Mailboxes refactory for consistency.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10747 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
3a6f913544
commit
7d2486a57a
|
@ -285,7 +285,7 @@ extern "C" {
|
||||||
void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp);
|
void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp);
|
||||||
#endif
|
#endif
|
||||||
#if (CH_CFG_FACTORY_MAILBOXES == TRUE) || defined(__DOXIGEN__)
|
#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);
|
dyn_mailbox_t *chFactoryFindMailbox(const char *name);
|
||||||
void chFactoryReleaseMailbox(dyn_mailbox_t *dmp);
|
void chFactoryReleaseMailbox(dyn_mailbox_t *dmp);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -127,7 +127,7 @@ static inline void chMailObjectInit(objects_fifo_t *ofp, size_t objsize,
|
||||||
|
|
||||||
chGuardedPoolObjectInit(&ofp->free, objsize);
|
chGuardedPoolObjectInit(&ofp->free, objsize);
|
||||||
chGuardedPoolLoadArray(&ofp->free, objbuf, objn);
|
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) {
|
void *objp) {
|
||||||
msg_t msg;
|
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");
|
chDbgAssert(msg == MSG_OK, "post failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static inline void chFifoSendObject(objects_fifo_t *ofp, void *objp) {
|
||||||
|
|
||||||
msg_t msg;
|
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");
|
chDbgAssert(msg == MSG_OK, "post failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ static inline msg_t chFifoReceiveObjectTimeoutS(objects_fifo_t *ofp,
|
||||||
void **objpp,
|
void **objpp,
|
||||||
systime_t timeout) {
|
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,
|
void **objpp,
|
||||||
systime_t timeout) {
|
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 */
|
#endif /* CH_CFG_USE_FIFO == TRUE */
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef struct {
|
||||||
after the buffer. */
|
after the buffer. */
|
||||||
msg_t *wrptr; /**< @brief Write pointer. */
|
msg_t *wrptr; /**< @brief Write pointer. */
|
||||||
msg_t *rdptr; /**< @brief Read 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. */
|
bool reset; /**< @brief True in reset state. */
|
||||||
threads_queue_t qw; /**< @brief Queued writers. */
|
threads_queue_t qw; /**< @brief Queued writers. */
|
||||||
threads_queue_t qr; /**< @brief Queued readers. */
|
threads_queue_t qr; /**< @brief Queued readers. */
|
||||||
|
@ -84,7 +84,7 @@ typedef struct {
|
||||||
(msg_t *)(buffer) + size, \
|
(msg_t *)(buffer) + size, \
|
||||||
(msg_t *)(buffer), \
|
(msg_t *)(buffer), \
|
||||||
(msg_t *)(buffer), \
|
(msg_t *)(buffer), \
|
||||||
(cnt_t)0, \
|
(size_t)0, \
|
||||||
false, \
|
false, \
|
||||||
_THREADS_QUEUE_DATA(name.qw), \
|
_THREADS_QUEUE_DATA(name.qw), \
|
||||||
_THREADS_QUEUE_DATA(name.qr), \
|
_THREADS_QUEUE_DATA(name.qr), \
|
||||||
|
@ -109,17 +109,17 @@ typedef struct {
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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 chMBReset(mailbox_t *mbp);
|
||||||
void chMBResetI(mailbox_t *mbp);
|
void chMBResetI(mailbox_t *mbp);
|
||||||
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 chMBPostS(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 chMBPostI(mailbox_t *mbp, msg_t msg);
|
||||||
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 chMBPostAheadS(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 chMBPostAheadI(mailbox_t *mbp, msg_t msg);
|
||||||
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 chMBFetchS(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);
|
msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -137,11 +137,11 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @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
|
/*lint -save -e9033 [10.8] Perfectly safe pointers
|
||||||
arithmetic.*/
|
arithmetic.*/
|
||||||
return (cnt_t)(mbp->top - mbp->buffer);
|
return (size_t)(mbp->top - mbp->buffer);
|
||||||
/*lint -restore*/
|
/*lint -restore*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static inline cnt_t chMBGetSizeI(const mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline cnt_t chMBGetUsedCountI(const mailbox_t *mbp) {
|
static inline size_t chMBGetUsedCountI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ static inline cnt_t chMBGetUsedCountI(const mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline cnt_t chMBGetFreeCountI(const mailbox_t *mbp) {
|
static inline size_t chMBGetFreeCountI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,7 @@ void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp) {
|
||||||
*
|
*
|
||||||
* @api
|
* @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;
|
dyn_mailbox_t *dmp;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
@ -513,7 +513,7 @@ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, cnt_t n) {
|
||||||
dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
|
dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
|
||||||
&ch_factory.mbx_list,
|
&ch_factory.mbx_list,
|
||||||
sizeof (dyn_mailbox_t) +
|
sizeof (dyn_mailbox_t) +
|
||||||
((size_t)n * sizeof (msg_t)));
|
(n * sizeof (msg_t)));
|
||||||
if (dmp != NULL) {
|
if (dmp != NULL) {
|
||||||
/* Initializing mailbox object data.*/
|
/* Initializing mailbox object data.*/
|
||||||
chMBObjectInit(&dmp->mbx, dmp->buffer, n);
|
chMBObjectInit(&dmp->mbx, dmp->buffer, n);
|
||||||
|
|
|
@ -84,15 +84,15 @@
|
||||||
*
|
*
|
||||||
* @init
|
* @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->buffer = buf;
|
||||||
mbp->rdptr = buf;
|
mbp->rdptr = buf;
|
||||||
mbp->wrptr = buf;
|
mbp->wrptr = buf;
|
||||||
mbp->top = &buf[n];
|
mbp->top = &buf[n];
|
||||||
mbp->cnt = (cnt_t)0;
|
mbp->cnt = (size_t)0;
|
||||||
mbp->reset = false;
|
mbp->reset = false;
|
||||||
chThdQueueObjectInit(&mbp->qw);
|
chThdQueueObjectInit(&mbp->qw);
|
||||||
chThdQueueObjectInit(&mbp->qr);
|
chThdQueueObjectInit(&mbp->qr);
|
||||||
|
@ -137,7 +137,7 @@ void chMBResetI(mailbox_t *mbp) {
|
||||||
|
|
||||||
mbp->wrptr = mbp->buffer;
|
mbp->wrptr = mbp->buffer;
|
||||||
mbp->rdptr = mbp->buffer;
|
mbp->rdptr = mbp->buffer;
|
||||||
mbp->cnt = (cnt_t)0;
|
mbp->cnt = (size_t)0;
|
||||||
mbp->reset = true;
|
mbp->reset = true;
|
||||||
chThdDequeueAllI(&mbp->qw, MSG_RESET);
|
chThdDequeueAllI(&mbp->qw, MSG_RESET);
|
||||||
chThdDequeueAllI(&mbp->qr, MSG_RESET);
|
chThdDequeueAllI(&mbp->qr, MSG_RESET);
|
||||||
|
@ -162,11 +162,11 @@ void chMBResetI(mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @api
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
rdymsg = chMBPostS(mbp, msg, timeout);
|
rdymsg = chMBPostTimeoutS(mbp, msg, timeout);
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
||||||
return rdymsg;
|
return rdymsg;
|
||||||
|
@ -191,7 +191,7 @@ msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t timeout) {
|
||||||
*
|
*
|
||||||
* @sclass
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chDbgCheckClassS();
|
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.*/
|
/* 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;
|
*mbp->wrptr++ = msg;
|
||||||
if (mbp->wrptr >= mbp->top) {
|
if (mbp->wrptr >= mbp->top) {
|
||||||
mbp->wrptr = mbp->buffer;
|
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.*/
|
/* 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;
|
*mbp->wrptr++ = msg;
|
||||||
if (mbp->wrptr >= mbp->top) {
|
if (mbp->wrptr >= mbp->top) {
|
||||||
mbp->wrptr = mbp->buffer;
|
mbp->wrptr = mbp->buffer;
|
||||||
|
@ -287,11 +287,11 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
|
||||||
*
|
*
|
||||||
* @api
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
rdymsg = chMBPostAheadS(mbp, msg, timeout);
|
rdymsg = chMBPostAheadTimeoutS(mbp, msg, timeout);
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
||||||
return rdymsg;
|
return rdymsg;
|
||||||
|
@ -316,7 +316,7 @@ msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t timeout) {
|
||||||
*
|
*
|
||||||
* @sclass
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chDbgCheckClassS();
|
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.*/
|
/* 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) {
|
if (--mbp->rdptr < mbp->buffer) {
|
||||||
mbp->rdptr = mbp->top - 1;
|
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.*/
|
/* 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) {
|
if (--mbp->rdptr < mbp->buffer) {
|
||||||
mbp->rdptr = mbp->top - 1;
|
mbp->rdptr = mbp->top - 1;
|
||||||
}
|
}
|
||||||
|
@ -412,11 +412,11 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
|
||||||
*
|
*
|
||||||
* @api
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
rdymsg = chMBFetchS(mbp, msgp, timeout);
|
rdymsg = chMBFetchTimeoutS(mbp, msgp, timeout);
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
|
||||||
return rdymsg;
|
return rdymsg;
|
||||||
|
@ -441,7 +441,7 @@ msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
|
||||||
*
|
*
|
||||||
* @sclass
|
* @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;
|
msg_t rdymsg;
|
||||||
|
|
||||||
chDbgCheckClassS();
|
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.*/
|
/* 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++;
|
*msgp = *mbp->rdptr++;
|
||||||
if (mbp->rdptr >= mbp->top) {
|
if (mbp->rdptr >= mbp->top) {
|
||||||
mbp->rdptr = mbp->buffer;
|
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.*/
|
/* 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++;
|
*msgp = *mbp->rdptr++;
|
||||||
if (mbp->rdptr >= mbp->top) {
|
if (mbp->rdptr >= mbp->top) {
|
||||||
mbp->rdptr = mbp->buffer;
|
mbp->rdptr = mbp->buffer;
|
||||||
|
|
|
@ -89,6 +89,10 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** Next ***
|
*** 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: Added a new function to RT events chEvtAddEventsI().
|
||||||
- NEW: Integrated the latest FatFS 0.13 with patches.
|
- NEW: Integrated the latest FatFS 0.13 with patches.
|
||||||
- NEW: Improved RT and NIL test suite to report version numbers and
|
- NEW: Improved RT and NIL test suite to report version numbers and
|
||||||
|
|
|
@ -827,28 +827,28 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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");
|
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");
|
test_assert(msg1 == MSG_RESET, "not in reset state");
|
||||||
chMBResumeX(&mb1);]]></value>
|
chMBResumeX(&mb1);]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<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>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -867,14 +867,14 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Emptying the mailbox using chMBFetch(), no errors expected.</value>
|
<value>Emptying the mailbox using chMBFetchTimeout(), no errors expected.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
|
<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_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
|
@ -889,9 +889,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -1022,9 +1022,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -1076,26 +1076,26 @@ unsigned i;]]></value>
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
|
<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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}]]></value>
|
}]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Testing chMBPost(), chMBPostI(), chMBPostAhead() and chMBPostAheadI() timeout.</value>
|
<value>Testing chMBPostTimeout(), chMBPostI(), chMBPostAheadTimeout() and chMBPostAheadI() timeout.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[msg1 = chMBPost(&mb1, 'X', 1);
|
<value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostI(&mb1, 'X');
|
msg1 = chMBPostI(&mb1, 'X');
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
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");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostAheadI(&mb1, 'X');
|
msg1 = chMBPostAheadI(&mb1, 'X');
|
||||||
|
@ -1117,13 +1117,13 @@ chMBResumeX(&mb1);]]></value>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Testing chMBFetch() and chMBFetchI() timeout.</value>
|
<value>Testing chMBFetchTimeout() and chMBFetchI() timeout.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[msg1 = chMBFetch(&mb1, &msg2, 1);
|
<value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBFetchI(&mb1, &msg2);
|
msg1 = chMBFetchI(&mb1, &msg2);
|
||||||
|
|
|
@ -72,11 +72,11 @@ static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE);
|
||||||
* expected.
|
* expected.
|
||||||
* - [5.1.3] Testing the behavior of API when the mailbox is in reset
|
* - [5.1.3] Testing the behavior of API when the mailbox is in reset
|
||||||
* state then return in active state.
|
* state then return in active state.
|
||||||
* - [5.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
|
* - [5.1.4] Filling the mailbox using chMBPostTimeout() and
|
||||||
* once, no errors expected.
|
* chMBPostAheadTimeout() once, no errors expected.
|
||||||
* - [5.1.5] Testing intermediate conditions. Data pointers must be
|
* - [5.1.5] Testing intermediate conditions. Data pointers must be
|
||||||
* aligned, semaphore counters are checked.
|
* 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.
|
* expected.
|
||||||
* - [5.1.7] Posting and then fetching one more message, no errors
|
* - [5.1.7] Posting and then fetching one more message, no errors
|
||||||
* expected.
|
* expected.
|
||||||
|
@ -118,24 +118,24 @@ static void test_005_001_execute(void) {
|
||||||
state then return in active state.*/
|
state then return in active state.*/
|
||||||
test_set_step(3);
|
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");
|
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");
|
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");
|
test_assert(msg1 == MSG_RESET, "not in reset state");
|
||||||
chMBResumeX(&mb1);
|
chMBResumeX(&mb1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [5.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
|
/* [5.1.4] Filling the mailbox using chMBPostTimeout() and
|
||||||
once, no errors expected.*/
|
chMBPostAheadTimeout() once, no errors expected.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE - 1; i++) {
|
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");
|
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");
|
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");
|
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.*/
|
expected.*/
|
||||||
test_set_step(6);
|
test_set_step(6);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE; i++) {
|
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_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
|
@ -164,9 +164,9 @@ static void test_005_001_execute(void) {
|
||||||
expected.*/
|
expected.*/
|
||||||
test_set_step(7);
|
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");
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,9 +287,9 @@ static void test_005_002_execute(void) {
|
||||||
expected.*/
|
expected.*/
|
||||||
test_set_step(6);
|
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");
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,10 +319,10 @@ static const testcase_t test_005_002 = {
|
||||||
*
|
*
|
||||||
* <h2>Test Steps</h2>
|
* <h2>Test Steps</h2>
|
||||||
* - [5.3.1] Filling the mailbox.
|
* - [5.3.1] Filling the mailbox.
|
||||||
* - [5.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
|
* - [5.3.2] Testing chMBPostTimeout(), chMBPostI(),
|
||||||
* chMBPostAheadI() timeout.
|
* chMBPostAheadTimeout() and chMBPostAheadI() timeout.
|
||||||
* - [5.3.3] Resetting the mailbox.
|
* - [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);
|
test_set_step(1);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE; i++) {
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [5.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
|
/* [5.3.2] Testing chMBPostTimeout(), chMBPostI(),
|
||||||
chMBPostAheadI() timeout.*/
|
chMBPostAheadTimeout() and chMBPostAheadI() timeout.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
{
|
{
|
||||||
msg1 = chMBPost(&mb1, 'X', 1);
|
msg1 = chMBPostTimeout(&mb1, 'X', 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostI(&mb1, 'X');
|
msg1 = chMBPostI(&mb1, 'X');
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
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");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostAheadI(&mb1, 'X');
|
msg1 = chMBPostAheadI(&mb1, 'X');
|
||||||
|
@ -372,10 +372,10 @@ static void test_005_003_execute(void) {
|
||||||
chMBResumeX(&mb1);
|
chMBResumeX(&mb1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [5.3.4] Testing chMBFetch() and chMBFetchI() timeout.*/
|
/* [5.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
{
|
{
|
||||||
msg1 = chMBFetch(&mb1, &msg2, 1);
|
msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBFetchI(&mb1, &msg2);
|
msg1 = chMBFetchI(&mb1, &msg2);
|
||||||
|
|
|
@ -3216,28 +3216,28 @@ test_assert_lock(mb1.buffer == mb1.rdptr, "read pointer not aligned to base");]]
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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");
|
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");
|
test_assert(msg1 == MSG_RESET, "not in reset state");
|
||||||
chMBResumeX(&mb1);]]></value>
|
chMBResumeX(&mb1);]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<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>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE - 1; i++) {
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -3256,14 +3256,14 @@ test_assert_lock(mb1.rdptr == mb1.wrptr, "pointers not aligned");]]></value>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Emptying the mailbox using chMBFetch(), no errors expected.</value>
|
<value>Emptying the mailbox using chMBFetchTimeout(), no errors expected.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
|
<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_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
|
@ -3278,9 +3278,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -3411,9 +3411,9 @@ test_assert_sequence("ABCD", "wrong get sequence");]]></value>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<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");
|
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>
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
|
@ -3465,26 +3465,26 @@ unsigned i;]]></value>
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[for (i = 0; i < MB_SIZE; i++) {
|
<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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}]]></value>
|
}]]></value>
|
||||||
</code>
|
</code>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Testing chMBPost(), chMBPostI(), chMBPostAhead() and chMBPostAheadI() timeout.</value>
|
<value>Testing chMBPostTimeout(), chMBPostI(), chMBPostAheadTimeout() and chMBPostAheadI() timeout.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[msg1 = chMBPost(&mb1, 'X', 1);
|
<value><![CDATA[msg1 = chMBPostTimeout(&mb1, 'X', 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostI(&mb1, 'X');
|
msg1 = chMBPostI(&mb1, 'X');
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
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");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostAheadI(&mb1, 'X');
|
msg1 = chMBPostAheadI(&mb1, 'X');
|
||||||
|
@ -3506,13 +3506,13 @@ chMBResumeX(&mb1);]]></value>
|
||||||
</step>
|
</step>
|
||||||
<step>
|
<step>
|
||||||
<description>
|
<description>
|
||||||
<value>Testing chMBFetch() and chMBFetchI() timeout.</value>
|
<value>Testing chMBFetchTimeout() and chMBFetchI() timeout.</value>
|
||||||
</description>
|
</description>
|
||||||
<tags>
|
<tags>
|
||||||
<value />
|
<value />
|
||||||
</tags>
|
</tags>
|
||||||
<code>
|
<code>
|
||||||
<value><![CDATA[msg1 = chMBFetch(&mb1, &msg2, 1);
|
<value><![CDATA[msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBFetchI(&mb1, &msg2);
|
msg1 = chMBFetchI(&mb1, &msg2);
|
||||||
|
|
|
@ -71,11 +71,11 @@ static MAILBOX_DECL(mb1, mb_buffer, MB_SIZE);
|
||||||
* expected.
|
* expected.
|
||||||
* - [9.1.3] Testing the behavior of API when the mailbox is in reset
|
* - [9.1.3] Testing the behavior of API when the mailbox is in reset
|
||||||
* state then return in active state.
|
* state then return in active state.
|
||||||
* - [9.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
|
* - [9.1.4] Filling the mailbox using chMBPostTimeout() and
|
||||||
* once, no errors expected.
|
* chMBPostAheadTimeout() once, no errors expected.
|
||||||
* - [9.1.5] Testing intermediate conditions. Data pointers must be
|
* - [9.1.5] Testing intermediate conditions. Data pointers must be
|
||||||
* aligned, semaphore counters are checked.
|
* 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.
|
* expected.
|
||||||
* - [9.1.7] Posting and then fetching one more message, no errors
|
* - [9.1.7] Posting and then fetching one more message, no errors
|
||||||
* expected.
|
* expected.
|
||||||
|
@ -117,24 +117,24 @@ static void test_009_001_execute(void) {
|
||||||
state then return in active state.*/
|
state then return in active state.*/
|
||||||
test_set_step(3);
|
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");
|
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");
|
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");
|
test_assert(msg1 == MSG_RESET, "not in reset state");
|
||||||
chMBResumeX(&mb1);
|
chMBResumeX(&mb1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [9.1.4] Filling the mailbox using chMBPost() and chMBPostAhead()
|
/* [9.1.4] Filling the mailbox using chMBPostTimeout() and
|
||||||
once, no errors expected.*/
|
chMBPostAheadTimeout() once, no errors expected.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE - 1; i++) {
|
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");
|
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");
|
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");
|
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.*/
|
expected.*/
|
||||||
test_set_step(6);
|
test_set_step(6);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE; i++) {
|
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_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
test_emit_token(msg2);
|
test_emit_token(msg2);
|
||||||
}
|
}
|
||||||
|
@ -163,9 +163,9 @@ static void test_009_001_execute(void) {
|
||||||
expected.*/
|
expected.*/
|
||||||
test_set_step(7);
|
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");
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,9 +286,9 @@ static void test_009_002_execute(void) {
|
||||||
expected.*/
|
expected.*/
|
||||||
test_set_step(6);
|
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");
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,11 +318,11 @@ static const testcase_t test_009_002 = {
|
||||||
*
|
*
|
||||||
* <h2>Test Steps</h2>
|
* <h2>Test Steps</h2>
|
||||||
* - [9.3.1] Filling the mailbox.
|
* - [9.3.1] Filling the mailbox.
|
||||||
* - [9.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
|
* - [9.3.2] Testing chMBPostTimeout(), chMBPostI(),
|
||||||
* chMBPostAheadI() timeout.
|
* chMBPostAheadTimeout() and chMBPostAheadI() timeout.
|
||||||
* - [9.3.3] Resetting the mailbox. The mailbox is then returned in
|
* - [9.3.3] Resetting the mailbox. The mailbox is then returned in
|
||||||
* active state.
|
* 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);
|
test_set_step(1);
|
||||||
{
|
{
|
||||||
for (i = 0; i < MB_SIZE; i++) {
|
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");
|
test_assert(msg1 == MSG_OK, "wrong wake-up message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [9.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and
|
/* [9.3.2] Testing chMBPostTimeout(), chMBPostI(),
|
||||||
chMBPostAheadI() timeout.*/
|
chMBPostAheadTimeout() and chMBPostAheadI() timeout.*/
|
||||||
test_set_step(2);
|
test_set_step(2);
|
||||||
{
|
{
|
||||||
msg1 = chMBPost(&mb1, 'X', 1);
|
msg1 = chMBPostTimeout(&mb1, 'X', 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostI(&mb1, 'X');
|
msg1 = chMBPostI(&mb1, 'X');
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
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");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBPostAheadI(&mb1, 'X');
|
msg1 = chMBPostAheadI(&mb1, 'X');
|
||||||
|
@ -373,10 +373,10 @@ static void test_009_003_execute(void) {
|
||||||
chMBResumeX(&mb1);
|
chMBResumeX(&mb1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [9.3.4] Testing chMBFetch() and chMBFetchI() timeout.*/
|
/* [9.3.4] Testing chMBFetchTimeout() and chMBFetchI() timeout.*/
|
||||||
test_set_step(4);
|
test_set_step(4);
|
||||||
{
|
{
|
||||||
msg1 = chMBFetch(&mb1, &msg2, 1);
|
msg1 = chMBFetchTimeout(&mb1, &msg2, 1);
|
||||||
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message");
|
||||||
chSysLock();
|
chSysLock();
|
||||||
msg1 = chMBFetchI(&mb1, &msg2);
|
msg1 = chMBFetchI(&mb1, &msg2);
|
||||||
|
|
Loading…
Reference in New Issue