diff options
author | liamstask <liamstask@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-04-19 15:48:30 +0000 |
---|---|---|
committer | liamstask <liamstask@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-04-19 15:48:30 +0000 |
commit | a222ba2ddebb519fce65ebabfaf63ee32c38c3be (patch) | |
tree | 28d504802cdfc65ab3e3d5ca834ed85717cb0e8a /os/hal/platforms/STM32 | |
parent | 6e8ee658598c5e1176bec50f36148112158aae49 (diff) | |
download | ChibiOS-a222ba2ddebb519fce65ebabfaf63ee32c38c3be.tar.gz ChibiOS-a222ba2ddebb519fce65ebabfaf63ee32c38c3be.tar.bz2 ChibiOS-a222ba2ddebb519fce65ebabfaf63ee32c38c3be.zip |
* STM32 SerialDriver to remove SerialConfig pointer
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1878 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r-- | os/hal/platforms/STM32/serial_lld.c | 20 | ||||
-rw-r--r-- | os/hal/platforms/STM32/serial_lld.h | 4 |
2 files changed, 11 insertions, 13 deletions
diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c index 99a8653ca..00ccadd6b 100644 --- a/os/hal/platforms/STM32/serial_lld.c +++ b/os/hal/platforms/STM32/serial_lld.c @@ -83,25 +83,25 @@ static const SerialConfig default_config = *
* @param[in] sdp pointer to a @p SerialDriver object
*/
-static void usart_init(SerialDriver *sdp) {
+static void usart_init(SerialDriver *sdp, const SerialConfig *config) {
USART_TypeDef *u = sdp->usart;
/*
* Baud rate setting.
*/
if (sdp->usart == USART1)
- u->BRR = APB2CLK / sdp->config->sc_speed;
+ u->BRR = APB2CLK / config->sc_speed;
else
- u->BRR = APB1CLK / sdp->config->sc_speed;
+ u->BRR = APB1CLK / config->sc_speed;
/*
* Note that some bits are enforced.
*/
- u->CR1 = sdp->config->sc_cr1 | USART_CR1_UE | USART_CR1_PEIE |
+ u->CR1 = config->sc_cr1 | USART_CR1_UE | USART_CR1_PEIE |
USART_CR1_RXNEIE | USART_CR1_TE |
USART_CR1_RE;
- u->CR2 = sdp->config->sc_cr2 | USART_CR2_LBDIE;
- u->CR3 = sdp->config->sc_cr3 | USART_CR3_EIE;
+ u->CR2 = config->sc_cr2 | USART_CR2_LBDIE;
+ u->CR3 = config->sc_cr3 | USART_CR3_EIE;
(void)u->SR; /* SR reset step 1.*/
(void)u->DR; /* SR reset step 2.*/
}
@@ -318,10 +318,10 @@ void sd_lld_init(void) { *
* @param[in] sdp pointer to a @p SerialDriver object
*/
-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_STM32_USART1
@@ -362,7 +362,7 @@ void sd_lld_start(SerialDriver *sdp) { #endif
#endif
}
- usart_init(sdp);
+ usart_init(sdp, config);
}
/**
diff --git a/os/hal/platforms/STM32/serial_lld.h b/os/hal/platforms/STM32/serial_lld.h index 861582d54..979009916 100644 --- a/os/hal/platforms/STM32/serial_lld.h +++ b/os/hal/platforms/STM32/serial_lld.h @@ -170,8 +170,6 @@ typedef struct { _base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -226,7 +224,7 @@ extern SerialDriver SD5; 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
}
|