descriptor.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Vojtech Horky
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef LIBUSB_DESCRIPTOR_H_
00036 #define LIBUSB_DESCRIPTOR_H_
00037 
00038 #include <async.h>
00039 
00041 typedef enum {
00042         USB_DESCTYPE_DEVICE = 1,
00043         USB_DESCTYPE_CONFIGURATION = 2,
00044         USB_DESCTYPE_STRING = 3,
00045         USB_DESCTYPE_INTERFACE = 4,
00046         USB_DESCTYPE_ENDPOINT = 5,
00047         USB_DESCTYPE_HID = 0x21,
00048         USB_DESCTYPE_HID_REPORT = 0x22,
00049         USB_DESCTYPE_HID_PHYSICAL = 0x23,
00050         USB_DESCTYPE_HUB = 0x29,
00051         /* USB_DESCTYPE_ = */
00052 } usb_descriptor_type_t;
00053 
00056 typedef struct {
00058         uint8_t length;
00060         uint8_t descriptor_type;
00064         uint16_t usb_spec_version;
00066         uint8_t device_class;
00068         uint8_t device_subclass;
00070         uint8_t device_protocol;
00074         uint8_t max_packet_size;
00076         uint16_t vendor_id;
00078         uint16_t product_id;
00080         uint16_t device_version;
00082         uint8_t str_manufacturer;
00084         uint8_t str_product;
00086         uint8_t str_serial_number;
00088         uint8_t configuration_count;
00089 } __attribute__ ((packed)) usb_standard_device_descriptor_t;
00090 
00093 typedef struct {
00095         uint8_t length;
00097         uint8_t descriptor_type;
00103         uint16_t total_length;
00105         uint8_t interface_count;
00107         uint8_t configuration_number;
00109         uint8_t str_configuration;
00111         uint8_t attributes;
00115         uint8_t max_power;
00116 } __attribute__ ((packed)) usb_standard_configuration_descriptor_t;
00117 
00120 typedef struct {
00122         uint8_t length;
00124         uint8_t descriptor_type;
00128         uint8_t interface_number;
00130         uint8_t alternate_setting;
00135         uint8_t endpoint_count;
00137         uint8_t interface_class;
00139         uint8_t interface_subclass;
00141         uint8_t interface_protocol;
00143         uint8_t str_interface;
00144 } __attribute__ ((packed)) usb_standard_interface_descriptor_t;
00145 
00148 typedef struct {
00150         uint8_t length;
00152         uint8_t descriptor_type;
00154         uint8_t endpoint_address;
00158         uint8_t attributes;
00160         uint16_t max_packet_size;
00166         uint8_t poll_interval;
00167 } __attribute__ ((packed)) usb_standard_endpoint_descriptor_t;
00168 
00173 typedef struct {
00175         uint8_t type;
00177         uint16_t length;
00178 } __attribute__ ((packed)) usb_standard_hid_class_descriptor_info_t;
00179 
00188 typedef struct {
00194         uint8_t length;
00196         uint8_t descriptor_type;
00198         uint16_t spec_release;
00200         uint8_t country_code;
00206         uint8_t class_desc_count;
00208         usb_standard_hid_class_descriptor_info_t report_desc_info;
00209 } __attribute__ ((packed)) usb_standard_hid_descriptor_t;
00210 
00211 #endif
00212 

Generated on Thu Jun 2 07:45:48 2011 for HelenOS/USB by  doxygen 1.4.7