clean up
This commit is contained in:
		| @@ -50,10 +50,6 @@ | ||||
| //--------------------------------------------------------------------+ | ||||
| // MACRO CONSTANT TYPEDEF | ||||
| //--------------------------------------------------------------------+ | ||||
| enum { | ||||
|   INTERFACE_INVALID_NUMBER = UINT8_MAX | ||||
| }; | ||||
|  | ||||
| ATTR_USB_MIN_ALIGNMENT | ||||
| static cdc_line_coding_t cdcd_line_coding[CONTROLLER_DEVICE_NUMBER] TUSB_CFG_ATTR_USBRAM; | ||||
|  | ||||
| @@ -69,20 +65,13 @@ typedef struct { | ||||
| //--------------------------------------------------------------------+ | ||||
| cdcd_data_t cdcd_data[CONTROLLER_DEVICE_NUMBER]; | ||||
|  | ||||
| static inline bool cdcd_is_configured(uint8_t coreid) ATTR_PURE ATTR_ALWAYS_INLINE; | ||||
| static inline bool cdcd_is_configured(uint8_t coreid) | ||||
| { | ||||
|   return cdcd_data[coreid].interface_number != INTERFACE_INVALID_NUMBER; | ||||
| } | ||||
|  | ||||
| static tusb_error_t cdcd_xfer(uint8_t coreid,  cdc_pipeid_t pipeid, void * p_buffer, uint32_t length, bool is_notify) | ||||
| { | ||||
|   ASSERT(cdcd_is_configured(coreid), TUSB_ERROR_USBD_INTERFACE_NOT_CONFIGURED); | ||||
|   ASSERT(tusbd_is_configured(coreid), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED); | ||||
|  | ||||
|   cdcd_data_t* p_cdc = &cdcd_data[coreid]; | ||||
|  | ||||
|   ASSERT_FALSE( dcd_pipe_is_busy(p_cdc->edpt_hdl[pipeid]), TUSB_ERROR_INTERFACE_IS_BUSY); | ||||
|  | ||||
|   ASSERT_FALSE ( dcd_pipe_is_busy(p_cdc->edpt_hdl[pipeid]), TUSB_ERROR_INTERFACE_IS_BUSY); | ||||
|   ASSERT_STATUS( dcd_pipe_xfer(p_cdc->edpt_hdl[pipeid], p_buffer, length, is_notify) ); | ||||
|  | ||||
|   return TUSB_ERROR_NONE; | ||||
| @@ -91,15 +80,8 @@ static tusb_error_t cdcd_xfer(uint8_t coreid,  cdc_pipeid_t pipeid, void * p_buf | ||||
| //--------------------------------------------------------------------+ | ||||
| // APPLICATION API (Parameters requires validation) | ||||
| //--------------------------------------------------------------------+ | ||||
| bool tusbd_cdc_is_configured(uint8_t coreid) | ||||
| { | ||||
|   return cdcd_is_configured(coreid); | ||||
| } | ||||
|  | ||||
| bool tusbd_cdc_is_busy(uint8_t coreid, cdc_pipeid_t pipeid) | ||||
| { | ||||
|   ASSERT(cdcd_is_configured(coreid) && (pipeid < CDC_PIPE_ERROR), false); | ||||
|  | ||||
|   return dcd_pipe_is_busy( cdcd_data[coreid].edpt_hdl[pipeid] ); | ||||
| } | ||||
|  | ||||
| @@ -198,7 +180,6 @@ void cdcd_close(uint8_t coreid) | ||||
| { | ||||
|   // no need to close opened pipe, dcd bus reset will put controller's endpoints to default state | ||||
|   memclr_(&cdcd_data[coreid], sizeof(cdcd_data_t)); | ||||
|   cdcd_data[coreid].interface_number = INTERFACE_INVALID_NUMBER; | ||||
| } | ||||
|  | ||||
| tusb_error_t cdcd_control_request(uint8_t coreid, tusb_control_request_t const * p_request) | ||||
|   | ||||
| @@ -57,7 +57,7 @@ | ||||
| //--------------------------------------------------------------------+ | ||||
| // APPLICATION API | ||||
| //--------------------------------------------------------------------+ | ||||
| bool tusbd_cdc_is_configured(uint8_t coreid); | ||||
| //bool tusbd_cdc_is_configured(uint8_t coreid); | ||||
| bool tusbd_cdc_is_busy(uint8_t coreid, cdc_pipeid_t pipeid)  ATTR_PURE ATTR_WARN_UNUSED_RESULT; | ||||
|  | ||||
| tusb_error_t tusbd_cdc_send(uint8_t coreid, void * p_data, uint32_t length, bool is_notify); | ||||
|   | ||||
| @@ -56,13 +56,7 @@ | ||||
| /** \defgroup Keyboard_Device Device | ||||
|  *  @{ */ | ||||
|  | ||||
| /** \brief      Check if the interface is configured and ready to use | ||||
|  * \param[in]   coreid USB Controller ID | ||||
|  * \retval      true if the interface is configured | ||||
|  * \retval      false if the interface is not configured (e.g device is not attached) | ||||
|  * \note        This function should be call frequently or before any xfer attempt to check if device is still attached | ||||
|  */ | ||||
| bool tusbd_hid_keyboard_is_configured(uint8_t coreid); | ||||
| //bool tusbd_hid_keyboard_is_configured(uint8_t coreid); | ||||
|  | ||||
| /** \brief      Check if the interface is currently busy or not | ||||
|  * \param[in]   coreid USB Controller ID | ||||
| @@ -112,13 +106,7 @@ void tusbd_hid_keyboard_unmounted_cb(uint8_t coreid); | ||||
| /** \defgroup Mouse_Device Device | ||||
|  *  @{ */ | ||||
|  | ||||
| /** \brief      Check if the interface is configured and ready to use | ||||
|  * \param[in]   coreid USB Controller ID | ||||
|  * \retval      true if the interface is configured | ||||
|  * \retval      false if the interface is not configured (e.g device is not attached) | ||||
|  * \note        This function should be call frequently or before any xfer attempt to check if device is still attached | ||||
|  */ | ||||
| bool tusbd_hid_mouse_is_configured(uint8_t coreid); | ||||
| //bool tusbd_hid_mouse_is_configured(uint8_t coreid); | ||||
|  | ||||
| /** \brief      Check if the interface is currently busy or not | ||||
|  * \param[in]   coreid USB Controller ID | ||||
|   | ||||
| @@ -50,13 +50,7 @@ | ||||
| //--------------------------------------------------------------------+ | ||||
| // APPLICATION API | ||||
| //--------------------------------------------------------------------+ | ||||
| /** \brief      Check if the interface is configured and ready to use | ||||
|  * \param[in]   coreid USB Controller ID | ||||
|  * \retval      true if the interface is configured | ||||
|  * \retval      false if the interface is not configured (e.g device is not attached) | ||||
|  * \note        This function should be call frequently or before any xfer attempt to check if device is still attached | ||||
|  */ | ||||
| bool tusbd_msc_is_configured(uint8_t coreid); | ||||
| //bool tusbd_msc_is_configured(uint8_t coreid); | ||||
|  | ||||
| //--------------------------------------------------------------------+ | ||||
| // APPLICATION CALLBACK API | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hathach
					hathach