Просмотр исходного кода

redirect tinyusb debug to rt_kprintf

tfx2001 4 лет назад
Родитель
Сommit
b867a1337c
2 измененных файлов с 9 добавлено и 5 удалено
  1. 2 2
      rt-thread/tinyusb_port.c
  2. 7 3
      rt-thread/tusb_config.h

+ 2 - 2
rt-thread/tinyusb_port.c

@@ -56,7 +56,7 @@ static int init_tinyusb(void) {
     tid = rt_thread_create("tusb", tusb_thread_entry, RT_NULL,
     tid = rt_thread_create("tusb", tusb_thread_entry, RT_NULL,
                            PKG_TINYUSB_STACK_SIZE, 4, 10);
                            PKG_TINYUSB_STACK_SIZE, 4, 10);
     if (tid == RT_NULL) {
     if (tid == RT_NULL) {
-        LOG_E("Fail to create a USB stack thread");
+        LOG_E("Fail to create TinyUSB thread");
         return -1;
         return -1;
     }
     }
 #else
 #else
@@ -66,7 +66,7 @@ static int init_tinyusb(void) {
     result = rt_thread_init(tid, "tusb", tusb_thread_entry, RT_NULL,
     result = rt_thread_init(tid, "tusb", tusb_thread_entry, RT_NULL,
                             tusb_stack, sizeof(tusb_stack), 4, 10);
                             tusb_stack, sizeof(tusb_stack), 4, 10);
     if (tid != RT_EOK) {
     if (tid != RT_EOK) {
-        LOG_E("Fail to create a USB stack thread");
+        LOG_E("Fail to create TinyUSB thread");
         return -1;
         return -1;
     }
     }
 #endif
 #endif

+ 7 - 3
rt-thread/tusb_config.h

@@ -52,6 +52,13 @@ extern "C" {
 
 
 #define CFG_TUSB_OS OPT_OS_RTTHREAD
 #define CFG_TUSB_OS OPT_OS_RTTHREAD
 
 
+//--------------------------------------------------------------------
+// DEBUG CONFIGURATION
+//--------------------------------------------------------------------
+#ifdef CFG_TUSB_DEBUG
+#define CFG_TUSB_DEBUG_PRINTF rt_kprintf
+#endif /* CFG_TUSB_DEBUG */
+
 // RHPort number used for device can be defined by board.mk, default to port 0
 // RHPort number used for device can be defined by board.mk, default to port 0
 #ifndef BOARD_DEVICE_RHPORT_NUM
 #ifndef BOARD_DEVICE_RHPORT_NUM
 #define BOARD_DEVICE_RHPORT_NUM     0
 #define BOARD_DEVICE_RHPORT_NUM     0
@@ -77,9 +84,6 @@ extern "C" {
   #error "Incorrect RHPort configuration"
   #error "Incorrect RHPort configuration"
 #endif
 #endif
 
 
-// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
-// #define CFG_TUSB_DEBUG           0
-
 /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
 /* 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
  * Tinyusb use follows macros to declare transferring memory so that they can be put
  * into those specific section.
  * into those specific section.