public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Larmour <jlarmour@redhat.com>
To: Chris Sekula <chriss@turnpikeglobal.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Problems with eCos clocks
Date: Thu, 06 Sep 2001 23:32:00 -0000	[thread overview]
Message-ID: <3B986A18.89148313@redhat.com> (raw)
In-Reply-To: <8669764C0A96B640AE8A6F5BB7C259D972FA@turnpdcf1.home.turnpikeglobal.com>

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

  reply	other threads:[~2001-09-06 23:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-29 14:19 Chris Sekula
2001-09-06 23:32 ` Jonathan Larmour [this message]
2001-08-31  6:44 [ECOS] Problems with eCos Clocks Chris Sekula
2001-09-05 11:11 [ECOS] Problems with eCos clocks Chris Sekula

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=3B986A18.89148313@redhat.com \
    --to=jlarmour@redhat.com \
    --cc=chriss@turnpikeglobal.com \
    --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).