aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-14 09:45:53 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-14 09:45:53 +0000
commit7c31ee40a8643ce4df4bb3e86cb5aa995544abb1 (patch)
tree7713bc378fc488348747a14e831d069da0a8943c
parentd6e56d6e7fee513c7436816a7abaaf6a6c3fb007 (diff)
downloadChibiOS-7c31ee40a8643ce4df4bb3e86cb5aa995544abb1.tar.gz
ChibiOS-7c31ee40a8643ce4df4bb3e86cb5aa995544abb1.tar.bz2
ChibiOS-7c31ee40a8643ce4df4bb3e86cb5aa995544abb1.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1921 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/platforms/STM32/pal_lld.h8
-rw-r--r--os/hal/platforms/STM8/pal_lld.c53
-rw-r--r--os/hal/platforms/STM8/pal_lld.h22
-rw-r--r--readme.txt1
4 files changed, 79 insertions, 5 deletions
diff --git a/os/hal/platforms/STM32/pal_lld.h b/os/hal/platforms/STM32/pal_lld.h
index 3564d3cb9..fb276877d 100644
--- a/os/hal/platforms/STM32/pal_lld.h
+++ b/os/hal/platforms/STM32/pal_lld.h
@@ -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)
/**
diff --git a/os/hal/platforms/STM8/pal_lld.c b/os/hal/platforms/STM8/pal_lld.c
index b03e5a9d2..5ec3b2fcc 100644
--- a/os/hal/platforms/STM8/pal_lld.c
+++ b/os/hal/platforms/STM8/pal_lld.c
@@ -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 */
/** @} */
diff --git a/os/hal/platforms/STM8/pal_lld.h b/os/hal/platforms/STM8/pal_lld.h
index 0545986d9..41b2a2ace 100644
--- a/os/hal/platforms/STM8/pal_lld.h
+++ b/os/hal/platforms/STM8/pal_lld.h
@@ -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_ */
diff --git a/readme.txt b/readme.txt
index 5baab4cff..754e53dfd 100644
--- a/readme.txt
+++ b/readme.txt
@@ -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.