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.


On Fri, 2008-11-21 at 17:34 +0000, Nick Garnett wrote:
> 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.

Ok - I can see the point about keeping the driver API as simple as
possible, especially given that the flags functionality can easily be
emulated using the existing driver primitives.  Flags now expunged.

> I suggest you take a look at the AT91 driver for an example of how an
> SPI driver should work.

I think it's fair to say that there are already quite a few similarities
between the two drivers!

Chris.


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