diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index cac811c4..a926081c 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 7ff757ad..f8a2216c 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 (void) +{ + return tud_cdc_n_get_rx_ff(0); +} + +// Get the transmit FIFO +static inline tu_fifo_t* tud_cdc_get_tx_ff (void) +{ + return tud_cdc_n_get_tx_ff(0); +} + /** @} */ /** @} */ diff --git a/src/device/usbd.h b/src/device/usbd.h index 3857295d..0a0f0bf0 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -236,7 +236,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb // Interface number, string index, protocol, report descriptor len, EP In address, size & polling interval #define TUD_HID_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epin, _epsize, _ep_interval) \ /* Interface */\ - 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\ + 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? (uint8_t)HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\ /* HID descriptor */\ 9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\ /* Endpoint In */\ @@ -249,7 +249,7 @@ TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb // Interface number, string index, protocol, report descriptor len, EP OUT & IN address, size & polling interval #define TUD_HID_INOUT_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epout, _epin, _epsize, _ep_interval) \ /* Interface */\ - 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\ + 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? (uint8_t)HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\ /* HID descriptor */\ 9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\ /* Endpoint Out */\