Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.

Dependencies:   mbed

Committer:
iva2k
Date:
Mon Jun 14 03:24:33 2010 +0000
Revision:
1:3ee499525aa5
Parent:
0:e614f7875b60

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iva2k 0:e614f7875b60 1
iva2k 0:e614f7875b60 2 /*
iva2k 0:e614f7875b60 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
iva2k 0:e614f7875b60 4
iva2k 0:e614f7875b60 5 Permission is hereby granted, free of charge, to any person obtaining a copy
iva2k 0:e614f7875b60 6 of this software and associated documentation files (the "Software"), to deal
iva2k 0:e614f7875b60 7 in the Software without restriction, including without limitation the rights
iva2k 0:e614f7875b60 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
iva2k 0:e614f7875b60 9 copies of the Software, and to permit persons to whom the Software is
iva2k 0:e614f7875b60 10 furnished to do so, subject to the following conditions:
iva2k 0:e614f7875b60 11
iva2k 0:e614f7875b60 12 The above copyright notice and this permission notice shall be included in
iva2k 0:e614f7875b60 13 all copies or substantial portions of the Software.
iva2k 0:e614f7875b60 14
iva2k 0:e614f7875b60 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
iva2k 0:e614f7875b60 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
iva2k 0:e614f7875b60 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
iva2k 0:e614f7875b60 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
iva2k 0:e614f7875b60 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
iva2k 0:e614f7875b60 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
iva2k 0:e614f7875b60 21 THE SOFTWARE.
iva2k 0:e614f7875b60 22 */
iva2k 0:e614f7875b60 23
iva2k 0:e614f7875b60 24 /*
iva2k 0:e614f7875b60 25 USB-Serial device driver
iva2k 0:e614f7875b60 26 Donatien Garnier 2010
iva2k 0:e614f7875b60 27 */
iva2k 0:e614f7875b60 28
iva2k 0:e614f7875b60 29 #include "usbserialif.h"
iva2k 0:e614f7875b60 30 #include "drv/usb/UsbEndpoint.h"
iva2k 0:e614f7875b60 31
iva2k 0:e614f7875b60 32 #include "netCfg.h"
iva2k 0:e614f7875b60 33 #if NET_USB_SERIAL
iva2k 0:e614f7875b60 34
iva2k 0:e614f7875b60 35 UsbEndpoint* pEpIn;
iva2k 0:e614f7875b60 36 UsbEndpoint* pEpOut;
iva2k 0:e614f7875b60 37
iva2k 0:e614f7875b60 38 USB_INT08U ser_int_found;
iva2k 0:e614f7875b60 39 USB_INT32S SerialInit()
iva2k 0:e614f7875b60 40 {
iva2k 0:e614f7875b60 41 Host_Init(); // Initialize the host controller
iva2k 0:e614f7875b60 42 USB_INT32S rc = Host_EnumDev(); // Enumerate the device connected
iva2k 0:e614f7875b60 43 if (rc != OK)
iva2k 0:e614f7875b60 44 {
iva2k 0:e614f7875b60 45 fprintf(stderr, "Could not enumerate device: %d\n", rc);
iva2k 0:e614f7875b60 46 return rc;
iva2k 0:e614f7875b60 47 }
iva2k 0:e614f7875b60 48 return OK;
iva2k 0:e614f7875b60 49 }
iva2k 0:e614f7875b60 50
iva2k 0:e614f7875b60 51 bool SerialHasToSwitch()
iva2k 0:e614f7875b60 52 {
iva2k 0:e614f7875b60 53 return (ser_int_found == 3);
iva2k 0:e614f7875b60 54 }
iva2k 0:e614f7875b60 55
iva2k 0:e614f7875b60 56 uint16_t m_vid;
iva2k 0:e614f7875b60 57 uint16_t m_pid;
iva2k 0:e614f7875b60 58
iva2k 0:e614f7875b60 59 USB_INT32S SerialSendMagic()
iva2k 0:e614f7875b60 60 {
iva2k 0:e614f7875b60 61 bool scsi = false;
iva2k 0:e614f7875b60 62 //Size 31
iva2k 0:e614f7875b60 63 const unsigned char magicHuawei[] = { 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, 0, 0, 0, 0, 0, 0, 0, 0x11, 0x6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
iva2k 0:e614f7875b60 64 const unsigned char magicVoda[] = { 0x55, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12, 0x01, 0, 0, 0, 0x80, 0, 0x06, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
iva2k 0:e614f7875b60 65 char* magic;
iva2k 0:e614f7875b60 66 USB_INT32S rc;
iva2k 0:e614f7875b60 67 if((m_vid == 0x12d1) && (m_pid == 0x1446))
iva2k 0:e614f7875b60 68 {
iva2k 0:e614f7875b60 69 PRINT_Log("\r\nHuawei magic packet sent.\r\n");
iva2k 0:e614f7875b60 70 magic = (char*) magicHuawei;
iva2k 0:e614f7875b60 71 scsi = true;
iva2k 0:e614f7875b60 72 }
iva2k 0:e614f7875b60 73 else if((m_vid == 0x12d1) && (m_pid == 0x1003))
iva2k 0:e614f7875b60 74 {
iva2k 0:e614f7875b60 75 PRINT_Log("\r\nHuawei magic control packet sent.\r\n");
iva2k 0:e614f7875b60 76 rc = Host_CtrlSend( 0 /*USB_TYPE_STANDARD | USB_RECIP_DEVICE*/, 0x03 /*USB_REQ_SET_FEATURE*/, 00000001, 0, 0, NULL);
iva2k 0:e614f7875b60 77 }
iva2k 0:e614f7875b60 78 else if(m_vid == 0x0af0)
iva2k 0:e614f7875b60 79 {
iva2k 0:e614f7875b60 80 PRINT_Log("\r\nVoda magic packet sent.\r\n");
iva2k 0:e614f7875b60 81 magic = (char*) magicVoda;
iva2k 0:e614f7875b60 82 scsi = true;
iva2k 0:e614f7875b60 83 }
iva2k 0:e614f7875b60 84 else
iva2k 0:e614f7875b60 85 {
iva2k 0:e614f7875b60 86 return -1;
iva2k 0:e614f7875b60 87 }
iva2k 0:e614f7875b60 88
iva2k 0:e614f7875b60 89
iva2k 0:e614f7875b60 90 if(scsi)
iva2k 0:e614f7875b60 91 {
iva2k 0:e614f7875b60 92 //rc = Host_ProcessTD(EDBulkOut, TD_OUT, (volatile USB_INT08U*)magic, 31);
iva2k 0:e614f7875b60 93 rc = pEpOut->transfer((volatile USB_INT08U*)magic, 31);
iva2k 0:e614f7875b60 94 while(rc == PROCESSING)
iva2k 0:e614f7875b60 95 {
iva2k 0:e614f7875b60 96 // __WFI();
iva2k 0:e614f7875b60 97 rc = pEpOut->status();
iva2k 0:e614f7875b60 98 }
iva2k 0:e614f7875b60 99
iva2k 0:e614f7875b60 100 }
iva2k 0:e614f7875b60 101
iva2k 0:e614f7875b60 102
iva2k 0:e614f7875b60 103 delete pEpOut;
iva2k 0:e614f7875b60 104 pEpOut = NULL;
iva2k 0:e614f7875b60 105 return rc;
iva2k 0:e614f7875b60 106 }
iva2k 0:e614f7875b60 107
iva2k 0:e614f7875b60 108 USB_INT32S SerialCheckVidPid()
iva2k 0:e614f7875b60 109 {
iva2k 0:e614f7875b60 110 volatile USB_INT08U *desc_ptr;
iva2k 0:e614f7875b60 111 desc_ptr = TDBuffer;
iva2k 0:e614f7875b60 112
iva2k 0:e614f7875b60 113 ser_int_found = 0;
iva2k 0:e614f7875b60 114
iva2k 0:e614f7875b60 115 m_vid = *((USB_INT16U*)&desc_ptr[8]);
iva2k 0:e614f7875b60 116 m_pid = *((USB_INT16U*)&desc_ptr[10]);
iva2k 0:e614f7875b60 117
iva2k 0:e614f7875b60 118 if (desc_ptr[1] != USB_DESCRIPTOR_TYPE_DEVICE) {
iva2k 0:e614f7875b60 119 PRINT_Log("\r\nLen = %02x\r\n",desc_ptr[0]);
iva2k 0:e614f7875b60 120 PRINT_Log("\r\nDesc code %02x\r\n",desc_ptr[1]);
iva2k 0:e614f7875b60 121 return (ERR_BAD_CONFIGURATION);
iva2k 0:e614f7875b60 122 }
iva2k 0:e614f7875b60 123
iva2k 0:e614f7875b60 124 if( m_vid == 0x12d1 &&//Huawei : Change
iva2k 0:e614f7875b60 125 m_pid == 0x1446 )
iva2k 0:e614f7875b60 126 {
iva2k 0:e614f7875b60 127 PRINT_Log("\r\nHuawei device found in CDFS mode\r\n");
iva2k 0:e614f7875b60 128 ser_int_found=3;
iva2k 0:e614f7875b60 129 }
iva2k 0:e614f7875b60 130 else if( m_vid == 0x12d1 &&//Huawei : Change
iva2k 0:e614f7875b60 131 m_pid == 0x1001 )
iva2k 0:e614f7875b60 132 {
iva2k 0:e614f7875b60 133 PRINT_Log("\r\nHuawei device found in Serial mode\r\n");
iva2k 0:e614f7875b60 134 ser_int_found=1;
iva2k 0:e614f7875b60 135 }
iva2k 0:e614f7875b60 136 else if( m_vid == 0x0af0 &&//Voda?Qualcomm? : Change
iva2k 0:e614f7875b60 137 m_pid == 0x7501 )
iva2k 0:e614f7875b60 138 {
iva2k 0:e614f7875b60 139 PRINT_Log("\r\nVodafone K3760 found, checking mode...\r\n");
iva2k 0:e614f7875b60 140 ser_int_found=3;
iva2k 0:e614f7875b60 141 }
iva2k 0:e614f7875b60 142 else if( m_vid == 0x12d1 &&//Voda?Qualcomm? : Change
iva2k 0:e614f7875b60 143 m_pid == 0x1003 )
iva2k 0:e614f7875b60 144 {
iva2k 0:e614f7875b60 145 PRINT_Log("\r\nHuawei device found, checking mode...\r\n");
iva2k 0:e614f7875b60 146 ser_int_found=3;
iva2k 0:e614f7875b60 147 }
iva2k 0:e614f7875b60 148 else
iva2k 0:e614f7875b60 149 {
iva2k 0:e614f7875b60 150 PRINT_Log("\r\nDevice %04x : %04x found.\r\n",m_vid,m_pid);
iva2k 0:e614f7875b60 151 }
iva2k 0:e614f7875b60 152 return OK;
iva2k 0:e614f7875b60 153 }
iva2k 0:e614f7875b60 154
iva2k 0:e614f7875b60 155 USB_INT32S SerialParseConfig()
iva2k 0:e614f7875b60 156 {
iva2k 0:e614f7875b60 157 volatile USB_INT08U *desc_ptr;
iva2k 0:e614f7875b60 158
iva2k 0:e614f7875b60 159 desc_ptr = TDBuffer;
iva2k 0:e614f7875b60 160
iva2k 0:e614f7875b60 161 if (desc_ptr[1] != USB_DESCRIPTOR_TYPE_CONFIGURATION) {
iva2k 0:e614f7875b60 162 return (ERR_BAD_CONFIGURATION);
iva2k 0:e614f7875b60 163 }
iva2k 0:e614f7875b60 164 desc_ptr += desc_ptr[0];
iva2k 0:e614f7875b60 165
iva2k 0:e614f7875b60 166 int epOut = 0;
iva2k 0:e614f7875b60 167 int epIn = 0;
iva2k 0:e614f7875b60 168
iva2k 0:e614f7875b60 169 pEpOut = NULL;
iva2k 0:e614f7875b60 170 pEpIn = NULL;
iva2k 0:e614f7875b60 171 while (desc_ptr != TDBuffer + ReadLE16U(&TDBuffer[2])) {
iva2k 0:e614f7875b60 172
iva2k 0:e614f7875b60 173 switch (desc_ptr[1]) {
iva2k 0:e614f7875b60 174 case USB_DESCRIPTOR_TYPE_INTERFACE:
iva2k 0:e614f7875b60 175 PRINT_Log("\r\nIf %02x:%02x:%02x.\r\n",desc_ptr[5],desc_ptr[6],desc_ptr[7]);
iva2k 0:e614f7875b60 176 if (desc_ptr[5] == 0xFF &&
iva2k 0:e614f7875b60 177 desc_ptr[6] == 0xFF &&
iva2k 0:e614f7875b60 178 desc_ptr[7] == 0xFF ) {
iva2k 0:e614f7875b60 179 //if(ser_int_found==1)
iva2k 0:e614f7875b60 180 ser_int_found=2;
iva2k 0:e614f7875b60 181 }
iva2k 0:e614f7875b60 182 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 183 break;
iva2k 0:e614f7875b60 184
iva2k 0:e614f7875b60 185 case USB_DESCRIPTOR_TYPE_ENDPOINT: /* If it is an endpoint descriptor */
iva2k 0:e614f7875b60 186 PRINT_Log("\r\nEp %02x of size %d.\r\n", desc_ptr[2], (ReadLE16U(&desc_ptr[4]) ));
iva2k 0:e614f7875b60 187 if ( SerialHasToSwitch() )
iva2k 0:e614f7875b60 188 {
iva2k 0:e614f7875b60 189 if( pEpOut == NULL /*desc_ptr[2] == 1*/) //EP 1
iva2k 0:e614f7875b60 190 {
iva2k 0:e614f7875b60 191 #if 0
iva2k 0:e614f7875b60 192 EDBulkOut->Control = 1 | /* USB address */
iva2k 0:e614f7875b60 193 ((desc_ptr[2] & 0x7F) << 7) | /* Endpoint address */
iva2k 0:e614f7875b60 194 (1 << 11) | /* direction */
iva2k 0:e614f7875b60 195 (ReadLE16U(&desc_ptr[4]) << 16); /* MaxPkt Size */
iva2k 0:e614f7875b60 196 #endif
iva2k 0:e614f7875b60 197 pEpOut = new UsbEndpoint((desc_ptr[2] & 0x7F), false, ReadLE16U(&desc_ptr[4]));
iva2k 0:e614f7875b60 198 }
iva2k 0:e614f7875b60 199 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 200 }
iva2k 0:e614f7875b60 201 else if ((desc_ptr[3] & 0x03) == 0x02) { /* If it is Bulk endpoint */
iva2k 0:e614f7875b60 202 if (desc_ptr[2] & 0x80) { /* If it is In endpoint */
iva2k 0:e614f7875b60 203 if(epIn == 0)
iva2k 0:e614f7875b60 204 {
iva2k 0:e614f7875b60 205 PRINT_Log("\r\nEp %02x is in ep.\r\n", desc_ptr[2]);
iva2k 0:e614f7875b60 206 #if 0
iva2k 0:e614f7875b60 207 EDBulkIn->Control = 1 | /* USB address */
iva2k 0:e614f7875b60 208 ((desc_ptr[2] & 0x7F) << 7) | /* Endpoint address */
iva2k 0:e614f7875b60 209 (2 << 11) | /* direction */
iva2k 0:e614f7875b60 210 (ReadLE16U(&desc_ptr[4]) << 16); /* MaxPkt Size */
iva2k 0:e614f7875b60 211 #endif
iva2k 0:e614f7875b60 212 // pEpIn = new UsbEndpoint((desc_ptr[2] & 0x7F), true, ReadLE16U(&desc_ptr[4]));
iva2k 0:e614f7875b60 213 }
iva2k 0:e614f7875b60 214 epIn++;
iva2k 0:e614f7875b60 215 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 216 } else { /* If it is Out endpoint */
iva2k 0:e614f7875b60 217 if(epOut == 0)
iva2k 0:e614f7875b60 218 {
iva2k 0:e614f7875b60 219 PRINT_Log("\r\nEp %02x is out ep.\r\n", desc_ptr[2]);
iva2k 0:e614f7875b60 220 #if 0
iva2k 0:e614f7875b60 221 EDBulkOut->Control = 1 | /* USB address */
iva2k 0:e614f7875b60 222 ((desc_ptr[2] & 0x7F) << 7) | /* Endpoint address */
iva2k 0:e614f7875b60 223 (1 << 11) | /* direction */
iva2k 0:e614f7875b60 224 (ReadLE16U(&desc_ptr[4]) << 16); /* MaxPkt Size */
iva2k 0:e614f7875b60 225 #endif
iva2k 0:e614f7875b60 226 // pEpOut = new UsbEndpoint((desc_ptr[2] & 0x7F), false, ReadLE16U(&desc_ptr[4]));
iva2k 0:e614f7875b60 227 }
iva2k 0:e614f7875b60 228 epOut++;
iva2k 0:e614f7875b60 229 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 230 }
iva2k 0:e614f7875b60 231 } else { /* If it is not bulk end point */
iva2k 0:e614f7875b60 232 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 233 }
iva2k 0:e614f7875b60 234 break;
iva2k 0:e614f7875b60 235
iva2k 0:e614f7875b60 236 default: /* If the descriptor is neither interface nor endpoint */
iva2k 0:e614f7875b60 237 desc_ptr += desc_ptr[0]; /* Move to next descriptor start */
iva2k 0:e614f7875b60 238 break;
iva2k 0:e614f7875b60 239 }
iva2k 0:e614f7875b60 240 }
iva2k 0:e614f7875b60 241 if (ser_int_found==2) {
iva2k 0:e614f7875b60 242 PRINT_Log("Virtual Serial Port device %04x:%04x connected, vid=%d, pid=%d, E220=%d\n", m_vid, m_pid, ( m_vid == 0x12d1 ), ( m_pid == 0x1003 ), (( m_vid == 0x12d1 ) && ( m_pid == 0x1003 )));
iva2k 0:e614f7875b60 243 if(m_vid==0x0af0) //Voda
iva2k 0:e614f7875b60 244 {
iva2k 0:e614f7875b60 245 pEpOut = new UsbEndpoint((0x0a & 0x7F), false, 64);
iva2k 0:e614f7875b60 246 pEpIn = new UsbEndpoint((0x8b & 0x7F), true, 64);
iva2k 0:e614f7875b60 247 PRINT_Log("Voda K3760\r\n");
iva2k 0:e614f7875b60 248 }
iva2k 0:e614f7875b60 249 else //if ( ( m_vid == 0x12d1 ) && ( m_pid == 0x1003 ) )
iva2k 0:e614f7875b60 250 /*{*/
iva2k 0:e614f7875b60 251 if ( ( m_vid == 0x12d1 ) && ( m_pid == 0x1003 ) )
iva2k 0:e614f7875b60 252 {
iva2k 0:e614f7875b60 253 pEpOut = new UsbEndpoint((0x02 & 0x7F), false, 64);
iva2k 0:e614f7875b60 254 pEpIn = new UsbEndpoint((0x82 & 0x7F), true, 64);
iva2k 0:e614f7875b60 255 PRINT_Log("Huawei E220\r\n");
iva2k 0:e614f7875b60 256 }
iva2k 0:e614f7875b60 257 /*else
iva2k 0:e614f7875b60 258 {
iva2k 0:e614f7875b60 259 if(( m_vid == 0x12d1 ))
iva2k 0:e614f7875b60 260 PRINT_Log("VID OK\r\n");
iva2k 0:e614f7875b60 261 else
iva2k 0:e614f7875b60 262 PRINT_Log("VID NOK\r\n");
iva2k 0:e614f7875b60 263 if(( m_pid == 0x1003 ))
iva2k 0:e614f7875b60 264 PRINT_Log("VID OK\r\n");
iva2k 0:e614f7875b60 265 else
iva2k 0:e614f7875b60 266 PRINT_Log("VID NOK\r\n");
iva2k 0:e614f7875b60 267 PRINT_Log("\r\n....\r\n\r\n");
iva2k 0:e614f7875b60 268 error("\r\n\r\n");
iva2k 0:e614f7875b60 269 }*/
iva2k 0:e614f7875b60 270 //}
iva2k 0:e614f7875b60 271 #if 1
iva2k 0:e614f7875b60 272 else /*if ( m_vid == 0x12d1 &&
iva2k 0:e614f7875b60 273 m_pid == 0x1001 )*/
iva2k 0:e614f7875b60 274 {
iva2k 0:e614f7875b60 275 pEpOut = new UsbEndpoint((0x01 & 0x7F), false, 64);
iva2k 0:e614f7875b60 276 pEpIn = new UsbEndpoint((0x82 & 0x7F), true, 64);
iva2k 0:e614f7875b60 277 PRINT_Log("Huawei E1550\r\n");
iva2k 0:e614f7875b60 278 }
iva2k 0:e614f7875b60 279 #endif
iva2k 0:e614f7875b60 280
iva2k 0:e614f7875b60 281 PRINT_Log("Virtual Serial Port device %04x:%04x connected\n", m_vid, m_pid);
iva2k 0:e614f7875b60 282 return (OK);
iva2k 0:e614f7875b60 283 }
iva2k 0:e614f7875b60 284 else if (ser_int_found==3) {
iva2k 0:e614f7875b60 285 PRINT_Log("CDFS dongle connected, reset\n");
iva2k 0:e614f7875b60 286 return (OK);
iva2k 0:e614f7875b60 287 } else {
iva2k 0:e614f7875b60 288 PRINT_Log("Not a Virtual Serial Port device\n");
iva2k 0:e614f7875b60 289 return (ERR_NO_MS_INTERFACE);
iva2k 0:e614f7875b60 290 }
iva2k 0:e614f7875b60 291 }
iva2k 0:e614f7875b60 292
iva2k 0:e614f7875b60 293
iva2k 0:e614f7875b60 294 USB_INT32S SerialRx( volatile USB_INT08U* buf, USB_INT32U len )
iva2k 0:e614f7875b60 295 {
iva2k 0:e614f7875b60 296 USB_INT32S rc;
iva2k 0:e614f7875b60 297 rc = pEpIn->transfer(buf, len);
iva2k 0:e614f7875b60 298 return rc;
iva2k 0:e614f7875b60 299 }
iva2k 0:e614f7875b60 300
iva2k 0:e614f7875b60 301 USB_INT32S SerialReceived()
iva2k 0:e614f7875b60 302 {
iva2k 0:e614f7875b60 303 return pEpIn->status();
iva2k 0:e614f7875b60 304 }
iva2k 0:e614f7875b60 305
iva2k 0:e614f7875b60 306 USB_INT32S SerialTx( volatile USB_INT08U* buf, USB_INT32U len )
iva2k 0:e614f7875b60 307 {
iva2k 0:e614f7875b60 308 USB_INT32S rc;
iva2k 0:e614f7875b60 309 rc = pEpOut->transfer(buf, len);
iva2k 0:e614f7875b60 310 // PRINT_Log("\r\nOut rc = %d\r\n",len);
iva2k 0:e614f7875b60 311 return rc;
iva2k 0:e614f7875b60 312 }
iva2k 0:e614f7875b60 313
iva2k 0:e614f7875b60 314 USB_INT32S SerialTransmitted()
iva2k 0:e614f7875b60 315 {
iva2k 0:e614f7875b60 316 USB_INT32S rc = pEpOut->status();
iva2k 0:e614f7875b60 317 /* if(rc>=0)
iva2k 0:e614f7875b60 318 {
iva2k 0:e614f7875b60 319 PRINT_Log("\r\nTransmitted %d\r\n",rc);
iva2k 0:e614f7875b60 320 }*/
iva2k 0:e614f7875b60 321 return rc;
iva2k 0:e614f7875b60 322 }
iva2k 0:e614f7875b60 323
iva2k 0:e614f7875b60 324 USB_INT32S SerialReg(USB_INT16U vid, USB_INT16U pid) {return 0;}
iva2k 0:e614f7875b60 325
iva2k 0:e614f7875b60 326 #endif