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]

RE: Idle thread trying to sleep



On 06-Jul-2001 Trenton D. Adams wrote:
> This is what I'm doing.  I'm trying to delay 300ms inside a function.
> This function is called in response to an interrupt.  Can I not delay
> from within a DSR?  How would I delay without using the cyg_thread_delay
> () function?  How am I supposed to know that I'm delaying the right
> amount of time if I can't use cyg_thread_delay ()?

You can't do anything which blocks, including sleeping, in a DSR since
DSRs are run anonymously.

The way to solve this is to have your DSR control a separate thread which
can sleep, etc.

Look at the CF ethernet code for an example.  There is a separate thread
which is used to handle card events.  When a card is inserted, the DSR 
will cause the thread to run.  That thread can then do things like enable
power, etc, which must be sequenced.

Note: it might be nice to have this sort of functionality as part of the
generic CF/PCMCIA support, but at the current time it is associated with
the specific card driver.


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