mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-23 09:41:19 +00:00
add tusbh_cdc_serial_is_mounted API
test for cdch close driver
This commit is contained in:
parent
b04b145965
commit
7e5c6ded2d
@ -155,6 +155,39 @@ void test_cdch_open_acm_capacity_check(void)
|
|||||||
TEST_ASSERT_EQUAL_MEMORY(&cdc_config_descriptor.cdc_acm.bmCapabilities, &p_cdc->acm_capability, 1);
|
TEST_ASSERT_EQUAL_MEMORY(&cdc_config_descriptor.cdc_acm.bmCapabilities, &p_cdc->acm_capability, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_cdch_close_device(void)
|
||||||
|
{
|
||||||
|
pipe_handle_t pipe_notification = {
|
||||||
|
.dev_addr = 1,
|
||||||
|
.xfer_type = TUSB_XFER_INTERRUPT
|
||||||
|
};
|
||||||
|
|
||||||
|
pipe_handle_t pipe_out = {
|
||||||
|
.dev_addr = 1,
|
||||||
|
.xfer_type = TUSB_XFER_BULK,
|
||||||
|
.index = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
pipe_handle_t pipe_int = {
|
||||||
|
.dev_addr = 1,
|
||||||
|
.xfer_type = TUSB_XFER_BULK,
|
||||||
|
.index = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
|
||||||
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, pipe_out);
|
||||||
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_int);
|
||||||
|
|
||||||
|
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||||
|
|
||||||
|
hcd_pipe_close_ExpectAndReturn(pipe_notification , TUSB_ERROR_NONE);
|
||||||
|
hcd_pipe_close_ExpectAndReturn(pipe_int , TUSB_ERROR_NONE);
|
||||||
|
hcd_pipe_close_ExpectAndReturn(pipe_out , TUSB_ERROR_NONE);
|
||||||
|
|
||||||
|
//------------- CUT -------------//
|
||||||
|
cdch_close(dev_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +57,18 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX];
|
/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX];
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// APPLICATION API (parameter validation needed)
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr)
|
||||||
|
{
|
||||||
|
// TODO consider all AT Command as serial candidate
|
||||||
|
return
|
||||||
|
(tusbh_device_get_mounted_class_flag(dev_addr) & BIT_(TUSB_CLASS_CDC) ) &&
|
||||||
|
(CDC_COMM_PROTOCOL_ATCOMMAND <= cdch_data[dev_addr-1].interface_protocol) &&
|
||||||
|
(cdch_data[dev_addr-1].interface_protocol <= CDC_COMM_PROTOCOL_ATCOMMAND_CDMA);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// USBH-CLASS DRIVER API
|
// USBH-CLASS DRIVER API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -57,11 +57,11 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION PUBLIC API
|
// APPLICATION PUBLIC API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
bool tusbh_cdc_acm_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
//bool tusbh_cdc_acm_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||||
bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
bool tusbh_cdc_serial_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||||
bool tusbh_cdc_rndis_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
bool tusbh_cdc_rndis_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
tusb_interface_status_t tusbh_cdc_send(void const * p_data, uint32_t length);
|
tusb_interface_status_t tusbh_cdc_send(void const * p_data, uint32_t length, bool is_notify);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// USBH-CLASS API
|
// USBH-CLASS API
|
||||||
|
@ -964,7 +964,7 @@ static ehci_link_t* list_find_previous_item(ehci_link_t* p_head, ehci_link_t* p_
|
|||||||
uint32_t max_loop = 0;
|
uint32_t max_loop = 0;
|
||||||
while( (align32(p_prev->address) != (uint32_t) p_head) && // not loop around
|
while( (align32(p_prev->address) != (uint32_t) p_head) && // not loop around
|
||||||
(align32(p_prev->address) != (uint32_t) p_current) && // not found yet
|
(align32(p_prev->address) != (uint32_t) p_current) && // not found yet
|
||||||
!p_prev->terminate && // not advancable
|
!p_prev->terminate && // not advanceable
|
||||||
max_loop < EHCI_MAX_QHD)
|
max_loop < EHCI_MAX_QHD)
|
||||||
{
|
{
|
||||||
p_prev = list_next(p_prev);
|
p_prev = list_next(p_prev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user