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

📄 usbs_upd985xx.sgml

📁 NEC的USB接口驱动
💻 SGML
字号:
<!-- DOCTYPE refentry  PUBLIC "-//OASIS//DTD DocBook V3.1//EN" --><!-- {{{ Banner                         --><!-- =============================================================== --><!--                                                                 --><!--     usbs_nec_upd9850x.sgml                                      --><!--                                                                 --><!--     Documentation for the NEC uPD9850x 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/05/22                                         --><!-- Version:     0.01                                               --><!--                                                                 --><!-- ####DESCRIPTIONEND####                                          --><!-- =============================================================== --><!-- }}} --><part id="devs-usb-nec-upd985xx-ref"><!-- reference id="devs-usb-nec-upd985xx-ref" -->  <title>NEC uPD985xx USB Device Driver</title><refentry id="devs-usb-nec-upd985xx"><refmeta><refentrytitle>NEC uPD985xx USB Device Driver</refentrytitle></refmeta><refnamediv><refname>NEC uPD985xx USB Support</refname><refpurpose>Device driver for the on-chip NEC uPD985xx USB device</refpurpose></refnamediv><refsect1><title>NEC uPD985xx USB Hardware</title><para>The NEC uPD985xx family of processors is supplied with an on-chip USBslave device, the UDC (USB Device Controller). This supports sevenendpoints. Endpoint 0 can only be used for control messages. Endpoints1 and 2 are for isochronous transmits and receives respectively.Endpoints 3 and 4 support bulk transmits and receives. Endpoints 5 and6 normally support interrupt transmits and receives, but endpoint 5 canalso be configured to support bulk transmits. At this time only thecontrol endpoint 0, the bulk endpoints 3 and 4, and the interruptendpoint 5 are supported.</para></refsect1><refsect1><title>Endpoint Data Structures</title><para>The uPD985xx USB device driver can provide up to four data structurescorresponding to the four supported endpoints: a<structname>usbs_control_endpoint</structname> structure<varname>usbs_upd985xx_ep0</varname>;<structname>usbs_tx_endpoint</structname> structures<varname>usbs_upd985xx_ep3</varname> and<varname>usbs_upd985xx_ep5</varname>; and a<structname>usbs_rx_endpoint</structname><varname>usbs_upd985xx_ep4</varname>. The header file<filename class="headerfile">cyg/io/usb/usbs_nec_upd985xx.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_upd985xx_ep4</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_UPD985XX_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 3 is controlled by<literal>CYGPKG_DEVS_USB_UPD985XX_EP3</literal>. By default thisendpoint is disabled: according to NEC erratum U3 there may beproblems when attempting bulk transfers of 192 bytes or greater. As analternative the device driver provides support for endpoint 5,configured to allow bulk transfers. Endpoint 3 can be enabled if theapplication only requires bulk transfers of less than 192 bytes, or ifthis erratum is not applicable to the system being developed for otherreasons.</para></listitem><listitem><para>Endpoint 4 is controlled by<literal>CYGPKG_DEVS_USB_UPD985XX_EP4</literal>. This is enabled bydefault whenever endpoint 0 is enabled, but it can be disabledmanually.</para></listitem><listitem><para>Endpoint 5 is controlled by<literal>CYGPKG_DEVS_USB_UPD985XX_EP5</literal>. This is enabled bydefault whenever endpoint 0 is enabled, but it can be disabledmanually. There is also a configuration option<literal>CYGIMP_DEVS_USB_UPD985XX_EP5_BULK</literal>, enabled bydefault. This option allows the endpoint to be used for bulktransfers rather than interrupt transfers.</para></listitem></orderedlist><para>The uPD985xx USB device driver implements the interface specified by thecommon eCos USB Slave Support package. The documentation for thatpackage should be consulted for further details. </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. The device driver also assumesa control packet size of eight bytes, and again this should bereflected in the enumeration data. If endpoint 5 is configured forinterrupt rather than bulk transfers then the maximum packet size islimited to 64 bytes by the USB standard.</para></refsect1><refsect1><title>Devtab Entries</title><para>In addition to the endpoint data structures the uPD985xx 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_UPD985XX_EP0_DEVTAB_ENTRY</literal>,<literal>CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY</literal>,<literal>CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY</literal>, and<literal>CYGVAR_DEVS_USB_UPD985XX_EP5_DEVTAB_ENTRY</literal>. Bydefault these 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 4 if<literal>CYGPKG_DEVS_USB_UPD985XX_EP4</literal> is disabled.</para><para>The names for the devtab entries are determined by using aconfigurable base name and appending <literal>0c</literal>,<literal>3w</literal>, <literal>4r</literal> or <literal>5w</literal>.The base name is determined by the configuration option<literal>CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME</literal> and has adefault value of <literal>/dev/usbs</literal>, so the devtab entry forendpoint 4 would default to <literal>/dev/usbs4r</literal>. If thetarget hardware involves multiple USB devices then applicationdevelopers may have to change the base name to prevent a name clashwith other USB device drivers.</para></refsect1><refsect1><title>Restrictions</title><para>The current device driver imposes a restriction on certain bulkreceives on endpoint 4. If the protocol being used involvesvariable-length transfers, in other words if the host is allowed tosend less data than a maximum-sized transfer, then the buffer passedto the device driver for receives must be aligned to a 16-bytecacheline boundary and it must be a multiple of this 16-byte cachelinesize. This restriction does not apply if the protocol only involvesfixed-size transfers.</para></refsect1><refsect1><title>Optional Hardware Workarounds</title><para>The NEC errata list a number of other problems that affect the USBdevice driver. The device driver contains workarounds for these, whichare enabled by default but can be disabled if the applicationdeveloper knows that the errata are not relevant to the system beingdeveloped.</para><para>Erratum S1 lists a possible problem if the device driver attemptsmultiple writes to the USB hardware. This is circumvented by adummy read operation after every write. If the workaround is notrequired then the configuration option<literal>CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT</literal> can be disabled.</para><para>Errata U3 and U4 describe various problems related to concurrenttransmissions on different endpoints. By default the device driverworks around this by serializing all transmit operations. For exampleif the device driver needs to send a response to a control message onendpoint 0 while there is an ongoing bulk transfer on endpoint 5, theresponse is delayed until the bulk transfer has completed. Undertypical operating conditions this does not cause any problems:endpoint 0 traffic usually happens only during initialization, whenthe target is connected to the host, while endpoint 5 traffic onlyhappens after initialization. However if transmit serialization isinappropriate for the system being developed then it can be disabledusing the configuration option<literal>CYGIMP_DEVS_USB_UPD985XX_SERIALIZE_TRANSMITS</literal>. </para></refsect1><refsect1><title>Platform Dependencies</title><para>On some platforms it is necessary for the low-level USB device driverto perform some additional operations during start-up. For example itmay be necessary to manipulate one of the processor's GPIO linesbefore the host can detect a new USB peripheral and attempt tocommunicate with it. This avoids problems if the target involves asignificant amount of work prior to device driver initialization, forexample a power-on self-test sequence. If the USB host attempted tocontact the target before the USB device driver had been initialized,it would fail to get the expected responses and conclude that thetarget was not a functional USB peripheral.</para><para>Platform-specific initialization code can be provided via a macro<function>UPD985XX_USB_PLATFORM_INIT</function>. Typically this macrowould be defined in the platform HAL's header file<filename class="headerfile">cyg/hal/plf_io.h</filename>. If thecurrent platform defines such a macro, the USB device driver willinvoke it during the endpoint 0 start-up operation.</para></refsect1></refentry></part><!-- /reference -->

⌨️ 快捷键说明

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