refractor usbd-dcd callback, add bus event isr

This commit is contained in:
hathach
2013-11-21 12:47:55 +07:00
parent d94efa60d6
commit 6887e5e642
15 changed files with 169 additions and 83 deletions

View File

@@ -117,10 +117,10 @@ void tusbd_cdc_xfer_isr(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id
OSAL_TASK_FUNCTION( cdcd_serial_app_task ) (void* p_task_para)
{
tusb_error_t error;
OSAL_TASK_LOOP_BEGIN
tusb_error_t error;
osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error);
if ( tusbd_cdc_is_configured(0) )

View File

@@ -46,6 +46,8 @@
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
OSAL_TASK_DEF(keyboardd_app_task, 128, KEYBOARDD_APP_TASK_PRIO);
ATTR_USB_MIN_ALIGNMENT hid_keyboard_report_t keyboard_report TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+
@@ -62,11 +64,13 @@ void tusbd_hid_keyboard_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred
void keyboardd_app_init(void)
{
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(keyboardd_app_task) ), VOID_RETURN);
}
OSAL_TASK_FUNCTION( keyboardd_app_task ) (void* p_task_para)
{
OSAL_TASK_LOOP_BEGIN
if (tusbd_is_configured(0))
{
static uint32_t count =0;
@@ -79,6 +83,10 @@ OSAL_TASK_FUNCTION( keyboardd_app_task ) (void* p_task_para)
}
}
}
osal_task_delay(1000);
OSAL_TASK_LOOP_END
}
#endif

View File

@@ -50,6 +50,8 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
OSAL_TASK_DEF(moused_app_task, 128, MOUSED_APP_TASK_PRIO);
ATTR_USB_MIN_ALIGNMENT hid_mouse_report_t mouse_report TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+
@@ -62,11 +64,13 @@ void tusbd_hid_mouse_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_by
void moused_app_init(void)
{
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(moused_app_task) ), VOID_RETURN);
}
OSAL_TASK_FUNCTION( moused_app_task ) (void* p_task_para)
{
OSAL_TASK_LOOP_BEGIN
if (tusbd_is_configured(0))
{
static uint32_t count =0;
@@ -79,6 +83,10 @@ OSAL_TASK_FUNCTION( moused_app_task ) (void* p_task_para)
}
}
}
osal_task_delay(1000);
OSAL_TASK_LOOP_END
}
#endif

View File

@@ -81,17 +81,16 @@
#define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor, remove
//------------- CLASS -------------//
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
#define TUSB_CFG_DEVICE_HID_MOUSE 0
#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
#define TUSB_CFG_DEVICE_HID_MOUSE 1
#define TUSB_CFG_DEVICE_HID_GENERIC 0
#define TUSB_CFG_DEVICE_MSC 1
#define TUSB_CFG_DEVICE_CDC 0
#define TUSB_CFG_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
#define TUSB_CFG_DEBUG 3
#define TUSB_CFG_OS TUSB_OS_NONE // defined using eclipse build