1 <!-- Copyright (C) 2002 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of substantively modified versions of this -->
7 <!-- document is prohibited without the explicit permission of the -->
8 <!-- copyright holder. -->
9 <!-- Distribution of the work or derivative of the work in any -->
10 <!-- standard (paper) book form is prohibited unless prior -->
11 <!-- permission is obtained from the copyright holder. -->
15 >Starting up a USB Device</TITLE
16 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
19 CONTENT="Modular DocBook HTML Stylesheet Version 1.64
22 TITLE="eCos USB Slave Support"
23 HREF="io-usb-slave.html"><LINK
25 TITLE="USB Enumeration Data"
26 HREF="usbs-enum.html"><LINK
28 TITLE="Devtab Entries"
29 HREF="usbs-devtab.html"></HEAD
48 >eCos USB Slave Support</TH
69 HREF="usbs-devtab.html"
80 >Starting up a USB Device</A
92 > -- Starting up a USB Device</DIV
94 CLASS="REFSYNOPSISDIV"
114 CLASS="FUNCSYNOPSISINFO"
115 >#include <cyg/io/usb/usbs.h></PRE
123 >void usbs_start</CODE
124 >(usbs_control_endpoint* ep0);</CODE
138 >Initializing a USB device requires some support from higher-level
139 code, typically the application, in the form of enumeration data.
140 Hence it is not possible for the low-level USB driver to activate a
141 USB device itself. Instead the higher-level code has to take care of
145 >. This function takes
146 a pointer to a USB control endpoint data structure. USB device drivers
147 should provide exactly one such data structure for every USB device,
148 so the pointer uniquely identifies the device.</P
156 CLASS="PROGRAMLISTING"
157 >const usbs_enumeration_data usb_enum_data = {
162 main(int argc, char** argv)
164 usbs_sa11x0_ep0.enumeration_data = &usb_enum_data;
166 usbs_start(&usbs_sa11x0_ep0);
173 >The exact behaviour of <TT
177 USB hardware and the device driver. A typical implementation would
178 change the USB data pins from tristated to active. If the peripheral
179 is already plugged into a host then the latter should detect this
180 change and start interacting with the peripheral, including requesting
181 the enumeration data. Some of this may happen before
185 > returns, but given that multiple
186 interactions between USB host and peripheral are required it is likely
187 that the function will return before the peripheral is fully
188 configured. Control endpoints provide a <A
189 HREF="usbs-control.html#AEN515"
192 higher-level code of USB state changes.
196 > will return even if the peripheral is
197 not currently connected to a host: it will not block until the
198 connection is established.</P
203 > should only be called once for a given
204 USB device. There are no defined error conditions. Note that the
205 function affects the entire USB device and not just the control
206 endpoint: there is no need to start any data endpoints as well.</P
223 HREF="usbs-enum.html"
231 HREF="io-usb-slave.html"
239 HREF="usbs-devtab.html"
248 >USB Enumeration Data</TD