From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22842 invoked by alias); 21 Nov 2008 17:35:37 -0000 Received: (qmail 22794 invoked by uid 22791); 21 Nov 2008 17:35:37 -0000 X-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SARE_PROLOSTOCK_SYM3 X-Spam-Check-By: sourceware.org Received: from lon1-post-3.mail.demon.net (HELO lon1-post-3.mail.demon.net) (195.173.77.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Nov 2008 17:34:44 +0000 Received: from calivar.demon.co.uk ([83.104.54.243] helo=xl5.calivar.com) by lon1-post-3.mail.demon.net with esmtp (Exim 4.69) id 1L3Ztw-0003u8-fb; Fri, 21 Nov 2008 17:34:40 +0000 Received: from xl5.calivar.com (localhost [127.0.0.1]) by xl5.calivar.com (Postfix) with ESMTP id 3296D138764; Fri, 21 Nov 2008 17:34:40 +0000 (GMT) To: Chris Holgate Cc: ecos-devel@ecos.sourceware.org Subject: Re: STM32 - I/O pullup and EXTI issues, plus new SPI driver. References: <1227280292.8476.47.camel@hercules.zynaptic.com> <1227287580.8476.74.camel@hercules.zynaptic.com> From: Nick Garnett Original-Sender: nickg@ecoscentric.com Date: Fri, 21 Nov 2008 17:35:00 -0000 In-Reply-To: <1227287580.8476.74.camel@hercules.zynaptic.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00053.txt.bz2 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. 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