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]

Interrupt on ARM


Hi !
I'm trying to handle hardware interrupt from external IRQ lines on ARM E7T,
using ecos kernel API :
- void cyg_interrupt_create
- void cyg_interrupt_attach
- void cyg_interrupt_enable
- etc...
but without success.
Where can I find a simple example of source code ?
Below is an abstract of my code :
-----------------------------------------------------
/* ISR interrupt handler */
cyg_uint32 myISR(cyg_vector_t vector, cyg_addrword_t data)
{
	if(*INTPND & (1<<INT_SW3_NUM)){
		// clear interrupt pending IRQ0
		*INTPND |= INT_SW3_MASK;
		flag = 1;
	}
	else if(*INTPND){
		*INTPND = 0x1fffff;
		flag = 2;
	}
	cyg_interrupt_acknowledge(vector);
	return 0;
}

void myDSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{

}
void thread(cyg_addrword_t data)
{
	int led1=0, led2=0;
	cyg_handle_t handle;
	cyg_interrupt intr;

	//printf("Entering simpleirq' thread() function\n");
	*IOPMOD |=0xF0;
	*IOPCON = (IO_ENABLE_INT0 | IO_ACTIVE_HIGH_INT0 | IO_RISING_EDGE_INT0);
	/* masquer toutes les it */
	*INTMSK = 0x3fffff;
	/* demasquer G et IRQ0 */
	*INTMSK &= ~((1<<INT_GLOBAL) | (1<<INT_SW3_NUM));


	cyg_interrupt_create((cyg_vector_t)CYGNUM_HAL_VECTOR_IRQ, 0, 0, myISR,
myDSR, &handle, &intr);
	cyg_interrupt_attach(handle);
	*INTPND= 0x1fffff;
	cyg_interrupt_enable();
	cyg_interrupt_unmask((cyg_vector_t)CYGNUM_HAL_VECTOR_IRQ);
	for(;;){
	  while(flag==0);
      if(flag==1){
		  if(led1)led1=0; else led1=1;
	  }
	  else if (flag==2){
		  if(led2)led2=0; else led2=1;
	  }
		SetLEDs((led2<<1) + led1)  ;
	  flag=0;
	}
	cyg_interrupt_mask((cyg_vector_t)CYGNUM_HAL_VECTOR_IRQ);
	cyg_interrupt_disable();
	cyg_interrupt_delete(handle);

	*IOPCON &= ~(IO_ENABLE_INT0 | IO_ACTIVE_HIGH_INT0 | IO_RISING_EDGE_INT0);
	/* masquer G et IRQ0 */
	*INTMSK |= ((1<<INT_GLOBAL) | (1<<INT_SW3_NUM));
}
--
Jacques Ehrlich | LIVIC (INRETS-LCPC) |
http://www.lcpc.fr
Laboratoire sur les Interactions Véhicules, Infrastructure, Conducteurs
tel:33(0)1 4043 2903 | fax:33(0)1 4043 2930 | mob:33(0)6 6336 9499
---



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


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