Merge pull request #245 from hathach/develop
fix samd51 setup packet handling
This commit is contained in:
commit
b8cef16b58
|
@ -2,7 +2,7 @@
|
|||
|
||||
![tinyUSB_240x100](https://user-images.githubusercontent.com/249515/62646655-f9393200-b978-11e9-9c53-484862f15503.png)
|
||||
|
||||
[![Build Status](https://travis-ci.org/hathach/tinyusb.svg?branch=master)](https://travis-ci.org/hathach/tinyusb) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)[![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb)
|
||||
[![Build Status](https://travis-ci.org/hathach/tinyusb.svg?branch=master)](https://travis-ci.org/hathach/tinyusb) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb)
|
||||
|
||||
TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function.
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ static bool maybe_handle_setup_packet(void) {
|
|||
USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP;
|
||||
|
||||
// This copies the data elsewhere so we can reuse the buffer.
|
||||
dcd_event_setup_received(0, (uint8_t*) sram_registers[0][0].ADDR.reg, true);
|
||||
dcd_event_setup_received(0, _setup_packet, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
/*------------------------------------------------------------------*/
|
||||
/* MACRO TYPEDEF CONSTANT ENUM
|
||||
*------------------------------------------------------------------*/
|
||||
static UsbDeviceDescBank sram_registers[8][2];
|
||||
static TU_ATTR_ALIGNED(4) UsbDeviceDescBank sram_registers[8][2];
|
||||
static TU_ATTR_ALIGNED(4) uint8_t _setup_packet[8];
|
||||
|
||||
// Setup the control endpoint 0.
|
||||
|
@ -81,7 +81,7 @@ void dcd_init (uint8_t rhport)
|
|||
while (USB->DEVICE.SYNCBUSY.bit.ENABLE == 1) {}
|
||||
|
||||
USB->DEVICE.INTFLAG.reg |= USB->DEVICE.INTFLAG.reg; // clear pending
|
||||
USB->DEVICE.INTENSET.reg = USB_DEVICE_INTENSET_SOF | USB_DEVICE_INTENSET_EORST;
|
||||
USB->DEVICE.INTENSET.reg = /* USB_DEVICE_INTENSET_SOF | */ USB_DEVICE_INTENSET_EORST;
|
||||
}
|
||||
|
||||
void dcd_int_enable(uint8_t rhport)
|
||||
|
@ -257,7 +257,8 @@ static bool maybe_handle_setup_packet(void) {
|
|||
USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP;
|
||||
|
||||
// This copies the data elsewhere so we can reuse the buffer.
|
||||
dcd_event_setup_received(0, (uint8_t*) sram_registers[0][0].ADDR.reg, true);
|
||||
dcd_event_setup_received(0, _setup_packet, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -336,11 +337,7 @@ void transfer_complete(uint8_t direction) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (direction == TUSB_DIR_OUT && maybe_handle_setup_packet()) {
|
||||
continue;
|
||||
}
|
||||
UsbDeviceEndpoint* ep = &USB->DEVICE.DeviceEndpoint[epnum];
|
||||
|
||||
UsbDeviceDescBank* bank = &sram_registers[epnum][direction];
|
||||
uint16_t total_transfer_size = bank->PCKSIZE.bit.BYTE_COUNT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue