use correct wch usbhs, usbfs for ch32v307 using CFG_TUD_MAX_SPEED

This commit is contained in:
hathach
2024-05-20 17:26:04 +07:00
parent 4a5fee503b
commit b19295c1c1
9 changed files with 98 additions and 117 deletions

View File

@@ -2,9 +2,9 @@
#define _USB_CH32_USBHS_REG_H
#if (CFG_TUSB_MCU == OPT_MCU_CH32V307)
#include <ch32v30x.h>
#include <ch32v30x.h>
#elif (CFG_TUSB_MCU == OPT_MCU_CH32F20X)
#include <ch32f20x.h>
#include <ch32f20x.h>
#endif
/******************* GLOBAL ******************/

View File

@@ -1,6 +1,7 @@
#include "tusb_option.h"
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_CH32V20X || CFG_TUSB_MCU == OPT_MCU_CH32V307)
// Note: CH32 can have both USB FS and HS, only use this driver if CFG_TUD_MAX_SPEED is full speed
#if CFG_TUD_ENABLED && defined(TUP_USBIP_WCH_USBFS) && (CFG_TUD_MAX_SPEED == OPT_MODE_FULL_SPEED)
#include <stdio.h>
#include "device/dcd.h"

View File

@@ -26,11 +26,11 @@
#include "tusb_option.h"
#if CFG_TUD_ENABLED && ((CFG_TUSB_MCU == OPT_MCU_CH32V307) || (CFG_TUSB_MCU == OPT_MCU_CH32F20X))
#include "device/dcd.h"
// Note: CH32 can have both USB FS and HS, only use this driver if CFG_TUD_MAX_SPEED is high speed
#if CFG_TUD_ENABLED && defined(TUP_USBIP_WCH_USBHS) && (CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED)
#include "ch32_usbhs_reg.h"
#include "device/dcd.h"
// Max number of bi-directional endpoints including EP0
#define EP_MAX 16