diff options
| author | hathach <[email protected]> | 2018-03-01 11:28:26 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-01 11:28:26 +0700 |
| commit | 329fdc026c4536b218438577c90491bc0b69fff8 (patch) | |
| tree | acd8b9abffcb78231774cc955e0bc544ea68ffa7 /tinyusb | |
| parent | a789fad4b7b23b8324e07ee4b9d08a145f5df0f9 (diff) | |
change osal_task_create signature
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/device/usbd.c | 3 | ||||
| -rw-r--r-- | tinyusb/host/usbh.c | 2 | ||||
| -rw-r--r-- | tinyusb/osal/osal.h | 97 | ||||
| -rw-r--r-- | tinyusb/osal/osal_freeRTOS.h | 9 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 9 |
5 files changed, 15 insertions, 105 deletions
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 790143320..46437e36f 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -168,8 +168,7 @@ tusb_error_t usbd_init (void) usbd_control_xfer_sem_hdl = osal_semaphore_create(1, 0);
ASSERT_PTR(usbd_queue_hdl, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
- osal_task_t usbd_hdl;
- osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, TUSB_CFG_OS_TASK_PRIO, &usbd_hdl);
+ osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, TUSB_CFG_OS_TASK_PRIO);
//------------- Descriptor Check -------------//
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index 3e242d82b..8ab25a19a 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -150,7 +150,7 @@ tusb_error_t usbh_init(void) enum_queue_hdl = osal_queue_create( ENUM_QUEUE_DEPTH, sizeof(uint32_t) );
ASSERT_PTR(enum_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED);
- osal_task_create(usbh_enumeration_task, "usbh", 200, NULL, TUSB_CFG_OS_TASK_PRIO, NULL);
+ osal_task_create(usbh_enumeration_task, "usbh", 200, NULL, TUSB_CFG_OS_TASK_PRIO);
//------------- Semaphore, Mutex for Control Pipe -------------//
for(uint8_t i=0; i<TUSB_CFG_HOST_DEVICE_MAX+1; i++) // including address zero
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 5b9d12200..95e36f7b4 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -56,13 +56,7 @@ #include "tusb_option.h"
#include "common/common.h"
-#ifndef _TEST_
-
/*------------- Task -------------*/
-typedef void (*osal_func_t)(void *param);
-typedef void* osal_task_t;
-
-static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl);
/*------------- Queue -------------*/
@@ -103,97 +97,6 @@ static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t condition, TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false")
#endif
-//------------- OSAL API for cmock -------------//
-#else
-
-#include "osal_common.h"
-
-//------------- Tick -------------//
-uint32_t osal_tick_get(void);
-
-//--------------------------------------------------------------------+
-// TASK API
-//--------------------------------------------------------------------+
-typedef uint32_t osal_task_t;
-tusb_error_t osal_task_create(osal_task_t *task);
-
-void osal_task_delay(uint32_t msec);
-
-#define OSAL_TASK_LOOP_BEGIN
-#define OSAL_TASK_LOOP_END
-
-#define SUBTASK_EXIT(error) return error;
-
-//------------- Sub Task -------------//
-#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) status = subtask
-
-#define OSAL_SUBTASK_BEGIN
-#define OSAL_SUBTASK_END return TUSB_ERROR_NONE;
-
-//------------- Sub Task Assert -------------//
-#define _SUBTASK_ASSERT_ERROR_HANDLER(error, func_call) func_call; return error
-
-#define SUBTASK_ASSERT_STATUS(sts) ASSERT_STATUS(sts)
-
-#define SUBTASK_ASSERT_STATUS_WITH_HANDLER(sts, func_call) \
- ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, tusb_error_t status = (tusb_error_t)(sts),\
- TUSB_ERROR_NONE == status, status, "%s", TUSB_ErrorStr[status])
-
-#define SUBTASK_ASSERT(condition) ASSERT(condition, TUSB_ERROR_OSAL_TASK_FAILED)
-
-#define SUBTASK_ASSERT_WITH_HANDLER(condition, func_call) \
- ASSERT_DEFINE_WITH_HANDLER(_SUBTASK_ASSERT_ERROR_HANDLER, func_call, ,\
- condition, TUSB_ERROR_OSAL_TASK_FAILED, "%s", "evaluated to false")
-
-//--------------------------------------------------------------------+
-// Semaphore API
-//--------------------------------------------------------------------+
-typedef volatile uint8_t osal_semaphore_t;
-typedef osal_semaphore_t * osal_semaphore_handle_t;
-
-osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * p_sem);
-void osal_semaphore_wait(osal_semaphore_handle_t sem_hdl, uint32_t msec, tusb_error_t *p_error);
-tusb_error_t osal_semaphore_post(osal_semaphore_handle_t sem_hdl);
-void osal_semaphore_reset(osal_semaphore_handle_t sem_hdl);
-
-//--------------------------------------------------------------------+
-// MUTEX API (priority inheritance)
-//--------------------------------------------------------------------+
-#define OSAL_MUTEX_DEF(name) osal_mutex_t name
-#define OSAL_MUTEX_REF(name) &name
-
-typedef osal_semaphore_t osal_mutex_t;
-typedef osal_semaphore_handle_t osal_mutex_handle_t;
-
-osal_mutex_handle_t osal_mutex_create(osal_mutex_t * p_mutex);
-void osal_mutex_wait(osal_mutex_handle_t mutex_hdl, uint32_t msec, tusb_error_t *p_error);
-tusb_error_t osal_mutex_release(osal_mutex_handle_t mutex_hdl);
-void osal_mutex_reset(osal_mutex_handle_t mutex_hdl);
-//--------------------------------------------------------------------+
-// QUEUE API
-//--------------------------------------------------------------------+
-typedef struct{
- uint32_t * const buffer ; ///< buffer pointer
- uint8_t const depth ; ///< buffer size
- volatile uint8_t count ; ///< bytes in fifo
- volatile uint8_t wr_idx ; ///< write pointer
- volatile uint8_t rd_idx ; ///< read pointer
-} osal_queue_t;
-
-typedef osal_queue_t * osal_queue_handle_t;
-
-
-osal_queue_handle_t osal_queue_create (osal_queue_t *p_queue);
-void osal_queue_receive (osal_queue_handle_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error);
-tusb_error_t osal_queue_send (osal_queue_handle_t const queue_hdl, const void * data);
-void osal_queue_flush(osal_queue_handle_t const queue_hdl);
-
-//--------------------------------------------------------------------+
-// TICK API
-//--------------------------------------------------------------------+
-uint32_t osal_tick_get(void);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h index f79829e58..0e043ded6 100644 --- a/tinyusb/osal/osal_freeRTOS.h +++ b/tinyusb/osal/osal_freeRTOS.h @@ -64,9 +64,14 @@ extern "C" { //--------------------------------------------------------------------+ // TASK API //--------------------------------------------------------------------+ -static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl) +typedef void (*osal_func_t)(void *param); +typedef void* osal_task_t; + +static inline osal_task_t osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio) { - return xTaskCreate(code, (const signed char*) name, stack_size, param, prio, task_hdl); + osal_task_t task_hdl; + xTaskCreate(code, (const signed char*) name, stack_size, param, prio, &task_hdl); + return task_hdl; } static inline void osal_task_delay(uint32_t msec) diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index c1a426e49..bf0a82d8d 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -70,10 +70,13 @@ uint32_t tusb_tick_get(void); // OSAL_TASK_LOOP_ENG
// }
//--------------------------------------------------------------------+
-static inline bool osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio, osal_task_t* task_hdl)
+typedef void (*osal_func_t)(void *param);
+typedef void* osal_task_t;
+
+static inline osal_task_t osal_task_create(osal_func_t code, const char* name, uint32_t stack_size, void* param, uint32_t prio)
{
- (void) code; (void) name; (void) stack_size; (void) param; (void) prio; (void) task_hdl;
- return true;
+ (void) code; (void) name; (void) stack_size; (void) param; (void) prio;
+ return (osal_task_t) 1;
}
#define TASK_RESTART \
|
