AnsweredAssumed Answered

interrupt handling

Question asked by kantardzioski.filip on Mar 16, 2012
Latest reply on May 5, 2014 by huang.fakenerd
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...
01.unsigned int button_isr(cyg_vector_t vector,cyg_addrword_t data)
02.{
03.    cyg_interrupt_mask(vector );
04. 
05.    // Tell the processor that we have received
06.    // the interrupt.
07. 
08.    cyg_interrupt_acknowledge( vector );
09. 
10.// Tell the kernel that chained interrupt processing
11.// is done and the DSR needs to be executed next.
12.     return (CYG_ISR_CALL_DSR);
13.}
14. 
15.void button_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
16.{
17.        k=~k;
18.    CYGHWR_HAL_STM32_GPIO_OUT(led_f6,k);
19.        delay(100);
20.    cyg_interrupt_unmask(vector);
21.}
22. 
23. 
24.void threadA(cyg_addrword_t index)
25.{
26.    while(1)
27.    {
28.        CYGHWR_HAL_STM32_GPIO_OUT(led_f7,1);
29.            cyg_thread_delay(500);
30.            CYGHWR_HAL_STM32_GPIO_OUT(led_f7,0);
31.            cyg_thread_delay(500);
32.    }
33.}
34. 
35. 
36.int main( void )
37.{
38. 
39. cyg_handle_t int1;
40. cyg_interrupt intr;
41.   
42. 
43.  
44. 
45.  cyg_thread_create(15,threadA,0,"threadA",&ON,STACK,&led_on,&led_on_obj); //toggle LED
46. 
47.  cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXTI8, 1, (cyg_addrword_t)0, &button_isr,&button_dsr, &int1, &intr);
48.      // Set interrupt configuration
49.  cyg_interrupt_configure(CYGNUM_HAL_INTERRUPT_EXTI8,0,1); //rising edge.....
50.//    level|    up |    interrupt on
51.//    -----|-------|-----------------
52.//      0  |    0  |    Falling Edge
53.//      0  |    1  |    Rising Edge
54.//      1  |    0  |    Low Level
55.//      1  |    1  |    High Level
56. 
57.      
58.     cyg_interrupt_attach(int1);
59.     cyg_interrupt_enable();
60.      cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EXTI8);
61.      cyg_thread_resume( led_on );
62. return 0;
63.}
help...
thanks....
Filip

Outcomes