summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-04-26 14:51:44 +0700
committerhathach <[email protected]>2020-04-26 14:51:44 +0700
commit017c95037f3173455fa09efae6093d56fd3f3d1a (patch)
tree37e5eb03f99c95ca9ebdb69c0bf6c8b263342492 /src/common
parentf1ecda392ffcc0c114269c3b6c318a2d0a50e2f5 (diff)
add usbd edpt open
- RTT mode is blocking to prevent log lost - Improve logging message
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_common.h12
-rw-r--r--src/common/tusb_verify.h6
2 files changed, 13 insertions, 5 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h
index 2d80f8210..fcb22cde1 100644
--- a/src/common/tusb_common.h
+++ b/src/common/tusb_common.h
@@ -219,17 +219,25 @@ void tu_print_mem(void const *buf, uint16_t count, uint8_t indent);
#define tu_printf printf
#endif
+static inline
+void tu_print_var(uint8_t const* buf, uint32_t bufsize)
+{
+ for(uint32_t i=0; i<bufsize; i++) tu_printf("%02X ", buf[i]);
+}
+
// Log with debug level 1
#define TU_LOG1 tu_printf
#define TU_LOG1_MEM tu_print_mem
+#define TU_LOG1_VAR(_x) tu_print_var((uint8_t const*)(_x), sizeof(*(_x)))
+#define TU_LOG1_INT(_x) tu_printf(#_x " = %ld\n", (uint32_t) (_x) )
+#define TU_LOG1_HEX(_x) tu_printf(#_x " = %lX\n", (uint32_t) (_x) )
#define TU_LOG1_LOCATION() tu_printf("%s: %d:\r\n", __PRETTY_FUNCTION__, __LINE__)
-#define TU_LOG1_INT(x) tu_printf(#x " = %ld\n", (uint32_t) (x) )
-#define TU_LOG1_HEX(x) tu_printf(#x " = %lX\n", (uint32_t) (x) )
// Log with debug level 2
#if CFG_TUSB_DEBUG > 1
#define TU_LOG2 TU_LOG1
#define TU_LOG2_MEM TU_LOG1_MEM
+ #define TU_LOG2_VAR TU_LOG1_VAR
#define TU_LOG2_LOCATION() TU_LOG1_LOCATION()
#define TU_LOG2_INT TU_LOG1_INT
#define TU_LOG2_HEX TU_LOG1_HEX
diff --git a/src/common/tusb_verify.h b/src/common/tusb_verify.h
index fee291df6..406f5e6ee 100644
--- a/src/common/tusb_verify.h
+++ b/src/common/tusb_verify.h
@@ -90,13 +90,13 @@
volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); /* Cortex M CoreDebug->DHCSR */ \
if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); /* Only halt mcu if debugger is attached */ \
} while(0)
-#else
-#if defined(__riscv)
+
+#elif defined(__riscv)
#define TU_BREAKPOINT() do { __asm("ebreak\n"); } while(0)
+
#else
#define TU_BREAKPOINT() do {} while (0)
#endif
-#endif
/*------------------------------------------------------------------*/
/* Macro Generator