summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasterPhi <[email protected]>2021-06-24 21:35:06 +0200
committerMasterPhi <[email protected]>2021-06-24 21:35:06 +0200
commit64f53c304c8d671c3a9b9bb4f8c0aa69cd6914f3 (patch)
treeab64d7f3c50e6788b93ff90ca7bb95c64d1acb70
parent30fff56aa4b3e75dd14b95cf21484e7342088997 (diff)
parentb9e9773d04419032d9e8eb8ca568390f74382690 (diff)
Merge branch 'local' of https://github.com/HiFiPhile/tinyusb into dcd_same70
-rw-r--r--src/class/cdc/cdc_device.c14
-rw-r--r--src/class/cdc/cdc_device.h18
-rw-r--r--src/device/usbd.h4
3 files changed, 34 insertions, 2 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..f8a2216c1 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 3857295d7..0a0f0bf00 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 */\