remove DCD API dependency tusb_dcd_edpt_queue_xfer

improve MSC driver
This commit is contained in:
hathach
2018-03-23 11:53:49 +07:00
parent 16aa3eb437
commit 98d6ec1ef5
4 changed files with 61 additions and 65 deletions

View File

@@ -436,11 +436,6 @@ bool tusb_dcd_edpt_xfer (uint8_t port, uint8_t ep_addr, uint8_t * buffer, uint16
return true;
}
bool tusb_dcd_edpt_queue_xfer (uint8_t port, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{
return true;
}
void tusb_dcd_edpt_stall (uint8_t port, uint8_t ep_addr)
{
(void) port;

View File

@@ -219,8 +219,9 @@ static void qtd_init(dcd_qtd_t* p_qtd, void * data_ptr, uint16_t total_bytes)
// retval 0: invalid
static inline uint8_t qtd_find_free(uint8_t port)
{
for(uint8_t i=2; i<DCD_QTD_MAX; i++)
{ // exclude control's qtd
// QTD0 is reserved for control transfer
for(uint8_t i=1; i<DCD_QTD_MAX; i++)
{
if ( dcd_data_ptr[port]->qtd[i].used == 0) return i;
}
@@ -331,6 +332,7 @@ bool tusb_dcd_edpt_busy(uint8_t port, uint8_t ep_addr)
}
// add only, controller virtually cannot know
// TODO remove and merge to tusb_dcd_edpt_xfer
static bool pipe_add_xfer(uint8_t port, uint8_t ed_idx, void * buffer, uint16_t total_bytes, bool int_on_complete)
{
uint8_t qtd_idx = qtd_find_free(port);
@@ -359,12 +361,6 @@ static bool pipe_add_xfer(uint8_t port, uint8_t ed_idx, void * buffer, uint16_t
return true;
}
bool tusb_dcd_edpt_queue_xfer(uint8_t port, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{
uint8_t ep_idx = edpt_addr2phy(ep_addr);
return pipe_add_xfer(port, ep_idx, buffer, total_bytes, false);
}
bool tusb_dcd_edpt_xfer(uint8_t port, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{
uint8_t ep_idx = edpt_addr2phy(ep_addr);