From: klueska Date: Thu, 15 May 2008 23:57:13 +0000 (+0000) Subject: Reverting back to decentralized handling of interrupts on the msp430. Centralizing... X-Git-Tag: release_tinyos_2_1_0_0~404 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=16188bae3116336995dd219b272b27df9c255411 Reverting back to decentralized handling of interrupts on the msp430. Centralizing them has the side effect of forcing all interrupt handlers to be included regardless of whether the component that actually DEPENDS on it is included or not. Leads to unnecessary code bloat. Original motivation for centralizing them in the first place was in anticipation of adding tosthreads in the upcoming release. A better way of supporting them without the need for centralized interrupt handlers was found, hence the rollback. --- diff --git a/tos/chips/msp430/adc12/HplAdc12P.nc b/tos/chips/msp430/adc12/HplAdc12P.nc index 6243739d..aaee9ce5 100644 --- a/tos/chips/msp430/adc12/HplAdc12P.nc +++ b/tos/chips/msp430/adc12/HplAdc12P.nc @@ -44,7 +44,6 @@ module HplAdc12P { provides interface HplAdc12; - uses interface HplMsp430InterruptSig as SIGNAL_ADC_VECTOR; } implementation { @@ -119,7 +118,7 @@ implementation async command bool HplAdc12.isBusy(){ return ADC12CTL1 & ADC12BUSY; } - inline async event void SIGNAL_ADC_VECTOR.fired() { + TOSH_SIGNAL(ADC_VECTOR) { signal HplAdc12.conversionDone(ADC12IV); } } diff --git a/tos/chips/msp430/adc12/Msp430Adc12P.nc b/tos/chips/msp430/adc12/Msp430Adc12P.nc index bd3c9465..e662eea5 100644 --- a/tos/chips/msp430/adc12/Msp430Adc12P.nc +++ b/tos/chips/msp430/adc12/Msp430Adc12P.nc @@ -77,8 +77,5 @@ configuration Msp430Adc12P Msp430Adc12ImplP.CompareA0 -> Msp430TimerC.CompareA0; Msp430Adc12ImplP.CompareA1 -> Msp430TimerC.CompareA1; #endif - - components HplMsp430InterruptSigP; - HplAdc12P.SIGNAL_ADC_VECTOR -> HplMsp430InterruptSigP.SIGNAL_ADC_VECTOR; } diff --git a/tos/chips/msp430/dma/HplMsp430DmaC.nc b/tos/chips/msp430/dma/HplMsp430DmaC.nc index b6869f16..259d81a9 100644 --- a/tos/chips/msp430/dma/HplMsp430DmaC.nc +++ b/tos/chips/msp430/dma/HplMsp430DmaC.nc @@ -85,9 +85,6 @@ implementation { Dma0.Interrupt -> HplMsp430DmaP; Dma1.Interrupt -> HplMsp430DmaP; Dma2.Interrupt -> HplMsp430DmaP; - - components HplMsp430InterruptSigP; - HplMsp430DmaP.SIGNAL_DACDMA_VECTOR -> HplMsp430InterruptSigP.SIGNAL_DACDMA_VECTOR; } diff --git a/tos/chips/msp430/dma/HplMsp430DmaP.nc b/tos/chips/msp430/dma/HplMsp430DmaP.nc index 69f49dc0..6b581606 100644 --- a/tos/chips/msp430/dma/HplMsp430DmaP.nc +++ b/tos/chips/msp430/dma/HplMsp430DmaP.nc @@ -61,7 +61,7 @@ module HplMsp430DmaP { provides interface HplMsp430DmaControl as DmaControl; provides interface HplMsp430DmaInterrupt as Interrupt; - uses interface HplMsp430InterruptSig as SIGNAL_DACDMA_VECTOR; + } implementation { @@ -69,7 +69,7 @@ implementation { MSP430REG_NORACE( DMACTL0 ); MSP430REG_NORACE( DMACTL1 ); - inline async event void SIGNAL_DACDMA_VECTOR.fired() { + TOSH_SIGNAL( DACDMA_VECTOR ) { signal Interrupt.fired(); } diff --git a/tos/chips/msp430/pins/HplMsp430InterruptC.nc b/tos/chips/msp430/pins/HplMsp430InterruptC.nc index 3cb8163e..50ec746a 100644 --- a/tos/chips/msp430/pins/HplMsp430InterruptC.nc +++ b/tos/chips/msp430/pins/HplMsp430InterruptC.nc @@ -51,7 +51,6 @@ configuration HplMsp430InterruptC implementation { components HplMsp430InterruptP as HplInterruptP; - components HplMsp430InterruptSigP; #ifdef __msp430_have_port1 Port10 = HplInterruptP.Port10; Port11 = HplInterruptP.Port11; @@ -61,7 +60,6 @@ implementation Port15 = HplInterruptP.Port15; Port16 = HplInterruptP.Port16; Port17 = HplInterruptP.Port17; - HplInterruptP.SIGNAL_PORT1_VECTOR -> HplMsp430InterruptSigP.SIGNAL_PORT1_VECTOR; #endif #ifdef __msp430_have_port2 Port20 = HplInterruptP.Port20; @@ -72,6 +70,5 @@ implementation Port25 = HplInterruptP.Port25; Port26 = HplInterruptP.Port26; Port27 = HplInterruptP.Port27; - HplInterruptP.SIGNAL_PORT2_VECTOR -> HplMsp430InterruptSigP.SIGNAL_PORT2_VECTOR; #endif } diff --git a/tos/chips/msp430/pins/HplMsp430InterruptNMIC.nc b/tos/chips/msp430/pins/HplMsp430InterruptNMIC.nc index b4d71b6b..0acdbbb0 100644 --- a/tos/chips/msp430/pins/HplMsp430InterruptNMIC.nc +++ b/tos/chips/msp430/pins/HplMsp430InterruptNMIC.nc @@ -38,7 +38,4 @@ implementation NMI = HplInterruptP.NMI; OF = HplInterruptP.OF; ACCV = HplInterruptP.ACCV; - - components HplMsp430InterruptSigP; - HplInterruptP.SIGNAL_NMI_VECTOR -> HplMsp430InterruptSigP.SIGNAL_NMI_VECTOR; } diff --git a/tos/chips/msp430/pins/HplMsp430InterruptNMIP.nc b/tos/chips/msp430/pins/HplMsp430InterruptNMIP.nc index 97b945b2..1942ff24 100644 --- a/tos/chips/msp430/pins/HplMsp430InterruptNMIP.nc +++ b/tos/chips/msp430/pins/HplMsp430InterruptNMIP.nc @@ -27,11 +27,10 @@ module HplMsp430InterruptNMIP provides interface HplMsp430Interrupt as NMI; provides interface HplMsp430Interrupt as OF; provides interface HplMsp430Interrupt as ACCV; - uses interface HplMsp430InterruptSig as SIGNAL_NMI_VECTOR; } implementation { - inline async event void SIGNAL_NMI_VECTOR.fired() + TOSH_SIGNAL(NMI_VECTOR) { volatile int n = IFG1; if (n & NMIIFG) { signal NMI.fired(); return; } diff --git a/tos/chips/msp430/pins/HplMsp430InterruptP.nc b/tos/chips/msp430/pins/HplMsp430InterruptP.nc index 4c8d8990..9b1b1f21 100644 --- a/tos/chips/msp430/pins/HplMsp430InterruptP.nc +++ b/tos/chips/msp430/pins/HplMsp430InterruptP.nc @@ -33,7 +33,6 @@ module HplMsp430InterruptP provides interface HplMsp430Interrupt as Port15; provides interface HplMsp430Interrupt as Port16; provides interface HplMsp430Interrupt as Port17; - uses interface HplMsp430InterruptSig as SIGNAL_PORT1_VECTOR; #endif #ifdef __msp430_have_port2 provides interface HplMsp430Interrupt as Port20; @@ -44,7 +43,6 @@ module HplMsp430InterruptP provides interface HplMsp430Interrupt as Port25; provides interface HplMsp430Interrupt as Port26; provides interface HplMsp430Interrupt as Port27; - uses interface HplMsp430InterruptSig as SIGNAL_PORT2_VECTOR; #endif } @@ -52,7 +50,7 @@ implementation { #ifdef __msp430_have_port1 - inline async event void SIGNAL_PORT1_VECTOR.fired() + TOSH_SIGNAL(PORT1_VECTOR) { volatile int n = P1IFG & P1IE; @@ -157,7 +155,7 @@ implementation #endif #ifdef __msp430_have_port2 - inline async event void SIGNAL_PORT2_VECTOR.fired() + TOSH_SIGNAL(PORT2_VECTOR) { volatile int n = P2IFG & P2IE; diff --git a/tos/chips/msp430/pins/HplMsp430InterruptSig.nc b/tos/chips/msp430/pins/HplMsp430InterruptSig.nc deleted file mode 100644 index e9c29fb2..00000000 --- a/tos/chips/msp430/pins/HplMsp430InterruptSig.nc +++ /dev/null @@ -1,44 +0,0 @@ -/// $Id$ - -/* - * Copyright (c) 2004-2005 Crossbow Technology, Inc. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written - * agreement is hereby granted, provided that the above copyright - * notice, the (updated) modification history and the author appear in - * all copies of this source code. - * - * Permission is also granted to distribute this software under the - * standard BSD license as contained in the TinyOS distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, - * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * Interface to an Msp430 external interrupt pin that exposes just the - * interrupt vector routine for easy linking to generic components (see - * Msp430InterruptSigP for the full interface). - * - * @author Martin Turon - * @author Kevin Klues - * @see Msp430InterruptSigP - */ -interface HplMsp430InterruptSig -{ - /** - * Signalled when an interrupt occurs on a pin - */ - inline async event void fired(); -} - diff --git a/tos/chips/msp430/pins/HplMsp430InterruptSigP.nc b/tos/chips/msp430/pins/HplMsp430InterruptSigP.nc deleted file mode 100644 index 408ab9bd..00000000 --- a/tos/chips/msp430/pins/HplMsp430InterruptSigP.nc +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2008 Stanford University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - Neither the name of the Stanford University nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD - * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @author Kevin Klues - */ - -module HplMsp430InterruptSigP -{ - provides { - interface HplMsp430InterruptSig as SIGNAL_ADC_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_DACDMA_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_NMI_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_PORT1_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_PORT2_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_TIMERA0_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_TIMERA1_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_TIMERB0_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_TIMERB1_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_UART0RX_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_UART0TX_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_UART1RX_VECTOR; - interface HplMsp430InterruptSig as SIGNAL_UART1TX_VECTOR; - } -} -implementation { - #define MSP430_INTERRUPT_HANDLER(NAME) \ - default async event void SIGNAL_##NAME.fired() {} \ - TOSH_SIGNAL(NAME) { \ - signal SIGNAL_##NAME.fired(); \ - } - - MSP430_INTERRUPT_HANDLER(ADC_VECTOR) - MSP430_INTERRUPT_HANDLER(DACDMA_VECTOR) - MSP430_INTERRUPT_HANDLER(NMI_VECTOR) - MSP430_INTERRUPT_HANDLER(PORT1_VECTOR) - MSP430_INTERRUPT_HANDLER(PORT2_VECTOR) - MSP430_INTERRUPT_HANDLER(TIMERA0_VECTOR) - MSP430_INTERRUPT_HANDLER(TIMERA1_VECTOR) - MSP430_INTERRUPT_HANDLER(TIMERB0_VECTOR) - MSP430_INTERRUPT_HANDLER(TIMERB1_VECTOR) - MSP430_INTERRUPT_HANDLER(UART0RX_VECTOR) - MSP430_INTERRUPT_HANDLER(UART0TX_VECTOR) - MSP430_INTERRUPT_HANDLER(UART1RX_VECTOR) - MSP430_INTERRUPT_HANDLER(UART1TX_VECTOR) -} diff --git a/tos/chips/msp430/timer/Msp430TimerC.nc b/tos/chips/msp430/timer/Msp430TimerC.nc index e1d6a23f..65b23cd8 100644 --- a/tos/chips/msp430/timer/Msp430TimerC.nc +++ b/tos/chips/msp430/timer/Msp430TimerC.nc @@ -159,11 +159,5 @@ implementation CaptureB6 = Msp430TimerB6.Capture; Msp430TimerB6.Timer -> Msp430TimerB.Timer; Msp430TimerB6.Event -> Msp430TimerB.Event[6]; - - components HplMsp430InterruptSigP; - Common.SIGNAL_TIMERA0_VECTOR -> HplMsp430InterruptSigP.SIGNAL_TIMERA0_VECTOR; - Common.SIGNAL_TIMERA1_VECTOR -> HplMsp430InterruptSigP.SIGNAL_TIMERA1_VECTOR; - Common.SIGNAL_TIMERB0_VECTOR -> HplMsp430InterruptSigP.SIGNAL_TIMERB0_VECTOR; - Common.SIGNAL_TIMERB1_VECTOR -> HplMsp430InterruptSigP.SIGNAL_TIMERB1_VECTOR; } diff --git a/tos/chips/msp430/timer/Msp430TimerCommonP.nc b/tos/chips/msp430/timer/Msp430TimerCommonP.nc index 707ca7db..64c27704 100644 --- a/tos/chips/msp430/timer/Msp430TimerCommonP.nc +++ b/tos/chips/msp430/timer/Msp430TimerCommonP.nc @@ -1,44 +1,16 @@ -/* "Copyright (c) 2000-2003 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement - * is hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY - * OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - */ - -/** - * @author Cory Sharp - */ - module Msp430TimerCommonP { provides interface Msp430TimerEvent as VectorTimerA0; provides interface Msp430TimerEvent as VectorTimerA1; provides interface Msp430TimerEvent as VectorTimerB0; provides interface Msp430TimerEvent as VectorTimerB1; - uses interface HplMsp430InterruptSig as SIGNAL_TIMERA0_VECTOR; - uses interface HplMsp430InterruptSig as SIGNAL_TIMERA1_VECTOR; - uses interface HplMsp430InterruptSig as SIGNAL_TIMERB0_VECTOR; - uses interface HplMsp430InterruptSig as SIGNAL_TIMERB1_VECTOR; } implementation { - inline async event void SIGNAL_TIMERA0_VECTOR.fired() { signal VectorTimerA0.fired(); } - inline async event void SIGNAL_TIMERA1_VECTOR.fired() { signal VectorTimerA1.fired(); } - inline async event void SIGNAL_TIMERB0_VECTOR.fired() { signal VectorTimerB0.fired(); } - inline async event void SIGNAL_TIMERB1_VECTOR.fired() { signal VectorTimerB1.fired(); } + TOSH_SIGNAL(TIMERA0_VECTOR) { signal VectorTimerA0.fired(); } + TOSH_SIGNAL(TIMERA1_VECTOR) { signal VectorTimerA1.fired(); } + TOSH_SIGNAL(TIMERB0_VECTOR) { signal VectorTimerB0.fired(); } + TOSH_SIGNAL(TIMERB1_VECTOR) { signal VectorTimerB1.fired(); } } diff --git a/tos/chips/msp430/usart/HplMsp430Usart0C.nc b/tos/chips/msp430/usart/HplMsp430Usart0C.nc index 8c87accc..c1060df2 100644 --- a/tos/chips/msp430/usart/HplMsp430Usart0C.nc +++ b/tos/chips/msp430/usart/HplMsp430Usart0C.nc @@ -85,7 +85,4 @@ implementation { HplUsartP.URXD -> GIO.URXD0; HplUsartP.UTXD -> GIO.UTXD0; - components HplMsp430InterruptSigP; - HplUsartP.SIGNAL_UART0RX_VECTOR -> HplMsp430InterruptSigP.SIGNAL_UART0RX_VECTOR; - HplUsartP.SIGNAL_UART0TX_VECTOR -> HplMsp430InterruptSigP.SIGNAL_UART0TX_VECTOR; } diff --git a/tos/chips/msp430/usart/HplMsp430Usart0P.nc b/tos/chips/msp430/usart/HplMsp430Usart0P.nc index 228e2b14..cf618bfb 100644 --- a/tos/chips/msp430/usart/HplMsp430Usart0P.nc +++ b/tos/chips/msp430/usart/HplMsp430Usart0P.nc @@ -82,8 +82,6 @@ module HplMsp430Usart0P { uses interface HplMsp430GeneralIO as UCLK; uses interface HplMsp430GeneralIO as URXD; uses interface HplMsp430GeneralIO as UTXD; - uses interface HplMsp430InterruptSig as SIGNAL_UART0RX_VECTOR; - uses interface HplMsp430InterruptSig as SIGNAL_UART0TX_VECTOR; } implementation @@ -95,12 +93,12 @@ implementation MSP430REG_NORACE(U0RCTL); MSP430REG_NORACE(U0TXBUF); - inline async event void SIGNAL_UART0RX_VECTOR.fired() { + TOSH_SIGNAL(UART0RX_VECTOR) { uint8_t temp = U0RXBUF; signal Interrupts.rxDone(temp); } - inline async event void SIGNAL_UART0TX_VECTOR.fired() { + TOSH_SIGNAL(UART0TX_VECTOR) { if ( call HplI2C.isI2C() ) signal I2CInterrupts.fired(); else diff --git a/tos/chips/msp430/usart/HplMsp430Usart1C.nc b/tos/chips/msp430/usart/HplMsp430Usart1C.nc index aefd47f7..78b93232 100644 --- a/tos/chips/msp430/usart/HplMsp430Usart1C.nc +++ b/tos/chips/msp430/usart/HplMsp430Usart1C.nc @@ -85,8 +85,5 @@ implementation { HplUsartP.UCLK -> GIO.UCLK1; HplUsartP.URXD -> GIO.URXD1; HplUsartP.UTXD -> GIO.UTXD1; - - components HplMsp430InterruptSigP; - HplUsartP.SIGNAL_UART1RX_VECTOR -> HplMsp430InterruptSigP.SIGNAL_UART1RX_VECTOR; - HplUsartP.SIGNAL_UART1TX_VECTOR -> HplMsp430InterruptSigP.SIGNAL_UART1TX_VECTOR; + } diff --git a/tos/chips/msp430/usart/HplMsp430Usart1P.nc b/tos/chips/msp430/usart/HplMsp430Usart1P.nc index d35e9f50..d5a8a268 100644 --- a/tos/chips/msp430/usart/HplMsp430Usart1P.nc +++ b/tos/chips/msp430/usart/HplMsp430Usart1P.nc @@ -80,8 +80,6 @@ module HplMsp430Usart1P { uses interface HplMsp430GeneralIO as UCLK; uses interface HplMsp430GeneralIO as URXD; uses interface HplMsp430GeneralIO as UTXD; - uses interface HplMsp430InterruptSig as SIGNAL_UART1RX_VECTOR; - uses interface HplMsp430InterruptSig as SIGNAL_UART1TX_VECTOR; } implementation @@ -93,12 +91,14 @@ implementation MSP430REG_NORACE(U1RCTL); MSP430REG_NORACE(U1TXBUF); - inline async event void SIGNAL_UART1RX_VECTOR.fired() { + + + TOSH_SIGNAL(UART1RX_VECTOR) { uint8_t temp = U1RXBUF; signal Interrupts.rxDone(temp); } - inline async event void SIGNAL_UART1TX_VECTOR.fired() { + TOSH_SIGNAL(UART1TX_VECTOR) { signal Interrupts.txDone(); }