Browse Source

Fix CMSIS / USB-FD name conflicts (#18327)

ellensp 4 years ago
parent
commit
1c13428d84
No account linked to committer's email address

+ 6
- 6
Marlin/src/sd/usb_flashdrive/lib-uhs2/Usb.cpp View File

428
   uint8_t rcode;
428
   uint8_t rcode;
429
   uint8_t tmpdata;
429
   uint8_t tmpdata;
430
   static uint32_t delay = 0;
430
   static uint32_t delay = 0;
431
-  //USB_DEVICE_DESCRIPTOR buf;
431
+  //USB_FD_DEVICE_DESCRIPTOR buf;
432
   bool lowspeed = false;
432
   bool lowspeed = false;
433
 
433
 
434
   MAX3421E::Task();
434
   MAX3421E::Task();
647
   //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
647
   //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
648
   uint8_t devConfigIndex;
648
   uint8_t devConfigIndex;
649
   uint8_t rcode = 0;
649
   uint8_t rcode = 0;
650
-  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
651
-  USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
650
+  uint8_t buf[sizeof (USB_FD_DEVICE_DESCRIPTOR)];
651
+  USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
652
   UsbDevice *p = nullptr;
652
   UsbDevice *p = nullptr;
653
   EpInfo *oldep_ptr = nullptr;
653
   EpInfo *oldep_ptr = nullptr;
654
   EpInfo epInfo;
654
   EpInfo epInfo;
678
 
678
 
679
   p->lowspeed = lowspeed;
679
   p->lowspeed = lowspeed;
680
   // Get device descriptor
680
   // Get device descriptor
681
-  rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
681
+  rcode = getDevDescr(0, 0, sizeof (USB_FD_DEVICE_DESCRIPTOR), (uint8_t*)buf);
682
 
682
 
683
   // Restore p->epinfo
683
   // Restore p->epinfo
684
   p->epinfo = oldep_ptr;
684
   p->epinfo = oldep_ptr;
685
 
685
 
686
   if (rcode) {
686
   if (rcode) {
687
-    //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
687
+    //printf("Configuring error: Can't get USB_FD_DEVICE_DESCRIPTOR\r\n");
688
     return rcode;
688
     return rcode;
689
   }
689
   }
690
 
690
 
762
 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
762
 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
763
   const uint8_t bufSize = 64;
763
   const uint8_t bufSize = 64;
764
   uint8_t buf[bufSize];
764
   uint8_t buf[bufSize];
765
-  USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
765
+  USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
766
 
766
 
767
   uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
767
   uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
768
   if (ret) return ret;
768
   if (ret) return ret;

+ 7
- 7
Marlin/src/sd/usb_flashdrive/lib-uhs2/confdescparser.h View File

30
 
30
 
31
 class UsbConfigXtracter {
31
 class UsbConfigXtracter {
32
 public:
32
 public:
33
-  //virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0;
34
-  //virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0;
33
+  //virtual void ConfigXtract(const USB_FD_CONFIGURATION_DESCRIPTOR *conf) = 0;
34
+  //virtual void InterfaceXtract(uint8_t conf, const USB_FD_INTERFACE_DESCRIPTOR *iface) = 0;
35
 
35
 
36
-  virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) {
36
+  virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_FD_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) {
37
   }
37
   }
38
 };
38
 };
39
 
39
 
50
   MultiValueBuffer theBuffer;
50
   MultiValueBuffer theBuffer;
51
   MultiByteValueParser valParser;
51
   MultiByteValueParser valParser;
52
   ByteSkipper theSkipper;
52
   ByteSkipper theSkipper;
53
-  uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/];
53
+  uint8_t varBuffer[16 /*sizeof(USB_FD_CONFIGURATION_DESCRIPTOR)*/];
54
 
54
 
55
   uint8_t stateParseDescr; // ParseDescriptor state
55
   uint8_t stateParseDescr; // ParseDescriptor state
56
 
56
 
97
   compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
97
   compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
98
 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
98
 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
