From 60d8cde6951fa9fe9c43064ee701598e9da566f7 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 22 Nov 2018 17:21:07 +0700 Subject: rename CFG_TUSB_MEM_SECTION to CFG_TUSB_MEM_SECTION --- src/device/usbd_control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/device') diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c index 8564d1ae9..33de6d064 100644 --- a/src/device/usbd_control.c +++ b/src/device/usbd_control.c @@ -64,7 +64,7 @@ typedef struct static usbd_control_xfer_t _control_state; -CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _usbd_ctrl_buf[CFG_TUD_ENDOINT0_SIZE]; +CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN uint8_t _usbd_ctrl_buf[CFG_TUD_ENDOINT0_SIZE]; void usbd_control_reset (uint8_t rhport) { -- cgit v1.3.1 From cb8782e5f28b4897e73520c91296d1ac7d71da81 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 23 Nov 2018 15:14:47 +0700 Subject: rename tusb_event_t to xfer_result_t --- examples/obsolete/device/src/keyboard_device_app.c | 2 +- examples/obsolete/device/src/mouse_device_app.c | 2 +- examples/obsolete/host/src/cdc_serial_host_app.c | 2 +- examples/obsolete/host/src/keyboard_host_app.c | 2 +- examples/obsolete/host/src/mouse_host_app.c | 2 +- examples/obsolete/host/src/msc_host_app.c | 2 +- src/class/cdc/cdc_device.c | 2 +- src/class/cdc/cdc_device.h | 2 +- src/class/cdc/cdc_host.c | 2 +- src/class/cdc/cdc_host.h | 6 +++--- src/class/cdc/cdc_rndis_host.c | 2 +- src/class/cdc/cdc_rndis_host.h | 2 +- src/class/custom/custom_device.c | 2 +- src/class/custom/custom_device.h | 2 +- src/class/custom/custom_host.c | 2 +- src/class/custom/custom_host.h | 2 +- src/class/hid/hid_device.c | 2 +- src/class/hid/hid_device.h | 2 +- src/class/hid/hid_host.c | 2 +- src/class/hid/hid_host.h | 12 ++++++------ src/class/msc/msc_device.c | 4 ++-- src/class/msc/msc_device.h | 2 +- src/class/msc/msc_host.c | 2 +- src/class/msc/msc_host.h | 6 +++--- src/common/tusb_types.h | 3 +-- src/device/usbd.c | 4 ++-- src/device/usbd_control.c | 2 +- src/host/ehci/ehci.c | 2 +- src/host/hub.c | 2 +- src/host/hub.h | 2 +- src/host/ohci/ohci.c | 2 +- src/host/usbh.c | 2 +- src/host/usbh.h | 2 +- src/host/usbh_hcd.h | 2 +- tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h | 2 +- tests/lpc18xx_43xx/test/host/hid/hidh_callback.h | 4 ++-- tests/lpc18xx_43xx/test/host/msc/msch_callback.h | 2 +- 37 files changed, 49 insertions(+), 50 deletions(-) (limited to 'src/device') diff --git a/examples/obsolete/device/src/keyboard_device_app.c b/examples/obsolete/device/src/keyboard_device_app.c index f6ef77c10..6c413464e 100644 --- a/examples/obsolete/device/src/keyboard_device_app.c +++ b/examples/obsolete/device/src/keyboard_device_app.c @@ -66,7 +66,7 @@ void keyboard_app_umount(uint8_t rhport) } -void tud_hid_keyboard_cb(uint8_t rhport, tusb_event_t event, uint32_t xferred_bytes) +void tud_hid_keyboard_cb(uint8_t rhport, xfer_result_t event, uint32_t xferred_bytes) { switch(event) { diff --git a/examples/obsolete/device/src/mouse_device_app.c b/examples/obsolete/device/src/mouse_device_app.c index db685daf6..4c4d322d7 100644 --- a/examples/obsolete/device/src/mouse_device_app.c +++ b/examples/obsolete/device/src/mouse_device_app.c @@ -66,7 +66,7 @@ void mouse_app_umount(uint8_t rhport) } -void tud_hid_mouse_cb(uint8_t rhport, tusb_event_t event, uint32_t xferred_bytes) +void tud_hid_mouse_cb(uint8_t rhport, xfer_result_t event, uint32_t xferred_bytes) { switch(event) { diff --git a/examples/obsolete/host/src/cdc_serial_host_app.c b/examples/obsolete/host/src/cdc_serial_host_app.c index d16a9b411..afb2b8937 100644 --- a/examples/obsolete/host/src/cdc_serial_host_app.c +++ b/examples/obsolete/host/src/cdc_serial_host_app.c @@ -75,7 +75,7 @@ void tuh_cdc_unmounted_cb(uint8_t dev_addr) } // invoked ISR context -void tuh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) +void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) { (void) dev_addr; // compiler warnings diff --git a/examples/obsolete/host/src/keyboard_host_app.c b/examples/obsolete/host/src/keyboard_host_app.c index 6d10e96e1..27d10b9e7 100644 --- a/examples/obsolete/host/src/keyboard_host_app.c +++ b/examples/obsolete/host/src/keyboard_host_app.c @@ -77,7 +77,7 @@ void tuh_hid_keyboard_unmounted_cb(uint8_t dev_addr) } // invoked ISR context -void tuh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event) +void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event) { switch(event) { diff --git a/examples/obsolete/host/src/mouse_host_app.c b/examples/obsolete/host/src/mouse_host_app.c index 563b911c2..05135693b 100644 --- a/examples/obsolete/host/src/mouse_host_app.c +++ b/examples/obsolete/host/src/mouse_host_app.c @@ -76,7 +76,7 @@ void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr) } // invoked ISR context -void tuh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) +void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event) { switch(event) { diff --git a/examples/obsolete/host/src/msc_host_app.c b/examples/obsolete/host/src/msc_host_app.c index 3648cb94b..1cfe9ec60 100644 --- a/examples/obsolete/host/src/msc_host_app.c +++ b/examples/obsolete/host/src/msc_host_app.c @@ -129,7 +129,7 @@ void tuh_msc_unmounted_cb(uint8_t dev_addr) } // invoked ISR context -void tuh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes) +void tuh_msc_isr(uint8_t dev_addr, xfer_result_t event, uint32_t xferred_bytes) { (void) dev_addr; (void) event; diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index a0abd42f6..b68a6a7ff 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -358,7 +358,7 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request return true; } -tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, uint32_t xferred_bytes) +tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes) { // TODO Support multiple interfaces uint8_t const itf = 0; diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h index 749351a54..ad1100e9c 100644 --- a/src/class/cdc/cdc_device.h +++ b/src/class/cdc/cdc_device.h @@ -116,7 +116,7 @@ void cdcd_init (void); tusb_error_t cdcd_open (uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length); bool cdcd_control_request (uint8_t rhport, tusb_control_request_t const * p_request); bool cdcd_control_request_complete (uint8_t rhport, tusb_control_request_t const * p_request); -tusb_error_t cdcd_xfer_cb (uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes); +tusb_error_t cdcd_xfer_cb (uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes); void cdcd_reset (uint8_t rhport); #endif diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index af2e2c444..0a3661878 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -221,7 +221,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ OSAL_SUBTASK_END } -void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) +void cdch_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) { tuh_cdc_xfer_isr( pipe_hdl.dev_addr, event, get_app_pipeid(pipe_hdl), xferred_bytes ); } diff --git a/src/class/cdc/cdc_host.h b/src/class/cdc/cdc_host.h index b3e995470..8cfe6e5b7 100644 --- a/src/class/cdc/cdc_host.h +++ b/src/class/cdc/cdc_host.h @@ -118,7 +118,7 @@ void tuh_cdc_unmounted_cb(uint8_t dev_addr); /** \brief Callback function that is invoked when an transferring event occurred * \param[in] dev_addr Address of device - * \param[in] event an value from \ref tusb_event_t + * \param[in] event an value from \ref xfer_result_t * \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 @@ -127,7 +127,7 @@ void tuh_cdc_unmounted_cb(uint8_t dev_addr); * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device. * \note */ -void tuh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes); +void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes); /// @} // group CDC_Serial_Host /// @} @@ -151,7 +151,7 @@ extern cdch_data_t cdch_data[CFG_TUSB_HOST_DEVICE_MAX]; // TODO consider to move void cdch_init(void); tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; -void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes); +void cdch_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes); void cdch_close(uint8_t dev_addr); #endif diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c index 42722fd0d..89ea3b32f 100644 --- a/src/class/cdc/cdc_rndis_host.c +++ b/src/class/cdc/cdc_rndis_host.c @@ -224,7 +224,7 @@ tusb_error_t rndish_open_subtask(uint8_t dev_addr, cdch_data_t *p_cdc) OSAL_SUBTASK_END } -void rndish_xfer_isr(cdch_data_t *p_cdc, pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) +void rndish_xfer_isr(cdch_data_t *p_cdc, pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) { if ( pipehandle_is_equal(pipe_hdl, p_cdc->pipe_notification) ) { diff --git a/src/class/cdc/cdc_rndis_host.h b/src/class/cdc/cdc_rndis_host.h index c4597daa8..3b92d3f23 100644 --- a/src/class/cdc/cdc_rndis_host.h +++ b/src/class/cdc/cdc_rndis_host.h @@ -65,7 +65,7 @@ typedef struct { void rndish_init(void); tusb_error_t rndish_open_subtask(uint8_t dev_addr, cdch_data_t *p_cdc) ATTR_WARN_UNUSED_RESULT; -void rndish_xfer_isr(cdch_data_t *p_cdc, pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes); +void rndish_xfer_isr(cdch_data_t *p_cdc, pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes); void rndish_close(uint8_t dev_addr); #endif diff --git a/src/class/custom/custom_device.c b/src/class/custom/custom_device.c index cc440fc7e..194963c17 100644 --- a/src/class/custom/custom_device.c +++ b/src/class/custom/custom_device.c @@ -94,7 +94,7 @@ bool cusd_control_request(uint8_t rhport, tusb_control_request_t const * p_reque return false; } -tusb_error_t cusd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes) +tusb_error_t cusd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes) { return TUSB_ERROR_NONE; } diff --git a/src/class/custom/custom_device.h b/src/class/custom/custom_device.h index 704c4127b..0a8f05e7d 100644 --- a/src/class/custom/custom_device.h +++ b/src/class/custom/custom_device.h @@ -66,7 +66,7 @@ void cusd_init(void); tusb_error_t cusd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length); bool cusd_control_request_st(uint8_t rhport, tusb_control_request_t const * p_request); bool cusd_control_request_complete (uint8_t rhport, tusb_control_request_t const * p_request); -tusb_error_t cusd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes); +tusb_error_t cusd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes); void cusd_reset(uint8_t rhport); #endif diff --git a/src/class/custom/custom_host.c b/src/class/custom/custom_host.c index 329012fda..9f0b70afb 100644 --- a/src/class/custom/custom_host.c +++ b/src/class/custom/custom_host.c @@ -131,7 +131,7 @@ tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ return TUSB_ERROR_NONE; } -void cush_isr(pipe_handle_t pipe_hdl, tusb_event_t event) +void cush_isr(pipe_handle_t pipe_hdl, xfer_result_t event) { } diff --git a/src/class/custom/custom_host.h b/src/class/custom/custom_host.h index 2bf3a8d3c..5f9c25dda 100644 --- a/src/class/custom/custom_host.h +++ b/src/class/custom/custom_host.h @@ -73,7 +73,7 @@ tusb_error_t tusbh_custom_write(uint8_t dev_addr, uint16_t vendor_id, uint16_t p void cush_init(void); tusb_error_t cush_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; -void cush_isr(pipe_handle_t pipe_hdl, tusb_event_t event); +void cush_isr(pipe_handle_t pipe_hdl, xfer_result_t event); void cush_close(uint8_t dev_addr); #endif diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index cece06ea0..f1ecec3c7 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -510,7 +510,7 @@ bool hidd_control_request_complete(uint8_t rhport, tusb_control_request_t const return true; } -tusb_error_t hidd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes) +tusb_error_t hidd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes) { // nothing to do return TUSB_ERROR_NONE; diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h index 357c71082..7aff7f34d 100644 --- a/src/class/hid/hid_device.h +++ b/src/class/hid/hid_device.h @@ -380,7 +380,7 @@ void hidd_init(void); tusb_error_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length); bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * p_request); bool hidd_control_request_complete (uint8_t rhport, tusb_control_request_t const * p_request); -tusb_error_t hidd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes); +tusb_error_t hidd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes); void hidd_reset(uint8_t rhport); #endif diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 7129562c5..6aa0748df 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -251,7 +251,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ OSAL_SUBTASK_END } -void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) +void hidh_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) { (void) xferred_bytes; // TODO may need to use this para later diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h index 3acc05bf7..fb10a614f 100644 --- a/src/class/hid/hid_host.h +++ b/src/class/hid/hid_host.h @@ -93,14 +93,14 @@ tusb_error_t tuh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) /*A //------------- Application Callback -------------// /** \brief Callback function that is invoked when an transferring event occurred * \param[in] dev_addr Address of device - * \param[in] event an value from \ref tusb_event_t + * \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. * \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, tusb_event_t event); +void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event); /** \brief Callback function that will be invoked when a device with Keyboard interface is mounted * \param[in] dev_addr Address of newly mounted device @@ -158,14 +158,14 @@ tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATTR_ //------------- Application Callback -------------// /** \brief Callback function that is invoked when an transferring event occurred * \param[in] dev_addr Address of device - * \param[in] event an value from \ref tusb_event_t + * \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. * \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, tusb_event_t event); +void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event); /** \brief Callback function that will be invoked when a device with Mouse interface is mounted * \param[in] dev_addr Address of newly mounted device @@ -199,7 +199,7 @@ tusb_interface_status_t tuh_hid_generic_get_status(uint8_t dev_addr) ATTR_WARN_U tusb_interface_status_t tuh_hid_generic_set_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT; //------------- Application Callback -------------// -void tuh_hid_generic_isr(uint8_t dev_addr, tusb_event_t event); +void tuh_hid_generic_isr(uint8_t dev_addr, xfer_result_t event); /** @} */ // Generic_Host /** @} */ // ClassDriver_HID_Generic @@ -217,7 +217,7 @@ typedef struct { void hidh_init(void); tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; -void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes); +void hidh_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes); void hidh_close(uint8_t dev_addr); #endif diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index 78e6d0a6b..1f4252f22 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -324,7 +324,7 @@ int32_t proc_builtin_scsi(msc_cbw_t const * p_cbw, uint8_t* buffer, uint32_t buf return ret; } -tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, uint32_t xferred_bytes) +tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes) { mscd_interface_t* p_msc = &_mscd_itf; msc_cbw_t const * p_cbw = &p_msc->cbw; @@ -337,7 +337,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u // Complete IN while waiting for CMD is usually Status of previous SCSI op, ignore it if(ep_addr != p_msc->ep_out) return TUSB_ERROR_NONE; - TU_ASSERT( event == DCD_XFER_SUCCESS && + TU_ASSERT( ((uint8_t) event) == DCD_XFER_SUCCESS && xferred_bytes == sizeof(msc_cbw_t) && p_cbw->signature == MSC_CBW_SIGNATURE, TUSB_ERROR_INVALID_PARA ); p_csw->signature = MSC_CSW_SIGNATURE; diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h index c1c51255a..c4476f56f 100644 --- a/src/class/msc/msc_device.h +++ b/src/class/msc/msc_device.h @@ -180,7 +180,7 @@ void mscd_init(void); tusb_error_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length); bool mscd_control_request(uint8_t rhport, tusb_control_request_t const * p_request); bool mscd_control_request_complete (uint8_t rhport, tusb_control_request_t const * p_request); -tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, tusb_event_t event, uint32_t xferred_bytes); +tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t edpt_addr, xfer_result_t event, uint32_t xferred_bytes); void mscd_reset(uint8_t rhport); #endif diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index bd3e92de1..baef7ff44 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -397,7 +397,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_ OSAL_SUBTASK_END } -void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) +void msch_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) { if ( pipehandle_is_equal(pipe_hdl, msch_data[pipe_hdl.dev_addr-1].bulk_in) ) { diff --git a/src/class/msc/msc_host.h b/src/class/msc/msc_host.h index 6d95cfe34..0afe5c515 100644 --- a/src/class/msc/msc_host.h +++ b/src/class/msc/msc_host.h @@ -171,7 +171,7 @@ void tuh_msc_unmounted_cb(uint8_t dev_addr); /** \brief Callback function that is invoked when an transferring event occurred * \param[in] dev_addr Address of device - * \param[in] event an value from \ref tusb_event_t + * \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. @@ -179,7 +179,7 @@ void tuh_msc_unmounted_cb(uint8_t dev_addr); * - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device. * \note */ -void tuh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes); +void tuh_msc_isr(uint8_t dev_addr, xfer_result_t event, uint32_t xferred_bytes); //--------------------------------------------------------------------+ @@ -205,7 +205,7 @@ typedef struct { void msch_init(void); tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; -void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes); +void msch_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes); void msch_close(uint8_t dev_addr); #endif diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h index 32632cd90..7b5268d4f 100644 --- a/src/common/tusb_types.h +++ b/src/common/tusb_types.h @@ -197,11 +197,10 @@ typedef enum typedef enum { - TUSB_EVENT_NONE = 0, TUSB_EVENT_XFER_COMPLETE, TUSB_EVENT_XFER_ERROR, TUSB_EVENT_XFER_STALLED, -}tusb_event_t; +}xfer_result_t; enum { diff --git a/src/device/usbd.c b/src/device/usbd.c index f39605987..710eba553 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -92,7 +92,7 @@ typedef struct { tusb_error_t (* open ) (uint8_t rhport, tusb_desc_interface_t const * desc_intf, uint16_t* p_length); bool (* control_request ) (uint8_t rhport, tusb_control_request_t const * request); bool (* control_request_complete ) (uint8_t rhport, tusb_control_request_t const * request); - tusb_error_t (* xfer_cb ) (uint8_t rhport, uint8_t ep_addr, tusb_event_t, uint32_t); + tusb_error_t (* xfer_cb ) (uint8_t rhport, uint8_t ep_addr, xfer_result_t, uint32_t); void (* sof ) (uint8_t rhport); void (* reset ) (uint8_t); } usbd_class_driver_t; @@ -174,7 +174,7 @@ static bool process_set_config(uint8_t rhport, uint8_t config_number); static void const* get_descriptor(tusb_control_request_t const * p_request, uint16_t* desc_len); void usbd_control_reset (uint8_t rhport); -bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, tusb_event_t event, uint32_t xferred_bytes); +bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); void usbd_control_set_complete_callback( bool (*fp) (uint8_t, tusb_control_request_t const * ) ); //--------------------------------------------------------------------+ diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c index 33de6d064..31d74edf0 100644 --- a/src/device/usbd_control.c +++ b/src/device/usbd_control.c @@ -126,7 +126,7 @@ bool usbd_control_xfer(uint8_t rhport, tusb_control_request_t const * request, v } // callback when a transaction complete on DATA stage of control endpoint -bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, tusb_event_t event, uint32_t xferred_bytes) +bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes) { if ( _control_state.request.bmRequestType_bit.direction == TUSB_DIR_OUT ) { diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c index b3d897537..2fc99ffcd 100644 --- a/src/host/ehci/ehci.c +++ b/src/host/ehci/ehci.c @@ -638,7 +638,7 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd) qhd_has_xact_error(p_qhd) ) { // current qhd has error in transaction tusb_xfer_type_t const xfer_type = qhd_get_xfer_type(p_qhd); - tusb_event_t error_event; + 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; diff --git a/src/host/hub.c b/src/host/hub.c index e4c08c9d1..9635bcc0b 100644 --- a/src/host/hub.c +++ b/src/host/hub.c @@ -209,7 +209,7 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_i } // is the response of interrupt endpoint polling -void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes) +void hub_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes) { (void) xferred_bytes; // TODO can be more than 1 for hub with lots of ports diff --git a/src/host/hub.h b/src/host/hub.h index 67c02f2e3..9376a2698 100644 --- a/src/host/hub.h +++ b/src/host/hub.h @@ -196,7 +196,7 @@ tusb_error_t hub_status_pipe_queue(uint8_t dev_addr); void hub_init(void); tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; -void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes); +void hub_isr(pipe_handle_t pipe_hdl, xfer_result_t event, uint32_t xferred_bytes); void hub_close(uint8_t dev_addr); #endif diff --git a/src/host/ohci/ohci.c b/src/host/ohci/ohci.c index f058f8348..58738a236 100644 --- a/src/host/ohci/ohci.c +++ b/src/host/ohci/ohci.c @@ -617,7 +617,7 @@ 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; - tusb_event_t const event = (p_qtd->condition_code == OHCI_CCODE_NO_ERROR) ? TUSB_EVENT_XFER_COMPLETE : + 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; p_qtd->used = 0; // free TD diff --git a/src/host/usbh.c b/src/host/usbh.c index 196a45ee7..ed21bf3da 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -256,7 +256,7 @@ static inline uint8_t std_class_code_to_index(uint8_t std_class_code) // USBH-HCD ISR/Callback API //--------------------------------------------------------------------+ // interrupt caused by a TD (with IOC=1) in pipe of class class_code -void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event, uint32_t xferred_bytes) +void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, xfer_result_t event, uint32_t xferred_bytes) { uint8_t class_index = std_class_code_to_index(class_code); if (TUSB_XFER_CONTROL == pipe_hdl.xfer_type) diff --git a/src/host/usbh.h b/src/host/usbh.h index 5aaeb4186..22fdef162 100644 --- a/src/host/usbh.h +++ b/src/host/usbh.h @@ -66,7 +66,7 @@ typedef enum tusb_interface_status_{ typedef struct { void (* const init) (void); tusb_error_t (* const open_subtask)(uint8_t, tusb_desc_interface_t const *, uint16_t*); - void (* const isr) (pipe_handle_t, tusb_event_t, uint32_t); + void (* const isr) (pipe_handle_t, xfer_result_t, uint32_t); void (* const close) (uint8_t); } host_class_driver_t; //--------------------------------------------------------------------+ diff --git a/src/host/usbh_hcd.h b/src/host/usbh_hcd.h index 1c2c4ad0b..f6b72273a 100644 --- a/src/host/usbh_hcd.h +++ b/src/host/usbh_hcd.h @@ -101,7 +101,7 @@ extern usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including //--------------------------------------------------------------------+ // callback from HCD ISR //--------------------------------------------------------------------+ -void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t event, uint32_t xferred_bytes); +void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, xfer_result_t event, uint32_t xferred_bytes); void usbh_hcd_rhport_plugged_isr(uint8_t hostid); void usbh_hcd_rhport_unplugged_isr(uint8_t hostid); diff --git a/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h b/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h index b1aea64b0..1eb608b91 100644 --- a/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h +++ b/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h @@ -55,7 +55,7 @@ void tusbh_cdc_mounted_cb(uint8_t dev_addr); void tusbh_cdc_unmounted_cb(uint8_t dev_addr); -void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes); +void tusbh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes); void tusbh_cdc_rndis_mounted_cb(uint8_t dev_addr); void tusbh_cdc_rndis_unmounted_isr(uint8_t dev_addr); diff --git a/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h b/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h index 4b76bd3cd..b0945c1d1 100644 --- a/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h +++ b/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h @@ -59,11 +59,11 @@ #include "common/common.h" //------------- hidh -------------// -void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event); +void tusbh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event); void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr); void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr); -void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event); +void tusbh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event); void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr); void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr); diff --git a/tests/lpc18xx_43xx/test/host/msc/msch_callback.h b/tests/lpc18xx_43xx/test/host/msc/msch_callback.h index 26b301a00..275245bec 100644 --- a/tests/lpc18xx_43xx/test/host/msc/msch_callback.h +++ b/tests/lpc18xx_43xx/test/host/msc/msch_callback.h @@ -54,7 +54,7 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr); void tusbh_msc_unmounted_cb(uint8_t dev_addr); -void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes); +void tusbh_msc_isr(uint8_t dev_addr, xfer_result_t event, uint32_t xferred_bytes); #ifdef __cplusplus -- cgit v1.3.1 From f196b24dce1531eae8e049bbe35df79996fe4155 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 23 Nov 2018 15:22:46 +0700 Subject: rename DCD_XFER_SUCCESS to XFER_RESULT_SUCCESS --- src/class/msc/msc_device.c | 8 ++++---- src/device/dcd.h | 7 ------- src/device/usbd.c | 2 +- src/portable/microchip/samd21/dcd_samd21.c | 4 ++-- src/portable/microchip/samd51/dcd_samd51.c | 2 +- src/portable/nordic/nrf5x/dcd_nrf5x.c | 6 +++--- src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c | 8 ++++---- 7 files changed, 15 insertions(+), 22 deletions(-) (limited to 'src/device') diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index 1f4252f22..88f8da6db 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -337,7 +337,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, // Complete IN while waiting for CMD is usually Status of previous SCSI op, ignore it if(ep_addr != p_msc->ep_out) return TUSB_ERROR_NONE; - TU_ASSERT( ((uint8_t) event) == DCD_XFER_SUCCESS && + TU_ASSERT( event == XFER_RESULT_SUCCESS && xferred_bytes == sizeof(msc_cbw_t) && p_cbw->signature == MSC_CBW_SIGNATURE, TUSB_ERROR_INVALID_PARA ); p_csw->signature = MSC_CSW_SIGNATURE; @@ -467,7 +467,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, } // simulate an transfer complete with adjusted parameters --> this driver callback will fired again - dcd_event_xfer_complete(rhport, p_msc->ep_out, xferred_bytes-nbytes, DCD_XFER_SUCCESS, false); + dcd_event_xfer_complete(rhport, p_msc->ep_out, xferred_bytes-nbytes, XFER_RESULT_SUCCESS, false); return TUSB_ERROR_NONE; // skip the rest } @@ -516,7 +516,7 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, if ( dcd_edpt_stalled(rhport, p_msc->ep_in) || dcd_edpt_stalled(rhport, p_msc->ep_out) ) { // simulate an transfer complete with adjusted parameters --> this driver callback will fired again - dcd_event_xfer_complete(rhport, p_msc->ep_out, 0, DCD_XFER_SUCCESS, false); + dcd_event_xfer_complete(rhport, p_msc->ep_out, 0, XFER_RESULT_SUCCESS, false); } else { @@ -578,7 +578,7 @@ static void proc_read10_cmd(uint8_t rhport, mscd_interface_t* p_msc) else if ( nbytes == 0 ) { // zero means not ready -> simulate an transfer complete so that this driver callback will fired again - dcd_event_xfer_complete(rhport, p_msc->ep_in, 0, DCD_XFER_SUCCESS, false); + dcd_event_xfer_complete(rhport, p_msc->ep_in, 0, XFER_RESULT_SUCCESS, false); } else { diff --git a/src/device/dcd.h b/src/device/dcd.h index f07bda2d3..db84df839 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -49,13 +49,6 @@ extern "C" { #endif -enum -{ - DCD_XFER_SUCCESS = 0, - DCD_XFER_FAILED, - DCD_XFER_STALLED -}; - typedef enum { DCD_EVENT_BUS_RESET = 1, diff --git a/src/device/usbd.c b/src/device/usbd.c index 710eba553..8c7e588e0 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -581,7 +581,7 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr) if ( 0 == edpt_number(event->xfer_complete.ep_addr) && event->xfer_complete.len == 0) break; osal_queue_send(_usbd_q, event, in_isr); - TU_ASSERT(event->xfer_complete.result == DCD_XFER_SUCCESS,); + TU_ASSERT(event->xfer_complete.result == XFER_RESULT_SUCCESS,); break; default: break; diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c index b31db547d..c6101f312 100644 --- a/src/portable/microchip/samd21/dcd_samd21.c +++ b/src/portable/microchip/samd21/dcd_samd21.c @@ -275,7 +275,7 @@ void maybe_transfer_complete(void) { total_transfer_size = bank->PCKSIZE.bit.BYTE_COUNT; uint8_t ep_addr = epnum | TUSB_DIR_IN_MASK; - dcd_event_xfer_complete(0, ep_addr, total_transfer_size, DCD_XFER_SUCCESS, true); + dcd_event_xfer_complete(0, ep_addr, total_transfer_size, XFER_RESULT_SUCCESS, true); } // Handle OUT completions @@ -286,7 +286,7 @@ void maybe_transfer_complete(void) { total_transfer_size = bank->PCKSIZE.bit.BYTE_COUNT; uint8_t ep_addr = epnum; - dcd_event_xfer_complete(0, ep_addr, total_transfer_size, DCD_XFER_SUCCESS, true); + dcd_event_xfer_complete(0, ep_addr, total_transfer_size, XFER_RESULT_SUCCESS, true); } // just finished status stage (total size = 0), prepare for next setup packet diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c index 6fff12ba7..6e8053e59 100644 --- a/src/portable/microchip/samd51/dcd_samd51.c +++ b/src/portable/microchip/samd51/dcd_samd51.c @@ -304,7 +304,7 @@ void transfer_complete(uint8_t direction) { if (direction == TUSB_DIR_IN) { ep_addr |= TUSB_DIR_IN_MASK; } - dcd_event_xfer_complete(0, ep_addr, total_transfer_size, DCD_XFER_SUCCESS, true); + dcd_event_xfer_complete(0, ep_addr, total_transfer_size, XFER_RESULT_SUCCESS, true); // just finished status stage (total size = 0), prepare for next setup packet if (epnum == 0 && total_transfer_size == 0) { diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c index 816ff62ae..4fb88689c 100644 --- a/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -261,7 +261,7 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t edpt_dma_end(); // The nRF doesn't interrupt on status transmit so we queue up a success response. - dcd_event_xfer_complete(0, ep_addr, 0, DCD_XFER_SUCCESS, false); + dcd_event_xfer_complete(0, ep_addr, 0, XFER_RESULT_SUCCESS, false); } else if ( dir == TUSB_DIR_OUT ) { @@ -459,7 +459,7 @@ void USBD_IRQHandler(void) xfer->total_len = xfer->actual_len; // BULK/INT OUT complete - dcd_event_xfer_complete(0, epnum, xfer->actual_len, DCD_XFER_SUCCESS, true); + dcd_event_xfer_complete(0, epnum, xfer->actual_len, XFER_RESULT_SUCCESS, true); } } @@ -494,7 +494,7 @@ void USBD_IRQHandler(void) } else { // Bulk/Int IN complete - dcd_event_xfer_complete(0, epnum | TUSB_DIR_IN_MASK, xfer->actual_len, DCD_XFER_SUCCESS, true); + dcd_event_xfer_complete(0, epnum | TUSB_DIR_IN_MASK, xfer->actual_len, XFER_RESULT_SUCCESS, true); } } } diff --git a/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c b/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c index 274ebc032..2f83f4203 100644 --- a/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c +++ b/src/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c @@ -311,9 +311,9 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t p_qhd->qtd_overlay.next = (uint32_t) p_qtd; // link qtd to qhd // start transfer - LPC_USB[rhport]->ENDPTPRIME = BIT_( ep_idx2bit(ep_idx) ) ; + LPC_USB[rhport]->ENDPTPRIME = BIT_( ep_idx2bit(ep_idx) ) ; - return true; + return true; } @@ -390,8 +390,8 @@ void hal_dcd_isr(uint8_t rhport) dcd_qhd_t * p_qhd = &dcd_data_ptr[rhport]->qhd[ep_idx]; dcd_qtd_t * p_qtd = &dcd_data_ptr[rhport]->qtd[ep_idx]; - uint8_t result = p_qtd->halted ? DCD_XFER_STALLED : - ( p_qtd->xact_err ||p_qtd->buffer_err ) ? DCD_XFER_FAILED : DCD_XFER_SUCCESS; + uint8_t result = p_qtd->halted ? XFER_RESULT_STALLED : + ( p_qtd->xact_err ||p_qtd->buffer_err ) ? XFER_RESULT_FAILED : XFER_RESULT_SUCCESS; uint8_t ep_addr = (ep_idx/2) | ( (ep_idx & 0x01) ? TUSB_DIR_IN_MASK : 0 ); dcd_event_xfer_complete(rhport, ep_addr, p_qtd->expected_bytes - p_qtd->total_bytes, result, true); // only number of bytes in the IOC qtd -- cgit v1.3.1