diff options
| author | hathach <[email protected]> | 2013-01-30 12:55:44 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-30 12:55:44 +0700 |
| commit | 9c9fa182d40587a44d525de84d1a36933c8556e6 (patch) | |
| tree | 7818a7968c3302c3ffe86aacfa10913f15de1c31 /tinyusb | |
| parent | 07048b943e6b57aeee4a671b85d76a2f592e3205 (diff) | |
fix mocking osal api using ifdef
start to add task_create macro API for osal_none
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/host/usbd_host.c | 4 | ||||
| -rw-r--r-- | tinyusb/osal/osal.h | 28 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 2 |
3 files changed, 21 insertions, 13 deletions
diff --git a/tinyusb/host/usbd_host.c b/tinyusb/host/usbd_host.c index 134bdc038..5ddaaaef5 100644 --- a/tinyusb/host/usbd_host.c +++ b/tinyusb/host/usbd_host.c @@ -59,8 +59,8 @@ STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX]; #define ENUM_DEPTH 2 -STATIC_ osal_queue_t queue_enumerate; -STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)]; +//STATIC_ osal_queue_t queue_enumerate; +//STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)]; //--------------------------------------------------------------------+ // PUBLIC API (Parameter Verification is required) diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 7e3977d1c..b97f049e6 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -62,27 +62,33 @@ #define TUSB_OS_FREERTOS 3 #define TUSB_OS_UCOS 4 +#ifndef _TEST_ + #if TUSB_CFG_OS == TUSB_OS_NONE #include "osal_none.h" #else #error TUSB_CFG_OS is not defined or OS is not supported yet #endif -//--------------------------------------------------------------------+ -// SEMAPHORE API -//--------------------------------------------------------------------+ +#else // OSAL API for cmock + +#include "osal_common.h" -//--------------------------------------------------------------------+ -// QUEUE API -//--------------------------------------------------------------------+ -typedef uint32_t osal_queue_id_t; -////osal_queue_id_t osal_queue_create(osal_queue_t *queue, uint8_t *buffer); -osal_queue_id_t osal_queue_create(osal_queue_id_t *queue, uint8_t *buffer); -//tusb_error_t osal_queue_put(osal_queue_id_t qid, uint32_t data, osal_timeout_t msec); -//tusb_error_t osal_queue_get(osal_queue_id_t qid, uint32_t *data, osal_timeout_t msec); +typedef uint32_t osal_timeout_t; +//------------- Semaphore -------------// +typedef uint32_t osal_semaphore_t; +typedef void* osal_semaphore_handle_t; +osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * const sem); +tusb_error_t osal_semaphore_wait(osal_semaphore_handle_t const sem_hdl, osal_timeout_t msec); +tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl); +//------------- Queue -------------// +typedef uint32_t osal_queue_t; +typedef void* osal_queue_handle_t; +osal_queue_handle_t osal_queue_create(osal_queue_t *queue, uint8_t *buffer); +#endif #ifdef __cplusplus } diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 7219c06ca..caf13fcb0 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -73,6 +73,8 @@ typedef uint32_t osal_timeout_t; // OSAL_TASK_LOOP_ENG // } //--------------------------------------------------------------------+ +#define osal_task_create(code, name, stack_depth, parameters, prio) + #define OSAL_TASK_LOOP \ static uint16_t state = 0;\ switch(state)\ |
