mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
change class (hid/cdc) _mounted_isr to _mounted_cb
This commit is contained in:
parent
544b48183a
commit
c5afb9d50f
@ -86,7 +86,7 @@
|
|||||||
#if BOARD == 0
|
#if BOARD == 0
|
||||||
#error BOARD is not defined or supported yet
|
#error BOARD is not defined or supported yet
|
||||||
#elif BOARD == BOARD_NGX4330
|
#elif BOARD == BOARD_NGX4330
|
||||||
#include "ngx/board_ngx4330.h"`
|
#include "ngx/board_ngx4330.h"
|
||||||
#elif BOARD == BOARD_LPCXPRESSO1347
|
#elif BOARD == BOARD_LPCXPRESSO1347
|
||||||
#include "lpcxpresso/board_lpcxpresso1347.h"
|
#include "lpcxpresso/board_lpcxpresso1347.h"
|
||||||
#elif BOARD == BOARD_RF1GHZNODE
|
#elif BOARD == BOARD_RF1GHZNODE
|
||||||
|
@ -58,7 +58,7 @@ static uint8_t buffer_in[64] TUSB_CFG_ATTR_USBRAM;
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tusbh_cdc_mounted_isr(uint8_t dev_addr)
|
void tusbh_cdc_mounted_cb(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
// application set-up
|
// application set-up
|
||||||
osal_queue_flush(queue_hdl);
|
osal_queue_flush(queue_hdl);
|
||||||
|
@ -67,7 +67,7 @@ static inline void process_kbd_report(tusb_keyboard_report_t const * report);
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callback (ISR context)
|
// tinyusb callback (ISR context)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tusbh_hid_keyboard_mounted_isr(uint8_t dev_addr)
|
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
// application set-up
|
// application set-up
|
||||||
osal_queue_flush(queue_kbd_hdl);
|
osal_queue_flush(queue_kbd_hdl);
|
||||||
|
@ -67,7 +67,7 @@ static inline void process_mouse_report(tusb_mouse_report_t const * p_report);
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callback (ISR context)
|
// tinyusb callback (ISR context)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tusbh_hid_mouse_mounted_isr(uint8_t dev_addr)
|
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
// application set-up
|
// application set-up
|
||||||
osal_queue_flush(queue_mouse_hdl);
|
osal_queue_flush(queue_mouse_hdl);
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void tusbh_cdc_mounted_isr(uint8_t dev_addr);
|
void tusbh_cdc_mounted_cb(uint8_t dev_addr);
|
||||||
void tusbh_cdc_unmounted_isr(uint8_t dev_addr);
|
void tusbh_cdc_unmounted_isr(uint8_t dev_addr);
|
||||||
void tusbh_cdc_isr(uint8_t dev_addr, tusb_event_t event);
|
void tusbh_cdc_isr(uint8_t dev_addr, tusb_event_t event);
|
||||||
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
|
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
|
||||||
|
@ -128,7 +128,7 @@ void test_cdch_open_length_check(void)
|
|||||||
|
|
||||||
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
||||||
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
||||||
tusbh_cdc_mounted_isr_Expect(dev_addr);
|
tusbh_cdc_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
//------------- CUT -------------//
|
//------------- CUT -------------//
|
||||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||||
@ -140,7 +140,7 @@ void test_cdch_open_interface_number_check(void)
|
|||||||
{
|
{
|
||||||
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
||||||
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
||||||
tusbh_cdc_mounted_isr_Expect(dev_addr);
|
tusbh_cdc_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
//------------- CUT -------------//
|
//------------- CUT -------------//
|
||||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||||
@ -153,7 +153,7 @@ void test_cdch_open_acm_capacity_check(void)
|
|||||||
{
|
{
|
||||||
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
pipe_handle_t dummy_hld = { .dev_addr = 1 };
|
||||||
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
hcd_pipe_open_IgnoreAndReturn(dummy_hld);
|
||||||
tusbh_cdc_mounted_isr_Expect(dev_addr);
|
tusbh_cdc_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
//------------- CUT -------------//
|
//------------- CUT -------------//
|
||||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||||
@ -173,7 +173,7 @@ void test_cdch_close_device(void)
|
|||||||
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
|
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_out, TUSB_CLASS_CDC, pipe_out);
|
||||||
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_int);
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_int);
|
||||||
tusbh_cdc_mounted_isr_Expect(dev_addr);
|
tusbh_cdc_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@
|
|||||||
|
|
||||||
//------------- hidh -------------//
|
//------------- hidh -------------//
|
||||||
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
||||||
void tusbh_hid_keyboard_mounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
||||||
|
|
||||||
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
||||||
void tusbh_hid_mouse_mounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -145,7 +145,7 @@ void test_keyboard_open_ok(void)
|
|||||||
|
|
||||||
usbh_control_xfer_subtask_StubWithCallback(stub_set_idle_request);
|
usbh_control_xfer_subtask_StubWithCallback(stub_set_idle_request);
|
||||||
hcd_pipe_open_ExpectAndReturn(dev_addr, p_kdb_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_kdb_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
|
||||||
tusbh_hid_keyboard_mounted_isr_Expect(dev_addr);
|
tusbh_hid_keyboard_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
//------------- Code Under TEST -------------//
|
//------------- Code Under TEST -------------//
|
||||||
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, hidh_open_subtask(dev_addr, p_kbd_interface_desc, &length));
|
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, hidh_open_subtask(dev_addr, p_kbd_interface_desc, &length));
|
||||||
|
@ -134,7 +134,7 @@ void test_mouse_open_ok(void)
|
|||||||
|
|
||||||
usbh_control_xfer_subtask_StubWithCallback(stub_set_idle_request);
|
usbh_control_xfer_subtask_StubWithCallback(stub_set_idle_request);
|
||||||
hcd_pipe_open_ExpectAndReturn(dev_addr, p_mouse_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
|
hcd_pipe_open_ExpectAndReturn(dev_addr, p_mouse_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
|
||||||
tusbh_hid_mouse_mounted_isr_Expect(dev_addr);
|
tusbh_hid_mouse_mounted_cb_Expect(dev_addr);
|
||||||
|
|
||||||
//------------- Code Under TEST -------------//
|
//------------- Code Under TEST -------------//
|
||||||
TEST_ASSERT_STATUS( hidh_open_subtask(dev_addr, p_mouse_interface_desc, &length));
|
TEST_ASSERT_STATUS( hidh_open_subtask(dev_addr, p_mouse_interface_desc, &length));
|
||||||
|
@ -194,9 +194,9 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME mounted class flag is not set yet
|
// FIXME mounted class flag is not set yet
|
||||||
if (tusbh_cdc_mounted_isr)
|
if (tusbh_cdc_mounted_cb)
|
||||||
{
|
{
|
||||||
tusbh_cdc_mounted_isr(dev_addr);
|
tusbh_cdc_mounted_cb(dev_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
|
@ -69,7 +69,7 @@ tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t leng
|
|||||||
tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify);
|
tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify);
|
||||||
|
|
||||||
//------------- Application Callback -------------//
|
//------------- Application Callback -------------//
|
||||||
void tusbh_cdc_mounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_cdc_mounted_cb(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_cdc_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_cdc_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_cdc_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
void tusbh_cdc_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
||||||
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) ATTR_WEAK;
|
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes) ATTR_WEAK;
|
||||||
|
@ -257,9 +257,9 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
|
if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
|
||||||
{
|
{
|
||||||
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboard_data[dev_addr-1]) );
|
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboard_data[dev_addr-1]) );
|
||||||
if ( tusbh_hid_keyboard_mounted_isr )
|
if ( tusbh_hid_keyboard_mounted_cb )
|
||||||
{
|
{
|
||||||
tusbh_hid_keyboard_mounted_isr(dev_addr);
|
tusbh_hid_keyboard_mounted_cb(dev_addr);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@ -268,9 +268,9 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
|
if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
|
||||||
{
|
{
|
||||||
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouse_data[dev_addr-1]) );
|
SUBTASK_ASSERT_STATUS ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouse_data[dev_addr-1]) );
|
||||||
if (tusbh_hid_mouse_mounted_isr)
|
if (tusbh_hid_mouse_mounted_cb)
|
||||||
{
|
{
|
||||||
tusbh_hid_mouse_mounted_isr(dev_addr);
|
tusbh_hid_mouse_mounted_cb(dev_addr);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,7 +64,7 @@ tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void * report) ATT
|
|||||||
tusb_interface_status_t tusbh_hid_keyboard_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
tusb_interface_status_t tusbh_hid_keyboard_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
||||||
//------------- Application Callback -------------//
|
//------------- Application Callback -------------//
|
||||||
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
||||||
void tusbh_hid_keyboard_mounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_keyboard_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -75,7 +75,7 @@ tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void* report) ATTR_WA
|
|||||||
tusb_interface_status_t tusbh_hid_mouse_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
tusb_interface_status_t tusbh_hid_mouse_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
||||||
//------------- Application Callback -------------//
|
//------------- Application Callback -------------//
|
||||||
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) ATTR_WEAK;
|
||||||
void tusbh_hid_mouse_mounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr) ATTR_WEAK;
|
||||||
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
void tusbh_hid_mouse_unmounted_isr(uint8_t dev_addr) ATTR_WEAK;
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user