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]

Re: E7T timer0 interrupt issue ?


Peter,
    As I knew, you can not invoke any interrupt in your "user_start"
program.
Only you can do that in driver.

Simon



----- Original Message -----
From: "peter_ku" <peter_ku@issc.com.tw>
To: <ecos-discuss@sources.redhat.com>
Sent: Tuesday, May 21, 2002 11:31 AM
Subject: [ECOS] E7T timer0 interrupt issue ?


> Hello,
>
> Target = E7T.
> I write a simple program to test timer0 interrupt, I want to toggle the
led every 1sec. But I can't enter my ISR.
> I can see the INTPND = 0x400, and also see my timer0 running!!
> Anyone can check the following code?
>
> thanks a lot
> Peter
>
>
> #define TOTAL_THREADS 1
>
> cyg_thread threads[TOTAL_THREADS];
>
> cyg_handle_t handle_thread_show_led;
> cyg_handle_t handle_timer0_isr;
>
> cyg_interrupt isr;
>
> char stack[TOTAL_THREADS][4096];
>
> cyg_thread_entry_t show_led_proc;
> cyg_ISR_t Timer0_ISR;
> cyg_DSR_t Timer0_DSR;
>
> void cyg_user_start(void)
> {
>   cyg_thread_create(4, show_led_proc , (cyg_addrword_t) 0 , "THREAD SHOW
LED", (void *) stack[0], 4096,
>   &handle_thread_show_led, &threads[0]);
>
>
>   cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_TIMER0,99,0,Timer0_ISR,
Timer0_DSR, &handle_timer0_isr, &isr);
>
>   cyg_interrupt_attach(handle_timer0_isr);
>
>   HAL_WRITE_UINT32(E7T_TDATA0,50000000);
>   HAL_WRITE_UINT32(E7T_TMOD,E7T_TMOD_TE0 | E7T_TMOD_TMD0);
>
>   cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_TIMER0);
>   cyg_interrupt_enable();
>
>
>   cyg_thread_resume(handle_thread_show_led);
>
>
> }
>
>
>
>
> void show_led_proc(cyg_addrword_t data)
> {
>
>    int i,j;
>    int temp_data;
>
>
>    HAL_READ_UINT32(E7T_IOPDATA,temp_data);
>    temp_data |= 0xf0;
>    HAL_WRITE_UINT32(E7T_IOPDATA,temp_data);
>
>    for( ; ; )
>    {
>      for( i =0 ; i < 10 ; i++)
>      {
>
>    HAL_READ_UINT32(E7T_IOPDATA,temp_data);
>    temp_data &= ~SEG_MASK;
>    temp_data |= numeric_display[i];
>    HAL_WRITE_UINT32(E7T_IOPDATA,temp_data);
>    for(j = 0; j < 10000000; j++) { }
>      }
>
>    }
>
> }
>
>
> cyg_uint32 Timer0_ISR(cyg_vector_t vector, cyg_addrword_t data)
> {
>
>    cyg_uint32 temp_data;
>    HAL_READ_UINT32(E7T_IOPDATA,temp_data);
>    temp_data ^= 0xf0;
>    HAL_WRITE_UINT32(E7T_IOPDATA,temp_data);
>
>    cyg_interrupt_acknowledge(vector);
>
>    return CYG_ISR_HANDLED;
> }
>
> void Timer0_DSR(cyg_vector_t vector,cyg_ucount32 count, cyg_addrword_t
data)
> {
>
> }


-- 
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]