99
 bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor(uint8_t **pp, uint16_t *pcntdn) {
99
 bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor(uint8_t **pp, uint16_t *pcntdn) {
100
-  USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
101
-  USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
100
+  USB_FD_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR*>(varBuffer);
101
+  USB_FD_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_FD_INTERFACE_DESCRIPTOR*>(varBuffer);
102
   switch (stateParseDescr) {
102
   switch (stateParseDescr) {
103
     case 0:
103
     case 0:
104
       theBuffer.valueSize = 2;
104
       theBuffer.valueSize = 2;
155
         case USB_DESCRIPTOR_ENDPOINT:
155
         case USB_DESCRIPTOR_ENDPOINT:
156
           if (!valParser.Parse(pp, pcntdn)) return false;
156
           if (!valParser.Parse(pp, pcntdn)) return false;
157
           if (isGoodInterface && theXtractor)
157
           if (isGoodInterface && theXtractor)
158
-            theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
158
+            theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_FD_ENDPOINT_DESCRIPTOR*)varBuffer);
159
           break;
159
           break;
160
           //case HID_DESCRIPTOR_HID:
160
           //case HID_DESCRIPTOR_HID:
161
           //  if (!valParser.Parse(pp, pcntdn)) return false;
161
           //  if (!valParser.Parse(pp, pcntdn)) return false;

+ 4
- 4
Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.cpp View File

250
  */
250
  */
251
 uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
251
 uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
252
 
252
 
253
-  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
253
+  const uint8_t constBufSize = sizeof (USB_FD_DEVICE_DESCRIPTOR);
254
 
254
 
255
   uint8_t buf[constBufSize];
255
   uint8_t buf[constBufSize];
256
-  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
256
+  USB_FD_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR*>(buf);
257
   uint8_t rcode;
257
   uint8_t rcode;
258
   UsbDevice *p = nullptr;
258
   UsbDevice *p = nullptr;
259
   EpInfo *oldep_ptr = nullptr;
259
   EpInfo *oldep_ptr = nullptr;
529
  * @param proto
529
  * @param proto
530
  * @param pep
530
  * @param pep
531
  */
531
  */
532
-void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR * pep) {
532
+void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_FD_ENDPOINT_DESCRIPTOR * pep) {
533
   ErrorMessage<uint8_t> (PSTR("Conf.Val"), conf);
533
   ErrorMessage<uint8_t> (PSTR("Conf.Val"), conf);
534
   ErrorMessage<uint8_t> (PSTR("Iface Num"), iface);
534
   ErrorMessage<uint8_t> (PSTR("Iface Num"), iface);
535
   ErrorMessage<uint8_t> (PSTR("Alt.Set"), alt);
535
   ErrorMessage<uint8_t> (PSTR("Alt.Set"), alt);
1166
  *
1166
  *
1167
  * @param ep_ptr
1167
  * @param ep_ptr
1168
  */
1168
  */
1169
-void BulkOnly::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) {
1169
+void BulkOnly::PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR * ep_ptr) {
1170
   Notify(PSTR("Endpoint descriptor:"), 0x80);
1170
   Notify(PSTR("Endpoint descriptor:"), 0x80);
1171
   Notify(PSTR("\r\nLength:\t\t"), 0x80);
1171
   Notify(PSTR("\r\nLength:\t\t"), 0x80);
1172
   D_PrintHex<uint8_t> (ep_ptr->bLength, 0x80);
1172
   D_PrintHex<uint8_t> (ep_ptr->bLength, 0x80);

+ 2
- 2
Marlin/src/sd/usb_flashdrive/lib-uhs2/masstorage.h View File

491
   uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
491
   uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
492
   bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
492
   bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
493
   bool WriteOk[MASS_MAX_SUPPORTED_LUN];
493
   bool WriteOk[MASS_MAX_SUPPORTED_LUN];
494
-  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
494
+  void PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR* ep_ptr);
495
 
495
 
496
   // Additional Initialization Method for Subclasses
496
   // Additional Initialization Method for Subclasses
497
 
497
 
526
   virtual uint8_t GetAddress() { return bAddress; }
526
   virtual uint8_t GetAddress() { return bAddress; }
527
 
527
 
528
   // UsbConfigXtracter implementation
528
   // UsbConfigXtracter implementation
529
-  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
529
+  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_FD_ENDPOINT_DESCRIPTOR *ep);
530
 
