start to add pio usb (host) support

run as proof of concept
This commit is contained in:
hathach
2022-03-01 23:55:53 +07:00
parent c9b0fbc907
commit 1d29817139
10 changed files with 300 additions and 13 deletions
+3
View File
@@ -127,6 +127,9 @@ void board_init(void)
#ifndef BUTTON_BOOTSEL
#endif
// Set the system clock to a multiple of 120mhz for bitbanging USB with pico-usb
set_sys_clock_khz(120000, true);
#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART)
bi_decl(bi_2pins_with_func(UART_TX_PIN, UART_TX_PIN, GPIO_FUNC_UART));
uart_inst = uart_get_instance(UART_DEV);
+18 -2
View File
@@ -89,13 +89,27 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
${TOP}/src/class/hid/hid_host.c
${TOP}/src/class/msc/msc_host.c
${TOP}/src/class/vendor/vendor_host.c
${TOP}/src/portable/raspberrypi/pio/hcd_pio.c
${TOP}/lib/Pico-PIO-USB/pio_usb.c
${TOP}/lib/Pico-PIO-USB/usb_crc.c
)
# Sometimes have to do host specific actions in mostly
# common functions
# Sometimes have to do host specific actions in mostly common functions
target_compile_definitions(tinyusb_host_base INTERFACE
RP2040_USB_HOST_MODE=1
)
# config for host pio
target_link_libraries(tinyusb_host_base INTERFACE
hardware_dma
hardware_pio
pico_multicore
)
target_include_directories(tinyusb_host_base INTERFACE
${TOP}/lib/Pico-PIO-USB
)
add_library(tinyusb_bsp INTERFACE)
target_sources(tinyusb_bsp INTERFACE
@@ -151,6 +165,8 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
_family_initialize_project(${PROJECT} ${DIR})
enable_language(C CXX ASM)
pico_sdk_init()
pico_generate_pio_header(tinyusb_host_base ${TOP}/lib/Pico-PIO-USB/usb_tx.pio)
pico_generate_pio_header(tinyusb_host_base ${TOP}/lib/Pico-PIO-USB/usb_rx.pio)
endfunction()
# This method must be called from the project scope to suppress known warnings in TinyUSB source files