diff options
| author | hathach <[email protected]> | 2013-02-04 16:07:42 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-02-04 16:07:42 +0700 |
| commit | d71e244dffc15cd3fbabbe6e710a7a20ea09c413 (patch) | |
| tree | cec86a2520fbd271094f67cc86d2dd594844d2ba /tinyusb/osal | |
| parent | 0a13e37ba22c195b685cbcb61e51500f038a38c4 (diff) | |
add TUSB_CFG_HOST_ENUM_BUFFER_SIZE
add enum buffer
getting serious with osal_freeRTOS
Diffstat (limited to 'tinyusb/osal')
| -rw-r--r-- | tinyusb/osal/osal.h | 8 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h index 0f632f529..055f28d1a 100644 --- a/tinyusb/osal/osal.h +++ b/tinyusb/osal/osal.h @@ -94,8 +94,12 @@ typedef uint32_t osal_task_t; tusb_error_t osal_task_create(osal_task_t *task); //------------- Semaphore -------------// -typedef uint32_t osal_semaphore_t; +typedef volatile uint32_t osal_semaphore_t; typedef void* osal_semaphore_handle_t; + +#define OSAL_SEM_DEF(name)\ + osal_semaphore_t name + osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * const sem); void osal_semaphore_wait(osal_semaphore_handle_t const sem_hdl, uint32_t msec, tusb_error_t *p_error); tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl); @@ -104,7 +108,7 @@ tusb_error_t osal_semaphore_post(osal_semaphore_handle_t const sem_hdl); typedef uint32_t osal_queue_t; typedef void* osal_queue_handle_t; -#define OSAL_DEF_QUEUE(name, queue_depth, type) \ +#define OSAL_QUEUE_DEF(name, queue_depth, type) \ osal_queue_t name osal_queue_handle_t osal_queue_create (osal_queue_t *p_queue); diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index 2056f5214..adcc22ed9 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -103,6 +103,12 @@ uint32_t osal_tick_get(void); typedef volatile uint8_t osal_semaphore_t; typedef osal_semaphore_t * osal_semaphore_handle_t; +#define OSAL_SEM_DEF(name)\ + osal_semaphore_t name + +#define OSAL_SEM_REF(name)\ + &name + static inline osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * const p_sem) ATTR_ALWAYS_INLINE; static inline osal_semaphore_handle_t osal_semaphore_create(osal_semaphore_t * const p_sem) { @@ -145,7 +151,7 @@ typedef struct{ typedef osal_queue_t * osal_queue_handle_t; // use to declare a queue, within the scope of tinyusb, should only use primitive type only -#define OSAL_DEF_QUEUE(name, queue_depth, type)\ +#define OSAL_QUEUE_DEF(name, queue_depth, type)\ uint32_t name##_buffer[queue_depth];\ osal_queue_t name = {\ .buffer = name##_buffer,\ |
