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 /os/common/oslib/src | |
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
Diffstat (limited to 'os/common/oslib/src')
-rw-r--r-- | os/common/oslib/src/chfactory.c | 4 | ||||
-rw-r--r-- | os/common/oslib/src/chmboxes.c | 38 |
2 files changed, 21 insertions, 21 deletions
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;
|