diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-03 08:50:33 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-10-03 08:50:33 +0000 |
commit | 7d2486a57ad2f63c30d00d1d4302e82e10467633 (patch) | |
tree | 41445cb98d7c42bf2afa607af7b32f4b22f3d002 | |
parent | 3a6f91354464e430dfb78bc81031815d7700bb97 (diff) | |
download | ChibiOS-7d2486a57ad2f63c30d00d1d4302e82e10467633.tar.gz ChibiOS-7d2486a57ad2f63c30d00d1d4302e82e10467633.tar.bz2 ChibiOS-7d2486a57ad2f63c30d00d1d4302e82e10467633.zip |
Mailboxes refactory for consistency.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10747 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | os/common/oslib/include/chfactory.h | 2 | ||||
-rw-r--r-- | os/common/oslib/include/chfifo.h | 10 | ||||
-rw-r--r-- | os/common/oslib/include/chmboxes.h | 26 | ||||
-rw-r--r-- | os/common/oslib/src/chfactory.c | 4 | ||||
-rw-r--r-- | os/common/oslib/src/chmboxes.c | 38 | ||||
-rw-r--r-- | readme.txt | 4 | ||||
-rw-r--r-- | test/nil/configuration.xml | 36 | ||||
-rw-r--r-- | test/nil/source/test/test_sequence_005.c | 52 | ||||
-rw-r--r-- | test/rt/configuration.xml | 36 | ||||
-rw-r--r-- | test/rt/source/test/test_sequence_009.c | 52 |
10 files changed, 132 insertions, 128 deletions
diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h index a18dfbefa..acb8c79a4 100644 --- a/os/common/oslib/include/chfactory.h +++ b/os/common/oslib/include/chfactory.h @@ -285,7 +285,7 @@ extern "C" { void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp);
#endif
#if (CH_CFG_FACTORY_MAILBOXES == TRUE) || defined(__DOXIGEN__)
- dyn_mailbox_t *chFactoryCreateMailbox(const char *name, cnt_t n);
+ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n);
dyn_mailbox_t *chFactoryFindMailbox(const char *name);
void chFactoryReleaseMailbox(dyn_mailbox_t *dmp);
#endif
diff --git a/os/common/oslib/include/chfifo.h b/os/common/oslib/include/chfifo.h index 494689f2f..8727fff84 100644 --- a/os/common/oslib/include/chfifo.h +++ b/os/common/oslib/include/chfifo.h @@ -127,7 +127,7 @@ static inline void chMailObjectInit(objects_fifo_t *ofp, size_t objsize, chGuardedPoolObjectInit(&ofp->free, objsize);
chGuardedPoolLoadArray(&ofp->free, objbuf, objn);
- chMBObjectInit(&ofp->mbx, msgbuf, (cnt_t)objn); /* TODO: make this a size_t, no more sems there.*/
+ chMBObjectInit(&ofp->mbx, msgbuf, objn);
}
/**
@@ -223,7 +223,7 @@ static inline void chFifoSendObjectS(objects_fifo_t *ofp, void *objp) {
msg_t msg;
- msg = chMBPostS(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE);
+ msg = chMBPostTimeoutS(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE);
chDbgAssert(msg == MSG_OK, "post failed");
}
@@ -240,7 +240,7 @@ static inline void chFifoSendObject(objects_fifo_t *ofp, void *objp) { msg_t msg;
- msg = chMBPost(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE);
+ msg = chMBPostTimeout(&ofp->mbx, (msg_t)objp, TIME_IMMEDIATE);
chDbgAssert(msg == MSG_OK, "post failed");
}
@@ -281,7 +281,7 @@ static inline msg_t chFifoReceiveObjectTimeoutS(objects_fifo_t *ofp, void **objpp,
systime_t timeout) {
- return chMBFetchS(&ofp->mbx, (msg_t *)objpp, timeout);
+ return chMBFetchTimeoutS(&ofp->mbx, (msg_t *)objpp, timeout);
}
/**
@@ -304,7 +304,7 @@ static inline msg_t chFifoReceiveObjectTimeout(objects_fifo_t *ofp, void **objpp,
systime_t timeout) {
- return chMBFetch(&ofp->mbx, (msg_t *)objpp, timeout);
+ return chMBFetchTimeout(&ofp->mbx, (msg_t *)objpp, timeout);
}
#endif /* CH_CFG_USE_FIFO == TRUE */
diff --git a/os/common/oslib/include/chmboxes.h b/os/common/oslib/include/chmboxes.h index c31948296..e6ffd7b82 100644 --- a/os/common/oslib/include/chmboxes.h +++ b/os/common/oslib/include/chmboxes.h @@ -60,7 +60,7 @@ typedef struct { after the buffer. */
msg_t *wrptr; /**< @brief Write pointer. */
msg_t *rdptr; /**< @brief Read pointer. */
- cnt_t cnt; /**< @brief Messages in queue. */
+ size_t cnt; /**< @brief Messages in queue. */
bool reset; /**< @brief True in reset state. */
threads_queue_t qw; /**< @brief Queued writers. */
threads_queue_t qr; /**< @brief Queued readers. */
@@ -84,7 +84,7 @@ typedef struct { (msg_t *)(buffer) + size, \
(msg_t *)(buffer), \
(msg_t *)(buffer), \
- (cnt_t)0, \
+ (size_t)0, \
false, \
_THREADS_QUEUE_DATA(name.qw), \
_THREADS_QUEUE_DATA(name.qr), \
@@ -109,17 +109,17 @@ typedef struct { #ifdef __cplusplus
extern "C" {
#endif
- void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n);
+ void chMBObjectInit(mailbox_t *mbp, msg_t *buf, size_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 chMBPostTimeout(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostTimeoutS(mailbox_t *mbp, msg_t msg, systime_t timeout);
msg_t chMBPostI(mailbox_t *mbp, msg_t msg);
- msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t timeout);
- msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostAheadTimeout(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostAheadTimeoutS(mailbox_t *mbp, msg_t msg, systime_t timeout);
msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg);
- msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
- msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
+ msg_t chMBFetchTimeout(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
+ msg_t chMBFetchTimeoutS(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp);
#ifdef __cplusplus
}
@@ -137,11 +137,11 @@ extern "C" { *
* @iclass
*/
-static inline cnt_t chMBGetSizeI(const mailbox_t *mbp) {
+static inline size_t chMBGetSizeI(const mailbox_t *mbp) {
/*lint -save -e9033 [10.8] Perfectly safe pointers
arithmetic.*/
- return (cnt_t)(mbp->top - mbp->buffer);
+ return (size_t)(mbp->top - mbp->buffer);
/*lint -restore*/
}
@@ -154,7 +154,7 @@ static inline cnt_t chMBGetSizeI(const mailbox_t *mbp) { *
* @iclass
*/
-static inline cnt_t chMBGetUsedCountI(const mailbox_t *mbp) {
+static inline size_t chMBGetUsedCountI(const mailbox_t *mbp) {
chDbgCheckClassI();
@@ -169,7 +169,7 @@ static inline cnt_t chMBGetUsedCountI(const mailbox_t *mbp) { *
* @iclass
*/
-static inline cnt_t chMBGetFreeCountI(const mailbox_t *mbp) {
+static inline size_t chMBGetFreeCountI(const mailbox_t *mbp) {
chDbgCheckClassI();
diff --git a/os/common/oslib/src/chfactory.c b/os/common/oslib/src/chfactory.c index 48b88441b..b7e355143 100644 --- a/os/common/oslib/src/chfactory.c +++ b/os/common/oslib/src/chfactory.c @@ -505,7 +505,7 @@ void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp) { *
* @api
*/
-dyn_mailbox_t *chFactoryCreateMailbox(const char *name, cnt_t n) {
+dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n) {
dyn_mailbox_t *dmp;
chSysLock();
@@ -513,7 +513,7 @@ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, cnt_t n) { dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
&ch_factory.mbx_list,
sizeof (dyn_mailbox_t) +
- ((size_t)n * sizeof (msg_t)));
+ (n * sizeof (msg_t)));
if (dmp != NULL) {
/* Initializing mailbox object data.*/
chMBObjectInit(&dmp->mbx, dmp->buffer, n);
diff --git a/os/common/oslib/src/chmboxes.c b/os/common/oslib/src/chmboxes.c index 8e543bf4d..5f2f9b6a3 100644 --- a/os/common/oslib/src/chmboxes.c +++ b/os/common/oslib/src/chmboxes.c @@ -84,15 +84,15 @@ *
* @init
*/
-void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n) {
+void chMBObjectInit(mailbox_t *mbp, msg_t *buf, size_t n) {
- chDbgCheck((mbp != NULL) && (buf != NULL) && (n > (cnt_t)0));
+ chDbgCheck((mbp != NULL) && (buf != NULL) && (n > (size_t)0));
mbp->buffer = buf;
mbp->rdptr = buf;
mbp->wrptr = buf;
mbp->top = &buf[n];
- mbp->cnt = (cnt_t)0;
+ mbp->cnt = (size_t)0;
mbp->reset = false;
chThdQueueObjectInit(&mbp->qw);
chThdQueueObjectInit(&mbp->qr);
@@ -137,7 +137,7 @@ void chMBResetI(mailbox_t *mbp) { mbp->wrptr = mbp->buffer;
mbp->rdptr = mbp->buffer;
- mbp->cnt = (cnt_t)0;
+ mbp->cnt = (size_t)0;
mbp->reset = true;
chThdDequeueAllI(&mbp->qw, MSG_RESET);
chThdDequeueAllI(&mbp->qr, MSG_RESET);
@@ -162,11 +162,11 @@ void chMBResetI(mailbox_t *mbp) { *
* @api
*/
-msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t timeout) {
+msg_t chMBPostTimeout(mailbox_t *mbp, msg_t msg, systime_t timeout) {
msg_t rdymsg;
chSysLock();
- rdymsg = chMBPostS(mbp, msg, timeout);
+ rdymsg = chMBPostTimeoutS(mbp, msg, timeout);
chSysUnlock();
return rdymsg;
@@ -191,7 +191,7 @@ msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t timeout) { *
* @sclass
*/
-msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
+msg_t chMBPostTimeoutS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
msg_t rdymsg;
chDbgCheckClassS();
@@ -204,7 +204,7 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout) { }
/* Is there a free message slot in queue? if so then post.*/
- if (chMBGetFreeCountI(mbp) > (cnt_t)0) {
+ if (chMBGetFreeCountI(mbp) > (size_t)0) {
*mbp->wrptr++ = msg;
if (mbp->wrptr >= mbp->top) {
mbp->wrptr = mbp->buffer;
@@ -251,7 +251,7 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) { }
/* Is there a free message slot in queue? if so then post.*/
- if (chMBGetFreeCountI(mbp) > (cnt_t)0) {
+ if (chMBGetFreeCountI(mbp) > (size_t)0) {
*mbp->wrptr++ = msg;
if (mbp->wrptr >= mbp->top) {
mbp->wrptr = mbp->buffer;
@@ -287,11 +287,11 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) { *
* @api
*/
-msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t timeout) {
+msg_t chMBPostAheadTimeout(mailbox_t *mbp, msg_t msg, systime_t timeout) {
msg_t rdymsg;
chSysLock();
- rdymsg = chMBPostAheadS(mbp, msg, timeout);
+ rdymsg = chMBPostAheadTimeoutS(mbp, msg, timeout);
chSysUnlock();
return rdymsg;
@@ -316,7 +316,7 @@ msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t timeout) { *
* @sclass
*/
-msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
+msg_t chMBPostAheadTimeoutS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
msg_t rdymsg;
chDbgCheckClassS();
@@ -329,7 +329,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout) { }
/* Is there a free message slot in queue? if so then post.*/
- if (chMBGetFreeCountI(mbp) > (cnt_t)0) {
+ if (chMBGetFreeCountI(mbp) > (size_t)0) {
if (--mbp->rdptr < mbp->buffer) {
mbp->rdptr = mbp->top - 1;
}
@@ -376,7 +376,7 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) { }
/* Is there a free message slot in queue? if so then post.*/
- if (chMBGetFreeCountI(mbp) > (cnt_t)0) {
+ if (chMBGetFreeCountI(mbp) > (size_t)0) {
if (--mbp->rdptr < mbp->buffer) {
mbp->rdptr = mbp->top - 1;
}
@@ -412,11 +412,11 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) { *
* @api
*/
-msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
+msg_t chMBFetchTimeout(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
msg_t rdymsg;
chSysLock();
- rdymsg = chMBFetchS(mbp, msgp, timeout);
+ rdymsg = chMBFetchTimeoutS(mbp, msgp, timeout);
chSysUnlock();
return rdymsg;
@@ -441,7 +441,7 @@ msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t timeout) { *
* @sclass
*/
-msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
+msg_t chMBFetchTimeoutS(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
msg_t rdymsg;
chDbgCheckClassS();
@@ -454,7 +454,7 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout) { }
/* Is there a message in queue? if so then fetch.*/
- if (chMBGetUsedCountI(mbp) > (cnt_t)0) {
+ if (chMBGetUsedCountI(mbp) > (size_t)0) {
*msgp = *mbp->rdptr++;
if (mbp->rdptr >= mbp->top) {
mbp->rdptr = mbp->buffer;
@@ -501,7 +501,7 @@ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) { }
/* Is there a message in queue? if so then fetch.*/
- if (chMBGetUsedCountI(mbp) > (cnt_t)0) {
+ if (chMBGetUsedCountI(mbp) > (size_t)0) {
*msgp = *mbp->rdptr++;
if (mbp->rdptr >= mbp->top) {
mbp->rdptr = mbp->buffer;
diff --git a/readme.txt b/readme.txt index dad395474..7efa5ddeb 100644 --- a/readme.txt +++ b/readme.txt @@ -89,6 +89,10 @@ *****************************************************************************
*** Next ***
+- NEW: Mailbox API changed by adding "Timeout" to those function that have
+ timeout capability, for consistency with the rest of the system.
+- NEW: Modified mailboxes to use a size_t as counter instead of a cnt_t,
+ this is a leftover of semaphores in previous mailboxes implementation.
- NEW: Added a new function to RT events chEvtAddEventsI().
- NEW: Integrated the latest FatFS 0.13 with patches.
- NEW: Improved RT and NIL test suite to report version numbers and
diff --git a/test/nil/configuration.xml b/test/nil/configuration.xml index 2eaa24bd0..542ccb8b6 100644 --- a/test/nil/configuration.xml +++ b/test/nil/configuration.xml @@ -827,28 +827,28 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]] <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, (msg_t)0, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBPostAhead(&mb1, (msg_t)0, TIME_INFINITE);
+msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
chMBResumeX(&mb1);]]></value>
</code>
</step>
<step>
<description>
- <value>Filling the mailbox using chMBPost() and chMBPostAhead() once, no errors expected.</value>
+ <value>Filling the mailbox using chMBPostTimeout() and chMBPostAheadTimeout() once, no errors expected.</value>
</description>
<tags>
<value />
</tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
-msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE);
+msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -867,14 +867,14 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value> </step>
<step>
<description>
- <value>Emptying the mailbox using chMBFetch(), no errors expected.</value>
+ <value>Emptying the mailbox using chMBFetchTimeout(), no errors expected.</value>
</description>
<tags>
<value />
</tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
test_emit_token(msg2);
}
@@ -889,9 +889,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1022,9 +1022,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -1076,26 +1076,26 @@ unsigned i;]]></value> </tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}]]></value>
</code>
</step>
<step>
<description>
- <value>Testing chMBPost(), chMBPostI(), chMBPostAhead() and chMBPostAheadI() timeout.</value>
+ <value>Testing chMBPostTimeout(), chMBPostI(), chMBPostAheadTimeout() and chMBPostAheadI() timeout.</value>
</description>
<tags>
<value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'X', 1);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostI(&mb1, 'X');
chSysUnlock();
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-msg1 = chMBPostAhead(&mb1, 'X', 1);
+msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostAheadI(&mb1, 'X');
@@ -1117,13 +1117,13 @@ chMBResumeX(&mb1);]]></value> </step>
<step>
<description>
- <value>Testing chMBFetch() and chMBFetchI() timeout.</value>
+ <value>Testing chMBFetchTimeout() and chMBFetchI() timeout.</value>
</description>
<tags>
<value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBFetch(&mb1, &msg2, 1);
+ <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
diff --git a/test/nil/source/test/test_sequence_005.c b/test/nil/source/test/test_sequence_005.c index 32307b284..fbca897f9 100644 --- a/test/nil/source/test/test_sequence_005.c +++ b/test/nil/source/test/test_sequence_005.c @@ -72,11 +72,11 @@ static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE); * expected.
* - [5.1.3] Testing the behavior of API when the mailbox is in reset
* state then return in active state.
- * - [5.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
- * once, no errors expected.
+ * - [5.1.4] Filling the mailbox using chMBPostTimeout() and
+ * chMBPostAheadTimeout() once, no errors expected.
* - [5.1.5] Testing intermediate conditions. Data pointers must be
* aligned, semaphore counters are checked.
- * - [5.1.6] Emptying the mailbox using chMBFetch(), no errors
+ * - [5.1.6] Emptying the mailbox using chMBFetchTimeout(), no errors
* expected.
* - [5.1.7] Posting and then fetching one more message, no errors
* expected.
@@ -118,24 +118,24 @@ static void test_005_001_execute(void) { state then return in active state.*/
test_set_step(3);
{
- msg1 = chMBPost(&mb1, (msg_t)0, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
- msg1 = chMBPostAhead(&mb1, (msg_t)0, TIME_INFINITE);
+ msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
chMBResumeX(&mb1);
}
- /* [5.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
- once, no errors expected.*/
+ /* [5.1.4] Filling the mailbox using chMBPostTimeout() and
+ chMBPostAheadTimeout() once, no errors expected.*/
test_set_step(4);
{
for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
- msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE);
+ msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -148,12 +148,12 @@ static void test_005_001_execute(void) { test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");
}
- /* [5.1.6] Emptying the mailbox using chMBFetch(), no errors
+ /* [5.1.6] Emptying the mailbox using chMBFetchTimeout(), no errors
expected.*/
test_set_step(6);
{
for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
test_emit_token(msg2);
}
@@ -164,9 +164,9 @@ static void test_005_001_execute(void) { expected.*/
test_set_step(7);
{
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -287,9 +287,9 @@ static void test_005_002_execute(void) { expected.*/
test_set_step(6);
{
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -319,10 +319,10 @@ static const testcase_t test_005_002 = { *
* <h2>Test Steps</h2>
* - [5.3.1] Filling the mailbox.
- * - [5.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
- * chMBPostAheadI() timeout.
+ * - [5.3.2] Testing chMBPostTimeout(), chMBPostI(),
+ * chMBPostAheadTimeout() and chMBPostAheadI() timeout.
* - [5.3.3] Resetting the mailbox.
- * - [5.3.4] Testing chMBFetch() and chMBFetchI() timeout.
+ * - [5.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.
* .
*/
@@ -342,22 +342,22 @@ static void test_005_003_execute(void) { test_set_step(1);
{
for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
}
- /* [5.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
- chMBPostAheadI() timeout.*/
+ /* [5.3.2] Testing chMBPostTimeout(), chMBPostI(),
+ chMBPostAheadTimeout() and chMBPostAheadI() timeout.*/
test_set_step(2);
{
- msg1 = chMBPost(&mb1, 'X', 1);
+ msg1 = chMBPostTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostI(&mb1, 'X');
chSysUnlock();
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
- msg1 = chMBPostAhead(&mb1, 'X', 1);
+ msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostAheadI(&mb1, 'X');
@@ -372,10 +372,10 @@ static void test_005_003_execute(void) { chMBResumeX(&mb1);
}
- /* [5.3.4] Testing chMBFetch() and chMBFetchI() timeout.*/
+ /* [5.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.*/
test_set_step(4);
{
- msg1 = chMBFetch(&mb1, &msg2, 1);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml index 162b85bd2..00ecd82a8 100644 --- a/test/rt/configuration.xml +++ b/test/rt/configuration.xml @@ -3216,28 +3216,28 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]] <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, (msg_t)0, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBPostAhead(&mb1, (msg_t)0, TIME_INFINITE);
+msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
chMBResumeX(&mb1);]]></value>
</code>
</step>
<step>
<description>
- <value>Filling the mailbox using chMBPost() and chMBPostAhead() once, no errors expected.</value>
+ <value>Filling the mailbox using chMBPostTimeout() and chMBPostAheadTimeout() once, no errors expected.</value>
</description>
<tags>
<value />
</tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
-msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE);
+msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3256,14 +3256,14 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value> </step>
<step>
<description>
- <value>Emptying the mailbox using chMBFetch(), no errors expected.</value>
+ <value>Emptying the mailbox using chMBFetchTimeout(), no errors expected.</value>
</description>
<tags>
<value />
</tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
test_emit_token(msg2);
}
@@ -3278,9 +3278,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3411,9 +3411,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value> <value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
-msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
</code>
</step>
@@ -3465,26 +3465,26 @@ unsigned i;]]></value> </tags>
<code>
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}]]></value>
</code>
</step>
<step>
<description>
- <value>Testing chMBPost(), chMBPostI(), chMBPostAhead() and chMBPostAheadI() timeout.</value>
+ <value>Testing chMBPostTimeout(), chMBPostI(), chMBPostAheadTimeout() and chMBPostAheadI() timeout.</value>
</description>
<tags>
<value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBPost(&mb1, 'X', 1);
+ <value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostI(&mb1, 'X');
chSysUnlock();
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
-msg1 = chMBPostAhead(&mb1, 'X', 1);
+msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostAheadI(&mb1, 'X');
@@ -3506,13 +3506,13 @@ chMBResumeX(&mb1);]]></value> </step>
<step>
<description>
- <value>Testing chMBFetch() and chMBFetchI() timeout.</value>
+ <value>Testing chMBFetchTimeout() and chMBFetchI() timeout.</value>
</description>
<tags>
<value />
</tags>
<code>
- <value><![CDATA[msg1 = chMBFetch(&mb1, &msg2, 1);
+ <value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
diff --git a/test/rt/source/test/test_sequence_009.c b/test/rt/source/test/test_sequence_009.c index 671f829f9..92ec11b77 100644 --- a/test/rt/source/test/test_sequence_009.c +++ b/test/rt/source/test/test_sequence_009.c @@ -71,11 +71,11 @@ static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE); * expected.
* - [9.1.3] Testing the behavior of API when the mailbox is in reset
* state then return in active state.
- * - [9.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
- * once, no errors expected.
+ * - [9.1.4] Filling the mailbox using chMBPostTimeout() and
+ * chMBPostAheadTimeout() once, no errors expected.
* - [9.1.5] Testing intermediate conditions. Data pointers must be
* aligned, semaphore counters are checked.
- * - [9.1.6] Emptying the mailbox using chMBFetch(), no errors
+ * - [9.1.6] Emptying the mailbox using chMBFetchTimeout(), no errors
* expected.
* - [9.1.7] Posting and then fetching one more message, no errors
* expected.
@@ -117,24 +117,24 @@ static void test_009_001_execute(void) { state then return in active state.*/
test_set_step(3);
{
- msg1 = chMBPost(&mb1, (msg_t)0, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
- msg1 = chMBPostAhead(&mb1, (msg_t)0, TIME_INFINITE);
+ msg1 = chMBPostAheadTimeout(&mb1, (msg_t)0, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_RESET, "not in reset state");
chMBResumeX(&mb1);
}
- /* [9.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
- once, no errors expected.*/
+ /* [9.1.4] Filling the mailbox using chMBPostTimeout() and
+ chMBPostAheadTimeout() once, no errors expected.*/
test_set_step(4);
{
for (i = 0; i < MB_SIZE - 1; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
- msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE);
+ msg1 = chMBPostAheadTimeout(&mb1, 'A', TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -147,12 +147,12 @@ static void test_009_001_execute(void) { test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");
}
- /* [9.1.6] Emptying the mailbox using chMBFetch(), no errors
+ /* [9.1.6] Emptying the mailbox using chMBFetchTimeout(), no errors
expected.*/
test_set_step(6);
{
for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
test_emit_token(msg2);
}
@@ -163,9 +163,9 @@ static void test_009_001_execute(void) { expected.*/
test_set_step(7);
{
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -286,9 +286,9 @@ static void test_009_002_execute(void) { expected.*/
test_set_step(6);
{
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
- msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
@@ -318,11 +318,11 @@ static const testcase_t test_009_002 = { *
* <h2>Test Steps</h2>
* - [9.3.1] Filling the mailbox.
- * - [9.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
- * chMBPostAheadI() timeout.
+ * - [9.3.2] Testing chMBPostTimeout(), chMBPostI(),
+ * chMBPostAheadTimeout() and chMBPostAheadI() timeout.
* - [9.3.3] Resetting the mailbox. The mailbox is then returned in
* active state.
- * - [9.3.4] Testing chMBFetch() and chMBFetchI() timeout.
+ * - [9.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.
* .
*/
@@ -342,22 +342,22 @@ static void test_009_003_execute(void) { test_set_step(1);
{
for (i = 0; i < MB_SIZE; i++) {
- msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE);
+ msg1 = chMBPostTimeout(&mb1, 'B' + i, TIME_INFINITE);
test_assert(msg1 == MSG_OK, "wrong wake-up message");
}
}
- /* [9.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
- chMBPostAheadI() timeout.*/
+ /* [9.3.2] Testing chMBPostTimeout(), chMBPostI(),
+ chMBPostAheadTimeout() and chMBPostAheadI() timeout.*/
test_set_step(2);
{
- msg1 = chMBPost(&mb1, 'X', 1);
+ msg1 = chMBPostTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostI(&mb1, 'X');
chSysUnlock();
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
- msg1 = chMBPostAhead(&mb1, 'X', 1);
+ msg1 = chMBPostAheadTimeout(&mb1, 'X', 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBPostAheadI(&mb1, 'X');
@@ -373,10 +373,10 @@ static void test_009_003_execute(void) { chMBResumeX(&mb1);
}
- /* [9.3.4] Testing chMBFetch() and chMBFetchI() timeout.*/
+ /* [9.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.*/
test_set_step(4);
{
- msg1 = chMBFetch(&mb1, &msg2, 1);
+ msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
|