diff options
| author | Jerzy Kasenberg <[email protected]> | 2020-09-21 15:45:17 +0200 |
|---|---|---|
| committer | Jerzy Kasenberg <[email protected]> | 2020-10-01 09:22:55 +0200 |
| commit | fceb8853c7e125d74fc4e13ca6ea6934248dbd21 (patch) | |
| tree | 0f7e1fc8ee18690fa9ee11d5f10c90097532e117 /src | |
| parent | b2ce7a39b0d0b941ad7edb63f527b223568caa47 (diff) | |
nrf5x: Add dcd_edpt_close
Closing endpoints can be important when there are alternate
instances. This adds functionality of closing endpoints
similar to what exists in other drivers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/nordic/nrf5x/dcd_nrf5x.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c index 60da9fb25..f8190062b 100644 --- a/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -310,6 +310,27 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) return true; } +void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) +{ + (void) rhport; + + uint8_t const epnum = tu_edpt_number(ep_addr); + uint8_t const dir = tu_edpt_dir(ep_addr); + + // CBI + if (dir == TUSB_DIR_OUT) + { + NRF_USBD->INTENCLR = TU_BIT(USBD_INTEN_ENDEPOUT0_Pos + epnum); + NRF_USBD->EPOUTEN &= ~TU_BIT(epnum); + } + else + { + NRF_USBD->INTENCLR = TU_BIT(USBD_INTEN_ENDEPIN0_Pos + epnum); + NRF_USBD->EPINEN &= ~TU_BIT(epnum); + } + __ISB(); __DSB(); +} + bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) { (void) rhport; |
