summaryrefslogtreecommitdiff
path: root/tinyusb/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-11 13:59:37 +0700
committerhathach <[email protected]>2018-03-11 13:59:37 +0700
commit43cf0fb3dfeb87fadeed3b1c0f4ca9ae49df0422 (patch)
tree547baee54bceccad9f1f3b1a6cbf4126af18fcf3 /tinyusb/device
parentbf9fc1b31861c563253e429cbc10ed7362612d5b (diff)
refactor dcd_xfer_complete
Diffstat (limited to 'tinyusb/device')
-rw-r--r--tinyusb/device/dcd_lpc175x_6x.c6
-rw-r--r--tinyusb/device/dcd_lpc_11uxx_13uxx.c4
-rw-r--r--tinyusb/device/usbd.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c
index 4328fbf1c..274fc462c 100644
--- a/tinyusb/device/dcd_lpc175x_6x.c
+++ b/tinyusb/device/dcd_lpc175x_6x.c
@@ -165,9 +165,9 @@ static void endpoint_non_control_isr(uint32_t eot_int)
.index = ep_id,
.class_code = dcd_data.class_code[ep_id]
};
- tusb_event_t event = (p_last_dd->status == DD_STATUS_NORMAL || p_last_dd->status == DD_STATUS_DATA_UNDERUN) ? TUSB_EVENT_XFER_COMPLETE : TUSB_EVENT_XFER_ERROR;
+ bool succeeded = (p_last_dd->status == DD_STATUS_NORMAL || p_last_dd->status == DD_STATUS_DATA_UNDERUN) ? true : false;
- usbd_xfer_isr(edpt_hdl, event, p_last_dd->present_count); // report only xferred bytes in the IOC qtd
+ tusb_dcd_xfer_complete(edpt_hdl, p_last_dd->present_count, succeeded); // report only xferred bytes in the IOC qtd
}
}
}
@@ -208,7 +208,7 @@ static void endpoint_control_isr(void)
dcd_data.control_dma.int_on_complete = 0;
// FIXME xferred_byte for control xfer is not needed now !!!
- usbd_xfer_isr(edpt_hdl, TUSB_EVENT_XFER_COMPLETE, 0);
+ tusb_dcd_xfer_complete(edpt_hdl, 0, true);
}
}
}
diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
index 8a5691dc4..559da4a0f 100644
--- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c
+++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
@@ -256,7 +256,7 @@ static void endpoint_non_control_isr(uint32_t int_status)
dcd_data.current_ioc = BIT_CLR_(dcd_data.current_ioc, edpt_hdl.index);
// TODO no way determine if the transfer is failed or not
- usbd_xfer_isr(edpt_hdl, TUSB_EVENT_XFER_COMPLETE, dcd_data.current_td[ep_id].xferred_total);
+ tusb_dcd_xfer_complete(edpt_hdl, dcd_data.current_td[ep_id].xferred_total, true);
}
//------------- Next TD is available -------------//
@@ -291,7 +291,7 @@ static void endpoint_control_isr(uint32_t int_status)
dcd_data.current_ioc = BIT_CLR_(dcd_data.current_ioc, ep_id);
// FIXME xferred_byte for control xfer is not needed now !!!
- usbd_xfer_isr(edpt_hdl, TUSB_EVENT_XFER_COMPLETE, 0);
+ tusb_dcd_xfer_complete(edpt_hdl, 0, true);
}
}
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index f090bc141..55bce5626 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -498,7 +498,7 @@ void tusb_dcd_setup_received(uint8_t port, uint8_t const* p_request)
osal_queue_send(usbd_queue_hdl, &task_event);
}
-void usbd_xfer_isr(edpt_hdl_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
+void tusb_dcd_xfer_complete(edpt_hdl_t edpt_hdl, uint32_t xferred_bytes, bool succeeded)
{
if (edpt_hdl.index == 0 )
{
@@ -508,9 +508,9 @@ void usbd_xfer_isr(edpt_hdl_t edpt_hdl, tusb_event_t event, uint32_t xferred_byt
{
usbd_task_event_t task_event =
{
- .port = edpt_hdl.port,
+ .port = edpt_hdl.port,
.event_id = USBD_EVENTID_XFER_DONE,
- .sub_event_id = event
+ .sub_event_id = succeeded ? TUSB_EVENT_XFER_COMPLETE : TUSB_EVENT_XFER_ERROR
};
task_event.xfer_done.xferred_byte = xferred_bytes;