diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 12:58:35 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 12:58:35 +0000 |
commit | 4c2be4a8e9211f53e3b460de2ad5e9d3e4be70c8 (patch) | |
tree | ff9d69f7b2528008d5410895cf979cf158e918fb /src/include/mailboxes.h | |
parent | 6b6e5b95fb78af5f4c018c74b54b15a82b32d812 (diff) | |
download | ChibiOS-4c2be4a8e9211f53e3b460de2ad5e9d3e4be70c8.tar.gz ChibiOS-4c2be4a8e9211f53e3b460de2ad5e9d3e4be70c8.tar.bz2 ChibiOS-4c2be4a8e9211f53e3b460de2ad5e9d3e4be70c8.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@781 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/mailboxes.h')
-rw-r--r-- | src/include/mailboxes.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/include/mailboxes.h b/src/include/mailboxes.h index 03623e7bc..58e386e9f 100644 --- a/src/include/mailboxes.h +++ b/src/include/mailboxes.h @@ -52,22 +52,33 @@ extern "C" { #endif
/**
- * Verifies if the mailbox has space for an immediate message.
+ * Returns the mailbox buffer size.
+ * @param[in] mbp the pointer to an initialized Mailbox object
+ */
+#define chMBSize(mbp) \
+ ((mbp)->mb_top - (mbp)->mb_buffer)
+
+/**
+ * Returns the free space into the mailbox.
* @param[in] mbp the pointer to an initialized Mailbox object
* @return The number of empty message slots.
* @note Can be invoked in any system state but if invoked out of a locked
* state then the returned value may change after reading.
+ * @note The returned value can be less than zero when there are waiting
+ * threads on the internal semaphore.
*/
-#define chMBHasSpace(mbp) chSemGetCounterI(&(mbp)->mb_emptysem)
+#define chMBGetEmpty(mbp) chSemGetCounterI(&(mbp)->mb_emptysem)
/**
- * Verifies if the mailbox has incoming messages.
+ * Returns the number of messages into the mailbox.
* @param[in] mbp the pointer to an initialized Mailbox object
* @return The number of queued messages.
* @note Can be invoked in any system state but if invoked out of a locked
* state then the returned value may change after reading.
+ * @note The returned value can be less than zero when there are waiting
+ * threads on the internal semaphore.
*/
-#define chMBContainsMessages(mbp) chSemGetCounterI(&(mbp)->mb_fullsem)
+#define chMBGetFull(mbp) chSemGetCounterI(&(mbp)->mb_fullsem)
/**
* Returns the next message in the queue without removing it.
|