[ECOS] E7T timer0 interrupt issue ?

peter_ku peter_ku@issc.com.tw
Wed May 22 08:22:00 GMT 2002


I found the casue that I can't enter my ISR.
Because I use timer0,  if I change to timer1, everything is fine.
I guess eCos use timer0 to do something, right ???

If I have to use timer0 ISR to do something , what should I do?

Peter


-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of peter_ku
Sent: Tuesday, May 21, 2002 11:31 AM
To: ecos-discuss@sources.redhat.com
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)
{

}


More information about the Ecos-discuss mailing list