kernel: msgq: rename parameters q->msgq

Rename parameters in header for msgq and make them more readable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-11-25 09:30:47 -05:00
commit 4b38659b06

View file

@ -3654,7 +3654,7 @@ void k_msgq_init(struct k_msgq *q, char *buffer, size_t msg_size,
* k_msgq_cleanup(), or if userspace is enabled and the msgq object loses * k_msgq_cleanup(), or if userspace is enabled and the msgq object loses
* all of its references. * all of its references.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* @param msg_size Message size (in bytes). * @param msg_size Message size (in bytes).
* @param max_msgs Maximum number of messages that can be queued. * @param max_msgs Maximum number of messages that can be queued.
* *
@ -3663,16 +3663,18 @@ void k_msgq_init(struct k_msgq *q, char *buffer, size_t msg_size,
* an integer overflow. * an integer overflow.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall int k_msgq_alloc_init(struct k_msgq *q, size_t msg_size, __syscall int k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,
u32_t max_msgs); u32_t max_msgs);
/** /**
* @brief Cleanup message queue * @brief Release allocated buffer for a queue
* *
* Releases memory allocated for the ring buffer. * Releases memory allocated for the ring buffer.
* @param q *
* @param msgq message queue to cleanup
*
*/ */
void k_msgq_cleanup(struct k_msgq *q); void k_msgq_cleanup(struct k_msgq *msgq);
/** /**
* @brief Send a message to a message queue. * @brief Send a message to a message queue.
@ -3681,7 +3683,7 @@ void k_msgq_cleanup(struct k_msgq *q);
* *
* @note Can be called by ISRs. * @note Can be called by ISRs.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* @param data Pointer to the message. * @param data Pointer to the message.
* @param timeout Non-negative waiting period to add the message (in * @param timeout Non-negative waiting period to add the message (in
* milliseconds), or one of the special values K_NO_WAIT and * milliseconds), or one of the special values K_NO_WAIT and
@ -3692,7 +3694,7 @@ void k_msgq_cleanup(struct k_msgq *q);
* @retval -EAGAIN Waiting period timed out. * @retval -EAGAIN Waiting period timed out.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall int k_msgq_put(struct k_msgq *q, void *data, s32_t timeout); __syscall int k_msgq_put(struct k_msgq *msgq, void *data, s32_t timeout);
/** /**
* @brief Receive a message from a message queue. * @brief Receive a message from a message queue.
@ -3702,7 +3704,7 @@ __syscall int k_msgq_put(struct k_msgq *q, void *data, s32_t timeout);
* *
* @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT. * @note Can be called by ISRs, but @a timeout must be set to K_NO_WAIT.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* @param data Address of area to hold the received message. * @param data Address of area to hold the received message.
* @param timeout Non-negative waiting period to receive the message (in * @param timeout Non-negative waiting period to receive the message (in
* milliseconds), or one of the special values K_NO_WAIT and * milliseconds), or one of the special values K_NO_WAIT and
@ -3713,7 +3715,7 @@ __syscall int k_msgq_put(struct k_msgq *q, void *data, s32_t timeout);
* @retval -EAGAIN Waiting period timed out. * @retval -EAGAIN Waiting period timed out.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall int k_msgq_get(struct k_msgq *q, void *data, s32_t timeout); __syscall int k_msgq_get(struct k_msgq *msgq, void *data, s32_t timeout);
/** /**
* @brief Peek/read a message from a message queue. * @brief Peek/read a message from a message queue.
@ -3723,14 +3725,14 @@ __syscall int k_msgq_get(struct k_msgq *q, void *data, s32_t timeout);
* *
* @note Can be called by ISRs. * @note Can be called by ISRs.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* @param data Address of area to hold the message read from the queue. * @param data Address of area to hold the message read from the queue.
* *
* @retval 0 Message read. * @retval 0 Message read.
* @retval -ENOMSG Returned when the queue has no message. * @retval -ENOMSG Returned when the queue has no message.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall int k_msgq_peek(struct k_msgq *q, void *data); __syscall int k_msgq_peek(struct k_msgq *msgq, void *data);
/** /**
* @brief Purge a message queue. * @brief Purge a message queue.
@ -3739,12 +3741,12 @@ __syscall int k_msgq_peek(struct k_msgq *q, void *data);
* buffer. Any threads that are blocked waiting to send a message to the * buffer. Any threads that are blocked waiting to send a message to the
* message queue are unblocked and see an -ENOMSG error code. * message queue are unblocked and see an -ENOMSG error code.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* *
* @return N/A * @return N/A
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall void k_msgq_purge(struct k_msgq *q); __syscall void k_msgq_purge(struct k_msgq *msgq);
/** /**
* @brief Get the amount of free space in a message queue. * @brief Get the amount of free space in a message queue.
@ -3752,30 +3754,31 @@ __syscall void k_msgq_purge(struct k_msgq *q);
* This routine returns the number of unused entries in a message queue's * This routine returns the number of unused entries in a message queue's
* ring buffer. * ring buffer.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* *
* @return Number of unused ring buffer entries. * @return Number of unused ring buffer entries.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall u32_t k_msgq_num_free_get(struct k_msgq *q); __syscall u32_t k_msgq_num_free_get(struct k_msgq *msgq);
/** /**
* @brief Get basic attributes of a message queue. * @brief Get basic attributes of a message queue.
* *
* This routine fetches basic attributes of message queue into attr argument. * This routine fetches basic attributes of message queue into attr argument.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* @param attrs pointer to message queue attribute structure. * @param attrs pointer to message queue attribute structure.
* *
* @return N/A * @return N/A
* @req K-MSGQ-003 * @req K-MSGQ-003
*/ */
__syscall void k_msgq_get_attrs(struct k_msgq *q, struct k_msgq_attrs *attrs); __syscall void k_msgq_get_attrs(struct k_msgq *msgq,
struct k_msgq_attrs *attrs);
static inline u32_t z_impl_k_msgq_num_free_get(struct k_msgq *q) static inline u32_t z_impl_k_msgq_num_free_get(struct k_msgq *msgq)
{ {
return q->max_msgs - q->used_msgs; return msgq->max_msgs - msgq->used_msgs;
} }
/** /**
@ -3783,16 +3786,16 @@ static inline u32_t z_impl_k_msgq_num_free_get(struct k_msgq *q)
* *
* This routine returns the number of messages in a message queue's ring buffer. * This routine returns the number of messages in a message queue's ring buffer.
* *
* @param q Address of the message queue. * @param msgq Address of the message queue.
* *
* @return Number of messages. * @return Number of messages.
* @req K-MSGQ-002 * @req K-MSGQ-002
*/ */
__syscall u32_t k_msgq_num_used_get(struct k_msgq *q); __syscall u32_t k_msgq_num_used_get(struct k_msgq *msgq);
static inline u32_t z_impl_k_msgq_num_used_get(struct k_msgq *q) static inline u32_t z_impl_k_msgq_num_used_get(struct k_msgq *msgq)
{ {
return q->used_msgs; return msgq->used_msgs;
} }
/** @} */ /** @} */