summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-11-21 13:20:46 +0700
committerhathach <[email protected]>2013-11-21 13:20:46 +0700
commitc461c72ac2ddf6f89ba533e98f34bba72f8c1470 (patch)
tree7cf88a0b5248e887f549c4fd710aa2af62c77c9a /tinyusb
parent6887e5e642c71666d622d28b52e1d32fea67982c (diff)
clean up
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/class/cdc_device.c23
-rw-r--r--tinyusb/class/cdc_device.h2
-rw-r--r--tinyusb/class/hid_device.h16
-rw-r--r--tinyusb/class/msc_device.h8
-rw-r--r--tinyusb/common/errors.h3
-rw-r--r--tinyusb/common/tusb_types.h2
6 files changed, 8 insertions, 46 deletions
diff --git a/tinyusb/class/cdc_device.c b/tinyusb/class/cdc_device.c
index 29f38c3f5..64b3e1227 100644
--- a/tinyusb/class/cdc_device.c
+++ b/tinyusb/class/cdc_device.c
@@ -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)
diff --git a/tinyusb/class/cdc_device.h b/tinyusb/class/cdc_device.h
index 03ad676f4..b5135a23c 100644
--- a/tinyusb/class/cdc_device.h
+++ b/tinyusb/class/cdc_device.h
@@ -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);
diff --git a/tinyusb/class/hid_device.h b/tinyusb/class/hid_device.h
index ed50c8e75..54cdd5e94 100644
--- a/tinyusb/class/hid_device.h
+++ b/tinyusb/class/hid_device.h
@@ -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
diff --git a/tinyusb/class/msc_device.h b/tinyusb/class/msc_device.h
index 5311a14f0..acbf04ea0 100644
--- a/tinyusb/class/msc_device.h
+++ b/tinyusb/class/msc_device.h
@@ -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
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index 15a0e03f6..9b47fc332 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -79,7 +79,6 @@
ENTRY(TUSB_ERROR_OSAL_SEMAPHORE_FAILED )\
ENTRY(TUSB_ERROR_OSAL_MUTEX_FAILED )\
ENTRY(TUSB_ERROR_EHCI_NOT_ENOUGH_QTD )\
- ENTRY(TUSB_ERROR_USBD_DESCRIPTOR_STRING )\
ENTRY(TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE )\
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL )\
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS )\
@@ -96,7 +95,7 @@
ENTRY(TUSB_ERROR_DCD_NOT_ENOUGH_QTD )\
ENTRY(TUSB_ERROR_DCD_OPEN_PIPE_FAILED )\
ENTRY(TUSB_ERROR_NOT_SUPPORTED_YET )\
- ENTRY(TUSB_ERROR_USBD_INTERFACE_NOT_CONFIGURED )\
+ ENTRY(TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED )\
ENTRY(TUSB_ERROR_FAILED )\
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h
index a47200522..c1bada971 100644
--- a/tinyusb/common/tusb_types.h
+++ b/tinyusb/common/tusb_types.h
@@ -194,8 +194,8 @@ enum {
typedef enum tusb_device_state_{
TUSB_DEVICE_STATE_UNPLUG = 0 ,
TUSB_DEVICE_STATE_ADDRESSED ,
-
TUSB_DEVICE_STATE_CONFIGURED ,
+ TUSB_DEVICE_STATE_SUSPENDED ,
TUSB_DEVICE_STATE_REMOVING ,
TUSB_DEVICE_STATE_SAFE_REMOVE ,