summaryrefslogtreecommitdiff
path: root/src/class/cdc
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-07-01 22:38:06 +0700
committerhathach <[email protected]>2019-07-01 22:38:06 +0700
commit6991b28532605ceae685cb8be1fee904e09f12fe (patch)
tree2d383bce7e232d56ee072f5fccdf2b688228da8d /src/class/cdc
parent991aaf0158fcb02f7951a895a0caa6637e84fd8a (diff)
improving midi support, adding midi exmaple
rename TUSB_DESC_CLASS_SPECIFIC to TUSB_DESC_CS_INTERFACE
Diffstat (limited to 'src/class/cdc')
-rw-r--r--src/class/cdc/cdc.h20
-rw-r--r--src/class/cdc/cdc_device.c2
-rw-r--r--src/class/cdc/cdc_host.c2
3 files changed, 14 insertions, 10 deletions
diff --git a/src/class/cdc/cdc.h b/src/class/cdc/cdc.h
index 2e865bdbb..9cc8b82e3 100644
--- a/src/class/cdc/cdc.h
+++ b/src/class/cdc/cdc.h
@@ -41,7 +41,7 @@
/** \defgroup ClassDriver_CDC_Common Common Definitions
* @{ */
-
+// TODO remove
/// CDC Pipe ID, used to indicate which pipe the API is addressing to (Notification, Out, In)
typedef enum
{
@@ -52,8 +52,9 @@ typedef enum
}cdc_pipeid_t;
//--------------------------------------------------------------------+
-// CDC COMMUNICATION INTERFACE CLASS
+// CDC Communication Interface Class
//--------------------------------------------------------------------+
+
/// Communication Interface Subclass Codes
typedef enum
{
@@ -117,7 +118,7 @@ typedef enum
}cdc_func_desc_type_t;
//--------------------------------------------------------------------+
-// CDC DATA INTERFACE CLASS
+// CDC Data Interface Class
//--------------------------------------------------------------------+
// SUBCLASS code of Data Interface is not used and should/must be zero
@@ -138,8 +139,9 @@ typedef enum{
}cdc_data_protocol_type_t;
//--------------------------------------------------------------------+
-// MANAGEMENT ELEMENT REQUEST (CONTROL ENDPOINT)
+// Management Element Request (Control Endpoint)
//--------------------------------------------------------------------+
+
/// Communication Interface Management Element Request Codes
typedef enum
{
@@ -189,8 +191,9 @@ typedef enum
}cdc_management_request_t;
//--------------------------------------------------------------------+
-// MANAGEMENT ELEMENENT NOTIFICATION (NOTIFICATION ENDPOINT)
+// Management Elemenent Notification (Notification Endpoint)
//--------------------------------------------------------------------+
+
/// Communication Interface Management Element Notification Codes
typedef enum
{
@@ -209,14 +212,15 @@ typedef enum
}cdc_notification_request_t;
//--------------------------------------------------------------------+
-// FUNCTIONAL DESCRIPTOR (COMMUNICATION INTERFACE)
+// Class Specific Functional Descriptor (Communication Interface)
//--------------------------------------------------------------------+
+
/// Header Functional Descriptor (Communication Interface)
typedef struct TU_ATTR_PACKED
{
uint8_t bLength ; ///< Size of this descriptor in bytes.
uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific
- uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_
+ uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUNC_DESC_
uint16_t bcdCDC ; ///< CDC release number in Binary-Coded Decimal
}cdc_desc_func_header_t;
@@ -246,7 +250,7 @@ typedef struct TU_ATTR_PACKED
uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific
uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_
uint8_t iCountryCodeRelDate ; ///< Index of a string giving the release date for the implemented ISO 3166 Country Codes.
- uint16_t wCountryCode[] ; ///< Country code in the format as defined in [ISO3166], release date as specified inoffset 3 for the first supported country.
+ uint16_t wCountryCode ; ///< Country code in the format as defined in [ISO3166], release date as specified inoffset 3 for the first supported country.
}cdc_desc_func_country_selection_t;
#define cdc_desc_func_country_selection_n_t(no_country) \
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index 0a41147c9..d9e128307 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -265,7 +265,7 @@ bool cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t
(*p_length) = sizeof(tusb_desc_interface_t);
// Communication Functional Descriptors
- while ( TUSB_DESC_CLASS_SPECIFIC == tu_desc_type(p_desc) )
+ while ( TUSB_DESC_CS_INTERFACE == tu_desc_type(p_desc) )
{
(*p_length) += tu_desc_len(p_desc);
p_desc = tu_desc_next(p_desc);
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index b64d4a1fe..6a6f508b3 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -142,7 +142,7 @@ bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
(*p_length) = sizeof(tusb_desc_interface_t);
// Communication Functional Descriptors
- while( TUSB_DESC_CLASS_SPECIFIC == p_desc[DESC_OFFSET_TYPE] )
+ while( TUSB_DESC_CS_INTERFACE == p_desc[DESC_OFFSET_TYPE] )
{
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == cdc_functional_desc_typeof(p_desc) )
{