530
 
531
   virtual bool DEVCLASSOK(uint8_t klass) { return klass == USB_CLASS_MASS_STORAGE; }
531
   virtual bool DEVCLASSOK(uint8_t klass) { return klass == USB_CLASS_MASS_STORAGE; }
532
 
532
 

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs2/message.cpp View File

37
 void E_Notifyc(char c, int lvl) {
37
 void E_Notifyc(char c, int lvl) {
38
   if (UsbDEBUGlvl < lvl) return;
38
   if (UsbDEBUGlvl < lvl) return;
39
   USB_HOST_SERIAL.print(c
39
   USB_HOST_SERIAL.print(c
40
-    #if !defined(ARDUINO) || ARDUINO < 100
40
+    #if !defined(ARDUINO) && !defined(ARDUINO_ARCH_LPC176X)
41
       , BYTE
41
       , BYTE
42
     #endif
42
     #endif
43
   );
43
   );

+ 4
- 4
Marlin/src/sd/usb_flashdrive/lib-uhs2/usb_ch9.h View File

116
         uint8_t iProduct; // Index of String Descriptor describing the product.
116
         uint8_t iProduct; // Index of String Descriptor describing the product.
117
         uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
117
         uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
118
         uint8_t bNumConfigurations; // Number of possible configurations.
118
         uint8_t bNumConfigurations; // Number of possible configurations.
119
-} __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
119
+} __attribute__((packed)) USB_FD_DEVICE_DESCRIPTOR;
120
 
120
 
121
 /* Configuration descriptor structure */
121
 /* Configuration descriptor structure */
122
 typedef struct {
122
 typedef struct {
128
         uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
128
         uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
129
         uint8_t bmAttributes; // Configuration characteristics.
129
         uint8_t bmAttributes; // Configuration characteristics.
130
         uint8_t bMaxPower; // Maximum power consumed by this configuration.
130
         uint8_t bMaxPower; // Maximum power consumed by this configuration.
131
-} __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
131
+} __attribute__((packed)) USB_FD_CONFIGURATION_DESCRIPTOR;
132
 
132
 
133
 /* Interface descriptor structure */
133
 /* Interface descriptor structure */
134
 typedef struct {
134
 typedef struct {
141
         uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
141
         uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
142
         uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF).  0xFF-Vendor specific.
142
         uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF).  0xFF-Vendor specific.
143
         uint8_t iInterface; // Index of String Descriptor describing the interface.
143
         uint8_t iInterface; // Index of String Descriptor describing the interface.
144
-} __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
144
+} __attribute__((packed)) USB_FD_INTERFACE_DESCRIPTOR;
145
 
145
 
146
 /* Endpoint descriptor structure */
146
 /* Endpoint descriptor structure */
147
 typedef struct {
147
 typedef struct {
151
         uint8_t bmAttributes; // Endpoint transfer type.
151
         uint8_t bmAttributes; // Endpoint transfer type.
152
         uint16_t wMaxPacketSize; // Maximum packet size.
152
         uint16_t wMaxPacketSize; // Maximum packet size.
153
         uint8_t bInterval; // Polling interval in frames.
153
         uint8_t bInterval; // Polling interval in frames.
154
-} __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
154
+} __attribute__((packed)) USB_FD_ENDPOINT_DESCRIPTOR;
155
 
155
 
156
 /* HID descriptor */
156
 /* HID descriptor */
