summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-21 12:58:28 +0700
committerhathach <[email protected]>2025-11-21 12:58:28 +0700
commitd4cdc096caa9c662f77f5633a792335f74fdad97 (patch)
tree1a0a53871738c45d47822d778e94057bac47731d /src
parent30198b2ab9e69c120e5b49c063dad3d2d3889d79 (diff)
add more unit tests for tu_fifo
Diffstat (limited to 'src')
-rw-r--r--src/common/tusb_fifo.c6
-rw-r--r--src/common/tusb_mcu.h9
-rw-r--r--src/tusb_option.h26
3 files changed, 20 insertions, 21 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index a3e89bbc2..ef2344801 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -85,7 +85,7 @@ bool tu_fifo_config(tu_fifo_t *f, void *buffer, uint16_t depth, uint16_t item_si
// Pull & Push
//--------------------------------------------------------------------+
-#ifdef TUP_MEM_CONST_ADDR
+#ifdef CFG_TUSB_FIFO_ACCESS_FIXED_ADDR_RW32
// Intended to be used to read from hardware USB FIFO in e.g. STM32 where all data is read from a constant address
// Code adapted from dcd_synopsys.c
// TODO generalize with configurable 1 byte or 4 byte each read
@@ -164,7 +164,7 @@ static void _ff_push_n(tu_fifo_t *f, const void *app_buf, uint16_t n, uint16_t w
}
break;
-#ifdef TUP_MEM_CONST_ADDR
+#ifdef CFG_TUSB_FIFO_ACCESS_FIXED_ADDR_RW32
case TU_FIFO_FIXED_ADDR_RW32:
// Intended for hardware buffers from which it can be read word by word only
if (n <= lin_count) {
@@ -244,7 +244,7 @@ static void _ff_pull_n(tu_fifo_t *f, void *app_buf, uint16_t n, uint16_t rd_ptr,
}
break;
-#ifdef TUP_MEM_CONST_ADDR
+#ifdef CFG_TUSB_FIFO_ACCESS_FIXED_ADDR_RW32
case TU_FIFO_FIXED_ADDR_RW32:
if (n <= lin_count) {
// Linear only
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h
index 002cd3a0e..34977378c 100644
--- a/src/common/tusb_mcu.h
+++ b/src/common/tusb_mcu.h
@@ -24,8 +24,7 @@
* This file is part of the TinyUSB stack.
*/
-#ifndef TUSB_MCU_H_
-#define TUSB_MCU_H_
+#pragma once
//--------------------------------------------------------------------+
// Port/Platform Specific
@@ -697,9 +696,3 @@
#ifndef TUP_DCD_EDPT_CLOSE_API
#define TUP_DCD_EDPT_ISO_ALLOC
#endif
-
-#if defined(TUP_USBIP_DWC2) // && CFG_TUD_DWC2_DMA_ENABLE == 0
- #define TUP_MEM_CONST_ADDR
-#endif
-
-#endif
diff --git a/src/tusb_option.h b/src/tusb_option.h
index dd5f17dfc..e2eaecd2d 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -24,8 +24,7 @@
* This file is part of the TinyUSB stack.
*/
-#ifndef TUSB_OPTION_H_
-#define TUSB_OPTION_H_
+#pragma once
#include "common/tusb_compiler.h"
@@ -305,15 +304,26 @@
#define CFG_TUH_DWC2_DMA_ENABLE CFG_TUH_DWC2_DMA_ENABLE_DEFAULT
#endif
-#if defined(TUP_USBIP_DWC2) && CFG_TUD_DWC2_SLAVE_ENABLE == 1
-#define TUP_DCD_EDPT_DEDICATED_FIFO
+#if defined(TUP_USBIP_DWC2)
+ #if CFG_TUD_DWC2_SLAVE_ENABLE
+ #define CFG_TUD_EDPT_DEDICATED_FIFO
+ #endif
+
+ #if CFG_TUD_DWC2_SLAVE_ENABLE
+ #define CFG_TUH_EDPT_DEDICATED_FIFO
+ #endif
+#endif
+
+#if defined(CFG_TUD_EDPT_DEDICATED_FIFO) || defined(CFG_TUH_EDPT_DEDICATED_FIFO)
+ #define CFG_TUSB_FIFO_ACCESS_FIXED_ADDR_RW32
#endif
//------------- ChipIdea -------------//
-// Enable CI_HS VBUS Charge. Set this to 1 if the USB_VBUS pin is not connected to 5V VBUS (note: 3.3V is insufficient).
+// Enable CI_HS VBUS Charge. Set this to 1 if the USB_VBUS pin is not connected to 5V VBUS (note: 3.3V is
+// insufficient).
#ifndef CFG_TUD_CI_HS_VBUS_CHARGE
#ifndef CFG_TUD_CI_HS_VBUS_CHARGE_DEFAULT
- #define CFG_TUD_CI_HS_VBUS_CHARGE_DEFAULT 0
+ #define CFG_TUD_CI_HS_VBUS_CHARGE_DEFAULT 0
#endif
#define CFG_TUD_CI_HS_VBUS_CHARGE CFG_TUD_CI_HS_VBUS_CHARGE_DEFAULT
@@ -738,7 +748,3 @@
// To avoid GCC compiler warnings when -pedantic option is used (strict ISO C)
typedef int make_iso_compilers_happy;
-
-#endif /* TUSB_OPTION_H_ */
-
-/** @} */