hathach 3 năm trước cách đây
mục cha
commit
ae5490e5a5

+ 2 - 4
examples/device/hid_boot_interface/src/tusb_config.h

@@ -40,10 +40,8 @@
 #endif
 #endif
 
 
 // Use raspberry pio-usb for device
 // Use raspberry pio-usb for device
-#define CFG_TUD_RPI_PIO_USB            1
-#if CFG_TUD_RPI_PIO_USB
-#define BOARD_DEVICE_RHPORT_NUM 1
-#endif
+// #define CFG_TUD_RPI_PIO_USB     1
+// #define BOARD_DEVICE_RHPORT_NUM 1
 
 
 // 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

+ 3 - 4
examples/host/cdc_msc_hid/src/tusb_config.h

@@ -40,13 +40,12 @@
 #endif
 #endif
 
 
 // Use raspberry pio-usb for host
 // Use raspberry pio-usb for host
-#define CFG_TUH_RPI_PIO_USB            1
-//#define CFG_TUSB_RPI_PIO_INC_PATH   1
-
+// #define CFG_TUH_RPI_PIO_USB            1
+// #define CFG_TUH_RPI_PIO_USB            1
 
 
 #if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
 #if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
   #define CFG_TUSB_RHPORT0_MODE       (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED)
   #define CFG_TUSB_RHPORT0_MODE       (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED)
-#elif CFG_TUH_RPI_PIO_USB
+#elif defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB
   // rp2040: port0 is native, port 1 for PIO-USB
   // rp2040: port0 is native, port 1 for PIO-USB
   #define CFG_TUSB_RHPORT1_MODE       OPT_MODE_HOST
   #define CFG_TUSB_RHPORT1_MODE       OPT_MODE_HOST
 #else
 #else

+ 3 - 3
src/common/tusb_debug.h

@@ -57,7 +57,7 @@ void tu_print_mem(void const *buf, uint32_t count, uint8_t indent);
   #define tu_printf    printf
   #define tu_printf    printf
 #endif
 #endif
 
 
-static inline void tu_print_var(uint8_t const* buf, uint32_t bufsize)
+static inline void tu_print_arr(uint8_t const* buf, uint32_t bufsize)
 {
 {
   for(uint32_t i=0; i<bufsize; i++) tu_printf("%02X ", buf[i]);
   for(uint32_t i=0; i<bufsize; i++) tu_printf("%02X ", buf[i]);
 }
 }
@@ -75,8 +75,8 @@ static inline void tu_print_var(uint8_t const* buf, uint32_t bufsize)
 // Log Level 1: Error
 // Log Level 1: Error
 #define TU_LOG1               tu_printf
 #define TU_LOG1               tu_printf
 #define TU_LOG1_MEM           tu_print_mem
 #define TU_LOG1_MEM           tu_print_mem
-#define TU_LOG1_ARR(_x, _n)   tu_print_var((uint8_t const*)(_x), _n)
-#define TU_LOG1_VAR(_x)       tu_print_var((uint8_t const*)(_x), sizeof(*(_x)))
+#define TU_LOG1_ARR(_x, _n)   tu_print_arr((uint8_t const*)(_x), _n)
+#define TU_LOG1_VAR(_x)       tu_print_arr((uint8_t const*)(_x), sizeof(*(_x)))
 #define TU_LOG1_INT(_x)       tu_printf(#_x " = %ld\r\n", (unsigned long) (_x) )
 #define TU_LOG1_INT(_x)       tu_printf(#_x " = %ld\r\n", (unsigned long) (_x) )
 #define TU_LOG1_HEX(_x)       tu_printf(#_x " = %lX\r\n", (unsigned long) (_x) )
 #define TU_LOG1_HEX(_x)       tu_printf(#_x " = %lX\r\n", (unsigned long) (_x) )
 
 

+ 1 - 1
src/device/usbd.c

@@ -265,7 +265,7 @@ static inline usbd_class_driver_t const * get_driver(uint8_t drvid)
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 
 
 enum { RHPORT_INVALID = 0xFFu };
 enum { RHPORT_INVALID = 0xFFu };
-static volatile uint8_t _usbd_rhport = RHPORT_INVALID;
+static uint8_t _usbd_rhport = RHPORT_INVALID;
 
 
 // Event queue
 // Event queue
 // usbd_int_set() is used as mutex in OS NONE config
 // usbd_int_set() is used as mutex in OS NONE config

+ 3 - 3
src/host/usbh.c

@@ -410,7 +410,7 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr)
       case HCD_EVENT_DEVICE_ATTACH:
       case HCD_EVENT_DEVICE_ATTACH:
         // TODO due to the shared _usbh_ctrl_buf, we must complete enumerating
         // TODO due to the shared _usbh_ctrl_buf, we must complete enumerating
         // one device before enumerating another one.
         // one device before enumerating another one.
-        TU_LOG2("[rh%d] USBH DEVICE ATTACH\r\n", event.rhport);
+        TU_LOG2("[%u:] USBH DEVICE ATTACH\r\n", event.rhport);
         enum_new_device(&event);
         enum_new_device(&event);
       break;
       break;
 
 
@@ -799,7 +799,7 @@ bool usbh_edpt_xfer_with_callback(uint8_t dev_addr, uint8_t ep_addr, uint8_t * b
 
 
 static bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_size)
 static bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_size)
 {
 {
-  TU_LOG2("[%u] Open EP0 with Size = %u\r\n", dev_addr, max_packet_size);
+  TU_LOG2("[%u:%u] Open EP0 with Size = %u\r\n", usbh_get_rhport(dev_addr), dev_addr, max_packet_size);
 
 
   tusb_desc_endpoint_t ep0_desc =
   tusb_desc_endpoint_t ep0_desc =
   {
   {
@@ -1279,7 +1279,7 @@ static void process_enumeration(tuh_xfer_t* xfer)
       if (_dev0.hub_addr == 0)
       if (_dev0.hub_addr == 0)
       {
       {
         // connected directly to roothub
         // connected directly to roothub
-#if !CFG_TUH_RPI_PIO_USB // skip this reset for pio-usb
+#if !CFG_TUH_RPI_PIO_USB // FIXME skip this reset for pio-usb
         hcd_port_reset( _dev0.rhport );
         hcd_port_reset( _dev0.rhport );
         osal_task_delay(RESET_DELAY);
         osal_task_delay(RESET_DELAY);
         hcd_port_reset_end(_dev0.rhport);
         hcd_port_reset_end(_dev0.rhport);

+ 0 - 1
src/portable/raspberrypi/pio_usb/dcd_pio_usb.c

@@ -29,7 +29,6 @@
 #if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RP2040) && CFG_TUD_RPI_PIO_USB
 #if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RP2040) && CFG_TUD_RPI_PIO_USB
 
 
 #include "pico.h"
 #include "pico.h"
-#include "hardware/pio.h"
 #include "pio_usb.h"
 #include "pio_usb.h"
 #include "pio_usb_ll.h"
 #include "pio_usb_ll.h"
 
 

+ 0 - 1
src/portable/raspberrypi/pio_usb/hcd_pio_usb.c

@@ -29,7 +29,6 @@
 #if CFG_TUH_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RP2040) && CFG_TUH_RPI_PIO_USB
 #if CFG_TUH_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RP2040) && CFG_TUH_RPI_PIO_USB
 
 
 #include "pico.h"
 #include "pico.h"
-#include "hardware/pio.h"
 #include "pio_usb.h"
 #include "pio_usb.h"
 #include "pio_usb_ll.h"
 #include "pio_usb_ll.h"