MISRA-related fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14544 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-06-13 09:59:48 +00:00
parent bf475d92c6
commit eef7c4e7fc
6 changed files with 28 additions and 9 deletions

View File

@ -108,3 +108,6 @@
--- Module: ..\..\..\os\hal\templates\hal_wdg_lld.c (C) --- Module: ..\..\..\os\hal\templates\hal_wdg_lld.c (C)
--- Module: ..\..\..\os\hal\templates\hal_wspi_lld.c (C) --- Module: ..\..\..\os\hal\templates\hal_wspi_lld.c (C)
executed 6-13-2021

View File

@ -468,6 +468,7 @@ extern "C" {
void sioStop(SIODriver *siop); void sioStop(SIODriver *siop);
void sioStartOperation(SIODriver *siop, const SIOOperation *operation); void sioStartOperation(SIODriver *siop, const SIOOperation *operation);
void sioStopOperation(SIODriver *siop); void sioStopOperation(SIODriver *siop);
sio_events_mask_t sioGetAndClearEvents(SIODriver *siop);
size_t sioAsyncRead(SIODriver *siop, uint8_t *buffer, size_t n); size_t sioAsyncRead(SIODriver *siop, uint8_t *buffer, size_t n);
size_t sioAsyncWrite(SIODriver *siop, const uint8_t *buffer, size_t n); size_t sioAsyncWrite(SIODriver *siop, const uint8_t *buffer, size_t n);
#if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__) #if (SIO_USE_SYNCHRONIZATION == TRUE) || defined(__DOXYGEN__)

View File

@ -246,8 +246,8 @@ void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec,
/* Day of the year calculation.*/ /* Day of the year calculation.*/
year = timp->tm_year + 1900; year = timp->tm_year + 1900;
timp->tm_yday = timp->tm_mday - 1; timp->tm_yday = timp->tm_mday - 1;
timp->tm_yday += accu_month_len[timp->tm_mon]; timp->tm_yday += (int)accu_month_len[timp->tm_mon];
is_leap_year = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); is_leap_year = (((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0);
if (is_leap_year && (timp->tm_mon > 1)) { if (is_leap_year && (timp->tm_mon > 1)) {
timp->tm_yday++; timp->tm_yday++;
} }
@ -313,7 +313,7 @@ uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec) {
if (hour == 24U) { if (hour == 24U) {
hour = 0U; hour = 0U;
day += 1U; day += 1U;
if (day > month_len[month - 1U]) { if (day > (uint32_t)month_len[month - 1U]) {
day = 1U; day = 1U;
month += 1U; month += 1U;
} }

View File

@ -185,7 +185,8 @@ static msg_t __ctl(void *ip, unsigned int operation, void *arg) {
osalDbgAssert(false, "invalid CTL operation"); osalDbgAssert(false, "invalid CTL operation");
break; break;
default: default:
break; /* Delegating to the LLD if supported.*/
return sio_lld_control(siop, operation, arg);
} }
return MSG_OK; return MSG_OK;
} }
@ -453,7 +454,11 @@ msg_t sioSynchronizeRX(SIODriver *siop, sysinterval_t timeout) {
osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state"); osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state");
/*lint -save -e506 -e681 [2.1] Silencing this error because it is
tested with a template implementation of sio_lld_is_rx_empty() which
is constant.*/
while (sio_lld_is_rx_empty(siop)) { while (sio_lld_is_rx_empty(siop)) {
/*lint -restore*/
msg = osalThreadSuspendTimeoutS(&siop->sync_rx, timeout); msg = osalThreadSuspendTimeoutS(&siop->sync_rx, timeout);
} }
@ -484,7 +489,11 @@ msg_t sioSynchronizeTX(SIODriver *siop, sysinterval_t timeout) {
osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state"); osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state");
/*lint -save -e506 -e681 [2.1] Silencing this error because it is
tested with a template implementation of sio_lld_is_tx_full() which
is constant.*/
while (sio_lld_is_tx_full(siop)) { while (sio_lld_is_tx_full(siop)) {
/*lint -restore*/
msg = osalThreadSuspendTimeoutS(&siop->sync_tx, timeout); msg = osalThreadSuspendTimeoutS(&siop->sync_tx, timeout);
} }
@ -512,7 +521,11 @@ msg_t sioSynchronizeTXEnd(SIODriver *siop, sysinterval_t timeout) {
osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state"); osalDbgAssert(siop->state == SIO_ACTIVE, "invalid state");
/*lint -save -e506 -e774 [2.1, 14.3] Silencing this error because
it is tested with a template implementation of sio_lld_is_tx_ongoing()
which is constant.*/
if (sio_lld_is_tx_ongoing(siop)) { if (sio_lld_is_tx_ongoing(siop)) {
/*lint -restore*/
msg = osalThreadSuspendTimeoutS(&siop->sync_txend, timeout); msg = osalThreadSuspendTimeoutS(&siop->sync_txend, timeout);
} }
else { else {

View File

@ -204,7 +204,7 @@ size_t sio_lld_write(SIODriver *siop, const uint8_t *buffer, size_t n) {
* @notapi * @notapi
*/ */
msg_t sio_lld_get(SIODriver *siop) { msg_t sio_lld_get(SIODriver *siop) {
msg_t msg = 0U; msg_t msg = (msg_t)0;
(void)siop; (void)siop;

View File

@ -69,12 +69,14 @@ typedef uint32_t sio_events_mask_t;
/** /**
* @brief Low level fields of the SIO driver structure. * @brief Low level fields of the SIO driver structure.
*/ */
#define sio_lld_driver_fields #define sio_lld_driver_fields \
uint32_t dummy
/** /**
* @brief Low level fields of the SIO configuration structure. * @brief Low level fields of the SIO configuration structure.
*/ */
#define sio_lld_config_fields #define sio_lld_config_fields \
uint32_t dummy
/** /**
* @brief Determines the state of the RX FIFO. * @brief Determines the state of the RX FIFO.
@ -86,7 +88,7 @@ typedef uint32_t sio_events_mask_t;
* *
* @notapi * @notapi
*/ */
#define sio_lld_is_rx_empty(siop) true #define sio_lld_is_rx_empty(siop) false
/** /**
* @brief Determines the state of the TX FIFO. * @brief Determines the state of the TX FIFO.
@ -98,7 +100,7 @@ typedef uint32_t sio_events_mask_t;
* *
* @notapi * @notapi
*/ */
#define sio_lld_is_tx_full(siop) true #define sio_lld_is_tx_full(siop) false
/** /**
* @brief Determines the transmission state. * @brief Determines the transmission state.