]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Update to centralize inside one module where all interrupt handlers are signaled...
authorklueska <klueska>
Thu, 17 Apr 2008 22:38:34 +0000 (22:38 +0000)
committerklueska <klueska>
Thu, 17 Apr 2008 22:38:34 +0000 (22:38 +0000)
16 files changed:
tos/chips/msp430/adc12/HplAdc12P.nc
tos/chips/msp430/adc12/Msp430Adc12P.nc
tos/chips/msp430/dma/HplMsp430DmaC.nc
tos/chips/msp430/dma/HplMsp430DmaP.nc
tos/chips/msp430/pins/HplMsp430InterruptC.nc
tos/chips/msp430/pins/HplMsp430InterruptNMIC.nc
tos/chips/msp430/pins/HplMsp430InterruptNMIP.nc
tos/chips/msp430/pins/HplMsp430InterruptP.nc
tos/chips/msp430/pins/HplMsp430InterruptSig.nc [new file with mode: 0644]
tos/chips/msp430/pins/HplMsp430InterruptSigP.nc [new file with mode: 0644]
tos/chips/msp430/timer/Msp430TimerC.nc
tos/chips/msp430/timer/Msp430TimerCommonP.nc
tos/chips/msp430/usart/HplMsp430Usart0C.nc
tos/chips/msp430/usart/HplMsp430Usart0P.nc
tos/chips/msp430/usart/HplMsp430Usart1C.nc
tos/chips/msp430/usart/HplMsp430Usart1P.nc

index aaee9ce507e61846f7c65072b5226979c6a46382..6243739d775ca7628424a3a20dbafa77e7b5596e 100644 (file)
@@ -44,6 +44,7 @@
 
 module HplAdc12P {
   provides interface HplAdc12;
+  uses interface HplMsp430InterruptSig as SIGNAL_ADC_VECTOR;
 }
 implementation
 {
@@ -118,7 +119,7 @@ implementation
     
   async command bool HplAdc12.isBusy(){ return ADC12CTL1 & ADC12BUSY; }
 
-  TOSH_SIGNAL(ADC_VECTOR) {
+  inline async event void SIGNAL_ADC_VECTOR.fired() {
     signal HplAdc12.conversionDone(ADC12IV);
   }
 }
index e662eea537146704af97c4bcbb4096525191b8e1..bd3c9465c3ab8264ad13dadd684ed5ac186de383 100644 (file)
@@ -77,5 +77,8 @@ configuration Msp430Adc12P
   Msp430Adc12ImplP.CompareA0 -> Msp430TimerC.CompareA0;
   Msp430Adc12ImplP.CompareA1 -> Msp430TimerC.CompareA1;
 #endif
+
+  components HplMsp430InterruptSigP;
+  HplAdc12P.SIGNAL_ADC_VECTOR -> HplMsp430InterruptSigP.SIGNAL_ADC_VECTOR;
 }
 
index 259d81a9608f48afebf332038e2061ebfc529d5e..b6869f16e88cddf1032c6049aaf42f9145d80720 100644 (file)
@@ -85,6 +85,9 @@ implementation {
   Dma0.Interrupt -> HplMsp430DmaP;
   Dma1.Interrupt -> HplMsp430DmaP;
   Dma2.Interrupt -> HplMsp430DmaP;
+  
+  components HplMsp430InterruptSigP;
+  HplMsp430DmaP.SIGNAL_DACDMA_VECTOR -> HplMsp430InterruptSigP.SIGNAL_DACDMA_VECTOR;
 
 }
 
index 6b58160659503bac4acd74120a7c01e30e249813..4d8a6b6fbd2e9729160f1d58d9920574769b12d0 100644 (file)
@@ -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 );
 
-  TOSH_SIGNAL( DACDMA_VECTOR ) {
+  inline async event void SIGNAL_DACDMA_VECTOR.fired {
     signal Interrupt.fired();
   }
 
index 50ec746aebead97ed44903f6a3c5672fb79e0fe2..3cb8163e067291d5f81823fd77cfd44f8b63c822 100644 (file)
@@ -51,6 +51,7 @@ configuration HplMsp430InterruptC
 implementation
 {
   components HplMsp430InterruptP as HplInterruptP;
+  components HplMsp430InterruptSigP;
 #ifdef __msp430_have_port1
   Port10 = HplInterruptP.Port10;
   Port11 = HplInterruptP.Port11;
@@ -60,6 +61,7 @@ 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;
@@ -70,5 +72,6 @@ implementation
   Port25 = HplInterruptP.Port25;
   Port26 = HplInterruptP.Port26;
   Port27 = HplInterruptP.Port27;
+  HplInterruptP.SIGNAL_PORT2_VECTOR -> HplMsp430InterruptSigP.SIGNAL_PORT2_VECTOR;
 #endif
 }
index 0acdbbb0ec8897518bee61866188142d9137d204..b4d71b6bfd4ecdaf0501d233098fa10f717cca5f 100644 (file)
@@ -38,4 +38,7 @@ implementation
   NMI = HplInterruptP.NMI;
   OF = HplInterruptP.OF;
   ACCV = HplInterruptP.ACCV;
+  
+  components HplMsp430InterruptSigP;
+  HplInterruptP.SIGNAL_NMI_VECTOR -> HplMsp430InterruptSigP.SIGNAL_NMI_VECTOR;
 }
