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

Re: [MiNT] sleep() and wake() in device drivers

> [snip]
>  No, you've got it wrong :) the call is like this; sleep(queue,cond). That
> is, put the current process to sleep on the given queue, waiting for
> 'cond' to happend.
>  So, after putting a process (or many) to sleep with , for example,
> sleep(IO_Q,&busy), you will wake all processes sleeping on the IO queue,
> waiting for 'cond' &busy with wake(IO_Q,&busy). You can look at the second
> parameter (the &busy parameter) as some kind of ID by which you can select
> what to wake on the given queue. The use of address in most xdd's is to
> make sure a unique condition (or sleep ID, as I like to look at it), so
> that other wake calls don't accidentally wake other processes too. The
> contents at &busy makes no difference at all...

Thanks Odd. I think I should be able to make it work now...
(although, I was wondering... what if a part of the kernel, like MiNTNet's
slip.xif, is the process reading/writing the device?)

There are actually a couple more points about which I am not sure...
(ok, so I was wrong when I said I thought I had figured out most of it ;)
- does the .xdd need to initialize any fields of the `struct tty'
 whose pointer it stores in f->devinfo and the dev_descr struct?
- the tty devices in the kernel seem to do their `normal' io  in units of 4
 bytes of which only the last is significant; is this true also for external
 tty drivers? 
 It seems not to be true from what tests I have done, i.e. ser_write() reports 
 that bytes is equal to the number which my little test program passes to 

Thanks again