2 * Copyright (c) 2006, Benedikt Sauter <sauter@ixbat.de>
5 * Short descripton of file:
6 * I take the function names and parameters mainly from
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the FH Augsburg nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #include "../../types.h"
44 /******************* Device Operations **********************/
46 // use an own usb device
47 struct usb_device *usb_open(u32 vendor_id, u32 product_id);
48 struct usb_device *usb_open_class(u8 class);
50 s8 usb_close(struct usb_device *dev);
53 s8 usb_get_device_descriptor(struct usb_device *dev, u8 *buf, u8 buflen);
54 s8 usb_set_address(struct usb_device *dev, u8 address);
55 s8 usb_set_configuration(struct usb_device *dev, u8 configuration);
56 s8 usb_set_altinterface(struct usb_device *dev, u8 alternate);
60 * usb_reset resets the specified device by sending a RESET down the port
61 * it is connected to. Returns 0 on success or < 0 on error.
64 s8 usb_reset(struct usb_device *dev);
67 /******************* Control Transfer **********************/
68 s8 usb_control_msg(struct usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length, u8 *buf, u16 timeout);
69 s8 usb_get_string(struct usb_device *dev, u8 index, u8 langid, u8 *buf, u8 buflen);
70 char *usb_get_string_simple(struct usb_device *dev, u8 index, u8 *buf, u8 size);
71 s8 usb_get_dev_desc_simple(struct usb_device *dev, u8 *buf, u8 size);
72 s8 usb_get_configuration(struct usb_device *dev, u8 index, u8 *buf, u8 size);
73 s8 usb_get_dev_desc(struct usb_device *dev, u8 *buf, u8 size);
74 s8 usb_get_descriptor(struct usb_device *dev, u8 type, u8 index, u8 *buf, u8 size);
77 /******************* Bulk Transfer **********************/
78 s8 usb_bulk_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
79 s8 usb_bulk_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
82 /******************* Interrupt Transfer **********************/
83 s8 usb_u8errupt_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
84 s8 usb_u8errupt_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
87 /******************* Isochron Transfer **********************/
88 s8 usb_isochron_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
89 s8 usb_isochron_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);