public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
From: Nick Garnett <nickg@ecoscentric.com>
To: Chris Holgate <chris@zynaptic.com>
Cc: ecos-devel@ecos.sourceware.org
Subject: Re: STM32 - I/O pullup and EXTI issues, plus new SPI driver.
Date: Fri, 21 Nov 2008 17:35:00 -0000	[thread overview]
Message-ID: <m3d4gp2dao.fsf@xl5.calivar.com> (raw)
In-Reply-To: <1227287580.8476.74.camel@hercules.zynaptic.com>

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

  reply	other threads:[~2008-11-21 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 15:06 Chris Holgate
2008-11-21 15:15 ` Simon Kallweit
2008-11-21 15:52 ` Jonathan Larmour
2008-11-21 15:53 ` Nick Garnett
2008-11-21 17:08   ` Chris Holgate
2008-11-21 17:35     ` Nick Garnett [this message]
2008-11-22 12:53       ` Chris Holgate

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d4gp2dao.fsf@xl5.calivar.com \
    --to=nickg@ecoscentric.com \
    --cc=chris@zynaptic.com \
    --cc=ecos-devel@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).