diff options
| author | hathach <[email protected]> | 2018-11-23 15:17:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-11-23 15:17:43 +0700 |
| commit | a619ff88a36e4b841cb5901135b1811b06c3c843 (patch) | |
| tree | 9212c44046d8d37a86d000d9f1f5c8bc3f54d3f6 /src | |
| parent | cb8782e5f28b4897e73520c91296d1ac7d71da81 (diff) | |
rename xfer complete enum
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/cdc/cdc_host.h | 6 | ||||
| -rw-r--r-- | src/class/hid/hid_host.h | 12 | ||||
| -rw-r--r-- | src/class/msc/msc_host.h | 6 | ||||
| -rw-r--r-- | src/common/tusb_types.h | 6 | ||||
| -rw-r--r-- | src/host/ehci/ehci.c | 6 | ||||
| -rw-r--r-- | src/host/hub.c | 2 | ||||
| -rw-r--r-- | src/host/ohci/ohci.c | 10 | ||||
| -rw-r--r-- | src/host/usbh.c | 8 | ||||
| -rw-r--r-- | src/osal/osal_none.h | 6 |
9 files changed, 32 insertions, 30 deletions
diff --git a/src/class/cdc/cdc_host.h b/src/class/cdc/cdc_host.h index 8cfe6e5b7..0b863bb61 100644 --- a/src/class/cdc/cdc_host.h +++ b/src/class/cdc/cdc_host.h @@ -122,9 +122,9 @@ void tuh_cdc_unmounted_cb(uint8_t dev_addr); * \param[in] pipe_id value from \ref cdc_pipeid_t indicate the pipe
* \param[in] xferred_bytes Number of bytes transferred via USB bus
* \note event can be one of following
- * - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
- * - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
- * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
+ * - XFER_RESULT_SUCCESS : previously scheduled transfer completes successfully.
+ * - XFER_RESULT_FAILED : previously scheduled transfer encountered a transaction error.
+ * - XFER_RESULT_STALLED : previously scheduled transfer is stalled by device.
* \note
*/
void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h index fb10a614f..cb0230e8a 100644 --- a/src/class/hid/hid_host.h +++ b/src/class/hid/hid_host.h @@ -95,9 +95,9 @@ tusb_error_t tuh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) /*A * \param[in] dev_addr Address of device
* \param[in] event an value from \ref xfer_result_t
* \note event can be one of following
- * - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
- * - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
- * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
+ * - XFER_RESULT_SUCCESS : previously scheduled transfer completes successfully.
+ * - XFER_RESULT_FAILED : previously scheduled transfer encountered a transaction error.
+ * - XFER_RESULT_STALLED : previously scheduled transfer is stalled by device.
* \note Application should schedule the next report by calling \ref tuh_hid_keyboard_get_report within this callback
*/
void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event);
@@ -160,9 +160,9 @@ tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATTR_ * \param[in] dev_addr Address of device
* \param[in] event an value from \ref xfer_result_t
* \note event can be one of following
- * - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
- * - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
- * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
+ * - XFER_RESULT_SUCCESS : previously scheduled transfer completes successfully.
+ * - XFER_RESULT_FAILED : previously scheduled transfer encountered a transaction error.
+ * - XFER_RESULT_STALLED : previously scheduled transfer is stalled by device.
* \note Application should schedule the next report by calling \ref tuh_hid_mouse_get_report within this callback
*/
void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event);
diff --git a/src/class/msc/msc_host.h b/src/class/msc/msc_host.h index 0afe5c515..a408bbeaf 100644 --- a/src/class/msc/msc_host.h +++ b/src/class/msc/msc_host.h @@ -174,9 +174,9 @@ void tuh_msc_unmounted_cb(uint8_t dev_addr); * \param[in] event an value from \ref xfer_result_t
* \param[in] xferred_bytes Number of bytes transferred via USB bus
* \note event can be one of following
- * - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
- * - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
- * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
+ * - XFER_RESULT_SUCCESS : previously scheduled transfer completes successfully.
+ * - XFER_RESULT_FAILED : previously scheduled transfer encountered a transaction error.
+ * - XFER_RESULT_STALLED : previously scheduled transfer is stalled by device.
* \note
*/
void tuh_msc_isr(uint8_t dev_addr, xfer_result_t event, uint32_t xferred_bytes);
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h index 7b5268d4f..9c3c21b88 100644 --- a/src/common/tusb_types.h +++ b/src/common/tusb_types.h @@ -197,9 +197,9 @@ typedef enum typedef enum
{
- TUSB_EVENT_XFER_COMPLETE,
- TUSB_EVENT_XFER_ERROR,
- TUSB_EVENT_XFER_STALLED,
+ XFER_RESULT_SUCCESS,
+ XFER_RESULT_FAILED,
+ XFER_RESULT_STALLED,
}xfer_result_t;
enum
diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c index 2fc99ffcd..27808d59b 100644 --- a/src/host/ehci/ehci.c +++ b/src/host/ehci/ehci.c @@ -570,7 +570,7 @@ static void qhd_xfer_complete_isr(ehci_qhd_t * p_qhd) if (is_ioc) // end of request
{ // call USBH callback
usbh_xfer_isr( qhd_create_pipe_handle(p_qhd, xfer_type),
- p_qhd->class_code, TUSB_EVENT_XFER_COMPLETE,
+ p_qhd->class_code, XFER_RESULT_SUCCESS,
p_qhd->total_xferred_bytes - (xfer_type == TUSB_XFER_CONTROL ? 8 : 0) ); // subtract setup packet size if control,
p_qhd->total_xferred_bytes = 0;
}
@@ -641,12 +641,12 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd) xfer_result_t error_event;
// no error bits are set, endpoint is halted due to STALL
- error_event = qhd_has_xact_error(p_qhd) ? TUSB_EVENT_XFER_ERROR : TUSB_EVENT_XFER_STALLED;
+ error_event = qhd_has_xact_error(p_qhd) ? XFER_RESULT_FAILED : XFER_RESULT_STALLED;
p_qhd->total_xferred_bytes += p_qhd->p_qtd_list_head->expected_bytes - p_qhd->p_qtd_list_head->total_bytes;
-// if ( TUSB_EVENT_XFER_ERROR == error_event ) TU_BREAKPOINT(); // TODO skip unplugged device
+// if ( XFER_RESULT_FAILED == error_event ) TU_BREAKPOINT(); // TODO skip unplugged device
p_qhd->p_qtd_list_head->used = 0; // free QTD
qtd_remove_1st_from_qhd(p_qhd);
diff --git a/src/host/hub.c b/src/host/hub.c index 9635bcc0b..55c8597ad 100644 --- a/src/host/hub.c +++ b/src/host/hub.c @@ -215,7 +215,7 @@ void hub_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes usbh_hub_t * p_hub = &hub_data[pipe_hdl.dev_addr-1];
- if ( event == TUSB_EVENT_XFER_COMPLETE )
+ if ( event == XFER_RESULT_SUCCESS )
{
for (uint8_t port=1; port <= p_hub->port_number; port++)
{ // TODO HUB ignore bit0 hub_status_change
diff --git a/src/host/ohci/ohci.c b/src/host/ohci/ohci.c index 58738a236..91d9b6243 100644 --- a/src/host/ohci/ohci.c +++ b/src/host/ohci/ohci.c @@ -617,11 +617,11 @@ static void done_queue_isr(uint8_t hostid) // TODO check if td_head is iso td
//------------- Non ISO transfer -------------//
ohci_gtd_t * const p_qtd = (ohci_gtd_t *) td_head;
- xfer_result_t const event = (p_qtd->condition_code == OHCI_CCODE_NO_ERROR) ? TUSB_EVENT_XFER_COMPLETE :
- (p_qtd->condition_code == OHCI_CCODE_STALL) ? TUSB_EVENT_XFER_STALLED : TUSB_EVENT_XFER_ERROR;
+ xfer_result_t const event = (p_qtd->condition_code == OHCI_CCODE_NO_ERROR) ? XFER_RESULT_SUCCESS :
+ (p_qtd->condition_code == OHCI_CCODE_STALL) ? XFER_RESULT_STALLED : XFER_RESULT_FAILED;
p_qtd->used = 0; // free TD
- if ( (p_qtd->delay_interrupt == OHCI_INT_ON_COMPLETE_YES) || (event != TUSB_EVENT_XFER_COMPLETE) )
+ if ( (p_qtd->delay_interrupt == OHCI_INT_ON_COMPLETE_YES) || (event != XFER_RESULT_SUCCESS) )
{
ohci_ed_t * const p_ed = gtd_get_ed(p_qtd);
@@ -634,11 +634,11 @@ static void done_queue_isr(uint8_t hostid) // --> HC will not process Control list (due to service ratio when Bulk list not empty)
// To walk-around this, the halted ED will have TailP = HeadP (empty list condition), when clearing halt
// the TailP must be set back to NULL for processing remaining TDs
- if ((event != TUSB_EVENT_XFER_COMPLETE))
+ if ((event != XFER_RESULT_SUCCESS))
{
p_ed->td_tail.address &= 0x0Ful;
p_ed->td_tail.address |= tu_align16(p_ed->td_head.address); // mark halted EP as empty queue
- if ( event == TUSB_EVENT_XFER_STALLED ) p_ed->is_stalled = 1;
+ if ( event == XFER_RESULT_STALLED ) p_ed->is_stalled = 1;
}
pipe_handle_t pipe_hdl =
diff --git a/src/host/usbh.c b/src/host/usbh.c index ed21bf3da..a0aab3b96 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -199,7 +199,7 @@ tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, #ifndef _TEST_
usbh_devices[dev_addr].control.pipe_status = 0;
#else
- usbh_devices[dev_addr].control.pipe_status = TUSB_EVENT_XFER_COMPLETE; // in Test project, mark as complete immediately
+ usbh_devices[dev_addr].control.pipe_status = XFER_RESULT_SUCCESS; // in Test project, mark as complete immediately
#endif
error = hcd_pipe_control_xfer(dev_addr, &usbh_devices[dev_addr].control.request, data);
@@ -207,11 +207,11 @@ tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, osal_mutex_release(usbh_devices[dev_addr].control.mutex_hdl);
STASK_ASSERT_ERR(error);
- if (TUSB_EVENT_XFER_STALLED == usbh_devices[dev_addr].control.pipe_status) STASK_RETURN(TUSB_ERROR_USBH_XFER_STALLED);
- if (TUSB_EVENT_XFER_ERROR == usbh_devices[dev_addr].control.pipe_status) STASK_RETURN(TUSB_ERROR_USBH_XFER_FAILED);
+ if (XFER_RESULT_STALLED == usbh_devices[dev_addr].control.pipe_status) STASK_RETURN(TUSB_ERROR_USBH_XFER_STALLED);
+ if (XFER_RESULT_FAILED == usbh_devices[dev_addr].control.pipe_status) STASK_RETURN(TUSB_ERROR_USBH_XFER_FAILED);
// STASK_ASSERT_HDLR(TUSB_ERROR_NONE == error &&
-// TUSB_EVENT_XFER_COMPLETE == usbh_devices[dev_addr].control.pipe_status,
+// XFER_RESULT_SUCCESS == usbh_devices[dev_addr].control.pipe_status,
// tuh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL) );
OSAL_SUBTASK_END
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h index 46930aeda..b21c3332a 100644 --- a/src/osal/osal_none.h +++ b/src/osal/osal_none.h @@ -156,10 +156,12 @@ static inline void osal_queue_reset(osal_queue_t const queue_hdl) static inline bool osal_queue_receive(osal_queue_t const queue_hdl, void* data)
{
// osal none return immediately without blocking
+ // extern void tusb_hal_int_disable(uint8_t rhport);
+ // extern void tusb_hal_int_enable(uint8_t rhport);
- // tusb_hal_int_disable_all();
+// tusb_hal_int_disable(0);
bool rc = tu_fifo_read(queue_hdl, data);
- // tusb_hal_int_enable_all();
+// tusb_hal_int_enable(0);
return rc;
}
|
