This is the mail archive of the ecos-devel@sourceware.org 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: STM32 - I/O pullup and EXTI issues, plus new SPI driver.


Chris Holgate <chris@zynaptic.com> 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


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