1 <!-- Copyright (C) 2003 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 the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Starting up a USB Device</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
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
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
71 HREF="usbs-devtab.html"
82 NAME="USBS-START">Starting up a USB Device</H1
93 > -- Starting up a USB Device</DIV
95 CLASS="REFSYNOPSISDIV"
111 CLASS="FUNCSYNOPSISINFO"
112 >#include <cyg/io/usb/usbs.h></PRE
120 >void usbs_start</CODE
121 >(usbs_control_endpoint* ep0);</CODE
135 >Initializing a USB device requires some support from higher-level
136 code, typically the application, in the form of enumeration data.
137 Hence it is not possible for the low-level USB driver to activate a
138 USB device itself. Instead the higher-level code has to take care of
142 >. This function takes
143 a pointer to a USB control endpoint data structure. USB device drivers
144 should provide exactly one such data structure for every USB device,
145 so the pointer uniquely identifies the device.</P
153 CLASS="PROGRAMLISTING"
154 >const usbs_enumeration_data usb_enum_data = {
159 main(int argc, char** argv)
161 usbs_sa11x0_ep0.enumeration_data = &usb_enum_data;
163 usbs_start(&usbs_sa11x0_ep0);
170 >The exact behaviour of <TT
174 USB hardware and the device driver. A typical implementation would
175 change the USB data pins from tristated to active. If the peripheral
176 is already plugged into a host then the latter should detect this
177 change and start interacting with the peripheral, including requesting
178 the enumeration data. Some of this may happen before
182 > returns, but given that multiple
183 interactions between USB host and peripheral are required it is likely
184 that the function will return before the peripheral is fully
185 configured. Control endpoints provide a <A
186 HREF="usbs-control.html#AEN16552"
189 higher-level code of USB state changes.
193 > will return even if the peripheral is
194 not currently connected to a host: it will not block until the
195 connection is established.</P
200 > should only be called once for a given
201 USB device. There are no defined error conditions. Note that the
202 function affects the entire USB device and not just the control
203 endpoint: there is no need to start any data endpoints as well.</P
210 SUMMARY="Footer navigation table"
221 HREF="usbs-enum.html"
239 HREF="usbs-devtab.html"
249 >USB Enumeration Data</TD
255 HREF="io-usb-slave.html"