From b83aa91d0424245008bc68cecceac8b12efda682 Mon Sep 17 00:00:00 2001 From: smckown Date: Tue, 9 Sep 2008 02:30:44 +0000 Subject: [PATCH] The msp430 now has two basic clock peripherals. Add tos/chips/msp430/clock and move basic clock and clock configuration files from timer to clock directories. Update .platform files accordingly. --- tos/chips/msp430/{timer => clock}/Msp430ClockC.nc | 0 .../msp430/{timer => clock}/Msp430ClockInit.nc | 0 tos/chips/msp430/{timer => clock}/Msp430ClockP.nc | 0 .../msp430/{timer => clock}/Msp430DcoCalibC.nc | 0 .../msp430/{timer => clock}/Msp430DcoCalibP.nc | 0 tos/chips/msp430/{timer => clock}/Msp430DcoSpec.h | 0 tos/chips/msp430/pins/HplMsp430GeneralIOP.nc | 4 ++-- tos/chips/msp430/usci/Msp430SpiP.nc | 15 +++++++++------ tos/chips/msp430/usci/Msp430UartP.nc | 4 ++-- tos/chips/msp430/usci/Msp430Usci.h | 2 ++ tos/platforms/shimmer/.platform | 3 ++- tos/platforms/telosa/.platform | 3 ++- tos/platforms/telosb/.platform | 1 + tos/platforms/tinynode/.platform | 1 + tos/platforms/tmicore/.platform | 2 ++ 15 files changed, 23 insertions(+), 12 deletions(-) rename tos/chips/msp430/{timer => clock}/Msp430ClockC.nc (100%) rename tos/chips/msp430/{timer => clock}/Msp430ClockInit.nc (100%) rename tos/chips/msp430/{timer => clock}/Msp430ClockP.nc (100%) rename tos/chips/msp430/{timer => clock}/Msp430DcoCalibC.nc (100%) rename tos/chips/msp430/{timer => clock}/Msp430DcoCalibP.nc (100%) rename tos/chips/msp430/{timer => clock}/Msp430DcoSpec.h (100%) diff --git a/tos/chips/msp430/timer/Msp430ClockC.nc b/tos/chips/msp430/clock/Msp430ClockC.nc similarity index 100% rename from tos/chips/msp430/timer/Msp430ClockC.nc rename to tos/chips/msp430/clock/Msp430ClockC.nc diff --git a/tos/chips/msp430/timer/Msp430ClockInit.nc b/tos/chips/msp430/clock/Msp430ClockInit.nc similarity index 100% rename from tos/chips/msp430/timer/Msp430ClockInit.nc rename to tos/chips/msp430/clock/Msp430ClockInit.nc diff --git a/tos/chips/msp430/timer/Msp430ClockP.nc b/tos/chips/msp430/clock/Msp430ClockP.nc similarity index 100% rename from tos/chips/msp430/timer/Msp430ClockP.nc rename to tos/chips/msp430/clock/Msp430ClockP.nc diff --git a/tos/chips/msp430/timer/Msp430DcoCalibC.nc b/tos/chips/msp430/clock/Msp430DcoCalibC.nc similarity index 100% rename from tos/chips/msp430/timer/Msp430DcoCalibC.nc rename to tos/chips/msp430/clock/Msp430DcoCalibC.nc diff --git a/tos/chips/msp430/timer/Msp430DcoCalibP.nc b/tos/chips/msp430/clock/Msp430DcoCalibP.nc similarity index 100% rename from tos/chips/msp430/timer/Msp430DcoCalibP.nc rename to tos/chips/msp430/clock/Msp430DcoCalibP.nc diff --git a/tos/chips/msp430/timer/Msp430DcoSpec.h b/tos/chips/msp430/clock/Msp430DcoSpec.h similarity index 100% rename from tos/chips/msp430/timer/Msp430DcoSpec.h rename to tos/chips/msp430/clock/Msp430DcoSpec.h diff --git a/tos/chips/msp430/pins/HplMsp430GeneralIOP.nc b/tos/chips/msp430/pins/HplMsp430GeneralIOP.nc index 78104ac3..191d4f21 100644 --- a/tos/chips/msp430/pins/HplMsp430GeneralIOP.nc +++ b/tos/chips/msp430/pins/HplMsp430GeneralIOP.nc @@ -46,7 +46,7 @@ implementation async command void IO.clr() { atomic PORTx &= ~(0x01 << pin); } async command void IO.toggle() { atomic PORTx ^= (0x01 << pin); } async command uint8_t IO.getOutRaw() { return PORTx & (0x01 << pin); } - async command bool IO.getOut() { return IO.getOutRaw() != 0; } + async command bool IO.getOut() { return (call IO.getOutRaw() != 0); } async command uint8_t IO.getRaw() { return PORTxIN & (0x01 << pin); } async command bool IO.get() { return (call IO.getRaw() != 0); } async command void IO.makeInput() { atomic PORTxDIR &= ~(0x01 << pin); } @@ -59,5 +59,5 @@ implementation async command bool IO.isIOFunc() { return (PORTxSEL & (0x01<ctl0 | UCSYNC; + if ((ctl0 & UCMODE_3) == UCMODE_3) + ctl0 &= ~(UCMODE_3); + /* Configure USCI registers */ - call Registers.assignCtl0(config->ctl0); - call Registers.assignCtl1(config->ctl1|UCSWRST); + call Registers.assignCtl0(ctl0); + call Registers.assignCtl1(config->ctl1 | UCSWRST); call Registers.assignBr0(config->brx & 0xff); call Registers.assignBr1(config->brx >> 8); - call Registers.assignMctl(config->mctl); - call Registers.assignIrtctl(config->irtctl); - call Registers.assignIrrctl(config->irrctl); - call Registers.assignAbctl(config->abctl); + call Registers.assignMctl(config->mctl); /* ??? */ call Registers.clrStat(UCLISTEN); /* Save pin IO states */ diff --git a/tos/chips/msp430/usci/Msp430UartP.nc b/tos/chips/msp430/usci/Msp430UartP.nc index 49dc1f1b..ce31d9ce 100644 --- a/tos/chips/msp430/usci/Msp430UartP.nc +++ b/tos/chips/msp430/usci/Msp430UartP.nc @@ -95,8 +95,8 @@ implementation { call Registers.setCtl1(UCSWRST); /* Configure USCI registers */ - call Registers.assignCtl0(config->ctl0); - call Registers.assignCtl1(config->ctl1|UCSWRST); + call Registers.assignCtl0(config->ctl0 & ~UCSYNC); + call Registers.assignCtl1(config->ctl1 | UCSWRST); call Registers.assignBr0(config->brx & 0xff); call Registers.assignBr1(config->brx >> 8); call Registers.assignMctl(config->mctl); diff --git a/tos/chips/msp430/usci/Msp430Usci.h b/tos/chips/msp430/usci/Msp430Usci.h index 94ca476c..50a0ca72 100644 --- a/tos/chips/msp430/usci/Msp430Usci.h +++ b/tos/chips/msp430/usci/Msp430Usci.h @@ -76,6 +76,8 @@ typedef enum { */ 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_19200=54, UMCTL_1MHZ_19200=(0 << 4) + (5 << 1) + 0, + UBRX_1MHZ_38400=27, UMCTL_1MHZ_38400=(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, diff --git a/tos/platforms/shimmer/.platform b/tos/platforms/shimmer/.platform index 8ea49534..310bbb72 100644 --- a/tos/platforms/shimmer/.platform +++ b/tos/platforms/shimmer/.platform @@ -27,6 +27,7 @@ push( @includes, qw( %T/chips/cc2420/unique %T/chips/msp430 %T/chips/msp430/adc12 + %T/chips/msp430/clock %T/chips/msp430/dma %T/chips/msp430/pins %T/chips/msp430/timer @@ -72,4 +73,4 @@ $ENV{'CIL_MACHINE'} = "big_endian=false " . "underscore_name=false " . "__builtin_va_list=true " . - "__thread_is_keyword=true"; \ No newline at end of file + "__thread_is_keyword=true"; diff --git a/tos/platforms/telosa/.platform b/tos/platforms/telosa/.platform index dc6d34bd..00f9de94 100644 --- a/tos/platforms/telosa/.platform +++ b/tos/platforms/telosa/.platform @@ -27,6 +27,7 @@ push( @includes, qw( %T/chips/at45db %T/chips/msp430 %T/chips/msp430/adc12 + %T/chips/msp430/clock %T/chips/msp430/pins %T/chips/msp430/timer %T/chips/msp430/usart @@ -75,4 +76,4 @@ $ENV{'CIL_MACHINE'} = "underscore_name=false " . "__builtin_va_list=true " . "__thread_is_keyword=true"; - \ No newline at end of file + diff --git a/tos/platforms/telosb/.platform b/tos/platforms/telosb/.platform index 5fab8f26..816de3fd 100644 --- a/tos/platforms/telosb/.platform +++ b/tos/platforms/telosb/.platform @@ -26,6 +26,7 @@ push( @includes, qw( %T/chips/cc2420/transmit %T/chips/cc2420/unique %T/chips/msp430 + %T/chips/msp430/clock %T/chips/msp430/adc12 %T/chips/msp430/dma %T/chips/msp430/pins diff --git a/tos/platforms/tinynode/.platform b/tos/platforms/tinynode/.platform index 818c7a83..a6050ac4 100644 --- a/tos/platforms/tinynode/.platform +++ b/tos/platforms/tinynode/.platform @@ -19,6 +19,7 @@ push( @includes, qw( %T/chips/msp430 %T/chips/msp430/adc12 + %T/chips/msp430/clock %T/chips/msp430/dma %T/chips/msp430/pins %T/chips/msp430/timer diff --git a/tos/platforms/tmicore/.platform b/tos/platforms/tmicore/.platform index 97022c58..3cd16861 100755 --- a/tos/platforms/tmicore/.platform +++ b/tos/platforms/tmicore/.platform @@ -8,6 +8,8 @@ push( @includes, qw( %T/platforms/telosa %T/chips/msp430 %T/chips/msp430/adc12 + %T/chips/msp430/clock2 + %T/chips/msp430/clock %T/chips/msp430/dma %T/chips/msp430/pins %T/chips/msp430/timer -- 2.39.2