diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-09-24 14:01:10 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-09-24 14:01:10 +0000 |
commit | 419dd123e740ddbdb56a2a76a0b49e9f8480a785 (patch) | |
tree | 6c8501e4ab9b70f89f362105e5db8206d8d36a6d /os/rt | |
parent | 844094dc44cb49b534191cde1d60a05b7d6e00d9 (diff) | |
download | ChibiOS-419dd123e740ddbdb56a2a76a0b49e9f8480a785.tar.gz ChibiOS-419dd123e740ddbdb56a2a76a0b49e9f8480a785.tar.bz2 ChibiOS-419dd123e740ddbdb56a2a76a0b49e9f8480a785.zip |
Added chMBResetI().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7313 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/include/chmboxes.h | 1 | ||||
-rw-r--r-- | os/rt/src/chmboxes.c | 21 |
2 files changed, 19 insertions, 3 deletions
diff --git a/os/rt/include/chmboxes.h b/os/rt/include/chmboxes.h index 7194dae46..357ee89c9 100644 --- a/os/rt/include/chmboxes.h +++ b/os/rt/include/chmboxes.h @@ -110,6 +110,7 @@ extern "C" { #endif
void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n);
void chMBReset(mailbox_t *mbp);
+ void chMBResetI(mailbox_t *mbp);
msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t timeout);
msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout);
msg_t chMBPostI(mailbox_t *mbp, msg_t msg);
diff --git a/os/rt/src/chmboxes.c b/os/rt/src/chmboxes.c index 31a5e5970..b7ae4f7d1 100644 --- a/os/rt/src/chmboxes.c +++ b/os/rt/src/chmboxes.c @@ -105,14 +105,29 @@ void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n) { */
void chMBReset(mailbox_t *mbp) {
+ chSysLock();
+ chMBResetI(mbp);
+ chSchRescheduleS();
+ chSysUnlock();
+}
+
+/**
+ * @brief Resets a @p mailbox_t object.
+ * @details All the waiting threads are resumed with status @p MSG_RESET and
+ * the queued messages are lost.
+ *
+ * @param[in] mbp the pointer to an initialized @p mailbox_t object
+ *
+ * @api
+ */
+void chMBResetI(mailbox_t *mbp) {
+
+ chDbgCheckClassI();
chDbgCheck(mbp != NULL);
- chSysLock();
mbp->mb_wrptr = mbp->mb_rdptr = mbp->mb_buffer;
chSemResetI(&mbp->mb_emptysem, mbp->mb_top - mbp->mb_buffer);
chSemResetI(&mbp->mb_fullsem, 0);
- chSchRescheduleS();
- chSysUnlock();
}
/**
|