Vodafone K3770/K3772-Z modems driver & networking library
This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/
USBHostWANDongleLib/USBHost/USBHost.h@0:bd5343539e38, 2012-08-17 (annotated)
- Committer:
- donatien
- Date:
- Fri Aug 17 15:21:55 2012 +0000
- Revision:
- 0:bd5343539e38
Initial public commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:bd5343539e38 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
donatien | 0:bd5343539e38 | 2 | * |
donatien | 0:bd5343539e38 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
donatien | 0:bd5343539e38 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
donatien | 0:bd5343539e38 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
donatien | 0:bd5343539e38 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
donatien | 0:bd5343539e38 | 7 | * Software is furnished to do so, subject to the following conditions: |
donatien | 0:bd5343539e38 | 8 | * |
donatien | 0:bd5343539e38 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
donatien | 0:bd5343539e38 | 10 | * substantial portions of the Software. |
donatien | 0:bd5343539e38 | 11 | * |
donatien | 0:bd5343539e38 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
donatien | 0:bd5343539e38 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
donatien | 0:bd5343539e38 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
donatien | 0:bd5343539e38 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:bd5343539e38 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
donatien | 0:bd5343539e38 | 17 | */ |
donatien | 0:bd5343539e38 | 18 | |
donatien | 0:bd5343539e38 | 19 | #ifndef USBHOST_H |
donatien | 0:bd5343539e38 | 20 | #define USBHOST_H |
donatien | 0:bd5343539e38 | 21 | |
donatien | 0:bd5343539e38 | 22 | #include "USBHALHost.h" |
donatien | 0:bd5343539e38 | 23 | #include "USBDeviceConnected.h" |
donatien | 0:bd5343539e38 | 24 | #include "USBEndpoint.h" |
donatien | 0:bd5343539e38 | 25 | #include "IUSBEnumerator.h" |
donatien | 0:bd5343539e38 | 26 | |
donatien | 0:bd5343539e38 | 27 | #define MAX_DEVICE_NB 1 |
donatien | 0:bd5343539e38 | 28 | |
donatien | 0:bd5343539e38 | 29 | // singleton class |
donatien | 0:bd5343539e38 | 30 | class USBHost : public USBHALHost { |
donatien | 0:bd5343539e38 | 31 | public: |
donatien | 0:bd5343539e38 | 32 | /* |
donatien | 0:bd5343539e38 | 33 | * Static method to create or retrieve the single USBHost instance |
donatien | 0:bd5343539e38 | 34 | */ |
donatien | 0:bd5343539e38 | 35 | static USBHost * getHostInst(); |
donatien | 0:bd5343539e38 | 36 | |
donatien | 0:bd5343539e38 | 37 | USB_TYPE getDeviceDescriptor(USBDeviceConnected * dev, uint8_t * buf) ; |
donatien | 0:bd5343539e38 | 38 | USB_TYPE getConfigurationDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint16_t * len_conf_descr = NULL) ; |
donatien | 0:bd5343539e38 | 39 | USB_TYPE setConfiguration(USBDeviceConnected * dev, uint8_t conf) ; |
donatien | 0:bd5343539e38 | 40 | USB_TYPE getStringDescriptor(USBDeviceConnected * dev, uint8_t index, uint8_t * buf) ; |
donatien | 0:bd5343539e38 | 41 | USB_TYPE getReportDescriptor(USBDeviceConnected * dev, uint8_t * buf, uint8_t len) ; |
donatien | 0:bd5343539e38 | 42 | |
donatien | 0:bd5343539e38 | 43 | /* |
donatien | 0:bd5343539e38 | 44 | * Control read: setup stage, data stage and status stage |
donatien | 0:bd5343539e38 | 45 | * |
donatien | 0:bd5343539e38 | 46 | * @param dev the control read will be done for this device |
donatien | 0:bd5343539e38 | 47 | * @param requestType request type |
donatien | 0:bd5343539e38 | 48 | * @param request request |
donatien | 0:bd5343539e38 | 49 | * @param value value |
donatien | 0:bd5343539e38 | 50 | * @param index index |
donatien | 0:bd5343539e38 | 51 | * @param buf pointer on a buffer where will be store the data received |
donatien | 0:bd5343539e38 | 52 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 53 | * |
donatien | 0:bd5343539e38 | 54 | * @returns status of the control read |
donatien | 0:bd5343539e38 | 55 | */ |
donatien | 0:bd5343539e38 | 56 | USB_TYPE controlRead(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len) ; |
donatien | 0:bd5343539e38 | 57 | |
donatien | 0:bd5343539e38 | 58 | /* |
donatien | 0:bd5343539e38 | 59 | * Control write: setup stage, data stage and status stage |
donatien | 0:bd5343539e38 | 60 | * |
donatien | 0:bd5343539e38 | 61 | * @param dev the control write will be done for this device |
donatien | 0:bd5343539e38 | 62 | * @param requestType request type |
donatien | 0:bd5343539e38 | 63 | * @param request request |
donatien | 0:bd5343539e38 | 64 | * @param value value |
donatien | 0:bd5343539e38 | 65 | * @param index index |
donatien | 0:bd5343539e38 | 66 | * @param buf pointer on a buffer which will be written |
donatien | 0:bd5343539e38 | 67 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 68 | * |
donatien | 0:bd5343539e38 | 69 | * @returns status of the control write |
donatien | 0:bd5343539e38 | 70 | */ |
donatien | 0:bd5343539e38 | 71 | USB_TYPE controlWrite(USBDeviceConnected * dev, uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, uint8_t * buf, uint32_t len) ; |
donatien | 0:bd5343539e38 | 72 | |
donatien | 0:bd5343539e38 | 73 | |
donatien | 0:bd5343539e38 | 74 | /* |
donatien | 0:bd5343539e38 | 75 | * Bulk read |
donatien | 0:bd5343539e38 | 76 | * |
donatien | 0:bd5343539e38 | 77 | * @param dev the bulk transfer will be done for this device |
donatien | 0:bd5343539e38 | 78 | * @param ep USBEndpoint which will be used to read a packet |
donatien | 0:bd5343539e38 | 79 | * @param buf pointer on a buffer where will be store the data received |
donatien | 0:bd5343539e38 | 80 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 81 | * @param blocking if true, the read is blocking (wait for completion) |
donatien | 0:bd5343539e38 | 82 | * |
donatien | 0:bd5343539e38 | 83 | * @returns status of the bulk read |
donatien | 0:bd5343539e38 | 84 | */ |
donatien | 0:bd5343539e38 | 85 | USB_TYPE bulkRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true) ; |
donatien | 0:bd5343539e38 | 86 | |
donatien | 0:bd5343539e38 | 87 | /* |
donatien | 0:bd5343539e38 | 88 | * Bulk write |
donatien | 0:bd5343539e38 | 89 | * |
donatien | 0:bd5343539e38 | 90 | * @param dev the bulk transfer will be done for this device |
donatien | 0:bd5343539e38 | 91 | * @param ep USBEndpoint which will be used to write a packet |
donatien | 0:bd5343539e38 | 92 | * @param buf pointer on a buffer which will be written |
donatien | 0:bd5343539e38 | 93 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 94 | * @param blocking if true, the write is blocking (wait for completion) |
donatien | 0:bd5343539e38 | 95 | * |
donatien | 0:bd5343539e38 | 96 | * @returns status of the bulk write |
donatien | 0:bd5343539e38 | 97 | */ |
donatien | 0:bd5343539e38 | 98 | USB_TYPE bulkWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true) ; |
donatien | 0:bd5343539e38 | 99 | |
donatien | 0:bd5343539e38 | 100 | /* |
donatien | 0:bd5343539e38 | 101 | * Interrupt read |
donatien | 0:bd5343539e38 | 102 | * |
donatien | 0:bd5343539e38 | 103 | * @param dev the bulk transfer will be done for this device |
donatien | 0:bd5343539e38 | 104 | * @param ep USBEndpoint which will be used to write a packet |
donatien | 0:bd5343539e38 | 105 | * @param buf pointer on a buffer which will be written |
donatien | 0:bd5343539e38 | 106 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 107 | * @param blocking if true, the read is blocking (wait for completion) |
donatien | 0:bd5343539e38 | 108 | * |
donatien | 0:bd5343539e38 | 109 | * @returns status of the interrupt read |
donatien | 0:bd5343539e38 | 110 | */ |
donatien | 0:bd5343539e38 | 111 | USB_TYPE interruptRead(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true) ; |
donatien | 0:bd5343539e38 | 112 | |
donatien | 0:bd5343539e38 | 113 | /* |
donatien | 0:bd5343539e38 | 114 | * Interrupt write |
donatien | 0:bd5343539e38 | 115 | * |
donatien | 0:bd5343539e38 | 116 | * @param dev the bulk transfer will be done for this device |
donatien | 0:bd5343539e38 | 117 | * @param ep USBEndpoint which will be used to write a packet |
donatien | 0:bd5343539e38 | 118 | * @param buf pointer on a buffer which will be written |
donatien | 0:bd5343539e38 | 119 | * @param len length of the transfer |
donatien | 0:bd5343539e38 | 120 | * @param blocking if true, the write is blocking (wait for completion) |
donatien | 0:bd5343539e38 | 121 | * |
donatien | 0:bd5343539e38 | 122 | * @returns status of the interrupt write |
donatien | 0:bd5343539e38 | 123 | */ |
donatien | 0:bd5343539e38 | 124 | USB_TYPE interruptWrite(USBDeviceConnected * dev, USBEndpoint * ep, uint8_t * buf, uint32_t len, bool blocking = true) ; |
donatien | 0:bd5343539e38 | 125 | |
donatien | 0:bd5343539e38 | 126 | /* |
donatien | 0:bd5343539e38 | 127 | * Enumerate a device. This method is responsible for: |
donatien | 0:bd5343539e38 | 128 | * - set the address of the device |
donatien | 0:bd5343539e38 | 129 | * - fill a USBDeviceConnected object: |
donatien | 0:bd5343539e38 | 130 | * - add interfaces, endpoints, ... |
donatien | 0:bd5343539e38 | 131 | * - set a configuration |
donatien | 0:bd5343539e38 | 132 | * |
donatien | 0:bd5343539e38 | 133 | * @param dev device which will be enumerated |
donatien | 0:bd5343539e38 | 134 | * |
donatien | 0:bd5343539e38 | 135 | * @returns status of the enumeration |
donatien | 0:bd5343539e38 | 136 | */ |
donatien | 0:bd5343539e38 | 137 | USB_TYPE enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerator) ; |
donatien | 0:bd5343539e38 | 138 | |
donatien | 0:bd5343539e38 | 139 | /* |
donatien | 0:bd5343539e38 | 140 | * Get a device |
donatien | 0:bd5343539e38 | 141 | * |
donatien | 0:bd5343539e38 | 142 | * @param index index of the device which will be returned |
donatien | 0:bd5343539e38 | 143 | * |
donatien | 0:bd5343539e38 | 144 | * @returns pointer on the "index" device |
donatien | 0:bd5343539e38 | 145 | */ |
donatien | 0:bd5343539e38 | 146 | USBDeviceConnected * getDevice(uint8_t index) ; |
donatien | 0:bd5343539e38 | 147 | |
donatien | 0:bd5343539e38 | 148 | /* |
donatien | 0:bd5343539e38 | 149 | * reset port and hub of a specific device |
donatien | 0:bd5343539e38 | 150 | * |
donatien | 0:bd5343539e38 | 151 | * @param pointer on the device hich will be reseted |
donatien | 0:bd5343539e38 | 152 | */ |
donatien | 0:bd5343539e38 | 153 | void resetDevice(USBDeviceConnected * dev) ; |
donatien | 0:bd5343539e38 | 154 | |
donatien | 0:bd5343539e38 | 155 | /* |
donatien | 0:bd5343539e38 | 156 | * If there is a HID device connected, the host stores the length of the report descriptor. |
donatien | 0:bd5343539e38 | 157 | * This avoid to the driver to re-ask the configuration descriptor to request the report descriptor |
donatien | 0:bd5343539e38 | 158 | * |
donatien | 0:bd5343539e38 | 159 | * @returns length of the report descriptor |
donatien | 0:bd5343539e38 | 160 | */ |
donatien | 0:bd5343539e38 | 161 | uint16_t getLengthReportDescr() { |
donatien | 0:bd5343539e38 | 162 | return lenReportDescr; |
donatien | 0:bd5343539e38 | 163 | }; |
donatien | 0:bd5343539e38 | 164 | |
donatien | 0:bd5343539e38 | 165 | /** |
donatien | 0:bd5343539e38 | 166 | * register a driver into the host associated with a callback function called when the device is disconnected |
donatien | 0:bd5343539e38 | 167 | * |
donatien | 0:bd5343539e38 | 168 | * @param dev device |
donatien | 0:bd5343539e38 | 169 | * @param tptr pointer to the object to call the member function on |
donatien | 0:bd5343539e38 | 170 | * @param mptr pointer to the member function to be called |
donatien | 0:bd5343539e38 | 171 | */ |
donatien | 0:bd5343539e38 | 172 | template<typename T> |
donatien | 0:bd5343539e38 | 173 | void registerDriver(USBDeviceConnected * dev, uint8_t intf, T* tptr, void (T::*mptr)(void)) { |
donatien | 0:bd5343539e38 | 174 | int index = findDevice(dev); |
donatien | 0:bd5343539e38 | 175 | if ((index != -1) && (mptr != NULL) && (tptr != NULL)) { |
donatien | 0:bd5343539e38 | 176 | dev->onDisconnect(intf, tptr, mptr); |
donatien | 0:bd5343539e38 | 177 | } |
donatien | 0:bd5343539e38 | 178 | } |
donatien | 0:bd5343539e38 | 179 | |
donatien | 0:bd5343539e38 | 180 | /** |
donatien | 0:bd5343539e38 | 181 | * register a driver into the host associated with a callback function called when the device is disconnected |
donatien | 0:bd5343539e38 | 182 | * |
donatien | 0:bd5343539e38 | 183 | * @param dev device |
donatien | 0:bd5343539e38 | 184 | * @param fn callback called when the specified device has been disconnected |
donatien | 0:bd5343539e38 | 185 | */ |
donatien | 0:bd5343539e38 | 186 | void registerDriver(USBDeviceConnected * dev, uint8_t intf, void (*fn)(void)) { |
donatien | 0:bd5343539e38 | 187 | int index = findDevice(dev); |
donatien | 0:bd5343539e38 | 188 | if ((index != -1) && (fn != NULL)) { |
donatien | 0:bd5343539e38 | 189 | dev->onDisconnect(intf, fn); |
donatien | 0:bd5343539e38 | 190 | } |
donatien | 0:bd5343539e38 | 191 | } |
donatien | 0:bd5343539e38 | 192 | |
donatien | 0:bd5343539e38 | 193 | |
donatien | 0:bd5343539e38 | 194 | protected: |
donatien | 0:bd5343539e38 | 195 | |
donatien | 0:bd5343539e38 | 196 | /* |
donatien | 0:bd5343539e38 | 197 | * Virtual method called when a device has been connected |
donatien | 0:bd5343539e38 | 198 | * |
donatien | 0:bd5343539e38 | 199 | * @param hub hub number of the device |
donatien | 0:bd5343539e38 | 200 | * @param port port number of the device |
donatien | 0:bd5343539e38 | 201 | * @param lowSpeed 1 if low speed, 0 otherwise |
donatien | 0:bd5343539e38 | 202 | */ |
donatien | 0:bd5343539e38 | 203 | virtual void deviceConnected(int hub, int port, bool lowSpeed) ; |
donatien | 0:bd5343539e38 | 204 | |
donatien | 0:bd5343539e38 | 205 | /* |
donatien | 0:bd5343539e38 | 206 | * Virtuel method called when a device has been disconnected |
donatien | 0:bd5343539e38 | 207 | * |
donatien | 0:bd5343539e38 | 208 | * @param hub hub number of the device |
donatien | 0:bd5343539e38 | 209 | * @param port port number of the device |
donatien | 0:bd5343539e38 | 210 | * @param addr list of the TDs which have been completed to dequeue freed TDs |
donatien | 0:bd5343539e38 | 211 | */ |
donatien | 0:bd5343539e38 | 212 | virtual void deviceDisconnected(int hub, int port, volatile uint32_t addr) ; |
donatien | 0:bd5343539e38 | 213 | |
donatien | 0:bd5343539e38 | 214 | /* |
donatien | 0:bd5343539e38 | 215 | * Virtual method called when a transfer has been completed |
donatien | 0:bd5343539e38 | 216 | * |
donatien | 0:bd5343539e38 | 217 | * @param addr list of the TDs which have been completed |
donatien | 0:bd5343539e38 | 218 | */ |
donatien | 0:bd5343539e38 | 219 | virtual void transferCompleted(volatile uint32_t addr) ; |
donatien | 0:bd5343539e38 | 220 | |
donatien | 0:bd5343539e38 | 221 | |
donatien | 0:bd5343539e38 | 222 | private: |
donatien | 0:bd5343539e38 | 223 | // singleton class -> constructor is private |
donatien | 0:bd5343539e38 | 224 | USBHost(); |
donatien | 0:bd5343539e38 | 225 | |
donatien | 0:bd5343539e38 | 226 | static USBHost * instHost; |
donatien | 0:bd5343539e38 | 227 | |
donatien | 0:bd5343539e38 | 228 | uint8_t nb_devices; |
donatien | 0:bd5343539e38 | 229 | uint16_t lenReportDescr; |
donatien | 0:bd5343539e38 | 230 | |
donatien | 0:bd5343539e38 | 231 | void fillControlBuf(uint8_t requestType, uint8_t request, uint32_t value, uint32_t index, int len) ; |
donatien | 0:bd5343539e38 | 232 | void parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator) ; |
donatien | 0:bd5343539e38 | 233 | void freeDevice(USBDeviceConnected * dev) ; |
donatien | 0:bd5343539e38 | 234 | int findDevice(USBDeviceConnected * dev) ; |
donatien | 0:bd5343539e38 | 235 | |
donatien | 0:bd5343539e38 | 236 | |
donatien | 0:bd5343539e38 | 237 | // endpoints |
donatien | 0:bd5343539e38 | 238 | void unqueueEndpoint(USBEndpoint * ep) ; |
donatien | 0:bd5343539e38 | 239 | USBEndpoint endpoints[MAX_ENDPOINT]; |
donatien | 0:bd5343539e38 | 240 | USBEndpoint* volatile control; |
donatien | 0:bd5343539e38 | 241 | |
donatien | 0:bd5343539e38 | 242 | USBEndpoint* volatile headControlEndpoint; |
donatien | 0:bd5343539e38 | 243 | USBEndpoint* volatile headBulkEndpoint; |
donatien | 0:bd5343539e38 | 244 | USBEndpoint* volatile headInterruptEndpoint; |
donatien | 0:bd5343539e38 | 245 | |
donatien | 0:bd5343539e38 | 246 | USBEndpoint* volatile tailControlEndpoint; |
donatien | 0:bd5343539e38 | 247 | USBEndpoint* volatile tailBulkEndpoint; |
donatien | 0:bd5343539e38 | 248 | USBEndpoint* volatile tailInterruptEndpoint; |
donatien | 0:bd5343539e38 | 249 | |
donatien | 0:bd5343539e38 | 250 | bool controlEndpointAllocated; |
donatien | 0:bd5343539e38 | 251 | |
donatien | 0:bd5343539e38 | 252 | |
donatien | 0:bd5343539e38 | 253 | // devices connected |
donatien | 0:bd5343539e38 | 254 | USBDeviceConnected devices[MAX_DEVICE_NB]; |
donatien | 0:bd5343539e38 | 255 | volatile bool deviceInUse[MAX_DEVICE_NB]; |
donatien | 0:bd5343539e38 | 256 | volatile bool deviceReset[MAX_DEVICE_NB]; |
donatien | 0:bd5343539e38 | 257 | |
donatien | 0:bd5343539e38 | 258 | /* |
donatien | 0:bd5343539e38 | 259 | * Add a transfer on the TD linked list associated to an ED |
donatien | 0:bd5343539e38 | 260 | * |
donatien | 0:bd5343539e38 | 261 | * @param ed the transfer is associated to this ed |
donatien | 0:bd5343539e38 | 262 | * @param buf pointer on a buffer where will be read/write data to send or receive |
donatien | 0:bd5343539e38 | 263 | * @param len transfer length |
donatien | 0:bd5343539e38 | 264 | * |
donatien | 0:bd5343539e38 | 265 | * @return status of the transfer |
donatien | 0:bd5343539e38 | 266 | */ |
donatien | 0:bd5343539e38 | 267 | USB_TYPE addTransfer(USBEndpoint * ed, uint8_t * buf, uint32_t len) ; |
donatien | 0:bd5343539e38 | 268 | |
donatien | 0:bd5343539e38 | 269 | /* |
donatien | 0:bd5343539e38 | 270 | * Link the USBEndpoint to the linked list and attach an USBEndpoint this USBEndpoint to a device |
donatien | 0:bd5343539e38 | 271 | * |
donatien | 0:bd5343539e38 | 272 | * @param dev pointer on a USBDeviceConnected object |
donatien | 0:bd5343539e38 | 273 | * @param ep pointer on the USBEndpoint which will be added |
donatien | 0:bd5343539e38 | 274 | * |
donatien | 0:bd5343539e38 | 275 | * return true if successful |
donatien | 0:bd5343539e38 | 276 | */ |
donatien | 0:bd5343539e38 | 277 | bool addEndpoint(USBDeviceConnected * dev, uint8_t intf_nb, USBEndpoint * ep) ; |
donatien | 0:bd5343539e38 | 278 | |
donatien | 0:bd5343539e38 | 279 | /* |
donatien | 0:bd5343539e38 | 280 | * Create an USBEndpoint descriptor. Warning: the USBEndpoint is not linked. |
donatien | 0:bd5343539e38 | 281 | * |
donatien | 0:bd5343539e38 | 282 | * @param type USBEndpoint type (CONTROL_ENDPOINT, BULK_ENDPOINT, INTERRUPT_ENDPOINT) |
donatien | 0:bd5343539e38 | 283 | * @param dir USBEndpoint direction (no meaning for CONTROL_ENDPOINT) |
donatien | 0:bd5343539e38 | 284 | * @param size USBEndpoint max packet size |
donatien | 0:bd5343539e38 | 285 | * @param addr USBEndpoint address |
donatien | 0:bd5343539e38 | 286 | * |
donatien | 0:bd5343539e38 | 287 | * @returns pointer on the USBEndpoint created |
donatien | 0:bd5343539e38 | 288 | */ |
donatien | 0:bd5343539e38 | 289 | USBEndpoint * newEndpoint(ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint32_t size, uint8_t addr) ; |
donatien | 0:bd5343539e38 | 290 | |
donatien | 0:bd5343539e38 | 291 | |
donatien | 0:bd5343539e38 | 292 | // to store a setup packet |
donatien | 0:bd5343539e38 | 293 | uint8_t setupPacket[8]; |
donatien | 0:bd5343539e38 | 294 | |
donatien | 0:bd5343539e38 | 295 | |
donatien | 0:bd5343539e38 | 296 | ///////////////////////// |
donatien | 0:bd5343539e38 | 297 | /// FOR DEBUG |
donatien | 0:bd5343539e38 | 298 | ///////////////////////// |
donatien | 0:bd5343539e38 | 299 | void printBulk(); |
donatien | 0:bd5343539e38 | 300 | void printInt(); |
donatien | 0:bd5343539e38 | 301 | |
donatien | 0:bd5343539e38 | 302 | }; |
donatien | 0:bd5343539e38 | 303 | |
donatien | 0:bd5343539e38 | 304 | #endif |