@@ -68,10 +68,10 @@ const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00, 0x00, 0x00, 64, USB
6868volatile uint32_t _usbConfiguration = 0 ;
6969volatile uint32_t _usbSetInterface = 0 ;
7070
71- static __attribute__ ((__aligned__(8 ))) // __attribute__((__section__(".bss_hram0")))
71+ static __attribute__ ((__aligned__(4 ))) // __attribute__((__section__(".bss_hram0")))
7272uint8_t udd_ep_out_cache_buffer[4][64];
7373
74- static __attribute__ ((__aligned__(8 ))) // __attribute__((__section__(".bss_hram0")))
74+ static __attribute__ ((__aligned__(4 ))) // __attribute__((__section__(".bss_hram0")))
7575uint8_t udd_ep_in_cache_buffer[4][64];
7676
7777// ==================================================================
@@ -502,17 +502,19 @@ uint32_t USBDeviceClass::recv(uint32_t ep, void *_data, uint32_t len)
502502 // NAK on endpoint OUT, the bank is full.
503503 // usbd.epBank0SetReady(CDC_ENDPOINT_OUT);
504504
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+ // }
510512
511513 // release empty buffer
512514 if (len && !available (ep)) {
513515 // The RAM Buffer is empty: we can receive data
514516 usbd.epBank0ResetReady (ep);
515-
517+
516518 // Clear Transfer complete 0 flag
517519 usbd.epBank0AckTransferComplete (ep);
518520 }
@@ -553,9 +555,9 @@ uint8_t USBDeviceClass::armRecvCtrlOUT(uint32_t ep, uint32_t len)
553555
554556uint8_t USBDeviceClass::armRecv (uint32_t ep, uint32_t len)
555557{
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"?
559561 uint16_t count = usbd.epBank0ByteCount (ep);
560562 if (count >= 64 ) {
561563 usbd.epBank0SetByteCount (ep, count - 64 );
0 commit comments