diff options
| -rw-r--r-- | doc/hal/reports/misra.txt | 4 | ||||
| -rw-r--r-- | os/hal/include/hal_buffers.h | 16 | ||||
| -rw-r--r-- | os/hal/include/hal_queues.h | 12 | ||||
| -rw-r--r-- | os/hal/include/uart.h | 6 | ||||
| -rw-r--r-- | os/hal/include/wdg.h | 2 | ||||
| -rw-r--r-- | os/hal/ports/STM32/LLD/USARTv1/uart_lld.h | 4 | ||||
| -rw-r--r-- | os/hal/ports/STM32/LLD/USARTv2/uart_lld.h | 4 | ||||
| -rw-r--r-- | os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c | 4 | ||||
| -rw-r--r-- | os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.h | 4 | ||||
| -rw-r--r-- | os/hal/src/hal_buffers.c | 42 | ||||
| -rw-r--r-- | os/hal/src/serial_usb.c | 24 | ||||
| -rw-r--r-- | os/hal/src/uart.c | 22 | ||||
| -rw-r--r-- | os/hal/src/usb.c | 8 | ||||
| -rw-r--r-- | os/hal/src/wdg.c | 4 | ||||
| -rw-r--r-- | os/hal/templates/pal_lld.h | 4 | ||||
| -rw-r--r-- | os/hal/templates/uart_lld.h | 4 | ||||
| -rw-r--r-- | os/hal/templates/wdg_lld.h | 6 | 
17 files changed, 97 insertions, 73 deletions
| diff --git a/doc/hal/reports/misra.txt b/doc/hal/reports/misra.txt index 831ebfde9..6615adc69 100644 --- a/doc/hal/reports/misra.txt +++ b/doc/hal/reports/misra.txt @@ -1,6 +1,8 @@  --- Module:   ..\..\..\os\hal\src\hal.c (C)
 +--- Module:   ..\..\..\os\hal\src\hal_buffers.c (C)
 +
  --- Module:   ..\..\..\os\hal\src\hal_queues.c (C)
  --- Module:   ..\..\..\os\hal\src\hal_mmcsd.c (C)
 @@ -45,6 +47,8 @@  --- Module:   ..\..\..\os\hal\src\usb.c (C)
 +--- Module:   ..\..\..\os\hal\src\wdg.c (C)
 +
  --- Module:   ..\..\..\os\hal\templates\osal\osal.c (C)
  --- Module:   ..\..\..\os\hal\templates\hal_lld.c (C)
 diff --git a/os/hal/include/hal_buffers.h b/os/hal/include/hal_buffers.h index c7f731f83..bedc56c56 100644 --- a/os/hal/include/hal_buffers.h +++ b/os/hal/include/hal_buffers.h @@ -132,7 +132,7 @@ typedef io_buffers_queue_t output_buffers_queue_t;   * @param[in] size      size of the buffers
   */
  #define BQ_BUFFER_SIZE(n, size)                                             \
 -  (((size_t)(size) + (sizeof (size_t)) * (size_t)(n)))
 +  ((size_t)(size) + ((sizeof (size_t)) * (size_t)(n)))
  /**
   * @name    Macro Functions
 @@ -192,8 +192,10 @@ typedef io_buffers_queue_t output_buffers_queue_t;   *
   * @iclass
   */
 -#define ibqIsFullI(ibqp) ((bool)(((ibqp)->bwrptr == (ibqp)->brdptr) &&      \
 -                                 ((ibqp)->bcounter != 0U)))
 +#define ibqIsFullI(ibqp)                                                    \
 +  /*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/        \
 +  ((bool)(((ibqp)->bwrptr == (ibqp)->brdptr) && ((ibqp)->bcounter != 0U)))  \
 +  /*lint -restore*/
  /**
   * @brief   Evaluates to @p true if the specified output buffers queue is empty.
 @@ -205,8 +207,10 @@ typedef io_buffers_queue_t output_buffers_queue_t;   *
   * @iclass
   */
 -#define obqIsEmptyI(obqp) ((bool)(((obqp)->bwrptr == (obqp)->brdptr) &&     \
 -                                  ((obqp)->bcounter != 0U)))
 +#define obqIsEmptyI(obqp)                                                   \
 +  /*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/        \
 +  ((bool)(((obqp)->bwrptr == (obqp)->brdptr) && ((obqp)->bcounter != 0U)))  \
 +  /*lint -restore*/
  /**
   * @brief   Evaluates to @p true if the specified output buffers queue is full.
 @@ -228,7 +232,7 @@ typedef io_buffers_queue_t output_buffers_queue_t;  #ifdef __cplusplus
  extern "C" {
  #endif
 -  void ibqObjectInit(io_buffers_queue_t *ibqp, uint8_t *bp,
 +  void ibqObjectInit(input_buffers_queue_t *ibqp, uint8_t *bp,
                       size_t size, size_t n,
                       bqnotify_t infy, void *link);
    void ibqResetI(input_buffers_queue_t *ibqp);
 diff --git a/os/hal/include/hal_queues.h b/os/hal/include/hal_queues.h index 42d70953a..144a4a123 100644 --- a/os/hal/include/hal_queues.h +++ b/os/hal/include/hal_queues.h @@ -174,8 +174,10 @@ typedef io_queue_t input_queue_t;   *
   * @iclass
   */
 -#define iqIsFullI(iqp) ((bool)(((iqp)->q_wrptr == (iqp)->q_rdptr) &&        \
 -                               ((iqp)->q_counter != 0U)))
 +#define iqIsFullI(iqp)                                                      \
 +  /*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/        \
 +  ((bool)(((iqp)->q_wrptr == (iqp)->q_rdptr) && ((iqp)->q_counter != 0U)))  \
 +  /*lint -restore*/
  /**
   * @brief   Input queue read.
 @@ -240,8 +242,10 @@ typedef io_queue_t output_queue_t;   *
   * @iclass
   */
 -#define oqIsEmptyI(oqp) ((bool)(((oqp)->q_wrptr == (oqp)->q_rdptr) &&       \
 -                                ((oqp)->q_counter != 0U)))
 +#define oqIsEmptyI(oqp)                                                     \
 +  /*lint -save -e9007 [13.5] No side effects, a pointer is passed.*/        \
 +  ((bool)(((oqp)->q_wrptr == (oqp)->q_rdptr) && ((oqp)->q_counter != 0U)))  \
 +  /*lint -restore*/
  /**
   * @brief   Evaluates to @p true if the specified output queue is full.
 diff --git a/os/hal/include/uart.h b/os/hal/include/uart.h index 2942636b4..a6a8c4298 100644 --- a/os/hal/include/uart.h +++ b/os/hal/include/uart.h @@ -321,11 +321,11 @@ extern "C" {    size_t uartStopReceiveI(UARTDriver *uartp);
  #if UART_USE_WAIT == TRUE
    msg_t uartSendTimeout(UARTDriver *uartp, size_t *np,
 -                        const void *txbuf, systime_t time);
 +                        const void *txbuf, systime_t timeout);
    msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np,
 -                            const void *txbuf, systime_t time);
 +                            const void *txbuf, systime_t timeout);
    msg_t uartReceiveTimeout(UARTDriver *uartp, size_t *np,
 -                           void *rxbuf, systime_t time);
 +                           void *rxbuf, systime_t timeout);
  #endif
  #if UART_USE_MUTUAL_EXCLUSION == TRUE
    void uartAcquireBus(UARTDriver *uartp);
 diff --git a/os/hal/include/wdg.h b/os/hal/include/wdg.h index 764e0b2b1..b94575915 100644 --- a/os/hal/include/wdg.h +++ b/os/hal/include/wdg.h @@ -49,7 +49,7 @@  typedef enum {
    WDG_UNINIT = 0,                   /**< Not initialized.                   */
    WDG_STOP = 1,                     /**< Stopped.                           */
 -  WDG_READY = 2,                    /**< Ready.                             */
 +  WDG_READY = 2                     /**< Ready.                             */
  } wdgstate_t;
  #include "wdg_lld.h"
 diff --git a/os/hal/ports/STM32/LLD/USARTv1/uart_lld.h b/os/hal/ports/STM32/LLD/USARTv1/uart_lld.h index fee0d1413..a64b65150 100644 --- a/os/hal/ports/STM32/LLD/USARTv1/uart_lld.h +++ b/os/hal/ports/STM32/LLD/USARTv1/uart_lld.h @@ -524,7 +524,7 @@ struct UARTDriver {     * @brief Current configuration data.
     */
    const UARTConfig          *config;
 -#if UART_USE_WAIT || defined(__DOXYGEN__)
 +#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Synchronization flag for transmit operations.
     */
 @@ -538,7 +538,7 @@ struct UARTDriver {     */
    thread_reference_t        threadtx;
  #endif /* UART_USE_WAIT */
 -#if UART_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
 +#if (UART_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Mutex protecting the peripheral.
     */
 diff --git a/os/hal/ports/STM32/LLD/USARTv2/uart_lld.h b/os/hal/ports/STM32/LLD/USARTv2/uart_lld.h index 395cb3054..708857bd3 100644 --- a/os/hal/ports/STM32/LLD/USARTv2/uart_lld.h +++ b/os/hal/ports/STM32/LLD/USARTv2/uart_lld.h @@ -623,7 +623,7 @@ struct UARTDriver {     * @brief   Current configuration data.
     */
    const UARTConfig          *config;
 -#if UART_USE_WAIT || defined(__DOXYGEN__)
 +#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Synchronization flag for transmit operations.
     */
 @@ -637,7 +637,7 @@ struct UARTDriver {     */
    thread_reference_t        threadtx;
  #endif /* UART_USE_WAIT */
 -#if UART_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
 +#if (UART_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Mutex protecting the peripheral.
     */
 diff --git a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c index d3ff1600d..50b5a95de 100644 --- a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c +++ b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.c @@ -24,7 +24,7 @@  #include "hal.h"
 -#if HAL_USE_WDG || defined(__DOXYGEN__)
 +#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
  /*===========================================================================*/
  /* Driver local definitions.                                                 */
 @@ -135,6 +135,6 @@ void wdg_lld_reset(WDGDriver * wdgp) {    wdgp->wdg->KR = KR_KEY_RELOAD;
  }
 -#endif /* HAL_USE_WDG */
 +#endif /* HAL_USE_WDG == TRUE */
  /** @} */
 diff --git a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.h b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.h index 8c108b5dd..8d2786f63 100644 --- a/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.h +++ b/os/hal/ports/STM32/LLD/xWDGv1/wdg_lld.h @@ -25,7 +25,7 @@  #ifndef _WDG_LLD_H_
  #define _WDG_LLD_H_
 -#if HAL_USE_WDG || defined(__DOXYGEN__)
 +#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
  /*===========================================================================*/
  /* Driver constants.                                                         */
 @@ -176,7 +176,7 @@ extern "C" {  }
  #endif
 -#endif /* HAL_USE_WDG */
 +#endif /* HAL_USE_WDG == TRUE */
  #endif /* _WDG_LLD_H_ */
 diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index a01de2793..68c30c5a4 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -76,7 +76,7 @@ void ibqObjectInit(input_buffers_queue_t *ibqp, uint8_t *bp,                     size_t size, size_t n,
                     bqnotify_t infy, void *link) {
 -  osalDbgCheck((ibqp != NULL) && (bp != NULL) && (size >= 2));
 +  osalDbgCheck((ibqp != NULL) && (bp != NULL) && (size >= 2U));
    osalThreadQueueObjectInit(&ibqp->waiting);
    ibqp->bcounter = 0;
 @@ -148,7 +148,7 @@ void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size) {    osalDbgCheckClassI();
 -  osalDbgCheck((size > 0) && (size <= ibqp->bsize - sizeof (size_t)));
 +  osalDbgCheck((size > 0U) && (size <= (ibqp->bsize - sizeof (size_t))));
    osalDbgAssert(!ibqIsFullI(ibqp), "buffers queue full");
    /* Writing size field in the buffer.*/
 @@ -314,7 +314,7 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, systime_t timeout) {    }
    /* Next byte from the buffer.*/
 -  msg = *ibqp->ptr;
 +  msg = (msg_t)*ibqp->ptr;
    ibqp->ptr++;
    /* If the current buffer has been fully read then it is returned as
 @@ -396,19 +396,19 @@ size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp,      }
      /* Size of the data chunk present in the current buffer.*/
 -    size = ibqp->top - ibqp->ptr;
 -    if (size > n - r) {
 +    size = (size_t)ibqp->top - (size_t)ibqp->ptr;
 +    if (size > (n - r)) {
        size = n - r;
      }
      /* Smaller chunks in order to not make the critical zone too long,
         this impacts throughput however.*/
 -    if (size > 64) {
 +    if (size > 64U) {
        /* Giving the compiler a chance to optimize for a fixed size move.*/
 -      memcpy(bp, ibqp->ptr, 64);
 -      bp        += 64;
 -      ibqp->ptr += 64;
 -      r         += 64;
 +      memcpy(bp, ibqp->ptr, 64U);
 +      bp        += 64U;
 +      ibqp->ptr += 64U;
 +      r         += 64U;
      }
      else {
        memcpy(bp, ibqp->ptr, size);
 @@ -447,7 +447,7 @@ void obqObjectInit(output_buffers_queue_t *obqp, uint8_t *bp,                     size_t size, size_t n,
                     bqnotify_t onfy, void *link) {
 -  osalDbgCheck((obqp != NULL) && (bp != NULL) && (size >= 2));
 +  osalDbgCheck((obqp != NULL) && (bp != NULL) && (size >= 2U));
    osalThreadQueueObjectInit(&obqp->waiting);
    obqp->bcounter = n;
 @@ -635,7 +635,7 @@ void obqPostFullBuffer(output_buffers_queue_t *obqp, size_t size) {  void obqPostFullBufferS(output_buffers_queue_t *obqp, size_t size) {
    osalDbgCheckClassS();
 -  osalDbgCheck((size > 0) && (size <= obqp->bsize - sizeof (size_t)));
 +  osalDbgCheck((size > 0U) && (size <= (obqp->bsize - sizeof (size_t))));
    osalDbgAssert(!obqIsFullI(obqp), "buffers queue full");
    /* Writing size field in the buffer.*/
 @@ -774,19 +774,19 @@ size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp,      }
      /* Size of the space available in the current buffer.*/
 -    size = obqp->top - obqp->ptr;
 -    if (size > n - w) {
 +    size = (size_t)obqp->top - (size_t)obqp->ptr;
 +    if (size > (n - w)) {
        size = n - w;
      }
      /* Smaller chunks in order to not make the critical zone too long,
         this impacts throughput however.*/
 -    if (size > 64) {
 +    if (size > 64U) {
        /* Giving the compiler a chance to optimize for a fixed size move.*/
 -      memcpy(obqp->ptr, bp, 64);
 -      bp        += 64;
 -      obqp->ptr += 64;
 -      w         += 64;
 +      memcpy(obqp->ptr, bp, 64U);
 +      bp        += 64U;
 +      obqp->ptr += 64U;
 +      w         += 64U;
      }
      else {
        memcpy(obqp->ptr, bp, size);
 @@ -829,7 +829,7 @@ bool obqTryFlushI(output_buffers_queue_t *obqp) {    /* If queue is empty and there is a buffer partially filled and
       it is not being written.*/
    if (obqIsEmptyI(obqp) && (obqp->ptr != NULL)) {
 -    size_t size = (size_t)(obqp->ptr - (obqp->bwrptr + sizeof (size_t)));
 +    size_t size = (size_t)obqp->ptr - ((size_t)obqp->bwrptr + sizeof (size_t));
      if (size > 0U) {
 @@ -865,7 +865,7 @@ void obqFlush(output_buffers_queue_t *obqp) {    /* If there is a buffer partially filled and not being written.*/
    if (obqp->ptr != NULL) {
 -    size_t size = (size_t)(obqp->ptr - obqp->bwrptr);
 +    size_t size = (size_t)obqp->ptr - (size_t)obqp->bwrptr;
      if (size > 0U) {
        obqPostFullBufferS(obqp, size);
 diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index d4525c52f..afa6679e4 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -56,8 +56,9 @@ static cdc_linecoding_t linecoding = {  static size_t write(void *ip, const uint8_t *bp, size_t n) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return 0;
 +  }
    return obqWriteTimeout(&((SerialUSBDriver *)ip)->obqueue, bp,
                           n, TIME_INFINITE);
 @@ -65,8 +66,9 @@ static size_t write(void *ip, const uint8_t *bp, size_t n) {  static size_t read(void *ip, uint8_t *bp, size_t n) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return 0;
 +  }
    return ibqReadTimeout(&((SerialUSBDriver *)ip)->ibqueue, bp,
                          n, TIME_INFINITE);
 @@ -74,48 +76,54 @@ static size_t read(void *ip, uint8_t *bp, size_t n) {  static msg_t put(void *ip, uint8_t b) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return MSG_RESET;
 +  }
    return obqPutTimeout(&((SerialUSBDriver *)ip)->obqueue, b, TIME_INFINITE);
  }
  static msg_t get(void *ip) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return MSG_RESET;
 +  }
    return ibqGetTimeout(&((SerialUSBDriver *)ip)->ibqueue, TIME_INFINITE);
  }
  static msg_t putt(void *ip, uint8_t b, systime_t timeout) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return MSG_RESET;
 +  }
    return obqPutTimeout(&((SerialUSBDriver *)ip)->obqueue, b, timeout);
  }
  static msg_t gett(void *ip, systime_t timeout) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return MSG_RESET;
 +  }
    return ibqGetTimeout(&((SerialUSBDriver *)ip)->ibqueue, timeout);
  }
  static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t timeout) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return 0;
 +  }
    return obqWriteTimeout(&((SerialUSBDriver *)ip)->obqueue, bp, n, timeout);
  }
  static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t timeout) {
 -  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE)
 +  if (usbGetDriverStateI(((SerialUSBDriver *)ip)->config->usbp) != USB_ACTIVE) {
      return 0;
 +  }
    return ibqReadTimeout(&((SerialUSBDriver *)ip)->ibqueue, bp, n, timeout);
  }
 diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c index 96f2bed5f..33fb9f562 100644 --- a/os/hal/src/uart.c +++ b/os/hal/src/uart.c @@ -71,12 +71,12 @@ void uartObjectInit(UARTDriver *uartp) {    uartp->txstate    = UART_TX_IDLE;
    uartp->rxstate    = UART_RX_IDLE;
    uartp->config     = NULL;
 -#if UART_USE_WAIT || defined(__DOXYGEN__)
 +#if UART_USE_WAIT == TRUE
    uartp->early      = false;
    uartp->threadrx   = NULL;
    uartp->threadtx   = NULL;
  #endif /* UART_USE_WAIT */
 -#if UART_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
 +#if UART_USE_MUTUAL_EXCLUSION == TRUE
    osalMutexObjectInit(&uartp->mutex);
  #endif /* UART_USE_MUTUAL_EXCLUSION */
 @@ -354,7 +354,7 @@ size_t uartStopReceiveI(UARTDriver *uartp) {   * @param[in,out] np    number of data frames to transmit, on exit the number
   *                      of frames actually transmitted
   * @param[in] txbuf     the pointer to the transmit buffer
 - * @param[in] time      operation timeout
 + * @param[in] timeout   operation timeout
   * @return              The operation status.
   * @retval MSG_OK       if the operation completed successfully.
   * @retval MSG_TIMEOUT  if the operation timed out.
 @@ -362,7 +362,7 @@ size_t uartStopReceiveI(UARTDriver *uartp) {   * @api
   */
  msg_t uartSendTimeout(UARTDriver *uartp, size_t *np,
 -                      const void *txbuf, systime_t time) {
 +                      const void *txbuf, systime_t timeout) {
    msg_t msg;
    osalDbgCheck((uartp != NULL) && (*np > 0U) && (txbuf != NULL));
 @@ -377,7 +377,7 @@ msg_t uartSendTimeout(UARTDriver *uartp, size_t *np,    uartp->txstate = UART_TX_ACTIVE;
    /* Waiting for result.*/
 -  msg = osalThreadSuspendTimeoutS(&uartp->threadtx, time);
 +  msg = osalThreadSuspendTimeoutS(&uartp->threadtx, timeout);
    if (msg != MSG_OK) {
      *np = uartStopSendI(uartp);
    }
 @@ -397,7 +397,7 @@ msg_t uartSendTimeout(UARTDriver *uartp, size_t *np,   * @param[in,out] np    number of data frames to transmit, on exit the number
   *                      of frames actually transmitted
   * @param[in] txbuf     the pointer to the transmit buffer
 - * @param[in] time      operation timeout
 + * @param[in] timeout   operation timeout
   * @return              The operation status.
   * @retval MSG_OK       if the operation completed successfully.
   * @retval MSG_TIMEOUT  if the operation timed out.
 @@ -405,7 +405,7 @@ msg_t uartSendTimeout(UARTDriver *uartp, size_t *np,   * @api
   */
  msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np,
 -                          const void *txbuf, systime_t time) {
 +                          const void *txbuf, systime_t timeout) {
    msg_t msg;
    osalDbgCheck((uartp != NULL) && (*np > 0U) && (txbuf != NULL));
 @@ -420,7 +420,7 @@ msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np,    uartp->txstate = UART_TX_ACTIVE;
    /* Waiting for result.*/
 -  msg = osalThreadSuspendTimeoutS(&uartp->threadtx, time);
 +  msg = osalThreadSuspendTimeoutS(&uartp->threadtx, timeout);
    if (msg != MSG_OK) {
      *np = uartStopSendI(uartp);
    }
 @@ -440,7 +440,7 @@ msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np,   * @param[in,out] np    number of data frames to receive, on exit the number
   *                      of frames actually received
   * @param[in] rxbuf     the pointer to the receive buffer
 - * @param[in] time      operation timeout
 + * @param[in] timeout   operation timeout
   *
   * @return              The operation status.
   * @retval MSG_OK       if the operation completed successfully.
 @@ -450,7 +450,7 @@ msg_t uartSendFullTimeout(UARTDriver *uartp, size_t *np,   * @api
   */
  msg_t uartReceiveTimeout(UARTDriver *uartp, size_t *np,
 -                         void *rxbuf, systime_t time) {
 +                         void *rxbuf, systime_t timeout) {
    msg_t msg;
    osalDbgCheck((uartp != NULL) && (*np > 0U) && (rxbuf != NULL));
 @@ -464,7 +464,7 @@ msg_t uartReceiveTimeout(UARTDriver *uartp, size_t *np,    uartp->rxstate = UART_RX_ACTIVE;
    /* Waiting for result.*/
 -  msg = osalThreadSuspendTimeoutS(&uartp->threadrx, time);
 +  msg = osalThreadSuspendTimeoutS(&uartp->threadrx, timeout);
    if (msg != MSG_OK) {
      *np = uartStopReceiveI(uartp);
    }
 diff --git a/os/hal/src/usb.c b/os/hal/src/usb.c index 4f52424fb..1b4993e49 100644 --- a/os/hal/src/usb.c +++ b/os/hal/src/usb.c @@ -419,14 +419,16 @@ void usbStartReceiveI(USBDriver *usbp, usbep_t ep,    USBOutEndpointState *osp;
    osalDbgCheckClassI();
 -  osalDbgCheck((usbp != NULL) && (ep <= USB_MAX_ENDPOINTS));
 +  osalDbgCheck((usbp != NULL) && (ep <= (usbep_t)USB_MAX_ENDPOINTS));
    osalDbgAssert(!usbGetReceiveStatusI(usbp, ep), "already receiving");
    /* Marking the endpoint as active.*/
    usbp->receiving |= (uint16_t)((unsigned)1U << (unsigned)ep);
    /* Setting up the transfer.*/
 +  /*lint -save -e661 [18.1] pclint is confused by the check on ep.*/
    osp = usbp->epc[ep]->out_state;
 +  /*lint -restore*/
    osp->rxbuf  = buf;
    osp->rxsize = n;
    osp->rxcnt  = 0;
 @@ -456,14 +458,16 @@ void usbStartTransmitI(USBDriver *usbp, usbep_t ep,    USBInEndpointState *isp;
    osalDbgCheckClassI();
 -  osalDbgCheck((usbp != NULL) && (ep <= USB_MAX_ENDPOINTS));
 +  osalDbgCheck((usbp != NULL) && (ep <= (usbep_t)USB_MAX_ENDPOINTS));
    osalDbgAssert(!usbGetTransmitStatusI(usbp, ep), "already transmitting");
    /* Marking the endpoint as active.*/
    usbp->transmitting |= (uint16_t)((unsigned)1U << (unsigned)ep);
    /* Setting up the transfer.*/
 +  /*lint -save -e661 [18.1] pclint is confused by the check on ep.*/
    isp = usbp->epc[ep]->in_state;
 +  /*lint -restore*/
    isp->txbuf  = buf;
    isp->txsize = n;
    isp->txcnt  = 0;
 diff --git a/os/hal/src/wdg.c b/os/hal/src/wdg.c index deb8e0ce9..949b0bb36 100644 --- a/os/hal/src/wdg.c +++ b/os/hal/src/wdg.c @@ -24,7 +24,7 @@  #include "hal.h"
 -#if HAL_USE_WDG || defined(__DOXYGEN__)
 +#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
  /*===========================================================================*/
  /* Driver local definitions.                                                 */
 @@ -115,6 +115,6 @@ void wdgReset(WDGDriver *wdgp) {    osalSysUnlock();
  }
 -#endif /* HAL_USE_WDG */
 +#endif /* HAL_USE_WDG == TRUE */
  /** @} */
 diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h index 5b39648c2..59e5c0f2a 100644 --- a/os/hal/templates/pal_lld.h +++ b/os/hal/templates/pal_lld.h @@ -42,13 +42,13 @@  /**
   * @brief   Width, in bits, of an I/O port.
   */
 -#define PAL_IOPORTS_WIDTH 16
 +#define PAL_IOPORTS_WIDTH           16U
  /**
   * @brief   Whole port mask.
   * @details This macro specifies all the valid bits into a port.
   */
 -#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFF)
 +#define PAL_WHOLE_PORT              ((ioportmask_t)0xFFFFU)
  /** @} */
  /**
 diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h index 0451dcb21..d17b71a1a 100644 --- a/os/hal/templates/uart_lld.h +++ b/os/hal/templates/uart_lld.h @@ -143,7 +143,7 @@ struct UARTDriver {     * @brief Current configuration data.
     */
    const UARTConfig          *config;
 -#if UART_USE_WAIT || defined(__DOXYGEN__)
 +#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Synchronization flag for transmit operations.
     */
 @@ -157,7 +157,7 @@ struct UARTDriver {     */
    thread_reference_t        threadtx;
  #endif /* UART_USE_WAIT */
 -#if UART_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
 +#if (UART_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
    /**
     * @brief   Mutex protecting the peripheral.
     */
 diff --git a/os/hal/templates/wdg_lld.h b/os/hal/templates/wdg_lld.h index d10af5add..7bb854778 100644 --- a/os/hal/templates/wdg_lld.h +++ b/os/hal/templates/wdg_lld.h @@ -25,7 +25,7 @@  #ifndef _WDG_LLD_H_
  #define _WDG_LLD_H_
 -#if HAL_USE_WDG || defined(__DOXYGEN__)
 +#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
  /*===========================================================================*/
  /* Driver constants.                                                         */
 @@ -91,7 +91,7 @@ struct WDGDriver {  /* External declarations.                                                    */
  /*===========================================================================*/
 -#if PLATFORM_WDG_USE_WDG1 && !defined(__DOXYGEN__)
 +#if (PLATFORM_WDG_USE_WDG1 == TRUE) && !defined(__DOXYGEN__)
  extern WDGDriver WDGD1;
  #endif
 @@ -106,7 +106,7 @@ extern "C" {  }
  #endif
 -#endif /* HAL_USE_WDG */
 +#endif /* HAL_USE_WDG == TRUE */
  #endif /* _WDG_LLD_H_ */
 | 
