Fixed bug 3001528.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1920 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2010-05-14 09:23:32 +00:00
parent f0f02c897c
commit d6e56d6e7f
7 changed files with 156 additions and 145 deletions

View File

@ -84,7 +84,7 @@
<NodeC Path="..\..\os\ports\RC\STM8\chcore.c" Header="chcore.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\chcore.obj" sate="0" />
</Group>
<Group Header="hal" Marker="-1" OutputFile="" sate="0" >
<Group Header="hal" Marker="-1" OutputFile="" sate="96" >
<NodeC Path="..\..\os\hal\src\adc.c" Header="adc.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\adc.obj" sate="0" />
<NodeC Path="..\..\os\hal\src\can.c" Header="can.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\can.obj" sate="0" />
<NodeC Path="..\..\os\hal\src\hal.c" Header="hal.c" Marker="-1" OutputFile="..\STM8S-STM8S208-RC/bin\hal.obj" sate="0" />

View File

@ -388,7 +388,7 @@ typedef struct {
*
* @param[in] port port identifier
* @param[in] pad pad number within the port
* @param[out] bit logical value, the value must be @p PAL_LOW or
* @param[in] bit logical value, the value must be @p PAL_LOW or
* @p PAL_HIGH
*/
#if !defined(pal_lld_writepad) || defined(__DOXYGEN__)

View File

@ -20,6 +20,7 @@
/**
* @file STM32/pal_lld.c
* @brief STM32 GPIO low level driver code.
*
* @addtogroup STM32_PAL
* @{
*/
@ -125,17 +126,16 @@ void _pal_lld_init(const STM32GPIOConfig *config) {
* @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.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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
*
* @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.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
*/
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,

View File

@ -20,6 +20,7 @@
/**
* @file STM32/pal_lld.h
* @brief STM32 GPIO low level driver header.
*
* @addtogroup STM32_PAL
* @{
*/
@ -30,7 +31,7 @@
#if CH_HAL_USE_PAL || defined(__DOXYGEN__)
/*===========================================================================*/
/* I/O Ports Types and constants. */
/* Unsupported modes and specific modes */
/*===========================================================================*/
/**
@ -43,6 +44,10 @@
*/
#define PAL_MODE_STM32_ALTERNATE_OPENDRAIN 17
/*===========================================================================*/
/* I/O Ports Types and constants. */
/*===========================================================================*/
/**
* @brief GPIO port setup info.
*/
@ -166,12 +171,11 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Reads an I/O port.
* @details This function is implemented by reading the GPIO IDR register, the
* implementation has no side effects.
*
* @param[in] port the port identifier
* @return the port bits
*
* @note This function is not meant to be invoked directly by the application
* code.
*
* @param[in] port the port identifier
* @return The port bits.
*/
#define pal_lld_readport(port) ((port)->IDR)
@ -179,12 +183,11 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Reads the output latch.
* @details This function is implemented by reading the GPIO ODR register, the
* implementation has no side effects.
* @note This function is not meant to be invoked directly by the application
* code.
*
* @param[in] port the port identifier
* @return The latched logical states.
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
#define pal_lld_readlatch(port) ((port)->ODR)
@ -192,15 +195,14 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Writes on a I/O port.
* @details This function is implemented by writing the GPIO ODR register, the
* implementation has no side effects.
* @note This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
*/
#define pal_lld_writeport(port, bits) ((port)->ODR = (bits))
@ -208,15 +210,14 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Sets a bits mask on a I/O port.
* @details This function is implemented by writing the GPIO BSRR register, the
* implementation has no side effects.
* @note This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
*/
#define pal_lld_setport(port, bits) ((port)->BSRR = (bits))
@ -224,15 +225,14 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Clears a bits mask on a I/O port.
* @details This function is implemented by writing the GPIO BRR register, the
* implementation has no side effects.
* @note This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
*/
#define pal_lld_clearport(port, bits) ((port)->BRR = (bits))
@ -240,18 +240,17 @@ typedef GPIO_TypeDef * ioportid_t;
* @brief Writes a group of bits.
* @details This function is implemented by writing the GPIO BSRR register, the
* implementation has no side effects.
* @note This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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] offset the group bit offset within the port
* @param[in] bits the bits to be written. Values exceeding the group width
* are masked.
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
* @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))) | \
@ -262,32 +261,31 @@ 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 This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
*/
#define pal_lld_setgroupmode(port, mask, mode) \
_pal_lld_setgroupmode(port, mask, mode)
/**
* @brief Writes a logical state on an output pad.
* @note This function is not meant to be invoked directly by the
* application code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* 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[out] bit the logical value, the value must be @p 0 or @p 1
*
* @note This function is not meant to be invoked directly by the application
* code.
* @note Writing on pads programmed as pull-up or pull-down has the side
* effect to modify the resistor setting because the output latched data
* is used for the resistor selection.
* @param[in] bit logical value, the value must be @p PAL_LOW or
* @p PAL_HIGH
*/
#define pal_lld_writepad(port, pad, bit) pal_lld_writegroup(port, 1, pad, bit)

View File

@ -40,7 +40,7 @@
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
*/
ROMCONST STM8GPIOConfig pal_default_config =
ROMCONST PALConfig pal_default_config =
{
{
{VAL_GPIOAODR, 0, VAL_GPIOADDR, VAL_GPIOACR1, VAL_GPIOACR2},

View File

@ -34,6 +34,18 @@
/* Unsupported modes and specific modes */
/*===========================================================================*/
#undef PAL_MODE_INPUT_PULLDOWN
/**
* @brief STM8 specific alternate push-pull slow output mode.
*/
#define PAL_MODE_OUTPUT_PUSHPULL_SLOW 16
/**
* @brief STM8 specific alternate open-drain slow output mode.
*/
#define PAL_MODE_OUTPUT_OPENDRAIN_SLOW 17
/*===========================================================================*/
/* I/O Ports Types and constants. */
/*===========================================================================*/
@ -58,23 +70,23 @@ typedef struct {
*/
typedef struct {
gpio_t P[9];
} STM8GPIOConfig;
} PALConfig;
/**
* @brief Width, in bits, of an I/O port.
*/
#define PAL_IOPORTS_WIDTH 32
#define PAL_IOPORTS_WIDTH 8
/**
* @brief Whole port mask.
* @brief This macro specifies all the valid bits into a port.
*/
#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFF)
#define PAL_WHOLE_PORT ((ioportmask_t)0xFF)
/**
* @brief Digital I/O port sized unsigned type.
*/
typedef uint32_t ioportmask_t;
typedef uint8_t ioportmask_t;
/**
* @brief Port Identifier.
@ -88,7 +100,7 @@ typedef gpio_t *ioportid_t;
/**
* @brief GPIO ports as a whole.
*/
#define IOPORTS ((STM8GPIOConfig *)0x5000)
#define IOPORTS ((PALConfig *)0x5000)
/**
* @brief GPIO port A identifier.
@ -194,7 +206,7 @@ typedef gpio_t *ioportid_t;
*/
#define pal_lld_setgroupmode(port, mask, mode) ((void)(mode))
extern ROMCONST STM8GPIOConfig pal_default_config;
extern ROMCONST PALConfig pal_default_config;
#endif /* CH_HAL_USE_PAL */

View File

@ -59,6 +59,7 @@
*****************************************************************************
*** 1.5.7 ***
- FIX: Fixed wrong GPIO ports size in the STM8 PAL driver (bug 3001528).
- NEW: Improved clock initialization for the STM32, now it is possible to
configure the clock using any clock source and any HSE frequency.
- NEW: The STM32 clock tree parameters and checks are now calculated into