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 usb_device * usb_open(u32 vendor_id, u32 product_id);
48 usb_device * usb_open_class(u8 class);
50 u8 usb_close(usb_device *dev);
54 u8 usb_get_device_descriptor(usb_device *dev, char *buf,u8 size);
55 u8 usb_set_address(usb_device *dev, u8 address);
56 u8 usb_set_configuration(usb_device *dev, u8 configuration);
57 u8 usb_set_altinterface(usb_device *dev, u8 alternate);
61 * usb_reset resets the specified device by sending a RESET down the port
62 * it is connected to. Returns 0 on success or < 0 on error.
65 u8 usb_reset(usb_device *dev);
68 /******************* Control Transfer **********************/
71 u8 usb_control_msg(usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length, char *buf, u16 size, u16 timeout);
72 u8 usb_get_string(usb_device *dev, u8 index, u8 langid, char *buf, u8 buflen);
73 u8 usb_get_string_simple(usb_device *dev, u8 index, char *buf, u8 buflen);
74 u8 usb_get_descriptor(usb_device *dev, unsigned char type, unsigned char index, void *buf, u8 size);
77 /******************* Bulk Transfer **********************/
79 u8 usb_bulk_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
80 u8 usb_bulk_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
83 /******************* Interrupt Transfer **********************/
84 u8 usb_u8errupt_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
85 u8 usb_u8errupt_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
88 /******************* Isochron Transfer **********************/
89 u8 usb_isochron_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
90 u8 usb_isochron_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);