Skip to content

Add Host support for ch32v20x usbfs #2793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions hw/bsp/ch32v20x/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ void USBHD_IRQHandler(void) {
#if CFG_TUD_WCH_USBIP_USBFS
tud_int_handler(0);
#endif
#if defined(CFG_TUH_WCH_USBIP_USBFS) && CFG_TUH_WCH_USBIP_USBFS
tuh_int_handler(0);
#endif
}

__attribute__((interrupt)) __attribute__((used))
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/ch32v20x/family.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function(add_board_target BOARD_TARGET)
if (PORT EQUAL 0)
target_compile_definitions(${BOARD_TARGET} PUBLIC
CFG_TUD_WCH_USBIP_FSDEV=1
CFG_TUH_WCH_USBIP_USBFS=1
)
elseif (PORT EQUAL 1)
target_compile_definitions(${BOARD_TARGET} PUBLIC
Expand Down Expand Up @@ -127,6 +128,7 @@ function(family_configure_example TARGET RTOS)

target_sources(${TARGET} PUBLIC
${TOP}/src/portable/wch/dcd_ch32_usbfs.c
${TOP}/src/portable/wch/hcd_ch32_usbfs.c
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
)
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
Expand Down
3 changes: 3 additions & 0 deletions hw/bsp/ch32v20x/family.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CFLAGS += -Wno-error=strict-prototypes
ifeq ($(PORT),0)
$(info "Using FSDEV driver")
CFLAGS += -DCFG_TUD_WCH_USBIP_FSDEV=1
$(info "Using USBFS Host driver")
CFLAGS += -DCFG_TUH_WCH_USBIP_USBFS=1
else
$(info "Using USBFS driver")
CFLAGS += -DCFG_TUD_WCH_USBIP_USBFS=1
Expand All @@ -43,6 +45,7 @@ LD_FILE = $(FAMILY_PATH)/linker/${CH32_FAMILY}.ld

SRC_C += \
src/portable/wch/dcd_ch32_usbfs.c \
src/portable/wch/hcd_ch32_usbfs.c \
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
$(SDK_SRC_DIR)/Core/core_riscv.c \
$(SDK_SRC_DIR)/Peripheral/src/${CH32_FAMILY}_gpio.c \
Expand Down
Loading
Loading