To support GR-PEACH

Fork of USBHost by mbed official

Committer:
ksekimoto
Date:
Sat Nov 07 12:21:03 2015 +0000
Revision:
33:0675edbac47d
Parent:
27:4206883f4cb7
The first version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 8:93da8ea2708b 1 /* mbed USBHost Library
samux 8:93da8ea2708b 2 * Copyright (c) 2006-2013 ARM Limited
samux 8:93da8ea2708b 3 *
samux 8:93da8ea2708b 4 * Licensed under the Apache License, Version 2.0 (the "License");
samux 8:93da8ea2708b 5 * you may not use this file except in compliance with the License.
samux 8:93da8ea2708b 6 * You may obtain a copy of the License at
samux 8:93da8ea2708b 7 *
samux 8:93da8ea2708b 8 * http://www.apache.org/licenses/LICENSE-2.0
samux 8:93da8ea2708b 9 *
samux 8:93da8ea2708b 10 * Unless required by applicable law or agreed to in writing, software
samux 8:93da8ea2708b 11 * distributed under the License is distributed on an "AS IS" BASIS,
samux 8:93da8ea2708b 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
samux 8:93da8ea2708b 13 * See the License for the specific language governing permissions and
samux 8:93da8ea2708b 14 * limitations under the License.
samux 8:93da8ea2708b 15 */
mbed_official 0:a554658735bf 16
mbed_official 0:a554658735bf 17 #include "USBHostSerial.h"
mbed_official 0:a554658735bf 18
mbed_official 0:a554658735bf 19 #if USBHOST_SERIAL
mbed_official 0:a554658735bf 20
mbed_official 0:a554658735bf 21 #include "dbg.h"
mbed_official 0:a554658735bf 22
mbed_official 19:bd46ea19486b 23 #define CHECK_INTERFACE(cls,subcls,proto) \
mbed_official 19:bd46ea19486b 24 (((cls == 0xFF) && (subcls == 0xFF) && (proto == 0xFF)) /* QUALCOM CDC */ || \
mbed_official 19:bd46ea19486b 25 ((cls == SERIAL_CLASS) && (subcls == 0x00) && (proto == 0x00)) /* STANDARD CDC */ )
samux 4:b320d68e98e7 26
mbed_official 19:bd46ea19486b 27 #if (USBHOST_SERIAL <= 1)
mbed_official 0:a554658735bf 28
mbed_official 24:868cbfe611a7 29 USBHostSerial::USBHostSerial()
mbed_official 19:bd46ea19486b 30 {
mbed_official 19:bd46ea19486b 31 host = USBHost::getHostInst();
mbed_official 19:bd46ea19486b 32 ports_found = 0;
mbed_official 0:a554658735bf 33 dev_connected = false;
mbed_official 0:a554658735bf 34 }
mbed_official 0:a554658735bf 35
mbed_official 0:a554658735bf 36 bool USBHostSerial::connected()
mbed_official 0:a554658735bf 37 {
mbed_official 0:a554658735bf 38 return dev_connected;
mbed_official 0:a554658735bf 39 }
mbed_official 0:a554658735bf 40
mbed_official 19:bd46ea19486b 41 void USBHostSerial::disconnect(void)
mbed_official 19:bd46ea19486b 42 {
mbed_official 19:bd46ea19486b 43 ports_found = 0;
mbed_official 19:bd46ea19486b 44 dev = NULL;
mbed_official 19:bd46ea19486b 45 }
mbed_official 19:bd46ea19486b 46
mbed_official 0:a554658735bf 47 bool USBHostSerial::connect() {
mbed_official 0:a554658735bf 48
mbed_official 24:868cbfe611a7 49 if (dev)
mbed_official 19:bd46ea19486b 50 {
mbed_official 24:868cbfe611a7 51 for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++)
mbed_official 19:bd46ea19486b 52 {
mbed_official 19:bd46ea19486b 53 USBDeviceConnected* d = host->getDevice(i);
mbed_official 19:bd46ea19486b 54 if (dev == d)
mbed_official 19:bd46ea19486b 55 return true;
mbed_official 19:bd46ea19486b 56 }
mbed_official 19:bd46ea19486b 57 disconnect();
mbed_official 0:a554658735bf 58 }
mbed_official 24:868cbfe611a7 59 for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++)
mbed_official 19:bd46ea19486b 60 {
mbed_official 19:bd46ea19486b 61 USBDeviceConnected* d = host->getDevice(i);
mbed_official 19:bd46ea19486b 62 if (d != NULL) {
mbed_official 24:868cbfe611a7 63
mbed_official 19:bd46ea19486b 64 USB_DBG("Trying to connect serial device \r\n");
mbed_official 19:bd46ea19486b 65 if(host->enumerate(d, this))
mbed_official 0:a554658735bf 66 break;
mbed_official 24:868cbfe611a7 67
mbed_official 19:bd46ea19486b 68 USBEndpoint* bulk_in = d->getEndpoint(port_intf, BULK_ENDPOINT, IN);
mbed_official 19:bd46ea19486b 69 USBEndpoint* bulk_out = d->getEndpoint(port_intf, BULK_ENDPOINT, OUT);
mbed_official 19:bd46ea19486b 70 if (bulk_in && bulk_out)
mbed_official 19:bd46ea19486b 71 {
mbed_official 19:bd46ea19486b 72 USBHostSerialPort::connect(host,d,port_intf,bulk_in, bulk_out);
mbed_official 19:bd46ea19486b 73 dev = d;
mbed_official 27:4206883f4cb7 74 dev_connected = true;
mbed_official 0:a554658735bf 75 }
mbed_official 0:a554658735bf 76 }
mbed_official 0:a554658735bf 77 }
mbed_official 19:bd46ea19486b 78 return dev != NULL;
mbed_official 19:bd46ea19486b 79 }
mbed_official 19:bd46ea19486b 80
mbed_official 19:bd46ea19486b 81 /*virtual*/ void USBHostSerial::setVidPid(uint16_t vid, uint16_t pid)
mbed_official 19:bd46ea19486b 82 {
mbed_official 19:bd46ea19486b 83 // we don't check VID/PID for MSD driver
mbed_official 19:bd46ea19486b 84 }
mbed_official 19:bd46ea19486b 85
mbed_official 19:bd46ea19486b 86 /*virtual*/ bool USBHostSerial::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed
mbed_official 19:bd46ea19486b 87 {
mbed_official 24:868cbfe611a7 88 if (!ports_found &&
mbed_official 19:bd46ea19486b 89 CHECK_INTERFACE(intf_class, intf_subclass, intf_protocol)) {
mbed_official 19:bd46ea19486b 90 port_intf = intf_nb;
mbed_official 19:bd46ea19486b 91 ports_found = true;
mbed_official 19:bd46ea19486b 92 return true;
mbed_official 19:bd46ea19486b 93 }
mbed_official 19:bd46ea19486b 94 return false;
mbed_official 19:bd46ea19486b 95 }
mbed_official 19:bd46ea19486b 96
mbed_official 19:bd46ea19486b 97 /*virtual*/ bool USBHostSerial::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used
mbed_official 19:bd46ea19486b 98 {
mbed_official 19:bd46ea19486b 99 if (ports_found && (intf_nb == port_intf)) {
mbed_official 24:868cbfe611a7 100 if (type == BULK_ENDPOINT)
mbed_official 19:bd46ea19486b 101 return true;
mbed_official 19:bd46ea19486b 102 }
mbed_official 0:a554658735bf 103 return false;
mbed_official 0:a554658735bf 104 }
mbed_official 0:a554658735bf 105
mbed_official 19:bd46ea19486b 106 #else // (USBHOST_SERIAL > 1)
mbed_official 19:bd46ea19486b 107
mbed_official 19:bd46ea19486b 108 //------------------------------------------------------------------------------
mbed_official 19:bd46ea19486b 109
mbed_official 24:868cbfe611a7 110 USBHostMultiSerial::USBHostMultiSerial()
mbed_official 19:bd46ea19486b 111 {
mbed_official 19:bd46ea19486b 112 host = USBHost::getHostInst();
mbed_official 19:bd46ea19486b 113 dev = NULL;
mbed_official 19:bd46ea19486b 114 memset(ports, NULL, sizeof(ports));
mbed_official 19:bd46ea19486b 115 ports_found = 0;
mbed_official 19:bd46ea19486b 116 dev_connected = false;
mbed_official 19:bd46ea19486b 117 }
mbed_official 19:bd46ea19486b 118
mbed_official 19:bd46ea19486b 119 USBHostMultiSerial::~USBHostMultiSerial()
mbed_official 19:bd46ea19486b 120 {
mbed_official 19:bd46ea19486b 121 disconnect();
mbed_official 19:bd46ea19486b 122 }
mbed_official 19:bd46ea19486b 123
mbed_official 19:bd46ea19486b 124 bool USBHostMultiSerial::connected()
mbed_official 19:bd46ea19486b 125 {
mbed_official 19:bd46ea19486b 126 return dev_connected;
mbed_official 19:bd46ea19486b 127 }
mbed_official 19:bd46ea19486b 128
mbed_official 19:bd46ea19486b 129 void USBHostMultiSerial::disconnect(void)
mbed_official 19:bd46ea19486b 130 {
mbed_official 24:868cbfe611a7 131 for (int port = 0; port < USBHOST_SERIAL; port ++)
mbed_official 19:bd46ea19486b 132 {
mbed_official 19:bd46ea19486b 133 if (ports[port])
mbed_official 19:bd46ea19486b 134 {
mbed_official 19:bd46ea19486b 135 delete ports[port];
mbed_official 19:bd46ea19486b 136 ports[port] = NULL;
mbed_official 19:bd46ea19486b 137 }
mbed_official 19:bd46ea19486b 138 }
mbed_official 19:bd46ea19486b 139 ports_found = 0;
mbed_official 19:bd46ea19486b 140 dev = NULL;
mbed_official 19:bd46ea19486b 141 }
mbed_official 19:bd46ea19486b 142
mbed_official 19:bd46ea19486b 143 bool USBHostMultiSerial::connect() {
mbed_official 19:bd46ea19486b 144
mbed_official 24:868cbfe611a7 145 if (dev)
mbed_official 19:bd46ea19486b 146 {
mbed_official 24:868cbfe611a7 147 for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++)
mbed_official 19:bd46ea19486b 148 {
mbed_official 19:bd46ea19486b 149 USBDeviceConnected* d = host->getDevice(i);
mbed_official 19:bd46ea19486b 150 if (dev == d)
mbed_official 19:bd46ea19486b 151 return true;
mbed_official 19:bd46ea19486b 152 }
mbed_official 19:bd46ea19486b 153 disconnect();
mbed_official 19:bd46ea19486b 154 }
mbed_official 24:868cbfe611a7 155 for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++)
mbed_official 19:bd46ea19486b 156 {
mbed_official 19:bd46ea19486b 157 USBDeviceConnected* d = host->getDevice(i);
mbed_official 19:bd46ea19486b 158 if (d != NULL) {
mbed_official 24:868cbfe611a7 159
mbed_official 19:bd46ea19486b 160 USB_DBG("Trying to connect serial device \r\n");
mbed_official 19:bd46ea19486b 161 if(host->enumerate(d, this))
mbed_official 19:bd46ea19486b 162 break;
mbed_official 24:868cbfe611a7 163
mbed_official 24:868cbfe611a7 164 for (int port = 0; port < ports_found; port ++)
mbed_official 19:bd46ea19486b 165 {
mbed_official 19:bd46ea19486b 166 USBEndpoint* bulk_in = d->getEndpoint(port_intf[port], BULK_ENDPOINT, IN);
mbed_official 19:bd46ea19486b 167 USBEndpoint* bulk_out = d->getEndpoint(port_intf[port], BULK_ENDPOINT, OUT);
mbed_official 19:bd46ea19486b 168 if (bulk_in && bulk_out)
mbed_official 19:bd46ea19486b 169 {
mbed_official 19:bd46ea19486b 170 ports[port] = new USBHostSerialPort();
mbed_official 19:bd46ea19486b 171 if (ports[port])
mbed_official 19:bd46ea19486b 172 {
mbed_official 19:bd46ea19486b 173 ports[port]->connect(host,d,port_intf[port],bulk_in, bulk_out);
mbed_official 19:bd46ea19486b 174 dev = d;
mbed_official 27:4206883f4cb7 175 dev_connected = true;
mbed_official 19:bd46ea19486b 176 }
mbed_official 19:bd46ea19486b 177 }
mbed_official 19:bd46ea19486b 178 }
mbed_official 19:bd46ea19486b 179 }
mbed_official 19:bd46ea19486b 180 }
mbed_official 19:bd46ea19486b 181 return dev != NULL;
mbed_official 19:bd46ea19486b 182 }
mbed_official 19:bd46ea19486b 183
mbed_official 19:bd46ea19486b 184 /*virtual*/ void USBHostMultiSerial::setVidPid(uint16_t vid, uint16_t pid)
mbed_official 19:bd46ea19486b 185 {
mbed_official 19:bd46ea19486b 186 // we don't check VID/PID for MSD driver
mbed_official 19:bd46ea19486b 187 }
mbed_official 19:bd46ea19486b 188
mbed_official 19:bd46ea19486b 189 /*virtual*/ bool USBHostMultiSerial::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed
mbed_official 19:bd46ea19486b 190 {
mbed_official 24:868cbfe611a7 191 if ((ports_found < USBHOST_SERIAL) &&
mbed_official 19:bd46ea19486b 192 CHECK_INTERFACE(intf_class, intf_subclass, intf_protocol)) {
mbed_official 19:bd46ea19486b 193 port_intf[ports_found++] = intf_nb;
mbed_official 19:bd46ea19486b 194 return true;
mbed_official 19:bd46ea19486b 195 }
mbed_official 19:bd46ea19486b 196 return false;
mbed_official 19:bd46ea19486b 197 }
mbed_official 19:bd46ea19486b 198
mbed_official 19:bd46ea19486b 199 /*virtual*/ bool USBHostMultiSerial::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used
mbed_official 19:bd46ea19486b 200 {
mbed_official 19:bd46ea19486b 201 if ((ports_found > 0) && (intf_nb == port_intf[ports_found-1])) {
mbed_official 24:868cbfe611a7 202 if (type == BULK_ENDPOINT)
mbed_official 19:bd46ea19486b 203 return true;
mbed_official 19:bd46ea19486b 204 }
mbed_official 19:bd46ea19486b 205 return false;
mbed_official 19:bd46ea19486b 206 }
mbed_official 19:bd46ea19486b 207
mbed_official 19:bd46ea19486b 208 #endif
mbed_official 19:bd46ea19486b 209
mbed_official 19:bd46ea19486b 210 //------------------------------------------------------------------------------
mbed_official 19:bd46ea19486b 211
mbed_official 19:bd46ea19486b 212 #define SET_LINE_CODING 0x20
mbed_official 19:bd46ea19486b 213
mbed_official 24:868cbfe611a7 214 USBHostSerialPort::USBHostSerialPort(): circ_buf()
mbed_official 19:bd46ea19486b 215 {
mbed_official 19:bd46ea19486b 216 init();
mbed_official 19:bd46ea19486b 217 }
mbed_official 19:bd46ea19486b 218
mbed_official 19:bd46ea19486b 219 void USBHostSerialPort::init(void)
mbed_official 19:bd46ea19486b 220 {
mbed_official 19:bd46ea19486b 221 host = NULL;
mbed_official 19:bd46ea19486b 222 dev = NULL;
mbed_official 19:bd46ea19486b 223 serial_intf = NULL;
mbed_official 19:bd46ea19486b 224 size_bulk_in = 0;
mbed_official 19:bd46ea19486b 225 size_bulk_out = 0;
mbed_official 19:bd46ea19486b 226 bulk_in = NULL;
mbed_official 19:bd46ea19486b 227 bulk_out = NULL;
mbed_official 19:bd46ea19486b 228 line_coding.baudrate = 9600;
mbed_official 19:bd46ea19486b 229 line_coding.data_bits = 8;
mbed_official 19:bd46ea19486b 230 line_coding.parity = None;
mbed_official 19:bd46ea19486b 231 line_coding.stop_bits = 1;
mbed_official 19:bd46ea19486b 232 circ_buf.flush();
mbed_official 19:bd46ea19486b 233 }
mbed_official 19:bd46ea19486b 234
mbed_official 24:868cbfe611a7 235 void USBHostSerialPort::connect(USBHost* _host, USBDeviceConnected * _dev,
mbed_official 19:bd46ea19486b 236 uint8_t _serial_intf, USBEndpoint* _bulk_in, USBEndpoint* _bulk_out)
mbed_official 19:bd46ea19486b 237 {
mbed_official 19:bd46ea19486b 238 host = _host;
mbed_official 19:bd46ea19486b 239 dev = _dev;
mbed_official 19:bd46ea19486b 240 serial_intf = _serial_intf;
mbed_official 19:bd46ea19486b 241 bulk_in = _bulk_in;
mbed_official 19:bd46ea19486b 242 bulk_out = _bulk_out;
mbed_official 24:868cbfe611a7 243
mbed_official 19:bd46ea19486b 244 USB_INFO("New Serial device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, serial_intf);
mbed_official 19:bd46ea19486b 245 dev->setName("Serial", serial_intf);
mbed_official 19:bd46ea19486b 246 host->registerDriver(dev, serial_intf, this, &USBHostSerialPort::init);
mbed_official 27:4206883f4cb7 247 baud(9600);
mbed_official 19:bd46ea19486b 248 size_bulk_in = bulk_in->getSize();
mbed_official 19:bd46ea19486b 249 size_bulk_out = bulk_out->getSize();
mbed_official 19:bd46ea19486b 250 bulk_in->attach(this, &USBHostSerialPort::rxHandler);
mbed_official 19:bd46ea19486b 251 bulk_out->attach(this, &USBHostSerialPort::txHandler);
mbed_official 19:bd46ea19486b 252 host->bulkRead(dev, bulk_in, buf, size_bulk_in, false);
mbed_official 19:bd46ea19486b 253 }
mbed_official 19:bd46ea19486b 254
mbed_official 19:bd46ea19486b 255 void USBHostSerialPort::rxHandler() {
mbed_official 0:a554658735bf 256 if (bulk_in) {
mbed_official 0:a554658735bf 257 int len = bulk_in->getLengthTransferred();
mbed_official 0:a554658735bf 258 if (bulk_in->getState() == USB_TYPE_IDLE) {
mbed_official 0:a554658735bf 259 for (int i = 0; i < len; i++) {
mbed_official 0:a554658735bf 260 circ_buf.queue(buf[i]);
mbed_official 0:a554658735bf 261 }
mbed_official 0:a554658735bf 262 rx.call();
samux 4:b320d68e98e7 263 host->bulkRead(dev, bulk_in, buf, size_bulk_in, false);
mbed_official 0:a554658735bf 264 }
mbed_official 0:a554658735bf 265 }
mbed_official 0:a554658735bf 266 }
mbed_official 0:a554658735bf 267
mbed_official 19:bd46ea19486b 268 void USBHostSerialPort::txHandler() {
mbed_official 0:a554658735bf 269 if (bulk_out) {
mbed_official 0:a554658735bf 270 if (bulk_out->getState() == USB_TYPE_IDLE) {
mbed_official 0:a554658735bf 271 tx.call();
mbed_official 0:a554658735bf 272 }
mbed_official 0:a554658735bf 273 }
mbed_official 0:a554658735bf 274 }
mbed_official 0:a554658735bf 275
mbed_official 19:bd46ea19486b 276 int USBHostSerialPort::_putc(int c) {
mbed_official 0:a554658735bf 277 if (bulk_out) {
mbed_official 0:a554658735bf 278 if (host->bulkWrite(dev, bulk_out, (uint8_t *)&c, 1) == USB_TYPE_OK) {
mbed_official 0:a554658735bf 279 return 1;
mbed_official 0:a554658735bf 280 }
mbed_official 0:a554658735bf 281 }
mbed_official 0:a554658735bf 282 return -1;
mbed_official 0:a554658735bf 283 }
mbed_official 0:a554658735bf 284
mbed_official 19:bd46ea19486b 285 void USBHostSerialPort::baud(int baudrate) {
samux 4:b320d68e98e7 286 line_coding.baudrate = baudrate;
samux 8:93da8ea2708b 287 format(line_coding.data_bits, (Parity)line_coding.parity, line_coding.stop_bits);
samux 4:b320d68e98e7 288 }
samux 4:b320d68e98e7 289
mbed_official 19:bd46ea19486b 290 void USBHostSerialPort::format(int bits, Parity parity, int stop_bits) {
samux 4:b320d68e98e7 291 line_coding.data_bits = bits;
samux 4:b320d68e98e7 292 line_coding.parity = parity;
samux 4:b320d68e98e7 293 line_coding.stop_bits = (stop_bits == 1) ? 0 : 2;
mbed_official 24:868cbfe611a7 294
samux 4:b320d68e98e7 295 // set line coding
mbed_official 13:b58a2204422f 296 host->controlWrite( dev,
mbed_official 13:b58a2204422f 297 USB_RECIPIENT_INTERFACE | USB_HOST_TO_DEVICE | USB_REQUEST_TYPE_CLASS,
mbed_official 13:b58a2204422f 298 SET_LINE_CODING,
mbed_official 13:b58a2204422f 299 0, serial_intf, (uint8_t *)&line_coding, 7);
samux 4:b320d68e98e7 300 }
mbed_official 0:a554658735bf 301
mbed_official 19:bd46ea19486b 302 int USBHostSerialPort::_getc() {
mbed_official 0:a554658735bf 303 uint8_t c = 0;
mbed_official 0:a554658735bf 304 if (bulk_in == NULL) {
samux 4:b320d68e98e7 305 init();
mbed_official 0:a554658735bf 306 return -1;
mbed_official 0:a554658735bf 307 }
samux 4:b320d68e98e7 308 while (circ_buf.isEmpty());
mbed_official 0:a554658735bf 309 circ_buf.dequeue(&c);
mbed_official 0:a554658735bf 310 return c;
mbed_official 0:a554658735bf 311 }
mbed_official 0:a554658735bf 312
mbed_official 19:bd46ea19486b 313 int USBHostSerialPort::writeBuf(const char* b, int s)
mbed_official 19:bd46ea19486b 314 {
mbed_official 19:bd46ea19486b 315 int c = 0;
mbed_official 24:868cbfe611a7 316 if (bulk_out)
mbed_official 19:bd46ea19486b 317 {
mbed_official 19:bd46ea19486b 318 while (c < s)
mbed_official 19:bd46ea19486b 319 {
mbed_official 19:bd46ea19486b 320 int i = (s < size_bulk_out) ? s : size_bulk_out;
mbed_official 24:868cbfe611a7 321 if (host->bulkWrite(dev, bulk_out, (uint8_t *)(b+c), i) == USB_TYPE_OK)
mbed_official 19:bd46ea19486b 322 c += i;
mbed_official 19:bd46ea19486b 323 }
mbed_official 19:bd46ea19486b 324 }
mbed_official 19:bd46ea19486b 325 return s;
mbed_official 19:bd46ea19486b 326 }
mbed_official 0:a554658735bf 327
mbed_official 19:bd46ea19486b 328 int USBHostSerialPort::readBuf(char* b, int s)
mbed_official 19:bd46ea19486b 329 {
mbed_official 19:bd46ea19486b 330 int i = 0;
mbed_official 24:868cbfe611a7 331 if (bulk_in)
mbed_official 19:bd46ea19486b 332 {
mbed_official 19:bd46ea19486b 333 for (i = 0; i < s; )
mbed_official 19:bd46ea19486b 334 b[i++] = getc();
mbed_official 19:bd46ea19486b 335 }
mbed_official 19:bd46ea19486b 336 return i;
mbed_official 19:bd46ea19486b 337 }
mbed_official 19:bd46ea19486b 338
mbed_official 19:bd46ea19486b 339 uint8_t USBHostSerialPort::available() {
mbed_official 0:a554658735bf 340 return circ_buf.available();
mbed_official 0:a554658735bf 341 }
mbed_official 0:a554658735bf 342
mbed_official 0:a554658735bf 343
mbed_official 0:a554658735bf 344
mbed_official 0:a554658735bf 345 #endif