mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-25 03:02:26 +00:00
fix mocking osal api using ifdef
start to add task_create macro API for osal_none
This commit is contained in:
parent
07048b943e
commit
9c9fa182d4
@ -42,7 +42,7 @@
|
|||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="tests/build" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry excluding="tests/build/test/runners|tests/build/test/results|tests/build/test/preprocess|tests/build/test/out|tests/build/test/dependencies|tests/build/test/cache" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
:mock_prefix: mock_
|
:mock_prefix: mock_
|
||||||
:when_no_prototypes: :warn
|
:when_no_prototypes: :warn
|
||||||
:enforce_strict_ordering: TRUE
|
:enforce_strict_ordering: TRUE
|
||||||
# :callback_include_count: FALSE
|
|
||||||
:plugins:
|
:plugins:
|
||||||
- :ignore
|
- :ignore
|
||||||
- :callback
|
- :callback
|
||||||
|
@ -39,9 +39,8 @@
|
|||||||
#undef TUSB_CFG_OS
|
#undef TUSB_CFG_OS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TUSB_CFG_OS TUSB_OS_NONE
|
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "osal.h"
|
#include "osal_none.h"
|
||||||
|
|
||||||
uint32_t statements[10];
|
uint32_t statements[10];
|
||||||
osal_semaphore_t sem;
|
osal_semaphore_t sem;
|
||||||
|
@ -59,8 +59,8 @@
|
|||||||
STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
|
STATIC_ usbh_device_info_t device_info_pool[TUSB_CFG_HOST_DEVICE_MAX];
|
||||||
|
|
||||||
#define ENUM_DEPTH 2
|
#define ENUM_DEPTH 2
|
||||||
STATIC_ osal_queue_t queue_enumerate;
|
//STATIC_ osal_queue_t queue_enumerate;
|
||||||
STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)];
|
//STATIC_ uint8_t queue_enumerate_buffer[ENUM_DEPTH*sizeof(usbh_enumerate_t)];
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// PUBLIC API (Parameter Verification is required)
|
// PUBLIC API (Parameter Verification is required)
|
||||||
|
@ -62,27 +62,33 @@
|
|||||||
#define TUSB_OS_FREERTOS 3
|
#define TUSB_OS_FREERTOS 3
|
||||||
#define TUSB_OS_UCOS 4
|
#define TUSB_OS_UCOS 4
|
||||||
|
|
||||||
|
#ifndef _TEST_
|
||||||
|
|
||||||
#if TUSB_CFG_OS == TUSB_OS_NONE
|
#if TUSB_CFG_OS == TUSB_OS_NONE
|
||||||
#include "osal_none.h"
|
#include "osal_none.h"
|
||||||
#else
|
#else
|
||||||
#error TUSB_CFG_OS is not defined or OS is not supported yet
|
#error TUSB_CFG_OS is not defined or OS is not supported yet
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
#else // OSAL API for cmock
|
||||||
// SEMAPHORE API
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,8 @@ typedef uint32_t osal_timeout_t;
|
|||||||
// OSAL_TASK_LOOP_ENG
|
// OSAL_TASK_LOOP_ENG
|
||||||
// }
|
// }
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
#define osal_task_create(code, name, stack_depth, parameters, prio)
|
||||||
|
|
||||||
#define OSAL_TASK_LOOP \
|
#define OSAL_TASK_LOOP \
|
||||||
static uint16_t state = 0;\
|
static uint16_t state = 0;\
|
||||||
switch(state)\
|
switch(state)\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user