From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20125 invoked by alias); 22 Nov 2008 12:53:36 -0000 Received: (qmail 19946 invoked by uid 22791); 22 Nov 2008 12:53:34 -0000 X-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BARRACUDA_BRBL,BAYES_00,SARE_PROLOSTOCK_SYM3,SPF_PASS X-Spam-Check-By: sourceware.org Received: from nicola.2020media.com (HELO nicola.2020mail.com) (212.124.192.216) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 22 Nov 2008 12:52:52 +0000 Received: from [212.124.199.38] (helo=[192.168.0.2]) by nicola.2020mail.com with esmtp (Exim 4.22) id 1L3ryD-000DGX-Or; Sat, 22 Nov 2008 12:52:17 +0000 Subject: Re: STM32 - I/O pullup and EXTI issues, plus new SPI driver. From: Chris Holgate To: Nick Garnett Cc: ecos-devel@ecos.sourceware.org In-Reply-To: References: <1227280292.8476.47.camel@hercules.zynaptic.com> <1227287580.8476.74.camel@hercules.zynaptic.com> Content-Type: text/plain Organization: Zynaptic Limited Date: Sat, 22 Nov 2008 12:53:00 -0000 Message-Id: <1227358709.19034.11.camel@hercules.zynaptic.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1.1 Content-Transfer-Encoding: 7bit X-2020-Relay: Sent using 2020MEDIA.net.uk relay with auth code: Send Abuse reports to abuse@2020media.net.uk X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2008-11/txt/msg00057.txt.bz2 On Fri, 2008-11-21 at 17:34 +0000, Nick Garnett wrote: > Chris Holgate 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.