From d49cac6d954f6d6b0bfe6365a46139d82366907b Mon Sep 17 00:00:00 2001 From: scipio Date: Mon, 14 Sep 2009 00:25:59 +0000 Subject: [PATCH] UartControl update for enum consistency and support in atm128/msp430. --- tos/chips/atm128/Atm128Uart.h | 22 ++++++++++++++++++++ tos/chips/msp430/usart/msp430usart.h | 30 ++++++++++++++++++++++++++++ tos/interfaces/UartControl.nc | 3 ++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/tos/chips/atm128/Atm128Uart.h b/tos/chips/atm128/Atm128Uart.h index 63d49cde..08400180 100644 --- a/tos/chips/atm128/Atm128Uart.h +++ b/tos/chips/atm128/Atm128Uart.h @@ -127,6 +127,28 @@ typedef uint8_t Atm128_UBRR0H_t; //!< UART 0 Baud Register (High) typedef uint8_t Atm128_UBRR1L_t; //!< UART 1 Baud Register (Low) typedef uint8_t Atm128_UBRR1H_t; //!< UART 1 Baud Register (High) +typedef uint8_t uart_parity_t; +typedef uint8_t uart_speed_t; +typedef uint8_t uart_duplex_t; + +enum { + TOS_UART_PARITY_NONE = 0, + TOS_UART_PARITY_EVEN = 1, + TOS_UART_PARITY_ODD = 2, +}; + +enum { + TOS_UART_19200 = 0, + TOS_UART_38400 = 1, + TOS_UART_57600 = 2, +}; + +enum { + TOS_UART_OFF = 0, + TOS_UART_RONLY = 1, + TOS_UART_TONLY = 2, + TOS_UART_DUPLEX = 3, +}; #endif //_H_Atm128UART_h diff --git a/tos/chips/msp430/usart/msp430usart.h b/tos/chips/msp430/usart/msp430usart.h index 5a50349c..08d543b3 100644 --- a/tos/chips/msp430/usart/msp430usart.h +++ b/tos/chips/msp430/usart/msp430usart.h @@ -306,5 +306,35 @@ msp430_i2c_union_config_t msp430_i2c_default_config = { } }; +typedef uint8_t uart_speed_t; +typedef uint8_t uart_parity_t; +typedef uint8_t uart_duplex_t; + +enum { + TOS_UART_1200 = 0, + TOS_UART_1800 = 1, + TOS_UART_2400 = 2, + TOS_UART_4800 = 3, + TOS_UART_9600 = 4, + TOS_UART_19200 = 5, + TOS_UART_38400 = 6, + TOS_UART_57600 = 7, + TOS_UART_76800 = 8, + TOS_UART_115200 = 9, + TOS_UART_230400 = 10 +}; + +enum { + TOS_UART_OFF, + TOS_UART_RONLY, + TOS_UART_TONLY, + TOS_UART_DUPLEX +}; + +enum { + TOS_UART_PARITY_NONE, + TOS_UART_PARITY_EVEN, + TOS_UART_PARITY_ODD +}; #endif//_H_Msp430Usart_h diff --git a/tos/interfaces/UartControl.nc b/tos/interfaces/UartControl.nc index 76c52874..f0226b4f 100644 --- a/tos/interfaces/UartControl.nc +++ b/tos/interfaces/UartControl.nc @@ -86,7 +86,8 @@ interface UartControl { * only be called when both the receive and transmit paths * are disabled, either through a power control interface * or setDuplexMode. Valid parity settings are - * TOS_PARITY_NONE, TOS_PARITY_EVEN, and TOS_PARITY_ODD. + * TOS_UART_PARITY_NONE, TOS_UART_PARITY_EVEN, + * and TOS_UART_PARITY_ODD. * * @param parity The parity mode to change to. */ -- 2.39.2