public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "peter_ku" <peter_ku@issc.com.tw>
To: <ecos-discuss@sources.redhat.com>
Subject: RE: [ECOS] E7T timer0 interrupt issue ?
Date: Wed, 22 May 2002 08:22:00 -0000	[thread overview]
Message-ID: <000001c201a4$73ca5760$790114ac@issc.com.tw> (raw)
In-Reply-To: <000001c20077$f7e23320$790114ac@issc.com.tw>


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)
{

}

  parent reply	other threads:[~2002-05-22 15:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-15  7:24 [ECOS] GNU tools combination for eCos peter_ku
2002-05-20 18:53 ` Jonathan Larmour
2002-05-20 20:31   ` [ECOS] E7T timer0 interrupt issue ? peter_ku
2002-05-20 20:56     ` Simoncc
2002-05-21  7:34     ` Gary Thomas
2002-05-22  8:22     ` peter_ku [this message]
2002-05-28 12:28       ` Jonathan Larmour
2002-05-20 20:41   ` [ECOS] GNU tools combination for eCos peter_ku
2002-05-21  7:44     ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001c201a4$73ca5760$790114ac@issc.com.tw' \
    --to=peter_ku@issc.com.tw \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).