diff options
Diffstat (limited to 'os')
-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 |
5 files changed, 40 insertions, 40 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;
|