This is the mail archive of the ecos-discuss@sources.redhat.com 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: On Alarms...


> Milind Kopikare wrote:
> > Hi,
> >    A few questions on alarms.
> >
> > 1> Are Alarms like interrupts? If so, what's the
> > priority? I've been using Alarms and they seem to stop
> > even the highest of priority tasks. But just curios on
> > how it's implemented internally. Is there a more
> > comprehensive doc to read up on this.
>
> Alarm's are called as a result of the kernel clock interrupt. As David
> says, this results in the alarm handlers being called in a DSR
> context, in
> this case from the clock DSR.
>
> > 2> I was trying to toggle between starting a thread
> > and suspending it using an Alarm.
> > void alarm_func(){
> >    if (thread is suspended)
> >        cyg_thread_resume
> >    else
> >        cyg_thread_suspend
> > }
> > But if I keep the Alarm resolution too small, say the
> > Alarm triggers every 2 ticks (2*10ms), the thread does
> > not resume. It's as if the scheduler is taking more
> > than 2 ms to start the thread. Any insight into what's
> > wrong? Ofcourse, if I give the ALARM resolution as
> > 100ms (10ticks), the thread toggles allright.
>
> Just on the off-chance, is the thread doing any diagnostic output,
> especially via GDB? If so, interrupts will be disabled while the
> output is
> performed which could easily be up to 2 ticks. Diagnostic output
> shouldn't
> be used for "real" applications - use proper interrupt-driven
> drivers instead.

Surely you have to apply the rule that no function which can potentially
block can be called in a DSR callback? I remember initially having quite a
few problems using interrupt driven driver calls in alarm callbacks, which
all went away when I followed the rules for DSR callbacks, as outlined in
http://sources.redhat.com/ecos/docs-latest/ref/ecos-ref.7.html#33307

Robert Cragie, Design Engineer
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
http://www.jennic.com  Tel: +44 (0) 114 281 2655
_______________________________________________________________
Visit our stand (C79) at DATE - Munich 4-6 March 2003
_______________________________________________________________


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


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