diff options
| author | hathach <[email protected]> | 2018-11-21 17:03:39 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-11-21 17:03:39 +0700 |
| commit | 1d6fc49fa974903ca14af6454671ea816fb2d6dd (patch) | |
| tree | 01215f73adf306790355968519e513b2cb33b4a6 /src | |
| parent | 3cad1d11341bb70612ce94559bd93c21bc43b498 (diff) | |
clean up
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/microchip/samd21/dcd_samd21.c | 14 | ||||
| -rw-r--r-- | src/portable/microchip/samd51/dcd_samd51.c | 14 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c index 0102685d2..b31db547d 100644 --- a/src/portable/microchip/samd21/dcd_samd21.c +++ b/src/portable/microchip/samd21/dcd_samd21.c @@ -41,21 +41,11 @@ #if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMD21 #include "device/dcd.h" - -#include "device/usbd.h" -#include "device/usbd_pvt.h" // to use defer function helper - #include "sam.h" /*------------------------------------------------------------------*/ /* MACRO TYPEDEF CONSTANT ENUM *------------------------------------------------------------------*/ -enum -{ - // Max allowed by USB specs - MAX_PACKET_SIZE = 64, -}; - static ATTR_ALIGNED(4) UsbDeviceDescBank sram_registers[8][2]; static ATTR_ALIGNED(4) uint8_t _setup_packet[8]; @@ -134,6 +124,10 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) } size_value++; } + + // unsupported endpoint size + if ( size_value == 7 && desc_edpt->wMaxPacketSize.size != 1023 ) return false; + bank->PCKSIZE.bit.SIZE = size_value; UsbDeviceEndpoint* ep = &USB->DEVICE.DeviceEndpoint[epnum]; diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c index 023a706ea..6fff12ba7 100644 --- a/src/portable/microchip/samd51/dcd_samd51.c +++ b/src/portable/microchip/samd51/dcd_samd51.c @@ -41,21 +41,11 @@ #if TUSB_OPT_DEVICE_ENABLED && CFG_TUSB_MCU == OPT_MCU_SAMD51 #include "device/dcd.h" - -#include "device/usbd.h" -#include "device/usbd_pvt.h" // to use defer function helper - #include "sam.h" /*------------------------------------------------------------------*/ /* MACRO TYPEDEF CONSTANT ENUM *------------------------------------------------------------------*/ -enum -{ - // Max allowed by USB specs - MAX_PACKET_SIZE = 64, -}; - static UsbDeviceDescBank sram_registers[8][2]; static ATTR_ALIGNED(4) uint8_t _setup_packet[8]; @@ -134,6 +124,10 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) } size_value++; } + + // unsupported endpoint size + if ( size_value == 7 && desc_edpt->wMaxPacketSize.size != 1023 ) return false; + bank->PCKSIZE.bit.SIZE = size_value; UsbDeviceEndpoint* ep = &USB->DEVICE.DeviceEndpoint[epnum]; |
