⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbs_sa11x0.sgml

📁 Sa11的USB驱动
💻 SGML
字号:
<!-- DOCTYPE refentry  PUBLIC "-//OASIS//DTD DocBook V3.1//EN" --><!-- {{{ Banner                         --><!-- =============================================================== --><!--                                                                 --><!--     usbs_sa11x0.sgml                                            --><!--                                                                 --><!--     Documentation for the SA11x0 USB Device Driver.             --><!--                                                                 --><!-- =============================================================== --><!-- ####COPYRIGHTBEGIN####                                          --><!--                                                                 --><!-- =============================================================== --><!-- Copyright (C) 2001, 2002 Red Hat, Inc.                          --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/)                            --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission obtained from the copyright holder                   --><!-- =============================================================== --><!--                                                                 -->      <!-- ####COPYRIGHTEND####                                            --><!-- =============================================================== --><!-- #####DESCRIPTIONBEGIN####                                       --><!--                                                                 --><!-- Author(s):   bartv                                              --><!-- Contact(s):  bartv                                              --><!-- Date:        2001/01/11                                         --><!-- Version:     0.01                                               --><!--                                                                 --><!-- ####DESCRIPTIONEND####                                          --><!-- =============================================================== --><!-- }}} --><part id="devs-usb-sa11x0-ref"><!-- reference id="devs-usb-sa11x0-ref" -->  <title>SA11X0 USB Device Driver</title><refentry id="devs-usb-sa11x0"><refmeta><refentrytitle>SA11X0 USB Device Driver</refentrytitle></refmeta><refnamediv><refname>SA11X0 USB Support</refname><refpurpose>Device driver for the on-chip SA11X0 USB device</refpurpose></refnamediv><refsect1><title>SA11X0 USB Hardware</title><para>The Intel StrongARM SA11x0 family of processors is supplied with anon-chip USB slave device, the UDC (USB Device Controller). Thissupports three endpoints. Endpoint 0 can only be used for controlmessages. Endpoint 1 can only be used for bulk transfers from host toperipheral. Endpoint 2 can only be used for bulk transfers fromperipheral to host. Isochronous and interrupt transfers are notsupported.</para><caution>    <para>Different revisions of the SA11x0 silicon have had various problemswith the USB support. The device driver has been tested primarilyagainst stepping B4 of the SA1110 processor, and may not function asexpected with other revisions. Application developers should obtainthe manufacturer's current errata sheets and specification updates.The B4 stepping still has a number of problems, but the device drivercan work around these. However there is a penalty in terms of extracode, extra cpu cycles, and increased dispatch latency because extraprocessing is needed at DSR level. Interrupt latency should not beaffected.</para><para>There is one specific problem inherent in the UDC design of whichapplication developers should be aware: the hardware cannot fullyimplement the USB standard for bulk transfers. A bulk transfertypically consists of some number of full-size 64-byte packets and isterminated by a packet less than the full size. If the amount of datatransferred is an exact multiple of 64 bytes then this requires aterminating packet of 0 bytes of data (plus header and checksum). TheSA11x0 USB hardware does not allow a 0-byte packet to be transmitted,so the device driver is forced to substitute a 1-byte packet and thehost receives more data than expected. Protocol support is needed sothat the appropriate host-side device driver can allow buffer spacefor the extra byte, detect when it gets sent, and discard it.Consequently certain standard USB class protocols cannot beimplemented using the SA11x0, and therefore custom host-side devicedrivers will generally have to be provided, rather than re-usingexisting ones that understand the standard protocol.</para></caution></refsect1><refsect1><title>Endpoint Data Structures</title><para>The SA11x0 USB device driver can provide up to three data structurescorresponding to the three endpoints: a<structname>usbs_control_endpoint</structname> structure<literal>usbs_sa11x0_ep0</literal>; a<structname>usbs_rx_endpoint</structname><literal>usbs_sa11x0_ep1</literal>; and a<structname>usbs_tx_endpoint</structname><literal>usbs_sa11x0_ep2</literal>. The header file<filename class="headerfile">cyg/io/usb/usbs_sa11x0.h</filename>provides declarations for these.</para><para>Not all applications will require support for all the endpoints. Forexample, if the intended use of the UDC only involves peripheral tohost transfers then <literal>usbs_sa11x0_ep1</literal> is redundant.The device driver provides configuration options to control thepresence of each endpoint:</para><orderedlist><listitem><para>Endpoint 0 is controlled by<literal>CYGFUN_DEVS_USB_SA11X0_EP0</literal>. This defaults toenabled if there are any higher-level packages that require USBhardware or if the global preference<literal>CYGGLO_IO_USB_SLAVE_APPLICATION</literal> is enabled,otherwise it is disabled. Usually this has the desired effect. It maybe necessary to override this in special circumstances, for example ifthe target board uses an external USB chip in preference to the UDCand it is that external chip's device driver that should be usedrather than the on-chip UDC. It is not possible to disable endpoint 0and at the same time enable one or both of the other endpoints, sincea USB device is only usable if it can process the standard controlmessages.</para></listitem><listitem><para>Endpoint 1 is controlled by<literal>CYGPKG_DEVS_USB_SA11X0_EP1</literal>. By default it isenabled whenever endpoint 0 is enabled, but it can be disabledmanually when not required.</para></listitem><listitem><para>Similarly endpoint 2 is controlled by<literal>CYGPKG_DEVS_USB_SA11X0_EP2</literal>. This is also enabled bydefault whenever endpoint 0 is enabled, but it can be disabled manually.</para></listitem></orderedlist><para>The SA11X0 USB device driver implements the interface specified by thecommon eCos USB Slave Support package. The documentation for thatpackage should be consulted for further details. There is only onemajor deviation: when there is a peripheral to host transfer onendpoint 2 which is an exact multiple of the bulk transfer packet size(usually 64 bytes) the device driver has to pad the transfer with oneextra byte. This is because of a hardware limitation: the UDC isincapable of transmitting 0-byte packets as required by the USBspecification. Higher-level code, including the host-side devicedriver, needs to be aware of this and adapt accordingly.</para><para>The device driver assumes a bulk packet size of 64 bytes, so thisvalue should be used in the endpoint descriptors in the enumerationdata provided by application code. There is experimental codefor running with <link linkend="usbs-sa11x0-dma">DMA disabled</link>,in which case the packet size will be 16 bytes rather than 64.</para></refsect1><refsect1><title>Devtab Entries</title><para>In addition to the endpoint data structures the SA11X0 USB devicedriver can also provide devtab entries for each endpoint. This allowshigher-level code to use traditional I/O operations such as<function>open</function>/<function>read</function>/<function>write</function>rather than the USB-specific non-blocking functions like<function>usbs_start_rx_buffer</function>. These devtab entries areoptional since they are not always required. The relevantconfiguration options are<literal>CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY</literal>,<literal>CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY</literal> and<literal>CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY</literal>. By defaultthese devtab entries are provided if the global preference<literal>CYGGLO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES</literal> is enabled,which is usually the case. Obviously a devtab entry for a givenendpoint will only be provided if the underlying endpoint is enabled.For example, there will not be a devtab entry for endpoint 1 if<literal>CYGPKG_DEVS_USB_SA11X0_EP1</literal> is disabled.</para><para>The names for the three devtab entries are determined by using aconfigurable base name and appending <literal>0c</literal>,<literal>1r</literal> or <literal>2w</literal>. The base name isdetermined by the configuration option<literal>CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME</literal> and has adefault value of <literal>/dev/usbs</literal>, so the devtab entry forendpoint 1 would default to <literal>/dev/usbs1r</literal>. If thetarget hardware involves multiple USB devices then applicationdevelopers may have to change the base name to prevent a name clash.</para></refsect1><refsect1><title id="usbs-sa11x0-dma">DMA Engines</title><para>The SA11X0 UDC provides only limited fifos for bulk transfers onendpoints 1 and 2; smaller than the normal 64-byte bulk packet size.Therefore a typical transfer requires the use of DMA engines. TheSA11x0 provides six DMA engines that can be used for this, and theendpoints require one each (assuming both endpoints are enabled). Atthe time of writing there is no arbitration mechanism to controlaccess to the DMA engines. By default the device driver will useDMA engine 4 for endpoint 1 and DMA engine 5 for endpoint 2, and itassumes that no other code uses these particular engines.</para><para>The exact DMA engines that will be used are determined by theconfiguration options<literal>CYGNUM_DEVS_USB_SA11X0_EP1_DMA_CHANNEL</literal> and<literal>CYGNUM_DEVS_USB_SA11X0_EP2_DMA_CHANNEL</literal>. Theseoptions have the booldata flavor, allowing the use of DMA to bedisabled completely in addition to controlling which DMA engines areused. If DMA is disabled then the device driver will attempt towork purely using the fifos, and the packet size will be limited toonly 16 bytes. This limit should be reflected in the appropriateendpoint descriptors in the enumeration data. The code for driving theendpoints without DMA should be considered experimental. At best itwill be suitable only for applications where the amount of datatransferred is relatively small, because four times as many interruptswill be raised and performance will suffer accordingly.</para></refsect1></refentry></part><!-- /reference -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -