From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24382 invoked by alias); 19 May 2009 15:44:35 -0000 Received: (qmail 24371 invoked by uid 22791); 19 May 2009 15:44:34 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from anika.2020media.com (HELO smtp.2020smtp.net) (212.124.192.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 May 2009 15:44:22 +0000 Received: from [212.124.199.38] (helo=[192.168.0.2]) by smtp.2020smtp.net with esmtp (Exim 4.63) (envelope-from ) id 1M6RUF-0005fk-Ry; Tue, 19 May 2009 16:44:15 +0100 Message-ID: <4A12D3CC.1070707@zynaptic.com> Date: Tue, 19 May 2009 15:44:00 -0000 From: Chris Holgate User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: Andrew Lunn CC: Simon Kallweit , ecos-devel@sourceware.org Subject: Re: STM32 USB support References: <4A11CAAA.8040900@intefo.ch> <4A11D861.8090206@zynaptic.com> <4A11E5DF.2000403@intefo.ch> <4A129C34.9090606@zynaptic.com> <20090519120004.GI20046@lunn.ch> In-Reply-To: <20090519120004.GI20046@lunn.ch> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2009-05/txt/msg00032.txt.bz2 Andrew Lunn wrote: > The AT91 USB driver has something similar to this. It can configure > the endpoints by looking at the USB descriptors. > I've just had a quick look back at the AT91, and while there's a certain degree of flexibility there, it's still limited to the particular configuration decreed by Atmel as far as buffer sizes, endpoint number etc. is concerned. With the STM32, ST seem to have taken the opposite approach - you have a chunk of buffer memory and 8 endpoint state machines. Beyond that you've got complete flexibility to choose how many endpoints you want - input or output (or bidirectional[1] if you don't need double buffering). You can also choose an arbitrary set of logical (ie visible to the host) endpoint IDs and buffer sizes. Given this flexibility, it seemed to be a bit of a waste to define a fixed standard configuration similar to the Atmel device. Instead, when the host sends the configuration select to the STM32 EP0 I intercept it and scan the descriptor data structures for a corresponding configuration. Using the descriptor configuration I can then set up the buffer memory and endpoint state machines 'on the fly' to correspond directly to the configuration requested by the host. All this gives the application specific driver layered on top of the STM32 driver complete freedom to specify one or more supported endpoint configurations. > I don't remember how it works with respect to devtab entries. Since the Atmel and other USB drivers have fixed endpoint configurations, it's reasonable to statically allocate and configure the devtab entries during the device init sequence. Unfortunately, this has obvious problems when using the dynamic configuration scheme described above. Chris. [1] I used the bidirectional mode for the control endpoint, but otherwise decided it was more bother than it was worth!