This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: cyg_alarm_initialize() description is wrong in eCos reference.


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


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