license stuff
[ppcskel.git] / usb / core / usb.h
index 6579b725b2acdab462e2cae90a59b72e485e9ba0..d5cb53b783cb1b4ad2da2440d59107e79435f700 100644 (file)
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/*
+       ppcskel - a Free Software replacement for the Nintendo/BroadOn bootloader.
+       libusb like interface
+
+Copyright (C) 2009     Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009     Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
+
+# This code is licensed to you under the terms of the GNU GPL, version 2;
+# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+*/
 
 #ifndef _USB_H_
 #define _USB_H_
 /******************* Device Operations **********************/
 
 // use an own usb device
-usb_device * usb_open(u32 vendor_id, u32 product_id);
-usb_device * usb_open_class(u8 class);
-
-u8 usb_close(usb_device *dev);
-
+struct usb_device *usb_open(u32 vendor_id, u32 product_id);
+struct usb_device *usb_open_class(u8 class);
 
-
-u8 usb_get_device_descriptor(usb_device *dev, char *buf,u8 size);
-u8 usb_set_address(usb_device *dev, u8 address);
-u8 usb_set_configuration(usb_device *dev, u8 configuration);
-u8 usb_set_altinterface(usb_device *dev, u8 alternate);
+s8 usb_close(struct usb_device *dev);
 
 
 /**
@@ -62,33 +65,38 @@ u8 usb_set_altinterface(usb_device *dev, u8 alternate);
  * it is connected to. Returns 0 on success or < 0 on error.
  */
 
-u8 usb_reset(usb_device *dev);
+s8 usb_reset(struct usb_device *dev);
 
 
 /******************* Control Transfer **********************/
+s8 usb_control_msg(struct usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length, u8 *buf, u16 timeout);
+s8 usb_get_descriptor(struct usb_device *dev, u8 type, u8 index, u8 *buf, u8 size);
+s8 usb_get_desc_dev_simple(struct usb_device *dev);
+s8 usb_get_desc_dev(struct usb_device *dev);
+s8 usb_get_desc_configuration(struct usb_device *dev, u8 index, struct usb_conf *conf);
+s8 usb_get_desc_config_ext(struct usb_device *dev, u8 index, struct usb_conf *conf);
 
+char *usb_get_string_simple(struct usb_device *dev, u8 index);
+s8 usb_get_string(struct usb_device *dev, u8 index, u8 langid);
 
-u8 usb_control_msg(usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length, char *buf, u16 size, u16 timeout);
-u8 usb_get_string(usb_device *dev, u8 index, u8 langid, char *buf, u8 buflen);
-u8 usb_get_string_simple(usb_device *dev, u8 index, char *buf, u8 buflen);
-u8 usb_get_descriptor(usb_device *dev, unsigned char type, unsigned char index, void *buf, u8 size);
+s8 usb_set_address(struct usb_device *dev, u8 address);
+u8 usb_get_configuration(struct usb_device *dev);
+s8 usb_set_configuration(struct usb_device *dev, u8 configuration);
+s8 usb_set_altinterface(struct usb_device *dev, u8 alternate);
 
 
 /******************* Bulk Transfer **********************/
-
-u8 usb_bulk_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
-u8 usb_bulk_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
+s8 usb_bulk_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
+s8 usb_bulk_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
 
 
 /******************* Interrupt Transfer **********************/
-u8 usb_u8errupt_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
-u8 usb_u8errupt_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
+s8 usb_interrupt_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
+s8 usb_interrupt_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
 
 
 /******************* Isochron Transfer **********************/
-u8 usb_isochron_write(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
-u8 usb_isochron_read(usb_device *dev, u8 ep, char *buf, u8 size, u8 timeout);
-
-
+s8 usb_isochron_write(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
+s8 usb_isochron_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeout);
 
 #endif //_USB_H_