[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/msp430/dma
HplMsp430DmaC.nc, NONE, 1.1.4.2 HplMsp430DmaChannel.nc, NONE,
1.1.4.2 HplMsp430DmaControl.nc, NONE,
1.1.4.2 HplMsp430DmaInterrupt.nc, NONE,
1.1.4.2 HplMsp430DmaP.nc, NONE, 1.1.4.2 HplMsp430DmaXP.nc,
NONE, 1.1.4.2 Msp430Dma.h, NONE, 1.1.4.2 Msp430DmaC.nc, NONE,
1.1.4.2 Msp430DmaChannel.nc, NONE,
1.1.4.2 Msp430DmaChannelP.nc, NONE,
1.1.4.2 Msp430DmaControl.nc, NONE,
1.1.4.2 Msp430DmaControlP.nc, NONE, 1.1.4.2
Kevin Klues
klueska at users.sourceforge.net
Mon May 15 11:35:33 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/java/net/tinyos/sim
LinkLayerModel.java, NONE, 1.1.4.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/xe1205 XE1205.h, NONE,
1.1.4.2 XE1205ActiveMessageC.nc, NONE,
1.1.4.2 XE1205ActiveMessageP.nc, NONE, 1.1.4.2 XE1205Fifo.nc,
NONE, 1.1.4.2 XE1205PacketC.nc, NONE,
1.1.4.2 XE1205SendReceiveC.nc, NONE,
1.1.4.2 XE1205SendReceiveP.nc, NONE, 1.1.4.2 XE1205SpiC.nc,
NONE, 1.1.4.2 XE1205SpiImplP.nc, NONE, 1.1.4.2 XE1205SpiP.nc,
NONE, 1.1.4.2 crc.h, NONE, 1.1.4.2 xe1205debug.h, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/dma
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18756/tos/chips/msp430/dma
Added Files:
Tag: tos-2-resource-pm-eval-cand
HplMsp430DmaC.nc HplMsp430DmaChannel.nc HplMsp430DmaControl.nc
HplMsp430DmaInterrupt.nc HplMsp430DmaP.nc HplMsp430DmaXP.nc
Msp430Dma.h Msp430DmaC.nc Msp430DmaChannel.nc
Msp430DmaChannelP.nc Msp430DmaControl.nc Msp430DmaControlP.nc
Log Message:
Merging the development branch with the resource/power management evaluation branch. After this merge all files except those already commited should be identical.
--- NEW FILE: HplMsp430DmaC.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
configuration HplMsp430DmaC {
provides interface HplMsp430DmaControl as Control;
provides interface HplMsp430DmaChannel as Channel0;
provides interface HplMsp430DmaChannel as Channel1;
provides interface HplMsp430DmaChannel as Channel2;
}
implementation {
components HplMsp430DmaP;
components new HplMsp430DmaXP( DMA0CTL_, DMA0SA_, DMA0DA_,
DMA0SZ_, DMA0TSEL_MASK,
DMA0TSEL_SHIFT ) as Dma0;
components new HplMsp430DmaXP( DMA1CTL_, DMA1SA_, DMA1DA_,
DMA1SZ_, DMA1TSEL_MASK,
DMA1TSEL_SHIFT ) as Dma1;
components new HplMsp430DmaXP( DMA2CTL_, DMA2SA_, DMA2DA_,
DMA2SZ_, DMA2TSEL_MASK,
DMA2TSEL_SHIFT ) as Dma2;
Control = HplMsp430DmaP;
Channel0 = Dma0;
Channel1 = Dma1;
Channel2 = Dma2;
Dma0.Interrupt -> HplMsp430DmaP;
Dma1.Interrupt -> HplMsp430DmaP;
Dma2.Interrupt -> HplMsp430DmaP;
}
--- NEW FILE: HplMsp430DmaChannel.nc ---
//$Id: HplMsp430DmaChannel.nc,v 1.1.4.2 2006/05/15 18:35:31 klueska Exp $
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
interface HplMsp430DmaChannel {
async command error_t setTrigger(dma_trigger_t trigger);
async command void clearTrigger();
async command void setSingleMode();
async command void setBlockMode();
async command void setBurstMode();
async command void setRepeatedSingleMode();
async command void setRepeatedBlockMode();
async command void setRepeatedBurstMode();
async command void setSrcNoIncrement();
async command void setSrcDecrement();
async command void setSrcIncrement();
async command void setDstNoIncrement();
async command void setDstDecrement();
async command void setDstIncrement();
async command void setWordToWord();
async command void setByteToWord();
async command void setWordToByte();
async command void setByteToByte();
async command void setEdgeSensitive();
async command void setLevelSensitive();
async command void enableDMA();
async command void disableDMA();
async command void enableInterrupt() ;
async command void disableInterrupt() ;
async command bool interruptPending();
async command bool aborted();
async command void triggerDMA();
async command void setSrc(void *saddr);
async command void setDst(void *daddr);
async command void setSize(uint16_t sz);
async command void setState(dma_channel_state_t s, dma_channel_trigger_t t, void* src, void* dest, uint16_t size);
async command void setStateRaw(uint16_t state, uint16_t trigger, void* src, void* dest, uint16_t size);
async command dma_channel_state_t getState();
async command void* getSource();
async command void* getDestination();
async command uint16_t getSize();
async command dma_channel_trigger_t getTrigger();
async command void reset();
async event void transferDone(error_t success);
}
--- NEW FILE: HplMsp430DmaControl.nc ---
//$Id: HplMsp430DmaControl.nc,v 1.1.4.2 2006/05/15 18:35:31 klueska Exp $
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#include "Msp430Dma.h"
interface HplMsp430DmaControl {
async command void setOnFetch();
async command void clearOnFetch();
async command void setRoundRobin();
async command void clearRoundRobin();
async command void setENNMI();
async command void clearENNMI();
async command void setState(dma_state_t s);
async command dma_state_t getState();
async command void reset();
}
--- NEW FILE: HplMsp430DmaInterrupt.nc ---
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
interface HplMsp430DmaInterrupt {
async event void fired();
}
--- NEW FILE: HplMsp430DmaP.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
module HplMsp430DmaP {
provides interface HplMsp430DmaControl as DmaControl;
provides interface HplMsp430DmaInterrupt as Interrupt;
}
implementation {
MSP430REG_NORACE( DMACTL0 );
MSP430REG_NORACE( DMACTL1 );
TOSH_SIGNAL( DACDMA_VECTOR ) {
signal Interrupt.fired();
}
async command void DmaControl.setOnFetch(){
DMACTL1 |= DMAONFETCH;
}
async command void DmaControl.clearOnFetch(){
DMACTL1 &= ~DMAONFETCH;
}
async command void DmaControl.setRoundRobin(){
DMACTL1 |= ROUNDROBIN;
}
async command void DmaControl.clearRoundRobin(){
DMACTL1 &= ~ROUNDROBIN;
}
async command void DmaControl.setENNMI(){
DMACTL1 |= ENNMI;
}
async command void DmaControl.clearENNMI(){
DMACTL1 &= ~ENNMI;
}
async command void DmaControl.setState(dma_state_t s){
DMACTL1 = *(int*)&s;
}
async command dma_state_t DmaControl.getState(){
dma_state_t s;
s = *(dma_state_t*)&DMACTL1;
return s;
}
async command void DmaControl.reset(){
DMACTL0 = 0;
DMACTL1 = 0;
}
}
--- NEW FILE: HplMsp430DmaXP.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
generic module HplMsp430DmaXP( uint16_t DMAxCTL_addr,
uint16_t DMAxSA_addr,
uint16_t DMAxDA_addr,
uint16_t DMAxSZ_addr,
uint16_t DMAxTSEL_mask,
uint16_t DMAxTSEL_shift ) {
provides interface HplMsp430DmaChannel as DMA;
uses interface HplMsp430DmaInterrupt as Interrupt;
}
implementation {
MSP430REG_NORACE( DMACTL0 );
#define DMAxCTL (*(volatile TYPE_DMA0CTL*)DMAxCTL_addr)
#define DMAxSA (*(volatile TYPE_DMA0SA*)DMAxSA_addr)
#define DMAxDA (*(volatile TYPE_DMA0DA*)DMAxDA_addr)
#define DMAxSZ (*(volatile TYPE_DMA0SZ*)DMAxSZ_addr)
async event void Interrupt.fired() {
error_t error = ( DMAxCTL & DMAABORT ) ? FAIL : SUCCESS;
if ( DMAxCTL & DMAIFG ) {
DMAxCTL &= ~DMAIFG;
DMAxCTL &= ~DMAABORT;
signal DMA.transferDone( error );
}
}
async error_t command DMA.setTrigger( dma_trigger_t trigger ) {
if ( DMAxCTL & DMAEN )
return FAIL;
DMACTL0 = ( ( DMACTL0 & ~DMAxTSEL_mask ) |
( ( trigger << DMAxTSEL_shift ) & DMAxTSEL_mask ) );
return SUCCESS;
}
async command void DMA.clearTrigger() {
DMACTL0 &= ~DMAxTSEL_mask;
}
async command void DMA.setSingleMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
}
async command void DMA.setBlockMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
DMAxCTL |= DMADT0;
}
async command void DMA.setBurstMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
DMAxCTL |= DMADT1;
}
async command void DMA.setRepeatedSingleMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
DMAxCTL |= DMADT2;
}
async command void DMA.setRepeatedBlockMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
DMAxCTL |= ( DMADT2 | DMADT0 );
}
async command void DMA.setRepeatedBurstMode() {
DMAxCTL &= ~( DMADT0 | DMADT1 | DMADT2 );
DMAxCTL |= ( DMADT2 | DMADT1 );
}
async command void DMA.setSrcNoIncrement() {
DMAxCTL &= ~( DMASRCINCR0 | DMASRCINCR1 );
}
async command void DMA.setSrcDecrement() {
DMAxCTL |= DMASRCINCR1;
}
async command void DMA.setSrcIncrement() {
DMAxCTL |= ( DMASRCINCR0 | DMASRCINCR1 );
}
async command void DMA.setDstNoIncrement() {
DMAxCTL &= ~( DMADSTINCR0 | DMADSTINCR1 );
}
async command void DMA.setDstDecrement() {
DMAxCTL |= DMADSTINCR1;
}
async command void DMA.setDstIncrement() {
DMAxCTL |= ( DMADSTINCR0 | DMADSTINCR1 );
}
async command void DMA.setWordToWord() {
DMAxCTL &= ~(DMASRCBYTE | DMADSTBYTE);
DMAxCTL |= DMASWDW;
}
async command void DMA.setByteToWord() {
DMAxCTL &= ~(DMASRCBYTE | DMADSTBYTE);
DMAxCTL |= DMASBDW;
}
async command void DMA.setWordToByte() {
DMAxCTL &= ~(DMASRCBYTE | DMADSTBYTE);
DMAxCTL |= DMASWDB;
}
async command void DMA.setByteToByte() {
DMAxCTL &= ~(DMASRCBYTE | DMADSTBYTE);
DMAxCTL |= DMASBDB;
}
async command void DMA.setEdgeSensitive() {
DMAxCTL &= ~DMALEVEL;
}
async command void DMA.setLevelSensitive() {
DMAxCTL |= DMALEVEL;
}
async command void DMA.enableDMA() {
DMAxCTL |= DMAEN;
}
async command void DMA.disableDMA() {
DMAxCTL &= ~DMAEN;
}
async command void DMA.enableInterrupt() {
DMAxCTL |= DMAIE;
}
async command void DMA.disableInterrupt() {
DMAxCTL &= ~DMAIE;
}
async command bool DMA.interruptPending() {
return !!( DMAxCTL & DMAIFG );
}
async command bool DMA.aborted() {
return !!( DMAxCTL & DMAABORT );
}
async command void DMA.triggerDMA() {
DMAxCTL |= DMAREQ;
}
async command void DMA.setSrc( void *saddr ) {
DMAxSA = (uint16_t)saddr;
}
async command void DMA.setDst( void *daddr ) {
DMAxDA = (uint16_t)daddr;
}
async command void DMA.setSize( uint16_t sz ) {
DMAxSZ = sz;
}
async command void DMA.setState( dma_channel_state_t s,
dma_channel_trigger_t t,
void* src, void* dest,
uint16_t size ) {
call DMA.setStateRaw( *(uint16_t*)&s, *(uint16_t*)&t,
src, dest, size);
}
async command void DMA.setStateRaw( uint16_t s, uint16_t t,
void* src, void* dest,
uint16_t size ) {
DMAxSA = (uint16_t)src;
DMAxDA = (uint16_t)dest;
DMAxSZ = size;
DMACTL0 = ( DMACTL0 & ~DMAxTSEL_mask ) | ( t << DMAxTSEL_shift );
DMAxCTL = s;
}
async command dma_channel_state_t DMA.getState() {
dma_channel_state_t s = *(dma_channel_state_t*) &DMAxCTL;
return s;
}
async command void* DMA.getSource() {
return (void*)DMAxSA;
}
async command void* DMA.getDestination() {
return (void*)DMAxDA;
}
async command uint16_t DMA.getSize() {
return DMAxSZ;
}
async command dma_channel_trigger_t DMA.getTrigger() {
dma_channel_trigger_t t;
t.trigger = ( DMACTL0 & DMAxTSEL_mask ) >> DMAxTSEL_shift;
return t;
}
async command void DMA.reset() {
DMAxCTL = 0;
DMAxSA = 0;
DMAxDA = 0;
DMAxSZ = 0;
}
}
--- NEW FILE: Msp430Dma.h ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#ifndef MSP430DMA_H
#define MSP430DMA_H
enum {
DMA_CHANNELS = 3
};
enum {
DMA_CHANNEL0 = 0,
DMA_CHANNEL1 = 1,
DMA_CHANNEL2 = 2,
DMA_CHANNEL_UNKNOWN = 3
};
enum {
DMA_CHANNEL_AVAILABLE = 0,
DMA_CHANNEL_IN_USE = 1
};
// HPL constants
enum {
DMA0TSEL_SHIFT = 0,
DMA1TSEL_SHIFT = 4,
DMA2TSEL_SHIFT = 8,
DMATSEL_MASK = (uint16_t)0xf,
DMA0TSEL_MASK = ( 0xf ),
DMA1TSEL_MASK = ( 0xf0 ),
DMA2TSEL_MASK = ( 0xf00 ),
};
enum {
DMASRCINCR_SHIFT = (8),
DMADSTINCR_SHIFT = (10),
DMAINCR_MASK = (0x3)
};
enum {
DMADT_SHIFT = (12),
DMADT_MASK = (0x3)
};
typedef enum {
DMA_TRIGGER_DMAREQ = 0x0, // software trigger
DMA_TRIGGER_TACCR2 = 0x1,
DMA_TRIGGER_TBCCR2 = 0x2,
DMA_TRIGGER_USARTRX = 0x3, // URXIFG0 (UART/SPI), data received (I2C)
DMA_TRIGGER_USARTTX = 0x4, // UTXIFG0 (UART/SPI), transmit ready (I2C)
DMA_TRIGGER_DAC12IFG = 0x5, // DAC12_0CTL DAC12IFG bit
DMA_TRIGGER_ADC12IFGx = 0x6,
DMA_TRIGGER_TACCR0 = 0x7, // CCIFG bit
DMA_TRIGGER_TBCCR0 = 0x8, // CCIFG bit
DMA_TRIGGER_URXIFG1 = 0x9,
DMA_TRIGGER_UTXIFG1 = 0xa,
DMA_TRIGGER_MULT = 0xb, // Hardware Multiplier Ready
DMA_TRIGGER_DMAxIFG = 0xe, // DMA0IFG triggers DMA channel 1
// DMA1IFG triggers DMA channel 2
// DMA2IFG triggers DMA channel 0
DMA_TRIGGER_DMAE0 = 0xf // External Trigger DMAE0
} dma_trigger_t;
enum {
DISABLE_NMI = 0,
ENABLE_NMI = 1
};
enum {
NOT_ROUND_ROBIN = 0,
ROUND_ROBIN = 1,
};
enum {
NOT_ON_FETCH = 0,
ON_FETCH = 1
};
typedef enum {
DMA_EDGE_SENSITIVE = 0x0,
DMA_LEVEL_SENSITIVE = 0x1
} dma_level_t;
typedef enum {
DMA_WORD = 0x0,
DMA_BYTE = 0x1
} dma_byte_t;
typedef enum {
DMA_ADDRESS_UNCHANGED = 0x0,
DMA_ADDRESS_DECREMENTED = 0x2,
DMA_ADDRESS_INCREMENTED = 0x3
} dma_incr_t;
typedef enum {
DMA_SINGLE_TRANSFER = 0x0,
DMA_BLOCK_TRANSFER = 0x1,
DMA_BURST_BLOCK_TRANSFER = 0x2,
DMA_REPEATED_SINGLE_TRANSFER = 0x4,
DMA_REPEATED_BLOCK_TRANSFER = 0x5,
DMA_REPEATED_BURST_BLOCK_TRANSFER = 0x7
} dma_transfer_mode_t;
typedef struct dma_state_s {
unsigned int enableNMI : 1;
unsigned int roundRobin : 1;
unsigned int onFetch : 1;
unsigned int reserved : 13;
} __attribute__ ((packed)) dma_state_t;
typedef struct dma_channel_trigger_s {
unsigned int trigger : 4;
unsigned int reserved : 12;
} __attribute__ ((packed)) dma_channel_trigger_t;
typedef struct dma_channel_state_s {
unsigned int request : 1;
unsigned int abort : 1;
unsigned int interruptEnable : 1;
unsigned int interruptFlag : 1;
unsigned int enable : 1;
unsigned int level : 1; /* or edge- triggered */
unsigned int srcByte : 1; /* or word */
unsigned int dstByte : 1;
unsigned int srcIncrement : 2; /* or no-increment, decrement */
unsigned int dstIncrement : 2;
unsigned int transferMode : 3;
unsigned int reserved2 : 1;
} __attribute__ ((packed)) dma_channel_state_t;
#endif
--- NEW FILE: Msp430DmaC.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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."
*/
/**
* Implementation of the HAL level component for the MSP430 DMA module.
* This configuration provides the available DMA channels through the
* MSP430DMA parameterized interface. If more channels are requested
* than available through unique("DMA"), there will be no mapping for
* that channel and compilation will fail.
*
* @author Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
configuration Msp430DmaC {
provides interface Msp430DmaControl as Control;
provides interface Msp430DmaChannel as Channel0;
provides interface Msp430DmaChannel as Channel1;
provides interface Msp430DmaChannel as Channel2;
}
implementation {
components HplMsp430DmaC as HplDmaC;
components new Msp430DmaChannelP() as Channel0P;
Channel0 = Channel0P;
Channel0P.HplChannel -> HplDmaC.Channel0;
components new Msp430DmaChannelP() as Channel1P;
Channel1 = Channel1P;
Channel1P.HplChannel -> HplDmaC.Channel1;
components new Msp430DmaChannelP() as Channel2P;
Channel2 = Channel2P;
Channel2P.HplChannel -> HplDmaC.Channel2;
components Msp430DmaControlP as ControlP;
Control = ControlP;
ControlP.HplControl -> HplDmaC;
ControlP.HplChannel0 -> HplDmaC.Channel0;
ControlP.HplChannel1 -> HplDmaC.Channel1;
ControlP.HplChannel2 -> HplDmaC.Channel2;
}
--- NEW FILE: Msp430DmaChannel.nc ---
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#include "Msp430Dma.h"
interface Msp430DmaChannel {
/**
* Setup a transfer using explicit argument (most robust and simple
* mechanism and recommended for novice users)
*
* See MSP430DMA.h for parameter options
*/
async command error_t setupTransfer( dma_transfer_mode_t transfer_mode,
dma_trigger_t trigger,
dma_level_t level,
void *src_addr,
void *dst_addr,
uint16_t size,
dma_byte_t src_byte,
dma_byte_t dst_byte,
dma_incr_t src_incr,
dma_incr_t dst_incr );
/**
* Raw interface for setting up a DMA transfer. This function is
* intended to provide as much raw performance as possible but
* sacrifices type checking in the process. Recommended ONLY for
* advanced users that have very intricate knowledge of the MSP430
* DMA module described in the user's guide.
*
* @param state The control register value, as specified by
* dma_control_state_t in MSP430DMA.h
* @param trigger The trigger for the DMA transfer. Should be one
* of the options from dma_trigger_t in MSP430DMA.h
* @param src Pointer to the source address
* @param dest Pointer to the destination address
* @param size Size of the DMA transfer
*
* See MSP430DMA.h for parameter options
*/
async command void setupTransferRaw( uint16_t state, uint16_t trigger,
void* src, void* dest, int size );
/**
* Enable the DMA module. Equivalent to setting the DMA enable bit.
* This function does not force a transfer.
*/
async command error_t startTransfer();
/**
* Repeat a DMA transfer using previous settings but new pointers
* and transfer size. Automatically starts the transfer (sets the
* enable bit).
*/
async command error_t repeatTransfer( void *src_addr, void *dst_addr,
uint16_t size );
/**
* Trigger a DMA transfer using software
*/
async command error_t softwareTrigger();
/**
* Stop a DMA transfer in progress
*/
async command error_t stopTransfer();
/**
* Notification that the transfer has completed
*/
async event void transferDone(error_t success);
}
--- NEW FILE: Msp430DmaChannelP.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#include "Msp430Dma.h"
generic module Msp430DmaChannelP() {
provides interface Msp430DmaChannel as Channel;
uses interface HplMsp430DmaChannel as HplChannel;
}
implementation {
norace dma_channel_state_t gChannelState;
norace dma_channel_trigger_t gChannelTrigger;
async command void Channel.setupTransferRaw( uint16_t s, uint16_t t,
void* src, void* dest,
int size ) {
call HplChannel.setStateRaw( s, t, src, dest, size );
}
async command error_t Channel.setupTransfer( dma_transfer_mode_t transfer_mode,
dma_trigger_t trigger,
dma_level_t level,
void *src_addr,
void *dst_addr,
uint16_t size,
dma_byte_t src_byte,
dma_byte_t dst_byte,
dma_incr_t src_incr,
dma_incr_t dst_incr ) {
gChannelState.request = 0;
gChannelState.abort = 0;
gChannelState.interruptEnable = 1;
gChannelState.interruptFlag = 0;
gChannelState.enable = 0; /* don't start an xfer */
gChannelState.level = level;
gChannelState.srcByte = src_byte;
gChannelState.dstByte = dst_byte;
gChannelState.srcIncrement = src_incr;
gChannelState.dstIncrement = dst_incr;
gChannelState.transferMode = transfer_mode;
gChannelTrigger.trigger = trigger;
call HplChannel.setState( gChannelState, gChannelTrigger,
src_addr, dst_addr, size );
return SUCCESS;
}
async command error_t Channel.startTransfer() {
call HplChannel.enableDMA();
return SUCCESS;
}
async command error_t Channel.repeatTransfer( void *src_addr,
void *dst_addr,
uint16_t size ) {
call HplChannel.setSrc( src_addr );
call HplChannel.setDst(dst_addr);
call HplChannel.setSize(size);
call HplChannel.enableDMA();
return SUCCESS;
}
async command error_t Channel.softwareTrigger() {
if (gChannelTrigger.trigger != DMA_TRIGGER_DMAREQ)
return FAIL;
call HplChannel.triggerDMA();
return SUCCESS;
}
async command error_t Channel.stopTransfer() {
if ( gChannelState.transferMode != DMA_BURST_BLOCK_TRANSFER ||
gChannelState.transferMode != DMA_REPEATED_BURST_BLOCK_TRANSFER)
return FAIL;
call HplChannel.disableDMA();
return SUCCESS;
}
async event void HplChannel.transferDone( error_t error ) {
signal Channel.transferDone( error );
}
default async event void Channel.transferDone( error_t error ) {}
}
--- NEW FILE: Msp430DmaControl.nc ---
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#include "Msp430Dma.h"
interface Msp430DmaControl {
async command void init();
async command void setFlags( bool enable_nmi, bool round_robin,
bool on_fetch);
}
--- NEW FILE: Msp430DmaControlP.nc ---
/**
* Copyright (c) 2005-2006 Arched Rock Corporation
* 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 Arched Rock Corporation 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 THE
* ARCHED ROCK 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
*/
/**
* "Copyright (c) 2000-2005 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 Ben Greenstein <ben at cs.ucla.edu>
* @author Jonathan Hui <jhui at archedrock.com>
* @author Joe Polastre <info at moteiv.com>
* @version $Revision: 1.1.4.2 $ $Date: 2006/05/15 18:35:31 $
*/
#include "Msp430Dma.h"
module Msp430DmaControlP {
provides interface Msp430DmaControl as Control;
uses interface HplMsp430DmaControl as HplControl;
uses interface HplMsp430DmaChannel as HplChannel0;
uses interface HplMsp430DmaChannel as HplChannel1;
uses interface HplMsp430DmaChannel as HplChannel2;
}
implementation {
async command void Control.init() {
call HplControl.reset();
call HplChannel0.reset();
call HplChannel1.reset();
call HplChannel2.reset();
}
async command void Control.setFlags( bool enable_nmi, bool round_robin,
bool on_fetch ) {
// NOTE: on_fetch must be true when dst addr is flash
if (enable_nmi) call HplControl.setENNMI();
else call HplControl.clearENNMI();
if (round_robin) call HplControl.setRoundRobin();
else call HplControl.clearRoundRobin();
if (on_fetch) call HplControl.setOnFetch();
else call HplControl.clearOnFetch();
}
async event void HplChannel0.transferDone( error_t error ) {}
async event void HplChannel1.transferDone( error_t error ) {}
async event void HplChannel2.transferDone( error_t error ) {}
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/support/sdk/java/net/tinyos/sim
LinkLayerModel.java, NONE, 1.1.4.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/xe1205 XE1205.h, NONE,
1.1.4.2 XE1205ActiveMessageC.nc, NONE,
1.1.4.2 XE1205ActiveMessageP.nc, NONE, 1.1.4.2 XE1205Fifo.nc,
NONE, 1.1.4.2 XE1205PacketC.nc, NONE,
1.1.4.2 XE1205SendReceiveC.nc, NONE,
1.1.4.2 XE1205SendReceiveP.nc, NONE, 1.1.4.2 XE1205SpiC.nc,
NONE, 1.1.4.2 XE1205SpiImplP.nc, NONE, 1.1.4.2 XE1205SpiP.nc,
NONE, 1.1.4.2 crc.h, NONE, 1.1.4.2 xe1205debug.h, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list