APC UPS monitoring program

Dependencies:   EthernetInterface NetworkAPI mbed-rtos mbed

Fork of ups_mon_141217 by jinbeom kim

Committer:
bumisee
Date:
Mon Jan 19 02:40:27 2015 +0000
Revision:
0:fb1f6d3926fe
v1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bumisee 0:fb1f6d3926fe 1
bumisee 0:fb1f6d3926fe 2 /*
bumisee 0:fb1f6d3926fe 3 I changed a bit the code but all credit goes to the amazing work of :
bumisee 0:fb1f6d3926fe 4
bumisee 0:fb1f6d3926fe 5 Copyright (c) 2010 Peter Barrett
bumisee 0:fb1f6d3926fe 6
bumisee 0:fb1f6d3926fe 7 Permission is hereby granted, free of charge, to any person obtaining a copy
bumisee 0:fb1f6d3926fe 8 of this software and associated documentation files (the "Software"), to deal
bumisee 0:fb1f6d3926fe 9 in the Software without restriction, including without limitation the rights
bumisee 0:fb1f6d3926fe 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
bumisee 0:fb1f6d3926fe 11 copies of the Software, and to permit persons to whom the Software is
bumisee 0:fb1f6d3926fe 12 furnished to do so, subject to the following conditions:
bumisee 0:fb1f6d3926fe 13
bumisee 0:fb1f6d3926fe 14 The above copyright notice and this permission notice shall be included in
bumisee 0:fb1f6d3926fe 15 all copies or substantial portions of the Software.
bumisee 0:fb1f6d3926fe 16
bumisee 0:fb1f6d3926fe 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
bumisee 0:fb1f6d3926fe 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
bumisee 0:fb1f6d3926fe 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
bumisee 0:fb1f6d3926fe 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
bumisee 0:fb1f6d3926fe 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
bumisee 0:fb1f6d3926fe 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
bumisee 0:fb1f6d3926fe 23 THE SOFTWARE.
bumisee 0:fb1f6d3926fe 24 */
bumisee 0:fb1f6d3926fe 25
bumisee 0:fb1f6d3926fe 26 #ifndef USBHOST_H
bumisee 0:fb1f6d3926fe 27 #define USBHOST_H
bumisee 0:fb1f6d3926fe 28
bumisee 0:fb1f6d3926fe 29 #ifndef u8
bumisee 0:fb1f6d3926fe 30 typedef unsigned char u8;
bumisee 0:fb1f6d3926fe 31 typedef unsigned short u16;
bumisee 0:fb1f6d3926fe 32 typedef unsigned long u32;
bumisee 0:fb1f6d3926fe 33
bumisee 0:fb1f6d3926fe 34 typedef char s8;
bumisee 0:fb1f6d3926fe 35 typedef short s16;
bumisee 0:fb1f6d3926fe 36 typedef char s32;
bumisee 0:fb1f6d3926fe 37 #endif
bumisee 0:fb1f6d3926fe 38
bumisee 0:fb1f6d3926fe 39 #define ENDPOINT_CONTROL 0
bumisee 0:fb1f6d3926fe 40 #define ENDPOINT_ISOCRONOUS 1
bumisee 0:fb1f6d3926fe 41 #define ENDPOINT_BULK 2
bumisee 0:fb1f6d3926fe 42 #define ENDPOINT_INTERRUPT 3
bumisee 0:fb1f6d3926fe 43
bumisee 0:fb1f6d3926fe 44 #define DESCRIPTOR_TYPE_DEVICE 1
bumisee 0:fb1f6d3926fe 45 #define DESCRIPTOR_TYPE_CONFIGURATION 2
bumisee 0:fb1f6d3926fe 46 #define DESCRIPTOR_TYPE_STRING 3
bumisee 0:fb1f6d3926fe 47 #define DESCRIPTOR_TYPE_INTERFACE 4
bumisee 0:fb1f6d3926fe 48 #define DESCRIPTOR_TYPE_ENDPOINT 5
bumisee 0:fb1f6d3926fe 49
bumisee 0:fb1f6d3926fe 50 #define DESCRIPTOR_TYPE_HID 0x21
bumisee 0:fb1f6d3926fe 51 #define DESCRIPTOR_TYPE_REPORT 0x22
bumisee 0:fb1f6d3926fe 52 #define DESCRIPTOR_TYPE_PHYSICAL 0x23
bumisee 0:fb1f6d3926fe 53 #define DESCRIPTOR_TYPE_HUB 0x29
bumisee 0:fb1f6d3926fe 54
bumisee 0:fb1f6d3926fe 55 enum USB_CLASS_CODE
bumisee 0:fb1f6d3926fe 56 {
bumisee 0:fb1f6d3926fe 57 CLASS_DEVICE,
bumisee 0:fb1f6d3926fe 58 CLASS_AUDIO,
bumisee 0:fb1f6d3926fe 59 CLASS_COMM_AND_CDC_CONTROL,
bumisee 0:fb1f6d3926fe 60 CLASS_HID,
bumisee 0:fb1f6d3926fe 61 CLASS_PHYSICAL = 0x05,
bumisee 0:fb1f6d3926fe 62 CLASS_STILL_IMAGING,
bumisee 0:fb1f6d3926fe 63 CLASS_PRINTER,
bumisee 0:fb1f6d3926fe 64 CLASS_MASS_STORAGE,
bumisee 0:fb1f6d3926fe 65 CLASS_HUB,
bumisee 0:fb1f6d3926fe 66 CLASS_CDC_DATA,
bumisee 0:fb1f6d3926fe 67 CLASS_SMART_CARD,
bumisee 0:fb1f6d3926fe 68 CLASS_CONTENT_SECURITY = 0x0D,
bumisee 0:fb1f6d3926fe 69 CLASS_VIDEO = 0x0E,
bumisee 0:fb1f6d3926fe 70 CLASS_DIAGNOSTIC_DEVICE = 0xDC,
bumisee 0:fb1f6d3926fe 71 CLASS_WIRELESS_CONTROLLER = 0xE0,
bumisee 0:fb1f6d3926fe 72 CLASS_MISCELLANEOUS = 0xEF,
bumisee 0:fb1f6d3926fe 73 CLASS_APP_SPECIFIC = 0xFE,
bumisee 0:fb1f6d3926fe 74 CLASS_VENDOR_SPECIFIC = 0xFF
bumisee 0:fb1f6d3926fe 75 };
bumisee 0:fb1f6d3926fe 76 //CLASS=0x00=DEVICE // This means that the use of the device comes in the Interface Descriptors
bumisee 0:fb1f6d3926fe 77
bumisee 0:fb1f6d3926fe 78 #define DEVICE_TO_HOST 0x80
bumisee 0:fb1f6d3926fe 79 #define HOST_TO_DEVICE 0x00
bumisee 0:fb1f6d3926fe 80 #define REQUEST_TYPE_CLASS 0x20
bumisee 0:fb1f6d3926fe 81 #define RECIPIENT_DEVICE 0x00
bumisee 0:fb1f6d3926fe 82 #define RECIPIENT_INTERFACE 0x01
bumisee 0:fb1f6d3926fe 83 #define RECIPIENT_ENDPOINT 0x02
bumisee 0:fb1f6d3926fe 84 #define RECIPIENT_OTHER 0x03
bumisee 0:fb1f6d3926fe 85
bumisee 0:fb1f6d3926fe 86 #define GET_STATUS 0
bumisee 0:fb1f6d3926fe 87 #define CLEAR_FEATURE 1
bumisee 0:fb1f6d3926fe 88 #define SET_FEATURE 3
bumisee 0:fb1f6d3926fe 89 #define SET_ADDRESS 5
bumisee 0:fb1f6d3926fe 90 #define GET_DESCRIPTOR 6
bumisee 0:fb1f6d3926fe 91 #define SET_DESCRIPTOR 7
bumisee 0:fb1f6d3926fe 92 #define GET_CONFIGURATION 8
bumisee 0:fb1f6d3926fe 93 #define SET_CONFIGURATION 9
bumisee 0:fb1f6d3926fe 94 #define GET_INTERFACE 10
bumisee 0:fb1f6d3926fe 95 #define SET_INTERFACE 11
bumisee 0:fb1f6d3926fe 96 #define SET_REPORT 0x09
bumisee 0:fb1f6d3926fe 97 #define SYNCH_FRAME 11
bumisee 0:fb1f6d3926fe 98
bumisee 0:fb1f6d3926fe 99 // -5 is nak
bumisee 0:fb1f6d3926fe 100 /*
bumisee 0:fb1f6d3926fe 101 0010 ACK Handshake
bumisee 0:fb1f6d3926fe 102 1010 NAK Handshake
bumisee 0:fb1f6d3926fe 103 1110 STALL Handshake
bumisee 0:fb1f6d3926fe 104 0110 NYET (No Response Yet)
bumisee 0:fb1f6d3926fe 105 */
bumisee 0:fb1f6d3926fe 106
bumisee 0:fb1f6d3926fe 107 #define IO_PENDING -100
bumisee 0:fb1f6d3926fe 108 #define ERR_ENDPOINT_NONE_LEFT -101
bumisee 0:fb1f6d3926fe 109 #define ERR_ENDPOINT_NOT_FOUND -102
bumisee 0:fb1f6d3926fe 110 #define ERR_DEVICE_NOT_FOUND -103
bumisee 0:fb1f6d3926fe 111 #define ERR_DEVICE_NONE_LEFT -104
bumisee 0:fb1f6d3926fe 112 #define ERR_HUB_INIT_FAILED -105
bumisee 0:fb1f6d3926fe 113 #define ERR_INTERFACE_NOT_FOUND -106
bumisee 0:fb1f6d3926fe 114
bumisee 0:fb1f6d3926fe 115 #define UPS_REPORT 1
bumisee 0:fb1f6d3926fe 116 #define UPS_CONNECT 2
bumisee 0:fb1f6d3926fe 117 #define UPS_DISCONNECT 3
bumisee 0:fb1f6d3926fe 118 #define TCP_CONNECT 1
bumisee 0:fb1f6d3926fe 119 #define TCP_DISCONNECT 0
bumisee 0:fb1f6d3926fe 120 #define ALLOFF 0
bumisee 0:fb1f6d3926fe 121 #define ONLINE 1
bumisee 0:fb1f6d3926fe 122 #define BATTERY 2
bumisee 0:fb1f6d3926fe 123 #define TCP_RESET_TIME 10
bumisee 0:fb1f6d3926fe 124
bumisee 0:fb1f6d3926fe 125 //prefixeds indicators:
bumisee 0:fb1f6d3926fe 126 // b = byte(8bits)
bumisee 0:fb1f6d3926fe 127 // w = word(16bits)
bumisee 0:fb1f6d3926fe 128 // bm= bit map
bumisee 0:fb1f6d3926fe 129 // bcd = binary-coded-decimal
bumisee 0:fb1f6d3926fe 130 // i = index
bumisee 0:fb1f6d3926fe 131 // id = identifier.
bumisee 0:fb1f6d3926fe 132
bumisee 0:fb1f6d3926fe 133 // bDescriptorType values:
bumisee 0:fb1f6d3926fe 134 // 01h device
bumisee 0:fb1f6d3926fe 135 // 02h configuration
bumisee 0:fb1f6d3926fe 136 // 03h string -just for optional descriptive test
bumisee 0:fb1f6d3926fe 137 // 04h interface
bumisee 0:fb1f6d3926fe 138 // 05h endpoint
bumisee 0:fb1f6d3926fe 139 // 06h device_qualifier -for devices theat support both full and high speeds.
bumisee 0:fb1f6d3926fe 140 // 07h other_speed_configuration
bumisee 0:fb1f6d3926fe 141 // 08h interface_powr
bumisee 0:fb1f6d3926fe 142 // 09h OTG -for On-The-Go devices only
bumisee 0:fb1f6d3926fe 143 // 0Ah debug
bumisee 0:fb1f6d3926fe 144 // 0Bh interface association -for composite devices
bumisee 0:fb1f6d3926fe 145
bumisee 0:fb1f6d3926fe 146
bumisee 0:fb1f6d3926fe 147 // This is the device decriptor:
bumisee 0:fb1f6d3926fe 148 typedef struct
bumisee 0:fb1f6d3926fe 149 {
bumisee 0:fb1f6d3926fe 150 u8 bLength; // the length in bytes of the descriptor
bumisee 0:fb1f6d3926fe 151 u8 bDescriptorType; //descriptor! (01h)
bumisee 0:fb1f6d3926fe 152 u16 bcdUSB; // usb specs version
bumisee 0:fb1f6d3926fe 153 // usb 2.0 -> 0x0200
bumisee 0:fb1f6d3926fe 154 // usb 1.1 -> 0x0110
bumisee 0:fb1f6d3926fe 155 // usb 1.0 -> 0x0100
bumisee 0:fb1f6d3926fe 156 u8 bDeviceClass; //class code
bumisee 0:fb1f6d3926fe 157 u8 bDeviceSubClass; //subclass code
bumisee 0:fb1f6d3926fe 158 u8 bDeviceProtocol; //protocol code
bumisee 0:fb1f6d3926fe 159 u8 bMaxPacketSize; //maximun packet size for endpoint 0
bumisee 0:fb1f6d3926fe 160 u16 idVendor; //vendor ID
bumisee 0:fb1f6d3926fe 161 u16 idProduct; //product ID
bumisee 0:fb1f6d3926fe 162 u16 bcdDevice; // device release number
bumisee 0:fb1f6d3926fe 163 u8 iManufacturer; //index that points a string describing the manufacturer. zero if no string description.
bumisee 0:fb1f6d3926fe 164 u8 iProduct; //index that points a string describing the product. zero if no string decription
bumisee 0:fb1f6d3926fe 165 u8 iSerialNumber; //index to a string with the serial number.
bumisee 0:fb1f6d3926fe 166 u8 bNumConfigurations; //number of possible configurations.
bumisee 0:fb1f6d3926fe 167 } DeviceDescriptor; // 16 bytes
bumisee 0:fb1f6d3926fe 168
bumisee 0:fb1f6d3926fe 169
bumisee 0:fb1f6d3926fe 170 //after retrieving the device decriptor the host can
bumisee 0:fb1f6d3926fe 171 //ask for device configuration.
bumisee 0:fb1f6d3926fe 172 //When the configuration descriptor is read, it returns
bumisee 0:fb1f6d3926fe 173 //the entire configuration hierarchy which includes all
bumisee 0:fb1f6d3926fe 174 //related interface and endpoint descriptors.
bumisee 0:fb1f6d3926fe 175 // The wTotalLength field reflects the number of bytes in the hierarchy.
bumisee 0:fb1f6d3926fe 176 typedef struct
bumisee 0:fb1f6d3926fe 177 {
bumisee 0:fb1f6d3926fe 178 u8 bLength; //length in bytes of the descriptor
bumisee 0:fb1f6d3926fe 179 u8 bDescriptorType; // the constant CONFIGURATION (02h)
bumisee 0:fb1f6d3926fe 180 u16 wTotalLength;
bumisee 0:fb1f6d3926fe 181 u8 bNumInterfaces; //specifies the number of interfaces present for this configuration.
bumisee 0:fb1f6d3926fe 182 u8 bConfigurationValue; //is used by the SetConfiguration request to select this configuration.
bumisee 0:fb1f6d3926fe 183 u8 iConfiguration; // Index of String Descriptor describing this configuration
bumisee 0:fb1f6d3926fe 184 u8 bmAttributes; // Bitmap D7 Reserved, set to 1. (USB 1.0 Bus Powered),D6 Self Powered,D5 Remote Wakeup,D4..0 = 0
bumisee 0:fb1f6d3926fe 185 u8 bMaxPower; // Maximum Power Consumption in 2mA units
bumisee 0:fb1f6d3926fe 186 } ConfigurationDescriptor;
bumisee 0:fb1f6d3926fe 187
bumisee 0:fb1f6d3926fe 188
bumisee 0:fb1f6d3926fe 189 // the InterfaceDescriptor provides information
bumisee 0:fb1f6d3926fe 190 //or features implemented.
bumisee 0:fb1f6d3926fe 191 //The interface descriptor could be seen as a header
bumisee 0:fb1f6d3926fe 192 // or grouping of the endpoints into a functional group
bumisee 0:fb1f6d3926fe 193 // performing a single feature of the device.
bumisee 0:fb1f6d3926fe 194 typedef struct
bumisee 0:fb1f6d3926fe 195 {
bumisee 0:fb1f6d3926fe 196 u8 bLength; //descriptor size in bytes.
bumisee 0:fb1f6d3926fe 197 u8 bDescriptorType; // the constant INTERFACE (04h)
bumisee 0:fb1f6d3926fe 198 u8 bInterfaceNumber; //number identifing this interface
bumisee 0:fb1f6d3926fe 199 u8 bAlternateSetting; //Can be used to specify alternative interfaces.
bumisee 0:fb1f6d3926fe 200 //These alternative interfaces can be selected with the Set Interface request.
bumisee 0:fb1f6d3926fe 201 u8 bNumEndpoints; //number of endpoint supported, not counting the endpoint 0
bumisee 0:fb1f6d3926fe 202 u8 bInterfaceClass; //class code
bumisee 0:fb1f6d3926fe 203 //bInterfaceClass values:
bumisee 0:fb1f6d3926fe 204 //01 Audio
bumisee 0:fb1f6d3926fe 205 //02 Comunication interface
bumisee 0:fb1f6d3926fe 206 //03 HID-> Human Interface Device
bumisee 0:fb1f6d3926fe 207 //05 Physical
bumisee 0:fb1f6d3926fe 208 //06 Image
bumisee 0:fb1f6d3926fe 209 //07 Printer
bumisee 0:fb1f6d3926fe 210 //08 Mass storage
bumisee 0:fb1f6d3926fe 211 //09 Hub
bumisee 0:fb1f6d3926fe 212 //0A Data interface
bumisee 0:fb1f6d3926fe 213 //0B Smart Card
bumisee 0:fb1f6d3926fe 214 //0D Content security
bumisee 0:fb1f6d3926fe 215 //0E Video
bumisee 0:fb1f6d3926fe 216 //DC diagnostic divice
bumisee 0:fb1f6d3926fe 217 //E0 wirelless controler
bumisee 0:fb1f6d3926fe 218 //FE Application specific
bumisee 0:fb1f6d3926fe 219 //FF vendor specific
bumisee 0:fb1f6d3926fe 220 u8 bInterfaceSubClass; //subclass code
bumisee 0:fb1f6d3926fe 221 u8 bInterfaceProtocol; //protocol code
bumisee 0:fb1f6d3926fe 222 u8 iInterface; // Index of String Descriptor Describing this interface
bumisee 0:fb1f6d3926fe 223 } InterfaceDescriptor;
bumisee 0:fb1f6d3926fe 224
bumisee 0:fb1f6d3926fe 225
bumisee 0:fb1f6d3926fe 226 //Each endpoint in an interface descriptor must have
bumisee 0:fb1f6d3926fe 227 //an endpoint descriptor.
bumisee 0:fb1f6d3926fe 228 //Endpoint descriptors are used to describe endpoints
bumisee 0:fb1f6d3926fe 229 //other than endpoint zero. Endpoint zero is always
bumisee 0:fb1f6d3926fe 230 //assumed to be a control endpoint and is configured
bumisee 0:fb1f6d3926fe 231 // before any descriptors are even requested. The host
bumisee 0:fb1f6d3926fe 232 // will use the information returned from these descriptors
bumisee 0:fb1f6d3926fe 233 // to determine the bandwidth requirements of the bus.
bumisee 0:fb1f6d3926fe 234 typedef struct
bumisee 0:fb1f6d3926fe 235 {
bumisee 0:fb1f6d3926fe 236 u8 bLength; //descriptor size in bytes.
bumisee 0:fb1f6d3926fe 237 u8 bDescriptorType; //the constant ENDPOINT(05h)
bumisee 0:fb1f6d3926fe 238 u8 bEndpointAddress; //Endpoint number and direction
bumisee 0:fb1f6d3926fe 239 // Bits 0:3 endpoint, Bits 7 Direction 0 = Out, 1 = In (Ignored for Control Endpoints)
bumisee 0:fb1f6d3926fe 240 u8 bmAttributes; //specifies the transfer type.
bumisee 0:fb1f6d3926fe 241 // Bits 0:1 00 = Control, 01 = Isochronous, 10 = Bulk, 11 = Interrupt
bumisee 0:fb1f6d3926fe 242 u16 wMaxPacketSize; //maximun packet size supported.
bumisee 0:fb1f6d3926fe 243 u8 bInterval; // Interval for polling endpoint data transfers.
bumisee 0:fb1f6d3926fe 244 } EndpointDescriptor;
bumisee 0:fb1f6d3926fe 245
bumisee 0:fb1f6d3926fe 246 typedef struct {
bumisee 0:fb1f6d3926fe 247 u8 bLength;
bumisee 0:fb1f6d3926fe 248 u8 bDescriptorType; //(0x21h)
bumisee 0:fb1f6d3926fe 249 u16 bcdHID; // HID specs release number
bumisee 0:fb1f6d3926fe 250 u8 bCountryCode; //0X00 for no country-code
bumisee 0:fb1f6d3926fe 251 u8 bNumDescriptors;//the number of class descriptors that
bumisee 0:fb1f6d3926fe 252 //are subordinated to this descriptor.
bumisee 0:fb1f6d3926fe 253 u8 bDescriptorType2; //2? the type of descriptor that is subordinated
bumisee 0:fb1f6d3926fe 254 //to the class descriptor. Minimun 1, due it
bumisee 0:fb1f6d3926fe 255 //has to have at least 1 report descriptor and/Or
bumisee 0:fb1f6d3926fe 256 //one or more phsical descriptors.
bumisee 0:fb1f6d3926fe 257 //A report descriptionr (required) is type 22h.
bumisee 0:fb1f6d3926fe 258 u16 wDescriptorLength;
bumisee 0:fb1f6d3926fe 259
bumisee 0:fb1f6d3926fe 260 //u8 bDescriptorTyepe; //<- Optional; The type of descriptor that follows
bumisee 0:fb1f6d3926fe 261 //A physical descriptior is 0x23h
bumisee 0:fb1f6d3926fe 262 //u16 wDescriptorLength2;
bumisee 0:fb1f6d3926fe 263
bumisee 0:fb1f6d3926fe 264 } HIDDescriptor;
bumisee 0:fb1f6d3926fe 265
bumisee 0:fb1f6d3926fe 266 //============================================================================
bumisee 0:fb1f6d3926fe 267 //============================================================================
bumisee 0:fb1f6d3926fe 268
bumisee 0:fb1f6d3926fe 269
bumisee 0:fb1f6d3926fe 270 void USBInit();
bumisee 0:fb1f6d3926fe 271 int USBLoop(int u_flag, u8* u_data);
bumisee 0:fb1f6d3926fe 272
bumisee 0:fb1f6d3926fe 273 u8* USBGetBuffer(u32* len);
bumisee 0:fb1f6d3926fe 274
bumisee 0:fb1f6d3926fe 275 // Optional callback for transfers, called at interrupt time
bumisee 0:fb1f6d3926fe 276 typedef void (*USBCallback)(int device, int endpoint, int status, u8* data, int len, void* userData);
bumisee 0:fb1f6d3926fe 277
bumisee 0:fb1f6d3926fe 278 // Transfers
bumisee 0:fb1f6d3926fe 279 int USBControlTransfer(int device, int request_type, int request, int value, int index, u8* data, int length, USBCallback callback = 0, void* userData = 0);
bumisee 0:fb1f6d3926fe 280 int USBInterruptTransfer(int device, int ep, u8* data, int length, USBCallback callback = 0, void* userData = 0);
bumisee 0:fb1f6d3926fe 281 int USBBulkTransfer(int device, int ep, u8* data, int length, USBCallback callback = 0, void* userData = 0);
bumisee 0:fb1f6d3926fe 282
bumisee 0:fb1f6d3926fe 283 // Standard Device methods
bumisee 0:fb1f6d3926fe 284 int GetDescriptor(int device, int descType, int descIndex, u8* data, int length);
bumisee 0:fb1f6d3926fe 285 int GetString(int device, int index, char* dst, int length);
bumisee 0:fb1f6d3926fe 286 int SetAddress(int device, int new_addr);
bumisee 0:fb1f6d3926fe 287 int SetConfiguration(int device, int configNum);
bumisee 0:fb1f6d3926fe 288 int SetInterface(int device, int ifNum, int altNum);
bumisee 0:fb1f6d3926fe 289 int SetReport(int device);
bumisee 0:fb1f6d3926fe 290 int GetReport(int device, int descType,int descIndex, u8* data, int length);
bumisee 0:fb1f6d3926fe 291 // Implemented to notify app of the arrival of a device
bumisee 0:fb1f6d3926fe 292 void OnLoadDevice(int device, DeviceDescriptor* deviceDesc, InterfaceDescriptor* interfaceDesc);
bumisee 0:fb1f6d3926fe 293
bumisee 0:fb1f6d3926fe 294
bumisee 0:fb1f6d3926fe 295 #endif