public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Carlos Camargo <carlos_ivan_camargo@yahoo.com>
To: Jesper Skov <jskov@cambridge.redhat.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Redboot Questions
Date: Tue, 10 Jul 2001 03:28:00 -0000	[thread overview]
Message-ID: <20010710102801.83592.qmail@web14002.mail.yahoo.com> (raw)
In-Reply-To: <ot66d1umk8.fsf@zoftcorp.adsl.dk>

> Carlos> Exists any problem with spurious interrupts
> an CTRL-C
> Carlos> support???
> 
> Not understood.
> 
> Jesper

My question is:

Due that my interrupt source is EXT0 with the same
vector of spurious interrupt. This have any
problem????

I have the following program:


/****************************************************************
 *
 *	File		: counter.c
 *	Description	: Segment Display Programm 
 *	Author 		: Carlos Camargo
 *	Date		: 22/06/2001
 *

****************************************************************/
#include <cyg/kernel/kapi.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <cyg/hal/hal_intr.h>

#include "segment.h"
#define SYSCFG		0x03ff0000
#define IOPMOD          ((volatile unsigned
*)(SYSCFG+0x5000))
#define IOPDATA         ((volatile unsigned
*)(SYSCFG+0x5008))
#define FOREVER		(1)	

cyg_thread thread_s[2];				/* space for two thread
objects */

char stack[2][4096];				/* space for two 4K stacks */

cyg_handle_t simple_threadA, simple_threadB;	/*
handles for the thread */

cyg_thread_entry_t program_A, program_B;	/* variables
for the procedure which is the thread */

cyg_handle_t int_0_ISR_H;

cyg_interrupt intr;

int toggle = 0;



cyg_uint32 int_0_isr(cyg_vector_t
vector,cyg_addrword_t data)
 {
   /* ISRs must acknowledge the interrupt, or they
might be invoked again */
   cyg_interrupt_acknowledge(vector);
   return CYG_ISR_CALL_DSR;
 }

			
 /* this is the DSR for ext 0 interrupts */
 void int_0_dsr(cyg_vector_t vector, cyg_ucount32
count, cyg_addrword_t data)
 {
     if ( toggle == 0){
     	cyg_thread_suspend( simple_threadA );
	cyg_thread_resume( simple_threadB );
	toggle = 1;
     }
     else {
     	cyg_thread_suspend		( simple_threadB );
	cyg_thread_resume ( simple_threadA );
	toggle = 0;
     }     
 }


static unsigned int numeric_display [16] = 
{
	DISP_0,	DISP_1,	DISP_2,	DISP_3,	DISP_4,
	DISP_5,	DISP_6,	DISP_7,	DISP_8,	DISP_9,
	DISP_A,	DISP_B,	DISP_C,	DISP_D,	DISP_E,
	DISP_F
};	

void cyg_user_start(void)
{
//  printf("Entering test' cyg_user_start()
function\n");
  
//  printf("Create Thread_A and Thread_B\n");


  cyg_thread_create(4, program_A, (cyg_addrword_t)
'A',
		    "Thread A", (void *) stack[0], 4096,
		    &simple_threadA, &thread_s[0]);
 
  cyg_thread_create(4, program_B, (cyg_addrword_t)
'B',
		    "Thread B", (void *) stack[1], 4096,
		    &simple_threadB, &thread_s[1]);

  /* create an interrupt handler with int_0_isr() as
the ISR and int_0_dsr() as the DSR.*/
  cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXT0, 0,
0, &int_0_isr,
                       &int_0_dsr, &int_0_ISR_H,
&intr);
	

  cyg_interrupt_attach(int_0_ISR_H);		    
  cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXT0);
  cyg_thread_resume(simple_threadB);
}


void program_A(cyg_addrword_t data)
{
  char message =  data;
  int seg;

  while ( FOREVER ){
    for ( seg=0xf; seg>=0; seg--) {
      if ( (seg >= 0) & (seg <= 0xf) ){
        *IOPDATA &= ~SEG_MASK;
	*IOPDATA |= numeric_display[seg];
      }
      cyg_thread_delay(100);
    }
  }
}

void program_B(cyg_addrword_t data)
{
  char message =  data;
  int seg;

//  printf("Beginning execution; thread data is %c\n",
message);
  
  while ( FOREVER ){
    for ( seg=0; seg<=0xf; seg++) {
      if ( (seg >= 0) & (seg <= 0xf) ){
        *IOPDATA &= ~SEG_MASK;
	*IOPDATA |= numeric_display[seg];
      }
      cyg_thread_delay(100);
    }
  }
}

/****************************************************************
 * END OF counter.c

****************************************************************/

When i run this program from insight The thread
simple_threadB running correctly, but when i press the
external button attach to EXT0, no acurrs any
interrupt.

My code is good, or i have any error.

Thanks


Carlos Camargo









__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

  reply	other threads:[~2001-07-10  3:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-10  2:29 Carlos Camargo
2001-07-10  3:05 ` Jesper Skov
2001-07-10  3:28   ` Carlos Camargo [this message]
2001-07-10  3:57     ` Jesper Skov
2001-07-10 10:31     ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010710102801.83592.qmail@web14002.mail.yahoo.com \
    --to=carlos_ivan_camargo@yahoo.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=jskov@cambridge.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).