[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MiNT device drivers



Hello Juergen,

>  there is still the problem you cannot call wake() directly from
> interrupts...  should we fix that?  like add some iwake() that just
> puts it on a list thats processed somewhere at top of sleep?
> 
>  of course you can already use addroottimeout but thats a bit of
> overhead just to queue a call to wake(), and the wake would take effect
> one sleep() later.

This is rather contrived. An interrupt handler should be able to call
safely wakeselect() and wake() (to wake up any sleeping process waiting
for data) and kill() (when connections are established/lost, or a break
or ^C, ^\ etc is received). I don't think we need other kernel functions
to be interrupt-safe. 

Ideally, the interrupt handler should do the biggest part of the work
(raising signals, waking up sleeping processes) while the device-driver
functions read() and write() would only read from (write to) some buffer,
putting the process to sleep when the buffer is empty (full).

Of course, the "right way" to do things would be to inspire ourselves of
what is described in the daemon book (4.3), Chapter 9 -- terminal handling.
What makes modm0dev complicated and kludgy is that it's a tty device;
raw devices are cleanly handled by MiNT.

Thierry.