diff options
| author | hathach <[email protected]> | 2018-12-17 12:14:11 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-17 12:14:11 +0700 |
| commit | 902697ca079a179221da92f8cb9f873768a5d0d7 (patch) | |
| tree | 8bc9238d3aa66b4b02139a9e24005e1ce4c3630a /src/portable | |
| parent | 455da57f9d66a342383334f3af82c27b57feb6cd (diff) | |
add dcd_get_microframe()
Diffstat (limited to 'src/portable')
| -rw-r--r-- | src/portable/microchip/samd21/dcd_samd21.c | 6 | ||||
| -rw-r--r-- | src/portable/microchip/samd51/dcd_samd51.c | 6 | ||||
| -rw-r--r-- | src/portable/nordic/nrf5x/dcd_nrf5x.c | 11 | ||||
| -rw-r--r-- | src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c | 7 | ||||
| -rw-r--r-- | src/portable/nxp/lpc17_40/dcd_lpc17_40.c | 6 | ||||
| -rw-r--r-- | src/portable/nxp/lpc18_43/dcd_lpc18_43.c | 28 |
6 files changed, 52 insertions, 12 deletions
diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c index af0721ec3..0865f2bda 100644 --- a/src/portable/microchip/samd21/dcd_samd21.c +++ b/src/portable/microchip/samd21/dcd_samd21.c @@ -124,6 +124,12 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) // Nothing to do } +uint32_t dcd_get_microframe(uint8_t rhport) +{ + (void) rhport; + return USB->DEVICE.FNUM & (TU_BIT(14) - 1); +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c index ce66b8245..fc3d31dea 100644 --- a/src/portable/microchip/samd51/dcd_samd51.c +++ b/src/portable/microchip/samd51/dcd_samd51.c @@ -129,6 +129,12 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) // Nothing to do } +uint32_t dcd_get_microframe(uint8_t rhport) +{ + (void) rhport; + return USB->DEVICE.FNUM & (TU_BIT(14) - 1); +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c index 7d13ef8c3..1e0c34743 100644 --- a/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -187,7 +187,7 @@ static void xact_in_prepare(uint8_t epnum) } //--------------------------------------------------------------------+ -// Tinyusb DCD API +// Controller API //--------------------------------------------------------------------+ bool dcd_init (uint8_t rhport) { @@ -221,6 +221,15 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) // Nothing to do } +uint32_t dcd_get_microframe(uint8_t rhport) +{ + (void) rhport; + return NRF_USBD->FRAMECNTR << 3; +} + +//--------------------------------------------------------------------+ +// Endpoint API +//--------------------------------------------------------------------+ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt) { (void) rhport; diff --git a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c index 26ecaf8be..23522b940 100644 --- a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c +++ b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c @@ -165,6 +165,13 @@ void dcd_set_address(uint8_t rhport, uint8_t dev_addr) LPC_USB->DEVCMDSTAT |= dev_addr; } +uint32_t dcd_get_microframe(uint8_t rhport) +{ + (void) rhport; + + return (LPC_USB->INFO & (TU_BIT(11) - 1)) << 3; +} + bool dcd_init(uint8_t rhport) { (void) rhport; diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c index fca2c355d..7406d1770 100644 --- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c +++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c @@ -227,6 +227,12 @@ void dcd_set_config(uint8_t rhport, uint8_t config_num) sie_write(SIE_CMDCODE_CONFIGURE_DEVICE, 1, 1); } +uint32_t dcd_get_microframe(uint8_t rhport) +{ + (void) rhport; + return ((uint32_t) sie_read(SIE_CMDCODE_READ_FRAME_NUMBER)) << 3; +} + //--------------------------------------------------------------------+ // CONTROL HELPER //--------------------------------------------------------------------+ diff --git a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c index 7761d547f..796c8c4bb 100644 --- a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c +++ b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c @@ -92,17 +92,6 @@ static dcd_data_t* const dcd_data_ptr[2] = //--------------------------------------------------------------------+ // CONTROLLER API //--------------------------------------------------------------------+ -void dcd_set_address(uint8_t rhport, uint8_t dev_addr) -{ - LPC_USB[rhport]->DEVICEADDR = (dev_addr << 25) | TU_BIT(24); -} - -void dcd_set_config(uint8_t rhport, uint8_t config_num) -{ - (void) rhport; - (void) config_num; - // nothing to do -} /// follows LPC43xx User Manual 23.10.3 static void bus_reset(uint8_t rhport) @@ -173,6 +162,23 @@ void dcd_int_disable(uint8_t rhport) NVIC_DisableIRQ(rhport ? USB1_IRQn : USB0_IRQn); } +void dcd_set_address(uint8_t rhport, uint8_t dev_addr) +{ + LPC_USB[rhport]->DEVICEADDR = (dev_addr << 25) | TU_BIT(24); +} + +void dcd_set_config(uint8_t rhport, uint8_t config_num) +{ + (void) rhport; + (void) config_num; + // nothing to do +} + +uint32_t dcd_get_microframe(uint8_t rhport) +{ + return LPC_USB[rhport]->FRINDEX_D; +} + //--------------------------------------------------------------------+ // HELPER //--------------------------------------------------------------------+ |
