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]

Re: Problems with eCos clocks


Chris Sekula wrote:
> 
> 2. What is required to create and run a clock with a finer resolution
> than that of the real time clock?

You can't.

> Is the API for clocks and counters
> sufficient, or is it necessary to set a microprocessor timer and write
> an interrupt handler to handle the overflow of the timer and increment a
> counter appropriately?

If possible increase the resolution of the RTC.
 
> 3. I tried to modify the resolution of the real time clock in code by
> obtaining a handle to the RTC with cyg_real_time_clock() and then trying
> cyg_clock_set_resolution with the appropriate resolution. When I ran my
> test code, the while loop exited after about 5 seconds, corresponding to
> 500 ticks of 10 milliseconds per tick. Therefore, the function
> cyg_clock_set_resolution had no effect on changing the resolution of the
> real time clock. Is it possible to change the resolution of the RTC in
> code?

Setting the resolution of the RTC handle won't actually change the
frequency the hardware interrupts at. If anything, the resolution is simply
a consequence of the period. Setting the resolution is only interesting for
counters/clocks triggered indirectly off the underlying RTC.

> 4. Using the eCos Config Tool, Under the option 'ECos Kernel', 'Counters
> and clocks', I selected the option 'Override default clock settings' and
> then modified the clock resolution numerator and denominator to one
> billion and ten thousand respectively (I wasn't sure what to set the
> Clock Hardware Initialization value to, so I left it).

That initialization value is actually what you need to change. The correct
value is determined by your hardware.

> 5. I checked two of the include files generated by the Configuration
> Tool: \install\include\pkconfig\kernel.h and
> \install\include\pkconfig\hal_i386_pcmb.h. I noticed that the value of
> CYGNUM_HAL_RTC_DENOMINATOR retained the initial value of 100 as opposed
> to the new value of 10000 that I had set in the Config Tool. I manually
> changed the value of the denominator to 10000 and recompiled the code.
> My code produced the same result: an exit from the loop after 5 seconds.
> 
> 6. What steps are required to reconfigure the resolution of the Real
> Time Clock with the Configuration Tool?

Change the override value of the clock hardware initialization value. Look
at hal/i386/pcmb/current/src/pcmb_misc.c for the clock initialize code.
>From that, and a PC hardware book, you can determine the new value to use
for your application. Then you make the overridden numerator and
denominator for the RTC resolution reflect that new period.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


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