summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-04-27 20:52:56 +0700
committerhathach <[email protected]>2022-04-27 20:52:56 +0700
commitae5490e5a5cd8650a45578b4ac70dbe89b002fb1 (patch)
treee8aa3de0a30163bff20ae5d4079270ed00e5e3fc
parent4a661dead0899cb154325a8257d19281f2536af3 (diff)
clean up
-rw-r--r--examples/device/hid_boot_interface/src/tusb_config.h6
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h7
-rw-r--r--src/common/tusb_debug.h6
-rw-r--r--src/device/usbd.c2
-rw-r--r--src/host/usbh.c6
-rw-r--r--src/portable/raspberrypi/pio_usb/dcd_pio_usb.c1
-rw-r--r--src/portable/raspberrypi/pio_usb/hcd_pio_usb.c1
7 files changed, 12 insertions, 17 deletions
diff --git a/examples/device/hid_boot_interface/src/tusb_config.h b/examples/device/hid_boot_interface/src/tusb_config.h
index c8bb8a807..8bc85b722 100644
--- a/examples/device/hid_boot_interface/src/tusb_config.h
+++ b/examples/device/hid_boot_interface/src/tusb_config.h
@@ -40,10 +40,8 @@
#endif
// 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
#ifndef BOARD_DEVICE_RHPORT_NUM
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index 9d083c771..e9e68cf5a 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -40,13 +40,12 @@
#endif
// 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
#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
#define CFG_TUSB_RHPORT1_MODE OPT_MODE_HOST
#else
diff --git a/src/common/tusb_debug.h b/src/common/tusb_debug.h
index 1ea2c19f5..ac5bee6ec 100644
--- a/src/common/tusb_debug.h
+++ b/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
#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]);
}
@@ -75,8 +75,8 @@ static inline void tu_print_var(uint8_t const* buf, uint32_t bufsize)
// Log Level 1: Error
#define TU_LOG1 tu_printf
#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_HEX(_x) tu_printf(#_x " = %lX\r\n", (unsigned long) (_x) )
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 4c2cd3abd..e545e8056 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -265,7 +265,7 @@ static inline usbd_class_driver_t const * get_driver(uint8_t drvid)
//--------------------------------------------------------------------+
enum { RHPORT_INVALID = 0xFFu };
-static volatile uint8_t _usbd_rhport = RHPORT_INVALID;
+static uint8_t _usbd_rhport = RHPORT_INVALID;
// Event queue
// usbd_int_set() is used as mutex in OS NONE config
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 4df60626a..a0d9d83d3 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -410,7 +410,7 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr)
case HCD_EVENT_DEVICE_ATTACH:
// TODO due to the shared _usbh_ctrl_buf, we must complete enumerating
// 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);
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)
{
- 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 =
{
@@ -1279,7 +1279,7 @@ static void process_enumeration(tuh_xfer_t* xfer)
if (_dev0.hub_addr == 0)
{
// 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 );
osal_task_delay(RESET_DELAY);
hcd_port_reset_end(_dev0.rhport);
diff --git a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
index 3daa39a8b..fb10087b5 100644
--- a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
+++ b/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
#include "pico.h"
-#include "hardware/pio.h"
#include "pio_usb.h"
#include "pio_usb_ll.h"
diff --git a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
index f6caabb54..3c7378561 100644
--- a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
+++ b/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
#include "pico.h"
-#include "hardware/pio.h"
#include "pio_usb.h"
#include "pio_usb_ll.h"