在线时间0 小时
UID2107377
注册时间2014-7-4
NXP金币0
该用户从未签到
新手上路

- 积分
- 4
- 最后登录
- 1970-1-1
|
源码中 的 mqx/source/kernel/ queue.c
有人使用其中的的函数写过东西吗?
这个当中的每个函数又是怎么实现的呢?
以 _queue_enqueue
/*!
* \brief Adds the element to the end of the queue.
*
* \param[in] q_ptr Pointer to the queue to which to add the element; initialized
* with _queue_init().
* \param[in] e_ptr Pointer to the element to add.
*
* \return TRUE (success) or FALSE (Failure: the queue is full.)
*
* \warning The function might behave unpredictably if either:
* \li Q_ptr is not a pointer to QUEUE_STRUCT.
* \li E_ptr is not a pointer to QUEUE_ELEMENT_STRUCT.
*
* \see _queue_init
* \see _queue_dequeue
* \see _queue_init
* \see QUEUE_STRUCT
* \see QUEUE_ELEMENT_STRUCT
*/
boolean _queue_enqueue
(
QUEUE_STRUCT_PTR q_ptr,
QUEUE_ELEMENT_STRUCT_PTR e_ptr
)
{ /* Body */
_int_disable();
if ((q_ptr->MAX != 0) && (q_ptr->SIZE >= q_ptr->MAX))
{
_int_enable();
return (FALSE);
} /* Endif */
_QUEUE_ENQUEUE(q_ptr, e_ptr);
_int_enable();
return (TRUE);
} /* Endbody */
然后
#define _QUEUE_ENQUEUE(queue,element) \
_queue_enqueue((QUEUE_STRUCT_PTR)(queue), \
(QUEUE_ELEMENT_STRUCT_PTR)((pointer)(element)))
这两个函数相互调。。有什么意思没? 大神多指教指教啊。
|
|