diff options
| author | hathach <[email protected]> | 2025-11-03 10:46:09 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-11-03 10:46:09 +0700 |
| commit | bda7efb1b3d482b7add2535a4a72f51a0dea5c08 (patch) | |
| tree | 6fe059dfa614e1b4b567906dda830adc4ab34e15 | |
| parent | a6c16d147593732028ed89292805e0e6a972e4b5 (diff) | |
fix #2942, include stdio if CFG_TUSB_DEBUG > 0 and CFG_TUSB_DEBUG_PRINTF is not defined
| -rw-r--r-- | examples/host/cdc_msc_hid/src/app.h | 2 | ||||
| -rw-r--r-- | examples/host/cdc_msc_hid/src/hid_app.c | 1 | ||||
| -rw-r--r-- | examples/host/cdc_msc_hid/src/msc_app.c | 1 | ||||
| -rw-r--r-- | examples/host/cdc_msc_hid_freertos/src/app.h | 2 | ||||
| -rw-r--r-- | examples/host/cdc_msc_hid_freertos/src/msc_app.c | 2 | ||||
| -rw-r--r-- | examples/host/hid_controller/src/app.h | 2 | ||||
| -rw-r--r-- | examples/host/msc_file_explorer/src/main.c | 1 | ||||
| -rw-r--r-- | examples/host/msc_file_explorer/src/msc_app.h | 1 | ||||
| -rw-r--r-- | src/class/net/ncm_device.c | 4 | ||||
| -rw-r--r-- | src/common/tusb_common.h | 9 | ||||
| -rw-r--r-- | src/common/tusb_debug.h | 1 | ||||
| -rw-r--r-- | src/common/tusb_types.h | 6 | ||||
| -rw-r--r-- | src/common/tusb_verify.h | 4 |
13 files changed, 20 insertions, 16 deletions
diff --git a/examples/host/cdc_msc_hid/src/app.h b/examples/host/cdc_msc_hid/src/app.h index bf15c7bea..49783b4ae 100644 --- a/examples/host/cdc_msc_hid/src/app.h +++ b/examples/host/cdc_msc_hid/src/app.h @@ -26,6 +26,8 @@ #ifndef TUSB_TINYUSB_EXAMPLES_APP_H #define TUSB_TINYUSB_EXAMPLES_APP_H +#include <stdio.h> + void cdc_app_task(void); void hid_app_task(void); diff --git a/examples/host/cdc_msc_hid/src/hid_app.c b/examples/host/cdc_msc_hid/src/hid_app.c index f6a83aeed..eb20356cb 100644 --- a/examples/host/cdc_msc_hid/src/hid_app.c +++ b/examples/host/cdc_msc_hid/src/hid_app.c @@ -22,7 +22,6 @@ * THE SOFTWARE. * */ - #include "bsp/board_api.h" #include "tusb.h" #include "app.h" diff --git a/examples/host/cdc_msc_hid/src/msc_app.c b/examples/host/cdc_msc_hid/src/msc_app.c index 0e9c99766..dd4e22d7f 100644 --- a/examples/host/cdc_msc_hid/src/msc_app.c +++ b/examples/host/cdc_msc_hid/src/msc_app.c @@ -23,6 +23,7 @@ * */ +#include <stdio.h> #include "tusb.h" //--------------------------------------------------------------------+ diff --git a/examples/host/cdc_msc_hid_freertos/src/app.h b/examples/host/cdc_msc_hid_freertos/src/app.h index 960f7e8cc..8892a1b6b 100644 --- a/examples/host/cdc_msc_hid_freertos/src/app.h +++ b/examples/host/cdc_msc_hid_freertos/src/app.h @@ -26,6 +26,8 @@ #ifndef TUSB_TINYUSB_EXAMPLES_APP_H #define TUSB_TINYUSB_EXAMPLES_APP_H +#include <stdio.h> + void cdc_app_init(void); void hid_app_init(void); void msc_app_init(void); diff --git a/examples/host/cdc_msc_hid_freertos/src/msc_app.c b/examples/host/cdc_msc_hid_freertos/src/msc_app.c index a6e3ed4ee..fa864c364 100644 --- a/examples/host/cdc_msc_hid_freertos/src/msc_app.c +++ b/examples/host/cdc_msc_hid_freertos/src/msc_app.c @@ -23,6 +23,8 @@ * */ +#include <stdio.h> + #include "tusb.h" #include "app.h" diff --git a/examples/host/hid_controller/src/app.h b/examples/host/hid_controller/src/app.h index 1f9015cd2..b4d072668 100644 --- a/examples/host/hid_controller/src/app.h +++ b/examples/host/hid_controller/src/app.h @@ -26,6 +26,8 @@ #ifndef TUSB_TINYUSB_EXAMPLES_APP_H #define TUSB_TINYUSB_EXAMPLES_APP_H +#include <stdio.h> + void hid_app_task(void); #endif diff --git a/examples/host/msc_file_explorer/src/main.c b/examples/host/msc_file_explorer/src/main.c index 506c3b015..f9ec0ff5f 100644 --- a/examples/host/msc_file_explorer/src/main.c +++ b/examples/host/msc_file_explorer/src/main.c @@ -56,7 +56,6 @@ */ #include <stdlib.h> -#include <stdio.h> #include <string.h> #include "bsp/board_api.h" diff --git a/examples/host/msc_file_explorer/src/msc_app.h b/examples/host/msc_file_explorer/src/msc_app.h index 3ba03d0dc..a99da5b5c 100644 --- a/examples/host/msc_file_explorer/src/msc_app.h +++ b/examples/host/msc_file_explorer/src/msc_app.h @@ -27,6 +27,7 @@ #define MSC_APP_H #include <stdbool.h> +#include <stdio.h> bool msc_app_init(void); void msc_app_task(void); diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c index 02833c5f1..ea3c250fe 100644 --- a/src/class/net/ncm_device.c +++ b/src/class/net/ncm_device.c @@ -50,10 +50,6 @@ #if (CFG_TUD_ENABLED && CFG_TUD_NCM) -#include <stdbool.h> -#include <stdint.h> -#include <stdio.h> - #include "device/usbd.h" #include "device/usbd_pvt.h" diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index 6aa7e0bfc..6d7adc3a1 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -77,7 +77,6 @@ #include <inttypes.h> #include <stddef.h> #include <string.h> -#include <stdio.h> // Tinyusb Common Headers #include "tusb_option.h" @@ -126,7 +125,7 @@ TU_ATTR_ALWAYS_INLINE static inline int tu_memset_s(void *dest, size_t destsz, i return -1; } - memset(dest, ch, count); + (void) memset(dest, ch, count); return 0; } @@ -146,7 +145,7 @@ TU_ATTR_ALWAYS_INLINE static inline int tu_memcpy_s(void *dest, size_t destsz, c return -1; } - memcpy(dest, src, count); + (void) memcpy(dest, src, count); return 0; } @@ -231,7 +230,9 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_round_up(uint32_t v, uint32_t f) // TODO use clz TODO remove TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_log2(uint32_t value) { uint8_t result = 0; - while (value >>= 1) { result++; } + while ((value >>= 1) != 0) { + result++; + } return result; } diff --git a/src/common/tusb_debug.h b/src/common/tusb_debug.h index e3f9d3f18..df4034098 100644 --- a/src/common/tusb_debug.h +++ b/src/common/tusb_debug.h @@ -55,6 +55,7 @@ void tu_print_mem(void const *buf, uint32_t count, uint8_t indent); extern int CFG_TUSB_DEBUG_PRINTF(const char *format, ...); #define tu_printf CFG_TUSB_DEBUG_PRINTF #else + #include <stdio.h> #define tu_printf printf #endif diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h index 55f309af8..4f2b66e6a 100644 --- a/src/common/tusb_types.h +++ b/src/common/tusb_types.h @@ -252,8 +252,8 @@ typedef enum { } device_capability_type_t; enum { - TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = 1u << 5, - TUSB_DESC_CONFIG_ATT_SELF_POWERED = 1u << 6, + TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = 1 << 5, + TUSB_DESC_CONFIG_ATT_SELF_POWERED = 1 << 6, }; #define TUSB_DESC_CONFIG_POWER_MA(x) ((x)/2) @@ -311,7 +311,7 @@ enum { }; enum { - TUSB_INDEX_INVALID_8 = 0xFFu + TUSB_INDEX_INVALID_8 = 0xFF }; //--------------------------------------------------------------------+ diff --git a/src/common/tusb_verify.h b/src/common/tusb_verify.h index db91a73d9..9dc73aa60 100644 --- a/src/common/tusb_verify.h +++ b/src/common/tusb_verify.h @@ -67,10 +67,8 @@ //--------------------------------------------------------------------+ // TU_VERIFY Helper //--------------------------------------------------------------------+ - #if CFG_TUSB_DEBUG - #include <stdio.h> - #define TU_MESS_FAILED() tu_printf("%s %d: ASSERT FAILED\r\n", __func__, __LINE__) + #define TU_MESS_FAILED() TU_LOG1("%s %d: ASSERT FAILED\r\n", __func__, __LINE__) #else #define TU_MESS_FAILED() do {} while (0) #endif |
