aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM8S
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-18 13:09:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-18 13:09:41 +0000
commit5008068ce440a8220d2486a0f69e05d72e857565 (patch)
tree0ee7fd6bde0ed26b95b0e189f72a4e49ca4bb1a4 /os/hal/platforms/STM8S
parenta623601c72c782f7b1771619d5956c0f90739cc0 (diff)
downloadChibiOS-5008068ce440a8220d2486a0f69e05d72e857565.tar.gz
ChibiOS-5008068ce440a8220d2486a0f69e05d72e857565.tar.bz2
ChibiOS-5008068ce440a8220d2486a0f69e05d72e857565.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2386 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM8S')
-rw-r--r--os/hal/platforms/STM8S/hal_lld.c24
-rw-r--r--os/hal/platforms/STM8S/hal_lld.h97
-rw-r--r--os/hal/platforms/STM8S/pal_lld.c4
-rw-r--r--os/hal/platforms/STM8S/pal_lld.h8
-rw-r--r--os/hal/platforms/STM8S/platform.dox57
-rw-r--r--os/hal/platforms/STM8S/serial_lld.c54
-rw-r--r--os/hal/platforms/STM8S/serial_lld.h28
-rw-r--r--os/hal/platforms/STM8S/spi_lld.c14
-rw-r--r--os/hal/platforms/STM8S/spi_lld.h12
9 files changed, 154 insertions, 144 deletions
diff --git a/os/hal/platforms/STM8S/hal_lld.c b/os/hal/platforms/STM8S/hal_lld.c
index 87010481c..de32cfb44 100644
--- a/os/hal/platforms/STM8S/hal_lld.c
+++ b/os/hal/platforms/STM8S/hal_lld.c
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/hal_lld.c
- * @brief STM8 HAL subsystem low level driver source.
+ * @file STM8S/hal_lld.c
+ * @brief STM8S HAL subsystem low level driver source.
*
* @addtogroup HAL
* @{
@@ -52,40 +52,40 @@
* @brief Low level HAL driver initialization.
* @details Clock sources initialization, HSI is assumed to be already
* started after reset.
- * @note If the @p STM8_CLOCK_INIT option is set to @p FALSE then the
+ * @note If the @p STM8S_CLOCK_INIT option is set to @p FALSE then the
* initialization is not performed and is left to the application.
*
* @notapi
*/
void hal_lld_init(void) {
-#if !STM8_NO_CLOCK_INIT
+#if !STM8S_NO_CLOCK_INIT
/* Makes sure that HSI is stable before proceeding.*/
CLK->ICKR |= CLK_ICKR_HSIRDY;
while ((CLK->ICKR & CLK_ICKR_HSIRDY) == 0)
;
/* LSI startup and stabilization if required.*/
-#if STM8_LSI_ENABLED
+#if STM8S_LSI_ENABLED
CLK->ICKR |= CLK_ICKR_LSIEN;
while ((CLK->ICKR & CLK_ICKR_LSIRDY) == 0)
;
#endif
/* HSE startup and stabilization if required.*/
-#if STM8_HSE_ENABLED
+#if STM8S_HSE_ENABLED
CLK->ECKR |= CLK_ECKR_HSEEN;
while ((CLK->ECKR & CLK_ECKR_HSERDY) == 0)
;
#endif
/* Setting up clock dividers.*/
- CLK->CKDIVR = (STM8_HSI_DIVIDER << 3) | (STM8_CPU_DIVIDER << 0);
+ CLK->CKDIVR = (STM8S_HSI_DIVIDER << 3) | (STM8S_CPU_DIVIDER << 0);
/* SYSCLK switch to the selected source, not necessary if it is HSI.*/
-#if STM8_SYSCLK_SOURCE != CLK_SYSSEL_HSI
+#if STM8S_SYSCLK_SOURCE != CLK_SYSSEL_HSI
/* Switching clock (manual switch mode).*/
- CLK->SWR = STM8_SYSCLK_SOURCE;
+ CLK->SWR = STM8S_SYSCLK_SOURCE;
while ((CLK->SWCR & CLK_SWCR_SWIF) == 0)
;
CLK->SWCR = CLK_SWCR_SWEN;
@@ -98,13 +98,13 @@ void hal_lld_init(void) {
/* Other clock related initializations.*/
CLK->CSSR = 0;
CLK->CCOR = 0;
- CLK->CANCCR = STM8_CAN_DIVIDER_VALUE;
+ CLK->CANCCR = STM8S_CAN_DIVIDER_VALUE;
/* HSI disabled if it is no more required.*/
-#if !STM8_HSI_ENABLED
+#if !STM8S_HSI_ENABLED
CLK->ICKR &= ~CLK_ICKR_HSIEN;
#endif
-#endif /* !STM8_NO_CLOCK_INIT */
+#endif /* !STM8S_NO_CLOCK_INIT */
}
/** @} */
diff --git a/os/hal/platforms/STM8S/hal_lld.h b/os/hal/platforms/STM8S/hal_lld.h
index 6e2c585d2..1db8a742c 100644
--- a/os/hal/platforms/STM8S/hal_lld.h
+++ b/os/hal/platforms/STM8S/hal_lld.h
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/hal_lld.h
- * @brief STM8 HAL subsystem low level driver source.
+ * @file STM8S/hal_lld.h
+ * @brief STM8S HAL subsystem low level driver source.
* @pre This module requires the following macros to be defined in the
* @p board.h file:
* - HSECLK (@p 0 if disabled or frequency in Hertz).
@@ -39,7 +39,18 @@
#ifndef _HAL_LLD_H_
#define _HAL_LLD_H_
-#include "stm8.h"
+#undef FALSE
+#undef TRUE
+
+#if defined(STM8S208) || defined(STM8S207) || defined(STM8S105) || \
+ defined(STM8S103) || defined(STM8S903)
+#include "stm8s.h"
+#else
+#error "unsupported or invalid STM8 platform"
+#endif
+
+#define FALSE 0
+#define TRUE (!FALSE)
/*===========================================================================*/
/* Driver constants. */
@@ -78,111 +89,111 @@
/**
* @brief Disables the clock initialization in the HAL.
*/
-#if !defined(STM8_NO_CLOCK_INIT) || defined(__DOXYGEN__)
-#define STM8_NO_CLOCK_INIT FALSE
+#if !defined(STM8S_NO_CLOCK_INIT) || defined(__DOXYGEN__)
+#define STM8S_NO_CLOCK_INIT FALSE
#endif
/**
* @brief Enables or disables the HSI clock source.
*/
-#if !defined(STM8_HSI_ENABLED) || defined(__DOXYGEN__)
-#define STM8_HSI_ENABLED FALSE
+#if !defined(STM8S_HSI_ENABLED) || defined(__DOXYGEN__)
+#define STM8S_HSI_ENABLED FALSE
#endif
/**
* @brief Enables or disables the LSI clock source.
*/
-#if !defined(STM8_LSI_ENABLED) || defined(__DOXYGEN__)
-#define STM8_LSI_ENABLED TRUE
+#if !defined(STM8S_LSI_ENABLED) || defined(__DOXYGEN__)
+#define STM8S_LSI_ENABLED TRUE
#endif
/**
* @brief Enables or disables the HSE clock source.
*/
-#if !defined(STM8_HSE_ENABLED) || defined(__DOXYGEN__)
-#define STM8_HSE_ENABLED TRUE
+#if !defined(STM8S_HSE_ENABLED) || defined(__DOXYGEN__)
+#define STM8S_HSE_ENABLED TRUE
#endif
/**
* @brief Clock source setting.
*/
-#if !defined(STM8_SYSCLK_SOURCE) || defined(__DOXYGEN__)
-#define STM8_SYSCLK_SOURCE CLK_SYSSEL_HSE
+#if !defined(STM8S_SYSCLK_SOURCE) || defined(__DOXYGEN__)
+#define STM8S_SYSCLK_SOURCE CLK_SYSSEL_HSE
#endif
/**
* @brief HSI clock divider.
*/
-#if !defined(STM8_HSI_DIVIDER) || defined(__DOXYGEN__)
-#define STM8_HSI_DIVIDER CLK_HSI_DIV8
+#if !defined(STM8S_HSI_DIVIDER) || defined(__DOXYGEN__)
+#define STM8S_HSI_DIVIDER CLK_HSI_DIV8
#endif
/**
* @brief CPU clock divider.
*/
-#if !defined(STM8_CPU_DIVIDER) || defined(__DOXYGEN__)
-#define STM8_CPU_DIVIDER CLK_CPU_DIV1
+#if !defined(STM8S_CPU_DIVIDER) || defined(__DOXYGEN__)
+#define STM8S_CPU_DIVIDER CLK_CPU_DIV1
#endif
/**
* @brief bxCAN divider value.
*/
-#if !defined(STM8_CAN_DIVIDER_VALUE) || defined(__DOXYGEN__)
-#define STM8_CAN_DIVIDER_VALUE 1
+#if !defined(STM8S_CAN_DIVIDER_VALUE) || defined(__DOXYGEN__)
+#define STM8S_CAN_DIVIDER_VALUE 1
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-#if (STM8_HSI_DIVIDER != CLK_HSI_DIV1) && \
- (STM8_HSI_DIVIDER != CLK_HSI_DIV2) && \
- (STM8_HSI_DIVIDER != CLK_HSI_DIV4) && \
- (STM8_HSI_DIVIDER != CLK_HSI_DIV8)
+#if (STM8S_HSI_DIVIDER != CLK_HSI_DIV1) && \
+ (STM8S_HSI_DIVIDER != CLK_HSI_DIV2) && \
+ (STM8S_HSI_DIVIDER != CLK_HSI_DIV4) && \
+ (STM8S_HSI_DIVIDER != CLK_HSI_DIV8)
#error "specified invalid HSI divider"
#endif
-#if (STM8_CPU_DIVIDER != CLK_CPU_DIV1) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV2) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV4) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV8) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV16) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV32) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV64) && \
- (STM8_CPU_DIVIDER != CLK_CPU_DIV128)
+#if (STM8S_CPU_DIVIDER != CLK_CPU_DIV1) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV2) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV4) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV8) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV16) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV32) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV64) && \
+ (STM8S_CPU_DIVIDER != CLK_CPU_DIV128)
#error "specified invalid CPU divider"
#endif
-#if (STM8_CAN_DIVIDER_VALUE < 1) || (STM8_CAN_DIVIDER_VALUE > 8)
+#if (STM8S_CAN_DIVIDER_VALUE < 1) || (STM8S_CAN_DIVIDER_VALUE > 8)
#error "specified invalid CAN divider value"
#endif
-#if STM8_HSE_ENABLED && (HSECLK == 0)
+#if STM8S_HSE_ENABLED && (HSECLK == 0)
#error "impossible to activate HSE"
#endif
-#if !STM8_HSI_ENABLED && (STM8_SYSCLK_SOURCE == CLK_SYSSEL_HSI)
+#if !STM8S_HSI_ENABLED && (STM8S_SYSCLK_SOURCE == CLK_SYSSEL_HSI)
#error "requested HSI clock is not enabled"
#endif
-#if !STM8_LSI_ENABLED && (STM8_SYSCLK_SOURCE == CLK_SYSSEL_LSI)
+#if !STM8S_LSI_ENABLED && (STM8S_SYSCLK_SOURCE == CLK_SYSSEL_LSI)
#error "requested LSI clock is not enabled"
#endif
-#if !STM8_HSE_ENABLED && (STM8_SYSCLK_SOURCE == CLK_SYSSEL_HSE)
+#if !STM8S_HSE_ENABLED && (STM8S_SYSCLK_SOURCE == CLK_SYSSEL_HSE)
#error "requested HSE clock is not enabled"
#endif
/**
* @brief System clock.
*/
-#if STM8L_NO_CLOCK_INIT || defined(__DOXYGEN__)
+#if STM8SL_NO_CLOCK_INIT || defined(__DOXYGEN__)
#define SYSCLK (HSICLK / 8)
-#elif STM8_SYSCLK_SOURCE == CLK_SYSSEL_HSI
-#define SYSCLK (HSICLK / (1 << STM8_HSI_DIVIDER))
-#elif STM8_SYSCLK_SOURCE == CLK_SYSSEL_LSI
+#elif STM8S_SYSCLK_SOURCE == CLK_SYSSEL_HSI
+#define SYSCLK (HSICLK / (1 << STM8S_HSI_DIVIDER))
+#elif STM8S_SYSCLK_SOURCE == CLK_SYSSEL_LSI
#define SYSCLK LSICLK
-#elif STM8_SYSCLK_SOURCE == CLK_SYSSEL_HSE
+#elif STM8S_SYSCLK_SOURCE == CLK_SYSSEL_HSE
#define SYSCLK HSECLK
#else
#error "specified invalid clock source"
@@ -190,10 +201,10 @@
/**
* @brief CPU clock.
- * @details On the STM8S the CPU clock can be programmed to be a fraction of
+ * @details On the STM8SS the CPU clock can be programmed to be a fraction of
* the system clock.
*/
-#define CPUCLK (SYSCLK / (1 << STM8_CPU_DIVIDER))
+#define CPUCLK (SYSCLK / (1 << STM8S_CPU_DIVIDER))
/*===========================================================================*/
/* Driver data structures and types. */
diff --git a/os/hal/platforms/STM8S/pal_lld.c b/os/hal/platforms/STM8S/pal_lld.c
index 3296022e7..feb9c33cf 100644
--- a/os/hal/platforms/STM8S/pal_lld.c
+++ b/os/hal/platforms/STM8S/pal_lld.c
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/pal_lld.c
- * @brief STM8 GPIO low level driver code.
+ * @file STM8S/pal_lld.c
+ * @brief STM8S GPIO low level driver code.
*
* @addtogroup PAL
* @{
diff --git a/os/hal/platforms/STM8S/pal_lld.h b/os/hal/platforms/STM8S/pal_lld.h
index c8e572d42..65f4584de 100644
--- a/os/hal/platforms/STM8S/pal_lld.h
+++ b/os/hal/platforms/STM8S/pal_lld.h
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/pal_lld.h
- * @brief STM8 GPIO low level driver header.
+ * @file STM8S/pal_lld.h
+ * @brief STM8S GPIO low level driver header.
*
* @addtogroup PAL
* @{
@@ -37,12 +37,12 @@
#undef PAL_MODE_INPUT_PULLDOWN
/**
- * @brief STM8 specific alternate push-pull slow output mode.
+ * @brief STM8S specific alternate push-pull slow output mode.
*/
#define PAL_MODE_OUTPUT_PUSHPULL_SLOW 16
/**
- * @brief STM8 specific alternate open-drain slow output mode.
+ * @brief STM8S specific alternate open-drain slow output mode.
*/
#define PAL_MODE_OUTPUT_OPENDRAIN_SLOW 17
diff --git a/os/hal/platforms/STM8S/platform.dox b/os/hal/platforms/STM8S/platform.dox
index c71063910..2bf6f73a3 100644
--- a/os/hal/platforms/STM8S/platform.dox
+++ b/os/hal/platforms/STM8S/platform.dox
@@ -18,33 +18,32 @@
*/
/**
- * @defgroup STM8 STM8x Drivers
- * @details This section describes all the supported drivers on the STM8S and
- * STM8A platforms and the implementation details of the single
- * drivers.
+ * @defgroup STM8S STM8Sx Drivers
+ * @details This section describes all the supported drivers on the STM8S
+ * platform and the implementation details of the single drivers.
*
* @ingroup platforms
*/
/**
- * @defgroup STM8_HAL STM8 Initialization Support
- * @details The STM8 HAL support is responsible for system initialization.
+ * @defgroup STM8S_HAL STM8S Initialization Support
+ * @details The STM8S HAL support is responsible for system initialization.
*
- * @section stm8_hal_1 Supported HW resources
+ * @section stm8s_hal_1 Supported HW resources
* - CLK.
* .
- * @section stm8_hal_2 STM8 HAL driver implementation features
+ * @section stm8s_hal_2 STM8S HAL driver implementation features
* - Clock tree initialization.
* - Clock source selection.
* .
- * @ingroup STM8
+ * @ingroup STM8S
*/
/**
- * @defgroup STM8_PAL STM8 GPIO Support
- * @details The STM8 PAL driver uses the GPIO peripherals.
+ * @defgroup STM8S_PAL STM8S GPIO Support
+ * @details The STM8S PAL driver uses the GPIO peripherals.
*
- * @section stm8_pal_1 Supported HW resources
+ * @section stm8s_pal_1 Supported HW resources
* - AFIO.
* - GPIOA.
* - GPIOB.
@@ -56,16 +55,16 @@
* - GPIOH (where present).
* - GPIOI (where present).
* .
- * @section stm8_pal_2 STM8 PAL driver implementation features
+ * @section stm8s_pal_2 STM8S PAL driver implementation features
* The PAL driver implementation fully supports the following hardware
* capabilities:
* - 8 bits wide ports.
- * - Atomic set/reset/toggle functions because special STM8 instruction set.
+ * - Atomic set/reset/toggle functions because special STM8S instruction set.
* - Output latched regardless of the pad setting.
* - Direct read of input pads regardless of the pad setting.
* .
- * @section stm8_pal_3 Supported PAL setup modes
- * The STM8 PAL driver supports the following I/O modes:
+ * @section stm8s_pal_3 Supported PAL setup modes
+ * The STM8S PAL driver supports the following I/O modes:
* - @p PAL_MODE_RESET.
* - @p PAL_MODE_UNCONNECTED.
* - @p PAL_MODE_INPUT.
@@ -75,50 +74,50 @@
* .
* Any attempt to setup an invalid mode is ignored.
*
- * @section stm8_pal_4 Suboptimal behavior
- * The STM8 GPIO is less than optimal in several areas, the limitations
+ * @section stm8s_pal_4 Suboptimal behavior
+ * The STM8S GPIO is less than optimal in several areas, the limitations
* should be taken in account while using the PAL driver:
* - Bus/group writing is not atomic.
* - Pad/group mode setup is not atomic.
* .
- * @ingroup STM8
+ * @ingroup STM8S
*/
/**
- * @defgroup STM8_SPI STM8 SPI Support
- * @details The SPI driver supports the STM8 SPI peripheral in an interrupt
+ * @defgroup STM8S_SPI STM8S SPI Support
+ * @details The SPI driver supports the STM8S SPI peripheral in an interrupt
* driven implementation.
* @note Being the SPI a fast peripheral, much care must be taken to
* not saturate the CPU bandwidth with an excessive IRQ rate. The
* maximum transfer bit rate is likely limited by the IRQ
* handling.
*
- * @section stm8_spi_1 Supported HW resources
+ * @section stm8s_spi_1 Supported HW resources
* - SPI.
* .
- * @section stm8_spi_2 STM8 SPI driver implementation features
+ * @section stm8s_spi_2 STM8S SPI driver implementation features
* - Clock stop for reduced power usage when the driver is in stop state.
* - Fully interrupt driven.
* .
- * @ingroup STM8
+ * @ingroup STM8S
*/
/**
- * @defgroup STM8_SERIAL STM8 UART Support (buffered)
- * @details The STM8 Serial driver uses the UART peripherals in a
+ * @defgroup STM8S_SERIAL STM8S UART Support (buffered)
+ * @details The STM8S Serial driver uses the UART peripherals in a
* buffered, interrupt driven, implementation.
*
- * @section stm8_serial_1 Supported HW resources
+ * @section stm8s_serial_1 Supported HW resources
* The serial driver can support any of the following hardware resources:
* - UART1.
* - UART2 (where present).
* - UART3 (where present).
* .
- * @section stm8_serial_2 STM8 Serial driver implementation features
+ * @section stm8s_serial_2 STM8S Serial driver implementation features
* - Clock stop for reduced power usage when the driver is in stop state.
* - Each UART can be independently enabled and programmed. Unused
* peripherals are left in low power mode.
* - Fully interrupt driven.
* .
- * @ingroup STM8
+ * @ingroup STM8S
*/
diff --git a/os/hal/platforms/STM8S/serial_lld.c b/os/hal/platforms/STM8S/serial_lld.c
index 06f2f482b..d7ccfc70a 100644
--- a/os/hal/platforms/STM8S/serial_lld.c
+++ b/os/hal/platforms/STM8S/serial_lld.c
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/serial_lld.c
- * @brief STM8 low level serial driver code.
+ * @file STM8S/serial_lld.c
+ * @brief STM8S low level serial driver code.
*
* @addtogroup SERIAL
* @{
@@ -37,21 +37,21 @@
/**
* @brief UART1 serial driver identifier.
*/
-#if STM8_SERIAL_USE_UART1 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART1 || defined(__DOXYGEN__)
SerialDriver SD1;
#endif
/**
* @brief UART2 serial driver identifier.
*/
-#if STM8_SERIAL_USE_UART2 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART2 || defined(__DOXYGEN__)
SerialDriver SD2;
#endif
/**
* @brief UART3 serial driver identifier.
*/
-#if STM8_SERIAL_USE_UART3 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART3 || defined(__DOXYGEN__)
SerialDriver SD3;
#endif
@@ -63,7 +63,7 @@ SerialDriver SD3;
* @brief Driver default configuration.
*/
static ROMCONST SerialConfig default_config = {
- BBR(SERIAL_DEFAULT_BITRATE),
+ BRR(SERIAL_DEFAULT_BITRATE),
SD_MODE_PARITY_NONE | SD_MODE_STOP_1
};
@@ -89,7 +89,7 @@ static void set_error(SerialDriver *sdp, uint8_t sr) {
chSysUnlockFromIsr();
}
-#if STM8_SERIAL_USE_UART1 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART1 || defined(__DOXYGEN__)
static void notify1(void) {
UART1->CR2 |= UART1_CR2_TIEN;
@@ -128,9 +128,9 @@ static void uart1_deinit(void) {
UART1->CR5 = 0;
UART1->PSCR = 0;
}
-#endif /* STM8_SERIAL_USE_UART1 */
+#endif /* STM8S_SERIAL_USE_UART1 */
-#if STM8_SERIAL_USE_UART2 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART2 || defined(__DOXYGEN__)
static void notify2(void) {
UART2->CR2 |= UART2_CR2_TIEN;
@@ -171,9 +171,9 @@ static void uart2_deinit(void) {
UART2->CR6 = 0;
UART2->PSCR = 0;
}
-#endif /* STM8_SERIAL_USE_UART1 */
+#endif /* STM8S_SERIAL_USE_UART1 */
-#if STM8_SERIAL_USE_UART3 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART3 || defined(__DOXYGEN__)
static void notify3(void) {
UART3->CR2 |= UART3_CR2_TIEN;
@@ -210,13 +210,13 @@ static void uart3_deinit(void) {
UART3->CR4 = 0;
UART3->CR6 = 0;
}
-#endif /* STM8_SERIAL_USE_UART3 */
+#endif /* STM8S_SERIAL_USE_UART3 */
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
-#if STM8_SERIAL_USE_UART1 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART1 || defined(__DOXYGEN__)
/**
* @brief IRQ 17 service routine.
*
@@ -257,9 +257,9 @@ CH_IRQ_HANDLER(18) {
CH_IRQ_EPILOGUE();
}
-#endif /* STM8_SERIAL_USE_UART1 */
+#endif /* STM8S_SERIAL_USE_UART1 */
-#if STM8_SERIAL_USE_UART2 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART2 || defined(__DOXYGEN__)
/**
* @brief IRQ 20 service routine.
*
@@ -300,9 +300,9 @@ CH_IRQ_HANDLER(21) {
CH_IRQ_EPILOGUE();
}
-#endif /* STM8_SERIAL_USE_UART2 */
+#endif /* STM8S_SERIAL_USE_UART2 */
-#if STM8_SERIAL_USE_UART3 || defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART3 || defined(__DOXYGEN__)
/**
* @brief IRQ 20 service routine.
*
@@ -343,7 +343,7 @@ CH_IRQ_HANDLER(21) {
CH_IRQ_EPILOGUE();
}
-#endif /* STM8_SERIAL_USE_UART3 */
+#endif /* STM8S_SERIAL_USE_UART3 */
/*===========================================================================*/
/* Driver exported functions. */
@@ -356,19 +356,19 @@ CH_IRQ_HANDLER(21) {
*/
void sd_lld_init(void) {
-#if STM8_SERIAL_USE_UART1
+#if STM8S_SERIAL_USE_UART1
sdObjectInit(&SD1, NULL, notify1);
CLK->PCKENR1 |= CLK_PCKENR1_UART1; /* PCKEN12, clock source. */
UART1->CR1 = UART1_CR1_UARTD; /* UARTD (low power). */
#endif
-#if STM8_SERIAL_USE_UART2
+#if STM8S_SERIAL_USE_UART2
sdObjectInit(&SD2, NULL, notify2);
CLK->PCKENR1 |= CLK_PCKENR1_UART2; /* PCKEN13, clock source. */
UART2->CR1 = UART2_CR1_UARTD; /* UARTD (low power). */
#endif
-#if STM8_SERIAL_USE_UART3
+#if STM8S_SERIAL_USE_UART3
sdObjectInit(&SD3, NULL, notify3);
CLK->PCKENR1 |= CLK_PCKENR1_UART3; /* PCKEN13, clock source. */
UART3->CR1 = UART3_CR1_UARTD; /* UARTD (low power). */
@@ -390,19 +390,19 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
if (config == NULL)
config = &default_config;
-#if STM8_SERIAL_USE_UART1
+#if STM8S_SERIAL_USE_UART1
if (&SD1 == sdp) {
uart1_init(config);
return;
}
#endif
-#if STM8_SERIAL_USE_UART2
+#if STM8S_SERIAL_USE_UART2
if (&SD2 == sdp) {
uart2_init(config);
return;
}
#endif
-#if STM8_SERIAL_USE_UART3
+#if STM8S_SERIAL_USE_UART3
if (&SD3 == sdp) {
uart3_init(config);
return;
@@ -421,19 +421,19 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
*/
void sd_lld_stop(SerialDriver *sdp) {
-#if STM8_SERIAL_USE_UART1
+#if STM8S_SERIAL_USE_UART1
if (&SD1 == sdp) {
uart1_deinit();
return;
}
#endif
-#if STM8_SERIAL_USE_UART2
+#if STM8S_SERIAL_USE_UART2
if (&SD2 == sdp) {
uart2_deinit();
return;
}
#endif
-#if STM8_SERIAL_USE_UART3
+#if STM8S_SERIAL_USE_UART3
if (&SD3 == sdp) {
uart3_deinit();
return;
diff --git a/os/hal/platforms/STM8S/serial_lld.h b/os/hal/platforms/STM8S/serial_lld.h
index fe6b9bcaa..29b44bfbc 100644
--- a/os/hal/platforms/STM8S/serial_lld.h
+++ b/os/hal/platforms/STM8S/serial_lld.h
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/serial_lld.h
- * @brief STM8 low level serial driver header.
+ * @file STM8S/serial_lld.h
+ * @brief STM8S low level serial driver header.
*
* @addtogroup SERIAL
* @{
@@ -53,8 +53,8 @@
* @details If set to @p TRUE the support for UART1 is included.
* @note The default is @p TRUE.
*/
-#if !defined(STM8_SERIAL_USE_UART1) || defined(__DOXYGEN__)
-#define STM8_SERIAL_USE_UART1 TRUE
+#if !defined(STM8S_SERIAL_USE_UART1) || defined(__DOXYGEN__)
+#define STM8S_SERIAL_USE_UART1 TRUE
#endif
/**
@@ -62,8 +62,8 @@
* @details If set to @p TRUE the support for UART3 is included.
* @note The default is @p TRUE.
*/
-#if !defined(STM8_SERIAL_USE_UART2) || defined(__DOXYGEN__)
-#define STM8_SERIAL_USE_UART2 TRUE
+#if !defined(STM8S_SERIAL_USE_UART2) || defined(__DOXYGEN__)
+#define STM8S_SERIAL_USE_UART2 TRUE
#endif
/**
@@ -71,16 +71,16 @@
* @details If set to @p TRUE the support for UART3 is included.
* @note The default is @p TRUE.
*/
-#if !defined(STM8_SERIAL_USE_UART3) || defined(__DOXYGEN__)
-#define STM8_SERIAL_USE_UART3 TRUE
+#if !defined(STM8S_SERIAL_USE_UART3) || defined(__DOXYGEN__)
+#define STM8S_SERIAL_USE_UART3 TRUE
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-#if STM8_SERIAL_USE_UART2 && STM8_SERIAL_USE_UART3
-#error "STM8 UART2 and UART3 cannot be used together"
+#if STM8S_SERIAL_USE_UART2 && STM8S_SERIAL_USE_UART3
+#error "STM8S UART2 and UART3 cannot be used together"
#endif
/*===========================================================================*/
@@ -140,19 +140,19 @@ typedef struct {
* @brief Macro for baud rate computation.
* @note Make sure the final baud rate is within tolerance.
*/
-#define BBR(b) (SYSCLK / (b))
+#define BRR(b) (SYSCLK / (b))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
-#if STM8_SERIAL_USE_UART1 && !defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART1 && !defined(__DOXYGEN__)
extern SerialDriver SD1;
#endif
-#if STM8_SERIAL_USE_UART2 && !defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART2 && !defined(__DOXYGEN__)
extern SerialDriver SD2;
#endif
-#if STM8_SERIAL_USE_UART3 && !defined(__DOXYGEN__)
+#if STM8S_SERIAL_USE_UART3 && !defined(__DOXYGEN__)
extern SerialDriver SD3;
#endif
diff --git a/os/hal/platforms/STM8S/spi_lld.c b/os/hal/platforms/STM8S/spi_lld.c
index 4accd6cd0..c950f0bd4 100644
--- a/os/hal/platforms/STM8S/spi_lld.c
+++ b/os/hal/platforms/STM8S/spi_lld.c
@@ -18,8 +18,8 @@
*/
/**
- * @file STM8/spi_lld.c
- * @brief STM8 low level SPI driver code.
+ * @file STM8S/spi_lld.c
+ * @brief STM8S low level SPI driver code.
*
* @addtogroup SPI
* @{
@@ -34,7 +34,7 @@
/* Driver exported variables. */
/*===========================================================================*/
-#if STM8_SPI_USE_SPI || defined(__DOXYGEN__)
+#if STM8S_SPI_USE_SPI || defined(__DOXYGEN__)
/** @brief SPI1 driver identifier.*/
SPIDriver SPID1;
#endif
@@ -51,7 +51,7 @@ SPIDriver SPID1;
/* Driver interrupt handlers. */
/*===========================================================================*/
-#if STM8_SPI_USE_SPI || defined(__DOXYGEN__)
+#if STM8S_SPI_USE_SPI || defined(__DOXYGEN__)
/**
* @brief IRQ 10 service routine.
*
@@ -64,7 +64,7 @@ CH_IRQ_HANDLER(10) {
if ((SPI->SR & SPI_SR_OVR) != 0) {
/* The overflow condition should never happen because priority is given
to receive but a hook macro is provided anyway...*/
- STM8_SPI_ERROR_HOOK(&SPID1);
+ STM8S_SPI_ERROR_HOOK(&SPID1);
}
/* Handling the DR register like it is a FIFO with depth>1 in order to
handle the case where a frame arrives immediately after reading the
@@ -111,9 +111,9 @@ exit_isr:
*/
void spi_lld_init(void) {
-#if STM8_SPI_USE_SPI
+#if STM8S_SPI_USE_SPI
spiObjectInit(&SPID1);
-#endif /* STM8_SPI_USE_SPI */
+#endif /* STM8S_SPI_USE_SPI */
}
/**
diff --git a/os/hal/platforms/STM8S/spi_lld.h b/os/hal/platforms/STM8S/spi_lld.h
index a1b56694e..e4a963d67 100644
--- a/os/hal/platforms/STM8S/spi_lld.h
+++ b/os/hal/platforms/STM8S/spi_lld.h
@@ -43,23 +43,23 @@
* @details If set to @p TRUE the support for device SSP0 is included.
* @note The default is @p TRUE.
*/
-#if !defined(STM8_SPI_USE_SPI) || defined(__DOXYGEN__)
-#define STM8_SPI_USE_SPI TRUE
+#if !defined(STM8S_SPI_USE_SPI) || defined(__DOXYGEN__)
+#define STM8S_SPI_USE_SPI TRUE
#endif
/**
* @brief Overflow error hook.
* @details The default action is to stop the system.
*/
-#if !defined(STM8_SPI_SPI_ERROR_HOOK) || defined(__DOXYGEN__)
-#define STM8_SPI_ERROR_HOOK(spip) chSysHalt()
+#if !defined(STM8S_SPI_SPI_ERROR_HOOK) || defined(__DOXYGEN__)
+#define STM8S_SPI_ERROR_HOOK(spip) chSysHalt()
#endif
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !STM8_SPI_USE_SPI
+#if !STM8S_SPI_USE_SPI
#error "SPI driver activated but no SPI peripheral assigned"
#endif
@@ -164,7 +164,7 @@ struct SPIDriver {
/* External declarations. */
/*===========================================================================*/
-#if STM8_SPI_USE_SPI && !defined(__DOXYGEN__)
+#if STM8S_SPI_USE_SPI && !defined(__DOXYGEN__)
extern SPIDriver SPID1;
#endif