aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-04-21 14:11:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-04-21 14:11:12 +0000
commit75792b3d6af243e043e66b1b2f7199229d430ef8 (patch)
tree8c0740a9254d7b4b8d635c6734e3fbd30dc6d30e /os/hal/platforms
parent3621ac37b0cbab7737d215db0335017561856a10 (diff)
downloadChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.tar.gz
ChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.tar.bz2
ChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1882 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/AVR/serial_lld.c56
-rw-r--r--os/hal/platforms/AVR/serial_lld.h27
-rw-r--r--os/hal/platforms/LPC11xx/serial_lld.c22
-rw-r--r--os/hal/platforms/LPC11xx/serial_lld.h26
-rw-r--r--os/hal/platforms/LPC13xx/serial_lld.c22
-rw-r--r--os/hal/platforms/LPC13xx/serial_lld.h28
-rw-r--r--os/hal/platforms/MSP430/serial_lld.c32
-rw-r--r--os/hal/platforms/MSP430/serial_lld.h25
-rw-r--r--os/hal/platforms/Posix/serial_lld.c10
-rw-r--r--os/hal/platforms/Posix/serial_lld.h29
-rw-r--r--os/hal/platforms/SPC56x/serial_lld.h2
-rw-r--r--os/hal/platforms/STM8/hal_lld.c8
-rw-r--r--os/hal/platforms/STM8/hal_lld.h6
-rw-r--r--os/hal/platforms/STM8/pal_lld.h5
-rw-r--r--os/hal/platforms/STM8/serial_lld.c2
15 files changed, 157 insertions, 143 deletions
diff --git a/os/hal/platforms/AVR/serial_lld.c b/os/hal/platforms/AVR/serial_lld.c
index 48f688b64..8512fb873 100644
--- a/os/hal/platforms/AVR/serial_lld.c
+++ b/os/hal/platforms/AVR/serial_lld.c
@@ -18,8 +18,9 @@
*/
/**
- * @file AVR/serial_lld.c
- * @brief AVR low level serial driver code.
+ * @file AVR/serial_lld.c
+ * @brief AVR low level serial driver code.
+ *
* @addtogroup AVR_SERIAL
* @{
*/
@@ -34,18 +35,18 @@
/*===========================================================================*/
/**
- * @brief USART0 serial driver identifier.
- * @note The name does not follow the convention used in the other ports
- * (COMn) because a name conflict with the AVR headers.
+ * @brief USART0 serial driver identifier.
+ * @note The name does not follow the convention used in the other ports
+ * (COMn) because a name conflict with the AVR headers.
*/
#if USE_AVR_USART0 || defined(__DOXYGEN__)
SerialDriver SD1;
#endif
/**
- * @brief USART1 serial driver identifier.
- * @note The name does not follow the convention used in the other ports
- * (COMn) because a name conflict with the AVR headers.
+ * @brief USART1 serial driver identifier.
+ * @note The name does not follow the convention used in the other ports
+ * (COMn) because a name conflict with the AVR headers.
*/
#if USE_AVR_USART1 || defined(__DOXYGEN__)
SerialDriver SD2;
@@ -56,7 +57,7 @@ SerialDriver SD2;
/*===========================================================================*/
/**
- * @brief Driver default configuration.
+ * @brief Driver default configuration.
*/
static const SerialConfig default_config = {
UBRR(SERIAL_DEFAULT_BITRATE),
@@ -88,8 +89,9 @@ static void notify1(void) {
}
/**
- * @brief USART0 initialization.
- * @param[in] config the architecture-dependent serial driver configuration
+ * @brief USART0 initialization.
+ *
+ * @param[in] config the architecture-dependent serial driver configuration
*/
static void usart0_init(const SerialConfig *config) {
@@ -101,7 +103,7 @@ static void usart0_init(const SerialConfig *config) {
}
/**
- * @brief USART0 de-initialization.
+ * @brief USART0 de-initialization.
*/
static void usart0_deinit(void) {
@@ -118,8 +120,9 @@ static void notify2(void) {
}
/**
- * @brief USART1 initialization.
- * @param[in] config the architecture-dependent serial driver configuration
+ * @brief USART1 initialization.
+ *
+ * @param[in] config the architecture-dependent serial driver configuration
*/
static void usart1_init(const SerialConfig *config) {
@@ -131,7 +134,7 @@ static void usart1_init(const SerialConfig *config) {
}
/**
- * @brief USART1 de-initialization.
+ * @brief USART1 de-initialization.
*/
static void usart1_deinit(void) {
@@ -216,7 +219,7 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) {
/*===========================================================================*/
/**
- * Low level serial driver initialization.
+ * @brief Low level serial driver initialization.
*/
void sd_lld_init(void) {
@@ -229,35 +232,38 @@ void sd_lld_init(void) {
}
/**
- * @brief Low level serial driver configuration and (re)start.
+ * @brief Low level serial driver configuration and (re)start.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
-void sd_lld_start(SerialDriver *sdp) {
+void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
- if (sdp->config == NULL)
- sdp->config = &default_config;
+ if (config == NULL)
+ config = &default_config;
#if USE_AVR_USART0
if (&SD1 == sdp) {
- usart0_init(sdp->config);
+ usart0_init(config);
return;
}
#endif
#if USE_AVR_USART1
if (&SD2 == sdp) {
- usart1_init(sdp->config);
+ usart1_init(config);
return;
}
#endif
}
/**
- * @brief Low level serial driver stop.
+ * @brief Low level serial driver stop.
* @details De-initializes the USART, stops the associated clock, resets the
* interrupt vector.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
*/
void sd_lld_stop(SerialDriver *sdp) {
diff --git a/os/hal/platforms/AVR/serial_lld.h b/os/hal/platforms/AVR/serial_lld.h
index b89bd3ef3..604a46c99 100644
--- a/os/hal/platforms/AVR/serial_lld.h
+++ b/os/hal/platforms/AVR/serial_lld.h
@@ -18,8 +18,9 @@
*/
/**
- * @file AVR/serial_lld.h
- * @brief AVR low level serial driver header.
+ * @file AVR/serial_lld.h
+ * @brief AVR low level serial driver header.
+ *
* @addtogroup AVR_SERIAL
* @{
*/
@@ -38,18 +39,18 @@
/*===========================================================================*/
/**
- * @brief USART0 driver enable switch.
+ * @brief USART0 driver enable switch.
* @details If set to @p TRUE the support for USART0 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p FALSE.
*/
#if !defined(USE_AVR_USART0) || defined(__DOXYGEN__)
#define USE_AVR_USART0 TRUE
#endif
/**
- * @brief USART1 driver enable switch.
+ * @brief USART1 driver enable switch.
* @details If set to @p TRUE the support for USART1 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p TRUE.
*/
#if !defined(USE_AVR_USART1) || defined(__DOXYGEN__)
#define USE_AVR_USART1 TRUE
@@ -64,12 +65,12 @@
/*===========================================================================*/
/**
- * @brief Serial Driver condition flags type.
+ * @brief Serial Driver condition flags type.
*/
typedef uint8_t sdflags_t;
/**
- * @brief AVR Serial Driver configuration structure.
+ * @brief AVR Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
*/
@@ -85,14 +86,12 @@ typedef struct {
} SerialConfig;
/**
- * @brief @p SerialDriver specific data.
+ * @brief @p SerialDriver specific data.
*/
#define _serial_driver_data \
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -112,8 +111,8 @@ typedef struct {
/*===========================================================================*/
/**
- * @brief Macro for baud rate computation.
- * @note Make sure the final baud rate is within tolerance.
+ * @brief Macro for baud rate computation.
+ * @note Make sure the final baud rate is within tolerance.
*/
#define UBRR(b) ((F_CPU / (b << 4)) - 1)
@@ -132,7 +131,7 @@ extern SerialDriver SD2;
extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp);
+ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}
diff --git a/os/hal/platforms/LPC11xx/serial_lld.c b/os/hal/platforms/LPC11xx/serial_lld.c
index cc6146c3c..2cff76cd6 100644
--- a/os/hal/platforms/LPC11xx/serial_lld.c
+++ b/os/hal/platforms/LPC11xx/serial_lld.c
@@ -58,16 +58,17 @@ static const SerialConfig default_config = {
* @brief UART initialization.
*
* @param[in] sdp communication channel associated to the UART
+ * @param[in] config the architecture-dependent serial driver configuration
*/
-static void uart_init(SerialDriver *sdp) {
+static void uart_init(SerialDriver *sdp, const SerialConfig *config) {
LPC_UART_TypeDef *u = sdp->uart;
- uint32_t div = LPC11xx_UART_PCLK / (sdp->config->sc_speed << 4);
- u->LCR = sdp->config->sc_lcr | LCR_DLAB;
+ uint32_t div = LPC11xx_UART_PCLK / (config->sc_speed << 4);
+ u->LCR = config->sc_lcr | LCR_DLAB;
u->DLL = div;
u->DLM = div >> 8;
- u->LCR = sdp->config->sc_lcr;
- u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | sdp->config->sc_fcr;
+ u->LCR = config->sc_lcr;
+ u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | config->sc_fcr;
u->ACR = 0;
u->FDR = 0x10;
u->TER = TER_ENABLE;
@@ -242,11 +243,14 @@ void sd_lld_init(void) {
* @brief Low level serial driver configuration and (re)start.
*
* @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
-void sd_lld_start(SerialDriver *sdp) {
+void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
- if (sdp->config == NULL)
- sdp->config = &default_config;
+ if (config == NULL)
+ config = &default_config;
if (sdp->state == SD_STOP) {
#if USE_LPC11xx_UART0
@@ -257,7 +261,7 @@ void sd_lld_start(SerialDriver *sdp) {
}
#endif
}
- uart_init(sdp);
+ uart_init(sdp, config);
}
/**
diff --git a/os/hal/platforms/LPC11xx/serial_lld.h b/os/hal/platforms/LPC11xx/serial_lld.h
index e14cea679..bb91680cf 100644
--- a/os/hal/platforms/LPC11xx/serial_lld.h
+++ b/os/hal/platforms/LPC11xx/serial_lld.h
@@ -84,29 +84,29 @@
/*===========================================================================*/
/**
- * @brief UART0 driver enable switch.
+ * @brief UART0 driver enable switch.
* @details If set to @p TRUE the support for UART0 is included.
- * @note The default is @p TRUE .
+ * @note The default is @p TRUE .
*/
#if !defined(USE_LPC11xx_UART0) || defined(__DOXYGEN__)
#define USE_LPC11xx_UART0 TRUE
#endif
/**
- * @brief FIFO preload parameter.
+ * @brief FIFO preload parameter.
* @details Configuration parameter, this values defines how many bytes are
- * preloaded in the HW transmit FIFO for each interrupt, the maximum value is
- * 16 the minimum is 1.
- * @note An high value reduces the number of interrupts generated but can
- * also increase the worst case interrupt response time because the
- * preload loops.
+ * preloaded in the HW transmit FIFO for each interrupt, the maximum
+ * value is 16 the minimum is 1.
+ * @note An high value reduces the number of interrupts generated but can
+ * also increase the worst case interrupt response time because the
+ * preload loops.
*/
#if !defined(LPC11xx_UART_FIFO_PRELOAD) || defined(__DOXYGEN__)
#define LPC11xx_UART_FIFO_PRELOAD 16
#endif
/**
- * @brief UART0 interrupt priority level setting.
+ * @brief UART0 interrupt priority level setting.
*/
#if !defined(LPC11xx_UART0_PRIORITY) || defined(__DOXYGEN__)
#define LPC11xx_UART0_PRIORITY 3
@@ -117,7 +117,7 @@
/*===========================================================================*/
#if (LPC11xx_UART_FIFO_PRELOAD < 1) || (LPC11xx_UART_FIFO_PRELOAD > 16)
-#error "invalid LPC214x_UART_FIFO_PRELOAD setting"
+#error "invalid LPC11xx_UART_FIFO_PRELOAD setting"
#endif
/*===========================================================================*/
@@ -130,7 +130,7 @@
typedef uint32_t sdflags_t;
/**
- * @brief LPC214x Serial Driver configuration structure.
+ * @brief LPC11xx Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
*/
@@ -156,8 +156,6 @@ typedef struct {
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -190,7 +188,7 @@ extern SerialDriver SD1;
extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp);
+ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}
diff --git a/os/hal/platforms/LPC13xx/serial_lld.c b/os/hal/platforms/LPC13xx/serial_lld.c
index 8c3e73ca1..53fd7e11e 100644
--- a/os/hal/platforms/LPC13xx/serial_lld.c
+++ b/os/hal/platforms/LPC13xx/serial_lld.c
@@ -58,16 +58,17 @@ static const SerialConfig default_config = {
* @brief UART initialization.
*
* @param[in] sdp communication channel associated to the UART
+ * @param[in] config the architecture-dependent serial driver configuration
*/
-static void uart_init(SerialDriver *sdp) {
+static void uart_init(SerialDriver *sdp, const SerialConfig *config) {
LPC_UART_TypeDef *u = sdp->uart;
- uint32_t div = LPC13xx_UART_PCLK / (sdp->config->sc_speed << 4);
- u->LCR = sdp->config->sc_lcr | LCR_DLAB;
+ uint32_t div = LPC13xx_UART_PCLK / (config->sc_speed << 4);
+ u->LCR = config->sc_lcr | LCR_DLAB;
u->DLL = div;
u->DLM = div >> 8;
- u->LCR = sdp->config->sc_lcr;
- u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | sdp->config->sc_fcr;
+ u->LCR = config->sc_lcr;
+ u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | config->sc_fcr;
u->ACR = 0;
u->FDR = 0x10;
u->TER = TER_ENABLE;
@@ -242,11 +243,14 @@ void sd_lld_init(void) {
* @brief Low level serial driver configuration and (re)start.
*
* @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
-void sd_lld_start(SerialDriver *sdp) {
+void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
- if (sdp->config == NULL)
- sdp->config = &default_config;
+ if (config == NULL)
+ config = &default_config;
if (sdp->state == SD_STOP) {
#if USE_LPC13xx_UART0
@@ -257,7 +261,7 @@ void sd_lld_start(SerialDriver *sdp) {
}
#endif
}
- uart_init(sdp);
+ uart_init(sdp, config);
}
/**
diff --git a/os/hal/platforms/LPC13xx/serial_lld.h b/os/hal/platforms/LPC13xx/serial_lld.h
index c6503fc08..0426c6d5f 100644
--- a/os/hal/platforms/LPC13xx/serial_lld.h
+++ b/os/hal/platforms/LPC13xx/serial_lld.h
@@ -84,29 +84,29 @@
/*===========================================================================*/
/**
- * @brief UART0 driver enable switch.
+ * @brief UART0 driver enable switch.
* @details If set to @p TRUE the support for UART0 is included.
- * @note The default is @p TRUE .
+ * @note The default is @p TRUE .
*/
#if !defined(USE_LPC13xx_UART0) || defined(__DOXYGEN__)
#define USE_LPC13xx_UART0 TRUE
#endif
/**
- * @brief FIFO preload parameter.
+ * @brief FIFO preload parameter.
* @details Configuration parameter, this values defines how many bytes are
- * preloaded in the HW transmit FIFO for each interrupt, the maximum value is
- * 16 the minimum is 1.
- * @note An high value reduces the number of interrupts generated but can
- * also increase the worst case interrupt response time because the
- * preload loops.
+ * preloaded in the HW transmit FIFO for each interrupt, the maximum
+ * value is 16 the minimum is 1.
+ * @note An high value reduces the number of interrupts generated but can
+ * also increase the worst case interrupt response time because the
+ * preload loops.
*/
#if !defined(LPC13xx_UART_FIFO_PRELOAD) || defined(__DOXYGEN__)
#define LPC13xx_UART_FIFO_PRELOAD 16
#endif
/**
- * @brief UART0 interrupt priority level setting.
+ * @brief UART0 interrupt priority level setting.
*/
#if !defined(LPC13xx_UART0_PRIORITY) || defined(__DOXYGEN__)
#define LPC13xx_UART0_PRIORITY 3
@@ -117,7 +117,7 @@
/*===========================================================================*/
#if (LPC13xx_UART_FIFO_PRELOAD < 1) || (LPC13xx_UART_FIFO_PRELOAD > 16)
-#error "invalid LPC214x_UART_FIFO_PRELOAD setting"
+#error "invalid LPC13xx_UART_FIFO_PRELOAD setting"
#endif
/*===========================================================================*/
@@ -125,12 +125,12 @@
/*===========================================================================*/
/**
- * @brief Serial Driver condition flags type.
+ * @brief Serial Driver condition flags type.
*/
typedef uint32_t sdflags_t;
/**
- * @brief LPC214x Serial Driver configuration structure.
+ * @brief LPC13xx Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
*/
@@ -156,8 +156,6 @@ typedef struct {
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -190,7 +188,7 @@ extern SerialDriver SD1;
extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp);
+ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}
diff --git a/os/hal/platforms/MSP430/serial_lld.c b/os/hal/platforms/MSP430/serial_lld.c
index 1dc6399f1..8186813fb 100644
--- a/os/hal/platforms/MSP430/serial_lld.c
+++ b/os/hal/platforms/MSP430/serial_lld.c
@@ -18,8 +18,9 @@
*/
/**
- * @file MSP430/serial_lld.c
- * @brief MSP430 low level serial driver code.
+ * @file MSP430/serial_lld.c
+ * @brief MSP430 low level serial driver code.
+ *
* @addtogroup MSP430_SERIAL
* @{
*/
@@ -88,9 +89,9 @@ static void notify1(void) {
}
/**
- * @brief USART0 initialization.
+ * @brief USART0 initialization.
*
- * @param[in] config the architecture-dependent serial driver configuration
+ * @param[in] config the architecture-dependent serial driver configuration
*/
static void usart0_init(const SerialConfig *config) {
@@ -110,7 +111,7 @@ static void usart0_init(const SerialConfig *config) {
}
/**
- * @brief USART0 de-initialization.
+ * @brief USART0 de-initialization.
*/
static void usart0_deinit(void) {
@@ -132,9 +133,9 @@ static void notify2(void) {
}
/**
- * @brief USART1 initialization.
+ * @brief USART1 initialization.
*
- * @param[in] config the architecture-dependent serial driver configuration
+ * @param[in] config the architecture-dependent serial driver configuration
*/
static void usart1_init(const SerialConfig *config) {
@@ -154,7 +155,7 @@ static void usart1_init(const SerialConfig *config) {
}
/**
- * @brief USART1 de-initialization.
+ * @brief USART1 de-initialization.
*/
static void usart1_deinit(void) {
@@ -236,7 +237,7 @@ CH_IRQ_HANDLER(USART1RX_VECTOR) {
/*===========================================================================*/
/**
- * Low level serial driver initialization.
+ * @brief Low level serial driver initialization.
*/
void sd_lld_init(void) {
@@ -254,11 +255,14 @@ void sd_lld_init(void) {
}
/**
- * @brief Low level serial driver configuration and (re)start.
+ * @brief Low level serial driver configuration and (re)start.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
-void sd_lld_start(SerialDriver *sdp) {
+void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
if (sdp->config == NULL)
sdp->config = &default_config;
@@ -278,11 +282,11 @@ void sd_lld_start(SerialDriver *sdp) {
}
/**
- * @brief Low level serial driver stop.
+ * @brief Low level serial driver stop.
* @details De-initializes the USART, stops the associated clock, resets the
* interrupt vector.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
*/
void sd_lld_stop(SerialDriver *sdp) {
diff --git a/os/hal/platforms/MSP430/serial_lld.h b/os/hal/platforms/MSP430/serial_lld.h
index ad7ae7dd4..d19c9160d 100644
--- a/os/hal/platforms/MSP430/serial_lld.h
+++ b/os/hal/platforms/MSP430/serial_lld.h
@@ -18,8 +18,9 @@
*/
/**
- * @file MSP430/serial_lld.h
- * @brief MSP430 low level serial driver header.
+ * @file MSP430/serial_lld.h
+ * @brief MSP430 low level serial driver header.
+ *
* @addtogroup MSP430_SERIAL
* @{
*/
@@ -38,18 +39,18 @@
/*===========================================================================*/
/**
- * @brief USART0 driver enable switch.
+ * @brief USART0 driver enable switch.
* @details If set to @p TRUE the support for USART0 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p TRUE.
*/
#if !defined(USE_MSP430_USART0) || defined(__DOXYGEN__)
#define USE_MSP430_USART0 TRUE
#endif
/**
- * @brief USART1 driver enable switch.
+ * @brief USART1 driver enable switch.
* @details If set to @p TRUE the support for USART1 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p FALSE.
*/
#if !defined(USE_MSP430_USART1) || defined(__DOXYGEN__)
#define USE_MSP430_USART1 TRUE
@@ -64,12 +65,12 @@
/*===========================================================================*/
/**
- * Serial Driver condition flags type.
+ * @brief Serial Driver condition flags type.
*/
typedef uint8_t sdflags_t;
/**
- * @brief MSP430 Serial Driver configuration structure.
+ * @brief MSP430 Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
*/
@@ -95,8 +96,6 @@ typedef struct {
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -116,8 +115,8 @@ typedef struct {
/*===========================================================================*/
/**
- * @brief Macro for baud rate computation.
- * @note Make sure the final baud rate is within tolerance.
+ * @brief Macro for baud rate computation.
+ * @note Make sure the final baud rate is within tolerance.
*/
#define UBR(b) (SMCLK / (b))
@@ -136,7 +135,7 @@ extern SerialDriver SD2;
extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp);
+ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}
diff --git a/os/hal/platforms/Posix/serial_lld.c b/os/hal/platforms/Posix/serial_lld.c
index b312fccbd..290e39c8f 100644
--- a/os/hal/platforms/Posix/serial_lld.c
+++ b/os/hal/platforms/Posix/serial_lld.c
@@ -202,7 +202,7 @@ static bool_t outint(SerialDriver *sdp) {
/*===========================================================================*/
/**
- * Low level serial driver initialization.
+ * @brief Low level serial driver initialization.
*/
void sd_lld_init(void) {
@@ -222,9 +222,9 @@ void sd_lld_init(void) {
}
/**
- * @brief Low level serial driver configuration and (re)start.
+ * @brief Low level serial driver configuration and (re)start.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
*/
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
@@ -243,11 +243,11 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
}
/**
- * @brief Low level serial driver stop.
+ * @brief Low level serial driver stop.
* @details De-initializes the USART, stops the associated clock, resets the
* interrupt vector.
*
- * @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] sdp pointer to a @p SerialDriver object
*/
void sd_lld_stop(SerialDriver *sdp) {
diff --git a/os/hal/platforms/Posix/serial_lld.h b/os/hal/platforms/Posix/serial_lld.h
index 53ba4af95..4ffa0c544 100644
--- a/os/hal/platforms/Posix/serial_lld.h
+++ b/os/hal/platforms/Posix/serial_lld.h
@@ -39,41 +39,41 @@
/*===========================================================================*/
/**
- * @brief Serial buffers size.
+ * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue
- * buffers depending on the requirements of your application.
+ * buffers depending on the requirements of your application.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 1024
#endif
/**
- * @brief SD1 driver enable switch.
+ * @brief SD1 driver enable switch.
* @details If set to @p TRUE the support for SD1 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p TRUE.
*/
#if !defined(USE_SIM_SERIAL1) || defined(__DOXYGEN__)
#define USE_SIM_SERIAL1 TRUE
#endif
/**
- * @brief SD2 driver enable switch.
+ * @brief SD2 driver enable switch.
* @details If set to @p TRUE the support for SD2 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p TRUE.
*/
#if !defined(USE_SIM_SERIAL2) || defined(__DOXYGEN__)
#define USE_SIM_SERIAL2 TRUE
#endif
/**
- * @brief Listen port for SD1.
+ * @brief Listen port for SD1.
*/
#if !defined(SD1_PORT) || defined(__DOXYGEN__)
#define SIM_SD1_PORT 29001
#endif
/**
- * @brief Listen port for SD2.
+ * @brief Listen port for SD2.
*/
#if !defined(SD2_PORT) || defined(__DOXYGEN__)
#define SIM_SD2_PORT 29002
@@ -88,24 +88,23 @@
/*===========================================================================*/
/**
- * Serial Driver condition flags type.
+ * @brief Serial Driver condition flags type.
*/
typedef uint32_t sdflags_t;
/**
- * @brief Generic Serial Driver configuration structure.
+ * @brief Generic Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
- *
- * @note This structure content is architecture dependent, each driver
- * implementation defines its own version and the custom static
- * initializers.
+ * @note This structure content is architecture dependent, each driver
+ * implementation defines its own version and the custom static
+ * initializers.
*/
typedef struct {
} SerialConfig;
/**
- * @brief @p SerialDriver specific data.
+ * @brief @p SerialDriver specific data.
*/
#define _serial_driver_data \
_base_asynchronous_channel_data \
diff --git a/os/hal/platforms/SPC56x/serial_lld.h b/os/hal/platforms/SPC56x/serial_lld.h
index 7d6ef0352..5dc9c8c64 100644
--- a/os/hal/platforms/SPC56x/serial_lld.h
+++ b/os/hal/platforms/SPC56x/serial_lld.h
@@ -111,7 +111,7 @@ typedef struct {
} SerialConfig;
/**
- * @brief @p SerialDriver specific data.
+ * @brief @p SerialDriver specific data.
*/
#define _serial_driver_data \
_base_asynchronous_channel_data \
diff --git a/os/hal/platforms/STM8/hal_lld.c b/os/hal/platforms/STM8/hal_lld.c
index 0d5791236..7a2d1bc1f 100644
--- a/os/hal/platforms/STM8/hal_lld.c
+++ b/os/hal/platforms/STM8/hal_lld.c
@@ -37,10 +37,10 @@
/*===========================================================================*/
/**
- * @brief PAL setup.
+ * @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
*/
-const STM8GPIOConfig pal_default_config =
+ROMCONST STM8GPIOConfig pal_default_config =
{
{
{VAL_GPIOAODR, 0, VAL_GPIOADDR, VAL_GPIOACR1, VAL_GPIOACR2},
@@ -78,7 +78,7 @@ void hal_lld_init(void) {
while ((CLK_ICKR & 2) == 0) /* HSIRDY */
;
#elif STM8_CLOCK_SOURCE == CLK_SOURCE_LSI
- CLK_ICKR = 8; /* LSIEN */
+ CLK_ICKR = 8; /* LSIEN */
while ((CLK_ICKR & 16) == 0) /* LSIRDY */
;
#else /* STM8_CLOCK_SOURCE == CLK_SOURCE_HSE */
@@ -100,7 +100,7 @@ void hal_lld_init(void) {
/* Clocks initially all disabled.*/
CLK_PCKENR1 = 0;
CLK_PCKENR2 = 0;
-
+
/* Other clock related initializations.*/
CLK_CSSR = 0;
CLK_CCOR = 0;
diff --git a/os/hal/platforms/STM8/hal_lld.h b/os/hal/platforms/STM8/hal_lld.h
index aba5013b3..786843ffc 100644
--- a/os/hal/platforms/STM8/hal_lld.h
+++ b/os/hal/platforms/STM8/hal_lld.h
@@ -66,21 +66,21 @@
/*===========================================================================*/
/**
- * @brief Clock source setting.
+ * @brief Clock source setting.
*/
#if !defined(STM8_CLOCK_SOURCE) || defined(__DOXYGEN__)
#define STM8_CLOCK_SOURCE CLK_SOURCE_DEFAULT
#endif
/**
- * @brief HSI clock divider.
+ * @brief HSI clock divider.
*/
#if !defined(STM8_HSI_DIVIDER) || defined(__DOXYGEN__)
#define STM8_HSI_DIVIDER CLK_HSI_DIV8
#endif
/**
- * @brief CPU clock divider.
+ * @brief CPU clock divider.
*/
#if !defined(STM8_CPU_DIVIDER) || defined(__DOXYGEN__)
#define STM8_CPU_DIVIDER CLK_CPU_DIV1
diff --git a/os/hal/platforms/STM8/pal_lld.h b/os/hal/platforms/STM8/pal_lld.h
index 88f68dd37..65ddeedea 100644
--- a/os/hal/platforms/STM8/pal_lld.h
+++ b/os/hal/platforms/STM8/pal_lld.h
@@ -38,6 +38,9 @@
/* I/O Ports Types and constants. */
/*===========================================================================*/
+/**
+ * @brief GPIO port representation.
+ */
typedef struct {
volatile uint8_t ODR;
volatile uint8_t IDR;
@@ -191,7 +194,7 @@ typedef gpio_t *ioportid_t;
*/
#define pal_lld_setgroupmode(port, mask, mode) ((void)(mode))
-extern const STM8GPIOConfig pal_default_config;
+extern ROMCONST STM8GPIOConfig pal_default_config;
#endif /* CH_HAL_USE_PAL */
diff --git a/os/hal/platforms/STM8/serial_lld.c b/os/hal/platforms/STM8/serial_lld.c
index a0b85619c..d3b49b1e4 100644
--- a/os/hal/platforms/STM8/serial_lld.c
+++ b/os/hal/platforms/STM8/serial_lld.c
@@ -79,7 +79,7 @@ SerialDriver SD3;
/**
* @brief Driver default configuration.
*/
-static const SerialConfig default_config = {
+static ROMCONST SerialConfig default_config = {
BBR(SERIAL_DEFAULT_BITRATE),
SD_MODE_PARITY_NONE | SD_MODE_STOP_1
};