From ef9ae502febb70319ecfbc09f37885b13460a7a0 Mon Sep 17 00:00:00 2001 From: smckown Date: Mon, 8 Sep 2008 23:11:16 +0000 Subject: [PATCH] Mintor tweaks to usci --- tos/chips/msp430/usci/Msp430UartP.nc | 6 +++--- tos/chips/msp430/usci/Msp430Usci.h | 6 +++++- tos/chips/msp430/usci/Msp430UsciConfigure.nc | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tos/chips/msp430/usci/Msp430UartP.nc b/tos/chips/msp430/usci/Msp430UartP.nc index ad919b82..2ef1736f 100644 --- a/tos/chips/msp430/usci/Msp430UartP.nc +++ b/tos/chips/msp430/usci/Msp430UartP.nc @@ -90,7 +90,7 @@ implementation { async command void ResourceConfigure.configure() { atomic { - msp430_usci_config_t* config = call Msp430UsciConfigure.get(); + const msp430_usci_config_t* config = call Msp430UsciConfigure.get(); call Registers.setCtl1(UCSWRST); @@ -280,9 +280,9 @@ implementation { signal UartStream.receivedByte(byte); } - default async command msp430_usci_config_t* Msp430UsciConfigure.get() + default async command const msp430_usci_config_t* Msp430UsciConfigure.get() { - static msp430_usci_config_t def = { + const static msp430_usci_config_t def = { uart: { ctl0: UCMODE_0, /* async, lsb first, 8N1 */ ctl1: UCSWRST|UCSSEL_1, /* clock uart from SMCLK */ diff --git a/tos/chips/msp430/usci/Msp430Usci.h b/tos/chips/msp430/usci/Msp430Usci.h index 880a92da..48299822 100644 --- a/tos/chips/msp430/usci/Msp430Usci.h +++ b/tos/chips/msp430/usci/Msp430Usci.h @@ -82,10 +82,14 @@ typedef struct { /* Baud rates for UART mode. Only 32KHz modes work right now. */ typedef enum { - /* UCOS16=0. UMCTL = UCBRFx << 4 + UCBRSx << 1 + UCOS16. */ + /* 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 { diff --git a/tos/chips/msp430/usci/Msp430UsciConfigure.nc b/tos/chips/msp430/usci/Msp430UsciConfigure.nc index d7bab281..77cb87d2 100644 --- a/tos/chips/msp430/usci/Msp430UsciConfigure.nc +++ b/tos/chips/msp430/usci/Msp430UsciConfigure.nc @@ -36,5 +36,5 @@ #include "Msp430Usci.h" interface Msp430UsciConfigure { - async command msp430_usci_config_t* get(); + async command const msp430_usci_config_t* get(); } -- 2.39.2