USBDDriver.c
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------------- */
2 /* Atmel Microcontroller Software Support */
3 /* SAM Software Package License */
4 /* ---------------------------------------------------------------------------- */
5 /* Copyright (c) 2015, Atmel Corporation */
6 /* */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without */
10 /* modification, are permitted provided that the following condition is met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, */
13 /* this list of conditions and the disclaimer below. */
14 /* */
15 /* Atmel's name may not be used to endorse or promote products derived from */
16 /* this software without specific prior written permission. */
17 /* */
18 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 /* ---------------------------------------------------------------------------- */
29 
35 /*------------------------------------------------------------------------------
36  * Headers
37  *------------------------------------------------------------------------------*/
38 
39 #include <USBLib_Trace.h>
40 
41 #include "USBDDriver.h"
42 #include "USBD.h"
43 #include "USBD_HAL.h"
44 
45 #include <string.h>
46 
47 /*------------------------------------------------------------------------------
48  * Local variables
49  *------------------------------------------------------------------------------*/
50 
53 
54 /*------------------------------------------------------------------------------
55  * Local functions
56  *------------------------------------------------------------------------------*/
57 
61 static void TerminateCtrlInWithNull(void *pArg,
62  uint8_t status,
63  uint32_t transferred,
64  uint32_t remaining)
65 {
66  pArg = pArg; status = status;
67  transferred = transferred; remaining = remaining;
68  USBD_Write(0, /* Endpoint #0 */
69  0, /* No data buffer */
70  0, /* No data buffer */
71  (TransferCallback) 0,
72  (void *) 0);
73 }
74 
81 static void SetConfiguration(USBDDriver *pDriver, uint8_t cfgnum)
82 {
83  USBEndpointDescriptor *pEndpoints[17];
84  const USBConfigurationDescriptor *pConfiguration;
85 
86  /* Use different descriptor depending on device speed */
88  && pDriver->pDescriptors->pHsConfiguration)
89 
90  pConfiguration = pDriver->pDescriptors->pHsConfiguration;
91  else
92 
93  pConfiguration = pDriver->pDescriptors->pFsConfiguration;
94 
95  /* Set & save the desired configuration */
96  USBD_SetConfiguration(cfgnum);
97 
98  pDriver->cfgnum = cfgnum;
99  pDriver->isRemoteWakeUpEnabled =
100  ((pConfiguration->bmAttributes & 0x20) > 0);
101 
102  /* If the configuration is not 0, configure endpoints */
103  if (cfgnum != 0) {
104 
105  /* Parse configuration to get endpoint descriptors */
106  USBConfigurationDescriptor_Parse(pConfiguration, 0, pEndpoints, 0);
107 
108  /* Configure endpoints */
109  int i = 0;
110 
111  while (pEndpoints[i] != 0) {
112 
113  USBD_ConfigureEndpoint(pEndpoints[i]);
114  i++;
115  }
116  }
117 
118  /* Should be done before send the ZLP */
121 
122  /* Acknowledge the request */
123  USBD_Write(0, /* Endpoint #0 */
124  0, /* No data buffer */
125  0, /* No data buffer */
126  (TransferCallback) 0,
127  (void *) 0);
128 }
129 
134 static void GetConfiguration(const USBDDriver *pDriver)
135 {
136  unsigned long
137  tmp; // Coud be unsigned char : unsigned long has been chose to avoid any potential alignment issue with DMA
138 
140  tmp = 0; // If device is unconfigured, returned configuration must be 0
141  else
142  tmp = pDriver->cfgnum;
143 
144  USBD_Write(0, &tmp, 1, 0, 0);
145 }
146 
151 static void GetDeviceStatus(const USBDDriver *pDriver)
152 {
153  static unsigned short data;
154  const USBConfigurationDescriptor *pConfiguration;
155 
156  data = 0;
157  /* Use different configuration depending on device speed */
158 
159  if (USBD_IsHighSpeed())
160 
161  pConfiguration = pDriver->pDescriptors->pHsConfiguration;
162  else
163 
164  pConfiguration = pDriver->pDescriptors->pFsConfiguration;
165 
166  /* Check current configuration for power mode (if device is configured) */
167 
168  if (pDriver->cfgnum != 0) {
169 
170  if (USBConfigurationDescriptor_IsSelfPowered(pConfiguration))
171 
172  data |= 1;
173  }
174 
175  /* Check if remote wake-up is enabled */
176 
177  if (pDriver->isRemoteWakeUpEnabled)
178 
179  data |= 2;
180 
181  /* Send the device status */
182 
183  USBD_Write(0, &data, 2, 0, 0);
184 }
185 
190 static void GetEndpointStatus(uint8_t bEndpoint)
191 {
192  static unsigned short data;
193 
194  data = 0;
195 
196  switch (USBD_HAL_Halt(bEndpoint, 0xFF)) {
197 
198  case USBD_STATUS_INVALID_PARAMETER: /* the endpoint not exists */
199  USBD_Stall(0);
200  break;
201 
202  case 1:
203  data = 1;
204 
205  case 0:
206  /* Send the endpoint status */
207  USBD_Write(0, &data, 2, 0, 0);
208  break;
209  }
210 }
211 
220 static void GetDescriptor(
221  const USBDDriver *pDriver,
222  uint8_t type,
223  uint8_t indexRDesc,
224  uint32_t length)
225 {
226  const USBDeviceDescriptor *pDevice;
227  const USBConfigurationDescriptor *pConfiguration;
228  const USBDeviceQualifierDescriptor *pQualifier;
229  const USBConfigurationDescriptor *pOtherSpeed;
230  const USBGenericDescriptor **pStrings =
231  (const USBGenericDescriptor **) pDriver->pDescriptors->pStrings;
232  const USBGenericDescriptor *pString;
233  uint8_t numStrings = pDriver->pDescriptors->numStrings;
234  uint8_t terminateWithNull = 0;
235 
236  /* Use different set of descriptors depending on device speed */
237 
238  /* By default, we uses full speed values */
239  pDevice = pDriver->pDescriptors->pFsDevice;
240  pConfiguration = pDriver->pDescriptors->pFsConfiguration;
241 
242  /* HS, we try HS values */
244 
245  TRACE_DEBUG_WP("HS ");
246 
247  if (pDriver->pDescriptors->pHsDevice)
248  pDevice = pDriver->pDescriptors->pHsDevice;
249 
250  if (pDriver->pDescriptors->pHsConfiguration)
251  pConfiguration = pDriver->pDescriptors->pHsConfiguration;
252 
253  pQualifier = pDriver->pDescriptors->pHsQualifier;
254  pOtherSpeed = pDriver->pDescriptors->pHsOtherSpeed;
255  } else {
256 
257  TRACE_DEBUG_WP("FS ");
258  pQualifier = pDriver->pDescriptors->pFsQualifier;
259  pOtherSpeed = pDriver->pDescriptors->pFsOtherSpeed;
260  }
261 
262  /* Check the descriptor type */
263 
264  switch (type) {
265 
267  TRACE_INFO_WP("Dev ");
268 
269  /* Adjust length and send descriptor */
270 
271  if (length > USBGenericDescriptor_GetLength((USBGenericDescriptor *) pDevice))
272 
273  length = USBGenericDescriptor_GetLength((USBGenericDescriptor *) pDevice);
274 
275  USBD_Write(0, pDevice, length, 0, 0);
276  break;
277 
279  TRACE_INFO_WP("Cfg ");
280 
281  /* Adjust length and send descriptor */
282 
283  if (length > USBConfigurationDescriptor_GetTotalLength(pConfiguration)) {
284 
285  length = USBConfigurationDescriptor_GetTotalLength(pConfiguration);
286  terminateWithNull = ((length % pDevice->bMaxPacketSize0) == 0);
287  }
288 
289  USBD_Write(0,
290  pConfiguration,
291  length,
292  terminateWithNull ? TerminateCtrlInWithNull : 0,
293  0);
294  break;
295 
297  TRACE_INFO_WP("Qua ");
298 
299  /* Check if descriptor exists */
300 
301  if (!pQualifier)
302 
303  USBD_Stall(0);
304  else {
305 
306  /* Adjust length and send descriptor */
307 
308  if (length > USBGenericDescriptor_GetLength((USBGenericDescriptor *)
309  pQualifier))
310 
311  length = USBGenericDescriptor_GetLength((USBGenericDescriptor *) pQualifier);
312 
313  USBD_Write(0, pQualifier, length, 0, 0);
314  }
315 
316  break;
317 
319  TRACE_INFO_WP("OSC ");
320 
321  /* Check if descriptor exists */
322 
323  if (!pOtherSpeed)
324 
325  USBD_Stall(0);
326  else {
327 
328  /* Adjust length and send descriptor */
329 
330  if (length > USBConfigurationDescriptor_GetTotalLength(pOtherSpeed)) {
331 
332  length = USBConfigurationDescriptor_GetTotalLength(pOtherSpeed);
333  terminateWithNull = ((length % pDevice->bMaxPacketSize0) == 0);
334  }
335 
336  USBD_Write(0,
337  pOtherSpeed,
338  length,
339  terminateWithNull ? TerminateCtrlInWithNull : 0,
340  0);
341  }
342 
343  break;
344 
346  TRACE_INFO_WP("Str%d ", indexRDesc);
347 
348  /* Check if descriptor exists */
349 
350  if (indexRDesc >= numStrings)
351 
352  USBD_Stall(0);
353  else {
354 
355  pString = pStrings[indexRDesc];
356 
357  /* Adjust length and send descriptor */
358 
359  if (length > USBGenericDescriptor_GetLength(pString)) {
360 
361  length = USBGenericDescriptor_GetLength(pString);
362  terminateWithNull = ((length % pDevice->bMaxPacketSize0) == 0);
363  }
364 
365  USBD_Write(0,
366  pString,
367  length,
368  terminateWithNull ? TerminateCtrlInWithNull : 0,
369  0);
370  }
371 
372  break;
373 
374  default:
376  "USBDDriver_GetDescriptor: Unknown descriptor type (%d)\n\r",
377  type);
378  USBD_Stall(0);
379  }
380 }
381 
390 static void SetInterface(
391  USBDDriver *pDriver,
392  uint8_t infnum,
393  uint8_t setting)
394 {
395  /* Make sure alternate settings are supported */
396 
397  TRACE_INFO_WP("Setting %d ", setting);
398 
399  if (!pDriver->pInterfaces)
400 
401  USBD_Stall(0);
402  else {
403 
404  /* Change the current setting of the interface and trigger the callback */
405  /* if necessary */
406  if (pDriver->pInterfaces[infnum] != setting) {
407 
408  pDriver->pInterfaces[infnum] = setting;
409 
412  }
413 
414  /* Acknowledge the request */
415 
416  USBD_Write(0, 0, 0, 0, 0);
417  }
418 }
419 
427 static void GetInterface(
428  const USBDDriver *pDriver,
429  uint8_t infnum)
430 {
431  /* Make sure alternate settings are supported, or STALL the control pipe */
432 
433  if (!pDriver->pInterfaces)
434 
435  USBD_Stall(0);
436  else {
437 
438  /* Sends the current interface setting to the host */
439 
440  USBD_Write(0, &(pDriver->pInterfaces[infnum]), 1, 0, 0);
441  }
442 }
443 
448 static void USBDDriver_Test(const USBDDriver *pDriver, uint8_t test)
449 {
450  pDriver = pDriver;
451  TRACE_DEBUG("UDPHS_Test\n\r");
452 
453  /* the lower byte of wIndex must be zero
454  the most significant byte of wIndex is used to specify the specific test mode */
455 
456  switch (test) {
458  /*Test mode Test_Packet: */
459  /*Upon command, a port must repetitively transmit the following test packet until */
460  /*the exit action is taken. This enables the testing of rise and fall times, eye */
461  /*patterns, jitter, and any other dynamic waveform specifications. */
462  /*The test packet is made up by concatenating the following strings. */
463  /*(Note: For J/K NRZI data, and for NRZ data, the bit on the left is the first one */
464  /*transmitted. “S?indicates that a bit stuff occurs, which inserts an “extra?NRZI data bit. */
465  /*? N?is used to indicate N occurrences of a string of bits or symbols.) */
466  /*A port in Test_Packet mode must send this packet repetitively. The inter-packet timing */
467  /*must be no less than the minimum allowable inter-packet gap as defined in Section 7.1.18 and */
468  /*no greater than 125 us. */
469 
470  /* Send ZLP */
472  /* Tst PACKET */
474 
475  while (1);
476 
477  /*break; not reached */
478 
479 
481  /*Test mode Test_J: */
482  /*Upon command, a port’s transceiver must enter the high-speed J state and remain in that */
483  /*state until the exit action is taken. This enables the testing of the high output drive */
484  /*level on the D+ line. */
485 
486  /* Send ZLP */
488  /* Tst J */
490 
491  while (1);
492 
493  /*break; not reached */
494 
495 
497  /*Test mode Test_K: */
498  /*Upon command, a port’s transceiver must enter the high-speed K state and remain in */
499  /*that state until the exit action is taken. This enables the testing of the high output drive */
500  /*level on the D- line. */
501 
502  /* Send a ZLP */
505 
506  while (1);
507 
508  /*break; not reached */
509 
510 
512  /*Test mode Test_SE0_NAK: */
513  /*Upon command, a port’s transceiver must enter the high-speed receive mode */
514  /*and remain in that mode until the exit action is taken. This enables the testing */
515  /*of output impedance, low level output voltage, and loading characteristics. */
516  /*In addition, while in this mode, upstream facing ports (and only upstream facing ports) */
517  /*must respond to any IN token packet with a NAK handshake (only if the packet CRC is */
518  /*determined to be correct) within the normal allowed device response time. This enables testing of */
519  /*the device squelch level circuitry and, additionally, provides a general purpose stimulus/response */
520  /*test for basic functional testing. */
521 
522  /* Send a ZLP */
524  /* Test SE0_NAK */
526 
527  while (1);
528 
529  /*break; not reached */
530 
531 
532  default:
533  USBD_Stall(0);
534  break;
535 
536  }
537 
538  /* The exit action is to power cycle the device. */
539  /* The device must be disconnected from the host */
540 }
541 
542 /*------------------------------------------------------------------------------
543  * Exported functions
544  *------------------------------------------------------------------------------*/
545 
550 {
551  return &usbdDriver;
552 }
553 
564  USBDDriver *pDriver,
565  const USBDDriverDescriptors *pDescriptors,
566  uint8_t *pInterfaces)
567 {
568 
569  pDriver->cfgnum = 0;
570  pDriver->isRemoteWakeUpEnabled = 0;
571 
572  pDriver->pDescriptors = pDescriptors;
573  pDriver->pInterfaces = pInterfaces;
574 
575  /* Initialize interfaces array if not null */
576 
577  if (pInterfaces != 0)
578 
579  memset(pInterfaces, sizeof(pInterfaces), 0);
580 }
581 
587 USBConfigurationDescriptor *USBDDriver_GetCfgDescriptors(
588  USBDDriver *pDriver, uint8_t cfgNum)
589 {
591  pDriver->pDescriptors;
592  USBConfigurationDescriptor *pCfg;
593 
594  cfgNum = cfgNum;
595 
596  if (USBD_HAL_IsHighSpeed() && pDescList->pHsConfiguration)
597  pCfg = (USBConfigurationDescriptor *)pDescList->pHsConfiguration;
598  else
599  pCfg = (USBConfigurationDescriptor *)pDescList->pFsConfiguration;
600 
601  return pCfg;
602 }
603 
610  USBDDriver *pDriver,
611  const USBGenericRequest *pRequest)
612 {
613  uint8_t cfgnum;
614  uint8_t infnum;
615  uint8_t eptnum;
616  uint8_t setting;
617  uint8_t type;
618  uint8_t indexDesc;
619  uint32_t length;
620  uint32_t address;
621 
622  TRACE_INFO_WP("Std ");
623 
624  /* Check request code */
625  switch (USBGenericRequest_GetRequest(pRequest)) {
626 
628  TRACE_INFO_WP("gDesc ");
629 
630  /* Send the requested descriptor */
632  indexDesc = USBGetDescriptorRequest_GetDescriptorIndex(pRequest);
633  length = USBGenericRequest_GetLength(pRequest);
634  GetDescriptor(pDriver, type, indexDesc, length);
635  break;
636 
638  TRACE_INFO_WP("sAddr ");
639 
640  /* Sends a zero-length packet and then set the device address */
641  address = USBSetAddressRequest_GetAddress(pRequest);
642  USBD_Write(0, 0, 0, (TransferCallback) USBD_SetAddress, (void *) address);
643  break;
644 
646  TRACE_INFO_WP("sCfg ");
647 
648  /* Set the requested configuration */
650  SetConfiguration(pDriver, cfgnum);
651  break;
652 
654  TRACE_INFO_WP("gCfg ");
655 
656  /* Send the current configuration number */
657  GetConfiguration(pDriver);
658  break;
659 
661  TRACE_INFO_WP("gSta ");
662 
663  /* Check who is the recipient */
664  switch (USBGenericRequest_GetRecipient(pRequest)) {
665 
667  TRACE_INFO_WP("Dev ");
668 
669  /* Send the device status */
670  GetDeviceStatus(pDriver);
671  break;
672 
674  TRACE_INFO_WP("Ept ");
675 
676  /* Send the endpoint status */
677  eptnum = USBGenericRequest_GetEndpointNumber(pRequest);
678  GetEndpointStatus(eptnum);
679  break;
680 
681  default:
683  "USBDDriver_RequestHandler: Unknown recipient (%d)\n\r",
685  USBD_Stall(0);
686  }
687 
688  break;
689 
691  TRACE_INFO_WP("cFeat ");
692 
693  /* Check which is the requested feature */
694  switch (USBFeatureRequest_GetFeatureSelector(pRequest)) {
695 
697  TRACE_INFO_WP("Hlt ");
698  TRACE_INFO_WP(" ");
699 
700  /* Unhalt endpoint and send a zero-length packet */
702  USBD_Write(0, 0, 0, 0, 0);
703  break;
704 
706  TRACE_INFO_WP("RmWU ");
707 
708  /* Disable remote wake-up and send a zero-length packet */
709  pDriver->isRemoteWakeUpEnabled = 0;
710  USBD_Write(0, 0, 0, 0, 0);
711  break;
712 
713  default:
715  "USBDDriver_RequestHandler: Unknown feature selector (%d)\n\r",
717  USBD_Stall(0);
718  }
719 
720  break;
721 
723  TRACE_INFO_WP("sFeat ");
724 
725  /* Check which is the selected feature */
726  switch (USBFeatureRequest_GetFeatureSelector(pRequest)) {
727 
729  TRACE_INFO_WP("RmWU ");
730 
731  /* Enable remote wake-up and send a ZLP */
732  pDriver->isRemoteWakeUpEnabled = 1;
733  USBD_Write(0, 0, 0, 0, 0);
734  break;
735 
737  TRACE_INFO_WP("Halt ");
738  /* Halt endpoint */
740  USBD_Write(0, 0, 0, 0, 0);
741  break;
742 
744 
745  /* 7.1.20 Test Mode Support, 9.4.9 Set Feature */
747  && ((USBGenericRequest_GetIndex(pRequest) & 0x000F) == 0)) {
748 
749  /* Handle test request */
750  USBDDriver_Test(pDriver,
752  } else
753 
754  USBD_Stall(0);
755 
756  break;
757 
758 #if 0
759 
761  TRACE_INFO_WP("OTG_B_HNP_ENABLE ");
762  pDriver->otg_features_supported |=
764  USBD_Write(0, 0, 0, 0, 0);
765  break;
766 
768  TRACE_INFO_WP("OTG_A_HNP_SUPPORT ");
769  pDriver->otg_features_supported |=
771  USBD_Write(0, 0, 0, 0, 0);
772  break;
773 
775  TRACE_INFO_WP("OTG_A_ALT_HNP_SUPPORT ");
776  pDriver->otg_features_supported |=
778  USBD_Write(0, 0, 0, 0, 0);
779  break;
780 #endif
781 
782  default:
784  "USBDDriver_RequestHandler: Unknown feature selector (%d)\n\r",
786  USBD_Stall(0);
787  }
788 
789  break;
790 
792  TRACE_INFO_WP("sInterface ");
793 
794  infnum = USBInterfaceRequest_GetInterface(pRequest);
795  setting = USBInterfaceRequest_GetAlternateSetting(pRequest);
796  SetInterface(pDriver, infnum, setting);
797  break;
798 
800  TRACE_INFO_WP("gInterface ");
801 
802  infnum = USBInterfaceRequest_GetInterface(pRequest);
803  GetInterface(pDriver, infnum);
804  break;
805 
806  default:
808  "USBDDriver_RequestHandler: Unknown request code (%d)\n\r",
809  USBGenericRequest_GetRequest(pRequest));
810  USBD_Stall(0);
811  }
812 }
813 
814 
822 {
823  return pDriver->isRemoteWakeUpEnabled;
824 }
825 
832 {
833  return pDriver->otg_features_supported;
834 }
835 
842 {
843  pDriver->otg_features_supported = 0;
844 }
845 
const uint8_t ** pStrings
Definition: USBDDriver.h:98
#define USBD_STATUS_INVALID_PARAMETER
Definition: USBD.h:112
uint8_t USBSetAddressRequest_GetAddress(const USBGenericRequest *request)
Definition: USBRequests.c:172
#define USBFeatureRequest_OTG_A_HNP_SUPPORT
Definition: USBRequests.h:220
#define USBFeatureRequest_TESTSE0NAK
Definition: USBRequests.h:242
const USBDeviceQualifierDescriptor * pHsQualifier
Definition: USBDDriver.h:94
#define USBGenericRequest_SETINTERFACE
Definition: USBRequests.h:130
#define USBFeatureRequest_ENDPOINTHALT
Definition: USBRequests.h:210
const USBDeviceDescriptor * pHsDevice
Definition: USBDDriver.h:90
uint8_t USBD_HAL_IsHighSpeed(void)
Definition: USBD_HAL.c:1898
uint8_t USBGenericRequest_GetRecipient(const USBGenericRequest *request)
Definition: USBRequests.c:117
#define USBFeatureRequest_TESTSENDZLP
Definition: USBRequests.h:248
#define USBGenericDescriptor_DEVICEQUALIFIER
uint8_t USBD_GetState(void)
Definition: USBD.c:538
#define USBGenericRequest_DEVICE
Definition: USBRequests.h:144
void USBD_Unhalt(uint8_t bEndpoint)
Definition: USBD.c:397
#define USBGenericDescriptor_DEVICE
const USBConfigurationDescriptor * pHsOtherSpeed
Definition: USBDDriver.h:96
#define USBGenericRequest_SETFEATURE
Definition: USBRequests.h:116
if(udd_ctrl_interrupt())
Definition: usbhs_device.c:688
void USBD_SetAddress(uint8_t address)
Definition: USBD.c:437
static void GetEndpointStatus(uint8_t bEndpoint)
Definition: USBDDriver.c:190
static void SetInterface(USBDDriver *pDriver, uint8_t infnum, uint8_t setting)
Definition: USBDDriver.c:390
#define USBGenericRequest_SETCONFIGURATION
Definition: USBRequests.h:126
#define NULL
Definition: nm_bsp.h:52
const USBConfigurationDescriptor * pHsConfiguration
Definition: USBDDriver.h:92
static void GetDescriptor(const USBDDriver *pDriver, uint8_t type, uint8_t indexRDesc, uint32_t length)
Definition: USBDDriver.c:220
#define USBFeatureRequest_OTG_B_HNP_ENABLE
Definition: USBRequests.h:218
uint8_t USBD_Stall(uint8_t bEndpoint)
Definition: USBD.c:427
void USBD_SetConfiguration(uint8_t cfgnum)
Definition: USBD.c:453
void USBConfigurationDescriptor_Parse(const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others)
uint32_t USBGenericDescriptor_GetLength(const USBGenericDescriptor *descriptor)
uint8_t USBInterfaceRequest_GetInterface(const USBGenericRequest *request)
Definition: USBRequests.c:197
WEAK void USBDDriverCallbacks_InterfaceSettingChanged(uint8_t interface, uint8_t setting)
#define USBGenericRequest_GETINTERFACE
Definition: USBRequests.h:128
WEAK void USBDDriverCallbacks_ConfigurationChanged(uint8_t cfgnum)
uint8_t USBDDriver_IsRemoteWakeUpEnabled(const USBDDriver *pDriver)
Definition: USBDDriver.c:821
void USBD_ConfigureEndpoint(const USBEndpointDescriptor *pDescriptor)
Definition: USBD.c:165
#define USBFeatureRequest_TESTJ
Definition: USBRequests.h:237
uint8_t USBD_Write(uint8_t bEndpoint, const void *pData, uint32_t dLength, TransferCallback fCallback, void *pArgument)
Definition: USBD.c:191
static USBDDriver usbdDriver
Definition: USBDDriver.c:52
uint8_t USBSetConfigurationRequest_GetConfiguration(const USBGenericRequest *request)
Definition: USBRequests.c:184
uint16_t USBGenericRequest_GetLength(const USBGenericRequest *request)
Definition: USBRequests.c:95
uint8_t USBFeatureRequest_GetTestSelector(const USBGenericRequest *request)
Definition: USBRequests.c:233
#define USBGenericDescriptor_CONFIGURATION
#define USBFeatureRequest_TESTK
Definition: USBRequests.h:239
#define USBGenericRequest_GETDESCRIPTOR
Definition: USBRequests.h:120
uint8_t USBD_IsHighSpeed(void)
Definition: USBD.c:416
void USBDDriver_RequestHandler(USBDDriver *pDriver, const USBGenericRequest *pRequest)
Definition: USBDDriver.c:609
static void GetDeviceStatus(const USBDDriver *pDriver)
Definition: USBDDriver.c:151
USBConfigurationDescriptor * USBDDriver_GetCfgDescriptors(USBDDriver *pDriver, uint8_t cfgNum)
Definition: USBDDriver.c:587
#define USBGenericDescriptor_STRING
static void SetConfiguration(USBDDriver *pDriver, uint8_t cfgnum)
Definition: USBDDriver.c:81
static void GetConfiguration(const USBDDriver *pDriver)
Definition: USBDDriver.c:134
uint8_t USBGenericRequest_GetEndpointNumber(const USBGenericRequest *request)
Definition: USBRequests.c:105
uint8_t USBGetDescriptorRequest_GetDescriptorType(const USBGenericRequest *request)
Definition: USBRequests.c:145
uint8_t cfgnum
Definition: USBDDriver.h:116
const USBDDriverDescriptors * pDescriptors
Definition: USBDDriver.h:112
uint8_t USBGenericRequest_GetRequest(const USBGenericRequest *request)
Definition: USBRequests.c:65
const USBConfigurationDescriptor * pFsOtherSpeed
Definition: USBDDriver.h:88
unsigned char USBConfigurationDescriptor_IsSelfPowered(const USBConfigurationDescriptor *configuration)
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
Definition: USBD.h:200
#define USBD_STATE_CONFIGURED
Definition: USBD.h:143
void USBDDriver_clearOTGFeatures(USBDDriver *pDriver)
Definition: USBDDriver.c:841
void USBD_Halt(uint8_t bEndpoint)
Definition: USBD.c:388
const USBDeviceQualifierDescriptor * pFsQualifier
Definition: USBDDriver.h:86
USBInterfaceDescriptor data
uint8_t USBD_HAL_Halt(uint8_t bEndpoint, uint8_t ctl)
Definition: USBD_HAL.c:1809
void USBD_Test(uint8_t bIndex)
Definition: USBD.c:547
static void USBDDriver_Test(const USBDDriver *pDriver, uint8_t test)
Definition: USBDDriver.c:448
#define TRACE_WARNING(...)
Definition: USBLib_Trace.h:174
#define USBGenericRequest_GETSTATUS
Definition: USBRequests.h:112
#define USBGenericRequest_GETCONFIGURATION
Definition: USBRequests.h:124
#define USBGenericRequest_ENDPOINT
Definition: USBRequests.h:148
uint8_t otg_features_supported
Definition: USBDDriver.h:120
USBDDriver * USBD_GetDriver(void)
Definition: USBDDriver.c:549
const USBConfigurationDescriptor * pFsConfiguration
Definition: USBDDriver.h:84
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
#define USBFeatureRequest_TESTMODE
Definition: USBRequests.h:214
#define USBFeatureRequest_TESTPACKET
Definition: USBRequests.h:244
uint32_t USBConfigurationDescriptor_GetTotalLength(const USBConfigurationDescriptor *configuration)
const USBDeviceDescriptor * pFsDevice
Definition: USBDDriver.h:82
uint8_t USBInterfaceRequest_GetAlternateSetting(const USBGenericRequest *request)
Definition: USBRequests.c:208
uint16_t USBGenericRequest_GetIndex(const USBGenericRequest *request)
Definition: USBRequests.c:85
#define USBFeatureRequest_OTG_A_ALT_HNP_SUPPORT
Definition: USBRequests.h:222
#define TRACE_DEBUG(...)
Definition: USBLib_Trace.h:161
#define USBGenericRequest_CLEARFEATURE
Definition: USBRequests.h:114
#define USBGenericDescriptor_OTHERSPEEDCONFIGURATION
uint8_t USBDDriver_returnOTGFeatures(const USBDDriver *pDriver)
Definition: USBDDriver.c:831
uint8_t USBGetDescriptorRequest_GetDescriptorIndex(const USBGenericRequest *request)
Definition: USBRequests.c:158
static void GetInterface(const USBDDriver *pDriver, uint8_t infnum)
Definition: USBDDriver.c:427
uint8_t * pInterfaces
Definition: USBDDriver.h:114
void USBDDriver_Initialize(USBDDriver *pDriver, const USBDDriverDescriptors *pDescriptors, uint8_t *pInterfaces)
Definition: USBDDriver.c:563
uint8_t isRemoteWakeUpEnabled
Definition: USBDDriver.h:118
#define TRACE_DEBUG_WP(...)
Definition: USBLib_Trace.h:162
#define USBFeatureRequest_DEVICEREMOTEWAKEUP
Definition: USBRequests.h:212
#define TRACE_INFO_WP(...)
Definition: USBLib_Trace.h:167
#define USBGenericRequest_SETADDRESS
Definition: USBRequests.h:118
uint8_t USBFeatureRequest_GetFeatureSelector(const USBGenericRequest *request)
Definition: USBRequests.c:221
static void TerminateCtrlInWithNull(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
Definition: USBDDriver.c:61


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:05