index 1942ff24204eb2c6439410d20319da5fac7072d5..97b945b2be82667805510cffff0eac383de8f615 100644 (file)
@@ -27,10 +27,11 @@ 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
 {
-  TOSH_SIGNAL(NMI_VECTOR)
+  inline async event void SIGNAL_NMI_VECTOR.fired() 
   {
     volatile int n = IFG1;
     if (n & NMIIFG) { signal NMI.fired(); return; }
index 9b1b1f2194f11621c54a0228b1c7ecb98a21b74e..4c8d899062e9ff0111b84e34b7cc7a2be684b695 100644 (file)
@@ -33,6 +33,7 @@ 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;
@@ -43,6 +44,7 @@ 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
 
 }
@@ -50,7 +52,7 @@ implementation
 {
 
 #ifdef __msp430_have_port1
-  TOSH_SIGNAL(PORT1_VECTOR)
+  inline async event void SIGNAL_PORT1_VECTOR.fired()
   {
     volatile int n = P1IFG & P1IE;
 
@@ -155,7 +157,7 @@ implementation
 #endif
 
 #ifdef __msp430_have_port2
-  TOSH_SIGNAL(PORT2_VECTOR)
+  inline async event void SIGNAL_PORT2_VECTOR.fired()
   {
     volatile int n = P2IFG & P2IE;
 
diff --git a/tos/chips/msp430/pins/HplMsp430InterruptSig.nc b/tos/chips/msp430/pins/HplMsp430InterruptSig.nc
new file mode 100644 (file)
index 0000000..e9c29fb
--- /dev/null
@@ -0,0 +1,44 @@
+/// $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 <mturon@xbow.com>
+ * @author Kevin Klues <klueska@cs.stanford.edu>
+ * @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
new file mode 100644 (file)
index 0000000..408ab9b
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * 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 <klueska@cs.stanford.edu>
+ */
+
+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)
+}
index 65b23cd8dfa39ae51f4ce729cdf087d218732951..e1d6a23f1656773ecf59d0fd98e3b518acb0b8f1 100644 (file)
@@ -159,5 +159,11 @@ 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;
 }
 
index 64c27704f1127abfc0fd29fdc966bbc365b4853c..707ca7dbc088d80755acba0d729763cb5a87e2a1 100644 (file)
@@ -1,16 +1,44 @@
 
+/* "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 <cssharp@eecs.berkeley.edu>
+ */
 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
 {
-  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(); }
+  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(); }
 }
 
index c1060df216c397c0b461a8dd7e8907ec6e436807..8c87accc68b6d517f6289bd89e00ce976ff2d53b 100644 (file)
@@ -85,4 +85,7 @@ 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;
 }
index cf618bfbbdba8cc75855497c1102b256380c6293..228e2b14e85c823081bba0414e9c8a4f77b5ee8b 100644 (file)
@@ -82,6 +82,8 @@ 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
@@ -93,12 +95,12 @@ implementation
   MSP430REG_NORACE(U0RCTL);
   MSP430REG_NORACE(U0TXBUF);
   
-  TOSH_SIGNAL(UART0RX_VECTOR) {
+  inline async event void SIGNAL_UART0RX_VECTOR.fired() {
     uint8_t temp = U0RXBUF;
     signal Interrupts.rxDone(temp);
   }
   
-  TOSH_SIGNAL(UART0TX_VECTOR) {
+  inline async event void SIGNAL_UART0TX_VECTOR.fired() {
     if ( call HplI2C.isI2C() )
       signal I2CInterrupts.fired();
     else
index 78b932324460332afdd5dd45bf76fff34f74ce91..aefd47f7131aeb7972cbc7794adf2701c4c9a127 100644 (file)
@@ -85,5 +85,8 @@ 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;
 }
index d5a8a268b54080e3a95b2a97463a84d77c51ee26..d35e9f502762bc173eceaaaf9a1a7300beb5fc4a 100644 (file)
@@ -80,6 +80,8 @@ 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
@@ -91,14 +93,12 @@ implementation
   MSP430REG_NORACE(U1RCTL);
   MSP430REG_NORACE(U1TXBUF);
 
-
-
-  TOSH_SIGNAL(UART1RX_VECTOR) {
+  inline async event void SIGNAL_UART1RX_VECTOR.fired() {
     uint8_t temp = U1RXBUF;
     signal Interrupts.rxDone(temp);
   }
 
-  TOSH_SIGNAL(UART1TX_VECTOR) {
+  inline async event void SIGNAL_UART1TX_VECTOR.fired() {
     signal Interrupts.txDone();
   }