update(port): remove CONFIG_USBDEV_EP_NUM & CONFIG_USBHOST_PIPE_NUM for some ips because they are constant

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-07-21 21:19:41 +08:00
parent 96ab19e398
commit ddda03c4cb
8 changed files with 18 additions and 14 deletions

View File

@@ -250,9 +250,10 @@
/* ================ USB Device Port Configuration ================*/ /* ================ USB Device Port Configuration ================*/
#ifndef CONFIG_USBDEV_MAX_BUS #ifndef CONFIG_USBDEV_MAX_BUS
#define CONFIG_USBDEV_MAX_BUS 1 // for now, bus num must be 1 except hpm ip #define CONFIG_USBDEV_MAX_BUS 1
#endif #endif
/* only useful for musb/ch32/chipidea */
#ifndef CONFIG_USBDEV_EP_NUM #ifndef CONFIG_USBDEV_EP_NUM
#define CONFIG_USBDEV_EP_NUM 8 #define CONFIG_USBDEV_EP_NUM 8
#endif #endif
@@ -283,6 +284,7 @@
#define CONFIG_USBHOST_MAX_BUS 1 #define CONFIG_USBHOST_MAX_BUS 1
#endif #endif
/* only useful for musb */
#ifndef CONFIG_USBHOST_PIPE_NUM #ifndef CONFIG_USBHOST_PIPE_NUM
#define CONFIG_USBHOST_PIPE_NUM 10 #define CONFIG_USBHOST_PIPE_NUM 10
#endif #endif
@@ -291,7 +293,7 @@
#define CONFIG_USB_EHCI_HCCR_OFFSET (0x0) #define CONFIG_USB_EHCI_HCCR_OFFSET (0x0)
#define CONFIG_USB_EHCI_FRAME_LIST_SIZE 1024 #define CONFIG_USB_EHCI_FRAME_LIST_SIZE 1024
#define CONFIG_USB_EHCI_QH_NUM CONFIG_USBHOST_PIPE_NUM #define CONFIG_USB_EHCI_QH_NUM 10
#define CONFIG_USB_EHCI_QTD_NUM (CONFIG_USB_EHCI_QH_NUM * 3) #define CONFIG_USB_EHCI_QTD_NUM (CONFIG_USB_EHCI_QH_NUM * 3)
#define CONFIG_USB_EHCI_ITD_NUM 4 #define CONFIG_USB_EHCI_ITD_NUM 4
// #define CONFIG_USB_EHCI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_HCOR_RESERVED_DISABLE
@@ -302,7 +304,7 @@
/* ---------------- OHCI Configuration ---------------- */ /* ---------------- OHCI Configuration ---------------- */
#define CONFIG_USB_OHCI_HCOR_OFFSET (0x0) #define CONFIG_USB_OHCI_HCOR_OFFSET (0x0)
#define CONFIG_USB_OHCI_ED_NUM CONFIG_USBHOST_PIPE_NUM #define CONFIG_USB_OHCI_ED_NUM 10
#define CONFIG_USB_OHCI_TD_NUM 3 #define CONFIG_USB_OHCI_TD_NUM 3
// #define CONFIG_USB_OHCI_DESC_DCACHE_ENABLE // #define CONFIG_USB_OHCI_DESC_DCACHE_ENABLE

View File

@@ -19,7 +19,7 @@
#define EHCI_ADDR2ITD(x) ((struct ehci_itd_hw *)(uintptr_t)((uint32_t)(x) & ~0x1F)) #define EHCI_ADDR2ITD(x) ((struct ehci_itd_hw *)(uintptr_t)((uint32_t)(x) & ~0x1F))
#ifndef CONFIG_USB_EHCI_QH_NUM #ifndef CONFIG_USB_EHCI_QH_NUM
#define CONFIG_USB_EHCI_QH_NUM CONFIG_USBHOST_PIPE_NUM #define CONFIG_USB_EHCI_QH_NUM 10
#endif #endif
#ifndef CONFIG_USB_EHCI_QTD_NUM #ifndef CONFIG_USB_EHCI_QTD_NUM
#define CONFIG_USB_EHCI_QTD_NUM (CONFIG_USB_EHCI_QH_NUM * 3) #define CONFIG_USB_EHCI_QTD_NUM (CONFIG_USB_EHCI_QH_NUM * 3)

