mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-11 09:40:06 +00:00
proof of concpet that device pio-usb work with host pio-usb
This commit is contained in:
parent
d97c154695
commit
d5d4909c20
@ -31,6 +31,8 @@
|
|||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "usb_descriptors.h"
|
#include "usb_descriptors.h"
|
||||||
|
|
||||||
|
#include "pio_usb.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF PROTYPES
|
// MACRO CONSTANT TYPEDEF PROTYPES
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -59,6 +61,8 @@ int main(void)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
pio_usb_device_task();
|
||||||
|
|
||||||
tud_task(); // tinyusb device task
|
tud_task(); // tinyusb device task
|
||||||
led_blinking_task();
|
led_blinking_task();
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#error CFG_TUSB_MCU must be defined
|
#error CFG_TUSB_MCU must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Use raspberry pio-usb for device
|
||||||
|
#define CFG_TUD_RPI_PIO_USB 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
|
||||||
#define BOARD_DEVICE_RHPORT_NUM 0
|
#define BOARD_DEVICE_RHPORT_NUM 0
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#error CFG_TUSB_MCU must be defined
|
#error CFG_TUSB_MCU must be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Use raspberry pio-usb for host
|
||||||
#define CFG_TUH_RPI_PIO_USB 1
|
#define CFG_TUH_RPI_PIO_USB 1
|
||||||
//#define CFG_TUSB_RPI_PIO_INC_PATH 1
|
//#define CFG_TUSB_RPI_PIO_INC_PATH 1
|
||||||
|
|
||||||
|
@ -29,12 +29,17 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
target_sources(tinyusb_common_base INTERFACE
|
target_sources(tinyusb_common_base INTERFACE
|
||||||
${TOP}/src/tusb.c
|
${TOP}/src/tusb.c
|
||||||
${TOP}/src/common/tusb_fifo.c
|
${TOP}/src/common/tusb_fifo.c
|
||||||
|
${TOP}/lib/Pico-PIO-USB/pio_usb.c
|
||||||
|
${TOP}/lib/Pico-PIO-USB/pio_usb_host.c
|
||||||
|
${TOP}/lib/Pico-PIO-USB/pio_usb_hw.c
|
||||||
|
${TOP}/lib/Pico-PIO-USB/usb_crc.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(tinyusb_common_base INTERFACE
|
target_include_directories(tinyusb_common_base INTERFACE
|
||||||
${TOP}/src
|
${TOP}/src
|
||||||
${TOP}/src/common
|
${TOP}/src/common
|
||||||
${TOP}/hw
|
${TOP}/hw
|
||||||
|
${TOP}/lib/Pico-PIO-USB
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(tinyusb_common_base INTERFACE
|
target_link_libraries(tinyusb_common_base INTERFACE
|
||||||
@ -42,6 +47,10 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
hardware_irq
|
hardware_irq
|
||||||
hardware_resets
|
hardware_resets
|
||||||
pico_sync
|
pico_sync
|
||||||
|
# for usb-pio
|
||||||
|
hardware_dma
|
||||||
|
hardware_pio
|
||||||
|
pico_multicore
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TINYUSB_DEBUG_LEVEL 0)
|
set(TINYUSB_DEBUG_LEVEL 0)
|
||||||
@ -60,6 +69,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
add_library(tinyusb_device_base INTERFACE)
|
add_library(tinyusb_device_base INTERFACE)
|
||||||
target_sources(tinyusb_device_base INTERFACE
|
target_sources(tinyusb_device_base INTERFACE
|
||||||
${TOP}/src/portable/raspberrypi/rp2040/dcd_rp2040.c
|
${TOP}/src/portable/raspberrypi/rp2040/dcd_rp2040.c
|
||||||
|
${TOP}/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
|
||||||
${TOP}/src/portable/raspberrypi/rp2040/rp2040_usb.c
|
${TOP}/src/portable/raspberrypi/rp2040/rp2040_usb.c
|
||||||
${TOP}/src/device/usbd.c
|
${TOP}/src/device/usbd.c
|
||||||
${TOP}/src/device/usbd_control.c
|
${TOP}/src/device/usbd_control.c
|
||||||
@ -88,12 +98,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
${TOP}/src/class/hid/hid_host.c
|
${TOP}/src/class/hid/hid_host.c
|
||||||
${TOP}/src/class/msc/msc_host.c
|
${TOP}/src/class/msc/msc_host.c
|
||||||
${TOP}/src/class/vendor/vendor_host.c
|
${TOP}/src/class/vendor/vendor_host.c
|
||||||
|
|
||||||
${TOP}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
|
${TOP}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
|
||||||
${TOP}/lib/Pico-PIO-USB/pio_usb.c
|
|
||||||
${TOP}/lib/Pico-PIO-USB/pio_usb_host.c
|
|
||||||
${TOP}/lib/Pico-PIO-USB/pio_usb_hw.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
|
||||||
@ -101,17 +106,6 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
RP2040_USB_HOST_MODE=1
|
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)
|
add_library(tinyusb_bsp INTERFACE)
|
||||||
target_sources(tinyusb_bsp INTERFACE
|
target_sources(tinyusb_bsp INTERFACE
|
||||||
${TOP}/hw/bsp/rp2040/family.c
|
${TOP}/hw/bsp/rp2040/family.c
|
||||||
@ -166,8 +160,8 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
_family_initialize_project(${PROJECT} ${DIR})
|
_family_initialize_project(${PROJECT} ${DIR})
|
||||||
enable_language(C CXX ASM)
|
enable_language(C CXX ASM)
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
pico_generate_pio_header(tinyusb_host_base ${TOP}/lib/Pico-PIO-USB/usb_tx.pio)
|
pico_generate_pio_header(tinyusb_common_base ${TOP}/lib/Pico-PIO-USB/usb_tx.pio)
|
||||||
pico_generate_pio_header(tinyusb_host_base ${TOP}/lib/Pico-PIO-USB/usb_rx.pio)
|
pico_generate_pio_header(tinyusb_common_base ${TOP}/lib/Pico-PIO-USB/usb_rx.pio)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
|
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "tusb_option.h"
|
#include "tusb_option.h"
|
||||||
|
|
||||||
#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_RP2040
|
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_RP2040) && !CFG_TUD_RPI_PIO_USB
|
||||||
|
|
||||||
#include "pico.h"
|
#include "pico.h"
|
||||||
#include "rp2040_usb.h"
|
#include "rp2040_usb.h"
|
||||||
|
@ -398,6 +398,10 @@
|
|||||||
#define CFG_TUH_RPI_PIO_USB 0
|
#define CFG_TUH_RPI_PIO_USB 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CFG_TUD_RPI_PIO_USB
|
||||||
|
#define CFG_TUD_RPI_PIO_USB 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Configuration Validation
|
// Configuration Validation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user