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

This commit is contained in:
gdisirio 2010-05-14 09:45:53 +00:00
parent d6e56d6e7f
commit 7c31ee40a8
4 changed files with 79 additions and 5 deletions

View File

@ -252,9 +252,9 @@ typedef GPIO_TypeDef * ioportid_t;
* @param[in] bits the bits to be written. Values exceeding the group
* width are masked.
*/
#define pal_lld_writegroup(port, mask, offset, bits) { \
(port)->BSRR = ((~(bits) & (mask)) << (16 + (offset))) | \
(((bits) & (mask)) << (offset)); \
#define pal_lld_writegroup(port, mask, offset, bits) { \
(port)->BSRR = ((~(bits) & (mask)) << (16 + (offset))) | \
(((bits) & (mask)) << (offset)); \
}
/**
@ -271,7 +271,7 @@ typedef GPIO_TypeDef * ioportid_t;
* @param[in] mask the group mask
* @param[in] mode the mode
*/
#define pal_lld_setgroupmode(port, mask, mode) \
#define pal_lld_setgroupmode(port, mask, mode) \
_pal_lld_setgroupmode(port, mask, mode)
/**

View File

@ -50,6 +50,59 @@
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief Pads mode setup.
* @details This function programs a pads group belonging to the same port
* with the specified mode.
* @note This function is not meant to be invoked directly by the
* application code.
* @note @p PAL_MODE_UNCONNECTED is implemented as push pull output at 2MHz.
*
* @param[in] port the port identifier
* @param[in] mask the group mask
* @param[in] mode the mode
*/
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
uint_fast8_t mode) {
switch (mode & PAL_MODE_MASK) {
case PAL_MODE_RESET:
case PAL_MODE_INPUT_PULLUP:
port->DDR &= ~mask;
port->CR1 |= mask;
port->CR2 &= ~mask;
break;
case PAL_MODE_INPUT:
case PAL_MODE_INPUT_ANALOG:
port->DDR &= ~mask;
port->CR1 &= ~mask;
port->CR2 &= ~mask;
break;
case PAL_MODE_UNCONNECTED:
case PAL_MODE_OUTPUT_PUSHPULL_SLOW:
port->DDR |= mask;
port->CR1 |= mask;
port->CR2 &= ~mask;
break;
case PAL_MODE_OUTPUT_PUSHPULL:
port->DDR |= mask;
port->CR1 |= mask;
port->CR2 |= mask;
break;
case PAL_MODE_OUTPUT_OPENDRAIN_SLOW:
port->DDR |= mask;
port->CR1 &= ~mask;
port->CR2 &= ~mask;
break;
case PAL_MODE_OUTPUT_OPENDRAIN:
port->DDR |= mask;
port->CR1 &= ~mask;
port->CR2 |= mask;
break;
}
}
#endif /* CH_HAL_USE_PAL */
/** @} */

View File

@ -106,46 +106,55 @@ typedef gpio_t *ioportid_t;
* @brief GPIO port A identifier.
*/
#define IOPORT1 ((gpio_t *)0x5000)
#define GPIOA IOPORT1
/**
* @brief GPIO port B identifier.
*/
#define IOPORT2 ((gpio_t *)0x5005)
#define GPIOB IOPORT2
/**
* @brief GPIO port C identifier.
*/
#define IOPORT3 ((gpio_t *)0x500A)
#define GPIOC IOPORT3
/**
* @brief GPIO port D identifier.
*/
#define IOPORT4 ((gpio_t *)0x500F)
#define GPIOD IOPORT4
/**
* @brief GPIO port E identifier.
*/
#define IOPORT5 ((gpio_t *)0x5014)
#define GPIOE IOPORT5
/**
* @brief GPIO port F identifier.
*/
#define IOPORT6 ((gpio_t *)0x5019)
#define GPIOF IOPORT6
/**
* @brief GPIO port G identifier.
*/
#define IOPORT7 ((gpio_t *)0x501E)
#define GPIOG IOPORT7
/**
* @brief GPIO port H identifier.
*/
#define IOPORT8 ((gpio_t *)0x5023)
#define GPIOH IOPORT8
/**
* @brief GPIO port I identifier.
*/
#define IOPORT9 ((gpio_t *)0x5028)
#define GPIOI IOPORT9
/*===========================================================================*/
/* Implementation, some of the following macros could be implemented as */
@ -204,10 +213,21 @@ typedef gpio_t *ioportid_t;
* @param[in] mask group mask
* @param[in] mode group mode
*/
#define pal_lld_setgroupmode(port, mask, mode) ((void)(mode))
#define pal_lld_setgroupmode(port, mask, mode) \
_pal_lld_setgroupmode(port, mask, mode)
extern ROMCONST PALConfig pal_default_config;
#ifdef __cplusplus
extern "C" {
#endif
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
uint_fast8_t mode);
#ifdef __cplusplus
}
#endif
#endif /* CH_HAL_USE_PAL */
#endif /* _PAL_LLD_H_ */

View File

@ -69,6 +69,7 @@
the CL sub-family (untested). Now the selection of the sub-family is done
in the board.h file, there is no more the need to put -DSTM32F10X_xx into
the makefile.
- NEW: Added the palSetBusMode() capability to the STM8 PAL driver.
- Tested the STM8 port with the latest RKit-STM8_2.28.10.0092. It works but
the new compiler shows a general performance regression except in one
test case.