Running multiple threads on mbed using RTOS

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player_appbd

Committer:
wschon
Date:
Sun Feb 28 22:40:13 2016 +0000
Revision:
1:2129bb91c172
Added USB libraries;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wschon 1:2129bb91c172 1 /* mbed USBHost Library
wschon 1:2129bb91c172 2 * Copyright (c) 2006-2013 ARM Limited
wschon 1:2129bb91c172 3 *
wschon 1:2129bb91c172 4 * Licensed under the Apache License, Version 2.0 (the "License");
wschon 1:2129bb91c172 5 * you may not use this file except in compliance with the License.
wschon 1:2129bb91c172 6 * You may obtain a copy of the License at
wschon 1:2129bb91c172 7 *
wschon 1:2129bb91c172 8 * http://www.apache.org/licenses/LICENSE-2.0
wschon 1:2129bb91c172 9 *
wschon 1:2129bb91c172 10 * Unless required by applicable law or agreed to in writing, software
wschon 1:2129bb91c172 11 * distributed under the License is distributed on an "AS IS" BASIS,
wschon 1:2129bb91c172 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
wschon 1:2129bb91c172 13 * See the License for the specific language governing permissions and
wschon 1:2129bb91c172 14 * limitations under the License.
wschon 1:2129bb91c172 15 */
wschon 1:2129bb91c172 16
wschon 1:2129bb91c172 17 #ifndef USBHOST_H
wschon 1:2129bb91c172 18 #define USBHOST_H
wschon 1:2129bb91c172 19
wschon 1:2129bb91c172 20 #include "USBHALHost.h"
wschon 1:2129bb91c172 21 #include "USBDeviceConnected.h"
wschon 1:2129bb91c172 22 #include "IUSBEnumerator.h"
wschon 1:2129bb91c172 23 #include "USBHostConf.h"
wschon 1:2129bb91c172 24 #include "rtos.h"
wschon 1:2129bb91c172 25 #include "dbg.h"
wschon 1:2129bb91c172 26 #include "USBHostHub.h"
wschon 1:2129bb91c172 27
wschon 1:2129bb91c172 28 /**
wschon 1:2129bb91c172 29 * USBHost class
wschon 1:2129bb91c172 30 * This class is a singleton. All drivers have a reference on the static USBHost instance
wschon 1:2129bb91c172 31 */
wschon 1:2129bb91c172 32 class USBHost : public USBHALHost {
wschon 1:2129bb91c172 33 public:
wschon 1:2129bb91c172 34 /**
wschon 1:2129bb91c172 35 * Static method to create or retrieve the single USBHost instance
wschon 1:2129bb91c172 36 */
wschon 1:2129bb91c172 37 static USBHost * getHostInst();
wschon 1:2129bb91c172 38
wschon 1:2129bb91c172 39 /**
wschon 1:2129bb91c172 40 * Control read: setup stage, data stage and status stage
wschon 1:2129bb91c172 41 *
wschon 1:2129bb91c172 42 * @param dev the control read will be done for this device
wschon 1:2129bb91c172 43 * @param requestType request type
wschon 1:2129bb91c172 44 * @param request request
wschon 1:2129bb91c172 45 * @param value value
wschon 1:2129bb91c172 46 * @param index index
wschon 1:2129bb91c172 47 * @param buf pointer on a buffer where will be store the data received
wschon 1:2129bb91c172 48 * @param len length of the transfer
wschon 1:2129bb91c172 49 *
wschon 1:2129bb91c172 50 * @returns status of the control read
wschon 1:2129bb91c172 51 */
wschon 1:2129bb91c172 52 USB_TYPE controlRead(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len);
wschon 1:2129bb91c172 53
wschon 1:2129bb91c172 54 /**
wschon 1:2129bb91c172 55 * Control write: setup stage, data stage and status stage
wschon 1:2129bb91c172 56 *
wschon 1:2129bb91c172 57 * @param dev the control write will be done for this device
wschon 1:2129bb91c172 58 * @param requestType request type
wschon 1:2129bb91c172 59 * @param request request
wschon 1:2129bb91c172 60 * @param value value
wschon 1:2129bb91c172 61 * @param index index
wschon 1:2129bb91c172 62 * @param buf pointer on a buffer which will be written
wschon 1:2129bb91c172 63 * @param len length of the transfer
wschon 1:2129bb91c172 64 *
wschon 1:2129bb91c172 65 * @returns status of the control write
wschon 1:2129bb91c172 66 */
wschon 1:2129bb91c172 67 USB_TYPE controlWrite(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len);
wschon 1:2129bb91c172 68
wschon 1:2129bb91c172 69 /**
wschon 1:2129bb91c172 70 * Bulk read
wschon 1:2129bb91c172 71 *
wschon 1:2129bb91c172 72 * @param dev the bulk transfer will be done for this device
wschon 1:2129bb91c172 73 * @param ep USBEndpoint which will be used to read a packet
wschon 1:2129bb91c172 74 * @param buf pointer on a buffer where will be store the data received
wschon 1:2129bb91c172 75 * @param len length of the transfer
wschon 1:2129bb91c172 76 * @param blocking if true, the read is blocking (wait for completion)
wschon 1:2129bb91c172 77 *
wschon 1:2129bb91c172 78 * @returns status of the bulk read
wschon 1:2129bb91c172 79 */
wschon 1:2129bb91c172 80 USB_TYPE bulkRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
wschon 1:2129bb91c172 81
wschon 1:2129bb91c172 82 /**
wschon 1:2129bb91c172 83 * Bulk write
wschon 1:2129bb91c172 84 *
wschon 1:2129bb91c172 85 * @param dev the bulk transfer will be done for this device
wschon 1:2129bb91c172 86 * @param ep USBEndpoint which will be used to write a packet
wschon 1:2129bb91c172 87 * @param buf pointer on a buffer which will be written
wschon 1:2129bb91c172 88 * @param len length of the transfer
wschon 1:2129bb91c172 89 * @param blocking if true, the write is blocking (wait for completion)
wschon 1:2129bb91c172 90 *
wschon 1:2129bb91c172 91 * @returns status of the bulk write
wschon 1:2129bb91c172 92 */
wschon 1:2129bb91c172 93 USB_TYPE bulkWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
wschon 1:2129bb91c172 94
wschon 1:2129bb91c172 95 /**
wschon 1:2129bb91c172 96 * Interrupt read
wschon 1:2129bb91c172 97 *
wschon 1:2129bb91c172 98 * @param dev the bulk transfer will be done for this device
wschon 1:2129bb91c172 99 * @param ep USBEndpoint which will be used to write a packet
wschon 1:2129bb91c172 100 * @param buf pointer on a buffer which will be written
wschon 1:2129bb91c172 101 * @param len length of the transfer
wschon 1:2129bb91c172 102 * @param blocking if true, the read is blocking (wait for completion)
wschon 1:2129bb91c172 103 *
wschon 1:2129bb91c172 104 * @returns status of the interrupt read
wschon 1:2129bb91c172 105 */
wschon 1:2129bb91c172 106 USB_TYPE interruptRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
wschon 1:2129bb91c172 107
wschon 1:2129bb91c172 108 /**
wschon 1:2129bb91c172 109 * Interrupt write
wschon 1:2129bb91c172 110 *
wschon 1:2129bb91c172 111 * @param dev the bulk transfer will be done for this device
wschon 1:2129bb91c172 112 * @param ep USBEndpoint which will be used to write a packet
wschon 1:2129bb91c172 113 * @param buf pointer on a buffer which will be written
wschon 1:2129bb91c172 114 * @param len length of the transfer
wschon 1:2129bb91c172 115 * @param blocking if true, the write is blocking (wait for completion)
wschon 1:2129bb91c172 116 *
wschon 1:2129bb91c172 117 * @returns status of the interrupt write
wschon 1:2129bb91c172 118 */
wschon 1:2129bb91c172 119 USB_TYPE interruptWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true);
wschon 1:2129bb91c172 120
wschon 1:2129bb91c172 121 /**
wschon 1:2129bb91c172 122 * Enumerate a device.
wschon 1:2129bb91c172 123 *
wschon 1:2129bb91c172 124 * @param dev device which will be enumerated
wschon 1:2129bb91c172 125 *
wschon 1:2129bb91c172 126 * @returns status of the enumeration
wschon 1:2129bb91c172 127 */
wschon 1:2129bb91c172 128 USB_TYPE enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerator);
wschon 1:2129bb91c172 129
wschon 1:2129bb91c172 130 /**
wschon 1:2129bb91c172 131 * reset a specific device
wschon 1:2129bb91c172 132 *
wschon 1:2129bb91c172 133 * @param dev device which will be resetted
wschon 1:2129bb91c172 134 */
wschon 1:2129bb91c172 135 USB_TYPE resetDevice(USBDeviceConnected * dev);
wschon 1:2129bb91c172 136
wschon 1:2129bb91c172 137 /**
wschon 1:2129bb91c172 138 * Get a device
wschon 1:2129bb91c172 139 *
wschon 1:2129bb91c172 140 * @param index index of the device which will be returned
wschon 1:2129bb91c172 141 *
wschon 1:2129bb91c172 142 * @returns pointer on the "index" device
wschon 1:2129bb91c172 143 */
wschon 1:2129bb91c172 144 USBDeviceConnected * getDevice(uint8_t index);
wschon 1:2129bb91c172 145
wschon 1:2129bb91c172 146 /*
wschon 1:2129bb91c172 147 * If there is a HID device connected, the host stores the length of the report descriptor.
wschon 1:2129bb91c172 148 * This avoid to the driver to re-ask the configuration descriptor to request the report descriptor
wschon 1:2129bb91c172 149 *
wschon 1:2129bb91c172 150 * @returns length of the report descriptor
wschon 1:2129bb91c172 151 */
wschon 1:2129bb91c172 152 inline uint16_t getLengthReportDescr() {
wschon 1:2129bb91c172 153 return lenReportDescr;
wschon 1:2129bb91c172 154 };
wschon 1:2129bb91c172 155
wschon 1:2129bb91c172 156 /**
wschon 1:2129bb91c172 157 * register a driver into the host associated with a callback function called when the device is disconnected
wschon 1:2129bb91c172 158 *
wschon 1:2129bb91c172 159 * @param dev device
wschon 1:2129bb91c172 160 * @param intf interface number
wschon 1:2129bb91c172 161 * @param tptr pointer to the object to call the member function on
wschon 1:2129bb91c172 162 * @param mptr pointer to the member function to be called
wschon 1:2129bb91c172 163 */
wschon 1:2129bb91c172 164 template<typename T>
wschon 1:2129bb91c172 165 inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, T* tptr, void (T::*mptr)(void)) {
wschon 1:2129bb91c172 166 int index = findDevice(dev);
wschon 1:2129bb91c172 167 if ((index != -1) && (mptr != NULL) && (tptr != NULL)) {
wschon 1:2129bb91c172 168 USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
wschon 1:2129bb91c172 169 deviceAttachedDriver[index][intf] = true;
wschon 1:2129bb91c172 170 dev->onDisconnect(intf, tptr, mptr);
wschon 1:2129bb91c172 171 }
wschon 1:2129bb91c172 172 }
wschon 1:2129bb91c172 173
wschon 1:2129bb91c172 174 /**
wschon 1:2129bb91c172 175 * register a driver into the host associated with a callback function called when the device is disconnected
wschon 1:2129bb91c172 176 *
wschon 1:2129bb91c172 177 * @param dev device
wschon 1:2129bb91c172 178 * @param intf interface number
wschon 1:2129bb91c172 179 * @param fn callback called when the specified device has been disconnected
wschon 1:2129bb91c172 180 */
wschon 1:2129bb91c172 181 inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, void (*fn)(void)) {
wschon 1:2129bb91c172 182 int index = findDevice(dev);
wschon 1:2129bb91c172 183 if ((index != -1) && (fn != NULL)) {
wschon 1:2129bb91c172 184 USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
wschon 1:2129bb91c172 185 deviceAttachedDriver[index][intf] = true;
wschon 1:2129bb91c172 186 dev->onDisconnect(intf, fn);
wschon 1:2129bb91c172 187 }
wschon 1:2129bb91c172 188 }
wschon 1:2129bb91c172 189
wschon 1:2129bb91c172 190 friend class USBHostHub;
wschon 1:2129bb91c172 191
wschon 1:2129bb91c172 192 protected:
wschon 1:2129bb91c172 193
wschon 1:2129bb91c172 194 /**
wschon 1:2129bb91c172 195 * Virtual method called when a transfer has been completed
wschon 1:2129bb91c172 196 *
wschon 1:2129bb91c172 197 * @param addr list of the TDs which have been completed
wschon 1:2129bb91c172 198 */
wschon 1:2129bb91c172 199 virtual void transferCompleted(volatile uint32_t addr);
wschon 1:2129bb91c172 200
wschon 1:2129bb91c172 201 /**
wschon 1:2129bb91c172 202 * Virtual method called when a device has been connected
wschon 1:2129bb91c172 203 *
wschon 1:2129bb91c172 204 * @param hub hub number of the device
wschon 1:2129bb91c172 205 * @param port port number of the device
wschon 1:2129bb91c172 206 * @param lowSpeed 1 if low speed, 0 otherwise
wschon 1:2129bb91c172 207 * @param hub_parent reference on the parent hub
wschon 1:2129bb91c172 208 */
wschon 1:2129bb91c172 209 virtual void deviceConnected(int hub, int port, bool lowSpeed, USBHostHub * hub_parent = NULL);
wschon 1:2129bb91c172 210
wschon 1:2129bb91c172 211 /**
wschon 1:2129bb91c172 212 * Virtuel method called when a device has been disconnected
wschon 1:2129bb91c172 213 *
wschon 1:2129bb91c172 214 * @param hub hub number of the device
wschon 1:2129bb91c172 215 * @param port port number of the device
wschon 1:2129bb91c172 216 * @param addr list of the TDs which have been completed to dequeue freed TDs
wschon 1:2129bb91c172 217 */
wschon 1:2129bb91c172 218 virtual void deviceDisconnected(int hub, int port, USBHostHub * hub_parent, volatile uint32_t addr);
wschon 1:2129bb91c172 219
wschon 1:2129bb91c172 220
wschon 1:2129bb91c172 221 private:
wschon 1:2129bb91c172 222 // singleton class -> constructor is private
wschon 1:2129bb91c172 223 USBHost();
wschon 1:2129bb91c172 224 static USBHost * instHost;
wschon 1:2129bb91c172 225 uint16_t lenReportDescr;
wschon 1:2129bb91c172 226
wschon 1:2129bb91c172 227 // endpoints
wschon 1:2129bb91c172 228 void unqueueEndpoint(USBEndpoint * ep) ;
wschon 1:2129bb91c172 229 USBEndpoint endpoints[MAX_ENDPOINT];
wschon 1:2129bb91c172 230 USBEndpoint* volatile control;
wschon 1:2129bb91c172 231
wschon 1:2129bb91c172 232 USBEndpoint* volatile headControlEndpoint;
wschon 1:2129bb91c172 233 USBEndpoint* volatile headBulkEndpoint;
wschon 1:2129bb91c172 234 USBEndpoint* volatile headInterruptEndpoint;
wschon 1:2129bb91c172 235
wschon 1:2129bb91c172 236 USBEndpoint* volatile tailControlEndpoint;
wschon 1:2129bb91c172 237 USBEndpoint* volatile tailBulkEndpoint;
wschon 1:2129bb91c172 238 USBEndpoint* volatile tailInterruptEndpoint;
wschon 1:2129bb91c172 239
wschon 1:2129bb91c172 240 bool controlEndpointAllocated;
wschon 1:2129bb91c172 241
wschon 1:2129bb91c172 242 // devices connected
wschon 1:2129bb91c172 243 USBDeviceConnected devices[MAX_DEVICE_CONNECTED];
wschon 1:2129bb91c172 244 bool deviceInUse[MAX_DEVICE_CONNECTED];
wschon 1:2129bb91c172 245 bool deviceAttachedDriver[MAX_DEVICE_CONNECTED][MAX_INTF];
wschon 1:2129bb91c172 246 bool deviceReset[MAX_DEVICE_CONNECTED];
wschon 1:2129bb91c172 247 bool deviceInited[MAX_DEVICE_CONNECTED];
wschon 1:2129bb91c172 248
wschon 1:2129bb91c172 249 #if MAX_HUB_NB
wschon 1:2129bb91c172 250 USBHostHub hubs[MAX_HUB_NB];
wschon 1:2129bb91c172 251 bool hub_in_use[MAX_HUB_NB];
wschon 1:2129bb91c172 252 #endif
wschon 1:2129bb91c172 253
wschon 1:2129bb91c172 254 // to store a setup packet
wschon 1:2129bb91c172 255 uint8_t setupPacket[8];
wschon 1:2129bb91c172 256
wschon 1:2129bb91c172 257 typedef struct {
wschon 1:2129bb91c172 258 uint8_t event_id;
wschon 1:2129bb91c172 259 void * td_addr;
wschon 1:2129bb91c172 260 uint8_t hub;
wschon 1:2129bb91c172 261 uint8_t port;
wschon 1:2129bb91c172 262 uint8_t lowSpeed;
wschon 1:2129bb91c172 263 uint8_t td_state;
wschon 1:2129bb91c172 264 void * hub_parent;
wschon 1:2129bb91c172 265 } message_t;
wschon 1:2129bb91c172 266
wschon 1:2129bb91c172 267 Thread usbThread;
wschon 1:2129bb91c172 268 void usb_process();
wschon 1:2129bb91c172 269 static void usb_process_static(void const * arg);
wschon 1:2129bb91c172 270 Mail<message_t, 10> mail_usb_event;
wschon 1:2129bb91c172 271 Mutex usb_mutex;
wschon 1:2129bb91c172 272 Mutex td_mutex;
wschon 1:2129bb91c172 273
wschon 1:2129bb91c172 274 // buffer for conf descriptor
wschon 1:2129bb91c172 275 uint8_t data[300];
wschon 1:2129bb91c172 276
wschon 1:2129bb91c172 277 /**
wschon 1:2129bb91c172 278 * Add a transfer on the TD linked list associated to an ED
wschon 1:2129bb91c172 279 *
wschon 1:2129bb91c172 280 * @param ed the transfer is associated to this ed
wschon 1:2129bb91c172 281 * @param buf pointer on a buffer where will be read/write data to send or receive
wschon 1:2129bb91c172 282 * @param len transfer length
wschon 1:2129bb91c172 283 *
wschon 1:2129bb91c172 284 * @return status of the transfer
wschon 1:2129bb91c172 285 */
wschon 1:2129bb91c172 286 USB_TYPE addTransfer(USBEndpoint * ed, uint8_t * buf, uint32_t len) ;
wschon 1:2129bb91c172 287
wschon 1:2129bb91c172 288 /**
wschon 1:2129bb91c172 289 * Link the USBEndpoint to the linked list and attach an USBEndpoint this USBEndpoint to a device
wschon 1:2129bb91c172 290 *
wschon 1:2129bb91c172 291 * @param dev pointer on a USBDeviceConnected object
wschon 1:2129bb91c172 292 * @param ep pointer on the USBEndpoint which will be added
wschon 1:2129bb91c172 293 *
wschon 1:2129bb91c172 294 * return true if successful
wschon 1:2129bb91c172 295 */
wschon 1:2129bb91c172 296 bool addEndpoint(USBDeviceConnected * dev, uint8_t intf_nb, USBEndpoint * ep) ;
wschon 1:2129bb91c172 297
wschon 1:2129bb91c172 298 /**
wschon 1:2129bb91c172 299 * Create an USBEndpoint descriptor. Warning: the USBEndpoint is not linked.
wschon 1:2129bb91c172 300 *
wschon 1:2129bb91c172 301 * @param type USBEndpoint type (CONTROL_ENDPOINT, BULK_ENDPOINT, INTERRUPT_ENDPOINT)
wschon 1:2129bb91c172 302 * @param dir USBEndpoint direction (no meaning for CONTROL_ENDPOINT)
wschon 1:2129bb91c172 303 * @param size USBEndpoint max packet size
wschon 1:2129bb91c172 304 * @param addr USBEndpoint address
wschon 1:2129bb91c172 305 *
wschon 1:2129bb91c172 306 * @returns pointer on the USBEndpoint created
wschon 1:2129bb91c172 307 */
wschon 1:2129bb91c172 308 USBEndpoint * newEndpoint(ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint32_t size, uint8_t addr) ;
wschon 1:2129bb91c172 309
wschon 1:2129bb91c172 310 /**
wschon 1:2129bb91c172 311 * Request the device descriptor
wschon 1:2129bb91c172 312 *
wschon 1:2129bb91c172 313 * @param dev request the device descriptor on this device
wschon 1:2129bb91c172 314 * @param buf buffer to store the device descriptor
wschon 1:2129bb91c172 315 * @param max_len_buf maximum size of buf
wschon 1:2129bb91c172 316 * @param len_dev_descr pointer to store the length of the packet transferred
wschon 1:2129bb91c172 317 */
wschon 1:2129bb91c172 318 USB_TYPE getDeviceDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t max_len_buf, uint16_t * len_dev_descr = NULL);
wschon 1:2129bb91c172 319
wschon 1:2129bb91c172 320 /**
wschon 1:2129bb91c172 321 * Request the configuration descriptor
wschon 1:2129bb91c172 322 *
wschon 1:2129bb91c172 323 * @param dev request the configuration descriptor on this device
wschon 1:2129bb91c172 324 * @param buf buffer to store the configuration descriptor
wschon 1:2129bb91c172 325 * @param max_len_buf maximum size of buf
wschon 1:2129bb91c172 326 * @param len_conf_descr pointer to store the length of the packet transferred
wschon 1:2129bb91c172 327 */
wschon 1:2129bb91c172 328 USB_TYPE getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t max_len_buf, uint16_t * len_conf_descr = NULL);
wschon 1:2129bb91c172 329
wschon 1:2129bb91c172 330 /**
wschon 1:2129bb91c172 331 * Set the address of a specific device
wschon 1:2129bb91c172 332 *
wschon 1:2129bb91c172 333 * @param dev device to set the address
wschon 1:2129bb91c172 334 * @param address address
wschon 1:2129bb91c172 335 */
wschon 1:2129bb91c172 336 USB_TYPE setAddress(USBDeviceConnected * dev, uint8_t address);
wschon 1:2129bb91c172 337
wschon 1:2129bb91c172 338 /**
wschon 1:2129bb91c172 339 * Set the configuration of a device
wschon 1:2129bb91c172 340 *
wschon 1:2129bb91c172 341 * @param dev device on which the specified configuration will be activated
wschon 1:2129bb91c172 342 * @param conf configuration number to activate (usually 1)
wschon 1:2129bb91c172 343 */
wschon 1:2129bb91c172 344 USB_TYPE setConfiguration(USBDeviceConnected * dev, uint8_t conf);
wschon 1:2129bb91c172 345
wschon 1:2129bb91c172 346 /**
wschon 1:2129bb91c172 347 * Free a specific device
wschon 1:2129bb91c172 348 *
wschon 1:2129bb91c172 349 * @param dev device to be freed
wschon 1:2129bb91c172 350 */
wschon 1:2129bb91c172 351 void freeDevice(USBDeviceConnected * dev);
wschon 1:2129bb91c172 352
wschon 1:2129bb91c172 353 USB_TYPE controlTransfer( USBDeviceConnected * dev,
wschon 1:2129bb91c172 354 uint8_t requestType,
wschon 1:2129bb91c172 355 uint8_t request,
wschon 1:2129bb91c172 356 uint32_t value,
wschon 1:2129bb91c172 357 uint32_t index,
wschon 1:2129bb91c172 358 uint8_t * buf,
wschon 1:2129bb91c172 359 uint32_t len,
wschon 1:2129bb91c172 360 bool write);
wschon 1:2129bb91c172 361
wschon 1:2129bb91c172 362 USB_TYPE generalTransfer( USBDeviceConnected * dev,
wschon 1:2129bb91c172 363 USBEndpoint * ep,
wschon 1:2129bb91c172 364 uint8_t * buf,
wschon 1:2129bb91c172 365 uint32_t len,
wschon 1:2129bb91c172 366 bool blocking,
wschon 1:2129bb91c172 367 ENDPOINT_TYPE type,
wschon 1:2129bb91c172 368 bool write) ;
wschon 1:2129bb91c172 369
wschon 1:2129bb91c172 370 void fillControlBuf(uint8_t requestType, uint8_t request, uint16_t value, uint16_t index, int len) ;
wschon 1:2129bb91c172 371 void parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator) ;
wschon 1:2129bb91c172 372 int findDevice(USBDeviceConnected * dev) ;
wschon 1:2129bb91c172 373 int findDevice(uint8_t hub, uint8_t port, USBHostHub * hub_parent = NULL) ;
wschon 1:2129bb91c172 374 uint8_t numberDriverAttached(USBDeviceConnected * dev);
wschon 1:2129bb91c172 375
wschon 1:2129bb91c172 376 /////////////////////////
wschon 1:2129bb91c172 377 /// FOR DEBUG
wschon 1:2129bb91c172 378 /////////////////////////
wschon 1:2129bb91c172 379 void printList(ENDPOINT_TYPE type);
wschon 1:2129bb91c172 380
wschon 1:2129bb91c172 381 };
wschon 1:2129bb91c172 382
wschon 1:2129bb91c172 383 #endif