Question
interrupt handling
Posted on March 16, 2012 at 13:33
i am using eCos for my app. i have STM3210E-EVAL board.
in my app there is one thread(toggle LED) and external interrupt on PG8. when button is pressed(PG8) another LED should blink once.but nothing...
unsigned
int
button_isr(cyg_vector_t vector,cyg_addrword_t data)
{
cyg_interrupt_mask(vector );
// Tell the processor that we have received
// the interrupt.
cyg_interrupt_acknowledge( vector );
// Tell the kernel that chained interrupt processing
// is done and the DSR needs to be executed next.
return
(CYG_ISR_CALL_DSR);
}
void
button_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
k=~k;
CYGHWR_HAL_STM32_GPIO_OUT(led_f6,k);
delay(100);
cyg_interrupt_unmask(vector);
}
void
threadA(cyg_addrword_t index)
{
while
(1)
{
CYGHWR_HAL_STM32_GPIO_OUT(led_f7,1);
cyg_thread_delay(500);
CYGHWR_HAL_STM32_GPIO_OUT(led_f7,0);
cyg_thread_delay(500);
}
}
int
main(
void
)
{
cyg_handle_t int1;
cyg_interrupt intr;
cyg_thread_create(15,threadA,0,
''threadA''
,&ON,STACK,&led_on,&led_on_obj);
//toggle LED
cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXTI8, 1, (cyg_addrword_t)0, &button_isr,&button_dsr, &int1, &intr);
// Set interrupt configuration
cyg_interrupt_configure(CYGNUM_HAL_INTERRUPT_EXTI8,0,1);
//rising edge.....
// level| up | interrupt on
// -----|-------|-----------------
// 0 | 0 | Falling Edge
// 0 | 1 | Rising Edge
// 1 | 0 | Low Level
// 1 | 1 | High Level
cyg_interrupt_attach(int1);
cyg_interrupt_enable();
cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXTI8);
cyg_thread_resume( led_on );
return
0;
} help...
thanks....
Filip
#ecos #exti #interrupt