summaryrefslogtreecommitdiff
path: root/tinyusb/host/ohci
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-04-13 15:39:57 +0700
committerhathach <[email protected]>2014-04-13 15:39:57 +0700
commit940d7fb7f6086afc5483f277077c6c05a8d8b539 (patch)
treef69ee29048f4a3cf2ceb3e4e992bf139904650d5 /tinyusb/host/ohci
parent45e76ee34f0306aab31a3bc22d2eb982ab13c923 (diff)
merge EHCI_MAX_QHD/QTD and OHCI_MAX_QHD/QTD to HCD_MAX_ENDPOINT/XFER and scale with number of enabled classes.
default config to support up to 5 device (hub + 4 others)
Diffstat (limited to 'tinyusb/host/ohci')
-rw-r--r--tinyusb/host/ohci/ohci.c8
-rw-r--r--tinyusb/host/ohci/ohci.h10
2 files changed, 9 insertions, 9 deletions
diff --git a/tinyusb/host/ohci/ohci.c b/tinyusb/host/ohci/ohci.c
index c1cdc3ea2..128760779 100644
--- a/tinyusb/host/ohci/ohci.c
+++ b/tinyusb/host/ohci/ohci.c
@@ -371,7 +371,7 @@ static inline ohci_ed_t * ed_from_pipe_handle(pipe_handle_t pipe_hdl)
static inline ohci_ed_t * ed_find_free(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE;
static inline ohci_ed_t * ed_find_free(uint8_t dev_addr)
{
- for(uint8_t i = 0; i < OHCI_MAX_QHD; i++)
+ for(uint8_t i = 0; i < HCD_MAX_ENDPOINT; i++)
{
if ( !ohci_data.device[dev_addr-1].ed[i].used )
{
@@ -384,7 +384,7 @@ static inline ohci_ed_t * ed_find_free(uint8_t dev_addr)
static ohci_ed_t * ed_list_find_previous(ohci_ed_t const * p_head, ohci_ed_t const * p_ed)
{
- uint32_t max_loop = OHCI_MAX_QHD;
+ uint32_t max_loop = HCD_MAX_ENDPOINT;
ohci_ed_t const * p_prev = p_head;
@@ -444,7 +444,7 @@ pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const *
static ohci_gtd_t * gtd_find_free(uint8_t dev_addr)
{
- for(uint8_t i=0; i < OHCI_MAX_QTD; i++)
+ for(uint8_t i=0; i < HCD_MAX_XFER; i++)
{
if (!ohci_data.device[dev_addr-1].gtd[i].used)
{
@@ -608,7 +608,7 @@ static inline uint32_t gtd_xfer_byte_left(uint32_t buffer_end, uint32_t current_
static void done_queue_isr(uint8_t hostid)
{
- uint8_t max_loop = (TUSB_CFG_HOST_DEVICE_MAX+1)*(OHCI_MAX_QTD+OHCI_MAX_ITD);
+ uint8_t max_loop = (TUSB_CFG_HOST_DEVICE_MAX+1)*(HCD_MAX_XFER+OHCI_MAX_ITD);
// done head is written in reversed order of completion --> need to reverse the done queue first
ohci_td_item_t* td_head = list_reverse ( (ohci_td_item_t*) align16(ohci_data.hcca.done_head) );
diff --git a/tinyusb/host/ohci/ohci.h b/tinyusb/host/ohci/ohci.h
index eed6909a2..3d3607c2f 100644
--- a/tinyusb/host/ohci/ohci.h
+++ b/tinyusb/host/ohci/ohci.h
@@ -58,9 +58,9 @@
#define OHCI_PERIODIC_LIST (defined HOST_HCD_XFER_INTERRUPT || defined HOST_HCD_XFER_ISOCHRONOUS)
// TODO merge OHCI with EHCI
-#define OHCI_MAX_QHD 8
-#define OHCI_MAX_QTD 20
-#define OHCI_MAX_ITD 4
+enum {
+ OHCI_MAX_ITD = 4
+};
enum {
OHCI_PID_SETUP = 0,
@@ -195,8 +195,8 @@ typedef struct ATTR_ALIGNED(256) {
struct {
// ochi_itd_t itd[OHCI_MAX_ITD]; // itd requires alignment of 32
- ohci_ed_t ed[OHCI_MAX_QHD];
- ohci_gtd_t gtd[OHCI_MAX_QTD];
+ ohci_ed_t ed[HCD_MAX_ENDPOINT];
+ ohci_gtd_t gtd[HCD_MAX_XFER];
}device[TUSB_CFG_HOST_DEVICE_MAX];
} ohci_data_t;