View File

@@ -20,9 +20,8 @@
#define CONFIG_USB_FSDEV_RAM_SIZE 512 #define CONFIG_USB_FSDEV_RAM_SIZE 512
#endif #endif
#ifndef CONFIG_USBDEV_EP_NUM #undef CONFIG_USBDEV_EP_NUM
#define CONFIG_USBDEV_EP_NUM 8 #define CONFIG_USBDEV_EP_NUM 8
#endif
#define USB ((USB_TypeDef *)g_usbdev_bus[0].reg_base) #define USB ((USB_TypeDef *)g_usbdev_bus[0].reg_base)

View File

@@ -8,9 +8,7 @@
#include "hpm_usb_device.h" #include "hpm_usb_device.h"
#include "usb_glue_hpm.h" #include "usb_glue_hpm.h"
#ifndef USB_NUM_BIDIR_ENDPOINTS #define USB_NUM_BIDIR_ENDPOINTS USB_SOC_DCD_MAX_ENDPOINT_COUNT
#define USB_NUM_BIDIR_ENDPOINTS CONFIG_USBDEV_EP_NUM
#endif
/* USBSTS, USBINTR */ /* USBSTS, USBINTR */
enum { enum {

View File

@@ -6,6 +6,9 @@
#include "usbd_core.h" #include "usbd_core.h"
#include "usb_kinetis_reg.h" #include "usb_kinetis_reg.h"
#undef CONFIG_USBDEV_EP_NUM
#define CONFIG_USBDEV_EP_NUM 16
#define USB_OTG_DEV ((KINETIS_TypeDef *)g_usbdev_bus[busid].reg_base) #define USB_OTG_DEV ((KINETIS_TypeDef *)g_usbdev_bus[busid].reg_base)
/* Endpoint state */ /* Endpoint state */

View File

@@ -17,7 +17,7 @@
#define OHCI_ADDR2TD(x) ((struct ohci_td_hw *)(uintptr_t)((uint32_t)(x) & ~0x0F)) #define OHCI_ADDR2TD(x) ((struct ohci_td_hw *)(uintptr_t)((uint32_t)(x) & ~0x0F))
#ifndef CONFIG_USB_OHCI_ED_NUM #ifndef CONFIG_USB_OHCI_ED_NUM
#define CONFIG_USB_OHCI_ED_NUM CONFIG_USBHOST_PIPE_NUM #define CONFIG_USB_OHCI_ED_NUM 10
#endif #endif
#ifndef CONFIG_USB_OHCI_TD_NUM #ifndef CONFIG_USB_OHCI_TD_NUM
#define CONFIG_USB_OHCI_TD_NUM 3 #define CONFIG_USB_OHCI_TD_NUM 3

View File

@@ -12,13 +12,12 @@
#include "pico/fix/rp2040_usb_device_enumeration.h" #include "pico/fix/rp2040_usb_device_enumeration.h"
#endif #endif
#undef CONFIG_USBDEV_EP_NUM
#define CONFIG_USBDEV_EP_NUM USB_NUM_ENDPOINTS
#define usb_hw_set hw_set_alias(usb_hw) #define usb_hw_set hw_set_alias(usb_hw)
#define usb_hw_clear hw_clear_alias(usb_hw) #define usb_hw_clear hw_clear_alias(usb_hw)
#ifndef CONFIG_USBDEV_EP_NUM
#define CONFIG_USBDEV_EP_NUM 16
#endif
#ifndef FORCE_VBUS_DETECT #ifndef FORCE_VBUS_DETECT
#define FORCE_VBUS_DETECT 1 #define FORCE_VBUS_DETECT 1
#endif #endif

View File

@@ -9,6 +9,9 @@
#include "hardware/irq.h" #include "hardware/irq.h"
#include "hardware/structs/usb.h" #include "hardware/structs/usb.h"
#undef CONFIG_USBHOST_PIPE_NUM
#define CONFIG_USBHOST_PIPE_NUM USB_HOST_INTERRUPT_ENDPOINTS
#define usb_hw_set hw_set_alias(usb_hw) #define usb_hw_set hw_set_alias(usb_hw)
#define usb_hw_clear hw_clear_alias(usb_hw) #define usb_hw_clear hw_clear_alias(usb_hw)