diff options
| author | hathach <[email protected]> | 2018-05-17 19:19:55 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-05-17 19:19:55 +0700 |
| commit | 61cc8666fc2bf277deb156c07b405849aeeb677c (patch) | |
| tree | e00f19f6aaac34a6a8be4da71b1c8521bbc40c98 /tinyusb/osal | |
| parent | d6794074e1c6e8a3640d69ff719a230160b05992 (diff) | |
complete osal queue, semaphore static API
Diffstat (limited to 'tinyusb/osal')
| -rw-r--r-- | tinyusb/osal/osal_freeRTOS.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h index 0348617ae..ce9e95927 100644 --- a/tinyusb/osal/osal_freeRTOS.h +++ b/tinyusb/osal/osal_freeRTOS.h @@ -83,11 +83,15 @@ static inline void osal_task_delay(uint32_t msec) //--------------------------------------------------------------------+ // QUEUE API //--------------------------------------------------------------------+ +#define OSAL_QUEUE_DEF(_name, _depth, _type) \ + uint8_t _name##_##buf[_depth*sizeof(_type)];\ + osal_queue_def_t _name = { .depth = _depth, .item_sz = sizeof(_type), .buf = _name##_##buf };\ + typedef struct { - uint16_t queue_sz; + uint16_t depth; uint16_t item_sz; - void* pool; + void* buf; StaticQueue_t sq; }osal_queue_def_t; @@ -96,7 +100,7 @@ typedef QueueHandle_t osal_queue_t; static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) { - return xQueueCreateStatic(qdef->queue_sz, qdef->item_sz, qdef->pool, &qdef->sq); + return xQueueCreateStatic(qdef->depth, qdef->item_sz, qdef->buf, &qdef->sq); } static inline void osal_queue_receive (osal_queue_t const queue_hdl, void *p_data, uint32_t msec, tusb_error_t *p_error) |
