module HplAdc12P {
provides interface HplAdc12;
+ uses interface HplMsp430InterruptSig as SIGNAL_ADC_VECTOR;
}
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);
}
}
Msp430Adc12ImplP.CompareA0 -> Msp430TimerC.CompareA0;
Msp430Adc12ImplP.CompareA1 -> Msp430TimerC.CompareA1;
#endif
+
+ components HplMsp430InterruptSigP;
+ HplAdc12P.SIGNAL_ADC_VECTOR -> HplMsp430InterruptSigP.SIGNAL_ADC_VECTOR;
}
Dma0.Interrupt -> HplMsp430DmaP;
Dma1.Interrupt -> HplMsp430DmaP;
Dma2.Interrupt -> HplMsp430DmaP;
+
+ components HplMsp430InterruptSigP;
+ HplMsp430DmaP.SIGNAL_DACDMA_VECTOR -> HplMsp430InterruptSigP.SIGNAL_DACDMA_VECTOR;
}
provides interface HplMsp430DmaControl as DmaControl;
provides interface HplMsp430DmaInterrupt as Interrupt;
-
+ uses interface HplMsp430InterruptSig as SIGNAL_DACDMA_VECTOR;
}
implementation {
MSP430REG_NORACE( DMACTL0 );
MSP430REG_NORACE( DMACTL1 );
- TOSH_SIGNAL( DACDMA_VECTOR ) {
+ inline async event void SIGNAL_DACDMA_VECTOR.fired {
signal Interrupt.fired();
}
implementation
{
components HplMsp430InterruptP as HplInterruptP;
+ components HplMsp430InterruptSigP;
#ifdef __msp430_have_port1
Port10 = HplInterruptP.Port10;
Port11 = HplInterruptP.Port11;
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;
Port25 = HplInterruptP.Port25;
Port26 = HplInterruptP.Port26;
Port27 = HplInterruptP.Port27;
+ HplInterruptP.SIGNAL_PORT2_VECTOR -> HplMsp430InterruptSigP.SIGNAL_PORT2_VECTOR;
#endif
}
NMI = HplInterruptP.NMI;
OF = HplInterruptP.OF;
ACCV = HplInterruptP.ACCV;
+
+ components HplMsp430InterruptSigP;
+ HplInterruptP.SIGNAL_NMI_VECTOR -> HplMsp430InterruptSigP.SIGNAL_NMI_VECTOR;
}
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; }
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;
provides interface HplMsp430Interrupt as Port25;
provides interface HplMsp430Interrupt as Port26;
provides interface HplMsp430Interrupt as Port27;
+ uses interface HplMsp430InterruptSig as SIGNAL_PORT2_VECTOR;
#endif
}
{
#ifdef __msp430_have_port1
- TOSH_SIGNAL(PORT1_VECTOR)
+ inline async event void SIGNAL_PORT1_VECTOR.fired()
{
volatile int n = P1IFG & P1IE;
#endif
#ifdef __msp430_have_port2
- TOSH_SIGNAL(PORT2_VECTOR)
+ inline async event void SIGNAL_PORT2_VECTOR.fired()
{
volatile int n = P2IFG & P2IE;
--- /dev/null
+/// $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();
+}
+
--- /dev/null
+/*
+ * 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)
+}
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;
}
+/* "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(); }
}
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;
}
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
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
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;
}
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
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();
}