public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Uwe Kindler" <ukindler@htwm.de>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS] CYGACC_CALL_IF_DELAY_US(1000000) fails
Date: Tue, 25 Nov 2003 14:09:00 -0000	[thread overview]
Message-ID: <000d01c3b35e$37e04c10$2c79378d@uwepc> (raw)

Hello,

if I call  CYGACC_CALL_IF_DELAY_US(1000000) in order to delay one second,
then this call returns a lot
faster then 1 second. When I debug the code, then I can see, that
HAL_DELAY_US provided by the HAL
is only used if no kernel package is included. HAL_DELAY_US(1000000) works
fine.

If the kernel package is included, the the following calculation takes
place:

// How many ticks total we should wait for.
        usec_ticks = usecs*CYGNUM_KERNEL_COUNTERS_RTC_PERIOD;

The RTC period for the EDOSK board is 20625. The board runs with 33 Mhz and
the 16 Bit timer is driven
with a prescaler of 16 - timer clock is 33Mhz/16 = 2062500. We would like to
interrupt 100 times per second
2062500 / 100 = 20625.

If I now delay 1 second, usec_ticks is calculated usec_tick = 1000000 *
20625 - this is larger than int32.

In the reference manual is written:
While most of the time this function is called with very small values,
occasionally
(particularly in some ethernet drivers) it is called with values of several
seconds.

So what can I do - if I use larger timer prescale values in order to lower
the timer period I will never get exactly 100 Hz for the timer clock.

Best Regards, Uwe


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

                 reply	other threads:[~2003-11-25 14:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='000d01c3b35e$37e04c10$2c79378d@uwepc' \
    --to=ukindler@htwm.de \
    --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).