From 7d47d8cf46c4728c277d0971efd7f5a3f7368cec Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 15 Jun 2018 09:11:07 +0000 Subject: New API added to pools and fifos. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12100 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/lib/include/chobjfifos.h | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'os/lib/include/chobjfifos.h') diff --git a/os/lib/include/chobjfifos.h b/os/lib/include/chobjfifos.h index dfb0692ef..a422bf81d 100644 --- a/os/lib/include/chobjfifos.h +++ b/os/lib/include/chobjfifos.h @@ -204,6 +204,20 @@ static inline void chFifoReturnObjectI(objects_fifo_t *ofp, chGuardedPoolFreeI(&ofp->free, objp); } +/** + * @brief Releases a fetched object. + * + * @param[in] ofp pointer to a @p objects_fifo_t structure + * @param[in] objp pointer to the object to be released + * + * @sclass + */ +static inline void chFifoReturnObjectS(objects_fifo_t *ofp, + void *objp) { + + chGuardedPoolFreeS(&ofp->free, objp); +} + /** * @brief Releases a fetched object. * @@ -269,6 +283,57 @@ static inline void chFifoSendObject(objects_fifo_t *ofp, void *objp) { chDbgAssert(msg == MSG_OK, "post failed"); } +/** + * @brief Posts an high priority object. + * @note By design the object can be always immediately posted. + * + * @param[in] ofp pointer to a @p objects_fifo_t structure + * @param[in] objp pointer to the object to be posted + * + * @iclass + */ +static inline void chFifoSendObjectAheadI(objects_fifo_t *ofp, + void *objp) { + msg_t msg; + + msg = chMBPostAheadI(&ofp->mbx, (msg_t)objp); + chDbgAssert(msg == MSG_OK, "post failed"); +} + +/** + * @brief Posts an high priority object. + * @note By design the object can be always immediately posted. + * + * @param[in] ofp pointer to a @p objects_fifo_t structure + * @param[in] objp pointer to the object to be posted + * + * @sclass + */ +static inline void chFifoSendObjectAheadS(objects_fifo_t *ofp, + void *objp) { + msg_t msg; + + msg = chMBPostAheadTimeoutS(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE); + chDbgAssert(msg == MSG_OK, "post failed"); +} + +/** + * @brief Posts an high priority object. + * @note By design the object can be always immediately posted. + * + * @param[in] ofp pointer to a @p objects_fifo_t structure + * @param[in] objp pointer to the object to be released + * + * @api + */ +static inline void chFifoSendObjectAhead(objects_fifo_t *ofp, void *objp) { + + msg_t msg; + + msg = chMBPostAheadTimeout(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE); + chDbgAssert(msg == MSG_OK, "post failed"); +} + /** * @brief Fetches an object. * -- cgit v1.2.3