diff options
| author | Mengsk <[email protected]> | 2021-06-24 11:34:29 +0200 |
|---|---|---|
| committer | Mengsk <[email protected]> | 2021-06-24 11:34:29 +0200 |
| commit | 9d6fd78b632db5b40e84e4c019f00286aae5d1ad (patch) | |
| tree | 90d7febbd800424418ded7007609b7814063c256 /src | |
| parent | b34724215bea28ef93fd80ed9c2e4ddc87874093 (diff) | |
Add fifo helper function to CDC class for DMA transfer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/cdc/cdc_device.c | 14 | ||||
| -rw-r--r-- | src/class/cdc/cdc_device.h | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index cac811c45..a926081cc 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -483,4 +483,18 @@ bool cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_ return true; } +// Get the Receive FIFO (for DMA transfer) +tu_fifo_t* tud_cdc_n_get_rx_ff (uint8_t itf) +{ + TU_ASSERT(itf < CFG_TUD_CDC); + return &_cdcd_itf[itf].rx_ff; +} + +// Get the transmit FIFO (for DMA transfer) +tu_fifo_t* tud_cdc_n_get_tx_ff (uint8_t itf) +{ + TU_ASSERT(itf < CFG_TUD_CDC); + return &_cdcd_itf[itf].tx_ff; +} + #endif diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h index 7ff757add..94678a660 100644 --- a/src/class/cdc/cdc_device.h +++ b/src/class/cdc/cdc_device.h @@ -104,6 +104,12 @@ uint32_t tud_cdc_n_write_available (uint8_t itf); // Clear the transmit FIFO bool tud_cdc_n_write_clear (uint8_t itf); +// Get the Receive FIFO (for DMA transfer) +tu_fifo_t* tud_cdc_n_get_rx_ff (uint8_t itf); + +// Get the transmit FIFO (for DMA transfer) +tu_fifo_t* tud_cdc_n_get_tx_ff (uint8_t itf); + //--------------------------------------------------------------------+ // Application API (Single Port) //--------------------------------------------------------------------+ @@ -241,6 +247,18 @@ static inline bool tud_cdc_write_clear(void) return tud_cdc_n_write_clear(0); } +// Get the Receive FIFO +static inline tu_fifo_t* tud_cdc_get_rx_ff (uint8_t itf) +{ + return tud_cdc_n_get_rx_ff(0); +} + +// Get the transmit FIFO +static inline tu_fifo_t* tud_cdc_get_tx_ff (uint8_t itf) +{ + return tud_cdc_n_get_tx_ff(0); +} + /** @} */ /** @} */ |
