summaryrefslogtreecommitdiff
path: root/tinyusb/class/cdc_device.c
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/class/cdc_device.c
parent6887e5e642c71666d622d28b52e1d32fea67982c (diff)
clean up
Diffstat (limited to 'tinyusb/class/cdc_device.c')
-rw-r--r--tinyusb/class/cdc_device.c23
1 files changed, 2 insertions, 21 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)