From 7d2486a57ad2f63c30d00d1d4302e82e10467633 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 3 Oct 2017 08:50:33 +0000 Subject: Mailboxes refactory for consistency. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10747 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/src/chfactory.c | 4 ++-- os/common/oslib/src/chmboxes.c | 38 +++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'os/common/oslib/src') 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; -- cgit v1.2.3