Chris Holgate <[EMAIL PROTECTED]> writes: > > Polled operation works, but I'm going to have to sprinkle a few > preprocessor directives in there to get rid of my calls to the kernel > flags API. Is there any reason why flags support didn't make it into > the standard driver API? I find that it's much more elegant than using > condition variables in a lot of cases.
The driver API is meant to be simple and reflect how drivers should be used. Each driver is responsible for managing its own concurrency so it needs to use mutexes anyway. When a thread in the driver must wait for an interrupt it must release the mutex, a condition variable provides exactly the necessary functionality. Flags are too complicated to be used at driver level, and too prone to errors and race conditions. I suggest you take a look at the AT91 driver for an example of how an SPI driver should work. -- Nick Garnett eCos Kernel Architect eCosCentric Limited http://www.eCosCentric.com The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No: 4422071