From fe326573ffa4b8f1132520facc4b467c53fdcc94 Mon Sep 17 00:00:00 2001 From: liang_mike Date: Mon, 11 Jan 2010 04:48:39 +0000 Subject: [PATCH] Add tosthreads support for Epic platform --- support/make/threads.extra | 8 ++ .../platforms/epic/ActiveMessageC.nc | 82 +++++++++++++++++++ .../tosthreads/platforms/epic/TelosSerialP.nc | 23 ++++++ 3 files changed, 113 insertions(+) create mode 100644 tos/lib/tosthreads/platforms/epic/ActiveMessageC.nc create mode 100644 tos/lib/tosthreads/platforms/epic/TelosSerialP.nc diff --git a/support/make/threads.extra b/support/make/threads.extra index 17adba17..b39a734f 100644 --- a/support/make/threads.extra +++ b/support/make/threads.extra @@ -77,6 +77,9 @@ THREADS_EYES_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/eyesIFX #Shimmer specific include directories THREADS_SHIMMER_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/shimmer +#Epic specific include directories +THREADS_EPIC_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/epic + #Add CFLAGS for supported platforms ifneq ($(filter telos telosa telosb tmote,$(MAKECMDGOALS)),) CFLAGS += $(THREADS_MSP430_INCLUDE_DIRS) @@ -89,6 +92,11 @@ ifneq ($(filter telos telosa telosb tmote,$(MAKECMDGOALS)),) CFLAGS += -DPLATFORM_TELOSB endif endif +ifneq ($(filter epic,$(MAKECMDGOALS)),) + CFLAGS += $(THREADS_MSP430_INCLUDE_DIRS) + CFLAGS += $(THREADS_CC2420_INCLUDE_DIRS) + CFLAGS += $(THREADS_EPIC_INCLUDE_DIRS) +endif ifneq ($(filter mica2,$(MAKECMDGOALS)),) CFLAGS += $(THREADS_ATM128_INCLUDE_DIRS) CFLAGS += $(THREADS_CC1000_INCLUDE_DIRS) diff --git a/tos/lib/tosthreads/platforms/epic/ActiveMessageC.nc b/tos/lib/tosthreads/platforms/epic/ActiveMessageC.nc new file mode 100644 index 00000000..816f8b60 --- /dev/null +++ b/tos/lib/tosthreads/platforms/epic/ActiveMessageC.nc @@ -0,0 +1,82 @@ +// $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. + */ +/* + * + * Authors: Philip Levis + * Date last modified: $Id$ + * + */ + +/** + * + * The Active Message layer on the Telos platform. This is a naming wrapper + * around the CC2420 Active Message layer. + * + * @author Philip Levis + * @version $Revision$ $Date$ + */ +#include "Timer.h" + +configuration ActiveMessageC { + provides { + interface SplitControl; + + interface AMSend[am_id_t id]; + interface Receive[am_id_t id]; + interface Receive as ReceiveDefault[am_id_t id]; + interface Receive as Snoop[am_id_t id]; + interface Receive as SnoopDefault[am_id_t id]; + + interface Packet; + interface AMPacket; + interface PacketAcknowledgements; + interface PacketTimeStamp as PacketTimeStamp32khz; + interface PacketTimeStamp as PacketTimeStampMilli; + } +} +implementation { + components CC2420ActiveMessageC as AM; + + SplitControl = AM; + + AMSend = AM; + Receive = AM.Receive; + ReceiveDefault = AM.ReceiveDefault; + Snoop = AM.Snoop; + SnoopDefault = AM.SnoopDefault; + Packet = AM; + AMPacket = AM; + PacketAcknowledgements = AM; + + components CC2420PacketC; + PacketTimeStamp32khz = CC2420PacketC; + PacketTimeStampMilli = CC2420PacketC; +} diff --git a/tos/lib/tosthreads/platforms/epic/TelosSerialP.nc b/tos/lib/tosthreads/platforms/epic/TelosSerialP.nc new file mode 100644 index 00000000..fcfc91d3 --- /dev/null +++ b/tos/lib/tosthreads/platforms/epic/TelosSerialP.nc @@ -0,0 +1,23 @@ +module TelosSerialP { + provides interface StdControl; + provides interface Msp430UartConfigure; + uses interface Resource; +} +implementation { + + msp430_uart_union_config_t msp430_uart_telos_config = { {ubr: UBR_1MHZ_57600, umctl: UMCTL_1MHZ_57600, ssel: 0x02, pena: 0, pev: 0, spb: 0, clen: 1, listen: 0, mm: 0, ckpl: 0, urxse: 0, urxeie: 1, urxwie: 0, utxe : 1, urxe : 1} }; + + command error_t StdControl.start(){ + return call Resource.immediateRequest(); + } + command error_t StdControl.stop(){ + call Resource.release(); + return SUCCESS; + } + event void Resource.granted(){} + + async command msp430_uart_union_config_t* Msp430UartConfigure.getConfig() { + return &msp430_uart_telos_config; + } + +} -- 2.39.2