Added function chThdQueueIsEmptyI(), fixed a naming error in threads queues static initializer.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7255 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2014-09-10 12:35:59 +00:00
parent 530c3a6f9e
commit 3b9ae6825f
5 changed files with 23 additions and 6 deletions

View File

@ -73,7 +73,7 @@ typedef struct condition_variable {
* *
* @param[in] name the name of the condition variable * @param[in] name the name of the condition variable
*/ */
#define _CONDVAR_DATA(name) {_threads_queue_t_DATA(name.c_queue)} #define _CONDVAR_DATA(name) {_THREADS_QUEUE_DATA(name.c_queue)}
/** /**
* @brief Static condition variable initializer. * @brief Static condition variable initializer.

View File

@ -79,9 +79,9 @@ struct mutex {
* @param[in] name the name of the mutex variable * @param[in] name the name of the mutex variable
*/ */
#if CH_CFG_USE_MUTEXES_RECURSIVE || defined(__DOXYGEN__) #if CH_CFG_USE_MUTEXES_RECURSIVE || defined(__DOXYGEN__)
#define _MUTEX_DATA(name) {_threads_queue_t_DATA(name.m_queue), NULL, NULL, 0} #define _MUTEX_DATA(name) {_THREADS_QUEUE_DATA(name.m_queue), NULL, NULL, 0}
#else #else
#define _MUTEX_DATA(name) {_threads_queue_t_DATA(name.m_queue), NULL, NULL} #define _MUTEX_DATA(name) {_THREADS_QUEUE_DATA(name.m_queue), NULL, NULL}
#endif #endif
/** /**

View File

@ -129,7 +129,7 @@ typedef io_queue_t output_queue_t;
* @param[in] link application defined pointer * @param[in] link application defined pointer
*/ */
#define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \ #define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \
_threads_queue_t_DATA(name), \ _THREADS_QUEUE_DATA(name), \
0, \ 0, \
(uint8_t *)(buffer), \ (uint8_t *)(buffer), \
(uint8_t *)(buffer) + (size), \ (uint8_t *)(buffer) + (size), \
@ -165,7 +165,7 @@ typedef io_queue_t output_queue_t;
* @param[in] link application defined pointer * @param[in] link application defined pointer
*/ */
#define _OUTPUTQUEUE_DATA(name, buffer, size, onotify, link) { \ #define _OUTPUTQUEUE_DATA(name, buffer, size, onotify, link) { \
_threads_queue_t_DATA(name), \ _THREADS_QUEUE_DATA(name), \
(size), \ (size), \
(uint8_t *)(buffer), \ (uint8_t *)(buffer), \
(uint8_t *)(buffer) + (size), \ (uint8_t *)(buffer) + (size), \

View File

@ -69,7 +69,7 @@ typedef struct semaphore {
* @param[in] n the counter initial value, this value must be * @param[in] n the counter initial value, this value must be
* non-negative * non-negative
*/ */
#define _SEMAPHORE_DATA(name, n) {_threads_queue_t_DATA(name.s_queue), n} #define _SEMAPHORE_DATA(name, n) {_THREADS_QUEUE_DATA(name.s_queue), n}
/** /**
* @brief Static semaphore initializer. * @brief Static semaphore initializer.

View File

@ -376,6 +376,23 @@ static inline void chThdQueueObjectInit(threads_queue_t *tqp) {
queue_init(tqp); queue_init(tqp);
} }
/**
* @brief Evaluates to @p true if the specified queue is empty.
*
* @param[out] tqp pointer to the threads queue object
* @return The queue status.
* @retval false if the queue is not empty.
* @retval true if the queue is empty.
*
* @iclass
*/
static inline bool chThdQueueIsEmptyI(threads_queue_t *tqp) {
chDbgCheckClassI();
return queue_isempty(tqp);
}
#endif /* _CHTHREADS_H_ */ #endif /* _CHTHREADS_H_ */
/** @} */ /** @} */