summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-03-04 21:04:52 +0700
committerhathach <[email protected]>2022-03-04 21:04:52 +0700
commit7480c2e46b10faa0cbdac5c9db803dbb1597cd34 (patch)
tree9475e0347908cbfc0043c3327a278b92b4613a45
parent032e2c292997f4f8fe58239fcca535bb53ed2348 (diff)
correct qhd and qtd count for ehci/ohci
-rw-r--r--src/host/hcd.h2
-rw-r--r--src/portable/ehci/ehci.c7
-rw-r--r--src/portable/ohci/ohci.c6
-rw-r--r--src/portable/ohci/ohci.h5
4 files changed, 11 insertions, 9 deletions
diff --git a/src/host/hcd.h b/src/host/hcd.h
index d50fc2d60..9819f5f2a 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -40,7 +40,7 @@
//--------------------------------------------------------------------+
#ifndef CFG_TUH_ENDPOINT_MAX
- #define CFG_TUH_ENDPOINT_MAX (CFG_TUH_DEVICE_MAX*(CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3))
+ #define CFG_TUH_ENDPOINT_MAX (CFG_TUH_HUB + CFG_TUH_HID*2 + CFG_TUH_MSC*2 + CFG_TUH_CDC*3)
// #ifdef TUP_HCD_ENDPOINT_MAX
// #define CFG_TUH_ENDPPOINT_MAX TUP_HCD_ENDPOINT_MAX
// #else
diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c
index bc0b7b89a..2220474d7 100644
--- a/src/portable/ehci/ehci.c
+++ b/src/portable/ehci/ehci.c
@@ -58,7 +58,8 @@
#define FRAMELIST_SIZE (1024 >> FRAMELIST_SIZE_BIT_VALUE)
-#define HCD_MAX_XFER CFG_TUH_ENDPOINT_MAX
+#define QHD_MAX (CFG_TUH_DEVICE_MAX*CFG_TUH_ENDPOINT_MAX)
+#define QTD_MAX QHD_MAX
typedef struct
{
@@ -76,7 +77,7 @@ typedef struct
}control[CFG_TUH_DEVICE_MAX+CFG_TUH_HUB+1];
ehci_qhd_t qhd_pool[CFG_TUH_ENDPOINT_MAX];
- ehci_qtd_t qtd_pool[HCD_MAX_XFER] TU_ATTR_ALIGNED(32);
+ ehci_qtd_t qtd_pool[QTD_MAX] TU_ATTR_ALIGNED(32);
ehci_registers_t* regs;
@@ -752,7 +753,7 @@ static inline ehci_qhd_t* qhd_get_from_addr(uint8_t dev_addr, uint8_t ep_addr)
//------------- TD helper -------------//
static inline ehci_qtd_t* qtd_find_free(void)
{
- for (uint32_t i=0; i<HCD_MAX_XFER; i++)
+ for (uint32_t i=0; i<QTD_MAX; i++)
{
if ( !ehci_data.qtd_pool[i].used ) return &ehci_data.qtd_pool[i];
}
diff --git a/src/portable/ohci/ohci.c b/src/portable/ohci/ohci.c
index c82b9352c..e09382241 100644
--- a/src/portable/ohci/ohci.c
+++ b/src/portable/ohci/ohci.c
@@ -313,7 +313,7 @@ static ohci_ed_t * ed_from_addr(uint8_t dev_addr, uint8_t ep_addr)
ohci_ed_t* ed_pool = ohci_data.ed_pool;
- for(uint32_t i=0; i<CFG_TUH_ENDPOINT_MAX; i++)
+ for(uint32_t i=0; i<ED_MAX; i++)
{
if ( (ed_pool[i].dev_addr == dev_addr) &&
ep_addr == tu_edpt_addr(ed_pool[i].ep_number, ed_pool[i].pid == PID_IN) )
@@ -329,7 +329,7 @@ static ohci_ed_t * ed_find_free(void)
{
ohci_ed_t* ed_pool = ohci_data.ed_pool;
- for(uint8_t i = 0; i < CFG_TUH_ENDPOINT_MAX; i++)
+ for(uint8_t i = 0; i < ED_MAX; i++)
{
if ( !ed_pool[i].used ) return &ed_pool[i];
}
@@ -368,7 +368,7 @@ static void ed_list_remove_by_addr(ohci_ed_t * p_head, uint8_t dev_addr)
static ohci_gtd_t * gtd_find_free(void)
{
- for(uint8_t i=0; i < HCD_MAX_XFER; i++)
+ for(uint8_t i=0; i < GTD_MAX; i++)
{
if ( !ohci_data.gtd_pool[i].used ) return &ohci_data.gtd_pool[i];
}
diff --git a/src/portable/ohci/ohci.h b/src/portable/ohci/ohci.h
index a1d74580b..d45555ded 100644
--- a/src/portable/ohci/ohci.h
+++ b/src/portable/ohci/ohci.h
@@ -42,7 +42,8 @@ enum {
OHCI_MAX_ITD = 4
};
-#define HCD_MAX_XFER CFG_TUH_ENDPOINT_MAX
+#define ED_MAX (CFG_TUH_DEVICE_MAX*CFG_TUH_ENDPOINT_MAX)
+#define GTD_MAX ED_MAX
//--------------------------------------------------------------------+
// OHCI Data Structure
@@ -165,7 +166,7 @@ typedef struct TU_ATTR_ALIGNED(256)
// ochi_itd_t itd[OHCI_MAX_ITD]; // itd requires alignment of 32
ohci_ed_t ed_pool[CFG_TUH_ENDPOINT_MAX];
- ohci_gtd_t gtd_pool[HCD_MAX_XFER];
+ ohci_gtd_t gtd_pool[GTD_MAX];
volatile uint16_t frame_number_hi;