aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-31 10:07:43 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-31 10:07:43 +0000
commitc397738010966f85c7ae841e21d74790ac49611c (patch)
tree71fc62ea0e2f86481586f51dbe55ffe691b4b363
parent72266f8b591c6e7857f4578ba753eeea7222ac6b (diff)
downloadChibiOS-c397738010966f85c7ae841e21d74790ac49611c.tar.gz
ChibiOS-c397738010966f85c7ae841e21d74790ac49611c.tar.bz2
ChibiOS-c397738010966f85c7ae841e21d74790ac49611c.zip
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
-rw-r--r--boards/OLIMEX_SAM7_EX256/board.c4
-rw-r--r--boards/OLIMEX_SAM7_P256/board.c3
-rw-r--r--demos/ARMCM3-STM32F100-DISCOVERY/main.c3
-rw-r--r--os/hal/include/pal.h11
-rw-r--r--os/hal/platforms/AT91SAM7/pal_lld.h37
-rw-r--r--os/hal/platforms/AVR/pal_lld.h28
-rw-r--r--os/hal/platforms/LPC11xx/pal_lld.h5
-rw-r--r--os/hal/platforms/LPC13xx/pal_lld.h5
-rw-r--r--os/hal/platforms/LPC214x/pal_lld.h39
-rw-r--r--os/hal/platforms/MSP430/pal_lld.h19
-rw-r--r--os/hal/platforms/Posix/pal_lld.h16
-rw-r--r--os/hal/platforms/STM32/GPIOv1/pal_lld.h37
-rw-r--r--os/hal/platforms/STM32/GPIOv2/pal_lld.h37
-rw-r--r--os/hal/platforms/STM8L/pal_lld.h6
-rw-r--r--os/hal/platforms/STM8S/pal_lld.h6
-rw-r--r--os/hal/platforms/Win32/pal_lld.h16
-rw-r--r--os/hal/src/pal.c2
-rw-r--r--os/hal/templates/pal_lld.h4
-rw-r--r--readme.txt2
-rw-r--r--testhal/STM32F1xx/ADC/main.c2
-rw-r--r--testhal/STM32F4xx/ADC/main.c2
-rw-r--r--testhal/STM32L1xx/ADC/main.c2
22 files changed, 165 insertions, 121 deletions
diff --git a/boards/OLIMEX_SAM7_EX256/board.c b/boards/OLIMEX_SAM7_EX256/board.c
index 31f28d3a3..d1439d7f3 100644
--- a/boards/OLIMEX_SAM7_EX256/board.c
+++ b/boards/OLIMEX_SAM7_EX256/board.c
@@ -94,14 +94,16 @@ void boardInit(void) {
palSetGroupMode(IOPORT1,
PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK |
PIOA_B4_MASK | PIOA_B5_MASK,
+ 0
PAL_MODE_INPUT);
- palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT);
+ palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, 0, PAL_MODE_INPUT);
/*
* MMC/SD slot setup.
*/
palSetGroupMode(IOPORT2,
PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK,
+ 0,
PAL_MODE_INPUT);
/*
diff --git a/boards/OLIMEX_SAM7_P256/board.c b/boards/OLIMEX_SAM7_P256/board.c
index 59ec35d4b..614c415db 100644
--- a/boards/OLIMEX_SAM7_P256/board.c
+++ b/boards/OLIMEX_SAM7_P256/board.c
@@ -84,13 +84,14 @@ void boardInit(void) {
/*
* buttons setup.
*/
- palSetGroupMode(IOPORT1, PIOA_B1_MASK | PIOA_B2_MASK, PAL_MODE_INPUT);
+ palSetGroupMode(IOPORT1, PIOA_B1_MASK | PIOA_B2_MASK, 0, PAL_MODE_INPUT);
/*
* MMC/SD slot setup.
*/
palSetGroupMode(IOPORT1,
PIOA_MMC_WP_MASK | PIOA_MMC_CP_MASK,
+ 0,
PAL_MODE_INPUT);
/*
diff --git a/demos/ARMCM3-STM32F100-DISCOVERY/main.c b/demos/ARMCM3-STM32F100-DISCOVERY/main.c
index 4aa8f421c..2e1867fae 100644
--- a/demos/ARMCM3-STM32F100-DISCOVERY/main.c
+++ b/demos/ARMCM3-STM32F100-DISCOVERY/main.c
@@ -205,7 +205,7 @@ int main(void) {
* The pin PC0 on the port GPIOC is programmed as analog input.
*/
adcStart(&ADCD1, NULL);
- palSetGroupMode(GPIOC, PAL_PORT_BIT(0), PAL_MODE_INPUT_ANALOG);
+ palSetGroupMode(GPIOC, PAL_PORT_BIT(0), 0, PAL_MODE_INPUT_ANALOG);
/*
* Initializes the PWM driver 1, re-routes the TIM3 outputs, programs the
@@ -216,6 +216,7 @@ int main(void) {
pwmStart(&PWMD3, &pwmcfg);
AFIO->MAPR |= AFIO_MAPR_TIM3_REMAP_0 | AFIO_MAPR_TIM3_REMAP_1;
palSetGroupMode(GPIOC, PAL_PORT_BIT(GPIOC_LED3) | PAL_PORT_BIT(GPIOC_LED4),
+ 0,
PAL_MODE_STM32_ALTERNATE_PUSHPULL);
/*
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.
diff --git a/readme.txt b/readme.txt
index e942168c1..c5ff58d69 100644
--- a/readme.txt
+++ b/readme.txt
@@ -91,6 +91,8 @@
- NEW: Improved I2C driver model and STM32 implementation by Barthess.
- CHANGE: Removed the option to change the stack alignment in the GCC
Cortex-Mx ports, now alignment is always 64 bits.
+- CHANGE: Modified the function palSetGroupMode() to have an offset parameter
+ in order to make it similar to other functions operating on groups.
- CHANGE: Increased main and process default stack sizes from 0x100 to 0x200
in LPC1114 and LPC1343 linker scripts.
diff --git a/testhal/STM32F1xx/ADC/main.c b/testhal/STM32F1xx/ADC/main.c
index bfe8997f9..700801864 100644
--- a/testhal/STM32F1xx/ADC/main.c
+++ b/testhal/STM32F1xx/ADC/main.c
@@ -126,7 +126,7 @@ int main(void) {
* Setting up analog inputs used by the demo.
*/
palSetGroupMode(GPIOC, PAL_PORT_BIT(0) | PAL_PORT_BIT(1),
- PAL_MODE_INPUT_ANALOG);
+ 0, PAL_MODE_INPUT_ANALOG);
/*
* Creates the blinker thread.
diff --git a/testhal/STM32F4xx/ADC/main.c b/testhal/STM32F4xx/ADC/main.c
index 221792a57..59c7b264d 100644
--- a/testhal/STM32F4xx/ADC/main.c
+++ b/testhal/STM32F4xx/ADC/main.c
@@ -127,7 +127,7 @@ int main(void) {
* Setting up analog inputs used by the demo.
*/
palSetGroupMode(GPIOC, PAL_PORT_BIT(1) | PAL_PORT_BIT(2),
- PAL_MODE_INPUT_ANALOG);
+ 0, PAL_MODE_INPUT_ANALOG);
/*
* Creates the blinker thread.
diff --git a/testhal/STM32L1xx/ADC/main.c b/testhal/STM32L1xx/ADC/main.c
index 2af3703e8..e84e4843e 100644
--- a/testhal/STM32L1xx/ADC/main.c
+++ b/testhal/STM32L1xx/ADC/main.c
@@ -130,7 +130,7 @@ int main(void) {
* Setting up analog inputs used by the demo.
*/
palSetGroupMode(GPIOC, PAL_PORT_BIT(0) | PAL_PORT_BIT(1),
- PAL_MODE_INPUT_ANALOG);
+ 0, PAL_MODE_INPUT_ANALOG);
/*
* Creates the blinker thread.