public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CYGNUM_HAL_RTC_PERIOD
@ 2006-02-17 13:41 vasantha.rajan
  2006-02-17 22:18 ` Chuck McManis
  0 siblings, 1 reply; 8+ messages in thread
From: vasantha.rajan @ 2006-02-17 13:41 UTC (permalink / raw)
  To: ecos-discuss; +Cc: gary



Hi all,

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)

2. right now in my CDL(hal/arm/arm9/excalibur/v2_0b1/cdl) I have my
CYGNUM_HAL_RTC_NUMERATOR as  1000000000, CYGNUM_HAL_RTC_DENOMINATOR as
100. So the clock triggers for every 10000000 ns(ie,10000 us)

3. Now I changed my  CYGNUM_HAL_RTC_DENOMINATOR to 10000 so my clock will
trigger for every 100us.

4. So, In my cyg_alarm_initialize() API, if I use 25 + cyg_current_time() as
my trigger time value ,will the alarm function will be triggered in
25us????????or my calculation is wrong??????

Thank you very much

Vasanth

-------------------------------------------------------



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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: [ECOS] CYGNUM_HAL_RTC_PERIOD
@ 2006-02-17 14:11 Àlex Bueno Guarner
  0 siblings, 0 replies; 8+ messages in thread
From: Àlex Bueno Guarner @ 2006-02-17 14:11 UTC (permalink / raw)
  To: vasantha.rajan, ecos-discuss; +Cc: gary


	I think that if your clock triggers every 100us, it's not possible to trigger the alarm for 25us.

	When you initialize an alarm, the value you pass to cyg_alarm_initialize must be in the units the system uses. As you are using a clock with a trigger of 100us, the time value is calculated in increments of 100us. 

	If you want to be able to use delays of "us", the timer must be configured to trigger every "us". Depending on the hardware used, this frequency of ints can make the system not to work properly, because the timer interrupt calls some kernel functions. Be aware.

	Maybe there is another way to give "us" precision to the system, but I don't know.

	Alex Bueno



-----Mensaje original-----
De: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@ecos.sourceware.org] En nombre de vasantha.rajan
Enviado el: viernes, 17 de febrero de 2006 14:41
Para: ecos-discuss@ecos.sourceware.org
CC: gary@mlbassoc.com
Asunto: [ECOS] CYGNUM_HAL_RTC_PERIOD



Hi all,

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)

2. right now in my CDL(hal/arm/arm9/excalibur/v2_0b1/cdl) I have my CYGNUM_HAL_RTC_NUMERATOR as  1000000000, CYGNUM_HAL_RTC_DENOMINATOR as 100. So the clock triggers for every 10000000 ns(ie,10000 us)

3. Now I changed my  CYGNUM_HAL_RTC_DENOMINATOR to 10000 so my clock will trigger for every 100us.

4. So, In my cyg_alarm_initialize() API, if I use 25 + cyg_current_time() as my trigger time value ,will the alarm function will be triggered in 25us????????or my calculation is wrong??????

Thank you very much

Vasanth

-------------------------------------------------------



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



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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [ECOS] CYGNUM_HAL_RTC_PERIOD
@ 2006-02-22  9:03 vasantha.rajan
  2006-02-22  9:32 ` Andrew Lunn
  0 siblings, 1 reply; 8+ messages in thread
From: vasantha.rajan @ 2006-02-22  9:03 UTC (permalink / raw)
  To: gary, hud, cmcmanis; +Cc: ecos-discuss



On Tuesday 21 February 2006 15:09, you wrote:

Hi Dirk ,

Thanks for your reply......

In my previous mail I asked one more question.....but did'nt get reply.

I will give a test code....

int count =1;

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);
 }

 1. I made  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 given to cyg_alarm_initialize() API to 10000 my alarm
triggered for every 0.1 sec ie, my code
 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 1 my count only increments to 350
 only...why I am not getting the linear increment?????????


 Thanks
 Vasanth



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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-02-22  9:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-17 13:41 [ECOS] CYGNUM_HAL_RTC_PERIOD vasantha.rajan
2006-02-17 22:18 ` Chuck McManis
2006-02-21  5:10   ` vasantha.rajan
2006-02-21  7:54     ` Gary Thomas
     [not found]     ` <43FADFC7.90709@zurich.ibm.com>
     [not found]       ` <200602221019.24844.vasantha.rajan@cranessoftware.com>
2006-02-22  9:01         ` Dirk Husemann
2006-02-17 14:11 Àlex Bueno Guarner
2006-02-22  9:03 vasantha.rajan
2006-02-22  9:32 ` Andrew Lunn

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