diff options
| author | hathach <[email protected]> | 2019-03-30 14:47:11 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-30 14:47:11 +0700 |
| commit | b28cc6ddb11ef233b6e6ee25b4a305b4b76cc03c (patch) | |
| tree | de6623830676a997c9328f8996151537c30f5d6f /src/portable/microchip | |
| parent | cabf6abb4f49648ad6eb1f9cb54bfad131f457b7 (diff) | |
added dcd_remote_wakeup() stub for all ports
Diffstat (limited to 'src/portable/microchip')
| -rw-r--r-- | src/portable/microchip/samd21/dcd_samd21.c | 34 | ||||
| -rw-r--r-- | src/portable/microchip/samd51/dcd_samd51.c | 5 |
2 files changed, 36 insertions, 3 deletions
diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c index a340c888d..39d59486d 100644 --- a/src/portable/microchip/samd21/dcd_samd21.c +++ b/src/portable/microchip/samd21/dcd_samd21.c @@ -110,6 +110,18 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) (void) rhport; (void) config_num; // Nothing to do + +#if 0 + // Enable suspend to detect disconnection + // TODO need to distinguish Suspend vs Disconnect + USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTENCLR_SUSPEND; + USB->DEVICE.INTENSET.reg |= USB_DEVICE_INTENSET_SUSPEND; +#endif +} + +void dcd_remote_wakeup(uint8_t rhport) +{ + (void) rhport; } /*------------------------------------------------------------------*/ @@ -290,13 +302,14 @@ void maybe_transfer_complete(void) { } } -void USB_Handler(void) { - uint32_t int_status = USB->DEVICE.INTFLAG.reg; +void USB_Handler(void) +{ + uint32_t int_status = USB->DEVICE.INTFLAG.reg & USB->DEVICE.INTENSET.reg; /*------------- Interrupt Processing -------------*/ if ( int_status & USB_DEVICE_INTFLAG_EORST ) { - USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTENCLR_EORST; + USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_EORST; bus_reset(); dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true); } @@ -307,6 +320,21 @@ void USB_Handler(void) { dcd_event_bus_signal(0, DCD_EVENT_SOF, true); } +#if 0 + if ( int_status & USB_DEVICE_INTFLAG_SUSPEND ) + { + USB->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_SUSPEND; + + // disable interrupt to prevent it continue to trigger + USB->DEVICE.INTENCLR.reg = USB_DEVICE_INTENCLR_SUSPEND; + + // TODO need to distinguish Suspend vs Disconnect + // reset address to 0, force host to re-enumerate after resume + USB->DEVICE.DADD.reg = 0; + dcd_event_bus_signal(0, DCD_EVENT_UNPLUGGED, true); + } +#endif + // Setup packet received. maybe_handle_setup_packet(); diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c index 13250c38c..a1702b056 100644 --- a/src/portable/microchip/samd51/dcd_samd51.c +++ b/src/portable/microchip/samd51/dcd_samd51.c @@ -117,6 +117,11 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) // Nothing to do } +void dcd_remote_wakeup(uint8_t rhport) +{ + (void) rhport; +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ |
