nx_uint8_t tx_power;
nx_bool crc;
nx_bool ack;
- nx_uint16_t time;
+ nx_bool timesync;
+ nx_uint32_t timestamp;
nx_uint16_t rxInterval;
/** Packet Link Metadata */
CC2420_SFDMUX_XOSC16M_STABLE = 24,
};
+enum
+{
+ CC2420_INVALID_TIMESTAMP = 0x80000000L,
+};
+
#endif
--- /dev/null
+/*
+ * Copyright (c) 2007, Vanderbilt University
+ * 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 VANDERBILT UNIVERSITY 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 VANDERBILT
+ * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE VANDERBILT UNIVERSITY 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 VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Author: Miklos Maroti
+ */
+
+#ifndef __TIMESYNCMESSAGE_H__
+#define __TIMESYNCMESSAGE_H__
+
+// this value is sent in the air
+typedef nx_uint32_t timesync_radio_t;
+
+#endif//__TIMESYNCMESSAGE_H__
--- /dev/null
+/*
+ * Copyright (c) 2007, Vanderbilt University
+ * 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 VANDERBILT UNIVERSITY 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 VANDERBILT
+ * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE VANDERBILT UNIVERSITY 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 VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+/**
+ * The Active Message layer for the CC2420 radio with timesync support. This
+ * configuration is just layer above CC2420ActiveMessageC that supports
+ * TimeSyncPacket and TimeSyncAMSend interfaces (TEP 133)
+ *
+ * @author: Miklos Maroti
+ * @author: Brano Kusy (CC2420 port)
+ */
+
+#include <Timer.h>
+#include <AM.h>
+
+configuration CC2420TimeSyncMessageC
+{
+ provides
+ {
+ interface SplitControl;
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
+ interface Packet;
+ interface AMPacket;
+
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+}
+
+implementation
+{
+ components CC2420TimeSyncMessageP, CC2420ActiveMessageC, CC2420PacketC, LedsC;
+
+ TimeSyncAMSend32khz = CC2420TimeSyncMessageP;
+ TimeSyncPacket32khz = CC2420TimeSyncMessageP;
+
+ TimeSyncAMSendMilli = CC2420TimeSyncMessageP;
+ TimeSyncPacketMilli = CC2420TimeSyncMessageP;
+
+ Packet = CC2420TimeSyncMessageP;
+ CC2420TimeSyncMessageP.SubSend -> CC2420ActiveMessageC.AMSend;
+ CC2420TimeSyncMessageP.SubPacket -> CC2420ActiveMessageC.Packet;
+
+ CC2420TimeSyncMessageP.PacketTimeStamp32khz -> CC2420PacketC;
+ CC2420TimeSyncMessageP.PacketTimeStampMilli -> CC2420PacketC;
+ CC2420TimeSyncMessageP.PacketTimeSyncOffset -> CC2420PacketC;
+ components Counter32khz32C, new CounterToLocalTimeC(T32khz) as LocalTime32khzC, LocalTimeMilliC;
+ LocalTime32khzC.Counter -> Counter32khz32C;
+ CC2420TimeSyncMessageP.LocalTime32khz -> LocalTime32khzC;
+ CC2420TimeSyncMessageP.LocalTimeMilli -> LocalTimeMilliC;
+ CC2420TimeSyncMessageP.Leds -> LedsC;
+
+ SplitControl = CC2420ActiveMessageC;
+ Receive = CC2420ActiveMessageC.Receive;
+ Snoop = CC2420ActiveMessageC.Snoop;
+ AMPacket = CC2420ActiveMessageC;
+}
--- /dev/null
+/*
+ * Copyright (c) 2007, Vanderbilt University
+ * 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 VANDERBILT UNIVERSITY 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 VANDERBILT
+ * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE VANDERBILT UNIVERSITY 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 VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * @author: Miklos Maroti
+ * @author: Brano Kusy (CC2420 port)
+ */
+#include "CC2420TimeSyncMessage.h"
+
+module CC2420TimeSyncMessageP
+{
+ provides
+ {
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[uint8_t id];
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[uint8_t id];
+ interface Packet;
+
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+
+ uses
+ {
+ interface AMSend as SubSend[uint8_t id];
+ interface Packet as SubPacket;
+
+ interface PacketTimeStamp<T32khz,uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli,uint32_t> as PacketTimeStampMilli;
+ interface PacketTimeSyncOffset;
+
+ interface LocalTime<T32khz> as LocalTime32khz;
+ interface LocalTime<TMilli> as LocalTimeMilli;
+ interface Leds;
+ }
+}
+
+implementation
+{
+ // TODO: change the Packet.payloadLength and Packet.maxPayloadLength commands to async
+ inline void* getFooter(message_t* msg)
+ {
+ // we use the payload length that we export (the smaller one)
+ return msg->data + call Packet.payloadLength(msg);
+ }
+
+/*----------------- Packet -----------------*/
+ command void Packet.clear(message_t* msg)
+ {
+ call PacketTimeSyncOffset.cancel(msg);
+ call SubPacket.clear(msg);
+ }
+
+ command void Packet.setPayloadLength(message_t* msg, uint8_t len)
+ {
+ call SubPacket.setPayloadLength(msg, len + sizeof(timesync_radio_t));
+ }
+
+ command uint8_t Packet.payloadLength(message_t* msg)
+ {
+ return call SubPacket.payloadLength(msg) - sizeof(timesync_radio_t);
+ }
+
+ command uint8_t Packet.maxPayloadLength()
+ {
+ return call SubPacket.maxPayloadLength() - sizeof(timesync_radio_t);
+ }
+
+ command void* Packet.getPayload(message_t* msg, uint8_t len)
+ {
+ return call SubPacket.getPayload(msg, len + sizeof(timesync_radio_t));
+ }
+
+/*----------------- TimeSyncAMSend32khz -----------------*/
+ command error_t TimeSyncAMSend32khz.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len, uint32_t event_time)
+ {
+ error_t err;
+ void * timesync = msg->data + len;
+ *(timesync_radio_t*)timesync = event_time;
+
+ err = call SubSend.send[id](addr, msg, len + sizeof(timesync_radio_t));
+ call PacketTimeSyncOffset.set(msg);
+ return err;
+ }
+
+ command error_t TimeSyncAMSend32khz.cancel[am_id_t id](message_t* msg)
+ {
+ call PacketTimeSyncOffset.cancel(msg);
+ return call SubSend.cancel[id](msg);
+ }
+
+ default event void TimeSyncAMSend32khz.sendDone[am_id_t id](message_t* msg, error_t error) {}
+
+ command uint8_t TimeSyncAMSend32khz.maxPayloadLength[am_id_t id]()
+ {
+ return call SubSend.maxPayloadLength[id]() - sizeof(timesync_radio_t);
+ }
+
+ command void* TimeSyncAMSend32khz.getPayload[am_id_t id](message_t* msg, uint8_t len)
+ {
+ return call SubSend.getPayload[id](msg, len + sizeof(timesync_radio_t));
+ }
+
+/*----------------- TimeSyncAMSendMilli -----------------*/
+ command error_t TimeSyncAMSendMilli.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len, uint32_t event_time)
+ {
+ // compute elapsed time in millisecond
+ event_time = ((event_time - call LocalTimeMilli.get()) << 5) + call LocalTime32khz.get();
+ return call TimeSyncAMSend32khz.send[id](addr, msg, len, event_time);
+ }
+
+ command error_t TimeSyncAMSendMilli.cancel[am_id_t id](message_t* msg)
+ {
+ return call TimeSyncAMSend32khz.cancel[id](msg);
+ }
+
+ default event void TimeSyncAMSendMilli.sendDone[am_id_t id](message_t* msg, error_t error){}
+
+ command uint8_t TimeSyncAMSendMilli.maxPayloadLength[am_id_t id]()
+ {
+ return call TimeSyncAMSend32khz.maxPayloadLength[id]();
+ }
+
+ command void* TimeSyncAMSendMilli.getPayload[am_id_t id](message_t* msg, uint8_t len)
+ {
+ return call TimeSyncAMSend32khz.getPayload[id](msg, len);
+ }
+
+/*----------------- SubSend.sendDone -------------------*/
+ event void SubSend.sendDone[am_id_t id](message_t* msg, error_t error)
+ {
+ signal TimeSyncAMSend32khz.sendDone[id](msg, error);
+ signal TimeSyncAMSendMilli.sendDone[id](msg, error);
+ }
+
+/*----------------- TimeSyncPacket32khz -----------------*/
+ command bool TimeSyncPacket32khz.isValid(message_t* msg)
+ {
+ timesync_radio_t* timesync = getFooter(msg);
+ return call PacketTimeStamp32khz.isValid(msg) && *timesync != CC2420_INVALID_TIMESTAMP;
+ }
+
+ command uint32_t TimeSyncPacket32khz.eventTime(message_t* msg)
+ {
+ timesync_radio_t* timesync = getFooter(msg);
+
+ return (uint32_t)(*timesync) + call PacketTimeStamp32khz.timestamp(msg);
+ }
+
+/*----------------- TimeSyncPacketMilli -----------------*/
+ command bool TimeSyncPacketMilli.isValid(message_t* msg)
+ {
+ timesync_radio_t* timesync = getFooter(msg);
+ return call PacketTimeStampMilli.isValid(msg) && *timesync != CC2420_INVALID_TIMESTAMP;
+ }
+
+ command uint32_t TimeSyncPacketMilli.eventTime(message_t* msg)
+ {
+ timesync_radio_t* timesync = getFooter(msg);
+ return ((int32_t)(*timesync) >> 5) + call PacketTimeStampMilli.timestamp(msg);
+ }
+}
metadata->ack = FALSE;
metadata->rssi = 0;
metadata->lqi = 0;
- metadata->time = 0;
-
+ metadata->timesync = FALSE;
+ metadata->timestamp = CC2420_INVALID_TIMESTAMP;
+
ccaOn = TRUE;
signal RadioBackoff.requestCca(m_msg);
*
* @param time at which the capture happened.
*/
- async command void sfd( uint16_t time );
+ async command void sfd( uint32_t time );
/**
* Notification that the packet has been dropped by the radio
--- /dev/null
+/*
+ * Copyright (c) 2007, Vanderbilt University
+ * 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 VANDERBILT UNIVERSITY 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 VANDERBILT
+ * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE VANDERBILT UNIVERSITY 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 VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Author: Miklos Maroti
+ */
+
+interface PacketTimeSyncOffset
+{
+ /**
+ * Returns TRUE if the value is set for this message.
+ */
+ async command bool isSet(message_t* msg);
+
+ /**
+ * Returns the stored value of this field in the message. If the
+ * value is not set, then the returned value is undefined.
+ */
+ async command uint8_t get(message_t* msg);
+
+ /**
+ * Sets the isSet false to TRUE and the time stamp value to the
+ * specified value.
+ */
+ async command void set(message_t* msg);
+
+ /**
+ * Cancels any pending requests.
+ */
+ async command void cancel(message_t* msg);
+}
* @author Chad Metcalf
*/
-#include "IEEE802154.h"
-#include "message.h"
-
-module CC2420PacketC {
+configuration CC2420PacketC {
provides {
interface CC2420Packet;
interface PacketAcknowledgements as Acks;
interface CC2420PacketBody;
interface LinkPacketMetadata;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+ interface PacketTimeSyncOffset;
}
}
implementation {
-
-
- /***************** PacketAcknowledgement Commands ****************/
- async command error_t Acks.requestAck( message_t* p_msg ) {
- (call CC2420PacketBody.getHeader( p_msg ))->fcf |= 1 << IEEE154_FCF_ACK_REQ;
- return SUCCESS;
- }
-
- async command error_t Acks.noAck( message_t* p_msg ) {
- (call CC2420PacketBody.getHeader( p_msg ))->fcf &= ~(1 << IEEE154_FCF_ACK_REQ);
- return SUCCESS;
- }
-
- async command bool Acks.wasAcked( message_t* p_msg ) {
- return (call CC2420PacketBody.getMetadata( p_msg ))->ack;
- }
-
- /***************** CC2420Packet Commands ****************/
- async command void CC2420Packet.setPower( message_t* p_msg, uint8_t power ) {
- if ( power > 31 )
- power = 31;
- (call CC2420PacketBody.getMetadata( p_msg ))->tx_power = power;
- }
-
- async command uint8_t CC2420Packet.getPower( message_t* p_msg ) {
- return (call CC2420PacketBody.getMetadata( p_msg ))->tx_power;
- }
-
- async command int8_t CC2420Packet.getRssi( message_t* p_msg ) {
- return (call CC2420PacketBody.getMetadata( p_msg ))->rssi;
- }
-
- async command uint8_t CC2420Packet.getLqi( message_t* p_msg ) {
- return (call CC2420PacketBody.getMetadata( p_msg ))->lqi;
- }
-
- /***************** CC2420PacketBody Commands ****************/
- async command cc2420_header_t * ONE CC2420PacketBody.getHeader( message_t* ONE msg ) {
- return TCAST(cc2420_header_t* ONE, (uint8_t *)msg + offsetof(message_t, data) - sizeof( cc2420_header_t ));
- }
-
- async command cc2420_metadata_t *CC2420PacketBody.getMetadata( message_t* msg ) {
- return (cc2420_metadata_t*)msg->metadata;
- }
-
- async command bool LinkPacketMetadata.highChannelQuality(message_t* msg) {
- return call CC2420Packet.getLqi(msg) > 105;
- }
+ components CC2420PacketP;
+ CC2420Packet = CC2420PacketP;
+ Acks = CC2420PacketP;
+ CC2420PacketBody = CC2420PacketP;
+ LinkPacketMetadata = CC2420PacketP;
+ PacketTimeStamp32khz = CC2420PacketP;
+ PacketTimeStampMilli = CC2420PacketP;
+ PacketTimeSyncOffset = CC2420PacketP;
+
+ components CC2420ActiveMessageC;
+ CC2420PacketP.Packet -> CC2420ActiveMessageC;
+
+ components Counter32khz32C, new CounterToLocalTimeC(T32khz), HilTimerMilliC;
+ CounterToLocalTimeC.Counter -> Counter32khz32C;
+ CC2420PacketP.LocalTime32khz -> CounterToLocalTimeC;
+ CC2420PacketP.LocalTimeMilli -> HilTimerMilliC;
}
--- /dev/null
+/*
+ * Copyright (c) 2005-2006 Arch 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 Arch 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
+ */
+
+/**
+ * @author Jonathan Hui <jhui@archrock.com>
+ * @author David Moss
+ * @author Chad Metcalf
+ */
+
+#include "IEEE802154.h"
+#include "message.h"
+#include "CC2420.h"
+
+module CC2420PacketP {
+
+ provides {
+ interface CC2420Packet;
+ interface PacketAcknowledgements as Acks;
+ interface CC2420PacketBody;
+ interface LinkPacketMetadata;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+ interface PacketTimeSyncOffset;
+ }
+
+ uses interface Packet;
+ uses interface LocalTime<T32khz> as LocalTime32khz;
+ uses interface LocalTime<TMilli> as LocalTimeMilli;
+}
+
+implementation {
+
+
+ /***************** PacketAcknowledgement Commands ****************/
+ async command error_t Acks.requestAck( message_t* p_msg ) {
+ (call CC2420PacketBody.getHeader( p_msg ))->fcf |= 1 << IEEE154_FCF_ACK_REQ;
+ return SUCCESS;
+ }
+
+ async command error_t Acks.noAck( message_t* p_msg ) {
+ (call CC2420PacketBody.getHeader( p_msg ))->fcf &= ~(1 << IEEE154_FCF_ACK_REQ);
+ return SUCCESS;
+ }
+
+ async command bool Acks.wasAcked( message_t* p_msg ) {
+ return (call CC2420PacketBody.getMetadata( p_msg ))->ack;
+ }
+
+ /***************** CC2420Packet Commands ****************/
+ async command void CC2420Packet.setPower( message_t* p_msg, uint8_t power ) {
+ if ( power > 31 )
+ power = 31;
+ (call CC2420PacketBody.getMetadata( p_msg ))->tx_power = power;
+ }
+
+ async command uint8_t CC2420Packet.getPower( message_t* p_msg ) {
+ return (call CC2420PacketBody.getMetadata( p_msg ))->tx_power;
+ }
+
+ async command int8_t CC2420Packet.getRssi( message_t* p_msg ) {
+ return (call CC2420PacketBody.getMetadata( p_msg ))->rssi;
+ }
+
+ async command uint8_t CC2420Packet.getLqi( message_t* p_msg ) {
+ return (call CC2420PacketBody.getMetadata( p_msg ))->lqi;
+ }
+
+ /***************** CC2420PacketBody Commands ****************/
+ async command cc2420_header_t * ONE CC2420PacketBody.getHeader( message_t* ONE msg ) {
+ return TCAST(cc2420_header_t* ONE, (uint8_t *)msg + offsetof(message_t, data) - sizeof( cc2420_header_t ));
+ }
+
+ async command cc2420_metadata_t *CC2420PacketBody.getMetadata( message_t* msg ) {
+ return (cc2420_metadata_t*)msg->metadata;
+ }
+
+ async command bool LinkPacketMetadata.highChannelQuality(message_t* msg) {
+ return call CC2420Packet.getLqi(msg) > 105;
+ }
+
+ /***************** PacketTimeStamp32khz Commands ****************/
+ async command bool PacketTimeStamp32khz.isValid(message_t* msg)
+ {
+ return ((call CC2420PacketBody.getMetadata( msg ))->timestamp != CC2420_INVALID_TIMESTAMP);
+ }
+
+ async command uint32_t PacketTimeStamp32khz.timestamp(message_t* msg)
+ {
+ return (call CC2420PacketBody.getMetadata( msg ))->timestamp;
+ }
+
+ async command void PacketTimeStamp32khz.clear(message_t* msg)
+ {
+ (call CC2420PacketBody.getMetadata( msg ))->timesync = FALSE;
+ (call CC2420PacketBody.getMetadata( msg ))->timestamp = CC2420_INVALID_TIMESTAMP;
+ }
+
+ async command void PacketTimeStamp32khz.set(message_t* msg, uint32_t value)
+ {
+ (call CC2420PacketBody.getMetadata( msg ))->timestamp = value;
+ }
+
+ /***************** PacketTimeStampMilli Commands ****************/
+ // over the air value is always T32khz, which is used to capture SFD interrupt
+ // (Timer1 on micaZ, B1 on telos)
+ async command bool PacketTimeStampMilli.isValid(message_t* msg)
+ {
+ return call PacketTimeStamp32khz.isValid(msg);
+ }
+
+ async command uint32_t PacketTimeStampMilli.timestamp(message_t* msg)
+ {
+ int32_t offset = call PacketTimeStamp32khz.timestamp(msg) - call LocalTime32khz.get();
+ return (offset >> 5) + call LocalTimeMilli.get();
+ }
+
+ async command void PacketTimeStampMilli.clear(message_t* msg)
+ {
+ call PacketTimeStamp32khz.clear(msg);
+ }
+
+ async command void PacketTimeStampMilli.set(message_t* msg, uint32_t value)
+ {
+ int32_t offset = (value - call LocalTimeMilli.get()) << 5;
+ call PacketTimeStamp32khz.set(msg, offset + call LocalTime32khz.get());
+ }
+ /*----------------- PacketTimeSyncOffset -----------------*/
+ async command bool PacketTimeSyncOffset.isSet(message_t* msg)
+ {
+ return ((call CC2420PacketBody.getMetadata( msg ))->timesync);
+ }
+
+ async command uint8_t PacketTimeSyncOffset.get(message_t* msg)
+ {
+ // minus 1 because one less byte is transmitted
+ return (call CC2420PacketBody.getHeader(msg))->length - 1 - sizeof(uint32_t);
+ }
+
+ async command void PacketTimeSyncOffset.set(message_t* msg)
+ {
+ (call CC2420PacketBody.getMetadata( msg ))->timesync = TRUE;
+ }
+
+ async command void PacketTimeSyncOffset.cancel(message_t* msg)
+ {
+ (call CC2420PacketBody.getMetadata( msg ))->timesync = FALSE;
+ }
+}
CC2420ReceiveP.SACK -> Spi.SACK;
CC2420ReceiveP.CC2420Packet -> CC2420PacketC;
CC2420ReceiveP.CC2420PacketBody -> CC2420PacketC;
+ CC2420ReceiveP.PacketTimeStamp -> CC2420PacketC;
CC2420ReceiveP.CC2420Config -> CC2420ControlC;
}
uses interface CC2420Packet;
uses interface CC2420PacketBody;
uses interface CC2420Config;
-
+ uses interface PacketTimeStamp<T32khz,uint32_t>;
+
uses interface Leds;
}
SACK_HEADER_LENGTH = 7,
};
- uint16_t m_timestamp_queue[ TIMESTAMP_QUEUE_SIZE ];
-
+ uint32_t m_timestamp_queue[ TIMESTAMP_QUEUE_SIZE ];
+
uint8_t m_timestamp_head;
uint8_t m_timestamp_size;
* Start frame delimiter signifies the beginning/end of a packet
* See the CC2420 datasheet for details.
*/
- async command void CC2420Receive.sfd( uint16_t time ) {
+ async command void CC2420Receive.sfd( uint32_t time ) {
if ( m_timestamp_size < TIMESTAMP_QUEUE_SIZE ) {
uint8_t tail = ( ( m_timestamp_head + m_timestamp_size ) %
TIMESTAMP_QUEUE_SIZE );
async event void RXFIFO.readDone( uint8_t* rx_buf, uint8_t rx_len,
error_t error ) {
cc2420_header_t* header = call CC2420PacketBody.getHeader( m_p_rx_buf );
- cc2420_metadata_t* metadata = call CC2420PacketBody.getMetadata( m_p_rx_buf );
uint8_t tmpLen __DEPUTY_UNUSED__ = sizeof(message_t) - (offsetof(message_t, data) - sizeof(cc2420_header_t));
uint8_t* COUNT(tmpLen) buf = TCAST(uint8_t* COUNT(tmpLen), header);
rxFrameLength = buf[ 0 ];
if ( m_timestamp_size ) {
if ( rxFrameLength > 10 ) {
- metadata->time = m_timestamp_queue[ m_timestamp_head ];
+ call PacketTimeStamp.set(m_p_rx_buf, m_timestamp_queue[ m_timestamp_head ]);
m_timestamp_head = ( m_timestamp_head + 1 ) % TIMESTAMP_QUEUE_SIZE;
m_timestamp_size--;
}
} else {
- metadata->time = 0xffff;
+ call PacketTimeStamp.clear(m_p_rx_buf);
}
// We may have received an ack that should be processed by Transmit
interface StdControl;
interface CC2420Transmit;
interface RadioBackoff;
- interface RadioTimeStamping;
interface ReceiveIndicator as EnergyIndicator;
interface ReceiveIndicator as ByteIndicator;
}
StdControl = CC2420TransmitP;
CC2420Transmit = CC2420TransmitP;
RadioBackoff = CC2420TransmitP;
- RadioTimeStamping = CC2420TransmitP;
EnergyIndicator = CC2420TransmitP.EnergyIndicator;
ByteIndicator = CC2420TransmitP.ByteIndicator;
components CC2420PacketC;
CC2420TransmitP.CC2420Packet -> CC2420PacketC;
CC2420TransmitP.CC2420PacketBody -> CC2420PacketC;
-
+ CC2420TransmitP.PacketTimeStamp -> CC2420PacketC;
+ CC2420TransmitP.PacketTimeSyncOffset -> CC2420PacketC;
+
components LedsC;
CC2420TransmitP.Leds -> LedsC;
}
*/
#include "CC2420.h"
+#include "CC2420TimeSyncMessage.h"
#include "crc.h"
#include "message.h"
provides interface StdControl;
provides interface CC2420Transmit as Send;
provides interface RadioBackoff;
- provides interface RadioTimeStamping as TimeStamp;
provides interface ReceiveIndicator as EnergyIndicator;
provides interface ReceiveIndicator as ByteIndicator;
uses interface Alarm<T32khz,uint32_t> as BackoffTimer;
uses interface CC2420Packet;
uses interface CC2420PacketBody;
+ uses interface PacketTimeStamp<T32khz,uint32_t>;
+ uses interface PacketTimeSyncOffset;
uses interface GpioCapture as CaptureSFD;
uses interface GeneralIO as CCA;
uses interface GeneralIO as CSN;
}
-
+ inline uint32_t time16to32(uint16_t time, uint32_t recent_time)
+ {
+ if ((recent_time&0xFFFF)<time)
+ return ((recent_time-0x10000UL)&0xFFFF0000UL)|time;
+ else
+ return (recent_time&0xFFFF0000UL)|time;
+ }
+
/**
* The CaptureSFD event is actually an interrupt from the capture pin
* which is connected to timing circuitry and timer modules. This
* would have picked up and executed had our microcontroller been fast enough.
*/
async event void CaptureSFD.captured( uint16_t time ) {
+ uint32_t time32 = time16to32(time, call BackoffTimer.getNow());
atomic {
switch( m_state ) {
m_state = S_EFD;
sfdHigh = TRUE;
call CaptureSFD.captureFallingEdge();
- signal TimeStamp.transmittedSFD( time, m_msg );
+ call PacketTimeStamp.set(m_msg, time32);
+ if (call PacketTimeSyncOffset.isSet(m_msg)) {
+ timesync_radio_t *timesync = (timesync_radio_t*)((void*)m_msg + call PacketTimeSyncOffset.get(m_msg));
+ // set timesync event time as the offset between the event time and the SFD interrupt time (TEP 133)
+ *timesync -= time32;
+ call CSN.clr();
+ call TXFIFO_RAM.write( call PacketTimeSyncOffset.get(m_msg), (void*)timesync, sizeof(timesync_radio_t) );
+ call CSN.set();
+ }
+
if ( (call CC2420PacketBody.getHeader( m_msg ))->fcf & ( 1 << IEEE154_FCF_ACK_REQ ) ) {
// This is an ack packet, don't release the chip's SPI bus lock.
abortSpiRelease = TRUE;
if ( ( ( (call CC2420PacketBody.getHeader( m_msg ))->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7 ) == IEEE154_TYPE_DATA ) {
- (call CC2420PacketBody.getMetadata( m_msg ))->time = time;
+ call PacketTimeStamp.set(m_msg, time32);
}
if ( call SFD.get() ) {
if ( !m_receiving ) {
sfdHigh = TRUE;
call CaptureSFD.captureFallingEdge();
- signal TimeStamp.receivedSFD( time );
- call CC2420Receive.sfd( time );
+ call CC2420Receive.sfd( time32 );
m_receiving = TRUE;
m_prev_time = time;
if ( call SFD.get() ) {
m_receiving = FALSE;
if ( time - m_prev_time < 10 ) {
call CC2420Receive.sfd_dropped();
+ call PacketTimeStamp.clear(m_msg);
}
break;
call ChipSpiResource.attemptRelease();
signal Send.sendDone( m_msg, err );
}
-
-
-
- /***************** Tasks ****************/
-
- /***************** Defaults ****************/
- default async event void TimeStamp.transmittedSFD( uint16_t time, message_t* p_msg ) {
- }
-
- default async event void TimeStamp.receivedSFD( uint16_t time ) {
- }
-
}
/**
*
- * The Active Message layer on the mica2 platform. This is a naming wrapper
- * around the CC1000 Active Message layer.
+ * The Active Message layer on the intelmote2 platform. This is a naming wrapper
+ * around the CC2420 Active Message layer.
*
* @author Philip Levis
* @date June 19 2005
provides {
interface SplitControl;
- interface AMSend[uint8_t id];
- interface Receive[uint8_t id];
- interface Receive as Snoop[uint8_t id];
+ interface AMSend[am_id_t id];
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
interface Packet;
interface AMPacket;
interface PacketAcknowledgements;
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}
implementation {
Packet = AM;
AMPacket = AM;
PacketAcknowledgements = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
}
--- /dev/null
+// $Id$
+
+/*
+ * "Copyright (c) 2004-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."
+ *
+ * Copyright (c) 2004-2005 Intel Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached INTEL-LICENSE
+ * file. If you do not find these files, copies can be found by writing to
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
+ * 94704. Attention: Intel License Inquiry.
+ */
+
+/**
+ *
+ * The Active Message layer on the intelmote2 platform. This is a naming wrapper
+ * around the CC2420 Active Message layer that implemets timesync interface (TEP 133).
+ *
+ * @author Philip Levis
+ * @author Brano Kusy
+ * @date June 19 2005
+ */
+
+configuration TimeSyncMessageC {
+ provides
+ {
+ interface SplitControl;
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
+ interface Packet;
+ interface AMPacket;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+}
+implementation {
+ components CC2420TimeSyncMessageC as AM;
+
+ SplitControl = AM;
+
+ Receive = AM.Receive;
+ Snoop = AM.Snoop;
+ Packet = AM;
+ AMPacket = AM;
+ TimeSyncAMSend32khz = AM;
+ TimeSyncAMSendMilli = AM;
+ TimeSyncPacket32khz = AM;
+ TimeSyncPacketMilli = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
+}
\ No newline at end of file
provides {
interface SplitControl;
- interface AMSend[uint8_t id];
- interface Receive[uint8_t id];
- interface Receive as Snoop[uint8_t id];
+ interface AMSend[am_id_t id];
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
interface Packet;
interface AMPacket;
interface PacketAcknowledgements;
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}
implementation {
Packet = AM;
AMPacket = AM;
PacketAcknowledgements = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
}
--- /dev/null
+// $Id$
+
+/*
+ * "Copyright (c) 2004-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."
+ *
+ * Copyright (c) 2004-2005 Intel Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached INTEL-LICENSE
+ * file. If you do not find these files, copies can be found by writing to
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
+ * 94704. Attention: Intel License Inquiry.
+ */
+
+/**
+ *
+ * The Active Message layer on the micaz platform. This is a naming wrapper
+ * around the CC2420 Active Message layer that implemets timesync interface (TEP 133).
+ *
+ * @author Philip Levis
+ * @author Brano Kusy
+ * @date June 19 2005
+ */
+
+configuration TimeSyncMessageC {
+ provides
+ {
+ interface SplitControl;
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
+ interface Packet;
+ interface AMPacket;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+}
+implementation {
+ components CC2420TimeSyncMessageC as AM;
+
+ SplitControl = AM;
+
+ Receive = AM.Receive;
+ Snoop = AM.Snoop;
+ Packet = AM;
+ AMPacket = AM;
+ TimeSyncAMSend32khz = AM;
+ TimeSyncAMSendMilli = AM;
+ TimeSyncPacket32khz = AM;
+ TimeSyncPacketMilli = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
+}
\ No newline at end of file
interface Packet;
interface AMPacket;
interface PacketAcknowledgements;
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}
implementation {
Packet = AM;
AMPacket = AM;
PacketAcknowledgements = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
}
--- /dev/null
+// $Id$
+
+/*
+ * "Copyright (c) 2004-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."
+ *
+ * Copyright (c) 2004-2005 Intel Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached INTEL-LICENSE
+ * file. If you do not find these files, copies can be found by writing to
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
+ * 94704. Attention: Intel License Inquiry.
+ */
+
+/**
+ *
+ * The Active Message layer on the shimmer platform. This is a naming wrapper
+ * around the CC2420 Active Message layer that implemets timesync interface (TEP 133).
+ *
+ * @author Konrad Lorincz
+ * @author Brano Kusy
+ * @date June 19 2005
+ */
+
+configuration TimeSyncMessageC {
+ provides
+ {
+ interface SplitControl;
+ interface Receive[uint8_t id];
+ interface Receive as Snoop[uint8_t id];
+ interface Packet;
+ interface AMPacket;
+ interface PacketAcknowledgements;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+}
+implementation {
+ components CC2420TimeSyncMessageC as AM;
+
+ SplitControl = AM;
+
+ Receive = AM.Receive;
+ Snoop = AM.Snoop;
+ Packet = AM;
+ AMPacket = AM;
+ PacketAcknowledgements = AM;
+ TimeSyncAMSend32khz = AM;
+ TimeSyncAMSendMilli = AM;
+ TimeSyncPacket32khz = AM;
+ TimeSyncPacketMilli = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
+}
\ No newline at end of file
provides {
interface SplitControl;
- interface AMSend[uint8_t id];
- interface Receive[uint8_t id];
- interface Receive as Snoop[uint8_t id];
+ interface AMSend[am_id_t id];
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
interface Packet;
interface AMPacket;
interface PacketAcknowledgements;
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}
implementation {
Packet = AM;
AMPacket = AM;
PacketAcknowledgements = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
}
--- /dev/null
+// $Id$
+
+/*
+ * "Copyright (c) 2004-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."
+ *
+ * Copyright (c) 2004-2005 Intel Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached INTEL-LICENSE
+ * file. If you do not find these files, copies can be found by writing to
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
+ * 94704. Attention: Intel License Inquiry.
+ */
+
+/**
+ *
+ * The Active Message layer on the telosa platform. This is a naming wrapper
+ * around the CC2420 Active Message layer that implemets timesync interface (TEP 133).
+ *
+ * @author Philip Levis
+ * @author Brano Kusy
+ * @date June 19 2005
+ */
+
+configuration TimeSyncMessageC {
+ provides
+ {
+ interface SplitControl;
+ interface Receive[am_id_t id];
+ interface Receive as Snoop[am_id_t id];
+ interface Packet;
+ interface AMPacket;
+
+ interface PacketTimeStamp<T32khz, uint32_t> as PacketTimeStamp32khz;
+ interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
+
+ interface TimeSyncAMSend<T32khz, uint32_t> as TimeSyncAMSend32khz[am_id_t id];
+ interface TimeSyncPacket<T32khz, uint32_t> as TimeSyncPacket32khz;
+
+ interface TimeSyncAMSend<TMilli, uint32_t> as TimeSyncAMSendMilli[am_id_t id];
+ interface TimeSyncPacket<TMilli, uint32_t> as TimeSyncPacketMilli;
+ }
+}
+implementation {
+ components CC2420TimeSyncMessageC as AM;
+
+ SplitControl = AM;
+
+ Receive = AM.Receive;
+ Snoop = AM.Snoop;
+ Packet = AM;
+ AMPacket = AM;
+ TimeSyncAMSend32khz = AM;
+ TimeSyncAMSendMilli = AM;
+ TimeSyncPacket32khz = AM;
+ TimeSyncPacketMilli = AM;
+
+ components CC2420PacketC;
+ PacketTimeStamp32khz = CC2420PacketC;
+ PacketTimeStampMilli = CC2420PacketC;
+}
\ No newline at end of file