This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARm-AT91 External Interrupt


Hi..

At present i'm working with custom at91R40008 board..
I try to use the external interrupto but, i can't do
it..

Anyone have a sample of External IRQ in at91 ???

The code is:

****************************************************
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_mask(vector);
   cyg_interrupt_acknowledge(vector);
   return (CYG_ISR_HANDLED | 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)
 {
//   DELAY = 0xFFFFFF;
   cyg_uint32 dumy;
   serial ++;
   output = serial;
   HAL_READ_UINT32(AT91_PIO_ISR,dumy);
   cyg_interrupt_unmask(vector);
 }



....

/* we install our own startup routine which sets up
threads */
void cyg_user_start(void)
{

  cyg_mutex_init(&cliblock);

  cyg_thread_create(4, simple_program,
(cyg_addrword_t) 0,
		    "Thread A", (void *) stack, 4096,
		    &simple_threadA, &thread_s);


  /* 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_threadA);
}

/* this is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
	int n,x=0;

	output='&';

	HAL_WRITE_UINT32( AT91_PIO_IER, 0x00000200 );
	HAL_WRITE_UINT32( AT91_PIO_IDR, 0xFFFFFDFF );


......


Thanks for your comments...


Best regards


Carlos Camargo




		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]