* [ECOS] Re: CYGACC_CALL_IF_DELAY_US(1000000) fails
@ 2003-11-25 14:28 Savin Zlobec
2003-11-25 14:56 ` Gary Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Savin Zlobec @ 2003-11-25 14:28 UTC (permalink / raw)
To: ukindler; +Cc: ecos-discuss
Uwe Kindler wrote:
>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;
>
>
This is already fixed in CVS.
PS:
There are better ways to wait for 1 second if you are using the kernel -
CYGACC_CALL_IF_DELAY_US is a busy wait.
savin
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] Re: CYGACC_CALL_IF_DELAY_US(1000000) fails
2003-11-25 14:28 [ECOS] Re: CYGACC_CALL_IF_DELAY_US(1000000) fails Savin Zlobec
@ 2003-11-25 14:56 ` Gary Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 2003-11-25 14:56 UTC (permalink / raw)
To: Savin Zlobec; +Cc: ukindler, ecos-discuss
On Tue, 2003-11-25 at 07:31, Savin Zlobec wrote:
> Uwe Kindler wrote:
>
> >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;
> >
> >
> This is already fixed in CVS.
>
> PS:
>
> There are better ways to wait for 1 second if you are using the kernel -
> CYGACC_CALL_IF_DELAY_US is a busy wait.
Indeed - first of all, CYGACC_CALL_IF_DELAY_US should really only be
used for "short" periods. Often devices may have requirements like
"the reset pulse should be true for 25us" or whatever. In this case,
the busy wait code (DELAY_US) is the correct way to go.
If you have the kernel package (i.e. threads), then use
cyg_thread_delay(100);
to wait for one second.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-25 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-25 14:28 [ECOS] Re: CYGACC_CALL_IF_DELAY_US(1000000) fails Savin Zlobec
2003-11-25 14:56 ` Gary Thomas
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).