Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
Diff: nordic-sdk/components/libraries/scheduler/app_scheduler.c
- Revision:
- 112:737b08b3b995
- Parent:
- 103:138bdc859cc9
--- a/nordic-sdk/components/libraries/scheduler/app_scheduler.c Wed Apr 15 09:24:27 2015 +0100 +++ b/nordic-sdk/components/libraries/scheduler/app_scheduler.c Thu Apr 30 08:34:37 2015 +0100 @@ -35,13 +35,6 @@ static uint16_t m_queue_event_size; /**< Maximum event size in queue. */ static uint16_t m_queue_size; /**< Number of queue entries. */ -/**@brief Macro for checking if a queue is full. */ -#define APP_SCHED_QUEUE_FULL() (next_index(m_queue_end_index) == m_queue_start_index) - -/**@brief Macro for checking if a queue is empty. */ -#define APP_SCHED_QUEUE_EMPTY() (m_queue_end_index == m_queue_start_index) - - /**@brief Function for incrementing a queue index, and handle wrap-around. * * @param[in] index Old index. @@ -54,6 +47,26 @@ } +static __INLINE uint8_t app_sched_queue_full() +{ + uint8_t tmp = m_queue_start_index; + return next_index(m_queue_end_index) == tmp; +} + +/**@brief Macro for checking if a queue is full. */ +#define APP_SCHED_QUEUE_FULL() app_sched_queue_full() + + +static __INLINE uint8_t app_sched_queue_empty() +{ + uint8_t tmp = m_queue_start_index; + return m_queue_end_index == tmp; +} + +/**@brief Macro for checking if a queue is empty. */ +#define APP_SCHED_QUEUE_EMPTY() app_sched_queue_empty() + + uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event_buffer) { uint16_t data_start_index = (queue_size + 1) * sizeof(event_header_t);