00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is confidential property of Nordic 00004 * Semiconductor ASA.Terms and conditions of usage are described in detail 00005 * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRENTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 * $LastChangedRevision: 133 $ 00012 */ 00013 00019 #ifndef USB_DESC_H__ 00020 #define USB_DESC_H__ 00021 00022 #include <stdint.h> 00023 00024 // Standard request codes 00025 #define USB_REQ_GET_STATUS 0x00 00026 #define USB_REQ_CLEAR_FEATURE 0x01 00027 #define USB_REQ_RESERVED_1 0x02 00028 #define USB_REQ_SET_FEATURE 0x03 00029 #define USB_REQ_RESERVED_2 0x04 00030 #define USB_REQ_SET_ADDRESS 0x05 00031 #define USB_REQ_GET_DESCRIPTOR 0x06 00032 #define USB_REQ_SET_DESCRIPTOR 0x07 00033 #define USB_REQ_GET_CONFIGURATION 0x08 00034 #define USB_REQ_SET_CONFIGURATION 0x09 00035 #define USB_REQ_GET_INTERFACE 0x0a 00036 #define USB_REQ_SET_INTERFACE 0x0b 00037 #define USB_REQ_SYNCH_FRAME 0x0c 00038 00039 // Descriptor types 00040 #define USB_DESC_DEVICE 0x01 00041 #define USB_DESC_CONFIGURATION 0x02 00042 #define USB_DESC_STRING 0x03 00043 #define USB_DESC_INTERFACE 0x04 00044 #define USB_DESC_ENDPOINT 0x05 00045 #define USB_DESC_DEVICE_QUAL 0x06 00046 #define USB_DESC_OTHER_SPEED_CONF 0x07 00047 #define USB_DESC_INTERFACE_POWER 0x08 00048 00049 00050 #define USB_ENDPOINT_TYPE_BULK 0x02 00051 00052 typedef struct 00053 { 00054 volatile uint8_t bLength; 00055 volatile uint8_t bDescriptorType; 00056 volatile uint16_t bcdUSB; 00057 volatile uint8_t bDeviceClass; 00058 volatile uint8_t bDeviceSubClass; 00059 volatile uint8_t bDeviceProtocol; 00060 volatile uint8_t bMaxPacketSize0; 00061 volatile uint16_t idVendor; 00062 volatile uint16_t idProduct; 00063 volatile uint16_t bcdDevice; 00064 volatile uint8_t iManufacturer; 00065 volatile uint8_t iProduct; 00066 volatile uint8_t iSerialNumber; 00067 volatile uint8_t bNumConfigurations; 00068 } usb_dev_desc_t; 00069 00070 typedef struct 00071 { 00072 volatile uint8_t bLength; 00073 volatile uint8_t bDescriptorType; 00074 volatile uint16_t wTotalLength; 00075 volatile uint8_t bNumInterfaces; 00076 volatile uint8_t bConfigurationValue; 00077 volatile uint8_t iConfiguration; 00078 volatile uint8_t bmAttributes; 00079 volatile uint8_t bMaxPower; 00080 } usb_conf_desc_t; 00081 00082 typedef struct 00083 { 00084 volatile uint8_t bLength; 00085 volatile uint8_t bDescriptorType; 00086 volatile uint8_t bInterfaceNumber; 00087 volatile uint8_t bAlternateSetting; 00088 volatile uint8_t bNumEndpoints; 00089 volatile uint8_t bInterfaceClass; 00090 volatile uint8_t bInterfaceSubClass; 00091 volatile uint8_t bInterfaceProtocol; 00092 volatile uint8_t iInterface; 00093 } usb_if_desc_t; 00094 00095 typedef struct 00096 { 00097 volatile uint8_t bLength; 00098 volatile uint8_t bDescriptorType; 00099 volatile uint8_t bEndpointAddress; 00100 volatile uint8_t bmAttributes; 00101 volatile uint16_t wMaxPacketSize; 00102 volatile uint8_t bInterval; 00103 } usb_ep_desc_t; 00104 00105 #endif // USB_DESC_H__