|
|
@@ -306,6 +306,11 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+// TODO move around
|
|
|
+static ohci_ed_t * ed_from_addr(uint8_t dev_addr, uint8_t ep_addr);
|
|
|
+static ohci_gtd_t * gtd_find_free(void);
|
|
|
+static void td_insert_to_ed(ohci_ed_t* p_ed, ohci_gtd_t * p_gtd);
|
|
|
+
|
|
|
bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen)
|
|
|
{
|
|
|
(void) rhport;
|
|
|
@@ -329,6 +334,21 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *
|
|
|
p_ed->td_head.address = (uint32_t) p_data;
|
|
|
|
|
|
OHCI_REG->command_status_bit.control_list_filled = 1;
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ ohci_ed_t * p_ed = ed_from_addr(dev_addr, ep_addr);
|
|
|
+ ohci_gtd_t* p_gtd = gtd_find_free();
|
|
|
+
|
|
|
+ TU_ASSERT(p_gtd);
|
|
|
+
|
|
|
+ gtd_init(p_gtd, buffer, buflen);
|
|
|
+ p_gtd->index = p_ed-ohci_data.ed_pool;
|
|
|
+ p_gtd->delay_interrupt = OHCI_INT_ON_COMPLETE_YES;
|
|
|
+
|
|
|
+ td_insert_to_ed(p_ed, p_gtd);
|
|
|
+
|
|
|
+ tusb_xfer_type_t xfer_type = ed_get_xfer_type( ed_from_addr(dev_addr, ep_addr) );
|
|
|
+ if (TUSB_XFER_BULK == xfer_type) OHCI_REG->command_status_bit.bulk_list_filled = 1;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
@@ -337,7 +357,7 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *
|
|
|
//--------------------------------------------------------------------+
|
|
|
// BULK/INT/ISO PIPE API
|
|
|
//--------------------------------------------------------------------+
|
|
|
-static inline ohci_ed_t * ed_from_addr(uint8_t dev_addr, uint8_t ep_addr)
|
|
|
+static ohci_ed_t * ed_from_addr(uint8_t dev_addr, uint8_t ep_addr)
|
|
|
{
|
|
|
if ( tu_edpt_number(ep_addr) == 0 ) return &ohci_data.control[dev_addr].ed;
|
|
|
|
|
|
@@ -355,7 +375,7 @@ static inline ohci_ed_t * ed_from_addr(uint8_t dev_addr, uint8_t ep_addr)
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
-static inline ohci_ed_t * ed_find_free(void)
|
|
|
+static ohci_ed_t * ed_find_free(void)
|
|
|
{
|
|
|
ohci_ed_t* ed_pool = ohci_data.ed_pool;
|
|
|
|