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
master
gdisirio 2011-12-31 10:07:43 +00:00
parent 72266f8b59
commit c397738010
22 changed files with 165 additions and 121 deletions

View File

@ -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);
/*

View File

@ -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);
/*

View File

@ -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);
/*

View File

@ -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

View File

@ -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
*

View File

@ -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
*/

View File

@ -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.

View File

@ -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.

View File

@ -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
*

View File

@ -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;

View File

@ -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;

View File

@ -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
*

View File

@ -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
*

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.