diff options
| -rw-r--r-- | examples/device/nrf52840/src/tusb_config.h | 4 | ||||
| -rw-r--r-- | examples/obsolete/device/src/tusb_config.h | 4 | ||||
| -rw-r--r-- | src/class/cdc/cdc_device.c | 11 | ||||
| -rw-r--r-- | src/common/tusb_fifo.c | 5 | ||||
| -rw-r--r-- | src/device/usbd.c | 14 |
5 files changed, 22 insertions, 16 deletions
diff --git a/examples/device/nrf52840/src/tusb_config.h b/examples/device/nrf52840/src/tusb_config.h index 476ff4bed..aee6099b5 100644 --- a/examples/device/nrf52840/src/tusb_config.h +++ b/examples/device/nrf52840/src/tusb_config.h @@ -72,7 +72,9 @@ *------------------------------------------------------------------*/ // FIFO size of CDC TX and RX -#define CFG_TUD_CDC_BUFSIZE 64 +#define CFG_TUD_CDC_RX_BUFSIZE 64 +#define CFG_TUD_CDC_TX_BUFSIZE 64 + // TX is sent automatically every Start of Frame event. // If not enabled, application must call tud_cdc_flush() periodically diff --git a/examples/obsolete/device/src/tusb_config.h b/examples/obsolete/device/src/tusb_config.h index bdadb2110..3904facbe 100644 --- a/examples/obsolete/device/src/tusb_config.h +++ b/examples/obsolete/device/src/tusb_config.h @@ -77,7 +77,9 @@ *------------------------------------------------------------------*/ // FIFO size of CDC TX and RX -#define CFG_TUD_CDC_BUFSIZE 128 +#define CFG_TUD_CDC_RX_BUFSIZE 128 +#define CFG_TUD_CDC_TX_BUFSIZE 128 + // TX is sent automatically in Start of Frame event. // If not enabled, application must call tud_cdc_flush() periodically diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index ccb15205b..583180fcc 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -67,17 +67,12 @@ typedef struct { // TODO multiple rhport
-#if CFG_TUSB_MCU == OPT_MCU_NRF5X
-// FIXME nrf52 OUT: Controller ACK data even we didn't prepare transfer
-CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_rx_buf[600];
-#else
-CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_rx_buf[64];
-#endif
+CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_rx_buf[64];
CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_tx_buf[64];
-FIFO_DEF(_rx_ff, CFG_TUD_CDC_BUFSIZE, uint8_t, true);
-FIFO_DEF(_tx_ff, CFG_TUD_CDC_BUFSIZE, uint8_t, false);
+FIFO_DEF(_rx_ff, CFG_TUD_CDC_RX_BUFSIZE, uint8_t, true);
+FIFO_DEF(_tx_ff, CFG_TUD_CDC_TX_BUFSIZE, uint8_t, false);
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index b4bb70b87..d6f34f33f 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -37,6 +37,7 @@ /**************************************************************************/
#include "tusb_fifo.h"
+#include "common/tusb_verify.h" // for ASSERT
/*------------------------------------------------------------------*/
/*
@@ -207,7 +208,9 @@ bool fifo_peek_at(fifo_t* f, uint16_t position, void * p_buffer) bool fifo_write(fifo_t* f, void const * p_data)
{
if ( !fifo_initalized(f) ) return false;
- if ( fifo_full(f) && !f->overwritable ) return false;
+
+// if ( fifo_full(f) && !f->overwritable ) return false;
+ TU_ASSERT( !(fifo_full(f) && !f->overwritable) );
mutex_lock_if_needed(f);
diff --git a/src/device/usbd.c b/src/device/usbd.c index 0f6cebc6c..a58196583 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -46,10 +46,12 @@ #include "usbd.h"
#include "device/usbd_pvt.h"
-#define USBD_TASK_QUEUE_DEPTH 16
+#ifndef CFG_TUD_TASK_QUEUE_SZ
+#define CFG_TUD_TASK_QUEUE_SZ 16
+#endif
-#ifndef CFG_TUD_TASK_STACKSIZE
-#define CFG_TUD_TASK_STACKSIZE 150
+#ifndef CFG_TUD_TASK_STACK_SZ
+#define CFG_TUD_TASK_STACK_SZ 150
#endif
#ifndef CFG_TUD_TASK_PRIO
@@ -190,10 +192,10 @@ typedef struct ATTR_ALIGNED(4) VERIFY_STATIC(sizeof(usbd_task_event_t) <= 12, "size is not correct");
-OSAL_TASK_DEF(_usbd_task_def, "usbd", usbd_task, CFG_TUD_TASK_PRIO, CFG_TUD_TASK_STACKSIZE);
+OSAL_TASK_DEF(_usbd_task_def, "usbd", usbd_task, CFG_TUD_TASK_PRIO, CFG_TUD_TASK_STACK_SZ);
/*------------- event queue -------------*/
-OSAL_QUEUE_DEF(_usbd_qdef, USBD_TASK_QUEUE_DEPTH, usbd_task_event_t);
+OSAL_QUEUE_DEF(_usbd_qdef, CFG_TUD_TASK_QUEUE_SZ, usbd_task_event_t);
static osal_queue_t _usbd_q;
/*------------- control transfer semaphore -------------*/
@@ -547,12 +549,14 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event) case USBD_BUS_EVENT_SOF:
{
+ #if CFG_TUD_CDC_FLUSH_ON_SOF
usbd_task_event_t task_event =
{
.rhport = rhport,
.event_id = USBD_EVT_SOF,
};
osal_queue_send_isr(_usbd_q, &task_event);
+ #endif
}
break;
|
