MISRA-related fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10234 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
a5a229f455
commit
b436539f00
|
@ -133,7 +133,7 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline cnt_t chMBGetSizeI(mailbox_t *mbp) {
|
static inline cnt_t chMBGetSizeI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
/*lint -save -e9033 [10.8] Perfectly safe pointers
|
/*lint -save -e9033 [10.8] Perfectly safe pointers
|
||||||
arithmetic.*/
|
arithmetic.*/
|
||||||
|
@ -150,7 +150,7 @@ static inline cnt_t chMBGetSizeI(mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline cnt_t chMBGetUsedCountI(mailbox_t *mbp) {
|
static inline cnt_t chMBGetUsedCountI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ static inline cnt_t chMBGetUsedCountI(mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline cnt_t chMBGetFreeCountI(mailbox_t *mbp) {
|
static inline cnt_t chMBGetFreeCountI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ static inline cnt_t chMBGetFreeCountI(mailbox_t *mbp) {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
static inline msg_t chMBPeekI(mailbox_t *mbp) {
|
static inline msg_t chMBPeekI(const mailbox_t *mbp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
chDbgCheckClassI();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#ifndef CHVT_H
|
#ifndef CHVT_H
|
||||||
#define CHVT_H
|
#define CHVT_H
|
||||||
|
|
||||||
|
@ -53,8 +51,18 @@
|
||||||
* see the specific function documentation.
|
* see the specific function documentation.
|
||||||
*/
|
*/
|
||||||
#define TIME_INFINITE ((systime_t)-1)
|
#define TIME_INFINITE ((systime_t)-1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum time constant.
|
||||||
|
*/
|
||||||
|
#define TIME_MAXIMUM ((systime_t)-2)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum unsigned integer.
|
||||||
|
*/
|
||||||
|
#define __UINT_MAX ((unsigned int)-1)
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module pre-compile time settings. */
|
/* Module pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -236,7 +244,7 @@ extern "C" {
|
||||||
static inline systime_t LL_S2ST(unsigned int sec) {
|
static inline systime_t LL_S2ST(unsigned int sec) {
|
||||||
uint64_t ticks = (uint64_t)sec * (uint64_t)CH_CFG_ST_FREQUENCY;
|
uint64_t ticks = (uint64_t)sec * (uint64_t)CH_CFG_ST_FREQUENCY;
|
||||||
|
|
||||||
chDbgAssert(ticks < (uint64_t)TIME_INFINITE, "conversion overflow");
|
chDbgAssert(ticks <= (uint64_t)TIME_MAXIMUM, "conversion overflow");
|
||||||
|
|
||||||
return (systime_t)ticks;
|
return (systime_t)ticks;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +266,7 @@ static inline systime_t LL_MS2ST(unsigned int msec) {
|
||||||
uint64_t ticks = (((uint64_t)msec * (uint64_t)CH_CFG_ST_FREQUENCY) + 999ULL)
|
uint64_t ticks = (((uint64_t)msec * (uint64_t)CH_CFG_ST_FREQUENCY) + 999ULL)
|
||||||
/ 1000ULL;
|
/ 1000ULL;
|
||||||
|
|
||||||
chDbgAssert(ticks < (uint64_t)TIME_INFINITE, "conversion overflow");
|
chDbgAssert(ticks <= (uint64_t)TIME_MAXIMUM, "conversion overflow");
|
||||||
|
|
||||||
return (systime_t)ticks;
|
return (systime_t)ticks;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +288,7 @@ static inline systime_t LL_US2ST(unsigned int usec) {
|
||||||
uint64_t ticks = (((uint64_t)usec * (uint64_t)CH_CFG_ST_FREQUENCY) + 999999ULL)
|
uint64_t ticks = (((uint64_t)usec * (uint64_t)CH_CFG_ST_FREQUENCY) + 999999ULL)
|
||||||
/ 1000000ULL;
|
/ 1000000ULL;
|
||||||
|
|
||||||
chDbgAssert(ticks < (uint64_t)TIME_INFINITE, "conversion overflow");
|
chDbgAssert(ticks <= (uint64_t)TIME_MAXIMUM, "conversion overflow");
|
||||||
|
|
||||||
return (systime_t)ticks;
|
return (systime_t)ticks;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +310,7 @@ static inline unsigned int LL_ST2S(systime_t n) {
|
||||||
uint64_t sec = ((uint64_t)n + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
uint64_t sec = ((uint64_t)n + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
||||||
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
||||||
|
|
||||||
chDbgAssert(sec < (uint64_t)UINT_MAX, "conversion overflow");
|
chDbgAssert(sec < (uint64_t)__UINT_MAX, "conversion overflow");
|
||||||
|
|
||||||
return (unsigned int)sec;
|
return (unsigned int)sec;
|
||||||
}
|
}
|
||||||
|
@ -321,10 +329,10 @@ static inline unsigned int LL_ST2S(systime_t n) {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
static inline unsigned int LL_ST2MS(systime_t n) {
|
static inline unsigned int LL_ST2MS(systime_t n) {
|
||||||
uint64_t msec = ((uint64_t)n * 1000ULL + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
uint64_t msec = (((uint64_t)n * 1000ULL) + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
||||||
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
||||||
|
|
||||||
chDbgAssert(msec < (uint64_t)UINT_MAX, "conversion overflow");
|
chDbgAssert(msec < (uint64_t)__UINT_MAX, "conversion overflow");
|
||||||
|
|
||||||
return (unsigned int)msec;
|
return (unsigned int)msec;
|
||||||
}
|
}
|
||||||
|
@ -343,10 +351,10 @@ static inline unsigned int LL_ST2MS(systime_t n) {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
static inline unsigned int LL_ST2US(systime_t n) {
|
static inline unsigned int LL_ST2US(systime_t n) {
|
||||||
uint64_t usec = ((uint64_t)n * 1000000ULL + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
uint64_t usec = (((uint64_t)n * 1000000ULL) + (uint64_t)CH_CFG_ST_FREQUENCY - 1ULL)
|
||||||
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
/ (uint64_t)CH_CFG_ST_FREQUENCY;
|
||||||
|
|
||||||
chDbgAssert(usec < (uint64_t)UINT_MAX, "conversion overflow");
|
chDbgAssert(usec < (uint64_t)__UINT_MAX, "conversion overflow");
|
||||||
|
|
||||||
return (unsigned int)usec;
|
return (unsigned int)usec;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue