diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-01 15:29:17 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-01-01 15:29:17 +0000 |
commit | 307e9891e40e46b08cd15690da8fff1657172915 (patch) | |
tree | 0b62c8e7972e24320c1091d957f7a2764de829dc /os/hal/platforms/AVR/serial_lld.c | |
parent | f8c40043e469d81f2a9f380d6723b92c79bd30bc (diff) | |
download | ChibiOS-307e9891e40e46b08cd15690da8fff1657172915.tar.gz ChibiOS-307e9891e40e46b08cd15690da8fff1657172915.tar.bz2 ChibiOS-307e9891e40e46b08cd15690da8fff1657172915.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1486 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/AVR/serial_lld.c')
-rw-r--r-- | os/hal/platforms/AVR/serial_lld.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/os/hal/platforms/AVR/serial_lld.c b/os/hal/platforms/AVR/serial_lld.c index 166663c44..0244471a6 100644 --- a/os/hal/platforms/AVR/serial_lld.c +++ b/os/hal/platforms/AVR/serial_lld.c @@ -58,7 +58,7 @@ SerialDriver SD2; /**
* @brief Driver default configuration.
*/
-static const SerialDriverConfig default_config = {
+static const SerialConfig default_config = {
UBRR(DEFAULT_USART_BITRATE),
(1 << UCSZ1) | (1 << UCSZ0)
};
@@ -91,13 +91,13 @@ static void notify1(void) { * @brief USART0 initialization.
* @param[in] config the architecture-dependent serial driver configuration
*/
-static void usart0_init(const SerialDriverConfig *config) {
+static void usart0_init(const SerialConfig *config) {
- UBRR0L = config->brr;
- UBRR0H = config->brr >> 8;
+ UBRR0L = config->sc_brr;
+ UBRR0H = config->sc_brr >> 8;
UCSR0A = 0;
UCSR0B = (1 << RXEN) | (1 << TXEN) | (1 << RXCIE);
- UCSR0C = config->csrc;
+ UCSR0C = config->sc_csrc;
}
/**
@@ -121,13 +121,13 @@ static void notify2(void) { * @brief USART1 initialization.
* @param[in] config the architecture-dependent serial driver configuration
*/
-static void usart1_init(const SerialDriverConfig *config) {
+static void usart1_init(const SerialConfig *config) {
- UBRR1L = config->brr;
- UBRR1H = config->brr >> 8;
+ UBRR1L = config->sc_brr;
+ UBRR1H = config->sc_brr >> 8;
UCSR1A = 0;
UCSR1B = (1 << RXEN) | (1 << TXEN) | (1 << RXCIE);
- UCSR1C = config->csrc;
+ UCSR1C = config->sc_csrc;
}
/**
@@ -232,20 +232,19 @@ 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, const SerialDriverConfig *config) {
+void sd_lld_start(SerialDriver *sdp) {
- if (config == NULL)
- config = &default_config;
+ if (sdp->sd.config == NULL)
+ sdp->sd.config = &default_config;
#if USE_AVR_USART0
- usart0_init(config);
+ if (&SD1 == sdp)
+ usart0_init(sdp->sd.config);
#endif
#if USE_AVR_USART1
- usart1_init(config);
+ if (&SD2 == sdp)
+ usart1_init(sdp->sd.config);
#endif
}
@@ -259,10 +258,12 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { void sd_lld_stop(SerialDriver *sdp) {
#if USE_AVR_USART0
- usart0_deinit();
+ if (&SD1 == sdp)
+ usart0_deinit();
#endif
#if USE_AVR_USART1
- usart1_deinit();
+ if (&SD2 == sdp)
+ usart1_deinit();
#endif
}
|