From fc2af0f5896de947b3c59a9251ac4eef91ed005c Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 11 Mar 2015 15:05:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/hal_channels.h | 12 ++++++------ os/hal/include/hal_queues.h | 4 ++-- os/hal/include/serial.h | 10 +++++----- os/hal/src/can.c | 6 +++--- os/hal/src/mac.c | 4 ++-- os/hal/src/mmc_spi.c | 4 ++-- os/hal/templates/osal/osal.h | 26 +++++++++++++------------- 7 files changed, 33 insertions(+), 33 deletions(-) (limited to 'os/hal') diff --git a/os/hal/include/hal_channels.h b/os/hal/include/hal_channels.h index 21d4834de..a57255b85 100644 --- a/os/hal/include/hal_channels.h +++ b/os/hal/include/hal_channels.h @@ -203,17 +203,17 @@ typedef struct { * @{ */ /** @brief No pending conditions.*/ -#define CHN_NO_ERROR 0 +#define CHN_NO_ERROR (eventflags_t)0 /** @brief Connection happened.*/ -#define CHN_CONNECTED 1 +#define CHN_CONNECTED (eventflags_t)1 /** @brief Disconnection happened.*/ -#define CHN_DISCONNECTED 2 +#define CHN_DISCONNECTED (eventflags_t)2 /** @brief Data available in the input queue.*/ -#define CHN_INPUT_AVAILABLE 4 +#define CHN_INPUT_AVAILABLE (eventflags_t)4 /** @brief Output queue empty.*/ -#define CHN_OUTPUT_EMPTY 8 +#define CHN_OUTPUT_EMPTY (eventflags_t)8 /** @brief Transmission end.*/ -#define CHN_TRANSMISSION_END 16 +#define CHN_TRANSMISSION_END (eventflags_t)16 /** @} */ /** diff --git a/os/hal/include/hal_queues.h b/os/hal/include/hal_queues.h index 62c08d11c..9e0d0d866 100644 --- a/os/hal/include/hal_queues.h +++ b/os/hal/include/hal_queues.h @@ -40,8 +40,8 @@ #define Q_OK MSG_OK /**< @brief Operation successful. */ #define Q_TIMEOUT MSG_TIMEOUT /**< @brief Timeout condition. */ #define Q_RESET MSG_RESET /**< @brief Queue has been reset. */ -#define Q_EMPTY -3 /**< @brief Queue empty. */ -#define Q_FULL -4 /**< @brief Queue full, */ +#define Q_EMPTY (msg_t)-3 /**< @brief Queue empty. */ +#define Q_FULL (msg_t)-4 /**< @brief Queue full, */ /** @} */ /** diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h index 3e0d1263e..24b4bd802 100644 --- a/os/hal/include/serial.h +++ b/os/hal/include/serial.h @@ -38,11 +38,11 @@ * @name Serial status flags * @{ */ -#define SD_PARITY_ERROR 32 /**< @brief Parity error happened. */ -#define SD_FRAMING_ERROR 64 /**< @brief Framing error happened. */ -#define SD_OVERRUN_ERROR 128 /**< @brief Overflow happened. */ -#define SD_NOISE_ERROR 256 /**< @brief Noise on the line. */ -#define SD_BREAK_DETECTED 512 /**< @brief Break detected. */ +#define SD_PARITY_ERROR (eventflags_t)32 /**< @brief Parity. */ +#define SD_FRAMING_ERROR (eventflags_t)64 /**< @brief Framing. */ +#define SD_OVERRUN_ERROR (eventflags_t)128 /**< @brief Overflow. */ +#define SD_NOISE_ERROR (eventflags_t)256 /**< @brief Line noise. */ +#define SD_BREAK_DETECTED (eventflags_t)512 /**< @brief LIN Break. */ /** @} */ /*===========================================================================*/ diff --git a/os/hal/src/can.c b/os/hal/src/can.c index 094f9691f..08cdd5172 100644 --- a/os/hal/src/can.c +++ b/os/hal/src/can.c @@ -105,7 +105,7 @@ void canStart(CANDriver *canp, const CANConfig *config) { (canp->state == CAN_READY), "invalid state"); while (canp->state == CAN_STARTING) { - osalThreadSleepS(1); + osalThreadSleepS((systime_t)1); } if (canp->state == CAN_STOP) { canp->config = config; @@ -253,7 +253,7 @@ void canSleep(CANDriver *canp) { if (canp->state == CAN_READY) { can_lld_sleep(canp); canp->state = CAN_SLEEP; - osalEventBroadcastFlagsI(&canp->sleep_event, 0); + osalEventBroadcastFlagsI(&canp->sleep_event, (eventflags_t)0); osalOsRescheduleS(); } osalSysUnlock(); @@ -276,7 +276,7 @@ void canWakeup(CANDriver *canp) { if (canp->state == CAN_SLEEP) { can_lld_wakeup(canp); canp->state = CAN_READY; - osalEventBroadcastFlagsI(&canp->wakeup_event, 0); + osalEventBroadcastFlagsI(&canp->wakeup_event, (eventflags_t)0); osalOsRescheduleS(); } osalSysUnlock(); diff --git a/os/hal/src/mac.c b/os/hal/src/mac.c index 88c32f3cc..b6570073e 100644 --- a/os/hal/src/mac.c +++ b/os/hal/src/mac.c @@ -156,7 +156,7 @@ msg_t macWaitTransmitDescriptor(MACDriver *macp, osalDbgAssert(macp->state == MAC_ACTIVE, "not active"); while (((msg = mac_lld_get_transmit_descriptor(macp, tdp)) != MSG_OK) && - (timeout > 0U)) { + (timeout > (systime_t)0)) { osalSysLock(); now = osalOsGetSystemTimeX(); msg = osalThreadEnqueueTimeoutS(&macp->tdqueue, timeout); @@ -216,7 +216,7 @@ msg_t macWaitReceiveDescriptor(MACDriver *macp, osalDbgAssert(macp->state == MAC_ACTIVE, "not active"); while (((msg = mac_lld_get_receive_descriptor(macp, rdp)) != MSG_OK) && - (timeout > 0U)) { + (timeout > (systime_t)0)) { osalSysLock(); now = osalOsGetSystemTimeX(); msg = osalThreadEnqueueTimeoutS(&macp->rdqueue, timeout); diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index 87c4df3af..465d2224a 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -182,7 +182,7 @@ static void wait(MMCDriver *mmcp) { } #if MMC_NICE_WAITING == TRUE /* Trying to be nice with the other threads.*/ - osalThreadSleep(1); + osalThreadSleepMilliseconds(1); #endif } } @@ -365,7 +365,7 @@ static void sync(MMCDriver *mmcp) { } #if MMC_NICE_WAITING == TRUE /* Trying to be nice with the other threads.*/ - osalThreadSleep(1); + osalThreadSleepMilliseconds(1); #endif } spiUnselect(mmcp->config->spip); diff --git a/os/hal/templates/osal/osal.h b/os/hal/templates/osal/osal.h index 3736256a0..6e3d62ca0 100644 --- a/os/hal/templates/osal/osal.h +++ b/os/hal/templates/osal/osal.h @@ -45,17 +45,17 @@ #define TRUE 1 #endif -#define OSAL_SUCCESS FALSE -#define OSAL_FAILED TRUE +#define OSAL_SUCCESS false +#define OSAL_FAILED true /** @} */ /** * @name Messages * @{ */ -#define MSG_OK 0 -#define MSG_RESET -1 -#define MSG_TIMEOUT -2 +#define MSG_OK (msg_t)0 +#define MSG_RESET (msg_t)-1 +#define MSG_TIMEOUT (msg_t)-2 /** @} */ @@ -308,7 +308,7 @@ typedef struct { * @api */ #define OSAL_S2ST(sec) \ - ((systime_t)((sec) * OSAL_ST_FREQUENCY)) + ((systime_t)((uint32_t)(sec) * (uint32_t)OSAL_ST_FREQUENCY)) /** * @brief Milliseconds to system ticks. @@ -321,8 +321,8 @@ typedef struct { * @api */ #define OSAL_MS2ST(msec) \ - ((systime_t)((((((uint32_t)(msec)) * ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) /\ - 1000UL) + 1UL)) + ((systime_t)((((((uint32_t)(msec)) * \ + ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL)) /** * @brief Microseconds to system ticks. @@ -335,8 +335,8 @@ typedef struct { * @api */ #define OSAL_US2ST(usec) \ - ((systime_t)((((((uint32_t)(usec)) * ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) /\ - 1000000UL) + 1UL)) + ((systime_t)((((((uint32_t)(usec)) * \ + ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL)) /** @} */ /** @@ -485,7 +485,7 @@ static inline void osalSysUnlockFromISR(void) { */ static inline syssts_t osalSysGetStatusAndLockX(void) { - return 0; + return (syssts_t)0; } /** @@ -555,7 +555,7 @@ static inline void osalOsRescheduleS(void) { */ static inline systime_t osalOsGetSystemTimeX(void) { - return 0; + return (systime_t)0; } /** @@ -745,7 +745,7 @@ static inline void osalEventObjectInit(event_source_t *esp) { osalDbgCheck(esp != NULL); - esp->flags = 0; + esp->flags = (eventflags_t)0; esp->cb = NULL; esp->param = NULL; } -- cgit v1.2.3