summaryrefslogtreecommitdiff
path: root/examples/host/hid_controller
diff options
context:
space:
mode:
authorMengsk <[email protected]>2022-11-07 12:47:41 +0100
committerMengsk <[email protected]>2022-11-07 12:47:41 +0100
commit9d3d8fd5b0788b811ad283d10d37dfd1b1005224 (patch)
treef66b39fe968cc1a6e46e3074bbda9b907064bc15 /examples/host/hid_controller
parent1eae139aa94130a63ecc4725852cb69c02566c82 (diff)
parente434a1dc0584e841da1ae4ff525bbe81a0f5514b (diff)
Merge branch 'master' of https://github.com/hathach/tinyusb into bsp_412
Diffstat (limited to 'examples/host/hid_controller')
-rw-r--r--examples/host/hid_controller/.only.MCU_LPC175X_6X0
-rw-r--r--examples/host/hid_controller/.only.MCU_LPC177X_8X0
-rw-r--r--examples/host/hid_controller/.only.MCU_LPC18XX0
-rw-r--r--examples/host/hid_controller/.only.MCU_LPC40XX0
-rw-r--r--examples/host/hid_controller/.only.MCU_LPC43XX0
-rw-r--r--examples/host/hid_controller/.only.MCU_MIMXRT10XX0
-rw-r--r--examples/host/hid_controller/.only.MCU_RP20400
-rw-r--r--examples/host/hid_controller/CMakeLists.txt5
-rw-r--r--examples/host/hid_controller/Makefile5
-rw-r--r--examples/host/hid_controller/only.txt11
-rw-r--r--examples/host/hid_controller/src/hid_app.c2
-rw-r--r--examples/host/hid_controller/src/main.c5
-rw-r--r--examples/host/hid_controller/src/tusb_config.h33
13 files changed, 45 insertions, 16 deletions
diff --git a/examples/host/hid_controller/.only.MCU_LPC175X_6X b/examples/host/hid_controller/.only.MCU_LPC175X_6X
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_LPC175X_6X
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_LPC177X_8X b/examples/host/hid_controller/.only.MCU_LPC177X_8X
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_LPC177X_8X
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_LPC18XX b/examples/host/hid_controller/.only.MCU_LPC18XX
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_LPC18XX
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_LPC40XX b/examples/host/hid_controller/.only.MCU_LPC40XX
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_LPC40XX
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_LPC43XX b/examples/host/hid_controller/.only.MCU_LPC43XX
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_LPC43XX
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_MIMXRT10XX b/examples/host/hid_controller/.only.MCU_MIMXRT10XX
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_MIMXRT10XX
+++ /dev/null
diff --git a/examples/host/hid_controller/.only.MCU_RP2040 b/examples/host/hid_controller/.only.MCU_RP2040
deleted file mode 100644
index e69de29bb..000000000
--- a/examples/host/hid_controller/.only.MCU_RP2040
+++ /dev/null
diff --git a/examples/host/hid_controller/CMakeLists.txt b/examples/host/hid_controller/CMakeLists.txt
index aaf8bc34f..6153d399a 100644
--- a/examples/host/hid_controller/CMakeLists.txt
+++ b/examples/host/hid_controller/CMakeLists.txt
@@ -25,4 +25,7 @@ target_include_directories(${PROJECT} PUBLIC
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
-family_configure_host_example(${PROJECT}) \ No newline at end of file
+family_configure_host_example(${PROJECT})
+
+# For rp2040, un-comment to enable pico-pio-usb
+# family_add_pico_pio_usb(${PROJECT})
diff --git a/examples/host/hid_controller/Makefile b/examples/host/hid_controller/Makefile
index 2595ec4a7..06dc56914 100644
--- a/examples/host/hid_controller/Makefile
+++ b/examples/host/hid_controller/Makefile
@@ -9,7 +9,7 @@ INC += \
EXAMPLE_SOURCE += \
src/hid_app.c \
src/main.c
-
+
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
# TODO: suppress warning caused by host stack
@@ -22,10 +22,7 @@ SRC_C += \
src/class/msc/msc_host.c \
src/host/hub.c \
src/host/usbh.c \
- src/host/usbh_control.c \
- src/portable/ehci/ehci.c \
src/portable/ohci/ohci.c \
- src/portable/nxp/transdimension/hcd_transdimension.c \
src/portable/nxp/lpc17_40/hcd_lpc17_40.c
include ../../rules.mk
diff --git a/examples/host/hid_controller/only.txt b/examples/host/hid_controller/only.txt
new file mode 100644
index 000000000..fa9c14857
--- /dev/null
+++ b/examples/host/hid_controller/only.txt
@@ -0,0 +1,11 @@
+mcu:LPC175X_6X
+mcu:LPC177X_8X
+mcu:LPC18XX
+mcu:LPC40XX
+mcu:LPC43XX
+mcu:MIMXRT
+mcu:MIMXRT10XX
+mcu:MIMXRT11XX
+mcu:RP2040
+mcu:MSP432E4
+mcu:RX65X
diff --git a/examples/host/hid_controller/src/hid_app.c b/examples/host/hid_controller/src/hid_app.c
index bbfea8182..582e01959 100644
--- a/examples/host/hid_controller/src/hid_app.c
+++ b/examples/host/hid_controller/src/hid_app.c
@@ -138,6 +138,8 @@ void hid_app_task(void)
// therefore report_desc = NULL, desc_len = 0
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len)
{
+ (void)desc_report;
+ (void)desc_len;
uint16_t vid, pid;
tuh_vid_pid_get(dev_addr, &vid, &pid);
diff --git a/examples/host/hid_controller/src/main.c b/examples/host/hid_controller/src/main.c
index b9b37a4d2..299a3ff10 100644
--- a/examples/host/hid_controller/src/main.c
+++ b/examples/host/hid_controller/src/main.c
@@ -49,9 +49,10 @@ int main(void)
board_init();
printf("TinyUSB Host HID Controller Example\r\n");
- printf("Note: Events only displayed for explictly supported controllers\r\n");
+ printf("Note: Events only displayed for explicit supported controllers\r\n");
- tusb_init();
+ // init host stack on configured roothub port
+ tuh_init(BOARD_TUH_RHPORT);
while (1)
{
diff --git a/examples/host/hid_controller/src/tusb_config.h b/examples/host/hid_controller/src/tusb_config.h
index 74b471ae4..475b9ca8f 100644
--- a/examples/host/hid_controller/src/tusb_config.h
+++ b/examples/host/hid_controller/src/tusb_config.h
@@ -30,27 +30,42 @@
extern "C" {
#endif
+//--------------------------------------------------------------------+
+// Board Specific Configuration
+//--------------------------------------------------------------------+
+
+// RHPort number used for host can be defined by board.mk, default to port 0
+#ifndef BOARD_TUH_RHPORT
+#define BOARD_TUH_RHPORT 0
+#endif
+
+// RHPort max operational speed can defined by board.mk
+#ifndef BOARD_TUH_MAX_SPEED
+#define BOARD_TUH_MAX_SPEED OPT_MODE_DEFAULT_SPEED
+#endif
+
//--------------------------------------------------------------------
// COMMON CONFIGURATION
//--------------------------------------------------------------------
// defined by compiler flags for flexibility
#ifndef CFG_TUSB_MCU
- #error CFG_TUSB_MCU must be defined
+#error CFG_TUSB_MCU must be defined
#endif
-#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)
-#else
- #define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
+#ifndef CFG_TUSB_OS
+#define CFG_TUSB_OS OPT_OS_NONE
#endif
-#ifndef CFG_TUSB_OS
-#define CFG_TUSB_OS OPT_OS_NONE
+#ifndef CFG_TUSB_DEBUG
+#define CFG_TUSB_DEBUG 0
#endif
-// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
-// #define CFG_TUSB_DEBUG 0
+// Enable Host stack
+#define CFG_TUH_ENABLED 1
+
+// Default is max speed that hardware controller could support with on-chip PHY
+#define CFG_TUH_MAX_SPEED BOARD_TUH_MAX_SPEED
/* 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