X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Fmsp430%2Fusci%2FMsp430Usci.h;h=94ca476c05c433828c58f7ec43b76e183e0e01a5;hb=d3c4fe58cc54a7f304e00ad4318d8c07bbb093c3;hp=541311136479c9de31a9be20609d085bfc5966da;hpb=ff7253eba0b30ef68b507dc6a0e479f5c1dc242b;p=tinyos-2.x.git diff --git a/tos/chips/msp430/usci/Msp430Usci.h b/tos/chips/msp430/usci/Msp430Usci.h index 54131113..94ca476c 100644 --- a/tos/chips/msp430/usci/Msp430Usci.h +++ b/tos/chips/msp430/usci/Msp430Usci.h @@ -69,6 +69,18 @@ typedef enum { USCI_REN_TX_PULLDOWN = USCI_REN_TX + 0x20 } msp430_ren_t; +/* Baud rates for UART mode. Only 32KHz modes work right now. */ +typedef enum { + /* UCOS16=0. UMCTL = UCBRFx << 4 + UCBRSx << 1 + UCOS16. + * 1MHZ = 1,048576HZ, 1E6MHZ = 1,000,000HZ. + */ + UBRX_32768HZ_9600=3, UMCTL_32768HZ_9600=(0 << 4) + (3 << 1) + 0, + UBRX_1MHZ_9600=109, UMCTL_1MHZ_9600=(0 << 4) + (2 << 1) + 0, + UBRX_1MHZ_115200=9, UMCTL_1MHZ_115200=(0 << 4) + (1 << 1) + 0, + UBRX_1E6MHZ_9600=104, UMCTL_1E6MHZ_9600=(0 << 4) + (1 << 1) + 0, + UBRX_1E6MHZ_115200=8, UMCTL_1E6MHZ_115200=(0 << 4) + (6 << 1) + 0, +} msp430_usci_uart_rate_t; + typedef struct { uint8_t ctl0; uint8_t ctl1; @@ -88,21 +100,14 @@ typedef struct { msp430_ren_t ren; } __attribute__ ((packed)) msp430_usci_spi_t; -/* Baud rates for UART mode. Only 32KHz modes work right now. */ -typedef enum { - /* UCOS16=0. UMCTL = UCBRFx << 4 + UCBRSx << 1 + UCOS16. - * 1MHZ = 1,048576HZ, 1E6MHZ = 1,000,000HZ. - */ - UBRX_32768HZ_9600=3, UMCTL_32768HZ_9600=(0 << 4) + (3 << 1) + 0, - UBRX_1MHZ_9600=109, UMCTL_1MHZ_9600=(0 << 4) + (2 << 1) + 0, - UBRX_1MHZ_115200=9, UMCTL_1MHZ_115200=(0 << 4) + (1 << 1) + 0, - UBRX_1E6MHZ_9600=104, UMCTL_1E6MHZ_9600=(0 << 4) + (1 << 1) + 0, - UBRX_1E6MHZ_115200=8, UMCTL_1E6MHZ_115200=(0 << 4) + (6 << 1) + 0, -} msp430_usci_uart_rate_t; - -typedef union { - msp430_usci_uart_t uart; - msp430_usci_spi_t spi; -} __attribute__ ((packed)) msp430_usci_config_t; +typedef struct { + uint8_t ctl0; + uint8_t ctl1; + uint16_t brx; + uint8_t i2cie; + uint8_t i2coa; + uint8_t i2csa; + msp430_ren_t ren; +} __attribute__ ((packed)) msp430_usci_i2c_t; #endif