git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7713 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
Giovanni Di Sirio 2015-03-03 15:08:54 +00:00
parent e2d1dd382a
commit 880d6916b3
10 changed files with 50 additions and 50 deletions

View File

@ -44,7 +44,7 @@
* it is guaranteed to be equal to the after-reset state. It is * it is guaranteed to be equal to the after-reset state. It is
* usually an input state. * usually an input state.
*/ */
#define PAL_MODE_RESET 0 #define PAL_MODE_RESET 0U
/** /**
* @brief Safe state for <b>unconnected</b> pads. * @brief Safe state for <b>unconnected</b> pads.
@ -53,37 +53,37 @@
* @p PAL_MODE_INPUT_PULLDOWN or @p PAL_MODE_OUTPUT_PUSHPULL for * @p PAL_MODE_INPUT_PULLDOWN or @p PAL_MODE_OUTPUT_PUSHPULL for
* example. * example.
*/ */
#define PAL_MODE_UNCONNECTED 1 #define PAL_MODE_UNCONNECTED 1U
/** /**
* @brief Regular input high-Z pad. * @brief Regular input high-Z pad.
*/ */
#define PAL_MODE_INPUT 2 #define PAL_MODE_INPUT 2U
/** /**
* @brief Input pad with weak pull up resistor. * @brief Input pad with weak pull up resistor.
*/ */
#define PAL_MODE_INPUT_PULLUP 3 #define PAL_MODE_INPUT_PULLUP 3U
/** /**
* @brief Input pad with weak pull down resistor. * @brief Input pad with weak pull down resistor.
*/ */
#define PAL_MODE_INPUT_PULLDOWN 4 #define PAL_MODE_INPUT_PULLDOWN 4U
/** /**
* @brief Analog input mode. * @brief Analog input mode.
*/ */
#define PAL_MODE_INPUT_ANALOG 5 #define PAL_MODE_INPUT_ANALOG 5U
/** /**
* @brief Push-pull output pad. * @brief Push-pull output pad.
*/ */
#define PAL_MODE_OUTPUT_PUSHPULL 6 #define PAL_MODE_OUTPUT_PUSHPULL 6U
/** /**
* @brief Open-drain output pad. * @brief Open-drain output pad.
*/ */
#define PAL_MODE_OUTPUT_OPENDRAIN 7 #define PAL_MODE_OUTPUT_OPENDRAIN 7U
/** @} */ /** @} */
/** /**
@ -93,12 +93,12 @@
/** /**
* @brief Logical low state. * @brief Logical low state.
*/ */
#define PAL_LOW 0 #define PAL_LOW 0U
/** /**
* @brief Logical high state. * @brief Logical high state.
*/ */
#define PAL_HIGH 1 #define PAL_HIGH 1U
/** @} */ /** @} */
/*===========================================================================*/ /*===========================================================================*/
@ -151,7 +151,7 @@ typedef struct {
* @return The bit mask. * @return The bit mask.
*/ */
#if !defined(PAL_PORT_BIT) || defined(__DOXYGEN__) #if !defined(PAL_PORT_BIT) || defined(__DOXYGEN__)
#define PAL_PORT_BIT(n) ((ioportmask_t)(1 << (n))) #define PAL_PORT_BIT(n) ((ioportmask_t)(1U << (n)))
#endif #endif
/** /**
@ -162,7 +162,7 @@ typedef struct {
* @return The group mask. * @return The group mask.
*/ */
#if !defined(PAL_GROUP_MASK) || defined(__DOXYGEN__) #if !defined(PAL_GROUP_MASK) || defined(__DOXYGEN__)
#define PAL_GROUP_MASK(width) ((ioportmask_t)(1 << (width)) - 1) #define PAL_GROUP_MASK(width) ((ioportmask_t)(1U << (width)) - 1U)
#endif #endif
/** /**
@ -218,7 +218,7 @@ typedef struct {
* @special * @special
*/ */
#if !defined(pal_lld_readport) || defined(__DOXYGEN__) #if !defined(pal_lld_readport) || defined(__DOXYGEN__)
#define palReadPort(port) ((void)(port), 0) #define palReadPort(port) ((void)(port), 0U)
#else #else
#define palReadPort(port) pal_lld_readport(port) #define palReadPort(port) pal_lld_readport(port)
#endif #endif
@ -237,7 +237,7 @@ typedef struct {
* @special * @special
*/ */
#if !defined(pal_lld_readlatch) || defined(__DOXYGEN__) #if !defined(pal_lld_readlatch) || defined(__DOXYGEN__)
#define palReadLatch(port) ((void)(port), 0) #define palReadLatch(port) ((void)(port), 0U)
#else #else
#define palReadLatch(port) pal_lld_readlatch(port) #define palReadLatch(port) pal_lld_readlatch(port)
#endif #endif
@ -408,7 +408,7 @@ typedef struct {
* @special * @special
*/ */
#if !defined(pal_lld_readpad) || defined(__DOXYGEN__) #if !defined(pal_lld_readpad) || defined(__DOXYGEN__)
#define palReadPad(port, pad) ((palReadPort(port) >> (pad)) & 1) #define palReadPad(port, pad) ((palReadPort(port) >> (pad)) & 1U)
#else #else
#define palReadPad(port, pad) pal_lld_readpad(port, pad) #define palReadPad(port, pad) pal_lld_readpad(port, pad)
#endif #endif
@ -436,7 +436,7 @@ typedef struct {
#if !defined(pal_lld_writepad) || defined(__DOXYGEN__) #if !defined(pal_lld_writepad) || defined(__DOXYGEN__)
#define palWritePad(port, pad, bit) \ #define palWritePad(port, pad, bit) \
palWritePort(port, (palReadLatch(port) & ~PAL_PORT_BIT(pad)) | \ palWritePort(port, (palReadLatch(port) & ~PAL_PORT_BIT(pad)) | \
(((bit) & 1) << pad)) (((bit) & 1U) << pad))
#else #else
#define palWritePad(port, pad, bit) pal_lld_writepad(port, pad, bit) #define palWritePad(port, pad, bit) pal_lld_writepad(port, pad, bit)
#endif #endif
@ -527,7 +527,7 @@ typedef struct {
*/ */
#if !defined(pal_lld_setpadmode) || defined(__DOXYGEN__) #if !defined(pal_lld_setpadmode) || defined(__DOXYGEN__)
#define palSetPadMode(port, pad, mode) \ #define palSetPadMode(port, pad, mode) \
palSetGroupMode(port, PAL_PORT_BIT(pad), 0, mode) palSetGroupMode(port, PAL_PORT_BIT(pad), 0U, mode)
#else #else
#define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode) #define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode)
#endif #endif

View File

@ -44,33 +44,33 @@
* @name STM32-specific I/O mode flags * @name STM32-specific I/O mode flags
* @{ * @{
*/ */
#define PAL_STM32_MODE_MASK (3 << 0) #define PAL_STM32_MODE_MASK (3U << 0U)
#define PAL_STM32_MODE_INPUT (0 << 0) #define PAL_STM32_MODE_INPUT (0U << 0U)
#define PAL_STM32_MODE_OUTPUT (1 << 0) #define PAL_STM32_MODE_OUTPUT (1U << 0U)
#define PAL_STM32_MODE_ALTERNATE (2 << 0) #define PAL_STM32_MODE_ALTERNATE (2U << 0U)
#define PAL_STM32_MODE_ANALOG (3 << 0) #define PAL_STM32_MODE_ANALOG (3U << 0U)
#define PAL_STM32_OTYPE_MASK (1 << 2) #define PAL_STM32_OTYPE_MASK (1U << 2U)
#define PAL_STM32_OTYPE_PUSHPULL (0 << 2) #define PAL_STM32_OTYPE_PUSHPULL (0U << 2U)
#define PAL_STM32_OTYPE_OPENDRAIN (1 << 2) #define PAL_STM32_OTYPE_OPENDRAIN (1U << 2U)
#define PAL_STM32_OSPEED_MASK (3 << 3) #define PAL_STM32_OSPEED_MASK (3U << 3U)
#define PAL_STM32_OSPEED_LOWEST (0 << 3) #define PAL_STM32_OSPEED_LOWEST (0U << 3U)
#if defined(STM32F0XX) || defined(STM32F30X) || defined(STM32F37X) #if defined(STM32F0XX) || defined(STM32F30X) || defined(STM32F37X)
#define PAL_STM32_OSPEED_MID (1 << 3) #define PAL_STM32_OSPEED_MID (1U << 3U)
#else #else
#define PAL_STM32_OSPEED_MID1 (1 << 3) #define PAL_STM32_OSPEED_MID1 (1U << 3U)
#define PAL_STM32_OSPEED_MID2 (2 << 3) #define PAL_STM32_OSPEED_MID2 (2U << 3U)
#endif #endif
#define PAL_STM32_OSPEED_HIGHEST (3 << 3) #define PAL_STM32_OSPEED_HIGHEST (3U << 3U)
#define PAL_STM32_PUDR_MASK (3 << 5) #define PAL_STM32_PUDR_MASK (3U << 5U)
#define PAL_STM32_PUDR_FLOATING (0 << 5) #define PAL_STM32_PUDR_FLOATING (0U << 5U)
#define PAL_STM32_PUDR_PULLUP (1 << 5) #define PAL_STM32_PUDR_PULLUP (1U << 5U)
#define PAL_STM32_PUDR_PULLDOWN (2 << 5) #define PAL_STM32_PUDR_PULLDOWN (2U << 5U)
#define PAL_STM32_ALTERNATE_MASK (15 << 7) #define PAL_STM32_ALTERNATE_MASK (15U << 7U)
#define PAL_STM32_ALTERNATE(n) ((n) << 7) #define PAL_STM32_ALTERNATE(n) ((n) << 7U)
/** /**
* @brief Alternate function. * @brief Alternate function.
@ -441,7 +441,7 @@ typedef stm32_gpio_t * ioportid_t;
* @notapi * @notapi
*/ */
#define pal_lld_writegroup(port, mask, offset, bits) \ #define pal_lld_writegroup(port, mask, offset, bits) \
((port)->BSRR.W = ((~(bits) & (mask)) << (16 + (offset))) | \ ((port)->BSRR.W = ((~(bits) & (mask)) << (16U + (offset))) | \
(((bits) & (mask)) << (offset))) (((bits) & (mask)) << (offset)))
/** /**

View File

@ -116,7 +116,7 @@
* @api * @api
*/ */
#define THD_ALIGN_STACK_SIZE(n) \ #define THD_ALIGN_STACK_SIZE(n) \
((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) (((((size_t)(n)) - 1U) | (sizeof(stkalign_t) - 1U)) + 1U)
/** /**
* @brief Calculates the total Working Area size. * @brief Calculates the total Working Area size.

View File

@ -118,8 +118,8 @@
* @api * @api
*/ */
#define MS2ST(msec) \ #define MS2ST(msec) \
((systime_t)(((((uint32_t)(msec)) * \ ((systime_t)((((((uint32_t)(msec)) * \
((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000UL) + 1UL)) ((uint32_t)CH_CFG_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL))
/** /**
* @brief Microseconds to system ticks. * @brief Microseconds to system ticks.
@ -132,8 +132,8 @@
* @api * @api
*/ */
#define US2ST(usec) \ #define US2ST(usec) \
((systime_t)(((((uint32_t)(usec)) * \ ((systime_t)((((((uint32_t)(usec)) * \
((uint32_t)CH_CFG_ST_FREQUENCY) - 1UL) / 1000000UL) + 1UL)) ((uint32_t)CH_CFG_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL))
/** /**
* @brief System ticks to seconds. * @brief System ticks to seconds.

View File

@ -251,7 +251,7 @@ struct context {
*/ */
#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \ #define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + (PORT_INT_REQUIRED_STACK)) ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.

View File

@ -197,7 +197,7 @@ struct port_intctx {
*/ */
#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \ #define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + (PORT_INT_REQUIRED_STACK)) ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.

View File

@ -296,7 +296,7 @@ struct port_intctx {
*/ */
#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \ #define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + (PORT_INT_REQUIRED_STACK)) ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.

View File

@ -191,8 +191,8 @@ struct context {
#define PORT_WA_SIZE(n) (sizeof(void *) * 4 + \ #define PORT_WA_SIZE(n) (sizeof(void *) * 4 + \
sizeof(struct port_intctx) + \ sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + \ ((size_t)(n)) + \
PORT_INT_REQUIRED_STACK) ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.

View File

@ -300,7 +300,7 @@ struct context {
*/ */
#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \ #define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + (PORT_INT_REQUIRED_STACK)) ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.

View File

@ -177,7 +177,7 @@ struct context {
*/ */
#define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \ #define PORT_WA_SIZE(n) (sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \ sizeof(struct port_extctx) + \
(n) + (PORT_INT_REQUIRED_STACK)) ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/** /**
* @brief IRQ prologue code. * @brief IRQ prologue code.