157
 typedef struct {
157
 typedef struct {

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_BULK_STORAGE/UHS_BULK_STORAGE.h View File

174
         volatile uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
174
         volatile uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
175
         volatile bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
175
         volatile bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
176
         volatile bool WriteOk[MASS_MAX_SUPPORTED_LUN];
176
         volatile bool WriteOk[MASS_MAX_SUPPORTED_LUN];
177
-        void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
177
+        void PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR* ep_ptr);
178
 
178
 
179
 public:
179
 public:
180
         UHS_Bulk_Storage(UHS_USB_HOST_BASE *p);
180
         UHS_Bulk_Storage(UHS_USB_HOST_BASE *p);

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_BULK_STORAGE/UHS_BULK_STORAGE_INLINE.h View File

1188
  *
1188
  *
1189
  * @param ep_ptr
1189
  * @param ep_ptr
1190
  */
1190
  */
1191
-void UHS_NI UHS_Bulk_Storage::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) {
1191
+void UHS_NI UHS_Bulk_Storage::PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR * ep_ptr) {
1192
         Notify(PSTR("Endpoint descriptor:"), 0x80);
1192
         Notify(PSTR("Endpoint descriptor:"), 0x80);
1193
         Notify(PSTR("\r\nLength:\t\t"), 0x80);
1193
         Notify(PSTR("\r\nLength:\t\t"), 0x80);
1194
         D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
1194
         D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);

+ 15
- 15
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_host_INLINE.h View File

239
         // wrap in {} to throw away the 64 byte buffer when we are done with it
239
         // wrap in {} to throw away the 64 byte buffer when we are done with it
240
         {
240
         {
241
                 uint8_t buf[biggest];
241
                 uint8_t buf[biggest];
242
-                USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
242
+                USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
243
 #else
243
 #else
244
         const uint8_t biggest = 18;
244
         const uint8_t biggest = 18;
245
         uint8_t buf[biggest];
245
         uint8_t buf[biggest];
246
-        USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
247
-        USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
246
+        USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
247
+        USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
248
 #endif
248
 #endif
249
 
249
 
250
                 //for(devConfigIndex = 0; devConfigIndex < UHS_HOST_MAX_INTERFACE_DRIVERS; devConfigIndex++) {
250
                 //for(devConfigIndex = 0; devConfigIndex < UHS_HOST_MAX_INTERFACE_DRIVERS; devConfigIndex++) {
309
                                 sof_delay(200);
309
                                 sof_delay(200);
310
                                 goto again;
310
                                 goto again;
311
                         }
311
                         }
312
-                        HOST_DEBUG("Configuring error: 0x%2.2x Can't get USB_DEVICE_DESCRIPTOR\r\n", rcode);
312
+                        HOST_DEBUG("Configuring error: 0x%2.2x Can't get USB_FD_DEVICE_DESCRIPTOR\r\n", rcode);
313
                         return rcode;
313
                         return rcode;
314
                 }
314
                 }
315
 
315
 
378
         } // unwrapped, old large buf now invalid and discarded.
378
         } // unwrapped, old large buf now invalid and discarded.
379
 
379
 
380
         uint8_t buf[18];
380
         uint8_t buf[18];
381
-        USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
381
+        USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
382
 #endif
382
 #endif
383
 
383
 
384
         ei.address = addrPool.AllocAddress(parent, IsHub(ei.klass), port);
384
         ei.address = addrPool.AllocAddress(parent, IsHub(ei.klass), port);
415
                 HOST_DEBUG("configs: %i\r\n", configs);
415
                 HOST_DEBUG("configs: %i\r\n", configs);
