[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac Teamgeist.nc, NONE, 1.1.2.1 SleepTime.nc, NONE, 1.1.2.1 RedMacP.nc, NONE, 1.1.2.1 RedMacC.nc, NONE, 1.1.2.1 RedMac.h, NONE, 1.1.2.1 ChannelCongestion.nc, NONE, 1.1.2.1

akoepke andreaskoepke at users.sourceforge.net
Fri Dec 8 07:16:39 PST 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17328

Added Files:
      Tag: tinyos-2_0_devel-BRANCH
	Teamgeist.nc SleepTime.nc RedMacP.nc RedMacC.nc RedMac.h 
	ChannelCongestion.nc 
Log Message:
low power mac, supports delta-T synchronization


--- NEW FILE: Teamgeist.nc ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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 COPYRIGHT
 * OWNER OR 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.
 *
 */
 
/**
 * Interface that helps the MAC to cooperate with the routing
 * @author Andreas Koepke (koepke at tkn.tu-berlin.de)
 */ 
interface Teamgeist {
    /**
     * Get the AM type of the messages that are jointly routed by the MAC and
     * the routing layer. Only for these messages the MAC tries to access the
     * routing layer. 
     */
    event am_id_t observedAMType();

    /**
     * The MAC layer uses this function to ask the routing protocol whether it
     * should acknowledge and thus propose himself as a forwarder. 
     */
    async event bool needsAck(message_t *msg, am_addr_t src, am_addr_t dest, uint16_t snr);

    /**
     * Sending the message to the original destination did not work.
     * Ask for a different one.
     */
    async event am_addr_t getDestination(message_t *msg, uint8_t retryCounter);
    
    /**
     * Information on the ACK.
     */
    async event void gotAck(message_t *msg, am_addr_t ackSender, uint16_t snr);

    /**
     * The MAC layer uses this function to ask the routing protocol how many
     * potential forwarders there are. This may not give a precise number, but
     * a rough estimate.
     */
    async event uint8_t estimateForwarders(message_t *msg);
}

--- NEW FILE: SleepTime.nc ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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 COPYRIGHT
 * OWNER OR 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.
 *
 */
 
/**
 * Interface to control the duty cycle of the MAC
 * @author Andreas Koepke (koepke at tkn.tu-berlin.de)
 */ 
interface SleepTime {
  /**
   * set the sleep time of the MAC in units of a 32kHz clock, the setting
   * takes effect on the next wakeup. To avoid synchroninization of the wake
   * up times, some additional randomization can be necessary, esp. when
   * switching from shorter to longer sleep times.
   */
  async command void setSleepTime(uint16_t sT);
  
  /**
   * which sleep time is in effect?
   */
  async command uint16_t getSleepTime();
}

--- NEW FILE: RedMacP.nc ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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
[...1290 lines suppressed...]
    
    /***** unused Radio Modes events **************************/
    
    async event void RadioModes.TimerModeDone() {}
    async event void RadioModes.SelfPollingModeDone() {}
    async event void RadioModes.PWDDDInterrupt() {}

    /** prevent MCU from going into a too low power mode */
    async command mcu_power_t McuPowerOverride.lowestState() {
        mcu_power_t mp;
        if(macState != SLEEP) {
            mp = MSP430_POWER_LPM1;
        }
        else {
            mp = MSP430_POWER_LPM3;
        }
        return mp;
    }
}


--- NEW FILE: RedMacC.nc ---
/* -*- mode:c++; indent-tabs-mode:nil -*- 
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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 COPYRIGHT 
 * OWNER OR 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.
 *
 * - Description ---------------------------------------------------------
 * low power nonpersistent CSMA MAC, rendez-vous via redundantly sent packets
 * - Author --------------------------------------------------------------
 * @author: Andreas Koepke (koepke at tkn.tu-berlin.de)
 * ========================================================================
 */


