summaryrefslogtreecommitdiff
path: root/examples/device/cdc_msc/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-06 17:35:17 +0700
committerhathach <[email protected]>2022-06-06 17:35:17 +0700
commitf4c80dd218240d934a28cb21d8ddd6a0e3a33fe5 (patch)
treefce3fbae54c687058cf06731a93cd7eb0e48b04f /examples/device/cdc_msc/src
parent1b086729452c67e3e78a736506732ca013959572 (diff)
clean up example to use CFG_TUD_ENABLED + CFG_TUD_MAX_SPEED instead of CFG_TUSB_RHPORT0_MODE
Diffstat (limited to 'examples/device/cdc_msc/src')
-rw-r--r--examples/device/cdc_msc/src/tusb_config.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/examples/device/cdc_msc/src/tusb_config.h b/examples/device/cdc_msc/src/tusb_config.h
index 363da88d7..03e0e649c 100644
--- a/examples/device/cdc_msc/src/tusb_config.h
+++ b/examples/device/cdc_msc/src/tusb_config.h
@@ -30,42 +30,43 @@
extern "C" {
#endif
+//--------------------------------------------------------------------+
+// Board Specific Configuration
+//--------------------------------------------------------------------+
+
+// RHPort number used for device can be defined by board.mk, default to port 0
+#ifndef BOARD_TUD_RHPORT
+#define BOARD_TUD_RHPORT 0
+#endif
+
+// RHPort max operational speed can defined by board.mk
+#ifndef BOARD_TUD_MAX_SPEED
+#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED
+#endif
+
//--------------------------------------------------------------------
-// COMMON CONFIGURATION
+// Common Configuration
//--------------------------------------------------------------------
-// defined by board.mk
+// defined by compiler flags for flexibility
#ifndef CFG_TUSB_MCU
- #error CFG_TUSB_MCU must be defined
+#error CFG_TUSB_MCU must be defined
#endif
-// This example doesn't use an RTOS
#ifndef CFG_TUSB_OS
- #define CFG_TUSB_OS OPT_OS_NONE
+#define CFG_TUSB_OS OPT_OS_NONE
#endif
-// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
#ifndef CFG_TUSB_DEBUG
- #define CFG_TUSB_DEBUG 0
+#define CFG_TUSB_DEBUG 0
#endif
// Enable Device stack
#define CFG_TUD_ENABLED 1
-// RHPort number used for device can be defined by board.mk, default to port 0
-#ifndef BOARD_TUD_RHPORT
- #define BOARD_TUD_RHPORT 0
-#endif
-
-// RHPort max operational speed can defined by board.mk
-#ifndef BOARD_TUD_MAX_SPEED
- #define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED
-#endif
-
// Default is max speed that hardware controller could support with on-chip PHY
#define CFG_TUD_MAX_SPEED BOARD_TUD_MAX_SPEED
-
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
* into those specific section.
@@ -78,7 +79,7 @@
#endif
#ifndef CFG_TUSB_MEM_ALIGN
-#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
+#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
#endif
//--------------------------------------------------------------------