This is the mail archive of the ecos-discuss@sourceware.org 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: CYGNUM_HAL_RTC_PERIOD


On Saturday 18 February 2006 03:47, you wrote:
> At 05:40 AM 2/17/2006, vasantha.rajan wrote:

Hi Chuck,
thanks for your reply....

I have something to ask..sorry for the lengthy mail below.

1. when I changed my CYGNUM_HAL_RTC_DENOMINATOR value to 1000000, (so that my 
clock will trigger for 1us) but in my code after the end of cyg_user_start() 
my code got struck (ie the thread  I created did'nt execute) Why??????

I will just give my test code below:

void alarm_handler( cyg_handle_t alarm_handle, cyg_addrword_t data )  
{ 
	printf("value of count:%d\n",count++);
	cyg_flag_setbits(&flag,pattern);
}  

void counter_thread(cyg_addrword_t data)
{
	while(1)
	{
    	value = 0xfffffffe;
	pattern = 1;
	mode=CYG_FLAG_WAITMODE_OR ;
	cyg_flag_maskbits(&flag,value);
	
	cyg_alarm_initialize( alarm_hdl, 100 + cyg_current_time(), 0 ); 
	value=cyg_flag_wait(&flag,pattern,mode);	
	}
}  
  
 void cyg_user_start()
{ 
  	sys_clk = cyg_real_time_clock();
    	cyg_clock_to_counter( sys_clk, &counter_hdl ); 
	 cyg_alarm_create( counter_hdl, alarm_handler, (cyg_addrword_t)&index1,     	
&alarm_hdl, &alarm_obj );	 
	cyg_thread_create(10, &counter_thread, 0 ,"counter_thread", stack, STACKSIZE, 
&handle, &thread);
	cyg_thread_resume(handle);
} 
	 
2. when I reduced my  CYGNUM_HAL_RTC_DENOMINATOR to 100000, (so that my clock 
will trigger for 10us) and in my code if i initialize my alarm to
cyg_alarm_initialize( alarm_hdl, 100000+ cyg_current_time(), 0 ), my alarm 
triggered for every 1 sec.

If I reduce my value to 10000 my alarm triggered for every 0.1 sec ie, my 
count value increments to 10 for every second and still if reduce my value to 
1000 count value increments to 100 for every second,but if I still reduce my 
value to 100 ,I expected the count value should increment to 1000,but the 
count value increments upto some 350 approx.

and if i still reduce my value to 10 or 1my count only increments to 350 
only...why I am not getting the linear increment?????????


Thanks 
Vasanth

> >I have some doubt in CYGNUM_HAL_RTC_PERIOD. I will list my doubts
> >
> >1. In my code I just want to trigger my alarm for some micro seconds (say
> > for 25 us)
>
> That is a very short time for most systems. Yours especially.
>
> Ignoring other aspects (like how the RTC timer is configured) for the
> moment, realize that on average the ARM9 achieves about 1.5 cycles per
> instruction. (This from the ARM9 FAQ) and that when clocked at 150Mhz
> (which the Excalibur board apparently is) that's roughly 100 million
> instructions per section. So 25 micro seconds is roughly 2500 instructions.
> At 3 instructions per line of C code (on average) that's about 833 lines of
> C code between clock ticks.
>
> Perhaps you need some specialized hardware to meet this timing requirement?
>
> --Chuck



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]