From c397738010966f85c7ae841e21d74790ac49611c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 31 Dec 2011 10:07:43 +0000 Subject: Changes to palSetGroupMode(), various adjustments to the PAL driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3695 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/pal.h | 11 +++++----- os/hal/platforms/AT91SAM7/pal_lld.h | 37 +++++++++++++++++-------------- os/hal/platforms/AVR/pal_lld.h | 28 ++++++++++++----------- os/hal/platforms/LPC11xx/pal_lld.h | 5 +++-- os/hal/platforms/LPC13xx/pal_lld.h | 5 +++-- os/hal/platforms/LPC214x/pal_lld.h | 39 ++++++++++++++++++--------------- os/hal/platforms/MSP430/pal_lld.h | 19 ++++++++-------- os/hal/platforms/Posix/pal_lld.h | 16 +++++++++++--- os/hal/platforms/STM32/GPIOv1/pal_lld.h | 37 ++++++++++++++++--------------- os/hal/platforms/STM32/GPIOv2/pal_lld.h | 37 ++++++++++++++++--------------- os/hal/platforms/STM8L/pal_lld.h | 6 ++--- os/hal/platforms/STM8S/pal_lld.h | 6 ++--- os/hal/platforms/Win32/pal_lld.h | 16 +++++++++++--- os/hal/src/pal.c | 2 +- os/hal/templates/pal_lld.h | 4 +++- 15 files changed, 153 insertions(+), 115 deletions(-) (limited to 'os') diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h index d844ca8b3..8b15d20bc 100644 --- a/os/hal/include/pal.h +++ b/os/hal/include/pal.h @@ -137,7 +137,7 @@ typedef struct { /** * @brief Offset, within the port, of the least significant bit of the bus. */ - iomode_t offset; + uint_fast8_t offset; } IOBus; /*===========================================================================*/ @@ -153,7 +153,6 @@ typedef struct { */ #define PAL_PORT_BIT(n) ((ioportmask_t)(1 << (n))) - /** * @brief Bits group mask helper. * @details This macro calculates the mask of a bits group. @@ -368,14 +367,16 @@ typedef struct { * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @api */ #if !defined(pal_lld_setgroupmode) || defined(__DOXYGEN__) -#define palSetGroupMode(port, mask, mode) +#define palSetGroupMode(port, mask, offset, mode) #else -#define palSetGroupMode(port, mask, mode) pal_lld_setgroupmode(port, mask, mode) +#define palSetGroupMode(port, mask, offset, mode) \ + pal_lld_setgroupmode(port, mask, offset, mode) #endif /** @@ -509,7 +510,7 @@ typedef struct { */ #if !defined(pal_lld_setpadmode) || defined(__DOXYGEN__) #define palSetPadMode(port, pad, mode) \ - palSetGroupMode(port, PAL_PORT_BIT(pad), mode) + palSetGroupMode(port, PAL_PORT_BIT(pad), 0, mode) #else #define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode) #endif diff --git a/os/hal/platforms/AT91SAM7/pal_lld.h b/os/hal/platforms/AT91SAM7/pal_lld.h index 53fdd417e..b9aa91371 100644 --- a/os/hal/platforms/AT91SAM7/pal_lld.h +++ b/os/hal/platforms/AT91SAM7/pal_lld.h @@ -123,6 +123,10 @@ typedef AT91PS_PIO ioportid_t; /** * @brief Low level PAL subsystem initialization. + * + * @param[in] config architecture-dependent ports configuration + * + * @notapi */ #define pal_lld_init(config) _pal_lld_init(config) @@ -131,7 +135,7 @@ typedef AT91PS_PIO ioportid_t; * @details This function is implemented by reading the PIO_PDSR register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -143,7 +147,7 @@ typedef AT91PS_PIO ioportid_t; * @details This function is implemented by reading the PIO_ODSR register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -167,8 +171,8 @@ typedef AT91PS_PIO ioportid_t; * @details This function is implemented by writing the PIO_SODR register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be ORed on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be ORed on the specified port * * @notapi */ @@ -179,8 +183,8 @@ typedef AT91PS_PIO ioportid_t; * @details This function is implemented by writing the PIO_CODR register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be cleared on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be cleared on the specified port * * @notapi */ @@ -192,10 +196,10 @@ typedef AT91PS_PIO ioportid_t; * PIO_OWDR registers, the implementation is not atomic because the * multiple accesses. * - * @param[in] port the port identifier - * @param[in] mask the group mask + * @param[in] port port identifier + * @param[in] mask group mask * @param[in] offset the group bit offset within the port - * @param[in] bits the bits to be written. Values exceeding the group + * @param[in] bits bits to be written. Values exceeding the group * width are masked. * * @notapi @@ -212,20 +216,21 @@ typedef AT91PS_PIO ioportid_t; * @note @p PAL_MODE_UNCONNECTED is implemented as push pull output with * high state. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * @param[in] bit logical value, the value must be @p PAL_LOW or * @p PAL_HIGH * diff --git a/os/hal/platforms/AVR/pal_lld.h b/os/hal/platforms/AVR/pal_lld.h index fe64029d0..b04241dbf 100644 --- a/os/hal/platforms/AVR/pal_lld.h +++ b/os/hal/platforms/AVR/pal_lld.h @@ -65,7 +65,7 @@ typedef struct { * @brief AVR registers block. * @note On some devices registers do not follow this layout on some * ports, the ports with abnormal layout cannot be used through - * the PAL driver. Example: PORT F on Mega128. + * PAL driver. Example: PORT F on Mega128. */ typedef struct { volatile uint8_t in; @@ -192,7 +192,7 @@ typedef avr_gpio_registers_t *ioportid_t; /** * @brief Reads the physical I/O port states. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -204,7 +204,7 @@ typedef avr_gpio_registers_t *ioportid_t; * @details The purpose of this function is to read back the latched output * value. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -214,8 +214,8 @@ typedef avr_gpio_registers_t *ioportid_t; /** * @brief Writes a bits mask on a I/O port. * - * @param[in] port the port identifier - * @param[in] bits the bits to be written on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be written on the specified port * * @notapi */ @@ -227,19 +227,21 @@ typedef avr_gpio_registers_t *ioportid_t; * with the specified mode. * @note Programming an unknown or unsupported mode is silently ignored. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Sets a pad logical state to @p PAL_HIGH. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * * @notapi */ @@ -256,8 +258,8 @@ __asm__ __volatile__ \ /** * @brief Clears a pad logical state to @p PAL_LOW. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * * @notapi */ diff --git a/os/hal/platforms/LPC11xx/pal_lld.h b/os/hal/platforms/LPC11xx/pal_lld.h index 2e99f0697..2040e9426 100644 --- a/os/hal/platforms/LPC11xx/pal_lld.h +++ b/os/hal/platforms/LPC11xx/pal_lld.h @@ -244,12 +244,13 @@ typedef LPC_GPIO_TypeDef *ioportid_t; * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. diff --git a/os/hal/platforms/LPC13xx/pal_lld.h b/os/hal/platforms/LPC13xx/pal_lld.h index 0673c11f1..06a99de67 100644 --- a/os/hal/platforms/LPC13xx/pal_lld.h +++ b/os/hal/platforms/LPC13xx/pal_lld.h @@ -244,12 +244,13 @@ typedef LPC_GPIO_TypeDef *ioportid_t; * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. diff --git a/os/hal/platforms/LPC214x/pal_lld.h b/os/hal/platforms/LPC214x/pal_lld.h index 688e687cc..78d688ae7 100644 --- a/os/hal/platforms/LPC214x/pal_lld.h +++ b/os/hal/platforms/LPC214x/pal_lld.h @@ -121,6 +121,8 @@ typedef FIO * ioportid_t; /** * @brief FIO subsystem initialization. * @details Enables the access through the fast registers. + * + * @notapi */ #define pal_lld_init(config) _pal_lld_init(config) @@ -129,7 +131,7 @@ typedef FIO * ioportid_t; * @details This function is implemented by reading the FIO PIN register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -141,7 +143,7 @@ typedef FIO * ioportid_t; * @details This function is implemented by reading the FIO SET register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -153,8 +155,8 @@ typedef FIO * ioportid_t; * @details This function is implemented by writing the FIO PIN register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be written on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be written on the specified port * * @notapi */ @@ -165,8 +167,8 @@ typedef FIO * ioportid_t; * @details This function is implemented by writing the FIO SET register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be ORed on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be ORed on the specified port * * @notapi */ @@ -177,8 +179,8 @@ typedef FIO * ioportid_t; * @details This function is implemented by writing the FIO CLR register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be cleared on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be cleared on the specified port * * @notapi */ @@ -190,11 +192,11 @@ typedef FIO * ioportid_t; * registers, the implementation is not atomic because the multiple * accesses. * - * @param[in] port the port identifier - * @param[in] mask the group mask, a logical AND is performed on the + * @param[in] port port identifier + * @param[in] mask group mask, a logical AND is performed on the * output data * @param[in] offset the group bit offset within the port - * @param[in] bits the bits to be written. Values exceeding the group + * @param[in] bits bits to be written. Values exceeding the group * width are masked. * * @notapi @@ -213,20 +215,21 @@ typedef FIO * ioportid_t; * @note This function does not alter the @p PINSELx registers. Alternate * functions setup must be handled by device-specific code. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * @param[in] bit logical value, the value must be @p PAL_LOW or * @p PAL_HIGH * diff --git a/os/hal/platforms/MSP430/pal_lld.h b/os/hal/platforms/MSP430/pal_lld.h index 282ed4e75..97e7795d5 100644 --- a/os/hal/platforms/MSP430/pal_lld.h +++ b/os/hal/platforms/MSP430/pal_lld.h @@ -231,7 +231,7 @@ typedef msp430_ioport_t *ioportid_t; * @details This function is implemented by reading the PxIN register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -243,7 +243,7 @@ typedef msp430_ioport_t *ioportid_t; * @details This function is implemented by reading the PxOUT register, the * implementation has no side effects. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -255,8 +255,8 @@ typedef msp430_ioport_t *ioportid_t; * @details This function is implemented by writing the PxOUT register, the * implementation has no side effects. * - * @param[in] port the port identifier - * @param[in] bits the bits to be written on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be written on the specified port * * @notapi */ @@ -271,14 +271,15 @@ typedef msp430_ioport_t *ioportid_t; * @note This function does not alter the @p PxSEL registers. Alternate * functions setup must be handled by device-specific code. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) extern const PALConfig pal_default_config; diff --git a/os/hal/platforms/Posix/pal_lld.h b/os/hal/platforms/Posix/pal_lld.h index f8e2a8702..da57d8481 100644 --- a/os/hal/platforms/Posix/pal_lld.h +++ b/os/hal/platforms/Posix/pal_lld.h @@ -133,6 +133,8 @@ typedef sim_vio_port_t *ioportid_t; * @brief Low level PAL subsystem initialization. * * @param[in] config architecture-dependent ports configuration + * + * @notapi */ #define pal_lld_init(config) \ (vio_port_1 = (config)->VP1Data, \ @@ -143,6 +145,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @return The port bits. + * + * @notapi */ #define pal_lld_readport(port) ((port)->pin) @@ -153,6 +157,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @return The latched logical states. + * + * @notapi */ #define pal_lld_readlatch(port) ((port)->latch) @@ -161,6 +167,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @param[in] bits bits to be written on the specified port + * + * @notapi */ #define pal_lld_writeport(port, bits) ((port)->latch = (bits)) @@ -168,14 +176,16 @@ typedef sim_vio_port_t *ioportid_t; * @brief Pads group mode setup. * @details This function programs a pads group belonging to the same port * with the specified mode. - * @note Programming an unknown or unsupported mode is silently ignored. * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode + * + * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) #if !defined(__DOXYGEN__) extern sim_vio_port_t vio_port_1; diff --git a/os/hal/platforms/STM32/GPIOv1/pal_lld.h b/os/hal/platforms/STM32/GPIOv1/pal_lld.h index ab1c273bc..ce0525fd6 100644 --- a/os/hal/platforms/STM32/GPIOv1/pal_lld.h +++ b/os/hal/platforms/STM32/GPIOv1/pal_lld.h @@ -199,7 +199,7 @@ typedef GPIO_TypeDef * ioportid_t; * @note This function is not meant to be invoked directly by the application * code. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -213,7 +213,7 @@ typedef GPIO_TypeDef * ioportid_t; * @note This function is not meant to be invoked directly by the application * code. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -228,8 +228,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be written on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be written on the specified port * * @notapi */ @@ -243,8 +243,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be ORed on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be ORed on the specified port * * @notapi */ @@ -258,8 +258,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be cleared on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be cleared on the specified port * * @notapi */ @@ -273,10 +273,10 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] mask the group mask + * @param[in] port port identifier + * @param[in] mask group mask * @param[in] offset the group bit offset within the port - * @param[in] bits the bits to be written. Values exceeding the group + * @param[in] bits bits to be written. Values exceeding the group * width are masked. * * @notapi @@ -293,14 +293,15 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. @@ -308,8 +309,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * @param[in] bit logical value, the value must be @p PAL_LOW or * @p PAL_HIGH * diff --git a/os/hal/platforms/STM32/GPIOv2/pal_lld.h b/os/hal/platforms/STM32/GPIOv2/pal_lld.h index ac564e8e3..bc36037f5 100644 --- a/os/hal/platforms/STM32/GPIOv2/pal_lld.h +++ b/os/hal/platforms/STM32/GPIOv2/pal_lld.h @@ -332,7 +332,7 @@ typedef GPIO_TypeDef * ioportid_t; * @note This function is not meant to be invoked directly by the application * code. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The port bits. * * @notapi @@ -346,7 +346,7 @@ typedef GPIO_TypeDef * ioportid_t; * @note This function is not meant to be invoked directly by the application * code. * - * @param[in] port the port identifier + * @param[in] port port identifier * @return The latched logical states. * * @notapi @@ -361,8 +361,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be written on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be written on the specified port * * @notapi */ @@ -376,8 +376,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be ORed on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be ORed on the specified port * * @notapi */ @@ -391,8 +391,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] bits the bits to be cleared on the specified port + * @param[in] port port identifier + * @param[in] bits bits to be cleared on the specified port * * @notapi */ @@ -406,10 +406,10 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] mask the group mask + * @param[in] port port identifier + * @param[in] mask group mask * @param[in] offset the group bit offset within the port - * @param[in] bits the bits to be written. Values exceeding the group + * @param[in] bits bits to be written. Values exceeding the group * width are masked. * * @notapi @@ -426,14 +426,15 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] mask the group mask - * @param[in] mode the mode + * @param[in] port port identifier + * @param[in] mask group mask + * @param[in] offset group bit offset within the port + * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Writes a logical state on an output pad. @@ -441,8 +442,8 @@ typedef GPIO_TypeDef * ioportid_t; * effect to modify the resistor setting because the output latched * data is used for the resistor selection. * - * @param[in] port the port identifier - * @param[in] pad the pad number within the port + * @param[in] port port identifier + * @param[in] pad pad number within the port * @param[in] bit logical value, the value must be @p PAL_LOW or * @p PAL_HIGH * diff --git a/os/hal/platforms/STM8L/pal_lld.h b/os/hal/platforms/STM8L/pal_lld.h index 22d048c74..57c558ce8 100644 --- a/os/hal/platforms/STM8L/pal_lld.h +++ b/os/hal/platforms/STM8L/pal_lld.h @@ -218,16 +218,16 @@ typedef GPIO_TypeDef *ioportid_t; * @brief Pads group mode setup. * @details This function programs a pads group belonging to the same port * with the specified mode. - * @note Programming an unknown or unsupported mode is silently ignored. * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) extern ROMCONST PALConfig pal_default_config; diff --git a/os/hal/platforms/STM8S/pal_lld.h b/os/hal/platforms/STM8S/pal_lld.h index d38406b2f..f8994765e 100644 --- a/os/hal/platforms/STM8S/pal_lld.h +++ b/os/hal/platforms/STM8S/pal_lld.h @@ -203,16 +203,16 @@ typedef GPIO_TypeDef *ioportid_t; * @brief Pads group mode setup. * @details This function programs a pads group belonging to the same port * with the specified mode. - * @note Programming an unknown or unsupported mode is silently ignored. * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) extern ROMCONST PALConfig pal_default_config; diff --git a/os/hal/platforms/Win32/pal_lld.h b/os/hal/platforms/Win32/pal_lld.h index e0f03e135..ce6c508c7 100644 --- a/os/hal/platforms/Win32/pal_lld.h +++ b/os/hal/platforms/Win32/pal_lld.h @@ -133,6 +133,8 @@ typedef sim_vio_port_t *ioportid_t; * @brief Low level PAL subsystem initialization. * * @param[in] config architecture-dependent ports configuration + * + * @notapi */ #define pal_lld_init(config) \ (vio_port_1 = (config)->VP1Data, \ @@ -143,6 +145,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @return The port bits. + * + * @notapi */ #define pal_lld_readport(port) ((port)->pin) @@ -153,6 +157,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @return The latched logical states. + * + * @notapi */ #define pal_lld_readlatch(port) ((port)->latch) @@ -161,6 +167,8 @@ typedef sim_vio_port_t *ioportid_t; * * @param[in] port port identifier * @param[in] bits bits to be written on the specified port + * + * @notapi */ #define pal_lld_writeport(port, bits) ((port)->latch = (bits)) @@ -168,14 +176,16 @@ typedef sim_vio_port_t *ioportid_t; * @brief Pads group mode setup. * @details This function programs a pads group belonging to the same port * with the specified mode. - * @note Programming an unknown or unsupported mode is silently ignored. * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode + * + * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) \ - _pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) #if !defined(__DOXYGEN__) extern sim_vio_port_t vio_port_1; diff --git a/os/hal/src/pal.c b/os/hal/src/pal.c index afb5c6b40..faa022f5d 100644 --- a/os/hal/src/pal.c +++ b/os/hal/src/pal.c @@ -119,7 +119,7 @@ void palSetBusMode(IOBus *bus, iomode_t mode) { chDbgCheck((bus != NULL) && (bus->offset < PAL_IOPORTS_WIDTH), "palSetBusMode"); - palSetGroupMode(bus->portid, bus->mask, mode); + palSetGroupMode(bus->portid, bus->mask, bus->offset, mode); } #endif /* HAL_USE_PAL */ diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h index 60bac5e5c..89d9fde9f 100644 --- a/os/hal/templates/pal_lld.h +++ b/os/hal/templates/pal_lld.h @@ -216,11 +216,13 @@ typedef uint32_t ioportid_t; * * @param[in] port port identifier * @param[in] mask group mask + * @param[in] offset group bit offset within the port * @param[in] mode group mode * * @notapi */ -#define pal_lld_setgroupmode(port, mask, mode) +#define pal_lld_setgroupmode(port, mask, offset, mode) \ + _pal_lld_setgroupmode(port, mask << offset, mode) /** * @brief Reads a logical state from an I/O pad. -- cgit v1.2.3