Wixel SDK
usb_cdc_acm.c
1 #include <cc2511_map.h>
2 #include <cc2511_types.h>
3 #include <usb.h>
4 #include <usb_com.h>
5 #include <board.h> // just for boardStartBootloader() and serialNumberString
6 #include <time.h> // just for timing the start of the bootloader
7 
8 // NOTE: We could easily remove the dependency on time.h if we added a
9 // function called startBootloaderSoon() in board.h that started the bootloader
10 // after some delay.
11 
12 /* CDC ACM Library Configuration **********************************************/
13 // Note: USB 2.0 says that the maximum packet size for full-speed bulk endpoints
14 // can only be 8, 16, 32, or 64 bytes.
15 // We picked endpoint 4 for the data because it has a 256-byte FIFO memory area,
16 // which is exactly enough for us to have two 64-byte IN buffers and two 64-byte
17 // OUT buffers.
18 
19 #define CDC_OUT_PACKET_SIZE 64
20 #define CDC_IN_PACKET_SIZE 64
21 #define CDC_CONTROL_INTERFACE_NUMBER 0
22 #define CDC_DATA_INTERFACE_NUMBER 1
23 
24 #define CDC_NOTIFICATION_ENDPOINT 1
25 #define CDC_NOTIFICATION_FIFO USBF1 // This must match CDC_NOTIFICATION_ENDPOINT!
26 
27 #define CDC_DATA_ENDPOINT 4
28 #define CDC_DATA_FIFO USBF4 // This must match CDC_DATA_ENDPOINT!
29 
30 /* CDC and ACM Constants ******************************************************/
31 
32 // USB Class Codes
33 #define CDC_CLASS 2 // (CDC 1.20 Section 4.1: Communications Device Class Code).
34 #define CDC_DATA_INTERFACE_CLASS 0xA // (CDC 1.20 Section 4.5: Data Class Interface Codes).
35 
36 // USB Subclass Codes
37 #define CDC_SUBCLASS_ACM 2 // (CDC 1.20 Section 4.3: Communications Class Subclass Codes). Refer to USBPSTN1.2.
38 
39 // USB Protocol Codes
40 #define CDC_PROTOCOL_V250 1 // (CDC 1.20 Section 4.4: Communications Class Protocol Codes).
41 
42 // USB Descriptor types from CDC 1.20 Section 5.2.3, Table 12
43 #define CDC_DESCRIPTOR_TYPE_CS_INTERFACE 0x24
44 #define CDC_DESCRIPTOR_TYPE_CS_ENDPOINT 0x25
45 
46 // USB Descriptor sub-types from CDC 1.20 Table 13: bDescriptor SubType in Communications Class Functional Descriptors
47 #define CDC_DESCRIPTOR_SUBTYPE_HEADER 0
48 #define CDC_DESCRIPTOR_SUBTYPE_CALL_MANAGEMENT 1
49 #define CDC_DESCRIPTOR_SUBTYPE_ABSTRACT_CONTROL_MANAGEMENT 2
50 #define CDC_DESCRIPTOR_SUBTYPE_UNION 6
51 
52 // Request Codes from CDC 1.20 Section 6.2: Management Element Requests.
53 #define ACM_GET_ENCAPSULATED_RESPONSE 0
54 #define ACM_SEND_ENCAPSULATED_COMMAND 1
55 
56 // Request Codes from PSTN 1.20 Table 13.
57 #define ACM_REQUEST_SET_LINE_CODING 0x20
58 #define ACM_REQUEST_GET_LINE_CODING 0x21
59 #define ACM_REQUEST_SET_CONTROL_LINE_STATE 0x22
60 
61 // Notification Codes from PSTN 1.20 Table 30.
62 #define ACM_NOTIFICATION_RESPONSE_AVAILABLE 0x01
63 #define ACM_NOTIFICATION_SERIAL_STATE 0x20
64 
65 /* Private Prototypes *********************************************************/
66 static void doNothing();
67 
68 /* USB COM Variables **********************************************************/
69 
70 // TODO: look at usb-to-serial adapters and figure out good default values for usbComControlLineState (RTS and CTS)
71 uint8 usbComControlLineState = 0;
72 
73 uint8 usbComSerialState = 0;
74 
75 // The last state we reported to the computer, or 0xFF if we have not reported
76 // a state yet.
77 static uint8 lastReportedSerialState = 0xFF;
78 
80 {
81  9600, // dwDTERate (baud rate)
82  0, // bCharFormat = 0: 1 stop bit
83  0, // bParityType = 0: no parity
84  8, // bDataBits = 8
85 };
86 
87 HandlerFunction * usbComLineCodingChangeHandler = doNothing;
88 
89 // This bit is true if we need to send an empty (zero-length) packet of data to
90 // the computer soon. Every data transfer needs to be ended with a packet that
91 // is less than full length, so sometimes we need to send empty packets.
92 static BIT sendEmptyPacketSoon = 0;
93 
94 // The number of bytes that we have loaded into the IN FIFO that are NOT yet
95 // queued up to be sent. This will always be less than CDC_IN_PACKET_SIZE because
96 // once we've loaded up a full packet we should always send it immediately.
97 static uint8 DATA inFifoBytesLoaded = 0;
98 
99 // True iff we have received a command from the user to enter bootloader mode.
100 static BIT startBootloaderSoon = 0;
101 
102 // The lower 8-bits of the time (in ms) when the request to enter bootloader mode
103 // was received. This allows us to delay for some time before actaully entering
104 // bootloader mode. This variable is only valid when startBootloaderSoon == 1.
105 static uint8 XDATA startBootloaderRequestTime;
106 
107 /* CDC ACM USB Descriptors ****************************************************/
108 
110 {
111  sizeof(USB_DESCRIPTOR_DEVICE),
112  USB_DESCRIPTOR_TYPE_DEVICE,
113  0x0200, // USB Spec Release Number in BCD format
114  CDC_CLASS, // Class Code: Communications Device Class
115  0, // Subclass code: must be 0 according to CDC 1.20 spec
116  0, // Protocol code: must be 0 according to CDC 1.20 spec
117  USB_EP0_PACKET_SIZE, // Max packet size for Endpoint 0
118  USB_VENDOR_ID_POLOLU, // Vendor ID
119  0x2200, // Product ID (Generic Wixel with one CDC ACM port)
120  0x0000, // Device release number in BCD format
121  1, // Index of Manufacturer String Descriptor
122  2, // Index of Product String Descriptor
123  3, // Index of Serial Number String Descriptor
124  1 // Number of possible configurations.
125 };
126 
127 CODE struct CONFIG1 {
128  USB_DESCRIPTOR_CONFIGURATION configuration;
129 
130  USB_DESCRIPTOR_INTERFACE communication_interface;
131  unsigned char class_specific[19]; // CDC-Specific Descriptors
132  USB_DESCRIPTOR_ENDPOINT notification_element;
133 
134  USB_DESCRIPTOR_INTERFACE data_interface;
135  USB_DESCRIPTOR_ENDPOINT data_out;
136  USB_DESCRIPTOR_ENDPOINT data_in;
137 } usbConfigurationDescriptor
138 =
139 {
140  { // Configuration Descriptor
142  USB_DESCRIPTOR_TYPE_CONFIGURATION,
143  sizeof(struct CONFIG1), // wTotalLength
144  2, // bNumInterfaces
145  1, // bConfigurationValue
146  0, // iConfiguration
147  0xC0, // bmAttributes: self powered (but may use bus power)
148  50, // bMaxPower
149  },
150  { // Communications Interface: Used for device management.
151  sizeof(USB_DESCRIPTOR_INTERFACE),
152  USB_DESCRIPTOR_TYPE_INTERFACE,
153  CDC_CONTROL_INTERFACE_NUMBER, // bInterfaceNumber
154  0, // bAlternateSetting
155  1, // bNumEndpoints
156  CDC_CLASS, // bInterfaceClass
157  CDC_SUBCLASS_ACM, // bInterfaceSubClass
158  CDC_PROTOCOL_V250, // bInterfaceProtocol
159  0 // iInterface
160  },
161  { // Functional Descriptors.
162 
163  5, // 5-byte General Descriptor: Header Functional Descriptor
164  CDC_DESCRIPTOR_TYPE_CS_INTERFACE,
165  CDC_DESCRIPTOR_SUBTYPE_HEADER,
166  0x20,0x01, // bcdCDC. We conform to CDC 1.20.
167 
168 
169  4, // 4-byte PTSN-Specific Descriptor: Abstract Control Management Functional Descriptor.
170  CDC_DESCRIPTOR_TYPE_CS_INTERFACE,
171  CDC_DESCRIPTOR_SUBTYPE_ABSTRACT_CONTROL_MANAGEMENT,
172  2, // bmCapabilities. See USBPSTN1.2 Table 4. We support SetLineCoding,
173  //SetControlLineState, GetLineCoding, and SerialState notifications.
174 
175  5, // 5-byte General Descriptor: Union Interface Functional Descriptor (CDC 1.20 Table 16).
176  CDC_DESCRIPTOR_TYPE_CS_INTERFACE,
177  CDC_DESCRIPTOR_SUBTYPE_UNION,
178  CDC_CONTROL_INTERFACE_NUMBER, // index of the control interface
179  CDC_DATA_INTERFACE_NUMBER, // index of the subordinate interface
180 
181  5, // 5-byte PTSN-Specific Descriptor
182  CDC_DESCRIPTOR_TYPE_CS_INTERFACE,
183  CDC_DESCRIPTOR_SUBTYPE_CALL_MANAGEMENT,
184  0x00, // bmCapabilities. USBPSTN1.2 Table 3. Device does not handle call management.
185  CDC_DATA_INTERFACE_NUMBER // index of the data interface
186  },
187  {
188  sizeof(USB_DESCRIPTOR_ENDPOINT),
189  USB_DESCRIPTOR_TYPE_ENDPOINT,
190  USB_ENDPOINT_ADDRESS_IN | CDC_NOTIFICATION_ENDPOINT, // bEndpointAddress
191  USB_TRANSFER_TYPE_INTERRUPT, // bmAttributes
192  10, // wMaxPacketSize
193  1, // bInterval
194  },
195  {
196  sizeof(USB_DESCRIPTOR_INTERFACE), // Data Interface: used for RX and TX data.
197  USB_DESCRIPTOR_TYPE_INTERFACE,
198  CDC_DATA_INTERFACE_NUMBER, // bInterfaceNumber
199  0, // bAlternateSetting
200  2, // bNumEndpoints
201  CDC_DATA_INTERFACE_CLASS, // bInterfaceClass
202  0, // bInterfaceSubClass
203  0, // bInterfaceProtocol
204  0 // iInterface
205  },
206  { // OUT Endpoint: Sends data out to Wixel.
207  sizeof(USB_DESCRIPTOR_ENDPOINT),
208  USB_DESCRIPTOR_TYPE_ENDPOINT,
209  USB_ENDPOINT_ADDRESS_OUT | CDC_DATA_ENDPOINT, // bEndpointAddress
210  USB_TRANSFER_TYPE_BULK, // bmAttributes
211  CDC_OUT_PACKET_SIZE, // wMaxPacketSize
212  0, // bInterval
213  },
214  {
215  sizeof(USB_DESCRIPTOR_ENDPOINT),
216  USB_DESCRIPTOR_TYPE_ENDPOINT,
217  USB_ENDPOINT_ADDRESS_IN | CDC_DATA_ENDPOINT, // bEndpointAddress
218  USB_TRANSFER_TYPE_BULK, // bmAttributes
219  CDC_IN_PACKET_SIZE, // wMaxPacketSize
220  0, // bInterval
221  },
222 };
223 
226 DEFINE_STRING_DESCRIPTOR(manufacturer, 18, 'P','o','l','o','l','u',' ','C','o','r','p','o','r','a','t','i','o','n')
227 DEFINE_STRING_DESCRIPTOR(product, 5, 'W','i','x','e','l')
228 uint16 CODE * CODE usbStringDescriptors[] = { languages, manufacturer, product, serialNumberStringDescriptor };
229 
230 /* CDC ACM USB callbacks ******************************************************/
231 // These functions are called by the low-level USB module (usb.c) when a USB
232 // event happens that requires higher-level code to make a decision.
233 
235 {
236  usbInitEndpointIn(CDC_NOTIFICATION_ENDPOINT, 10);
237  usbInitEndpointOut(CDC_DATA_ENDPOINT, CDC_OUT_PACKET_SIZE);
238  usbInitEndpointIn(CDC_DATA_ENDPOINT, CDC_IN_PACKET_SIZE);
239 
240  // Force an update to be sent to the computer.
241  lastReportedSerialState = 0xFF;
242 }
243 
244 // Implements all the control transfers that are required by D1 of the
245 // ACM descriptor bmCapabilities, (USBPSTN1.20 Table 4).
247 {
248  if ((usbSetupPacket.bmRequestType & 0x7F) != 0x21) // Require Type==Class and Recipient==Interface.
249  return;
250 
251  if (!(usbSetupPacket.wIndex == CDC_CONTROL_INTERFACE_NUMBER || usbSetupPacket.wIndex == CDC_DATA_INTERFACE_NUMBER))
252  return;
253 
254  switch(usbSetupPacket.bRequest)
255  {
256  case ACM_REQUEST_SET_LINE_CODING: // SetLineCoding (USBPSTN1.20 Section 6.3.10 SetLineCoding)
258  break;
259 
260  case ACM_REQUEST_GET_LINE_CODING: // GetLineCoding (USBPSTN1.20 Section 6.3.11 GetLineCoding)
262  break;
263 
264  case ACM_REQUEST_SET_CONTROL_LINE_STATE: // SetControlLineState (USBPSTN1.20 Section 6.3.12 SetControlLineState)
265  usbComControlLineState = usbSetupPacket.wValue;
267  break;
268  }
269 }
270 
272 {
273  // Not used by CDC ACM
274 }
275 
276 static void doNothing(void)
277 {
278  // Do nothing.
279 }
280 
282 {
284 
285  if (usbComLineCoding.dwDTERate == 333 && !startBootloaderSoon)
286  {
287  // The baud rate has been set to 333. That is the special signal
288  // sent by the USB host telling us to enter bootloader mode.
289 
290  startBootloaderSoon = 1;
291  startBootloaderRequestTime = (uint8)getMs();
292  }
293 }
294 
295 /* CDC ACM RX Functions *******************************************************/
296 // These functions can be called by the higher-level user of the CDC ACM library
297 // to receive bytes from the computer.
298 
300 {
301  if (usbDeviceState != USB_STATE_CONFIGURED)
302  {
303  // We have not reached the Configured state yet, so we should not be touching the non-zero endpoints.
304  return 0;
305  }
306 
307  USBINDEX = CDC_DATA_ENDPOINT; // Select the data endpoint.
308  if (USBCSOL & USBCSOL_OUTPKT_RDY) // Check the OUTPKT_RDY flag because USBCNTL is only valid when it is 1.
309  {
310  // Assumption: We don't need to read USBCNTH because we can't receive packets
311  // larger than 255 bytes.
312  return USBCNTL;
313  }
314  else
315  {
316  return 0;
317  }
318 }
319 
320 
321 // Assumption: We don't need to read USBCNTH because we can't receive packets
322 // larger than 255 bytes.
323 // Assumption: The user has previously called usbComRxAvailable and its return value
324 // was non-zero.
326 {
327  uint8 tmp;
328 
329  USBINDEX = CDC_DATA_ENDPOINT; // Select the CDC data endpoint.
330  tmp = CDC_DATA_FIFO; // Read one byte from the FIFO.
331 
332  if (USBCNTL == 0) // If there are no bytes left in this packet...
333  {
334  USBCSOL &= ~USBCSOL_OUTPKT_RDY; // Tell the USB module we are done reading this packet, so it can receive more.
335  }
336 
337  usbActivityFlag = 1;
338  return tmp;
339 }
340 
341 // Assumption: The user has previously called usbComRxAvailable and its return value
342 // was greater than or equal to size.
343 void usbComRxReceive(uint8 XDATA * buffer, uint8 size)
344 {
345  usbReadFifo(CDC_DATA_ENDPOINT, size, buffer);
346 
347  if (USBCNTL == 0)
348  {
349  USBCSOL &= ~USBCSOL_OUTPKT_RDY; // Tell the USB module we are done reading this packet, so it can receive more.
350  }
351 }
352 
353 
354 /* CDC ACM TX Functions *******************************************************/
355 // These functions can be called by the higher-level user of the CDC ACM library
356 // to send bytes to the computer.
357 
358 static void sendPacketNow()
359 {
360  USBINDEX = CDC_DATA_ENDPOINT;
361  USBCSIL |= USBCSIL_INPKT_RDY; // Send the packet.
362 
363  // If the last packet transmitted was a full packet, we should send an empty packet later.
364  sendEmptyPacketSoon = (inFifoBytesLoaded == CDC_IN_PACKET_SIZE);
365 
366  // There are 0 bytes in the IN FIFO now.
367  inFifoBytesLoaded = 0;
368 
369  // Notify the USB library that some activity has occurred.
370  usbActivityFlag = 1;
371 }
372 
373 void usbComService(void)
374 {
375  usbPoll();
376 
377  // Start bootloader if necessary.
378  if (startBootloaderSoon && (uint8)(getMs() - startBootloaderRequestTime) > 70)
379  {
380  // It has been 50 ms since the user requested that we start the bootloader, so
381  // start it.
382 
383  // The reason we don't start the bootloader right away when we get the request is
384  // because we want to have time to finish the status phase of the control transfer
385  // so the host knows the request was processed correctly. Also, the Windows
386  // usbser.sys sends several requests for about 7 ms after the SET_LINE_CODING
387  // request before the operation (SetCommState) finally succeeds.
389  }
390 
391  if (usbDeviceState != USB_STATE_CONFIGURED)
392  {
393  // We have not reached the Configured state yet, so we should not be touching the non-zero endpoints.
394  return;
395  }
396 
397  // Send a packet now if there is data loaded in the FIFO waiting to be sent OR
398  //
399  // Typical USB systems wait for a short or empty packet before forwarding the data
400  // up to the software that requested it, so this is necessary. However, we only transmit
401  // an empty packet if there are no packets currently loaded in the FIFO.
402  USBINDEX = CDC_DATA_ENDPOINT;
403  if (inFifoBytesLoaded || ( sendEmptyPacketSoon && !(USBCSIL & USBCSIL_PKT_PRESENT) ) )
404  {
405  sendPacketNow();
406  }
407 
408  // Notify the computer of the current serial state if necessary.
409  USBINDEX = CDC_NOTIFICATION_ENDPOINT;
410  if (usbComSerialState != lastReportedSerialState && !(USBCSIL & USBCSIL_INPKT_RDY))
411  {
412  // The serial state has changed since the last time we sent it.
413  // AND we are ready to send it to the USB host, so send it.
414  // See PSTN Section 6.5.4, SerialState for an explanation of this packet.
415 
416  CDC_NOTIFICATION_FIFO = 0b10100001; // bRequestType: Direction=IN, Type=Class, Sender=Interface
417  CDC_NOTIFICATION_FIFO = ACM_NOTIFICATION_SERIAL_STATE; // bRequest
418 
419  // wValue is zero.
420  CDC_NOTIFICATION_FIFO = 0;
421  CDC_NOTIFICATION_FIFO = 0;
422 
423  // wIndex is the number of the interface this notification comes from.
424  CDC_NOTIFICATION_FIFO = CDC_CONTROL_INTERFACE_NUMBER;
425  CDC_NOTIFICATION_FIFO = 0;
426 
427  // wLength is 2 because the data part has two bytes
428  CDC_NOTIFICATION_FIFO = 2;
429  CDC_NOTIFICATION_FIFO = 0;
430 
431  // Data
432  CDC_NOTIFICATION_FIFO = usbComSerialState;
433  CDC_NOTIFICATION_FIFO = 0;
434 
435  USBCSIL |= USBCSIL_INPKT_RDY;
436 
437  // As specified in PSTN 1.20 Section 6.5.4, we clear the "irregular" signals.
438  usbComSerialState &= ~ACM_IRREGULAR_SIGNAL_MASK;
439 
440  lastReportedSerialState = usbComSerialState;
441 
442  // Notify the USB library that some activity has occurred.
443  usbActivityFlag = 1;
444  }
445 }
446 
447 // Assumption: We are using double buffering, so we can load either 0, 1, or 2
448 // packets into the FIFO at this time.
450 {
451  uint8 tmp;
452 
453  if (usbDeviceState != USB_STATE_CONFIGURED)
454  {
455  // We have not reached the Configured state yet, so we should not be touching the non-zero endpoints.
456  return 0;
457  }
458 
459  USBINDEX = CDC_DATA_ENDPOINT;
460  tmp = USBCSIL;
461  if (tmp & USBCSIL_PKT_PRESENT)
462  {
463  if (tmp & USBCSIL_INPKT_RDY)
464  {
465  return 0; // 2 packets are in the FIFO, so no room
466  }
467  return CDC_IN_PACKET_SIZE - inFifoBytesLoaded; // 1 packet is in the FIFO, so there is room for 1 more
468  }
469  else
470  {
471  return (CDC_IN_PACKET_SIZE<<1) - inFifoBytesLoaded; // 0 packets are in the FIFO, so there is room for 2 more
472  }
473 }
474 
475 // Assumption: The user called usbComTxAvailable() before calling this function,
476 // and it returned a number greater than or equal to size.
477 void usbComTxSend(const uint8 XDATA * buffer, uint8 size)
478 {
479  uint8 packetSize;
480  while(size)
481  {
482  packetSize = CDC_IN_PACKET_SIZE - inFifoBytesLoaded; // Decide how many bytes to send in this packet (packetSize).
483  if (packetSize > size){ packetSize = size; }
484 
485  usbWriteFifo(CDC_DATA_ENDPOINT, packetSize, buffer); // Write those bytes to the USB FIFO.
486 
487  buffer += packetSize; // Update pointers.
488  size -= packetSize;
489  inFifoBytesLoaded += packetSize;
490 
491  if (inFifoBytesLoaded == CDC_IN_PACKET_SIZE)
492  {
493  sendPacketNow();
494  }
495  }
496 }
497 
499 {
500  // Assumption: usbComTxAvailable() recently returned a non-zero number
501 
502  CDC_DATA_FIFO = byte; // Give the byte to the USB module's FIFO.
503  inFifoBytesLoaded++;
504 
505  if (inFifoBytesLoaded == CDC_IN_PACKET_SIZE)
506  {
507  sendPacketNow();
508  }
509 
510  // Don't set usbActivityFlag here; wait until we actually send the packet.
511 }
512 
513 /* CDC ACM CONTROL SIGNAL FUNCTIONS *******************************************/
514 
516 {
517  return usbComControlLineState;
518 }
519 
521 {
522  usbComSerialState = (usbComSerialState & ACM_IRREGULAR_SIGNAL_MASK) | signals;
523 }
524 
526 {
527  usbComSerialState |= signalEvents;
528 }
#define DATA
Definition: cc2511_types.h:52
struct USB_DESCRIPTOR_DEVICE USB_DESCRIPTOR_DEVICE
void usbCallbackInitEndpoints(void)
Definition: usb_cdc_acm.c:234
uint8 CODE usbStringDescriptorCount
Definition: usb_cdc_acm.c:224
void boardStartBootloader()
Definition: board.c:111
ACM_LINE_CODING XDATA usbComLineCoding
Definition: usb_cdc_acm.c:79
void usbInitEndpointOut(uint8 endpointNumber, uint8 maxPacketSize)
Definition: usb.c:642
void usbComTxSend(const uint8 XDATA *buffer, uint8 size)
Definition: usb_cdc_acm.c:477
HandlerFunction * usbComLineCodingChangeHandler
Definition: usb_cdc_acm.c:87
volatile BIT usbActivityFlag
Definition: usb.c:27
#define XDATA
Definition: cc2511_types.h:65
#define USB_LANGUAGE_EN_US
Definition: usb.h:113
#define USB_EP0_PACKET_SIZE
Definition: usb.h:34
void usbComTxControlSignalEvents(uint8 signalEvents)
Definition: usb_cdc_acm.c:525
enum USB_DEVICE_STATES XDATA usbDeviceState
Definition: usb.c:18
void usbControlWrite(uint16 bytesCount, uint8 XDATA *source)
Definition: usb.c:617
USB_DESCRIPTOR_DEVICE CODE usbDeviceDescriptor
Definition: usb_cdc_acm.c:109
struct USB_DESCRIPTOR_CONFIGURATION USB_DESCRIPTOR_CONFIGURATION
struct USB_DESCRIPTOR_INTERFACE USB_DESCRIPTOR_INTERFACE
struct USB_DESCRIPTOR_ENDPOINT USB_DESCRIPTOR_ENDPOINT
USB_SETUP_PACKET XDATA usbSetupPacket
Definition: usb.c:17
void usbComRxReceive(uint8 XDATA *buffer, uint8 size)
Definition: usb_cdc_acm.c:343
#define USB_VENDOR_ID_POLOLU
Definition: usb.h:30
void usbWriteFifo(uint8 endpointNumber, uint8 count, const uint8 XDATA *buffer)
Definition: usb.c:46
uint16 CODE serialNumberStringDescriptor[]
void usbInitEndpointIn(uint8 endpointNumber, uint8 maxPacketSize)
Definition: usb.c:635
void usbReadFifo(uint8 endpointNumber, uint8 count, uint8 XDATA *buffer)
Definition: usb.c:34
__bit BIT
Definition: cc2511_types.h:32
void usbPoll(void)
Definition: usb.c:73
unsigned short uint16
Definition: cc2511_types.h:15
void usbComTxControlSignals(uint8 signals)
Definition: usb_cdc_acm.c:520
void usbComTxSendByte(uint8 byte)
Definition: usb_cdc_acm.c:498
void usbCallbackSetupHandler(void)
Definition: usb_cdc_acm.c:246
uint8 usbComRxControlSignals(void)
Definition: usb_cdc_acm.c:515
unsigned long dwDTERate
Definition: com.h:69
uint8 usbComRxReceiveByte(void)
Definition: usb_cdc_acm.c:325
unsigned char uint8
Definition: cc2511_types.h:9
void usbControlAcknowledge(void)
Definition: usb.c:624
void usbComService(void)
Definition: usb_cdc_acm.c:373
uint32 getMs()
Definition: time.c:19
void usbCallbackControlWriteHandler(void)
Definition: usb_cdc_acm.c:281
uint8 usbComRxAvailable(void)
Definition: usb_cdc_acm.c:299
void usbControlRead(uint16 bytesCount, uint8 XDATA *source)
Definition: usb.c:610
#define DEFINE_STRING_DESCRIPTOR(name, char_count,...)
Definition: usb.h:230
void usbCallbackClassDescriptorHandler(void)
Definition: usb_cdc_acm.c:271
#define ACM_IRREGULAR_SIGNAL_MASK
Definition: com.h:48
uint16 CODE *CODE usbStringDescriptors[]
Definition: usb_cdc_acm.c:228
uint8 usbComTxAvailable(void)
Definition: usb_cdc_acm.c:449
#define CODE
Definition: cc2511_types.h:39