mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
add acm_capability saving to host data & its test
This commit is contained in:
parent
e94ce81b04
commit
e1883fcd26
@ -144,6 +144,17 @@ void test_cdch_open_interface_number_check(void)
|
||||
|
||||
}
|
||||
|
||||
void test_cdch_open_acm_capacity_check(void)
|
||||
{
|
||||
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
||||
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
||||
|
||||
//------------- CUT -------------//
|
||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||
|
||||
TEST_ASSERT_EQUAL_MEMORY(&cdc_config_descriptor.cdc_acm.bmCapabilities, &p_cdc->acm_capability, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -264,17 +264,21 @@ typedef ATTR_PACKED_STRUCT(struct) {
|
||||
uint8_t bDataInterface;
|
||||
}tusb_cdc_func_call_management_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t support_comm_request : 1; ///< Device supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature.
|
||||
uint8_t support_line_request : 1; ///< Device supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State.
|
||||
uint8_t support_send_break : 1; ///< Device supports the request Send_Break
|
||||
uint8_t support_notification_network_connection : 1; ///< Device supports the notification Network_Connection.
|
||||
uint8_t : 0;
|
||||
}cdc_fun_acm_capability_t;
|
||||
|
||||
STATIC_ASSERT(sizeof(cdc_fun_acm_capability_t) == 1, "mostly problem with compiler");
|
||||
|
||||
typedef ATTR_PACKED_STRUCT(struct) {
|
||||
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_
|
||||
struct {
|
||||
uint8_t support_comm_request : 1; ///< Device supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature.
|
||||
uint8_t support_line_request : 1; ///< Device supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State.
|
||||
uint8_t support_send_break : 1; ///< Device supports the request Send_Break
|
||||
uint8_t support_notification_network_connection : 1; ///< Device supports the notification Network_Connection.
|
||||
uint8_t : 0;
|
||||
} bmCapabilities;
|
||||
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_
|
||||
cdc_fun_acm_capability_t bmCapabilities ;
|
||||
}tusb_cdc_func_abstract_control_management_t;
|
||||
|
||||
typedef ATTR_PACKED_STRUCT(struct) {
|
||||
@ -314,16 +318,22 @@ typedef ATTR_PACKED_STRUCT(struct) {
|
||||
uint8_t bDescriptorType ; ///< Descriptor Type, must be Class-Specific
|
||||
uint8_t bDescriptorSubType ; ///< Descriptor SubType one of above CDC_FUCN_DESC_
|
||||
struct {
|
||||
uint32_t interrupted_dialtone : 1; ///< 0 – Reports only dialtone (does not differentiate between normal and interrupted dialtone). 1 – Reports interrupted dialtone in addition to normal dialtone
|
||||
uint32_t ringback_busy_fastbusy : 1; ///< 0 – Reports only dialing state. 1 – Reports ringback, busy, and fast busy states.
|
||||
uint32_t caller_id : 1; ///< 0 – Does not report caller ID. 1 – Reports caller ID information.
|
||||
uint32_t incoming_distinctive : 1; ///< 0 – Reports only incoming ringing. 1 – Reports incoming distinctive ringing patterns.
|
||||
uint32_t dual_tone_multi_freq : 1; ///< 0 – Cannot report dual tone multi-frequency (DTMF) digits input remotely over the telephone line. 1 – Can report DTMF digits input remotely over the telephone line.
|
||||
uint32_t line_state_change : 1; ///< 0 – Does not support line state change notification. 1 – Does support line state change notificatio
|
||||
uint32_t interrupted_dialtone : 1; ///< 0 : Reports only dialtone (does not differentiate between normal and interrupted dialtone). 1 : Reports interrupted dialtone in addition to normal dialtone
|
||||
uint32_t ringback_busy_fastbusy : 1; ///< 0 : Reports only dialing state. 1 : Reports ringback, busy, and fast busy states.
|
||||
uint32_t caller_id : 1; ///< 0 : Does not report caller ID. 1 : Reports caller ID information.
|
||||
uint32_t incoming_distinctive : 1; ///< 0 : Reports only incoming ringing. 1 : Reports incoming distinctive ringing patterns.
|
||||
uint32_t dual_tone_multi_freq : 1; ///< 0 : Cannot report dual tone multi-frequency (DTMF) digits input remotely over the telephone line. 1 : Can report DTMF digits input remotely over the telephone line.
|
||||
uint32_t line_state_change : 1; ///< 0 : Does not support line state change notification. 1 : Does support line state change notification
|
||||
uint32_t : 0;
|
||||
} bmCapabilities;
|
||||
}tusb_cdc_func_telephone_call_state_reporting_capabilities_t;
|
||||
|
||||
static inline uint8_t functional_desc_typeof(uint8_t const * p_desc) ATTR_PURE ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t functional_desc_typeof(uint8_t const * p_desc)
|
||||
{
|
||||
return p_desc[2];
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -89,6 +89,11 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
||||
|
||||
while( TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC == p_desc[DESCRIPTOR_OFFSET_TYPE] )
|
||||
{ // Communication Functional Descriptors
|
||||
if ( CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT == functional_desc_typeof(p_desc) )
|
||||
{ // save ACM bmCapabilities
|
||||
p_cdc->acm_capability = ((tusb_cdc_func_abstract_control_management_t const *) p_desc)->bmCapabilities;
|
||||
}
|
||||
|
||||
(*p_length) += p_desc[DESCRIPTOR_OFFSET_LENGTH];
|
||||
p_desc = descriptor_next(p_desc);
|
||||
}
|
||||
|
@ -66,6 +66,8 @@
|
||||
typedef struct {
|
||||
uint8_t interface_number;
|
||||
uint8_t interface_protocol;
|
||||
cdc_fun_acm_capability_t acm_capability;
|
||||
|
||||
pipe_handle_t pipe_notification, pipe_out, pipe_in;
|
||||
|
||||
} cdch_data_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user