@@ -68,10 +68,10 @@ const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB
68
68
volatile uint32_t _usbConfiguration = 0 ;
69
69
volatile uint32_t _usbSetInterface = 0 ;
70
70
71
- static __attribute__ ((__aligned__(8 ))) // __attribute__((__section__(".bss_hram0")))
71
+ static __attribute__ ((__aligned__(4 ))) // __attribute__((__section__(".bss_hram0")))
72
72
uint8_t udd_ep_out_cache_buffer[4][64];
73
73
74
- static __attribute__ ((__aligned__(8 ))) // __attribute__((__section__(".bss_hram0")))
74
+ static __attribute__ ((__aligned__(4 ))) // __attribute__((__section__(".bss_hram0")))
75
75
uint8_t udd_ep_in_cache_buffer[4][64];
76
76
77
77
// ==================================================================
@@ -502,17 +502,19 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len)
502
502
// NAK on endpoint OUT, the bank is full.
503
503
// usbd.epBank0SetReady(CDC_ENDPOINT_OUT);
504
504
505
- uint8_t *buffer = udd_ep_out_cache_buffer[ep];
506
- uint8_t *data = reinterpret_cast <uint8_t *>(_data);
507
- for (uint32_t i=0 ; i<len; i++) {
508
- data[i] = buffer[i];
509
- }
505
+ memcpy (_data, udd_ep_out_cache_buffer[ep], len);
506
+
507
+ // uint8_t *buffer = udd_ep_out_cache_buffer[ep];
508
+ // uint8_t *data = reinterpret_cast<uint8_t *>(_data);
509
+ // for (uint32_t i=0; i<len; i++) {
510
+ // data[i] = buffer[i];
511
+ // }
510
512
511
513
// release empty buffer
512
514
if (len && !available (ep)) {
513
515
// The RAM Buffer is empty: we can receive data
514
516
usbd.epBank0ResetReady (ep);
515
-
517
+
516
518
// Clear Transfer complete 0 flag
517
519
usbd.epBank0AckTransferComplete (ep);
518
520
}
@@ -553,9 +555,9 @@ uint8_t USBDeviceClass::armRecvCtrlOUT(uint32_t ep, uint32_t len)
553
555
554
556
uint8_t USBDeviceClass::armRecv (uint32_t ep, uint32_t len)
555
557
{
556
- usbd.epBank0SetSize (ep, 64 );
557
- usbd.epBank0SetAddress (ep, &udd_ep_out_cache_buffer[ep]);
558
- usbd.epBank0SetMultiPacketSize (ep, 64 ); // XXX: Should be "len"?
558
+ // usbd.epBank0SetSize(ep, 64);
559
+ // usbd.epBank0SetAddress(ep, &udd_ep_out_cache_buffer[ep]);
560
+ // usbd.epBank0SetMultiPacketSize(ep, 64); // XXX: Should be "len"?
559
561
uint16_t count = usbd.epBank0ByteCount (ep);
560
562
if (count >= 64 ) {
561
563
usbd.epBank0SetByteCount (ep, count - 64 );
0 commit comments