configuration RedMacC {
  provides {
    interface SplitControl;
    interface MacSend;
    interface MacReceive;
    interface Packet;
    interface LocalTime<T32khz> as LocalTime;
    interface SleepTime;
    interface ChannelCongestion;
  }
  uses {
    interface PhySend as PacketSend;
    interface PhyReceive as PacketReceive;
    interface Packet as SubPacket;
    interface Tda5250Control;  
    interface UartPhyControl;
    interface RadioTimeStamping;
  }
}
implementation {
    components  MainC,
        RedMacP,
        RssiFixedThresholdCMC as Cca,
        new Alarm32khzC() as Timer,
        new Alarm32khzC() as SampleTimer,
        RandomLfsrC,
        McuSleepC,
        Counter32khzC;
    
    components ActiveMessageAddressC;
    RedMacP.amAddress -> ActiveMessageAddressC;

    MainC.SoftwareInit -> RedMacP;
              
    SplitControl = RedMacP;
    McuSleepC.McuPowerOverride -> RedMacP;
    MacSend = RedMacP;
    MacReceive = RedMacP;
    Tda5250Control = RedMacP;
    UartPhyControl = RedMacP;
    RadioTimeStamping = RedMacP;
    LocalTime = RedMacP;
    ChannelCongestion = RedMacP;
    
    RedMacP = PacketSend;
    RedMacP = PacketReceive;
    RedMacP = SubPacket;
    RedMacP = Packet;
    RedMacP = SleepTime;
    
    RedMacP.CcaStdControl -> Cca.StdControl;
    RedMacP.ChannelMonitor -> Cca.ChannelMonitor;
    RedMacP.ChannelMonitorData -> Cca.ChannelMonitorData;
    RedMacP.ChannelMonitorControl -> Cca.ChannelMonitorControl;
    RedMacP.RssiAdcResource -> Cca.RssiAdcResource;
    
    MainC.SoftwareInit -> RandomLfsrC;
    RedMacP.Random -> RandomLfsrC;

    RedMacP.Timer -> Timer;
    RedMacP.SampleTimer -> SampleTimer;
    RedMacP.Counter32khz16 -> Counter32khzC.Counter32khz16;
/*    
    components PlatformLedsC;
    RedMacP.Led0 -> PlatformLedsC.Led0;
    RedMacP.Led1 -> PlatformLedsC.Led1;
    RedMacP.Led2 -> PlatformLedsC.Led2;
    RedMacP.Led3 -> PlatformLedsC.Led3;
*/
}


--- NEW FILE: RedMac.h ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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 COPYRIGHT
 * OWNER OR 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.
 *
 * - Description ---------------------------------------------------------
 * packet headers for RedMac primitive messages
 * - Author --------------------------------------------------------------
 * @author: Andreas Koepke (koepke at tkn.tu-berlin.de)
 * ========================================================================
 */

#ifndef RED_MAC_H
#define RED_MAC_H

/*
 * highest bit of token set: this message is ACK and not intended for the
 * upper layers. Token is used for alternating bit like duplicate detection,
 * and set by the sender in [0,127] intervall. The receiver reflects the
 * token in the Ack, with the highest bit set. 
 */

typedef nx_struct red_mac_header_t {
    nx_uint8_t    repetitionCounter;
    nx_uint32_t   time; // processing delay of message
} red_mac_header_t;

#define RELIABLE_MCAST_MIN_ADDR 0xE000

#endif

--- NEW FILE: ChannelCongestion.nc ---
/* -*- mode:c++; indent-tabs-mode: nil -*-
 * Copyright (c) 2006, Technische Universitaet Berlin
 * 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 Technische Universitaet Berlin 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 COPYRIGHT
 * OWNER OR 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.
 *
 */
 
/**
 * Interface of MAC to inform any interested party on current congestion state
 * in radio neighborhood.
 * @author Andreas Koepke (koepke at tkn.tu-berlin.de)
 */ 
interface ChannelCongestion {
    /**
     * signal current congestion level. There are 5 levels, 0 means no
     * congestion, 5 means high congestion
     */
    async event void congestionEvent(uint8_t level);
}



More information about the Tinyos-2-commits mailing list