add tud_mount_cb, tud_umount_cb
remove device class/interface callback
This commit is contained in:
@@ -64,14 +64,14 @@ FIFO_DEF(fifo_serial, SERIAL_BUFFER_SIZE, uint8_t, true);
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_cdc_mounted_cb(uint8_t coreid)
|
void cdc_serial_app_mount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
osal_semaphore_reset(sem_hdl);
|
osal_semaphore_reset(sem_hdl);
|
||||||
|
|
||||||
tud_cdc_receive(coreid, serial_rx_buffer, SERIAL_BUFFER_SIZE, true);
|
tud_cdc_receive(coreid, serial_rx_buffer, SERIAL_BUFFER_SIZE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_cdc_unmounted_cb(uint8_t coreid)
|
void cdc_serial_app_umount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -111,26 +111,26 @@ void tud_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, u
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CODE
|
// APPLICATION CODE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void cdcd_serial_app_init(void)
|
void cdc_serial_app_init(void)
|
||||||
{
|
{
|
||||||
sem_hdl = osal_semaphore_create(1, 0);
|
sem_hdl = osal_semaphore_create(1, 0);
|
||||||
ASSERT_PTR( sem_hdl, VOID_RETURN);
|
ASSERT_PTR( sem_hdl, VOID_RETURN);
|
||||||
|
|
||||||
osal_task_create(cdcd_serial_app_task, "cdc", 128, NULL, CDC_SERIAL_APP_TASK_PRIO);
|
osal_task_create(cdc_serial_app_task, "cdc", 128, NULL, CDC_SERIAL_APP_TASK_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_error_t cdcd_serial_subtask(void);
|
tusb_error_t cdc_serial_subtask(void);
|
||||||
|
|
||||||
void cdcd_serial_app_task(void* param)
|
void cdc_serial_app_task(void* param)
|
||||||
{
|
{
|
||||||
(void) param;
|
(void) param;
|
||||||
|
|
||||||
OSAL_TASK_BEGIN
|
OSAL_TASK_BEGIN
|
||||||
cdcd_serial_subtask();
|
cdc_serial_subtask();
|
||||||
OSAL_TASK_END
|
OSAL_TASK_END
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_error_t cdcd_serial_subtask(void)
|
tusb_error_t cdc_serial_subtask(void)
|
||||||
{
|
{
|
||||||
OSAL_SUBTASK_BEGIN
|
OSAL_SUBTASK_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,18 @@
|
|||||||
|
|
||||||
#if TUSB_CFG_DEVICE_CDC
|
#if TUSB_CFG_DEVICE_CDC
|
||||||
|
|
||||||
void cdcd_serial_app_init(void);
|
void cdc_serial_app_init(void);
|
||||||
void cdcd_serial_app_task(void* param);
|
void cdc_serial_app_task(void* param);
|
||||||
|
|
||||||
|
void cdc_serial_app_mount(uint8_t coreid);
|
||||||
|
void cdc_serial_app_umount(uint8_t coreid);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define cdcd_serial_app_init()
|
#define cdc_serial_app_init()
|
||||||
#define cdcd_serial_app_task(x)
|
#define cdc_serial_app_task(x)
|
||||||
|
#define cdc_serial_app_mount(x)
|
||||||
|
#define cdc_serial_app_umount(x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ TUSB_CFG_ATTR_USBRAM hid_keyboard_report_t keyboard_report;
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_hid_keyboard_mounted_cb(uint8_t coreid)
|
void keyboard_app_mount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_hid_keyboard_unmounted_cb(uint8_t coreid)
|
void keyboard_app_umount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -104,14 +104,14 @@ void tud_hid_keyboard_set_report_cb(uint8_t coreid, hid_request_report_type_t re
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CODE
|
// APPLICATION CODE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void keyboard_device_app_init(void)
|
void keyboard_app_init(void)
|
||||||
{
|
{
|
||||||
osal_task_create(keyboard_device_app_task, "kbd", 128, NULL, KEYBOARD_APP_TASK_PRIO);
|
osal_task_create(keyboard_app_task, "kbd", 128, NULL, KEYBOARD_APP_TASK_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_error_t keyboard_device_subtask(void);
|
tusb_error_t keyboard_device_subtask(void);
|
||||||
|
|
||||||
void keyboard_device_app_task(void* param)
|
void keyboard_app_task(void* param)
|
||||||
{
|
{
|
||||||
(void) param;
|
(void) param;
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,18 @@
|
|||||||
|
|
||||||
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
#if TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||||
|
|
||||||
void keyboard_device_app_init(void);
|
void keyboard_app_init(void);
|
||||||
void keyboard_device_app_task(void* param);
|
void keyboard_app_task(void* param);
|
||||||
|
|
||||||
|
void keyboard_app_mount(uint8_t coreid);
|
||||||
|
void keyboard_app_umount(uint8_t coreid);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define keyboard_device_app_init()
|
#define keyboard_app_init()
|
||||||
#define keyboard_device_app_task(x)
|
#define keyboard_app_task(x)
|
||||||
|
#define keyboard_app_mount(x)
|
||||||
|
#define keyboard_app_umount(x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ void os_none_start_scheduler(void)
|
|||||||
tusb_task_runner();
|
tusb_task_runner();
|
||||||
led_blinking_task(NULL);
|
led_blinking_task(NULL);
|
||||||
|
|
||||||
msc_device_app_task(NULL);
|
msc_app_task(NULL);
|
||||||
keyboard_device_app_task(NULL);
|
keyboard_app_task(NULL);
|
||||||
mouse_device_app_task(NULL);
|
mouse_app_task(NULL);
|
||||||
cdcd_serial_app_task(NULL);
|
cdc_serial_app_task(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -87,10 +87,10 @@ int main(void)
|
|||||||
//------------- application task init -------------//
|
//------------- application task init -------------//
|
||||||
led_blinking_init();
|
led_blinking_init();
|
||||||
|
|
||||||
msc_device_app_init();
|
msc_app_init();
|
||||||
keyboard_device_app_init();
|
keyboard_app_init();
|
||||||
mouse_device_app_init();
|
mouse_app_init();
|
||||||
cdcd_serial_app_init();
|
cdc_serial_app_init();
|
||||||
|
|
||||||
//------------- start OS scheduler (never return) -------------//
|
//------------- start OS scheduler (never return) -------------//
|
||||||
#if TUSB_CFG_OS == TUSB_OS_FREERTOS
|
#if TUSB_CFG_OS == TUSB_OS_FREERTOS
|
||||||
@@ -104,6 +104,23 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// tinyusb callbacks
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void tud_mount_cb(uint8_t coreid)
|
||||||
|
{
|
||||||
|
cdc_serial_app_mount(coreid);
|
||||||
|
keyboard_app_mount(coreid);
|
||||||
|
msc_app_mount(coreid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tud_umount_cb(uint8_t coreid)
|
||||||
|
{
|
||||||
|
cdc_serial_app_umount(coreid);
|
||||||
|
keyboard_app_umount(coreid);
|
||||||
|
msc_app_umount(coreid);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// HELPER FUNCTION
|
// HELPER FUNCTION
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ TUSB_CFG_ATTR_USBRAM hid_mouse_report_t mouse_report;
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tusbd_hid_mouse_mounted_cb(uint8_t coreid)
|
void mouse_app_mount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tusbd_hid_mouse_unmounted_cb(uint8_t coreid)
|
void mouse_app_umount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -93,22 +93,22 @@ void tusbd_hid_mouse_set_report_cb(uint8_t coreid, hid_request_report_type_t rep
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CODE
|
// APPLICATION CODE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void mouse_device_app_init(void)
|
void mouse_app_init(void)
|
||||||
{
|
{
|
||||||
osal_task_create(mouse_device_app_task, "mouse", 128, NULL, MOUSE_APP_TASK_PRIO);
|
osal_task_create(mouse_app_task, "mouse", 128, NULL, MOUSE_APP_TASK_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouse_device_subtask(void);
|
void mouse_app_subtask(void);
|
||||||
|
|
||||||
void mouse_device_app_task(void * param)
|
void mouse_app_task(void * param)
|
||||||
{
|
{
|
||||||
(void) para;
|
(void) para;
|
||||||
OSAL_TASK_BEGIN
|
OSAL_TASK_BEGIN
|
||||||
mouse_device_subtask();
|
mouse_app_subtask();
|
||||||
OSAL_TASK_END
|
OSAL_TASK_END
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouse_device_subtask(void)
|
void mouse_app_subtask(void)
|
||||||
{
|
{
|
||||||
OSAL_SUBTASK_BEGIN
|
OSAL_SUBTASK_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,17 @@
|
|||||||
|
|
||||||
#if TUSB_CFG_DEVICE_HID_MOUSE
|
#if TUSB_CFG_DEVICE_HID_MOUSE
|
||||||
|
|
||||||
void mouse_device_app_init(void);
|
void mouse_app_init(void);
|
||||||
void mouse_device_app_task(void * param);
|
void mouse_app_task(void * param);
|
||||||
|
void mouse_app_mount(uint8_t coreid);
|
||||||
|
void mouse_app_umount(uint8_t coreid);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define mouse_device_app_init()
|
#define mouse_app_init()
|
||||||
#define mouse_device_app_task(x)
|
#define mouse_app_task(x)
|
||||||
|
#define mouse_app_mount(x)
|
||||||
|
#define mouse_app_umount(x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -89,12 +89,12 @@ static scsi_mode_parameters_t const msc_dev_mode_para =
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_msc_mounted_cb(uint8_t coreid)
|
void msc_app_mount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_msc_unmounted_cb(uint8_t coreid)
|
void msc_app_umount(uint8_t coreid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ msc_csw_status_t tud_msc_scsi_cb (uint8_t coreid, uint8_t lun, uint8_t scsi_cmd[
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CODE
|
// APPLICATION CODE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void msc_device_app_task(void* param)
|
void msc_app_task(void* param)
|
||||||
{ // no need to implement the task yet
|
{ // no need to implement the task yet
|
||||||
(void) param;
|
(void) param;
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ void msc_device_app_task(void* param)
|
|||||||
OSAL_TASK_END
|
OSAL_TASK_END
|
||||||
}
|
}
|
||||||
|
|
||||||
void msc_device_app_init (void)
|
void msc_app_init (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,15 +69,20 @@ issue at github.com/hathach/tinyusb"
|
|||||||
#define MSCD_APP_RAMDISK
|
#define MSCD_APP_RAMDISK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void msc_device_app_init(void);
|
void msc_app_init(void);
|
||||||
void msc_device_app_task(void* param);
|
void msc_app_task(void* param);
|
||||||
|
|
||||||
|
void msc_app_mount(uint8_t coreid);
|
||||||
|
void msc_app_umount(uint8_t coreid);
|
||||||
|
|
||||||
extern scsi_sense_fixed_data_t mscd_sense_data;
|
extern scsi_sense_fixed_data_t mscd_sense_data;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define msc_device_app_init()
|
#define msc_app_init()
|
||||||
#define msc_device_app_task(x)
|
#define msc_app_task(x)
|
||||||
|
#define msc_app_mount(x)
|
||||||
|
#define msc_app_umount(x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -170,8 +170,6 @@ tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int
|
|||||||
|
|
||||||
p_cdc->interface_number = p_interface_desc->bInterfaceNumber;
|
p_cdc->interface_number = p_interface_desc->bInterfaceNumber;
|
||||||
|
|
||||||
tud_cdc_mounted_cb(coreid);
|
|
||||||
|
|
||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,8 +177,6 @@ void cdcd_close(uint8_t coreid)
|
|||||||
{
|
{
|
||||||
// no need to close opened pipe, dcd bus reset will put controller's endpoints to default state
|
// 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));
|
memclr_(&cdcd_data[coreid], sizeof(cdcd_data_t));
|
||||||
|
|
||||||
tud_cdc_unmounted_cb(coreid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request)
|
tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t const * p_request)
|
||||||
|
|||||||
@@ -98,18 +98,6 @@ tusb_error_t tud_cdc_receive(uint8_t coreid, void * p_buffer, uint32_t length, b
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CALLBACK API
|
// APPLICATION CALLBACK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
/** \brief Callback function that will be invoked when this interface is mounted (configured) by USB host
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b set-up interface-related data
|
|
||||||
*/
|
|
||||||
void tud_cdc_mounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b tear-down interface-related data
|
|
||||||
*/
|
|
||||||
void tud_cdc_unmounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that is invoked when an completion (error or success) of an USB transfer previously submitted
|
/** \brief Callback function that is invoked when an completion (error or success) of an USB transfer previously submitted
|
||||||
* by application (e.g \ref tusbd_cdc_send or \ref tusbd_cdc_send) with \a is_notify set to true.
|
* by application (e.g \ref tusbd_cdc_send or \ref tusbd_cdc_send) with \a is_notify set to true.
|
||||||
* \param[in] coreid USB Controller ID
|
* \param[in] coreid USB Controller ID
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
hidd_interface_t * const p_interface;
|
hidd_interface_t * const p_interface;
|
||||||
void (* const mounted_cb) (uint8_t coreid);
|
|
||||||
void (* const unmounted_cb) (uint8_t coreid);
|
|
||||||
void (* const xfer_cb) (uint8_t, tusb_event_t, uint32_t);
|
void (* const xfer_cb) (uint8_t, tusb_event_t, uint32_t);
|
||||||
uint16_t (* const get_report_cb) (uint8_t, hid_request_report_type_t, void**, uint16_t );
|
uint16_t (* const get_report_cb) (uint8_t, hid_request_report_type_t, void**, uint16_t );
|
||||||
void (* const set_report_cb) (uint8_t, hid_request_report_type_t, uint8_t[], uint16_t);
|
void (* const set_report_cb) (uint8_t, hid_request_report_type_t, uint8_t[], uint16_t);
|
||||||
@@ -83,8 +81,6 @@ static hidd_class_driver_t const hidd_class_driver[HIDD_NUMBER_OF_SUBCLASS] =
|
|||||||
[HID_PROTOCOL_KEYBOARD] =
|
[HID_PROTOCOL_KEYBOARD] =
|
||||||
{
|
{
|
||||||
.p_interface = &keyboardd_data,
|
.p_interface = &keyboardd_data,
|
||||||
.mounted_cb = tud_hid_keyboard_mounted_cb,
|
|
||||||
.unmounted_cb = tud_hid_keyboard_unmounted_cb,
|
|
||||||
.xfer_cb = tud_hid_keyboard_cb,
|
.xfer_cb = tud_hid_keyboard_cb,
|
||||||
.get_report_cb = tud_hid_keyboard_get_report_cb,
|
.get_report_cb = tud_hid_keyboard_get_report_cb,
|
||||||
.set_report_cb = tud_hid_keyboard_set_report_cb
|
.set_report_cb = tud_hid_keyboard_set_report_cb
|
||||||
@@ -95,8 +91,6 @@ static hidd_class_driver_t const hidd_class_driver[HIDD_NUMBER_OF_SUBCLASS] =
|
|||||||
[HID_PROTOCOL_MOUSE] =
|
[HID_PROTOCOL_MOUSE] =
|
||||||
{
|
{
|
||||||
.p_interface = &moused_data,
|
.p_interface = &moused_data,
|
||||||
.mounted_cb = tusbd_hid_mouse_mounted_cb,
|
|
||||||
.unmounted_cb = tusbd_hid_mouse_unmounted_cb,
|
|
||||||
.xfer_cb = tusbd_hid_mouse_cb,
|
.xfer_cb = tusbd_hid_mouse_cb,
|
||||||
.get_report_cb = tusbd_hid_mouse_get_report_cb,
|
.get_report_cb = tusbd_hid_mouse_get_report_cb,
|
||||||
.set_report_cb = tusbd_hid_mouse_set_report_cb
|
.set_report_cb = tusbd_hid_mouse_set_report_cb
|
||||||
@@ -178,7 +172,6 @@ void hidd_close(uint8_t coreid)
|
|||||||
for(uint8_t i=0; i<HIDD_NUMBER_OF_SUBCLASS; i++)
|
for(uint8_t i=0; i<HIDD_NUMBER_OF_SUBCLASS; i++)
|
||||||
{
|
{
|
||||||
interface_clear(hidd_class_driver[i].p_interface);
|
interface_clear(hidd_class_driver[i].p_interface);
|
||||||
if ( hidd_class_driver[i].unmounted_cb ) hidd_class_driver[i].unmounted_cb(coreid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +288,6 @@ tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int
|
|||||||
p_hid->report_length = p_desc_hid->wReportLength;
|
p_hid->report_length = p_desc_hid->wReportLength;
|
||||||
|
|
||||||
ASSERT_PTR(p_hid->p_report_desc, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
|
ASSERT_PTR(p_hid->p_report_desc, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
|
||||||
p_driver->mounted_cb(coreid);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -81,18 +81,6 @@ tusb_error_t tud_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const *
|
|||||||
// APPLICATION CALLBACK API
|
// APPLICATION CALLBACK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when this interface is mounted (configured) by USB host
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b set-up interface-related data
|
|
||||||
*/
|
|
||||||
void tud_hid_keyboard_mounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b tear-down interface-related data
|
|
||||||
*/
|
|
||||||
void tud_hid_keyboard_unmounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that is invoked when an transferring event occurred
|
/** \brief Callback function that is invoked when an transferring event occurred
|
||||||
* after invoking \ref tusbd_hid_keyboard_send
|
* after invoking \ref tusbd_hid_keyboard_send
|
||||||
* \param[in] coreid USB Controller ID
|
* \param[in] coreid USB Controller ID
|
||||||
@@ -165,17 +153,6 @@ tusb_error_t tud_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_repo
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CALLBACK API
|
// APPLICATION CALLBACK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
/** \brief Callback function that will be invoked when this interface is mounted (configured) by USB host
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b set-up interface-related data
|
|
||||||
*/
|
|
||||||
void tud_hid_mouse_mounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b tear-down interface-related data
|
|
||||||
*/
|
|
||||||
void tud_hid_mouse_unmounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that is invoked when an transferring event occurred
|
/** \brief Callback function that is invoked when an transferring event occurred
|
||||||
* after invoking \ref tusbd_hid_mouse_send
|
* after invoking \ref tusbd_hid_mouse_send
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ void mscd_init(void)
|
|||||||
void mscd_close(uint8_t coreid)
|
void mscd_close(uint8_t coreid)
|
||||||
{
|
{
|
||||||
memclr_(&mscd_data, sizeof(mscd_interface_t));
|
memclr_(&mscd_data, sizeof(mscd_interface_t));
|
||||||
tud_msc_unmounted_cb(coreid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
|
tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length)
|
||||||
@@ -112,8 +111,6 @@ tusb_error_t mscd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int
|
|||||||
|
|
||||||
(*p_length) += sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
|
(*p_length) += sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
|
||||||
|
|
||||||
tud_msc_mounted_cb(coreid);
|
|
||||||
|
|
||||||
//------------- Queue Endpoint OUT for Command Block Wrapper -------------//
|
//------------- Queue Endpoint OUT for Command Block Wrapper -------------//
|
||||||
ASSERT_STATUS( dcd_pipe_xfer(p_msc->edpt_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cmd_block_wrapper_t), true) );
|
ASSERT_STATUS( dcd_pipe_xfer(p_msc->edpt_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cmd_block_wrapper_t), true) );
|
||||||
|
|
||||||
|
|||||||
@@ -59,17 +59,6 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// APPLICATION CALLBACK API
|
// APPLICATION CALLBACK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
/** \brief Callback function that will be invoked when this interface is mounted (configured) by USB host
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b set-up interface-related data
|
|
||||||
*/
|
|
||||||
void tud_msc_mounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)
|
|
||||||
* \param[in] coreid USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b tear-down interface-related data
|
|
||||||
*/
|
|
||||||
void tud_msc_unmounted_cb(uint8_t coreid);
|
|
||||||
|
|
||||||
/** \brief Callback that is invoked when tinyusb stack received \ref SCSI_CMD_READ_10 command from host
|
/** \brief Callback that is invoked when tinyusb stack received \ref SCSI_CMD_READ_10 command from host
|
||||||
* \param[in] coreid USB Controller ID
|
* \param[in] coreid USB Controller ID
|
||||||
|
|||||||
@@ -90,7 +90,16 @@ typedef struct {
|
|||||||
bool tud_mounted(uint8_t coreid);
|
bool tud_mounted(uint8_t coreid);
|
||||||
|
|
||||||
/*------------- Callback -------------*/
|
/*------------- Callback -------------*/
|
||||||
|
/** \brief Callback function that will be invoked device is mounted (configured) by USB host
|
||||||
|
* \param[in] coreid USB Controller ID of the interface
|
||||||
|
* \note This callback should be used by Application to \b set-up application data
|
||||||
|
*/
|
||||||
void tud_mount_cb(uint8_t coreid);
|
void tud_mount_cb(uint8_t coreid);
|
||||||
|
|
||||||
|
/** \brief Callback function that will be invoked when device is unmounted (bus reset/unplugged)
|
||||||
|
* \param[in] coreid USB Controller ID of the interface
|
||||||
|
* \note This callback should be used by Application to \b tear-down application data
|
||||||
|
*/
|
||||||
void tud_umount_cb(uint8_t coreid);
|
void tud_umount_cb(uint8_t coreid);
|
||||||
|
|
||||||
//void tud_device_suspended_cb(uint8_t coreid);
|
//void tud_device_suspended_cb(uint8_t coreid);
|
||||||
|
|||||||
Reference in New Issue
Block a user