416
                 for(uint8_t conf = 0; (!rcode) && (conf < configs); conf++) {
416
                 for(uint8_t conf = 0; (!rcode) && (conf < configs); conf++) {
417
                         // read the config descriptor into a buffer.
417
                         // read the config descriptor into a buffer.
418
-                        rcode = getConfDescr(ei.address, sizeof (USB_CONFIGURATION_DESCRIPTOR), conf, buf);
418
+                        rcode = getConfDescr(ei.address, sizeof (USB_FD_CONFIGURATION_DESCRIPTOR), conf, buf);
419
                         if(rcode) {
419
                         if(rcode) {
420
-                                HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR\r\n", rcode);
420
+                                HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR\r\n", rcode);
421
                                 rcode = UHS_HOST_ERROR_FailGetConfDescr;
421
                                 rcode = UHS_HOST_ERROR_FailGetConfDescr;
422
                                 continue;
422
                                 continue;
423
                         }
423
                         }
438
                         uint8_t offset;
438
                         uint8_t offset;
439
                         rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
439
                         rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
440
                         if(rcode) {
440
                         if(rcode) {
441
-                                HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
441
+                                HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
442
                                 break;
442
                                 break;
443
                         }
443
                         }
444
                         for(; (numinf) && (!rcode); inf++) {
444
                         for(; (numinf) && (!rcode); inf++) {
451
                                         break;
451
                                         break;
452
                                 }
452
                                 }
453
                                 if(rcode) {
453
                                 if(rcode) {
454
-                                        HOST_DEBUG("Configuring error: %2.2x Can't close USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
454
+                                        HOST_DEBUG("Configuring error: %2.2x Can't close USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
455
                                         continue;
455
                                         continue;
456
                                 }
456
                                 }
457
                                 rcode = TestInterface(&ei);
457
                                 rcode = TestInterface(&ei);
471
                 if(!bestsuccess) rcode = UHS_HOST_ERROR_DEVICE_NOT_SUPPORTED;
471
                 if(!bestsuccess) rcode = UHS_HOST_ERROR_DEVICE_NOT_SUPPORTED;
472
         }
472
         }
473
         if(!rcode) {
473
         if(!rcode) {
474
-                rcode = getConfDescr(ei.address, sizeof (USB_CONFIGURATION_DESCRIPTOR), bestconf, buf);
474
+                rcode = getConfDescr(ei.address, sizeof (USB_FD_CONFIGURATION_DESCRIPTOR), bestconf, buf);
475
                 if(rcode) {
475
                 if(rcode) {
476
-                        HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR\r\n", rcode);
476
+                        HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR\r\n", rcode);
477
                         rcode = UHS_HOST_ERROR_FailGetConfDescr;
477
                         rcode = UHS_HOST_ERROR_FailGetConfDescr;
478
                 }
478
                 }
479
         }
479
         }
497
                                 uint8_t offset;
497
                                 uint8_t offset;
498
                                 rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
498
                                 rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
499
                                 if(rcode) {
499
                                 if(rcode) {
500
-                                        HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
500
+                                        HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
501
                                 } else {
501
                                 } else {
502
                                         for(; (numinf) && (!rcode); inf++) {
502
                                         for(; (numinf) && (!rcode); inf++) {
503
                                                 // iterate for each interface on this config
503
                                                 // iterate for each interface on this config
508
                                                         break;
508
                                                         break;
509
                                                 }
509
                                                 }
510
                                                 if(rcode) {
510
                                                 if(rcode) {
511
-                                                        HOST_DEBUG("Configuring error: %2.2x Can't close USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
511
+                                                        HOST_DEBUG("Configuring error: %2.2x Can't close USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
512
                                                         continue;
512
                                                         continue;
513
                                                 }
513
                                                 }
514
 
514
 
721
  * @param offset
721
  * @param offset
722
  * @return zero for success or error code
722
  * @return zero for success or error code
723
  */
723
  */
724
-uint8_t UHS_USB_HOST_BASE::initDescrStream(ENUMERATION_INFO *ei, USB_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset) {
724
+uint8_t UHS_USB_HOST_BASE::initDescrStream(ENUMERATION_INFO *ei, USB_FD_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset) {
725
         if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
725
         if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
726
         if(!pep) return UHS_HOST_ERROR_NULL_EPINFO;
726
         if(!pep) return UHS_HOST_ERROR_NULL_EPINFO;
727
         *left = ucd->wTotalLength;
727
         *left = ucd->wTotalLength;
837
         return rcode;
837
         return rcode;
838
 }
838
 }
839
 
839
 
840
-uint8_t UHS_USB_HOST_BASE::seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_CONFIGURATION_DESCRIPTOR *ucd) {
840
+uint8_t UHS_USB_HOST_BASE::seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_FD_CONFIGURATION_DESCRIPTOR *ucd) {
841
         if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
841
         if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
842
         uint8_t data[ei->bMaxPacketSize0];
842
         uint8_t data[ei->bMaxPacketSize0];
843
         UHS_EpInfo *pep;
843
         UHS_EpInfo *pep;

+ 4
- 4
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_usb_ch9.h View File

164
         uint8_t iProduct; // Index of String Descriptor describing the product.
164
         uint8_t iProduct; // Index of String Descriptor describing the product.
165
         uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
165
         uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
166
         uint8_t bNumConfigurations; // Number of possible configurations.
166
         uint8_t bNumConfigurations; // Number of possible configurations.
167
-} __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
167
+} __attribute__((packed)) USB_FD_DEVICE_DESCRIPTOR;
168
 
168
 
169
 /* Configuration descriptor structure */
169
 /* Configuration descriptor structure */
170
 typedef struct {
170
 typedef struct {
176
         uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
176
         uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
177
         uint8_t bmAttributes; // Configuration characteristics.
177
         uint8_t bmAttributes; // Configuration characteristics.
178
         uint8_t bMaxPower; // Maximum power consumed by this configuration.
178
         uint8_t bMaxPower; // Maximum power consumed by this configuration.
179
-} __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
179
+} __attribute__((packed)) USB_FD_CONFIGURATION_DESCRIPTOR;
180
 
180
 
181
 /* Interface descriptor structure */
181
 /* Interface descriptor structure */
182
 typedef struct {
182
 typedef struct {
189
         uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
189
         uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
190
         uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF).  0xFF-Vendor specific.
190
         uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF).  0xFF-Vendor specific.
191
         uint8_t iInterface; // Index of String Descriptor describing the interface.
191
         uint8_t iInterface; // Index of String Descriptor describing the interface.
192
-} __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
192
+} __attribute__((packed)) USB_FD_INTERFACE_DESCRIPTOR;
193
 
193
 
194
 /* Endpoint descriptor structure */
194
 /* Endpoint descriptor structure */
195
 typedef struct {
195
 typedef struct {
199
         uint8_t bmAttributes; // Endpoint transfer type.
199
         uint8_t bmAttributes; // Endpoint transfer type.
200
         uint16_t wMaxPacketSize; // Maximum packet size.
200
         uint16_t wMaxPacketSize; // Maximum packet size.
201
         uint8_t bInterval; // Polling interval in frames.
201
         uint8_t bInterval; // Polling interval in frames.
202
-} __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
202
+} __attribute__((packed)) USB_FD_ENDPOINT_DESCRIPTOR;
203
 
203
 
204
 /* HID descriptor */
204
 /* HID descriptor */
205
 /*
205
 /*

+ 2
- 2
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/UHS_usbhost.h View File

207
                 interrupts();
207
                 interrupts();
208
         }
208
         }
209
 
209
 
210
-        uint8_t UHS_NI seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_CONFIGURATION_DESCRIPTOR *ucd);
210
+        uint8_t UHS_NI seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_FD_CONFIGURATION_DESCRIPTOR *ucd);
211
 
211
 
212
         uint8_t UHS_NI setEpInfoEntry(uint8_t addr, uint8_t iface, uint8_t epcount, volatile UHS_EpInfo* eprecord_ptr);
212
         uint8_t UHS_NI setEpInfoEntry(uint8_t addr, uint8_t iface, uint8_t epcount, volatile UHS_EpInfo* eprecord_ptr);
213
 
213
 
261
         uint8_t TestInterface(ENUMERATION_INFO *ei);
261
         uint8_t TestInterface(ENUMERATION_INFO *ei);
262
         uint8_t enumerateInterface(ENUMERATION_INFO *ei);
262
         uint8_t enumerateInterface(ENUMERATION_INFO *ei);
263
         uint8_t getNextInterface(ENUMERATION_INFO *ei, UHS_EpInfo *pep, uint8_t data[], uint16_t *left, uint16_t *read, uint8_t *offset);
263
         uint8_t getNextInterface(ENUMERATION_INFO *ei, UHS_EpInfo *pep, uint8_t data[], uint16_t *left, uint16_t *read, uint8_t *offset);
264
-        uint8_t initDescrStream(ENUMERATION_INFO *ei, USB_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset);
264
+        uint8_t initDescrStream(ENUMERATION_INFO *ei, USB_FD_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset);
265
         uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
265
         uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
266
         uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
266
         uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
267
         uint8_t doSoftReset(uint8_t parent, uint8_t port, uint8_t address);
267
         uint8_t doSoftReset(uint8_t parent, uint8_t port, uint8_t address);

Loading…
Cancel
Save