[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/TOSSIM-CC2420 AM.h, NONE,
1.1 HPLCC2420C.nc, NONE, 1.1 HPLCC2420M.nc, NONE,
1.1 README.txt, NONE, 1.1 hardware.c, NONE,
1.1 hardware.nido.h, NONE, 1.1 platforms.properties, NONE, 1.1
overbored
overbored at users.sourceforge.net
Mon Feb 14 20:15:17 PST 2005
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Drain/TestDrain Makefile, NONE,
1.1 TestDrain.h, NONE, 1.1 TestDrain.nc, NONE,
1.1 TestDrainM.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, 1.1,
1.2 DrainC.nc, 1.1, 1.2 DrainLinkEstM.nc, 1.1, 1.2 DrainM.nc,
1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/TOSSIM-CC2420
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16171/beta/TOSSIM-CC2420
Added Files:
AM.h HPLCC2420C.nc HPLCC2420M.nc README.txt hardware.c
hardware.nido.h platforms.properties
Log Message:
Added TOSSIM-CC2420 to beta. This is the CC2420 radio simulation component.
Added TestPC2420 to apps. This is a test suite for the CC2420 radio
simulation component.
Added sim.extra to tools/make/pc. This is to allow for platform-specific
TOSSIM compilation (e.g., "make pc sim,telos").
--- NEW FILE: AM.h ---
// $Id: AM.h,v 1.1 2005/02/15 04:15:12 overbored Exp $
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 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: Joe Polastre
* Date last modified: 4/19/2004
*
*/
// Message format
/**
* @author Joe Polastre
*/
#ifndef AM_H_INCLUDED
#define AM_H_INCLUDED
enum {
TOS_BCAST_ADDR = 0xffff,
TOS_UART_ADDR = 0x007e,
};
#ifndef DEF_TOS_AM_GROUP
#define DEF_TOS_AM_GROUP 0x7d
#endif
enum {
TOS_DEFAULT_AM_GROUP = DEF_TOS_AM_GROUP
};
uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP;
// TOSH_DATA_LENGTH *must* be an even number for the structure to be
// correctly word aligned!
#ifndef TOSH_DATA_LENGTH
#define TOSH_DATA_LENGTH 28
#endif
#ifndef TOSH_AM_LENGTH
#define TOSH_AM_LENGTH 1
#endif
typedef struct TOS_Msg
{
/* The following fields are transmitted/received on the radio. */
uint8_t length;
uint8_t fcfhi;
uint8_t fcflo;
uint8_t dsn;
uint16_t destpan;
uint16_t addr;
uint8_t type;
uint8_t group;
int8_t data[TOSH_DATA_LENGTH];
/* The following fields are not actually transmitted or received
* on the radio! They are used for internal accounting only.
* The reason they are in this structure is that the AM interface
* requires them to be part of the TOS_Msg that is passed to
* send/receive operations.
*/
uint8_t strength;
uint8_t lqi;
bool crc;
bool ack;
uint16_t time;
} __attribute((packed)) TOS_Msg;
enum {
// size of the header not including the length byte
MSG_HEADER_SIZE = offsetof(struct TOS_Msg, data) - 1,
// size of the footer
MSG_FOOTER_SIZE = 2,
// size of the full packet
MSG_DATA_SIZE = offsetof(struct TOS_Msg, strength) + sizeof(uint16_t),
// size of the data length
DATA_LENGTH = TOSH_DATA_LENGTH,
// position of the length byte
LENGTH_BYTE_NUMBER = offsetof(struct TOS_Msg, length) + 1,
};
typedef TOS_Msg *TOS_MsgPtr;
uint8_t TOS_MsgLength(uint8_t type)
{
#if 0
uint8_t i;
for (i = 0; i < MSGLEN_TABLE_SIZE; i++)
if (msgTable[i].handler == type)
return msgTable[i].length;
#endif
return offsetof(TOS_Msg, strength);
}
#endif
--- NEW FILE: HPLCC2420C.nc ---
// $Id: HPLCC2420C.nc,v 1.1 2005/02/15 04:15:12 overbored Exp $
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 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: Joe Polastre
* Date last modified: $Revision: 1.1 $
*
*/
/**
* Low level hardware access to the CC2420
* @author Joe Polastre
*/
configuration HPLCC2420C {
provides {
interface StdControl;
interface HPLCC2420;
interface HPLCC2420RAM;
interface HPLCC2420FIFO;
interface HPLCC2420Interrupt as InterruptFIFOP;
interface HPLCC2420Interrupt as InterruptFIFO;
interface HPLCC2420Interrupt as InterruptCCA;
interface HPLCC2420Capture as CaptureSFD;
}
}
implementation
{
components HPLCC2420M,
PowerStateM;
// , HPLUSART0M
// , TimerC
// , CC2420RXFIFO
// , HPLCC2420InterruptM;
// , MSP430InterruptC
// , MSP430TimerC
// , BusArbitrationC;
StdControl = HPLCC2420M;
HPLCC2420 = HPLCC2420M;
HPLCC2420RAM = HPLCC2420M;
HPLCC2420FIFO = HPLCC2420M;
InterruptFIFOP = HPLCC2420M.FIFOP;
InterruptFIFO = HPLCC2420M.FIFO;
InterruptCCA = HPLCC2420M.CCA;
CaptureSFD = HPLCC2420M.SFD;
HPLCC2420M.PowerState -> PowerStateM;
// HPLCC2420M.USARTControl -> HPLUSART0M;
// HPLCC2420M.BusArbitration -> BusArbitrationC.BusArbitration[unique("BusArbitration")];
// HPLCC2420InterruptM.FIFOPInterrupt -> MSP430InterruptC.Port10;
// HPLCC2420InterruptM.FIFOInterrupt -> MSP430InterruptC.Port13;
// HPLCC2420InterruptM.CCAInterrupt -> MSP430InterruptC.Port14;
// HPLCC2420InterruptM.SFDControl -> MSP430TimerC.ControlB1;
// HPLCC2420InterruptM.SFDCapture -> MSP430TimerC.CaptureB1;
// HPLCC2420InterruptM.SFDTimer -> TimerC.Timer[unique("Timer")];
}
--- NEW FILE: HPLCC2420M.nc ---
// $Id: HPLCC2420M.nc,v 1.1 2005/02/15 04:15:12 overbored Exp $
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
[...2682 lines suppressed...]
// Enables an edge interrupt on the SFD pin.
async command result_t SFD.enableCapture(bool low_to_high) {
pp("enter SFD.enableCapture(%s)", low_to_high ? "low to high" : "high to low");
sfdEnabled = TRUE;
sfdLowToHigh = low_to_high;
return SUCCESS;
}
// Disables SFD interrupts.
async command result_t SFD.disable() {
p("enter SFD.disable()");
sfdEnabled = FALSE;
return SUCCESS;
}
default async event result_t SFD.captured(uint16_t val) { return FAIL; }
}
--- NEW FILE: README.txt ---
TOSSIM CC2420 Radio Simulation Project
Introduction:
- This directory contains components that engage a prototype emulator of
the CC2420 transciever hardware.
Usage notes:
- To use this instead of the standard AVR radio simulation, simply
compile your application with:
make pc sim,<platform>
where <platform> is either telos or micaz.
- No changes to the Makefile are needed.
- To use TinyViz with this, run tinyviz from a directory containing the
platform.properties file in this directory. (Due to TinyViz's quirky
behavior, if you'd like to use the SetLocations/RadioLinks plugins,
make sure you activate those first before you attach to the TOSSIM
instance, which you should start with.)
- For debug output, include "packet" in your DBG flag.
General notes (description & features):
- This component exposes the HPLCC2420 interface to the CC2420 radio stack
(in tos/lib/CC2420Radio/).
- Simulation of packet transmission takes place on a packet-segment level.
That is, there are events for the start of the preamble, the start of
the frame, the end of the address field, and the end of the packet.
- All motes are able to hear packets. Clear channel assessment, address
recognition, and auto-acking are implemented.
- Most of the constants (timing, energy levels, etc.) are drawn from the
datasheet.
- The contents of ACK packets were obtained by sniffing packets with
the CC2420DBK packet sniffer.
- The simulation contains a hardware.c and hardware.nido.h which override
the default versions of these files in tos/platform/pc. These include
the CC2420 pin assignments (in hardware.niod.h), as well as changes to
the macro handler functions so that they behave correctly (in
hardware.c).
- For the second argument to make ("sim,<platform>"), we introduced
tools/make/pc/sim.extra. This is to avoid the need to reconfigure the
Makefile.
- The CC2420 provides LQI and RSSI readings to the packet. The simulator
generates these numbers and packet loss probabilities based on
empirical data over distance, so the simulation depends on the ADC
readings that contain the (X,Y) locations of the motes (which can
be set using the SetLocations plugin for TinyViz).
- The simulation sends TinyViz event messages for successfully received
non-ACK packets, so it works with RadioLinks plugin for TinyViz.
- The AM.h that is used here is the same as the AM.h in the telos
platform directory.
- The simulation has a test suite app, TestPC2420. It has also been
tested with SurgeTelos using LQIMultihopRoute (but without Deluge).
- The simulation has been tested on both Linux and Windows.
General action items:
- Sample from a normal distribution when generating random LQI and RSSI
numbers.
- Implement more of the command strobes (only a few are supported right
now - namely, the ones that are used in CC2420Radio).
- Resolve all the TODO issues in the code.
- Look into whether we can generate LQI and RSSI from the packet loss
properties alone, so that we can continue working with the TinyViz
model and won't have to rely on distance.
Contacts:
- Project members/groups (people to email with questions/changes):
Joe Polastre (UC Berkeley) <polastre at cs.berkeley.edu>
Yang Zhang (UC Berkeley) <yang.zhang at overbored.net>
--- NEW FILE: hardware.c ---
// $Id: hardware.c,v 1.1 2005/02/15 04:15:13 overbored Exp $
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 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
* Description: Implementation of NIDO hardware emulation.
* Date: September 24, 2001
*
*/
#include <dbg.h>
typedef struct {
char status_register; // SREG
char register_A;
char register_B;
char register_C;
char register_D;
char register_E;
char register_F;
char register_G;
char register_default;
} hwreg;
norace hwreg TOSH_pc_hardware;
norace hwreg* cc_pc_hardware;
void init_hardware() {
int i;
cc_pc_hardware = (hwreg*) malloc(sizeof(hwreg) * tos_state.num_nodes);
for (i = 0; i < tos_state.num_nodes; i++) {
tos_state.current_node = i;
TOSH_pc_hardware.status_register = 0xff;
cc_pc_hardware[i].register_F = 0;
cc_pc_hardware[i].register_G = 0;
}
}
short set_io_bit(char port, char bit) {
char* register_ptr;
switch(port) {
case PORTA:
register_ptr = &TOSH_pc_hardware.register_A;
break;
case PORTB:
register_ptr = &TOSH_pc_hardware.register_B;
break;
case PORTC:
register_ptr = &TOSH_pc_hardware.register_C;
break;
case PORTD:
register_ptr = &TOSH_pc_hardware.register_D;
break;
case PORTE:
register_ptr = &TOSH_pc_hardware.register_E;
break;
// TODO YANG is this appropriate?
case PORTF:
register_ptr = &cc_pc_hardware[NODE_NUM].register_F;
break;
case PORTG:
register_ptr = &cc_pc_hardware[NODE_NUM].register_G;
break;
case SREG:
register_ptr = &TOSH_pc_hardware.status_register;
break;
default:
register_ptr = &TOSH_pc_hardware.register_default;
break;
}
dbg(DBG_HARD, "Set bit %i of port %u\n", (int)bit, port);
*register_ptr = (*register_ptr |= (0x1 << bit));
return *register_ptr;
}
short clear_io_bit(char port, char bit) {
char* register_ptr = NULL;
dbg(DBG_HARD, "Clear bit %i of port %u\n", (int)bit, port);
switch(port) {
case PORTF:
register_ptr = &cc_pc_hardware[NODE_NUM].register_F;
break;
case PORTG:
register_ptr = &cc_pc_hardware[NODE_NUM].register_G;
break;
}
if (register_ptr != NULL) {
*register_ptr &= ~(1 << bit);
}
return 0xff;
}
char inp_emulate(char port) {
switch(port) {
case SREG:
//dbg(DBG_HARD, "inp(SREG)\n");
return TOSH_pc_hardware.status_register;
case TCNT0:
//dbg(DBG_HARD, "inp(TCNT0)\n");
return 0;
case PINF:
return cc_pc_hardware[NODE_NUM].register_F;
case PING:
return cc_pc_hardware[NODE_NUM].register_G;
default:
dbg(DBG_HARD, "inp(%u)\n", port);
return 0xff;
}
}
#ifdef RADIO_GET_BIT_RATE
char TOS_COMMAND(RADIO_GET_BIT_RATE)();
#endif
short inw_emulate(char port) {
switch(port) {
//case TCNT1L:
//#ifdef RADIO_GET_BIT_RATE
//return TOS_CALL_COMMAND(RADIO_GET_BIT_RATE)();
//#endif
default:
dbg(DBG_HARD, "inw(%u)\n", port);
return 0xffff;
}
}
char outp_emulate(char val, char port) {
dbg(DBG_HARD, "outp(0x%x, %u)\n", val, port);
return 0xff;
}
short cli(void) {
TOSH_pc_hardware.status_register &= 0x7f;
return 0xff;
}
short sei(void) {
TOSH_pc_hardware.status_register |= 0x80;
return 0xff;
}
--- NEW FILE: hardware.nido.h ---
// $Id: hardware.nido.h,v 1.1 2005/02/15 04:15:13 overbored Exp $
/* tab:4
* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 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, Nelson Lee
* Description: Declarations for NIDO hardware emulation.
* Date: September 24, 2001
*
*/
/**
* @author Philip Levis
* @author Nelson Lee
*/
#ifndef __HARDWARE_NIDO_H_INCLUDED
#define __HARDWARE_NIDO_H_INCLUDED
void init_hardware();
short set_io_bit(char port, char bit);
short clear_io_bit(char port, char bit);
char inp_emulate(char port);
char outp_emulate(char port, char bit);
short inw_emulate(char port);
short cli(void);
short set(void);
#define SREG 0x00
#define SPH 0x01
#define SPL 0x02
#define GIMSK 0x03
#define GIFR 0x04
#define TIMSK 0x05
#define TIFR 0x06
#define SPMCR 0x07
#define TWCR 0x08
#define MCUCR 0x09
#define MCUSR 0x10
#define TCCR0 0x11
#define TCNT0 0x12
#define OSCCAL 0x13
#define SFIOR 0x14
#define TCCR1A 0x15
#define TCCR1B 0x16
#define TCNT1H 0x17
#define TCNT1L 0x18
#define OCR1AH 0x19
#define OCR1AL 0x20
#define OCR1BH 0x21
#define OCR1BL 0x22
#define ICR1H 0x23
#define ICR1L 0x24
#define TCCR2 0x25
#define OCR2 0x26
#define ASSR 0x27
#define WDTCR 0x28
#define UBRRHI 0x29
#define EEARH 0x30
#define EEARL 0x31
#define EEDR 0x32
#define EECR 0x33
#define PORTA 0x34
#define PINA 0x35
#define DDRA 0x36
#define PORTB 0x37
#define PINB 0x38
#define DDRB 0x39
#define PORTC 0x40
#define PINC 0x41
#define DDRC 0x42
#define PORTD 0x43
#define PIND 0x44
#define DDRD 0x45
#define SPDR 0x46
#define SPSR 0x47
#define SPCR 0x48
#define UDR 0x49
#define UCSRA 0x50
#define UCSRB 0x51
#define UBRR 0x52
#define ACSR 0x53
#define ADMUX 0x54
#define ADCSR 0x55
#define ADCH 0x56
#define ADCL 0x57
#define TWDR 0x58
#define TWAR 0x59
#define TWSR 0x60
#define TWBR 0x61
#define ADEN 0x62
#define ADIE 0x63
#define ADSC 0x64
#define OCIE1A 0x65
#define TICIE1 0x66
#define TOIE0 0x67
#define TOIE1 0x68
#define OCIE1B 0x69
#define PORTE 0x70
#define PINE 0x71
#define DDRE 0x72
#define UCR 0x73
#define USR 0x74
#define TXC 0x75
//needed to compile hpl.h
#define OCIE0 0x76
#define AS0 0x77
#define OCR0 0x78
#define ADIF 0x79
#define EIMSK 0x80
#define INT3 0x81
#define TCNT2 0x82
//by brchen needed to support snooze related pins
#define ADCSRA 0x83
#define SM0 0x84
#define SM1 0x85
#define SE 0x86
#define ACD 0x87
// ADDED
// TODO YANG is this appropriate?
// TODO the leading bit will be sign-extended, so the the debug outputs in set_io_bit* will come out as a huge number
#define PORTF -1
#define PINF -2
#define DDRF -3
#define PORTG -4
#define PING -5
#define DDRG -6
/* SPI Control Register - SPCR */
#define SPIE 7
#define SPE 6
#define DORD 5
#define MSTR 4
#define CPOL 3
#define CPHA 2
#define SPR1 1
#define SPR0 0
//end brchen
int a_holder_val;
//#define sbi(x...) a_holder_val = 1
//#define cbi(x...) a_holder_val = 1
//#define cli() a_holder_val = 1
//#define sei() a_holder_val = 1
#define sbi(port, bit) set_io_bit(port, bit)
#define cbi(port, bit) clear_io_bit(port, bit)
#define inp(port) inp_emulate(port)
#define outp(val, port) outp_emulate(val, port)
#define __inw(port) inw_emulate(port)
#define __inw_atomic(port) inw_emulate(port)
#define TOSH_ASSIGN_PIN(name, port, bit) \
static inline void TOSH_SET_##name##_PIN() {sbi(PORT##port , bit);} \
static inline void TOSH_CLR_##name##_PIN() {cbi(PORT##port , bit);} \
static inline char TOSH_READ_##name##_PIN() {return 0x01 & (inp(PIN##port) >> bit);} \
static inline void TOSH_MAKE_##name##_OUTPUT() {sbi(DDR##port , bit);} \
static inline void TOSH_MAKE_##name##_INPUT() {cbi(DDR##port , bit);}
#define TOSH_ASSIGN_OUTPUT_ONLY_PIN(name, port, bit) \
static inline void TOSH_SET_##name##_PIN() {sbi(PORT##port , bit);} \
static inline void TOSH_CLR_##name##_PIN() {cbi(PORT##port , bit);} \
static inline void TOSH_MAKE_##name##_OUTPUT() {;}
#define TOSH_ALIAS_OUTPUT_ONLY_PIN(alias, connector)\
static inline void TOSH_SET_##alias##_PIN() {TOSH_SET_##connector##_PIN();} \
static inline void TOSH_CLR_##alias##_PIN() {TOSH_CLR_##connector##_PIN();} \
static inline void TOSH_MAKE_##alias##_OUTPUT() {} \
#define TOSH_ALIAS_PIN(alias, connector) \
static inline void TOSH_SET_##alias##_PIN() {TOSH_SET_##connector##_PIN();} \
static inline void TOSH_CLR_##alias##_PIN() {TOSH_CLR_##connector##_PIN();} \
static inline char TOSH_READ_##alias##_PIN() {return TOSH_READ_##connector##_PIN();} \
static inline void TOSH_MAKE_##alias##_OUTPUT() {TOSH_MAKE_##connector##_OUTPUT();} \
static inline void TOSH_MAKE_##alias##_INPUT() {TOSH_MAKE_##connector##_INPUT();}
/* Watchdog Prescaler
*/
enum {
TOSH_period16 = 0x00, // 47ms
TOSH_period32 = 0x01, // 94ms
TOSH_period64 = 0x02, // 0.19s
TOSH_period128 = 0x03, // 0.38s
TOSH_period256 = 0x04, // 0.75s
TOSH_period512 = 0x05, // 1.5s
TOSH_period1024 = 0x06, // 3.0s
TOSH_period2048 = 0x07 // 6.0s
};
//brchen: add for CC1000RadioC.nc
enum
{
TOSH_ACTUAL_CC_RSSI_PORT = 0,
TOSH_ACTUAL_VOLTAGE_PORT = 7,
TOSH_ACTUAL_BANDGAP_PORT = 30, // 1.23 Fixed bandgap reference
TOSH_ACTUAL_GND_PORT = 31 // GND
};
enum
{
TOS_ADC_CC_RSSI_PORT = 0,
TOS_ADC_VOLTAGE_PORT = 7,
TOS_ADC_BANDGAP_PORT = 10,
TOS_ADC_GND_PORT = 11
};
//end brchen
TOSH_ASSIGN_PIN(RED_LED, A, 2);
TOSH_ASSIGN_PIN(YELLOW_LED, A, 0);
TOSH_ASSIGN_PIN(GREEN_LED, A, 1);
TOSH_ASSIGN_PIN(UD, A, 1);
TOSH_ASSIGN_PIN(INC, A, 2);
TOSH_ASSIGN_PIN(POT_SELECT, D, 5);
TOSH_ASSIGN_PIN(POT_POWER, E, 7);
TOSH_ASSIGN_PIN(BOOST_ENABLE, E, 4);
TOSH_ASSIGN_PIN(FLASH_SELECT, B, 0);
TOSH_ASSIGN_PIN(FLASH_CLK, A, 3);
TOSH_ASSIGN_PIN(FLASH_OUT, A, 7);
TOSH_ASSIGN_PIN(FLASH_IN, A, 6);
TOSH_ASSIGN_PIN(INT1, D, 1);
TOSH_ASSIGN_PIN(INT2, D, 2);
TOSH_ASSIGN_PIN(INT3, D, 3);
TOSH_ASSIGN_PIN(RFM_RXD, B, 2);
TOSH_ASSIGN_PIN(RFM_TXD, B, 3);
TOSH_ASSIGN_PIN(RFM_CTL0, D, 7);
TOSH_ASSIGN_PIN(RFM_CTL1, D, 6);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW0, C, 0);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW1, C, 1);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW2, C, 2);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW3, C, 3);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW4, C, 4);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW5, C, 5);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW6, C, 6);
TOSH_ASSIGN_OUTPUT_ONLY_PIN(PW7, C, 7);
TOSH_ASSIGN_PIN(I2C_BUS1_SCL, A, 4);
TOSH_ASSIGN_PIN(I2C_BUS1_SDA, A, 5);
TOSH_ASSIGN_PIN(LITTLE_GUY_RESET, E, 6);
TOSH_ASSIGN_PIN(UART_RXD0, E, 0);
TOSH_ASSIGN_PIN(UART_TXD0, E, 1);
TOSH_ASSIGN_PIN(ONE_WIRE, E, 5);
// ADDED
// TODO YANG is this appropriate?
// CC2420 RADIO #defines
TOSH_ASSIGN_PIN(RADIO_CSN, F, 0);
TOSH_ASSIGN_PIN(RADIO_VREF, F, 1);
TOSH_ASSIGN_PIN(RADIO_RESET, F, 2);
TOSH_ASSIGN_PIN(RADIO_FIFOP, F, 3);
TOSH_ASSIGN_PIN(RADIO_SFD, F, 4);
TOSH_ASSIGN_PIN(RADIO_GIO0, F, 5);
TOSH_ASSIGN_PIN(RADIO_FIFO, F, 6);
TOSH_ASSIGN_PIN(RADIO_GIO1, F, 7);
TOSH_ASSIGN_PIN(RADIO_CCA, G, 0);
TOSH_ASSIGN_PIN(CC_FIFOP, G, 1);
TOSH_ASSIGN_PIN(CC_FIFO, G, 2);
TOSH_ASSIGN_PIN(CC_SFD, G, 3);
TOSH_ASSIGN_PIN(CC_VREN, G, 4);
TOSH_ASSIGN_PIN(CC_RSTN, G, 5);
void TOSH_SET_PIN_DIRECTIONS(void)
{
outp(0x00, DDRA);
outp(0x00, DDRB);
outp(0x00, DDRD);
outp(0x02, DDRE);
outp(0x02, PORTE);
TOSH_MAKE_RED_LED_OUTPUT();
TOSH_MAKE_YELLOW_LED_OUTPUT();
TOSH_MAKE_GREEN_LED_OUTPUT();
TOSH_MAKE_POT_SELECT_OUTPUT();
TOSH_MAKE_POT_POWER_OUTPUT();
TOSH_MAKE_PW7_OUTPUT();
TOSH_MAKE_PW6_OUTPUT();
TOSH_MAKE_PW5_OUTPUT();
TOSH_MAKE_PW4_OUTPUT();
TOSH_MAKE_PW3_OUTPUT();
TOSH_MAKE_PW2_OUTPUT();
TOSH_MAKE_PW1_OUTPUT();
TOSH_MAKE_PW0_OUTPUT();
TOSH_MAKE_RFM_CTL0_OUTPUT();
TOSH_MAKE_RFM_CTL1_OUTPUT();
TOSH_MAKE_RFM_TXD_OUTPUT();
TOSH_SET_POT_POWER_PIN();
TOSH_MAKE_FLASH_SELECT_OUTPUT();
TOSH_MAKE_FLASH_OUT_OUTPUT();
TOSH_MAKE_FLASH_CLK_OUTPUT();
TOSH_SET_FLASH_SELECT_PIN();
TOSH_SET_RED_LED_PIN();
TOSH_SET_YELLOW_LED_PIN();
TOSH_SET_GREEN_LED_PIN();
TOSH_MAKE_BOOST_ENABLE_OUTPUT();
TOSH_SET_BOOST_ENABLE_PIN();
TOSH_MAKE_ONE_WIRE_INPUT();
TOSH_SET_ONE_WIRE_PIN();
}
#endif
--- NEW FILE: platforms.properties ---
##Initial properties for the known platforms
#This property file is used to associate the platforms specified in the comm
#ID string (e.g. serial at COM1:mica) with various plaftorm-specific parameters
#The entry format is as follows:
# <platform>=<platform package>, <integer ID>, <baudrate>
# where
#<platform> -- that's the platform we compile for (i.e. valid nesc target
#<platform package> -- name of the common package family that uses the same AM format (e.g. avrmote)
#<integer ID> -- unique integer that is used by serial forwarder to identify the platform across the network
#<baudrate> -- default serial port datarate used to communicate with the mote
#Thu Nov 04 18:44:39 PST 2004
telos=telos,1,19200
mica=avrmote,2,19200
eyes=eyes,4,19200
micaz=micaz,3,57600
mica2=avrmote,2,57600
mica2dot=avrmote,2,19200
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Drain/TestDrain Makefile, NONE,
1.1 TestDrain.h, NONE, 1.1 TestDrain.nc, NONE,
1.1 TestDrainM.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, 1.1,
1.2 DrainC.nc, 1.1, 1.2 DrainLinkEstM.nc, 1.1, 1.2 DrainM.nc,
1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list