diff options
| author | hathach <[email protected]> | 2018-02-28 14:21:31 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-02-28 14:21:43 +0700 |
| commit | 9b7cd608aa4addf40cbe2135b38a78378e6f428f (patch) | |
| tree | 5233a0c8244bd1d477471ccd8cb69528c8b40660 /tinyusb/device | |
| parent | 5efad7412ffef0bb7eb08beea29b3b06b04cfb6e (diff) | |
osal clean up
- task create, task def macros
Diffstat (limited to 'tinyusb/device')
| -rw-r--r-- | tinyusb/device/usbd.c | 17 | ||||
| -rw-r--r-- | tinyusb/device/usbd.h | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 4c304a2f8..23b178513 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -139,7 +139,14 @@ typedef struct ATTR_ALIGNED(4) STATIC_ASSERT(sizeof(usbd_task_event_t) <= 12, "size is not correct");
-OSAL_TASK_DEF(usbd_task, 150, TUSB_CFG_OS_TASK_PRIO);
+#ifndef TUC_DEVICE_STACKSIZE
+#define TUC_DEVICE_STACKSIZE 150
+#endif
+
+#ifndef TUSB_CFG_OS_TASK_PRIO
+#define TUSB_CFG_OS_TASK_PRIO 0
+#endif
+
OSAL_QUEUE_DEF(usbd_queue_def, USBD_TASK_QUEUE_DEPTH, usbd_task_event_t);
OSAL_SEM_DEF(usbd_control_xfer_semaphore_def);
@@ -163,7 +170,9 @@ tusb_error_t usbd_init (void) usbd_control_xfer_sem_hdl = osal_semaphore_create( OSAL_SEM_REF(usbd_control_xfer_semaphore_def) );
ASSERT_PTR(usbd_queue_hdl, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
- ASSERT_STATUS( osal_task_create( OSAL_TASK_REF(usbd_task) ));
+ osal_task_t usbd_hdl;
+ osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, TUSB_CFG_OS_TASK_PRIO, &usbd_hdl);
+
//------------- Descriptor Check -------------//
ASSERT(tusbd_descriptor_pointers.p_device != NULL && tusbd_descriptor_pointers.p_configuration != NULL, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
@@ -183,9 +192,9 @@ tusb_error_t usbd_init (void) // To enable the TASK_ASSERT style (quick return on false condition) in a real RTOS, a task must act as a wrapper
// and is used mainly to call subtasks. Within a subtask return statement can be called freely, the task with
// forever loop cannot have any return at all.
-OSAL_TASK_FUNCTION(usbd_task, p_task_para)
+void usbd_task( void* param)
{
- (void) p_task_para; // suppress compiler warnings
+ (void) param;
OSAL_TASK_LOOP_BEGIN
usbd_body_subtask();
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h index 4f79788f0..c2c5c702b 100644 --- a/tinyusb/device/usbd.h +++ b/tinyusb/device/usbd.h @@ -102,7 +102,7 @@ bool tusbd_is_configured(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; extern osal_semaphore_handle_t usbd_control_xfer_sem_hdl;
tusb_error_t usbd_init(void);
-OSAL_TASK_FUNCTION (usbd_task, p_task_para);
+void usbd_task( void* param);
#endif
|
