diff options
| author | hathach <[email protected]> | 2026-05-28 18:23:46 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2026-05-28 18:23:46 +0700 |
| commit | c5676382c7d5cad7b6cfe5dc185d9891b89241f2 (patch) | |
| tree | f9f155fd18f84b7aaf3ff76ff5339a38bbacd56a /src | |
| parent | c954c8c4c70df616e429d8e7ae1c382d3043acea (diff) | |
abstract OS logic with `CFG_TUSB_OS_HAS_SCHEDULER` to simplify conditional checks
Diffstat (limited to 'src')
| -rw-r--r-- | src/tusb_option.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tusb_option.h b/src/tusb_option.h index 74eb8cc06..dcf0646cf 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -535,6 +535,18 @@ #define CFG_TUSB_OS OPT_OS_NONE #endif +// 1 when CFG_TUSB_OS provides a preemptive scheduler with distinct tasks +// (FreeRTOS, Zephyr, ThreadX, etc.); 0 when the application is single-context +// (bare-metal OS_NONE or Pico SDK). Sync host control xfers from the host +// task are forbidden when this is 1. +#ifndef CFG_TUSB_OS_HAS_SCHEDULER + #if CFG_TUSB_OS == OPT_OS_NONE || CFG_TUSB_OS == OPT_OS_PICO + #define CFG_TUSB_OS_HAS_SCHEDULER 0 + #else + #define CFG_TUSB_OS_HAS_SCHEDULER 1 + #endif +#endif + #ifndef CFG_TUSB_OS_INC_PATH #ifndef CFG_TUSB_OS_INC_PATH_DEFAULT #define CFG_TUSB_OS_INC_PATH_DEFAULT |
