This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: cyg_alarm_initialize() description is wrong in eCos reference.
- From: John Dallaway <john at dallaway dot org dot uk>
- To: Grant Edwards <grant dot b dot edwards at gmail dot com>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 25 Feb 2010 08:50:55 +0000
- Subject: [ECOS] Re: cyg_alarm_initialize() description is wrong in eCos reference.
- References: <hm3ult$uv6$1@dough.gmane.org>
Hi Grant
Grant Edwards wrote:
> I've been trying to use an alarm, and after a couple hours of
> experimentation I've concluded that in the eCos reference the
> description of cyg_alarm_initialize()'s second parameter is
> wrong. In the reference it says:
>
> The second argument indicates the number of events, for
> example clock ticks, that need to occur before the alarm
> triggers.
>
> AFAICT, that's not correct. Experimentation seems to indicate
> that parameter is the counter value at which the alarm
> triggers, _not_ the number of events that will occur before the
> alarm triggers.
>
> If you want the alarm to trigger after N events, the reference
> would lead you to believe you pass N. But, in reality you have
> to pass the N+C where C is the current value of the counter.
Good catch. cyg_alarm_initialize() takes an absolute trigger value. This
allows you to re-arm the alarm conditionally (based on some
application-specific calculation) and still be sure that the alarm
intervals will be equally spaced.
I will fix the doc...
John Dallaway
eCos maintainer
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss