usb.h

00001 /*
00002  * Copyright (c) 2006, Benedikt Sauter <sauter@ixbat.de>
00003  * All rights reserved.
00004  *
00005  * Short descripton of file:
00006  * I take the function names and parameters mainly from
00007  * libusb.sf.net.
00008  *
00009  *
00010  * Redistribution and use in source and binary forms, with or without 
00011  * modification, are permitted provided that the following conditions 
00012  * are met:
00013  *
00014  *   * Redistributions of source code must retain the above copyright 
00015  *     notice, this list of conditions and the following disclaimer.
00016  *   * Redistributions in binary form must reproduce the above 
00017  *     copyright notice, this list of conditions and the following 
00018  *     disclaimer in the documentation and/or other materials provided 
00019  *     with the distribution.
00020  *   * Neither the name of the FH Augsburg nor the names of its 
00021  *     contributors may be used to endorse or promote products derived 
00022  *     from this software without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00025  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
00026  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
00027  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
00028  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
00029  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00030  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00031  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00032  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00033  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00034  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035  */
00036 /*
00037         ppcskel - a Free Software replacement for the Nintendo/BroadOn bootloader.
00038         libusb like interface
00039 
00040 Copyright (C) 2009     Bernhard Urban <lewurm@gmx.net>
00041 Copyright (C) 2009     Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
00042 
00043 # This code is licensed to you under the terms of the GNU GPL, version 2;
00044 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
00045 */
00046 
00047 #ifndef _USB_H_
00048 #define _USB_H_
00049 
00050 #include <types.h>
00051 #include <hextwelve/core/core.h>
00052 
00053 
00054 /******************* Device Operations **********************/
00055 
00056 // use an own usb device
00057 struct usb_device *usb_open(u32 vendor_id, u32 product_id);
00058 struct usb_device *usb_open_class(u8 class);
00059 
00060 s8 usb_close(struct usb_device *dev);
00061 
00062 
00068 s8 usb_reset(struct usb_device *dev);
00069 
00070 
00071 /******************* Control Transfer **********************/
00072 s8 usb_control_msg(struct usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length, u8 *buf, u16 timeout);
00073 s8 usb_get_descriptor(struct usb_device *dev, u8 type, u8 index, u8 *buf, u8 size);
00074 s8 usb_get_desc_dev_simple(struct usb_device *dev);
00075 s8 usb_get_desc_dev(struct usb_device *dev);
00076 s8 usb_get_desc_configuration(struct usb_device *dev, u8 index, struct usb_conf *conf);
00077 s8 usb_get_desc_config_ext(struct usb_device *dev, u8 index, struct usb_conf *conf);
00078 
00079 char *usb_get_string_simple(struct usb_device *dev, u8 index);
00080 s8 usb_get_string(struct usb_device *dev, u8 index, u8 langid);
00081 
00082 s8 usb_set_address(struct usb_device *dev, u8 address);
00083 u8 usb_get_configuration(struct usb_device *dev);
00084 s8 usb_set_configuration(struct usb_device *dev, u8 configuration);
00085 s8 usb_set_altinterface(struct usb_device *dev, u8 alternate);
00086 
00087 
00088 /******************* Bulk Transfer **********************/
00089 s8 usb_bulk_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00090 s8 usb_bulk_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00091 
00092 
00093 /******************* Interrupt Transfer **********************/
00094 s8 usb_interrupt_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00095 s8 usb_interrupt_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00096 
00097 
00098 /******************* Isochron Transfer **********************/
00099 s8 usb_isochron_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00100 s8 usb_isochron_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
00101 
00102 #endif  //_USB_H_
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3