repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
---|---|---|
tinyos-io/tinyos-3.x-contrib | wsu/tools/XMonitor/oasis/apps/OasisApp/build/telosb/app.c | #define nx_struct struct
#define nx_union union
#define dbg(mode, format, ...) ((void)0)
#define dbg_clear(mode, format, ...) ((void)0)
#define dbg_active(mode) 0
# 38 "/usr/msp430/include/sys/inttypes.h"
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef int int16_t;
typedef unsigned int uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
typedef int16_t intptr_t;
typedef uint16_t uintptr_t;
# 385 "/usr/lib/ncc/nesc_nx.h"
typedef struct { char data[1]; } __attribute__((packed)) nx_int8_t;typedef int8_t __nesc_nxbase_nx_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_int16_t;typedef int16_t __nesc_nxbase_nx_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_int32_t;typedef int32_t __nesc_nxbase_nx_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_int64_t;typedef int64_t __nesc_nxbase_nx_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nx_uint8_t;typedef uint8_t __nesc_nxbase_nx_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_uint16_t;typedef uint16_t __nesc_nxbase_nx_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_uint32_t;typedef uint32_t __nesc_nxbase_nx_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_uint64_t;typedef uint64_t __nesc_nxbase_nx_uint64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_int8_t;typedef int8_t __nesc_nxbase_nxle_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_int16_t;typedef int16_t __nesc_nxbase_nxle_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_int32_t;typedef int32_t __nesc_nxbase_nxle_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_int64_t;typedef int64_t __nesc_nxbase_nxle_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_uint8_t;typedef uint8_t __nesc_nxbase_nxle_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_uint16_t;typedef uint16_t __nesc_nxbase_nxle_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_uint32_t;typedef uint32_t __nesc_nxbase_nxle_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_uint64_t;typedef uint64_t __nesc_nxbase_nxle_uint64_t ;
# 151 "/usr/lib/gcc-lib/msp430/3.2.3/include/stddef.h" 3
typedef int ptrdiff_t;
#line 213
typedef unsigned int size_t;
#line 325
typedef int wchar_t;
# 41 "/usr/msp430/include/sys/types.h"
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef u_int64_t u_quad_t;
typedef int64_t quad_t;
typedef quad_t *qaddr_t;
typedef char *caddr_t;
typedef const char *c_caddr_t;
typedef volatile char *v_caddr_t;
typedef u_int32_t fixpt_t;
typedef u_int32_t gid_t;
typedef u_int32_t in_addr_t;
typedef u_int16_t in_port_t;
typedef u_int32_t ino_t;
typedef long key_t;
typedef u_int16_t mode_t;
typedef u_int16_t nlink_t;
typedef quad_t rlim_t;
typedef int32_t segsz_t;
typedef int32_t swblk_t;
typedef int32_t ufs_daddr_t;
typedef int32_t ufs_time_t;
typedef u_int32_t uid_t;
# 43 "/usr/msp430/include/string.h"
extern char *strcat(char *, const char *);
extern size_t strlen(const char *);
#line 64
extern void bzero(void *, size_t );
# 59 "/usr/msp430/include/stdlib.h"
#line 56
typedef struct __nesc_unnamed4242 {
int quot;
int rem;
} div_t;
#line 64
typedef struct __nesc_unnamed4243 {
long quot;
long rem;
} ldiv_t;
# 122 "/usr/msp430/include/sys/config.h" 3
typedef long int __int32_t;
typedef unsigned long int __uint32_t;
# 12 "/usr/msp430/include/sys/_types.h"
typedef long _off_t;
typedef long _ssize_t;
# 28 "/usr/msp430/include/sys/reent.h" 3
typedef __uint32_t __ULong;
struct _glue {
struct _glue *_next;
int _niobs;
struct __sFILE *_iobs;
};
struct _Bigint {
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm {
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void );
};
struct __sbuf {
unsigned char *_base;
int _size;
};
typedef long _fpos_t;
#line 116
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void *_cookie;
int (*_read)(void *_cookie, char *_buf, int _n);
int (*_write)(void *_cookie, const char *_buf, int _n);
_fpos_t (*_seek)(void *_cookie, _fpos_t _offset, int _whence);
int (*_close)(void *_cookie);
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
int _offset;
struct _reent *_data;
};
#line 174
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
struct _reent {
int _errno;
struct __sFILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _current_category;
const char *_current_locale;
int __sdidinit;
void (*__cleanup)(struct _reent *);
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union __nesc_unnamed4244 {
struct __nesc_unnamed4245 {
unsigned int _unused_rand;
char *_strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
} _reent;
struct __nesc_unnamed4246 {
unsigned char *_nextf[30];
unsigned int _nmalloc[30];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**_sig_func)(int );
struct _glue __sglue;
struct __sFILE __sf[3];
};
#line 273
struct _reent;
# 18 "/usr/msp430/include/math.h"
union __dmath {
__uint32_t i[2];
double d;
};
union __dmath;
#line 208
struct exception {
int type;
char *name;
double arg1;
double arg2;
double retval;
int err;
};
#line 261
enum __fdlibm_version {
__fdlibm_ieee = -1,
__fdlibm_svid,
__fdlibm_xopen,
__fdlibm_posix
};
enum __fdlibm_version;
# 91 "/opt/tinyos-1.x/tos/system/tos.h"
typedef unsigned char bool;
enum __nesc_unnamed4247 {
FALSE = 0,
TRUE = 1
};
uint16_t TOS_LOCAL_ADDRESS = 1;
enum __nesc_unnamed4248 {
FAIL = 0,
SUCCESS = 1
};
static inline uint8_t rcombine(uint8_t r1, uint8_t r2);
typedef uint8_t result_t ;
static inline result_t rcombine(result_t r1, result_t r2);
#line 140
enum __nesc_unnamed4249 {
NULL = 0x0
};
# 39 "/usr/msp430/include/msp430/iostructures.h"
#line 27
typedef union port {
volatile unsigned char reg_p;
volatile struct __nesc_unnamed4250 {
unsigned char __p0 : 1,
__p1 : 1,
__p2 : 1,
__p3 : 1,
__p4 : 1,
__p5 : 1,
__p6 : 1,
__p7 : 1;
} __pin;
} __attribute((packed)) ioregister_t;
# 108 "/usr/msp430/include/msp430/iostructures.h" 3
struct port_full_t {
ioregister_t in;
ioregister_t out;
ioregister_t dir;
ioregister_t ifg;
ioregister_t ies;
ioregister_t ie;
ioregister_t sel;
};
struct port_simple_t {
ioregister_t in;
ioregister_t out;
ioregister_t dir;
ioregister_t sel;
};
struct port_full_t;
struct port_full_t;
struct port_simple_t;
struct port_simple_t;
struct port_simple_t;
struct port_simple_t;
# 116 "/usr/msp430/include/msp430/gpio.h" 3
volatile unsigned char P1OUT __asm ("0x0021");
volatile unsigned char P1DIR __asm ("0x0022");
volatile unsigned char P1IES __asm ("0x0024");
volatile unsigned char P1IE __asm ("0x0025");
volatile unsigned char P1SEL __asm ("0x0026");
volatile unsigned char P2OUT __asm ("0x0029");
volatile unsigned char P2DIR __asm ("0x002A");
volatile unsigned char P2IE __asm ("0x002D");
volatile unsigned char P2SEL __asm ("0x002E");
volatile unsigned char P3OUT __asm ("0x0019");
volatile unsigned char P3DIR __asm ("0x001A");
volatile unsigned char P3SEL __asm ("0x001B");
volatile unsigned char P4OUT __asm ("0x001D");
volatile unsigned char P4DIR __asm ("0x001E");
volatile unsigned char P4SEL __asm ("0x001F");
volatile unsigned char P5OUT __asm ("0x0031");
volatile unsigned char P5DIR __asm ("0x0032");
volatile unsigned char P5SEL __asm ("0x0033");
volatile unsigned char P6OUT __asm ("0x0035");
volatile unsigned char P6DIR __asm ("0x0036");
volatile unsigned char P6SEL __asm ("0x0037");
# 92 "/usr/msp430/include/msp430/usart.h"
volatile unsigned char U0CTL __asm ("0x0070");
volatile unsigned char U0TCTL __asm ("0x0071");
volatile unsigned char U0MCTL __asm ("0x0073");
volatile unsigned char U0BR0 __asm ("0x0074");
volatile unsigned char U0BR1 __asm ("0x0075");
volatile unsigned char U0RXBUF __asm ("0x0076");
#line 275
volatile unsigned char U1CTL __asm ("0x0078");
volatile unsigned char U1TCTL __asm ("0x0079");
volatile unsigned char U1RCTL __asm ("0x007A");
volatile unsigned char U1MCTL __asm ("0x007B");
volatile unsigned char U1BR0 __asm ("0x007C");
volatile unsigned char U1BR1 __asm ("0x007D");
volatile unsigned char U1RXBUF __asm ("0x007E");
# 24 "/usr/msp430/include/msp430/flash.h"
volatile unsigned int FCTL3 __asm ("0x012C");
# 25 "/usr/msp430/include/msp430/timera.h"
volatile unsigned int TA0IV __asm ("0x012E");
volatile unsigned int TA0CTL __asm ("0x0160");
volatile unsigned int TA0R __asm ("0x0170");
# 127 "/usr/msp430/include/msp430/timera.h" 3
#line 118
typedef struct __nesc_unnamed4251 {
volatile unsigned
taifg : 1,
taie : 1,
taclr : 1,
dummy : 1,
tamc : 2,
taid : 2,
tassel : 2;
} __attribute((packed)) tactl_t;
#line 143
#line 129
typedef struct __nesc_unnamed4252 {
volatile unsigned
ccifg : 1,
cov : 1,
out : 1,
cci : 1,
ccie : 1,
outmod : 3,
cap : 1,
dummy : 1,
scci : 1,
scs : 1,
ccis : 2,
cm : 2;
} __attribute((packed)) tacctl_t;
struct timera_t {
tactl_t ctl;
tacctl_t cctl0;
tacctl_t cctl1;
tacctl_t cctl2;
volatile unsigned dummy[4];
volatile unsigned tar;
volatile unsigned taccr0;
volatile unsigned taccr1;
volatile unsigned taccr2;
};
struct timera_t;
# 22 "/usr/msp430/include/msp430/timerb.h"
volatile unsigned int TBIV __asm ("0x011E");
volatile unsigned int TBCTL __asm ("0x0180");
volatile unsigned int TBR __asm ("0x0190");
volatile unsigned int TBCCTL0 __asm ("0x0182");
volatile unsigned int TBCCR0 __asm ("0x0192");
#line 76
#line 64
typedef struct __nesc_unnamed4253 {
volatile unsigned
tbifg : 1,
tbie : 1,
tbclr : 1,
dummy1 : 1,
tbmc : 2,
tbid : 2,
tbssel : 2,
dummy2 : 1,
tbcntl : 2,
tbclgrp : 2;
} __attribute((packed)) tbctl_t;
#line 91
#line 78
typedef struct __nesc_unnamed4254 {
volatile unsigned
ccifg : 1,
cov : 1,
out : 1,
cci : 1,
ccie : 1,
outmod : 3,
cap : 1,
clld : 2,
scs : 1,
ccis : 2,
cm : 2;
} __attribute((packed)) tbcctl_t;
struct timerb_t {
tbctl_t ctl;
tbcctl_t cctl0;
tbcctl_t cctl1;
tbcctl_t cctl2;
tbcctl_t cctl3;
tbcctl_t cctl4;
tbcctl_t cctl5;
tbcctl_t cctl6;
volatile unsigned tbr;
volatile unsigned tbccr0;
volatile unsigned tbccr1;
volatile unsigned tbccr2;
volatile unsigned tbccr3;
volatile unsigned tbccr4;
volatile unsigned tbccr5;
volatile unsigned tbccr6;
};
struct timerb_t;
# 20 "/usr/msp430/include/msp430/basic_clock.h"
volatile unsigned char DCOCTL __asm ("0x0056");
volatile unsigned char BCSCTL1 __asm ("0x0057");
volatile unsigned char BCSCTL2 __asm ("0x0058");
# 18 "/usr/msp430/include/msp430/adc12.h"
volatile unsigned int ADC12CTL0 __asm ("0x01A0");
volatile unsigned int ADC12CTL1 __asm ("0x01A2");
#line 42
#line 30
typedef struct __nesc_unnamed4255 {
volatile unsigned
adc12sc : 1,
enc : 1,
adc12tovie : 1,
adc12ovie : 1,
adc12on : 1,
refon : 1,
r2_5v : 1,
msc : 1,
sht0 : 4,
sht1 : 4;
} __attribute((packed)) adc12ctl0_t;
#line 54
#line 44
typedef struct __nesc_unnamed4256 {
volatile unsigned
adc12busy : 1,
conseq : 2,
adc12ssel : 2,
adc12div : 3,
issh : 1,
shp : 1,
shs : 2,
cstartadd : 4;
} __attribute((packed)) adc12ctl1_t;
#line 74
#line 56
typedef struct __nesc_unnamed4257 {
volatile unsigned
bit0 : 1,
bit1 : 1,
bit2 : 1,
bit3 : 1,
bit4 : 1,
bit5 : 1,
bit6 : 1,
bit7 : 1,
bit8 : 1,
bit9 : 1,
bit10 : 1,
bit11 : 1,
bit12 : 1,
bit13 : 1,
bit14 : 1,
bit15 : 1;
} __attribute((packed)) adc12xflg_t;
struct adc12_t {
adc12ctl0_t ctl0;
adc12ctl1_t ctl1;
adc12xflg_t ifg;
adc12xflg_t ie;
adc12xflg_t iv;
};
struct adc12_t;
# 65 "/usr/msp430/include/msp430x16x.h"
volatile unsigned char IFG1 __asm ("0x0002");
volatile unsigned char IE2 __asm ("0x0001");
volatile unsigned char ME1 __asm ("0x0004");
volatile unsigned char ME2 __asm ("0x0005");
# 161 "/opt/tinyos-1.x/tos/platform/msp430/msp430hardware.h"
static __inline void TOSH_wait(void );
#line 174
static __inline void TOSH_uwait(uint16_t u);
#line 196
static inline void __nesc_disable_interrupt(void);
static inline void __nesc_enable_interrupt(void);
static inline bool are_interrupts_enabled(void);
typedef bool __nesc_atomic_t;
static inline __nesc_atomic_t __nesc_atomic_start(void );
static inline void __nesc_atomic_end(__nesc_atomic_t oldSreg);
static inline __nesc_atomic_t __nesc_atomic_start(void );
static inline void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts);
bool LPMode_disabled = FALSE;
static __inline void __nesc_atomic_sleep(void);
# 116 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12.h"
#line 105
typedef struct __nesc_unnamed4258 {
unsigned int refVolt2_5 : 1;
unsigned int clockSourceSHT : 2;
unsigned int clockSourceSAMPCON : 2;
unsigned int clockDivSAMPCON : 2;
unsigned int referenceVoltage : 3;
unsigned int clockDivSHT : 3;
unsigned int inputChannel : 4;
unsigned int sampleHoldTime : 4;
unsigned int : 0;
} MSP430ADC12Settings_t;
#line 118
typedef enum __nesc_unnamed4259 {
MSP430ADC12_FAIL = 0,
MSP430ADC12_SUCCESS = 1,
MSP430ADC12_DELAYED = 2
} msp430ADCresult_t;
enum refVolt2_5_enum {
REFVOLT_LEVEL_1_5 = 0,
REFVOLT_LEVEL_2_5 = 1
};
enum clockDivSHT_enum {
SHT_CLOCK_DIV_1 = 0,
SHT_CLOCK_DIV_2 = 1,
SHT_CLOCK_DIV_3 = 2,
SHT_CLOCK_DIV_4 = 3,
SHT_CLOCK_DIV_5 = 4,
SHT_CLOCK_DIV_6 = 5,
SHT_CLOCK_DIV_7 = 6,
SHT_CLOCK_DIV_8 = 7
};
enum clockDivSAMPCON_enum {
SAMPCON_CLOCK_DIV_1 = 0,
SAMPCON_CLOCK_DIV_2 = 1,
SAMPCON_CLOCK_DIV_3 = 2,
SAMPCON_CLOCK_DIV_4 = 3
};
enum clockSourceSAMPCON_enum {
SAMPCON_SOURCE_TACLK = 0,
SAMPCON_SOURCE_ACLK = 1,
SAMPCON_SOURCE_SMCLK = 2,
SAMPCON_SOURCE_INCLK = 3
};
enum inputChannel_enum {
INPUT_CHANNEL_A0 = 0,
INPUT_CHANNEL_A1 = 1,
INPUT_CHANNEL_A2 = 2,
INPUT_CHANNEL_A3 = 3,
INPUT_CHANNEL_A4 = 4,
INPUT_CHANNEL_A5 = 5,
INPUT_CHANNEL_A6 = 6,
INPUT_CHANNEL_A7 = 7,
EXTERNAL_REFERENCE_VOLTAGE = 8,
REFERENCE_VOLTAGE_NEGATIVE_TERMINAL = 9,
INTERNAL_TEMPERATURE = 10,
INTERNAL_VOLTAGE = 11
};
enum referenceVoltage_enum {
REFERENCE_AVcc_AVss = 0,
REFERENCE_VREFplus_AVss = 1,
REFERENCE_VeREFplus_AVss = 2,
REFERENCE_AVcc_VREFnegterm = 4,
REFERENCE_VREFplus_VREFnegterm = 5,
REFERENCE_VeREFplus_VREFnegterm = 6
};
enum clockSourceSHT_enum {
SHT_SOURCE_ADC12OSC = 0,
SHT_SOURCE_ACLK = 1,
SHT_SOURCE_MCLK = 2,
SHT_SOURCE_SMCLK = 3
};
enum sampleHold_enum {
SAMPLE_HOLD_4_CYCLES = 0,
SAMPLE_HOLD_8_CYCLES = 1,
SAMPLE_HOLD_16_CYCLES = 2,
SAMPLE_HOLD_32_CYCLES = 3,
SAMPLE_HOLD_64_CYCLES = 4,
SAMPLE_HOLD_96_CYCLES = 5,
SAMPLE_HOLD_123_CYCLES = 6,
SAMPLE_HOLD_192_CYCLES = 7,
SAMPLE_HOLD_256_CYCLES = 8,
SAMPLE_HOLD_384_CYCLES = 9,
SAMPLE_HOLD_512_CYCLES = 10,
SAMPLE_HOLD_768_CYCLES = 11,
SAMPLE_HOLD_1024_CYCLES = 12
};
#line 216
typedef union __nesc_unnamed4260 {
uint32_t i;
MSP430ADC12Settings_t s;
} MSP430ADC12Settings_ut;
enum __nesc_unnamed4261 {
ADC_IDLE = 0,
SINGLE_CHANNEL = 1,
REPEAT_SINGLE_CHANNEL = 2,
SEQUENCE_OF_CHANNELS = 4,
REPEAT_SEQUENCE_OF_CHANNELS = 8,
TIMER_USED = 16,
RESERVED = 32,
VREF_WAIT = 64
};
#line 261
#line 255
typedef struct __nesc_unnamed4262 {
volatile unsigned
inch : 4,
sref : 3,
eos : 1;
} __attribute((packed)) adc12memctl_t;
#line 274
#line 263
typedef struct __nesc_unnamed4263 {
unsigned int refVolt2_5 : 1;
unsigned int gotRefVolt : 1;
unsigned int result_16bit : 1;
unsigned int clockSourceSHT : 2;
unsigned int clockSourceSAMPCON : 2;
unsigned int clockDivSAMPCON : 2;
unsigned int clockDivSHT : 3;
unsigned int sampleHoldTime : 4;
adc12memctl_t memctl;
} __attribute((packed)) adc12settings_t;
# 58 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Const.h"
enum __nesc_unnamed4264 {
CC2420_TIME_BIT = 4,
CC2420_TIME_BYTE = CC2420_TIME_BIT << 3,
CC2420_TIME_SYMBOL = 16
};
uint8_t CC2420_CHANNEL = 20;
uint8_t CC2420_RFPOWER = 2;
enum __nesc_unnamed4265 {
CC2420_MIN_CHANNEL = 11,
CC2420_MAX_CHANNEL = 26
};
#line 261
enum __nesc_unnamed4266 {
CP_MAIN = 0,
CP_MDMCTRL0,
CP_MDMCTRL1,
CP_RSSI,
CP_SYNCWORD,
CP_TXCTRL,
CP_RXCTRL0,
CP_RXCTRL1,
CP_FSCTRL,
CP_SECCTRL0,
CP_SECCTRL1,
CP_BATTMON,
CP_IOCFG0,
CP_IOCFG1
};
# 46 "/opt/tinyos-1.x/tos/platform/telos/AM.h"
enum __nesc_unnamed4267 {
TOS_BCAST_ADDR = 0xffff,
TOS_UART_ADDR = 0x007e
};
enum __nesc_unnamed4268 {
TOS_DEFAULT_AM_GROUP = 0x7D
};
uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP;
#line 95
#line 71
typedef struct TOS_Msg {
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[74];
uint8_t strength;
uint8_t lqi;
bool crc;
bool ack;
uint16_t time;
} __attribute((packed)) TOS_Msg;
enum __nesc_unnamed4269 {
MSG_HEADER_SIZE = (size_t )& ((struct TOS_Msg *)0)->data - 1,
MSG_FOOTER_SIZE = 2,
MSG_DATA_SIZE = (size_t )& ((struct TOS_Msg *)0)->strength + sizeof(uint16_t ),
DATA_LENGTH = 74,
LENGTH_BYTE_NUMBER = (size_t )& ((struct TOS_Msg *)0)->length + 1
};
typedef TOS_Msg *TOS_MsgPtr;
# 12 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_RED_LED_PIN(void);
#line 12
static inline void TOSH_CLR_RED_LED_PIN(void);
static inline void TOSH_SET_GREEN_LED_PIN(void);
#line 13
static inline void TOSH_CLR_GREEN_LED_PIN(void);
static inline void TOSH_SET_YELLOW_LED_PIN(void);
#line 14
static inline void TOSH_CLR_YELLOW_LED_PIN(void);
static inline void TOSH_SET_RADIO_CSN_PIN(void);
#line 17
static inline void TOSH_CLR_RADIO_CSN_PIN(void);
#line 17
static inline void TOSH_MAKE_RADIO_CSN_OUTPUT(void);
static inline uint8_t TOSH_READ_RADIO_CCA_PIN(void);
static inline uint8_t TOSH_READ_CC_FIFOP_PIN(void);
static inline uint8_t TOSH_READ_CC_FIFO_PIN(void);
static inline uint8_t TOSH_READ_CC_SFD_PIN(void);
#line 29
static inline void TOSH_SEL_CC_SFD_MODFUNC(void);
#line 29
static inline void TOSH_SEL_CC_SFD_IOFUNC(void);
static inline void TOSH_SET_CC_VREN_PIN(void);
static inline void TOSH_SET_CC_RSTN_PIN(void);
#line 31
static inline void TOSH_CLR_CC_RSTN_PIN(void);
static inline void TOSH_SEL_SOMI0_MODFUNC(void);
static inline void TOSH_SET_SIMO0_PIN(void);
#line 35
static inline void TOSH_CLR_SIMO0_PIN(void);
#line 35
static inline void TOSH_MAKE_SIMO0_OUTPUT(void);
#line 35
static inline void TOSH_MAKE_SIMO0_INPUT(void);
#line 35
static inline void TOSH_SEL_SIMO0_MODFUNC(void);
static inline void TOSH_SET_UCLK0_PIN(void);
#line 36
static inline void TOSH_CLR_UCLK0_PIN(void);
#line 36
static inline void TOSH_MAKE_UCLK0_OUTPUT(void);
#line 36
static inline void TOSH_MAKE_UCLK0_INPUT(void);
#line 36
static inline void TOSH_SEL_UCLK0_MODFUNC(void);
static inline void TOSH_SEL_UTXD0_IOFUNC(void);
#line 37
static inline bool TOSH_IS_UTXD0_MODFUNC(void);
#line 37
static inline bool TOSH_IS_UTXD0_IOFUNC(void);
static inline void TOSH_SEL_URXD0_IOFUNC(void);
#line 38
static inline bool TOSH_IS_URXD0_MODFUNC(void);
#line 38
static inline bool TOSH_IS_URXD0_IOFUNC(void);
static inline void TOSH_SEL_UTXD1_MODFUNC(void);
#line 39
static inline void TOSH_SEL_UTXD1_IOFUNC(void);
#line 39
static inline bool TOSH_IS_UTXD1_MODFUNC(void);
#line 39
static inline bool TOSH_IS_UTXD1_IOFUNC(void);
static inline void TOSH_SEL_URXD1_MODFUNC(void);
#line 40
static inline void TOSH_SEL_URXD1_IOFUNC(void);
#line 40
static inline bool TOSH_IS_URXD1_MODFUNC(void);
#line 40
static inline bool TOSH_IS_URXD1_IOFUNC(void);
static inline void TOSH_SEL_UCLK1_IOFUNC(void);
static inline void TOSH_SEL_SOMI1_IOFUNC(void);
static inline void TOSH_SEL_SIMO1_IOFUNC(void);
#line 71
static inline void TOSH_SET_FLASH_CS_PIN(void);
#line 71
static inline void TOSH_CLR_FLASH_CS_PIN(void);
#line 71
static inline void TOSH_MAKE_FLASH_CS_OUTPUT(void);
static inline void TOSH_SET_FLASH_HOLD_PIN(void);
#line 72
static inline void TOSH_CLR_FLASH_HOLD_PIN(void);
#line 72
static inline void TOSH_MAKE_FLASH_HOLD_OUTPUT(void);
static void TOSH_FLASH_M25P_DP_bit(bool set);
static inline void TOSH_FLASH_M25P_DP(void);
#line 129
static inline void TOSH_SET_PIN_DIRECTIONS(void );
# 75 "/home/xu/oasis/system/dbg_modes.h"
typedef long long TOS_dbg_mode;
enum __nesc_unnamed4270 {
DBG_ALL = ~0ULL,
DBG_BOOT = 1ULL << 0,
DBG_CLOCK = 1ULL << 1,
DBG_TASK = 1ULL << 2,
DBG_SCHED = 1ULL << 3,
DBG_SENSOR = 1ULL << 4,
DBG_LED = 1ULL << 5,
DBG_CRYPTO = 1ULL << 6,
DBG_ROUTE = 1ULL << 7,
DBG_AM = 1ULL << 8,
DBG_CRC = 1ULL << 9,
DBG_PACKET = 1ULL << 10,
DBG_ENCODE = 1ULL << 11,
DBG_RADIO = 1ULL << 12,
DBG_LOG = 1ULL << 13,
DBG_ADC = 1ULL << 14,
DBG_I2C = 1ULL << 15,
DBG_UART = 1ULL << 16,
DBG_PROG = 1ULL << 17,
DBG_SOUNDER = 1ULL << 18,
DBG_TIME = 1ULL << 19,
DBG_POWER = 1ULL << 20,
DBG_SIM = 1ULL << 21,
DBG_QUEUE = 1ULL << 22,
DBG_SIMRADIO = 1ULL << 23,
DBG_HARD = 1ULL << 24,
DBG_MEM = 1ULL << 25,
DBG_USR1 = 1ULL << 27,
DBG_USR2 = 1ULL << 28,
DBG_USR3 = 1ULL << 29,
DBG_TEMP = 1ULL << 30,
DBG_ERROR = 1ULL << 31,
DBG_NONE = 0,
DBG_DEFAULT = DBG_ALL,
DBG_ERR = 1ULL << 63,
DBG_UTIL = 1ULL << 62,
DBG_NETWORKCOMM = 1ULL << 61,
DBG_GENERICCOMMPRO = 1ULL << 61,
DBG_ROUTEMANAGE = 1ULL << 60,
DBG_SINKCAST = 1ULL << 59,
DBG_BROADCAST = 1ULL << 58,
DBG_TRANSPORTRDT = 1ULL << 57,
DBG_CAS = 1ULL << 56,
DBG_TMAC = 1ULL << 55,
DBG_TOPO = 1ULL << 54,
DBG_SNMS = 1ULL << 53,
DBG_SENSING = 1ULL << 52,
DBG_MULTIHOPENGINE = 1ULL << 51,
DBG_RDT = 1ULL << 50,
DBG_NEIGHBORMGMT = 1ULL << 49,
DBG_WF = 1ULL << 48,
DBG_DV = 1ULL << 47,
DBG_TSYNC = 1ULL << 46,
DBG_APP = 1ULL << 32,
DBG_MIDWARE = 1ULL << 36
};
# 61 "/opt/tinyos-1.x/tos/system/sched.c"
#line 59
typedef struct __nesc_unnamed4271 {
void (*tp)(void);
} TOSH_sched_entry_T;
enum __nesc_unnamed4272 {
TOSH_MAX_TASKS = 1 << 8,
TOSH_TASK_BITMASK = TOSH_MAX_TASKS - 1
};
volatile TOSH_sched_entry_T TOSH_queue[TOSH_MAX_TASKS];
uint8_t TOSH_sched_full;
volatile uint8_t TOSH_sched_free;
static inline void TOSH_sched_init(void );
bool TOS_post(void (*tp)(void));
#line 102
bool TOS_post(void (*tp)(void)) ;
#line 136
static inline bool TOSH_run_next_task(void);
#line 159
static inline void TOSH_run_task(void);
# 149 "/opt/tinyos-1.x/tos/system/tos.h"
static void *nmemcpy(void *to, const void *from, size_t n);
static inline void *nmemset(void *to, int val, size_t n);
# 28 "/opt/tinyos-1.x/tos/system/Ident.h"
enum __nesc_unnamed4273 {
IDENT_MAX_PROGRAM_NAME_LENGTH = 16
};
#line 33
typedef struct __nesc_unnamed4274 {
uint32_t unix_time;
uint32_t user_hash;
char program_name[IDENT_MAX_PROGRAM_NAME_LENGTH];
} Ident_t;
#line 52
static const Ident_t G_Ident = {
.unix_time = 0x49ecaa47L,
.user_hash = 0x4c6e9f74L,
.program_name = "OasisApp" };
# 48 "/home/xu/oasis/system/OasisType.h"
typedef uint16_t address_t;
#line 83
enum TosType {
AM_NETWORKMSG = 129,
AM_ROUTEBEACONMSG = 130,
AM_NEIGHBORBEACONMSG = 131,
AM_CASCTRLMSG = 132,
AM_CASCADESMSG = 133
};
#line 107
#line 94
typedef struct NetworkMsg {
address_t linksource;
uint8_t type;
uint8_t ttl : 5, qos : 3;
union {
struct {
address_t dest;
address_t source;
} __attribute((packed)) ;
uint32_t crc;
} __attribute((packed)) ;
uint16_t seqno;
uint8_t data[0];
} __attribute((packed)) NetworkMsg;
enum NetType {
NW_DATA = 1,
NW_SNMS = 2,
NW_RPCR = 3,
NW_RPCC = 4,
NW_RDTACK = 5
};
#line 121
typedef enum __nesc_unnamed4275 {
ADDR_SINK = 0xfd,
ADDR_MCAST = 0xfe,
ADDR_BCAST = 0xff
} OasisAddr_t;
#line 158
#line 153
typedef struct ApplicationMsg {
uint8_t type;
uint8_t length;
uint16_t seqno;
uint8_t data[0];
} __attribute((packed)) ApplicationMsg;
enum AppType {
TYPE_DATA_SEISMIC = 0,
TYPE_DATA_INFRASONIC = 1,
TYPE_DATA_LIGHTNING = 2,
TYPE_DATA_RSAM1 = 3,
TYPE_DATA_RVOL = 4,
TYPE_DATA_TEMP = 5,
TYPE_DATA_ACCELX = 6,
TYPE_DATA_ACCELY = 7,
TYPE_DATA_MAGX = 8,
TYPE_DATA_MAGY = 9,
TYPE_DATA_MIC = 10,
TYPE_DATA_RSAM2 = 17,
TYPE_DATA_COMPRESS = 18,
TYPE_DATA_TREMOR = 19,
TYPE_DATA_GPS = 28,
TYPE_SNMS_EVENT = 11,
TYPE_SNMS_RPCCOMMAND = 12,
TYPE_SNMS_RPCRESPONSE = 13,
TYPE_SNMS_CODE = 14
};
enum EventType {
EVENT_TYPE_ALL = 0,
EVENT_TYPE_SNMS = 1,
EVENT_TYPE_SENSING = 2,
EVENT_TYPE_MIDDLEWARE = 3,
EVENT_TYPE_ROUTING = 4,
EVENT_TYPE_MAC = 5
};
enum TypeRange {
EVENT_TYPE_VALUE_MIN = 0,
EVENT_TYPE_VALUE_MAX = 5
};
enum EventLevel {
EVENT_LEVEL_URGENT = 0,
EVENT_LEVEL_HIGH = 1,
EVENT_LEVEL_MEDIUM = 2,
EVENT_LEVEL_LOW = 3
};
enum LevelRange {
EVENT_LEVEL_VALUE_MIN = 0,
EVENT_LEVEL_VALUE_MAX = 3
};
enum EventSendFailType {
BUFFER_FAIL = 2,
FILTER_FAIL = 3
};
# 65 "/home/xu/oasis/lib/MultiHopOasis/MultiHop.h"
enum __nesc_unnamed4276 {
AM_BEACONMSG = 250
};
#line 69
typedef struct BeaconMsg {
uint16_t parent;
uint16_t parent_dup;
uint16_t cost;
uint16_t hopcount;
} __attribute((packed)) BeaconMsg;
# 28 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.h"
enum __nesc_unnamed4277 {
MSP430TIMER_CM_NONE = 0,
MSP430TIMER_CM_RISING = 1,
MSP430TIMER_CM_FALLING = 2,
MSP430TIMER_CM_BOTH = 3,
MSP430TIMER_STOP_MODE = 0,
MSP430TIMER_UP_MODE = 1,
MSP430TIMER_CONTINUOUS_MODE = 2,
MSP430TIMER_UPDOWN_MODE = 3,
MSP430TIMER_TACLK = 0,
MSP430TIMER_TBCLK = 0,
MSP430TIMER_ACLK = 1,
MSP430TIMER_SMCLK = 2,
MSP430TIMER_INCLK = 3,
MSP430TIMER_CLOCKDIV_1 = 0,
MSP430TIMER_CLOCKDIV_2 = 1,
MSP430TIMER_CLOCKDIV_4 = 2,
MSP430TIMER_CLOCKDIV_8 = 3
};
#line 64
#line 51
typedef struct __nesc_unnamed4278 {
int ccifg : 1;
int cov : 1;
int out : 1;
int cci : 1;
int ccie : 1;
int outmod : 3;
int cap : 1;
int clld : 2;
int scs : 1;
int ccis : 2;
int cm : 2;
} MSP430CompareControl_t;
#line 76
#line 66
typedef struct __nesc_unnamed4279 {
int taifg : 1;
int taie : 1;
int taclr : 1;
int _unused0 : 1;
int mc : 2;
int id : 2;
int tassel : 2;
int _unused1 : 6;
} MSP430TimerAControl_t;
#line 91
#line 78
typedef struct __nesc_unnamed4280 {
int tbifg : 1;
int tbie : 1;
int tbclr : 1;
int _unused0 : 1;
int mc : 2;
int id : 2;
int tbssel : 2;
int _unused1 : 1;
int cntl : 2;
int tbclgrp : 2;
int _unused2 : 1;
} MSP430TimerBControl_t;
# 43 "/usr/lib/gcc-lib/msp430/3.2.3/include/stdarg.h"
typedef __builtin_va_list __gnuc_va_list;
# 110 "/usr/lib/gcc-lib/msp430/3.2.3/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 59 "/home/xu/oasis/lib/SNMS/Event.h"
#line 54
typedef struct EventMsg {
uint8_t type;
uint8_t level;
uint8_t length;
uint8_t data[0];
} __attribute((packed)) EventMsg;
uint8_t gTempEventBuf[80];
uint8_t gTempScratch[16];
static inline uint8_t *eventprintf(const uint8_t *format, ...);
# 39 "/home/xu/oasis/lib/Rpc/Rpc.h"
struct __nesc_attr_rpc {
};
enum rpcMsgs {
AM_RPCCOMMANDMSG = 211,
AM_RPCRESPONSEMSG = 212
};
enum rpcErrorCodes {
RPC_SUCCESS = 0,
RPC_GARBAGE_ARGS = 1,
RPC_RESPONSE_TOO_LARGE = 2,
RPC_PROCEDURE_UNAVAIL = 3,
RPC_SYSTEM_ERR = 4,
RPC_WRONG_XML_FILE = 5
};
#line 72
#line 59
typedef struct RpcCommandMsg {
uint8_t transactionID;
uint8_t commandID;
uint8_t responseDesired;
uint8_t dataLength;
uint16_t address;
uint16_t returnAddress;
uint32_t unix_time;
uint32_t user_hash;
uint8_t data[0];
} __attribute((packed)) RpcCommandMsg;
#line 74
typedef struct RpcResponseMsg {
uint8_t transactionID;
uint8_t commandID;
uint16_t sourceAddress;
uint8_t errorCode;
uint8_t dataLength;
uint8_t data[0];
} __attribute((packed)) RpcResponseMsg;
# 31 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
enum __nesc_unnamed4281 {
MAX_BUFFER_SIZE = 56,
MEM_QUEUE_SIZE = 20,
NUM_STATUS = 6
};
#line 48
typedef enum __nesc_unnamed4282 {
FREEMEM = 0,
FILLING = 1,
FILLED = 2,
MEMPROCESSING = 3,
MEMPENDING = 4,
MEMCOMPRESSING = 5
} MemStatus_t;
#line 70
#line 58
typedef struct SensorBlkMgmt_t {
uint32_t time;
uint16_t taskCode;
uint16_t interval;
uint8_t compressnum;
int16_t next;
int16_t prev;
uint8_t size;
uint8_t priority;
uint8_t status;
uint8_t type;
uint8_t buffer[MAX_BUFFER_SIZE];
} SensorBlkMgmt_t;
typedef SensorBlkMgmt_t *SenBlkPtr;
#line 74
typedef struct MemQueue_t {
int16_t size;
int16_t total;
int16_t head[NUM_STATUS];
int16_t tail[NUM_STATUS];
SensorBlkMgmt_t element[MEM_QUEUE_SIZE];
} MemQueue_t;
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2);
static inline result_t initSenorMem(MemQueue_t *queue, uint16_t size);
#line 125
static SenBlkPtr headMemElement(MemQueue_t *queue, MemStatus_t status);
#line 147
static SenBlkPtr getMemElementByIndex(MemQueue_t *queue, int16_t ind);
#line 161
static inline SenBlkPtr allocSensorMem(MemQueue_t *bufQueue);
#line 194
static inline result_t freeSensorMem(MemQueue_t *queue, SenBlkPtr obj);
#line 247
static result_t changeMemStatus(MemQueue_t *queue, SenBlkPtr obj, MemStatus_t status1, MemStatus_t status2);
#line 263
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2);
# 33 "/home/xu/oasis/lib/SmartSensing/Sensing.h"
enum SamplingRate {
SEISMIC_RATE = 50,
INFRASONIC_RATE = 50,
LIGHTNING_RATE = 1,
RVOL_RATE = 1
};
enum SamplingPriority {
SEISMIC_DATA_PRIORITY = 0x2,
INFRASONIC_DATA_PRIORITY = 0x1,
LIGHTNING_DATA_PRIORITY = 0x6,
RVOL_DATA_PRIORITY = 0x1,
GPS_DATA_PRIORITY = 0x3,
RSAM1_DATA_PRIORITY = 0x7,
RSAM2_DATA_PRIORITY = 0x6
};
enum SensorConfig {
MAX_SENSOR_NUM = 16,
MAX_SAMPLING_RATE = 1000UL,
MAX_DATA_WIDTH = 2,
MAX_SENSING_QUEUE_SIZE = 4,
MAX_RSAM_WIN_SIZE = 60,
MAX_STA_PERIOD = 2,
MAX_LTA_PERIOD = 30,
TASK_MASK = 0x000f,
TASK_CODE_SIZE = 4,
TSTAMPOFFSET = 4,
ONE_MS = 1000UL,
BATCH_TIMER_INTERVAL = 500UL,
VOL_TIMER_INTERVAL = 60000UL
};
enum Special_Sensor {
GPS_CLIENT_ID = 0,
RSAM1_CLIENT_ID = 1,
RSAM2_CLIENT_ID = 2,
COMPRESS_CLIENT_ID = 7,
GPS_BLK_NUM = 0,
RSAM_BLK_NUM = 2
};
enum sensing_flash {
BLANK = 0x2fff,
WRITTEN = 0x4fff,
IDLE = 0xffff,
BASE_ADDR = 0x220000
};
#line 116
#line 106
typedef struct SensorClient {
SenBlkPtr curBlkPtr;
uint16_t samplingRate;
uint16_t timerCount;
uint8_t channel;
uint8_t type;
uint8_t dataPriority;
uint8_t nodePriority;
uint8_t maxBlkNum;
uint8_t curBlkNum;
} SensorClient_t;
#line 118
typedef struct TimeStamp {
uint32_t minute : 6,
second : 6,
millisec : 10,
interval : 10;
} __attribute((packed)) TimeStamp_t;
SensorClient_t sensor[MAX_SENSOR_NUM];
uint8_t sensor_num = 0;
# 31 "/home/xu/oasis/system/platform/telosb/ADC/Hamamatsu.h"
enum __nesc_unnamed4283 {
TOS_ADC_PAR_PORT = 0U,
TOSH_ACTUAL_ADC_PAR_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A4
};
#line 48
enum __nesc_unnamed4284 {
TOS_ADC_TSR_PORT = 1U,
TOSH_ACTUAL_ADC_TSR_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A5
};
# 42 "/home/xu/oasis/system/platform/telosb/ADC/InternalTemp.h"
enum __nesc_unnamed4285 {
TOS_ADC_INTERNAL_TEMP_PORT = 2U,
TOSH_ACTUAL_ADC_INTERNAL_TEMPERATURE_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INTERNAL_TEMPERATURE
};
# 42 "/home/xu/oasis/system/platform/telosb/ADC/InternalVoltage.h"
enum __nesc_unnamed4286 {
TOS_ADC_INTERNAL_VOLTAGE_PORT = 3U,
TOSH_ACTUAL_ADC_INTERNAL_VOLTAGE_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INTERNAL_VOLTAGE
};
# 42 "/home/xu/oasis/system/platform/telosb/ADC/adcChannel.h"
enum __nesc_unnamed4287 {
TOS_ADC_CHANNEL_A0_PORT = 4U,
TOSH_ACTUAL_ADC_CHANNEL_A0_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A0
};
enum __nesc_unnamed4288 {
TOS_ADC_CHANNEL_A1_PORT = 5U,
TOSH_ACTUAL_ADC_CHANNEL_A1_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A1
};
enum __nesc_unnamed4289 {
TOS_ADC_CHANNEL_A4_PORT = 6U,
TOSH_ACTUAL_ADC_CHANNEL_A4_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A4
};
enum __nesc_unnamed4290 {
TOS_ADC_CHANNEL_A6_PORT = 7U,
TOSH_ACTUAL_ADC_CHANNEL_A6_PORT = (((REFVOLT_LEVEL_1_5 << 3) + REFERENCE_VREFplus_AVss) << 4) + INPUT_CHANNEL_A6
};
# 35 "/opt/tinyos-1.x/tos/interfaces/ADC.h"
enum __nesc_unnamed4291 {
TOS_ADCSample3750ns = 0,
TOS_ADCSample7500ns = 1,
TOS_ADCSample15us = 2,
TOS_ADCSample30us = 3,
TOS_ADCSample60us = 4,
TOS_ADCSample120us = 5,
TOS_ADCSample240us = 6,
TOS_ADCSample480us = 7
};
# 39 "/opt/tinyos-1.x/tos/interfaces/Timer.h"
enum __nesc_unnamed4292 {
TIMER_REPEAT = 0,
TIMER_ONE_SHOT = 1,
NUM_TIMERS = 12U
};
# 35 "/home/xu/oasis/system/RTClock.h"
#line 28
typedef struct RTClock {
uint16_t millisecond;
uint8_t hour;
uint8_t minute;
uint8_t second;
uint8_t packed;
} RTClock_t;
#line 37
typedef struct SyncUser {
uint32_t fireCount;
uint32_t syncInterval;
uint8_t type;
uint8_t id;
} SyncUser_t;
enum __nesc_unnamed4293 {
MAX_NUM_CLIENT = 12,
GPS_SYNC = 0,
FTSP_SYNC = 1,
UC_FIRE_INTERVAL = 1000UL,
DAY_END = 86400000UL,
HOUR_END = 3600000UL,
DEFAULT_SYNC_MODE = 1
};
# 61 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncMsg.h"
#line 25
typedef struct TimeSyncMsg {
uint16_t nodeID;
uint16_t rootID;
uint16_t seqNum;
#line 47
uint8_t hasGPS;
uint8_t wroteStamp;
uint32_t sendingTime;
uint32_t arrivalTime;
} __attribute((packed)) TimeSyncMsg;
enum __nesc_unnamed4294 {
AM_TIMESYNCMSG = 0xAA,
TIMESYNCMSG_LEN = sizeof(TimeSyncMsg ) - sizeof(uint32_t ),
TS_TIMER_MODE = 0,
TS_USER_MODE = 1,
TIMESYNC_LENGTH_SENDFIELDS = 5
};
# 31 "/home/xu/oasis/system/queue.h"
enum __nesc_unnamed4295 {
MAX_QUEUE_SIZE = 5,
NUM_OBJSTATUS = 3
};
typedef TOS_Msg object_type;
#line 51
typedef enum __nesc_unnamed4296 {
FREE = 0,
PENDING = 1,
PROCESSING = 2
} ObjStatus_t;
#line 68
#line 57
typedef struct Element_t {
int16_t next;
int16_t prev;
uint8_t status;
uint8_t retry;
uint8_t priority;
uint8_t dummy;
object_type *obj;
}
Element_t;
#line 70
typedef struct Queue_t {
int16_t size;
int16_t total;
int16_t head[NUM_OBJSTATUS];
int16_t tail[NUM_OBJSTATUS];
Element_t element[MAX_QUEUE_SIZE];
}
Queue_t;
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t staus2);
static inline void _private_reorderElementByPriority(Queue_t *queue, int16_t ind);
static result_t initQueue(Queue_t *queue, uint16_t size);
#line 146
static result_t insertElement(Queue_t *queue, object_type *obj);
#line 202
static inline result_t insertElementPri(Queue_t *queue, object_type *obj, uint8_t priority);
#line 257
static inline void _private_reorderElementByPriority(Queue_t *queue, int16_t ind);
#line 307
static result_t removeElement(Queue_t *queue, object_type *obj);
#line 368
static object_type *headElement(Queue_t *queue, ObjStatus_t status);
static inline object_type *tailElement(Queue_t *queue, ObjStatus_t status);
static inline uint8_t getRetryCount(object_type **object);
static inline bool incRetryCount(object_type **object);
#line 468
static object_type **findObject(Queue_t *queue, object_type *obj);
#line 496
static result_t changeElementStatus(Queue_t *queue, object_type *obj, ObjStatus_t status1, ObjStatus_t status2);
#line 559
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t status2);
# 31 "/home/xu/oasis/system/buffer.h"
enum __nesc_unnamed4297 {
FREEBUF = PENDING,
BUSYBUF = PROCESSING
};
static result_t initBufferPool(Queue_t *bufQueue, uint16_t size, TOS_Msg *bufPool);
#line 66
static TOS_MsgPtr allocBuffer(Queue_t *bufQueue);
#line 86
static result_t freeBuffer(Queue_t *bufQueue, TOS_MsgPtr buf);
# 4 "/home/xu/oasis/lib/GenericCommPro/QosRexmit.h"
enum __nesc_unnamed4298 {
QOS_LEVEL = 7
};
static inline uint8_t qosRexmit(uint8_t qos);
# 50 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
enum __nesc_unnamed4299 {
COMM_SEND_QUEUE_SIZE = 5,
COMM_RECV_QUEUE_SIZE = 5
};
enum __nesc_unnamed4300 {
RADIO = 1,
UART = 2,
COMM_WDT_UPDATE_PERIOD = 10,
COMM_WDT_UPDATE_UNIT = 1024 * 60
};
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline int is_host_lsb(void);
static __inline uint16_t toLSB16(uint16_t a);
static __inline uint16_t fromLSB16(uint16_t a);
# 39 "/opt/tinyos-1.x/tos/platform/msp430/msp430usart.h"
#line 31
typedef enum __nesc_unnamed4301 {
USART_NONE = 0,
USART_UART = 1,
USART_UART_TX = 2,
USART_UART_RX = 3,
USART_SPI = 4,
USART_I2C = 5
} msp430_usartmode_t;
# 31 "/opt/tinyos-1.x/tos/platform/msp430/crc.h"
uint16_t const ccitt_crc16_table[256] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
static uint16_t crcByte(uint16_t fcs, uint8_t c);
# 19 "/opt/tinyos-1.x/tos/platform/msp430/msp430baudrates.h"
enum __nesc_unnamed4302 {
UBR_ACLK_1200 = 0x001B, UMCTL_ACLK_1200 = 0x94,
UBR_ACLK_1800 = 0x0012, UMCTL_ACLK_1800 = 0x84,
UBR_ACLK_2400 = 0x000D, UMCTL_ACLK_2400 = 0x6D,
UBR_ACLK_4800 = 0x0006, UMCTL_ACLK_4800 = 0x77,
UBR_ACLK_9600 = 0x0003, UMCTL_ACLK_9600 = 0x29,
UBR_SMCLK_1200 = 0x0369, UMCTL_SMCLK_1200 = 0x7B,
UBR_SMCLK_1800 = 0x0246, UMCTL_SMCLK_1800 = 0x55,
UBR_SMCLK_2400 = 0x01B4, UMCTL_SMCLK_2400 = 0xDF,
UBR_SMCLK_4800 = 0x00DA, UMCTL_SMCLK_4800 = 0xAA,
UBR_SMCLK_9600 = 0x006D, UMCTL_SMCLK_9600 = 0x44,
UBR_SMCLK_19200 = 0x0036, UMCTL_SMCLK_19200 = 0xB5,
UBR_SMCLK_38400 = 0x001B, UMCTL_SMCLK_38400 = 0x94,
UBR_SMCLK_57600 = 0x0012, UMCTL_SMCLK_57600 = 0x84,
UBR_SMCLK_76800 = 0x000D, UMCTL_SMCLK_76800 = 0x6D,
UBR_SMCLK_115200 = 0x0009, UMCTL_SMCLK_115200 = 0x10,
UBR_SMCLK_230400 = 0x0004, UMCTL_SMCLK_230400 = 0x55,
UBR_SMCLK_262144 = 4, UMCTL_SMCLK_262144 = 0
};
# 33 "/home/xu/oasis/lib/RamSymbols/RamSymbols.h"
enum __nesc_unnamed4303 {
MAX_RAM_SYMBOL_SIZE = 74 - (size_t )& ((NetworkMsg *)0)->data -
(size_t )& ((ApplicationMsg *)0)->data - (size_t )& ((RpcCommandMsg *)0)->data - sizeof(uint32_t ) - sizeof(uint8_t ) - sizeof(bool ),
AM_RAMSYMBOL_T = 134
};
#line 53
#line 42
typedef struct ramSymbol_t {
uint16_t memAddress;
uint8_t length;
bool dereference;
uint8_t data[MAX_RAM_SYMBOL_SIZE];
} __attribute((packed)) ramSymbol_t;
# 11 "/opt/tinyos-1.x/tos/platform/msp430/ADCHIL.h"
#line 6
typedef enum __nesc_unnamed4304 {
ADC_SUCCESS = 0,
ADC_FAIL = 1
}
adcresult_t;
# 23 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.h"
#line 18
typedef enum __nesc_unnamed4305 {
REFERENCE_1_5V,
REFERENCE_2_5V,
REFERENCE_UNSTABLE
} RefVolt_t;
# 33 "/home/xu/oasis/lib/Cascades/Cascades.h"
enum CascadesEnum {
MAX_CAS_BUF = 1,
DEFAULT_DTCOUNT = 4,
MAX_CAS_RETRY_COUNT = 6,
MAX_CAS_PACKETS = 64,
CAS_SEND_QUEUE_SIZE = 3,
INVALID_INDEX = 100,
MIN_INTERVAL = 50,
MAX_NUM_CHILDREN = 16
};
#line 52
typedef struct CasCtrlMsg {
address_t linkSource;
address_t parent;
uint16_t dataSeq;
uint8_t type;
uint8_t dummy;
uint8_t data[0];
} __attribute((packed)) CasCtrlMsg;
#line 61
typedef struct childrenList {
address_t childID;
uint8_t status;
uint8_t dummy;
} __attribute((packed)) childrenList_t;
#line 69
typedef struct CascadesBuffer {
TOS_Msg tmsg;
childrenList_t childrenList[MAX_NUM_CHILDREN];
uint8_t countDT;
uint8_t retry;
uint8_t signalDone;
uint8_t dummy;
} __attribute((packed)) CascadesBuffer;
enum CascadesType {
TYPE_CASCADES_NODATA = 17,
TYPE_CASCADES_ACK = 18,
TYPE_CASCADES_REQ = 19,
TYPE_CASCADES_CMAU = 20
};
# 20 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmt.h"
#line 5
typedef struct NBRTableEntry {
uint16_t id;
uint16_t parentCost;
uint16_t linkEst;
uint16_t linkEstCandidate;
uint8_t flags;
uint8_t relation;
uint8_t liveliness;
uint8_t childLiveliness;
uint16_t priorHop;
uint8_t lqi_raw;
uint8_t rssi_raw;
}
NBRTableEntry;
enum __nesc_unnamed4306 {
NBRFLAG_VALID = 0x01,
NBRFLAG_NEW = 0x02,
NBRFLAG_JUST_UPDATED = 0x04
};
enum relation {
NBR_DIRECT_CHILD = 0x01,
NBR_CHILD = 0x02,
NBR_PARENT = 0x04,
NBR_NEIGHBOR = 0x08
};
enum __nesc_unnamed4307 {
LIVELINESS = 8,
CHILD_LIVELINESS = 8,
ROUTE_INVALID = 0xff,
ADDRESS_INVALID = 0xffff
};
# 30 "/opt/tinyos-1.x/tos/platform/msp430/HPLInitM.nc"
static result_t HPLInitM$init(void);
# 29 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockInit.nc"
static void MSP430ClockM$MSP430ClockInit$default$initTimerB(void);
static void MSP430ClockM$MSP430ClockInit$defaultInitTimerA(void);
#line 28
static void MSP430ClockM$MSP430ClockInit$default$initTimerA(void);
static void MSP430ClockM$MSP430ClockInit$defaultInitTimerB(void);
#line 27
static void MSP430ClockM$MSP430ClockInit$default$initClocks(void);
static void MSP430ClockM$MSP430ClockInit$defaultInitClocks(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MSP430ClockM$StdControl$init(void);
static result_t MSP430ClockM$StdControl$start(void);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430DCOCalibM$Timer32khz$overflow(void);
#line 33
static void MSP430DCOCalibM$TimerMicro$overflow(void);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlA2$getControl(void);
#line 30
static MSP430CompareControl_t MSP430TimerM$ControlB0$getControl(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureA1$getEvent(void);
#line 74
static void MSP430TimerM$CaptureA1$default$captured(uint16_t arg_0x408cb858);
#line 32
static uint16_t MSP430TimerM$CaptureB3$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB3$default$captured(uint16_t arg_0x408cb858);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA1$setEvent(uint16_t arg_0x408d6eb0);
static void MSP430TimerM$CompareB3$setEventFromNow(uint16_t arg_0x408d5830);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureB6$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB6$default$captured(uint16_t arg_0x408cb858);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlB4$getControl(void);
static void MSP430TimerM$ControlB4$enableEvents(void);
#line 35
static void MSP430TimerM$ControlB4$setControlAsCompare(void);
static void MSP430TimerM$ControlB4$disableEvents(void);
#line 32
static void MSP430TimerM$ControlB4$clearPendingInterrupt(void);
#line 30
static MSP430CompareControl_t MSP430TimerM$ControlA0$getControl(void);
static void MSP430TimerM$ControlA0$setControl(MSP430CompareControl_t arg_0x408c29a8);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureB1$getEvent(void);
#line 56
static void MSP430TimerM$CaptureB1$clearOverflow(void);
#line 51
static bool MSP430TimerM$CaptureB1$isOverflowPending(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB1$default$fired(void);
# 36 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void MSP430TimerM$ControlB1$setControlAsCapture(bool arg_0x408c0190);
#line 30
static MSP430CompareControl_t MSP430TimerM$ControlB1$getControl(void);
static void MSP430TimerM$ControlB1$enableEvents(void);
static void MSP430TimerM$ControlB1$disableEvents(void);
#line 32
static void MSP430TimerM$ControlB1$clearPendingInterrupt(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureA2$getEvent(void);
#line 74
static void MSP430TimerM$CaptureA2$default$captured(uint16_t arg_0x408cb858);
#line 32
static uint16_t MSP430TimerM$CaptureB4$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB4$default$captured(uint16_t arg_0x408cb858);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlB2$getControl(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA2$default$fired(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430TimerM$TimerA$clear(void);
static void MSP430TimerM$TimerA$setClockSource(uint16_t arg_0x408b88a8);
#line 38
static void MSP430TimerM$TimerA$disableEvents(void);
#line 35
static void MSP430TimerM$TimerA$setMode(int arg_0x408b9aa0);
static void MSP430TimerM$TimerA$setInputDivider(uint16_t arg_0x408b8d60);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB4$setEventFromNow(uint16_t arg_0x408d5830);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlA1$getControl(void);
static void MSP430TimerM$ControlA1$setControl(MSP430CompareControl_t arg_0x408c29a8);
#line 30
static MSP430CompareControl_t MSP430TimerM$ControlB5$getControl(void);
static void MSP430TimerM$ControlB5$enableEvents(void);
#line 35
static void MSP430TimerM$ControlB5$setControlAsCompare(void);
static void MSP430TimerM$ControlB5$disableEvents(void);
#line 32
static void MSP430TimerM$ControlB5$clearPendingInterrupt(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureA0$getEvent(void);
#line 74
static void MSP430TimerM$CaptureA0$default$captured(uint16_t arg_0x408cb858);
#line 32
static uint16_t MSP430TimerM$CaptureB2$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB2$default$captured(uint16_t arg_0x408cb858);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA0$setEvent(uint16_t arg_0x408d6eb0);
static void MSP430TimerM$CompareB2$default$fired(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureB5$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB5$default$captured(uint16_t arg_0x408cb858);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlB3$getControl(void);
static void MSP430TimerM$ControlB3$enableEvents(void);
#line 35
static void MSP430TimerM$ControlB3$setControlAsCompare(void);
static void MSP430TimerM$ControlB3$disableEvents(void);
#line 32
static void MSP430TimerM$ControlB3$clearPendingInterrupt(void);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static uint16_t MSP430TimerM$TimerB$read(void);
static bool MSP430TimerM$TimerB$isOverflowPending(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB5$setEventFromNow(uint16_t arg_0x408d5830);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static uint16_t MSP430TimerM$CaptureB0$getEvent(void);
#line 74
static void MSP430TimerM$CaptureB0$default$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB6$default$fired(void);
#line 34
static void MSP430TimerM$CompareB0$default$fired(void);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static MSP430CompareControl_t MSP430TimerM$ControlB6$getControl(void);
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
static result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t arg_0x40a044a8, uint8_t arg_0x40a04638);
static uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t arg_0x40a04ad0);
#line 31
static result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t arg_0x40a06948, uint8_t arg_0x40a06ad0);
#line 27
static result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t arg_0x40a07e08, uint16_t arg_0x40a06010);
static uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t arg_0x40a04010);
#line 29
static uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t arg_0x40a064b0);
#line 43
static result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t arg_0x40a037b0, uint16_t arg_0x40a03940);
#line 39
static result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t arg_0x40a03010);
static uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t arg_0x40a03de8);
#line 41
static uint8_t SmartSensingM$SensingConfig$getNodePriority(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$SensingTimer$fired(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr arg_0x40a2b4e0, result_t arg_0x40a2b670);
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t SmartSensingM$ADC$dataReady(
# 63 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint8_t arg_0x40a7cd80,
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
uint16_t arg_0x40a7c788);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SmartSensingM$StdControl$init(void);
static result_t SmartSensingM$StdControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t NoLeds$Leds$greenToggle(void);
#line 131
static result_t NoLeds$Leds$yellowToggle(void);
#line 81
static result_t NoLeds$Leds$redToggle(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t RandomLFSR$Random$rand(void);
#line 57
static result_t RandomLFSR$Random$init(void);
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
static bool RealTimeM$RealTime$isSync(void);
#line 40
static result_t RealTimeM$RealTime$setTimeCount(uint32_t arg_0x40ab48c8, uint8_t arg_0x40ab4a50);
static uint8_t RealTimeM$RealTime$getMode(void);
#line 39
static uint32_t RealTimeM$RealTime$getTimeCount(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t RealTimeM$LocalTime$read(void);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void RealTimeM$MSP430Timer$overflow(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void RealTimeM$MSP430Compare$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RealTimeM$StdControl$init(void);
static result_t RealTimeM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$default$fired(
# 30 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
uint8_t arg_0x40b35650);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$start(
# 30 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
uint8_t arg_0x40b35650,
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t RealTimeM$Timer$stop(
# 30 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
uint8_t arg_0x40b35650);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280);
# 36 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
static uint32_t TimeSyncM$GlobalTime$getLocalTime(void);
static result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b50150);
#line 60
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *arg_0x40b50718);
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
static void TimeSyncM$TimeSyncNotify$default$msg_received(void);
static void TimeSyncM$TimeSyncNotify$default$msg_sent(void);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimeSyncM$StdControl$init(void);
static result_t TimeSyncM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimeSyncM$Timer$fired(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t TimerM$TimerMilli$default$fired(
# 32 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c468b0);
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t TimerM$TimerMilli$setOneShot(
# 32 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c468b0,
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
int32_t arg_0x40c2c340);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t TimerM$LocalTime$read(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void TimerM$AlarmCompare$fired(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerJiffy.nc"
static result_t TimerM$TimerJiffy$default$fired(
# 33 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c444e0);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void TimerM$AlarmTimer$overflow(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimerM$StdControl$init(void);
static result_t TimerM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$default$fired(
# 31 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c46118);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$start(
# 31 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c46118,
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t TimerM$Timer$stop(
# 31 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c46118);
# 78 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$setRFPower(uint8_t arg_0x40d0a8a0) ;
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(
# 71 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40cdd5b8,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40bd2280);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$ActivityTimer$fired(void);
# 79 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static uint8_t GenericCommProM$getRFPower(void) ;
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010);
# 76 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$setRFChannel(uint8_t arg_0x40cddeb8) ;
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr arg_0x40bd2280);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$Control$init(void);
static result_t GenericCommProM$Control$start(void);
# 77 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static uint8_t GenericCommProM$getRFChannel(void) ;
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t GenericCommProM$SendMsg$send(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40cdef00,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
static result_t GenericCommProM$SendMsg$default$sendDone(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40cdef00,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr arg_0x40bd2280);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$SplitControl$default$initDone(void);
#line 64
static result_t CC2420RadioM$SplitControl$init(void);
#line 85
static result_t CC2420RadioM$SplitControl$default$startDone(void);
#line 77
static result_t CC2420RadioM$SplitControl$start(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420RadioM$FIFOP$fired(void);
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t CC2420RadioM$BackoffTimerJiffy$fired(void);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t CC2420RadioM$Send$send(TOS_MsgPtr arg_0x40d018a0);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
static void CC2420RadioM$MacControl$enableAck(void);
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t CC2420RadioM$SFD$captured(uint16_t arg_0x40dbedc8);
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t arg_0x40dcddb0, uint8_t *arg_0x40dcc010);
#line 39
static result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t arg_0x40dcd640, uint8_t *arg_0x40dcd7e8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420RadioM$StdControl$init(void);
static result_t CC2420RadioM$StdControl$start(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
static int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr arg_0x40d999b8);
static int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr arg_0x40d99e78);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$CC2420SplitControl$initDone(void);
#line 85
static result_t CC2420RadioM$CC2420SplitControl$startDone(void);
#line 64
static result_t CC2420ControlM$SplitControl$init(void);
#line 77
static result_t CC2420ControlM$SplitControl$start(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420ControlM$CCA$fired(void);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t arg_0x40e225a0, uint8_t arg_0x40e22728, uint8_t *arg_0x40e228d0);
# 120 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static result_t CC2420ControlM$CC2420Control$VREFOn(void);
#line 185
static uint8_t CC2420ControlM$CC2420Control$GetRFPower(void);
#line 206
static result_t CC2420ControlM$CC2420Control$enableAddrDecode(void);
#line 178
static result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t arg_0x40d15950);
#line 192
static result_t CC2420ControlM$CC2420Control$enableAutoAck(void);
#line 84
static result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t arg_0x40d19a30);
#line 163
static result_t CC2420ControlM$CC2420Control$RxMode(void);
#line 94
static result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t arg_0x40d18030);
#line 220
static result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t arg_0x40d12348);
#line 106
static uint8_t CC2420ControlM$CC2420Control$GetPreset(void);
#line 134
static result_t CC2420ControlM$CC2420Control$OscillatorOn(void);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t arg_0x40da30b0);
#line 54
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t arg_0x40da59c0, uint16_t arg_0x40da5b50);
#line 47
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t arg_0x40da54b0);
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t arg_0x40d9cec0, uint8_t *arg_0x40dcd088);
#line 19
static result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t arg_0x40d9c6a8, uint8_t *arg_0x40d9c850);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t arg_0x40e23d00, uint8_t arg_0x40e23e88, uint8_t *arg_0x40e22068);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HPLCC2420M$StdControl$init(void);
static result_t HPLCC2420M$StdControl$start(void);
# 39 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t HPLCC2420M$BusArbitration$busFree(void);
# 43 "/opt/tinyos-1.x/tos/platform/msp430/HPLI2CInterrupt.nc"
static void HPLUSART0M$HPLI2CInterrupt$default$fired(void);
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
static result_t HPLUSART0M$USARTData$default$rxDone(uint8_t arg_0x40ee6c40);
#line 46
static result_t HPLUSART0M$USARTData$default$txDone(void);
# 191 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
static result_t HPLUSART0M$USARTControl$isTxEmpty(void);
#line 130
static bool HPLUSART0M$USARTControl$isSPI(void);
#line 85
static void HPLUSART0M$USARTControl$disableUART(void);
#line 75
static bool HPLUSART0M$USARTControl$isUART(void);
#line 159
static bool HPLUSART0M$USARTControl$isI2C(void);
#line 172
static result_t HPLUSART0M$USARTControl$disableRxIntr(void);
static result_t HPLUSART0M$USARTControl$disableTxIntr(void);
#line 65
static bool HPLUSART0M$USARTControl$isUARTtx(void);
#line 125
static void HPLUSART0M$USARTControl$disableI2C(void);
static void HPLUSART0M$USARTControl$setModeSPI(void);
#line 52
static msp430_usartmode_t HPLUSART0M$USARTControl$getMode(void);
#line 180
static result_t HPLUSART0M$USARTControl$isTxIntrPending(void);
#line 202
static result_t HPLUSART0M$USARTControl$tx(uint8_t arg_0x40e95850);
static uint8_t HPLUSART0M$USARTControl$rx(void);
#line 185
static result_t HPLUSART0M$USARTControl$isRxIntrPending(void);
#line 70
static bool HPLUSART0M$USARTControl$isUARTrx(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420InterruptM$FIFO$default$fired(void);
static result_t HPLCC2420InterruptM$FIFOP$disable(void);
#line 43
static result_t HPLCC2420InterruptM$FIFOP$startWait(bool arg_0x40dc68a0);
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void HPLCC2420InterruptM$CCAInterrupt$fired(void);
#line 59
static void HPLCC2420InterruptM$FIFOInterrupt$fired(void);
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420InterruptM$CCA$startWait(bool arg_0x40dc68a0);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void HPLCC2420InterruptM$SFDCapture$captured(uint16_t arg_0x408cb858);
# 60 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t HPLCC2420InterruptM$SFD$disable(void);
#line 43
static result_t HPLCC2420InterruptM$SFD$enableCapture(bool arg_0x40dbe808);
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void HPLCC2420InterruptM$FIFOPInterrupt$fired(void);
#line 40
static void MSP430InterruptM$Port14$clear(void);
#line 35
static void MSP430InterruptM$Port14$disable(void);
#line 54
static void MSP430InterruptM$Port14$edge(bool arg_0x40f36350);
#line 30
static void MSP430InterruptM$Port14$enable(void);
static void MSP430InterruptM$Port26$clear(void);
#line 59
static void MSP430InterruptM$Port26$default$fired(void);
#line 40
static void MSP430InterruptM$Port17$clear(void);
#line 59
static void MSP430InterruptM$Port17$default$fired(void);
#line 40
static void MSP430InterruptM$Port21$clear(void);
#line 59
static void MSP430InterruptM$Port21$default$fired(void);
#line 40
static void MSP430InterruptM$Port12$clear(void);
#line 59
static void MSP430InterruptM$Port12$default$fired(void);
#line 40
static void MSP430InterruptM$Port24$clear(void);
#line 59
static void MSP430InterruptM$Port24$default$fired(void);
#line 40
static void MSP430InterruptM$ACCV$clear(void);
#line 59
static void MSP430InterruptM$ACCV$default$fired(void);
#line 40
static void MSP430InterruptM$Port15$clear(void);
#line 59
static void MSP430InterruptM$Port15$default$fired(void);
#line 40
static void MSP430InterruptM$Port27$clear(void);
#line 59
static void MSP430InterruptM$Port27$default$fired(void);
#line 40
static void MSP430InterruptM$Port10$clear(void);
#line 35
static void MSP430InterruptM$Port10$disable(void);
#line 54
static void MSP430InterruptM$Port10$edge(bool arg_0x40f36350);
#line 30
static void MSP430InterruptM$Port10$enable(void);
static void MSP430InterruptM$Port22$clear(void);
#line 59
static void MSP430InterruptM$Port22$default$fired(void);
#line 40
static void MSP430InterruptM$OF$clear(void);
#line 59
static void MSP430InterruptM$OF$default$fired(void);
#line 40
static void MSP430InterruptM$Port13$clear(void);
#line 35
static void MSP430InterruptM$Port13$disable(void);
static void MSP430InterruptM$Port25$clear(void);
#line 59
static void MSP430InterruptM$Port25$default$fired(void);
#line 40
static void MSP430InterruptM$Port16$clear(void);
#line 59
static void MSP430InterruptM$Port16$default$fired(void);
#line 40
static void MSP430InterruptM$NMI$clear(void);
#line 59
static void MSP430InterruptM$NMI$default$fired(void);
#line 40
static void MSP430InterruptM$Port20$clear(void);
#line 59
static void MSP430InterruptM$Port20$default$fired(void);
#line 40
static void MSP430InterruptM$Port11$clear(void);
#line 59
static void MSP430InterruptM$Port11$default$fired(void);
#line 40
static void MSP430InterruptM$Port23$clear(void);
#line 59
static void MSP430InterruptM$Port23$default$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t BusArbitrationM$StdControl$init(void);
static result_t BusArbitrationM$StdControl$start(void);
# 39 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t BusArbitrationM$BusArbitration$default$busFree(
# 31 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
uint8_t arg_0x40ffcf08);
# 38 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t BusArbitrationM$BusArbitration$releaseBus(
# 31 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
uint8_t arg_0x40ffcf08);
# 37 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t BusArbitrationM$BusArbitration$getBus(
# 31 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
uint8_t arg_0x40ffcf08);
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t arg_0x40db7d10);
static bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void);
#line 8
static result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void TimerJiffyAsyncM$AlarmCompare$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimerJiffyAsyncM$StdControl$init(void);
static result_t TimerJiffyAsyncM$StdControl$start(void);
# 122 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t LedsC$Leds$yellowOff(void);
#line 114
static result_t LedsC$Leds$yellowOn(void);
#line 97
static result_t LedsC$Leds$greenOff(void);
#line 72
static result_t LedsC$Leds$redOff(void);
#line 106
static result_t LedsC$Leds$greenToggle(void);
#line 131
static result_t LedsC$Leds$yellowToggle(void);
#line 81
static result_t LedsC$Leds$redToggle(void);
#line 64
static result_t LedsC$Leds$redOn(void);
#line 89
static result_t LedsC$Leds$greenOn(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t FramerM$ByteComm$txDone(void);
#line 75
static result_t FramerM$ByteComm$txByteReady(bool arg_0x4106d4d8);
#line 66
static result_t FramerM$ByteComm$rxByteReady(uint8_t arg_0x4106eb30, bool arg_0x4106ecb8, uint16_t arg_0x4106ee50);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t FramerM$BareSendMsg$send(TOS_MsgPtr arg_0x40d018a0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FramerM$StdControl$init(void);
static result_t FramerM$StdControl$start(void);
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x41076710);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280);
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x41077eb0, uint8_t arg_0x41076068);
# 88 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
static result_t UARTM$HPLUART$get(uint8_t arg_0x410c4c58);
static result_t UARTM$HPLUART$putDone(void);
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t UARTM$ByteComm$txByte(uint8_t arg_0x4106e5e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t UARTM$Control$init(void);
static result_t UARTM$Control$start(void);
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
static result_t HPLUARTM$USARTData$rxDone(uint8_t arg_0x40ee6c40);
#line 46
static result_t HPLUARTM$USARTData$txDone(void);
# 62 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
static result_t HPLUARTM$UART$init(void);
#line 80
static result_t HPLUARTM$UART$put(uint8_t arg_0x410c46c0);
# 130 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
static bool HPLUSART1M$USARTControl$isSPI(void);
#line 115
static void HPLUSART1M$USARTControl$disableSPI(void);
#line 169
static void HPLUSART1M$USARTControl$setClockRate(uint16_t arg_0x40e98918, uint8_t arg_0x40e98aa0);
#line 85
static void HPLUSART1M$USARTControl$disableUART(void);
#line 167
static void HPLUSART1M$USARTControl$setClockSource(uint8_t arg_0x40e98460);
#line 75
static bool HPLUSART1M$USARTControl$isUART(void);
#line 174
static result_t HPLUSART1M$USARTControl$enableRxIntr(void);
#line 159
static bool HPLUSART1M$USARTControl$isI2C(void);
#line 175
static result_t HPLUSART1M$USARTControl$enableTxIntr(void);
#line 65
static bool HPLUSART1M$USARTControl$isUARTtx(void);
#line 52
static msp430_usartmode_t HPLUSART1M$USARTControl$getMode(void);
#line 202
static result_t HPLUSART1M$USARTControl$tx(uint8_t arg_0x40e95850);
#line 153
static void HPLUSART1M$USARTControl$setModeUART(void);
#line 70
static bool HPLUSART1M$USARTControl$isUARTrx(void);
# 51 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static result_t SNMSM$ledsOn(uint8_t arg_0x4113aa38) ;
static void SNMSM$restart(void) ;
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$StdControl$init(void);
static result_t SNMSM$StdControl$start(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t EventReportM$EventReport$default$eventSendDone(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x41169e18,
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
TOS_MsgPtr arg_0x40a2b4e0, result_t arg_0x40a2b670);
#line 37
static uint8_t EventReportM$EventReport$eventSend(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x41169e18,
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
uint8_t arg_0x40a2ca80,
uint8_t arg_0x40a2cc18,
uint8_t *arg_0x40a2cdd0);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
static uint8_t EventReportM$EventConfig$getReportLevel(uint8_t arg_0x41143ec0);
#line 38
static result_t EventReportM$EventConfig$setReportLevel(uint8_t arg_0x41143778, uint8_t arg_0x41143900);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t EventReportM$StdControl$init(void);
static result_t EventReportM$StdControl$start(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr arg_0x40a0f130, void *arg_0x40a0f2d0, uint16_t arg_0x40a0f468);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RpcM$StdControl$init(void);
static result_t RpcM$StdControl$start(void);
# 71 "/home/xu/oasis/lib/MultiHopOasis/RouteSelect.nc"
static result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr arg_0x411f8238, uint8_t arg_0x411f83c0, uint8_t arg_0x411f8548);
#line 86
static result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr arg_0x411f8b58, uint8_t arg_0x411f8ce0);
# 2 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
static result_t MultiHopLQI$RouteRpcCtrl$setSink(bool arg_0x41197068);
static result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void);
#line 3
static result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t arg_0x41197510);
static uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void);
#line 5
static result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x41197cc0);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopLQI$Timer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280);
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t arg_0x41231718, uint16_t arg_0x412318b0, bool arg_0x41231a40);
#line 2
static result_t MultiHopLQI$MultihopCtrl$switchParent(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr arg_0x40a2b4e0, result_t arg_0x40a2b670);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopLQI$StdControl$init(void);
static result_t MultiHopLQI$StdControl$start(void);
# 116 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
static bool MultiHopLQI$RouteControl$isSink(void);
#line 109
static result_t MultiHopLQI$RouteControl$releaseParent(void);
#line 84
static uint16_t MultiHopLQI$RouteControl$getQuality(void);
#line 107
static result_t MultiHopLQI$RouteControl$setParent(uint16_t arg_0x40ac6178);
#line 49
static uint16_t MultiHopLQI$RouteControl$getParent(void);
#line 94
static result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t arg_0x40ac87d8);
# 33 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static ramSymbol_t RamSymbolsM$peek(unsigned int arg_0x41298828, uint8_t arg_0x412989b0, bool arg_0x41298b40) ;
#line 32
static unsigned int RamSymbolsM$poke(ramSymbol_t *arg_0x41298240) ;
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
static uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658);
#line 33
static void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t arg_0x40e225a0, uint8_t arg_0x40e22728, uint8_t *arg_0x40e228d0);
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
static result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40bcab20, uint32_t *arg_0x40bcacd8);
# 29 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
static result_t DataMgmtM$DataMgmt$freeBlk(void *arg_0x40ad2c28);
#line 28
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t arg_0x40ad2760);
static result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t arg_0x40ad0bf0);
#line 30
static result_t DataMgmtM$DataMgmt$saveBlk(void *arg_0x40ad0110, uint8_t arg_0x40ad02a0);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t DataMgmtM$BatchTimer$fired(void);
#line 73
static result_t DataMgmtM$SysCheckTimer$fired(void);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t DataMgmtM$StdControl$init(void);
static result_t DataMgmtM$StdControl$start(void);
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
static result_t ADCM$ADCControl$bindPort(uint8_t arg_0x40a94cf8, uint8_t arg_0x40a94e80);
#line 50
static result_t ADCM$ADCControl$init(void);
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static result_t ADCM$MSP430ADC12Single$dataReady(uint16_t arg_0x4133cdc8);
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t ADCM$ADC$getData(
# 47 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
uint8_t arg_0x41345b10);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t ADCM$StdControl$init(void);
static result_t ADCM$StdControl$start(void);
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
static result_t HamamatsuM$TSRSingle$default$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8);
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static result_t HamamatsuM$MSP430ADC12SingleTSR$dataReady(uint16_t arg_0x4133cdc8);
#line 131
static result_t HamamatsuM$MSP430ADC12SinglePAR$dataReady(uint16_t arg_0x4133cdc8);
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static uint16_t *HamamatsuM$MSP430ADC12MultipleTSR$dataReady(uint16_t *arg_0x413b0010, uint16_t arg_0x413b01a0);
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
static uint16_t *HamamatsuM$TSRMultiple$default$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0);
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static uint16_t *HamamatsuM$MSP430ADC12MultiplePAR$dataReady(uint16_t *arg_0x413b0010, uint16_t arg_0x413b01a0);
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
static uint16_t *HamamatsuM$PARMultiple$default$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0);
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
static result_t HamamatsuM$PARSingle$default$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430ADC12M$CompareA1$fired(void);
# 127 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
static void MSP430ADC12M$RefVolt$isStable(RefVolt_t arg_0x413e8578);
# 65 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static msp430ADCresult_t MSP430ADC12M$ADCSingle$getData(
# 41 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bcd90);
# 50 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static result_t MSP430ADC12M$ADCSingle$bind(
# 41 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bcd90,
# 50 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
MSP430ADC12Settings_t arg_0x4133e958);
#line 117
static result_t MSP430ADC12M$ADCSingle$unreserve(
# 41 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bcd90);
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static result_t MSP430ADC12M$ADCSingle$default$dataReady(
# 41 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bcd90,
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
uint16_t arg_0x4133cdc8);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430ADC12M$TimerA$overflow(void);
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static msp430ADCresult_t MSP430ADC12M$ADCMultiple$getData(
# 42 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bb8d8,
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
uint16_t *arg_0x413b57e8, uint16_t arg_0x413b5978, uint16_t arg_0x413b5b08);
#line 167
static uint16_t *MSP430ADC12M$ADCMultiple$default$dataReady(
# 42 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bb8d8,
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
uint16_t *arg_0x413b0010, uint16_t arg_0x413b01a0);
# 61 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void MSP430ADC12M$HPLADC12$memOverflow(void);
static void MSP430ADC12M$HPLADC12$converted(uint8_t arg_0x413f8a00);
#line 62
static void MSP430ADC12M$HPLADC12$timeOverflow(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430ADC12M$CompareA0$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MSP430ADC12M$StdControl$init(void);
static result_t MSP430ADC12M$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void HPLADC12M$HPLADC12$setRefOff(void);
#line 58
static void HPLADC12M$HPLADC12$resetIFGs(void);
static bool HPLADC12M$HPLADC12$isBusy(void);
#line 43
static void HPLADC12M$HPLADC12$setControl1(adc12ctl1_t arg_0x413fc4e8);
#line 76
static void HPLADC12M$HPLADC12$setRef2_5V(void);
static void HPLADC12M$HPLADC12$disableConversion(void);
#line 48
static void HPLADC12M$HPLADC12$setControl0_IgnoreRef(adc12ctl0_t arg_0x413fa010);
#line 72
static void HPLADC12M$HPLADC12$setRefOn(void);
#line 51
static adc12memctl_t HPLADC12M$HPLADC12$getMemControl(uint8_t arg_0x413fab10);
#line 75
static void HPLADC12M$HPLADC12$setRef1_5V(void);
static void HPLADC12M$HPLADC12$startConversion(void);
#line 52
static uint16_t HPLADC12M$HPLADC12$getMem(uint8_t arg_0x413f9010);
static void HPLADC12M$HPLADC12$setIEFlags(uint16_t arg_0x413f94c0);
#line 69
static void HPLADC12M$HPLADC12$setSHT(uint8_t arg_0x413f6688);
#line 50
static void HPLADC12M$HPLADC12$setMemControl(uint8_t arg_0x413fa4b8, adc12memctl_t arg_0x413fa650);
#line 82
static void HPLADC12M$HPLADC12$stopConversion(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t RefVoltM$SwitchOffTimer$fired(void);
# 118 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
static RefVolt_t RefVoltM$RefVolt$getState(void);
#line 109
static result_t RefVoltM$RefVolt$release(void);
#line 93
static result_t RefVoltM$RefVolt$get(RefVolt_t arg_0x413e2cf8);
# 61 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void RefVoltM$HPLADC12$memOverflow(void);
static void RefVoltM$HPLADC12$converted(uint8_t arg_0x413f8a00);
#line 62
static void RefVoltM$HPLADC12$timeOverflow(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t RefVoltM$SwitchOnTimer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Intercept$default$intercept(
# 19 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e1e20,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
#line 86
static result_t MultiHopEngineM$Snoop$default$intercept(
# 20 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e0420,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t MultiHopEngineM$Send$send(
# 17 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e10f8,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
#line 106
static void *MultiHopEngineM$Send$getBuffer(
# 17 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e10f8,
# 106 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0);
#line 119
static result_t MultiHopEngineM$Send$default$sendDone(
# 17 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e10f8,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopEngineM$MultihopCtrl$readyToSend(void);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopEngineM$StdControl$init(void);
static result_t MultiHopEngineM$StdControl$start(void);
# 84 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
static uint16_t MultiHopEngineM$RouteControl$getQuality(void);
#line 49
static uint16_t MultiHopEngineM$RouteControl$getParent(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopEngineM$RouteStatusTimer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(
# 39 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x415508a0,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40bd2280);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesRouterM$SubSend$sendDone(
# 40 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x41550e50,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$DTTimer$fired(void);
#line 73
static result_t CascadesRouterM$RTTimer$fired(void);
#line 73
static result_t CascadesRouterM$DelayTimer$fired(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr CascadesRouterM$Receive$default$receive(
# 36 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x415502d0,
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
TOS_MsgPtr arg_0x40a0f130, void *arg_0x40a0f2d0, uint16_t arg_0x40a0f468);
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static result_t CascadesRouterM$CascadeControl$addDirectChild(address_t arg_0x41544d38);
static result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t arg_0x415431f0);
static result_t CascadesRouterM$CascadeControl$parentChanged(address_t arg_0x41543698);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ResetTimer$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesRouterM$StdControl$init(void);
static result_t CascadesRouterM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ACKTimer$fired(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t CascadesEngineM$SendMsg$default$send(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x415fc7b8,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
static result_t CascadesEngineM$SendMsg$sendDone(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x415fc7b8,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesEngineM$MySend$send(
# 36 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x415fc030,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesEngineM$StdControl$init(void);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t arg_0x412209c8, uint16_t arg_0x41220b60, bool arg_0x41220cf0);
#line 6
static bool NeighborMgmtM$NeighborCtrl$clearParent(bool arg_0x41220528);
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t arg_0x4121d7d8, uint16_t arg_0x4121d968);
#line 5
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t arg_0x41220098);
# 2 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static uint16_t NeighborMgmtM$CascadeControl$getParent(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t NeighborMgmtM$StdControl$init(void);
static result_t NeighborMgmtM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t NeighborMgmtM$Timer$fired(void);
# 47 "/opt/tinyos-1.x/tos/platform/msp430/MainM.nc"
static result_t MainM$hardwareInit(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MainM$StdControl$init(void);
static result_t MainM$StdControl$start(void);
# 52 "/opt/tinyos-1.x/tos/platform/msp430/MainM.nc"
int main(void) ;
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HPLInitM$MSP430ClockControl$init(void);
static result_t HPLInitM$MSP430ClockControl$start(void);
# 35 "/opt/tinyos-1.x/tos/platform/msp430/HPLInitM.nc"
static inline result_t HPLInitM$init(void);
# 29 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockInit.nc"
static void MSP430ClockM$MSP430ClockInit$initTimerB(void);
#line 28
static void MSP430ClockM$MSP430ClockInit$initTimerA(void);
#line 27
static void MSP430ClockM$MSP430ClockInit$initClocks(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static volatile uint8_t MSP430ClockM$IE1 __asm ("0x0000");
static volatile uint16_t MSP430ClockM$TA0CTL __asm ("0x0160");
static volatile uint16_t MSP430ClockM$TA0IV __asm ("0x012E");
static volatile uint16_t MSP430ClockM$TBCTL __asm ("0x0180");
static volatile uint16_t MSP430ClockM$TBIV __asm ("0x011E");
enum MSP430ClockM$__nesc_unnamed4308 {
MSP430ClockM$ACLK_CALIB_PERIOD = 8,
MSP430ClockM$ACLK_KHZ = 32,
MSP430ClockM$TARGET_DCO_KHZ = 4096,
MSP430ClockM$TARGET_DCO_DELTA = MSP430ClockM$TARGET_DCO_KHZ / MSP430ClockM$ACLK_KHZ * MSP430ClockM$ACLK_CALIB_PERIOD
};
static inline void MSP430ClockM$MSP430ClockInit$defaultInitClocks(void);
#line 69
static inline void MSP430ClockM$MSP430ClockInit$defaultInitTimerA(void);
#line 84
static inline void MSP430ClockM$MSP430ClockInit$defaultInitTimerB(void);
#line 99
static inline void MSP430ClockM$MSP430ClockInit$default$initClocks(void);
static inline void MSP430ClockM$MSP430ClockInit$default$initTimerA(void);
static inline void MSP430ClockM$MSP430ClockInit$default$initTimerB(void);
static inline void MSP430ClockM$startTimerA(void);
#line 127
static inline void MSP430ClockM$startTimerB(void);
#line 139
static void MSP430ClockM$set_dco_calib(int calib);
static inline uint16_t MSP430ClockM$test_calib_busywait_delta(int calib);
#line 168
static inline void MSP430ClockM$busyCalibrateDCO(void);
#line 201
static inline result_t MSP430ClockM$StdControl$init(void);
#line 220
static inline result_t MSP430ClockM$StdControl$start(void);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static uint16_t MSP430DCOCalibM$Timer32khz$read(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430DCOCalibM.nc"
uint16_t MSP430DCOCalibM$m_prev;
enum MSP430DCOCalibM$__nesc_unnamed4309 {
MSP430DCOCalibM$TARGET_DELTA = 2048,
MSP430DCOCalibM$MAX_DEVIATION = 7
};
static inline void MSP430DCOCalibM$TimerMicro$overflow(void);
#line 75
static inline void MSP430DCOCalibM$Timer32khz$overflow(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureA1$captured(uint16_t arg_0x408cb858);
#line 74
static void MSP430TimerM$CaptureB3$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA1$fired(void);
#line 34
static void MSP430TimerM$CompareB3$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureB6$captured(uint16_t arg_0x408cb858);
#line 74
static void MSP430TimerM$CaptureB1$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB1$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureA2$captured(uint16_t arg_0x408cb858);
#line 74
static void MSP430TimerM$CaptureB4$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA2$fired(void);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430TimerM$TimerA$overflow(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB4$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureA0$captured(uint16_t arg_0x408cb858);
#line 74
static void MSP430TimerM$CaptureB2$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareA0$fired(void);
#line 34
static void MSP430TimerM$CompareB2$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureB5$captured(uint16_t arg_0x408cb858);
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430TimerM$TimerB$overflow(void);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB5$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void MSP430TimerM$CaptureB0$captured(uint16_t arg_0x408cb858);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430TimerM$CompareB6$fired(void);
#line 34
static void MSP430TimerM$CompareB0$fired(void);
# 67 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static volatile uint16_t MSP430TimerM$TA0CTL __asm ("0x0160");
static volatile uint16_t MSP430TimerM$TA0CCTL0 __asm ("0x0162");
static volatile uint16_t MSP430TimerM$TA0CCTL1 __asm ("0x0164");
static volatile uint16_t MSP430TimerM$TA0CCTL2 __asm ("0x0166");
static volatile uint16_t MSP430TimerM$TA0CCR0 __asm ("0x0172");
static volatile uint16_t MSP430TimerM$TA0CCR1 __asm ("0x0174");
static volatile uint16_t MSP430TimerM$TA0CCR2 __asm ("0x0176");
static volatile uint16_t MSP430TimerM$TBCCTL0 __asm ("0x0182");
static volatile uint16_t MSP430TimerM$TBCCTL1 __asm ("0x0184");
static volatile uint16_t MSP430TimerM$TBCCTL2 __asm ("0x0186");
static volatile uint16_t MSP430TimerM$TBCCTL3 __asm ("0x0188");
static volatile uint16_t MSP430TimerM$TBCCTL4 __asm ("0x018A");
static volatile uint16_t MSP430TimerM$TBCCTL5 __asm ("0x018C");
static volatile uint16_t MSP430TimerM$TBCCTL6 __asm ("0x018E");
static volatile uint16_t MSP430TimerM$TBCCR0 __asm ("0x0192");
static volatile uint16_t MSP430TimerM$TBCCR1 __asm ("0x0194");
static volatile uint16_t MSP430TimerM$TBCCR2 __asm ("0x0196");
static volatile uint16_t MSP430TimerM$TBCCR3 __asm ("0x0198");
static volatile uint16_t MSP430TimerM$TBCCR4 __asm ("0x019A");
static volatile uint16_t MSP430TimerM$TBCCR5 __asm ("0x019C");
static volatile uint16_t MSP430TimerM$TBCCR6 __asm ("0x019E");
typedef MSP430CompareControl_t MSP430TimerM$CC_t;
static inline uint16_t MSP430TimerM$CC2int(MSP430TimerM$CC_t x);
static inline MSP430TimerM$CC_t MSP430TimerM$int2CC(uint16_t x);
static uint16_t MSP430TimerM$compareControl(void);
#line 110
static inline uint16_t MSP430TimerM$captureControl(uint8_t l_cm);
#line 123
void sig_TIMERA0_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(12))) ;
void sig_TIMERA1_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(10))) ;
#line 159
static inline void MSP430TimerM$CompareA2$default$fired(void);
static inline void MSP430TimerM$CaptureA0$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureA1$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureA2$default$captured(uint16_t time);
static inline uint16_t MSP430TimerM$TimerB$read(void);
static inline bool MSP430TimerM$TimerB$isOverflowPending(void);
static inline void MSP430TimerM$TimerA$setMode(int mode);
static inline void MSP430TimerM$TimerA$clear(void);
static inline void MSP430TimerM$TimerA$disableEvents(void);
static inline void MSP430TimerM$TimerA$setClockSource(uint16_t clockSource);
static inline void MSP430TimerM$TimerA$setInputDivider(uint16_t inputDivider);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA0$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA1$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA2$getControl(void);
static inline void MSP430TimerM$ControlA0$setControl(MSP430TimerM$CC_t x);
static inline void MSP430TimerM$ControlA1$setControl(MSP430TimerM$CC_t x);
#line 253
static inline uint16_t MSP430TimerM$CaptureA0$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureA1$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureA2$getEvent(void);
static inline void MSP430TimerM$CompareA0$setEvent(uint16_t x);
static inline void MSP430TimerM$CompareA1$setEvent(uint16_t x);
#line 277
void sig_TIMERB0_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(26))) ;
void sig_TIMERB1_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(24))) ;
#line 331
static inline void MSP430TimerM$CompareB0$default$fired(void);
static inline void MSP430TimerM$CompareB1$default$fired(void);
static inline void MSP430TimerM$CompareB2$default$fired(void);
static inline void MSP430TimerM$CompareB6$default$fired(void);
static inline void MSP430TimerM$CaptureB0$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureB2$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureB3$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureB4$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureB5$default$captured(uint16_t time);
static inline void MSP430TimerM$CaptureB6$default$captured(uint16_t time);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB0$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB1$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB2$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB3$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB4$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB5$getControl(void);
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB6$getControl(void);
static inline void MSP430TimerM$ControlB1$clearPendingInterrupt(void);
static inline void MSP430TimerM$ControlB3$clearPendingInterrupt(void);
static inline void MSP430TimerM$ControlB4$clearPendingInterrupt(void);
static inline void MSP430TimerM$ControlB5$clearPendingInterrupt(void);
#line 382
static inline void MSP430TimerM$ControlB3$setControlAsCompare(void);
static inline void MSP430TimerM$ControlB4$setControlAsCompare(void);
static inline void MSP430TimerM$ControlB5$setControlAsCompare(void);
static inline void MSP430TimerM$ControlB1$setControlAsCapture(uint8_t cm);
#line 412
static inline void MSP430TimerM$ControlB1$enableEvents(void);
static inline void MSP430TimerM$ControlB3$enableEvents(void);
static inline void MSP430TimerM$ControlB4$enableEvents(void);
static inline void MSP430TimerM$ControlB5$enableEvents(void);
static inline void MSP430TimerM$ControlB1$disableEvents(void);
static inline void MSP430TimerM$ControlB3$disableEvents(void);
static inline void MSP430TimerM$ControlB4$disableEvents(void);
static inline void MSP430TimerM$ControlB5$disableEvents(void);
#line 443
static inline uint16_t MSP430TimerM$CaptureB0$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB1$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB2$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB3$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB4$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB5$getEvent(void);
static inline uint16_t MSP430TimerM$CaptureB6$getEvent(void);
#line 470
static inline void MSP430TimerM$CompareB3$setEventFromNow(uint16_t x);
static inline void MSP430TimerM$CompareB4$setEventFromNow(uint16_t x);
static inline void MSP430TimerM$CompareB5$setEventFromNow(uint16_t x);
static inline bool MSP430TimerM$CaptureB1$isOverflowPending(void);
static inline void MSP430TimerM$CaptureB1$clearOverflow(void);
# 28 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
static void *SmartSensingM$DataMgmt$allocBlk(uint8_t arg_0x40ad2760);
static result_t SmartSensingM$DataMgmt$saveBlk(void *arg_0x40ad0110, uint8_t arg_0x40ad02a0);
# 39 "/home/xu/oasis/interfaces/RealTime.nc"
static uint32_t SmartSensingM$RealTime$getTimeCount(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t SmartSensingM$Random$rand(void);
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
static result_t SmartSensingM$ADCControl$bindPort(uint8_t arg_0x40a94cf8, uint8_t arg_0x40a94e80);
#line 50
static result_t SmartSensingM$ADCControl$init(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$SensingTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SmartSensingM$SubControl$init(void);
static result_t SmartSensingM$SubControl$start(void);
#line 63
static result_t SmartSensingM$TimerControl$init(void);
static result_t SmartSensingM$TimerControl$start(void);
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t SmartSensingM$ADC$getData(
# 63 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint8_t arg_0x40a7cd80);
# 84 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
static uint16_t SmartSensingM$RouteControl$getQuality(void);
# 90 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint16_t SmartSensingM$timerInterval;
uint16_t SmartSensingM$defaultCode;
bool SmartSensingM$initedClock;
SenBlkPtr SmartSensingM$sensingCurBlk;
static inline void SmartSensingM$initDefault(void);
static inline void SmartSensingM$trySample(void);
static void SmartSensingM$saveData(uint8_t type, uint16_t data);
static uint16_t SmartSensingM$calFireInterval(void);
static void SmartSensingM$updateMaxBlkNum(void);
static inline void SmartSensingM$setrate(void);
static inline void SmartSensingM$initDefault(void);
#line 312
static inline result_t SmartSensingM$StdControl$init(void);
#line 332
static inline result_t SmartSensingM$StdControl$start(void);
#line 360
static inline uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t type);
#line 382
static inline result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t type, uint16_t rate);
#line 416
static inline uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t type);
#line 436
static inline result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t type, uint8_t channel);
#line 480
static inline uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t type);
#line 498
static inline result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t type, uint8_t priority);
#line 525
static inline uint8_t SmartSensingM$SensingConfig$getNodePriority(void);
#line 544
static inline result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t priority);
#line 570
static inline uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t type);
#line 582
static inline result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t type, uint16_t code);
#line 608
static inline result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
#line 620
static inline result_t SmartSensingM$SensingTimer$fired(void);
#line 645
static inline result_t SmartSensingM$ADC$dataReady(uint8_t client, uint16_t data);
#line 734
static void SmartSensingM$saveData(uint8_t client, uint16_t data);
#line 770
static inline void SmartSensingM$setrate(void);
#line 788
static void SmartSensingM$updateMaxBlkNum(void);
#line 814
static __inline uint16_t SmartSensingM$GCD(uint16_t a, uint16_t b);
#line 832
static uint16_t SmartSensingM$calFireInterval(void);
#line 861
static inline bool SmartSensingM$needSample(uint8_t client);
#line 909
static inline void SmartSensingM$trySample(void);
# 63 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$redToggle(void);
#line 75
static inline result_t NoLeds$Leds$greenToggle(void);
#line 87
static inline result_t NoLeds$Leds$yellowToggle(void);
# 54 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
uint16_t RandomLFSR$shiftReg;
uint16_t RandomLFSR$initSeed;
uint16_t RandomLFSR$mask;
static inline result_t RandomLFSR$Random$init(void);
static uint16_t RandomLFSR$Random$rand(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void RealTimeM$MSP430Compare$setEventFromNow(uint16_t arg_0x408d5830);
# 43 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
static result_t RealTimeM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b50150);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t RealTimeM$Leds$greenToggle(void);
#line 131
static result_t RealTimeM$Leds$yellowToggle(void);
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void RealTimeM$MSP430TimerControl$enableEvents(void);
#line 35
static void RealTimeM$MSP430TimerControl$setControlAsCompare(void);
static void RealTimeM$MSP430TimerControl$disableEvents(void);
#line 32
static void RealTimeM$MSP430TimerControl$clearPendingInterrupt(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$fired(
# 30 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
uint8_t arg_0x40b35650);
#line 46
SyncUser_t RealTimeM$clientList[MAX_NUM_CLIENT];
uint32_t RealTimeM$mState;
uint32_t RealTimeM$localTime;
uint32_t RealTimeM$uc_fire_point;
uint32_t RealTimeM$uc_fire_interval;
uint8_t RealTimeM$numClients;
int8_t RealTimeM$queue_head;
int8_t RealTimeM$queue_tail;
uint8_t RealTimeM$queue_size;
uint8_t RealTimeM$queue[NUM_TIMERS];
uint8_t RealTimeM$syncMode;
bool RealTimeM$taskBusy;
bool RealTimeM$is_synced;
bool RealTimeM$timerBusy;
uint32_t RealTimeM$timerCount;
uint32_t RealTimeM$globaltime_t;
static void RealTimeM$signalOneTimer(void);
static inline void RealTimeM$enqueue(uint8_t value);
static inline uint8_t RealTimeM$dequeue(void);
static inline result_t RealTimeM$StdControl$init(void);
#line 108
static inline result_t RealTimeM$StdControl$start(void);
#line 169
static uint32_t RealTimeM$RealTime$getTimeCount(void);
#line 209
static inline bool RealTimeM$RealTime$isSync(void);
static inline uint8_t RealTimeM$RealTime$getMode(void);
static result_t RealTimeM$RealTime$setTimeCount(uint32_t newCount, uint8_t userMode);
#line 282
static result_t RealTimeM$Timer$start(uint8_t id, char type, uint32_t interval);
#line 323
static inline result_t RealTimeM$Timer$stop(uint8_t id);
#line 342
static inline void RealTimeM$enqueue(uint8_t value);
#line 354
static inline uint8_t RealTimeM$dequeue(void);
#line 373
static void RealTimeM$signalOneTimer(void);
#line 387
static inline void RealTimeM$updateTimer(void);
#line 436
static inline void RealTimeM$MSP430Compare$fired(void);
#line 459
static uint32_t RealTimeM$LocalTime$read(void);
#line 508
static inline result_t RealTimeM$Timer$default$fired(uint8_t id);
static inline void RealTimeM$MSP430Timer$overflow(void);
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
static result_t TimeSyncM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40bcab20, uint32_t *arg_0x40bcacd8);
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
static bool TimeSyncM$RealTime$isSync(void);
#line 40
static result_t TimeSyncM$RealTime$setTimeCount(uint32_t arg_0x40ab48c8, uint8_t arg_0x40ab4a50);
static uint8_t TimeSyncM$RealTime$getMode(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t TimeSyncM$LocalTime$read(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t TimeSyncM$Leds$greenToggle(void);
#line 131
static result_t TimeSyncM$Leds$yellowToggle(void);
#line 81
static result_t TimeSyncM$Leds$redToggle(void);
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
static void TimeSyncM$TimeSyncNotify$msg_received(void);
static void TimeSyncM$TimeSyncNotify$msg_sent(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t TimeSyncM$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimeSyncM$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 75 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
enum TimeSyncM$__nesc_unnamed4310 {
TimeSyncM$MAX_ENTRIES = 8,
TimeSyncM$BEACON_RATE = 5,
TimeSyncM$ROOT_TIMEOUT = 6,
TimeSyncM$IGNORE_ROOT_MSG = 4,
TimeSyncM$ENTRY_VALID_LIMIT = 4,
TimeSyncM$ENTRY_SEND_LIMIT = 4,
TimeSyncM$ENTRY_THROWOUT_LIMIT = 100
};
#line 149
#line 144
typedef struct TimeSyncM$TableItem {
uint16_t state;
uint32_t localTime;
int32_t timeOffset;
} TimeSyncM$TableItem;
enum TimeSyncM$__nesc_unnamed4311 {
TimeSyncM$ENTRY_EMPTY = 0,
TimeSyncM$ENTRY_FULL = 1
};
enum TimeSyncM$__nesc_unnamed4312 {
TimeSyncM$ERROR_TIMES = 3,
TimeSyncM$GPS_VALID = 3
};
TimeSyncM$TableItem TimeSyncM$table[TimeSyncM$MAX_ENTRIES];
uint16_t TimeSyncM$tableEntries;
enum TimeSyncM$__nesc_unnamed4313 {
TimeSyncM$STATE_IDLE = 0x00,
TimeSyncM$STATE_PROCESSING = 0x01,
TimeSyncM$STATE_SENDING = 0x02,
TimeSyncM$STATE_INIT = 0x04
};
uint16_t TimeSyncM$state;
#line 170
uint16_t TimeSyncM$mode;
uint16_t TimeSyncM$alreadySetTime;
uint16_t TimeSyncM$errTimes;
uint16_t TimeSyncM$hasGPSValid;
#line 185
float TimeSyncM$skew;
uint32_t TimeSyncM$localAverage;
int32_t TimeSyncM$offsetAverage;
uint16_t TimeSyncM$numEntries;
uint16_t TimeSyncM$missedSendStamps;
#line 190
uint16_t TimeSyncM$missedReceiveStamps;
TOS_Msg TimeSyncM$processedMsgBuffer;
TOS_MsgPtr TimeSyncM$processedMsg;
TOS_Msg TimeSyncM$outgoingMsgBuffer;
uint16_t TimeSyncM$heartBeats;
uint16_t TimeSyncM$rootid;
static inline uint32_t TimeSyncM$GlobalTime$getLocalTime(void);
static inline result_t TimeSyncM$is_synced(void);
static result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *time);
#line 229
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *time);
#line 248
static inline void TimeSyncM$calculateConversion(void);
#line 309
static void TimeSyncM$clearTable(void);
static inline void TimeSyncM$addNewEntry(TimeSyncMsg *msg);
#line 417
static inline void TimeSyncM$processMsg(void);
#line 509
static inline TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr p);
#line 571
static void TimeSyncM$adjustRootID(void);
#line 624
static void TimeSyncM$sendMsg(void);
#line 693
static inline result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr ptr, result_t success);
#line 718
static inline void TimeSyncM$timeSyncMsgSend(void);
#line 753
static inline result_t TimeSyncM$Timer$fired(void);
#line 806
static inline result_t TimeSyncM$StdControl$init(void);
#line 839
static inline result_t TimeSyncM$StdControl$start(void);
#line 873
static inline void TimeSyncM$TimeSyncNotify$default$msg_received(void);
static inline void TimeSyncM$TimeSyncNotify$default$msg_sent(void);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t TimerM$TimerMilli$fired(
# 32 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c468b0);
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void TimerM$AlarmControl$enableEvents(void);
#line 35
static void TimerM$AlarmControl$setControlAsCompare(void);
static void TimerM$AlarmControl$disableEvents(void);
#line 32
static void TimerM$AlarmControl$clearPendingInterrupt(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void TimerM$AlarmCompare$setEventFromNow(uint16_t arg_0x408d5830);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerJiffy.nc"
static result_t TimerM$TimerJiffy$fired(
# 33 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c444e0);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static uint16_t TimerM$AlarmTimer$read(void);
static bool TimerM$AlarmTimer$isOverflowPending(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$fired(
# 31 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
uint8_t arg_0x40c46118);
enum TimerM$__nesc_unnamed4314 {
TimerM$COUNT_TIMER_OLD = 12U,
TimerM$COUNT_TIMER_MILLI = 2U,
TimerM$COUNT_TIMER_JIFFY = 0U,
TimerM$OFFSET_TIMER_OLD = 0,
TimerM$OFFSET_TIMER_MILLI = TimerM$OFFSET_TIMER_OLD + TimerM$COUNT_TIMER_OLD,
TimerM$OFFSET_TIMER_JIFFY = TimerM$OFFSET_TIMER_MILLI + TimerM$COUNT_TIMER_MILLI,
TimerM$NUM_TIMERS = TimerM$OFFSET_TIMER_JIFFY + TimerM$COUNT_TIMER_JIFFY,
TimerM$EMPTY_LIST = 255
};
#line 54
typedef struct TimerM$Timer_s {
uint32_t alarm;
uint8_t next;
bool isperiodic : 1;
bool isset : 1;
bool isqueued : 1;
int _reserved_flags : 5;
uint8_t _reserved_byte;
} TimerM$Timer_t;
TimerM$Timer_t TimerM$m_timers[TimerM$NUM_TIMERS];
int32_t TimerM$m_period[TimerM$NUM_TIMERS];
uint16_t TimerM$m_hinow;
uint8_t TimerM$m_head_short;
uint8_t TimerM$m_head_long;
bool TimerM$m_posted_checkShortTimers;
static result_t TimerM$StdControl$init(void);
#line 84
static inline result_t TimerM$StdControl$start(void);
static void TimerM$insertTimer(uint8_t num, bool isshort);
#line 113
static inline void TimerM$removeTimer(uint8_t num);
static inline void TimerM$signal_timer_fired(uint8_t num);
#line 141
static void TimerM$executeTimers(uint8_t head);
#line 184
static inline void TimerM$checkShortTimers(void);
static void TimerM$post_checkShortTimers(void);
#line 198
static void TimerM$setNextShortEvent(void);
#line 257
static inline void TimerM$checkShortTimers(void);
static inline void TimerM$checkLongTimers(void);
static uint16_t TimerM$readTime(void);
#line 288
static uint32_t TimerM$LocalTime$read(void);
#line 308
static inline void TimerM$AlarmCompare$fired(void);
static inline void TimerM$AlarmTimer$overflow(void);
static result_t TimerM$setTimer(uint8_t num, int32_t jiffy, bool isperiodic);
#line 386
static inline result_t TimerM$TimerJiffy$default$fired(uint8_t num);
static inline uint8_t TimerM$fromNumMilli(uint8_t num);
static inline result_t TimerM$TimerMilli$setOneShot(uint8_t num, int32_t milli);
#line 435
static inline result_t TimerM$TimerMilli$default$fired(uint8_t num);
static result_t TimerM$Timer$start(uint8_t num, char type, uint32_t milli);
#line 457
static result_t TimerM$Timer$stop(uint8_t num);
static inline result_t TimerM$Timer$default$fired(uint8_t num);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$ReceiveMsg$receive(
# 71 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40cdd5b8,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40bd2280);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$ActivityTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t GenericCommProM$Intercept$intercept(TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$UARTSend$send(TOS_MsgPtr arg_0x40d018a0);
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
static uint8_t GenericCommProM$PowerManagement$adjustPower(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$RadioControl$init(void);
static result_t GenericCommProM$RadioControl$start(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
static void GenericCommProM$MacControl$enableAck(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$TimerControl$init(void);
static result_t GenericCommProM$TimerControl$start(void);
#line 63
static result_t GenericCommProM$UARTControl$init(void);
static result_t GenericCommProM$UARTControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t GenericCommProM$Leds$greenToggle(void);
#line 131
static result_t GenericCommProM$Leds$yellowToggle(void);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$RadioSend$send(TOS_MsgPtr arg_0x40d018a0);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t GenericCommProM$SendMsg$sendDone(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40cdef00,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68);
# 185 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static uint8_t GenericCommProM$CC2420Control$GetRFPower(void);
#line 178
static result_t GenericCommProM$CC2420Control$SetRFPower(uint8_t arg_0x40d15950);
#line 84
static result_t GenericCommProM$CC2420Control$TunePreset(uint8_t arg_0x40d19a30);
#line 106
static uint8_t GenericCommProM$CC2420Control$GetPreset(void);
# 119 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
bool GenericCommProM$sendTaskBusy;
bool GenericCommProM$recvTaskBusy;
#line 122
typedef struct GenericCommProM$backupHeader {
uint8_t valid;
uint8_t length;
uint8_t type;
uint8_t group;
TOS_MsgPtr msgPtr;
address_t addr;
} GenericCommProM$backupHeader;
Queue_t GenericCommProM$sendQueue;
GenericCommProM$backupHeader GenericCommProM$bkHeader[COMM_SEND_QUEUE_SIZE];
TOS_Msg GenericCommProM$swapBuf;
TOS_MsgPtr GenericCommProM$swapMsgPtr;
bool GenericCommProM$state;
bool GenericCommProM$radioRecvActive;
bool GenericCommProM$radioSendActive;
uint8_t GenericCommProM$wdtTimerCnt;
uint16_t GenericCommProM$lastCount;
uint16_t GenericCommProM$counter;
uint8_t GenericCommProM$UARTOrRadio;
bool GenericCommProM$toSend;
static inline void GenericCommProM$sendTask(void);
static result_t GenericCommProM$tryNextSend(void);
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg);
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len);
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success);
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg);
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void);
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg);
static result_t GenericCommProM$freeBkHeader(uint8_t ind);
static inline bool GenericCommProM$Control$init(void);
#line 250
static inline bool GenericCommProM$Control$start(void);
#line 295
static result_t GenericCommProM$SendMsg$send(uint8_t id, uint16_t addr, uint8_t len, TOS_MsgPtr msg);
#line 332
static inline result_t GenericCommProM$ActivityTimer$fired(void);
#line 365
static inline result_t GenericCommProM$SendMsg$default$sendDone(uint8_t id, TOS_MsgPtr msg, result_t success);
static inline result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr msg, result_t success);
static inline TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(uint8_t id, TOS_MsgPtr msg);
static inline TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr packet);
static inline result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr msg, result_t status);
static inline TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr msg);
static inline void GenericCommProM$sendFunc(void);
#line 463
static inline void GenericCommProM$sendTask(void);
#line 504
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg);
static result_t GenericCommProM$tryNextSend(void);
#line 536
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len);
#line 576
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success);
#line 650
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg);
#line 698
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void);
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg);
#line 722
static result_t GenericCommProM$freeBkHeader(uint8_t ind);
#line 737
static inline result_t GenericCommProM$setRFChannel(uint8_t channel);
static inline result_t GenericCommProM$setRFPower(uint8_t level);
static inline uint8_t GenericCommProM$getRFChannel(void);
static inline uint8_t GenericCommProM$getRFPower(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$SplitControl$initDone(void);
#line 85
static result_t CC2420RadioM$SplitControl$startDone(void);
# 59 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420RadioM$FIFOP$disable(void);
#line 43
static result_t CC2420RadioM$FIFOP$startWait(bool arg_0x40dc68a0);
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t CC2420RadioM$BackoffTimerJiffy$setOneShot(uint32_t arg_0x40db7d10);
static bool CC2420RadioM$BackoffTimerJiffy$isSet(void);
#line 8
static result_t CC2420RadioM$BackoffTimerJiffy$stop(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t CC2420RadioM$Send$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t CC2420RadioM$Random$rand(void);
#line 57
static result_t CC2420RadioM$Random$init(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420RadioM$TimerControl$init(void);
static result_t CC2420RadioM$TimerControl$start(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr CC2420RadioM$Receive$receive(TOS_MsgPtr arg_0x40bd2280);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t CC2420RadioM$HPLChipcon$read(uint8_t arg_0x40da30b0);
#line 47
static uint8_t CC2420RadioM$HPLChipcon$cmd(uint8_t arg_0x40da54b0);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void CC2420RadioM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658);
# 60 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t CC2420RadioM$SFD$disable(void);
#line 43
static result_t CC2420RadioM$SFD$enableCapture(bool arg_0x40dbe808);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void CC2420RadioM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658);
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t CC2420RadioM$HPLChipconFIFO$writeTXFIFO(uint8_t arg_0x40d9cec0, uint8_t *arg_0x40dcd088);
#line 19
static result_t CC2420RadioM$HPLChipconFIFO$readRXFIFO(uint8_t arg_0x40d9c6a8, uint8_t *arg_0x40d9c850);
# 206 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static result_t CC2420RadioM$CC2420Control$enableAddrDecode(void);
#line 192
static result_t CC2420RadioM$CC2420Control$enableAutoAck(void);
#line 163
static result_t CC2420RadioM$CC2420Control$RxMode(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
static int16_t CC2420RadioM$MacBackoff$initialBackoff(TOS_MsgPtr arg_0x40d999b8);
static int16_t CC2420RadioM$MacBackoff$congestionBackoff(TOS_MsgPtr arg_0x40d99e78);
# 64 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$CC2420SplitControl$init(void);
#line 77
static result_t CC2420RadioM$CC2420SplitControl$start(void);
# 76 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
enum CC2420RadioM$__nesc_unnamed4315 {
CC2420RadioM$DISABLED_STATE = 0,
CC2420RadioM$DISABLED_STATE_STARTTASK,
CC2420RadioM$IDLE_STATE,
CC2420RadioM$TX_STATE,
CC2420RadioM$TX_WAIT,
CC2420RadioM$PRE_TX_STATE,
CC2420RadioM$POST_TX_STATE,
CC2420RadioM$POST_TX_ACK_STATE,
CC2420RadioM$RX_STATE,
CC2420RadioM$POWER_DOWN_STATE,
CC2420RadioM$WARMUP_STATE,
CC2420RadioM$TIMER_INITIAL = 0,
CC2420RadioM$TIMER_BACKOFF,
CC2420RadioM$TIMER_ACK
};
uint8_t CC2420RadioM$countRetry;
uint8_t CC2420RadioM$stateRadio;
uint8_t CC2420RadioM$stateTimer;
uint8_t CC2420RadioM$currentDSN;
bool CC2420RadioM$bAckEnable;
bool CC2420RadioM$bPacketReceiving;
uint8_t CC2420RadioM$txlength;
TOS_MsgPtr CC2420RadioM$txbufptr;
TOS_MsgPtr CC2420RadioM$rxbufptr;
TOS_Msg CC2420RadioM$RxBuf;
volatile uint16_t CC2420RadioM$LocalAddr;
static void CC2420RadioM$sendFailed(void);
static void CC2420RadioM$flushRXFIFO(void);
static __inline result_t CC2420RadioM$setInitialTimer(uint16_t jiffy);
static __inline result_t CC2420RadioM$setBackoffTimer(uint16_t jiffy);
static __inline result_t CC2420RadioM$setAckTimer(uint16_t jiffy);
static inline void CC2420RadioM$PacketRcvd(void);
#line 168
static void CC2420RadioM$PacketSent(void);
#line 186
static inline result_t CC2420RadioM$StdControl$init(void);
static inline result_t CC2420RadioM$SplitControl$init(void);
#line 208
static inline result_t CC2420RadioM$CC2420SplitControl$initDone(void);
static inline result_t CC2420RadioM$SplitControl$default$initDone(void);
#line 239
static inline void CC2420RadioM$startRadio(void);
#line 253
static inline result_t CC2420RadioM$StdControl$start(void);
#line 277
static inline result_t CC2420RadioM$SplitControl$start(void);
#line 294
static inline result_t CC2420RadioM$CC2420SplitControl$startDone(void);
#line 312
static inline result_t CC2420RadioM$SplitControl$default$startDone(void);
static inline void CC2420RadioM$sendPacket(void);
#line 344
static inline result_t CC2420RadioM$SFD$captured(uint16_t time);
#line 393
static void CC2420RadioM$startSend(void);
#line 410
static void CC2420RadioM$tryToSend(void);
#line 449
static inline result_t CC2420RadioM$BackoffTimerJiffy$fired(void);
#line 491
static inline result_t CC2420RadioM$Send$send(TOS_MsgPtr pMsg);
#line 534
static void CC2420RadioM$delayedRXFIFO(void);
static inline void CC2420RadioM$delayedRXFIFOtask(void);
static void CC2420RadioM$delayedRXFIFO(void);
#line 591
static inline result_t CC2420RadioM$FIFOP$fired(void);
#line 628
static inline result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t length, uint8_t *data);
#line 721
static inline result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t length, uint8_t *data);
static inline void CC2420RadioM$MacControl$enableAck(void);
#line 744
static inline int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr m);
static inline int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr m);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420ControlM$SplitControl$initDone(void);
#line 85
static result_t CC2420ControlM$SplitControl$startDone(void);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t CC2420ControlM$HPLChipcon$read(uint8_t arg_0x40da30b0);
#line 54
static uint8_t CC2420ControlM$HPLChipcon$write(uint8_t arg_0x40da59c0, uint16_t arg_0x40da5b50);
#line 47
static uint8_t CC2420ControlM$HPLChipcon$cmd(uint8_t arg_0x40da54b0);
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420ControlM$CCA$startWait(bool arg_0x40dc68a0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420ControlM$HPLChipconControl$init(void);
static result_t CC2420ControlM$HPLChipconControl$start(void);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t CC2420ControlM$HPLChipconRAM$write(uint16_t arg_0x40e23d00, uint8_t arg_0x40e23e88, uint8_t *arg_0x40e22068);
# 63 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
enum CC2420ControlM$__nesc_unnamed4316 {
CC2420ControlM$IDLE_STATE = 0,
CC2420ControlM$INIT_STATE,
CC2420ControlM$INIT_STATE_DONE,
CC2420ControlM$START_STATE,
CC2420ControlM$START_STATE_DONE,
CC2420ControlM$STOP_STATE
};
uint8_t CC2420ControlM$state = 0;
uint16_t CC2420ControlM$gCurrentParameters[14];
static inline bool CC2420ControlM$SetRegs(void);
#line 108
static inline void CC2420ControlM$taskInitDone(void);
static inline void CC2420ControlM$PostOscillatorOn(void);
#line 129
static inline result_t CC2420ControlM$SplitControl$init(void);
#line 227
static inline result_t CC2420ControlM$SplitControl$start(void);
#line 264
static inline result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t chnl);
#line 286
static inline result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t DesiredFreq);
#line 310
static inline uint8_t CC2420ControlM$CC2420Control$GetPreset(void);
#line 343
static inline result_t CC2420ControlM$CC2420Control$RxMode(void);
static inline result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t power);
static inline uint8_t CC2420ControlM$CC2420Control$GetRFPower(void);
static inline result_t CC2420ControlM$CC2420Control$OscillatorOn(void);
#line 400
static inline result_t CC2420ControlM$CC2420Control$VREFOn(void);
#line 412
static inline result_t CC2420ControlM$CC2420Control$enableAutoAck(void);
static inline result_t CC2420ControlM$CC2420Control$enableAddrDecode(void);
static inline result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t addr);
static inline result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t addr, uint8_t length, uint8_t *buffer);
static inline result_t CC2420ControlM$CCA$fired(void);
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t HPLCC2420M$HPLCC2420FIFO$TXFIFODone(uint8_t arg_0x40dcddb0, uint8_t *arg_0x40dcc010);
#line 39
static result_t HPLCC2420M$HPLCC2420FIFO$RXFIFODone(uint8_t arg_0x40dcd640, uint8_t *arg_0x40dcd7e8);
# 191 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
static result_t HPLCC2420M$USARTControl$isTxEmpty(void);
#line 172
static result_t HPLCC2420M$USARTControl$disableRxIntr(void);
static result_t HPLCC2420M$USARTControl$disableTxIntr(void);
#line 135
static void HPLCC2420M$USARTControl$setModeSPI(void);
#line 180
static result_t HPLCC2420M$USARTControl$isTxIntrPending(void);
#line 202
static result_t HPLCC2420M$USARTControl$tx(uint8_t arg_0x40e95850);
static uint8_t HPLCC2420M$USARTControl$rx(void);
#line 185
static result_t HPLCC2420M$USARTControl$isRxIntrPending(void);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t HPLCC2420M$HPLCC2420RAM$writeDone(uint16_t arg_0x40e225a0, uint8_t arg_0x40e22728, uint8_t *arg_0x40e228d0);
# 38 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t HPLCC2420M$BusArbitration$releaseBus(void);
#line 37
static result_t HPLCC2420M$BusArbitration$getBus(void);
# 57 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
uint8_t *HPLCC2420M$txbuf;
uint8_t *HPLCC2420M$rxbuf;
uint8_t *HPLCC2420M$rambuf;
uint8_t HPLCC2420M$txlen;
uint8_t HPLCC2420M$rxlen;
uint8_t HPLCC2420M$ramlen;
uint16_t HPLCC2420M$ramaddr;
#line 68
struct HPLCC2420M$__nesc_unnamed4317 {
bool enabled : 1;
bool busy : 1;
bool rxbufBusy : 1;
bool txbufBusy : 1;
} HPLCC2420M$f;
static inline uint8_t HPLCC2420M$adjustStatusByte(uint8_t status);
static inline result_t HPLCC2420M$StdControl$init(void);
#line 96
static inline result_t HPLCC2420M$StdControl$start(void);
#line 127
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t addr);
#line 162
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t addr, uint16_t data);
#line 205
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t addr);
#line 288
static inline void HPLCC2420M$signalRAMWr(void);
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t addr, uint8_t _length, uint8_t *buffer);
#line 322
static inline void HPLCC2420M$signalRXFIFO(void);
#line 335
static inline result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t length, uint8_t *data);
#line 394
static inline void HPLCC2420M$signalTXFIFO(void);
#line 415
static inline result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t length, uint8_t *data);
#line 461
static inline result_t HPLCC2420M$BusArbitration$busFree(void);
# 43 "/opt/tinyos-1.x/tos/platform/msp430/HPLI2CInterrupt.nc"
static void HPLUSART0M$HPLI2CInterrupt$fired(void);
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
static result_t HPLUSART0M$USARTData$rxDone(uint8_t arg_0x40ee6c40);
#line 46
static result_t HPLUSART0M$USARTData$txDone(void);
# 47 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static volatile uint8_t HPLUSART0M$IE1 __asm ("0x0000");
static volatile uint8_t HPLUSART0M$ME1 __asm ("0x0004");
static volatile uint8_t HPLUSART0M$IFG1 __asm ("0x0002");
static volatile uint8_t HPLUSART0M$U0TCTL __asm ("0x0071");
static volatile uint8_t HPLUSART0M$U0TXBUF __asm ("0x0077");
uint16_t HPLUSART0M$l_br;
uint8_t HPLUSART0M$l_ssel;
void sig_UART0RX_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(18))) ;
void sig_UART0TX_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(16))) ;
static inline void HPLUSART0M$HPLI2CInterrupt$default$fired(void);
static inline bool HPLUSART0M$USARTControl$isSPI(void);
static inline bool HPLUSART0M$USARTControl$isUART(void);
static inline bool HPLUSART0M$USARTControl$isUARTtx(void);
static inline bool HPLUSART0M$USARTControl$isUARTrx(void);
static inline bool HPLUSART0M$USARTControl$isI2C(void);
static inline msp430_usartmode_t HPLUSART0M$USARTControl$getMode(void);
#line 172
static inline void HPLUSART0M$USARTControl$disableUART(void);
#line 218
static inline void HPLUSART0M$USARTControl$disableI2C(void);
static void HPLUSART0M$USARTControl$setModeSPI(void);
#line 424
static result_t HPLUSART0M$USARTControl$isTxIntrPending(void);
static inline result_t HPLUSART0M$USARTControl$isTxEmpty(void);
static result_t HPLUSART0M$USARTControl$isRxIntrPending(void);
static inline result_t HPLUSART0M$USARTControl$disableRxIntr(void);
static inline result_t HPLUSART0M$USARTControl$disableTxIntr(void);
#line 473
static inline result_t HPLUSART0M$USARTControl$tx(uint8_t data);
static uint8_t HPLUSART0M$USARTControl$rx(void);
static inline result_t HPLUSART0M$USARTData$default$txDone(void);
static inline result_t HPLUSART0M$USARTData$default$rxDone(uint8_t data);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420InterruptM$FIFO$fired(void);
#line 51
static result_t HPLCC2420InterruptM$FIFOP$fired(void);
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void HPLCC2420InterruptM$CCAInterrupt$clear(void);
#line 35
static void HPLCC2420InterruptM$CCAInterrupt$disable(void);
#line 54
static void HPLCC2420InterruptM$CCAInterrupt$edge(bool arg_0x40f36350);
#line 30
static void HPLCC2420InterruptM$CCAInterrupt$enable(void);
# 36 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void HPLCC2420InterruptM$SFDControl$setControlAsCapture(bool arg_0x408c0190);
static void HPLCC2420InterruptM$SFDControl$enableEvents(void);
static void HPLCC2420InterruptM$SFDControl$disableEvents(void);
#line 32
static void HPLCC2420InterruptM$SFDControl$clearPendingInterrupt(void);
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void HPLCC2420InterruptM$FIFOInterrupt$clear(void);
#line 35
static void HPLCC2420InterruptM$FIFOInterrupt$disable(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420InterruptM$CCA$fired(void);
# 56 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
static void HPLCC2420InterruptM$SFDCapture$clearOverflow(void);
#line 51
static bool HPLCC2420InterruptM$SFDCapture$isOverflowPending(void);
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t HPLCC2420InterruptM$SFD$captured(uint16_t arg_0x40dbedc8);
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void HPLCC2420InterruptM$FIFOPInterrupt$clear(void);
#line 35
static void HPLCC2420InterruptM$FIFOPInterrupt$disable(void);
#line 54
static void HPLCC2420InterruptM$FIFOPInterrupt$edge(bool arg_0x40f36350);
#line 30
static void HPLCC2420InterruptM$FIFOPInterrupt$enable(void);
# 65 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static result_t HPLCC2420InterruptM$FIFOP$startWait(bool low_to_high);
#line 78
static result_t HPLCC2420InterruptM$FIFOP$disable(void);
static inline void HPLCC2420InterruptM$FIFOPInterrupt$fired(void);
#line 130
static inline void HPLCC2420InterruptM$FIFOInterrupt$fired(void);
static inline result_t HPLCC2420InterruptM$FIFO$default$fired(void);
static inline result_t HPLCC2420InterruptM$CCA$startWait(bool low_to_high);
#line 171
static inline void HPLCC2420InterruptM$CCAInterrupt$fired(void);
#line 185
static result_t HPLCC2420InterruptM$SFD$enableCapture(bool low_to_high);
#line 200
static result_t HPLCC2420InterruptM$SFD$disable(void);
static inline void HPLCC2420InterruptM$SFDCapture$captured(uint16_t time);
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
static void MSP430InterruptM$Port14$fired(void);
#line 59
static void MSP430InterruptM$Port26$fired(void);
#line 59
static void MSP430InterruptM$Port17$fired(void);
#line 59
static void MSP430InterruptM$Port21$fired(void);
#line 59
static void MSP430InterruptM$Port12$fired(void);
#line 59
static void MSP430InterruptM$Port24$fired(void);
#line 59
static void MSP430InterruptM$ACCV$fired(void);
#line 59
static void MSP430InterruptM$Port15$fired(void);
#line 59
static void MSP430InterruptM$Port27$fired(void);
#line 59
static void MSP430InterruptM$Port10$fired(void);
#line 59
static void MSP430InterruptM$Port22$fired(void);
#line 59
static void MSP430InterruptM$OF$fired(void);
#line 59
static void MSP430InterruptM$Port13$fired(void);
#line 59
static void MSP430InterruptM$Port25$fired(void);
#line 59
static void MSP430InterruptM$Port16$fired(void);
#line 59
static void MSP430InterruptM$NMI$fired(void);
#line 59
static void MSP430InterruptM$Port20$fired(void);
#line 59
static void MSP430InterruptM$Port11$fired(void);
#line 59
static void MSP430InterruptM$Port23$fired(void);
# 51 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static volatile uint8_t MSP430InterruptM$P1IE __asm ("0x0025");
static volatile uint8_t MSP430InterruptM$P2IE __asm ("0x002D");
static volatile uint8_t MSP430InterruptM$P1IFG __asm ("0x0023");
static volatile uint8_t MSP430InterruptM$P2IFG __asm ("0x002B");
void sig_PORT1_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(8))) ;
#line 71
void sig_PORT2_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(2))) ;
#line 85
void sig_NMI_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(28))) ;
static inline void MSP430InterruptM$Port11$default$fired(void);
static inline void MSP430InterruptM$Port12$default$fired(void);
static inline void MSP430InterruptM$Port15$default$fired(void);
static inline void MSP430InterruptM$Port16$default$fired(void);
static inline void MSP430InterruptM$Port17$default$fired(void);
static inline void MSP430InterruptM$Port20$default$fired(void);
static inline void MSP430InterruptM$Port21$default$fired(void);
static inline void MSP430InterruptM$Port22$default$fired(void);
static inline void MSP430InterruptM$Port23$default$fired(void);
static inline void MSP430InterruptM$Port24$default$fired(void);
static inline void MSP430InterruptM$Port25$default$fired(void);
static inline void MSP430InterruptM$Port26$default$fired(void);
static inline void MSP430InterruptM$Port27$default$fired(void);
static inline void MSP430InterruptM$NMI$default$fired(void);
static inline void MSP430InterruptM$OF$default$fired(void);
static inline void MSP430InterruptM$ACCV$default$fired(void);
static inline void MSP430InterruptM$Port10$enable(void);
static inline void MSP430InterruptM$Port14$enable(void);
#line 146
static inline void MSP430InterruptM$Port10$disable(void);
static inline void MSP430InterruptM$Port13$disable(void);
static inline void MSP430InterruptM$Port14$disable(void);
#line 177
static inline void MSP430InterruptM$Port10$clear(void);
static inline void MSP430InterruptM$Port11$clear(void);
static inline void MSP430InterruptM$Port12$clear(void);
static inline void MSP430InterruptM$Port13$clear(void);
static inline void MSP430InterruptM$Port14$clear(void);
static inline void MSP430InterruptM$Port15$clear(void);
static inline void MSP430InterruptM$Port16$clear(void);
static inline void MSP430InterruptM$Port17$clear(void);
static inline void MSP430InterruptM$Port20$clear(void);
static inline void MSP430InterruptM$Port21$clear(void);
static inline void MSP430InterruptM$Port22$clear(void);
static inline void MSP430InterruptM$Port23$clear(void);
static inline void MSP430InterruptM$Port24$clear(void);
static inline void MSP430InterruptM$Port25$clear(void);
static inline void MSP430InterruptM$Port26$clear(void);
static inline void MSP430InterruptM$Port27$clear(void);
static inline void MSP430InterruptM$NMI$clear(void);
static inline void MSP430InterruptM$OF$clear(void);
static inline void MSP430InterruptM$ACCV$clear(void);
#line 222
static inline void MSP430InterruptM$Port10$edge(bool l2h);
#line 246
static inline void MSP430InterruptM$Port14$edge(bool l2h);
# 39 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
static result_t BusArbitrationM$BusArbitration$busFree(
# 31 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
uint8_t arg_0x40ffcf08);
uint8_t BusArbitrationM$state;
uint8_t BusArbitrationM$busid;
bool BusArbitrationM$isBusReleasedPending;
enum BusArbitrationM$__nesc_unnamed4318 {
#line 40
BusArbitrationM$BUS_IDLE, BusArbitrationM$BUS_BUSY, BusArbitrationM$BUS_OFF
};
static inline void BusArbitrationM$busReleased(void);
#line 54
static inline result_t BusArbitrationM$StdControl$init(void);
static inline result_t BusArbitrationM$StdControl$start(void);
#line 94
static result_t BusArbitrationM$BusArbitration$getBus(uint8_t id);
#line 108
static result_t BusArbitrationM$BusArbitration$releaseBus(uint8_t id);
#line 125
static inline result_t BusArbitrationM$BusArbitration$default$busFree(uint8_t id);
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void TimerJiffyAsyncM$AlarmControl$enableEvents(void);
#line 35
static void TimerJiffyAsyncM$AlarmControl$setControlAsCompare(void);
static void TimerJiffyAsyncM$AlarmControl$disableEvents(void);
#line 32
static void TimerJiffyAsyncM$AlarmControl$clearPendingInterrupt(void);
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$fired(void);
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void TimerJiffyAsyncM$AlarmCompare$setEventFromNow(uint16_t arg_0x408d5830);
# 13 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
uint32_t TimerJiffyAsyncM$jiffy;
bool TimerJiffyAsyncM$bSet;
static inline result_t TimerJiffyAsyncM$StdControl$init(void);
static inline result_t TimerJiffyAsyncM$StdControl$start(void);
#line 41
static inline void TimerJiffyAsyncM$AlarmCompare$fired(void);
#line 70
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t _jiffy);
#line 97
static inline bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void);
static inline result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void);
# 50 "/opt/tinyos-1.x/tos/system/LedsC.nc"
uint8_t LedsC$ledsOn;
enum LedsC$__nesc_unnamed4319 {
LedsC$RED_BIT = 1,
LedsC$GREEN_BIT = 2,
LedsC$YELLOW_BIT = 4
};
#line 72
static result_t LedsC$Leds$redOn(void);
static result_t LedsC$Leds$redOff(void);
static result_t LedsC$Leds$redToggle(void);
static inline result_t LedsC$Leds$greenOn(void);
static inline result_t LedsC$Leds$greenOff(void);
static result_t LedsC$Leds$greenToggle(void);
static inline result_t LedsC$Leds$yellowOn(void);
static inline result_t LedsC$Leds$yellowOff(void);
static result_t LedsC$Leds$yellowToggle(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280);
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t FramerM$ByteComm$txByte(uint8_t arg_0x4106e5e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FramerM$ByteControl$init(void);
static result_t FramerM$ByteControl$start(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t FramerM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010);
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static TOS_MsgPtr FramerM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x41077eb0, uint8_t arg_0x41076068);
# 82 "/opt/tinyos-1.x/tos/system/FramerM.nc"
enum FramerM$__nesc_unnamed4320 {
FramerM$HDLC_QUEUESIZE = 2,
FramerM$HDLC_MTU = sizeof(TOS_Msg ),
FramerM$HDLC_FLAG_BYTE = 0x7e,
FramerM$HDLC_CTLESC_BYTE = 0x7d,
FramerM$PROTO_ACK = 64,
FramerM$PROTO_PACKET_ACK = 65,
FramerM$PROTO_PACKET_NOACK = 66,
FramerM$PROTO_UNKNOWN = 255
};
enum FramerM$__nesc_unnamed4321 {
FramerM$RXSTATE_NOSYNC,
FramerM$RXSTATE_PROTO,
FramerM$RXSTATE_TOKEN,
FramerM$RXSTATE_INFO,
FramerM$RXSTATE_ESC
};
enum FramerM$__nesc_unnamed4322 {
FramerM$TXSTATE_IDLE,
FramerM$TXSTATE_PROTO,
FramerM$TXSTATE_INFO,
FramerM$TXSTATE_ESC,
FramerM$TXSTATE_FCS1,
FramerM$TXSTATE_FCS2,
FramerM$TXSTATE_ENDFLAG,
FramerM$TXSTATE_FINISH,
FramerM$TXSTATE_ERROR
};
enum FramerM$__nesc_unnamed4323 {
FramerM$FLAGS_TOKENPEND = 0x2,
FramerM$FLAGS_DATAPEND = 0x4,
FramerM$FLAGS_UNKNOWN = 0x8
};
TOS_Msg FramerM$gMsgRcvBuf[FramerM$HDLC_QUEUESIZE];
#line 121
typedef struct FramerM$_MsgRcvEntry {
uint8_t Proto;
uint8_t Token;
uint16_t Length;
TOS_MsgPtr pMsg;
} FramerM$MsgRcvEntry_t;
FramerM$MsgRcvEntry_t FramerM$gMsgRcvTbl[FramerM$HDLC_QUEUESIZE];
uint8_t *FramerM$gpRxBuf;
uint8_t *FramerM$gpTxBuf;
uint8_t FramerM$gFlags;
uint8_t FramerM$gTxState;
uint8_t FramerM$gPrevTxState;
uint16_t FramerM$gTxProto;
uint16_t FramerM$gTxByteCnt;
uint16_t FramerM$gTxLength;
uint16_t FramerM$gTxRunningCRC;
uint8_t FramerM$gRxState;
uint8_t FramerM$gRxHeadIndex;
uint8_t FramerM$gRxTailIndex;
uint16_t FramerM$gRxByteCnt;
uint16_t FramerM$gRxRunningCRC;
TOS_MsgPtr FramerM$gpTxMsg;
uint8_t FramerM$gTxTokenBuf;
uint8_t FramerM$gTxUnknownBuf;
uint8_t FramerM$gTxEscByte;
static void FramerM$PacketSent(void);
static result_t FramerM$StartTx(void);
#line 202
static inline void FramerM$PacketUnknown(void);
static inline void FramerM$PacketRcvd(void);
#line 246
static void FramerM$PacketSent(void);
#line 268
static void FramerM$HDLCInitialize(void);
#line 292
static inline result_t FramerM$StdControl$init(void);
static inline result_t FramerM$StdControl$start(void);
static inline result_t FramerM$BareSendMsg$send(TOS_MsgPtr pMsg);
#line 329
static inline result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t Token);
#line 349
static inline result_t FramerM$ByteComm$rxByteReady(uint8_t data, bool error, uint16_t strength);
#line 470
static result_t FramerM$TxArbitraryByte(uint8_t inByte);
#line 483
static inline result_t FramerM$ByteComm$txByteReady(bool LastByteSuccess);
#line 553
static inline result_t FramerM$ByteComm$txDone(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$ReceiveCombined$receive(TOS_MsgPtr arg_0x40bd2280);
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static result_t FramerAckM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x41076710);
# 72 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
uint8_t FramerAckM$gTokenBuf;
static inline void FramerAckM$SendAckTask(void);
static inline TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr Msg, uint8_t token);
#line 91
static inline TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr Msg);
# 62 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
static result_t UARTM$HPLUART$init(void);
#line 80
static result_t UARTM$HPLUART$put(uint8_t arg_0x410c46c0);
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t UARTM$ByteComm$txDone(void);
#line 75
static result_t UARTM$ByteComm$txByteReady(bool arg_0x4106d4d8);
#line 66
static result_t UARTM$ByteComm$rxByteReady(uint8_t arg_0x4106eb30, bool arg_0x4106ecb8, uint16_t arg_0x4106ee50);
# 58 "/opt/tinyos-1.x/tos/system/UARTM.nc"
bool UARTM$state;
static inline result_t UARTM$Control$init(void);
static inline result_t UARTM$Control$start(void);
static inline result_t UARTM$HPLUART$get(uint8_t data);
static inline result_t UARTM$HPLUART$putDone(void);
#line 110
static result_t UARTM$ByteComm$txByte(uint8_t data);
# 88 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
static result_t HPLUARTM$UART$get(uint8_t arg_0x410c4c58);
static result_t HPLUARTM$UART$putDone(void);
# 169 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
static void HPLUARTM$USARTControl$setClockRate(uint16_t arg_0x40e98918, uint8_t arg_0x40e98aa0);
#line 167
static void HPLUARTM$USARTControl$setClockSource(uint8_t arg_0x40e98460);
static result_t HPLUARTM$USARTControl$enableRxIntr(void);
static result_t HPLUARTM$USARTControl$enableTxIntr(void);
#line 202
static result_t HPLUARTM$USARTControl$tx(uint8_t arg_0x40e95850);
#line 153
static void HPLUARTM$USARTControl$setModeUART(void);
# 50 "/opt/tinyos-1.x/tos/platform/msp430/HPLUARTM.nc"
static inline result_t HPLUARTM$UART$init(void);
#line 90
static inline result_t HPLUARTM$USARTData$rxDone(uint8_t b);
static inline result_t HPLUARTM$USARTData$txDone(void);
static inline result_t HPLUARTM$UART$put(uint8_t data);
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
static result_t HPLUSART1M$USARTData$rxDone(uint8_t arg_0x40ee6c40);
#line 46
static result_t HPLUSART1M$USARTData$txDone(void);
# 46 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static volatile uint8_t HPLUSART1M$ME2 __asm ("0x0005");
static volatile uint8_t HPLUSART1M$IFG2 __asm ("0x0003");
static volatile uint8_t HPLUSART1M$U1TCTL __asm ("0x0079");
static volatile uint8_t HPLUSART1M$U1TXBUF __asm ("0x007F");
uint16_t HPLUSART1M$l_br;
uint8_t HPLUSART1M$l_mctl;
uint8_t HPLUSART1M$l_ssel;
void sig_UART1RX_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(6))) ;
void sig_UART1TX_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(4))) ;
static inline bool HPLUSART1M$USARTControl$isSPI(void);
static inline bool HPLUSART1M$USARTControl$isUART(void);
static inline bool HPLUSART1M$USARTControl$isUARTtx(void);
static inline bool HPLUSART1M$USARTControl$isUARTrx(void);
#line 107
static inline bool HPLUSART1M$USARTControl$isI2C(void);
static inline msp430_usartmode_t HPLUSART1M$USARTControl$getMode(void);
#line 158
static inline void HPLUSART1M$USARTControl$disableUART(void);
#line 191
static inline void HPLUSART1M$USARTControl$disableSPI(void);
#line 252
static inline void HPLUSART1M$setUARTModeCommon(void);
#line 325
static inline void HPLUSART1M$USARTControl$setModeUART(void);
#line 341
static inline void HPLUSART1M$USARTControl$setClockSource(uint8_t source);
static inline void HPLUSART1M$USARTControl$setClockRate(uint16_t baudrate, uint8_t mctl);
#line 392
static inline result_t HPLUSART1M$USARTControl$enableRxIntr(void);
static inline result_t HPLUSART1M$USARTControl$enableTxIntr(void);
static inline result_t HPLUSART1M$USARTControl$tx(uint8_t data);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$EReportControl$init(void);
static result_t SNMSM$EReportControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t SNMSM$Leds$greenToggle(void);
#line 131
static result_t SNMSM$Leds$yellowToggle(void);
#line 81
static result_t SNMSM$Leds$redToggle(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$RPCControl$init(void);
static result_t SNMSM$RPCControl$start(void);
# 96 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
uint16_t SNMSM$rstdelayCount;
bool SNMSM$toBeRestart;
static inline result_t SNMSM$StdControl$init(void);
#line 122
static inline result_t SNMSM$StdControl$start(void);
#line 169
static inline result_t SNMSM$ledsOn(uint8_t ledColorParam);
#line 280
static inline void SNMSM$restart(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t EventReportM$EventReport$eventSendDone(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x41169e18,
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
TOS_MsgPtr arg_0x40a2b4e0, result_t arg_0x40a2b670);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t EventReportM$EventSend$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
#line 106
static void *EventReportM$EventSend$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0);
# 86 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
bool EventReportM$gfSendBusy;
bool EventReportM$taskBusy;
uint8_t EventReportM$gLevelMode[6];
uint8_t EventReportM$seqno;
Queue_t EventReportM$sendQueue;
Queue_t EventReportM$buffQueue;
TOS_Msg EventReportM$eventBuffer[3];
static inline void EventReportM$initialize(void);
static void EventReportM$tryNextSend(void);
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level);
static inline void EventReportM$sendEvent(void);
static inline void EventReportM$initialize(void);
#line 145
static inline result_t EventReportM$StdControl$init(void);
static inline result_t EventReportM$StdControl$start(void);
static inline result_t EventReportM$EventConfig$setReportLevel(uint8_t type, uint8_t level);
#line 175
static inline uint8_t EventReportM$EventConfig$getReportLevel(uint8_t type);
#line 187
static inline uint8_t EventReportM$EventReport$eventSend(uint8_t eventType, uint8_t type,
uint8_t level,
uint8_t *content);
#line 244
static inline result_t EventReportM$EventReport$default$eventSendDone(uint8_t eventType, TOS_MsgPtr pMsg, result_t success);
#line 263
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr pMsg, result_t success);
#line 298
static void EventReportM$tryNextSend(void);
#line 312
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level);
static inline void EventReportM$sendEvent(void);
# 42 "build/telosb/RpcM.nc"
static void RpcM$SNMSM_restart(void);
#line 39
static ramSymbol_t RpcM$RamSymbolsM_peek(unsigned int arg_0x41196bb8, uint8_t arg_0x41196d40, bool arg_0x41196ed0);
# 2 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setSink(bool arg_0x41197068);
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent(void);
#line 3
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setParent(uint16_t arg_0x41197510);
static uint16_t RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval(void);
#line 5
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x41197cc0);
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
static result_t RpcM$SmartSensingM_SensingConfig$setDataPriority(uint8_t arg_0x40a044a8, uint8_t arg_0x40a04638);
static uint8_t RpcM$SmartSensingM_SensingConfig$getDataPriority(uint8_t arg_0x40a04ad0);
#line 31
static result_t RpcM$SmartSensingM_SensingConfig$setADCChannel(uint8_t arg_0x40a06948, uint8_t arg_0x40a06ad0);
#line 27
static result_t RpcM$SmartSensingM_SensingConfig$setSamplingRate(uint8_t arg_0x40a07e08, uint16_t arg_0x40a06010);
static uint8_t RpcM$SmartSensingM_SensingConfig$getADCChannel(uint8_t arg_0x40a04010);
#line 29
static uint16_t RpcM$SmartSensingM_SensingConfig$getSamplingRate(uint8_t arg_0x40a064b0);
#line 43
static result_t RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(uint8_t arg_0x40a037b0, uint16_t arg_0x40a03940);
#line 39
static result_t RpcM$SmartSensingM_SensingConfig$setNodePriority(uint8_t arg_0x40a03010);
static uint16_t RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(uint8_t arg_0x40a03de8);
#line 41
static uint8_t RpcM$SmartSensingM_SensingConfig$getNodePriority(void);
# 40 "build/telosb/RpcM.nc"
static unsigned int RpcM$RamSymbolsM_poke(ramSymbol_t *arg_0x4119e3e8);
#line 34
static uint8_t RpcM$GenericCommProM_getRFChannel(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t RpcM$ResponseSend$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
#line 106
static void *RpcM$ResponseSend$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0);
# 36 "build/telosb/RpcM.nc"
static result_t RpcM$GenericCommProM_setRFChannel(uint8_t arg_0x411aaa90);
static result_t RpcM$SNMSM_ledsOn(uint8_t arg_0x4119e888);
#line 35
static uint8_t RpcM$GenericCommProM_getRFPower(void);
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
static uint8_t RpcM$EventReportM_EventConfig$getReportLevel(uint8_t arg_0x41143ec0);
#line 38
static result_t RpcM$EventReportM_EventConfig$setReportLevel(uint8_t arg_0x41143778, uint8_t arg_0x41143900);
# 37 "build/telosb/RpcM.nc"
static result_t RpcM$GenericCommProM_setRFPower(uint8_t arg_0x4119f010);
#line 49
TOS_Msg RpcM$cmdStore;
TOS_Msg RpcM$sendMsgBuf;
TOS_MsgPtr RpcM$sendMsgPtr;
uint16_t RpcM$cmdStoreLength;
bool RpcM$processingCommand;
bool RpcM$taskBusy;
uint8_t RpcM$seqno;
uint16_t RpcM$debugSequenceNo;
static const uint8_t RpcM$args_sizes[25] = {
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
0,
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
0,
0,
sizeof(uint16_t ),
sizeof(uint16_t ),
sizeof(bool ),
sizeof(unsigned int ) + sizeof(uint8_t ) + sizeof(bool ),
sizeof(ramSymbol_t ),
sizeof(uint8_t ),
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint16_t ),
sizeof(uint8_t ) + sizeof(uint16_t ) };
static const uint8_t RpcM$return_sizes[25] = {
sizeof(uint8_t ),
sizeof(result_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(uint16_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(ramSymbol_t ),
sizeof(unsigned int ),
sizeof(result_t ),
sizeof(void ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint16_t ),
sizeof(uint16_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ) };
static inline result_t RpcM$StdControl$init(void);
#line 135
static inline result_t RpcM$StdControl$start(void);
static void RpcM$tryNextSend(void);
static inline void RpcM$sendResponse(void);
static inline void RpcM$processCommand(void);
#line 601
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr pMsg, void *payload, uint16_t payloadLength);
#line 697
static void RpcM$tryNextSend(void);
static inline void RpcM$sendResponse(void);
#line 749
static inline result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr pMsg, result_t success);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopLQI$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t MultiHopLQI$Random$rand(void);
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopLQI$MultihopCtrl$readyToSend(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t MultiHopLQI$EventReport$eventSend(uint8_t arg_0x40a2ca80,
uint8_t arg_0x40a2cc18,
uint8_t *arg_0x40a2cdd0);
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
static bool MultiHopLQI$NeighborCtrl$addChild(uint16_t arg_0x412209c8, uint16_t arg_0x41220b60, bool arg_0x41220cf0);
static bool MultiHopLQI$NeighborCtrl$setCost(uint16_t arg_0x4121d7d8, uint16_t arg_0x4121d968);
#line 5
static bool MultiHopLQI$NeighborCtrl$setParent(uint16_t arg_0x41220098);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopLQI$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
# 92 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
enum MultiHopLQI$__nesc_unnamed4324 {
MultiHopLQI$TOS_BASE_ADDRESS = 0,
MultiHopLQI$BASE_STATION_ADDRESS = 10,
MultiHopLQI$BEACON_PERIOD = 10,
MultiHopLQI$BEACON_TIMEOUT = 6
};
enum MultiHopLQI$__nesc_unnamed4325 {
MultiHopLQI$ROUTE_INVALID = 0xff
};
TOS_Msg MultiHopLQI$msgBuf;
bool MultiHopLQI$msgBufBusy;
bool MultiHopLQI$fixedParent = FALSE;
bool MultiHopLQI$receivedBeacon = FALSE;
uint16_t MultiHopLQI$gbCurrentParent;
uint16_t MultiHopLQI$gbCurrentParentCost;
uint16_t MultiHopLQI$gbCurrentLinkEst;
uint8_t MultiHopLQI$gbCurrentHopCount;
uint16_t MultiHopLQI$gbCurrentCost;
uint8_t MultiHopLQI$gLastHeard;
int16_t MultiHopLQI$gCurrentSeqNo;
uint16_t MultiHopLQI$gUpdateInterval;
uint8_t MultiHopLQI$gRecentIndex;
uint16_t MultiHopLQI$gRecentPacketSender[10];
int16_t MultiHopLQI$gRecentPacketSeqNo[10];
uint8_t MultiHopLQI$gRecentOriginIndex;
uint16_t MultiHopLQI$gRecentOriginPacketSender[10];
int16_t MultiHopLQI$gRecentOriginPacketSeqNo[10];
uint8_t MultiHopLQI$gRecentOriginPacketTTL[10];
bool MultiHopLQI$localBeSink;
uint16_t MultiHopLQI$gbLinkQuality;
static uint16_t MultiHopLQI$adjustLQI(uint8_t val);
static void MultiHopLQI$SendRouteTask(void);
#line 187
static inline void MultiHopLQI$TimerTask(void);
#line 219
static inline result_t MultiHopLQI$StdControl$init(void);
#line 264
static inline result_t MultiHopLQI$StdControl$start(void);
#line 280
static inline result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr Msg, uint8_t id,
uint8_t resend);
#line 339
static inline result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr Msg, uint8_t id);
#line 352
static inline uint16_t MultiHopLQI$RouteControl$getParent(void);
static inline uint16_t MultiHopLQI$RouteControl$getQuality(void);
#line 374
static inline result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t Interval);
static inline result_t MultiHopLQI$RouteControl$setParent(uint16_t parentAddr);
static inline result_t MultiHopLQI$RouteControl$releaseParent(void);
#line 418
static inline bool MultiHopLQI$RouteControl$isSink(void);
static inline result_t MultiHopLQI$Timer$fired(void);
static inline TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr Msg);
#line 523
static inline result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t MultiHopLQI$MultihopCtrl$switchParent(void);
#line 558
static inline result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect);
static inline result_t MultiHopLQI$RouteRpcCtrl$setSink(bool enable);
#line 602
static inline result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t parentAddr);
static inline result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void);
static inline result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t seconds);
static inline uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void);
# 39 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
ramSymbol_t RamSymbolsM$symbol;
static inline unsigned int RamSymbolsM$poke(ramSymbol_t *p_symbol);
#line 53
static inline ramSymbol_t RamSymbolsM$peek(unsigned int memAddress, uint8_t length, bool dereference);
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLPowerManagementM.nc"
static inline uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t ClockTimeStampingM$LocalTime$read(void);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t ClockTimeStampingM$HPLCC2420RAM$write(uint16_t arg_0x40e23d00, uint8_t arg_0x40e23e88, uint8_t *arg_0x40e22068);
# 26 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
uint32_t ClockTimeStampingM$rcv_time;
TOS_MsgPtr ClockTimeStampingM$rcv_message;
enum ClockTimeStampingM$__nesc_unnamed4326 {
ClockTimeStampingM$TX_FIFO_MSG_START = 10,
ClockTimeStampingM$SEND_TIME_CORRECTION = 0
};
#line 58
static inline void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff);
#line 123
static inline void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff);
#line 138
static inline result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr ourMessage,
uint32_t *timeStamp);
#line 165
static inline result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t addr,
uint8_t length,
uint8_t *buffer);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t DataMgmtM$BatchTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
#line 59
static result_t DataMgmtM$SysCheckTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t DataMgmtM$SysCheckTimer$stop(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t DataMgmtM$Send$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
#line 106
static void *DataMgmtM$Send$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t DataMgmtM$SubControl$init(void);
static result_t DataMgmtM$SubControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t DataMgmtM$Leds$greenToggle(void);
#line 131
static result_t DataMgmtM$Leds$yellowToggle(void);
# 68 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
uint16_t DataMgmtM$seqno;
bool DataMgmtM$sendTaskBusy;
bool DataMgmtM$presendTaskBusy;
bool DataMgmtM$processTaskBusy;
uint8_t DataMgmtM$sysCheckCount;
uint8_t DataMgmtM$sendDoneFailCheckCount;
uint16_t DataMgmtM$sendQueueLen;
uint16_t DataMgmtM$sendDoneR_num;
uint16_t DataMgmtM$send_num;
uint16_t DataMgmtM$Msg_length;
uint16_t DataMgmtM$sendCalled;
uint16_t DataMgmtM$presendTaskCount;
uint16_t DataMgmtM$trynextSendCount;
uint16_t DataMgmtM$processTaskCount;
uint16_t DataMgmtM$batchTimerCount;
uint16_t DataMgmtM$allocbuffercount;
uint16_t DataMgmtM$f_allocbuffercount;
uint16_t DataMgmtM$freebuffercount;
uint16_t DataMgmtM$nothingtosend;
TOS_MsgPtr DataMgmtM$headSendQueue;
TOS_Msg DataMgmtM$buffMsg[MAX_SENSING_QUEUE_SIZE];
Queue_t DataMgmtM$buffQueue;
Queue_t DataMgmtM$sendQueue;
MemQueue_t DataMgmtM$sensorMem;
uint16_t DataMgmtM$processloopCount;
uint16_t DataMgmtM$GlobaltaskCode;
static result_t DataMgmtM$tryNextSend(void);
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr );
static void DataMgmtM$presendTask(void);
static void DataMgmtM$processTask(void);
static inline void DataMgmtM$sendTask(void);
static inline void DataMgmtM$initialize(void);
#line 158
static inline result_t DataMgmtM$StdControl$init(void);
#line 170
static inline result_t DataMgmtM$StdControl$start(void);
#line 191
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t client);
#line 228
static result_t DataMgmtM$DataMgmt$freeBlk(void *obj);
#line 263
static inline result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t type);
#line 306
static inline result_t DataMgmtM$DataMgmt$saveBlk(void *obj, uint8_t mediumType);
#line 330
static inline result_t DataMgmtM$BatchTimer$fired(void);
#line 353
static inline result_t DataMgmtM$SysCheckTimer$fired(void);
#line 399
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr pMsg, result_t success);
#line 426
static inline void DataMgmtM$sendTask(void);
#line 473
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr msg);
#line 489
static result_t DataMgmtM$tryNextSend(void);
#line 509
static void DataMgmtM$presendTask(void);
#line 602
static void DataMgmtM$processTask(void);
# 65 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static msp430ADCresult_t ADCM$MSP430ADC12Single$getData(void);
#line 50
static result_t ADCM$MSP430ADC12Single$bind(MSP430ADC12Settings_t arg_0x4133e958);
#line 117
static result_t ADCM$MSP430ADC12Single$unreserve(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t ADCM$Leds$greenToggle(void);
#line 131
static result_t ADCM$Leds$yellowToggle(void);
#line 81
static result_t ADCM$Leds$redToggle(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t ADCM$ADC$dataReady(
# 47 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
uint8_t arg_0x41345b10,
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
uint16_t arg_0x40a7c788);
# 61 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
enum ADCM$__nesc_unnamed4327 {
ADCM$TOSH_ADC_PORTMAPSIZE = 12
};
uint8_t ADCM$TOSH_adc_portmap[ADCM$TOSH_ADC_PORTMAPSIZE];
uint16_t ADCM$adc_count[ADCM$TOSH_ADC_PORTMAPSIZE];
uint8_t ADCM$samplingRate;
bool ADCM$continuousData;
uint8_t ADCM$owner;
uint8_t ADCM$g_port;
bool ADCM$initialized;
volatile bool ADCM$busy;
volatile bool ADCM$readdone;
static inline result_t ADCM$StdControl$init(void);
static inline result_t ADCM$StdControl$start(void);
#line 100
static result_t ADCM$ADCControl$init(void);
#line 127
static result_t ADCM$ADCControl$bindPort(uint8_t port, uint8_t adcPort);
static result_t ADCM$triggerConversion(uint8_t port);
#line 160
static void ADCM$readADCTask(void);
static void ADCM$readLightTask(void);
static inline result_t ADCM$ADC$getData(uint8_t port);
#line 246
static result_t ADCM$MSP430ADC12Single$dataReady(uint16_t d);
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
static result_t HamamatsuM$TSRSingle$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8);
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static msp430ADCresult_t HamamatsuM$MSP430ADC12MultipleTSR$getData(uint16_t *arg_0x413b57e8, uint16_t arg_0x413b5978, uint16_t arg_0x413b5b08);
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
static uint16_t *HamamatsuM$TSRMultiple$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0);
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static msp430ADCresult_t HamamatsuM$MSP430ADC12MultiplePAR$getData(uint16_t *arg_0x413b57e8, uint16_t arg_0x413b5978, uint16_t arg_0x413b5b08);
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
static uint16_t *HamamatsuM$PARMultiple$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0);
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
static result_t HamamatsuM$PARSingle$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8);
# 46 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
bool HamamatsuM$contMode;
#line 105
static inline result_t HamamatsuM$MSP430ADC12SinglePAR$dataReady(uint16_t data);
static inline result_t HamamatsuM$PARSingle$default$dataReady(adcresult_t result, uint16_t data);
#line 159
static uint16_t *HamamatsuM$MSP430ADC12MultiplePAR$dataReady(uint16_t *buf, uint16_t length);
#line 172
static inline uint16_t *HamamatsuM$PARMultiple$default$dataReady(adcresult_t result, uint16_t *buf, uint16_t length);
#line 212
static inline result_t HamamatsuM$MSP430ADC12SingleTSR$dataReady(uint16_t data);
static inline result_t HamamatsuM$TSRSingle$default$dataReady(adcresult_t result, uint16_t data);
#line 266
static uint16_t *HamamatsuM$MSP430ADC12MultipleTSR$dataReady(uint16_t *buf, uint16_t length);
#line 279
static inline uint16_t *HamamatsuM$TSRMultiple$default$dataReady(adcresult_t result, uint16_t *buf, uint16_t length);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430ADC12M$CompareA1$setEvent(uint16_t arg_0x408d6eb0);
# 118 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
static RefVolt_t MSP430ADC12M$RefVolt$getState(void);
#line 109
static result_t MSP430ADC12M$RefVolt$release(void);
#line 93
static result_t MSP430ADC12M$RefVolt$get(RefVolt_t arg_0x413e2cf8);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void MSP430ADC12M$ControlA0$setControl(MSP430CompareControl_t arg_0x408c29a8);
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
static result_t MSP430ADC12M$ADCSingle$dataReady(
# 41 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bcd90,
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
uint16_t arg_0x4133cdc8);
# 37 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
static void MSP430ADC12M$TimerA$clear(void);
static void MSP430ADC12M$TimerA$setClockSource(uint16_t arg_0x408b88a8);
#line 38
static void MSP430ADC12M$TimerA$disableEvents(void);
#line 35
static void MSP430ADC12M$TimerA$setMode(int arg_0x408b9aa0);
static void MSP430ADC12M$TimerA$setInputDivider(uint16_t arg_0x408b8d60);
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
static uint16_t *MSP430ADC12M$ADCMultiple$dataReady(
# 42 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t arg_0x413bb8d8,
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
uint16_t *arg_0x413b0010, uint16_t arg_0x413b01a0);
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
static void MSP430ADC12M$ControlA1$setControl(MSP430CompareControl_t arg_0x408c29a8);
# 58 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void MSP430ADC12M$HPLADC12$resetIFGs(void);
#line 43
static void MSP430ADC12M$HPLADC12$setControl1(adc12ctl1_t arg_0x413fc4e8);
#line 80
static void MSP430ADC12M$HPLADC12$disableConversion(void);
#line 48
static void MSP430ADC12M$HPLADC12$setControl0_IgnoreRef(adc12ctl0_t arg_0x413fa010);
static adc12memctl_t MSP430ADC12M$HPLADC12$getMemControl(uint8_t arg_0x413fab10);
#line 81
static void MSP430ADC12M$HPLADC12$startConversion(void);
#line 52
static uint16_t MSP430ADC12M$HPLADC12$getMem(uint8_t arg_0x413f9010);
static void MSP430ADC12M$HPLADC12$setIEFlags(uint16_t arg_0x413f94c0);
#line 69
static void MSP430ADC12M$HPLADC12$setSHT(uint8_t arg_0x413f6688);
#line 50
static void MSP430ADC12M$HPLADC12$setMemControl(uint8_t arg_0x413fa4b8, adc12memctl_t arg_0x413fa650);
#line 82
static void MSP430ADC12M$HPLADC12$stopConversion(void);
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
static void MSP430ADC12M$CompareA0$setEvent(uint16_t arg_0x408d6eb0);
# 58 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
uint8_t MSP430ADC12M$cmode;
uint16_t *MSP430ADC12M$bufPtr;
uint16_t MSP430ADC12M$bufLength;
uint16_t MSP430ADC12M$bufOffset;
uint8_t MSP430ADC12M$owner;
uint8_t MSP430ADC12M$reserved;
uint8_t MSP430ADC12M$vrefWait;
adc12settings_t MSP430ADC12M$adc12settings[5U];
static inline result_t MSP430ADC12M$StdControl$init(void);
static inline result_t MSP430ADC12M$StdControl$start(void);
#line 89
static inline void MSP430ADC12M$configureAdcPin(uint8_t inputChannel);
static inline result_t MSP430ADC12M$ADCSingle$bind(uint8_t num, MSP430ADC12Settings_t settings);
#line 130
static inline msp430ADCresult_t MSP430ADC12M$getRefVolt(uint8_t num);
#line 158
static inline result_t MSP430ADC12M$releaseRefVolt(uint8_t num);
static void MSP430ADC12M$prepareTimerA(uint16_t interval, uint16_t csSAMPCON, uint16_t cdSAMPCON);
#line 184
static void MSP430ADC12M$startTimerA(void);
#line 203
static msp430ADCresult_t MSP430ADC12M$newRequest(uint8_t req, uint8_t num, void *dataDest, uint16_t length, uint16_t jiffies);
#line 331
static inline result_t MSP430ADC12M$unreserve(uint8_t num);
static inline msp430ADCresult_t MSP430ADC12M$ADCSingle$getData(uint8_t num);
#line 365
static inline result_t MSP430ADC12M$ADCSingle$unreserve(uint8_t num);
static inline msp430ADCresult_t MSP430ADC12M$ADCMultiple$getData(uint8_t num, uint16_t *buf,
uint16_t length, uint16_t jiffies);
#line 405
static inline void MSP430ADC12M$TimerA$overflow(void);
static inline void MSP430ADC12M$CompareA0$fired(void);
static inline void MSP430ADC12M$CompareA1$fired(void);
static inline result_t MSP430ADC12M$ADCSingle$default$dataReady(uint8_t num, uint16_t data);
static inline uint16_t *MSP430ADC12M$ADCMultiple$default$dataReady(uint8_t num, uint16_t *buf,
uint16_t length);
static void MSP430ADC12M$RefVolt$isStable(RefVolt_t vref);
static void MSP430ADC12M$stopConversion(void);
static inline void MSP430ADC12M$HPLADC12$converted(uint8_t number);
#line 496
static inline void MSP430ADC12M$HPLADC12$memOverflow(void);
static inline void MSP430ADC12M$HPLADC12$timeOverflow(void);
# 61 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void HPLADC12M$HPLADC12$memOverflow(void);
static void HPLADC12M$HPLADC12$converted(uint8_t arg_0x413f8a00);
#line 62
static void HPLADC12M$HPLADC12$timeOverflow(void);
# 44 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static volatile uint16_t HPLADC12M$ADC12CTL0 __asm ("0x01A0");
static volatile uint16_t HPLADC12M$ADC12CTL1 __asm ("0x01A2");
static volatile uint16_t HPLADC12M$ADC12IFG __asm ("0x01A4");
static volatile uint16_t HPLADC12M$ADC12IE __asm ("0x01A6");
static volatile uint16_t HPLADC12M$ADC12IV __asm ("0x01A8");
static inline void HPLADC12M$HPLADC12$setControl1(adc12ctl1_t control1);
static inline void HPLADC12M$HPLADC12$setControl0_IgnoreRef(adc12ctl0_t control0);
#line 73
static void HPLADC12M$HPLADC12$setMemControl(uint8_t i, adc12memctl_t memControl);
static inline adc12memctl_t HPLADC12M$HPLADC12$getMemControl(uint8_t i);
static inline uint16_t HPLADC12M$HPLADC12$getMem(uint8_t i);
static inline void HPLADC12M$HPLADC12$setIEFlags(uint16_t mask);
static void HPLADC12M$HPLADC12$resetIFGs(void);
#line 112
static inline bool HPLADC12M$HPLADC12$isBusy(void);
static inline void HPLADC12M$HPLADC12$disableConversion(void);
static inline void HPLADC12M$HPLADC12$startConversion(void);
static inline void HPLADC12M$HPLADC12$stopConversion(void);
#line 137
static inline void HPLADC12M$HPLADC12$setRefOn(void);
static inline void HPLADC12M$HPLADC12$setRefOff(void);
static inline void HPLADC12M$HPLADC12$setRef1_5V(void);
static inline void HPLADC12M$HPLADC12$setRef2_5V(void);
static inline void HPLADC12M$HPLADC12$setSHT(uint8_t sht);
#line 163
void sig_ADC_VECTOR(void) __attribute((wakeup)) __attribute((interrupt(14))) ;
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t RefVoltM$SwitchOffTimer$setOneShot(int32_t arg_0x40c2c340);
# 127 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
static void RefVoltM$RefVolt$isStable(RefVolt_t arg_0x413e8578);
# 73 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
static void RefVoltM$HPLADC12$setRefOff(void);
#line 65
static bool RefVoltM$HPLADC12$isBusy(void);
static void RefVoltM$HPLADC12$setRef2_5V(void);
static void RefVoltM$HPLADC12$disableConversion(void);
#line 72
static void RefVoltM$HPLADC12$setRefOn(void);
static void RefVoltM$HPLADC12$setRef1_5V(void);
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
static result_t RefVoltM$SwitchOnTimer$setOneShot(int32_t arg_0x40c2c340);
# 84 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
enum RefVoltM$__nesc_unnamed4328 {
RefVoltM$REFERENCE_OFF,
RefVoltM$REFERENCE_1_5V_PENDING,
RefVoltM$REFERENCE_2_5V_PENDING,
RefVoltM$REFERENCE_1_5V_STABLE,
RefVoltM$REFERENCE_2_5V_STABLE
};
uint8_t RefVoltM$semaCount;
uint8_t RefVoltM$state;
bool RefVoltM$switchOff;
static __inline void RefVoltM$switchRefOn(uint8_t vref);
static __inline void RefVoltM$switchRefOff(void);
static __inline void RefVoltM$switchToRefStable(uint8_t vref);
static __inline void RefVoltM$switchToRefPending(uint8_t vref);
static inline void RefVoltM$switchOnDelay(void);
static inline void RefVoltM$switchOffDelay(void);
static inline void RefVoltM$switchOffRetry(void);
static result_t RefVoltM$RefVolt$get(RefVolt_t vref);
#line 140
static __inline void RefVoltM$switchRefOn(uint8_t vref);
#line 154
static __inline void RefVoltM$switchToRefPending(uint8_t vref);
static __inline void RefVoltM$switchToRefStable(uint8_t vref);
static inline void RefVoltM$switchOnDelay(void);
static inline result_t RefVoltM$SwitchOnTimer$fired(void);
#line 180
static inline result_t RefVoltM$RefVolt$release(void);
#line 205
static __inline void RefVoltM$switchRefOff(void);
#line 225
static inline void RefVoltM$switchOffDelay(void);
static inline void RefVoltM$switchOffRetry(void);
static inline result_t RefVoltM$SwitchOffTimer$fired(void);
static inline RefVolt_t RefVoltM$RefVolt$getState(void);
static inline void RefVoltM$HPLADC12$memOverflow(void);
static inline void RefVoltM$HPLADC12$timeOverflow(void);
static inline void RefVoltM$HPLADC12$converted(uint8_t number);
# 71 "/home/xu/oasis/lib/MultiHopOasis/RouteSelect.nc"
static result_t MultiHopEngineM$RouteSelect$selectRoute(TOS_MsgPtr arg_0x411f8238, uint8_t arg_0x411f83c0, uint8_t arg_0x411f8548);
#line 86
static result_t MultiHopEngineM$RouteSelect$initializeFields(TOS_MsgPtr arg_0x411f8b58, uint8_t arg_0x411f8ce0);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Intercept$intercept(
# 19 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e1e20,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
# 116 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
static bool MultiHopEngineM$RouteSelectCntl$isSink(void);
#line 84
static uint16_t MultiHopEngineM$RouteSelectCntl$getQuality(void);
#line 49
static uint16_t MultiHopEngineM$RouteSelectCntl$getParent(void);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Snoop$intercept(
# 20 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e0420,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t MultiHopEngineM$Send$sendDone(
# 17 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
uint8_t arg_0x414e10f8,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopEngineM$MultihopCtrl$addChild(uint16_t arg_0x41231718, uint16_t arg_0x412318b0, bool arg_0x41231a40);
#line 2
static result_t MultiHopEngineM$MultihopCtrl$switchParent(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopEngineM$SubControl$init(void);
static result_t MultiHopEngineM$SubControl$start(void);
# 72 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t MultiHopEngineM$Leds$redOff(void);
#line 64
static result_t MultiHopEngineM$Leds$redOn(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopEngineM$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopEngineM$RouteStatusTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 54 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
#line 47
typedef struct MultiHopEngineM$SendQueueEntryInfo {
uint8_t valid;
uint8_t AMID;
uint8_t resend;
uint16_t length;
TOS_MsgPtr msgPtr;
TOS_MsgPtr originalTOSPtr;
} MultiHopEngineM$SendQueueEntryInfo;
enum MultiHopEngineM$__nesc_unnamed4329 {
MultiHopEngineM$NETWORKMSG_HEADER_LENGTH = 10,
MultiHopEngineM$SUCCESSIVE_TRANSMITE_FAILURE_THRESHOLD = 15,
MultiHopEngineM$ROUTE_STATUS_CHECK_PERIOD = 6 * 1024,
MultiHopEngineM$WDT_UPDATE_PERIOD = 10,
MultiHopEngineM$WDT_UPDATE_UNIT = 1024 * 60
};
bool MultiHopEngineM$sendTaskBusy;
Queue_t MultiHopEngineM$sendQueue;
Queue_t MultiHopEngineM$buffQueue;
TOS_Msg MultiHopEngineM$poolBuffer[5];
MultiHopEngineM$SendQueueEntryInfo MultiHopEngineM$queueEntryInfo[5];
bool MultiHopEngineM$messageIsRetransmission;
uint16_t MultiHopEngineM$numberOfSendFailures;
uint16_t MultiHopEngineM$numberOfSendSuccesses;
bool MultiHopEngineM$useMhopPriority;
uint8_t MultiHopEngineM$numOfPktProcessing;
uint16_t MultiHopEngineM$numOfSuccessiveFailures;
bool MultiHopEngineM$beRadioActive;
uint8_t MultiHopEngineM$wdtTimerCnt;
bool MultiHopEngineM$beParentActive;
uint16_t MultiHopEngineM$localSendFail;
uint16_t MultiHopEngineM$numLocalPendingPkt;
uint16_t MultiHopEngineM$falseType;
static inline void MultiHopEngineM$initialize(void);
#line 107
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void);
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind);
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg);
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr);
static result_t MultiHopEngineM$tryNextSend(void);
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable);
static inline result_t MultiHopEngineM$StdControl$init(void);
static inline result_t MultiHopEngineM$StdControl$start(void);
#line 147
static result_t MultiHopEngineM$Send$send(uint8_t AMID, TOS_MsgPtr msg, uint16_t length);
#line 174
static void *MultiHopEngineM$Send$getBuffer(uint8_t AMID, TOS_MsgPtr msg, uint16_t *length);
#line 186
static inline void MultiHopEngineM$sendTask(void);
#line 254
static inline result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr msg, result_t success);
#line 327
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr);
#line 392
static result_t MultiHopEngineM$tryNextSend(void);
#line 409
static inline TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr msg);
#line 478
static inline result_t MultiHopEngineM$RouteStatusTimer$fired(void);
#line 498
static inline result_t MultiHopEngineM$MultihopCtrl$readyToSend(void);
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable);
#line 531
static inline uint16_t MultiHopEngineM$RouteControl$getParent(void);
static inline uint16_t MultiHopEngineM$RouteControl$getQuality(void);
#line 582
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void);
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg);
#line 606
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind);
#line 621
static inline result_t MultiHopEngineM$Send$default$sendDone(uint8_t AMID, TOS_MsgPtr pMsg,
result_t success);
static inline result_t MultiHopEngineM$Intercept$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen);
static inline result_t MultiHopEngineM$Snoop$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesRouterM$SubSend$send(
# 40 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x41550e50,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$DTTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
#line 59
static result_t CascadesRouterM$RTTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t CascadesRouterM$RTTimer$stop(void);
#line 59
static result_t CascadesRouterM$DelayTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t CascadesRouterM$DelayTimer$stop(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t CascadesRouterM$Random$rand(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesRouterM$SubControl$init(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr CascadesRouterM$Receive$receive(
# 36 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x415502d0,
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
TOS_MsgPtr arg_0x40a0f130, void *arg_0x40a0f2d0, uint16_t arg_0x40a0f468);
# 2 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static uint16_t CascadesRouterM$CascadeControl$getParent(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ResetTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
static result_t CascadesRouterM$ResetTimer$stop(void);
#line 59
static result_t CascadesRouterM$ACKTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 57 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint16_t CascadesRouterM$RTwait;
uint16_t CascadesRouterM$highestSeq;
uint16_t CascadesRouterM$expectingSeq;
uint8_t CascadesRouterM$headIndex;
uint8_t CascadesRouterM$resetCount;
uint16_t CascadesRouterM$nextSignalSeq;
bool CascadesRouterM$inData[MAX_CAS_PACKETS];
bool CascadesRouterM$activeRT;
bool CascadesRouterM$DataTimerOn;
bool CascadesRouterM$DataProcessBusy;
bool CascadesRouterM$RequestProcessBusy;
bool CascadesRouterM$CMAuProcessBusy;
bool CascadesRouterM$sigRcvTaskBusy;
bool CascadesRouterM$delayTimerBusy;
bool CascadesRouterM$ctrlMsgBusy;
bool CascadesRouterM$inited;
TOS_Msg CascadesRouterM$RecvDataMsg;
TOS_Msg CascadesRouterM$RecvRequestMsg;
TOS_Msg CascadesRouterM$RecvCMAuMsg;
TOS_Msg CascadesRouterM$SendCtrlMsg;
CascadesBuffer CascadesRouterM$myBuffer[MAX_CAS_BUF];
static inline void CascadesRouterM$processData(void);
static inline void CascadesRouterM$processRequest(void);
static inline void CascadesRouterM$processCMAu(void);
static void CascadesRouterM$sigRcvTask(void);
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq);
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex);
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr);
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type);
static void CascadesRouterM$initialize(void);
static inline NetworkMsg *CascadesRouterM$getCasData(TOS_MsgPtr tmPtr);
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq);
#line 148
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex);
#line 167
static void CascadesRouterM$delFromChildrenList(address_t nodeID);
#line 188
static void CascadesRouterM$addToChildrenList(address_t nodeID);
#line 228
static void CascadesRouterM$clearChildrenListStatus(uint8_t myindex);
#line 241
static inline void CascadesRouterM$updateInData(void);
#line 254
static bool CascadesRouterM$getCMAu(uint8_t myindex);
#line 278
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr);
#line 305
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr);
#line 323
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type);
#line 347
static void CascadesRouterM$initialize(void);
#line 374
static inline result_t CascadesRouterM$StdControl$init(void);
static inline result_t CascadesRouterM$StdControl$start(void);
static inline result_t CascadesRouterM$CascadeControl$addDirectChild(address_t childID);
static inline result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t childID);
#line 407
static inline result_t CascadesRouterM$CascadeControl$parentChanged(address_t newParent);
#line 437
static inline result_t CascadesRouterM$DTTimer$fired(void);
#line 501
static inline result_t CascadesRouterM$RTTimer$fired(void);
#line 536
static inline result_t CascadesRouterM$ResetTimer$fired(void);
#line 556
static inline result_t CascadesRouterM$DelayTimer$fired(void);
static inline result_t CascadesRouterM$ACKTimer$fired(void);
static void CascadesRouterM$sigRcvTask(void);
#line 614
static inline uint32_t CascadesRouterM$crcByte(uint32_t crc, uint8_t b);
#line 627
static inline uint32_t CascadesRouterM$calculateCRC(uint8_t *start, uint8_t length);
#line 640
static inline void CascadesRouterM$processData(void);
#line 818
static inline void CascadesRouterM$processCMAu(void);
#line 859
static inline void CascadesRouterM$processRequest(void);
#line 900
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr);
#line 932
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr);
#line 960
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(uint8_t type, TOS_MsgPtr tmsg);
#line 1009
static inline result_t CascadesRouterM$SubSend$sendDone(uint8_t type, TOS_MsgPtr msg, result_t status);
static inline TOS_MsgPtr CascadesRouterM$Receive$default$receive(uint8_t type, TOS_MsgPtr pMsg,
void *payload, uint16_t payloadLen);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t CascadesEngineM$SendMsg$send(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x415fc7b8,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesEngineM$MySend$sendDone(
# 36 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x415fc030,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30);
# 45 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
bool CascadesEngineM$sendTaskBusy;
Queue_t CascadesEngineM$sendQueue;
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, uint8_t len);
static result_t CascadesEngineM$tryNextSend(void);
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg);
static inline void CascadesEngineM$sendTask(void);
static inline result_t CascadesEngineM$StdControl$init(void);
#line 68
static result_t CascadesEngineM$MySend$send(uint8_t type, TOS_MsgPtr msg, uint16_t len);
#line 82
static result_t CascadesEngineM$SendMsg$sendDone(uint8_t type, TOS_MsgPtr msg, result_t success);
#line 94
static inline result_t CascadesEngineM$SendMsg$default$send(uint8_t type, uint16_t dest, uint8_t length, TOS_MsgPtr pMsg);
static inline void CascadesEngineM$sendTask(void);
#line 122
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg);
static result_t CascadesEngineM$tryNextSend(void);
#line 146
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t type, uint8_t len);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t NeighborMgmtM$Random$rand(void);
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static result_t NeighborMgmtM$CascadeControl$addDirectChild(address_t arg_0x41544d38);
static result_t NeighborMgmtM$CascadeControl$deleteDirectChild(address_t arg_0x415431f0);
static result_t NeighborMgmtM$CascadeControl$parentChanged(address_t arg_0x41543698);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t NeighborMgmtM$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0);
# 25 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
NBRTableEntry NeighborMgmtM$NeighborTbl[16];
bool NeighborMgmtM$initTime;
bool NeighborMgmtM$processTaskBusy;
uint8_t NeighborMgmtM$lqiBuf;
uint8_t NeighborMgmtM$rssiBuf;
uint16_t NeighborMgmtM$linkaddrBuf;
NetworkMsg *NeighborMgmtM$nwMsg;
uint8_t NeighborMgmtM$ticks;
static void NeighborMgmtM$initialize(void);
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id);
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void);
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id);
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id);
static inline void NeighborMgmtM$timerTask(void);
static inline void NeighborMgmtM$updateTable(void);
static inline void NeighborMgmtM$processSnoopMsg(void);
static inline result_t NeighborMgmtM$StdControl$init(void);
static inline result_t NeighborMgmtM$StdControl$start(void);
static void NeighborMgmtM$initialize(void);
static inline result_t NeighborMgmtM$Timer$fired(void);
static inline void NeighborMgmtM$processSnoopMsg(void);
#line 107
static inline result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr msg, void *payload, uint16_t payloadLen);
#line 123
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id);
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id);
#line 154
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id);
#line 170
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void);
#line 188
static inline void NeighborMgmtM$timerTask(void);
static inline void NeighborMgmtM$updateTable(void);
#line 325
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t parent);
#line 341
static inline bool NeighborMgmtM$NeighborCtrl$clearParent(bool reset);
#line 357
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect);
#line 439
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t addr, uint16_t parentCost);
#line 465
static uint16_t NeighborMgmtM$CascadeControl$getParent(void);
# 127 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static inline void MSP430ClockM$startTimerB(void)
{
MSP430ClockM$TBCTL = 0x0020 | (MSP430ClockM$TBCTL & ~(0x0020 | 0x0010));
}
#line 115
static inline void MSP430ClockM$startTimerA(void)
{
MSP430ClockM$TA0CTL = 0x0020 | (MSP430ClockM$TA0CTL & ~(0x0020 | 0x0010));
}
#line 220
static inline result_t MSP430ClockM$StdControl$start(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
MSP430ClockM$startTimerA();
MSP430ClockM$startTimerB();
}
#line 226
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t HPLInitM$MSP430ClockControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = MSP430ClockM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 84 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static inline void MSP430ClockM$MSP430ClockInit$defaultInitTimerB(void)
{
TBR = 0;
MSP430ClockM$TBCTL = 0x0100 | 0x0002;
}
static inline void MSP430ClockM$MSP430ClockInit$default$initTimerB(void)
{
MSP430ClockM$MSP430ClockInit$defaultInitTimerB();
}
# 29 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockInit.nc"
inline static void MSP430ClockM$MSP430ClockInit$initTimerB(void){
#line 29
MSP430ClockM$MSP430ClockInit$default$initTimerB();
#line 29
}
#line 29
# 69 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static inline void MSP430ClockM$MSP430ClockInit$defaultInitTimerA(void)
{
TA0R = 0;
MSP430ClockM$TA0CTL = 0x0200 | 0x0002;
}
#line 104
static inline void MSP430ClockM$MSP430ClockInit$default$initTimerA(void)
{
MSP430ClockM$MSP430ClockInit$defaultInitTimerA();
}
# 28 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockInit.nc"
inline static void MSP430ClockM$MSP430ClockInit$initTimerA(void){
#line 28
MSP430ClockM$MSP430ClockInit$default$initTimerA();
#line 28
}
#line 28
# 48 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static inline void MSP430ClockM$MSP430ClockInit$defaultInitClocks(void)
{
BCSCTL1 = 0x80 | (BCSCTL1 & ((0x04 | 0x02) | 0x01));
BCSCTL2 = 0x04;
MSP430ClockM$IE1 &= ~(1 << 1);
}
#line 99
static inline void MSP430ClockM$MSP430ClockInit$default$initClocks(void)
{
MSP430ClockM$MSP430ClockInit$defaultInitClocks();
}
# 27 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockInit.nc"
inline static void MSP430ClockM$MSP430ClockInit$initClocks(void){
#line 27
MSP430ClockM$MSP430ClockInit$default$initClocks();
#line 27
}
#line 27
# 145 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static inline uint16_t MSP430ClockM$test_calib_busywait_delta(int calib)
{
int8_t aclk_count = 2;
uint16_t dco_prev = 0;
uint16_t dco_curr = 0;
MSP430ClockM$set_dco_calib(calib);
while (aclk_count-- > 0)
{
TBCCR0 = TBR + MSP430ClockM$ACLK_CALIB_PERIOD;
TBCCTL0 &= ~0x0001;
while ((TBCCTL0 & 0x0001) == 0) ;
dco_prev = dco_curr;
dco_curr = TA0R;
}
return dco_curr - dco_prev;
}
static inline void MSP430ClockM$busyCalibrateDCO(void)
{
int calib;
int step;
MSP430ClockM$TA0CTL = 0x0200 | 0x0020;
MSP430ClockM$TBCTL = 0x0100 | 0x0020;
BCSCTL1 = 0x80 | 0x04;
BCSCTL2 = 0;
TBCCTL0 = 0x4000;
for (calib = 0, step = 0x800; step != 0; step >>= 1)
{
if (MSP430ClockM$test_calib_busywait_delta(calib | step) <= MSP430ClockM$TARGET_DCO_DELTA) {
calib |= step;
}
}
if ((calib & 0x0e0) == 0x0e0) {
calib &= ~0x01f;
}
MSP430ClockM$set_dco_calib(calib);
}
static inline result_t MSP430ClockM$StdControl$init(void)
{
MSP430ClockM$TA0CTL = 0x0004;
MSP430ClockM$TA0IV = 0;
MSP430ClockM$TBCTL = 0x0004;
MSP430ClockM$TBIV = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
MSP430ClockM$busyCalibrateDCO();
MSP430ClockM$MSP430ClockInit$initClocks();
MSP430ClockM$MSP430ClockInit$initTimerA();
MSP430ClockM$MSP430ClockInit$initTimerB();
}
#line 215
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t HPLInitM$MSP430ClockControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = MSP430ClockM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 72 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_FLASH_HOLD_PIN(void)
#line 72
{
#line 72
static volatile uint8_t r __asm ("0x001D");
#line 72
r &= ~(1 << 7);
}
#line 36
static inline void TOSH_MAKE_UCLK0_INPUT(void)
#line 36
{
#line 36
static volatile uint8_t r __asm ("0x001A");
#line 36
r &= ~(1 << 3);
}
#line 35
static inline void TOSH_MAKE_SIMO0_INPUT(void)
#line 35
{
#line 35
static volatile uint8_t r __asm ("0x001A");
#line 35
r &= ~(1 << 1);
}
#line 35
static inline void TOSH_SET_SIMO0_PIN(void)
#line 35
{
#line 35
static volatile uint8_t r __asm ("0x0019");
#line 35
r |= 1 << 1;
}
#line 71
static inline void TOSH_SET_FLASH_CS_PIN(void)
#line 71
{
#line 71
static volatile uint8_t r __asm ("0x001D");
#line 71
r |= 1 << 4;
}
#line 36
static inline void TOSH_CLR_UCLK0_PIN(void)
#line 36
{
#line 36
static volatile uint8_t r __asm ("0x0019");
#line 36
r &= ~(1 << 3);
}
#line 71
static inline void TOSH_CLR_FLASH_CS_PIN(void)
#line 71
{
#line 71
static volatile uint8_t r __asm ("0x001D");
#line 71
r &= ~(1 << 4);
}
# 161 "/opt/tinyos-1.x/tos/platform/msp430/msp430hardware.h"
static __inline void TOSH_wait(void )
{
__asm volatile ("nop"); __asm volatile ("nop");}
# 72 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_FLASH_HOLD_PIN(void)
#line 72
{
#line 72
static volatile uint8_t r __asm ("0x001D");
#line 72
r |= 1 << 7;
}
#line 71
static inline void TOSH_MAKE_FLASH_CS_OUTPUT(void)
#line 71
{
#line 71
static volatile uint8_t r __asm ("0x001E");
#line 71
r |= 1 << 4;
}
#line 72
static inline void TOSH_MAKE_FLASH_HOLD_OUTPUT(void)
#line 72
{
#line 72
static volatile uint8_t r __asm ("0x001E");
#line 72
r |= 1 << 7;
}
#line 36
static inline void TOSH_MAKE_UCLK0_OUTPUT(void)
#line 36
{
#line 36
static volatile uint8_t r __asm ("0x001A");
#line 36
r |= 1 << 3;
}
#line 35
static inline void TOSH_MAKE_SIMO0_OUTPUT(void)
#line 35
{
#line 35
static volatile uint8_t r __asm ("0x001A");
#line 35
r |= 1 << 1;
}
#line 94
static inline void TOSH_FLASH_M25P_DP(void)
#line 94
{
TOSH_MAKE_SIMO0_OUTPUT();
TOSH_MAKE_UCLK0_OUTPUT();
TOSH_MAKE_FLASH_HOLD_OUTPUT();
TOSH_MAKE_FLASH_CS_OUTPUT();
TOSH_SET_FLASH_HOLD_PIN();
TOSH_SET_FLASH_CS_PIN();
TOSH_wait();
TOSH_CLR_FLASH_CS_PIN();
TOSH_CLR_UCLK0_PIN();
TOSH_FLASH_M25P_DP_bit(TRUE);
TOSH_FLASH_M25P_DP_bit(FALSE);
TOSH_FLASH_M25P_DP_bit(TRUE);
TOSH_FLASH_M25P_DP_bit(TRUE);
TOSH_FLASH_M25P_DP_bit(TRUE);
TOSH_FLASH_M25P_DP_bit(FALSE);
TOSH_FLASH_M25P_DP_bit(FALSE);
TOSH_FLASH_M25P_DP_bit(TRUE);
TOSH_SET_FLASH_CS_PIN();
TOSH_SET_SIMO0_PIN();
TOSH_MAKE_SIMO0_INPUT();
TOSH_MAKE_UCLK0_INPUT();
TOSH_CLR_FLASH_HOLD_PIN();
}
# 174 "/opt/tinyos-1.x/tos/platform/msp430/msp430hardware.h"
static __inline void TOSH_uwait(uint16_t u)
{
uint16_t i;
#line 177
if (u < 500) {
for (i = 2; i < u; i++) {
__asm volatile ("nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t");}
}
else {
for (i = 0; i < u; i++) {
__asm volatile ("nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t");}
}
}
# 129 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_PIN_DIRECTIONS(void )
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
P1SEL = 0;
P2SEL = 0;
P3SEL = 0;
P4SEL = 0;
P5SEL = 0;
P6SEL = 0;
P1DIR = 0xe0;
P1OUT = 0x00;
P2DIR = 0x7b;
P2OUT = 0x30;
P3DIR = 0xf1;
P3OUT = 0x00;
P4DIR = 0xfd;
P4OUT = 0xdd;
P5DIR = 0xff;
P5OUT = 0xff;
P6DIR = 0xff;
P6OUT = 0x00;
P1IE = 0;
P2IE = 0;
TOSH_uwait(1024 * 10);
TOSH_FLASH_M25P_DP();
}
#line 170
__nesc_atomic_end(__nesc_atomic); }
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/HPLInitM.nc"
static inline result_t HPLInitM$init(void)
{
TOSH_SET_PIN_DIRECTIONS();
HPLInitM$MSP430ClockControl$init();
HPLInitM$MSP430ClockControl$start();
return SUCCESS;
}
# 47 "/opt/tinyos-1.x/tos/platform/msp430/MainM.nc"
inline static result_t MainM$hardwareInit(void){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLInitM$init();
#line 47
#line 47
return result;
#line 47
}
#line 47
# 35 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_SIMO0_PIN(void)
#line 35
{
#line 35
static volatile uint8_t r __asm ("0x0019");
#line 35
r &= ~(1 << 1);
}
#line 36
static inline void TOSH_SET_UCLK0_PIN(void)
#line 36
{
#line 36
static volatile uint8_t r __asm ("0x0019");
#line 36
r |= 1 << 3;
}
# 79 "/opt/tinyos-1.x/tos/system/sched.c"
static inline void TOSH_sched_init(void )
{
int i;
#line 82
TOSH_sched_free = 0;
TOSH_sched_full = 0;
for (i = 0; i < TOSH_MAX_TASKS; i++)
TOSH_queue[i].tp = NULL;
}
# 120 "/opt/tinyos-1.x/tos/system/tos.h"
static inline result_t rcombine(result_t r1, result_t r2)
{
return r1 == FAIL ? FAIL : r2;
}
# 47 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline result_t NeighborMgmtM$StdControl$init(void)
#line 47
{
NeighborMgmtM$initialize();
return SUCCESS;
}
# 54 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline result_t CascadesEngineM$StdControl$init(void)
#line 54
{
initQueue(&CascadesEngineM$sendQueue, CAS_SEND_QUEUE_SIZE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 56
CascadesEngineM$sendTaskBusy = FALSE;
#line 56
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CascadesRouterM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = CascadesEngineM$StdControl$init();
#line 63
result = rcombine(result, NeighborMgmtM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 374 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$StdControl$init(void)
#line 374
{
CascadesRouterM$initialize();
CascadesRouterM$SubControl$init();
;
return SUCCESS;
}
# 114 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$initialize(void)
#line 114
{
int l;
#line 116
EventReportM$seqno = 0;
EventReportM$gfSendBusy = FALSE;
EventReportM$taskBusy = FALSE;
for (l = 0; l < 6; l++)
EventReportM$gLevelMode[l] = EVENT_LEVEL_URGENT;
initQueue(&EventReportM$sendQueue, 3);
initBufferPool(&EventReportM$buffQueue, 3, &EventReportM$eventBuffer[0]);
}
#line 145
static inline result_t EventReportM$StdControl$init(void)
#line 145
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 146
EventReportM$initialize();
#line 146
__nesc_atomic_end(__nesc_atomic); }
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$EReportControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = EventReportM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 122 "build/telosb/RpcM.nc"
static inline result_t RpcM$StdControl$init(void)
#line 122
{
RpcM$sendMsgPtr = &RpcM$sendMsgBuf;
RpcM$processingCommand = FALSE;
RpcM$seqno = 0;
RpcM$taskBusy = FALSE;
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$RPCControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RpcM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 99 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$StdControl$init(void)
#line 99
{
SNMSM$RPCControl$init();
#line 116
SNMSM$EReportControl$init();
SNMSM$rstdelayCount = 0;
SNMSM$toBeRestart = FALSE;
return SUCCESS;
}
# 806 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$StdControl$init(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 808
{
TimeSyncM$skew = 0.0;
TimeSyncM$localAverage = 0;
TimeSyncM$offsetAverage = 0;
}
#line 812
__nesc_atomic_end(__nesc_atomic); }
#line 812
;
TimeSyncM$clearTable();
(
(TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = 0xFFFF;
TimeSyncM$rootid = 0xFFFF;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$processedMsg = &TimeSyncM$processedMsgBuffer;
TimeSyncM$state = TimeSyncM$STATE_INIT;
TimeSyncM$alreadySetTime = 0;
TimeSyncM$errTimes = 0;
TimeSyncM$hasGPSValid = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 834
TimeSyncM$missedSendStamps = TimeSyncM$missedReceiveStamps = 0;
#line 834
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 212 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$default$initDone(void)
#line 212
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$SplitControl$initDone(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$SplitControl$default$initDone();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 208 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$CC2420SplitControl$initDone(void)
#line 208
{
return CC2420RadioM$SplitControl$initDone();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420ControlM$SplitControl$initDone(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$CC2420SplitControl$initDone();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 108 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline void CC2420ControlM$taskInitDone(void)
#line 108
{
CC2420ControlM$SplitControl$initDone();
}
# 452 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTControl$disableTxIntr(void)
#line 452
{
HPLUSART0M$IE1 &= ~(1 << 7);
return SUCCESS;
}
# 173 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLCC2420M$USARTControl$disableTxIntr(void){
#line 173
unsigned char result;
#line 173
#line 173
result = HPLUSART0M$USARTControl$disableTxIntr();
#line 173
#line 173
return result;
#line 173
}
#line 173
# 447 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTControl$disableRxIntr(void)
#line 447
{
HPLUSART0M$IE1 &= ~(1 << 6);
return SUCCESS;
}
# 172 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLCC2420M$USARTControl$disableRxIntr(void){
#line 172
unsigned char result;
#line 172
#line 172
result = HPLUSART0M$USARTControl$disableRxIntr();
#line 172
#line 172
return result;
#line 172
}
#line 172
#line 135
inline static void HPLCC2420M$USARTControl$setModeSPI(void){
#line 135
HPLUSART0M$USARTControl$setModeSPI();
#line 135
}
#line 135
# 17 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_MAKE_RADIO_CSN_OUTPUT(void)
#line 17
{
#line 17
static volatile uint8_t r __asm ("0x001E");
#line 17
r |= 1 << 2;
}
#line 17
static inline void TOSH_SET_RADIO_CSN_PIN(void)
#line 17
{
#line 17
static volatile uint8_t r __asm ("0x001D");
#line 17
r |= 1 << 2;
}
# 83 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline result_t HPLCC2420M$StdControl$init(void)
#line 83
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 84
{
HPLCC2420M$f.busy = HPLCC2420M$f.enabled = HPLCC2420M$f.rxbufBusy = HPLCC2420M$f.txbufBusy = FALSE;
}
#line 86
__nesc_atomic_end(__nesc_atomic); }
TOSH_SET_RADIO_CSN_PIN();
TOSH_MAKE_RADIO_CSN_OUTPUT();
HPLCC2420M$USARTControl$setModeSPI();
HPLCC2420M$USARTControl$disableRxIntr();
HPLCC2420M$USARTControl$disableTxIntr();
return SUCCESS;
}
# 54 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static inline result_t BusArbitrationM$StdControl$init(void)
#line 54
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 55
{
BusArbitrationM$state = BusArbitrationM$BUS_OFF;
BusArbitrationM$isBusReleasedPending = FALSE;
}
#line 58
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420ControlM$HPLChipconControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = BusArbitrationM$StdControl$init();
#line 63
result = rcombine(result, HPLCC2420M$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 129 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$SplitControl$init(void)
#line 129
{
uint8_t _state = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 133
{
if (CC2420ControlM$state == CC2420ControlM$IDLE_STATE) {
CC2420ControlM$state = CC2420ControlM$INIT_STATE;
_state = TRUE;
}
}
#line 138
__nesc_atomic_end(__nesc_atomic); }
if (!_state) {
return FAIL;
}
CC2420ControlM$HPLChipconControl$init();
CC2420ControlM$gCurrentParameters[CP_MAIN] = 0xf800;
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] = ((((0 << 11) | (
2 << 8)) | (3 << 6)) | (
1 << 5)) | (2 << 0);
CC2420ControlM$gCurrentParameters[CP_MDMCTRL1] = 20 << 6;
CC2420ControlM$gCurrentParameters[CP_RSSI] = 0xE080;
CC2420ControlM$gCurrentParameters[CP_SYNCWORD] = 0xA70F;
CC2420ControlM$gCurrentParameters[CP_TXCTRL] = ((((1 << 14) | (
1 << 13)) | (3 << 6)) | (
1 << 5)) | (CC2420_RFPOWER << 0);
CC2420ControlM$gCurrentParameters[CP_RXCTRL0] = (((((1 << 12) | (
2 << 8)) | (3 << 6)) | (
2 << 4)) | (1 << 2)) | (
1 << 0);
CC2420ControlM$gCurrentParameters[CP_RXCTRL1] = (((((1 << 11) | (
1 << 9)) | (1 << 6)) | (
1 << 4)) | (1 << 2)) | (
2 << 0);
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (1 << 14) | ((
357 + 5 * (CC2420_CHANNEL - 11)) << 0);
CC2420ControlM$gCurrentParameters[CP_SECCTRL0] = (((1 << 8) | (
1 << 7)) | (1 << 6)) | (
1 << 2);
CC2420ControlM$gCurrentParameters[CP_SECCTRL1] = 0;
CC2420ControlM$gCurrentParameters[CP_BATTMON] = 0;
CC2420ControlM$gCurrentParameters[CP_IOCFG0] = (127 << 0) | (
1 << 9);
CC2420ControlM$gCurrentParameters[CP_IOCFG1] = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 185
CC2420ControlM$state = CC2420ControlM$INIT_STATE_DONE;
#line 185
__nesc_atomic_end(__nesc_atomic); }
TOS_post(CC2420ControlM$taskInitDone);
return SUCCESS;
}
# 64 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$CC2420SplitControl$init(void){
#line 64
unsigned char result;
#line 64
#line 64
result = CC2420ControlM$SplitControl$init();
#line 64
#line 64
return result;
#line 64
}
#line 64
# 59 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
static inline result_t RandomLFSR$Random$init(void)
#line 59
{
{
}
#line 60
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 61
{
RandomLFSR$shiftReg = 119 * 119 * (TOS_LOCAL_ADDRESS + 1);
RandomLFSR$initSeed = RandomLFSR$shiftReg;
RandomLFSR$mask = 137 * 29 * (TOS_LOCAL_ADDRESS + 1);
}
#line 65
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 57 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static result_t CC2420RadioM$Random$init(void){
#line 57
unsigned char result;
#line 57
#line 57
result = RandomLFSR$Random$init();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 423 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB4$disableEvents(void)
#line 423
{
#line 423
MSP430TimerM$TBCCTL4 &= ~0x0010;
}
# 39 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerJiffyAsyncM$AlarmControl$disableEvents(void){
#line 39
MSP430TimerM$ControlB4$disableEvents();
#line 39
}
#line 39
# 383 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB4$setControlAsCompare(void)
#line 383
{
#line 383
MSP430TimerM$TBCCTL4 = MSP430TimerM$compareControl();
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerJiffyAsyncM$AlarmControl$setControlAsCompare(void){
#line 35
MSP430TimerM$ControlB4$setControlAsCompare();
#line 35
}
#line 35
# 16 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$StdControl$init(void)
{
TimerJiffyAsyncM$AlarmControl$setControlAsCompare();
TimerJiffyAsyncM$AlarmControl$disableEvents();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420RadioM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerJiffyAsyncM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 191 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$init(void)
#line 191
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 193
{
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE;
CC2420RadioM$currentDSN = 0;
CC2420RadioM$bAckEnable = FALSE;
CC2420RadioM$bPacketReceiving = FALSE;
CC2420RadioM$rxbufptr = &CC2420RadioM$RxBuf;
CC2420RadioM$rxbufptr->length = 0;
}
#line 200
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$TimerControl$init();
CC2420RadioM$Random$init();
CC2420RadioM$LocalAddr = TOS_LOCAL_ADDRESS;
return CC2420RadioM$CC2420SplitControl$init();
}
#line 186
static inline result_t CC2420RadioM$StdControl$init(void)
#line 186
{
return CC2420RadioM$SplitControl$init();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$RadioControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = CC2420RadioM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 60 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$Control$init(void)
#line 60
{
{
}
#line 61
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 62
{
UARTM$state = FALSE;
}
#line 64
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t FramerM$ByteControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = UARTM$Control$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 292 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$StdControl$init(void)
#line 292
{
FramerM$HDLCInitialize();
return FramerM$ByteControl$init();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$UARTControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = FramerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static result_t GenericCommProM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 175 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline bool GenericCommProM$Control$init(void)
#line 175
{
bool ok = SUCCESS;
bool status = SUCCESS;
uint8_t ind;
;
ok = GenericCommProM$TimerControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = GenericCommProM$UARTControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = GenericCommProM$RadioControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = initQueue(&GenericCommProM$sendQueue, COMM_SEND_QUEUE_SIZE);
status = status && ok;
if (ok != SUCCESS) {
;
}
#line 218
GenericCommProM$state = FALSE;
GenericCommProM$sendTaskBusy = FALSE;
GenericCommProM$recvTaskBusy = FALSE;
GenericCommProM$swapMsgPtr = &GenericCommProM$swapBuf;
GenericCommProM$lastCount = 0;
GenericCommProM$counter = 0;
GenericCommProM$radioRecvActive = FALSE;
GenericCommProM$radioSendActive = FALSE;
GenericCommProM$wdtTimerCnt = 0;
GenericCommProM$toSend = TRUE;
for (ind = 0; ind < COMM_SEND_QUEUE_SIZE; ind++) {
GenericCommProM$bkHeader[ind].valid = FALSE;
GenericCommProM$bkHeader[ind].length = 0;
GenericCommProM$bkHeader[ind].type = 0;
GenericCommProM$bkHeader[ind].group = 0;
GenericCommProM$bkHeader[ind].msgPtr = 0;
GenericCommProM$bkHeader[ind].addr = 0;
}
if (status == SUCCESS) {
;
}
else {
;
}
return status;
}
# 219 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$StdControl$init(void)
#line 219
{
int n;
MultiHopLQI$gRecentIndex = 0;
for (n = 0; n < 10; n++) {
MultiHopLQI$gRecentPacketSender[n] = TOS_BCAST_ADDR;
MultiHopLQI$gRecentPacketSeqNo[n] = 0;
}
MultiHopLQI$gRecentOriginIndex = 0;
for (n = 0; n < 10; n++) {
MultiHopLQI$gRecentOriginPacketSender[n] = TOS_BCAST_ADDR;
MultiHopLQI$gRecentOriginPacketSeqNo[n] = 0;
MultiHopLQI$gRecentOriginPacketTTL[n] = 31;
}
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$gCurrentSeqNo = 0;
MultiHopLQI$gUpdateInterval = MultiHopLQI$BEACON_PERIOD;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 244
MultiHopLQI$msgBufBusy = FALSE;
#line 244
__nesc_atomic_end(__nesc_atomic); }
MultiHopLQI$localBeSink = FALSE;
if (TOS_LOCAL_ADDRESS == MultiHopLQI$BASE_STATION_ADDRESS) {
MultiHopLQI$gbCurrentParent = TOS_UART_ADDR;
MultiHopLQI$gbCurrentParentCost = 0;
MultiHopLQI$gbCurrentLinkEst = 0;
MultiHopLQI$gbLinkQuality = 110;
MultiHopLQI$gbCurrentHopCount = 0;
MultiHopLQI$gbCurrentCost = 0;
MultiHopLQI$localBeSink = TRUE;
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MultiHopEngineM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = MultiHopLQI$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 82 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline void MultiHopEngineM$initialize(void)
#line 82
{
uint8_t ind;
#line 84
MultiHopEngineM$sendTaskBusy = FALSE;
MultiHopEngineM$numberOfSendSuccesses = 0;
MultiHopEngineM$numberOfSendFailures = 0;
MultiHopEngineM$numOfSuccessiveFailures = 0;
MultiHopEngineM$messageIsRetransmission = FALSE;
MultiHopEngineM$useMhopPriority = 1;
MultiHopEngineM$numOfPktProcessing = 0;
MultiHopEngineM$beRadioActive = FALSE;
MultiHopEngineM$beParentActive = FALSE;
MultiHopEngineM$wdtTimerCnt = 0;
MultiHopEngineM$localSendFail = 0;
MultiHopEngineM$numLocalPendingPkt = 0;
MultiHopEngineM$falseType = 0;
for (ind = 0; ind < 5; ind++) {
MultiHopEngineM$queueEntryInfo[ind].valid = FALSE;
MultiHopEngineM$queueEntryInfo[ind].AMID = 0;
MultiHopEngineM$queueEntryInfo[ind].resend = FALSE;
MultiHopEngineM$queueEntryInfo[ind].length = 0;
MultiHopEngineM$queueEntryInfo[ind].originalTOSPtr = NULL;
MultiHopEngineM$queueEntryInfo[ind].msgPtr = NULL;
}
}
static inline result_t MultiHopEngineM$StdControl$init(void)
#line 117
{
initQueue(&MultiHopEngineM$sendQueue, 5);
initBufferPool(&MultiHopEngineM$buffQueue, 5, &MultiHopEngineM$poolBuffer[0]);
MultiHopEngineM$initialize();
return MultiHopEngineM$SubControl$init();
}
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
inline static result_t SmartSensingM$ADCControl$bindPort(uint8_t arg_0x40a94cf8, uint8_t arg_0x40a94e80){
#line 89
unsigned char result;
#line 89
#line 89
result = ADCM$ADCControl$bindPort(arg_0x40a94cf8, arg_0x40a94e80);
#line 89
#line 89
return result;
#line 89
}
#line 89
# 28 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
inline static void *SmartSensingM$DataMgmt$allocBlk(uint8_t arg_0x40ad2760){
#line 28
void *result;
#line 28
#line 28
result = DataMgmtM$DataMgmt$allocBlk(arg_0x40ad2760);
#line 28
#line 28
return result;
#line 28
}
#line 28
# 118 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline void SmartSensingM$initDefault(void)
#line 118
{
SmartSensingM$initedClock = FALSE;
SmartSensingM$defaultCode = 0;
sensor_num = 0;
SmartSensingM$sensingCurBlk = NULL;
#line 164
if (NULL != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / SEISMIC_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_SEISMIC;
sensor[sensor_num].channel = TOSH_ACTUAL_ADC_CHANNEL_A0_PORT;
sensor[sensor_num].dataPriority = SEISMIC_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_ADC_CHANNEL_A0_PORT);
++sensor_num;
}
if (NULL != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / INFRASONIC_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_INFRASONIC;
sensor[sensor_num].channel = TOSH_ACTUAL_ADC_CHANNEL_A4_PORT;
sensor[sensor_num].dataPriority = INFRASONIC_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_ADC_CHANNEL_A4_PORT);
++sensor_num;
}
#line 216
SmartSensingM$updateMaxBlkNum();
SmartSensingM$timerInterval = SmartSensingM$calFireInterval();
}
# 424 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB5$disableEvents(void)
#line 424
{
#line 424
MSP430TimerM$TBCCTL5 &= ~0x0010;
}
# 39 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void RealTimeM$MSP430TimerControl$disableEvents(void){
#line 39
MSP430TimerM$ControlB5$disableEvents();
#line 39
}
#line 39
# 384 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB5$setControlAsCompare(void)
#line 384
{
#line 384
MSP430TimerM$TBCCTL5 = MSP430TimerM$compareControl();
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void RealTimeM$MSP430TimerControl$setControlAsCompare(void){
#line 35
MSP430TimerM$ControlB5$setControlAsCompare();
#line 35
}
#line 35
# 86 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline result_t RealTimeM$StdControl$init(void)
#line 86
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 87
{
RealTimeM$localTime = 0;
RealTimeM$mState = 0;
RealTimeM$queue_head = RealTimeM$queue_tail = -1;
RealTimeM$queue_size = 0;
RealTimeM$numClients = 0;
RealTimeM$uc_fire_interval = UC_FIRE_INTERVAL;
RealTimeM$uc_fire_point = RealTimeM$uc_fire_interval;
RealTimeM$taskBusy = FALSE;
RealTimeM$syncMode = DEFAULT_SYNC_MODE;
RealTimeM$is_synced = FALSE;
RealTimeM$timerBusy = FALSE;
RealTimeM$timerCount = 0;
RealTimeM$globaltime_t = 0;
}
#line 101
__nesc_atomic_end(__nesc_atomic); }
RealTimeM$MSP430TimerControl$setControlAsCompare();
RealTimeM$MSP430TimerControl$disableEvents();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RealTimeM$StdControl$init();
#line 63
result = rcombine(result, TimerM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 95 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setIEFlags(uint16_t mask)
#line 95
{
#line 95
HPLADC12M$ADC12IE = mask;
}
# 55 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$setIEFlags(uint16_t arg_0x413f94c0){
#line 55
HPLADC12M$HPLADC12$setIEFlags(arg_0x413f94c0);
#line 55
}
#line 55
# 115 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$disableConversion(void)
#line 115
{
#line 115
HPLADC12M$ADC12CTL0 &= ~0x0002;
}
# 80 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$disableConversion(void){
#line 80
HPLADC12M$HPLADC12$disableConversion();
#line 80
}
#line 80
# 67 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline result_t MSP430ADC12M$StdControl$init(void)
{
MSP430ADC12M$cmode = ADC_IDLE;
MSP430ADC12M$reserved = ADC_IDLE;
MSP430ADC12M$vrefWait = FALSE;
MSP430ADC12M$HPLADC12$disableConversion();
MSP430ADC12M$HPLADC12$setIEFlags(0x0000);
return SUCCESS;
}
# 81 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static inline result_t ADCM$StdControl$init(void)
{
ADCM$ADCControl$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t DataMgmtM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 123 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline void DataMgmtM$initialize(void)
#line 123
{
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$processTaskBusy = FALSE;
DataMgmtM$presendTaskBusy = FALSE;
DataMgmtM$sysCheckCount = 0;
DataMgmtM$seqno = 0;
DataMgmtM$sendDoneFailCheckCount = 0;
DataMgmtM$sendQueueLen = 0;
DataMgmtM$Msg_length = 0;
DataMgmtM$sendDoneR_num = 0;
DataMgmtM$send_num = 0;
DataMgmtM$processloopCount = 0;
DataMgmtM$GlobaltaskCode = 0;
DataMgmtM$headSendQueue = NULL;
DataMgmtM$presendTaskCount = 0;
DataMgmtM$processTaskCount = 0;
DataMgmtM$trynextSendCount = 0;
DataMgmtM$allocbuffercount = 0;
DataMgmtM$f_allocbuffercount = 0;
DataMgmtM$freebuffercount = 0;
DataMgmtM$nothingtosend = 0;
DataMgmtM$batchTimerCount = 0;
}
# 90 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static inline result_t initSenorMem(MemQueue_t *queue, uint16_t size)
#line 90
{
int16_t i;
#line 92
if (size > MEM_QUEUE_SIZE || size <= 0) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 96
{
queue->size = size;
queue->total = 0;
queue->head[FREEMEM] = 0;
queue->tail[FREEMEM] = size - 1;
for (i = 1; i < NUM_STATUS; i++) {
queue->head[i] = queue->tail[i] = -1;
}
for (i = 0; i < size; i++) {
queue->element[i].time = 0;
queue->element[i].interval = 0;
queue->element[i].next = i + 1;
queue->element[i].prev = i - 1;
queue->element[i].size = 0;
queue->element[i].priority = 0;
queue->element[i].status = FREEMEM;
}
queue->element[i].next = -1;
}
#line 115
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 158 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$StdControl$init(void)
#line 158
{
initBufferPool(&DataMgmtM$buffQueue, MAX_SENSING_QUEUE_SIZE, DataMgmtM$buffMsg);
initQueue(&DataMgmtM$sendQueue, MAX_SENSING_QUEUE_SIZE);
initSenorMem(&DataMgmtM$sensorMem, MEM_QUEUE_SIZE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 162
DataMgmtM$initialize();
#line 162
__nesc_atomic_end(__nesc_atomic); }
DataMgmtM$SubControl$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = DataMgmtM$StdControl$init();
#line 63
result = rcombine(result, ADCM$StdControl$init());
#line 63
result = rcombine(result, MSP430ADC12M$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 50 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
inline static result_t SmartSensingM$ADCControl$init(void){
#line 50
unsigned char result;
#line 50
#line 50
result = ADCM$ADCControl$init();
#line 50
#line 50
return result;
#line 50
}
#line 50
# 312 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$StdControl$init(void)
#line 312
{
SmartSensingM$ADCControl$init();
SmartSensingM$SubControl$init();
SmartSensingM$TimerControl$init();
SmartSensingM$initDefault();
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MainM$StdControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
result = rcombine(result, SmartSensingM$StdControl$init());
#line 63
result = rcombine(result, MultiHopEngineM$StdControl$init());
#line 63
result = rcombine(result, GenericCommProM$Control$init());
#line 63
result = rcombine(result, TimeSyncM$StdControl$init());
#line 63
result = rcombine(result, SNMSM$StdControl$init());
#line 63
result = rcombine(result, CascadesRouterM$StdControl$init());
#line 63
result = rcombine(result, NeighborMgmtM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 382 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB3$setControlAsCompare(void)
#line 382
{
#line 382
MSP430TimerM$TBCCTL3 = MSP430TimerM$compareControl();
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerM$AlarmControl$setControlAsCompare(void){
#line 35
MSP430TimerM$ControlB3$setControlAsCompare();
#line 35
}
#line 35
# 422 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB3$disableEvents(void)
#line 422
{
#line 422
MSP430TimerM$TBCCTL3 &= ~0x0010;
}
# 39 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerM$AlarmControl$disableEvents(void){
#line 39
MSP430TimerM$ControlB3$disableEvents();
#line 39
}
#line 39
# 263 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t type)
#line 263
{
result_t result = FAIL;
SenBlkPtr p = headMemElement(&DataMgmtM$sensorMem, MEMPENDING);
int16_t nextInd = -1;
#line 267
while (p != NULL) {
if (p->type == type) {
result = DataMgmtM$DataMgmt$freeBlk((void *)p);
break;
}
else {
nextInd = p->next;
p = getMemElementByIndex(&DataMgmtM$sensorMem, nextInd);
}
}
if (result != TRUE) {
p = headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING);
while (p != NULL) {
if (p->type == type) {
result = DataMgmtM$DataMgmt$freeBlk((void *)p);
break;
}
else {
nextInd = p->next;
p = getMemElementByIndex(&DataMgmtM$sensorMem, nextInd);
}
}
}
return result;
}
# 194 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static inline result_t freeSensorMem(MemQueue_t *queue, SenBlkPtr obj)
#line 194
{
int16_t ind;
#line 196
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total <= 0) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 206
ind = queue->head[obj->status];
#line 206
__nesc_atomic_end(__nesc_atomic); }
while (ind != -1) {
if (queue->element[ind].status != FREEMEM && &queue->element[ind] == obj) {
_private_changeMemStatusByIndex(queue, ind, queue->element[ind].status, FREEMEM);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 210
{
queue->element[ind].time = 0;
queue->element[ind].interval = 0;
queue->element[ind].size = 0;
queue->element[ind].priority = 0;
queue->total = queue->total - 1;
}
#line 216
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 220
ind = queue->element[ind].next;
#line 220
__nesc_atomic_end(__nesc_atomic); }
}
}
return FAIL;
}
#line 161
static inline SenBlkPtr allocSensorMem(MemQueue_t *bufQueue)
#line 161
{
int16_t head;
#line 163
if (bufQueue->size <= 0) {
;
return NULL;
}
if (bufQueue->total >= bufQueue->size) {
;
return NULL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 171
head = bufQueue->head[FREEMEM];
#line 171
__nesc_atomic_end(__nesc_atomic); }
if (-1 != head) {
if (FAIL == _private_changeMemStatusByIndex(bufQueue, head, FREEMEM, FILLING)) {
;
return NULL;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 178
bufQueue->total++;
#line 178
__nesc_atomic_end(__nesc_atomic); }
return &bufQueue->element[head];
}
}
else
#line 181
{
;
return NULL;
}
}
# 87 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$yellowToggle(void)
#line 87
{
return SUCCESS;
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t DataMgmtM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = NoLeds$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 814 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static __inline uint16_t SmartSensingM$GCD(uint16_t a, uint16_t b)
#line 814
{
while (1) {
a = a % b;
if (a == 0) {
return b;
}
b = b % a;
if (b == 0) {
return a;
}
}
}
# 114 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline bool HPLUSART0M$USARTControl$isI2C(void)
#line 114
{
bool _ret = FALSE;
return _ret;
}
#line 72
static inline bool HPLUSART0M$USARTControl$isSPI(void)
#line 72
{
bool _ret = FALSE;
#line 74
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 74
{
if (HPLUSART0M$ME1 & (1 << 6)) {
_ret = TRUE;
}
}
#line 78
__nesc_atomic_end(__nesc_atomic); }
#line 78
return _ret;
}
# 38 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline bool TOSH_IS_URXD0_IOFUNC(void)
#line 38
{
#line 38
static volatile uint8_t r __asm ("0x001B");
#line 38
return r | ~(1 << 5);
}
#line 37
static inline bool TOSH_IS_UTXD0_MODFUNC(void)
#line 37
{
#line 37
static volatile uint8_t r __asm ("0x001B");
#line 37
return r & (1 << 4);
}
# 92 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline bool HPLUSART0M$USARTControl$isUARTtx(void)
#line 92
{
bool _ret = FALSE;
#line 94
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 94
{
if (
#line 95
HPLUSART0M$ME1 & (1 << 7) &&
TOSH_IS_UTXD0_MODFUNC() &&
TOSH_IS_URXD0_IOFUNC()) {
_ret = TRUE;
}
}
#line 100
__nesc_atomic_end(__nesc_atomic); }
#line 100
return _ret;
}
# 37 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline bool TOSH_IS_UTXD0_IOFUNC(void)
#line 37
{
#line 37
static volatile uint8_t r __asm ("0x001B");
#line 37
return r | ~(1 << 4);
}
#line 38
static inline bool TOSH_IS_URXD0_MODFUNC(void)
#line 38
{
#line 38
static volatile uint8_t r __asm ("0x001B");
#line 38
return r & (1 << 5);
}
# 103 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline bool HPLUSART0M$USARTControl$isUARTrx(void)
#line 103
{
bool _ret = FALSE;
#line 105
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 105
{
if (
#line 106
HPLUSART0M$ME1 & (1 << 6) &&
TOSH_IS_URXD0_MODFUNC() &&
TOSH_IS_UTXD0_IOFUNC()) {
_ret = TRUE;
}
}
#line 111
__nesc_atomic_end(__nesc_atomic); }
#line 111
return _ret;
}
#line 81
static inline bool HPLUSART0M$USARTControl$isUART(void)
#line 81
{
bool _ret = FALSE;
#line 83
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 83
{
if (
#line 84
HPLUSART0M$ME1 & (1 << 7) && HPLUSART0M$ME1 & (1 << 6) &&
TOSH_IS_URXD0_MODFUNC() &&
TOSH_IS_UTXD0_MODFUNC()) {
_ret = TRUE;
}
}
#line 89
__nesc_atomic_end(__nesc_atomic); }
#line 89
return _ret;
}
#line 125
static inline msp430_usartmode_t HPLUSART0M$USARTControl$getMode(void)
#line 125
{
if (HPLUSART0M$USARTControl$isUART()) {
return USART_UART;
}
else {
#line 128
if (HPLUSART0M$USARTControl$isUARTrx()) {
return USART_UART_RX;
}
else {
#line 130
if (HPLUSART0M$USARTControl$isUARTtx()) {
return USART_UART_TX;
}
else {
#line 132
if (HPLUSART0M$USARTControl$isSPI()) {
return USART_SPI;
}
else {
#line 134
if (HPLUSART0M$USARTControl$isI2C()) {
return USART_I2C;
}
else {
#line 137
return USART_NONE;
}
}
}
}
}
}
# 38 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_URXD0_IOFUNC(void)
#line 38
{
#line 38
static volatile uint8_t r __asm ("0x001B");
#line 38
r &= ~(1 << 5);
}
#line 37
static inline void TOSH_SEL_UTXD0_IOFUNC(void)
#line 37
{
#line 37
static volatile uint8_t r __asm ("0x001B");
#line 37
r &= ~(1 << 4);
}
# 172 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline void HPLUSART0M$USARTControl$disableUART(void)
#line 172
{
HPLUSART0M$ME1 &= ~((1 << 7) | (1 << 6));
TOSH_SEL_UTXD0_IOFUNC();
TOSH_SEL_URXD0_IOFUNC();
}
#line 218
static inline void HPLUSART0M$USARTControl$disableI2C(void)
#line 218
{
}
# 35 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_SIMO0_MODFUNC(void)
#line 35
{
#line 35
static volatile uint8_t r __asm ("0x001B");
#line 35
r |= 1 << 1;
}
#line 34
static inline void TOSH_SEL_SOMI0_MODFUNC(void)
#line 34
{
#line 34
static volatile uint8_t r __asm ("0x001B");
#line 34
r |= 1 << 2;
}
#line 36
static inline void TOSH_SEL_UCLK0_MODFUNC(void)
#line 36
{
#line 36
static volatile uint8_t r __asm ("0x001B");
#line 36
r |= 1 << 3;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t NeighborMgmtM$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(11U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t NeighborMgmtM$Random$rand(void){
#line 63
unsigned int result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 52 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline result_t NeighborMgmtM$StdControl$start(void)
#line 52
{
uint16_t randomTime = NeighborMgmtM$Random$rand();
return NeighborMgmtM$Timer$start(TIMER_ONE_SHOT, (randomTime & 0xfff) + 1024);
}
# 381 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$StdControl$start(void)
#line 381
{
return SUCCESS;
}
# 151 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$StdControl$start(void)
#line 151
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$EReportControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = EventReportM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 135 "build/telosb/RpcM.nc"
static inline result_t RpcM$StdControl$start(void)
#line 135
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$RPCControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RpcM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 122 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$StdControl$start(void)
#line 122
{
SNMSM$RPCControl$start();
#line 141
SNMSM$EReportControl$start();
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t TimeSyncM$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(0U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 839 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$StdControl$start(void)
#line 839
{
TimeSyncM$mode = TS_TIMER_MODE;
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->nodeID = TOS_LOCAL_ADDRESS;
TimeSyncM$Timer$start(TIMER_REPEAT, (uint32_t )1000 * TimeSyncM$BEACON_RATE);
return SUCCESS;
}
# 54 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420ControlM$HPLChipcon$write(uint8_t arg_0x40da59c0, uint16_t arg_0x40da5b50){
#line 54
unsigned char result;
#line 54
#line 54
result = HPLCC2420M$HPLCC2420$write(arg_0x40da59c0, arg_0x40da5b50);
#line 54
#line 54
return result;
#line 54
}
#line 54
# 412 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$enableAutoAck(void)
#line 412
{
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] |= 1 << 4;
return CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
}
# 192 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$enableAutoAck(void){
#line 192
unsigned char result;
#line 192
#line 192
result = CC2420ControlM$CC2420Control$enableAutoAck();
#line 192
#line 192
return result;
#line 192
}
#line 192
# 422 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$enableAddrDecode(void)
#line 422
{
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] |= 1 << 11;
return CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
}
# 206 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$enableAddrDecode(void){
#line 206
unsigned char result;
#line 206
#line 206
result = CC2420ControlM$CC2420Control$enableAddrDecode();
#line 206
#line 206
return result;
#line 206
}
#line 206
# 727 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$MacControl$enableAck(void)
#line 727
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 728
CC2420RadioM$bAckEnable = TRUE;
#line 728
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$CC2420Control$enableAddrDecode();
CC2420RadioM$CC2420Control$enableAutoAck();
}
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
inline static void GenericCommProM$MacControl$enableAck(void){
#line 74
CC2420RadioM$MacControl$enableAck();
#line 74
}
#line 74
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLPowerManagementM.nc"
static inline uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)
#line 53
{
return SUCCESS;
}
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
inline static uint8_t GenericCommProM$PowerManagement$adjustPower(void){
#line 41
unsigned char result;
#line 41
#line 41
result = HPLPowerManagementM$PowerManagement$adjustPower();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t GenericCommProM$ActivityTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(1U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420ControlM$HPLChipcon$cmd(uint8_t arg_0x40da54b0){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420$cmd(arg_0x40da54b0);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 119 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port14$enable(void)
#line 119
{
#line 119
MSP430InterruptM$P1IE |= 1 << 4;
}
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$CCAInterrupt$enable(void){
#line 30
MSP430InterruptM$Port14$enable();
#line 30
}
#line 30
# 246 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port14$edge(bool l2h)
#line 246
{
/* atomic removed: atomic calls only */
#line 247
{
if (l2h) {
#line 248
P1IES &= ~(1 << 4);
}
else {
#line 249
P1IES |= 1 << 4;
}
}
}
# 54 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$CCAInterrupt$edge(bool arg_0x40f36350){
#line 54
MSP430InterruptM$Port14$edge(arg_0x40f36350);
#line 54
}
#line 54
# 181 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port14$clear(void)
#line 181
{
#line 181
MSP430InterruptM$P1IFG &= ~(1 << 4);
}
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$CCAInterrupt$clear(void){
#line 40
MSP430InterruptM$Port14$clear();
#line 40
}
#line 40
# 150 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port14$disable(void)
#line 150
{
#line 150
MSP430InterruptM$P1IE &= ~(1 << 4);
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$CCAInterrupt$disable(void){
#line 35
MSP430InterruptM$Port14$disable();
#line 35
}
#line 35
# 147 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline result_t HPLCC2420InterruptM$CCA$startWait(bool low_to_high)
#line 147
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 148
{
HPLCC2420InterruptM$CCAInterrupt$disable();
HPLCC2420InterruptM$CCAInterrupt$clear();
HPLCC2420InterruptM$CCAInterrupt$edge(low_to_high);
HPLCC2420InterruptM$CCAInterrupt$enable();
}
#line 153
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420ControlM$CCA$startWait(bool arg_0x40dc68a0){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420InterruptM$CCA$startWait(arg_0x40dc68a0);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 368 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$OscillatorOn(void)
#line 368
{
uint16_t i;
uint8_t status;
i = 0;
#line 384
CC2420ControlM$HPLChipcon$write(0x1D, 24);
CC2420ControlM$CCA$startWait(TRUE);
status = CC2420ControlM$HPLChipcon$cmd(0x01);
return SUCCESS;
}
# 31 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_CC_RSTN_PIN(void)
#line 31
{
#line 31
static volatile uint8_t r __asm ("0x001D");
#line 31
r |= 1 << 6;
}
#line 31
static inline void TOSH_CLR_CC_RSTN_PIN(void)
#line 31
{
#line 31
static volatile uint8_t r __asm ("0x001D");
#line 31
r &= ~(1 << 6);
}
#line 30
static inline void TOSH_SET_CC_VREN_PIN(void)
#line 30
{
#line 30
static volatile uint8_t r __asm ("0x001D");
#line 30
r |= 1 << 5;
}
# 400 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$VREFOn(void)
#line 400
{
TOSH_SET_CC_VREN_PIN();
TOSH_uwait(600);
return SUCCESS;
}
# 96 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline result_t HPLCC2420M$StdControl$start(void)
#line 96
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 97
{
if (! HPLCC2420M$f.busy) {
TOSH_SET_RADIO_CSN_PIN();
TOSH_MAKE_RADIO_CSN_OUTPUT();
HPLCC2420M$USARTControl$setModeSPI();
HPLCC2420M$USARTControl$disableRxIntr();
HPLCC2420M$USARTControl$disableTxIntr();
HPLCC2420M$f.busy = HPLCC2420M$f.rxbufBusy = HPLCC2420M$f.txbufBusy = FALSE;
HPLCC2420M$f.enabled = TRUE;
}
}
#line 107
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 62 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static inline result_t BusArbitrationM$StdControl$start(void)
#line 62
{
uint8_t _state;
#line 64
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 64
{
if (BusArbitrationM$state == BusArbitrationM$BUS_OFF) {
BusArbitrationM$state = BusArbitrationM$BUS_IDLE;
BusArbitrationM$isBusReleasedPending = FALSE;
}
_state = BusArbitrationM$state;
}
#line 70
__nesc_atomic_end(__nesc_atomic); }
if (_state == BusArbitrationM$BUS_IDLE) {
return SUCCESS;
}
return FAIL;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420ControlM$HPLChipconControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = BusArbitrationM$StdControl$start();
#line 70
result = rcombine(result, HPLCC2420M$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 227 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$SplitControl$start(void)
#line 227
{
result_t status;
uint8_t _state = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 231
{
if (CC2420ControlM$state == CC2420ControlM$INIT_STATE_DONE) {
CC2420ControlM$state = CC2420ControlM$START_STATE;
_state = TRUE;
}
}
#line 236
__nesc_atomic_end(__nesc_atomic); }
if (!_state) {
return FAIL;
}
CC2420ControlM$HPLChipconControl$start();
CC2420ControlM$CC2420Control$VREFOn();
TOSH_CLR_CC_RSTN_PIN();
TOSH_wait();
TOSH_SET_CC_RSTN_PIN();
TOSH_wait();
status = CC2420ControlM$CC2420Control$OscillatorOn();
return status;
}
# 77 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$CC2420SplitControl$start(void){
#line 77
unsigned char result;
#line 77
#line 77
result = CC2420ControlM$SplitControl$start();
#line 77
#line 77
return result;
#line 77
}
#line 77
# 23 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$StdControl$start(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 25
{
TimerJiffyAsyncM$bSet = FALSE;
TimerJiffyAsyncM$AlarmControl$disableEvents();
}
#line 28
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420RadioM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerJiffyAsyncM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 277 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$start(void)
#line 277
{
uint8_t chkstateRadio;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 280
chkstateRadio = CC2420RadioM$stateRadio;
#line 280
__nesc_atomic_end(__nesc_atomic); }
if (chkstateRadio == CC2420RadioM$DISABLED_STATE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 283
{
CC2420RadioM$stateRadio = CC2420RadioM$WARMUP_STATE;
CC2420RadioM$countRetry = 0;
CC2420RadioM$rxbufptr->length = 0;
}
#line 287
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$TimerControl$start();
return CC2420RadioM$CC2420SplitControl$start();
}
return FAIL;
}
#line 239
static inline void CC2420RadioM$startRadio(void)
#line 239
{
result_t success = FAIL;
#line 241
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 241
{
if (CC2420RadioM$stateRadio == CC2420RadioM$DISABLED_STATE_STARTTASK) {
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE;
success = SUCCESS;
}
}
#line 246
__nesc_atomic_end(__nesc_atomic); }
if (success == SUCCESS) {
CC2420RadioM$SplitControl$start();
}
}
static inline result_t CC2420RadioM$StdControl$start(void)
#line 253
{
result_t success = FAIL;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 263
{
if (CC2420RadioM$stateRadio == CC2420RadioM$DISABLED_STATE) {
if (TOS_post(CC2420RadioM$startRadio)) {
success = SUCCESS;
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE_STARTTASK;
}
}
}
#line 271
__nesc_atomic_end(__nesc_atomic); }
return success;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$RadioControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 400 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline result_t HPLUSART1M$USARTControl$enableTxIntr(void)
#line 400
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 401
{
HPLUSART1M$IFG2 &= ~(1 << 5);
IE2 |= 1 << 5;
}
#line 404
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 175 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLUARTM$USARTControl$enableTxIntr(void){
#line 175
unsigned char result;
#line 175
#line 175
result = HPLUSART1M$USARTControl$enableTxIntr();
#line 175
#line 175
return result;
#line 175
}
#line 175
# 392 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline result_t HPLUSART1M$USARTControl$enableRxIntr(void)
#line 392
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 393
{
HPLUSART1M$IFG2 &= ~(1 << 4);
IE2 |= 1 << 4;
}
#line 396
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 174 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLUARTM$USARTControl$enableRxIntr(void){
#line 174
unsigned char result;
#line 174
#line 174
result = HPLUSART1M$USARTControl$enableRxIntr();
#line 174
#line 174
return result;
#line 174
}
#line 174
# 349 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline void HPLUSART1M$USARTControl$setClockRate(uint16_t baudrate, uint8_t mctl)
#line 349
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 350
{
HPLUSART1M$l_br = baudrate;
HPLUSART1M$l_mctl = mctl;
U1BR0 = baudrate & 0x0FF;
U1BR1 = (baudrate >> 8) & 0x0FF;
U1MCTL = mctl;
}
#line 356
__nesc_atomic_end(__nesc_atomic); }
}
# 169 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static void HPLUARTM$USARTControl$setClockRate(uint16_t arg_0x40e98918, uint8_t arg_0x40e98aa0){
#line 169
HPLUSART1M$USARTControl$setClockRate(arg_0x40e98918, arg_0x40e98aa0);
#line 169
}
#line 169
# 341 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline void HPLUSART1M$USARTControl$setClockSource(uint8_t source)
#line 341
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 342
{
HPLUSART1M$l_ssel = source | 0x80;
HPLUSART1M$U1TCTL &= ~(((0x00 | 0x10) | 0x20) | 0x30);
HPLUSART1M$U1TCTL |= HPLUSART1M$l_ssel & 0x7F;
}
#line 346
__nesc_atomic_end(__nesc_atomic); }
}
# 167 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static void HPLUARTM$USARTControl$setClockSource(uint8_t arg_0x40e98460){
#line 167
HPLUSART1M$USARTControl$setClockSource(arg_0x40e98460);
#line 167
}
#line 167
# 252 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline void HPLUSART1M$setUARTModeCommon(void)
#line 252
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 253
{
U1CTL = 0x01;
U1CTL |= 0x10;
U1RCTL &= ~0x08;
U1CTL = 0x01;
U1CTL |= 0x10;
if (HPLUSART1M$l_ssel & 0x80) {
HPLUSART1M$U1TCTL &= ~(((0x00 | 0x10) | 0x20) | 0x30);
HPLUSART1M$U1TCTL |= HPLUSART1M$l_ssel & 0x7F;
}
else {
HPLUSART1M$U1TCTL &= ~(((0x00 | 0x10) | 0x20) | 0x30);
HPLUSART1M$U1TCTL |= 0x10;
}
if (HPLUSART1M$l_mctl != 0 || HPLUSART1M$l_br != 0) {
U1BR0 = HPLUSART1M$l_br & 0x0FF;
U1BR1 = (HPLUSART1M$l_br >> 8) & 0x0FF;
U1MCTL = HPLUSART1M$l_mctl;
}
else {
U1BR0 = 0x03;
U1BR1 = 0x00;
U1MCTL = 0x4A;
}
HPLUSART1M$ME2 &= ~(1 << 4);
HPLUSART1M$ME2 |= (1 << 5) | (1 << 4);
U1CTL &= ~0x01;
HPLUSART1M$IFG2 &= ~((1 << 5) | (1 << 4));
IE2 &= ~((1 << 5) | (1 << 4));
}
#line 289
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 40 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_URXD1_MODFUNC(void)
#line 40
{
#line 40
static volatile uint8_t r __asm ("0x001B");
#line 40
r |= 1 << 7;
}
#line 39
static inline void TOSH_SEL_UTXD1_MODFUNC(void)
#line 39
{
#line 39
static volatile uint8_t r __asm ("0x001B");
#line 39
r |= 1 << 6;
}
#line 40
static inline void TOSH_SEL_URXD1_IOFUNC(void)
#line 40
{
#line 40
static volatile uint8_t r __asm ("0x001B");
#line 40
r &= ~(1 << 7);
}
#line 39
static inline void TOSH_SEL_UTXD1_IOFUNC(void)
#line 39
{
#line 39
static volatile uint8_t r __asm ("0x001B");
#line 39
r &= ~(1 << 6);
}
# 158 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline void HPLUSART1M$USARTControl$disableUART(void)
#line 158
{
HPLUSART1M$ME2 &= ~((1 << 5) | (1 << 4));
TOSH_SEL_UTXD1_IOFUNC();
TOSH_SEL_URXD1_IOFUNC();
}
# 41 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_UCLK1_IOFUNC(void)
#line 41
{
#line 41
static volatile uint8_t r __asm ("0x0033");
#line 41
r &= ~(1 << 3);
}
#line 42
static inline void TOSH_SEL_SOMI1_IOFUNC(void)
#line 42
{
#line 42
static volatile uint8_t r __asm ("0x0033");
#line 42
r &= ~(1 << 2);
}
#line 43
static inline void TOSH_SEL_SIMO1_IOFUNC(void)
#line 43
{
#line 43
static volatile uint8_t r __asm ("0x0033");
#line 43
r &= ~(1 << 1);
}
# 191 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline void HPLUSART1M$USARTControl$disableSPI(void)
#line 191
{
HPLUSART1M$ME2 &= ~(1 << 4);
TOSH_SEL_SIMO1_IOFUNC();
TOSH_SEL_SOMI1_IOFUNC();
TOSH_SEL_UCLK1_IOFUNC();
}
#line 107
static inline bool HPLUSART1M$USARTControl$isI2C(void)
#line 107
{
return FALSE;
}
#line 64
static inline bool HPLUSART1M$USARTControl$isSPI(void)
#line 64
{
bool _ret = FALSE;
#line 66
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 66
{
if (HPLUSART1M$ME2 & (1 << 4)) {
_ret = TRUE;
}
}
#line 70
__nesc_atomic_end(__nesc_atomic); }
#line 70
return _ret;
}
# 40 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline bool TOSH_IS_URXD1_IOFUNC(void)
#line 40
{
#line 40
static volatile uint8_t r __asm ("0x001B");
#line 40
return r | ~(1 << 7);
}
#line 39
static inline bool TOSH_IS_UTXD1_MODFUNC(void)
#line 39
{
#line 39
static volatile uint8_t r __asm ("0x001B");
#line 39
return r & (1 << 6);
}
# 84 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline bool HPLUSART1M$USARTControl$isUARTtx(void)
#line 84
{
bool _ret = FALSE;
#line 86
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 86
{
if (
#line 87
HPLUSART1M$ME2 & (1 << 5) &&
TOSH_IS_UTXD1_MODFUNC() &&
TOSH_IS_URXD1_IOFUNC()) {
_ret = TRUE;
}
}
#line 92
__nesc_atomic_end(__nesc_atomic); }
#line 92
return _ret;
}
# 39 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline bool TOSH_IS_UTXD1_IOFUNC(void)
#line 39
{
#line 39
static volatile uint8_t r __asm ("0x001B");
#line 39
return r | ~(1 << 6);
}
#line 40
static inline bool TOSH_IS_URXD1_MODFUNC(void)
#line 40
{
#line 40
static volatile uint8_t r __asm ("0x001B");
#line 40
return r & (1 << 7);
}
# 95 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline bool HPLUSART1M$USARTControl$isUARTrx(void)
#line 95
{
bool _ret = FALSE;
#line 97
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 97
{
if (
#line 98
HPLUSART1M$ME2 & (1 << 4) &&
TOSH_IS_URXD1_MODFUNC() &&
TOSH_IS_UTXD1_IOFUNC()) {
_ret = TRUE;
}
}
#line 103
__nesc_atomic_end(__nesc_atomic); }
#line 103
return _ret;
}
#line 73
static inline bool HPLUSART1M$USARTControl$isUART(void)
#line 73
{
bool _ret = FALSE;
#line 75
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 75
{
if (
#line 76
HPLUSART1M$ME2 & (1 << 5) && HPLUSART1M$ME2 & (1 << 4) &&
TOSH_IS_URXD1_MODFUNC() &&
TOSH_IS_UTXD1_MODFUNC()) {
_ret = TRUE;
}
}
#line 81
__nesc_atomic_end(__nesc_atomic); }
#line 81
return _ret;
}
#line 111
static inline msp430_usartmode_t HPLUSART1M$USARTControl$getMode(void)
#line 111
{
if (HPLUSART1M$USARTControl$isUART()) {
return USART_UART;
}
else {
#line 114
if (HPLUSART1M$USARTControl$isUARTrx()) {
return USART_UART_RX;
}
else {
#line 116
if (HPLUSART1M$USARTControl$isUARTtx()) {
return USART_UART_TX;
}
else {
#line 118
if (HPLUSART1M$USARTControl$isSPI()) {
return USART_SPI;
}
else {
#line 120
if (HPLUSART1M$USARTControl$isI2C()) {
return USART_I2C;
}
else {
#line 123
return USART_NONE;
}
}
}
}
}
}
#line 325
static inline void HPLUSART1M$USARTControl$setModeUART(void)
#line 325
{
if (HPLUSART1M$USARTControl$getMode() == USART_UART) {
return;
}
HPLUSART1M$USARTControl$disableSPI();
HPLUSART1M$USARTControl$disableUART();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 333
{
TOSH_SEL_UTXD1_MODFUNC();
TOSH_SEL_URXD1_MODFUNC();
}
#line 336
__nesc_atomic_end(__nesc_atomic); }
HPLUSART1M$setUARTModeCommon();
return;
}
# 153 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static void HPLUARTM$USARTControl$setModeUART(void){
#line 153
HPLUSART1M$USARTControl$setModeUART();
#line 153
}
#line 153
# 50 "/opt/tinyos-1.x/tos/platform/msp430/HPLUARTM.nc"
static inline result_t HPLUARTM$UART$init(void)
#line 50
{
HPLUARTM$USARTControl$setModeUART();
#line 64
HPLUARTM$USARTControl$setClockSource(0x20);
HPLUARTM$USARTControl$setClockRate(UBR_SMCLK_57600, UMCTL_SMCLK_57600);
#line 77
HPLUARTM$USARTControl$enableRxIntr();
HPLUARTM$USARTControl$enableTxIntr();
return SUCCESS;
}
# 62 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
inline static result_t UARTM$HPLUART$init(void){
#line 62
unsigned char result;
#line 62
#line 62
result = HPLUARTM$UART$init();
#line 62
#line 62
return result;
#line 62
}
#line 62
# 68 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$Control$start(void)
#line 68
{
return UARTM$HPLUART$init();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t FramerM$ByteControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = UARTM$Control$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 297 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$StdControl$start(void)
#line 297
{
FramerM$HDLCInitialize();
return FramerM$ByteControl$start();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$UARTControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = FramerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 84 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline result_t TimerM$StdControl$start(void)
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 250 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline bool GenericCommProM$Control$start(void)
#line 250
{
bool ok = SUCCESS;
ok = GenericCommProM$TimerControl$start() && ok;
ok = GenericCommProM$UARTControl$start() && ok;
ok = GenericCommProM$RadioControl$start() && ok;
ok = GenericCommProM$ActivityTimer$start(TIMER_REPEAT, 1000) && ok;
if (SUCCESS != GenericCommProM$PowerManagement$adjustPower()) {
;
}
GenericCommProM$MacControl$enableAck();
return ok;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t MultiHopLQI$Random$rand(void){
#line 63
unsigned int result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t MultiHopLQI$Timer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(5U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 264 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$StdControl$start(void)
#line 264
{
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$Timer$start(TIMER_ONE_SHOT,
MultiHopLQI$Random$rand() % 1024 * 3 + 3);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MultiHopEngineM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = MultiHopLQI$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t MultiHopEngineM$RouteStatusTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(4U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 124 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$StdControl$start(void)
#line 124
{
MultiHopEngineM$RouteStatusTimer$start(TIMER_REPEAT, MultiHopEngineM$ROUTE_STATUS_CHECK_PERIOD);
return MultiHopEngineM$SubControl$start();
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$SensingTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = RealTimeM$Timer$start(0U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 472 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$CompareB5$setEventFromNow(uint16_t x)
#line 472
{
#line 472
MSP430TimerM$TBCCR5 = TBR + x;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void RealTimeM$MSP430Compare$setEventFromNow(uint16_t arg_0x408d5830){
#line 32
MSP430TimerM$CompareB5$setEventFromNow(arg_0x408d5830);
#line 32
}
#line 32
# 416 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB5$enableEvents(void)
#line 416
{
#line 416
MSP430TimerM$TBCCTL5 |= 0x0010;
}
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void RealTimeM$MSP430TimerControl$enableEvents(void){
#line 38
MSP430TimerM$ControlB5$enableEvents();
#line 38
}
#line 38
# 368 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB5$clearPendingInterrupt(void)
#line 368
{
#line 368
MSP430TimerM$TBCCTL5 &= ~0x0001;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void RealTimeM$MSP430TimerControl$clearPendingInterrupt(void){
#line 32
MSP430TimerM$ControlB5$clearPendingInterrupt();
#line 32
}
#line 32
# 108 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline result_t RealTimeM$StdControl$start(void)
#line 108
{
RealTimeM$MSP430TimerControl$clearPendingInterrupt();
RealTimeM$MSP430TimerControl$enableEvents();
RealTimeM$MSP430Compare$setEventFromNow(66);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RealTimeM$StdControl$start();
#line 70
result = rcombine(result, TimerM$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 77 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline result_t MSP430ADC12M$StdControl$start(void)
{
return SUCCESS;
}
# 87 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static inline result_t ADCM$StdControl$start(void)
{
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t DataMgmtM$BatchTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(2U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t DataMgmtM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 170 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$StdControl$start(void)
#line 170
{
DataMgmtM$SubControl$start();
DataMgmtM$BatchTimer$start(TIMER_ONE_SHOT, BATCH_TIMER_INTERVAL);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = DataMgmtM$StdControl$start();
#line 70
result = rcombine(result, ADCM$StdControl$start());
#line 70
result = rcombine(result, MSP430ADC12M$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t SmartSensingM$Random$rand(void){
#line 63
unsigned int result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 332 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$StdControl$start(void)
#line 332
{
uint16_t randomtimer;
#line 334
randomtimer = (SmartSensingM$Random$rand() & 0xff) + 0xf;
SmartSensingM$SubControl$start();
SmartSensingM$TimerControl$start();
SmartSensingM$SensingTimer$start(TIMER_ONE_SHOT, randomtimer);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MainM$StdControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
result = rcombine(result, SmartSensingM$StdControl$start());
#line 70
result = rcombine(result, MultiHopEngineM$StdControl$start());
#line 70
result = rcombine(result, GenericCommProM$Control$start());
#line 70
result = rcombine(result, TimeSyncM$StdControl$start());
#line 70
result = rcombine(result, SNMSM$StdControl$start());
#line 70
result = rcombine(result, CascadesRouterM$StdControl$start());
#line 70
result = rcombine(result, NeighborMgmtM$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 113 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline void TimerM$removeTimer(uint8_t num)
{
TimerM$m_timers[num].isset = FALSE;
}
# 166 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$TimerB$read(void)
#line 166
{
#line 166
return TBR;
}
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static uint16_t TimerM$AlarmTimer$read(void){
#line 30
unsigned int result;
#line 30
#line 30
result = MSP430TimerM$TimerB$read();
#line 30
#line 30
return result;
#line 30
}
#line 30
# 169 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline bool MSP430TimerM$TimerB$isOverflowPending(void)
#line 169
{
#line 169
return TBCTL & 0x0001;
}
# 31 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static bool TimerM$AlarmTimer$isOverflowPending(void){
#line 31
unsigned char result;
#line 31
#line 31
result = MSP430TimerM$TimerB$isOverflowPending();
#line 31
#line 31
return result;
#line 31
}
#line 31
# 257 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline void TimerM$checkShortTimers(void)
{
uint8_t head = TimerM$m_head_short;
#line 260
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 260
TimerM$m_posted_checkShortTimers = FALSE;
#line 260
__nesc_atomic_end(__nesc_atomic); }
TimerM$m_head_short = TimerM$EMPTY_LIST;
TimerM$executeTimers(head);
TimerM$setNextShortEvent();
}
# 718 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$timeSyncMsgSend(void)
#line 718
{
if (TimeSyncM$mode != TS_USER_MODE) {
TimeSyncM$adjustRootID();
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != 0xFFFF && (TimeSyncM$state & TimeSyncM$STATE_SENDING) == 0) {
TimeSyncM$state |= TimeSyncM$STATE_SENDING;
TOS_post(TimeSyncM$sendMsg);
}
}
else
{
if ((TimeSyncM$state & TimeSyncM$STATE_SENDING) == 0) {
TimeSyncM$state |= TimeSyncM$STATE_SENDING;
TOS_post(TimeSyncM$sendMsg);
}
}
}
# 209 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline bool RealTimeM$RealTime$isSync(void)
#line 209
{
return RealTimeM$is_synced;
}
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
inline static bool TimeSyncM$RealTime$isSync(void){
#line 42
unsigned char result;
#line 42
#line 42
result = RealTimeM$RealTime$isSync();
#line 42
#line 42
return result;
#line 42
}
#line 42
# 219 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline uint8_t RealTimeM$RealTime$getMode(void)
#line 219
{
return RealTimeM$syncMode;
}
# 44 "/home/xu/oasis/interfaces/RealTime.nc"
inline static uint8_t TimeSyncM$RealTime$getMode(void){
#line 44
unsigned char result;
#line 44
#line 44
result = RealTimeM$RealTime$getMode();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 753 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$Timer$fired(void)
#line 753
{
if (TimeSyncM$RealTime$getMode() == GPS_SYNC) {
if (TimeSyncM$RealTime$isSync()) {
TimeSyncM$mode = TS_USER_MODE;
}
}
else {
#line 767
TimeSyncM$mode = TS_TIMER_MODE;
}
TimeSyncM$timeSyncMsgSend();
return SUCCESS;
}
# 332 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$ActivityTimer$fired(void)
#line 332
{
GenericCommProM$lastCount = GenericCommProM$counter;
GenericCommProM$counter = 0;
GenericCommProM$tryNextSend();
return SUCCESS;
}
# 353 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$SysCheckTimer$fired(void)
#line 353
{
#line 368
return SUCCESS;
}
#line 330
static inline result_t DataMgmtM$BatchTimer$fired(void)
#line 330
{
DataMgmtM$batchTimerCount++;
DataMgmtM$BatchTimer$start(TIMER_ONE_SHOT, BATCH_TIMER_INTERVAL);
if (DataMgmtM$processTaskBusy != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 335
DataMgmtM$processTaskBusy = TRUE;
#line 335
__nesc_atomic_end(__nesc_atomic); }
if (NULL != headMemElement(&DataMgmtM$sensorMem, FILLED) || NULL != headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 338
DataMgmtM$processTaskBusy = TOS_post(DataMgmtM$processTask);
#line 338
__nesc_atomic_end(__nesc_atomic); }
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 342
DataMgmtM$processTaskBusy = FALSE;
#line 342
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
# 498 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$MultihopCtrl$readyToSend(void)
#line 498
{
MultiHopEngineM$tryNextSend();
return SUCCESS;
}
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopLQI$MultihopCtrl$readyToSend(void){
#line 6
unsigned char result;
#line 6
#line 6
result = MultiHopEngineM$MultihopCtrl$readyToSend();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 5 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$setParent(uint16_t arg_0x41220098){
#line 5
unsigned char result;
#line 5
#line 5
result = NeighborMgmtM$NeighborCtrl$setParent(arg_0x41220098);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 187 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline void MultiHopLQI$TimerTask(void)
#line 187
{
uint8_t val;
#line 189
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 189
val = ++MultiHopLQI$gLastHeard;
#line 189
__nesc_atomic_end(__nesc_atomic); }
if (!MultiHopLQI$localBeSink && val > MultiHopLQI$BEACON_TIMEOUT) {
MultiHopLQI$receivedBeacon = FALSE;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$fixedParent = FALSE;
if (!MultiHopLQI$localBeSink) {
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
}
}
if (MultiHopLQI$localBeSink) {
MultiHopLQI$NeighborCtrl$setParent(TOS_UART_ADDR);
}
TOS_post(MultiHopLQI$SendRouteTask);
}
#line 421
static inline result_t MultiHopLQI$Timer$fired(void)
#line 421
{
TOS_post(MultiHopLQI$TimerTask);
MultiHopLQI$MultihopCtrl$readyToSend();
MultiHopLQI$Timer$start(TIMER_ONE_SHOT, 1024 * MultiHopLQI$gUpdateInterval + 1);
return SUCCESS;
}
#line 535
static inline result_t MultiHopLQI$MultihopCtrl$switchParent(void)
#line 535
{
#line 552
return FAIL;
}
# 2 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopEngineM$MultihopCtrl$switchParent(void){
#line 2
unsigned char result;
#line 2
#line 2
result = MultiHopLQI$MultihopCtrl$switchParent();
#line 2
#line 2
return result;
#line 2
}
#line 2
# 352 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteControl$getParent(void)
#line 352
{
return MultiHopLQI$gbCurrentParent;
}
# 49 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
inline static uint16_t MultiHopEngineM$RouteSelectCntl$getParent(void){
#line 49
unsigned int result;
#line 49
#line 49
result = MultiHopLQI$RouteControl$getParent();
#line 49
#line 49
return result;
#line 49
}
#line 49
# 531 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline uint16_t MultiHopEngineM$RouteControl$getParent(void)
#line 531
{
return MultiHopEngineM$RouteSelectCntl$getParent();
}
#line 478
static inline result_t MultiHopEngineM$RouteStatusTimer$fired(void)
#line 478
{
if (!MultiHopEngineM$beParentActive) {
;
if (MultiHopEngineM$RouteControl$getParent() != TOS_BCAST_ADDR) {
MultiHopEngineM$MultihopCtrl$switchParent();
MultiHopEngineM$numOfSuccessiveFailures = 0;
}
}
MultiHopEngineM$beParentActive = FALSE;
return SUCCESS;
}
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t CascadesRouterM$SubSend$send(uint8_t arg_0x41550e50, TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850){
#line 83
unsigned char result;
#line 83
#line 83
result = CascadesEngineM$MySend$send(arg_0x41550e50, arg_0x40a166c0, arg_0x40a16850);
#line 83
#line 83
return result;
#line 83
}
#line 83
# 564 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$ACKTimer$fired(void)
#line 564
{
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, &CascadesRouterM$SendCtrlMsg, CascadesRouterM$SendCtrlMsg.length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 566
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 566
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
#line 556
static inline result_t CascadesRouterM$DelayTimer$fired(void)
#line 556
{
if (CascadesRouterM$sigRcvTaskBusy != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 558
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
#line 558
__nesc_atomic_end(__nesc_atomic); }
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 560
CascadesRouterM$delayTimerBusy = FALSE;
#line 560
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ResetTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(8U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 536 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$ResetTimer$fired(void)
#line 536
{
++CascadesRouterM$resetCount;
if (CascadesRouterM$resetCount == 10) {
CascadesRouterM$initialize();
}
else {
CascadesRouterM$ResetTimer$start(TIMER_ONE_SHOT, 60000UL);
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t CascadesRouterM$Random$rand(void){
#line 63
unsigned int result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$DTTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(7U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 119 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline NetworkMsg *CascadesRouterM$getCasData(TOS_MsgPtr tmPtr)
#line 119
{
return (NetworkMsg *)tmPtr->data;
}
#line 305
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr)
#line 305
{
NetworkMsg *nwMsg = (NetworkMsg *)tmPtr->data;
#line 307
nwMsg->linksource = TOS_LOCAL_ADDRESS;
}
#line 437
static inline result_t CascadesRouterM$DTTimer$fired(void)
#line 437
{
TOS_MsgPtr tempPtr = NULL;
int8_t i = 0;
uint8_t stopCount = 0;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[i].countDT != 0) {
if (CascadesRouterM$getCMAu(i) == TRUE) {
CascadesRouterM$clearChildrenListStatus(i);
stopCount++;
}
else {
CascadesRouterM$myBuffer[i].countDT--;
if (CascadesRouterM$myBuffer[i].countDT == 0) {
CascadesRouterM$myBuffer[i].countDT = DEFAULT_DTCOUNT;
++ CascadesRouterM$myBuffer[i].retry;
tempPtr = & CascadesRouterM$myBuffer[i].tmsg;
CascadesRouterM$produceDataMsg(tempPtr);
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCADESMSG, tempPtr, tempPtr->length)) {
}
if (CascadesRouterM$myBuffer[i].retry >= MAX_CAS_RETRY_COUNT) {
CascadesRouterM$clearChildrenListStatus(i);
stopCount = MAX_CAS_BUF;
break;
}
else {
if (CascadesRouterM$myBuffer[i].retry > 2) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 466
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 466
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$produceCtrlMsg(&CascadesRouterM$SendCtrlMsg, CascadesRouterM$getCasData(tempPtr)->seqno, TYPE_CASCADES_CMAU);
tempPtr = &CascadesRouterM$SendCtrlMsg;
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 471
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 471
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
}
}
}
else
{
stopCount++;
}
}
if (stopCount != MAX_CAS_BUF) {
CascadesRouterM$DTTimer$start(TIMER_ONE_SHOT, MIN_INTERVAL + (CascadesRouterM$Random$rand() & 0xf));
}
else {
CascadesRouterM$DataTimerOn = FALSE;
}
return SUCCESS;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$RTTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(6U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 501 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$RTTimer$fired(void)
#line 501
{
TOS_MsgPtr tempPtr = NULL;
#line 503
if (CascadesRouterM$expectingSeq >= CascadesRouterM$highestSeq) {
CascadesRouterM$RTTimer$stop();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 505
CascadesRouterM$activeRT = FALSE;
#line 505
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
if (CascadesRouterM$expectingSeq - CascadesRouterM$highestSeq < 10) {
CascadesRouterM$RTTimer$stop();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 511
CascadesRouterM$activeRT = FALSE;
#line 511
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
}
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 516
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 516
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_REQ);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 522
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 522
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
#line 394
static inline result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t childID)
#line 394
{
CascadesRouterM$delFromChildrenList(childID);
return SUCCESS;
}
# 4 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$deleteDirectChild(address_t arg_0x415431f0){
#line 4
unsigned char result;
#line 4
#line 4
result = CascadesRouterM$CascadeControl$deleteDirectChild(arg_0x415431f0);
#line 4
#line 4
return result;
#line 4
}
#line 4
# 195 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline void NeighborMgmtM$updateTable(void)
#line 195
{
NBRTableEntry *pNbr;
uint8_t childLiveOrigin = 0;
uint8_t i = 0;
#line 199
for (i = 0; i < 16; i++) {
pNbr = &NeighborMgmtM$NeighborTbl[i];
if (pNbr->flags & NBRFLAG_VALID) {
NeighborMgmtM$ticks++;
if (NeighborMgmtM$ticks >= 10) {
NeighborMgmtM$ticks = 0;
pNbr->linkEst = pNbr->linkEstCandidate;
pNbr->linkEstCandidate = 0;
pNbr->flags |= NBRFLAG_JUST_UPDATED;
}
if (pNbr->liveliness > 0) {
pNbr->liveliness--;
}
childLiveOrigin = pNbr->childLiveliness;
if (pNbr->childLiveliness > 0) {
pNbr->childLiveliness--;
}
if (pNbr->childLiveliness == 0 && childLiveOrigin - pNbr->childLiveliness == 1) {
if (pNbr->relation & NBR_DIRECT_CHILD) {
NeighborMgmtM$CascadeControl$deleteDirectChild(pNbr->id);
}
pNbr->relation &= ~(NBR_CHILD | NBR_DIRECT_CHILD);
}
}
}
}
#line 188
static inline void NeighborMgmtM$timerTask(void)
#line 188
{
NeighborMgmtM$updateTable();
}
#line 72
static inline result_t NeighborMgmtM$Timer$fired(void)
#line 72
{
if (NeighborMgmtM$initTime) {
NeighborMgmtM$initTime = FALSE;
return NeighborMgmtM$Timer$start(TIMER_REPEAT, 1024);
}
else {
return TOS_post(NeighborMgmtM$timerTask);
}
}
# 463 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline result_t TimerM$Timer$default$fired(uint8_t num)
{
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t TimerM$Timer$fired(uint8_t arg_0x40c46118){
#line 73
unsigned char result;
#line 73
#line 73
switch (arg_0x40c46118) {
#line 73
case 0U:
#line 73
result = TimeSyncM$Timer$fired();
#line 73
break;
#line 73
case 1U:
#line 73
result = GenericCommProM$ActivityTimer$fired();
#line 73
break;
#line 73
case 2U:
#line 73
result = DataMgmtM$BatchTimer$fired();
#line 73
break;
#line 73
case 3U:
#line 73
result = DataMgmtM$SysCheckTimer$fired();
#line 73
break;
#line 73
case 4U:
#line 73
result = MultiHopEngineM$RouteStatusTimer$fired();
#line 73
break;
#line 73
case 5U:
#line 73
result = MultiHopLQI$Timer$fired();
#line 73
break;
#line 73
case 6U:
#line 73
result = CascadesRouterM$RTTimer$fired();
#line 73
break;
#line 73
case 7U:
#line 73
result = CascadesRouterM$DTTimer$fired();
#line 73
break;
#line 73
case 8U:
#line 73
result = CascadesRouterM$ResetTimer$fired();
#line 73
break;
#line 73
case 9U:
#line 73
result = CascadesRouterM$DelayTimer$fired();
#line 73
break;
#line 73
case 10U:
#line 73
result = CascadesRouterM$ACKTimer$fired();
#line 73
break;
#line 73
case 11U:
#line 73
result = NeighborMgmtM$Timer$fired();
#line 73
break;
#line 73
default:
#line 73
result = TimerM$Timer$default$fired(arg_0x40c46118);
#line 73
break;
#line 73
}
#line 73
#line 73
return result;
#line 73
}
#line 73
# 394 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline uint8_t TimerM$fromNumMilli(uint8_t num)
{
return num + TimerM$OFFSET_TIMER_MILLI;
}
static inline result_t TimerM$TimerMilli$setOneShot(uint8_t num, int32_t milli)
{
return TimerM$setTimer(TimerM$fromNumMilli(num), milli * 32, FALSE);
}
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
inline static result_t RefVoltM$SwitchOffTimer$setOneShot(int32_t arg_0x40c2c340){
#line 28
unsigned char result;
#line 28
#line 28
result = TimerM$TimerMilli$setOneShot(1U, arg_0x40c2c340);
#line 28
#line 28
return result;
#line 28
}
#line 28
# 230 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$switchOffRetry(void)
#line 230
{
if (RefVoltM$switchOff == TRUE) {
RefVoltM$SwitchOffTimer$setOneShot(5);
}
}
# 138 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setRefOff(void)
#line 138
{
#line 138
HPLADC12M$ADC12CTL0 &= ~0x0020;
}
# 73 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void RefVoltM$HPLADC12$setRefOff(void){
#line 73
HPLADC12M$HPLADC12$setRefOff();
#line 73
}
#line 73
inline static void RefVoltM$HPLADC12$disableConversion(void){
#line 80
HPLADC12M$HPLADC12$disableConversion();
#line 80
}
#line 80
# 112 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline bool HPLADC12M$HPLADC12$isBusy(void)
#line 112
{
#line 112
return HPLADC12M$ADC12CTL1 & 0x0001;
}
# 65 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static bool RefVoltM$HPLADC12$isBusy(void){
#line 65
unsigned char result;
#line 65
#line 65
result = HPLADC12M$HPLADC12$isBusy();
#line 65
#line 65
return result;
#line 65
}
#line 65
# 205 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static __inline void RefVoltM$switchRefOff(void)
#line 205
{
result_t result;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 208
{
if (RefVoltM$switchOff == FALSE) {
result = FAIL;
}
else {
#line 211
if (RefVoltM$HPLADC12$isBusy()) {
result = FAIL;
}
else {
RefVoltM$HPLADC12$disableConversion();
RefVoltM$HPLADC12$setRefOff();
RefVoltM$state = RefVoltM$REFERENCE_OFF;
result = SUCCESS;
}
}
}
#line 221
__nesc_atomic_end(__nesc_atomic); }
#line 221
if (RefVoltM$switchOff == TRUE && result == FAIL) {
TOS_post(RefVoltM$switchOffRetry);
}
}
static inline result_t RefVoltM$SwitchOffTimer$fired(void)
#line 235
{
RefVoltM$switchRefOff();
return SUCCESS;
}
# 127 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
inline static void RefVoltM$RefVolt$isStable(RefVolt_t arg_0x413e8578){
#line 127
MSP430ADC12M$RefVolt$isStable(arg_0x413e8578);
#line 127
}
#line 127
# 166 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline result_t RefVoltM$SwitchOnTimer$fired(void)
#line 166
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 167
{
if (RefVoltM$state == RefVoltM$REFERENCE_1_5V_PENDING) {
RefVoltM$state = RefVoltM$REFERENCE_1_5V_STABLE;
}
#line 170
if (RefVoltM$state == RefVoltM$REFERENCE_2_5V_PENDING) {
RefVoltM$state = RefVoltM$REFERENCE_2_5V_STABLE;
}
}
#line 173
__nesc_atomic_end(__nesc_atomic); }
#line 173
if (RefVoltM$state == RefVoltM$REFERENCE_1_5V_STABLE) {
RefVoltM$RefVolt$isStable(REFERENCE_1_5V);
}
#line 175
if (RefVoltM$state == RefVoltM$REFERENCE_2_5V_STABLE) {
RefVoltM$RefVolt$isStable(REFERENCE_2_5V);
}
#line 177
return SUCCESS;
}
# 435 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline result_t TimerM$TimerMilli$default$fired(uint8_t num)
{
return SUCCESS;
}
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
inline static result_t TimerM$TimerMilli$fired(uint8_t arg_0x40c468b0){
#line 37
unsigned char result;
#line 37
#line 37
switch (arg_0x40c468b0) {
#line 37
case 0U:
#line 37
result = RefVoltM$SwitchOnTimer$fired();
#line 37
break;
#line 37
case 1U:
#line 37
result = RefVoltM$SwitchOffTimer$fired();
#line 37
break;
#line 37
default:
#line 37
result = TimerM$TimerMilli$default$fired(arg_0x40c468b0);
#line 37
break;
#line 37
}
#line 37
#line 37
return result;
#line 37
}
#line 37
# 386 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline result_t TimerM$TimerJiffy$default$fired(uint8_t num)
{
return SUCCESS;
}
# 37 "/opt/tinyos-1.x/tos/platform/msp430/TimerJiffy.nc"
inline static result_t TimerM$TimerJiffy$fired(uint8_t arg_0x40c444e0){
#line 37
unsigned char result;
#line 37
#line 37
result = TimerM$TimerJiffy$default$fired(arg_0x40c444e0);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 118 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline void TimerM$signal_timer_fired(uint8_t num)
{
const int16_t num16 = num;
if (TimerM$COUNT_TIMER_JIFFY > 0 && num16 >= TimerM$OFFSET_TIMER_JIFFY)
{
TimerM$TimerJiffy$fired(num - TimerM$OFFSET_TIMER_JIFFY);
}
else {
#line 129
if (TimerM$COUNT_TIMER_MILLI > 0 && num16 >= TimerM$OFFSET_TIMER_MILLI)
{
TimerM$TimerMilli$fired(num - TimerM$OFFSET_TIMER_MILLI);
}
else
{
TimerM$Timer$fired(num);
}
}
}
# 116 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$startConversion(void)
#line 116
{
#line 116
HPLADC12M$ADC12CTL0 |= 0x0001 + 0x0002;
}
# 81 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$startConversion(void){
#line 81
HPLADC12M$HPLADC12$startConversion();
#line 81
}
#line 81
# 95 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CC2int(MSP430TimerM$CC_t x)
#line 95
{
#line 95
union __nesc_unnamed4330 {
#line 95
MSP430TimerM$CC_t f;
#line 95
uint16_t t;
}
#line 95
c = { .f = x };
#line 95
return c.t;
}
#line 218
static inline void MSP430TimerM$ControlA1$setControl(MSP430TimerM$CC_t x)
#line 218
{
#line 218
MSP430TimerM$TA0CCTL1 = MSP430TimerM$CC2int(x);
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void MSP430ADC12M$ControlA1$setControl(MSP430CompareControl_t arg_0x408c29a8){
#line 34
MSP430TimerM$ControlA1$setControl(arg_0x408c29a8);
#line 34
}
#line 34
# 174 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$TimerA$setMode(int mode)
#line 174
{
#line 174
MSP430TimerM$TA0CTL = (MSP430TimerM$TA0CTL & ~(0x0020 | 0x0010)) | ((mode << 4) & (0x0020 | 0x0010));
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430ADC12M$TimerA$setMode(int arg_0x408b9aa0){
#line 35
MSP430TimerM$TimerA$setMode(arg_0x408b9aa0);
#line 35
}
#line 35
# 122 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg)
#line 122
{
result_t result;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 125
{
result = insertElement(&CascadesEngineM$sendQueue, msg);
CascadesEngineM$tryNextSend();
}
#line 128
__nesc_atomic_end(__nesc_atomic); }
return result;
}
#line 94
static inline result_t CascadesEngineM$SendMsg$default$send(uint8_t type, uint16_t dest, uint8_t length, TOS_MsgPtr pMsg)
#line 94
{
return FAIL;
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t CascadesEngineM$SendMsg$send(uint8_t arg_0x415fc7b8, uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728){
#line 48
unsigned char result;
#line 48
#line 48
switch (arg_0x415fc7b8) {
#line 48
case AM_CASCTRLMSG:
#line 48
result = GenericCommProM$SendMsg$send(AM_CASCTRLMSG, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
break;
#line 48
case AM_CASCADESMSG:
#line 48
result = GenericCommProM$SendMsg$send(AM_CASCADESMSG, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
break;
#line 48
default:
#line 48
result = CascadesEngineM$SendMsg$default$send(arg_0x415fc7b8, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
break;
#line 48
}
#line 48
#line 48
return result;
#line 48
}
#line 48
# 99 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline void CascadesEngineM$sendTask(void)
#line 99
{
TOS_MsgPtr msg;
#line 101
msg = headElement(&CascadesEngineM$sendQueue, PENDING);
if (msg == NULL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 103
CascadesEngineM$sendTaskBusy = FALSE;
#line 103
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (SUCCESS == CascadesEngineM$SendMsg$send(msg->type, msg->addr, msg->length, msg)) {
if (SUCCESS != changeElementStatus(&CascadesEngineM$sendQueue, msg, PENDING, PROCESSING)) {
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 111
{
CascadesEngineM$sendTaskBusy = FALSE;
CascadesEngineM$tryNextSend();
}
#line 114
__nesc_atomic_end(__nesc_atomic); }
}
else
#line 115
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 116
CascadesEngineM$sendTaskBusy = FALSE;
#line 116
__nesc_atomic_end(__nesc_atomic); }
CascadesEngineM$SendMsg$sendDone(msg->type, msg, FAIL);
}
return;
}
# 536 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len)
#line 536
{
if (len > 74) {
;
return FAIL;
}
msg->type = id;
msg->addr = addr;
msg->group = TOS_AM_GROUP;
msg->length = len;
return SUCCESS;
}
#line 504
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg)
#line 504
{
result_t result;
#line 506
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 506
{
result = insertElement(&GenericCommProM$sendQueue, msg);
GenericCommProM$tryNextSend();
}
#line 509
__nesc_atomic_end(__nesc_atomic); }
return result;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t CC2420RadioM$Random$rand(void){
#line 63
unsigned int result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 744 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr m)
#line 744
{
return (CC2420RadioM$Random$rand() & 0xF) + 1;
}
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
inline static int16_t CC2420RadioM$MacBackoff$initialBackoff(TOS_MsgPtr arg_0x40d999b8){
#line 74
int result;
#line 74
#line 74
result = CC2420RadioM$MacBackoff$default$initialBackoff(arg_0x40d999b8);
#line 74
#line 74
return result;
#line 74
}
#line 74
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t CC2420RadioM$BackoffTimerJiffy$setOneShot(uint32_t arg_0x40db7d10){
#line 6
unsigned char result;
#line 6
#line 6
result = TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(arg_0x40db7d10);
#line 6
#line 6
return result;
#line 6
}
#line 6
# 128 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setInitialTimer(uint16_t jiffy)
#line 128
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_INITIAL;
if (jiffy == 0) {
return CC2420RadioM$BackoffTimerJiffy$setOneShot(2);
}
#line 133
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline int is_host_lsb(void)
{
const uint8_t n[2] = { 1, 0 };
#line 15
return * (uint16_t *)n == 1;
}
static __inline uint16_t toLSB16(uint16_t a)
{
return is_host_lsb() ? a : (a << 8) | (a >> 8);
}
# 491 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$Send$send(TOS_MsgPtr pMsg)
#line 491
{
uint8_t currentstate;
#line 493
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 493
currentstate = CC2420RadioM$stateRadio;
#line 493
__nesc_atomic_end(__nesc_atomic); }
if (currentstate == CC2420RadioM$IDLE_STATE) {
pMsg->fcflo = 0x08;
if (CC2420RadioM$bAckEnable) {
pMsg->fcfhi = 0x21;
}
else {
#line 501
pMsg->fcfhi = 0x01;
}
pMsg->destpan = TOS_BCAST_ADDR;
pMsg->addr = toLSB16(pMsg->addr);
pMsg->length = pMsg->length + MSG_HEADER_SIZE + MSG_FOOTER_SIZE;
pMsg->dsn = ++CC2420RadioM$currentDSN;
pMsg->time = 0;
CC2420RadioM$txlength = pMsg->length - MSG_FOOTER_SIZE;
CC2420RadioM$txbufptr = pMsg;
CC2420RadioM$countRetry = 8;
if (CC2420RadioM$setInitialTimer(CC2420RadioM$MacBackoff$initialBackoff(CC2420RadioM$txbufptr) * 10)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 518
CC2420RadioM$stateRadio = CC2420RadioM$PRE_TX_STATE;
#line 518
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
}
return FAIL;
}
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t GenericCommProM$RadioSend$send(TOS_MsgPtr arg_0x40d018a0){
#line 58
unsigned char result;
#line 58
#line 58
result = CC2420RadioM$Send$send(arg_0x40d018a0);
#line 58
#line 58
return result;
#line 58
}
#line 58
# 307 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$BareSendMsg$send(TOS_MsgPtr pMsg)
#line 307
{
result_t Result = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 310
{
if (!(FramerM$gFlags & FramerM$FLAGS_DATAPEND)) {
FramerM$gFlags |= FramerM$FLAGS_DATAPEND;
FramerM$gpTxMsg = pMsg;
}
else
{
Result = FAIL;
}
}
#line 320
__nesc_atomic_end(__nesc_atomic); }
if (Result == SUCCESS) {
Result = FramerM$StartTx();
}
return Result;
}
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t GenericCommProM$UARTSend$send(TOS_MsgPtr arg_0x40d018a0){
#line 58
unsigned char result;
#line 58
#line 58
result = FramerM$BareSendMsg$send(arg_0x40d018a0);
#line 58
#line 58
return result;
#line 58
}
#line 58
# 405 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline void GenericCommProM$sendFunc(void)
#line 405
{
result_t ok;
TOS_MsgPtr m;
#line 407
TOS_MsgPtr m2;
uint8_t ind;
m = headElement(&GenericCommProM$sendQueue, PENDING);
if (m == NULL) {
GenericCommProM$sendTaskBusy = FALSE;
return;
}
m2 = m;
if (m2->addr == TOS_UART_ADDR) {
if (GenericCommProM$state) {
GenericCommProM$sendTaskBusy = FALSE;
return;
}
GenericCommProM$state = TRUE;
GenericCommProM$UARTOrRadio = UART;
ok = GenericCommProM$UARTSend$send(m2);
}
else
{
GenericCommProM$UARTOrRadio = RADIO;
ok = GenericCommProM$RadioSend$send(m2);
}
GenericCommProM$sendTaskBusy = FALSE;
if (ok == SUCCESS) {
changeElementStatus(&GenericCommProM$sendQueue, m, PENDING, PROCESSING);
;
if (GenericCommProM$UARTOrRadio == RADIO) {
GenericCommProM$tryNextSend();
}
}
else {
ind = GenericCommProM$findBkHeaderEntry(m);
if (ind < COMM_SEND_QUEUE_SIZE) {
m->addr = GenericCommProM$bkHeader[ind].addr;
m->group = GenericCommProM$bkHeader[ind].group;
m->type = GenericCommProM$bkHeader[ind].type;
m->length = GenericCommProM$bkHeader[ind].length;
}
else
#line 449
{
;
}
if (GenericCommProM$UARTOrRadio == UART) {
GenericCommProM$state = FALSE;
}
if (headElement(&GenericCommProM$sendQueue, PROCESSING) == NULL) {
GenericCommProM$tryNextSend();
}
}
return;
}
static inline void GenericCommProM$sendTask(void)
#line 463
{
GenericCommProM$sendFunc();
}
# 408 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
static inline result_t HPLUSART1M$USARTControl$tx(uint8_t data)
#line 408
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 409
{
HPLUSART1M$U1TXBUF = data;
}
#line 411
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 202 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLUARTM$USARTControl$tx(uint8_t arg_0x40e95850){
#line 202
unsigned char result;
#line 202
#line 202
result = HPLUSART1M$USARTControl$tx(arg_0x40e95850);
#line 202
#line 202
return result;
#line 202
}
#line 202
# 98 "/opt/tinyos-1.x/tos/platform/msp430/HPLUARTM.nc"
static inline result_t HPLUARTM$UART$put(uint8_t data)
#line 98
{
return HPLUARTM$USARTControl$tx(data);
}
# 80 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
inline static result_t UARTM$HPLUART$put(uint8_t arg_0x410c46c0){
#line 80
unsigned char result;
#line 80
#line 80
result = HPLUARTM$UART$put(arg_0x410c46c0);
#line 80
#line 80
return result;
#line 80
}
#line 80
# 370 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr msg, result_t success)
#line 370
{
GenericCommProM$state = FALSE;
return GenericCommProM$reportSendDone(msg, success);
}
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t FramerM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010){
#line 67
unsigned char result;
#line 67
#line 67
result = GenericCommProM$UARTSend$sendDone(arg_0x40d01e48, arg_0x40d00010);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 397 "/home/xu/oasis/system/queue.h"
static inline bool incRetryCount(object_type **object)
#line 397
{
Element_t *el;
#line 399
if (object == NULL) {
return FAIL;
}
else
#line 401
{
el = (Element_t *)((char *)object - (unsigned long )& ((Element_t *)0)->obj);
el->retry++;
return SUCCESS;
}
}
#line 387
static inline uint8_t getRetryCount(object_type **object)
#line 387
{
Element_t *el;
#line 389
if (object == NULL) {
return 0xff;
}
else
#line 391
{
el = (Element_t *)((char *)object - (unsigned long )& ((Element_t *)0)->obj);
return el->retry;
}
}
# 8 "/home/xu/oasis/lib/GenericCommPro/QosRexmit.h"
static inline uint8_t qosRexmit(uint8_t qos)
#line 8
{
switch (qos) {
case 1: return 2;
case 2: return 2;
case 3: return 3;
case 4: return 4;
case 5: return 4;
case 6: return 5;
case 7: return 6;
default: return 2;
}
}
# 523 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 523
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 524
MultiHopLQI$msgBufBusy = FALSE;
#line 524
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 749 "build/telosb/RpcM.nc"
static inline result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 749
{
;
return SUCCESS;
}
# 621 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Send$default$sendDone(uint8_t AMID, TOS_MsgPtr pMsg,
result_t success)
#line 622
{
MultiHopEngineM$falseType++;
return SUCCESS;
}
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t MultiHopEngineM$Send$sendDone(uint8_t arg_0x414e10f8, TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30){
#line 119
unsigned char result;
#line 119
#line 119
switch (arg_0x414e10f8) {
#line 119
case NW_DATA:
#line 119
result = DataMgmtM$Send$sendDone(arg_0x409fb9a0, arg_0x409fbb30);
#line 119
break;
#line 119
case NW_SNMS:
#line 119
result = EventReportM$EventSend$sendDone(arg_0x409fb9a0, arg_0x409fbb30);
#line 119
break;
#line 119
case NW_RPCR:
#line 119
result = RpcM$ResponseSend$sendDone(arg_0x409fb9a0, arg_0x409fbb30);
#line 119
break;
#line 119
default:
#line 119
result = MultiHopEngineM$Send$default$sendDone(arg_0x414e10f8, arg_0x409fb9a0, arg_0x409fbb30);
#line 119
break;
#line 119
}
#line 119
#line 119
return result;
#line 119
}
#line 119
# 418 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline bool MultiHopLQI$RouteControl$isSink(void)
#line 418
{
return MultiHopLQI$localBeSink;
}
# 116 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
inline static bool MultiHopEngineM$RouteSelectCntl$isSink(void){
#line 116
unsigned char result;
#line 116
#line 116
result = MultiHopLQI$RouteControl$isSink();
#line 116
#line 116
return result;
#line 116
}
#line 116
# 254 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr msg, result_t success)
#line 254
{
uint8_t infoIn = 0;
TOS_MsgPtr *mPPtr = NULL;
#line 257
;
mPPtr = findObject(&MultiHopEngineM$sendQueue, msg);
if (mPPtr == NULL) {
;
return SUCCESS;
}
if ((infoIn = MultiHopEngineM$findInfoEntry(msg)) == 5) {
;
}
if (MultiHopEngineM$RouteSelectCntl$isSink() || msg->addr != TOS_UART_ADDR) {
MultiHopEngineM$beRadioActive = TRUE;
}
if (
#line 268
success != SUCCESS &&
msg->addr != TOS_BCAST_ADDR &&
msg->addr != TOS_UART_ADDR) {
;
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != NULL) {
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, FAIL);
}
#line 274
MultiHopEngineM$numLocalPendingPkt--;
MultiHopEngineM$numberOfSendFailures++;
MultiHopEngineM$numOfSuccessiveFailures++;
}
else
#line 277
{
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != NULL) {
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, SUCCESS);
MultiHopEngineM$numLocalPendingPkt--;
}
MultiHopEngineM$numberOfSendSuccesses++;
if (msg->addr != TOS_BCAST_ADDR) {
MultiHopEngineM$numOfSuccessiveFailures = 0;
MultiHopEngineM$beParentActive = TRUE;
}
}
if (SUCCESS != removeElement(&MultiHopEngineM$sendQueue, msg)) {
;
}
else
{
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
MultiHopEngineM$numOfPktProcessing--;
#line 297
__nesc_atomic_end(__nesc_atomic); }
freeBuffer(&MultiHopEngineM$buffQueue, msg);
MultiHopEngineM$freeInfoEntry(infoIn);
MultiHopEngineM$tryNextSend();
return SUCCESS;
}
# 874 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$TimeSyncNotify$default$msg_sent(void)
#line 874
{
}
# 26 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
inline static void TimeSyncM$TimeSyncNotify$msg_sent(void){
#line 26
TimeSyncM$TimeSyncNotify$default$msg_sent();
#line 26
}
#line 26
# 63 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$redToggle(void)
#line 63
{
return SUCCESS;
}
# 81 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = NoLeds$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 693 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr ptr, result_t success)
{
if (ptr != &TimeSyncM$outgoingMsgBuffer) {
return SUCCESS;
}
if (success) {
++TimeSyncM$heartBeats;
TimeSyncM$Leds$redToggle();
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS) {
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
}
}
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
return SUCCESS;
}
# 365 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$SendMsg$default$sendDone(uint8_t id, TOS_MsgPtr msg, result_t success)
#line 365
{
return SUCCESS;
}
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t GenericCommProM$SendMsg$sendDone(uint8_t arg_0x40cdef00, TOS_MsgPtr arg_0x40bafbd8, result_t arg_0x40bafd68){
#line 49
unsigned char result;
#line 49
#line 49
switch (arg_0x40cdef00) {
#line 49
case AM_NETWORKMSG:
#line 49
result = MultiHopEngineM$SendMsg$sendDone(arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
case AM_CASCTRLMSG:
#line 49
result = CascadesEngineM$SendMsg$sendDone(AM_CASCTRLMSG, arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
case AM_CASCADESMSG:
#line 49
result = CascadesEngineM$SendMsg$sendDone(AM_CASCADESMSG, arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
case AM_TIMESYNCMSG:
#line 49
result = TimeSyncM$SendMsg$sendDone(arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
case AM_BEACONMSG:
#line 49
result = MultiHopLQI$SendMsg$sendDone(arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
default:
#line 49
result = GenericCommProM$SendMsg$default$sendDone(arg_0x40cdef00, arg_0x40bafbd8, arg_0x40bafd68);
#line 49
break;
#line 49
}
#line 49
#line 49
return result;
#line 49
}
#line 49
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t DataMgmtM$SysCheckTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(3U);
#line 68
#line 68
return result;
#line 68
}
#line 68
#line 59
inline static result_t DataMgmtM$SysCheckTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(3U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 75 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$greenToggle(void)
#line 75
{
return SUCCESS;
}
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t DataMgmtM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t DataMgmtM$Send$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_DATA, arg_0x40a166c0, arg_0x40a16850);
#line 83
#line 83
return result;
#line 83
}
#line 83
#line 106
inline static void *DataMgmtM$Send$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_DATA, arg_0x40a16f18, arg_0x409fb0e0);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 426 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline void DataMgmtM$sendTask(void)
#line 426
{
TOS_MsgPtr msg = NULL;
ApplicationMsg *pApp = NULL;
uint16_t length = 0;
if (NULL == (msg = headElement(&DataMgmtM$sendQueue, PENDING))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 432
DataMgmtM$sendTaskBusy = FALSE;
#line 432
__nesc_atomic_end(__nesc_atomic); }
;
return;
}
DataMgmtM$headSendQueue = headElement(&DataMgmtM$sendQueue, PENDING);
pApp = (ApplicationMsg *)DataMgmtM$Send$getBuffer(msg, &length);
length = (size_t )& ((ApplicationMsg *)0)->data + pApp->length;
DataMgmtM$Msg_length = length;
DataMgmtM$sendCalled++;
DataMgmtM$sendQueueLen = (&DataMgmtM$sendQueue)->total;
if (SUCCESS == DataMgmtM$Send$send(msg, length)) {
DataMgmtM$send_num++;
if (SUCCESS != changeElementStatus(&DataMgmtM$sendQueue, msg, PENDING, PROCESSING)) {
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 449
{
;
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$tryNextSend();
}
#line 454
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 459
{
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$sendQueueLen = (&DataMgmtM$sendQueue)->total;
}
#line 462
__nesc_atomic_end(__nesc_atomic); }
;
return;
}
}
# 339 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr Msg, uint8_t id)
#line 339
{
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
#line 341
pNWMsg->type = id;
pNWMsg->linksource = pNWMsg->source = TOS_LOCAL_ADDRESS;
pNWMsg->seqno = MultiHopLQI$gCurrentSeqNo++;
pNWMsg->ttl = 31;
return SUCCESS;
}
# 86 "/home/xu/oasis/lib/MultiHopOasis/RouteSelect.nc"
inline static result_t MultiHopEngineM$RouteSelect$initializeFields(TOS_MsgPtr arg_0x411f8b58, uint8_t arg_0x411f8ce0){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopLQI$RouteSelect$initializeFields(arg_0x411f8b58, arg_0x411f8ce0);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 582 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void)
#line 582
{
uint8_t i = 0;
#line 584
for (i = 0; i < 5; i++) {
if (MultiHopEngineM$queueEntryInfo[i].valid == FALSE) {
return i;
}
}
#line 588
if (i == 5) {
;
}
#line 590
return i;
}
# 257 "/home/xu/oasis/system/queue.h"
static inline void _private_reorderElementByPriority(Queue_t *queue, int16_t ind)
#line 257
{
int16_t _prev;
#line 258
int16_t _last;
#line 258
int16_t indprev;
#line 258
int16_t indnext;
#line 259
_last = ind;
while ((_prev = queue->element[_last].prev) != -1) {
if (queue->element[_prev].priority >= queue->element[ind].priority) {
#line 261
break;
}
#line 262
_last = _prev;
}
if (_last == ind) {
return;
}
indprev = queue->element[ind].prev;
indnext = queue->element[ind].next;
if (indprev != -1) {
queue->element[indprev].next = indnext;
}
#line 274
if (indnext != -1) {
queue->element[indnext].prev = indprev;
}
else
#line 276
{
queue->tail[queue->element[ind].status] = indprev;
}
if (_prev == -1) {
queue->element[ind].prev = -1;
queue->element[ind].next = _last;
queue->element[_last].prev = ind;
queue->head[queue->element[ind].status] = ind;
}
else
#line 289
{
queue->element[_prev].next = ind;
queue->element[ind].prev = _prev;
queue->element[ind].next = _last;
queue->element[_last].prev = ind;
}
return;
}
#line 202
static inline result_t insertElementPri(Queue_t *queue, object_type *obj, uint8_t priority)
#line 202
{
int16_t ind;
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total >= queue->size) {
return FAIL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
;
return FAIL;
}
}
ind = queue->head[FREE];
queue->element[ind].obj = obj;
queue->element[ind].retry = 0;
_private_changeElementStatusByIndex(queue, ind, FREE, PENDING);
queue->element[ind].priority = priority;
_private_reorderElementByPriority(queue, ind);
queue->total++;
;
return SUCCESS;
}
#line 378
static inline object_type *tailElement(Queue_t *queue, ObjStatus_t status)
#line 378
{
if (queue->tail[status] == -1) {
return NULL;
}
else {
#line 383
return queue->element[queue->tail[status]].obj;
}
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t MultiHopEngineM$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_NETWORKMSG, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 72 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t MultiHopEngineM$Leds$redOff(void){
#line 72
unsigned char result;
#line 72
#line 72
result = LedsC$Leds$redOff();
#line 72
#line 72
return result;
#line 72
}
#line 72
#line 64
inline static result_t MultiHopEngineM$Leds$redOn(void){
#line 64
unsigned char result;
#line 64
#line 64
result = LedsC$Leds$redOn();
#line 64
#line 64
return result;
#line 64
}
#line 64
# 280 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr Msg, uint8_t id,
uint8_t resend)
#line 281
{
int i;
int8_t ttlDiff = 0;
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
if (pNWMsg->source != TOS_LOCAL_ADDRESS && resend == 0) {
for (i = 0; i < 10; i++) {
if (
#line 289
MultiHopLQI$gRecentOriginPacketSender[i] == pNWMsg->source &&
MultiHopLQI$gRecentOriginPacketSeqNo[i] == pNWMsg->seqno &&
!MultiHopLQI$localBeSink) {
ttlDiff = MultiHopLQI$gRecentOriginPacketTTL[i] >= pNWMsg->ttl ? MultiHopLQI$gRecentOriginPacketTTL[i] - pNWMsg->ttl : pNWMsg->ttl - MultiHopLQI$gRecentOriginPacketTTL[i];
if (ttlDiff >= 2) {
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$fixedParent = FALSE;
}
;
return FAIL;
}
}
MultiHopLQI$gRecentOriginPacketSender[MultiHopLQI$gRecentOriginIndex] = pNWMsg->source;
MultiHopLQI$gRecentOriginPacketSeqNo[MultiHopLQI$gRecentOriginIndex] = pNWMsg->seqno;
MultiHopLQI$gRecentOriginPacketTTL[MultiHopLQI$gRecentOriginIndex] = pNWMsg->ttl;
MultiHopLQI$gRecentOriginIndex = (MultiHopLQI$gRecentOriginIndex + 1) % 10;
}
pNWMsg->linksource = TOS_LOCAL_ADDRESS;
Msg->addr = MultiHopLQI$gbCurrentParent;
if (pNWMsg->source == TOS_LOCAL_ADDRESS) {
pNWMsg->dest = MultiHopLQI$gbCurrentParent;
}
if (pNWMsg->source != TOS_LOCAL_ADDRESS && resend == 0) {
pNWMsg->ttl -= 1;
;
}
if (pNWMsg->ttl <= 0) {
;
return FALSE;
}
pNWMsg->linksource = TOS_LOCAL_ADDRESS;
return SUCCESS;
}
# 71 "/home/xu/oasis/lib/MultiHopOasis/RouteSelect.nc"
inline static result_t MultiHopEngineM$RouteSelect$selectRoute(TOS_MsgPtr arg_0x411f8238, uint8_t arg_0x411f83c0, uint8_t arg_0x411f8548){
#line 71
unsigned char result;
#line 71
#line 71
result = MultiHopLQI$RouteSelect$selectRoute(arg_0x411f8238, arg_0x411f83c0, arg_0x411f8548);
#line 71
#line 71
return result;
#line 71
}
#line 71
# 186 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline void MultiHopEngineM$sendTask(void)
#line 186
{
TOS_MsgPtr msgPtr = headElement(&MultiHopEngineM$sendQueue, PENDING);
uint8_t infoIn = 0;
#line 189
MultiHopEngineM$sendTaskBusy = FALSE;
if (msgPtr == NULL) {
return;
}
infoIn = MultiHopEngineM$findInfoEntry(msgPtr);
MultiHopEngineM$messageIsRetransmission = MultiHopEngineM$queueEntryInfo[infoIn].resend;
if (infoIn == 5) {
;
}
if (MultiHopEngineM$queueEntryInfo[infoIn].valid == FALSE)
{
goto out;
}
if (
#line 205
MultiHopEngineM$RouteSelect$selectRoute(
msgPtr,
MultiHopEngineM$queueEntryInfo[infoIn].AMID,
MultiHopEngineM$messageIsRetransmission) != SUCCESS) {
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != NULL) {
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, FAIL);
MultiHopEngineM$numLocalPendingPkt--;
;
}
out:
removeElement(&MultiHopEngineM$sendQueue, msgPtr);
freeBuffer(&MultiHopEngineM$buffQueue, msgPtr);
MultiHopEngineM$freeInfoEntry(infoIn);
MultiHopEngineM$numberOfSendFailures++;
MultiHopEngineM$numOfSuccessiveFailures++;
MultiHopEngineM$tryNextSend();
return;
}
else
#line 223
{
if (msgPtr->addr == TOS_BCAST_ADDR) {
MultiHopEngineM$Leds$redOn();
return;
}
MultiHopEngineM$Leds$redOff();
if (
#line 231
MultiHopEngineM$SendMsg$send(
msgPtr->addr,
MultiHopEngineM$queueEntryInfo[infoIn].length,
msgPtr) == SUCCESS) {
if (SUCCESS != changeElementStatus(&MultiHopEngineM$sendQueue, msgPtr, PENDING, PROCESSING)) {
;
}
MultiHopEngineM$numOfPktProcessing++;
;
MultiHopEngineM$tryNextSend();
return;
}
else
#line 242
{
MultiHopEngineM$queueEntryInfo[infoIn].resend = TRUE;
if (headElement(&MultiHopEngineM$sendQueue, PROCESSING) == NULL) {
MultiHopEngineM$tryNextSend();
}
}
}
}
# 123 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id)
#line 123
{
uint8_t i = 0;
#line 125
for (i = 0; i < 16; i++) {
if (NeighborMgmtM$NeighborTbl[i].flags & NBRFLAG_VALID && NeighborMgmtM$NeighborTbl[i].id == id) {
return i;
}
}
return ROUTE_INVALID;
}
#line 170
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void)
#line 170
{
uint8_t i = 0;
uint8_t minLinkEst = -1;
uint8_t minLinkEstIndex = ROUTE_INVALID;
#line 174
for (i = 0; i < 16; i++) {
if ((NeighborMgmtM$NeighborTbl[i].flags & NBRFLAG_VALID) == 0) {
return i;
}
if (NeighborMgmtM$NeighborTbl[i].relation & NBR_PARENT) {
continue;
}
#line 180
if (minLinkEst > NeighborMgmtM$NeighborTbl[i].linkEst) {
minLinkEst = NeighborMgmtM$NeighborTbl[i].linkEst;
minLinkEstIndex = i;
}
}
return minLinkEstIndex;
}
#line 133
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id)
#line 133
{
NeighborMgmtM$NeighborTbl[indes].id = id;
NeighborMgmtM$NeighborTbl[indes].flags = NBRFLAG_VALID | NBRFLAG_NEW;
NeighborMgmtM$NeighborTbl[indes].liveliness = 0;
NeighborMgmtM$NeighborTbl[indes].childLiveliness = 0;
NeighborMgmtM$NeighborTbl[indes].linkEst = 0;
NeighborMgmtM$NeighborTbl[indes].linkEstCandidate = 0;
NeighborMgmtM$NeighborTbl[indes].parentCost = 0x7fff;
NeighborMgmtM$NeighborTbl[indes].relation = 0;
}
#line 341
static inline bool NeighborMgmtM$NeighborCtrl$clearParent(bool reset)
#line 341
{
uint8_t ind = 0;
#line 343
for (ind = 0; ind < 16; ind++) {
if (NeighborMgmtM$NeighborTbl[ind].flags & NBRFLAG_VALID) {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT) {
NeighborMgmtM$NeighborTbl[ind].relation ^= NBR_PARENT;
if (reset) {
NeighborMgmtM$NeighborTbl[ind].flags = 0;
}
return TRUE;
}
}
}
return FALSE;
}
# 407 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$CascadeControl$parentChanged(address_t newParent)
#line 407
{
TOS_MsgPtr tempPtr = NULL;
if (newParent == TOS_BCAST_ADDR || CascadesRouterM$inited != TRUE) {
return SUCCESS;
}
if (TRUE != CascadesRouterM$activeRT) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 415
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 415
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_REQ);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 421
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 421
__nesc_atomic_end(__nesc_atomic); }
}
}
}
return SUCCESS;
}
# 5 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$parentChanged(address_t arg_0x41543698){
#line 5
unsigned char result;
#line 5
#line 5
result = CascadesRouterM$CascadeControl$parentChanged(arg_0x41543698);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 12 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_RED_LED_PIN(void)
#line 12
{
#line 12
static volatile uint8_t r __asm ("0x0031");
#line 12
r &= ~(1 << 4);
}
#line 12
static inline void TOSH_SET_RED_LED_PIN(void)
#line 12
{
#line 12
static volatile uint8_t r __asm ("0x0031");
#line 12
r |= 1 << 4;
}
# 608 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 608
{
return SUCCESS;
}
# 529 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 529
{
return SUCCESS;
}
# 244 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$EventReport$default$eventSendDone(uint8_t eventType, TOS_MsgPtr pMsg, result_t success)
#line 244
{
return SUCCESS;
}
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static result_t EventReportM$EventReport$eventSendDone(uint8_t arg_0x41169e18, TOS_MsgPtr arg_0x40a2b4e0, result_t arg_0x40a2b670){
#line 47
unsigned char result;
#line 47
#line 47
switch (arg_0x41169e18) {
#line 47
case EVENT_TYPE_SNMS:
#line 47
result = MultiHopLQI$EventReport$eventSendDone(arg_0x40a2b4e0, arg_0x40a2b670);
#line 47
break;
#line 47
case EVENT_TYPE_SENSING:
#line 47
result = SmartSensingM$EventReport$eventSendDone(arg_0x40a2b4e0, arg_0x40a2b670);
#line 47
break;
#line 47
default:
#line 47
result = EventReportM$EventReport$default$eventSendDone(arg_0x41169e18, arg_0x40a2b4e0, arg_0x40a2b670);
#line 47
break;
#line 47
}
#line 47
#line 47
return result;
#line 47
}
#line 47
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t EventReportM$EventSend$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_SNMS, arg_0x40a166c0, arg_0x40a16850);
#line 83
#line 83
return result;
#line 83
}
#line 83
#line 106
inline static void *EventReportM$EventSend$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_SNMS, arg_0x40a16f18, arg_0x409fb0e0);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 317 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$sendEvent(void)
#line 317
{
TOS_MsgPtr msgPtr;
ApplicationMsg *pApp;
uint16_t maxLen;
uint8_t length;
EventMsg *pEvent;
msgPtr = headElement(&EventReportM$sendQueue, PENDING);
if (msgPtr == NULL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 326
{
EventReportM$taskBusy = FALSE;
}
#line 328
__nesc_atomic_end(__nesc_atomic); }
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
EventReportM$gfSendBusy = TRUE;
#line 332
__nesc_atomic_end(__nesc_atomic); }
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(msgPtr, &maxLen);
length = pApp->length + (size_t )& ((ApplicationMsg *)0)->data;
pEvent = (EventMsg *)pApp->data;
if (SUCCESS != EventReportM$EventSend$send(msgPtr, length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 345
EventReportM$gfSendBusy = FALSE;
#line 345
__nesc_atomic_end(__nesc_atomic); }
if (headElement(&EventReportM$sendQueue, PROCESSING) == NULL) {
EventReportM$tryNextSend();
}
}
else
{
;
if (SUCCESS != changeElementStatus(&EventReportM$sendQueue, msgPtr, PENDING, PROCESSING)) {
;
}
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 364
{
EventReportM$taskBusy = FALSE;
EventReportM$tryNextSend();
}
#line 367
__nesc_atomic_end(__nesc_atomic); }
}
return;
}
# 1009 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$SubSend$sendDone(uint8_t type, TOS_MsgPtr msg, result_t status)
#line 1009
{
if (type == AM_CASCTRLMSG) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1011
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 1011
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t CascadesEngineM$MySend$sendDone(uint8_t arg_0x415fc030, TOS_MsgPtr arg_0x409fb9a0, result_t arg_0x409fbb30){
#line 119
unsigned char result;
#line 119
#line 119
result = CascadesRouterM$SubSend$sendDone(arg_0x415fc030, arg_0x409fb9a0, arg_0x409fbb30);
#line 119
#line 119
return result;
#line 119
}
#line 119
# 698 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void)
#line 698
{
uint8_t i = 0;
#line 700
for (i = 0; i < COMM_SEND_QUEUE_SIZE; i++) {
if (GenericCommProM$bkHeader[i].valid == FALSE) {
return i;
}
}
#line 704
if (i == COMM_SEND_QUEUE_SIZE) {
;
}
#line 706
return i;
}
# 146 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t type, uint8_t len)
#line 146
{
msg->type = type;
msg->length = len;
}
# 582 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t type, uint16_t code)
#line 582
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 583
SmartSensingM$defaultCode = code;
#line 583
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 43 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(uint8_t arg_0x40a037b0, uint16_t arg_0x40a03940){
#line 43
unsigned char result;
#line 43
#line 43
result = SmartSensingM$SensingConfig$setTaskSchedulingCode(arg_0x40a037b0, arg_0x40a03940);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 770 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline void SmartSensingM$setrate(void)
#line 770
{
uint16_t oldInterval = SmartSensingM$timerInterval;
#line 772
SmartSensingM$timerInterval = SmartSensingM$calFireInterval();
if (oldInterval != SmartSensingM$timerInterval) {
SmartSensingM$SensingTimer$start(TIMER_REPEAT, SmartSensingM$timerInterval);
}
}
#line 382
static inline result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t type, uint16_t rate)
#line 382
{
int8_t client;
uint16_t oldrate;
if (rate > MAX_SAMPLING_RATE) {
return FAIL;
}
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
oldrate = sensor[client].samplingRate;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 394
sensor[client].samplingRate = rate == 0 ? 0 : 1000UL / rate;
#line 394
__nesc_atomic_end(__nesc_atomic); }
if (oldrate != sensor[client].samplingRate) {
SmartSensingM$updateMaxBlkNum();
SmartSensingM$setrate();
}
return SUCCESS;
}
}
return FAIL;
}
# 27 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setSamplingRate(uint8_t arg_0x40a07e08, uint16_t arg_0x40a06010){
#line 27
unsigned char result;
#line 27
#line 27
result = SmartSensingM$SensingConfig$setSamplingRate(arg_0x40a07e08, arg_0x40a06010);
#line 27
#line 27
return result;
#line 27
}
#line 27
# 544 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t priority)
#line 544
{
int8_t client;
if (priority < 8) {
for (client = sensor_num - 1; client >= 0; client--) {
sensor[client].nodePriority = priority;
}
return SUCCESS;
}
return FAIL;
}
# 39 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setNodePriority(uint8_t arg_0x40a03010){
#line 39
unsigned char result;
#line 39
#line 39
result = SmartSensingM$SensingConfig$setNodePriority(arg_0x40a03010);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 498 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t type, uint8_t priority)
#line 498
{
int8_t client;
if (priority < 8) {
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
sensor[client].dataPriority = priority;
return SUCCESS;
}
}
}
return FAIL;
}
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setDataPriority(uint8_t arg_0x40a044a8, uint8_t arg_0x40a04638){
#line 35
unsigned char result;
#line 35
#line 35
result = SmartSensingM$SensingConfig$setDataPriority(arg_0x40a044a8, arg_0x40a04638);
#line 35
#line 35
return result;
#line 35
}
#line 35
# 436 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t type, uint8_t channel)
#line 436
{
int8_t client;
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
sensor[client].channel = channel;
SmartSensingM$ADCControl$bindPort(client, channel);
return SUCCESS;
}
}
if (sensor_num < MAX_SENSOR_NUM) {
sensor[sensor_num].type = type;
sensor[sensor_num].channel = channel;
SmartSensingM$ADCControl$bindPort(sensor_num, channel);
++sensor_num;
return SUCCESS;
}
else {
return FAIL;
}
}
# 31 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setADCChannel(uint8_t arg_0x40a06948, uint8_t arg_0x40a06ad0){
#line 31
unsigned char result;
#line 31
#line 31
result = SmartSensingM$SensingConfig$setADCChannel(arg_0x40a06948, arg_0x40a06ad0);
#line 31
#line 31
return result;
#line 31
}
#line 31
# 570 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t type)
#line 570
{
return SmartSensingM$defaultCode;
}
# 45 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint16_t RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(uint8_t arg_0x40a03de8){
#line 45
unsigned int result;
#line 45
#line 45
result = SmartSensingM$SensingConfig$getTaskSchedulingCode(arg_0x40a03de8);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 360 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t type)
#line 360
{
int8_t client;
#line 362
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
if (sensor[client].samplingRate != 0) {
return 1000UL / sensor[client].samplingRate;
}
else {
return 0;
}
}
}
return 0;
}
# 29 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint16_t RpcM$SmartSensingM_SensingConfig$getSamplingRate(uint8_t arg_0x40a064b0){
#line 29
unsigned int result;
#line 29
#line 29
result = SmartSensingM$SensingConfig$getSamplingRate(arg_0x40a064b0);
#line 29
#line 29
return result;
#line 29
}
#line 29
# 525 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getNodePriority(void)
#line 525
{
return sensor[0].nodePriority;
}
# 41 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getNodePriority(void){
#line 41
unsigned char result;
#line 41
#line 41
result = SmartSensingM$SensingConfig$getNodePriority();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 480 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t type)
#line 480
{
int8_t client;
#line 482
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
return sensor[client].dataPriority;
}
}
return -1;
}
# 37 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getDataPriority(uint8_t arg_0x40a04ad0){
#line 37
unsigned char result;
#line 37
#line 37
result = SmartSensingM$SensingConfig$getDataPriority(arg_0x40a04ad0);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 416 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t type)
#line 416
{
int8_t client;
#line 418
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
return sensor[client].channel;
}
}
return -1;
}
# 33 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getADCChannel(uint8_t arg_0x40a04010){
#line 33
unsigned char result;
#line 33
#line 33
result = SmartSensingM$SensingConfig$getADCChannel(arg_0x40a04010);
#line 33
#line 33
return result;
#line 33
}
#line 33
# 280 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline void SNMSM$restart(void)
#line 280
{
}
# 42 "build/telosb/RpcM.nc"
inline static void RpcM$SNMSM_restart(void){
#line 42
SNMSM$restart();
#line 42
}
#line 42
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t SNMSM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = LedsC$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
#line 106
inline static result_t SNMSM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = LedsC$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
#line 81
inline static result_t SNMSM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = LedsC$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 169 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$ledsOn(uint8_t ledColorParam)
#line 169
{
switch (ledColorParam)
{
case 0:
SNMSM$Leds$redToggle();
break;
case 1:
SNMSM$Leds$greenToggle();
break;
case 2:
SNMSM$Leds$yellowToggle();
break;
}
return SUCCESS;
}
# 41 "build/telosb/RpcM.nc"
inline static result_t RpcM$SNMSM_ledsOn(uint8_t arg_0x4119e888){
#line 41
unsigned char result;
#line 41
#line 41
result = SNMSM$ledsOn(arg_0x4119e888);
#line 41
#line 41
return result;
#line 41
}
#line 41
# 41 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static inline unsigned int RamSymbolsM$poke(ramSymbol_t *p_symbol)
#line 41
{
if (p_symbol->length <= MAX_RAM_SYMBOL_SIZE) {
if (p_symbol->dereference == TRUE) {
nmemcpy(* (void **)p_symbol->memAddress, (void *)p_symbol->data, p_symbol->length);
}
else {
nmemcpy((void *)p_symbol->memAddress, (void *)p_symbol->data, p_symbol->length);
}
}
return p_symbol->memAddress;
}
# 40 "build/telosb/RpcM.nc"
inline static unsigned int RpcM$RamSymbolsM_poke(ramSymbol_t *arg_0x4119e3e8){
#line 40
unsigned int result;
#line 40
#line 40
result = RamSymbolsM$poke(arg_0x4119e3e8);
#line 40
#line 40
return result;
#line 40
}
#line 40
# 53 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static inline ramSymbol_t RamSymbolsM$peek(unsigned int memAddress, uint8_t length, bool dereference)
#line 53
{
RamSymbolsM$symbol.memAddress = memAddress;
RamSymbolsM$symbol.length = length;
RamSymbolsM$symbol.dereference = dereference;
if (RamSymbolsM$symbol.length <= MAX_RAM_SYMBOL_SIZE) {
if (RamSymbolsM$symbol.dereference == TRUE) {
nmemcpy((void *)RamSymbolsM$symbol.data, * (void **)RamSymbolsM$symbol.memAddress, RamSymbolsM$symbol.length);
}
else {
nmemcpy((void *)RamSymbolsM$symbol.data, (void *)RamSymbolsM$symbol.memAddress, RamSymbolsM$symbol.length);
}
}
return RamSymbolsM$symbol;
}
# 39 "build/telosb/RpcM.nc"
inline static ramSymbol_t RpcM$RamSymbolsM_peek(unsigned int arg_0x41196bb8, uint8_t arg_0x41196d40, bool arg_0x41196ed0){
#line 39
struct ramSymbol_t result;
#line 39
#line 39
result = RamSymbolsM$peek(arg_0x41196bb8, arg_0x41196d40, arg_0x41196ed0);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 568 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteRpcCtrl$setSink(bool enable)
#line 568
{
if (enable) {
if (MultiHopLQI$localBeSink) {
#line 570
return SUCCESS;
}
#line 571
MultiHopLQI$localBeSink = TRUE;
MultiHopLQI$gbCurrentParent = TOS_UART_ADDR;
MultiHopLQI$gbCurrentParentCost = 0;
MultiHopLQI$gbCurrentLinkEst = 0;
MultiHopLQI$gbLinkQuality = 110;
MultiHopLQI$gbCurrentHopCount = 0;
MultiHopLQI$gbCurrentCost = 0;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_UART_ADDR);
}
else
{
if (!MultiHopLQI$localBeSink) {
#line 585
return SUCCESS;
}
#line 586
MultiHopLQI$localBeSink = FALSE;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
}
TOS_post(MultiHopLQI$SendRouteTask);
return SUCCESS;
}
# 2 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setSink(bool arg_0x41197068){
#line 2
unsigned char result;
#line 2
#line 2
result = MultiHopLQI$RouteRpcCtrl$setSink(arg_0x41197068);
#line 2
#line 2
return result;
#line 2
}
#line 2
# 384 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$setParent(uint16_t parentAddr)
#line 384
{
MultiHopLQI$fixedParent = TRUE;
MultiHopLQI$gbCurrentParent = parentAddr;
MultiHopLQI$NeighborCtrl$setParent(MultiHopLQI$gbCurrentParent);
return SUCCESS;
}
#line 602
static inline result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t parentAddr)
#line 602
{
if (parentAddr == TOS_LOCAL_ADDRESS || MultiHopLQI$localBeSink) {
return FAIL;
}
#line 605
return MultiHopLQI$RouteControl$setParent(parentAddr);
}
# 3 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setParent(uint16_t arg_0x41197510){
#line 3
unsigned char result;
#line 3
#line 3
result = MultiHopLQI$RouteRpcCtrl$setParent(arg_0x41197510);
#line 3
#line 3
return result;
#line 3
}
#line 3
# 374 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t Interval)
#line 374
{
MultiHopLQI$gUpdateInterval = Interval;
return SUCCESS;
}
#line 614
static inline result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t seconds)
#line 614
{
if (seconds <= 0 || seconds >= 60) {
return FAIL;
}
#line 617
return MultiHopLQI$RouteControl$setUpdateInterval(seconds);
}
# 5 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x41197cc0){
#line 5
unsigned char result;
#line 5
#line 5
result = MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(arg_0x41197cc0);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 395 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$releaseParent(void)
#line 395
{
if (!MultiHopLQI$fixedParent) {
#line 396
return FAIL;
}
#line 397
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
return SUCCESS;
}
#line 608
static inline result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void)
#line 608
{
if (MultiHopLQI$localBeSink) {
return FAIL;
}
#line 611
return MultiHopLQI$RouteControl$releaseParent();
}
# 4 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent(void){
#line 4
unsigned char result;
#line 4
#line 4
result = MultiHopLQI$RouteRpcCtrl$releaseParent();
#line 4
#line 4
return result;
#line 4
}
#line 4
# 620 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void)
#line 620
{
return MultiHopLQI$gUpdateInterval;
}
# 6 "/home/xu/oasis/lib/MultiHopOasis/RouteRpcCtrl.nc"
inline static uint16_t RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval(void){
#line 6
unsigned int result;
#line 6
#line 6
result = MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 354 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t power)
#line 354
{
CC2420ControlM$gCurrentParameters[CP_TXCTRL] = (CC2420ControlM$gCurrentParameters[CP_TXCTRL] & ~(0x1F << 0)) | (power << 0);
CC2420ControlM$HPLChipcon$write(0x15, CC2420ControlM$gCurrentParameters[CP_TXCTRL]);
return SUCCESS;
}
# 178 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t GenericCommProM$CC2420Control$SetRFPower(uint8_t arg_0x40d15950){
#line 178
unsigned char result;
#line 178
#line 178
result = CC2420ControlM$CC2420Control$SetRFPower(arg_0x40d15950);
#line 178
#line 178
return result;
#line 178
}
#line 178
# 744 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$setRFPower(uint8_t level)
#line 744
{
if (level >= 1 && level <= 31) {
return GenericCommProM$CC2420Control$SetRFPower(level);
}
else {
#line 748
return FAIL;
}
}
# 37 "build/telosb/RpcM.nc"
inline static result_t RpcM$GenericCommProM_setRFPower(uint8_t arg_0x4119f010){
#line 37
unsigned char result;
#line 37
#line 37
result = GenericCommProM$setRFPower(arg_0x4119f010);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 264 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t chnl)
#line 264
{
int fsctrl;
uint8_t status;
fsctrl = 357 + 5 * (chnl - 11);
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (CC2420ControlM$gCurrentParameters[CP_FSCTRL] & 0xfc00) | (fsctrl << 0);
status = CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
if (status & (1 << 6)) {
CC2420ControlM$HPLChipcon$cmd(0x03);
}
#line 275
return SUCCESS;
}
# 84 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t GenericCommProM$CC2420Control$TunePreset(uint8_t arg_0x40d19a30){
#line 84
unsigned char result;
#line 84
#line 84
result = CC2420ControlM$CC2420Control$TunePreset(arg_0x40d19a30);
#line 84
#line 84
return result;
#line 84
}
#line 84
# 737 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$setRFChannel(uint8_t channel)
#line 737
{
if (channel >= 11 && channel <= 26) {
return GenericCommProM$CC2420Control$TunePreset(channel);
}
else {
#line 741
return FAIL;
}
}
# 36 "build/telosb/RpcM.nc"
inline static result_t RpcM$GenericCommProM_setRFChannel(uint8_t arg_0x411aaa90){
#line 36
unsigned char result;
#line 36
#line 36
result = GenericCommProM$setRFChannel(arg_0x411aaa90);
#line 36
#line 36
return result;
#line 36
}
#line 36
# 364 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline uint8_t CC2420ControlM$CC2420Control$GetRFPower(void)
#line 364
{
return CC2420ControlM$gCurrentParameters[CP_TXCTRL] & (0x1F << 0);
}
# 185 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static uint8_t GenericCommProM$CC2420Control$GetRFPower(void){
#line 185
unsigned char result;
#line 185
#line 185
result = CC2420ControlM$CC2420Control$GetRFPower();
#line 185
#line 185
return result;
#line 185
}
#line 185
# 755 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline uint8_t GenericCommProM$getRFPower(void)
#line 755
{
return GenericCommProM$CC2420Control$GetRFPower();
}
# 35 "build/telosb/RpcM.nc"
inline static uint8_t RpcM$GenericCommProM_getRFPower(void){
#line 35
unsigned char result;
#line 35
#line 35
result = GenericCommProM$getRFPower();
#line 35
#line 35
return result;
#line 35
}
#line 35
# 310 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline uint8_t CC2420ControlM$CC2420Control$GetPreset(void)
#line 310
{
uint16_t _freq = CC2420ControlM$gCurrentParameters[CP_FSCTRL] & (0x1FF << 0);
#line 312
_freq = (_freq - 357) / 5;
_freq = _freq + 11;
return _freq;
}
# 106 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static uint8_t GenericCommProM$CC2420Control$GetPreset(void){
#line 106
unsigned char result;
#line 106
#line 106
result = CC2420ControlM$CC2420Control$GetPreset();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 751 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline uint8_t GenericCommProM$getRFChannel(void)
#line 751
{
return GenericCommProM$CC2420Control$GetPreset();
}
# 34 "build/telosb/RpcM.nc"
inline static uint8_t RpcM$GenericCommProM_getRFChannel(void){
#line 34
unsigned char result;
#line 34
#line 34
result = GenericCommProM$getRFChannel();
#line 34
#line 34
return result;
#line 34
}
#line 34
# 161 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$EventConfig$setReportLevel(uint8_t type, uint8_t level)
#line 161
{
int s;
#line 163
if (EVENT_TYPE_VALUE_MAX < type || EVENT_LEVEL_VALUE_MAX < level) {
return FALSE;
}
#line 165
if (type != EVENT_TYPE_ALL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 166
EventReportM$gLevelMode[type] = level;
#line 166
__nesc_atomic_end(__nesc_atomic); }
}
else {
for (s = 0; s < 6; s++)
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 170
EventReportM$gLevelMode[s] = level;
#line 170
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 38 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
inline static result_t RpcM$EventReportM_EventConfig$setReportLevel(uint8_t arg_0x41143778, uint8_t arg_0x41143900){
#line 38
unsigned char result;
#line 38
#line 38
result = EventReportM$EventConfig$setReportLevel(arg_0x41143778, arg_0x41143900);
#line 38
#line 38
return result;
#line 38
}
#line 38
# 175 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline uint8_t EventReportM$EventConfig$getReportLevel(uint8_t type)
#line 175
{
uint8_t level;
#line 177
if (EVENT_TYPE_VALUE_MAX < type) {
return FALSE;
}
#line 179
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 179
level = EventReportM$gLevelMode[type];
#line 179
__nesc_atomic_end(__nesc_atomic); }
return level;
}
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
inline static uint8_t RpcM$EventReportM_EventConfig$getReportLevel(uint8_t arg_0x41143ec0){
#line 47
unsigned char result;
#line 47
#line 47
result = EventReportM$EventConfig$getReportLevel(arg_0x41143ec0);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 106 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static void *RpcM$ResponseSend$getBuffer(TOS_MsgPtr arg_0x40a16f18, uint16_t *arg_0x409fb0e0){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_RPCR, arg_0x40a16f18, arg_0x409fb0e0);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 145 "build/telosb/RpcM.nc"
static inline void RpcM$processCommand(void)
#line 145
{
ApplicationMsg *RecvMsg = (ApplicationMsg *)RpcM$cmdStore.data;
RpcCommandMsg *msg = (RpcCommandMsg *)RecvMsg->data;
uint8_t *byteSrc = msg->data;
uint16_t maxLength;
uint16_t id = msg->commandID;
NetworkMsg *NMsg = (NetworkMsg *)RpcM$sendMsgPtr->data;
ApplicationMsg *AppMsg = (ApplicationMsg *)RpcM$ResponseSend$getBuffer(RpcM$sendMsgPtr, &maxLength);
RpcResponseMsg *responseMsg = (RpcResponseMsg *)AppMsg->data;
#line 158
NMsg->qos = 7;
{
}
#line 159
;
responseMsg->transactionID = msg->transactionID;
responseMsg->commandID = msg->commandID;
responseMsg->sourceAddress = TOS_LOCAL_ADDRESS;
responseMsg->errorCode = RPC_SUCCESS;
responseMsg->dataLength = 0;
if (msg->unix_time != G_Ident.unix_time || msg->user_hash != G_Ident.user_hash) {
responseMsg->errorCode = RPC_WRONG_XML_FILE;
}
else {
#line 175
if (id < 25 && msg->dataLength != RpcM$args_sizes[id]) {
responseMsg->errorCode = RPC_GARBAGE_ARGS;
{
}
#line 177
;
}
else {
#line 178
if (id < 25 && RpcM$return_sizes[id] + sizeof(RpcResponseMsg ) > maxLength) {
responseMsg->errorCode = RPC_RESPONSE_TOO_LARGE;
{
}
#line 180
;
}
else
#line 181
{
switch (id) {
case 0: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 190
{
}
#line 190
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$EventReportM_EventConfig$getReportLevel(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 194
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 196
;
{
}
#line 197
;
}
#line 198
break;
case 1: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_level;
#line 205
{
}
#line 205
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_level, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$EventReportM_EventConfig$setReportLevel(RPC_type, RPC_level);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 211
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 213
;
{
}
#line 214
;
}
#line 215
break;
case 2: {
uint8_t RPC_returnVal;
#line 220
{
}
#line 220
;
RPC_returnVal = RpcM$GenericCommProM_getRFChannel();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 223
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 225
;
{
}
#line 226
;
}
#line 227
break;
case 3: {
uint8_t RPC_returnVal;
#line 232
{
}
#line 232
;
RPC_returnVal = RpcM$GenericCommProM_getRFPower();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 235
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 237
;
{
}
#line 238
;
}
#line 239
break;
case 4: {
result_t RPC_returnVal;
uint8_t RPC_channel;
#line 245
{
}
#line 245
;
nmemcpy(&RPC_channel, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$GenericCommProM_setRFChannel(RPC_channel);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 249
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 251
;
{
}
#line 252
;
}
#line 253
break;
case 5: {
result_t RPC_returnVal;
uint8_t RPC_level;
#line 259
{
}
#line 259
;
nmemcpy(&RPC_level, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$GenericCommProM_setRFPower(RPC_level);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 263
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 265
;
{
}
#line 266
;
}
#line 267
break;
case 6: {
uint16_t RPC_returnVal;
#line 272
{
}
#line 272
;
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 275
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 277
;
{
}
#line 278
;
}
#line 279
break;
case 7: {
result_t RPC_returnVal;
#line 284
{
}
#line 284
;
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 287
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 289
;
{
}
#line 290
;
}
#line 291
break;
case 8: {
result_t RPC_returnVal;
uint16_t RPC_seconds;
#line 297
{
}
#line 297
;
nmemcpy(&RPC_seconds, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(RPC_seconds);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 301
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 303
;
{
}
#line 304
;
}
#line 305
break;
case 9: {
result_t RPC_returnVal;
uint16_t RPC_parentAddr;
#line 311
{
}
#line 311
;
nmemcpy(&RPC_parentAddr, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setParent(RPC_parentAddr);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 315
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 317
;
{
}
#line 318
;
}
#line 319
break;
case 10: {
result_t RPC_returnVal;
bool RPC_enable;
#line 325
{
}
#line 325
;
nmemcpy(&RPC_enable, byteSrc, sizeof(bool ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setSink(RPC_enable);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 329
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 331
;
{
}
#line 332
;
}
#line 333
break;
case 11: {
ramSymbol_t RPC_returnVal;
unsigned int RPC_memAddress;
uint8_t RPC_length;
bool RPC_dereference;
#line 341
{
}
#line 341
;
nmemcpy(&RPC_memAddress, byteSrc, sizeof(unsigned int ));
byteSrc += sizeof(unsigned int );
nmemcpy(&RPC_length, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_dereference, byteSrc, sizeof(bool ));
RPC_returnVal = RpcM$RamSymbolsM_peek(RPC_memAddress, RPC_length, RPC_dereference);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(ramSymbol_t ));
{
}
#line 349
;
responseMsg->dataLength = sizeof(ramSymbol_t );
{
}
#line 351
;
{
}
#line 352
;
}
#line 353
break;
case 12: {
unsigned int RPC_returnVal;
ramSymbol_t RPC_symbol;
#line 359
{
}
#line 359
;
nmemcpy(&RPC_symbol, byteSrc, sizeof(ramSymbol_t ));
RPC_returnVal = RpcM$RamSymbolsM_poke(&RPC_symbol);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(unsigned int ));
{
}
#line 363
;
responseMsg->dataLength = sizeof(unsigned int );
{
}
#line 365
;
{
}
#line 366
;
}
#line 367
break;
case 13: {
result_t RPC_returnVal;
uint8_t RPC_ledColorParam;
#line 373
{
}
#line 373
;
nmemcpy(&RPC_ledColorParam, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SNMSM_ledsOn(RPC_ledColorParam);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 377
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 379
;
{
}
#line 380
;
}
#line 381
break;
case 14: {
{
}
#line 385
;
RpcM$SNMSM_restart();
{
}
#line 387
;
{
}
#line 388
;
}
#line 389
break;
case 15: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 395
{
}
#line 395
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getADCChannel(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 399
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 401
;
{
}
#line 402
;
}
#line 403
break;
case 16: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 409
{
}
#line 409
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getDataPriority(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 413
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 415
;
{
}
#line 416
;
}
#line 417
break;
case 17: {
uint8_t RPC_returnVal;
#line 422
{
}
#line 422
;
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getNodePriority();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 425
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 427
;
{
}
#line 428
;
}
#line 429
break;
case 18: {
uint16_t RPC_returnVal;
uint8_t RPC_type;
#line 435
{
}
#line 435
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getSamplingRate(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 439
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 441
;
{
}
#line 442
;
}
#line 443
break;
case 19: {
uint16_t RPC_returnVal;
uint8_t RPC_type;
#line 449
{
}
#line 449
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 453
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 455
;
{
}
#line 456
;
}
#line 457
break;
case 20: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_channel;
#line 464
{
}
#line 464
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_channel, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setADCChannel(RPC_type, RPC_channel);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 470
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 472
;
{
}
#line 473
;
}
#line 474
break;
case 21: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_priority;
#line 481
{
}
#line 481
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_priority, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setDataPriority(RPC_type, RPC_priority);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 487
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 489
;
{
}
#line 490
;
}
#line 491
break;
case 22: {
result_t RPC_returnVal;
uint8_t RPC_priority;
#line 497
{
}
#line 497
;
nmemcpy(&RPC_priority, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setNodePriority(RPC_priority);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 501
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 503
;
{
}
#line 504
;
}
#line 505
break;
case 23: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint16_t RPC_samplingRate;
#line 512
{
}
#line 512
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_samplingRate, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setSamplingRate(RPC_type, RPC_samplingRate);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 518
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 520
;
{
}
#line 521
;
}
#line 522
break;
case 24: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint16_t RPC_code;
#line 529
{
}
#line 529
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_code, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(RPC_type, RPC_code);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 535
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 537
;
{
}
#line 538
;
}
#line 539
break;
default:
{
}
#line 542
;
responseMsg->errorCode = RPC_PROCEDURE_UNAVAIL;
}
}
}
}
#line 547
{
}
#line 547
;
{
}
#line 548
;
AppMsg->type = TYPE_SNMS_RPCRESPONSE;
AppMsg->length = responseMsg->dataLength + (size_t )& ((RpcResponseMsg *)0)->data;
AppMsg->seqno = RpcM$seqno++;
;
if (msg->responseDesired == 0) {
{
}
#line 560
;
RpcM$processingCommand = FALSE;
}
else {
RpcM$processingCommand = FALSE;
RpcM$tryNextSend();
}
}
# 79 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline uint8_t HPLCC2420M$adjustStatusByte(uint8_t status)
#line 79
{
return status & 0x7E;
}
#line 461
static inline result_t HPLCC2420M$BusArbitration$busFree(void)
#line 461
{
return SUCCESS;
}
# 125 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static inline result_t BusArbitrationM$BusArbitration$default$busFree(uint8_t id)
#line 125
{
return SUCCESS;
}
# 39 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
inline static result_t BusArbitrationM$BusArbitration$busFree(uint8_t arg_0x40ffcf08){
#line 39
unsigned char result;
#line 39
#line 39
switch (arg_0x40ffcf08) {
#line 39
case 0U:
#line 39
result = HPLCC2420M$BusArbitration$busFree();
#line 39
break;
#line 39
default:
#line 39
result = BusArbitrationM$BusArbitration$default$busFree(arg_0x40ffcf08);
#line 39
break;
#line 39
}
#line 39
#line 39
return result;
#line 39
}
#line 39
# 42 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static inline void BusArbitrationM$busReleased(void)
#line 42
{
uint8_t i;
uint8_t currentstate;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 46
BusArbitrationM$isBusReleasedPending = FALSE;
#line 46
__nesc_atomic_end(__nesc_atomic); }
for (i = 0; i < 1U; i++) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 48
currentstate = BusArbitrationM$state;
#line 48
__nesc_atomic_end(__nesc_atomic); }
if (currentstate == BusArbitrationM$BUS_IDLE) {
BusArbitrationM$BusArbitration$busFree(i);
}
}
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t MultiHopLQI$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_BEACONMSG, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 13 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_GREEN_LED_PIN(void)
#line 13
{
#line 13
static volatile uint8_t r __asm ("0x0031");
#line 13
r |= 1 << 5;
}
# 110 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$greenOff(void)
#line 110
{
{
}
#line 111
;
/* atomic removed: atomic calls only */
#line 112
{
TOSH_SET_GREEN_LED_PIN();
LedsC$ledsOn &= ~LedsC$GREEN_BIT;
}
return SUCCESS;
}
# 13 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_GREEN_LED_PIN(void)
#line 13
{
#line 13
static volatile uint8_t r __asm ("0x0031");
#line 13
r &= ~(1 << 5);
}
# 101 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$greenOn(void)
#line 101
{
{
}
#line 102
;
/* atomic removed: atomic calls only */
#line 103
{
TOSH_CLR_GREEN_LED_PIN();
LedsC$ledsOn |= LedsC$GREEN_BIT;
}
return SUCCESS;
}
# 14 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SET_YELLOW_LED_PIN(void)
#line 14
{
#line 14
static volatile uint8_t r __asm ("0x0031");
#line 14
r |= 1 << 6;
}
# 139 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$yellowOff(void)
#line 139
{
{
}
#line 140
;
/* atomic removed: atomic calls only */
#line 141
{
TOSH_SET_YELLOW_LED_PIN();
LedsC$ledsOn &= ~LedsC$YELLOW_BIT;
}
return SUCCESS;
}
# 14 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_YELLOW_LED_PIN(void)
#line 14
{
#line 14
static volatile uint8_t r __asm ("0x0031");
#line 14
r &= ~(1 << 6);
}
# 130 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$yellowOn(void)
#line 130
{
{
}
#line 131
;
/* atomic removed: atomic calls only */
#line 132
{
TOSH_CLR_YELLOW_LED_PIN();
LedsC$ledsOn |= LedsC$YELLOW_BIT;
}
return SUCCESS;
}
# 323 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline result_t RealTimeM$Timer$stop(uint8_t id)
#line 323
{
if (id >= NUM_TIMERS) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 327
{
if (RealTimeM$mState & (0x1L << id)) {
RealTimeM$mState &= ~(0x1L << id);
{
unsigned char __nesc_temp =
#line 330
SUCCESS;
{
#line 330
__nesc_atomic_end(__nesc_atomic);
#line 330
return __nesc_temp;
}
}
}
else
#line 332
{
{
unsigned char __nesc_temp =
#line 333
FAIL;
{
#line 333
__nesc_atomic_end(__nesc_atomic);
#line 333
return __nesc_temp;
}
}
}
}
#line 337
__nesc_atomic_end(__nesc_atomic); }
}
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t RpcM$ResponseSend$send(TOS_MsgPtr arg_0x40a166c0, uint16_t arg_0x40a16850){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_RPCR, arg_0x40a166c0, arg_0x40a16850);
#line 83
#line 83
return result;
#line 83
}
#line 83
# 704 "build/telosb/RpcM.nc"
static inline void RpcM$sendResponse(void)
#line 704
{
uint16_t maxLength;
ApplicationMsg *AppMsg = (ApplicationMsg *)RpcM$ResponseSend$getBuffer(RpcM$sendMsgPtr, &maxLength);
RpcResponseMsg *responseMsg = (RpcResponseMsg *)AppMsg->data;
if (RpcM$ResponseSend$send(RpcM$sendMsgPtr,
responseMsg->dataLength + (size_t )& ((RpcResponseMsg *)0)->data + (size_t )& ((ApplicationMsg *)0)->data)) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 719
RpcM$taskBusy = FALSE;
#line 719
__nesc_atomic_end(__nesc_atomic); }
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 723
RpcM$taskBusy = FALSE;
#line 723
__nesc_atomic_end(__nesc_atomic); }
;
RpcM$tryNextSend();
}
}
# 473 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr msg)
#line 473
{
result_t result = FALSE;
#line 475
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 475
{
result = insertElement(&DataMgmtM$sendQueue, msg);
DataMgmtM$tryNextSend();
}
#line 478
__nesc_atomic_end(__nesc_atomic); }
return result;
}
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t TimeSyncM$LocalTime$read(void){
#line 27
unsigned long result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 202 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline uint32_t TimeSyncM$GlobalTime$getLocalTime(void)
{
return TimeSyncM$LocalTime$read();
}
static inline result_t TimeSyncM$is_synced(void)
{
return TimeSyncM$numEntries >= TimeSyncM$ENTRY_VALID_LIMIT || ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS;
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t TimeSyncM$SendMsg$send(uint16_t arg_0x40baf410, uint8_t arg_0x40baf598, TOS_MsgPtr arg_0x40baf728){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_TIMESYNCMSG, arg_0x40baf410, arg_0x40baf598, arg_0x40baf728);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 470 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$CompareB3$setEventFromNow(uint16_t x)
#line 470
{
#line 470
MSP430TimerM$TBCCR3 = TBR + x;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void TimerM$AlarmCompare$setEventFromNow(uint16_t arg_0x408d5830){
#line 32
MSP430TimerM$CompareB3$setEventFromNow(arg_0x408d5830);
#line 32
}
#line 32
# 366 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB3$clearPendingInterrupt(void)
#line 366
{
#line 366
MSP430TimerM$TBCCTL3 &= ~0x0001;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerM$AlarmControl$clearPendingInterrupt(void){
#line 32
MSP430TimerM$ControlB3$clearPendingInterrupt();
#line 32
}
#line 32
# 414 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB3$enableEvents(void)
#line 414
{
#line 414
MSP430TimerM$TBCCTL3 |= 0x0010;
}
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerM$AlarmControl$enableEvents(void){
#line 38
MSP430TimerM$ControlB3$enableEvents();
#line 38
}
#line 38
# 202 "/opt/tinyos-1.x/tos/platform/msp430/msp430hardware.h"
static inline void __nesc_enable_interrupt(void)
{
__asm volatile ("eint");}
#line 226
static inline void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts)
{
if (reenable_interrupts) {
__nesc_enable_interrupt();
}
}
#line 245
static __inline void __nesc_atomic_sleep(void)
#line 245
{
uint16_t LPMode_bits = 0;
if (LPMode_disabled) {
__nesc_enable_interrupt();
return;
}
else
#line 259
{
LPMode_bits = 0x0080 + 0x0040 + 0x0010;
if ((((
#line 262
TA0CTL & (3 << 4)) != 0 << 4 && (TA0CTL & (3 << 8)) == 2 << 8)
|| (ME1 & ((1 << 7) | (1 << 6)) && U0TCTL & 0x20))
|| (ME2 & ((1 << 5) | (1 << 4)) && U1TCTL & 0x20)) {
LPMode_bits = 0x0040 + 0x0010;
}
if (ADC12CTL1 & 0x0001) {
if (!(ADC12CTL0 & 0x0080) && (TA0CTL & (3 << 8)) == 2 << 8) {
LPMode_bits = 0x0040 + 0x0010;
}
else {
#line 278
switch (ADC12CTL1 & (3 << 3)) {
case 2 << 3: LPMode_bits = 0;
#line 279
break;
case 3 << 3: LPMode_bits = 0x0040 + 0x0010;
#line 280
break;
}
}
}
LPMode_bits |= 0x0008;
__asm volatile ("bis %0, r2" : : "m"((uint16_t )LPMode_bits));}
}
#line 196
static inline void __nesc_disable_interrupt(void)
{
__asm volatile ("dint");
__asm volatile ("nop");}
static inline bool are_interrupts_enabled(void)
{
return (({
#line 209
uint16_t __x;
#line 209
__asm volatile ("mov r2, %0" : "=r"((uint16_t )__x));__x;
}
)
#line 209
& 0x0008) != 0;
}
static inline __nesc_atomic_t __nesc_atomic_start(void )
{
__nesc_atomic_t result = are_interrupts_enabled();
#line 222
__nesc_disable_interrupt();
return result;
}
# 136 "/opt/tinyos-1.x/tos/system/sched.c"
static inline bool TOSH_run_next_task(void)
{
__nesc_atomic_t fInterruptFlags;
uint8_t old_full;
void (*func)(void );
fInterruptFlags = __nesc_atomic_start();
old_full = TOSH_sched_full;
func = TOSH_queue[old_full].tp;
if (func == NULL)
{
__nesc_atomic_sleep();
return 0;
}
TOSH_queue[old_full].tp = NULL;
TOSH_sched_full = (old_full + 1) & TOSH_TASK_BITMASK;
__nesc_atomic_end(fInterruptFlags);
func();
return 1;
}
static inline void TOSH_run_task(void)
#line 159
{
for (; ; )
TOSH_run_next_task();
}
# 96 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$int2CC(uint16_t x)
#line 96
{
#line 96
union __nesc_unnamed4331 {
#line 96
uint16_t f;
#line 96
MSP430TimerM$CC_t t;
}
#line 96
c = { .f = x };
#line 96
return c.t;
}
#line 205
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA0$getControl(void)
#line 205
{
#line 205
return MSP430TimerM$int2CC(MSP430TimerM$TA0CCTL0);
}
#line 160
static inline void MSP430TimerM$CaptureA0$default$captured(uint16_t time)
#line 160
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureA0$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureA0$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 253 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureA0$getEvent(void)
#line 253
{
#line 253
return MSP430TimerM$TA0CCR0;
}
# 406 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$CompareA0$fired(void)
#line 406
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareA0$fired(void){
#line 34
MSP430ADC12M$CompareA0$fired();
#line 34
}
#line 34
# 206 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA1$getControl(void)
#line 206
{
#line 206
return MSP430TimerM$int2CC(MSP430TimerM$TA0CCTL1);
}
#line 161
static inline void MSP430TimerM$CaptureA1$default$captured(uint16_t time)
#line 161
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureA1$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureA1$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 254 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureA1$getEvent(void)
#line 254
{
#line 254
return MSP430TimerM$TA0CCR1;
}
# 407 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$CompareA1$fired(void)
#line 407
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareA1$fired(void){
#line 34
MSP430ADC12M$CompareA1$fired();
#line 34
}
#line 34
# 207 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlA2$getControl(void)
#line 207
{
#line 207
return MSP430TimerM$int2CC(MSP430TimerM$TA0CCTL2);
}
#line 162
static inline void MSP430TimerM$CaptureA2$default$captured(uint16_t time)
#line 162
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureA2$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureA2$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 255 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureA2$getEvent(void)
#line 255
{
#line 255
return MSP430TimerM$TA0CCR2;
}
#line 159
static inline void MSP430TimerM$CompareA2$default$fired(void)
#line 159
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareA2$fired(void){
#line 34
MSP430TimerM$CompareA2$default$fired();
#line 34
}
#line 34
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static uint16_t MSP430DCOCalibM$Timer32khz$read(void){
#line 30
unsigned int result;
#line 30
#line 30
result = MSP430TimerM$TimerB$read();
#line 30
#line 30
return result;
#line 30
}
#line 30
# 41 "/opt/tinyos-1.x/tos/platform/msp430/MSP430DCOCalibM.nc"
static inline void MSP430DCOCalibM$TimerMicro$overflow(void)
{
uint16_t now = MSP430DCOCalibM$Timer32khz$read();
uint16_t delta = now - MSP430DCOCalibM$m_prev;
#line 45
MSP430DCOCalibM$m_prev = now;
if (delta > MSP430DCOCalibM$TARGET_DELTA + MSP430DCOCalibM$MAX_DEVIATION)
{
if (DCOCTL < 0xe0)
{
DCOCTL++;
}
else {
#line 54
if ((BCSCTL1 & 7) < 7)
{
BCSCTL1++;
DCOCTL = 96;
}
}
}
else {
#line 60
if (delta < MSP430DCOCalibM$TARGET_DELTA - MSP430DCOCalibM$MAX_DEVIATION)
{
if (DCOCTL > 0)
{
DCOCTL--;
}
else {
#line 67
if ((BCSCTL1 & 7) > 0)
{
BCSCTL1--;
DCOCTL = 128;
}
}
}
}
}
# 405 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$TimerA$overflow(void)
#line 405
{
}
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430TimerM$TimerA$overflow(void){
#line 33
MSP430ADC12M$TimerA$overflow();
#line 33
MSP430DCOCalibM$TimerMicro$overflow();
#line 33
}
#line 33
# 347 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB0$getControl(void)
#line 347
{
#line 347
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL0);
}
#line 338
static inline void MSP430TimerM$CaptureB0$default$captured(uint16_t time)
#line 338
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB0$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB0$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 443 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB0$getEvent(void)
#line 443
{
#line 443
return MSP430TimerM$TBCCR0;
}
#line 331
static inline void MSP430TimerM$CompareB0$default$fired(void)
#line 331
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB0$fired(void){
#line 34
MSP430TimerM$CompareB0$default$fired();
#line 34
}
#line 34
# 348 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB1$getControl(void)
#line 348
{
#line 348
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL1);
}
#line 484
static inline void MSP430TimerM$CaptureB1$clearOverflow(void)
#line 484
{
#line 484
MSP430TimerM$TBCCTL1 &= ~0x0002;
}
# 56 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void HPLCC2420InterruptM$SFDCapture$clearOverflow(void){
#line 56
MSP430TimerM$CaptureB1$clearOverflow();
#line 56
}
#line 56
# 476 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline bool MSP430TimerM$CaptureB1$isOverflowPending(void)
#line 476
{
#line 476
return MSP430TimerM$TBCCTL1 & 0x0002;
}
# 51 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static bool HPLCC2420InterruptM$SFDCapture$isOverflowPending(void){
#line 51
unsigned char result;
#line 51
#line 51
result = MSP430TimerM$CaptureB1$isOverflowPending();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 364 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB1$clearPendingInterrupt(void)
#line 364
{
#line 364
MSP430TimerM$TBCCTL1 &= ~0x0001;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void HPLCC2420InterruptM$SFDControl$clearPendingInterrupt(void){
#line 32
MSP430TimerM$ControlB1$clearPendingInterrupt();
#line 32
}
#line 32
# 420 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB1$disableEvents(void)
#line 420
{
#line 420
MSP430TimerM$TBCCTL1 &= ~0x0010;
}
# 39 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void HPLCC2420InterruptM$SFDControl$disableEvents(void){
#line 39
MSP430TimerM$ControlB1$disableEvents();
#line 39
}
#line 39
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t ClockTimeStampingM$LocalTime$read(void){
#line 27
unsigned long result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 123 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff)
#line 125
{
/* atomic removed: atomic calls only */
#line 126
{
ClockTimeStampingM$rcv_time = ClockTimeStampingM$LocalTime$read();
ClockTimeStampingM$rcv_message = msgBuff;
}
return;
}
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
inline static void CC2420RadioM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658){
#line 33
ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(arg_0x40d91340, arg_0x40d914c8, arg_0x40d91658);
#line 33
}
#line 33
# 144 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setAckTimer(uint16_t jiffy)
#line 144
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_ACK;
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
inline static result_t CC2420RadioM$SFD$enableCapture(bool arg_0x40dbe808){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420InterruptM$SFD$enableCapture(arg_0x40dbe808);
#line 43
#line 43
return result;
#line 43
}
#line 43
#line 60
inline static result_t CC2420RadioM$SFD$disable(void){
#line 60
unsigned char result;
#line 60
#line 60
result = HPLCC2420InterruptM$SFD$disable();
#line 60
#line 60
return result;
#line 60
}
#line 60
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t ClockTimeStampingM$HPLCC2420RAM$write(uint16_t arg_0x40e23d00, uint8_t arg_0x40e23e88, uint8_t *arg_0x40e22068){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420RAM$write(arg_0x40e23d00, arg_0x40e23e88, arg_0x40e22068);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 58 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff)
#line 60
{
uint32_t send_time;
TimeSyncMsg *newMessage = (TimeSyncMsg *)msgBuff->data;
if (msgBuff->type != AM_TIMESYNCMSG) {
return;
}
if (newMessage->wroteStamp == SUCCESS) {
return;
}
/* atomic removed: atomic calls only */
send_time = ClockTimeStampingM$LocalTime$read() - ClockTimeStampingM$SEND_TIME_CORRECTION;
newMessage->sendingTime += send_time;
newMessage->wroteStamp = SUCCESS;
ClockTimeStampingM$HPLCC2420RAM$write(ClockTimeStampingM$TX_FIFO_MSG_START +
(size_t )& ((TimeSyncMsg *)0)->wroteStamp,
TIMESYNC_LENGTH_SENDFIELDS,
(void *)(msgBuff->data +
(size_t )& ((TimeSyncMsg *)0)->wroteStamp));
return;
}
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
inline static void CC2420RadioM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40d91340, uint8_t arg_0x40d914c8, TOS_MsgPtr arg_0x40d91658){
#line 33
ClockTimeStampingM$RadioSendCoordinator$startSymbol(arg_0x40d91340, arg_0x40d914c8, arg_0x40d91658);
#line 33
}
#line 33
# 29 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline uint8_t TOSH_READ_CC_SFD_PIN(void)
#line 29
{
#line 29
static volatile uint8_t r __asm ("0x001C");
#line 29
return r & (1 << 1);
}
# 344 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SFD$captured(uint16_t time)
#line 344
{
switch (CC2420RadioM$stateRadio) {
case CC2420RadioM$TX_STATE:
CC2420RadioM$SFD$enableCapture(FALSE);
if (!TOSH_READ_CC_SFD_PIN()) {
CC2420RadioM$SFD$disable();
}
else {
CC2420RadioM$stateRadio = CC2420RadioM$TX_WAIT;
}
CC2420RadioM$txbufptr->time = time;
CC2420RadioM$RadioSendCoordinator$startSymbol(8, 0, CC2420RadioM$txbufptr);
if (CC2420RadioM$stateRadio == CC2420RadioM$TX_WAIT) {
break;
}
case CC2420RadioM$TX_WAIT:
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_STATE;
CC2420RadioM$SFD$disable();
CC2420RadioM$SFD$enableCapture(TRUE);
if (CC2420RadioM$bAckEnable && CC2420RadioM$txbufptr->addr != TOS_BCAST_ADDR) {
if (!CC2420RadioM$setAckTimer(75)) {
CC2420RadioM$sendFailed();
}
}
else {
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
}
#line 381
break;
default:
CC2420RadioM$rxbufptr->time = time;
CC2420RadioM$RadioReceiveCoordinator$startSymbol(8, 0, CC2420RadioM$rxbufptr);
}
return SUCCESS;
}
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
inline static result_t HPLCC2420InterruptM$SFD$captured(uint16_t arg_0x40dbedc8){
#line 53
unsigned char result;
#line 53
#line 53
result = CC2420RadioM$SFD$captured(arg_0x40dbedc8);
#line 53
#line 53
return result;
#line 53
}
#line 53
# 209 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline void HPLCC2420InterruptM$SFDCapture$captured(uint16_t time)
#line 209
{
result_t val = SUCCESS;
#line 211
HPLCC2420InterruptM$SFDControl$clearPendingInterrupt();
val = HPLCC2420InterruptM$SFD$captured(time);
if (val == FAIL) {
HPLCC2420InterruptM$SFDControl$disableEvents();
HPLCC2420InterruptM$SFDControl$clearPendingInterrupt();
}
else {
if (HPLCC2420InterruptM$SFDCapture$isOverflowPending()) {
HPLCC2420InterruptM$SFDCapture$clearOverflow();
}
}
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB1$captured(uint16_t arg_0x408cb858){
#line 74
HPLCC2420InterruptM$SFDCapture$captured(arg_0x408cb858);
#line 74
}
#line 74
# 29 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_CC_SFD_MODFUNC(void)
#line 29
{
#line 29
static volatile uint8_t r __asm ("0x001F");
#line 29
r |= 1 << 1;
}
# 110 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$captureControl(uint8_t l_cm)
{
MSP430TimerM$CC_t x = {
.cm = l_cm & 0x03,
.ccis = 0,
.clld = 0,
.cap = 1,
.scs = 1,
.ccie = 0 };
return MSP430TimerM$CC2int(x);
}
#line 388
static inline void MSP430TimerM$ControlB1$setControlAsCapture(uint8_t cm)
#line 388
{
#line 388
MSP430TimerM$TBCCTL1 = MSP430TimerM$captureControl(cm);
}
# 36 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void HPLCC2420InterruptM$SFDControl$setControlAsCapture(bool arg_0x408c0190){
#line 36
MSP430TimerM$ControlB1$setControlAsCapture(arg_0x408c0190);
#line 36
}
#line 36
# 412 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB1$enableEvents(void)
#line 412
{
#line 412
MSP430TimerM$TBCCTL1 |= 0x0010;
}
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void HPLCC2420InterruptM$SFDControl$enableEvents(void){
#line 38
MSP430TimerM$ControlB1$enableEvents();
#line 38
}
#line 38
# 29 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_SEL_CC_SFD_IOFUNC(void)
#line 29
{
#line 29
static volatile uint8_t r __asm ("0x001F");
#line 29
r &= ~(1 << 1);
}
# 441 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t addr, uint8_t length, uint8_t *buffer)
#line 441
{
return SUCCESS;
}
# 165 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t addr,
uint8_t length,
uint8_t *buffer)
#line 167
{
return SUCCESS;
}
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t HPLCC2420M$HPLCC2420RAM$writeDone(uint16_t arg_0x40e225a0, uint8_t arg_0x40e22728, uint8_t *arg_0x40e228d0){
#line 49
unsigned char result;
#line 49
#line 49
result = ClockTimeStampingM$HPLCC2420RAM$writeDone(arg_0x40e225a0, arg_0x40e22728, arg_0x40e228d0);
#line 49
result = rcombine(result, CC2420ControlM$HPLChipconRAM$writeDone(arg_0x40e225a0, arg_0x40e22728, arg_0x40e228d0));
#line 49
#line 49
return result;
#line 49
}
#line 49
# 288 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline void HPLCC2420M$signalRAMWr(void)
#line 288
{
HPLCC2420M$HPLCC2420RAM$writeDone(HPLCC2420M$ramaddr, HPLCC2420M$ramlen, HPLCC2420M$rambuf);
}
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t GenericCommProM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = LedsC$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 392 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr msg, result_t status)
#line 392
{
GenericCommProM$radioSendActive = TRUE;
GenericCommProM$Leds$greenToggle();
return GenericCommProM$reportSendDone(msg, status);
}
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t CC2420RadioM$Send$sendDone(TOS_MsgPtr arg_0x40d01e48, result_t arg_0x40d00010){
#line 67
unsigned char result;
#line 67
#line 67
result = GenericCommProM$RadioSend$sendDone(arg_0x40d01e48, arg_0x40d00010);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 444 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB1$getEvent(void)
#line 444
{
#line 444
return MSP430TimerM$TBCCR1;
}
#line 332
static inline void MSP430TimerM$CompareB1$default$fired(void)
#line 332
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB1$fired(void){
#line 34
MSP430TimerM$CompareB1$default$fired();
#line 34
}
#line 34
# 349 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB2$getControl(void)
#line 349
{
#line 349
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL2);
}
#line 340
static inline void MSP430TimerM$CaptureB2$default$captured(uint16_t time)
#line 340
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB2$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB2$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 445 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB2$getEvent(void)
#line 445
{
#line 445
return MSP430TimerM$TBCCR2;
}
#line 333
static inline void MSP430TimerM$CompareB2$default$fired(void)
#line 333
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB2$fired(void){
#line 34
MSP430TimerM$CompareB2$default$fired();
#line 34
}
#line 34
# 350 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB3$getControl(void)
#line 350
{
#line 350
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL3);
}
#line 341
static inline void MSP430TimerM$CaptureB3$default$captured(uint16_t time)
#line 341
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB3$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB3$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 446 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB3$getEvent(void)
#line 446
{
#line 446
return MSP430TimerM$TBCCR3;
}
# 308 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline void TimerM$AlarmCompare$fired(void)
{
TimerM$post_checkShortTimers();
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB3$fired(void){
#line 34
TimerM$AlarmCompare$fired();
#line 34
}
#line 34
# 351 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB4$getControl(void)
#line 351
{
#line 351
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL4);
}
#line 342
static inline void MSP430TimerM$CaptureB4$default$captured(uint16_t time)
#line 342
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB4$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB4$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 447 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB4$getEvent(void)
#line 447
{
#line 447
return MSP430TimerM$TBCCR4;
}
#line 415
static inline void MSP430TimerM$ControlB4$enableEvents(void)
#line 415
{
#line 415
MSP430TimerM$TBCCTL4 |= 0x0010;
}
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerJiffyAsyncM$AlarmControl$enableEvents(void){
#line 38
MSP430TimerM$ControlB4$enableEvents();
#line 38
}
#line 38
# 367 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlB4$clearPendingInterrupt(void)
#line 367
{
#line 367
MSP430TimerM$TBCCTL4 &= ~0x0001;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void TimerJiffyAsyncM$AlarmControl$clearPendingInterrupt(void){
#line 32
MSP430TimerM$ControlB4$clearPendingInterrupt();
#line 32
}
#line 32
# 471 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$CompareB4$setEventFromNow(uint16_t x)
#line 471
{
#line 471
MSP430TimerM$TBCCR4 = TBR + x;
}
# 32 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void TimerJiffyAsyncM$AlarmCompare$setEventFromNow(uint16_t arg_0x408d5830){
#line 32
MSP430TimerM$CompareB4$setEventFromNow(arg_0x408d5830);
#line 32
}
#line 32
# 449 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$BackoffTimerJiffy$fired(void)
#line 449
{
uint8_t currentstate;
/* atomic removed: atomic calls only */
#line 451
currentstate = CC2420RadioM$stateRadio;
switch (CC2420RadioM$stateTimer) {
case CC2420RadioM$TIMER_INITIAL:
if (!TOS_post(CC2420RadioM$startSend)) {
CC2420RadioM$sendFailed();
}
break;
case CC2420RadioM$TIMER_BACKOFF:
CC2420RadioM$tryToSend();
break;
case CC2420RadioM$TIMER_ACK:
if (currentstate == CC2420RadioM$POST_TX_STATE) {
/* atomic removed: atomic calls only */
{
CC2420RadioM$txbufptr->ack = 0;
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_ACK_STATE;
}
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
}
#line 476
break;
}
return SUCCESS;
}
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t TimerJiffyAsyncM$TimerJiffyAsync$fired(void){
#line 12
unsigned char result;
#line 12
#line 12
result = CC2420RadioM$BackoffTimerJiffy$fired();
#line 12
#line 12
return result;
#line 12
}
#line 12
# 41 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static inline void TimerJiffyAsyncM$AlarmCompare$fired(void)
{
if (TimerJiffyAsyncM$jiffy < 0xFFFF) {
TimerJiffyAsyncM$AlarmControl$disableEvents();
TimerJiffyAsyncM$bSet = FALSE;
TimerJiffyAsyncM$TimerJiffyAsync$fired();
}
else {
TimerJiffyAsyncM$jiffy = TimerJiffyAsyncM$jiffy - 0xFFFF;
if (TimerJiffyAsyncM$jiffy > 0xFFFF) {
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(0xFFFF);
}
else
#line 52
{
/* atomic removed: atomic calls only */
#line 53
{
if (TimerJiffyAsyncM$jiffy > 2) {
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(TimerJiffyAsyncM$jiffy);
}
else {
#line 61
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(2);
}
}
}
TimerJiffyAsyncM$AlarmControl$clearPendingInterrupt();
TimerJiffyAsyncM$AlarmControl$enableEvents();
}
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB4$fired(void){
#line 34
TimerJiffyAsyncM$AlarmCompare$fired();
#line 34
}
#line 34
# 721 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t length, uint8_t *data)
#line 721
{
CC2420RadioM$tryToSend();
return SUCCESS;
}
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t HPLCC2420M$HPLCC2420FIFO$TXFIFODone(uint8_t arg_0x40dcddb0, uint8_t *arg_0x40dcc010){
#line 50
unsigned char result;
#line 50
#line 50
result = CC2420RadioM$HPLChipconFIFO$TXFIFODone(arg_0x40dcddb0, arg_0x40dcc010);
#line 50
#line 50
return result;
#line 50
}
#line 50
# 394 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline void HPLCC2420M$signalTXFIFO(void)
#line 394
{
uint8_t _txlen;
uint8_t *_txbuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 398
{
_txlen = HPLCC2420M$txlen;
_txbuf = HPLCC2420M$txbuf;
HPLCC2420M$f.txbufBusy = FALSE;
}
#line 402
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$HPLCC2420FIFO$TXFIFODone(_txlen, _txbuf);
}
# 38 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
inline static result_t HPLCC2420M$BusArbitration$releaseBus(void){
#line 38
unsigned char result;
#line 38
#line 38
result = BusArbitrationM$BusArbitration$releaseBus(0U);
#line 38
#line 38
return result;
#line 38
}
#line 38
# 432 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTControl$isTxEmpty(void)
#line 432
{
if (HPLUSART0M$U0TCTL & 0x01) {
return SUCCESS;
}
return FAIL;
}
# 191 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLCC2420M$USARTControl$isTxEmpty(void){
#line 191
unsigned char result;
#line 191
#line 191
result = HPLUSART0M$USARTControl$isTxEmpty();
#line 191
#line 191
return result;
#line 191
}
#line 191
#line 180
inline static result_t HPLCC2420M$USARTControl$isTxIntrPending(void){
#line 180
unsigned char result;
#line 180
#line 180
result = HPLUSART0M$USARTControl$isTxIntrPending();
#line 180
#line 180
return result;
#line 180
}
#line 180
# 473 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTControl$tx(uint8_t data)
#line 473
{
HPLUSART0M$U0TXBUF = data;
return SUCCESS;
}
# 202 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLCC2420M$USARTControl$tx(uint8_t arg_0x40e95850){
#line 202
unsigned char result;
#line 202
#line 202
result = HPLUSART0M$USARTControl$tx(arg_0x40e95850);
#line 202
#line 202
return result;
#line 202
}
#line 202
inline static uint8_t HPLCC2420M$USARTControl$rx(void){
#line 209
unsigned char result;
#line 209
#line 209
result = HPLUSART0M$USARTControl$rx();
#line 209
#line 209
return result;
#line 209
}
#line 209
# 17 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline void TOSH_CLR_RADIO_CSN_PIN(void)
#line 17
{
#line 17
static volatile uint8_t r __asm ("0x001D");
#line 17
r &= ~(1 << 2);
}
# 37 "/opt/tinyos-1.x/tos/platform/telos/BusArbitration.nc"
inline static result_t HPLCC2420M$BusArbitration$getBus(void){
#line 37
unsigned char result;
#line 37
#line 37
result = BusArbitrationM$BusArbitration$getBus(0U);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 415 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t length, uint8_t *data)
#line 415
{
uint8_t i = 0;
bool returnFail = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 419
{
if (HPLCC2420M$f.txbufBusy) {
returnFail = TRUE;
}
else {
#line 423
HPLCC2420M$f.txbufBusy = TRUE;
}
}
#line 425
__nesc_atomic_end(__nesc_atomic); }
if (returnFail) {
return FAIL;
}
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 430
{
HPLCC2420M$f.busy = TRUE;
HPLCC2420M$txlen = length;
HPLCC2420M$txbuf = data;
}
#line 434
__nesc_atomic_end(__nesc_atomic); }
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(0x3E);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
for (i = 0; i < HPLCC2420M$txlen; i++) {
HPLCC2420M$USARTControl$tx(HPLCC2420M$txbuf[i]);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
}
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxEmpty()) ;
TOSH_SET_RADIO_CSN_PIN();
HPLCC2420M$BusArbitration$releaseBus();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 448
HPLCC2420M$f.busy = FALSE;
#line 448
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 451
HPLCC2420M$f.txbufBusy = FALSE;
#line 451
__nesc_atomic_end(__nesc_atomic); }
return FAIL;
}
if (TOS_post(HPLCC2420M$signalTXFIFO) == FAIL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 455
HPLCC2420M$f.txbufBusy = FALSE;
#line 455
__nesc_atomic_end(__nesc_atomic); }
return FAIL;
}
return SUCCESS;
}
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t CC2420RadioM$HPLChipconFIFO$writeTXFIFO(uint8_t arg_0x40d9cec0, uint8_t *arg_0x40dcd088){
#line 29
unsigned char result;
#line 29
#line 29
result = HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(arg_0x40d9cec0, arg_0x40dcd088);
#line 29
#line 29
return result;
#line 29
}
#line 29
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint16_t CC2420RadioM$HPLChipcon$read(uint8_t arg_0x40da30b0){
#line 61
unsigned int result;
#line 61
#line 61
result = HPLCC2420M$HPLCC2420$read(arg_0x40da30b0);
#line 61
#line 61
return result;
#line 61
}
#line 61
# 222 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port10$edge(bool l2h)
#line 222
{
/* atomic removed: atomic calls only */
#line 223
{
if (l2h) {
#line 224
P1IES &= ~(1 << 0);
}
else {
#line 225
P1IES |= 1 << 0;
}
}
}
# 54 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOPInterrupt$edge(bool arg_0x40f36350){
#line 54
MSP430InterruptM$Port10$edge(arg_0x40f36350);
#line 54
}
#line 54
# 115 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port10$enable(void)
#line 115
{
#line 115
MSP430InterruptM$P1IE |= 1 << 0;
}
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOPInterrupt$enable(void){
#line 30
MSP430InterruptM$Port10$enable();
#line 30
}
#line 30
# 25 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline uint8_t TOSH_READ_RADIO_CCA_PIN(void)
#line 25
{
#line 25
static volatile uint8_t r __asm ("0x0020");
#line 25
return r & (1 << 4);
}
# 751 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr m)
#line 751
{
return (CC2420RadioM$Random$rand() & 0x3F) + 1;
}
# 75 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
inline static int16_t CC2420RadioM$MacBackoff$congestionBackoff(TOS_MsgPtr arg_0x40d99e78){
#line 75
int result;
#line 75
#line 75
result = CC2420RadioM$MacBackoff$default$congestionBackoff(arg_0x40d99e78);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 136 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setBackoffTimer(uint16_t jiffy)
#line 136
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_BACKOFF;
if (jiffy == 0) {
return CC2420RadioM$BackoffTimerJiffy$setOneShot(2);
}
#line 141
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420RadioM$HPLChipcon$cmd(uint8_t arg_0x40da54b0){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420$cmd(arg_0x40da54b0);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 321 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$sendPacket(void)
#line 321
{
uint8_t status;
CC2420RadioM$HPLChipcon$cmd(0x05);
status = CC2420RadioM$HPLChipcon$cmd(0x00);
if ((status >> 3) & 0x01) {
CC2420RadioM$SFD$enableCapture(TRUE);
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
CC2420RadioM$stateRadio = CC2420RadioM$PRE_TX_STATE;
#line 332
__nesc_atomic_end(__nesc_atomic); }
if (!CC2420RadioM$setBackoffTimer(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10)) {
CC2420RadioM$sendFailed();
}
}
}
# 352 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB5$getControl(void)
#line 352
{
#line 352
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL5);
}
#line 343
static inline void MSP430TimerM$CaptureB5$default$captured(uint16_t time)
#line 343
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB5$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB5$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 448 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB5$getEvent(void)
#line 448
{
#line 448
return MSP430TimerM$TBCCR5;
}
# 342 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline void RealTimeM$enqueue(uint8_t value)
#line 342
{
if (RealTimeM$queue_tail == NUM_TIMERS - 1) {
RealTimeM$queue_tail = -1;
}
RealTimeM$queue_tail++;
RealTimeM$queue_size++;
RealTimeM$queue[(uint8_t )RealTimeM$queue_tail] = value;
}
# 43 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
inline static result_t RealTimeM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b50150){
#line 43
unsigned char result;
#line 43
#line 43
result = TimeSyncM$GlobalTime$getGlobalTime(arg_0x40b50150);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 387 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline void RealTimeM$updateTimer(void)
#line 387
{
int32_t i = 0;
if (RealTimeM$syncMode == FTSP_SYNC) {
RealTimeM$GlobalTime$getGlobalTime(&RealTimeM$globaltime_t);
RealTimeM$globaltime_t = RealTimeM$globaltime_t % HOUR_END;
}
if (RealTimeM$mState) {
for (i = 0; i < RealTimeM$numClients; i++) {
if (RealTimeM$mState & (0x1L << RealTimeM$clientList[i].id)) {
if (RealTimeM$clientList[i].fireCount <= RealTimeM$globaltime_t && RealTimeM$globaltime_t - RealTimeM$clientList[i].fireCount < HOUR_END >> 1) {
if (TRUE != RealTimeM$taskBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 408
RealTimeM$taskBusy = TOS_post(RealTimeM$signalOneTimer);
#line 408
__nesc_atomic_end(__nesc_atomic); }
}
if (RealTimeM$clientList[i].type == TIMER_REPEAT) {
do {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 412
RealTimeM$clientList[i].fireCount += RealTimeM$clientList[i].syncInterval;
#line 412
__nesc_atomic_end(__nesc_atomic); }
}
while (
#line 413
RealTimeM$clientList[i].fireCount <= RealTimeM$globaltime_t);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 415
RealTimeM$clientList[i].fireCount %= HOUR_END;
#line 415
__nesc_atomic_end(__nesc_atomic); }
}
else
#line 416
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 417
RealTimeM$mState &= ~(0x1L << RealTimeM$clientList[i].id);
#line 417
__nesc_atomic_end(__nesc_atomic); }
}
RealTimeM$enqueue(RealTimeM$clientList[i].id);
}
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 424
RealTimeM$timerBusy = FALSE;
#line 424
__nesc_atomic_end(__nesc_atomic); }
}
static inline void RealTimeM$MSP430Compare$fired(void)
#line 436
{
/* atomic removed: atomic calls only */
{
RealTimeM$MSP430Compare$setEventFromNow(66);
RealTimeM$MSP430TimerControl$clearPendingInterrupt();
RealTimeM$MSP430TimerControl$enableEvents();
++RealTimeM$localTime;
}
if (RealTimeM$localTime >= DAY_END) {
RealTimeM$localTime -= DAY_END;
}
if (RealTimeM$timerBusy == FALSE) {
if (TOS_post(RealTimeM$updateTimer) == SUCCESS) {
RealTimeM$timerBusy = TRUE;
}
}
return;
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB5$fired(void){
#line 34
RealTimeM$MSP430Compare$fired();
#line 34
}
#line 34
# 354 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline uint8_t RealTimeM$dequeue(void)
#line 354
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 355
{
if (RealTimeM$queue_size == 0) {
{
unsigned char __nesc_temp =
#line 357
NUM_TIMERS;
{
#line 357
__nesc_atomic_end(__nesc_atomic);
#line 357
return __nesc_temp;
}
}
}
else
#line 359
{
if (RealTimeM$queue_head == NUM_TIMERS - 1) {
RealTimeM$queue_head = -1;
}
RealTimeM$queue_head++;
RealTimeM$queue_size--;
{
unsigned char __nesc_temp =
#line 365
RealTimeM$queue[(uint8_t )RealTimeM$queue_head];
{
#line 365
__nesc_atomic_end(__nesc_atomic);
#line 365
return __nesc_temp;
}
}
}
}
#line 369
__nesc_atomic_end(__nesc_atomic); }
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t ADCM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = LedsC$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 182 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static inline result_t ADCM$ADC$getData(uint8_t port)
{
bool oldBusy;
#line 186
if (port >= ADCM$TOSH_ADC_PORTMAPSIZE) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 189
{
oldBusy = ADCM$busy;
ADCM$busy = TRUE;
}
#line 192
__nesc_atomic_end(__nesc_atomic); }
ADCM$adc_count[port] += 1;
if (port == 0) {
if (TOS_post(ADCM$readADCTask) == FAIL) {
ADCM$Leds$yellowToggle();
}
}
else {
#line 199
if (port == 1) {
if (TOS_post(ADCM$readLightTask) == FAIL) {
ADCM$Leds$yellowToggle();
}
}
}
#line 204
return SUCCESS;
}
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
inline static result_t SmartSensingM$ADC$getData(uint8_t arg_0x40a7cd80){
#line 52
unsigned char result;
#line 52
#line 52
result = ADCM$ADC$getData(arg_0x40a7cd80);
#line 52
#line 52
return result;
#line 52
}
#line 52
# 39 "/home/xu/oasis/interfaces/RealTime.nc"
inline static uint32_t SmartSensingM$RealTime$getTimeCount(void){
#line 39
unsigned long result;
#line 39
#line 39
result = RealTimeM$RealTime$getTimeCount();
#line 39
#line 39
return result;
#line 39
}
#line 39
# 861 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline bool SmartSensingM$needSample(uint8_t client)
#line 861
{
SenBlkPtr p = NULL;
#line 863
if (0 != sensor[client].samplingRate) {
sensor[client].timerCount += SmartSensingM$timerInterval;
if (sensor[client].timerCount >= sensor[client].samplingRate) {
sensor[client].timerCount = 0;
}
else {
return FALSE;
}
}
else {
return FALSE;
}
if (NULL != (p = sensor[client].curBlkPtr)) {
if (0 == p->time) {
p->time = SmartSensingM$RealTime$getTimeCount();
p->interval = sensor[client].samplingRate;
p->type = sensor[client].type;
}
return TRUE;
}
else {
if (NULL != (sensor[client].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(client))) {
p = sensor[client].curBlkPtr;
p->time = SmartSensingM$RealTime$getTimeCount();
p->interval = sensor[client].samplingRate;
p->type = sensor[client].type;
return TRUE;
}
else {
;
return FALSE;
}
}
}
static inline void SmartSensingM$trySample(void)
#line 909
{
uint8_t client;
#line 911
for (client = 0; client < sensor_num; client++) {
if (FALSE != SmartSensingM$needSample(client)) {
SmartSensingM$ADC$getData((uint8_t )client);
}
}
return;
}
#line 620
static inline result_t SmartSensingM$SensingTimer$fired(void)
#line 620
{
if (TRUE != SmartSensingM$initedClock) {
SmartSensingM$initedClock = TRUE;
SmartSensingM$SensingTimer$start(TIMER_REPEAT, SmartSensingM$timerInterval);
}
else {
SmartSensingM$trySample();
}
return SUCCESS;
}
# 508 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline result_t RealTimeM$Timer$default$fired(uint8_t id)
#line 508
{
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t RealTimeM$Timer$fired(uint8_t arg_0x40b35650){
#line 73
unsigned char result;
#line 73
#line 73
switch (arg_0x40b35650) {
#line 73
case 0U:
#line 73
result = SmartSensingM$SensingTimer$fired();
#line 73
break;
#line 73
default:
#line 73
result = RealTimeM$Timer$default$fired(arg_0x40b35650);
#line 73
break;
#line 73
}
#line 73
#line 73
return result;
#line 73
}
#line 73
# 89 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$configureAdcPin(uint8_t inputChannel)
{
if (inputChannel <= 7) {
P6SEL |= 1 << inputChannel;
P6DIR &= ~(1 << inputChannel);
}
}
static inline result_t MSP430ADC12M$ADCSingle$bind(uint8_t num, MSP430ADC12Settings_t settings)
{
result_t res = FAIL;
adc12memctl_t memctl = { .inch = settings.inputChannel,
.sref = settings.referenceVoltage,
.eos = 0 };
if (num >= 5U) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
if (MSP430ADC12M$cmode == ADC_IDLE || MSP430ADC12M$owner != num) {
MSP430ADC12M$configureAdcPin(settings.inputChannel);
MSP430ADC12M$adc12settings[num].refVolt2_5 = settings.refVolt2_5;
MSP430ADC12M$adc12settings[num].gotRefVolt = 0;
MSP430ADC12M$adc12settings[num].clockSourceSHT = settings.clockSourceSHT;
MSP430ADC12M$adc12settings[num].clockSourceSAMPCON = settings.clockSourceSAMPCON;
MSP430ADC12M$adc12settings[num].clockDivSAMPCON = settings.clockDivSAMPCON;
MSP430ADC12M$adc12settings[num].clockDivSHT = settings.clockDivSHT;
MSP430ADC12M$adc12settings[num].sampleHoldTime = settings.sampleHoldTime;
MSP430ADC12M$adc12settings[num].memctl = memctl;
res = SUCCESS;
}
}
#line 121
__nesc_atomic_end(__nesc_atomic); }
return res;
}
# 50 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
inline static result_t ADCM$MSP430ADC12Single$bind(MSP430ADC12Settings_t arg_0x4133e958){
#line 50
unsigned char result;
#line 50
#line 50
result = MSP430ADC12M$ADCSingle$bind(0U, arg_0x4133e958);
#line 50
#line 50
return result;
#line 50
}
#line 50
# 340 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline msp430ADCresult_t MSP430ADC12M$ADCSingle$getData(uint8_t num)
{
return MSP430ADC12M$newRequest(SINGLE_CHANNEL, num, 0, 1, 0);
}
# 65 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
inline static msp430ADCresult_t ADCM$MSP430ADC12Single$getData(void){
#line 65
enum __nesc_unnamed4259 result;
#line 65
#line 65
result = MSP430ADC12M$ADCSingle$getData(0U);
#line 65
#line 65
return result;
#line 65
}
#line 65
# 240 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline RefVolt_t RefVoltM$RefVolt$getState(void)
#line 240
{
if (RefVoltM$state == RefVoltM$REFERENCE_2_5V_STABLE) {
return REFERENCE_2_5V;
}
#line 243
if (RefVoltM$state == RefVoltM$REFERENCE_1_5V_STABLE) {
return REFERENCE_1_5V;
}
#line 245
return REFERENCE_UNSTABLE;
}
# 118 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
inline static RefVolt_t MSP430ADC12M$RefVolt$getState(void){
#line 118
enum __nesc_unnamed4305 result;
#line 118
#line 118
result = RefVoltM$RefVolt$getState();
#line 118
#line 118
return result;
#line 118
}
#line 118
#line 93
inline static result_t MSP430ADC12M$RefVolt$get(RefVolt_t arg_0x413e2cf8){
#line 93
unsigned char result;
#line 93
#line 93
result = RefVoltM$RefVolt$get(arg_0x413e2cf8);
#line 93
#line 93
return result;
#line 93
}
#line 93
# 130 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline msp430ADCresult_t MSP430ADC12M$getRefVolt(uint8_t num)
{
msp430ADCresult_t adcResult = MSP430ADC12_SUCCESS;
result_t vrefResult;
adc12memctl_t memctl = MSP430ADC12M$adc12settings[num].memctl;
if (memctl.sref == REFERENCE_VREFplus_AVss ||
memctl.sref == REFERENCE_VREFplus_VREFnegterm)
{
if (MSP430ADC12M$adc12settings[num].gotRefVolt == 0) {
if (MSP430ADC12M$adc12settings[num].refVolt2_5) {
vrefResult = MSP430ADC12M$RefVolt$get(REFERENCE_2_5V);
}
else {
#line 143
vrefResult = MSP430ADC12M$RefVolt$get(REFERENCE_1_5V);
}
}
else {
#line 145
vrefResult = SUCCESS;
}
#line 146
if (vrefResult != SUCCESS)
{
adcResult = MSP430ADC12_FAIL;
}
else
#line 149
{
MSP430ADC12M$adc12settings[num].gotRefVolt = 1;
if (MSP430ADC12M$RefVolt$getState() == REFERENCE_UNSTABLE) {
adcResult = MSP430ADC12_DELAYED;
}
}
}
#line 155
return adcResult;
}
# 28 "/opt/tinyos-1.x/tos/platform/msp430/TimerMilli.nc"
inline static result_t RefVoltM$SwitchOnTimer$setOneShot(int32_t arg_0x40c2c340){
#line 28
unsigned char result;
#line 28
#line 28
result = TimerM$TimerMilli$setOneShot(0U, arg_0x40c2c340);
#line 28
#line 28
return result;
#line 28
}
#line 28
# 162 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$switchOnDelay(void)
#line 162
{
RefVoltM$SwitchOnTimer$setOneShot(17);
}
# 141 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setRef2_5V(void)
#line 141
{
#line 141
HPLADC12M$ADC12CTL0 |= 0x0040;
}
# 76 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void RefVoltM$HPLADC12$setRef2_5V(void){
#line 76
HPLADC12M$HPLADC12$setRef2_5V();
#line 76
}
#line 76
# 140 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setRef1_5V(void)
#line 140
{
#line 140
HPLADC12M$ADC12CTL0 &= ~0x0040;
}
# 75 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void RefVoltM$HPLADC12$setRef1_5V(void){
#line 75
HPLADC12M$HPLADC12$setRef1_5V();
#line 75
}
#line 75
# 137 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setRefOn(void)
#line 137
{
#line 137
HPLADC12M$ADC12CTL0 |= 0x0020;
}
# 72 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void RefVoltM$HPLADC12$setRefOn(void){
#line 72
HPLADC12M$HPLADC12$setRefOn();
#line 72
}
#line 72
# 140 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static __inline void RefVoltM$switchRefOn(uint8_t vref)
#line 140
{
RefVoltM$HPLADC12$disableConversion();
RefVoltM$HPLADC12$setRefOn();
if (vref == REFERENCE_1_5V) {
RefVoltM$HPLADC12$setRef1_5V();
/* atomic removed: atomic calls only */
#line 145
RefVoltM$state = RefVoltM$REFERENCE_1_5V_PENDING;
}
else {
RefVoltM$HPLADC12$setRef2_5V();
/* atomic removed: atomic calls only */
#line 149
RefVoltM$state = RefVoltM$REFERENCE_2_5V_PENDING;
}
TOS_post(RefVoltM$switchOnDelay);
}
static __inline void RefVoltM$switchToRefPending(uint8_t vref)
#line 154
{
RefVoltM$switchRefOn(vref);
}
static __inline void RefVoltM$switchToRefStable(uint8_t vref)
#line 158
{
RefVoltM$switchRefOn(vref);
}
# 58 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setControl0_IgnoreRef(adc12ctl0_t control0)
#line 58
{
adc12ctl0_t oldControl0 = * (adc12ctl0_t *)&HPLADC12M$ADC12CTL0;
#line 60
control0.refon = oldControl0.refon;
control0.r2_5v = oldControl0.r2_5v;
HPLADC12M$ADC12CTL0 = * (uint16_t *)&control0;
}
# 48 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$setControl0_IgnoreRef(adc12ctl0_t arg_0x413fa010){
#line 48
HPLADC12M$HPLADC12$setControl0_IgnoreRef(arg_0x413fa010);
#line 48
}
#line 48
# 144 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setSHT(uint8_t sht)
#line 144
{
uint16_t ctl0 = HPLADC12M$ADC12CTL0;
uint16_t shttemp = sht & 0x0F;
#line 147
ctl0 &= 0x00FF;
ctl0 |= shttemp << 8;
ctl0 |= shttemp << 12;
HPLADC12M$ADC12CTL0 = ctl0;
}
# 69 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$setSHT(uint8_t arg_0x413f6688){
#line 69
HPLADC12M$HPLADC12$setSHT(arg_0x413f6688);
#line 69
}
#line 69
# 54 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$setControl1(adc12ctl1_t control1)
#line 54
{
HPLADC12M$ADC12CTL1 = * (uint16_t *)&control1;
}
# 43 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$setControl1(adc12ctl1_t arg_0x413fc4e8){
#line 43
HPLADC12M$HPLADC12$setControl1(arg_0x413fc4e8);
#line 43
}
#line 43
# 179 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$TimerA$clear(void)
#line 179
{
#line 179
MSP430TimerM$TA0CTL |= 0x0004;
}
# 37 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430ADC12M$TimerA$clear(void){
#line 37
MSP430TimerM$TimerA$clear();
#line 37
}
#line 37
# 182 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$TimerA$disableEvents(void)
#line 182
{
#line 182
MSP430TimerM$TA0CTL &= ~0x0002;
}
# 38 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430ADC12M$TimerA$disableEvents(void){
#line 38
MSP430TimerM$TimerA$disableEvents();
#line 38
}
#line 38
# 185 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$TimerA$setClockSource(uint16_t clockSource)
{
MSP430TimerM$TA0CTL = (MSP430TimerM$TA0CTL & ~(0x0100 | 0x0200)) | ((clockSource << 8) & (0x0100 | 0x0200));
}
# 39 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430ADC12M$TimerA$setClockSource(uint16_t arg_0x408b88a8){
#line 39
MSP430TimerM$TimerA$setClockSource(arg_0x408b88a8);
#line 39
}
#line 39
# 195 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$TimerA$setInputDivider(uint16_t inputDivider)
{
MSP430TimerM$TA0CTL = (MSP430TimerM$TA0CTL & ~((1 << 6) | (3 << 6))) | ((inputDivider << 8) & ((1 << 6) | (3 << 6)));
}
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430ADC12M$TimerA$setInputDivider(uint16_t arg_0x408b8d60){
#line 40
MSP430TimerM$TimerA$setInputDivider(arg_0x408b8d60);
#line 40
}
#line 40
# 217 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$ControlA0$setControl(MSP430TimerM$CC_t x)
#line 217
{
#line 217
MSP430TimerM$TA0CCTL0 = MSP430TimerM$CC2int(x);
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerControl.nc"
inline static void MSP430ADC12M$ControlA0$setControl(MSP430CompareControl_t arg_0x408c29a8){
#line 34
MSP430TimerM$ControlA0$setControl(arg_0x408c29a8);
#line 34
}
#line 34
# 257 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$CompareA0$setEvent(uint16_t x)
#line 257
{
#line 257
MSP430TimerM$TA0CCR0 = x;
}
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430ADC12M$CompareA0$setEvent(uint16_t arg_0x408d6eb0){
#line 30
MSP430TimerM$CompareA0$setEvent(arg_0x408d6eb0);
#line 30
}
#line 30
# 258 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline void MSP430TimerM$CompareA1$setEvent(uint16_t x)
#line 258
{
#line 258
MSP430TimerM$TA0CCR1 = x;
}
# 30 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430ADC12M$CompareA1$setEvent(uint16_t arg_0x408d6eb0){
#line 30
MSP430TimerM$CompareA1$setEvent(arg_0x408d6eb0);
#line 30
}
#line 30
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t ADCM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = LedsC$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
#line 81
inline static result_t ADCM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = LedsC$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 353 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline MSP430TimerM$CC_t MSP430TimerM$ControlB6$getControl(void)
#line 353
{
#line 353
return MSP430TimerM$int2CC(MSP430TimerM$TBCCTL6);
}
#line 344
static inline void MSP430TimerM$CaptureB6$default$captured(uint16_t time)
#line 344
{
}
# 74 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Capture.nc"
inline static void MSP430TimerM$CaptureB6$captured(uint16_t arg_0x408cb858){
#line 74
MSP430TimerM$CaptureB6$default$captured(arg_0x408cb858);
#line 74
}
#line 74
# 449 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static inline uint16_t MSP430TimerM$CaptureB6$getEvent(void)
#line 449
{
#line 449
return MSP430TimerM$TBCCR6;
}
#line 337
static inline void MSP430TimerM$CompareB6$default$fired(void)
#line 337
{
}
# 34 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Compare.nc"
inline static void MSP430TimerM$CompareB6$fired(void){
#line 34
MSP430TimerM$CompareB6$default$fired();
#line 34
}
#line 34
# 75 "/opt/tinyos-1.x/tos/platform/msp430/MSP430DCOCalibM.nc"
static inline void MSP430DCOCalibM$Timer32khz$overflow(void)
{
}
# 512 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static inline void RealTimeM$MSP430Timer$overflow(void)
#line 512
{
return;
}
# 266 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static inline void TimerM$checkLongTimers(void)
{
uint8_t head = TimerM$m_head_long;
#line 269
TimerM$m_head_long = TimerM$EMPTY_LIST;
TimerM$executeTimers(head);
TimerM$setNextShortEvent();
}
#line 313
static inline void TimerM$AlarmTimer$overflow(void)
{
/* atomic removed: atomic calls only */
#line 315
TimerM$m_hinow++;
TOS_post(TimerM$checkLongTimers);
}
# 33 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Timer.nc"
inline static void MSP430TimerM$TimerB$overflow(void){
#line 33
TimerM$AlarmTimer$overflow();
#line 33
RealTimeM$MSP430Timer$overflow();
#line 33
MSP430DCOCalibM$Timer32khz$overflow();
#line 33
}
#line 33
# 488 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTData$default$rxDone(uint8_t data)
#line 488
{
#line 488
return SUCCESS;
}
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
inline static result_t HPLUSART0M$USARTData$rxDone(uint8_t arg_0x40ee6c40){
#line 53
unsigned char result;
#line 53
#line 53
result = HPLUSART0M$USARTData$default$rxDone(arg_0x40ee6c40);
#line 53
#line 53
return result;
#line 53
}
#line 53
# 70 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline void HPLUSART0M$HPLI2CInterrupt$default$fired(void)
#line 70
{
}
# 43 "/opt/tinyos-1.x/tos/platform/msp430/HPLI2CInterrupt.nc"
inline static void HPLUSART0M$HPLI2CInterrupt$fired(void){
#line 43
HPLUSART0M$HPLI2CInterrupt$default$fired();
#line 43
}
#line 43
# 486 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static inline result_t HPLUSART0M$USARTData$default$txDone(void)
#line 486
{
#line 486
return SUCCESS;
}
# 46 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
inline static result_t HPLUSART0M$USARTData$txDone(void){
#line 46
unsigned char result;
#line 46
#line 46
result = HPLUSART0M$USARTData$default$txDone();
#line 46
#line 46
return result;
#line 46
}
#line 46
# 177 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port10$clear(void)
#line 177
{
#line 177
MSP430InterruptM$P1IFG &= ~(1 << 0);
}
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOPInterrupt$clear(void){
#line 40
MSP430InterruptM$Port10$clear();
#line 40
}
#line 40
# 146 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port10$disable(void)
#line 146
{
#line 146
MSP430InterruptM$P1IE &= ~(1 << 0);
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOPInterrupt$disable(void){
#line 35
MSP430InterruptM$Port10$disable();
#line 35
}
#line 35
# 59 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420RadioM$FIFOP$disable(void){
#line 59
unsigned char result;
#line 59
#line 59
result = HPLCC2420InterruptM$FIFOP$disable();
#line 59
#line 59
return result;
#line 59
}
#line 59
# 536 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$delayedRXFIFOtask(void)
#line 536
{
CC2420RadioM$delayedRXFIFO();
}
# 28 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline uint8_t TOSH_READ_CC_FIFO_PIN(void)
#line 28
{
#line 28
static volatile uint8_t r __asm ("0x0020");
#line 28
return r & (1 << 3);
}
# 104 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void)
{
/* atomic removed: atomic calls only */
#line 106
{
TimerJiffyAsyncM$bSet = FALSE;
TimerJiffyAsyncM$AlarmControl$disableEvents();
}
return SUCCESS;
}
# 8 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t CC2420RadioM$BackoffTimerJiffy$stop(void){
#line 8
unsigned char result;
#line 8
#line 8
result = TimerJiffyAsyncM$TimerJiffyAsync$stop();
#line 8
#line 8
return result;
#line 8
}
#line 8
# 97 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static inline bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void)
{
bool _isSet;
/* atomic removed: atomic calls only */
#line 100
_isSet = TimerJiffyAsyncM$bSet;
return _isSet;
}
# 10 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static bool CC2420RadioM$BackoffTimerJiffy$isSet(void){
#line 10
unsigned char result;
#line 10
#line 10
result = TimerJiffyAsyncM$TimerJiffyAsync$isSet();
#line 10
#line 10
return result;
#line 10
}
#line 10
# 591 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$FIFOP$fired(void)
#line 591
{
if (CC2420RadioM$bAckEnable && CC2420RadioM$stateRadio == CC2420RadioM$PRE_TX_STATE) {
if (CC2420RadioM$BackoffTimerJiffy$isSet()) {
CC2420RadioM$BackoffTimerJiffy$stop();
CC2420RadioM$BackoffTimerJiffy$setOneShot(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10 + 75);
}
}
if (!TOSH_READ_CC_FIFO_PIN()) {
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
/* atomic removed: atomic calls only */
{
if (TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$FIFOP$disable();
}
else {
CC2420RadioM$flushRXFIFO();
}
}
return SUCCESS;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420InterruptM$FIFOP$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420RadioM$FIFOP$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 89 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline void HPLCC2420InterruptM$FIFOPInterrupt$fired(void)
#line 89
{
result_t val = SUCCESS;
#line 91
HPLCC2420InterruptM$FIFOPInterrupt$clear();
val = HPLCC2420InterruptM$FIFOP$fired();
if (val == FAIL) {
HPLCC2420InterruptM$FIFOPInterrupt$disable();
HPLCC2420InterruptM$FIFOPInterrupt$clear();
}
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port10$fired(void){
#line 59
HPLCC2420InterruptM$FIFOPInterrupt$fired();
#line 59
}
#line 59
# 27 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static inline uint8_t TOSH_READ_CC_FIFOP_PIN(void)
#line 27
{
#line 27
static volatile uint8_t r __asm ("0x0020");
#line 27
return r & (1 << 0);
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t GenericCommProM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = LedsC$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 398 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr msg)
#line 398
{
GenericCommProM$radioRecvActive = TRUE;
GenericCommProM$Leds$yellowToggle();
return GenericCommProM$received(msg);
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr CC2420RadioM$Receive$receive(TOS_MsgPtr arg_0x40bd2280){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = GenericCommProM$RadioReceive$receive(arg_0x40bd2280);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 153 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$PacketRcvd(void)
#line 153
{
TOS_MsgPtr pBuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 156
{
pBuf = CC2420RadioM$rxbufptr;
}
#line 158
__nesc_atomic_end(__nesc_atomic); }
pBuf = CC2420RadioM$Receive$receive((TOS_MsgPtr )pBuf);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 160
{
if (pBuf) {
#line 161
CC2420RadioM$rxbufptr = pBuf;
}
#line 162
CC2420RadioM$rxbufptr->length = 0;
CC2420RadioM$bPacketReceiving = FALSE;
}
#line 164
__nesc_atomic_end(__nesc_atomic); }
}
# 23 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline uint16_t fromLSB16(uint16_t a)
{
return is_host_lsb() ? a : (a << 8) | (a >> 8);
}
# 628 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t length, uint8_t *data)
#line 628
{
uint8_t currentstate;
#line 635
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 635
{
currentstate = CC2420RadioM$stateRadio;
}
#line 637
__nesc_atomic_end(__nesc_atomic); }
if (((
#line 641
!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN())
|| length == 0) || length > MSG_DATA_SIZE) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 644
CC2420RadioM$bPacketReceiving = FALSE;
#line 644
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr = (TOS_MsgPtr )data;
if (
#line 651
CC2420RadioM$bAckEnable && currentstate == CC2420RadioM$POST_TX_STATE && (
CC2420RadioM$rxbufptr->fcfhi & 0x07) == 0x02 &&
CC2420RadioM$rxbufptr->dsn == CC2420RadioM$currentDSN &&
data[length - 1] >> 7 == 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 655
{
CC2420RadioM$txbufptr->ack = 1;
CC2420RadioM$txbufptr->strength = data[length - 2];
CC2420RadioM$txbufptr->lqi = data[length - 1] & 0x7F;
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_ACK_STATE;
CC2420RadioM$bPacketReceiving = FALSE;
}
#line 662
__nesc_atomic_end(__nesc_atomic); }
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
#line 665
return SUCCESS;
}
if ((CC2420RadioM$rxbufptr->fcfhi & 0x07) != 0x01 ||
CC2420RadioM$rxbufptr->fcflo != 0x08) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 674
CC2420RadioM$bPacketReceiving = FALSE;
#line 674
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr->length = CC2420RadioM$rxbufptr->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
if (CC2420RadioM$rxbufptr->length > 74) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 682
CC2420RadioM$bPacketReceiving = FALSE;
#line 682
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr->addr = fromLSB16(CC2420RadioM$rxbufptr->addr);
CC2420RadioM$rxbufptr->crc = data[length - 1] >> 7;
CC2420RadioM$rxbufptr->strength = data[length - 2];
CC2420RadioM$rxbufptr->lqi = data[length - 1] & 0x7F;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 696
{
if (!TOS_post(CC2420RadioM$PacketRcvd)) {
CC2420RadioM$bPacketReceiving = FALSE;
}
}
#line 700
__nesc_atomic_end(__nesc_atomic); }
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
if (!TOSH_READ_CC_FIFOP_PIN()) {
if (TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
return SUCCESS;
}
}
#line 711
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
# 39 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t HPLCC2420M$HPLCC2420FIFO$RXFIFODone(uint8_t arg_0x40dcd640, uint8_t *arg_0x40dcd7e8){
#line 39
unsigned char result;
#line 39
#line 39
result = CC2420RadioM$HPLChipconFIFO$RXFIFODone(arg_0x40dcd640, arg_0x40dcd7e8);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 322 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline void HPLCC2420M$signalRXFIFO(void)
#line 322
{
uint8_t _rxlen;
uint8_t *_rxbuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 326
{
_rxlen = HPLCC2420M$rxlen;
_rxbuf = HPLCC2420M$rxbuf;
HPLCC2420M$f.rxbufBusy = FALSE;
}
#line 330
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$HPLCC2420FIFO$RXFIFODone(_rxlen, _rxbuf);
}
# 185 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTControl.nc"
inline static result_t HPLCC2420M$USARTControl$isRxIntrPending(void){
#line 185
unsigned char result;
#line 185
#line 185
result = HPLUSART0M$USARTControl$isRxIntrPending();
#line 185
#line 185
return result;
#line 185
}
#line 185
# 335 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static inline result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t length, uint8_t *data)
#line 335
{
uint8_t i;
bool returnFail = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 339
{
if (HPLCC2420M$f.rxbufBusy) {
returnFail = TRUE;
}
else {
#line 343
HPLCC2420M$f.rxbufBusy = TRUE;
}
}
#line 345
__nesc_atomic_end(__nesc_atomic); }
if (returnFail) {
return FAIL;
}
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 350
{
HPLCC2420M$f.busy = TRUE;
HPLCC2420M$rxbuf = data;
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(0x3F | 0x40);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
HPLCC2420M$rxlen = HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(0);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
HPLCC2420M$rxlen = HPLCC2420M$USARTControl$rx();
}
#line 364
__nesc_atomic_end(__nesc_atomic); }
if (HPLCC2420M$rxlen > 0) {
HPLCC2420M$rxbuf[0] = HPLCC2420M$rxlen;
HPLCC2420M$rxlen++;
if (HPLCC2420M$rxlen > length) {
#line 370
HPLCC2420M$rxlen = length;
}
#line 371
for (i = 1; i < HPLCC2420M$rxlen; i++) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 372
{
HPLCC2420M$USARTControl$tx(0);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
HPLCC2420M$rxbuf[i] = HPLCC2420M$USARTControl$rx();
}
#line 376
__nesc_atomic_end(__nesc_atomic); }
}
}
TOSH_SET_RADIO_CSN_PIN();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 380
HPLCC2420M$f.busy = FALSE;
#line 380
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$BusArbitration$releaseBus();
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 384
HPLCC2420M$f.rxbufBusy = FALSE;
#line 384
__nesc_atomic_end(__nesc_atomic); }
return FAIL;
}
if (TOS_post(HPLCC2420M$signalRXFIFO) == FAIL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 388
HPLCC2420M$f.rxbufBusy = FALSE;
#line 388
__nesc_atomic_end(__nesc_atomic); }
return FAIL;
}
return SUCCESS;
}
# 19 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t CC2420RadioM$HPLChipconFIFO$readRXFIFO(uint8_t arg_0x40d9c6a8, uint8_t *arg_0x40d9c850){
#line 19
unsigned char result;
#line 19
#line 19
result = HPLCC2420M$HPLCC2420FIFO$readRXFIFO(arg_0x40d9c6a8, arg_0x40d9c850);
#line 19
#line 19
return result;
#line 19
}
#line 19
# 82 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline void NeighborMgmtM$processSnoopMsg(void)
#line 82
{
uint8_t iNbr;
#line 84
iNbr = NeighborMgmtM$findPreparedIndex(NeighborMgmtM$linkaddrBuf);
if (NeighborMgmtM$NeighborTbl[iNbr].flags & NBRFLAG_NEW) {
NeighborMgmtM$NeighborTbl[iNbr].linkEst = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].flags ^= NBRFLAG_NEW;
}
else {
if (NeighborMgmtM$NeighborTbl[iNbr].flags & NBRFLAG_JUST_UPDATED) {
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].flags ^= NBRFLAG_JUST_UPDATED;
}
else {
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate * 0.75 + NeighborMgmtM$lqiBuf * 0.25;
}
}
NeighborMgmtM$NeighborTbl[iNbr].lqi_raw = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].rssi_raw = NeighborMgmtM$rssiBuf;
NeighborMgmtM$NeighborTbl[iNbr].liveliness = LIVELINESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 105
NeighborMgmtM$processTaskBusy = FALSE;
#line 105
__nesc_atomic_end(__nesc_atomic); }
}
#line 107
static inline result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr msg, void *payload, uint16_t payloadLen)
#line 107
{
if (!NeighborMgmtM$processTaskBusy) {
NeighborMgmtM$lqiBuf = msg->lqi;
NeighborMgmtM$rssiBuf = msg->strength;
NeighborMgmtM$nwMsg = (NetworkMsg *)msg->data;
NeighborMgmtM$linkaddrBuf = NeighborMgmtM$nwMsg->linksource;
if (TOS_post(NeighborMgmtM$processSnoopMsg) == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 117
NeighborMgmtM$processTaskBusy = TRUE;
#line 117
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t GenericCommProM$Intercept$intercept(TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0){
#line 86
unsigned char result;
#line 86
#line 86
result = NeighborMgmtM$Snoop$intercept(arg_0x40ca3b88, arg_0x40ca3d28, arg_0x40ca3ec0);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 159 "/opt/tinyos-1.x/tos/system/tos.h"
static inline void *nmemset(void *to, int val, size_t n)
{
char *cto = to;
while (n--) * cto++ = val;
return to;
}
# 66 "/home/xu/oasis/lib/SNMS/Event.h"
static inline uint8_t *eventprintf(const uint8_t *format, ...)
#line 66
{
uint8_t *buf = gTempEventBuf;
uint8_t format_flag;
uint16_t u_val = 0;
#line 70
uint16_t base;
uint8_t *ptr;
va_list ap;
nmemset(gTempEventBuf, 0, sizeof gTempEventBuf);
buf[0] = '\0';
__builtin_stdarg_start(ap, format);
for (; ; ) {
while ((format_flag = * format++) != '%') {
if (!format_flag) {
__builtin_va_end(ap);
return gTempEventBuf;
}
*buf = format_flag;
#line 87
buf++;
#line 87
*buf = 0;
}
switch ((format_flag = * format++)) {
case 'c':
format_flag = (__builtin_va_arg(ap, int ));
default:
*buf = format_flag;
#line 94
buf++;
#line 94
*buf = 0;
continue;
case 'S':
case 's':
ptr = (__builtin_va_arg(ap, char *));
strcat(buf, ptr);
continue;
case 'o':
base = 8;
*buf = '0';
#line 103
buf++;
#line 103
*buf = 0;
goto CONVERSION_LOOP;
case 'i':
if ((int16_t )u_val < 0) {
u_val = -u_val;
*buf = '-';
#line 108
buf++;
#line 108
*buf = 0;
}
case 'u':
base = 10;
goto CONVERSION_LOOP;
case 'x':
base = 16;
CONVERSION_LOOP:
u_val = (__builtin_va_arg(ap, int ));
ptr = gTempScratch + 16;
* --ptr = 0;
do {
char ch = u_val % base + '0';
#line 123
if (ch > '9') {
ch += 'a' - '9' - 1;
}
#line 125
* --ptr = ch;
u_val /= base;
}
while (
#line 127
u_val);
strcat(buf, ptr);
buf += strlen(ptr);
}
}
}
# 312 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level)
#line 312
{
NetworkMsg *NMsg = (NetworkMsg *)msg->data;
#line 314
NMsg->qos = 7;
}
#line 187
static inline uint8_t EventReportM$EventReport$eventSend(uint8_t eventType, uint8_t type,
uint8_t level,
uint8_t *content)
{
uint16_t len;
uint16_t maxLen;
result_t result = SUCCESS;
ApplicationMsg *pApp;
EventMsg *pEvent;
TOS_MsgPtr msgPtr;
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 200
{
if (EventReportM$gLevelMode[type] >= level) {
if (NULL != (msgPtr = allocBuffer(&EventReportM$buffQueue))) {
EventReportM$assignPriority(msgPtr, level);
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(msgPtr, &maxLen);
maxLen = maxLen - (size_t )& ((ApplicationMsg *)0)->data - (size_t )& ((EventMsg *)0)->data;
pEvent = (EventMsg *)pApp->data;
len = strlen(content);
if (len > maxLen) {
len = maxLen;
}
pEvent->length = len;
pEvent->type = type;
pEvent->level = level;
nmemcpy(pEvent->data, content, pEvent->length);
pApp->type = TYPE_SNMS_EVENT;
pApp->length = (size_t )& ((EventMsg *)0)->data + len;
pApp->seqno = EventReportM$seqno++;
result = insertElement(&EventReportM$sendQueue, msgPtr);
EventReportM$tryNextSend();
{
unsigned char __nesc_temp =
#line 230
result;
{
#line 230
__nesc_atomic_end(__nesc_atomic);
#line 230
return __nesc_temp;
}
}
}
else
#line 232
{
{
unsigned char __nesc_temp =
#line 234
BUFFER_FAIL;
{
#line 234
__nesc_atomic_end(__nesc_atomic);
#line 234
return __nesc_temp;
}
}
}
}
else
#line 237
{
;
{
unsigned char __nesc_temp =
#line 239
FILTER_FAIL;
{
#line 239
__nesc_atomic_end(__nesc_atomic);
#line 239
return __nesc_temp;
}
}
}
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
}
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t MultiHopLQI$EventReport$eventSend(uint8_t arg_0x40a2ca80, uint8_t arg_0x40a2cc18, uint8_t *arg_0x40a2cdd0){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x40a2ca80, arg_0x40a2cc18, arg_0x40a2cdd0);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 15 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$setCost(uint16_t arg_0x4121d7d8, uint16_t arg_0x4121d968){
#line 15
unsigned char result;
#line 15
#line 15
result = NeighborMgmtM$NeighborCtrl$setCost(arg_0x4121d7d8, arg_0x4121d968);
#line 15
#line 15
return result;
#line 15
}
#line 15
# 430 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr Msg)
#line 430
{
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
BeaconMsg *pRP = (BeaconMsg *)&pNWMsg->data[0];
uint16_t oldParent = 0;
#line 435
MultiHopLQI$receivedBeacon = TRUE;
if (pNWMsg->linksource != pNWMsg->source ||
pRP->parent != pRP->parent_dup) {
return Msg;
}
if (MultiHopLQI$localBeSink) {
#line 442
return Msg;
}
if (pNWMsg->linksource == MultiHopLQI$gbCurrentParent) {
if (pRP->parent != TOS_LOCAL_ADDRESS) {
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParentCost = pRP->cost;
MultiHopLQI$gbCurrentLinkEst = MultiHopLQI$adjustLQI(Msg->lqi);
MultiHopLQI$gbLinkQuality = Msg->lqi;
MultiHopLQI$gbCurrentHopCount = pRP->hopcount + 1;
if (pRP->parent == TOS_BCAST_ADDR) {
goto invalidate;
}
else {
#line 459
MultiHopLQI$NeighborCtrl$setCost(pNWMsg->source, pRP->cost);
}
}
else
#line 461
{
if (!MultiHopLQI$localBeSink) {
invalidate:
;
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
TOS_post(MultiHopLQI$SendRouteTask);
}
}
}
else
#line 480
{
MultiHopLQI$NeighborCtrl$setCost(pNWMsg->source, pRP->cost);
if (MultiHopLQI$fixedParent) {
#line 490
return Msg;
}
if (
#line 493
(uint32_t )pRP->cost + (uint32_t )MultiHopLQI$adjustLQI(Msg->lqi)
<
(uint32_t )MultiHopLQI$gbCurrentParentCost + (uint32_t )MultiHopLQI$gbCurrentLinkEst - ((
(uint32_t )MultiHopLQI$gbCurrentParentCost + (uint32_t )MultiHopLQI$gbCurrentLinkEst) >> 2)
&&
pRP->parent != TOS_LOCAL_ADDRESS) {
oldParent = MultiHopLQI$gbCurrentParent;
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParent = pNWMsg->linksource;
MultiHopLQI$gbCurrentParentCost = pRP->cost;
MultiHopLQI$gbCurrentLinkEst = MultiHopLQI$adjustLQI(Msg->lqi);
MultiHopLQI$gbLinkQuality = Msg->lqi;
MultiHopLQI$gbCurrentHopCount = pRP->hopcount + 1;
MultiHopLQI$NeighborCtrl$setParent(MultiHopLQI$gbCurrentParent);
if (oldParent == TOS_BCAST_ADDR) {
MultiHopLQI$MultihopCtrl$readyToSend();
TOS_post(MultiHopLQI$SendRouteTask);
}
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_MEDIUM,
eventprintf("parent:%i", MultiHopLQI$gbCurrentParent));
}
}
return Msg;
}
# 627 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Intercept$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen)
#line 629
{
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t MultiHopEngineM$Intercept$intercept(uint8_t arg_0x414e1e20, TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopEngineM$Intercept$default$intercept(arg_0x414e1e20, arg_0x40ca3b88, arg_0x40ca3d28, arg_0x40ca3ec0);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 509 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable)
#line 509
{
TOS_MsgPtr oldMsg;
NetworkMsg *checkingMsg;
NetworkMsg *passedMsg = (NetworkMsg *)msg->data;
uint16_t ind;
Queue_t *queue = &MultiHopEngineM$sendQueue;
#line 515
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].obj != NULL) {
oldMsg = queue->element[ind].obj;
checkingMsg = (NetworkMsg *)oldMsg->data;
if (checkingMsg->source == passedMsg->source &&
checkingMsg->seqno == passedMsg->seqno) {
if (disable == TRUE) {
}
return FAIL;
}
}
}
return SUCCESS;
}
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$addChild(uint16_t arg_0x412209c8, uint16_t arg_0x41220b60, bool arg_0x41220cf0){
#line 7
unsigned char result;
#line 7
#line 7
result = NeighborMgmtM$NeighborCtrl$addChild(arg_0x412209c8, arg_0x41220b60, arg_0x41220cf0);
#line 7
#line 7
return result;
#line 7
}
#line 7
# 558 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect)
#line 558
{
return MultiHopLQI$NeighborCtrl$addChild(childAddr, priorHop, isDirect);
}
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopEngineM$MultihopCtrl$addChild(uint16_t arg_0x41231718, uint16_t arg_0x412318b0, bool arg_0x41231a40){
#line 4
unsigned char result;
#line 4
#line 4
result = MultiHopLQI$MultihopCtrl$addChild(arg_0x41231718, arg_0x412318b0, arg_0x41231a40);
#line 4
#line 4
return result;
#line 4
}
#line 4
# 633 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Snoop$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen)
#line 635
{
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t MultiHopEngineM$Snoop$intercept(uint8_t arg_0x414e0420, TOS_MsgPtr arg_0x40ca3b88, void *arg_0x40ca3d28, uint16_t arg_0x40ca3ec0){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopEngineM$Snoop$default$intercept(arg_0x414e0420, arg_0x40ca3b88, arg_0x40ca3d28, arg_0x40ca3ec0);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 409 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr msg)
#line 409
{
NetworkMsg *multiHopMsg = (NetworkMsg *)msg->data;
uint16_t correctedLength = msg->length - (size_t )& ((NetworkMsg *)0)->data;
uint8_t AMID = msg->type;
#line 413
;
if (msg->length < MultiHopEngineM$NETWORKMSG_HEADER_LENGTH ||
msg->length > 74) {
return msg;
}
#line 417
if (msg->addr != TOS_LOCAL_ADDRESS) {
MultiHopEngineM$Snoop$intercept(AMID, msg,
&multiHopMsg->data[0],
correctedLength);
}
else {
if (multiHopMsg->source == multiHopMsg->linksource) {
MultiHopEngineM$MultihopCtrl$addChild(multiHopMsg->source, multiHopMsg->linksource, TRUE);
}
else {
#line 428
MultiHopEngineM$MultihopCtrl$addChild(multiHopMsg->source, multiHopMsg->linksource, FALSE);
}
if (MultiHopEngineM$checkForDuplicates(msg, FALSE) == SUCCESS) {
if (MultiHopEngineM$Intercept$intercept(AMID, msg, &multiHopMsg->data[0], correctedLength) == SUCCESS) {
if (MultiHopEngineM$insertAndStartSend(msg, AMID, msg->length, NULL) != SUCCESS) {
MultiHopEngineM$numberOfSendFailures++;
;
}
else {
;
}
}
else
#line 440
{
;
}
}
else
#line 443
{
;
}
}
return msg;
}
# 873 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$TimeSyncNotify$default$msg_received(void)
#line 873
{
}
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
inline static void TimeSyncM$TimeSyncNotify$msg_received(void){
#line 20
TimeSyncM$TimeSyncNotify$default$msg_received();
#line 20
}
#line 20
# 40 "/home/xu/oasis/interfaces/RealTime.nc"
inline static result_t TimeSyncM$RealTime$setTimeCount(uint32_t arg_0x40ab48c8, uint8_t arg_0x40ab4a50){
#line 40
unsigned char result;
#line 40
#line 40
result = RealTimeM$RealTime$setTimeCount(arg_0x40ab48c8, arg_0x40ab4a50);
#line 40
#line 40
return result;
#line 40
}
#line 40
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 248 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$calculateConversion(void)
{
float newSkew = TimeSyncM$skew;
uint32_t newLocalAverage;
int32_t newOffsetAverage;
int64_t localSum;
int64_t offsetSum;
int8_t i;
for (i = 0; i < TimeSyncM$MAX_ENTRIES && TimeSyncM$table[i].state != TimeSyncM$ENTRY_FULL; ++i)
;
if (i >= TimeSyncM$MAX_ENTRIES) {
return;
}
newLocalAverage = TimeSyncM$table[i].localTime;
newOffsetAverage = TimeSyncM$table[i].timeOffset;
localSum = 0;
offsetSum = 0;
while (++i < TimeSyncM$MAX_ENTRIES) {
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_FULL) {
localSum += (int32_t )(TimeSyncM$table[i].localTime - newLocalAverage) / TimeSyncM$tableEntries;
offsetSum += (int32_t )(TimeSyncM$table[i].timeOffset - newOffsetAverage) / TimeSyncM$tableEntries;
}
}
newLocalAverage += localSum;
newOffsetAverage += offsetSum;
localSum = offsetSum = 0;
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_FULL) {
int32_t a = TimeSyncM$table[i].localTime - newLocalAverage;
int32_t b = TimeSyncM$table[i].timeOffset - newOffsetAverage;
localSum += (int64_t )a * a;
offsetSum += (int64_t )a * b;
}
}
if (localSum != 0) {
newSkew = (float )offsetSum / (float )localSum;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
TimeSyncM$skew = newSkew;
TimeSyncM$offsetAverage = newOffsetAverage;
TimeSyncM$localAverage = newLocalAverage;
TimeSyncM$numEntries = TimeSyncM$tableEntries;
}
#line 302
__nesc_atomic_end(__nesc_atomic); }
TimeSyncM$Leds$greenToggle();
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = NoLeds$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 318 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$addNewEntry(TimeSyncMsg *msg)
{
int8_t i;
#line 320
int8_t freeItem = -1;
#line 320
int8_t oldestItem = 0;
uint32_t age;
#line 321
uint32_t oldestTime = 0;
int32_t timeError;
TimeSyncM$tableEntries = 0;
timeError = msg->arrivalTime;
TimeSyncM$GlobalTime$local2Global(&timeError);
timeError -= msg->sendingTime;
if (timeError > TimeSyncM$ENTRY_THROWOUT_LIMIT || timeError < -TimeSyncM$ENTRY_THROWOUT_LIMIT) {
TimeSyncM$errTimes += 1;
if (TimeSyncM$errTimes >= TimeSyncM$ERROR_TIMES) {
TimeSyncM$clearTable();
TimeSyncM$alreadySetTime = 0;
}
else {
#line 337
return;
}
}
TimeSyncM$errTimes = 0;
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
++TimeSyncM$tableEntries;
age = msg->arrivalTime - TimeSyncM$table[i].localTime;
if (age >= 0x7FFFFFFFL) {
TimeSyncM$table[i].state = TimeSyncM$ENTRY_EMPTY;
}
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_EMPTY) {
--TimeSyncM$tableEntries;
freeItem = i;
}
if (age >= oldestTime) {
oldestTime = age;
oldestItem = i;
}
}
if (freeItem < 0) {
freeItem = oldestItem;
}
else {
++TimeSyncM$tableEntries;
}
TimeSyncM$table[freeItem].state = TimeSyncM$ENTRY_FULL;
TimeSyncM$table[freeItem].localTime = msg->arrivalTime;
TimeSyncM$table[freeItem].timeOffset = msg->sendingTime - msg->arrivalTime;
TimeSyncM$Leds$yellowToggle();
}
#line 417
static inline void TimeSyncM$processMsg(void)
{
TimeSyncMsg *msg = (TimeSyncMsg *)TimeSyncM$processedMsg->data;
#line 434
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS == msg->hasGPS) {
if (msg->rootID < ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && ~(TimeSyncM$heartBeats < TimeSyncM$IGNORE_ROOT_MSG && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS)) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = msg->rootID;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
TimeSyncM$rootid = msg->rootID;
}
else {
#line 440
if (msg->rootID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && (int8_t )(msg->seqNum - ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum) > 0 && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != 0xffff) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
}
else {
if (msg->rootID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff || ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS)) {
if (TimeSyncM$alreadySetTime == 0) {
if (TimeSyncM$RealTime$setTimeCount(1, FTSP_SYNC) == SUCCESS) {
TimeSyncM$alreadySetTime = 1;
}
}
goto exit;
}
else {
goto exit;
}
}
}
}
else {
#line 459
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS != TRUE && msg->hasGPS == TRUE) {
if (msg->rootID == TOS_LOCAL_ADDRESS) {
goto exit;
}
TimeSyncM$hasGPSValid++;
if (TimeSyncM$hasGPSValid >= TimeSyncM$GPS_VALID) {
TimeSyncM$hasGPSValid = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = msg->rootID;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = msg->rootID;
}
else {
goto exit;
}
}
else {
#line 476
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS == TRUE && msg->hasGPS != TRUE) {
if (msg->nodeID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
}
goto exit;
}
}
}
TimeSyncM$addNewEntry(msg);
TimeSyncM$calculateConversion();
if (TimeSyncM$numEntries > 0) {
if (TimeSyncM$alreadySetTime == 0) {
if (TimeSyncM$RealTime$setTimeCount(0, FTSP_SYNC) == SUCCESS) {
TimeSyncM$alreadySetTime = 1;
TimeSyncM$clearTable();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 493
{
TimeSyncM$skew = 0.0;
TimeSyncM$offsetAverage = 0;
TimeSyncM$localAverage = 0;
}
#line 497
__nesc_atomic_end(__nesc_atomic); }
}
}
}
TimeSyncM$TimeSyncNotify$msg_received();
exit:
TimeSyncM$state &= ~TimeSyncM$STATE_PROCESSING;
}
# 138 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr ourMessage,
uint32_t *timeStamp)
#line 139
{
TimeSyncMsg *newMessage = (TimeSyncMsg *)ourMessage->data;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 144
{
if (ourMessage == ClockTimeStampingM$rcv_message) {
newMessage->arrivalTime = ClockTimeStampingM$rcv_time;
{
unsigned char __nesc_temp =
#line 150
SUCCESS;
{
#line 150
__nesc_atomic_end(__nesc_atomic);
#line 150
return __nesc_temp;
}
}
}
else
#line 151
{
{
unsigned char __nesc_temp =
#line 152
FAIL;
{
#line 152
__nesc_atomic_end(__nesc_atomic);
#line 152
return __nesc_temp;
}
}
}
}
#line 156
__nesc_atomic_end(__nesc_atomic); }
}
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
inline static result_t TimeSyncM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40bcab20, uint32_t *arg_0x40bcacd8){
#line 39
unsigned char result;
#line 39
#line 39
result = ClockTimeStampingM$TimeStamping$getStamp(arg_0x40bcab20, arg_0x40bcacd8);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 509 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr p)
#line 509
{
TOS_MsgPtr old;
TimeSyncMsg *newMessage = (TimeSyncMsg *)p->data;
#line 526
if (TimeSyncM$mode == TS_USER_MODE) {
return p;
}
if (
#line 535
TimeSyncM$TimeStamping$getStamp(p,
& newMessage->arrivalTime) != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 537
TimeSyncM$missedReceiveStamps++;
#line 537
__nesc_atomic_end(__nesc_atomic); }
return p;
}
if (newMessage->wroteStamp != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 549
TimeSyncM$missedSendStamps++;
#line 549
__nesc_atomic_end(__nesc_atomic); }
return p;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 554
{
if (TimeSyncM$state & TimeSyncM$STATE_PROCESSING) {
{
struct TOS_Msg *__nesc_temp =
#line 556
p;
{
#line 556
__nesc_atomic_end(__nesc_atomic);
#line 556
return __nesc_temp;
}
}
}
else
#line 557
{
TimeSyncM$state |= TimeSyncM$STATE_PROCESSING;
}
}
#line 560
__nesc_atomic_end(__nesc_atomic); }
old = TimeSyncM$processedMsg;
TimeSyncM$processedMsg = p;
TOS_post(TimeSyncM$processMsg);
return old;
}
# 376 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(uint8_t id, TOS_MsgPtr msg)
#line 376
{
return msg;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr GenericCommProM$ReceiveMsg$receive(uint8_t arg_0x40cdd5b8, TOS_MsgPtr arg_0x40bd2280){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
switch (arg_0x40cdd5b8) {
#line 75
case AM_NETWORKMSG:
#line 75
result = MultiHopEngineM$ReceiveMsg$receive(arg_0x40bd2280);
#line 75
break;
#line 75
case AM_CASCTRLMSG:
#line 75
result = CascadesRouterM$ReceiveMsg$receive(AM_CASCTRLMSG, arg_0x40bd2280);
#line 75
break;
#line 75
case AM_CASCADESMSG:
#line 75
result = CascadesRouterM$ReceiveMsg$receive(AM_CASCADESMSG, arg_0x40bd2280);
#line 75
break;
#line 75
case AM_TIMESYNCMSG:
#line 75
result = TimeSyncM$ReceiveMsg$receive(arg_0x40bd2280);
#line 75
break;
#line 75
case AM_BEACONMSG:
#line 75
result = MultiHopLQI$ReceiveMsg$receive(arg_0x40bd2280);
#line 75
break;
#line 75
default:
#line 75
result = GenericCommProM$ReceiveMsg$default$receive(arg_0x40cdd5b8, arg_0x40bd2280);
#line 75
break;
#line 75
}
#line 75
#line 75
return result;
#line 75
}
#line 75
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t RealTimeM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = NoLeds$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
#line 106
inline static result_t RealTimeM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 389 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$CascadeControl$addDirectChild(address_t childID)
#line 389
{
CascadesRouterM$addToChildrenList(childID);
return SUCCESS;
}
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$addDirectChild(address_t arg_0x41544d38){
#line 3
unsigned char result;
#line 3
#line 3
result = CascadesRouterM$CascadeControl$addDirectChild(arg_0x41544d38);
#line 3
#line 3
return result;
#line 3
}
#line 3
#line 2
inline static uint16_t CascadesRouterM$CascadeControl$getParent(void){
#line 2
unsigned int result;
#line 2
#line 2
result = NeighborMgmtM$CascadeControl$getParent();
#line 2
#line 2
return result;
#line 2
}
#line 2
# 932 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr)
#line 932
{
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
uint16_t seq = CCMsg->dataSeq;
if (CCMsg->linkSource != CascadesRouterM$CascadeControl$getParent()) {
return;
}
if (seq > CascadesRouterM$expectingSeq) {
CascadesRouterM$expectingSeq = seq;
}
else {
if (seq < 10 && CascadesRouterM$expectingSeq > 65530UL) {
CascadesRouterM$expectingSeq = seq;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 950
CascadesRouterM$activeRT = FALSE;
#line 950
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$RTTimer$stop();
return;
}
#line 900
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr)
#line 900
{
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
address_t linkSource = CCMsg->linkSource;
uint8_t localIndex = 0;
#line 904
if (CCMsg->parent != TOS_LOCAL_ADDRESS) {
CascadesRouterM$delFromChildrenList(linkSource);
}
else {
CascadesRouterM$addToChildrenList(linkSource);
localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq);
if (localIndex != INVALID_INDEX) {
CascadesRouterM$addChildACK(linkSource, localIndex);
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
}
else {
}
}
else
{
}
}
return;
}
#line 859
static inline void CascadesRouterM$processRequest(void)
#line 859
{
TOS_MsgPtr tempPtr = NULL;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)CascadesRouterM$RecvRequestMsg.data;
address_t linkSource = CCMsg->linkSource;
uint8_t localIndex = 0;
if (CCMsg->parent != TOS_LOCAL_ADDRESS) {
CascadesRouterM$delFromChildrenList(linkSource);
}
else {
CascadesRouterM$addToChildrenList(linkSource);
localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq);
if (INVALID_INDEX == localIndex) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 874
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 874
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_NODATA);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 879
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 879
__nesc_atomic_end(__nesc_atomic); }
}
}
}
if (CascadesRouterM$inited == TRUE) {
tempPtr = & CascadesRouterM$myBuffer[0].tmsg;
CascadesRouterM$produceDataMsg(tempPtr);
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCADESMSG, tempPtr, tempPtr->length)) {
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 891
CascadesRouterM$RequestProcessBusy = FALSE;
#line 891
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ACKTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(10U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 818 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$processCMAu(void)
#line 818
{
TOS_MsgPtr tempPtr = NULL;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)CascadesRouterM$RecvCMAuMsg.data;
uint8_t i = 0;
uint8_t localIndex = 0;
uint16_t *dst;
#line 824
if (INVALID_INDEX != (localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq))) {
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
dst = (uint16_t *)CCMsg->data;
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (TOS_LOCAL_ADDRESS == *dst) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 833
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 833
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CCMsg->dataSeq, TYPE_CASCADES_ACK);
tempPtr->addr = CCMsg->linkSource;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 838
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 838
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
}
++dst;
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 847
CascadesRouterM$CMAuProcessBusy = FALSE;
#line 847
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ResetTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(8U);
#line 68
#line 68
return result;
#line 68
}
#line 68
#line 59
inline static result_t CascadesRouterM$DelayTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(9U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 1020 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline TOS_MsgPtr CascadesRouterM$Receive$default$receive(uint8_t type, TOS_MsgPtr pMsg,
void *payload, uint16_t payloadLen)
#line 1021
{
return pMsg;
}
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
inline static TOS_MsgPtr CascadesRouterM$Receive$receive(uint8_t arg_0x415502d0, TOS_MsgPtr arg_0x40a0f130, void *arg_0x40a0f2d0, uint16_t arg_0x40a0f468){
#line 81
struct TOS_Msg *result;
#line 81
#line 81
switch (arg_0x415502d0) {
#line 81
case NW_RPCC:
#line 81
result = RpcM$CommandReceive$receive(arg_0x40a0f130, arg_0x40a0f2d0, arg_0x40a0f468);
#line 81
break;
#line 81
default:
#line 81
result = CascadesRouterM$Receive$default$receive(arg_0x415502d0, arg_0x40a0f130, arg_0x40a0f2d0, arg_0x40a0f468);
#line 81
break;
#line 81
}
#line 81
#line 81
return result;
#line 81
}
#line 81
# 241 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$updateInData(void)
#line 241
{
CascadesRouterM$inData[(CascadesRouterM$highestSeq + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
CascadesRouterM$inData[(CascadesRouterM$highestSeq + 1 + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
CascadesRouterM$inData[(CascadesRouterM$highestSeq + 2 + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$RTTimer$start(char arg_0x40abfb28, uint32_t arg_0x40abfcc0){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(6U, arg_0x40abfb28, arg_0x40abfcc0);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t CascadesRouterM$DelayTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(9U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 278 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr)
#line 278
{
uint8_t i;
uint8_t j;
#line 281
for (i = 0; i < MAX_CAS_BUF; i++) {
if (CascadesRouterM$myBuffer[i].countDT == 0 && CascadesRouterM$myBuffer[i].signalDone == 1) {
nmemcpy((void *)& CascadesRouterM$myBuffer[i].tmsg, (void *)tmPtr, sizeof(TOS_Msg ));
CascadesRouterM$myBuffer[i].countDT = 1;
CascadesRouterM$myBuffer[i].retry = 0;
CascadesRouterM$myBuffer[i].signalDone = 0;
CascadesRouterM$inData[CascadesRouterM$getCasData(& CascadesRouterM$myBuffer[i].tmsg)->seqno % MAX_CAS_PACKETS] = TRUE;
CascadesRouterM$headIndex = i;
for (j = 0; j < MAX_NUM_CHILDREN; j++) {
CascadesRouterM$myBuffer[i].childrenList[j].status = 0;
}
return SUCCESS;
}
}
return FAIL;
}
#line 614
static inline uint32_t CascadesRouterM$crcByte(uint32_t crc, uint8_t b)
#line 614
{
uint8_t i = 8;
#line 616
crc ^= (uint32_t )b << 24UL;
do {
if ((crc & 0x80000000) != 0) {
crc = (crc << 1UL) ^ 0x04C11DB7;
}
else {
#line 621
crc = crc << 1UL;
}
}
while (
#line 623
--i != 0);
return crc;
}
static inline uint32_t CascadesRouterM$calculateCRC(uint8_t *start, uint8_t length)
#line 627
{
uint8_t i = 0;
uint32_t crc = 0xffffffff;
#line 630
for (i = 0; i < length; i++) {
crc = CascadesRouterM$crcByte(crc, *(start + i));
}
return crc;
}
static inline void CascadesRouterM$processData(void)
#line 640
{
TOS_MsgPtr tempPtr = NULL;
NetworkMsg *nwMsg = (NetworkMsg *)(&CascadesRouterM$RecvDataMsg)->data;
ApplicationMsg *appMsg = (ApplicationMsg *)nwMsg->data;
uint16_t seq = nwMsg->seqno;
uint8_t localIndex = 0;
if (CascadesRouterM$inData[seq % MAX_CAS_PACKETS] != TRUE) {
if (nwMsg->crc != CascadesRouterM$calculateCRC((uint8_t *)& nwMsg->seqno, appMsg->length + 6)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 649
CascadesRouterM$DataProcessBusy = FALSE;
#line 649
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (TRUE != CascadesRouterM$addIntoBuffer(&CascadesRouterM$RecvDataMsg)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 654
CascadesRouterM$DataProcessBusy = FALSE;
#line 654
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 659
localIndex = CascadesRouterM$headIndex;
#line 659
__nesc_atomic_end(__nesc_atomic); }
}
if (CascadesRouterM$delayTimerBusy == TRUE) {
if (CascadesRouterM$DelayTimer$stop()) {
CascadesRouterM$delayTimerBusy = FALSE;
}
}
if (seq > CascadesRouterM$highestSeq) {
if (CascadesRouterM$highestSeq < 10 && seq > 65530UL && CascadesRouterM$inited == TRUE) {
}
else
{
CascadesRouterM$highestSeq = seq;
}
}
else
{
if (seq < 10 && CascadesRouterM$highestSeq > 65530UL && CascadesRouterM$inited == TRUE) {
CascadesRouterM$highestSeq = seq;
}
else {
}
}
while (CascadesRouterM$inData[CascadesRouterM$expectingSeq % MAX_CAS_PACKETS]) {
++CascadesRouterM$expectingSeq;
}
if ((uint16_t )(CascadesRouterM$expectingSeq - CascadesRouterM$highestSeq) != 1) {
if (CascadesRouterM$inited != TRUE) {
CascadesRouterM$expectingSeq = seq + 1;
CascadesRouterM$nextSignalSeq = seq;
}
else
{
if (TRUE != CascadesRouterM$activeRT) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 705
CascadesRouterM$activeRT = TRUE;
#line 705
__nesc_atomic_end(__nesc_atomic); }
if (SUCCESS != CascadesRouterM$RTTimer$start(TIMER_REPEAT, CascadesRouterM$RTwait)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 707
CascadesRouterM$activeRT = FALSE;
#line 707
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
CascadesRouterM$updateInData();
if (CascadesRouterM$getCMAu(localIndex) != TRUE) {
if (TRUE != CascadesRouterM$DataTimerOn) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 719
CascadesRouterM$DataTimerOn = TRUE;
#line 719
__nesc_atomic_end(__nesc_atomic); }
if (SUCCESS != CascadesRouterM$DTTimer$start(TIMER_ONE_SHOT, MIN_INTERVAL + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 721
CascadesRouterM$DataTimerOn = FALSE;
#line 721
__nesc_atomic_end(__nesc_atomic); }
}
}
if (nwMsg->linksource == TOS_UART_ADDR && TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 725
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 725
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = TOS_UART_ADDR;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 730
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 730
__nesc_atomic_end(__nesc_atomic); }
}
}
}
else
{
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 740
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 740
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = CascadesRouterM$CascadeControl$getParent();
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 745
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 745
__nesc_atomic_end(__nesc_atomic); }
}
}
}
if (seq == CascadesRouterM$nextSignalSeq) {
if (CascadesRouterM$Receive$receive(nwMsg->type, &CascadesRouterM$RecvDataMsg, nwMsg->data,
CascadesRouterM$RecvDataMsg.length - (size_t )& ((NetworkMsg *)0)->data)) {
CascadesRouterM$nextSignalSeq++;
CascadesRouterM$myBuffer[localIndex].signalDone = 1;
if (CascadesRouterM$nextSignalSeq != CascadesRouterM$expectingSeq) {
if (CascadesRouterM$sigRcvTaskBusy != TRUE) {
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
}
}
}
else {
if (CascadesRouterM$delayTimerBusy != TRUE) {
CascadesRouterM$delayTimerBusy = CascadesRouterM$DelayTimer$start(TIMER_ONE_SHOT, 100UL);
}
}
}
else
{
if (CascadesRouterM$delayTimerBusy != TRUE) {
CascadesRouterM$delayTimerBusy = CascadesRouterM$DelayTimer$start(TIMER_ONE_SHOT, 200UL);
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 776
CascadesRouterM$resetCount = 0;
#line 776
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$ResetTimer$stop();
CascadesRouterM$ResetTimer$start(TIMER_ONE_SHOT, 60000UL);
CascadesRouterM$inited = TRUE;
}
else
{
localIndex = CascadesRouterM$findMsgIndex(seq);
if (localIndex != INVALID_INDEX) {
CascadesRouterM$addChildACK(nwMsg->linksource, localIndex);
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
if (nwMsg->linksource == TOS_UART_ADDR) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 793
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 793
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = TOS_UART_ADDR;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 798
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 798
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 805
CascadesRouterM$DataProcessBusy = FALSE;
#line 805
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 178 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port11$clear(void)
#line 178
{
#line 178
MSP430InterruptM$P1IFG &= ~(1 << 1);
}
#line 94
static inline void MSP430InterruptM$Port11$default$fired(void)
#line 94
{
#line 94
MSP430InterruptM$Port11$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port11$fired(void){
#line 59
MSP430InterruptM$Port11$default$fired();
#line 59
}
#line 59
# 179 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port12$clear(void)
#line 179
{
#line 179
MSP430InterruptM$P1IFG &= ~(1 << 2);
}
#line 95
static inline void MSP430InterruptM$Port12$default$fired(void)
#line 95
{
#line 95
MSP430InterruptM$Port12$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port12$fired(void){
#line 59
MSP430InterruptM$Port12$default$fired();
#line 59
}
#line 59
# 180 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port13$clear(void)
#line 180
{
#line 180
MSP430InterruptM$P1IFG &= ~(1 << 3);
}
# 40 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOInterrupt$clear(void){
#line 40
MSP430InterruptM$Port13$clear();
#line 40
}
#line 40
# 149 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port13$disable(void)
#line 149
{
#line 149
MSP430InterruptM$P1IE &= ~(1 << 3);
}
# 35 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void HPLCC2420InterruptM$FIFOInterrupt$disable(void){
#line 35
MSP430InterruptM$Port13$disable();
#line 35
}
#line 35
# 140 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline result_t HPLCC2420InterruptM$FIFO$default$fired(void)
#line 140
{
#line 140
return FAIL;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420InterruptM$FIFO$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = HPLCC2420InterruptM$FIFO$default$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 130 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline void HPLCC2420InterruptM$FIFOInterrupt$fired(void)
#line 130
{
result_t val = SUCCESS;
#line 132
HPLCC2420InterruptM$FIFOInterrupt$clear();
val = HPLCC2420InterruptM$FIFO$fired();
if (val == FAIL) {
HPLCC2420InterruptM$FIFOInterrupt$disable();
HPLCC2420InterruptM$FIFOInterrupt$clear();
}
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port13$fired(void){
#line 59
HPLCC2420InterruptM$FIFOInterrupt$fired();
#line 59
}
#line 59
# 312 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$default$startDone(void)
#line 312
{
return SUCCESS;
}
# 85 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$SplitControl$startDone(void){
#line 85
unsigned char result;
#line 85
#line 85
result = CC2420RadioM$SplitControl$default$startDone();
#line 85
#line 85
return result;
#line 85
}
#line 85
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420RadioM$FIFOP$startWait(bool arg_0x40dc68a0){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420InterruptM$FIFOP$startWait(arg_0x40dc68a0);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 343 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$RxMode(void)
#line 343
{
CC2420ControlM$HPLChipcon$cmd(0x03);
return SUCCESS;
}
# 163 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$RxMode(void){
#line 163
unsigned char result;
#line 163
#line 163
result = CC2420ControlM$CC2420Control$RxMode();
#line 163
#line 163
return result;
#line 163
}
#line 163
# 294 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$CC2420SplitControl$startDone(void)
#line 294
{
uint8_t chkstateRadio;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
chkstateRadio = CC2420RadioM$stateRadio;
#line 297
__nesc_atomic_end(__nesc_atomic); }
if (chkstateRadio == CC2420RadioM$WARMUP_STATE) {
CC2420RadioM$CC2420Control$RxMode();
CC2420RadioM$FIFOP$startWait(FALSE);
CC2420RadioM$SFD$enableCapture(TRUE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 306
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
#line 306
__nesc_atomic_end(__nesc_atomic); }
}
CC2420RadioM$SplitControl$startDone();
return SUCCESS;
}
# 85 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420ControlM$SplitControl$startDone(void){
#line 85
unsigned char result;
#line 85
#line 85
result = CC2420RadioM$CC2420SplitControl$startDone();
#line 85
#line 85
return result;
#line 85
}
#line 85
# 286 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t DesiredFreq)
#line 286
{
int fsctrl;
uint8_t status;
fsctrl = DesiredFreq - 2048;
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (CC2420ControlM$gCurrentParameters[CP_FSCTRL] & 0xfc00) | (fsctrl << 0);
status = CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
if (status & (1 << 6)) {
CC2420ControlM$HPLChipcon$cmd(0x03);
}
#line 297
return SUCCESS;
}
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t CC2420ControlM$HPLChipconRAM$write(uint16_t arg_0x40e23d00, uint8_t arg_0x40e23e88, uint8_t *arg_0x40e22068){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420RAM$write(arg_0x40e23d00, arg_0x40e23e88, arg_0x40e22068);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 432 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t addr)
#line 432
{
addr = toLSB16(addr);
return CC2420ControlM$HPLChipconRAM$write(0x16A, 2, (uint8_t *)&addr);
}
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint16_t CC2420ControlM$HPLChipcon$read(uint8_t arg_0x40da30b0){
#line 61
unsigned int result;
#line 61
#line 61
result = HPLCC2420M$HPLCC2420$read(arg_0x40da30b0);
#line 61
#line 61
return result;
#line 61
}
#line 61
# 80 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline bool CC2420ControlM$SetRegs(void)
#line 80
{
uint16_t data;
CC2420ControlM$HPLChipcon$write(0x10, CC2420ControlM$gCurrentParameters[CP_MAIN]);
CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
data = CC2420ControlM$HPLChipcon$read(0x11);
if (data != CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]) {
#line 86
return FALSE;
}
CC2420ControlM$HPLChipcon$write(0x12, CC2420ControlM$gCurrentParameters[CP_MDMCTRL1]);
CC2420ControlM$HPLChipcon$write(0x13, CC2420ControlM$gCurrentParameters[CP_RSSI]);
CC2420ControlM$HPLChipcon$write(0x14, CC2420ControlM$gCurrentParameters[CP_SYNCWORD]);
CC2420ControlM$HPLChipcon$write(0x15, CC2420ControlM$gCurrentParameters[CP_TXCTRL]);
CC2420ControlM$HPLChipcon$write(0x16, CC2420ControlM$gCurrentParameters[CP_RXCTRL0]);
CC2420ControlM$HPLChipcon$write(0x17, CC2420ControlM$gCurrentParameters[CP_RXCTRL1]);
CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
CC2420ControlM$HPLChipcon$write(0x19, CC2420ControlM$gCurrentParameters[CP_SECCTRL0]);
CC2420ControlM$HPLChipcon$write(0x1A, CC2420ControlM$gCurrentParameters[CP_SECCTRL1]);
CC2420ControlM$HPLChipcon$write(0x1C, CC2420ControlM$gCurrentParameters[CP_IOCFG0]);
CC2420ControlM$HPLChipcon$write(0x1D, CC2420ControlM$gCurrentParameters[CP_IOCFG1]);
CC2420ControlM$HPLChipcon$cmd(0x09);
CC2420ControlM$HPLChipcon$cmd(0x08);
return TRUE;
}
static inline void CC2420ControlM$PostOscillatorOn(void)
#line 116
{
CC2420ControlM$SetRegs();
CC2420ControlM$CC2420Control$setShortAddress(TOS_LOCAL_ADDRESS);
CC2420ControlM$CC2420Control$TuneManual(((CC2420ControlM$gCurrentParameters[CP_FSCTRL] << 0) & 0x1FF) + 2048);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 121
CC2420ControlM$state = CC2420ControlM$START_STATE_DONE;
#line 121
__nesc_atomic_end(__nesc_atomic); }
CC2420ControlM$SplitControl$startDone();
}
#line 445
static inline result_t CC2420ControlM$CCA$fired(void)
#line 445
{
CC2420ControlM$HPLChipcon$write(0x1D, 0);
TOS_post(CC2420ControlM$PostOscillatorOn);
return FAIL;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420InterruptM$CCA$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420ControlM$CCA$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 171 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static inline void HPLCC2420InterruptM$CCAInterrupt$fired(void)
#line 171
{
result_t val = SUCCESS;
#line 173
HPLCC2420InterruptM$CCAInterrupt$clear();
val = HPLCC2420InterruptM$CCA$fired();
if (val == FAIL) {
HPLCC2420InterruptM$CCAInterrupt$disable();
HPLCC2420InterruptM$CCAInterrupt$clear();
}
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port14$fired(void){
#line 59
HPLCC2420InterruptM$CCAInterrupt$fired();
#line 59
}
#line 59
# 182 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port15$clear(void)
#line 182
{
#line 182
MSP430InterruptM$P1IFG &= ~(1 << 5);
}
#line 98
static inline void MSP430InterruptM$Port15$default$fired(void)
#line 98
{
#line 98
MSP430InterruptM$Port15$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port15$fired(void){
#line 59
MSP430InterruptM$Port15$default$fired();
#line 59
}
#line 59
# 183 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port16$clear(void)
#line 183
{
#line 183
MSP430InterruptM$P1IFG &= ~(1 << 6);
}
#line 99
static inline void MSP430InterruptM$Port16$default$fired(void)
#line 99
{
#line 99
MSP430InterruptM$Port16$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port16$fired(void){
#line 59
MSP430InterruptM$Port16$default$fired();
#line 59
}
#line 59
# 184 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port17$clear(void)
#line 184
{
#line 184
MSP430InterruptM$P1IFG &= ~(1 << 7);
}
#line 100
static inline void MSP430InterruptM$Port17$default$fired(void)
#line 100
{
#line 100
MSP430InterruptM$Port17$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port17$fired(void){
#line 59
MSP430InterruptM$Port17$default$fired();
#line 59
}
#line 59
# 186 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port20$clear(void)
#line 186
{
#line 186
MSP430InterruptM$P2IFG &= ~(1 << 0);
}
#line 102
static inline void MSP430InterruptM$Port20$default$fired(void)
#line 102
{
#line 102
MSP430InterruptM$Port20$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port20$fired(void){
#line 59
MSP430InterruptM$Port20$default$fired();
#line 59
}
#line 59
# 187 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port21$clear(void)
#line 187
{
#line 187
MSP430InterruptM$P2IFG &= ~(1 << 1);
}
#line 103
static inline void MSP430InterruptM$Port21$default$fired(void)
#line 103
{
#line 103
MSP430InterruptM$Port21$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port21$fired(void){
#line 59
MSP430InterruptM$Port21$default$fired();
#line 59
}
#line 59
# 188 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port22$clear(void)
#line 188
{
#line 188
MSP430InterruptM$P2IFG &= ~(1 << 2);
}
#line 104
static inline void MSP430InterruptM$Port22$default$fired(void)
#line 104
{
#line 104
MSP430InterruptM$Port22$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port22$fired(void){
#line 59
MSP430InterruptM$Port22$default$fired();
#line 59
}
#line 59
# 189 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port23$clear(void)
#line 189
{
#line 189
MSP430InterruptM$P2IFG &= ~(1 << 3);
}
#line 105
static inline void MSP430InterruptM$Port23$default$fired(void)
#line 105
{
#line 105
MSP430InterruptM$Port23$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port23$fired(void){
#line 59
MSP430InterruptM$Port23$default$fired();
#line 59
}
#line 59
# 190 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port24$clear(void)
#line 190
{
#line 190
MSP430InterruptM$P2IFG &= ~(1 << 4);
}
#line 106
static inline void MSP430InterruptM$Port24$default$fired(void)
#line 106
{
#line 106
MSP430InterruptM$Port24$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port24$fired(void){
#line 59
MSP430InterruptM$Port24$default$fired();
#line 59
}
#line 59
# 191 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port25$clear(void)
#line 191
{
#line 191
MSP430InterruptM$P2IFG &= ~(1 << 5);
}
#line 107
static inline void MSP430InterruptM$Port25$default$fired(void)
#line 107
{
#line 107
MSP430InterruptM$Port25$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port25$fired(void){
#line 59
MSP430InterruptM$Port25$default$fired();
#line 59
}
#line 59
# 192 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port26$clear(void)
#line 192
{
#line 192
MSP430InterruptM$P2IFG &= ~(1 << 6);
}
#line 108
static inline void MSP430InterruptM$Port26$default$fired(void)
#line 108
{
#line 108
MSP430InterruptM$Port26$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port26$fired(void){
#line 59
MSP430InterruptM$Port26$default$fired();
#line 59
}
#line 59
# 193 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$Port27$clear(void)
#line 193
{
#line 193
MSP430InterruptM$P2IFG &= ~(1 << 7);
}
#line 109
static inline void MSP430InterruptM$Port27$default$fired(void)
#line 109
{
#line 109
MSP430InterruptM$Port27$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$Port27$fired(void){
#line 59
MSP430InterruptM$Port27$default$fired();
#line 59
}
#line 59
# 195 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$NMI$clear(void)
#line 195
{
#line 195
IFG1 &= ~(1 << 4);
}
#line 111
static inline void MSP430InterruptM$NMI$default$fired(void)
#line 111
{
#line 111
MSP430InterruptM$NMI$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$NMI$fired(void){
#line 59
MSP430InterruptM$NMI$default$fired();
#line 59
}
#line 59
# 196 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$OF$clear(void)
#line 196
{
#line 196
IFG1 &= ~(1 << 1);
}
#line 112
static inline void MSP430InterruptM$OF$default$fired(void)
#line 112
{
#line 112
MSP430InterruptM$OF$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$OF$fired(void){
#line 59
MSP430InterruptM$OF$default$fired();
#line 59
}
#line 59
# 197 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
static inline void MSP430InterruptM$ACCV$clear(void)
#line 197
{
#line 197
FCTL3 &= ~0x0004;
}
#line 113
static inline void MSP430InterruptM$ACCV$default$fired(void)
#line 113
{
#line 113
MSP430InterruptM$ACCV$clear();
}
# 59 "/opt/tinyos-1.x/tos/platform/msp430/MSP430Interrupt.nc"
inline static void MSP430InterruptM$ACCV$fired(void){
#line 59
MSP430InterruptM$ACCV$default$fired();
#line 59
}
#line 59
# 202 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline void FramerM$PacketUnknown(void)
#line 202
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 203
{
FramerM$gFlags |= FramerM$FLAGS_UNKNOWN;
}
#line 205
__nesc_atomic_end(__nesc_atomic); }
FramerM$StartTx();
}
# 381 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr packet)
#line 381
{
packet->group = TOS_AM_GROUP;
return GenericCommProM$received(packet);
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr FramerAckM$ReceiveCombined$receive(TOS_MsgPtr arg_0x40bd2280){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = GenericCommProM$UARTReceive$receive(arg_0x40bd2280);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 91 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
static inline TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr Msg)
#line 91
{
TOS_MsgPtr pBuf;
pBuf = FramerAckM$ReceiveCombined$receive(Msg);
return pBuf;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr FramerM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40bd2280){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = FramerAckM$ReceiveMsg$receive(arg_0x40bd2280);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 329 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t Token)
#line 329
{
result_t Result = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
{
if (!(FramerM$gFlags & FramerM$FLAGS_TOKENPEND)) {
FramerM$gFlags |= FramerM$FLAGS_TOKENPEND;
FramerM$gTxTokenBuf = Token;
}
else {
Result = FAIL;
}
}
#line 340
__nesc_atomic_end(__nesc_atomic); }
if (Result == SUCCESS) {
Result = FramerM$StartTx();
}
return Result;
}
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
inline static result_t FramerAckM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x41076710){
#line 88
unsigned char result;
#line 88
#line 88
result = FramerM$TokenReceiveMsg$ReflectToken(arg_0x41076710);
#line 88
#line 88
return result;
#line 88
}
#line 88
# 74 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
static inline void FramerAckM$SendAckTask(void)
#line 74
{
FramerAckM$TokenReceiveMsg$ReflectToken(FramerAckM$gTokenBuf);
}
static inline TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr Msg, uint8_t token)
#line 79
{
TOS_MsgPtr pBuf;
FramerAckM$gTokenBuf = token;
TOS_post(FramerAckM$SendAckTask);
pBuf = FramerAckM$ReceiveCombined$receive(Msg);
return pBuf;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
inline static TOS_MsgPtr FramerM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x41077eb0, uint8_t arg_0x41076068){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = FramerAckM$TokenReceiveMsg$receive(arg_0x41077eb0, arg_0x41076068);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 210 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline void FramerM$PacketRcvd(void)
#line 210
{
FramerM$MsgRcvEntry_t *pRcv = &FramerM$gMsgRcvTbl[FramerM$gRxTailIndex];
TOS_MsgPtr pBuf = pRcv->pMsg;
if (pRcv->Length >= (size_t )& ((TOS_Msg *)0)->data) {
switch (pRcv->Proto) {
case FramerM$PROTO_ACK:
break;
case FramerM$PROTO_PACKET_ACK:
pBuf->crc = 1;
pBuf = FramerM$TokenReceiveMsg$receive(pBuf, pRcv->Token);
break;
case FramerM$PROTO_PACKET_NOACK:
pBuf->crc = 1;
pBuf = FramerM$ReceiveMsg$receive(pBuf);
break;
default:
FramerM$gTxUnknownBuf = pRcv->Proto;
TOS_post(FramerM$PacketUnknown);
break;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 235
{
if (pBuf) {
pRcv->pMsg = pBuf;
}
pRcv->Length = 0;
pRcv->Token = 0;
FramerM$gRxTailIndex++;
FramerM$gRxTailIndex %= FramerM$HDLC_QUEUESIZE;
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
}
#line 349
static inline result_t FramerM$ByteComm$rxByteReady(uint8_t data, bool error, uint16_t strength)
#line 349
{
switch (FramerM$gRxState) {
case FramerM$RXSTATE_NOSYNC:
if (data == FramerM$HDLC_FLAG_BYTE && FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gRxState = FramerM$RXSTATE_PROTO;
}
break;
case FramerM$RXSTATE_PROTO:
if (data == FramerM$HDLC_FLAG_BYTE) {
break;
}
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Proto = data;
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, data);
switch (data) {
case FramerM$PROTO_PACKET_ACK:
FramerM$gRxState = FramerM$RXSTATE_TOKEN;
break;
case FramerM$PROTO_PACKET_NOACK:
FramerM$gRxState = FramerM$RXSTATE_INFO;
break;
default:
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
break;
}
break;
case FramerM$RXSTATE_TOKEN:
if (data == FramerM$HDLC_FLAG_BYTE) {
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
#line 385
if (data == FramerM$HDLC_CTLESC_BYTE) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0x20;
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token ^= data;
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token);
FramerM$gRxState = FramerM$RXSTATE_INFO;
}
}
#line 393
break;
case FramerM$RXSTATE_INFO:
if (FramerM$gRxByteCnt > FramerM$HDLC_MTU) {
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
#line 403
if (data == FramerM$HDLC_CTLESC_BYTE) {
FramerM$gRxState = FramerM$RXSTATE_ESC;
}
else {
#line 406
if (data == FramerM$HDLC_FLAG_BYTE) {
if (FramerM$gRxByteCnt >= 2) {
uint16_t usRcvdCRC = FramerM$gpRxBuf[FramerM$gRxByteCnt - 1] & 0xff;
#line 409
usRcvdCRC = (usRcvdCRC << 8) | (FramerM$gpRxBuf[FramerM$gRxByteCnt - 2] & 0xff);
if (usRcvdCRC == FramerM$gRxRunningCRC) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = FramerM$gRxByteCnt - 2;
TOS_post(FramerM$PacketRcvd);
FramerM$gRxHeadIndex++;
#line 413
FramerM$gRxHeadIndex %= FramerM$HDLC_QUEUESIZE;
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
}
if (FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gRxState = FramerM$RXSTATE_PROTO;
}
else {
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
}
else {
FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
if (FramerM$gRxByteCnt >= 2) {
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
}
FramerM$gRxByteCnt++;
}
}
}
#line 441
break;
case FramerM$RXSTATE_ESC:
if (data == FramerM$HDLC_FLAG_BYTE) {
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
data = data ^ 0x20;
FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
if (FramerM$gRxByteCnt >= 2) {
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
}
FramerM$gRxByteCnt++;
FramerM$gRxState = FramerM$RXSTATE_INFO;
}
break;
default:
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
break;
}
return SUCCESS;
}
# 66 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$rxByteReady(uint8_t arg_0x4106eb30, bool arg_0x4106ecb8, uint16_t arg_0x4106ee50){
#line 66
unsigned char result;
#line 66
#line 66
result = FramerM$ByteComm$rxByteReady(arg_0x4106eb30, arg_0x4106ecb8, arg_0x4106ee50);
#line 66
#line 66
return result;
#line 66
}
#line 66
# 77 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$HPLUART$get(uint8_t data)
#line 77
{
UARTM$ByteComm$rxByteReady(data, FALSE, 0);
{
}
#line 83
;
return SUCCESS;
}
# 88 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
inline static result_t HPLUARTM$UART$get(uint8_t arg_0x410c4c58){
#line 88
unsigned char result;
#line 88
#line 88
result = UARTM$HPLUART$get(arg_0x410c4c58);
#line 88
#line 88
return result;
#line 88
}
#line 88
# 90 "/opt/tinyos-1.x/tos/platform/msp430/HPLUARTM.nc"
static inline result_t HPLUARTM$USARTData$rxDone(uint8_t b)
#line 90
{
return HPLUARTM$UART$get(b);
}
# 53 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
inline static result_t HPLUSART1M$USARTData$rxDone(uint8_t arg_0x40ee6c40){
#line 53
unsigned char result;
#line 53
#line 53
result = HPLUARTM$USARTData$rxDone(arg_0x40ee6c40);
#line 53
#line 53
return result;
#line 53
}
#line 53
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t FramerM$ByteComm$txByte(uint8_t arg_0x4106e5e0){
#line 55
unsigned char result;
#line 55
#line 55
result = UARTM$ByteComm$txByte(arg_0x4106e5e0);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 483 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$ByteComm$txByteReady(bool LastByteSuccess)
#line 483
{
result_t TxResult = SUCCESS;
uint8_t nextByte;
if (LastByteSuccess != TRUE) {
/* atomic removed: atomic calls only */
#line 488
FramerM$gTxState = FramerM$TXSTATE_ERROR;
TOS_post(FramerM$PacketSent);
return SUCCESS;
}
switch (FramerM$gTxState) {
case FramerM$TXSTATE_PROTO:
FramerM$gTxState = FramerM$TXSTATE_INFO;
FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, (uint8_t )(FramerM$gTxProto & 0x0FF));
TxResult = FramerM$ByteComm$txByte((uint8_t )(FramerM$gTxProto & 0x0FF));
break;
case FramerM$TXSTATE_INFO:
nextByte = FramerM$gpTxBuf[FramerM$gTxByteCnt];
FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, nextByte);
FramerM$gTxByteCnt++;
if (FramerM$gTxByteCnt >= FramerM$gTxLength) {
FramerM$gTxState = FramerM$TXSTATE_FCS1;
}
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_ESC:
TxResult = FramerM$ByteComm$txByte(FramerM$gTxEscByte ^ 0x20);
FramerM$gTxState = FramerM$gPrevTxState;
break;
case FramerM$TXSTATE_FCS1:
nextByte = (uint8_t )(FramerM$gTxRunningCRC & 0xff);
FramerM$gTxState = FramerM$TXSTATE_FCS2;
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_FCS2:
nextByte = (uint8_t )((FramerM$gTxRunningCRC >> 8) & 0xff);
FramerM$gTxState = FramerM$TXSTATE_ENDFLAG;
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_ENDFLAG:
FramerM$gTxState = FramerM$TXSTATE_FINISH;
TxResult = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
break;
case FramerM$TXSTATE_FINISH:
case FramerM$TXSTATE_ERROR:
default:
break;
}
if (TxResult != SUCCESS) {
FramerM$gTxState = FramerM$TXSTATE_ERROR;
TOS_post(FramerM$PacketSent);
}
return SUCCESS;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$txByteReady(bool arg_0x4106d4d8){
#line 75
unsigned char result;
#line 75
#line 75
result = FramerM$ByteComm$txByteReady(arg_0x4106d4d8);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 553 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$ByteComm$txDone(void)
#line 553
{
if (FramerM$gTxState == FramerM$TXSTATE_FINISH) {
FramerM$gTxState = FramerM$TXSTATE_IDLE;
TOS_post(FramerM$PacketSent);
}
return SUCCESS;
}
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$txDone(void){
#line 83
unsigned char result;
#line 83
#line 83
result = FramerM$ByteComm$txDone();
#line 83
#line 83
return result;
#line 83
}
#line 83
# 87 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$HPLUART$putDone(void)
#line 87
{
bool oldState;
/* atomic removed: atomic calls only */
#line 90
{
{
}
#line 91
;
oldState = UARTM$state;
UARTM$state = FALSE;
}
if (oldState) {
UARTM$ByteComm$txDone();
UARTM$ByteComm$txByteReady(TRUE);
}
return SUCCESS;
}
# 96 "/opt/tinyos-1.x/tos/interfaces/HPLUART.nc"
inline static result_t HPLUARTM$UART$putDone(void){
#line 96
unsigned char result;
#line 96
#line 96
result = UARTM$HPLUART$putDone();
#line 96
#line 96
return result;
#line 96
}
#line 96
# 94 "/opt/tinyos-1.x/tos/platform/msp430/HPLUARTM.nc"
static inline result_t HPLUARTM$USARTData$txDone(void)
#line 94
{
return HPLUARTM$UART$putDone();
}
# 46 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSARTFeedback.nc"
inline static result_t HPLUSART1M$USARTData$txDone(void){
#line 46
unsigned char result;
#line 46
#line 46
result = HPLUARTM$USARTData$txDone();
#line 46
#line 46
return result;
#line 46
}
#line 46
# 496 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$HPLADC12$memOverflow(void)
#line 496
{
}
# 248 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$HPLADC12$memOverflow(void)
#line 248
{
}
# 61 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void HPLADC12M$HPLADC12$memOverflow(void){
#line 61
RefVoltM$HPLADC12$memOverflow();
#line 61
MSP430ADC12M$HPLADC12$memOverflow();
#line 61
}
#line 61
# 497 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$HPLADC12$timeOverflow(void)
#line 497
{
}
# 249 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$HPLADC12$timeOverflow(void)
#line 249
{
}
# 62 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void HPLADC12M$HPLADC12$timeOverflow(void){
#line 62
RefVoltM$HPLADC12$timeOverflow();
#line 62
MSP430ADC12M$HPLADC12$timeOverflow();
#line 62
}
#line 62
#line 58
inline static void MSP430ADC12M$HPLADC12$resetIFGs(void){
#line 58
HPLADC12M$HPLADC12$resetIFGs();
#line 58
}
#line 58
# 413 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline uint16_t *MSP430ADC12M$ADCMultiple$default$dataReady(uint8_t num, uint16_t *buf,
uint16_t length)
{
return (uint16_t *)0;
}
# 167 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
inline static uint16_t *MSP430ADC12M$ADCMultiple$dataReady(uint8_t arg_0x413bb8d8, uint16_t *arg_0x413b0010, uint16_t arg_0x413b01a0){
#line 167
unsigned int *result;
#line 167
#line 167
switch (arg_0x413bb8d8) {
#line 167
case 3U:
#line 167
result = HamamatsuM$MSP430ADC12MultiplePAR$dataReady(arg_0x413b0010, arg_0x413b01a0);
#line 167
break;
#line 167
case 4U:
#line 167
result = HamamatsuM$MSP430ADC12MultipleTSR$dataReady(arg_0x413b0010, arg_0x413b01a0);
#line 167
break;
#line 167
default:
#line 167
result = MSP430ADC12M$ADCMultiple$default$dataReady(arg_0x413bb8d8, arg_0x413b0010, arg_0x413b01a0);
#line 167
break;
#line 167
}
#line 167
#line 167
return result;
#line 167
}
#line 167
# 91 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline uint16_t HPLADC12M$HPLADC12$getMem(uint8_t i)
#line 91
{
return *((uint16_t *)(int *)0x0140 + i);
}
# 52 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static uint16_t MSP430ADC12M$HPLADC12$getMem(uint8_t arg_0x413f9010){
#line 52
unsigned int result;
#line 52
#line 52
result = HPLADC12M$HPLADC12$getMem(arg_0x413f9010);
#line 52
#line 52
return result;
#line 52
}
#line 52
#line 50
inline static void MSP430ADC12M$HPLADC12$setMemControl(uint8_t arg_0x413fa4b8, adc12memctl_t arg_0x413fa650){
#line 50
HPLADC12M$HPLADC12$setMemControl(arg_0x413fa4b8, arg_0x413fa650);
#line 50
}
#line 50
# 81 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline adc12memctl_t HPLADC12M$HPLADC12$getMemControl(uint8_t i)
#line 81
{
adc12memctl_t x = { .inch = 0, .sref = 0, .eos = 0 };
uint8_t *memCtlPtr = (uint8_t *)(char *)0x0080;
#line 84
if (i < 16) {
memCtlPtr += i;
x = * (adc12memctl_t *)memCtlPtr;
}
return x;
}
# 51 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static adc12memctl_t MSP430ADC12M$HPLADC12$getMemControl(uint8_t arg_0x413fab10){
#line 51
struct __nesc_unnamed4262 result;
#line 51
#line 51
result = HPLADC12M$HPLADC12$getMemControl(arg_0x413fab10);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 218 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static inline result_t HamamatsuM$TSRSingle$default$dataReady(adcresult_t result, uint16_t data)
{
return FAIL;
}
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
inline static result_t HamamatsuM$TSRSingle$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8){
#line 105
unsigned char result;
#line 105
#line 105
result = HamamatsuM$TSRSingle$default$dataReady(arg_0x4135a928, arg_0x4135aab8);
#line 105
#line 105
return result;
#line 105
}
#line 105
# 212 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static inline result_t HamamatsuM$MSP430ADC12SingleTSR$dataReady(uint16_t data)
{
return HamamatsuM$TSRSingle$dataReady(ADC_SUCCESS, data);
}
#line 111
static inline result_t HamamatsuM$PARSingle$default$dataReady(adcresult_t result, uint16_t data)
{
return FAIL;
}
# 105 "/opt/tinyos-1.x/tos/platform/msp430/ADCSingle.nc"
inline static result_t HamamatsuM$PARSingle$dataReady(adcresult_t arg_0x4135a928, uint16_t arg_0x4135aab8){
#line 105
unsigned char result;
#line 105
#line 105
result = HamamatsuM$PARSingle$default$dataReady(arg_0x4135a928, arg_0x4135aab8);
#line 105
#line 105
return result;
#line 105
}
#line 105
# 105 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static inline result_t HamamatsuM$MSP430ADC12SinglePAR$dataReady(uint16_t data)
{
return HamamatsuM$PARSingle$dataReady(ADC_SUCCESS, data);
}
# 409 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline result_t MSP430ADC12M$ADCSingle$default$dataReady(uint8_t num, uint16_t data)
{
return FAIL;
}
# 131 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
inline static result_t MSP430ADC12M$ADCSingle$dataReady(uint8_t arg_0x413bcd90, uint16_t arg_0x4133cdc8){
#line 131
unsigned char result;
#line 131
#line 131
switch (arg_0x413bcd90) {
#line 131
case 0U:
#line 131
result = ADCM$MSP430ADC12Single$dataReady(arg_0x4133cdc8);
#line 131
break;
#line 131
case 1U:
#line 131
result = HamamatsuM$MSP430ADC12SinglePAR$dataReady(arg_0x4133cdc8);
#line 131
break;
#line 131
case 2U:
#line 131
result = HamamatsuM$MSP430ADC12SingleTSR$dataReady(arg_0x4133cdc8);
#line 131
break;
#line 131
default:
#line 131
result = MSP430ADC12M$ADCSingle$default$dataReady(arg_0x413bcd90, arg_0x4133cdc8);
#line 131
break;
#line 131
}
#line 131
#line 131
return result;
#line 131
}
#line 131
# 441 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline void MSP430ADC12M$HPLADC12$converted(uint8_t number)
#line 441
{
switch (MSP430ADC12M$cmode)
{
case SINGLE_CHANNEL:
{
volatile uint8_t ownerTmp = MSP430ADC12M$owner;
#line 447
MSP430ADC12M$stopConversion();
MSP430ADC12M$ADCSingle$dataReady(ownerTmp, MSP430ADC12M$HPLADC12$getMem(0));
}
break;
case REPEAT_SINGLE_CHANNEL:
if (MSP430ADC12M$ADCSingle$dataReady(MSP430ADC12M$owner, MSP430ADC12M$HPLADC12$getMem(0)) == FAIL) {
MSP430ADC12M$stopConversion();
}
#line 454
break;
case SEQUENCE_OF_CHANNELS:
{
uint16_t i = 0;
#line 457
uint16_t length = MSP430ADC12M$bufLength - MSP430ADC12M$bufOffset > 16 ? 16 : MSP430ADC12M$bufLength - MSP430ADC12M$bufOffset;
#line 458
do {
* MSP430ADC12M$bufPtr++ = MSP430ADC12M$HPLADC12$getMem(i);
}
while (
#line 460
++i < length);
MSP430ADC12M$bufOffset += length;
if (MSP430ADC12M$bufLength - MSP430ADC12M$bufOffset > 15) {
return;
}
else {
#line 466
if (MSP430ADC12M$bufLength - MSP430ADC12M$bufOffset > 0) {
adc12memctl_t memctl = MSP430ADC12M$HPLADC12$getMemControl(0);
#line 468
memctl.eos = 1;
MSP430ADC12M$HPLADC12$setMemControl(MSP430ADC12M$bufLength - MSP430ADC12M$bufOffset, memctl);
}
else
#line 470
{
MSP430ADC12M$stopConversion();
MSP430ADC12M$ADCMultiple$dataReady(MSP430ADC12M$owner, MSP430ADC12M$bufPtr - MSP430ADC12M$bufLength, MSP430ADC12M$bufLength);
}
}
}
#line 475
break;
case REPEAT_SEQUENCE_OF_CHANNELS:
{
uint8_t i = 0;
#line 479
do {
* MSP430ADC12M$bufPtr++ = MSP430ADC12M$HPLADC12$getMem(i);
}
while (
#line 481
++i < MSP430ADC12M$bufLength);
if ((
#line 482
MSP430ADC12M$bufPtr = MSP430ADC12M$ADCMultiple$dataReady(MSP430ADC12M$owner, MSP430ADC12M$bufPtr - MSP430ADC12M$bufLength,
MSP430ADC12M$bufLength)) == 0) {
MSP430ADC12M$stopConversion();
}
#line 485
break;
}
default:
{
MSP430ADC12M$HPLADC12$resetIFGs();
}
break;
}
}
# 250 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$HPLADC12$converted(uint8_t number)
#line 250
{
}
# 63 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void HPLADC12M$HPLADC12$converted(uint8_t arg_0x413f8a00){
#line 63
RefVoltM$HPLADC12$converted(arg_0x413f8a00);
#line 63
MSP430ADC12M$HPLADC12$converted(arg_0x413f8a00);
#line 63
}
#line 63
# 117 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static inline void HPLADC12M$HPLADC12$stopConversion(void)
#line 117
{
HPLADC12M$ADC12CTL1 &= ~((1 << 1) | (3 << 1));
HPLADC12M$ADC12CTL0 &= ~0x0002;
}
# 82 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12.nc"
inline static void MSP430ADC12M$HPLADC12$stopConversion(void){
#line 82
HPLADC12M$HPLADC12$stopConversion();
#line 82
}
#line 82
# 225 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static inline void RefVoltM$switchOffDelay(void)
#line 225
{
if (RefVoltM$switchOff == TRUE) {
RefVoltM$SwitchOffTimer$setOneShot(100);
}
}
#line 180
static inline result_t RefVoltM$RefVolt$release(void)
#line 180
{
result_t result = FAIL;
/* atomic removed: atomic calls only */
#line 183
{
if (RefVoltM$semaCount <= 0) {
result = FAIL;
}
else
#line 186
{
RefVoltM$semaCount--;
if (RefVoltM$semaCount == 0) {
if (RefVoltM$state == RefVoltM$REFERENCE_1_5V_PENDING ||
RefVoltM$state == RefVoltM$REFERENCE_2_5V_PENDING) {
RefVoltM$switchOff = TRUE;
RefVoltM$switchRefOff();
}
else {
RefVoltM$switchOff = TRUE;
TOS_post(RefVoltM$switchOffDelay);
}
result = SUCCESS;
}
}
}
return result;
}
# 109 "/opt/tinyos-1.x/tos/platform/msp430/RefVolt.nc"
inline static result_t MSP430ADC12M$RefVolt$release(void){
#line 109
unsigned char result;
#line 109
#line 109
result = RefVoltM$RefVolt$release();
#line 109
#line 109
return result;
#line 109
}
#line 109
# 158 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline result_t MSP430ADC12M$releaseRefVolt(uint8_t num)
{
if (MSP430ADC12M$adc12settings[num].gotRefVolt == 1) {
MSP430ADC12M$RefVolt$release();
MSP430ADC12M$adc12settings[num].gotRefVolt = 0;
return SUCCESS;
}
return FAIL;
}
#line 331
static inline result_t MSP430ADC12M$unreserve(uint8_t num)
{
if (MSP430ADC12M$reserved & RESERVED && MSP430ADC12M$owner == num) {
MSP430ADC12M$cmode = MSP430ADC12M$reserved = ADC_IDLE;
return SUCCESS;
}
return FAIL;
}
#line 365
static inline result_t MSP430ADC12M$ADCSingle$unreserve(uint8_t num)
{
return MSP430ADC12M$unreserve(num);
}
# 117 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Single.nc"
inline static result_t ADCM$MSP430ADC12Single$unreserve(void){
#line 117
unsigned char result;
#line 117
#line 117
result = MSP430ADC12M$ADCSingle$unreserve(0U);
#line 117
#line 117
return result;
#line 117
}
#line 117
# 645 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$ADC$dataReady(uint8_t client, uint16_t data)
#line 645
{
/* atomic removed: atomic calls only */
SmartSensingM$saveData(client, data);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
inline static result_t ADCM$ADC$dataReady(uint8_t arg_0x41345b10, uint16_t arg_0x40a7c788){
#line 70
unsigned char result;
#line 70
#line 70
result = SmartSensingM$ADC$dataReady(arg_0x41345b10, arg_0x40a7c788);
#line 70
#line 70
return result;
#line 70
}
#line 70
# 356 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteControl$getQuality(void)
#line 356
{
return MultiHopLQI$gbLinkQuality;
}
# 84 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
inline static uint16_t MultiHopEngineM$RouteSelectCntl$getQuality(void){
#line 84
unsigned int result;
#line 84
#line 84
result = MultiHopLQI$RouteControl$getQuality();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 535 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static inline uint16_t MultiHopEngineM$RouteControl$getQuality(void)
#line 535
{
return MultiHopEngineM$RouteSelectCntl$getQuality();
}
# 84 "/home/xu/oasis/lib/MultiHopOasis/RouteControl.nc"
inline static uint16_t SmartSensingM$RouteControl$getQuality(void){
#line 84
unsigned int result;
#line 84
#line 84
result = MultiHopEngineM$RouteControl$getQuality();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 306 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$DataMgmt$saveBlk(void *obj, uint8_t mediumType)
#line 306
{
result_t result = FAIL;
#line 308
if (obj != 0) {
result = changeMemStatus(&DataMgmtM$sensorMem, (SenBlkPtr )obj, ((SenBlkPtr )obj)->status, FILLED);
}
return result;
}
# 30 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
inline static result_t SmartSensingM$DataMgmt$saveBlk(void *arg_0x40ad0110, uint8_t arg_0x40ad02a0){
#line 30
unsigned char result;
#line 30
#line 30
result = DataMgmtM$DataMgmt$saveBlk(arg_0x40ad0110, arg_0x40ad02a0);
#line 30
#line 30
return result;
#line 30
}
#line 30
# 172 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static inline uint16_t *HamamatsuM$PARMultiple$default$dataReady(adcresult_t result, uint16_t *buf, uint16_t length)
{
return 0;
}
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
inline static uint16_t *HamamatsuM$PARMultiple$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0){
#line 129
unsigned int *result;
#line 129
#line 129
result = HamamatsuM$PARMultiple$default$dataReady(arg_0x41380170, arg_0x41380320, arg_0x413804b0);
#line 129
#line 129
return result;
#line 129
}
#line 129
# 370 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static inline msp430ADCresult_t MSP430ADC12M$ADCMultiple$getData(uint8_t num, uint16_t *buf,
uint16_t length, uint16_t jiffies)
{
return MSP430ADC12M$newRequest(SEQUENCE_OF_CHANNELS, num, buf, length, jiffies);
}
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
inline static msp430ADCresult_t HamamatsuM$MSP430ADC12MultiplePAR$getData(uint16_t *arg_0x413b57e8, uint16_t arg_0x413b5978, uint16_t arg_0x413b5b08){
#line 82
enum __nesc_unnamed4259 result;
#line 82
#line 82
result = MSP430ADC12M$ADCMultiple$getData(3U, arg_0x413b57e8, arg_0x413b5978, arg_0x413b5b08);
#line 82
#line 82
return result;
#line 82
}
#line 82
# 279 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static inline uint16_t *HamamatsuM$TSRMultiple$default$dataReady(adcresult_t result, uint16_t *buf, uint16_t length)
{
return 0;
}
# 129 "/opt/tinyos-1.x/tos/platform/msp430/ADCMultiple.nc"
inline static uint16_t *HamamatsuM$TSRMultiple$dataReady(adcresult_t arg_0x41380170, uint16_t *arg_0x41380320, uint16_t arg_0x413804b0){
#line 129
unsigned int *result;
#line 129
#line 129
result = HamamatsuM$TSRMultiple$default$dataReady(arg_0x41380170, arg_0x41380320, arg_0x413804b0);
#line 129
#line 129
return result;
#line 129
}
#line 129
# 82 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ADC12Multiple.nc"
inline static msp430ADCresult_t HamamatsuM$MSP430ADC12MultipleTSR$getData(uint16_t *arg_0x413b57e8, uint16_t arg_0x413b5978, uint16_t arg_0x413b5b08){
#line 82
enum __nesc_unnamed4259 result;
#line 82
#line 82
result = MSP430ADC12M$ADCMultiple$getData(4U, arg_0x413b57e8, arg_0x413b5978, arg_0x413b5b08);
#line 82
#line 82
return result;
#line 82
}
#line 82
# 102 "/opt/tinyos-1.x/tos/system/sched.c"
bool TOS_post(void (*tp)(void))
#line 102
{
__nesc_atomic_t fInterruptFlags;
uint8_t tmp;
fInterruptFlags = __nesc_atomic_start();
tmp = TOSH_sched_free;
if (TOSH_queue[tmp].tp == NULL) {
TOSH_sched_free = (tmp + 1) & TOSH_TASK_BITMASK;
TOSH_queue[tmp].tp = tp;
__nesc_atomic_end(fInterruptFlags);
return TRUE;
}
else {
__nesc_atomic_end(fInterruptFlags);
return FALSE;
}
}
# 52 "/opt/tinyos-1.x/tos/platform/msp430/MainM.nc"
int main(void)
{
MainM$hardwareInit();
TOSH_sched_init();
MainM$StdControl$init();
MainM$StdControl$start();
__nesc_enable_interrupt();
for (; ; ) {
#line 61
TOSH_run_task();
}
}
# 83 "/opt/tinyos-1.x/tos/platform/telosb/hardware.h"
static void TOSH_FLASH_M25P_DP_bit(bool set)
#line 83
{
if (set) {
TOSH_SET_SIMO0_PIN();
}
else {
#line 87
TOSH_CLR_SIMO0_PIN();
}
#line 88
TOSH_SET_UCLK0_PIN();
TOSH_CLR_UCLK0_PIN();
}
# 139 "/opt/tinyos-1.x/tos/platform/msp430/MSP430ClockM.nc"
static void MSP430ClockM$set_dco_calib(int calib)
{
BCSCTL1 = (BCSCTL1 & ~0x07) | ((calib >> 8) & 0x07);
DCOCTL = calib & 0xff;
}
# 72 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static result_t TimerM$StdControl$init(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 74
TimerM$m_hinow = 0;
#line 74
__nesc_atomic_end(__nesc_atomic); }
TimerM$m_head_short = TimerM$EMPTY_LIST;
TimerM$m_head_long = TimerM$EMPTY_LIST;
bzero(TimerM$m_timers, sizeof TimerM$m_timers);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 78
TimerM$m_posted_checkShortTimers = FALSE;
#line 78
__nesc_atomic_end(__nesc_atomic); }
TimerM$AlarmControl$setControlAsCompare();
TimerM$AlarmControl$disableEvents();
return SUCCESS;
}
# 98 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
static uint16_t MSP430TimerM$compareControl(void)
{
MSP430TimerM$CC_t x = {
.cm = 1,
.ccis = 0,
.clld = 0,
.cap = 0,
.ccie = 0 };
return MSP430TimerM$CC2int(x);
}
# 100 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static result_t ADCM$ADCControl$init(void)
{
if (!ADCM$initialized) {
ADCM$samplingRate = 0xFF;
ADCM$g_port = 0;
ADCM$initialized = 1;
}
return SUCCESS;
}
# 44 "/home/xu/oasis/system/buffer.h"
static result_t initBufferPool(Queue_t *bufQueue, uint16_t size, TOS_Msg *bufPool)
#line 44
{
result_t result;
int16_t ind;
if (SUCCESS != (result = initQueue(bufQueue, size))) {
return FAIL;
}
for (ind = 0; ind < size; ind++)
{
if (SUCCESS != insertElement(bufQueue, &bufPool[ind])) {
#line 53
return FAIL;
}
}
#line 55
;
return SUCCESS;
}
# 90 "/home/xu/oasis/system/queue.h"
static result_t initQueue(Queue_t *queue, uint16_t size)
#line 90
{
int16_t i;
if (size > MAX_QUEUE_SIZE || size <= 0) {
;
return FAIL;
}
queue->size = size;
queue->total = 0;
queue->head[FREE] = 0;
queue->tail[FREE] = size - 1;
queue->head[PENDING] = queue->tail[PENDING] = -1;
queue->head[PROCESSING] = queue->tail[PROCESSING] = -1;
for (i = 0; i < size; i++) {
queue->element[i].status = FREE;
queue->element[i].obj = NULL;
queue->element[i].prev = i - 1;
queue->element[i].retry = 0;
queue->element[i].priority = 0;
if (i < size - 1) {
queue->element[i].next = i + 1;
}
else {
#line 133
queue->element[i].next = -1;
}
}
return SUCCESS;
}
static result_t insertElement(Queue_t *queue, object_type *obj)
#line 146
{
int16_t ind;
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total >= queue->size) {
return FAIL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
;
return FAIL;
}
}
ind = queue->head[FREE];
queue->element[ind].obj = obj;
queue->element[ind].retry = 0;
_private_changeElementStatusByIndex(queue, ind, FREE, PENDING);
queue->total++;
;
return SUCCESS;
}
#line 559
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t status2)
#line 559
{
int16_t _prev;
#line 561
int16_t _next;
#line 561
int16_t tail2;
if (queue->element[ind].status != status1)
{
;
return;
}
if (queue->element[ind].status == status2) {
;
return;
}
_prev = queue->element[ind].prev;
_next = queue->element[ind].next;
if (_prev != -1) {
queue->element[_prev].next = _next;
}
else {
#line 580
queue->head[status1] = _next;
}
if (_next != -1) {
queue->element[_next].prev = _prev;
}
else {
#line 585
queue->tail[status1] = _prev;
}
tail2 = queue->tail[status2];
if (tail2 != -1) {
queue->element[tail2].next = ind;
}
else {
queue->head[status2] = ind;
}
queue->element[ind].status = status2;
queue->element[ind].prev = tail2;
queue->element[ind].next = -1;
queue->tail[status2] = ind;
return;
}
# 191 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t client)
#line 191
{
SenBlkPtr p = NULL;
result_t result = SUCCESS;
if (sensor[client].maxBlkNum != 0) {
if (sensor[client].curBlkNum >= sensor[client].maxBlkNum) {
result = DataMgmtM$DataMgmt$freeBlkByType(sensor[client].type);
}
}
if (FAIL != result) {
p = allocSensorMem(&DataMgmtM$sensorMem);
if (p != NULL) {
sensor[client].curBlkNum++;
DataMgmtM$Leds$yellowToggle();
}
else
#line 207
{
}
}
return p;
}
# 125 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static SenBlkPtr headMemElement(MemQueue_t *queue, MemStatus_t status)
#line 125
{
int16_t ind;
#line 127
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 127
ind = queue->head[status];
#line 127
__nesc_atomic_end(__nesc_atomic); }
if (ind == -1) {
return NULL;
}
else {
return &queue->element[ind];
}
}
# 228 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$DataMgmt$freeBlk(void *obj)
#line 228
{
uint8_t i = 0;
result_t result = FAIL;
SenBlkPtr p = 0;
uint8_t type = 0;
if (obj == 0) {
return result;
}
p = (SenBlkPtr )obj;
type = p->type;
result = freeSensorMem(&DataMgmtM$sensorMem, p);
if (result != FAIL) {
for (i = 0; i <= sensor_num; i++) {
if (sensor[i].type == type) {
if (sensor[i].curBlkNum > 0) {
sensor[i].curBlkNum--;
}
}
}
}
else
#line 250
{
}
return result;
}
# 263 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2)
#line 263
{
int16_t _prev;
#line 265
int16_t _next;
#line 265
int16_t tail2;
if (queue->element[ind].status != status1) {
;
return FAIL;
}
if (queue->element[ind].status == status2) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 282
{
_prev = queue->element[ind].prev;
_next = queue->element[ind].next;
}
#line 285
__nesc_atomic_end(__nesc_atomic); }
if (_prev != -1) {
queue->element[_prev].next = _next;
}
else {
#line 289
queue->head[status1] = _next;
}
if (_next != -1) {
queue->element[_next].prev = _prev;
}
else {
#line 294
queue->tail[status1] = _prev;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
tail2 = queue->tail[status2];
#line 297
__nesc_atomic_end(__nesc_atomic); }
if (tail2 != -1) {
queue->element[tail2].next = ind;
}
else {
queue->head[status2] = ind;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 305
{
queue->element[ind].status = status2;
queue->element[ind].prev = tail2;
queue->element[ind].next = -1;
queue->tail[status2] = ind;
}
#line 310
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 147
static SenBlkPtr getMemElementByIndex(MemQueue_t *queue, int16_t ind)
#line 147
{
if (ind >= queue->size || ind < 0) {
return NULL;
}
else {
return &queue->element[ind];
}
}
# 127 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static result_t ADCM$ADCControl$bindPort(uint8_t port, uint8_t adcPort)
{
if (port < ADCM$TOSH_ADC_PORTMAPSIZE) {
ADCM$TOSH_adc_portmap[port] = adcPort;
ADCM$adc_count[port] = 0;
return SUCCESS;
}
else {
#line 134
return FAIL;
}
}
# 788 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$updateMaxBlkNum(void)
#line 788
{
uint8_t i;
uint16_t totalRate = 0;
uint16_t usedBlkNum = 0;
#line 792
for (i = 0; i < sensor_num; i++) {
if (sensor[i].samplingRate != 0) {
totalRate += 1000UL / sensor[i].samplingRate;
}
else {
usedBlkNum += sensor[i].maxBlkNum;
}
}
if (totalRate != 0) {
for (i = 0; i <= sensor_num; i++) {
if (sensor[i].samplingRate != 0) {
sensor[i].maxBlkNum = 1000UL / sensor[i].samplingRate * (MEM_QUEUE_SIZE - usedBlkNum) / totalRate + 2;
}
}
}
return;
}
#line 832
static uint16_t SmartSensingM$calFireInterval(void)
#line 832
{
uint8_t client = 0;
uint16_t gcd = 0;
uint16_t value1 = 0;
#line 836
while (client < sensor_num) {
value1 = sensor[client].samplingRate;
if (value1 != 0) {
if (gcd == 0) {
gcd = value1;
}
else {
gcd = SmartSensingM$GCD(gcd, value1);
}
}
client++;
}
return gcd;
}
# 268 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static void FramerM$HDLCInitialize(void)
#line 268
{
int i;
#line 270
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 270
{
for (i = 0; i < FramerM$HDLC_QUEUESIZE; i++) {
FramerM$gMsgRcvTbl[i].pMsg = &FramerM$gMsgRcvBuf[i];
FramerM$gMsgRcvTbl[i].Length = 0;
FramerM$gMsgRcvTbl[i].Token = 0;
}
FramerM$gTxState = FramerM$TXSTATE_IDLE;
FramerM$gTxByteCnt = 0;
FramerM$gTxLength = 0;
FramerM$gTxRunningCRC = 0;
FramerM$gpTxMsg = NULL;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
FramerM$gRxHeadIndex = 0;
FramerM$gRxTailIndex = 0;
FramerM$gRxByteCnt = 0;
FramerM$gRxRunningCRC = 0;
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gFlags = 0;
}
#line 289
__nesc_atomic_end(__nesc_atomic); }
}
# 225 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static void HPLUSART0M$USARTControl$setModeSPI(void)
#line 225
{
if (HPLUSART0M$USARTControl$getMode() == USART_SPI) {
return;
}
HPLUSART0M$USARTControl$disableUART();
HPLUSART0M$USARTControl$disableI2C();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 233
{
TOSH_SEL_SIMO0_MODFUNC();
TOSH_SEL_SOMI0_MODFUNC();
TOSH_SEL_UCLK0_MODFUNC();
HPLUSART0M$IE1 &= ~((1 << 7) | (1 << 6));
U0CTL = 0x01;
U0CTL |= (0x10 | 0x04) | 0x02;
U0CTL &= ~0x20;
HPLUSART0M$U0TCTL = 0x02;
HPLUSART0M$U0TCTL |= 0x80;
if (HPLUSART0M$l_ssel & 0x80) {
HPLUSART0M$U0TCTL &= ~(((0x00 | 0x10) | 0x20) | 0x30);
HPLUSART0M$U0TCTL |= HPLUSART0M$l_ssel & 0x7F;
}
else {
HPLUSART0M$U0TCTL &= ~(((0x00 | 0x10) | 0x20) | 0x30);
HPLUSART0M$U0TCTL |= 0x20;
}
if (HPLUSART0M$l_br != 0) {
U0BR0 = HPLUSART0M$l_br & 0x0FF;
U0BR1 = (HPLUSART0M$l_br >> 8) & 0x0FF;
}
else {
U0BR0 = 0x02;
U0BR1 = 0x00;
}
U0MCTL = 0;
HPLUSART0M$ME1 &= ~((1 << 7) | (1 << 6));
HPLUSART0M$ME1 |= 1 << 6;
U0CTL &= ~0x01;
HPLUSART0M$IFG1 &= ~((1 << 7) | (1 << 6));
HPLUSART0M$IE1 &= ~((1 << 7) | (1 << 6));
}
#line 272
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 309 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static void TimeSyncM$clearTable(void)
{
int8_t i;
#line 312
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
TimeSyncM$table[i].state = TimeSyncM$ENTRY_EMPTY;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 315
TimeSyncM$numEntries = 0;
#line 315
__nesc_atomic_end(__nesc_atomic); }
}
# 347 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$initialize(void)
#line 347
{
int8_t i;
#line 349
CascadesRouterM$highestSeq = 0;
CascadesRouterM$expectingSeq = 0;
CascadesRouterM$headIndex = 0;
CascadesRouterM$RTwait = (CascadesRouterM$Random$rand() & 0x64) + 0xcf;
CascadesRouterM$resetCount = 0;
CascadesRouterM$nextSignalSeq = CascadesRouterM$expectingSeq;
CascadesRouterM$activeRT = FALSE;
CascadesRouterM$DataTimerOn = FALSE;
CascadesRouterM$DataProcessBusy = FALSE;
CascadesRouterM$RequestProcessBusy = FALSE;
CascadesRouterM$ctrlMsgBusy = FALSE;
CascadesRouterM$CMAuProcessBusy = FALSE;
CascadesRouterM$sigRcvTaskBusy = FALSE;
CascadesRouterM$delayTimerBusy = FALSE;
CascadesRouterM$inited = FALSE;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
CascadesRouterM$myBuffer[i].signalDone = 1;
CascadesRouterM$clearChildrenListStatus(i);
}
for (i = MAX_CAS_PACKETS - 1; i >= 0; i--) {
CascadesRouterM$inData[i] = FALSE;
}
}
# 70 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
static uint16_t RandomLFSR$Random$rand(void)
#line 70
{
bool endbit;
uint16_t tmpShiftReg;
#line 73
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 73
{
tmpShiftReg = RandomLFSR$shiftReg;
endbit = (tmpShiftReg & 0x8000) != 0;
tmpShiftReg <<= 1;
if (endbit) {
tmpShiftReg ^= 0x100b;
}
#line 79
tmpShiftReg++;
RandomLFSR$shiftReg = tmpShiftReg;
tmpShiftReg = tmpShiftReg ^ RandomLFSR$mask;
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return tmpShiftReg;
}
# 228 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$clearChildrenListStatus(uint8_t myindex)
#line 228
{
int8_t i;
#line 230
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
CascadesRouterM$myBuffer[myindex].childrenList[i].status = 0;
}
CascadesRouterM$myBuffer[myindex].countDT = 0;
CascadesRouterM$myBuffer[myindex].retry = 0;
}
# 62 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static void NeighborMgmtM$initialize(void)
#line 62
{
nmemset(NeighborMgmtM$NeighborTbl, 0, sizeof(NBRTableEntry ) * 16);
NeighborMgmtM$initTime = TRUE;
NeighborMgmtM$processTaskBusy = FALSE;
NeighborMgmtM$lqiBuf = 0;
NeighborMgmtM$rssiBuf = 0;
NeighborMgmtM$linkaddrBuf = 0;
NeighborMgmtM$ticks = 0;
}
# 443 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static result_t TimerM$Timer$start(uint8_t num, char type, uint32_t milli)
{
switch (type)
{
case TIMER_REPEAT:
return TimerM$setTimer(num, milli * 32, TRUE);
case TIMER_ONE_SHOT:
return TimerM$setTimer(num, milli * 32, FALSE);
}
return FAIL;
}
#line 319
static result_t TimerM$setTimer(uint8_t num, int32_t jiffy, bool isperiodic)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
TimerM$Timer_t *timer = &TimerM$m_timers[num];
int32_t now;
#line 325
if (timer->isset) {
TimerM$removeTimer(num);
}
#line 327
TimerM$m_period[num] = jiffy;
timer->isperiodic = isperiodic;
now = TimerM$LocalTime$read();
timer->alarm = now + jiffy;
TimerM$insertTimer(num, jiffy <= 0xffffL);
TimerM$setNextShortEvent();
}
#line 333
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 288
static uint32_t TimerM$LocalTime$read(void)
{
uint32_t now;
#line 291
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
uint16_t hinow = TimerM$m_hinow;
uint16_t lonow = TimerM$readTime();
#line 298
if (TimerM$AlarmTimer$isOverflowPending())
{
hinow++;
lonow = TimerM$readTime();
}
now = ((uint32_t )hinow << 16) | lonow;
}
#line 304
__nesc_atomic_end(__nesc_atomic); }
return now;
}
#line 275
static uint16_t TimerM$readTime(void)
{
uint16_t t0;
uint16_t t1 = TimerM$AlarmTimer$read();
#line 284
do {
#line 284
t0 = t1;
#line 284
t1 = TimerM$AlarmTimer$read();
}
while (
#line 284
t0 != t1);
return t1;
}
#line 94
static void TimerM$insertTimer(uint8_t num, bool isshort)
{
if (TimerM$m_timers[num].isqueued == FALSE)
{
if (isshort)
{
TimerM$m_timers[num].next = TimerM$m_head_short;
TimerM$m_head_short = num;
}
else
{
TimerM$m_timers[num].next = TimerM$m_head_long;
TimerM$m_head_long = num;
}
TimerM$m_timers[num].isqueued = TRUE;
}
TimerM$m_timers[num].isset = TRUE;
}
#line 198
static void TimerM$setNextShortEvent(void)
{
uint32_t now = TimerM$LocalTime$read();
#line 201
if (TimerM$m_head_short != TimerM$EMPTY_LIST)
{
uint8_t head = TimerM$m_head_short;
uint8_t soon = head;
int32_t remaining = TimerM$m_timers[head].alarm - now;
#line 206
head = TimerM$m_timers[head].next;
while (head != TimerM$EMPTY_LIST)
{
int32_t dt = TimerM$m_timers[head].alarm - now;
#line 210
if (dt < remaining)
{
remaining = dt;
soon = head;
}
head = TimerM$m_timers[head].next;
}
now = TimerM$LocalTime$read();
remaining = TimerM$m_timers[soon].alarm - now;
if (remaining <= 0)
{
TimerM$AlarmControl$disableEvents();
TimerM$post_checkShortTimers();
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
if (remaining > 2) {
TimerM$AlarmCompare$setEventFromNow(remaining);
}
else {
#line 240
TimerM$AlarmCompare$setEventFromNow(2);
}
#line 241
TimerM$AlarmControl$clearPendingInterrupt();
TimerM$AlarmControl$enableEvents();
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
}
}
else
{
TimerM$AlarmControl$disableEvents();
}
}
#line 186
static void TimerM$post_checkShortTimers(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
if (!TimerM$m_posted_checkShortTimers)
{
if (TOS_post(TimerM$checkShortTimers)) {
TimerM$m_posted_checkShortTimers = TRUE;
}
}
}
#line 196
__nesc_atomic_end(__nesc_atomic); }
}
#line 141
static void TimerM$executeTimers(uint8_t head)
{
uint32_t now = TimerM$LocalTime$read();
#line 144
while (head != TimerM$EMPTY_LIST)
{
uint8_t num = head;
bool signal_timer = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
TimerM$Timer_t *timer = &TimerM$m_timers[num];
#line 152
head = timer->next;
timer->isqueued = FALSE;
if (timer->isset)
{
int32_t remaining = timer->alarm - now;
#line 159
timer->isset = FALSE;
if (remaining <= 0)
{
if (timer->isperiodic)
{
timer->alarm += TimerM$m_period[num];
TimerM$insertTimer(num, (int32_t )(timer->alarm - now) <= 0xffffL);
}
signal_timer = TRUE;
}
else
{
TimerM$insertTimer(num, remaining <= 0xffffL);
}
}
}
#line 177
__nesc_atomic_end(__nesc_atomic); }
if (signal_timer) {
TimerM$signal_timer_fired(num);
}
}
}
# 419 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static void MSP430ADC12M$RefVolt$isStable(RefVolt_t vref)
{
if (MSP430ADC12M$vrefWait) {
MSP430ADC12M$HPLADC12$startConversion();
if (MSP430ADC12M$reserved & TIMER_USED) {
MSP430ADC12M$startTimerA();
}
#line 425
MSP430ADC12M$reserved = ADC_IDLE;
MSP430ADC12M$vrefWait = FALSE;
}
}
#line 184
static void MSP430ADC12M$startTimerA(void)
{
MSP430CompareControl_t ccSetSHI = {
.ccifg = 0, .cov = 0, .out = 1, .cci = 0, .ccie = 0,
.outmod = 0, .cap = 0, .clld = 0, .scs = 0, .ccis = 0, .cm = 0 };
MSP430CompareControl_t ccResetSHI = {
.ccifg = 0, .cov = 0, .out = 0, .cci = 0, .ccie = 0,
.outmod = 0, .cap = 0, .clld = 0, .scs = 0, .ccis = 0, .cm = 0 };
MSP430CompareControl_t ccRSOutmod = {
.ccifg = 0, .cov = 0, .out = 0, .cci = 0, .ccie = 0,
.outmod = 7, .cap = 0, .clld = 0, .scs = 0, .ccis = 0, .cm = 0 };
MSP430ADC12M$ControlA1$setControl(ccResetSHI);
MSP430ADC12M$ControlA1$setControl(ccSetSHI);
MSP430ADC12M$ControlA1$setControl(ccRSOutmod);
MSP430ADC12M$TimerA$setMode(MSP430TIMER_UP_MODE);
}
# 167 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$delFromChildrenList(address_t nodeID)
#line 167
{
int8_t i;
int8_t myIndex;
#line 170
for (myIndex = MAX_CAS_BUF - 1; myIndex >= 0; myIndex--) {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
CascadesRouterM$myBuffer[myIndex].childrenList[i].childID = 0;
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 0;
}
}
}
}
# 457 "/opt/tinyos-1.x/tos/platform/msp430/TimerM.nc"
static result_t TimerM$Timer$stop(uint8_t num)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 459
TimerM$removeTimer(num);
#line 459
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 323 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type)
#line 323
{
uint8_t localIndex = 0;
int8_t i = 0;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
uint16_t *dst = (uint16_t *)CCMsg->data;
#line 328
CCMsg->dataSeq = seq;
CCMsg->linkSource = TOS_LOCAL_ADDRESS;
CCMsg->type = type;
CCMsg->parent = CascadesRouterM$CascadeControl$getParent();
if (type == TYPE_CASCADES_CMAU) {
if (INVALID_INDEX != (localIndex = CascadesRouterM$findMsgIndex(seq))) {
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (CascadesRouterM$myBuffer[localIndex].childrenList[i].childID != 0 && CascadesRouterM$myBuffer[localIndex].childrenList[i].status != 1) {
* dst++ = CascadesRouterM$myBuffer[localIndex].childrenList[i].childID;
}
}
}
tmPtr->length = sizeof(CasCtrlMsg ) + (MAX_NUM_CHILDREN << 1);
return;
}
tmPtr->length = sizeof(CasCtrlMsg );
return;
}
# 465 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static uint16_t NeighborMgmtM$CascadeControl$getParent(void)
#line 465
{
uint8_t ind = 0;
#line 467
for (ind = 0; ind < 16; ind++) {
if (NeighborMgmtM$NeighborTbl[ind].flags & NBRFLAG_VALID) {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT) {
return NeighborMgmtM$NeighborTbl[ind].id;
}
}
}
#line 473
return ADDRESS_INVALID;
}
# 130 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq)
#line 130
{
int8_t i;
#line 132
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
if (CascadesRouterM$getCasData(& CascadesRouterM$myBuffer[i].tmsg)->seqno == msgSeq) {
return i;
}
}
return INVALID_INDEX;
}
# 68 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static result_t CascadesEngineM$MySend$send(uint8_t type, TOS_MsgPtr msg, uint16_t len)
#line 68
{
if (SUCCESS == CascadesEngineM$insertAndStartSend(msg)) {
CascadesEngineM$updateProtocolField(msg, type, len);
return SUCCESS;
}
else {
return FAIL;
}
}
#line 132
static result_t CascadesEngineM$tryNextSend(void)
#line 132
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 133
{
if (!CascadesEngineM$sendTaskBusy && headElement(&CascadesEngineM$sendQueue, PENDING) != NULL) {
if (SUCCESS != TOS_post(CascadesEngineM$sendTask)) {
CascadesEngineM$sendTaskBusy = FALSE;
}
else {
CascadesEngineM$sendTaskBusy = TRUE;
}
}
}
#line 142
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 368 "/home/xu/oasis/system/queue.h"
static object_type *headElement(Queue_t *queue, ObjStatus_t status)
#line 368
{
if (queue->head[status] == -1) {
return NULL;
}
else {
#line 373
return queue->element[queue->head[status]].obj;
}
}
# 295 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$SendMsg$send(uint8_t id, uint16_t addr, uint8_t len, TOS_MsgPtr msg)
#line 295
{
uint8_t ind = 0;
#line 299
if (len > DATA_LENGTH) {
;
return FAIL;
}
GenericCommProM$updateProtocolField(msg, id, addr, len);
if (GenericCommProM$insertAndStartSend(msg) == SUCCESS) {
;
ind = GenericCommProM$allocateBkHeaderEntry();
if (ind < COMM_SEND_QUEUE_SIZE) {
GenericCommProM$bkHeader[ind].valid = TRUE;
GenericCommProM$bkHeader[ind].length = len;
GenericCommProM$bkHeader[ind].type = id;
GenericCommProM$bkHeader[ind].group = msg->group;
GenericCommProM$bkHeader[ind].msgPtr = msg;
GenericCommProM$bkHeader[ind].addr = addr;
}
else {
;
}
return SUCCESS;
}
else {
;
return FAIL;
}
}
#line 513
static result_t GenericCommProM$tryNextSend(void)
#line 513
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 514
{
if (!GenericCommProM$sendTaskBusy && headElement(&GenericCommProM$sendQueue, PENDING) != NULL) {
if (TOS_post(GenericCommProM$sendTask) != SUCCESS) {
GenericCommProM$sendTaskBusy = FALSE;
;
{
unsigned char __nesc_temp =
#line 523
FAIL;
{
#line 523
__nesc_atomic_end(__nesc_atomic);
#line 523
return __nesc_temp;
}
}
}
else
#line 525
{
GenericCommProM$sendTaskBusy = TRUE;
}
}
else {
;
}
}
#line 532
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 158 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static result_t FramerM$StartTx(void)
#line 158
{
result_t Result = SUCCESS;
bool fInitiate = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 162
{
if (FramerM$gTxState == FramerM$TXSTATE_IDLE) {
if (FramerM$gFlags & FramerM$FLAGS_TOKENPEND) {
FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxTokenBuf;
FramerM$gTxProto = FramerM$PROTO_ACK;
FramerM$gTxLength = sizeof FramerM$gTxTokenBuf;
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
else {
#line 171
if (FramerM$gFlags & FramerM$FLAGS_DATAPEND) {
FramerM$gpTxBuf = (uint8_t *)FramerM$gpTxMsg;
FramerM$gTxProto = FramerM$PROTO_PACKET_NOACK;
FramerM$gTxLength = FramerM$gpTxMsg->length + (MSG_DATA_SIZE - DATA_LENGTH - 2);
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
else {
#line 178
if (FramerM$gFlags & FramerM$FLAGS_UNKNOWN) {
FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxUnknownBuf;
FramerM$gTxProto = FramerM$PROTO_UNKNOWN;
FramerM$gTxLength = sizeof FramerM$gTxUnknownBuf;
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
}
}
}
}
#line 188
__nesc_atomic_end(__nesc_atomic); }
#line 188
if (fInitiate) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 189
{
FramerM$gTxRunningCRC = 0;
#line 190
FramerM$gTxByteCnt = 0;
}
#line 191
__nesc_atomic_end(__nesc_atomic); }
Result = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
if (Result != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 194
FramerM$gTxState = FramerM$TXSTATE_ERROR;
#line 194
__nesc_atomic_end(__nesc_atomic); }
TOS_post(FramerM$PacketSent);
}
}
return Result;
}
# 110 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static result_t UARTM$ByteComm$txByte(uint8_t data)
#line 110
{
bool oldState;
{
}
#line 113
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 115
{
oldState = UARTM$state;
UARTM$state = TRUE;
}
#line 118
__nesc_atomic_end(__nesc_atomic); }
if (oldState) {
return FAIL;
}
UARTM$HPLUART$put(data);
return SUCCESS;
}
# 246 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static void FramerM$PacketSent(void)
#line 246
{
result_t TxResult = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 249
{
if (FramerM$gTxState == FramerM$TXSTATE_ERROR) {
TxResult = FAIL;
FramerM$gTxState = FramerM$TXSTATE_IDLE;
}
}
#line 254
__nesc_atomic_end(__nesc_atomic); }
if (FramerM$gTxProto == FramerM$PROTO_ACK) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 256
FramerM$gFlags ^= FramerM$FLAGS_TOKENPEND;
#line 256
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 259
FramerM$gFlags ^= FramerM$FLAGS_DATAPEND;
#line 259
__nesc_atomic_end(__nesc_atomic); }
FramerM$BareSendMsg$sendDone((TOS_MsgPtr )FramerM$gpTxMsg, TxResult);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 261
FramerM$gpTxMsg = NULL;
#line 261
__nesc_atomic_end(__nesc_atomic); }
}
FramerM$StartTx();
}
# 576 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success)
#line 576
{
result_t result;
TOS_MsgPtr *mPPtr = NULL;
uint8_t ind = 0;
uint8_t retry;
NetworkMsg *NMsg;
GenericCommProM$state = FALSE;
mPPtr = findObject(&GenericCommProM$sendQueue, msg);
if (mPPtr == NULL) {
;
return FAIL;
}
ind = GenericCommProM$findBkHeaderEntry(msg);
if (ind < COMM_SEND_QUEUE_SIZE) {
msg->addr = GenericCommProM$bkHeader[ind].addr;
msg->group = GenericCommProM$bkHeader[ind].group;
msg->type = GenericCommProM$bkHeader[ind].type;
msg->length = GenericCommProM$bkHeader[ind].length;
}
else
#line 601
{
;
}
result = SUCCESS;
if (success != SUCCESS || (
msg->ack != 1 && msg->addr != TOS_BCAST_ADDR
&& msg->addr != TOS_UART_ADDR)) {
incRetryCount(mPPtr);
retry = getRetryCount(mPPtr);
if (msg->type == AM_NETWORKMSG ? (NMsg = (NetworkMsg *)msg->data, retry >= qosRexmit(NMsg->qos)) :
retry >= 2) {
;
if (removeElement(&GenericCommProM$sendQueue, msg) != SUCCESS) {
;
}
if (GenericCommProM$freeBkHeader(ind) != SUCCESS) {
;
}
result = FAIL;
}
else {
changeElementStatus(&GenericCommProM$sendQueue, msg, PROCESSING, PENDING);
GenericCommProM$tryNextSend();
return SUCCESS;
}
}
else {
;
if (removeElement(&GenericCommProM$sendQueue, msg) != SUCCESS) {
;
}
if (GenericCommProM$freeBkHeader(ind) != SUCCESS) {
;
}
}
GenericCommProM$SendMsg$sendDone(msg->type, msg, result);
GenericCommProM$tryNextSend();
return SUCCESS;
}
# 468 "/home/xu/oasis/system/queue.h"
static object_type **findObject(Queue_t *queue, object_type *obj)
#line 468
{
int16_t ind;
#line 470
if (queue->size <= 0) {
;
return NULL;
}
if (queue->total <= 0) {
;
return NULL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
;
return & (&queue->element[ind])->obj;
}
}
;
return NULL;
}
# 709 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg)
#line 709
{
uint8_t i = 0;
#line 711
for (i = 0; i < COMM_SEND_QUEUE_SIZE; i++) {
if (GenericCommProM$bkHeader[i].valid == TRUE && GenericCommProM$bkHeader[i].msgPtr == pMsg) {
break;
}
}
if (i == COMM_SEND_QUEUE_SIZE) {
;
}
return i;
}
# 307 "/home/xu/oasis/system/queue.h"
static result_t removeElement(Queue_t *queue, object_type *obj)
#line 307
{
int16_t ind;
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total <= 0) {
;
return FAIL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
_private_changeElementStatusByIndex(queue, ind, queue->element[ind].status, FREE);
queue->element[ind].obj = NULL;
queue->element[ind].retry = 0;
queue->total = queue->total - 1;
;
break;
}
}
if (ind == queue->size) {
;
return FAIL;
}
;
return SUCCESS;
}
# 722 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$freeBkHeader(uint8_t ind)
#line 722
{
if (ind < COMM_SEND_QUEUE_SIZE) {
GenericCommProM$bkHeader[ind].valid = FALSE;
GenericCommProM$bkHeader[ind].length = 0;
GenericCommProM$bkHeader[ind].type = 0;
GenericCommProM$bkHeader[ind].group = 0;
GenericCommProM$bkHeader[ind].msgPtr = 0;
GenericCommProM$bkHeader[ind].addr = 0;
return SUCCESS;
}
;
return FALSE;
}
# 496 "/home/xu/oasis/system/queue.h"
static result_t changeElementStatus(Queue_t *queue, object_type *obj, ObjStatus_t status1, ObjStatus_t status2)
#line 496
{
int16_t ind;
ind = queue->head[status1];
while (ind != -1) {
if (queue->element[ind].obj == obj) {
_private_changeElementStatusByIndex(queue, ind, status1, status2);
break;
}
else
#line 506
{
ind = queue->element[ind].next;
}
}
if (ind == -1) {
;
return FAIL;
}
else {
;
return SUCCESS;
}
}
# 593 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg)
#line 593
{
uint8_t i = 0;
#line 595
for (i = 0; i < 5; i++) {
if (MultiHopEngineM$queueEntryInfo[i].valid == TRUE && MultiHopEngineM$queueEntryInfo[i].msgPtr == pMsg) {
break;
}
}
if (i == 5) {
;
}
return i;
}
# 399 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 399
{
DataMgmtM$sendDoneR_num++;
if (success == SUCCESS) {
DataMgmtM$SysCheckTimer$stop();
DataMgmtM$sysCheckCount = 0;
DataMgmtM$SysCheckTimer$start(TIMER_ONE_SHOT, 60000UL);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 405
DataMgmtM$sendDoneFailCheckCount = 0;
#line 405
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 409
DataMgmtM$sendDoneFailCheckCount++;
#line 409
__nesc_atomic_end(__nesc_atomic); }
}
removeElement(&DataMgmtM$sendQueue, pMsg);
freeBuffer(&DataMgmtM$buffQueue, pMsg);
DataMgmtM$freebuffercount++;
DataMgmtM$tryNextSend();
return SUCCESS;
}
# 86 "/home/xu/oasis/system/buffer.h"
static result_t freeBuffer(Queue_t *bufQueue, TOS_MsgPtr buf)
#line 86
{
if (FAIL == changeElementStatus(bufQueue, buf, BUSYBUF, FREEBUF)) {
;
return FAIL;
}
;
return SUCCESS;
}
# 489 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$tryNextSend(void)
#line 489
{
if (!DataMgmtM$sendTaskBusy && headElement(&DataMgmtM$sendQueue, PENDING) != NULL) {
DataMgmtM$Leds$greenToggle();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 493
DataMgmtM$sendTaskBusy = TOS_post(DataMgmtM$sendTask);
#line 493
__nesc_atomic_end(__nesc_atomic); }
DataMgmtM$trynextSendCount++;
}
return SUCCESS;
}
# 174 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static void *MultiHopEngineM$Send$getBuffer(uint8_t AMID, TOS_MsgPtr msg, uint16_t *length)
#line 174
{
NetworkMsg *NMsg = (NetworkMsg *)msg->data;
#line 176
*length = 74 - (size_t )& ((NetworkMsg *)0)->data;
return &NMsg->data[0];
}
#line 147
static result_t MultiHopEngineM$Send$send(uint8_t AMID, TOS_MsgPtr msg, uint16_t length)
#line 147
{
uint16_t correctedLength = (size_t )& ((NetworkMsg *)0)->data + length;
#line 149
if (correctedLength > 74) {
;
MultiHopEngineM$localSendFail++;
return FAIL;
}
;
MultiHopEngineM$RouteSelect$initializeFields(msg, AMID);
if (SUCCESS == MultiHopEngineM$insertAndStartSend(msg, AMID, correctedLength, msg)) {
MultiHopEngineM$numLocalPendingPkt++;
return SUCCESS;
}
else {
return FAIL;
}
}
#line 327
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr)
#line 330
{
result_t result = FALSE;
TOS_MsgPtr msgPtr;
uint8_t infoInd;
NetworkMsg *NMsg;
NetworkMsg *NMsgCome = (NetworkMsg *)msg->data;
#line 336
TryInsert:
if (NULL != (msgPtr = allocBuffer(&MultiHopEngineM$buffQueue))) {
if ((infoInd = MultiHopEngineM$allocateInfoEntry()) == 5) {
;
}
MultiHopEngineM$queueEntryInfo[infoInd].valid = TRUE;
MultiHopEngineM$queueEntryInfo[infoInd].AMID = AMID;
MultiHopEngineM$queueEntryInfo[infoInd].resend = FALSE;
MultiHopEngineM$queueEntryInfo[infoInd].length = length;
MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr = originalTOSPtr;
MultiHopEngineM$queueEntryInfo[infoInd].msgPtr = msgPtr;
nmemcpy(msgPtr, msg, sizeof(TOS_Msg ));
if (!MultiHopEngineM$useMhopPriority) {
result = insertElement(&MultiHopEngineM$sendQueue, msgPtr);
}
else {
#line 352
result = insertElementPri(&MultiHopEngineM$sendQueue, msgPtr, NMsgCome->qos);
}
}
else
#line 353
{
if (!MultiHopEngineM$useMhopPriority) {
result = FAIL;
}
else
#line 357
{
msgPtr = tailElement(&MultiHopEngineM$sendQueue, PENDING);
if (msgPtr == NULL) {
;
result = FAIL;
goto outInsert;
}
NMsg = (NetworkMsg *)msgPtr->data;
if (NMsg->qos < NMsgCome->qos) {
infoInd = MultiHopEngineM$findInfoEntry(msgPtr);
if (infoInd == 5) {
;
}
if (MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr != NULL) {
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoInd].AMID, MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr, FAIL);
}
if (SUCCESS != removeElement(&MultiHopEngineM$sendQueue, msgPtr)) {
;
}
freeBuffer(&MultiHopEngineM$buffQueue, msgPtr);
MultiHopEngineM$freeInfoEntry(infoInd);
MultiHopEngineM$numberOfSendFailures++;
goto TryInsert;
}
else {
result = FAIL;
}
}
}
outInsert:
MultiHopEngineM$tryNextSend();
return result;
}
# 66 "/home/xu/oasis/system/buffer.h"
static TOS_MsgPtr allocBuffer(Queue_t *bufQueue)
#line 66
{
TOS_MsgPtr head;
#line 68
if (NULL != (head = headElement(bufQueue, FREEBUF))) {
if (FAIL == changeElementStatus(bufQueue, head, FREEBUF, BUSYBUF)) {
;
}
#line 71
;
return head;
}
else
#line 73
{
return NULL;
}
}
# 149 "/opt/tinyos-1.x/tos/system/tos.h"
static void *nmemcpy(void *to, const void *from, size_t n)
{
char *cto = to;
const char *cfrom = from;
while (n--) * cto++ = * cfrom++;
return to;
}
# 606 "/home/xu/oasis/lib/MultiHopOasis/MultiHopEngineM.nc"
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind)
#line 606
{
if (ind < 5) {
MultiHopEngineM$queueEntryInfo[ind].valid = FALSE;
MultiHopEngineM$queueEntryInfo[ind].AMID = 0;
MultiHopEngineM$queueEntryInfo[ind].length = 0;
MultiHopEngineM$queueEntryInfo[ind].originalTOSPtr = NULL;
MultiHopEngineM$queueEntryInfo[ind].msgPtr = NULL;
return SUCCESS;
}
else
#line 614
{
;
return FALSE;
}
}
#line 392
static result_t MultiHopEngineM$tryNextSend(void)
#line 392
{
if (!MultiHopEngineM$sendTaskBusy && headElement(&MultiHopEngineM$sendQueue, PENDING) != NULL && MultiHopEngineM$numOfPktProcessing < 4) {
if (SUCCESS != TOS_post(MultiHopEngineM$sendTask)) {
MultiHopEngineM$sendTaskBusy = FALSE;
}
else {
#line 398
MultiHopEngineM$sendTaskBusy = TRUE;
}
}
#line 400
return SUCCESS;
}
# 325 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t parent)
#line 325
{
uint8_t ind = 0;
#line 327
ind = NeighborMgmtM$findPreparedIndex(parent);
if (ind == ROUTE_INVALID) {
return FALSE;
}
else
#line 330
{
if (!(NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT)) {
NeighborMgmtM$NeighborCtrl$clearParent(FALSE);
NeighborMgmtM$NeighborTbl[ind].relation = NBR_PARENT;
NeighborMgmtM$CascadeControl$parentChanged(parent);
;
}
return TRUE;
}
}
#line 154
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id)
#line 154
{
uint8_t indes = NeighborMgmtM$findEntry(id);
#line 156
if (indes == (uint8_t )ROUTE_INVALID) {
indes = NeighborMgmtM$findEntryToBeReplaced();
NeighborMgmtM$newEntry(indes, id);
}
return indes;
}
# 72 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static result_t LedsC$Leds$redOn(void)
#line 72
{
{
}
#line 73
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 74
{
TOSH_CLR_RED_LED_PIN();
LedsC$ledsOn |= LedsC$RED_BIT;
}
#line 77
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t LedsC$Leds$redOff(void)
#line 81
{
{
}
#line 82
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 83
{
TOSH_SET_RED_LED_PIN();
LedsC$ledsOn &= ~LedsC$RED_BIT;
}
#line 86
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 263 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 263
{
uint16_t maxLen;
ApplicationMsg *pApp;
EventMsg *pEvent;
#line 268
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(pMsg, &maxLen);
pEvent = (EventMsg *)pApp->data;
;
if (SUCCESS != removeElement(&EventReportM$sendQueue, pMsg)) {
;
}
EventReportM$EventReport$eventSendDone(pEvent->type, pMsg, success);
freeBuffer(&EventReportM$buffQueue, pMsg);
EventReportM$tryNextSend();
return SUCCESS;
}
#line 298
static void EventReportM$tryNextSend(void)
#line 298
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 299
{
if (!EventReportM$taskBusy && headElement(&EventReportM$sendQueue, PENDING) != NULL) {
if (TOS_post(EventReportM$sendEvent) != SUCCESS) {
EventReportM$taskBusy = FALSE;
}
else {
EventReportM$taskBusy = TRUE;
}
}
}
#line 308
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 82 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static result_t CascadesEngineM$SendMsg$sendDone(uint8_t type, TOS_MsgPtr msg, result_t success)
#line 82
{
if (SUCCESS != removeElement(&CascadesEngineM$sendQueue, msg)) {
}
CascadesEngineM$MySend$sendDone(type, msg, success);
CascadesEngineM$tryNextSend();
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/platform/telos/TimerJiffyAsyncM.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t _jiffy)
{
TimerJiffyAsyncM$AlarmControl$disableEvents();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 73
{
TimerJiffyAsyncM$jiffy = _jiffy;
TimerJiffyAsyncM$bSet = TRUE;
}
#line 76
__nesc_atomic_end(__nesc_atomic); }
if (_jiffy > 0xFFFF) {
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(0xFFFF);
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 81
{
if (_jiffy > 2) {
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(_jiffy);
}
else {
#line 89
TimerJiffyAsyncM$AlarmCompare$setEventFromNow(2);
}
}
#line 91
__nesc_atomic_end(__nesc_atomic); }
}
#line 92
TimerJiffyAsyncM$AlarmControl$clearPendingInterrupt();
TimerJiffyAsyncM$AlarmControl$enableEvents();
return SUCCESS;
}
# 254 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static bool CascadesRouterM$getCMAu(uint8_t myindex)
#line 254
{
int8_t i = 0;
#line 256
if (CascadesRouterM$myBuffer[myindex].countDT == 0) {
return TRUE;
}
else {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myindex].childrenList[i].childID != 0) {
if (CascadesRouterM$myBuffer[myindex].childrenList[i].status != 1) {
return FALSE;
}
}
}
}
return TRUE;
}
#line 575
static void CascadesRouterM$sigRcvTask(void)
#line 575
{
TOS_MsgPtr tempPtr = NULL;
NetworkMsg *nwMsg = NULL;
int8_t i;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
tempPtr = & CascadesRouterM$myBuffer[i].tmsg;
if (tempPtr != NULL) {
nwMsg = (NetworkMsg *)tempPtr->data;
if (nwMsg->seqno == CascadesRouterM$nextSignalSeq) {
if (CascadesRouterM$Receive$receive(nwMsg->type, tempPtr, nwMsg->data,
tempPtr->length - (size_t )& ((NetworkMsg *)0)->data)) {
CascadesRouterM$myBuffer[i].signalDone = 1;
break;
}
else {
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
return;
}
}
}
}
if (CascadesRouterM$nextSignalSeq != CascadesRouterM$highestSeq + 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 601
{
CascadesRouterM$inData[CascadesRouterM$nextSignalSeq % MAX_CAS_PACKETS] = TRUE;
++CascadesRouterM$nextSignalSeq;
CascadesRouterM$expectingSeq = CascadesRouterM$highestSeq + 1;
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
}
#line 606
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 609
CascadesRouterM$sigRcvTaskBusy = FALSE;
#line 609
__nesc_atomic_end(__nesc_atomic); }
}
}
# 601 "build/telosb/RpcM.nc"
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr pMsg, void *payload, uint16_t payloadLength)
#line 601
{
NetworkMsg *nwMsg = (NetworkMsg *)pMsg->data;
ApplicationMsg *AMsg = (ApplicationMsg *)payload;
RpcCommandMsg *msg = (RpcCommandMsg *)AMsg->data;
RpcM$debugSequenceNo = nwMsg->seqno;
if (RpcM$processingCommand == FALSE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 614
RpcM$processingCommand = TRUE;
#line 614
__nesc_atomic_end(__nesc_atomic); }
if (msg->address == TOS_LOCAL_ADDRESS || msg->address == TOS_BCAST_ADDR) {
nmemcpy(RpcM$cmdStore.data, payload, payloadLength);
RpcM$cmdStoreLength = payloadLength;
RpcM$debugSequenceNo = nwMsg->seqno;
if (SUCCESS != TOS_post(RpcM$processCommand)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 622
RpcM$processingCommand = FALSE;
#line 622
__nesc_atomic_end(__nesc_atomic); }
;
return NULL;
}
else {
;
}
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 632
RpcM$processingCommand = FALSE;
#line 632
__nesc_atomic_end(__nesc_atomic); }
;
}
}
else {
;
return NULL;
}
return pMsg;
}
# 162 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t addr, uint16_t data)
#line 162
{
uint8_t status = 0;
#line 164
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 166
HPLCC2420M$f.busy = TRUE;
#line 166
__nesc_atomic_end(__nesc_atomic); }
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(addr);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
status = HPLCC2420M$adjustStatusByte(HPLCC2420M$USARTControl$rx());
HPLCC2420M$USARTControl$tx((data >> 8) & 0x0FF);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
HPLCC2420M$USARTControl$tx(data & 0x0FF);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxEmpty()) ;
TOSH_SET_RADIO_CSN_PIN();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 179
HPLCC2420M$f.busy = FALSE;
#line 179
__nesc_atomic_end(__nesc_atomic); }
#line 195
HPLCC2420M$BusArbitration$releaseBus();
}
return status;
}
# 94 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static result_t BusArbitrationM$BusArbitration$getBus(uint8_t id)
#line 94
{
bool gotbus = FALSE;
#line 96
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 96
{
if (BusArbitrationM$state == BusArbitrationM$BUS_IDLE) {
BusArbitrationM$state = BusArbitrationM$BUS_BUSY;
gotbus = TRUE;
BusArbitrationM$busid = id;
}
}
#line 102
__nesc_atomic_end(__nesc_atomic); }
if (gotbus) {
return SUCCESS;
}
#line 105
return FAIL;
}
# 424 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
static result_t HPLUSART0M$USARTControl$isTxIntrPending(void)
#line 424
{
if (HPLUSART0M$IFG1 & (1 << 7)) {
HPLUSART0M$IFG1 &= ~(1 << 7);
return SUCCESS;
}
return FAIL;
}
#line 478
static uint8_t HPLUSART0M$USARTControl$rx(void)
#line 478
{
uint8_t value;
#line 480
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 480
{
value = U0RXBUF;
}
#line 482
__nesc_atomic_end(__nesc_atomic); }
return value;
}
#line 439
static result_t HPLUSART0M$USARTControl$isRxIntrPending(void)
#line 439
{
if (HPLUSART0M$IFG1 & (1 << 6)) {
HPLUSART0M$IFG1 &= ~(1 << 6);
return SUCCESS;
}
return FAIL;
}
# 108 "/opt/tinyos-1.x/tos/platform/telos/BusArbitrationM.nc"
static result_t BusArbitrationM$BusArbitration$releaseBus(uint8_t id)
#line 108
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 109
{
if (BusArbitrationM$state == BusArbitrationM$BUS_BUSY && BusArbitrationM$busid == id) {
BusArbitrationM$state = BusArbitrationM$BUS_IDLE;
if (BusArbitrationM$isBusReleasedPending == FALSE && TOS_post(BusArbitrationM$busReleased) == TRUE) {
BusArbitrationM$isBusReleasedPending = TRUE;
}
}
}
#line 121
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 127 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t addr)
#line 127
{
uint8_t status = 0;
#line 129
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 131
HPLCC2420M$f.busy = TRUE;
#line 131
__nesc_atomic_end(__nesc_atomic); }
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(addr);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
status = HPLCC2420M$adjustStatusByte(HPLCC2420M$USARTControl$rx());
TOSH_SET_RADIO_CSN_PIN();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 140
HPLCC2420M$f.busy = FALSE;
#line 140
__nesc_atomic_end(__nesc_atomic); }
#line 152
HPLCC2420M$BusArbitration$releaseBus();
}
return status;
}
# 153 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static void MultiHopLQI$SendRouteTask(void)
#line 153
{
NetworkMsg *pNWMsg = (NetworkMsg *)&MultiHopLQI$msgBuf.data[0];
BeaconMsg *pRP = (BeaconMsg *)&pNWMsg->data[0];
uint8_t length = (size_t )& ((NetworkMsg *)0)->data + sizeof(BeaconMsg );
{
}
#line 158
;
if (MultiHopLQI$gbCurrentParent != TOS_BCAST_ADDR) {
{
}
#line 161
;
}
if (MultiHopLQI$msgBufBusy) {
TOS_post(MultiHopLQI$SendRouteTask);
;
return;
}
{
}
#line 172
;
pRP->parent = MultiHopLQI$gbCurrentParent;
pRP->parent_dup = MultiHopLQI$gbCurrentParent;
pRP->cost = MultiHopLQI$gbCurrentParentCost + MultiHopLQI$gbCurrentLinkEst;
pNWMsg->linksource = pNWMsg->source = TOS_LOCAL_ADDRESS;
pRP->hopcount = MultiHopLQI$gbCurrentHopCount;
pNWMsg->seqno = MultiHopLQI$gCurrentSeqNo++;
if (MultiHopLQI$SendMsg$send(TOS_BCAST_ADDR, length, &MultiHopLQI$msgBuf) == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 183
MultiHopLQI$msgBufBusy = TRUE;
#line 183
__nesc_atomic_end(__nesc_atomic); }
}
}
# 90 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static result_t LedsC$Leds$redToggle(void)
#line 90
{
result_t rval;
#line 92
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 92
{
if (LedsC$ledsOn & LedsC$RED_BIT) {
rval = LedsC$Leds$redOff();
}
else {
#line 96
rval = LedsC$Leds$redOn();
}
}
#line 98
__nesc_atomic_end(__nesc_atomic); }
#line 98
return rval;
}
#line 119
static result_t LedsC$Leds$greenToggle(void)
#line 119
{
result_t rval;
#line 121
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 121
{
if (LedsC$ledsOn & LedsC$GREEN_BIT) {
rval = LedsC$Leds$greenOff();
}
else {
#line 125
rval = LedsC$Leds$greenOn();
}
}
#line 127
__nesc_atomic_end(__nesc_atomic); }
#line 127
return rval;
}
#line 148
static result_t LedsC$Leds$yellowToggle(void)
#line 148
{
result_t rval;
#line 150
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 150
{
if (LedsC$ledsOn & LedsC$YELLOW_BIT) {
rval = LedsC$Leds$yellowOff();
}
else {
#line 154
rval = LedsC$Leds$yellowOn();
}
}
#line 156
__nesc_atomic_end(__nesc_atomic); }
#line 156
return rval;
}
# 282 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static result_t RealTimeM$Timer$start(uint8_t id, char type, uint32_t interval)
#line 282
{
uint8_t i;
#line 284
if (id >= NUM_TIMERS || RealTimeM$numClients >= MAX_NUM_CLIENT) {
return FAIL;
}
if (type > TIMER_ONE_SHOT) {
return FAIL;
}
if (interval > 0) {
for (i = 0; i < RealTimeM$numClients; i++) {
if (RealTimeM$clientList[i].id == id) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 295
{
RealTimeM$clientList[i].type = type;
RealTimeM$clientList[i].syncInterval = interval;
RealTimeM$clientList[i].fireCount = (RealTimeM$localTime / interval + 1) * interval;
RealTimeM$mState |= 0x1L << id;
}
#line 300
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 304
{
RealTimeM$clientList[RealTimeM$numClients].id = id;
RealTimeM$clientList[RealTimeM$numClients].type = type;
RealTimeM$clientList[RealTimeM$numClients].syncInterval = interval;
RealTimeM$clientList[RealTimeM$numClients].fireCount = (RealTimeM$localTime / interval + 1) * interval;
RealTimeM$mState |= 0x1L << id;
++RealTimeM$numClients;
}
#line 311
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
RealTimeM$Timer$stop(id);
return FAIL;
}
}
# 697 "build/telosb/RpcM.nc"
static void RpcM$tryNextSend(void)
#line 697
{
if (TRUE != RpcM$taskBusy) {
RpcM$taskBusy = TOS_post(RpcM$sendResponse);
}
return;
}
# 602 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void DataMgmtM$processTask(void)
#line 602
{
SenBlkPtr inPtr = NULL;
uint16_t taskCode = 0;
DataMgmtM$processTaskCount++;
DataMgmtM$processloopCount = 0;
DataMgmtM$GlobaltaskCode = 0;
if (NULL != (inPtr = headMemElement(&DataMgmtM$sensorMem, FILLED))) {
taskCode = inPtr->taskCode;
#line 747
DataMgmtM$processloopCount = 0;
if (taskCode == 0) {
changeMemStatus(&DataMgmtM$sensorMem, inPtr, inPtr->status, MEMPENDING);
}
}
if (NULL != (inPtr = headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING))) {
taskCode = inPtr->taskCode;
#line 775
if (taskCode == 0) {
changeMemStatus(&DataMgmtM$sensorMem, inPtr, inPtr->status, MEMPENDING);
}
}
if (TRUE != DataMgmtM$presendTaskBusy) {
if (NULL != headMemElement(&DataMgmtM$sensorMem, MEMPENDING)) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 783
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 783
__nesc_atomic_end(__nesc_atomic); }
}
}
if (NULL != headMemElement(&DataMgmtM$sensorMem, FILLED)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 789
DataMgmtM$processTaskBusy = TOS_post(DataMgmtM$processTask);
#line 789
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 793
DataMgmtM$processTaskBusy = FALSE;
#line 793
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
# 247 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static result_t changeMemStatus(MemQueue_t *queue, SenBlkPtr obj, MemStatus_t status1, MemStatus_t status2)
#line 247
{
int16_t ind;
#line 249
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 249
ind = queue->head[status1];
#line 249
__nesc_atomic_end(__nesc_atomic); }
while (ind != -1) {
if (&queue->element[ind] == obj) {
_private_changeMemStatusByIndex(queue, ind, status1, status2);
return SUCCESS;
}
else
#line 254
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 255
ind = queue->element[ind].next;
#line 255
__nesc_atomic_end(__nesc_atomic); }
}
}
return FAIL;
}
# 509 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void DataMgmtM$presendTask(void)
#line 509
{
NetworkMsg *nwMsg = NULL;
ApplicationMsg *appMsg = NULL;
TOS_MsgPtr msg = NULL;
SenBlkPtr p = NULL;
TimeStamp_t *ts = NULL;
#line 517
DataMgmtM$presendTaskCount++;
if (NULL != (p = headMemElement(&DataMgmtM$sensorMem, MEMPENDING))) {
if (NULL != (msg = allocBuffer(&DataMgmtM$buffQueue))) {
DataMgmtM$allocbuffercount++;
nwMsg = (NetworkMsg *)msg->data;
nwMsg->qos = p->priority;
appMsg = (ApplicationMsg *)nwMsg->data;
appMsg->length = TSTAMPOFFSET + p->size;
appMsg->type = p->type;
appMsg->seqno = DataMgmtM$seqno;
if (nwMsg->qos == 0) {
DataMgmtM$DataMgmt$freeBlk((void *)p);
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 537
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 537
__nesc_atomic_end(__nesc_atomic); }
return;
}
ts = (TimeStamp_t *)appMsg->data;
ts->millisec = p->time % 1000UL;
ts->second = p->time / 1000UL % 60;
ts->minute = p->time / 60000UL % 60;
ts->interval = p->interval;
nmemcpy((void *)(appMsg->data + TSTAMPOFFSET), (void *)p->buffer, p->size);
if (SUCCESS != DataMgmtM$insertAndStartSend(msg)) {
;
DataMgmtM$freebuffercount++;
freeBuffer(&DataMgmtM$buffQueue, msg);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 552
DataMgmtM$presendTaskBusy = FALSE;
#line 552
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
if (p->type == TYPE_DATA_COMPRESS && p->compressnum > 0) {
DataMgmtM$seqno += p->compressnum - 1;
;
}
DataMgmtM$DataMgmt$freeBlk((void *)p);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 561
DataMgmtM$seqno++;
#line 561
__nesc_atomic_end(__nesc_atomic); }
;
}
}
else {
DataMgmtM$f_allocbuffercount++;
DataMgmtM$tryNextSend();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 569
DataMgmtM$presendTaskBusy = FALSE;
#line 569
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
else {
DataMgmtM$nothingtosend++;
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 577
DataMgmtM$presendTaskBusy = FALSE;
#line 577
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (headMemElement(&DataMgmtM$sensorMem, MEMPENDING) != NULL) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 582
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 582
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 587
DataMgmtM$presendTaskBusy = FALSE;
#line 587
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
# 571 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static void TimeSyncM$adjustRootID(void)
#line 571
{
if (TimeSyncM$RealTime$getMode() == GPS_SYNC) {
if (TimeSyncM$RealTime$isSync()) {
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
else {
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
}
else
{
}
}
else
{
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff && ++TimeSyncM$heartBeats > TimeSyncM$ROOT_TIMEOUT) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
TimeSyncM$heartBeats = 0;
}
else {
if (TimeSyncM$heartBeats > TimeSyncM$ROOT_TIMEOUT) {
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
else {
}
}
}
}
static void TimeSyncM$sendMsg(void)
#line 624
{
uint32_t localTime;
#line 625
uint32_t globalTime_t;
localTime = TimeSyncM$GlobalTime$getLocalTime();
if (TimeSyncM$mode != TS_USER_MODE) {
TimeSyncM$GlobalTime$getGlobalTime(&globalTime_t);
}
else
#line 631
{
}
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS) {
if ((int32_t )(localTime - TimeSyncM$localAverage) >= 0x20000000) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 641
{
TimeSyncM$localAverage = localTime;
TimeSyncM$offsetAverage = globalTime_t - localTime;
}
#line 644
__nesc_atomic_end(__nesc_atomic); }
}
}
TimeSyncM$adjustRootID();
if (TimeSyncM$mode != TS_USER_MODE) {
if (TimeSyncM$numEntries < TimeSyncM$ENTRY_SEND_LIMIT && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != TOS_LOCAL_ADDRESS) {
++TimeSyncM$heartBeats;
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
}
else {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->sendingTime = globalTime_t - localTime;
(
(TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->wroteStamp = FAIL;
if (TimeSyncM$SendMsg$send(TOS_BCAST_ADDR, TIMESYNCMSG_LEN, &TimeSyncM$outgoingMsgBuffer) != SUCCESS) {
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
}
}
}
else {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->sendingTime = globalTime_t - localTime;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->wroteStamp = FAIL;
if (TimeSyncM$SendMsg$send(TOS_BCAST_ADDR, TIMESYNCMSG_LEN, &TimeSyncM$outgoingMsgBuffer) != SUCCESS) {
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
}
}
}
# 459 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static uint32_t RealTimeM$LocalTime$read(void)
#line 459
{
uint32_t time;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 462
time = RealTimeM$localTime;
#line 462
__nesc_atomic_end(__nesc_atomic); }
return time;
}
# 216 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *time)
{
*time = TimeSyncM$GlobalTime$getLocalTime();
return TimeSyncM$GlobalTime$local2Global(time);
}
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *time)
{
*time += TimeSyncM$offsetAverage + (int32_t )(TimeSyncM$skew * (int32_t )(*time - TimeSyncM$localAverage));
return TimeSyncM$is_synced();
}
# 123 "/opt/tinyos-1.x/tos/platform/msp430/MSP430TimerM.nc"
__attribute((wakeup)) __attribute((interrupt(12))) void sig_TIMERA0_VECTOR(void)
{
if (MSP430TimerM$ControlA0$getControl().cap) {
MSP430TimerM$CaptureA0$captured(MSP430TimerM$CaptureA0$getEvent());
}
else {
#line 128
MSP430TimerM$CompareA0$fired();
}
}
#line 131
__attribute((wakeup)) __attribute((interrupt(10))) void sig_TIMERA1_VECTOR(void)
{
int n = TA0IV;
#line 134
switch (n)
{
case 0: break;
case 2:
if (MSP430TimerM$ControlA1$getControl().cap) {
MSP430TimerM$CaptureA1$captured(MSP430TimerM$CaptureA1$getEvent());
}
else {
#line 141
MSP430TimerM$CompareA1$fired();
}
#line 142
break;
case 4:
if (MSP430TimerM$ControlA2$getControl().cap) {
MSP430TimerM$CaptureA2$captured(MSP430TimerM$CaptureA2$getEvent());
}
else {
#line 147
MSP430TimerM$CompareA2$fired();
}
#line 148
break;
case 6: break;
case 8: break;
case 10: MSP430TimerM$TimerA$overflow();
#line 151
break;
case 12: break;
case 14: break;
}
}
#line 277
__attribute((wakeup)) __attribute((interrupt(26))) void sig_TIMERB0_VECTOR(void)
{
if (MSP430TimerM$ControlB0$getControl().cap) {
MSP430TimerM$CaptureB0$captured(MSP430TimerM$CaptureB0$getEvent());
}
else {
#line 282
MSP430TimerM$CompareB0$fired();
}
}
#line 285
__attribute((wakeup)) __attribute((interrupt(24))) void sig_TIMERB1_VECTOR(void)
{
int n = TBIV;
#line 288
switch (n)
{
case 0: break;
case 2:
if (MSP430TimerM$ControlB1$getControl().cap) {
MSP430TimerM$CaptureB1$captured(MSP430TimerM$CaptureB1$getEvent());
}
else {
#line 295
MSP430TimerM$CompareB1$fired();
}
#line 296
break;
case 4:
if (MSP430TimerM$ControlB2$getControl().cap) {
MSP430TimerM$CaptureB2$captured(MSP430TimerM$CaptureB2$getEvent());
}
else {
#line 301
MSP430TimerM$CompareB2$fired();
}
#line 302
break;
case 6:
if (MSP430TimerM$ControlB3$getControl().cap) {
MSP430TimerM$CaptureB3$captured(MSP430TimerM$CaptureB3$getEvent());
}
else {
#line 307
MSP430TimerM$CompareB3$fired();
}
#line 308
break;
case 8:
if (MSP430TimerM$ControlB4$getControl().cap) {
MSP430TimerM$CaptureB4$captured(MSP430TimerM$CaptureB4$getEvent());
}
else {
#line 313
MSP430TimerM$CompareB4$fired();
}
#line 314
break;
case 10:
if (MSP430TimerM$ControlB5$getControl().cap) {
MSP430TimerM$CaptureB5$captured(MSP430TimerM$CaptureB5$getEvent());
}
else {
#line 319
MSP430TimerM$CompareB5$fired();
}
#line 320
break;
case 12:
if (MSP430TimerM$ControlB6$getControl().cap) {
MSP430TimerM$CaptureB6$captured(MSP430TimerM$CaptureB6$getEvent());
}
else {
#line 325
MSP430TimerM$CompareB6$fired();
}
#line 326
break;
case 14: MSP430TimerM$TimerB$overflow();
#line 327
break;
}
}
# 185 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static result_t HPLCC2420InterruptM$SFD$enableCapture(bool low_to_high)
#line 185
{
uint8_t _direction;
#line 187
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 187
{
TOSH_SEL_CC_SFD_MODFUNC();
HPLCC2420InterruptM$SFDControl$disableEvents();
if (low_to_high) {
#line 190
_direction = MSP430TIMER_CM_RISING;
}
else {
#line 191
_direction = MSP430TIMER_CM_FALLING;
}
#line 192
HPLCC2420InterruptM$SFDControl$setControlAsCapture(_direction);
HPLCC2420InterruptM$SFDCapture$clearOverflow();
HPLCC2420InterruptM$SFDControl$clearPendingInterrupt();
HPLCC2420InterruptM$SFDControl$enableEvents();
}
#line 196
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t HPLCC2420InterruptM$SFD$disable(void)
#line 200
{
/* atomic removed: atomic calls only */
#line 201
{
HPLCC2420InterruptM$SFDControl$disableEvents();
HPLCC2420InterruptM$SFDControl$clearPendingInterrupt();
TOSH_SEL_CC_SFD_IOFUNC();
}
return SUCCESS;
}
# 292 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t addr, uint8_t _length, uint8_t *buffer)
#line 292
{
uint8_t i = 0;
#line 294
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 295
{
HPLCC2420M$f.busy = TRUE;
HPLCC2420M$ramaddr = addr;
HPLCC2420M$ramlen = _length;
HPLCC2420M$rambuf = buffer;
}
#line 300
__nesc_atomic_end(__nesc_atomic); }
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx((HPLCC2420M$ramaddr & 0x7F) | 0x80);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
HPLCC2420M$USARTControl$tx((HPLCC2420M$ramaddr >> 1) & 0xC0);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
for (i = 0; i < HPLCC2420M$ramlen; i++) {
HPLCC2420M$USARTControl$tx(HPLCC2420M$rambuf[i]);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxIntrPending()) ;
}
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isTxEmpty()) ;
TOSH_SET_RADIO_CSN_PIN();
HPLCC2420M$BusArbitration$releaseBus();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 316
HPLCC2420M$f.busy = FALSE;
#line 316
__nesc_atomic_end(__nesc_atomic); }
return TOS_post(HPLCC2420M$signalRAMWr);
}
return FAIL;
}
# 113 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$sendFailed(void)
#line 113
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 114
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
#line 114
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$txbufptr->length = CC2420RadioM$txbufptr->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
CC2420RadioM$Send$sendDone(CC2420RadioM$txbufptr, FAIL);
}
#line 168
static void CC2420RadioM$PacketSent(void)
#line 168
{
TOS_MsgPtr pBuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 171
{
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
pBuf = CC2420RadioM$txbufptr;
pBuf->length = pBuf->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
}
#line 175
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$Send$sendDone(pBuf, SUCCESS);
}
#line 393
static void CC2420RadioM$startSend(void)
#line 393
{
if (!CC2420RadioM$HPLChipcon$cmd(0x09)) {
CC2420RadioM$sendFailed();
return;
}
if (!CC2420RadioM$HPLChipconFIFO$writeTXFIFO(CC2420RadioM$txlength + 1, (uint8_t *)CC2420RadioM$txbufptr)) {
CC2420RadioM$sendFailed();
return;
}
}
static void CC2420RadioM$tryToSend(void)
#line 410
{
uint8_t currentstate;
#line 412
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 412
currentstate = CC2420RadioM$stateRadio;
#line 412
__nesc_atomic_end(__nesc_atomic); }
if (currentstate == CC2420RadioM$PRE_TX_STATE) {
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
}
if (TOSH_READ_RADIO_CCA_PIN()) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 424
CC2420RadioM$stateRadio = CC2420RadioM$TX_STATE;
#line 424
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$sendPacket();
}
else {
if (CC2420RadioM$countRetry-- <= 0) {
CC2420RadioM$flushRXFIFO();
CC2420RadioM$countRetry = 8;
if (!TOS_post(CC2420RadioM$startSend)) {
CC2420RadioM$sendFailed();
}
#line 436
return;
}
if (!CC2420RadioM$setBackoffTimer(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10)) {
CC2420RadioM$sendFailed();
}
}
}
}
#line 119
static void CC2420RadioM$flushRXFIFO(void)
#line 119
{
CC2420RadioM$FIFOP$disable();
CC2420RadioM$HPLChipcon$read(0x3F);
CC2420RadioM$HPLChipcon$cmd(0x08);
CC2420RadioM$HPLChipcon$cmd(0x08);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 124
CC2420RadioM$bPacketReceiving = FALSE;
#line 124
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$FIFOP$startWait(FALSE);
}
# 78 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static result_t HPLCC2420InterruptM$FIFOP$disable(void)
#line 78
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 79
{
HPLCC2420InterruptM$FIFOPInterrupt$disable();
HPLCC2420InterruptM$FIFOPInterrupt$clear();
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 205 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420M.nc"
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t addr)
#line 205
{
uint16_t data = 0;
#line 207
if (HPLCC2420M$BusArbitration$getBus() == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 209
HPLCC2420M$f.busy = TRUE;
#line 209
__nesc_atomic_end(__nesc_atomic); }
TOSH_CLR_RADIO_CSN_PIN();
HPLCC2420M$USARTControl$isTxIntrPending();
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(addr | 0x40);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
HPLCC2420M$USARTControl$rx();
HPLCC2420M$USARTControl$tx(0);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
data = (HPLCC2420M$USARTControl$rx() << 8) & 0xFF00;
HPLCC2420M$USARTControl$tx(0);
while (HPLCC2420M$f.enabled && !HPLCC2420M$USARTControl$isRxIntrPending()) ;
data = data | (HPLCC2420M$USARTControl$rx() & 0x0FF);
TOSH_SET_RADIO_CSN_PIN();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 224
HPLCC2420M$f.busy = FALSE;
#line 224
__nesc_atomic_end(__nesc_atomic); }
#line 242
HPLCC2420M$BusArbitration$releaseBus();
}
return data;
}
# 65 "/opt/tinyos-1.x/tos/platform/telos/HPLCC2420InterruptM.nc"
static result_t HPLCC2420InterruptM$FIFOP$startWait(bool low_to_high)
#line 65
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 66
{
HPLCC2420InterruptM$FIFOPInterrupt$disable();
HPLCC2420InterruptM$FIFOPInterrupt$clear();
HPLCC2420InterruptM$FIFOPInterrupt$edge(low_to_high);
HPLCC2420InterruptM$FIFOPInterrupt$enable();
}
#line 71
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 373 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static void RealTimeM$signalOneTimer(void)
#line 373
{
uint8_t itimer;
#line 375
if ((itimer = RealTimeM$dequeue()) < NUM_TIMERS) {
RealTimeM$Timer$fired(itimer);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 377
RealTimeM$taskBusy = TOS_post(RealTimeM$signalOneTimer);
#line 377
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 380
RealTimeM$taskBusy = FALSE;
#line 380
__nesc_atomic_end(__nesc_atomic); }
}
}
#line 169
static uint32_t RealTimeM$RealTime$getTimeCount(void)
#line 169
{
if (RealTimeM$syncMode == FTSP_SYNC) {
return RealTimeM$globaltime_t;
}
else {
#line 180
return RealTimeM$localTime % HOUR_END;
}
}
# 160 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static void ADCM$readADCTask(void)
#line 160
{
if (ADCM$adc_count[0] == 0) {
return;
}
if (ADCM$triggerConversion(0) == SUCCESS) {
ADCM$Leds$greenToggle();
ADCM$adc_count[0] -= 1;
}
else {
#line 168
TOS_post(ADCM$readADCTask);
}
}
#line 137
static result_t ADCM$triggerConversion(uint8_t port)
#line 137
{
MSP430ADC12Settings_t settings;
#line 140
settings.refVolt2_5 = (ADCM$TOSH_adc_portmap[port] & 0x80) >> 7;
settings.clockSourceSHT = SHT_SOURCE_SMCLK;
settings.clockSourceSAMPCON = SAMPCON_SOURCE_SMCLK;
settings.referenceVoltage = (ADCM$TOSH_adc_portmap[port] & 0x70) >> 4;
settings.clockDivSAMPCON = SAMPCON_CLOCK_DIV_1;
settings.clockDivSHT = SHT_CLOCK_DIV_1;
settings.inputChannel = ADCM$TOSH_adc_portmap[port] & 0x0F;
settings.sampleHoldTime = ADCM$samplingRate;
if (ADCM$MSP430ADC12Single$bind(settings) == SUCCESS) {
if (!ADCM$continuousData && ADCM$MSP430ADC12Single$getData() != MSP430ADC12_FAIL) {
ADCM$owner = port;
return SUCCESS;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 156
ADCM$busy = FALSE;
#line 156
__nesc_atomic_end(__nesc_atomic); }
return FAIL;
}
# 203 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static msp430ADCresult_t MSP430ADC12M$newRequest(uint8_t req, uint8_t num, void *dataDest, uint16_t length, uint16_t jiffies)
{
bool access = FALSE;
msp430ADCresult_t res = MSP430ADC12_FAIL;
const int16_t num16 = num;
if (num16 >= 5U || (!MSP430ADC12M$reserved && (
!length || (req == REPEAT_SEQUENCE_OF_CHANNELS && length > 16)))) {
return MSP430ADC12_FAIL;
}
if (jiffies == 1 || jiffies == 2) {
return MSP430ADC12_FAIL;
}
if (MSP430ADC12M$reserved & RESERVED) {
if (!(MSP430ADC12M$reserved & VREF_WAIT) && MSP430ADC12M$owner == num16 && MSP430ADC12M$cmode == req) {
MSP430ADC12M$HPLADC12$startConversion();
if (MSP430ADC12M$reserved & TIMER_USED) {
MSP430ADC12M$startTimerA();
}
#line 233
MSP430ADC12M$reserved = ADC_IDLE;
return MSP430ADC12_SUCCESS;
}
else {
#line 236
return MSP430ADC12_FAIL;
}
}
#line 238
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 238
{
if (MSP430ADC12M$cmode == ADC_IDLE) {
MSP430ADC12M$owner = num16;
MSP430ADC12M$cmode = SEQUENCE_OF_CHANNELS;
access = TRUE;
}
}
#line 244
__nesc_atomic_end(__nesc_atomic); }
if (access) {
res = MSP430ADC12_SUCCESS;
switch (MSP430ADC12M$getRefVolt(num16))
{
case MSP430ADC12_FAIL:
MSP430ADC12M$cmode = ADC_IDLE;
res = MSP430ADC12_FAIL;
break;
case MSP430ADC12_DELAYED:
req |= RESERVED | VREF_WAIT;
res = MSP430ADC12_DELAYED;
MSP430ADC12M$vrefWait = TRUE;
case MSP430ADC12_SUCCESS:
{
int8_t i;
#line 263
int8_t memctlsUsed = length;
uint16_t mask = 1;
adc12memctl_t lastMemctl = MSP430ADC12M$adc12settings[num16].memctl;
uint16_t ctl0 = (0x0000 | 0x0010) & ~0x0080;
adc12ctl1_t ctl1 = { .adc12busy = 0, .conseq = 1,
.adc12ssel = MSP430ADC12M$adc12settings[num16].clockSourceSHT,
.adc12div = MSP430ADC12M$adc12settings[num16].clockDivSHT, .issh = 0, .shp = 1,
.shs = 1, .cstartadd = 0 };
#line 271
if (length > 16) {
ctl1.conseq = 3;
memctlsUsed = 16;
}
MSP430ADC12M$bufPtr = dataDest;
MSP430ADC12M$bufLength = length;
MSP430ADC12M$bufOffset = 0;
MSP430ADC12M$HPLADC12$disableConversion();
if (jiffies == 0) {
ctl0 = (0x0000 | 0x0010) | 0x0080;
ctl1.shs = 0;
}
for (i = 0; i < memctlsUsed - 1; i++)
MSP430ADC12M$HPLADC12$setMemControl(i, MSP430ADC12M$adc12settings[num16].memctl);
lastMemctl.eos = 1;
MSP430ADC12M$HPLADC12$setMemControl(i, lastMemctl);
MSP430ADC12M$HPLADC12$setIEFlags(mask << i);
MSP430ADC12M$HPLADC12$setControl0_IgnoreRef(* (adc12ctl0_t *)&ctl0);
MSP430ADC12M$HPLADC12$setSHT(MSP430ADC12M$adc12settings[num16].sampleHoldTime);
if (req & SINGLE_CHANNEL) {
ctl1.conseq = 0;
MSP430ADC12M$cmode = SINGLE_CHANNEL;
}
else {
#line 296
if (req & REPEAT_SINGLE_CHANNEL) {
ctl1.conseq = 2;
MSP430ADC12M$cmode = REPEAT_SINGLE_CHANNEL;
}
else {
#line 299
if (req & REPEAT_SEQUENCE_OF_CHANNELS) {
ctl1.conseq = 3;
MSP430ADC12M$cmode = REPEAT_SEQUENCE_OF_CHANNELS;
}
}
}
#line 303
MSP430ADC12M$HPLADC12$setControl1(ctl1);
if (req & RESERVED) {
MSP430ADC12M$reserved = req;
if (jiffies != 0) {
MSP430ADC12M$prepareTimerA(jiffies, MSP430ADC12M$adc12settings[num16].clockSourceSAMPCON,
MSP430ADC12M$adc12settings[num16].clockDivSAMPCON);
MSP430ADC12M$reserved |= TIMER_USED;
}
}
else
#line 313
{
MSP430ADC12M$HPLADC12$startConversion();
if (jiffies != 0) {
MSP430ADC12M$prepareTimerA(jiffies, MSP430ADC12M$adc12settings[num16].clockSourceSAMPCON,
MSP430ADC12M$adc12settings[num16].clockDivSAMPCON);
MSP430ADC12M$startTimerA();
}
}
res = MSP430ADC12_SUCCESS;
break;
}
}
}
return res;
}
# 106 "/opt/tinyos-1.x/tos/platform/msp430/RefVoltM.nc"
static result_t RefVoltM$RefVolt$get(RefVolt_t vref)
#line 106
{
result_t result = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 109
{
if (RefVoltM$semaCount == 0) {
if (RefVoltM$HPLADC12$isBusy()) {
result = FAIL;
}
else
#line 113
{
if (RefVoltM$state == RefVoltM$REFERENCE_OFF) {
RefVoltM$switchRefOn(vref);
}
else {
#line 116
if ((RefVoltM$state == RefVoltM$REFERENCE_1_5V_PENDING && vref == REFERENCE_2_5V) || (
RefVoltM$state == RefVoltM$REFERENCE_2_5V_PENDING && vref == REFERENCE_1_5V)) {
RefVoltM$switchToRefPending(vref);
}
else {
#line 119
if ((RefVoltM$state == RefVoltM$REFERENCE_1_5V_STABLE && vref == REFERENCE_2_5V) || (
RefVoltM$state == RefVoltM$REFERENCE_2_5V_STABLE && vref == REFERENCE_1_5V)) {
RefVoltM$switchToRefStable(vref);
}
}
}
#line 122
RefVoltM$semaCount++;
RefVoltM$switchOff = FALSE;
result = SUCCESS;
}
}
else {
if ((((
#line 127
RefVoltM$state == RefVoltM$REFERENCE_1_5V_PENDING && vref == REFERENCE_1_5V) || (
RefVoltM$state == RefVoltM$REFERENCE_2_5V_PENDING && vref == REFERENCE_2_5V)) || (
RefVoltM$state == RefVoltM$REFERENCE_1_5V_STABLE && vref == REFERENCE_1_5V)) || (
RefVoltM$state == RefVoltM$REFERENCE_2_5V_STABLE && vref == REFERENCE_2_5V)) {
RefVoltM$semaCount++;
RefVoltM$switchOff = FALSE;
result = SUCCESS;
}
else {
#line 135
result = FAIL;
}
}
}
#line 138
__nesc_atomic_end(__nesc_atomic); }
#line 137
return result;
}
# 73 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static void HPLADC12M$HPLADC12$setMemControl(uint8_t i, adc12memctl_t memControl)
#line 73
{
uint8_t *memCtlPtr = (uint8_t *)(char *)0x0080;
#line 75
if (i < 16) {
memCtlPtr += i;
*memCtlPtr = * (uint8_t *)&memControl;
}
}
# 168 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static void MSP430ADC12M$prepareTimerA(uint16_t interval, uint16_t csSAMPCON, uint16_t cdSAMPCON)
{
MSP430CompareControl_t ccResetSHI = {
.ccifg = 0, .cov = 0, .out = 0, .cci = 0, .ccie = 0,
.outmod = 0, .cap = 0, .clld = 0, .scs = 0, .ccis = 0, .cm = 0 };
MSP430ADC12M$TimerA$setMode(MSP430TIMER_STOP_MODE);
MSP430ADC12M$TimerA$clear();
MSP430ADC12M$TimerA$disableEvents();
MSP430ADC12M$TimerA$setClockSource(csSAMPCON);
MSP430ADC12M$TimerA$setInputDivider(cdSAMPCON);
MSP430ADC12M$ControlA0$setControl(ccResetSHI);
MSP430ADC12M$CompareA0$setEvent(interval - 1);
MSP430ADC12M$CompareA1$setEvent((interval - 1) / 2);
}
# 171 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static void ADCM$readLightTask(void)
#line 171
{
if (ADCM$adc_count[1] == 0) {
return;
}
if (ADCM$triggerConversion(1) == SUCCESS) {
ADCM$Leds$redToggle();
ADCM$adc_count[1] -= 1;
}
else {
#line 179
TOS_post(ADCM$readLightTask);
}
}
# 58 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART0M.nc"
__attribute((wakeup)) __attribute((interrupt(18))) void sig_UART0RX_VECTOR(void)
#line 58
{
uint8_t temp = U0RXBUF;
#line 60
HPLUSART0M$USARTData$rxDone(temp);
}
__attribute((wakeup)) __attribute((interrupt(16))) void sig_UART0TX_VECTOR(void)
#line 63
{
if (HPLUSART0M$USARTControl$isI2C()) {
HPLUSART0M$HPLI2CInterrupt$fired();
}
else {
#line 67
HPLUSART0M$USARTData$txDone();
}
}
# 56 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
__attribute((wakeup)) __attribute((interrupt(8))) void sig_PORT1_VECTOR(void)
{
volatile int n = MSP430InterruptM$P1IFG & MSP430InterruptM$P1IE;
if (n & (1 << 0)) {
#line 60
MSP430InterruptM$Port10$fired();
#line 60
return;
}
#line 61
if (n & (1 << 1)) {
#line 61
MSP430InterruptM$Port11$fired();
#line 61
return;
}
#line 62
if (n & (1 << 2)) {
#line 62
MSP430InterruptM$Port12$fired();
#line 62
return;
}
#line 63
if (n & (1 << 3)) {
#line 63
MSP430InterruptM$Port13$fired();
#line 63
return;
}
#line 64
if (n & (1 << 4)) {
#line 64
MSP430InterruptM$Port14$fired();
#line 64
return;
}
#line 65
if (n & (1 << 5)) {
#line 65
MSP430InterruptM$Port15$fired();
#line 65
return;
}
#line 66
if (n & (1 << 6)) {
#line 66
MSP430InterruptM$Port16$fired();
#line 66
return;
}
#line 67
if (n & (1 << 7)) {
#line 67
MSP430InterruptM$Port17$fired();
#line 67
return;
}
}
# 540 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$delayedRXFIFO(void)
#line 540
{
uint8_t len = MSG_DATA_SIZE;
uint8_t _bPacketReceiving;
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 549
{
_bPacketReceiving = CC2420RadioM$bPacketReceiving;
if (_bPacketReceiving) {
if (!TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$flushRXFIFO();
}
}
else
#line 555
{
CC2420RadioM$bPacketReceiving = TRUE;
}
}
#line 558
__nesc_atomic_end(__nesc_atomic); }
if (!_bPacketReceiving) {
if (!CC2420RadioM$HPLChipconFIFO$readRXFIFO(len, (uint8_t *)CC2420RadioM$rxbufptr)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 566
CC2420RadioM$bPacketReceiving = FALSE;
#line 566
__nesc_atomic_end(__nesc_atomic); }
if (!TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$flushRXFIFO();
}
return;
}
}
CC2420RadioM$flushRXFIFO();
}
# 650 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg)
#line 650
{
uint16_t addr = TOS_LOCAL_ADDRESS;
#line 653
if (msg->crc == 1 && msg->group == TOS_AM_GROUP) {
GenericCommProM$Intercept$intercept(msg, msg->data, msg->length);
}
if (
#line 656
msg->crc == 1 &&
msg->group == TOS_AM_GROUP && (
msg->addr == TOS_BCAST_ADDR ||
msg->addr == addr)) {
uint8_t type = msg->type;
TOS_MsgPtr tmp;
#line 662
tmp = GenericCommProM$ReceiveMsg$receive(type, msg);
if (tmp) {
msg = tmp;
}
}
#line 666
return msg;
}
# 227 "/home/xu/oasis/system/platform/telosb/RTC/RealTimeM.nc"
static result_t RealTimeM$RealTime$setTimeCount(uint32_t newCount, uint8_t userMode)
#line 227
{
uint8_t i = 0;
uint32_t interval = 0;
uint32_t localcount = 0;
result_t result = FAIL;
if (RealTimeM$syncMode == FTSP_SYNC && userMode == FTSP_SYNC) {
RealTimeM$GlobalTime$getGlobalTime(&localcount);
if (localcount) {
if (RealTimeM$is_synced != TRUE) {
if (newCount == 0) {
RealTimeM$localTime = localcount;
}
RealTimeM$is_synced = TRUE;
RealTimeM$Leds$yellowToggle();
result = SUCCESS;
}
else
#line 250
{
return result;
}
}
}
if (RealTimeM$mState) {
for (i = 0; i < RealTimeM$numClients; i++) {
if (RealTimeM$mState & (0x1L << RealTimeM$clientList[i].id)) {
interval = RealTimeM$clientList[i].syncInterval;
if (interval != 0) {
RealTimeM$clientList[i].fireCount = (RealTimeM$localTime / interval + 1) * interval;
RealTimeM$Leds$greenToggle();
}
}
}
}
return result;
}
# 357 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect)
#line 357
{
uint8_t ind = 0;
#line 359
ind = NeighborMgmtM$findPreparedIndex(childAddr);
if (ind == ROUTE_INVALID) {
return FALSE;
}
else
#line 362
{
if (isDirect) {
if (!(NeighborMgmtM$NeighborTbl[ind].relation & NBR_DIRECT_CHILD)) {
NeighborMgmtM$NeighborTbl[ind].relation = NBR_DIRECT_CHILD | NBR_CHILD;
NeighborMgmtM$CascadeControl$addDirectChild(childAddr);
}
}
else {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_DIRECT_CHILD) {
NeighborMgmtM$CascadeControl$deleteDirectChild(childAddr);
}
NeighborMgmtM$NeighborTbl[ind].relation = NBR_CHILD;
}
NeighborMgmtM$NeighborTbl[ind].priorHop = priorHop;
NeighborMgmtM$NeighborTbl[ind].childLiveliness = CHILD_LIVELINESS;
return TRUE;
}
}
# 188 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$addToChildrenList(address_t nodeID)
#line 188
{
int8_t i;
int8_t myIndex;
bool found;
int8_t first = 0;
#line 193
for (myIndex = MAX_CAS_BUF - 1; myIndex >= 0; myIndex--) {
found = FALSE;
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
if (found != TRUE) {
found = TRUE;
}
else {
CascadesRouterM$myBuffer[myIndex].childrenList[i].childID = 0;
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 0;
}
}
else {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == 0) {
if (first == 0) {
first = i;
}
}
}
}
if (found != TRUE) {
CascadesRouterM$myBuffer[myIndex].childrenList[first].childID = nodeID;
CascadesRouterM$myBuffer[myIndex].childrenList[first].status = 0;
}
}
}
# 147 "/home/xu/oasis/lib/MultiHopOasis/MultiHopLQI.nc"
static uint16_t MultiHopLQI$adjustLQI(uint8_t val)
#line 147
{
uint16_t result = 80 - (val - 50);
#line 149
result = (result * result >> 3) * result >> 3;
return result;
}
# 439 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t addr, uint16_t parentCost)
#line 439
{
uint8_t ind = 0;
#line 441
ind = NeighborMgmtM$findPreparedIndex(addr);
if (ind == ROUTE_INVALID) {
;
return FALSE;
}
else {
NeighborMgmtM$NeighborTbl[ind].parentCost = parentCost;
return TRUE;
}
}
# 960 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(uint8_t type, TOS_MsgPtr tmsg)
#line 960
{
CasCtrlMsg *CCMsg;
#line 962
if (type == AM_CASCTRLMSG) {
CCMsg = (CasCtrlMsg *)tmsg->data;
switch (CCMsg->type) {
case TYPE_CASCADES_NODATA: {
CascadesRouterM$processNoData(tmsg);
}
break;
case TYPE_CASCADES_ACK: {
CascadesRouterM$processACK(tmsg);
}
break;
case TYPE_CASCADES_REQ: {
if (CascadesRouterM$RequestProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvRequestMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 976
CascadesRouterM$RequestProcessBusy = TOS_post(CascadesRouterM$processRequest);
#line 976
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
case TYPE_CASCADES_CMAU: {
if (CascadesRouterM$CMAuProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvCMAuMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 983
CascadesRouterM$CMAuProcessBusy = TOS_post(CascadesRouterM$processCMAu);
#line 983
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
default: {
;
}
#line 989
break;
}
}
else {
#line 992
if (type == AM_CASCADESMSG) {
if (CascadesRouterM$DataProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvDataMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 995
CascadesRouterM$DataProcessBusy = TOS_post(CascadesRouterM$processData);
#line 995
__nesc_atomic_end(__nesc_atomic); }
}
}
else {
;
}
}
#line 1001
return tmsg;
}
#line 148
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex)
#line 148
{
int8_t i;
#line 150
if (myIndex < MAX_CAS_BUF) {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 1;
}
}
}
}
# 71 "/opt/tinyos-1.x/tos/platform/msp430/MSP430InterruptM.nc"
__attribute((wakeup)) __attribute((interrupt(2))) void sig_PORT2_VECTOR(void)
{
volatile int n = MSP430InterruptM$P2IFG & MSP430InterruptM$P2IE;
if (n & (1 << 0)) {
#line 75
MSP430InterruptM$Port20$fired();
#line 75
return;
}
#line 76
if (n & (1 << 1)) {
#line 76
MSP430InterruptM$Port21$fired();
#line 76
return;
}
#line 77
if (n & (1 << 2)) {
#line 77
MSP430InterruptM$Port22$fired();
#line 77
return;
}
#line 78
if (n & (1 << 3)) {
#line 78
MSP430InterruptM$Port23$fired();
#line 78
return;
}
#line 79
if (n & (1 << 4)) {
#line 79
MSP430InterruptM$Port24$fired();
#line 79
return;
}
#line 80
if (n & (1 << 5)) {
#line 80
MSP430InterruptM$Port25$fired();
#line 80
return;
}
#line 81
if (n & (1 << 6)) {
#line 81
MSP430InterruptM$Port26$fired();
#line 81
return;
}
#line 82
if (n & (1 << 7)) {
#line 82
MSP430InterruptM$Port27$fired();
#line 82
return;
}
}
#line 85
__attribute((wakeup)) __attribute((interrupt(28))) void sig_NMI_VECTOR(void)
{
volatile int n = IFG1;
#line 88
if (n & (1 << 4)) {
#line 88
MSP430InterruptM$NMI$fired();
#line 88
return;
}
#line 89
if (n & (1 << 1)) {
#line 89
MSP430InterruptM$OF$fired();
#line 89
return;
}
#line 90
if (FCTL3 & 0x0004) {
#line 90
MSP430InterruptM$ACCV$fired();
#line 90
return;
}
}
# 55 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
__attribute((wakeup)) __attribute((interrupt(6))) void sig_UART1RX_VECTOR(void)
#line 55
{
uint8_t temp = U1RXBUF;
#line 57
HPLUSART1M$USARTData$rxDone(temp);
}
# 66 "/opt/tinyos-1.x/tos/platform/msp430/crc.h"
static uint16_t crcByte(uint16_t fcs, uint8_t c)
{
fcs = ccitt_crc16_table[((fcs >> 8) ^ c) & 0xffU] ^ (fcs << 8);
return fcs;
}
# 60 "/opt/tinyos-1.x/tos/platform/msp430/HPLUSART1M.nc"
__attribute((wakeup)) __attribute((interrupt(4))) void sig_UART1TX_VECTOR(void)
#line 60
{
HPLUSART1M$USARTData$txDone();
}
# 470 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static result_t FramerM$TxArbitraryByte(uint8_t inByte)
#line 470
{
if (inByte == FramerM$HDLC_FLAG_BYTE || inByte == FramerM$HDLC_CTLESC_BYTE) {
/* atomic removed: atomic calls only */
#line 472
{
FramerM$gPrevTxState = FramerM$gTxState;
FramerM$gTxState = FramerM$TXSTATE_ESC;
FramerM$gTxEscByte = inByte;
}
inByte = FramerM$HDLC_CTLESC_BYTE;
}
return FramerM$ByteComm$txByte(inByte);
}
# 163 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
__attribute((wakeup)) __attribute((interrupt(14))) void sig_ADC_VECTOR(void)
#line 163
{
uint16_t iv = HPLADC12M$ADC12IV;
#line 165
switch (iv)
{
case 2: HPLADC12M$HPLADC12$memOverflow();
#line 167
return;
case 4: HPLADC12M$HPLADC12$timeOverflow();
#line 168
return;
}
iv >>= 1;
if (iv && iv < 19) {
HPLADC12M$HPLADC12$converted(iv - 3);
}
}
# 430 "/home/xu/oasis/system/platform/telosb/ADC/MSP430ADC12M.nc"
static void MSP430ADC12M$stopConversion(void)
{
MSP430ADC12M$TimerA$setMode(MSP430TIMER_STOP_MODE);
MSP430ADC12M$HPLADC12$stopConversion();
MSP430ADC12M$HPLADC12$setIEFlags(0);
MSP430ADC12M$HPLADC12$resetIFGs();
if (MSP430ADC12M$adc12settings[MSP430ADC12M$owner].gotRefVolt) {
MSP430ADC12M$releaseRefVolt(MSP430ADC12M$owner);
}
#line 438
MSP430ADC12M$cmode = ADC_IDLE;
}
# 98 "/opt/tinyos-1.x/tos/platform/msp430/HPLADC12M.nc"
static void HPLADC12M$HPLADC12$resetIFGs(void)
#line 98
{
if (!HPLADC12M$ADC12IFG) {
return;
}
else
#line 102
{
uint8_t i;
volatile uint16_t mud;
#line 105
for (i = 0; i < 16; i++)
mud = HPLADC12M$HPLADC12$getMem(i);
}
}
# 246 "/home/xu/oasis/system/platform/telosb/ADC/ADCM.nc"
static result_t ADCM$MSP430ADC12Single$dataReady(uint16_t d)
{
ADCM$readdone = TRUE;
ADCM$MSP430ADC12Single$unreserve();
if (!ADCM$continuousData) {
/* atomic removed: atomic calls only */
ADCM$busy = FALSE;
if (ADCM$owner == 1) {
}
if (ADCM$ADC$dataReady(ADCM$owner, d) == FAIL)
{
}
return SUCCESS;
}
else {
#line 261
if (ADCM$ADC$dataReady(ADCM$owner, d) == FAIL) {
/* atomic removed: atomic calls only */
ADCM$busy = FALSE;
return FAIL;
}
}
#line 266
return SUCCESS;
}
# 734 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$saveData(uint8_t client, uint16_t data)
#line 734
{
SenBlkPtr p = sensor[client].curBlkPtr;
if (NULL != p) {
if (p->size < MAX_BUFFER_SIZE) {
* (uint16_t *)(p->buffer + p->size) = data;
p->size += MAX_DATA_WIDTH;
if (p->type == TYPE_DATA_RVOL) {
* (uint16_t *)(p->buffer + p->size) = SmartSensingM$RouteControl$getQuality();
p->size += MAX_DATA_WIDTH;
}
}
if (p->size >= MAX_BUFFER_SIZE) {
p->size = MAX_BUFFER_SIZE;
p->taskCode = SmartSensingM$defaultCode;
p->priority = sensor[client].dataPriority + sensor[client].nodePriority;
SmartSensingM$DataMgmt$saveBlk((void *)p, 0);
sensor[client].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(client);
}
}
else
{
;
return;
}
}
# 159 "/home/xu/oasis/system/platform/telosb/ADC/HamamatsuM.nc"
static uint16_t *HamamatsuM$MSP430ADC12MultiplePAR$dataReady(uint16_t *buf, uint16_t length)
{
uint16_t *nextbuf;
#line 162
if (!HamamatsuM$contMode) {
nextbuf = HamamatsuM$PARMultiple$dataReady(SUCCESS, buf, length);
}
else {
#line 165
if ((nextbuf = HamamatsuM$PARMultiple$dataReady(SUCCESS, buf, length))) {
HamamatsuM$MSP430ADC12MultiplePAR$getData(nextbuf, length, 0);
}
else {
#line 168
HamamatsuM$contMode = FALSE;
}
}
#line 169
return nextbuf;
}
#line 266
static uint16_t *HamamatsuM$MSP430ADC12MultipleTSR$dataReady(uint16_t *buf, uint16_t length)
{
uint16_t *nextbuf;
#line 269
if (!HamamatsuM$contMode) {
nextbuf = HamamatsuM$TSRMultiple$dataReady(SUCCESS, buf, length);
}
else {
#line 272
if ((nextbuf = HamamatsuM$TSRMultiple$dataReady(SUCCESS, buf, length))) {
HamamatsuM$MSP430ADC12MultipleTSR$getData(nextbuf, length, 0);
}
else {
#line 275
HamamatsuM$contMode = FALSE;
}
}
#line 276
return nextbuf;
}
|
tinyos-io/tinyos-3.x-contrib | berkeley/blip-2.0/support/sdk/c/blip/lib6lowpan/lib6lowpan_4944.c | <filename>berkeley/blip-2.0/support/sdk/c/blip/lib6lowpan/lib6lowpan_4944.c
/*
* "Copyright (c) 2008,2010 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."
*
*/
#include "lib6lowpan.h"
#include "6lowpan.h"
#include "nwbyte.h"
/*
* Library implementation of packing of 6lowpan packets.
*
* This should allow uniform code treatment between pc and mote code;
* the goal is to write ANSI C here... This means no nx_ types,
* unfortunately.
*
* Accessing fields programtically is probably a little less
* efficient, but that can be improved. By precomputing the packet
* headers present, we can make the overhead not too bad. The #1
* goal of this library is portability and readability.
*
* The broadcast and mesh headers may or may not be useful, and are
* off by default to reduce code size. Removing them reduces the
* library size by about 600 bytes.
*/
/*
* Return the length (in bytes) of the buffer required to pack lowmsg
* into a buffer.
*/
inline uint8_t *getLowpanPayload(struct packed_lowmsg *lowmsg) {
uint8_t len = 0;
#if LIB6LOWPAN_FULL
if (lowmsg->headers & LOWMSG_MESH_HDR)
len += LOWMSG_MESH_LEN;
if (lowmsg->headers & LOWMSG_BCAST_HDR)
len += LOWMSG_BCAST_LEN;
#endif
if (lowmsg->headers & LOWMSG_FRAG1_HDR)
len += LOWMSG_FRAG1_LEN;
if (lowmsg->headers & LOWMSG_FRAGN_HDR)
len += LOWMSG_FRAGN_LEN;
return lowmsg->data + len;
}
/*
* Return a bitmap indicating which lowpan headers are
* present in the message pointed to by lowmsg.
*
*/
inline uint16_t getHeaderBitmap(struct packed_lowmsg *lowmsg) {
uint16_t headers = 0;
uint8_t *buf = lowmsg->data;
uint16_t len = lowmsg->len;
if (buf == NULL) return headers;
if (len > 0 && ((*buf) >> 6) == LOWPAN_NALP_PATTERN) {
return LOWMSG_NALP;
}
#if LIB6LOWPAN_FULL
if (len > 0 && ((*buf) >> 6) == LOWPAN_MESH_PATTERN) {
if (!(*buf & LOWPAN_MESH_V_MASK) ||
!(*buf & LOWPAN_MESH_F_MASK)) {
// we will not parse a packet with 64-bit addressing.
return LOWMSG_NALP;
}
headers |= LOWMSG_MESH_HDR;
buf += LOWMSG_MESH_LEN;
len -= LOWMSG_MESH_LEN;
}
if (len > 0 && (*buf) == LOWPAN_BCAST_PATTERN) {
headers |= LOWMSG_BCAST_HDR;
buf += LOWMSG_BCAST_LEN;
len -= LOWMSG_BCAST_LEN;
}
#endif
if (len > 0 && ((*buf) >> 3) == LOWPAN_FRAG1_PATTERN) {
headers |= LOWMSG_FRAG1_HDR;
buf += LOWMSG_FRAG1_LEN;
len -= LOWMSG_FRAG1_LEN;
}
if (len > 0 && ((*buf) >> 3) == LOWPAN_FRAGN_PATTERN) {
headers |= LOWMSG_FRAGN_HDR;
buf += LOWMSG_FRAGN_LEN;
len -= LOWMSG_FRAGN_LEN;
}
return headers;
}
/*
* Fill in dispatch values
*/
inline uint8_t setupHeaders(struct packed_lowmsg *packed, uint16_t headers) {
uint8_t *buf = packed->data;
uint16_t len = packed->len;
if (packed == NULL) return 1;
if (buf == NULL) return 1;
packed->headers = 0;
#if LIB6LOWPAN_FULL
if (headers & LOWMSG_MESH_HDR) {
if (len < LOWMSG_MESH_LEN) return 1;
packed->headers |= LOWMSG_MESH_HDR;
*buf = LOWPAN_MESH_PATTERN << 6 | LOWPAN_MESH_V_MASK | LOWPAN_MESH_F_MASK;
buf += LOWMSG_MESH_LEN;
len -= LOWMSG_MESH_LEN;
}
if (headers & LOWMSG_BCAST_HDR) {
if (len < LOWMSG_BCAST_LEN) return 1;
packed->headers |= LOWMSG_BCAST_HDR;
*buf = LOWPAN_BCAST_PATTERN;
buf += LOWMSG_BCAST_LEN;
len -= LOWMSG_BCAST_LEN;
}
#endif
if (headers & LOWMSG_FRAG1_HDR) {
if (len < LOWMSG_FRAG1_LEN) return 1;
packed->headers |= LOWMSG_FRAG1_HDR;
*buf = LOWPAN_FRAG1_PATTERN << 3;
buf += LOWMSG_FRAG1_LEN;
len -= LOWMSG_FRAG1_LEN;
}
if (headers & LOWMSG_FRAGN_HDR) {
if (len < LOWMSG_FRAGN_LEN) return 1;
packed->headers |= LOWMSG_FRAGN_HDR;
*buf = LOWPAN_FRAGN_PATTERN << 3;
}
return 0;
}
/*
* Test if various headers are present are enabled
*/
#ifdef LIB6LOWPAN_FULL
inline uint8_t hasMeshHeader(struct packed_lowmsg *msg) {
return (msg->headers & LOWMSG_MESH_HDR);
}
inline uint8_t hasBcastHeader(struct packed_lowmsg *msg) {
return (msg->headers & LOWMSG_BCAST_HDR);
}
#endif
inline uint8_t hasFrag1Header(struct packed_lowmsg *msg) {
return (msg->headers & LOWMSG_FRAG1_HDR);
}
inline uint8_t hasFragNHeader(struct packed_lowmsg *msg) {
return (msg->headers & LOWMSG_FRAGN_HDR);
}
#ifdef LIB6LOWPAN_FULL
/*
* Mesh header fields
*
* return FAIL if the message doesn't have a mesh header
*/
inline uint8_t getMeshHopsLeft(struct packed_lowmsg *msg, uint8_t *hops) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL || hops == NULL) return 1;
*hops = (*buf) & LOWPAN_MESH_HOPS_MASK;
return 0;
}
inline uint8_t getMeshOriginAddr(struct packed_lowmsg *msg, ieee154_saddr_t *origin) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL || origin == NULL) return 1;
// skip 64-bit addresses
if (!(*buf & LOWPAN_MESH_V_MASK)) return 1;
buf += 1;
*origin = ntohs(*((uint16_t *)buf));
return 0;
}
inline uint8_t getMeshFinalAddr(struct packed_lowmsg *msg, ieee154_saddr_t *final) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL || final == NULL) return 1;
// skip 64-bit addresses
if (!(*buf & LOWPAN_MESH_F_MASK)) return 1;
buf += 3;
*final = ntohs(*((uint16_t *)buf));
return 0;
}
inline uint8_t setMeshHopsLeft(struct packed_lowmsg *msg, uint8_t hops) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL) return 1;
*buf = 0xb0;
*buf |= hops & LOWPAN_MESH_HOPS_MASK;
return 0;
}
inline uint8_t setMeshOriginAddr(struct packed_lowmsg *msg, ieee154_saddr_t origin) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL) return 1;
// skip 64-bit addresses
if (!(*buf & LOWPAN_MESH_V_MASK)) return 1;
buf += 1;
*((uint16_t *)buf) = htons(origin);
return 0;
}
inline uint8_t setMeshFinalAddr(struct packed_lowmsg *msg, ieee154_saddr_t final) {
uint8_t *buf = msg->data;
if (!hasMeshHeader(msg) || msg->data == NULL) return 1;
// skip 64-bit addresses
if (!(*buf & LOWPAN_MESH_F_MASK)) return 1;
buf += 3;
*((uint16_t *)buf) = htons(final);
return 0;
}
/*
* Broadcast header fields
*/
inline uint8_t getBcastSeqno(struct packed_lowmsg *msg, uint8_t *seqno) {
uint8_t *buf = msg->data;
if (buf == NULL || seqno == NULL || !hasBcastHeader(msg)) return 1;
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (*buf != LOWPAN_BCAST_PATTERN) return 2;
buf += 1;
*seqno = *buf;
return 0;
}
inline uint8_t setBcastSeqno(struct packed_lowmsg *msg, uint8_t seqno) {
uint8_t *buf = msg->data;
if (buf == NULL || !hasBcastHeader(msg)) return 1;
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (*buf != LOWPAN_BCAST_PATTERN) return 2;
buf += 1;
*buf = seqno;
return 0;
}
#endif
/*
* Fragmentation header fields
*/
inline uint8_t getFragDgramSize(struct packed_lowmsg *msg, uint16_t *size) {
uint8_t *buf = msg->data;
uint8_t s[2];
if (buf == NULL || size == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAG1_PATTERN &&
(*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
s[0] = *buf & 0x7;
buf++;
s[1] = *buf;
*size = ntohs( *(uint16_t *)s);
return 0;
}
inline uint8_t getFragDgramTag(struct packed_lowmsg *msg, uint16_t *tag) {
uint8_t *buf = msg->data;
if (buf == NULL || tag == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAG1_PATTERN &&
(*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
buf += 2;
//*tag = (*buf << 8) | *(buf + 1); ;
*tag = ntohs( *(uint16_t *)buf);
return 0;
}
inline uint8_t getFragDgramOffset(struct packed_lowmsg *msg, uint8_t *size) {
uint8_t *buf = msg->data;
if (buf == NULL || size == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
buf += 4;
*size = *buf;
return 0;
}
inline uint8_t setFragDgramSize(struct packed_lowmsg *msg, uint16_t size) {
uint8_t *buf = msg->data;
if (buf == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAG1_PATTERN &&
(*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
size = size & 0x7ff;
// zero out the dgram size first.
*buf &= 0xf8;
*buf |= (size >> 8);
buf[1] = size & 0xff;
// *((uint16_t *)buf) |= htons(size & 0x7ff);
return 0;
}
inline uint8_t setFragDgramTag(struct packed_lowmsg *msg, uint16_t tag) {
uint8_t *buf = msg->data;
if (buf == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAG1_PATTERN &&
(*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
buf += 2;
buf[0] = tag >> 8;
buf[1] = tag & 0xff;
return 0;
}
inline uint8_t setFragDgramOffset(struct packed_lowmsg *msg, uint8_t size) {
uint8_t *buf = msg->data;
if (buf == NULL) return 1;
#ifdef LIB6LOWPAN_FULL
if (hasMeshHeader(msg)) buf += LOWMSG_MESH_LEN;
if (hasBcastHeader(msg)) buf += LOWMSG_BCAST_LEN;
#endif
if ((*buf >> 3) != LOWPAN_FRAGN_PATTERN) return 1;
buf += 4;
*buf = size;
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/lib/usb/usb.h | <filename>diku/common/lib/usb/usb.h<gh_stars>1-10
#ifndef _H_usb_H
#define _H_usb_H
#include <byteorder.h>
#ifdef BIG_ENDIAN
#define usbToHost16(x) _BSWAP_UINT16(x)
#define hostToUsb16(x) _BSWAP_UINT16(x)
#define usbToHost32(l) _BSWAP_UINT32(l)
#define hostToUsb32(l) _BSWAP_UINT32(l)
#else
#define usbToHost16(x) x
#define hostToUsb16(x) x
#define usbToHost32(l) l
#define hostToUsb32(l) l
#endif
/**
* Setup packet types
*/
typedef struct {
uint8_t bmRequestType;
uint8_t bRequest;
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
} usb_setup_pkt_t; // End of Setup Packet Type
typedef enum {
USB_EP_DISABLED = 0,
USB_EP_IN = 1,
USB_EP_OUT = 2,
USB_EP_INISO = 3,
USB_EP_OUTISO = 4
} usb_ep_config_t;
typedef enum {
USB_LOW_SPEED = 0,
USB_FULL_SPEED = 1,
USB_HIGH_SPEED = 2
} usb_mode_t;
typedef enum {
USB_RECEIVE_FOLLOW_SETUP = 0,
USB_SETUP_DONE = 1
} usb_device_request_t;
// Device Request Direction (bmRequestType bit7)
enum {
USB_DRD_MASK = 0x80, // Mask for device request direction
USB_DRD_OUT = 0x00, // OUT: host to device
USB_DRD_IN = 0x80 // IN: device to host
};
// Request Codes (bRequest)
enum {
USB_GET_STATUS = 0x00,
USB_CLEAR_FEATURE = 0x01,
USB_SET_FEATURE = 0x03,
USB_SET_ADDRESS = 0x05,
USB_GET_DESCRIPTOR = 0x06,
USB_SET_DESCRIPTOR = 0x07,
USB_GET_CONFIGURATION = 0x08,
USB_SET_CONFIGURATION = 0x09,
USB_GET_INTERFACE = 0x0A,
USB_SET_INTERFACE = 0x0B,
USB_SYNCH_FRAME = 0x0C
};
// Device Request Type (bmRequestType)
enum {
USB_BMREQUEST_MASK = 0x60, // Mask for device request type
USB_REQUEST_VENDOR = 0x40, // Vendor specific request
USB_REQUEST_CLASS = 0x20, // Class specific request
USB_REQUEST_STD = 0x00 // Standard device request
};
// Device Request Recipient (bmRequestType bit4-0)
#define DRR_MASK 0x1F // Mask for device request recipient
#define DRR_DEVICE 0x00 // Device
#define DRR_INTERFACE 0x01 // Interface
#define DRR_ENDPOINT 0x02 // Endpoint
// Define bmRequestType bitmaps
#define USB_OUT_DEVICE (DRD_OUT | USB_REQUEST_STD | DRR_DEVICE)
// Request made to device,
#define USB_IN_DEVICE (USB_DRD_IN | USB_REQUEST_STD | DRR_DEVICE)
// Request made to device,
#define USB_OUT_INTERFACE (DRD_OUT | USB_REQUEST_STD | DRR_INTERFACE)
// Request made to interface,
#define USB_IN_INTERFACE (USB_DRD_IN | USB_REQUEST_STD | DRR_INTERFACE)
// Request made to interface,
#define USB_OUT_ENDPOINT (DRD_OUT | USB_REQUEST_STD | DRR_ENDPOINT)
// Request made to endpoint,
#define USB_IN_ENDPOINT (USB_DRD_IN | USB_REQUEST_STD | DRR_ENDPOINT)
// Request made to endpoint,
#define USB_OUT_CL_INTERFACE (DRD_OUT | DRT_CLASS | DRR_INTERFACE)
// Request made to class interface,
#define USB_IN_CL_INTERFACE (USB_DRD_IN | DRT_CLASS | DRR_INTERFACE)
// Request made to class interface,
#define USB_OUT_VR_INTERFACE (DRD_OUT | DRT_VENDOR | DRR_INTERFACE)
// Request made to vendor interface,
#define USB_IN_VR_INTERFACE (USB_DRD_IN | DRT_VENDOR | DRR_INTERFACE)
// Request made to vendor interface,
// Descriptor type (GET_DESCRIPTOR and SET_DESCRIPTOR)
#define USB_DESCRIPTOR_DEVICE 0x01
#define USB_DESCRIPTOR_CONFIG 0x02
#define USB_DESCRIPTOR_STRING 0x03
#define USB_DESCRIPTOR_INTERFACE 0x04
#define USB_DESCRIPTOR_ENDPOINT 0x05
#define USB_DESCRIPTOR_DEVICE_AULIFIER 0x6 // USB2.0 only
#define USB_DECRIPTROR_OTHER_SPEED 0x7 // USB2.0 only
// Define wValue bitmaps for Standard Feature Selectors
#define DEVICE_REMOTE_WAKEUP 0x01 // Remote wakeup feature(not used)
#define ENDPOINT_HALT 0x00 // Endpoint_Halt feature selector
/**
* Device Descriptor
*/
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t bcdUSB;
uint8_t bDeviceClass; // Device Class Code
uint8_t bDeviceSubClass; // Device Subclass Code
uint8_t bDeviceProtocol; // Device Protocol Code
uint8_t bMaxPacketSize0; // Maximum Packet Size for EP0
uint16_t idVendor; // Vendor ID
uint16_t idProduct; // Product ID
uint16_t bcdDevice; // Device Release Number in BCD
uint8_t iManufacturer; // Index of String Desc for Manufacturer
uint8_t iProduct; // Index of String Desc for Product
uint8_t iSerialNumber; // Index of String Desc for SerNo
uint8_t bNumConfigurations; // Number of possible Configurations
} usb_device_descriptor_t; // End of Device Descriptor Type
// Descriptor types
enum {
USB_DESCRIPTOR_TYPE_DEVICE = 0x01,
USB_DESCRIPTOR_TYPE_CONFIG = 0x02,
USB_DESCRIPTOR_TYPE_STRING = 0x03,
USB_DESCRIPTOR_TYPE_INTERFACE = 0x04,
USB_DESCRIPTOR_TYPE_ENDPOINT = 0x05,
// class specific descriptor types
USB_DESCRIPTOR_SUBTYPE_CS_HEADER_FUNC = 0x00,
USB_DESCRIPTOR_SUBTYPE_CS_CALL_MAN = 0x01,
USB_DESCRIPTOR_SUBTYPE_CS_ABST_CNTRL = 0x02,
USB_DESCRIPTOR_SUBTYPE_CS_UNION_FUNC = 0x06,
USB_DESCRIPTOR_TYPE_CS_INTERFACE = 0x24
};
#define VER_USB 0x0200
#define EP0_PACKET_SIZE 0x40
#define VID 0x16C0
#define PID 0x06EC
#define DSC_NUM_INTERFACE 2
#define DSC_NUM_STRING 4
#define DEV_REV 0x0000
const usb_device_descriptor_t MyDeviceDesc __attribute__((code)) = {
18,
//sizeof(usb_device_descriptor_t),
USB_DESCRIPTOR_TYPE_DEVICE,
hostToUsb16( VER_USB ),
0x02,
0x00,
0x00,
EP0_PACKET_SIZE,
hostToUsb16( VID ),
hostToUsb16( PID ),
hostToUsb16( DEV_REV ),
0x01,
0x02,
0x03,
0x01
};
/**
* Configuration Descriptor
*/
typedef struct {
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=2)
uint16_t wTotalLength; // Total Length of Data for this Conf
uint8_t bNumInterfaces; // # of Interfaces supported by Conf
uint8_t bConfigurationValue; // Designator Value for *this* Conf
uint8_t iConfiguration; // Index of String Desc for this Conf
uint8_t bmAttributes; // Configuration Characteristics
uint8_t bMaxPower; // Max. Power Consumption in Conf (*2mA)
} configuration_descriptor_t; // End of Configuration Descriptor Type
typedef struct {
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=4)
uint8_t bInterfaceNumber; // Number of *this* Interface (0..)
uint8_t bAlternateSetting; // Alternative for this Interface
uint8_t bNumEndpoints; // No of EPs used by this IF (excl. EP0)
uint8_t bInterfaceClass; // Interface Class Code
uint8_t bInterfaceSubClass; // Interface Subclass Code
uint8_t bInterfaceProtocol; // Interface Protocol Code
uint8_t iInterface; // Index of String Desc for Interface
} interface_descriptor_t; // End of Interface Descriptor Type
typedef struct {
uint8_t bLength; // Size of this Descriptor in Bytes
uint8_t bDescriptorType; // Descriptor Type (=5)
uint8_t bEndpointAddress; // Endpoint Address (Number + Direction)
uint8_t bmAttributes; // Endpoint Attributes (Transfer Type)
uint16_t wMaxPacketSize; // Max. Endpoint Packet Size
uint8_t bInterval; // Polling Interval (Interrupt) ms
} endpoint_descriptor_t; // End of Endpoint Descriptor Type
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint16_t bcdCDC;
} header_func_descriptor_t;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint8_t bmCapabilities;
uint8_t bDataInterface;
} call_man_func_descriptor_t;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint8_t bmCapabilities;
} abst_control_mana_descriptor_t;
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint8_t bMasterInterface;
uint8_t bSlaveInterface0;
} union_func_descriptor_t;
typedef struct {
configuration_descriptor_t config_desc;
interface_descriptor_t interface_desc_0;
header_func_descriptor_t header_func_desc;
call_man_func_descriptor_t call_man_desc;
abst_control_mana_descriptor_t abst_control_desc;
union_func_descriptor_t union_func_desc;
endpoint_descriptor_t endpoint_desc_IN1;
interface_descriptor_t interface_desc_1;
endpoint_descriptor_t endpoint_desc_IN2;
endpoint_descriptor_t endpoint_desc_OUT2;
} configuration_desc_set_t;
#define EP1_PACKET_SIZE 0x0010
#define EP2_PACKET_SIZE 0x0040
#define IN_EP1 0x81
#define OUT_EP1 0x01
#define IN_EP2 0x82
#define OUT_EP2 0x02
#define DSC_EP_CONTROL 0x00
#define DSC_EP_ISOC 0x01
#define DSC_EP_BULK 0x02
#define DSC_EP_INTERRUPT 0x03
const configuration_desc_set_t MyConfigDescSet __attribute__((code)) = {
{ // Configuration descriptor
sizeof(configuration_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_CONFIG, // bDescriptorType
hostToUsb16( sizeof(configuration_desc_set_t) ),// bTotalLength
DSC_NUM_INTERFACE, // bNumInterfaces
0x01, // bConfigurationValue
0x00, // iConfiguration
0x80, // bmAttributes
0x0F // bMaxPower
},
{ // Interface(0) - Communication Class
sizeof(interface_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType
0x00, // bInterfaceNumber
0x00, // bAlternateSetting
0x01, // bNumEndpoints
0x02, // bInterfaceClass (Communication Class)
0x02, // bInterfaceSubClass (Abstract Control Model)
0x01, // bInterfaceProcotol (V.25ter, Common AT commands)
0x00 // iInterface
},
{ // Header Functional Descriptor
sizeof(header_func_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
USB_DESCRIPTOR_SUBTYPE_CS_HEADER_FUNC,// bDescriptorSubtype (Header Functional)
hostToUsb16(0x0110) // bcdCDC (CDC spec release number, 1.1)
},
{ // Call Management Functional Descriptor
sizeof(call_man_func_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
USB_DESCRIPTOR_SUBTYPE_CS_CALL_MAN, // bDescriptorSubtype (Call Management)
0x01, // bmCapabilities (only over Communication Class IF / handles itself)
0x01 // bDataInterface (Interface number of Data Class interface)
},
{ // Abstract Control Management Functional Descriptor
sizeof(abst_control_mana_descriptor_t),// bLength
USB_DESCRIPTOR_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
USB_DESCRIPTOR_SUBTYPE_CS_ABST_CNTRL, // bDescriptorSubtype (Abstract Control Management)
0x06 // bmCapabilities (Supports Send_Break, Set_Line_Coding, Set_Control_Line_State,
// Get_Line_Coding, and the notification Serial_State)
},
{ // Union Functional Descriptor
sizeof(union_func_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
USB_DESCRIPTOR_SUBTYPE_CS_UNION_FUNC, // bDescriptorSubtype (Union Functional)
0x00, // bMasterInterface (Interface number master interface in the union)
0x01 // bSlaveInterface0 (Interface number slave interface in the union)
},
{ // Endpoint1
sizeof(endpoint_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
IN_EP1, // bEndpointAddress
DSC_EP_INTERRUPT, // bmAttributes
hostToUsb16( EP1_PACKET_SIZE ), // MaxPacketSize
1 // bInterval
},
{ // Interface(1) - Data Interface Class
sizeof(interface_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType
0x01, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints
0x0A, // bInterfaceClass (Data Interface Class)
0x00, // bInterfaceSubClass
0x00, // bInterfaceProcotol (No class specific protocol required)
0x00 // iInterface
},
{ // Endpoint IN 2 descriptor
sizeof(endpoint_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
IN_EP2, // bEndpointAddress
DSC_EP_BULK, // bmAttributes
hostToUsb16( EP2_PACKET_SIZE ), // MaxPacketSize
0 // bInterval
},
{ // Endpoint OUT 2 descriptor
sizeof(endpoint_descriptor_t), // bLength
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
OUT_EP2, // bEndpointAddress
DSC_EP_BULK, // bmAttributes
hostToUsb16( EP2_PACKET_SIZE ), // MaxPacketSize
0 // bInterval
}
}; //end of Configuration
#define STR0LEN 4
const uint8_t String0Desc[STR0LEN] __attribute__((code)) = {
STR0LEN, USB_DESCRIPTOR_TYPE_STRING, 0x09, 0x04
};
#define STR1LEN sizeof("Polaric")*2
const uint8_t String1Desc[STR1LEN] __attribute__((code)) = {
STR1LEN, USB_DESCRIPTOR_TYPE_STRING,
'P', 0,
'o', 0,
'l', 0,
'a', 0,
'r', 0,
'i', 0,
'c', 0
};
#define STR2LEN sizeof("SWM1702DK")*2
const uint8_t String2Desc[STR2LEN] __attribute__((code)) = {
STR2LEN, USB_DESCRIPTOR_TYPE_STRING,
'S', 0,
'W', 0,
'M', 0,
'1', 0,
'7', 0,
'0', 0,
'2', 0,
'D', 0,
'K', 0
};
#define STR3LEN sizeof("0001")*2
const uint8_t String3Desc[STR3LEN] __attribute__((code))= {
STR3LEN, USB_DESCRIPTOR_TYPE_STRING,
'0', 0,
'0', 0,
'0', 0,
'1', 0
};
const uint8_t *StringDescTable[4] __attribute__((code)) = {
String0Desc,
String1Desc,
String2Desc,
String3Desc
};
const uint8_t OnesPacket[2] __attribute__((code)) = {1,0};
const uint8_t ZerosPacket[2] __attribute__((code)) = {1,0};
/* typedef struct { */
/* configuration_descriptor_t ConfigDescriptor; */
/* interface_descriptor_t InterfaceDescriptor; */
/* endpoint_descriptor_t EndpointDescriptor0; */
/* endpoint_descriptor_t EndpointDescriptor1; */
/* } USB_CONFIG_DATA; */
/* const USB_CONFIG_DATA ConfigurationDescriptor __attribute((code)) = { */
/* { /\* configuration descriptor *\/ */
/* sizeof(configuration_descriptor_t), /\* bLength *\/ */
/* USB_DESCRIPTOR_TYPE_CONFIG, /\* bDescriptorType *\/ */
/* hostToUsb16(sizeof(USB_CONFIG_DATA)), /\* wTotalLength *\/ */
/* 1, /\* bNumInterfaces *\/ */
/* 1, /\* bConfigurationValue *\/ */
/* 0, /\* iConfiguration String Index *\/ */
/* 0x80, /\* bmAttributes Bus Powered, No Remote Wakeup *\/ */
/* 0x32 /\* bMaxPower, 100mA *\/ */
/* }, */
/* { /\* interface descriptor *\/ */
/* sizeof(interface_descriptor_t), /\* bLength *\/ */
/* USB_DESCRIPTOR_TYPE_INTERFACE, /\* bDescriptorType *\/ */
/* 0, /\* bInterface Number *\/ */
/* 0, /\* bAlternateSetting *\/ */
/* 2, /\* bNumEndpoints *\/ */
/* 0x0, /\* bInterfaceClass (Vendor specific) *\/ */
/* 0x0, /\* bInterfaceSubClass *\/ */
/* 0x0, /\* bInterfaceProtocol *\/ */
/* 0 /\* iInterface String Index *\/ */
/* }, */
/* { /\* endpoint descriptor *\/ */
/* sizeof(endpoint_descriptor_t), /\* bLength *\/ */
/* USB_DESCRIPTOR_TYPE_ENDPOINT, /\* bDescriptorType *\/ */
/* 0x01, /\* bEndpoint Address EP1 OUT *\/ */
/* 0x03, /\* bmAttributes - Interrupt *\/ */
/* hostToUsb16(0x0008), /\* wMaxPacketSize *\/ */
/* 0x0A /\* bInterval *\/ */
/* }, */
/* { /\* endpoint descriptor *\/ */
/* sizeof(endpoint_descriptor_t), /\* bLength *\/ */
/* USB_DESCRIPTOR_TYPE_ENDPOINT, /\* bDescriptorType *\/ */
/* 0x81, /\* bEndpoint Address EP1 IN *\/ */
/* 0x03, /\* bmAttributes - Interrupt *\/ */
/* hostToUsb16(0x0008), /\* wMaxPacketSize *\/ */
/* 0x0A /\* bInterval *\/ */
/* } */
/* }; */
typedef struct {
uint8_t length;
uint8_t page[EP2_PACKET_SIZE];
} usb_pkt_t;
#endif //_H_usb_H
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/tinynode/wake.h | #ifndef WAKE_H_
#define WAKE_H_
#define WAKE_COUNT 3
#define WAKE_IVAL 2500
#endif
|
tinyos-io/tinyos-3.x-contrib | berkeley/quanto/tools/quanto/compression/libquantocode.c | <gh_stars>1-10
/*
* Copyright (c) 2009 <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Author: <NAME> <<EMAIL>>
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "libquantocode.h"
inline void bitBuf_clear(bitBuf* buf) {
memset(buf->buf, 0, buf->size);
buf->pos = 0;
buf->rpos = 0;
}
bitBuf* bitBuf_new(uint16_t size) {
bitBuf* p;
p = (bitBuf*) malloc (sizeof(bitBuf) + (size-1)*sizeof(uint8_t));
p->size = size;
bitBuf_clear(p);
return p;
}
void bitBuf_delete(bitBuf* buf) {
free(buf);
}
/* sets the bit */
inline bool bitBuf_putBit(bitBuf* buf, bool bit) {
uint16_t B;
uint8_t b, mask;
if (buf->pos == (buf->size << 3))
return FALSE;
if (bit) {
B = buf->pos >> 3;
b = buf->pos - (B << 3);
mask = 1 << b;
buf->buf[B] |= mask;
}
buf->pos++;
return TRUE;
}
inline bool bitBuf_pad(bitBuf* buf) {
uint16_t B;
if (buf->pos == (buf->size << 3))
return FALSE;
B = buf->pos % 8;
if (B) {
buf->pos += 8 - B;
}
return TRUE;
}
uint16_t bitBuf_length(bitBuf* buf) {
uint16_t B;
uint8_t b;
B = buf->pos >> 3;
b = buf->pos % 8;
if (b)
return B+1;
return B;
}
inline bool bitBuf_putByte(bitBuf* buf, uint8_t byte) {
uint16_t l = bitBuf_length(buf);
if (l == buf->size)
return FALSE;
bitBuf_pad(buf); //pad can't increase the length
buf->buf[l] = byte;
buf->pos += 8;
return TRUE;
}
inline int bitBuf_getNextBit(bitBuf* buf) {
uint16_t B;
uint8_t b,mask;
if (buf->rpos == buf->pos)
return -1;
B = buf->rpos >> 3;
b = buf->rpos - (B << 3);
mask = 1 << b;
buf->rpos++;
return (buf->buf[B] & mask)?1:0;
}
inline void bitBuf_setReadPos(bitBuf* buf,uint16_t pos) {
if (pos > buf->pos)
buf->rpos = buf->pos;
buf->rpos = pos;
}
inline void bitBuf_resetReadPos(bitBuf* buf) {
bitBuf_setReadPos(buf, 0);
}
inline uint16_t bitBuf_getReadPos(bitBuf* buf) {
return buf->rpos;
}
void bitBuf_print(bitBuf* buf) {
uint16_t B, i;
uint8_t b,j,l;
B = buf->pos >> 3;
b = buf->pos - (B << 3);
printf("bitBuf {size:%d pos:%d B:%d b:%d}\n", buf->size, buf->pos, B, b);
for (i = 0; i <= B; i++) {
l = 8;
if (i == B)
l = b;
for (j = 0; j < l; j++) {
printf("%d", (buf->buf[i] & (1 << j))?1:0);
}
printf (" ");
}
}
/************* 32-bit Elias Gamma Codec ***************/
void elias_gamma_encode(uint32_t b, bitBuf* buf) {
uint32_t bb = b;
uint32_t m;
uint8_t l = 0;
//put as many 0's as l = floor(log2(b))
#ifdef EG_DEBUG
fprintf(stderr,"eg: encoding %d : ", b);
#endif
while (bb >>= 1) {
l++;
#ifdef EG_DEBUG
fprintf(stderr, "0");
#endif
bitBuf_putBit(buf, 0);
}
//copy b to the buffer starting from the msb
for (m = 1 << l; m ; m >>= 1) {
#ifdef EG_DEBUG
fprintf(stderr, "%d", (b&m)?1:0);
#endif
bitBuf_putBit(buf,(b & m)?1:0);
}
#ifdef EG_DEBUG
fprintf(stderr, "\n");
#endif
}
/* Decode the next elias_gamma integer from the buffer.
* Assumes that an elias_gamma encoded integer begins in
* buf->rpos */
uint32_t elias_gamma_decode(bitBuf *buf) {
uint8_t l = 0;
uint32_t n = 0;
uint8_t i;
int b;
while (!(b = bitBuf_getNextBit(buf))) {
#ifdef EG_DEBUG
fprintf(stderr, "0");
#endif
l++;
}
if (b == -1)
return 0;
n |= 1 << l;
for (i = l; i > 0; i--) {
if ((b = bitBuf_getNextBit(buf)) == 1) {
n |= 1 << (i-1);
} else if (b == -1) {
return 0;
}
}
#ifdef EG_DEBUG
fprintf(stderr, " eg: %u \n", n);
#endif
return n;
}
/************ 32-bit Elias Delta Codec ***************/
/* Elias Delta encodes the length portion of the elias
* gamma code using elias gamma */
void elias_delta_encode(uint32_t b, bitBuf* buf) {
uint32_t bb = b;
uint32_t m;
uint8_t l = 0;
#ifdef EG_DEBUG
fprintf(stderr,"ed: encoding %d : ", b);
#endif
//determine l = floor(log2(b))
while (bb >>= 1) {
l++;
}
//encode l+1 in elias_gamma
elias_gamma_encode(l+1, buf);
//copy b to the buffer, skipping the msb
for (m = (1 << l) >> 1; m ; m >>= 1) {
bitBuf_putBit(buf,(b & m)?1:0);
#ifdef EG_DEBUG
fprintf(stderr, "%d", (b&m)?1:0);
#endif
}
#ifdef EG_DEBUG
fprintf(stderr, "\n");
#endif
}
uint32_t elias_delta_decode(bitBuf *buf) {
uint32_t l;
uint32_t n = 0;
uint8_t i;
int b;
l = elias_gamma_decode(buf);
if (!l) return 0;
l--;
n |= 1 << l;
for (i = l; i > 0; i--) {
if ((b = bitBuf_getNextBit(buf)) == 1) {
n |= 1 << (i-1);
} else if (b == -1) {
return 0;
}
}
#ifdef EG_DEBUG
fprintf(stderr, " ed: %u \n", n);
#endif
return n;
}
/************ 8-bit Move To Front Codec **************/
void mtf_init(mtf_encoder* mtf) {
int i;
for (i = 0; i < 255; i++)
mtf->order[i] = i+1;
mtf->h = 0;
}
/* moves b to the front and returns the
* distance */
uint8_t mtf_encode(mtf_encoder* mtf, uint8_t b) {
uint8_t p, i;
p = mtf->h;
if (p == b)
return 0;
//with another of reverse pointers we can make the search o(1)
//we are trading 256 bytes of memory for up to 256 accesses to
//memory. If there is locality, these would be much less.
for (i = 1, p = mtf->h; mtf->order[p] != b; i++, p = mtf->order[p])
;
//i is the position in the list
//now we move to front
if (mtf->order[b] == b) //is b the last?
mtf->order[p] = p; //now p is the last
else
mtf->order[p] = mtf->order[b]; //next(p) = next(b)
mtf->order[b] = mtf->h; //b comes before head
mtf->h = b; //head points to b
return i;
}
uint8_t mtf_decode(mtf_encoder* mtf, uint8_t b) {
uint8_t v, p;
uint8_t i;
if (b == 0)
return mtf->h;
//if not head, we have to find the b-th element in the
//list, move it to the front, and return it.
for (i = 1, p = mtf->h; i < b ; i++, p = mtf->order[p])
;
//p = predecessor of the v
v = mtf->order[p];
//move to front
if (mtf->order[v] == v)
mtf->order[p] = p;
else
mtf->order[p] = mtf->order[v];
mtf->order[v] = mtf->h;
mtf->h = v;
return v;
}
|
tinyos-io/tinyos-3.x-contrib | berkeley/quanto/tos/chips/msp430/msp430hardware.h |
/* "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."
*/
// @author <NAME> <<EMAIL>>
// @author <NAME> <<EMAIL>>
// @author <NAME> <<EMAIL>>
#ifndef _H_msp430hardware_h
#define _H_msp430hardware_h
#include <io.h>
#include <signal.h>
#include "msp430regtypes.h"
#include "msp430quantoconsts.h"
// CPU memory-mapped register access will cause nesc to issue race condition
// warnings. Race conditions are a significant conern when accessing CPU
// memory-mapped registers, because they can change even while interrupts
// are disabled. This means that the standard nesc tools for resolving race
// conditions, atomic statements that disable interrupt handling, do not
// resolve CPU register race conditions. So, CPU registers access must be
// treated seriously and carefully.
// The macro MSP430REG_NORACE allows individual modules to internally
// redeclare CPU registers as norace, eliminating nesc's race condition
// warnings for their access. This macro should only be used after the
// specific CPU register use has been verified safe and correct. Example
// use:
//
// module MyLowLevelModule
// {
// // ...
// }
// implementation
// {
// MSP430REG_NORACE(TACCTL0);
// // ...
// }
#undef norace
#define MSP430REG_NORACE_EXPAND(type,name,addr) \
norace static volatile type name asm(#addr)
#define MSP430REG_NORACE3(type,name,addr) \
MSP430REG_NORACE_EXPAND(type,name,addr)
// MSP430REG_NORACE and MSP430REG_NORACE2 presume naming conventions among
// type, name, and addr, which are defined in the local header
// msp430regtypes.h and mspgcc's header io.h and its children.
#define MSP430REG_NORACE2(rename,name) \
MSP430REG_NORACE3(TYPE_##name,rename,name##_)
#define MSP430REG_NORACE(name) \
MSP430REG_NORACE3(TYPE_##name,name,name##_)
// Avoid the type-punned pointer warnings from gcc 3.3, which are warning about
// creating potentially broken object code. Union casts are the appropriate work
// around. Unfortunately, they require a function definiton.
#define DEFINE_UNION_CAST(func_name,to_type,from_type) \
to_type func_name(from_type x) @safe() { union {from_type f; to_type t;} c = {f:x}; return c.t; }
// redefine ugly defines from msp-gcc
#ifndef DONT_REDEFINE_SR_FLAGS
#undef C
#undef Z
#undef N
#undef V
#undef GIE
#undef CPUOFF
#undef OSCOFF
#undef SCG0
#undef SCG1
#undef LPM0_bits
#undef LPM1_bits
#undef LPM2_bits
#undef LPM3_bits
#undef LPM4_bits
#define SR_C 0x0001
#define SR_Z 0x0002
#define SR_N 0x0004
#define SR_V 0x0100
#define SR_GIE 0x0008
#define SR_CPUOFF 0x0010
#define SR_OSCOFF 0x0020
#define SR_SCG0 0x0040
#define SR_SCG1 0x0080
#define LPM0_bits SR_CPUOFF
#define LPM1_bits SR_SCG0+SR_CPUOFF
#define LPM2_bits SR_SCG1+SR_CPUOFF
#define LPM3_bits SR_SCG1+SR_SCG0+SR_CPUOFF
#define LPM4_bits SR_SCG1+SR_SCG0+SR_OSCOFF+SR_CPUOFF
#endif//DONT_REDEFINE_SR_FLAGS
#ifdef interrupt
#undef interrupt
#endif
#ifdef wakeup
#undef wakeup
#endif
#ifdef signal
#undef signal
#endif
// Re-definitions for safe tinyOS
// These rely on io.h being included at the top of this file
// thus pulling the affected header files before the re-definitions
#ifdef SAFE_TINYOS
#undef ADC12MEM
#define ADC12MEM TCAST(int* ONE, ADC12MEM_) /* ADC12 Conversion Memory (for C) */
#undef ADC12MCTL
#define ADC12MCTL TCAST(char * ONE, ADC12MCTL_)
#endif
// define platform constants that can be changed for different compilers
// these are all msp430-gcc specific (add as necessary)
#ifdef __msp430_headers_adc10_h
#define __msp430_have_adc10
#endif
#ifdef __msp430_headers_adc12_h
#define __msp430_have_adc12
#endif
// backwards compatibility to older versions of the header files
#ifdef __MSP430_HAS_I2C__
#define __msp430_have_usart0_with_i2c
#endif
// I2CBusy flag is not defined by current MSP430-GCC
#ifdef __msp430_have_usart0_with_i2c
#ifndef I2CBUSY
#define I2CBUSY (0x01 << 5)
#endif
MSP430REG_NORACE2(U0CTLnr,U0CTL);
MSP430REG_NORACE2(I2CTCTLnr,I2CTCTL);
MSP430REG_NORACE2(I2CDCTLnr,I2CDCTL);
#endif
// The signal attribute has opposite meaning in msp430-gcc than in avr-gcc
#define TOSH_SIGNAL(signame) \
void sig_##signame() __attribute__((interrupt (signame), wakeup)) @C()
// TOSH_INTERRUPT allows nested interrupts
#define TOSH_INTERRUPT(signame) \
void isr_##signame() __attribute__((interrupt (signame), signal, wakeup)) @C()
#define SET_FLAG(port, flag) ((port) |= (flag))
#define CLR_FLAG(port, flag) ((port) &= ~(flag))
#define READ_FLAG(port, flag) ((port) & (flag))
// TOSH_ASSIGN_PIN creates functions that are effectively marked as
// "norace". This means race conditions that result from their use will not
// be detectde by nesc.
#define TOSH_ASSIGN_PIN_HEX(name, port, hex) \
void TOSH_SET_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##OUT); r |= hex; } \
void TOSH_CLR_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##OUT); r &= ~hex; } \
void TOSH_TOGGLE_##name##_PIN() @safe(){ MSP430REG_NORACE2(r,P##port##OUT); r ^= hex; } \
uint8_t TOSH_READ_##name##_PIN() @safe() { MSP430REG_NORACE2(r,P##port##IN); return (r & hex); } \
void TOSH_MAKE_##name##_OUTPUT() @safe() { MSP430REG_NORACE2(r,P##port##DIR); r |= hex; } \
void TOSH_MAKE_##name##_INPUT() @safe() { MSP430REG_NORACE2(r,P##port##DIR); r &= ~hex; } \
void TOSH_SEL_##name##_MODFUNC() @safe() { MSP430REG_NORACE2(r,P##port##SEL); r |= hex; } \
void TOSH_SEL_##name##_IOFUNC() @safe() { MSP430REG_NORACE2(r,P##port##SEL); r &= ~hex; }
#define TOSH_ASSIGN_PIN(name, port, bit) \
TOSH_ASSIGN_PIN_HEX(name,port,(1<<(bit)))
typedef uint8_t mcu_power_t @combine("mcombine");
mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) @safe() {
return (m1 < m2) ? m1: m2;
}
enum {
MSP430_POWER_ACTIVE = 0,
MSP430_POWER_LPM0 = 1,
MSP430_POWER_LPM1 = 2,
MSP430_POWER_LPM2 = 3,
MSP430_POWER_LPM3 = 4,
MSP430_POWER_LPM4 = 5
};
void __nesc_disable_interrupt(void) @safe()
{
dint();
nop();
}
void __nesc_enable_interrupt(void) @safe()
{
eint();
}
typedef bool __nesc_atomic_t;
__nesc_atomic_t __nesc_atomic_start(void);
void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts);
#ifndef NESC_BUILD_BINARY
/* @spontaneous() functions should not be included when NESC_BUILD_BINARY
is #defined, to avoid duplicate functions definitions wheb binary
components are used. Such functions do need a prototype in all cases,
though. */
__nesc_atomic_t __nesc_atomic_start(void) @spontaneous() @safe()
{
__nesc_atomic_t result = ((READ_SR & SR_GIE) != 0);
__nesc_disable_interrupt();
asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
return result;
}
void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts) @spontaneous() @safe()
{
asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
if( reenable_interrupts )
__nesc_enable_interrupt();
}
#endif
/* Floating-point network-type support.
These functions must convert to/from a 32-bit big-endian integer that follows
the layout of Java's java.lang.float.floatToRawIntBits method.
Conveniently, for the MSP430 family, this is a straight byte copy...
*/
typedef float nx_float __attribute__((nx_base_be(afloat)));
inline float __nesc_ntoh_afloat(const void *COUNT(sizeof(float)) source) @safe() {
float f;
memcpy(&f, source, sizeof(float));
return f;
}
inline float __nesc_hton_afloat(void *COUNT(sizeof(float)) target, float value) @safe() {
memcpy(target, &value, sizeof(float));
return value;
}
#endif//_H_msp430hardware_h
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/simulator/consumptionpredictor.h | #ifndef CONSUMPTIONPREDICTOR_H
#define CONSUMPTIONPREDICTOR_H
#include "simulator.h"
#include "nodes.h"
using namespace std;
#define PATH_ENERGY_WEIGHT 5
/*extern uint8_t isPathTimed[NUMPATHS];
extern uint8_t pathSrc[NUMPATHS];
extern uint8_t timedPaths[NUMTIMEDPATHS];
extern uint16_t timerVals[NUMSOURCES][NUMSTATES][2];
extern uint8_t srcNodes[NUMSOURCES][2];*/
int64_t cp_event_count;
int64_t cp_prediction;
int8_t cp_srcprob[NUMSOURCES];
int8_t cp_prob[NUMPATHS];
int64_t cp_pathenergy[NUMPATHS];
int32_t cp_history_index;
void init_consumption_predictor()
{
int i=0;
int j=0;
int numpaths = 0;
for (j=0; j < NUMSOURCES; j++)
{
numpaths = 0;
for (i=0; i < NUMPATHS; i++)
{
if (pathSrc[i] == j) numpaths++;
}
for (i=0; i < NUMPATHS; i++)
{
cp_prob[i] = (100 / numpaths);
}
}
for (i=0; i < NUMPATHS; i++)
{
cp_pathenergy[i] = -1;
}
}
void cp_path_done(uint16_t pathNum,
uint8_t state,
int64_t energy)
{
uint16_t rnd;
int i, sum;
int src;
src = pathSrc[pathNum];
//update src probabilities.
if (!isPathTimed[pathNum])
{
cp_srcprob[src]++;
//get random number(1-100)
rnd = (rand() % 100)+1;
//deduct
i=0;
sum = 0;
while (sum < rnd && i < NUMPATHS-1)
{
sum += cp_srcprob[i];
if (sum >= rnd) break;
i++;
}
cp_srcprob[i]--;
} //end srcprob adjustment
//update path probabilities.
cp_prob[pathNum]++;
//get random number(1-100)
rnd = (rand() % 100)+1;
//deduct
i=0;
sum = 0;
while (sum < rnd && i < NUMPATHS-1)
{
//is same source
if (pathSrc[i] == src)
{
sum += cp_prob[i];
if (sum >= rnd) break;
}
i++;
}
cp_prob[i]--;
//update energy estimate
if (cp_pathenergy[pathNum] == -1)
{
cp_pathenergy[pathNum] = energy * 100;
} else {
cp_pathenergy[pathNum] = ((cp_pathenergy[pathNum] * (PATH_ENERGY_WEIGHT-1)) + (energy * 100)) / PATH_ENERGY_WEIGHT;
}
}
int64_t cp_predict_consumption(int64_t hours,
int64_t xevents,
uint8_t state,
double grade)
{
uint64_t energysum = 0;
uint64_t pathsum = 0;
uint64_t timedrate;
uint64_t maxrate, minrate;
int i=0;
int j=0;
for (i=0; i < NUMPATHS; i++)
{
if (!isPathTimed[i])
{
//cost of path
pathsum = ((xevents * cp_prob[i]) / 100) * (cp_pathenergy[i]/100);
energysum += pathsum;
}
}
//now add timed srcs
for (j=0; j < NUMSOURCES; j++)
{
for (i=0; i < NUMPATHS; i++)
{
if (pathSrc[i] == j)
{
if (isPathTimed[i])
{
//minrate = (3600000 * hours) / timerVals[j][state][1]; //how many evnts
double tdelta = (double)(timerVals[j][state][1]-timerVals[j][state][0]);
double dval = ((double)timerVals[j][state][1]) - (grade * tdelta);
uint32_t newval = (uint32_t)round(dval);
timedrate = (3600000 * hours) / newval;
//pathsum = ((timedrate * cp_prob[i])/100) * (cp_pathenergy[i]/100);
pathsum = (timedrate) * (cp_pathenergy[i]/100);
energysum += pathsum;
//printf("cp-->td=%lf,dv=%lf,nv=%ld,rate=%lld,p=%d,e=%lld --> es=%lld\n",
// tdelta,dval,newval,timedrate,cp_prob[i],cp_pathenergy[i],energysum);
} else {
break;
}
}
}
}
//printf("predict_consumption(%lld, %lld, %d, %lf)->%lld\n",hours,xevents,state,grade,energysum);
return energysum;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | cedt/tos/chips/cc1000/sim/CC1000Current.h | <filename>cedt/tos/chips/cc1000/sim/CC1000Current.h
/**
* "Copyright (c) 2007 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc.
* 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 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc 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 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc 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 CENTRE FOR ELECTRONICS
* AND DESIGN TECHNOLOGY,IISc HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
*/
/**
*
* @author <NAME>
* @author <NAME>
*/
#ifndef CC1000CURRENT_H
#define CC1000CURRENT_H
//required for energy analysis
//radio tx current
//23 values were taken from the CC1000 datasheet, and remaining values
//were interpolated.!
float CC1K_TX_CURRENT[256]={ 0.0,
0.005300,
0.007100,
0.007400,
0.007600,
0.007900,
0.008200,
0.008400,
0.008700,
0.008900,
0.009600,
0.009400,
0.009700,
0.010010,
0.010200,
0.010400,
0.010596,
0.010779,
0.010948,
0.011104,
0.011247,
0.011378,
0.011498,
0.011606,
0.011704,
0.011791,
0.011869,
0.011937,
0.011996,
0.012046,
0.012088,
0.012123,
0.012150,
0.012170,
0.012184,
0.012192,
0.012194,
0.012192,
0.012184,
0.012173,
0.012158,
0.012139,
0.012118,
0.012094,
0.012068,
0.012040,
0.012011,
0.011982,
0.011952,
0.011923,
0.011894,
0.011866,
0.011840,
0.011816,
0.011794,
0.011774,
0.011758,
0.011746,
0.011738,
0.011734,
0.011736,
0.011743,
0.011755,
0.011774,
0.011800,
0.011833,
0.011872,
0.011918,
0.011969,
0.012024,
0.012085,
0.012149,
0.012216,
0.012286,
0.012357,
0.012431,
0.012505,
0.012580,
0.012654,
0.012728,
0.012800,
0.012870,
0.012939,
0.013006,
0.013072,
0.013136,
0.013199,
0.013261,
0.013323,
0.013383,
0.013443,
0.013503,
0.013562,
0.013621,
0.013681,
0.013740,
0.013800,
0.013860,
0.013921,
0.013982,
0.014044,
0.014106,
0.014168,
0.014231,
0.014294,
0.014357,
0.014420,
0.014483,
0.014546,
0.014610,
0.014673,
0.014737,
0.014800,
0.014863,
0.014926,
0.014989,
0.015052,
0.015115,
0.015178,
0.015241,
0.015303,
0.015366,
0.015428,
0.015490,
0.015552,
0.015614,
0.015676,
0.015738,
0.015800,
0.015862,
0.015923,
0.015985,
0.016047,
0.016108,
0.016170,
0.016232,
0.016294,
0.016356,
0.016419,
0.016481,
0.016544,
0.016608,
0.016671,
0.016735,
0.016800,
0.016865,
0.016930,
0.016996,
0.017063,
0.017129,
0.017196,
0.017264,
0.017331,
0.017399,
0.017467,
0.017536,
0.017604,
0.017673,
0.017742,
0.017811,
0.017880,
0.017950,
0.018019,
0.018088,
0.018158,
0.018227,
0.018296,
0.018365,
0.018434,
0.018503,
0.018572,
0.018641,
0.018709,
0.018778,
0.018846,
0.018913,
0.018981,
0.019048,
0.019115,
0.019181,
0.019247,
0.019313,
0.019378,
0.019443,
0.019507,
0.019571,
0.019634,
0.019696,
0.019758,
0.019820,
0.019881,
0.019941,
0.020000,
0.020059,
0.020117,
0.020174,
0.020232,
0.020288,
0.020345,
0.020402,
0.020458,
0.020515,
0.020572,
0.020630,
0.020687,
0.020746,
0.020805,
0.020865,
0.020925,
0.020987,
0.021050,
0.021114,
0.021179,
0.021245,
0.021313,
0.021383,
0.021454,
0.021528,
0.021603,
0.021680,
0.021759,
0.021841,
0.021925,
0.022011,
0.022100,
0.022192,
0.022286,
0.022383,
0.022483,
0.022587,
0.022693,
0.022803,
0.022916,
0.023033,
0.023153,
0.023277,
0.023405,
0.023536,
0.023672,
0.023812,
0.023956,
0.024105,
0.024258,
0.024415,
0.024578,
0.024745,
0.024916,
0.025093,
0.025275,
0.025462,
0.025655,
0.025853,
0.026056,
0.026265,
0.026479,
0.026700};
#define CC1K_POWER_DOWN 0.0000002 //power down, Oscillator core OFF
float CC1K_RX_CURRENT[2] = {
0.0074, //for -110 sensitivity
0.0096 //for -102 sensitivity
};
#define CC1K_CRYSTAL_OSC_CURRENT 0.000105 //in mica2 schematics it uses 13pf, so choose the max
#define CC1K_CrystalBias_CURRENT 0.000860 //Crystal+bias current
#define CC1K_CrystalBiasSyn_CURRENT 0.005 //cyrstal+bias+synthesizer
#endif
|
tinyos-io/tinyos-3.x-contrib | tinyos-programming/FlashSampler/flashsampler.h | /*
* Copyright (c) 2007-2009 Intel Corporation
* All rights reserved.
* This file is distributed under the terms in the attached INTEL-LICENS
* file. If you do not find this file, a copy can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#ifndef FLASHSAMPLER_H
#define FLASHSAMPLER_H
enum {
SAMPLE_INTERVAL = 1024L * 60
};
enum {
SAMPLE_PERIOD = 1000,
BUFFER_SIZE = 512, // samples per buffer
TOTAL_SAMPLES = 32768L, // must be multiple of BUFFER_SIZE
};
enum { SUMMARY_SAMPLES = 256, // total samples in summary
// downsampling factor: real samples per summary sample
DFACTOR = 32768L / SUMMARY_SAMPLES };
#endif
|
tinyos-io/tinyos-3.x-contrib | antlab-polimi/sensors/driverCam/xbow_cb/xbowCam.h | <reponame>tinyos-io/tinyos-3.x-contrib
/*
* Copyright (c) 2005 Yale University.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgement:
* This product includes software developed by the Embedded Networks
* and Applications Lab (ENALAB) at Yale University.
* 4. Neither the name of the University nor that of the Laboratory
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY YALE UNIVERSITY 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 REGENTS
* 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.
*
*/
/**
* @brief Camera Service Layer Module
* @author <NAME> (<EMAIL>)
* @author <NAME>
*
* Description
* The camera module is a very basic module that utilizes the camera
* interface to take a picture.
*/
/**
* Modified and ported to tinyos-2.x.
*
* @author <NAME> (<EMAIL>)
* @version October 25, 2007
*/
#ifndef _XBOW_CB_H
#define _XBOW_CB_H
#define MAX_HEIGHT 480
#define MAX_WIDTH 640
#define BYTES_PER_PIXEL 2
#define FRAME_BUF_SIZE MAX_HEIGHT*MAX_WIDTH*BYTES_PER_PIXEL // 16-bit color
#define FRAME_SIZE sizeof(frame_t)
#define WINDOW_HZERO 0x11 // 0x1A
#define WINDOW_VZERO 0x03 // 0x03
#define WINDOW_HMAX 0x61 // 0xBA
#define WINDOW_VMAX 0x7B // 0xF3
typedef struct {
uint16_t height; // height of frame in pixels
uint16_t width; // width of fram in pixels
uint8_t color; // color model (defined by .h file for OV)
uint32_t size; // image size in bytes
uint32_t time_stamp; // frame timestamp
uint8_t type;
} __attribute__ ((packed)) frame_header_t;
enum {
BUF_TYPE_GRAY_1BYTE=0,
BUF_TYPE_GRAY_2BYTES=1, //UYVY
BUF_TYPE_RGB_2BYTES=2, //RGB565
BUF_TYPE_RGB_3BYTES=3,
};
typedef struct {
frame_header_t *header; // frame header
uint32_t size; // frame buffer size
uint8_t *buf; // frame buffer
} frame_t;
typedef struct {
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
} __attribute__ ((packed)) window_t;
#endif /* _IM2CB_H */
|
tinyos-io/tinyos-3.x-contrib | berkeley/quanto/tos/lib/timer/QuantoTimer.h | #ifndef _QUANTO_TIMER_H
#define _QUANTO_TIMER_T
enum {
ACT_TIMER = 0x31,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | shimmer/swtest/SyncedRadioTx/SyncedRadio.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>shimmer/swtest/SyncedRadioTx/SyncedRadio.h
#ifndef SYNCED_TIMING_H
#define SYNCED_TIMING_H
#include "AM.h"
typedef nx_struct simple_send_msg {
nx_uint16_t counter;
nx_uint8_t message[TOSH_DATA_LENGTH - 2]; // 114 bytes - 2 byte counter
} simple_send_msg_t;
enum {
BASE_STATION_ADDRESS = 0,
AM_SYNCED_TIMING_MSG = 0x7F,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/tos/lib/industrialCtpRoot/debug/CtpDebugMsg.h | <reponame>tinyos-io/tinyos-3.x-contrib
/*
* "Copyright (c) 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."
*
*/
#ifndef _COLLECTION_UART_MSG
#define _COLLECTION_UART_MSG
#include "AM.h"
//Comment format -> :meaning:args
enum {
NET_C_DEBUG_STARTED = 0xDE,
NET_C_FE_MSG_POOL_EMPTY = 0x10, //::no args
NET_C_FE_SEND_QUEUE_FULL = 0x11, //::no args
NET_C_FE_NO_ROUTE = 0x12, //::no args
NET_C_FE_SUBSEND_OFF = 0x13,
NET_C_FE_SUBSEND_BUSY = 0x14,
NET_C_FE_BAD_SENDDONE = 0x15,
NET_C_FE_QENTRY_POOL_EMPTY = 0x16,
NET_C_FE_SUBSEND_SIZE = 0x17,
NET_C_FE_LOOP_DETECTED = 0x18,
NET_C_FE_SEND_BUSY = 0x19,
NET_C_FE_SENDQUEUE_EMPTY = 0x50,
NET_C_FE_PUT_MSGPOOL_ERR = 0x51,
NET_C_FE_PUT_QEPOOL_ERR = 0x52,
NET_C_FE_GET_MSGPOOL_ERR = 0x53,
NET_C_FE_GET_QEPOOL_ERR = 0x54,
NET_C_FE_QUEUE_SIZE=0x55,
NET_C_FE_SENT_MSG = 0x20, //:app. send :msg uid, origin, next_hop
NET_C_FE_RCV_MSG = 0x21, //:next hop receive:msg uid, origin, last_hop
NET_C_FE_FWD_MSG = 0x22, //:fwd msg :msg uid, origin, next_hop
NET_C_FE_DST_MSG = 0x23, //:base app. recv :msg_uid, origin, last_hop
NET_C_FE_SENDDONE_FAIL = 0x24,
NET_C_FE_SENDDONE_WAITACK = 0x25,
NET_C_FE_SENDDONE_FAIL_ACK_SEND = 0x26,
NET_C_FE_SENDDONE_FAIL_ACK_FWD = 0x27,
NET_C_FE_DUPLICATE_CACHE = 0x28, //dropped duplicate packet seen in cache
NET_C_FE_DUPLICATE_QUEUE = 0x29, //dropped duplicate packet seen in queue
NET_C_FE_DUPLICATE_CACHE_AT_SEND = 0x2A, //dropped duplicate packet seen in cache
NET_C_FE_CONGESTION_SENDWAIT = 0x2B, // sendTask deferring for congested parent
NET_C_FE_CONGESTION_BEGIN = 0x2C, //
NET_C_FE_CONGESTION_END = 0x2D, // congestion over: reason is arg;
// arg=1 => overheard parent's
// ECN cleared.
// arg=0 => timeout.
NET_C_FE_CONGESTED = 0x2E,
NET_C_TREE_NO_ROUTE = 0x30, //: :no args
NET_C_TREE_NEW_PARENT = 0x31, //: :parent_id, hopcount, metric
NET_C_TREE_ROUTE_INFO = 0x32, //:periodic:parent_id, hopcount, metric
NET_C_TREE_SENT_BEACON = 0x33,
NET_C_TREE_RCV_BEACON = 0x34,
NET_C_DBG_1 = 0x40, //:any :uint16_t a
NET_C_DBG_2 = 0x41, //:any :uint16_t a, b, c
NET_C_DBG_3 = 0x42, //:any :uint16_t a, b, c
};
typedef nx_struct CollectionDebugMsg {
nx_uint8_t type;
nx_union {
nx_uint16_t arg;
nx_struct {
nx_uint16_t msg_uid;
nx_am_addr_t origin;
nx_am_addr_t other_node;
} msg;
nx_struct {
nx_am_addr_t parent;
nx_uint8_t hopcount;
nx_uint16_t metric;
} route_info;
nx_struct {
nx_uint16_t a;
nx_uint16_t b;
nx_uint16_t c;
} dbg;
} data;
nx_uint16_t seqno;
} CollectionDebugMsg;
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/mica2dot/sizes.h | #ifndef SIZES_H
#define SIZES_H
/*
* Debug messages
*/
//#define INDEX_DEBUG
//#define ARRAY_DEBUG
//#define CHUNK_DEBUG
//#define QUEUE_DEBUG
//#define STACK_DEBUG
//#define STREAM_DEBUG
//#define STREAM_INDEX_DEBUG
//#define CHECKPOINT_DEBUG
//#define ROOT_DIR_DEBUG
//#define COMPACT_DEBUG
#if defined(INDEX_DEBUG) || defined(ARRAY_DEBUG) || defined(CHUNK_DEBUG) || defined(QUEUE_DEBUG) || defined(STACK_DEBUG) || \
defined(STREAM_DEBUG) || defined(STREAM_INDEX_DEBUG) || defined(CHECKPOINT_DEBUG) || defined(ROOT_DIR_DEBUG) || \
defined(COMPACT_DEBUG)
#define CONSOLE_DEBUG
#endif
#define COUNT 20
/* Length of the data (compaction expt) */
#define LEN 20
/*
* TODO
* The following defines the number of instances of each of these storage
* objects being used in the application.
* The values for these should ideally be set automatically by the compiler
*/
#define NUM_STACKS 3
#define NUM_STREAMS 5
#define NUM_CHECKPOINTS 1
#define NUM_ARRAYS uniqueCount("Array")
//#define NUM_INDEXES uniqueCount("Index")
#define NUM_BUNDLE_INDEXES 1
/*
* This indicates the number of elements in level 1 of the index
*/
#define ARRAY_ELEMENTS_PER_CHUNK 50
/*
* This indicates the number of index elements in level 2 of the index
*/
#define INDEX_ELEMENTS_PER_CHUNK 50
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/client/sfaccess/testtinyrely.c | <filename>eon/eon/src/client/sfaccess/testtinyrely.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "tinystream.h"
/*void cb(int id, uint8_t *data, int length)
{
int i;
printf("recv cb (%i, %i)\n",id,length);
for (i=0; i < length; i++)
{
printf("%02x ", data[i]);
}
printf("\n");
}*/
int main(int argc, char **argv)
{
int fd;
int count = 0;
int cid;
if (argc != 3)
{
fprintf(stderr, "Usage: %s <host> <port> - dump packets from a serial forwarder\n", argv[0]);
exit(2);
}
fd = tinystream_init(argv[1], atoi(argv[2]));
if (fd < 0)
{
fprintf(stderr, "Couldn't start tinystream at %s:%s\n",
argv[1], argv[2]);
exit(1);
}
sleep(2);
printf("try to connect...fd=%i\n",fd);
cid = tinystream_connect(0);
printf("cid = %i\n",cid);
for (;;)
{
uint8_t buf[10];
int i;
tinystream_read(cid,buf, 10);
printf("Stream read\n");
for (i=0; i < sizeof(buf); i++)
{
printf("%02x ", buf[i]);
}
printf("Done\n");
}
tinystream_destroy();
}
|
tinyos-io/tinyos-3.x-contrib | nxtmote/tos/chips/at91/at91_registers.h | #ifndef _AT91_REGISTER_H
#define _AT91_REGISTER_H
#define _AT91REG(_addr) (*((volatile uint32_t *)(_addr)))
#define _AT91REG_OFFSET(_addr,_off) (_NXTREG((uint32_t)(_addr) + (uint32_t)(_off)))
#endif /* _NXT_REGISTER_H */
|
tinyos-io/tinyos-3.x-contrib | iowa/T2.tsync/IAtsync/Beacon.h | <reponame>tinyos-io/tinyos-3.x-contrib
#include "Tnbrhood.h"
#include "OTime.h"
#ifndef TS_BEACON_STRUCTS
enum { AM_BEACON=40,
AM_BEACON_PROBE=41,
AM_PROBE_ACK=42,
AM_PROBE_DEBUG=43,
AM_NEIGHBOR=44,
AM_NEIGHBOR_DEBUG=45,
AM_SKEW=47,
AM_UART=50
}; // please change if needed
// DebugMsg is generated only in testing versions
typedef struct beaconDebugMsg {
uint16_t sndId; // id of sender
uint8_t type; // a one-byte "type" of debugging
uint8_t stuff[25]; // anything can go here
} beaconDebugMsg; // 28 bytes of debugging data
typedef beaconDebugMsg * beaconDebugMsgPtr;
// sent only by probeTsync to test accuracy
typedef struct beaconProbeMsg {
uint16_t count;
uint32_t RecClock; // local clock at instant of receipt (just ClockL)
} beaconProbeMsg;
typedef beaconProbeMsg * beaconProbeMsgPtr;
// response to probe message
typedef struct beaconProbeAck {
uint16_t count;
uint16_t sndId; // id of sender
timeSync_t Local; // local clock for Ack (48 bit, H and L)
timeSync_t Virtual; // virtual time for Ack (48 bit, H and L)
float skew; // current skew adjustment factor
float calibRatio; // current OTime.calibrate() value
uint8_t mode; // mode of mote (important only for spy)
} beaconProbeAck;
typedef beaconProbeAck * beaconProbeAckPtr;
// the Beacon Message
typedef struct beaconMsg {
uint16_t sndId; // Id of sender
int16_t prevDiff; // difference of most recent received Beacon
timeSync_t Local; // local clock of sender (48 bit, H and L)
timeSync_t Virtual; // virtual time of sender (48 bit, H and L)
timeSync_t Xor; // XOR of Local and Virtual (for error check)
uint8_t mode; // sender's mode
uint8_t NbrSize; // neighborhood size of sender
// Delay is **VIRTUAL FIELD**
// uint32_t Delay; // processing and MAC delay of sending beacon
} beaconMsg; // 28 byte payload
typedef beaconMsg * beaconMsgPtr;
// the Neighborhood Message
typedef struct neighborMsg {
uint16_t sndId; // Id of sender
uint16_t nodes[NUM_NEIGHBORS]; // neighbors heard from recently
} neighborMsg;
typedef neighborMsg * neighborMsgPtr;
// Skew diffusion/gossip message
typedef struct skewMsg {
uint16_t sndId; // Id of sender
uint16_t rootId; // Id of "root" initiator of diffusion
uint16_t minId; // Id of node with minimum known skew
timeSync_t initStamp; // Vclock of initiation
float skewMin; // minimum known skew
uint8_t seqno; // sequence number (for repeats)
} skewMsg;
typedef skewMsg * skewMsgPtr;
#define TS_BEACON_STRUCTS
#endif
|
tinyos-io/tinyos-3.x-contrib | nxtmote/tos/chips/motor/d_output.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef D_OUTPUT_H
#define D_OUTPUT_H
//// d_output.h ////
//Constant reffering to new motor
#define REG_CONST_DIV 32 // Constant which the PID constants value will be divided with
#define DEFAULT_P_GAIN_FACTOR 96//3
#define DEFAULT_I_GAIN_FACTOR 32//1
#define DEFAULT_D_GAIN_FACTOR 32//1
#define MIN_MOVEMENT_POWER 10
#define MAX_CAPTURE_COUNT 100
//Constant reffering to RegMode parameter
#define REGSTATE_IDLE 0x00
#define REGSTATE_REGULATED 0x01
#define REGSTATE_SYNCHRONE 0x02
//Constant reffering to RunState parameter
#define MOTOR_RUN_STATE_IDLE 0x00
#define MOTOR_RUN_STATE_RAMPUP 0x10
#define MOTOR_RUN_STATE_RUNNING 0x20
#define MOTOR_RUN_STATE_RAMPDOWN 0x40
#define MOTOR_RUN_STATE_HOLD 0x60
enum
{
MOTOR_A,
MOTOR_B,
MOTOR_C
};
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/apps/simtest/impl/linuxsim/userstructs.h | #ifndef USERSTRUCTS_H_
#define USERSTRUCTS_H_
//typedef int bool;
#endif
|
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/driver/reset_device.c | <reponame>tinyos-io/tinyos-3.x-contrib<filename>nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/driver/reset_device.c
/* LIBUSB-WIN32, Generic Windows USB Library
* Copyright (c) 2002-2005 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "libusb_driver.h"
NTSTATUS reset_device(libusb_device_t *dev, int timeout)
{
NTSTATUS status = STATUS_SUCCESS;
DEBUG_MESSAGE("reset_device()");
status = call_usbd(dev, NULL, IOCTL_INTERNAL_USB_RESET_PORT, timeout);
if(!NT_SUCCESS(status))
{
DEBUG_ERROR("reset_device(): IOCTL_INTERNAL_USB_RESET_PORT failed: "
"status: 0x%x", status);
}
status = call_usbd(dev, NULL, IOCTL_INTERNAL_USB_CYCLE_PORT, timeout);
if(!NT_SUCCESS(status))
{
DEBUG_ERROR("reset_device(): IOCTL_INTERNAL_USB_CYCLE_PORT failed: "
"status: 0x%x", status);
}
return status;
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/daq/kernel-driver/ixpci.h | <filename>diku/common/tools/daq/kernel-driver/ixpci.h
/* User space declarations for PCI DAQ series.
Author: <NAME>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _IXPCI_H
#define _IXPCI_H
#define IXPCI_PROC_FILE "/proc/ixpci/ixpci"
#define PCI_BASE_ADDRESSES_NUMBER 6
#define CARD_NAME_LENGTH 32
/* The chaos of name convention from hardware manual... */
enum {
IXPCI_8254_COUNTER_0,
IXPCI_8254_COUNTER_1,
IXPCI_8254_COUNTER_2,
IXPCI_8254_CONTROL_REG,
IXPCI_SELECT_THE_ACTIVE_8254_CHIP,
IXPCI_GENERAL_CONTROL_REG,
IXPCI_STATUS_REG,
IXPCI_AD_SOFTWARE_TRIGGER_REG,
IXPCI_DIGITAL_INPUT_PORT,
IXPCI_DIGITAL_OUTPUT_PORT,
IXPCI_ANALOG_INPUT_CHANNEL_CONTROL_REG,
IXPCI_ANALOG_INPUT_GAIN_CONTROL_REG,
IXPCI_ANALOG_INPUT_PORT,
IXPCI_ANALOG_OUTPUT_CHANNEL_1,
IXPCI_ANALOG_OUTPUT_CHANNEL_2,
IXPCI_PCI_INTERRUPT_CONTROL_REG,
IXPCI_CLEAR_INTERRUPT,
IXPCI_LAST_REG
};
#define IXPCI_8254C0 IXPCI_8254_COUNTER_0
#define IXPCI_8254C1 IXPCI_8254_COUNTER_1
#define IXPCI_8254C2 IXPCI_8254_COUNTER_2
#define IXPCI_8254CR IXPCI_8254_CONTROL_REG
#define IXPCI_8254_CHIP_SELECT IXPCI_SELECT_THE_ACTIVE_8254_CHIP
#define IXPCI_8254CS IXPCI_8254_CHIP_SELECT
#define IXPCI_GCR IXPCI_GENERAL_CONTROL_REG
#define IXPCI_CONTROL_REG IXPCI_GENERAL_CONTROL_REG
#define IXPCI_CR IXPCI_CONTROL_REG
#define IXPCI_SR IXPCI_STATUS_REG
#define IXPCI_ADST IXPCI_AD_SOFTWARE_TRIGGER_REG
#define IXPCI_DI IXPCI_DIGITAL_INPUT_PORT
#define IXPCI_DO IXPCI_DIGITAL_OUTPUT_PORT
#define IXPCI_AICR IXPCI_ANALOG_INPUT_CHANNEL_CONTROL_REG
#define IXPCI_AIGR IXPCI_ANALOG_INPUT_GAIN_CONTROL_REG
#define IXPCI_AI IXPCI_ANALOG_INPUT_PORT
#define IXPCI_AD IXPCI_AI
#define IXPCI_AO1 IXPCI_ANALOG_OUTPUT_CHANNEL_1
#define IXPCI_DA1 IXPCI_AO1
#define IXPCI_AO2 IXPCI_ANALOG_OUTPUT_CHANNEL_2
#define IXPCI_DA2 IXPCI_AO2
#define IXPCI_PICR IXPCI_PCI_INTERRUPT_CONTROL_REG
#define IXPCI_CI IXPCI_CLEAR_INTERRUPT
/* IXPCI structure for register */
typedef struct ixpci_reg {
unsigned int id; /* register's id */
unsigned int value; /* register's value for read/write */
} ixpci_reg_t;
/* register operation mode */
enum {
IXPCI_RM_RAW, /* read/write directly without data mask */
IXPCI_RM_NORMAL, /* read/write directly */
IXPCI_RM_READY, /* blocks before ready */
IXPCI_RM_TRIGGER, /* do software trigger before ready (blocked) */
IXPCI_RM_LAST_MODE
};
/* IXPCI device information for found cards' list */
typedef struct ixpci_devinfo {
unsigned int no; /* device number (minor number) */
long long id; /* card's id */
unsigned long base[PCI_BASE_ADDRESSES_NUMBER]; /* base I/O addresses */
unsigned int range[PCI_BASE_ADDRESSES_NUMBER]; /* ranges for each I/O address */
char name[CARD_NAME_LENGTH]; /* card name information */
} ixpci_devinfo_t;
/* IOCTL command IDs */
enum {
IXPCI_IOCTL_ID_RESET,
IXPCI_IOCTL_ID_GET_INFO,
IXPCI_IOCTL_ID_SET_SIG,
IXPCI_IOCTL_ID_READ_REG,
IXPCI_IOCTL_ID_WRITE_REG,
IXPCI_IOCTL_ID_TIME_SPAN,
IXPCI_IOCTL_ID_DI,
IXPCI_IOCTL_ID_DO,
IXPCI_IOCTL_ID_IRQ_ENABLE,
IXPCI_IOCTL_ID_IRQ_DISABLE,
IXPCI_IOCTL_ID_PIC_CONTROL,
IXPCI_IOCTL_ID_LAST_ITEM,
};
/* IXPCI IOCTL command */
#define IXPCI_MAGIC_NUM 0x26 /* why? ascii codes 'P' + 'D' + 'A' + 'Q' */
#define IXPCI_GET_INFO _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_GET_INFO, ixpci_devinfo_t *)
#define IXPCI_SET_SIG _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_SET_SIG, ixpci_signal_t *)
#define IXPCI_READ_REG _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_READ_REG, ixpci_reg_t *)
#define IXPCI_WRITE_REG _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_WRITE_REG, ixpci_reg_t *)
#define IXPCI_TIME_SPAN _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_TIME_SPAN, int)
#define IXPCI_WAIT IXPCI_TIME_SPAN
#define IXPCI_DELAY IXPCI_TIME_SPAN
#define IXPCI_BLOCK IXPCI_TIME_SPAN
#define IXPCI_RESET _IO(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_RESET)
#define IXPCI_PIC_CONTROL _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_PIC_CONTROL, int)
#define IXPCI_IOCTL_DI _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_DI, void *)
#define IXPCI_IOCTL_DO _IOR(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_DO, void *)
#define IXPCI_IRQ_ENABLE _IO(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_IRQ_ENABLE)
#define IXPCI_IRQ_DISABLE _IO(IXPCI_MAGIC_NUM, IXPCI_IOCTL_ID_IRQ_DISABLE)
#endif /* _IXPCI_H */
/* *INDENT-ON* */
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/stargate/sfaccess/sfsource.c | <filename>eon/eon/src/runtime/stargate/sfaccess/sfsource.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "sfsource.h"
uint32_t platform;
int saferead(int fd, void *buffer, int count)
{
int actual = 0;
while (count > 0)
{
int n = read(fd, buffer, count);
if (n == -1 && errno == EINTR)
continue;
if (n == -1)
return -1;
if (n == 0)
return actual;
count -= n;
actual += n;
buffer += n;
}
return actual;
}
int safewrite(int fd, const void *buffer, int count)
{
int actual = 0;
while (count > 0)
{
int n = write(fd, buffer, count);
if (n == -1 && errno == EINTR)
continue;
if (n == -1)
return -1;
count -= n;
actual += n;
buffer += n;
}
return actual;
}
int open_sf_source(const char *host, int port)
/* Returns: file descriptor for serial forwarder at host:port
*/
{
int fd = socket(AF_INET, SOCK_STREAM, 0);
struct hostent *entry;
struct sockaddr_in addr;
if (fd < 0)
return fd;
entry = gethostbyname(host);
if (!entry)
{
close(fd);
return -1;
}
addr.sin_family = entry->h_addrtype;
memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
addr.sin_port = htons(port);
if (connect(fd, (struct sockaddr *)&addr, sizeof addr) < 0)
{
close(fd);
return -1;
}
if (init_sf_source(fd) < 0)
{
close(fd);
return -1;
}
return fd;
}
extern uint32_t platform;
int init_sf_source(int fd)
/* Effects: Checks that fd is following the serial forwarder protocol
Sends 'platform' for protocol version '!', and sets 'platform' to
the received platform value.
Modifies: platform
Returns: 0 if it is, -1 otherwise
*/
{
char check[2], us[2];
int version;
unsigned char nonce[4];
/* Indicate version and check if serial forwarder on the other end */
us[0] = 'T'; us[1] = '!';
if (safewrite(fd, us, 2) != 2 ||
saferead(fd, check, 2) != 2 ||
check[0] != 'T' || check[1] < ' ')
return -1;
version = check[1];
if (us[1] < version)
version = us[1];
switch (version)
{
case ' ': break;
case '!':
nonce[0] = platform;
nonce[1] = platform >> 8;
nonce[2] = platform >> 16;
nonce[3] = platform >> 24;
if (safewrite(fd, nonce, 4) != 4)
return -1;
if (saferead(fd, nonce, 4) != 4)
return -1;
//Unlike the more general SFProtocol.java this piece of code always knows what platform it is connected to; just drop the preferred platform from the client
//platform = nonce[0] | nonce[1] << 8 | nonce[2] << 16 | nonce[3] << 24;
break;
}
return 0;
}
void *read_sf_packet(int fd, int *len)
/* Effects: reads packet from serial forwarder on file descriptor fd
Returns: the packet read (in newly allocated memory), and *len is
set to the packet length, or NULL for failure
*/
{
unsigned char l;
void *packet;
if (saferead(fd, &l, 1) != 1)
return NULL;
packet = malloc(l);
//printf("length = %i\n",l);
if (!packet)
return NULL;
if (saferead(fd, packet, l) != l)
{
free(packet);
return NULL;
}
*len = l;
return packet;
}
int write_sf_packet(int fd, const void *packet, int len)
/* Effects: writes len byte packet to serial forwarder on file descriptor
fd
Returns: 0 if packet successfully written, -1 otherwise
*/
{
unsigned char l = len;
if (safewrite(fd, &l, 1) != 1 ||
safewrite(fd, packet, l) != l)
return -1;
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | wsu/WakeNet/tos/lib/net/ctp/Ctp.h | /* $Id: Ctp.h,v 1.6 2008/07/10 18:59:47 idgay Exp $ */
/*
* Copyright (c) 2006 Stanford University.
* 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 Stanford University 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 STANFORD
* UNIVERSITY 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.
*/
/*
* Header file that declares the AM types, message formats, and
* constants for the TinyOS reference implementation of the
* Collection Tree Protocol (CTP), as documented in TEP 123.
*
* @author <NAME>
* @date $Date: 2008/07/10 18:59:47 $
*/
#ifndef CTP_H
#define CTP_H
#include <Collection.h>
#include <AM.h>
#define UQ_CTP_CLIENT "CtpSenderC.CollectId"
enum {
// AM types:
AM_CTP_ROUTING = 0x70,
AM_CTP_DATA = 0x71,
AM_CTP_DEBUG = 0x72,
// CTP Options:
CTP_OPT_PULL = 0x80, // TEP 123: P field
CTP_OPT_ECN = 0x40, // TEP 123: C field
};
typedef nx_uint8_t nx_ctp_options_t;
typedef uint8_t ctp_options_t;
typedef nx_struct {
nx_ctp_options_t options;
nx_uint8_t thl;
nx_uint16_t etx;
nx_am_addr_t origin;
nx_uint8_t originSeqNo;
nx_collection_id_t type;
nx_uint8_t (COUNT(0) data)[0]; // Deputy place-holder, field will probably be removed when we Deputize Ctp
} ctp_data_header_t;
typedef nx_struct {
nx_ctp_options_t options;
nx_am_addr_t parent;
nx_uint16_t etx;
nx_uint8_t (COUNT(0) data)[0]; // Deputy place-holder, field will probably be removed when we Deputize Ctp
} ctp_routing_header_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | gems/ttsp/tinyos/apps/BeaconBroadcaster/BeaconBroadcaster.h | #ifndef BEACONBROADCAST_H
#define BEACONBROADCAST_H
typedef nx_struct BeaconMsg {
nx_uint16_t srcAddr;
nx_uint32_t beaconId;
} BeaconMsg_t;
enum {
AM_BEACONMSG = 181
};
#endif |
tinyos-io/tinyos-3.x-contrib | rincon/tos/chips/msp430/pwm/Msp430Pwm.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>rincon/tos/chips/msp430/pwm/Msp430Pwm.h
#ifndef PWM_H
#define PWM_H
enum timer_outmode_enum {
MSP430TIMER_OUTMODE_OUTPUT = 0,
MSP430TIMER_OUTMODE_SET = 1,
MSP430TIMER_OUTMODE_TOGGLERESET = 2,
MSP430TIMER_OUTMODE_SETRESET = 3,
MSP430TIMER_OUTMODE_TOGGLE = 4,
MSP430TIMER_OUTMODE_RESET = 5,
MSP430TIMER_OUTMODE_TOGGLESET = 6,
MSP430TIMER_OUTMODE_RESETSET = 7,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/tools/ft232r/d2xx/d2xx.c | /***********************************************************************
* d2xx.c -- python ftdi d2xx driver interface (partial)
*/
#include <Python.h>
#include "windows.h"
#include "ftd2xx.h"
static char c;
static void _del(void *fp, void *desc) {
if (desc == &c) {
FT_Close(*(FT_HANDLE *) fp);
PyMem_Free(fp);
}
}
static PyObject *new(void) {
FT_HANDLE *fp;
PyObject *o;
if ((fp = PyMem_Malloc(sizeof(FT_HANDLE))) == NULL)
return PyErr_NoMemory();
if ((o = PyCObject_FromVoidPtrAndDesc(fp, &c, _del)) == NULL) {
PyMem_Free(fp);
return NULL;
}
return o;
}
static FT_HANDLE *get(PyObject *o) {
if (!PyCObject_Check(o)) {
PyErr_SetString(PyExc_TypeError, "FT_HANDLE expected");
return NULL;
}
if (PyCObject_GetDesc(o) != &c) {
PyErr_SetString(PyExc_TypeError, "FT_HANDLE expected");
return NULL;
}
return (FT_HANDLE *) PyCObject_AsVoidPtr(o);
}
static char *fterrs[] = {
"Success",
"Invalid Handle",
"Device not found",
"Device not opened",
"IO Error",
"Insufficient resources",
"Invalid parameter",
"Invalid baud rate",
"Device not opened for erase",
"Device not opened for write",
"Failed to write device",
"EEPROM read failed",
"EEPROM write failed",
"EEPROM erase failed",
"EEPROM not present",
"EEPROM not programmed",
"Invalid argument",
"Not supported",
"Other error",
"Device list not ready",
};
static PyObject *fterr(int code) {
PyObject *r, *c = NULL, *d = NULL;
if ((code < 0) || (code > FT_DEVICE_LIST_NOT_READY))
code = FT_OTHER_ERROR;
if ((r = PyTuple_New(2)) == NULL)
return NULL;
if ((c = PyInt_FromLong(code)) == NULL)
goto bad;
PyTuple_SET_ITEM(r, 0, c); c = NULL;
if ((d = PyString_FromString(fterrs[code])) == NULL)
goto bad;
PyTuple_SET_ITEM(r, 1, d);
PyErr_SetObject(PyExc_RuntimeError, r);
return NULL;
bad:
Py_XDECREF(r);
Py_XDECREF(c);
Py_XDECREF(d);
return NULL;
}
static PyObject *ftopen(PyObject *self, PyObject *args) {
FT_HANDLE *hp;
PyObject *ho, *dvo = NULL;
FT_STATUS rc;
int dev;
char *sdev;
DWORD dwFlags, dwFlags2;
if (!PyArg_ParseTuple(args, "|O", &dvo))
return NULL;
if ((ho = new()) == NULL)
goto bad;
if ((hp = get(ho)) == NULL)
goto bad;
if ((dvo == NULL) || (PyInt_CheckExact(dvo))) {
if (dvo == NULL)
dev = 0;
else
dev = PyInt_AsLong(dvo);
if ((rc = FT_Open(dev, hp)) != FT_OK)
goto bonk;
} else {
if (!PyString_CheckExact(dvo)) {
PyErr_SetString(PyExc_RuntimeError, "Expected string or int");
goto bad;
}
if ((sdev = PyString_AsString(dvo)) == NULL)
return NULL;
if (*sdev == '=') {
sdev++;
dwFlags = dwFlags2 = FT_OPEN_BY_SERIAL_NUMBER;
} else {
if (*sdev == ':') {
sdev++;
dwFlags = dwFlags2 = FT_OPEN_BY_DESCRIPTION;
} else {
dwFlags = FT_OPEN_BY_DESCRIPTION;
dwFlags2 = FT_OPEN_BY_SERIAL_NUMBER;
}
}
if ((rc = FT_OpenEx(sdev, dwFlags, hp)) != FT_OK) {
if ((rc = FT_OpenEx(sdev, dwFlags2, hp)) != FT_OK)
goto bonk;
}
}
return ho;
bonk:
fterr(rc);
bad:
Py_XDECREF(ho);
return NULL;
}
PyDoc_STRVAR(dopen,
"handle = open(dev=0)\n"
"\n"
"attempt to open the specified device and\n"
"return a handle to it. dev can be one of\n"
"the following:\n"
" - a non-negative integer\n"
" - an equals (=) followed by a serial\n"
" number\n"
" - a colon (:) followed by a description\n"
" - a description or a serial number (open\n"
" will attempt them in that order)\n");
static PyObject *ftreset(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int how = 0;
if (!PyArg_ParseTuple(args, "O|i", &ho, &how))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
switch (how) {
case 0: {
rc = FT_ResetDevice(*hp); break;
}
case 1: {
rc = FT_ResetPort(*hp); break;
}
case 2: {
rc = FT_CyclePort(*hp); break;
}
default: {
PyErr_SetString(PyExc_ValueError, "how must be 0, 1, or 2");
return NULL;
}
}
if (rc != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dreset,
"reset(handle, [how])\n"
"\n"
"reset the device given a device handle.\n"
"\n"
"if how==0, call FT_ResetDevice (default).\n"
"if how==1, call FT_ResetPort.\n"
"if how==2, call FT_CyclePort.\n");
static PyObject *ftflow(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int meth, xon = 19, xoff = 20;
if (!PyArg_ParseTuple(args, "Oi|ii", &ho, &meth, &xon, &xoff))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_SetFlowControl(*hp, meth, xon, xoff)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dflow,
"flow(handle, method [, xonChar, xoffChar])\n"
"\n"
"set the flow control method to one of:\n"
" - FT_FLOW_NONE\n"
" - FT_FLOW_RTS_CTS\n"
" - FT_FLOW_DTR_DSR\n"
" - FT_FLOW_XON_XOFF\n");
static PyObject *ftspeed(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int b;
if (!PyArg_ParseTuple(args, "Oi", &ho, &b))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_SetBaudRate(*hp, b)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dspeed,
"speed(handle, rate)\n"
"\n"
"set the baud rate to one of the\n"
"FT_BAUD_xxx values.\n");
static PyObject *ftdfmt(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int db, sb, p;
if (!PyArg_ParseTuple(args, "Oiii", &ho, &db, &sb, &p))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_SetDataCharacteristics(*hp, db, sb, p)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(ddfmt,
"dfmt(handle, databits, stopbits, parity)\n"
"\n"
"set the number of data bits to one of the\n"
"FT_BITS_xxx value, the number of stop bits\n"
"to one of the FT_STOP_BITS_xxx values, and\n"
"the parity to one of the FT_PARITY_xxx\n"
"values.\n");
static PyObject *ftmode(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int mask, mode;
if (!PyArg_ParseTuple(args, "Oii", &ho, &mask, &mode))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_SetBitMode(*hp, mask, mode)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dmode,
"mode(handle, mask, mode)\n"
"\n"
"set the bit-banging mode to one of the\n"
"FT_MODE_xxx values. mask is a bitwise\n"
"or of FT_BANG_xxx values. see the d2xx\n"
"programmer's guide for more details.\n");
static PyObject *ftwrite(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
char *s;
int l;
DWORD nw;
if (!PyArg_ParseTuple(args, "Os#", &ho, &s, &l))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_Write(*hp, s, l, &nw)) != FT_OK)
return fterr(rc);
return PyInt_FromLong(nw);
}
PyDoc_STRVAR(dwrite,
"nwrite = write(handle, string)\n"
"\n"
"write the given string data to the port.\n");
static PyObject *ftread(PyObject *self, PyObject *args) {
PyObject *ret;
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
char *s;
int l = 1;
DWORD nr;
if (!PyArg_ParseTuple(args, "O|i", &ho, &l))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((ret = PyString_FromStringAndSize(NULL, l)) == NULL)
return NULL;
if (PyString_AsStringAndSize(ret, &s, &l))
goto bad;
if ((rc = FT_Read(*hp, s, l, &nr)) != FT_OK)
return fterr(rc);
if (nr != l) {
if (nr > l) {
PyErr_SetString(PyExc_ValueError, "read() returned too many bytes?!?");
goto bad;
}
if (_PyString_Resize(&ret, nr))
return NULL;
}
return ret;
bad:
Py_XDECREF(ret);
return NULL;
}
PyDoc_STRVAR(dread,
"string = read(handle, nbytes)\n"
"\n"
"read up to nbytes bytes from the port.\n"
"returns a string containing the bytes\n"
"actually read.\n");
static PyObject *ftmodem(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
DWORD ret;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_GetModemStatus(*hp, &ret)) != FT_OK)
return fterr(rc);
return PyInt_FromLong(ret);
}
PyDoc_STRVAR(dmodem,
"status = modem(handle)\n"
"\n"
"return a bitwise or of the FT_MODEM_xxx\n"
"values according to the modem status lines.\n");
static PyObject *ftpurge(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
int what;
FT_STATUS rc;
if (!PyArg_ParseTuple(args, "Oi", &ho, &what))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_Purge(*hp, what)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dpurge,
"purge(what)\n"
"\n"
"purge according to any combination of\n"
"FT_PURGE_{RX, TX}.\n");
static PyObject *ftdtr(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
int val = 1;
FT_STATUS rc;
if (!PyArg_ParseTuple(args, "O|i", &ho, &val))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if (val)
rc = FT_SetDtr(*hp);
else
rc = FT_ClrDtr(*hp);
if (rc != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(ddtr,
"dtr(level=1)\n"
"\n"
"set the DTR line according to level.\n");
static PyObject *ftrts(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
int val = 1;
FT_STATUS rc;
if (!PyArg_ParseTuple(args, "O|i", &ho, &val))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if (val)
rc = FT_SetRts(*hp);
else
rc = FT_ClrRts(*hp);
if (rc != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(drts,
"rts(level=1)\n"
"\n"
"set the RTS line according to level.\n");
static PyObject *ftbrk(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
int val;
FT_STATUS rc;
if (!PyArg_ParseTuple(args, "Oi", &ho, &val))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if (val)
rc = FT_SetBreakOn(*hp);
else
rc = FT_SetBreakOff(*hp);
if (rc != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dbrk,
"brk(bool)\n"
"\n"
"set/clear break condition.\n");
static PyObject *ftinq(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
DWORD ret, v1, v2;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_GetStatus(*hp, &ret, &v1, &v2)) != FT_OK)
return fterr(rc);
return PyInt_FromLong(ret);
}
PyDoc_STRVAR(dinq,
"bytes_in_rx_queue = inq(handle)\n"
"\n"
"return the number of bytes in the rx queue.\n");
static PyObject *fttimeo(PyObject *self, PyObject *args) {
PyObject *ho;
FT_HANDLE *hp;
FT_STATUS rc;
int timeo;
if (!PyArg_ParseTuple(args, "Oi", &ho, &timeo))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_SetTimeouts(*hp, timeo, timeo)) != FT_OK)
return fterr(rc);
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dtimeo,
"timeo(handle, timeout)\n"
"\n"
"set rx/tx timeout in milliseconds for the port.\n");
static PyObject *devs(PyObject *self, PyObject *args) {
FT_STATUS rc;
DWORD numDev;
FT_DEVICE_LIST_INFO_NODE *raw;
PyObject *ret = NULL;
int i;
if ((rc = FT_CreateDeviceInfoList(&numDev)) != FT_OK)
return fterr(rc);
if (!numDev)
return PyTuple_New(0);
if ((raw = (FT_DEVICE_LIST_INFO_NODE *) PyMem_Malloc(numDev * sizeof(FT_DEVICE_LIST_INFO_NODE))) == NULL)
return PyErr_NoMemory();
if ((rc = FT_GetDeviceInfoList(raw, &numDev)) != FT_OK)
goto bonk;
if ((ret = PyTuple_New(numDev)) == NULL)
goto bad;
for (i = 0; i < numDev; i++) {
PyObject *e, *n;
if ((e = PyTuple_New(3)) == NULL)
goto bad;
if ((n = PyInt_FromLong(raw[i].Type)) == NULL) {
Py_DECREF(e);
goto bad;
}
PyTuple_SET_ITEM(e, 0, n);
if ((n = PyString_FromString(raw[i].SerialNumber)) == NULL) {
Py_DECREF(e);
goto bad;
}
PyTuple_SET_ITEM(e, 1, n);
if ((n = PyString_FromString(raw[i].Description)) == NULL) {
Py_DECREF(e);
goto bad;
}
PyTuple_SET_ITEM(e, 2, n);
PyTuple_SET_ITEM(ret, i, e);
}
return ret;
bonk:
fterr(rc);
bad:
PyMem_Free(raw);
Py_XDECREF(ret);
return NULL;
}
PyDoc_STRVAR(ddevs,
"((serial_num, description), ...) = devs()\n"
"\n"
"return the serial number and description\n"
"of every connected device\n");
static PyObject *info(PyObject *self, PyObject *args) {
PyObject *ho, *tmp, *ret = NULL;
FT_HANDLE *hp;
FT_DEVICE dev;
DWORD id;
char serl[16];
char desc[64];
FT_STATUS rc;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_GetDeviceInfo(*hp, &dev, &id, serl, desc, NULL)) != FT_OK) {
fterr(rc);
return NULL;
}
if ((ret = PyTuple_New(4)) == NULL)
return NULL;
if ((tmp = PyInt_FromLong(dev)) == NULL)
goto bonk;
PyTuple_SET_ITEM(ret, 0, tmp);
if ((tmp = PyInt_FromLong(id)) == NULL)
goto bonk;
PyTuple_SET_ITEM(ret, 1, tmp);
if ((tmp = PyString_FromString(serl)) == NULL)
goto bonk;
PyTuple_SET_ITEM(ret, 2, tmp);
if ((tmp = PyString_FromString(desc)) == NULL)
goto bonk;
PyTuple_SET_ITEM(ret, 3, tmp);
return ret;
bonk:
Py_DECREF(ret);
return NULL;
}
PyDoc_STRVAR(dinfo,
"(type, id, ser#, desc) = info(handle)\n"
"\n"
"Return the device type, ID, serial number,\n"
"and description for the given handle.\n");
static PyObject *prog(PyObject *self, PyObject *args) {
FT_PROGRAM_DATA fd;
char MfgBuf[32];
char MfgIdBuf[16];
char DescBuf[64];
char SerlBuf[16];
FT_HANDLE *hp;
FT_STATUS rc;
PyObject *ho, *pd, *ko, *vo;
Py_ssize_t pos = 0;
char *ks, *vs;
int vi;
FT_DEVICE dev;
DWORD id;
char serl[16];
char desc[64];
if (!PyArg_ParseTuple(args, "OO", &ho, &pd))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if (!PyDict_CheckExact(pd)) {
PyErr_SetString(PyExc_TypeError, "dict expected");
return NULL;
}
if (!PyDict_Size(pd)) {
PyErr_SetString(PyExc_ValueError, "dict is empty");
return NULL;
}
/*** get device info */
if ((rc = FT_GetDeviceInfo(*hp, &dev, &id, serl, desc, NULL)) != FT_OK) {
fterr(rc);
return NULL;
}
/*** read eeprom */
fd.Signature1 = 0x00000000;
fd.Signature2 = 0xffffffff;
switch (dev) {
case FT_DEVICE_232R: { fd.Version = 0x00000002; break; }
case FT_DEVICE_2232C: { fd.Version = 0x00000001; break; }
default: { fd.Version = 0x00000000; break; }
}
fd.Manufacturer = MfgBuf;
fd.ManufacturerId = MfgIdBuf;
fd.Description = DescBuf;
fd.SerialNumber = SerlBuf;
if ((rc = FT_EE_Read(*hp, &fd)) != FT_OK) {
fterr(rc);
return NULL;
}
/*** update from dict */
while (PyDict_Next(pd, &pos, &ko, &vo)) {
int did = 0;
if (PyString_AsStringAndSize(ko, &ks, NULL))
return NULL;
/*** integers */
if (PyInt_CheckExact(vo)) {
vi = PyInt_AsLong(vo);
while (!did) {
if (!strcasecmp(ks, "vendorid")) {
fd.VendorId = vi; did = 1; break;
}
if (!strcasecmp(ks, "productid")) {
fd.ProductId = vi; did = 1; break;
}
if (!strcasecmp(ks, "maxpower")) {
fd.MaxPower = vi; did = 1; break;
}
if (!strcasecmp(ks, "pnp")) {
fd.PnP = vi; did = 1; break;
}
if (!strcasecmp(ks, "selfpowered")) {
fd.SelfPowered = vi; did = 1; break;
}
if (!strcasecmp(ks, "remotewakeup")) {
fd.RemoteWakeup = vi; did = 1; break;
}
/*** FT232BM */
if (dev == FT_DEVICE_BM) {
if (!strcasecmp(ks, "rev4")) {
fd.Rev4 = vi; did = 1; break;
}
if (!strcasecmp(ks, "pulldownenable")) {
fd.PullDownEnable = vi; did = 1; break;
}
if (!strcasecmp(ks, "sernumenable")) {
fd.SerNumEnable = vi; did = 1; break;
}
if (!strcasecmp(ks, "usbversionenable")) {
fd.USBVersionEnable = vi; did = 1; break;
}
if (!strcasecmp(ks, "usbversion")) {
fd.USBVersion = vi; did = 1; break;
}
/*** ...incomplete... */
}
/*** FT2232C */
if (dev == FT_DEVICE_2232C) {
if (!strcasecmp(ks, "rev5")) {
fd.Rev5 = vi; did = 1; break;
}
if (!strcasecmp(ks, "pulldownenable5")) {
fd.PullDownEnable5 = vi; did = 1; break;
}
if (!strcasecmp(ks, "sernumenable5")) {
fd.SerNumEnable5 = vi; did = 1; break;
}
if (!strcasecmp(ks, "usbversionenable5")) {
fd.USBVersionEnable5 = vi; did = 1; break;
}
if (!strcasecmp(ks, "usbversion5")) {
fd.USBVersion5 = vi; did = 1; break;
}
/*** ...incomplete... */
}
/*** FT232R */
if (dev == FT_DEVICE_232R) {
if (!strcasecmp(ks, "useextosc")) {
fd.UseExtOsc = vi; did = 1; break;
}
if (!strcasecmp(ks, "highdriveios")) {
fd.HighDriveIOs = vi; did = 1; break;
}
if (!strcasecmp(ks, "endpointsize")) {
fd.EndpointSize = vi; did = 1; break;
}
if (!strcasecmp(ks, "pulldownenabler")) {
fd.PullDownEnableR = vi; did = 1; break;
}
if (!strcasecmp(ks, "sernumenabler")) {
fd.SerNumEnableR = vi; did = 1; break;
}
if (!strcasecmp(ks, "inverttxd")) {
fd.InvertTXD = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertrxd")) {
fd.InvertRXD = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertrts")) {
fd.InvertRTS = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertcts")) {
fd.InvertCTS = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertdtr")) {
fd.InvertDTR = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertdsr")) {
fd.InvertDSR = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertdcd")) {
fd.InvertDCD = vi; did = 1; break;
}
if (!strcasecmp(ks, "invertri")) {
fd.InvertRI = vi; did = 1; break;
}
if (!strcasecmp(ks, "cbus0")) {
fd.Cbus0 = vi; did = 1; break;
}
if (!strcasecmp(ks, "cbus1")) {
fd.Cbus1 = vi; did = 1; break;
}
if (!strcasecmp(ks, "cbus2")) {
fd.Cbus2 = vi; did = 1; break;
}
if (!strcasecmp(ks, "cbus3")) {
fd.Cbus3 = vi; did = 1; break;
}
if (!strcasecmp(ks, "cbus4")) {
fd.Cbus4 = vi; did = 1; break;
}
if (!strcasecmp(ks, "risd2xx")) {
fd.RIsD2XX = vi; did = 1; break;
}
}
/*** nope */
break;
}
}
/*** strings */
while (!did) {
if (PyString_AsStringAndSize(vo, &vs, NULL))
return NULL;
if (!strcasecmp(ks, "manufacturer")) {
fd.Manufacturer = vs; did = 1; break;
}
if (!strcasecmp(ks, "manufacturerid")) {
fd.ManufacturerId = vs; did = 1; break;
}
if (!strcasecmp(ks, "description")) {
fd.Description = vs; did = 1; break;
}
if (!strcasecmp(ks, "serialnumber")) {
fd.SerialNumber = vs; did = 1; break;
}
break;
}
/*** got it? */
if (!did) {
PyErr_SetObject(PyExc_KeyError, ko);
return NULL;
}
}
/*** write updates to eeprom */
if ((rc = FT_EE_Program(*hp, &fd)) != FT_OK) {
fterr(rc);
return NULL;
}
/*** done */
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(dprog,
"prog(handle, dict)\n"
"\n"
"Program the EEPROM on the FTDI chip. Dict\n"
"contains key-value pairs in the FT_PROGRAM_DATA\n"
"struct (see ftd2xx.h). The keys are not\n"
"case sensitive.\n");
static PyObject *uasz(PyObject *self, PyObject *args) {
FT_HANDLE *hp;
PyObject *ho;
FT_STATUS rc;
DWORD sz;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_EE_UASize(*hp, &sz)) != FT_OK) {
fterr(rc);
return NULL;
}
return PyInt_FromLong(sz);
}
PyDoc_STRVAR(duasz,
"nbytes = uasz(handle)\n"
"\n"
"Return the size of the EEPROM user area.\n");
static PyObject *uard(PyObject *self, PyObject *args) {
FT_HANDLE *hp;
PyObject *ho, *ret = NULL;
FT_STATUS rc;
DWORD sz, nr;
char *s;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_EE_UASize(*hp, &sz)) != FT_OK) {
fterr(rc);
return NULL;
}
if (!sz)
return PyString_FromString("");
if ((ret = PyString_FromStringAndSize(NULL, sz)) == NULL)
return NULL;
if ((s = PyString_AsString(ret)) == NULL)
goto bad;
if ((rc = FT_EE_UARead(*hp, (unsigned char *) s, sz, &nr)) != FT_OK) {
fterr(rc);
goto bad;
}
if (nr != sz) {
PyErr_SetString(PyExc_RuntimeError, "UARead size mismatch");
goto bad;
}
return ret;
bad:
Py_DECREF(ret);
return NULL;
}
PyDoc_STRVAR(duard,
"data = uard(handle)\n"
"\n"
"Return the contents of the EEPROM user area.\n");
static PyObject *uawr(PyObject *self, PyObject *args) {
FT_HANDLE *hp;
PyObject *ho;
FT_STATUS rc;
DWORD sz;
char *s;
int l;
if (!PyArg_ParseTuple(args, "Os#", &ho, &s, &l))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_EE_UASize(*hp, &sz)) != FT_OK) {
fterr(rc);
return NULL;
}
if (l > sz) {
PyErr_SetString(PyExc_ValueError, "UA data too long to write");
return NULL;
}
if ((rc = FT_EE_UAWrite(*hp, (unsigned char *) s, l)) != FT_OK) {
fterr(rc);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
PyDoc_STRVAR(duawr,
"uawr(handle, data)\n"
"\n"
"Write data to the EEPROM user area.\n");
static PyObject *bits(PyObject *self, PyObject *args) {
FT_HANDLE *hp;
PyObject *ho;
FT_STATUS rc;
unsigned char c;
if (!PyArg_ParseTuple(args, "O", &ho))
return NULL;
if ((hp = get(ho)) == NULL)
return NULL;
if ((rc = FT_GetBitMode(*hp, &c)) != FT_OK) {
fterr(rc);
return NULL;
}
return PyInt_FromLong(c);
}
PyDoc_STRVAR(dbits,
"value = bits(handle)\n"
"\n"
"Return the instantaneous bit values\n"
"when in a bitbang mode\n");
static PyMethodDef methods[] = {
{ "open", (PyCFunction) ftopen, METH_VARARGS, dopen },
{ "reset", (PyCFunction) ftreset, METH_VARARGS, dreset },
{ "flow", (PyCFunction) ftflow, METH_VARARGS, dflow },
{ "speed", (PyCFunction) ftspeed, METH_VARARGS, dspeed },
{ "dfmt", (PyCFunction) ftdfmt, METH_VARARGS, ddfmt },
{ "mode", (PyCFunction) ftmode, METH_VARARGS, dmode },
{ "write", (PyCFunction) ftwrite, METH_VARARGS, dwrite },
{ "read", (PyCFunction) ftread, METH_VARARGS, dread },
{ "modem", (PyCFunction) ftmodem, METH_VARARGS, dmodem },
{ "purge", (PyCFunction) ftpurge, METH_VARARGS, dpurge },
{ "dtr", (PyCFunction) ftdtr, METH_VARARGS, ddtr },
{ "rts", (PyCFunction) ftrts, METH_VARARGS, drts },
{ "brk", (PyCFunction) ftbrk, METH_VARARGS, dbrk },
{ "inq", (PyCFunction) ftinq, METH_VARARGS, dinq },
{ "timeo", (PyCFunction) fttimeo, METH_VARARGS, dtimeo },
{ "devs", (PyCFunction) devs, METH_NOARGS, ddevs },
{ "info", (PyCFunction) info, METH_VARARGS, dinfo },
{ "prog", (PyCFunction) prog, METH_VARARGS, dprog },
{ "uasz", (PyCFunction) uasz, METH_VARARGS, duasz },
{ "uard", (PyCFunction) uard, METH_VARARGS, duard },
{ "uawr", (PyCFunction) uawr, METH_VARARGS, duawr },
{ "bits", (PyCFunction) bits, METH_VARARGS, dbits },
{ NULL, NULL },
};
PyDoc_STRVAR(docs,
"See the individual function docs\n"
"and the D2XX programmer's guide\n"
"for details\n");
PyMODINIT_FUNC
init_d2xx(void) {
PyObject *m;
if ((m = Py_InitModule3("_d2xx", methods, docs)) == NULL)
return;
/*** constants from ftd2xx.h */
#define K(s) if (PyModule_AddIntConstant(m, #s, s)) return
K(FT_OK);
K(FT_INVALID_HANDLE);
K(FT_DEVICE_NOT_FOUND);
K(FT_DEVICE_NOT_OPENED);
K(FT_IO_ERROR);
K(FT_INSUFFICIENT_RESOURCES);
K(FT_INVALID_PARAMETER);
K(FT_INVALID_BAUD_RATE);
K(FT_DEVICE_NOT_OPENED_FOR_ERASE);
K(FT_DEVICE_NOT_OPENED_FOR_WRITE);
K(FT_FAILED_TO_WRITE_DEVICE);
K(FT_EEPROM_READ_FAILED);
K(FT_EEPROM_WRITE_FAILED);
K(FT_EEPROM_ERASE_FAILED);
K(FT_EEPROM_NOT_PRESENT);
K(FT_EEPROM_NOT_PROGRAMMED);
K(FT_INVALID_ARGS);
K(FT_NOT_SUPPORTED);
K(FT_OTHER_ERROR);
K(FT_DEVICE_LIST_NOT_READY);
K(FT_OPEN_BY_SERIAL_NUMBER);
K(FT_OPEN_BY_DESCRIPTION);
K(FT_OPEN_BY_LOCATION);
K(FT_LIST_NUMBER_ONLY);
K(FT_LIST_BY_INDEX);
K(FT_LIST_ALL);
K(FT_LIST_MASK);
K(FT_BAUD_300);
K(FT_BAUD_600);
K(FT_BAUD_1200);
K(FT_BAUD_2400);
K(FT_BAUD_4800);
K(FT_BAUD_9600);
K(FT_BAUD_14400);
K(FT_BAUD_19200);
K(FT_BAUD_38400);
K(FT_BAUD_57600);
K(FT_BAUD_115200);
K(FT_BAUD_230400);
K(FT_BAUD_460800);
K(FT_BAUD_921600);
K(FT_BITS_8);
K(FT_BITS_7);
K(FT_BITS_6);
K(FT_BITS_5);
K(FT_STOP_BITS_1);
K(FT_STOP_BITS_1_5);
K(FT_STOP_BITS_2);
K(FT_PARITY_NONE);
K(FT_PARITY_ODD);
K(FT_PARITY_EVEN);
K(FT_PARITY_MARK);
K(FT_PARITY_SPACE);
K(FT_FLOW_NONE);
K(FT_FLOW_RTS_CTS);
K(FT_FLOW_DTR_DSR);
K(FT_FLOW_XON_XOFF);
K(FT_PURGE_RX);
K(FT_PURGE_TX);
K(FT_EVENT_RXCHAR);
K(FT_EVENT_MODEM_STATUS);
K(FT_DEFAULT_RX_TIMEOUT);
K(FT_DEFAULT_TX_TIMEOUT);
K(FT_DEVICE_BM);
K(FT_DEVICE_AM);
K(FT_DEVICE_100AX);
K(FT_DEVICE_UNKNOWN);
K(FT_DEVICE_2232C);
K(FT_DEVICE_232R);
/*** constants from the programmer's guide */
if (PyModule_AddIntConstant(m, "FT_MODE_UART", 0x00)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_ASYNC", 0x01)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_MPSSE", 0x02)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_SYNC", 0x04)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_MHBEM", 0x08)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_FOSM", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_MODE_CBUS", 0x20)) return;
/*** DBn versions */
if (PyModule_AddIntConstant(m, "FT_BANG_DB0_OUTPUT", 0x01)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB1_OUTPUT", 0x02)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB2_OUTPUT", 0x04)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB3_OUTPUT", 0x08)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB4_OUTPUT", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB5_OUTPUT", 0x20)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB6_OUTPUT", 0x40)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DB7_OUTPUT", 0x80)) return;
/*** Alt names for FT232R */
if (PyModule_AddIntConstant(m, "FT_BANG_TXD_OUTPUT", 0x01)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RXD_OUTPUT", 0x02)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RTS_OUTPUT", 0x04)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CTS_OUTPUT", 0x08)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DTR_OUTPUT", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DSR_OUTPUT", 0x20)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DCD_OUTPUT", 0x40)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RI_OUTPUT", 0x80)) return;
/*** bitmasks for write() */
if (PyModule_AddIntConstant(m, "FT_BANG_TXD_HIGH", 0x01)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RXD_HIGH", 0x02)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RTS_HIGH", 0x04)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CTS_HIGH", 0x08)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DTR_HIGH", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DSR_HIGH", 0x20)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_DCD_HIGH", 0x40)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_RI_HIGH", 0x80)) return;
/*** CBUS defs */
if (PyModule_AddIntConstant(m, "FT_BANG_CB0_OUTPUT", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB1_OUTPUT", 0x20)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB2_OUTPUT", 0x40)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB3_OUTPUT", 0x80)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB0_HIGH", 0x01)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB1_HIGH", 0x02)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB2_HIGH", 0x04)) return;
if (PyModule_AddIntConstant(m, "FT_BANG_CB3_HIGH", 0x08)) return;
/*** modem status line values */
if (PyModule_AddIntConstant(m, "FT_MODEM_CTS", 0x10)) return;
if (PyModule_AddIntConstant(m, "FT_MODEM_DSR", 0x20)) return;
if (PyModule_AddIntConstant(m, "FT_MODEM_RI", 0x40)) return;
if (PyModule_AddIntConstant(m, "FT_MODEM_DCD", 0x80)) return;
}
/*** EOF d2xx.c */
|
tinyos-io/tinyos-3.x-contrib | rincon/apps/BlackbookBridge/BFileWriteBridge/BFileWrite.h | <gh_stars>1-10
/*
* Copyright (c) 2005-2006 Rincon Research 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 Rincon Research 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
*/
/**
* Automatically generated header file for BFileWrite
*/
#ifndef BFILEWRITE_H
#define BFILEWRITE_H
#include "message.h"
#define BFILEWRITE_BYTE_ARRAY_LENGTH (TOSH_DATA_LENGTH-9)
typedef nx_struct BFileWriteMsg {
nx_uint8_t bool0;
nx_uint8_t short0;
nx_uint8_t short1;
nx_uint16_t int0;
nx_uint32_t long0;
nx_uint8_t byteArray[BFILEWRITE_BYTE_ARRAY_LENGTH];
} BFileWriteMsg;
enum {
BFILEWRITE_CMD_OPEN = 0,
BFILEWRITE_REPLY_OPEN = 1,
BFILEWRITE_CMD_ISOPEN = 2,
BFILEWRITE_REPLY_ISOPEN = 3,
BFILEWRITE_CMD_CLOSE = 4,
BFILEWRITE_REPLY_CLOSE = 5,
BFILEWRITE_CMD_SAVE = 6,
BFILEWRITE_REPLY_SAVE = 7,
BFILEWRITE_CMD_APPEND = 8,
BFILEWRITE_REPLY_APPEND = 9,
BFILEWRITE_CMD_GETREMAINING = 10,
BFILEWRITE_REPLY_GETREMAINING = 11,
BFILEWRITE_EVENT_OPENED = 12,
BFILEWRITE_EVENT_CLOSED = 13,
BFILEWRITE_EVENT_SAVED = 14,
BFILEWRITE_EVENT_APPENDED = 15,
};
enum {
AM_BFILEWRITEMSG = 0xB6,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/sensinode/tos/platforms/micro4/hpl1wire.h | typedef uint8_t b1w_reg[8];
|
tinyos-io/tinyos-3.x-contrib | ethz/snpk/apps/tests/DSNTest/DSNTest.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef DSNTEST_H
#define DSNTEST_H
enum {
TIMER_TIMEOUT_MILLI = 5000,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | uob/tossdr/ucla/gnuradio-802.15.4-demodulation/src/lib/ucla_cc1k_correlator_cb.h | /* -*- c++ -*- */
/*
* Copyright 2004 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef INCLUDED_UCLA_CC1K_CORRELATOR_CB_H
#define INCLUDED_UCLA_CC1K_CORRELATOR_CB_H
#include <gr_block.h>
#include <assert.h>
//#define DEBUG_UCLA_CC1K_CORRELATOR
class ucla_cc1k_correlator_cb;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef boost::shared_ptr<ucla_cc1k_correlator_cb> ucla_cc1k_correlator_cb_sptr;
/*!
* \brief Return a shared_ptr to a new instance of ucla_cc1k_correlator_cb.
*
* To avoid accidental use of raw pointers, ucla_cc1k_correlator_cb's
* constructor is private. ucla_make_cc1k_correlator_cb is the public
* interface for creating new instances.
*/
ucla_cc1k_correlator_cb_sptr ucla_make_cc1k_correlator_cb (int payload_bytesize, unsigned char sync_byte, unsigned char nsync_byte, unsigned char manchester);
/*!
* \brief implements the cc1k radio chip.
* \ingroup block
*
* \sa ucla_cc1k_correlator_cb for a version that subclasses gr_sync_block.
*/
class ucla_cc1k_correlator_cb : public gr_block
{
private:
static const int OVERSAMPLE = 8;
enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
int d_payload_bytesize;
unsigned char d_sync_byte; // syncronisation byte
unsigned char d_nsync_byte; // indicates end of sync
unsigned char d_manchester; // 0: manchester off, 1: manchester on
state_t d_state;
unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
unsigned int d_transition_osi; // first index where Hamming dist < thresh
unsigned int d_center_osi; // center of bit
unsigned long long int d_shift_reg[OVERSAMPLE];
int d_bblen; // length of bitbuf
float *d_bitbuf; // demodulated bits
int d_bbi; // bitbuf index
static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
static const unsigned long long CC1K_SYNC = 0x9999999999999999ULL;
static const int CC1K_BITS_PER_BYTE = 8;
static const int CC1K_SYNC_OVERHEAD = sizeof(CC1K_SYNC);
static const int CC1K_PAYLOAD_OVERHEAD = 0; // 0 byte overhead
static const int CC1K_TAIL_PAD = 1; // one byte trailing padding
static const int CC1K_OVERHEAD = CC1K_SYNC_OVERHEAD + CC1K_PAYLOAD_OVERHEAD + CC1K_TAIL_PAD;
static const int THRESHOLD = 3;
int d_avbi;
float d_avgbuf[AVG_PERIOD];
float d_avg;
float d_accum;
#ifdef DEBUG_UCLA_CC1K_CORRELATOR
FILE *d_debug_fp; // binary log file
#endif
// The friend declaration allows howto_make_square_ff to
// access the private constructor.
friend ucla_cc1k_correlator_cb_sptr ucla_make_cc1k_correlator_cb (int payload_bytesize,
unsigned char sync_byte,
unsigned char nsync_byte,
unsigned char manchester);
ucla_cc1k_correlator_cb (int payload_bytesize,
unsigned char sync_byte,
unsigned char nsync_byte,
unsigned char manchester); // private constructor
inline int slice (float x)
{
return x >= d_avg ? 1 : 0;
}
void update_avg(float x);
void enter_locked ();
void enter_under_threshold ();
void enter_looking ();
static int add_index (int a, int b)
{
int t = a + b;
if (t >= OVERSAMPLE)
t -= OVERSAMPLE;
assert (t >= 0 && t < OVERSAMPLE);
return t;
}
static int sub_index (int a, int b)
{
int t = a - b;
if (t < 0)
t += OVERSAMPLE;
assert (t >= 0 && t < OVERSAMPLE);
return t;
}
public:
~ucla_cc1k_correlator_cb (); // public destructor
// Where all the action really happens
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
#endif /* INCLUDED_UCLA_CC1K_CORRELATOR_CB_H */
|
tinyos-io/tinyos-3.x-contrib | dexma/tos/chips/msp430X/timer/Msp430Timer.h | //$Id: Msp430Timer.h,v 1.3 2010/04/12 07:53:39 dexma Exp $
/* "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."
*/
//@author <NAME> <<EMAIL>>
#ifndef _H_Msp430Timer_h
#define _H_Msp430Timer_h
enum {
MSP430TIMER_CM_NONE = 0,
MSP430TIMER_CM_RISING = 1,
MSP430TIMER_CM_FALLING = 2,
MSP430TIMER_CM_BOTH = 3,
MSP430TIMER_STOP_MODE = 0,
MSP430TIMER_UP_MODE = 1,
MSP430TIMER_CONTINUOUS_MODE = 2,
MSP430TIMER_UPDOWN_MODE = 3,
MSP430TIMER_TACLK = 0,
MSP430TIMER_TBCLK = 0,
MSP430TIMER_ACLK = 1,
MSP430TIMER_SMCLK = 2,
MSP430TIMER_INCLK = 3,
MSP430TIMER_CLOCKDIV_1 = 0,
MSP430TIMER_CLOCKDIV_2 = 1,
MSP430TIMER_CLOCKDIV_4 = 2,
MSP430TIMER_CLOCKDIV_8 = 3,
};
typedef struct
{
int ccifg : 1; // capture/compare interrupt flag
int cov : 1; // capture overflow flag
int out : 1; // output value
int cci : 1; // capture/compare input value
int ccie : 1; // capture/compare interrupt enable
int outmod : 3; // output mode
int cap : 1; // 1=capture mode, 0=compare mode
int clld : 2; // compare latch load
int scs : 1; // synchronize capture source
int ccis : 2; // capture/compare input select: 0=CCIxA, 1=CCIxB, 2=GND, 3=VCC
int cm : 2; // capture mode: 0=none, 1=rising, 2=falling, 3=both
} msp430_compare_control_t;
typedef struct
{
int taifg : 1; // timer A interrupt flag
int taie : 1; // timer A interrupt enable
int taclr : 1; // timer A clear: resets TAR, .id, and .mc
int _unused0 : 1; // unused
int mc : 2; // mode control: 0=stop, 1=up, 2=continuous, 3=up/down
int id : 2; // input divisor: 0=/1, 1=/2, 2=/4, 3=/8
int tassel : 2; // timer A source select: 0=TxCLK, 1=ACLK, 2=SMCLK, 3=INCLK
int _unused1 : 6; // unused
} msp430_timer_a_control_t;
typedef struct
{
int tbifg : 1; // timer B interrupt flag
int tbie : 1; // timer B interrupt enable
int tbclr : 1; // timer B clear: resets TAR, .id, and .mc
int _unused0 : 1; // unused
int mc : 2; // mode control: 0=stop, 1=up, 2=continuous, 3=up/down
int id : 2; // input divisor: 0=/1, 1=/2, 2=/4, 3=/8
int tbssel : 2; // timer B source select: 0=TxCLK, 1=ACLK, 2=SMCLK, 3=INCLK
int _unused1 : 1; // unused
int cntl : 2; // counter length: 0=16-bit, 1=12-bit, 2=10-bit, 3=8-bit
int tbclgrp : 2; // tbclx group: 0=independent, 1=0/12/34/56, 2=0/123/456, 3=all
int _unused2 : 1; // unused
} msp430_timer_b_control_t;
#endif//_H_Msp430Timer_h
|
tinyos-io/tinyos-3.x-contrib | antlab-polimi/sensors/dpcmSupport/diff_idctfstBlk.h | <gh_stars>1-10
#ifndef _DIFF_IDCTFSTBLK_H
#define _DIFF_IDCTFSTBLK_H
#include <stdio.h>
#include <inttypes.h>
#define CONST_BITS 8
#define PASS1_BITS 2
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
#define DCTSIZE 8
#define FIX_1_082392200 ((int32_t) 277) /* FIX(1.082392200) */
#define FIX_1_414213562 ((int32_t) 362) /* FIX(1.414213562) */
#define FIX_1_847759065 ((int32_t) 473) /* FIX(1.847759065) */
#define FIX_2_613125930 ((int32_t) 669) /* FIX(2.613125930) */
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
#define DESCALE(x,n) RIGHT_SHIFT(x, n)
#define MULTIPLY(var,const) ((int32_t) DESCALE((var) * (const), CONST_BITS))
#define IDESCALE(x,n) ((int32_t) RIGHT_SHIFT((x) + (1 << ((n)-1)), n))
static inline int16_t diff_dequantize(int8_t _val, uint8_t qval, uint8_t quality, uint8_t isDC)
{
int16_t quant = qval*quality;
// int32_t val=(isDC)?(uint8_t)_val:_val;
int32_t val=_val;
// val<<=QUALITY_SHIFT_NEW;
/* if (val>0)
val+=quant>>1;
else
val-=quant>>1;*/
if (quant!=0)
val*=quant;
return val;
}
void diff_idctNew(uint8_t blkIdx_i, uint8_t blkIdx_j, uint16_t numBlks,
int8_t* dct_data, int8_t* out, uint8_t bytesPerPixel,
uint8_t *qtable, uint8_t quality, uint16_t pixelsPerRow)
{
uint16_t blksPerRow = pixelsPerRow>>3;
int8_t *inptr = &dct_data[blksPerRow*blkIdx_j+blkIdx_i];
int8_t *outptr = &out[(pixelsPerRow*(blkIdx_j<<3)+(blkIdx_i<<3))*bytesPerPixel];
int k;
int16_t val;
int32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int32_t tmp10, tmp11, tmp12, tmp13;
int32_t z5, z10, z11, z12, z13;
uint8_t *quantptr;
int32_t *wsptr;
uint8_t ctr;
int32_t workspace[64]; /* buffers data between passes */
int32_t tmpout[8];
/* Pass 1: process columns from input, store into work array. */
quantptr = qtable;
wsptr = workspace;
for (ctr = DCTSIZE; ctr > 0; ctr--) {
tmp0 = diff_dequantize(inptr[numBlks*0], quantptr[DCTSIZE*0], quality,
(ctr==DCTSIZE)?1:0);
tmp1 = diff_dequantize(inptr[numBlks*2], quantptr[DCTSIZE*2], quality,0);
tmp2 = diff_dequantize(inptr[numBlks*4], quantptr[DCTSIZE*4], quality,0);
tmp3 = diff_dequantize(inptr[numBlks*6], quantptr[DCTSIZE*6], quality,0);
tmp10 = tmp0 + tmp2; /* phase 3 */
tmp11 = tmp0 - tmp2;
tmp13 = tmp1 + tmp3; /* phases 5-3 */
tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
tmp0 = tmp10 + tmp13; /* phase 2 */
tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
/* Odd part */
tmp4 = diff_dequantize(inptr[numBlks*1], quantptr[DCTSIZE*1], quality,0);
tmp5 = diff_dequantize(inptr[numBlks*3], quantptr[DCTSIZE*3], quality,0);
tmp6 = diff_dequantize(inptr[numBlks*5], quantptr[DCTSIZE*5], quality,0);
tmp7 = diff_dequantize(inptr[numBlks*7], quantptr[DCTSIZE*7], quality,0);
z13 = tmp6 + tmp5; /* phase 6 */
z10 = tmp6 - tmp5;
z11 = tmp4 + tmp7;
z12 = tmp4 - tmp7;
tmp7 = z11 + z13; /* phase 5 */
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6);
wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6);
wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5);
wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5);
wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4);
wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4);
/* advance pointers to next column */
//inptr++;
inptr+=numBlks<<3;
quantptr++;
wsptr++;
}
/* Pass 2: process rows from work array, store into output array. */
/* Note that we must descale the results by a factor of 8 == 2**3, */
/* and also undo the PASS1_BITS scaling. */
wsptr = workspace;
for (ctr = 0; ctr < DCTSIZE; ctr++) {
/* Even part */
tmp10 = ((int32_t) wsptr[0] + (int32_t) wsptr[4]);
tmp11 = ((int32_t) wsptr[0] - (int32_t) wsptr[4]);
tmp13 = ((int32_t) wsptr[2] + (int32_t) wsptr[6]);
tmp12 = MULTIPLY((int32_t) wsptr[2] - (int32_t) wsptr[6], FIX_1_414213562)
- tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
/* Odd part */
z13 = (int32_t) wsptr[5] + (int32_t) wsptr[3];
z10 = (int32_t) wsptr[5] - (int32_t) wsptr[3];
z11 = (int32_t) wsptr[1] + (int32_t) wsptr[7];
z12 = (int32_t) wsptr[1] - (int32_t) wsptr[7];
tmp7 = z11 + z13; /* phase 5 */
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */
z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */
tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */
tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */
tmp6 = tmp12 - tmp7; /* phase 2 */
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
/* Final output stage: scale down by a factor of 8 and range-limit */
tmpout[0] = IDESCALE(tmp0 + tmp7, PASS1_BITS+4);
tmpout[7] = IDESCALE(tmp0 - tmp7, PASS1_BITS+4);
tmpout[1] = IDESCALE(tmp1 + tmp6, PASS1_BITS+4);
tmpout[6] = IDESCALE(tmp1 - tmp6, PASS1_BITS+4);
tmpout[2] = IDESCALE(tmp2 + tmp5, PASS1_BITS+4);
tmpout[5] = IDESCALE(tmp2 - tmp5, PASS1_BITS+4);
tmpout[4] = IDESCALE(tmp3 + tmp4, PASS1_BITS+4);
tmpout[3] = IDESCALE(tmp3 - tmp4, PASS1_BITS+4);
for (k=0; k<8; k++)
{
val = tmpout[k];
val = (val>127)?127:val;
val = (val<(-128))?(-128):val;
//outptr[k]=val;
outptr[k*bytesPerPixel]=val;
}
wsptr += DCTSIZE; /* advance pointer to next row */
//outptr += pixelsPerRow;
outptr += pixelsPerRow*bytesPerPixel;
}
}
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/tests/unittest/tinyunittest.h | <filename>eon/eon/src/tests/unittest/tinyunittest.h
#ifndef _TINYUNITTEST_H_
#define _TINYUNITTEST_H_
#define __TINY_TEST(COND,COMMENT) \
do { \
if (COND) { \
fprintf(stdout, "@@UNITTEST@@: SUCCESS : " COMMENT "\n"); \
} else { \
fprintf(stdout, "@@UNITTEST@@: FAILED : " __FILE__ " @ %d : " #COND " : " COMMENT "\n", __LINE__); \
} \
}while (0)
#define __TINY_TEST_VAR(COND,COMMENT,VARS) \
do { \
if (COND) { \
fprintf(stdout, "@@UNITTEST@@: SUCCESS : " COMMENT "\n", VARS); \
} else { \
fprintf(stdout, "@@UNITTEST@@: FAILED : " __FILE__ " @ %d : " #COND " : " COMMENT "\n", __LINE__, VARS); \
} \
}while (0)
#define __TINY_TEST_INFO(COND,COMMENT) \
do { \
if (COND) { \
fprintf(stdout, "@@UNITTEST@@: INFO(TRUE) : " __FILE__ " @ %d : " #COND " : " COMMENT "\n", __LINE__); \
} else { \
fprintf(stdout, "@@UNITTEST@@: INFO(FALSE) : " __FILE__ " @ %d : " #COND " : " COMMENT "\n", __LINE__); \
} \
}while (0)
#endif
|
tinyos-io/tinyos-3.x-contrib | gems/ttsp/tinyos/tos/lib/ttsp/TimeSync.h | #ifndef TIMESYNC_H
#define TIMESYNC_H
enum {
TIMESYNC_TABLE_MAX_ENTRIES = 8,
TIMESYNC_TABLE_VALID_ENTRIES_LIMIT = 4,
TIMESYNC_DEFAULT_ROOT_ID = 1,
TIMESYNC_IGNORE_ROOT_MSG = 4,
};
typedef struct SyncPoint {
uint32_t localTime;
int32_t timeOffset;
} SyncPoint_t;
typedef struct TableItem {
SyncPoint_t syncPoint;
int32_t timeError;
bool isEmpty;
} TableItem_t;
#endif |
tinyos-io/tinyos-3.x-contrib | tinyos-programming/SoundLocalizer/Detector/detector.h | #ifndef DETECTOR_H
#define DETECTOR_H
typedef nx_struct coordination_msg {
nx_uint16_t count, sample_at, interval;
} coordination_msg_t;
typedef nx_struct detection_msg {
nx_uint16_t id;
nx_uint32_t time;
/* Debug information */
nx_uint16_t intercept;
nx_uint16_t slope;
nx_uint32_t t0, localDetectTime, localSampleTime;
} detection_msg_t;
enum {
AM_COORDINATION_MSG = 101,
AM_DETECTION_MSG = 102,
BEACON_INTERVAL = 128,
SAMPLE_TIME = 48,
MIN_SAMPLES = SAMPLE_TIME / 2,
VOTING_INTERVAL = 2048,
MICROPHONE_WARMUP = 1200
};
#endif
|
tinyos-io/tinyos-3.x-contrib | tinyos-programming/ReliableSerial/reliableserial.h | /*
* Copyright (c) 2007-2009 Intel Corporation
* All rights reserved.
* This file is distributed under the terms in the attached INTEL-LICENS
* file. If you do not find this file, a copy can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#ifndef RELIABLESERIAL_H
#define RELIABLESERIAL_H
enum { ACK_TIMEOUT = 250,
AM_ACK_MSG = 22,
AM_RELIABLE_MSG = 23 };
typedef nx_struct reliable_msg {
nx_uint8_t cookie;
nx_uint8_t data[];
} reliable_msg_t;
typedef nx_struct ack_msg {
nx_uint8_t cookie;
} ack_msg_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | ucc/PLScheduler/tos/chips/atm128/context_switch.h | #ifndef __context_switch_h__
#define __context_switch_h__
#define GET_SP(sp) {asm volatile("in %A0, __SP_L__\n\t in %B0, __SP_H__\n\t" : "=r" (sp) : );}
#define CONTEXT_SWITCH_PREAMBLE(FROM, TO) \
{ \
asm volatile("in %A0, __SP_L__\n\t in %B0, __SP_H__\n\t" : "=r" (contexts[FROM].sp) : ); \
asm volatile("out __SP_H__, %B0\n\t out __SP_L__, %A0\n\t" :: "r" (stack_addr) ); \
asm volatile("push %A0\n\t push %B0\n\t" :: "r" (preemption_handler) ); \
\
for(idex = 0; idex < 31; idex++) \
asm volatile("push __zero_reg__\n\t" ::); \
asm volatile("in %A0, __SP_L__\n\t in %B0, __SP_H__\n\t" : "=r" (contexts[TO].sp) : ); \
\
asm volatile("out __SP_H__, %B0\n\t out __SP_L__, %A0\n\t" :: "r" (contexts[FROM].sp) ); \
}
/** @brief save the current thread's context to the stack
* Save all the registers
* Save SREG
* Push the stack pointer
*/
#define PUSH_CONTEXT(ID) \
{ \
asm volatile("push r24\n\t in r24, __SREG__\n\t cli\n\t push r24\n\t"); \
asm volatile( \
"push r31\n\t" \
"push r30\n\t" \
"push r29\n\t" \
"push r28\n\t" \
"push r27\n\t" \
"push r26\n\t" \
"push r25\n\t" \
"push r23\n\t" \
"push r22\n\t" \
"push r21\n\t" \
"push r20\n\t" \
"push r19\n\t" \
"push r18\n\t" \
"push r17\n\t" \
"push r16\n\t" \
"push r15\n\t" \
"push r14\n\t" \
"push r13\n\t" \
"push r12\n\t" \
"push r11\n\t" \
"push r10\n\t" \
"push r9\n\t" \
"push r8\n\t" \
"push r7\n\t" \
"push r6\n\t" \
"push r5\n\t" \
"push r4\n\t" \
"push r3\n\t" \
"push r2\n\t" \
); \
asm volatile( \
"in %A0, __SP_L__\n\t in %B0, __SP_H__\n\t" : "=r" (contexts[ID].sp) : ); \
}
/** @brief retrieve a thread and context from the stack
* Restore the stack pointer
* Restore SREG
* Restore the other registers
*/
#define POP_CONTEXT(ID) \
{ \
asm volatile("out __SP_H__, %B0\n\t out __SP_L__, %A0\n\t" :: "r" (contexts[ID].sp)); \
asm volatile( "pop r2\n\t" \
"pop r3\n\t" \
"pop r4\n\t" \
"pop r5\n\t" \
"pop r6\n\t" \
"pop r7\n\t" \
"pop r8\n\t" \
"pop r9\n\t" \
"pop r10\n\t" \
"pop r11\n\t" \
"pop r12\n\t" \
"pop r13\n\t" \
"pop r14\n\t" \
"pop r15\n\t" \
"pop r16\n\t" \
"pop r17\n\t" \
"pop r18\n\t" \
"pop r19\n\t" \
"pop r20\n\t" \
"pop r21\n\t" \
"pop r22\n\t" \
"pop r23\n\t" \
"pop r25\n\t" \
"pop r26\n\t" \
"pop r27\n\t" \
"pop r28\n\t" \
"pop r29\n\t" \
"pop r30\n\t" \
"pop r31\n\t" \
"pop r24\n\t" \
"out __SREG__, r24\n\t" \
"pop r24\n\t" \
); \
}
#define CONTEXT_DIFF 50
#endif
|
tinyos-io/tinyos-3.x-contrib | uni_valencia/ema/Harvester.h | /* Copyright (c) 2007 ETH Zurich.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holders nor the names of
* 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 HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
* OR PROFITS) 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.
*
* For additional information see http://www.btnode.ethz.ch/
*
* $Id: Harvester.h,v 1.1 2013/05/14 08:36:58 santi0 Exp $
*
*/
/**
* @author <NAME>
*/
/* Copyright (c) 2011 Universitat de Valencia.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the copyright holders nor the names of
* 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 HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
* OR PROFITS) 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.
*
* For additional information see http://www.uv.es/varimos/
*
*/
/**
* @author <NAME>
*/
#ifndef HARVESTER_H
#define HARVESTER_H
#include <AM.h>
enum {
AM_HARVESTERSENSOR = 0x93,
INT_SENSOR = 30720UL, //muestras cada 30 segundos
INT_RESET = 675840UL, //11 minutos
NUM_MEDIDAS = 20, //10 minutos -> 20 medidas
INT_SEND_ANTERIOR = 5120UL, //5 segundos
INT_REINICIO_MOTA = 44298240UL, //12 horas y 1 minuto se reinicia la mota si o si
};
typedef nx_struct harvesterSensor {
nx_uint8_t dsn; /* serial number */
nx_uint16_t id; /* Mote id of sending mote. */
nx_uint32_t temperatura; /* raw value of the on-board Sensirion temperature sensor */
nx_uint32_t humedad; /* raw value of the on-board Sensirion humidity sensor */
nx_uint16_t voltaje; /* voltage level */
nx_uint8_t num_medidas;
nx_uint8_t anterior; /* 0 = actual, 1 = anterior*/
nx_am_addr_t padre; /* id of parent node (treerouting) */
nx_uint16_t etx;
} harvester_sensor_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | stanford-sing/apps/RssiSample/NoiseSample.h | /******************************************************************
NoiseSample.h created by <NAME> (<EMAIL>)
******************************************************************/
#ifndef _NOISESAMPLE_H_
#define _NOISESAMPLE_H_
enum
{
ALARM_PERIOD = 32, //i.e. 1KHz
AM_RSSI_SAMPLE_MSG = 6,
BUF_SIZE = 512,
TOTAL_SIZE = 1024,
FLASH_ADDR = 0x00,
};
typedef nx_struct rssi_sample_msg {
nx_uint16_t nodeId;
nx_uint32_t seqNo;
nx_uint8_t rssiVal;
} rssi_sample_msg;
#endif
|
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/camera_cmd/img_stat.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>intelmote2/support/sdk/c/camera_cmd/img_stat.h<gh_stars>1-10
/**
* This file is automatically generated by mig. DO NOT EDIT THIS FILE.
* This file defines the layout of the 'img_stat' message type.
*/
#ifndef IMG_STAT_H
#define IMG_STAT_H
#include <message.h>
enum {
/** The default size of this message type in bytes. */
IMG_STAT_SIZE = 19,
/** The Active Message type associated with this message. */
IMG_STAT_AM_TYPE = 5,
/* Field node_id: type uint16_t, offset (bits) 0, size (bits) 16 */
/** Offset (in bytes) of the field 'node_id' */
IMG_STAT_NODE_ID_OFFSET = 0,
/** Offset (in bits) of the field 'node_id' */
IMG_STAT_NODE_ID_OFFSETBITS = 0,
/** Size (in bytes) of the field 'node_id' */
IMG_STAT_NODE_ID_SIZE = 2,
/** Size (in bits) of the field 'node_id' */
IMG_STAT_NODE_ID_SIZEBITS = 16,
/* Field type: type uint8_t, offset (bits) 16, size (bits) 8 */
/** Offset (in bytes) of the field 'type' */
IMG_STAT_TYPE_OFFSET = 2,
/** Offset (in bits) of the field 'type' */
IMG_STAT_TYPE_OFFSETBITS = 16,
/** Size (in bytes) of the field 'type' */
IMG_STAT_TYPE_SIZE = 1,
/** Size (in bits) of the field 'type' */
IMG_STAT_TYPE_SIZEBITS = 8,
/* Field width: type uint16_t, offset (bits) 24, size (bits) 16 */
/** Offset (in bytes) of the field 'width' */
IMG_STAT_WIDTH_OFFSET = 3,
/** Offset (in bits) of the field 'width' */
IMG_STAT_WIDTH_OFFSETBITS = 24,
/** Size (in bytes) of the field 'width' */
IMG_STAT_WIDTH_SIZE = 2,
/** Size (in bits) of the field 'width' */
IMG_STAT_WIDTH_SIZEBITS = 16,
/* Field height: type uint16_t, offset (bits) 40, size (bits) 16 */
/** Offset (in bytes) of the field 'height' */
IMG_STAT_HEIGHT_OFFSET = 5,
/** Offset (in bits) of the field 'height' */
IMG_STAT_HEIGHT_OFFSETBITS = 40,
/** Size (in bytes) of the field 'height' */
IMG_STAT_HEIGHT_SIZE = 2,
/** Size (in bits) of the field 'height' */
IMG_STAT_HEIGHT_SIZEBITS = 16,
/* Field data_size: type uint32_t, offset (bits) 56, size (bits) 32 */
/** Offset (in bytes) of the field 'data_size' */
IMG_STAT_DATA_SIZE_OFFSET = 7,
/** Offset (in bits) of the field 'data_size' */
IMG_STAT_DATA_SIZE_OFFSETBITS = 56,
/** Size (in bytes) of the field 'data_size' */
IMG_STAT_DATA_SIZE_SIZE = 4,
/** Size (in bits) of the field 'data_size' */
IMG_STAT_DATA_SIZE_SIZEBITS = 32,
/* Field timeAcq: type uint32_t, offset (bits) 88, size (bits) 32 */
/** Offset (in bytes) of the field 'timeAcq' */
IMG_STAT_TIMEACQ_OFFSET = 11,
/** Offset (in bits) of the field 'timeAcq' */
IMG_STAT_TIMEACQ_OFFSETBITS = 88,
/** Size (in bytes) of the field 'timeAcq' */
IMG_STAT_TIMEACQ_SIZE = 4,
/** Size (in bits) of the field 'timeAcq' */
IMG_STAT_TIMEACQ_SIZEBITS = 32,
/* Field timeProc: type uint32_t, offset (bits) 120, size (bits) 32 */
/** Offset (in bytes) of the field 'timeProc' */
IMG_STAT_TIMEPROC_OFFSET = 15,
/** Offset (in bits) of the field 'timeProc' */
IMG_STAT_TIMEPROC_OFFSETBITS = 120,
/** Size (in bytes) of the field 'timeProc' */
IMG_STAT_TIMEPROC_SIZE = 4,
/** Size (in bits) of the field 'timeProc' */
IMG_STAT_TIMEPROC_SIZEBITS = 32,
};
/**
* Return the value of the field 'node_id'
*/
uint16_t img_stat_node_id_get(tmsg_t *msg);
/**
* Set the value of the field 'node_id'
*/
void img_stat_node_id_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'type'
*/
uint8_t img_stat_type_get(tmsg_t *msg);
/**
* Set the value of the field 'type'
*/
void img_stat_type_set(tmsg_t *msg, uint8_t value);
/**
* Return the value of the field 'width'
*/
uint16_t img_stat_width_get(tmsg_t *msg);
/**
* Set the value of the field 'width'
*/
void img_stat_width_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'height'
*/
uint16_t img_stat_height_get(tmsg_t *msg);
/**
* Set the value of the field 'height'
*/
void img_stat_height_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'data_size'
*/
uint32_t img_stat_data_size_get(tmsg_t *msg);
/**
* Set the value of the field 'data_size'
*/
void img_stat_data_size_set(tmsg_t *msg, uint32_t value);
/**
* Return the value of the field 'timeAcq'
*/
uint32_t img_stat_timeAcq_get(tmsg_t *msg);
/**
* Set the value of the field 'timeAcq'
*/
void img_stat_timeAcq_set(tmsg_t *msg, uint32_t value);
/**
* Return the value of the field 'timeProc'
*/
uint32_t img_stat_timeProc_get(tmsg_t *msg);
/**
* Set the value of the field 'timeProc'
*/
void img_stat_timeProc_set(tmsg_t *msg, uint32_t value);
#endif
|
tinyos-io/tinyos-3.x-contrib | uob/tossdr/ucla/gnuradio-802.15.4-demodulation/sos/modules/ping/ping.c | <filename>uob/tossdr/ucla/gnuradio-802.15.4-demodulation/sos/modules/ping/ping.c
/* -*- Mode: C; tab-width:4 -*- */
/* ex: set ts=4 shiftwidth=4 softtabstop=4 cindent: */
/**
* @brief simple module for testing radio
*/
/**
* Module needs to include <module.h>
*/
#include <sys_module.h>
#include <module.h>
#define LED_DEBUG
#include <led_dbg.h>
#ifndef PING_TIMER_INTERVAL
#define PING_TIMER_INTERVAL 256L
#endif
#define PING_TID 0
#define PINGER_ID DFLT_APP_ID0
#define MSG_TEST MOD_MSG_START
/**
* Module can define its own state
*/
typedef struct {
uint8_t pid;
uint8_t seq;
} app_state_t;
/**
* Module state and ID declaration.
* All modules should call the fallowing to macros to help the linker add
* module specific meta data to the resulting binary image. Note that the
* parameters my be different.
*/
/**
* Ping module
*
* @param msg Message being delivered to the module
* @return int8_t SOS status message
*
* Modules implement a module function that acts as a message handler. The
* module function is typically implemented as a switch acting on the message
* type.
*
* All modules should included a handler for MSG_INIT to initialize module
* state, and a handler for MSG_FINAL to release module resources.
*/
static int8_t module(void *start, Message *e);
/**
* This is the only global variable one can have.
*/
static mod_header_t mod_header SOS_MODULE_HEADER = {
.mod_id = DFLT_APP_ID0,
.state_size = sizeof(app_state_t),
.num_timers = 1,
.num_sub_func = 0,
.num_prov_func = 0,
.platform_type = HW_TYPE /* or PLATFORM_ANY */,
.processor_type = MCU_TYPE,
.code_id = ehtons(DFLT_APP_ID0),
.module_handler = module,
};
static int8_t module(void *state, Message *msg)
{
/**
* The module is passed in a void* that contains its state. For easy
* reference it is handy to typecast this variable to be of the
* applications state type. Note that since we are running as a module,
* this state is not accessible in the form of a global or static
* variable.
*/
app_state_t *s = (app_state_t*)state;
/**
* Switch to the correct message handler
*/
switch (msg->type){
/**
* MSG_INIT is used to initialize module state the first time the
* module is used. Many modules set timers at this point, so that
* they will continue to receive periodic (or one shot) timer events.
*/
case MSG_INIT:
{
LED_DBG(LED_YELLOW_TOGGLE);
s->pid = msg->did;
/**
* The timer API takes the following parameters:
* - PID of the module the timer is for
* - Timer ID (used to distinguish multiple timers of different
* ..types on the same host)
* - Type of timer
* - Timer delay in
*/
DEBUG("Ping Start\n");
ker_timer_init(s->pid, PING_TID, TIMER_REPEAT);
ker_timer_start(s->pid, PING_TID, PING_TIMER_INTERVAL);
s->seq = 0;
break;
}
/**
* MSG_FINAL is used to shut modules down. Modules should release all
* resources at this time and take care of any final protocol
* shutdown.
*/
case MSG_FINAL:
{
/**
* Stop the timer
*/
ker_timer_stop(s->pid, PING_TID);
DEBUG("Ping Stop\n");
break;
}
/**
* All timers addressed to this PID, regardless of the timer ID, are of
* type MSG_TIMER_TIMEOUT and handled by this handler. Timers with
* different timer IDs can be further distinguished by testing for the
* type, as demonstrated in the relay module.
*/
case MSG_TIMER_TIMEOUT:
{
MsgParam* params = (MsgParam*)(msg->data);
if (params->byte == PING_TID) {
s->seq++;
DEBUG("Ping Packet\n");
LED_DBG(LED_YELLOW_TOGGLE);
post_net(PINGER_ID, PINGER_ID, MSG_TEST, sizeof(s->seq), &(s->seq), SOS_MSG_HIGH_PRIORITY, BCAST_ADDRESS);
}
break;
}
case MSG_TEST:
{
LED_DBG(LED_GREEN_TOGGLE);
DEBUG("Recv Packet\n");
break;
}
/**
* The default handler is used to catch any messages that the module
* does no know how to handle.
*/
default:
return -EINVAL;
}
/**
* Return SOS_OK for those handlers that have successfully been handled.
*/
return SOS_OK;
}
#ifndef _MODULE_
mod_header_ptr ping_get_header()
{
return sos_get_header_address(mod_header);
}
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/daq/test_setup.c | /**
*
*/
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include "daq_lib.h"
#define DOWNSAMPLE_BY 1
struct config {
FILE *f;
char *filename;
int channel;
daq_gain_t gain;
daq_range_t range;
char *unit;
double multiplier;
double sum;
};
struct config cfg[] = { { 0, "micro4.dumpV", 0, DG_1, DR_UNIPOL10V, "V", 1.0, 0.0 },
{ 0, "micro4.dumpA", 16, DG_100, DR_UNIPOL10V, "mA", 1000.0, 0.0 } };
// { 0, "node1.dumpV", 8, DG_1, DR_UNIPOL10V, "V", 1.0, 0.0 },
// { 0, "node1.dumpA", 24, DG_100, DR_UNIPOL10V, "mA", 1000.0, 0.0 } };
#define NUM_CONFIGS (sizeof(cfg) / sizeof(struct config))
void sigint(int signum)
{
int i;
for (i = 0; i < NUM_CONFIGS; ++i) {
if (cfg[i].f)
fclose(cfg[i].f);
}
exit(0);
}
int main(int argc, char *argv[])
{
daq_card_t daq;
int count = 0;
int i;
int res;
struct sigaction act;
if (argc != 2) {
fprintf(stderr, "Too few arguments\n");
return 1;
}
if (daq_open(argv[1], &daq)) {
perror("Error opening daq device");
return 1;
}
/* Setup signal handler */
act.sa_handler = sigint;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
sigaction(SIGINT, &act, 0);
/* Setup the scan */
if (daq_clear_scan(&daq)) {
perror("Error clearing the scan");
return 1;
}
res = 0;
for (i = 0; i < NUM_CONFIGS; ++i)
res += daq_add_scan(&daq, cfg[i].channel, cfg[i].gain, cfg[i].range);
if (res) {
perror("Error configuring scan");
return 1;
}
/* Open files */
for (i = 0; i < NUM_CONFIGS; ++i) {
cfg[i].f = fopen(cfg[i].filename, "w");
if (!cfg[i].f) {
fprintf(stderr, "Error opening file %s for writing", cfg[i].filename);
return 1;
}
cfg[i].sum = 0.0;
}
if (daq_start_scan(&daq, 0x2000)) {
perror("Error starting scan");
return 1;
}
/* Throw away the first set of data. They are usually wrong */
for (i = 0; i < NUM_CONFIGS; ++i) {
uint16_t sample;
res = daq_get_scan_sample(&daq, &sample);
if (res) {
fprintf(stderr, "Error getting sample. res = %d", res);
exit(1);
}
}
while(1) {
uint16_t sample;
struct timeval tv;
for (i = 0; i < NUM_CONFIGS; ++i) {
res = daq_get_scan_sample(&daq, &sample);
if (res) {
fprintf(stderr, "Error getting sample. res = %d", res);
exit(1);
}
cfg[i].sum += daq_convert_result(&daq, sample, cfg[i].gain, cfg[i].range);
}
count++;
if ((count % DOWNSAMPLE_BY) == 0) {
gettimeofday(&tv, NULL);
for (i = 0; i < NUM_CONFIGS; ++i) {
fprintf(cfg[i].f, "%09li%06li: %01.4f%s\n", tv.tv_sec, tv.tv_usec,
(cfg[i].sum / (double)DOWNSAMPLE_BY) * cfg[i].multiplier, cfg[i].unit);
cfg[i].sum = 0.0;
}
}
if ((count % 100) == 0) {
printf(".");
fflush(stdout);
}
// usleep(500);
}
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/tinynode/GetGPS.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef _GETGPS_H_
#define _GETGPS_H_
#define SNR_THOLD 15
#define SNR_TIMEOUT 20
#define GPS_TIMEOUT 360
#define GPS_IMPROVEMENT_TIMEOUT 20
//#define GPS_TIMEOUT 200
//#define GPS_TIMEOUT 600
//#define GPS_TIMEOUT 30
//#define WETNESS_THRESHOLD 300
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/include/stdlib.h | <reponame>tinyos-io/tinyos-3.x-contrib
/** Dummy header to avoid inclusion of the standard library header **/
#ifndef _STDLIB_H_
#define _STDLIB_H_
/* The memset function in Codewarior doesnt work */
void *memset(void *s, unsigned char c, int n)
{
char *target = (char*)s;
while(n > 0)
{
*target = c;
target++;
n--;
}
return s;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/tos/lib/tossim/EnergyMonitor.h |
#ifndef _ENERGYMONITOR_H_
#define _ENERGYMONITOR_H_
class EnergyMonitor {
public:
EnergyMonitor(int id);
~EnergyMonitor();
double getEnergyStored();
double getEnergyIn();
double getEnergyOut();
double getBatterySize();
double getWaste();
void setEnergyStored(double mJ);
void harvestEnergy(double mJ);
void consumeEnergy(double mJ);
void setBatterySize(double mJ);
protected:
int m_id;
};
#endif
|
tinyos-io/tinyos-3.x-contrib | vu/apps/TestPacketTimeSync/TestPacketTimeSync.h | #ifndef TEST_PACKET_TIMESYNC_H
#define TEST_PACKET_TIMESYNC_H
typedef nx_struct ping_msg {
nx_uint16_t pinger;
nx_uint32_t ping_counter;
nx_uint32_t ping_event_time;
nx_uint32_t prev_ping_counter;
nx_uint8_t prev_ping_tx_timestamp_is_valid;
nx_uint32_t prev_ping_tx_timestamp;
nx_uint32_t mac_timestamp;
} ping_msg_t;
typedef nx_struct pong_msg {
nx_uint16_t ponger;
nx_uint16_t pinger;
nx_uint32_t ping_counter;
nx_uint32_t ping_event_time;
nx_uint8_t ping_rx_timestamp_is_valid;
nx_uint8_t ping_event_time_is_valid;
nx_uint32_t ping_rx_timestamp;
nx_uint32_t mac_timestamp;
} pong_msg_t;
enum {
AM_PING_MSG = 16,
AM_PONG_MSG = 17,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | unlpt/PowerTossim-TelosB/tos/lib/tossim/tossim.c | /*
* "Copyright (c) 2005 Stanford 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 STANFORD 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 STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD 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 STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* Implementation of TOSSIM C++ classes. Generally just directly
* call their C analogues.
*
* @author <NAME>
* @date Nov 22 2005
*/
// $Id: tossim.c,v 1.1 2007/11/11 22:23:09 unlpt Exp $
#include <stdint.h>
#include <tossim.h>
#include <sim_tossim.h>
#include <sim_mote.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <hashtable.h>
#include <mac.c>
#include <radio.c>
#include <packet.c>
//#include <sim_noise.h>
#include <EnergyEstimate.c>
uint16_t TOS_NODE_ID = 1;
Variable::Variable(char* str, char* formatStr, int array, int which) {
name = str;
format = formatStr;
isArray = array;
mote = which;
int sLen = strlen(name);
realName = (char*)malloc(sLen + 1);
memcpy(realName, name, sLen + 1);
realName[sLen] = 0;
for (int i = 0; i < sLen; i++) {
if (realName[i] == '.') {
realName[i] = '$';
}
}
// printf("Creating %s realName: %s format: %s %s\n", name, realName, formatStr, array? "[]":"");
if (sim_mote_get_variable_info(mote, realName, &ptr, &len) == 0) {
data = (char*)malloc(len + 1);
data[len] = 0;
}
else {
printf("Could not find variable %s\n", realName);
data = NULL;
ptr = NULL;
}
printf("Allocated variable %s\n", realName);
}
Variable::~Variable() {
printf("Freeing variable %s\n", realName);
free(data);
free(realName);
}
/* This is the sdbm algorithm, taken from
http://www.cs.yorku.ca/~oz/hash.html -pal */
static unsigned int tossim_hash(void* key) {
char* str = (char*)key;
unsigned int hashVal = 0;
int c;
while ((c = *str++))
hashVal = c + (hashVal << 6) + (hashVal << 16) - hashVal;
return hashVal;
}
static int tossim_hash_eq(void* key1, void* key2) {
return strcmp((char*)key1, (char*)key2) == 0;
}
variable_string_t Variable::getData() {
if (data != NULL && ptr != NULL) {
str.ptr = data;
str.type = format;
str.len = len;
str.isArray = isArray;
// printf("Getting %s %s %s\n", format, isArray? "[]":"", name);
memcpy(data, ptr, len);
}
else {
str.ptr = "<no such variable>";
str.type = "<no such variable>";
str.len = strlen("<no such variable>");
str.isArray = 0;
}
return str;
}
Mote::Mote(nesc_app_t* n) {
app = n;
varTable = create_hashtable(128, tossim_hash, tossim_hash_eq);
}
Mote::~Mote(){}
unsigned long Mote::id() {
return nodeID;
}
long long int Mote::euid() {
return sim_mote_euid(nodeID);
}
void Mote::setEuid(long long int val) {
sim_mote_set_euid(nodeID, val);
}
long long int Mote::bootTime() {
return sim_mote_start_time(nodeID);
}
void Mote::bootAtTime(long long int time) {
sim_mote_set_start_time(nodeID, time);
sim_mote_enqueue_boot_event(nodeID);
}
bool Mote::isOn() {
return sim_mote_is_on(nodeID);
}
void Mote::turnOff() {
sim_mote_turn_off(nodeID);
}
void Mote::turnOn() {
sim_mote_turn_on(nodeID);
}
void Mote::setID(unsigned long val) {
nodeID = val;
}
Variable* Mote::getVariable(char* name) {
char* typeStr = "";
int isArray;
Variable* var;
var = (Variable*)hashtable_search(varTable, name);
if (var == NULL) {
// Could hash this for greater efficiency,
// but that would either require transformation
// in Tossim class or a more complex typemap.
if (app != NULL) {
for (int i = 0; i < app->numVariables; i++) {
if(strcmp(name, app->variableNames[i]) == 0) {
typeStr = app->variableTypes[i];
isArray = app->variableArray[i];
break;
}
}
}
// printf("Getting variable %s of type %s %s\n", name, typeStr, isArray? "[]" : "");
var = new Variable(name, typeStr, isArray, nodeID);
hashtable_insert(varTable, name, var);
}
return var;
}
/*void Mote::addNoiseTraceReading(int val) {
sim_noise_trace_add(id(), (char)val);
}*/
/*void Mote::createNoiseModel() {
sim_noise_create_model(id());
}*/
/*int Mote::generateNoise(int when) {
return (int)sim_noise_generate(id(), when);
}*/
Tossim::Tossim(nesc_app_t* n) {
app = n;
init();
}
Tossim::~Tossim() {
sim_end();
}
void Tossim::init() {
sim_init();
motes = (Mote**)malloc(sizeof(Mote*) * (TOSSIM_MAX_NODES + 1));
memset(motes, 0, sizeof(Mote*) * TOSSIM_MAX_NODES);
}
long long int Tossim::time() {
return sim_time();
}
long long int Tossim::ticksPerSecond() {
return sim_ticks_per_sec();
}
char* Tossim::timeStr() {
sim_print_now(timeBuf, 256);
return timeBuf;
}
void Tossim::setTime(long long int val) {
sim_set_time(val);
}
Mote* Tossim::currentNode() {
return getNode(sim_node());
}
Mote* Tossim::getNode(unsigned long nodeID) {
if (nodeID > TOSSIM_MAX_NODES) {
nodeID = TOSSIM_MAX_NODES;
// log an error, asked for an invalid node
}
else {
if (motes[nodeID] == NULL) {
motes[nodeID] = new Mote(app);
if (nodeID == TOSSIM_MAX_NODES) {
motes[nodeID]->setID(0xffff);
}
else {
motes[nodeID]->setID(nodeID);
}
}
return motes[nodeID];
}
}
void Tossim::setCurrentNode(unsigned long nodeID) {
sim_set_node(nodeID);
}
void Tossim::addChannel(char* channel, FILE* file) {
sim_add_channel(channel, file);
}
bool Tossim::removeChannel(char* channel, FILE* file) {
return sim_remove_channel(channel, file);
}
void Tossim::randomSeed(int seed) {
return sim_random_seed(seed);
}
bool Tossim::runNextEvent() {
return sim_run_next_event();
}
MAC* Tossim::mac() {
return new MAC();
}
Radio* Tossim::radio() {
return new Radio();
}
Packet* Tossim::newPacket() {
return new Packet();
}
EnergyEstimator* Tossim::newEnergyEstimator() {
return new EnergyEstimator();
}
}
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinyos2/MarkovAlloc.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>eon/eon/src/runtime/tinyos2/MarkovAlloc.h<gh_stars>1-10
#ifndef MARKOV_ALLOC_H_INCLUDED
#define MARKOV_ALLOC_H_INCLUDED
#define HEAPSIZE 2048
#endif
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/powercurses/powercurses.c | #include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <strings.h>
enum batterystatus { GOODBATTERY = 1, MIDBATTERY, LOWBATTERY };
struct mote_state {
float battery_state;
int mote_num;
WINDOW *mote;
};
#define STARTX 1
#define STARTY 1
#define HEIGHT 3
#define WIDTH 32
WINDOW *create_info(int,int,int,int);
struct mote_state *create_newwin(int,int,int,int,int,int);
void update_win(struct mote_state *, float);
void update_info(WINDOW *, float);
extern char *strarg( const char *, const char *, size_t );
int main (int argc, char **argv)
{
/*
* This is actually ugly, we are going to move that static allocation in a dinamic one based on
* the number of motes...
*/
struct mote_state *win[100];
int ch;
int i = 0;
int num_motes = 0;
WINDOW *info_win;
char inputline[255];
if ( argc != 2 )
{
fprintf(stderr, "Usage : %s numberofmotes\n");
exit(EXIT_FAILURE);
}
num_motes = atoi(argv[1]);
num_motes++;
initscr();
cbreak();
if(has_colors() == FALSE)
{ endwin();
printf("Your terminal does not support color\n");
exit(1);
}
start_color();
init_pair(GOODBATTERY, COLOR_WHITE, COLOR_BLACK);
init_pair(MIDBATTERY, COLOR_GREEN, COLOR_BLACK);
init_pair(LOWBATTERY, COLOR_RED, COLOR_BLACK);
keypad(stdscr, TRUE);
refresh();
info_win = create_info(4,38,20,28 * 3);
for ( i = 0 ; i < num_motes; i++ ) {
win[i] = create_newwin(i,HEIGHT,WIDTH,1,1,num_motes);
}
bzero(inputline, 255);
while ( fgets(inputline, 255, stdin) != NULL )
{
if ( strncmp(strarg(inputline, ",", 1), "POWERCURSES", 11) )
continue;
update_info(info_win, atof(strarg(inputline, ",",2)));
int mote_num = atoi(strarg(inputline,",",3));
update_win(win[mote_num], atof(strarg(inputline, ",",4)));
bzero(inputline, 255);
}
while (getchar());
endwin();
return EXIT_SUCCESS;
}
struct mote_state *create_newwin(int mote, int height, int width, int starty, int startx, int num_motes)
{
struct mote_state *dest;
WINDOW *local_win;
int i = 0;
dest = malloc(sizeof *dest);
dest->mote_num = mote;
dest->battery_state = 100;
if ( mote < num_motes/2 )
local_win = newwin(height, width, starty + 3 * mote, startx);
else
local_win = newwin(height, width, starty + 3 * (mote - num_motes/2), startx + 40);
dest->mote = local_win;
return dest;
}
void update_win(struct mote_state *m, float batstate)
{
WINDOW *local_win = m->mote;
int i = 0;
m->battery_state = batstate;
box(local_win, 0, 0);
wattron(local_win, COLOR_PAIR(GOODBATTERY));
mvwprintw(local_win,STARTY, STARTX + 1, "MOTE : %d ", m->mote_num);
wattroff(local_win, COLOR_PAIR(GOODBATTERY));
wrefresh(local_win);
if ( m->battery_state/10 > 5 ) {
for ( i = 0; i < m->battery_state/10; i++ )
waddch(local_win, ACS_BLOCK | COLOR_PAIR(MIDBATTERY));
} else {
for ( i = 0; i < m->battery_state/10; i++ )
waddch(local_win, ACS_BLOCK | COLOR_PAIR(LOWBATTERY));
}
wprintw(local_win, " %.2f %", m->battery_state);
wrefresh(local_win);
}
WINDOW *create_info(int height, int width, int starty, int startx)
{
WINDOW *local_win;
int i = 0;
local_win = newwin(height, width, starty , startx );
return local_win;
}
void update_info(WINDOW *local_win, float time)
{
box(local_win, 0 , 0);
wrefresh(local_win);
wattron(local_win, COLOR_PAIR(GOODBATTERY));
mvwprintw(local_win,STARTY, STARTX+1, "Simulation time : %f secs", time);
// mvwprintw(local_win,STARTY+1, STARTX+1, "Program running...");
wattroff(local_win, COLOR_PAIR(GOODBATTERY));
wrefresh(local_win);
}
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/mica2dot/GetGPS.h | <filename>eon/apps/turtle_snapper/impl/mica2dot/GetGPS.h<gh_stars>1-10
#ifndef _GETGPS_H_
#define _GETGPS_H_
#define GPS_TIMEOUT 360
//#define GPS_TIMEOUT 600
//#define GPS_TIMEOUT 30
#define WETNESS_THRESHOLD 200
#endif
|
tinyos-io/tinyos-3.x-contrib | tinybt/tos/platforms/btnode3/chips/sd/SD.h | <filename>tinybt/tos/platforms/btnode3/chips/sd/SD.h
/* ***********************************************************
* THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
* REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
* INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
* COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
* TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
* POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
* INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
* YOUR USE OF THE PROGRAM.
*
* IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
* CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
* THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
* OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
* EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
* REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
* OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
* USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
* AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
* YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
* (U.S.$500).
*
* Unless otherwise stated, the Program written and copyrighted
* by Texas Instruments is distributed as "freeware". You may,
* only under TI's copyright in the Program, use and modify the
* Program without any charge or restriction. You may
* distribute to third parties, provided that you transfer a
* copy of this license to the third party and the third party
* agrees to these terms by its first use of the Program. You
* must reproduce the copyright notice and any other legend of
* ownership on each copy or partial copy, of the Program.
*
* You acknowledge and agree that the Program contains
* copyrighted material, trade secrets and other TI proprietary
* information and is protected by copyright laws,
* international copyright treaties, and trade secret laws, as
* well as other intellectual property laws. To protect TI's
* rights in the Program, you agree not to decompile, reverse
* engineer, disassemble or otherwise translate any object code
* versions of the Program to a human-readable form. You agree
* that in no event will you alter, remove or destroy any
* copyright notice included in the Program. TI reserves all
* rights not specifically granted under this license. Except
* as specifically provided herein, nothing in this agreement
* shall be construed as conferring by implication, estoppel,
* or otherwise, upon you, any license or other right under any
* TI patents, copyrights or trade secrets.
*
* You may not use the Program in non-TI devices.
* ********************************************************* */
/*
* Copyright (c) 2006, Intel 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 Intel 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 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.
*
* copied and edited from Texas Instruments sample code
*
* @author <NAME>
* @date May 2006
*/
#ifndef SD_H
#define SD_H
#define SD_START_DATA_BLOCK_TOKEN 0xfe // Data token start byte, Start Single Block Read
#define SD_COMMAND_LENGTH 6
typedef uint8_t sderror_t;
#define SD_SUCCESS 0x00
#define SD_BLOCK_SET_ERROR 0x01
#define SD_RESPONSE_ERROR 0x02
#define SD_DATA_TOKEN_ERROR 0x03
#define SD_INIT_ERROR 0x04
#define SD_CRC_ERROR 0x10
#define SD_WRITE_ERROR 0x11
#define SD_OTHER_ERROR 0x12
#define SD_NOCARD_ERROR 0x13
#define SD_SIGNATURE_ERROR 0x14
#define SD_TIMEOUT_ERROR 0xFF
#define SD_GO_IDLE_STATE 0x40 //CMD0
#define SD_SEND_OP_COND 0x41 //CMD1
#define SD_SEND_IF_COND 0x48 //CMD8
#define SD_SEND_CSD 0x49 //CMD9
#define SD_SEND_CID 0x4a //CMD10
#define SD_STOP_TRANSMISSION 0x4c //CMD12
#define SD_SEND_STATUS 0x4d //CMD13
#define SD_SET_BLOCKLEN 0x50 //CMD16 Set block length for next read/write
#define SD_READ_SINGLE_BLOCK 0x51 //CMD17 Read block from memory
#define SD_READ_MULTIPLE_BLOCK 0x52 //CMD18
#define SD_CMD_WRITEBLOCK 0x54 //CMD20 Write block to memory
#define SD_WRITE_BLOCK 0x58 //CMD24
#define SD_WRITE_MULTIPLE_BLOCK 0x59 //CMD25
#define SD_PROGRAM_CSD 0x5b //CMD27 PROGRAM_CSD
#define SD_SET_WRITE_PROT 0x5c //CMD28
#define SD_CLR_WRITE_PROT 0x5d //CMD29
#define SD_SEND_WRITE_PROT 0x5e //CMD30
#define SD_TAG_SECTOR_START 0x60 //CMD32
#define SD_TAG_SECTOR_END 0x61 //CMD33
#define SD_UNTAG_SECTOR 0x62 //CMD34
#define SD_TAG_EREASE_GROUP_START 0x63 //CMD35
#define SD_TAG_EREASE_GROUP_END 0x64 //CMD36
#define SD_UNTAG_EREASE_GROUP 0x65 //CMD37
#define SD_EREASE 0x66 //CMD38
#define SD_LOCK_UNLOCK 0x6a //CMD42
#define SD_ACMD41_SEND_OP_COND 0x69 //ACMD41
#define SD_APP_CMD 0x77 //CMD55
#define SD_READ_OCR 0x7a //CMD58
#define SD_CRC_ON_OFF 0x7b //CMD59
#define SD_ZERO_ARG_CRC 0x95 //CRC for zero argument command
#define SD_SEND_IF_COND_CRC 0x87 //CRC for CMD_IF_COND
#define SD_SEND_IF_COND_ARG 0x000001aa //Arg for checking Voltage
#define SD_BLANK_BYTE 0xFF //Blank Byte
#define SD_ZEROES 0x00 //Zeroes
#define SD_BLANK_CRC 0x01 //Blank CRC with stop bit
#define SD_TEST_BYTE 0xaa //Test Byte shows up asw 10101010 on scope
#define SD_RESPONSE_READY 0x00
#define SD_RESPONSE_IDLE 0x00
#define SD_RESPONSE_ERASE 0x01
#define SD_RESPONSE_ILLEGAL 0x02
#define SD_RESPONSE_CRC 0x03
#define SD_RESPONSE_SEQUENCE 0x04
#define SD_RESPONSE_ADDRESS 0x05
#define SD_RESPONSE_PARAMETER 0x06
#define SD_RESPONSE_START_BIT 0x07
#define SD_RESPONSE_R1 1
#define SD_RESPONSE_R2 2
#define SD_RESPONSE_R3 5
#define SD_RESPONSE_R7 5
#define SD_DATA_ACK 0x01
#define SD_DATA_ACK_MASK 0x11
#define SD_DATA_ACK_CHKBITS 0x1F
#define SD_DATA_ACCEPTED 0x05
#define SD_TYPE_MMC 0
#define SD_TYPE_SD1 1
#define SD_TYPE_SD2 2
typedef struct sd_command_t {
uint8_t cmd;
uint32_t arg;
uint8_t crc;
} __attribute__ ((packed)) sd_command_t;
typedef struct sd_packet_t {
uint8_t payload[SD_COMMAND_LENGTH];
} __attribute__ ((packed)) sd_packet_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/mcs51/tos/chips/cc2430/dma/dma.h | <filename>diku/mcs51/tos/chips/cc2430/dma/dma.h
/*
* Copyright (c) 2007 University of Copenhagen
* 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 University of Copenhagen 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 UNIVERSITY
* OF COPENHAGEN 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.
*/
/******************************************************************************
************************** DMA structures / macros *************************
******************************************************************************/
// The macros and structs in this section simplify setup and usage of DMA.
//******************************************************************************
#define DMA_CHANNEL_0 0x01
#define DMA_CHANNEL_1 0x02
#define DMA_CHANNEL_2 0x04
#define DMA_CHANNEL_3 0x08
#define DMA_CHANNEL_4 0x10
#define VLEN_USE_LEN 0x00 // Use LEN for transfer count
#define VLEN_FIXED 0x00 // Use LEN for transfer count
#define VLEN_1_P_VALOFFIRST 0x01 // Transfer the first uint8_t + the number of uint8_ts indicated by the first uint8_t
#define VLEN_VALOFFIRST 0x02 // Transfer the number of uint8_ts indicated by the first uint8_t (starting with the first uint8_t)
#define VLEN_1_P_VALOFFIRST_P_1 0x03 // Transfer the first uint8_t + the number of uint8_ts indicated by the first uint8_t + 1 more uint8_t
#define VLEN_1_P_VALOFFIRST_P_2 0x04 // Transfer the first uint8_t + the number of uint8_ts indicated by the first uint8_t + 2 more uint8_ts
#define WORDSIZE_BYTE 0x00 // Transfer a uint8_t at a time
#define WORDSIZE_WORD 0x01 // Transfer a 16-bit uint16_t at a time
#define TMODE_SINGLE 0x00 // Transfer a single uint8_t/uint16_t after each DMA trigger
#define TMODE_BLOCK 0x01 // Transfer block of data (length len) after each DMA trigger
#define TMODE_SINGLE_REPEATED 0x02 // Transfer single uint8_t/uint16_t (after len transfers, rearm DMA)
#define TMODE_BLOCK_REPEATED 0x03 // Transfer block of data (after len transfers, rearm DMA)
#define DMATRIG_NONE 0 // No trigger, setting DMAREQ.DMAREQx bit starts transfer
#define DMATRIG_PREV 1 // DMA channel is triggered by completion of previous channel
#define DMATRIG_T1_CH0 2 // Timer 1, compare, channel 0
#define DMATRIG_T1_CH1 3 // Timer 1, compare, channel 1
#define DMATRIG_T1_CH2 4 // Timer 1, compare, channel 2
#define DMATRIG_T2_COMP 5 // Timer 2, compare
#define DMATRIG_T2_OVFL 6 // Timer 2, overflow
#define DMATRIG_T3_CH0 7 // Timer 3, compare, channel 0
#define DMATRIG_T3_CH1 8 // Timer 3, compare, channel 1
#define DMATRIG_T4_CH0 9 // Timer 4, compare, channel 0
#define DMATRIG_T4_CH1 10 // Timer 4, compare, channel 1
#define DMATRIG_ST 11 // Sleep Timer compare
#define DMATRIG_IOC_0 12 // Port 0 I/O pin input transition
#define DMATRIG_IOC_1 13 // Port 1 I/O pin input transition
#define DMATRIG_URX0 14 // USART0 RX complete
#define DMATRIG_UTX0 15 // USART0 TX complete
#define DMATRIG_URX1 16 // USART1 RX complete
#define DMATRIG_UTX1 17 // USART1 TX complete
#define DMATRIG_FLASH 18 // Flash data write complete
#define DMATRIG_RADIO 19 // RF packet uint8_t received/transmit
#define DMATRIG_ADC_CHALL 20 // ADC end of a conversion in a sequence, sample ready
#define DMATRIG_ADC_CH0 21 // ADC end of conversion channel 0 in sequence, sample ready
#define DMATRIG_ADC_CH1 22 // ADC end of conversion channel 1 in sequence, sample ready
#define DMATRIG_ADC_CH2 23 // ADC end of conversion channel 2 in sequence, sample ready
#define DMATRIG_ADC_CH3 24 // ADC end of conversion channel 3 in sequence, sample ready
#define DMATRIG_ADC_CH4 25 // ADC end of conversion channel 4 in sequence, sample ready
#define DMATRIG_ADC_CH5 26 // ADC end of conversion channel 5 in sequence, sample ready
#define DMATRIG_ADC_CH6 27 // ADC end of conversion channel 6 in sequence, sample ready
#define DMATRIG_ADC_CH7 28 // ADC end of conversion channel 7 in sequence, sample ready
#define DMATRIG_ENC_DW 29 // AES encryption processor requests download input data
#define DMATRIG_ENC_UP 30 // AES encryption processor requests upload output data
#define SRCINC_0 0x00 // Increment source pointer by 0 uint8_ts/uint16_ts after each transfer
#define SRCINC_1 0x01 // Increment source pointer by 1 uint8_ts/uint16_ts after each transfer
#define SRCINC_2 0x02 // Increment source pointer by 2 uint8_ts/uint16_ts after each transfer
#define SRCINC_M1 0x03 // Decrement source pointer by 1 uint8_ts/uint16_ts after each transfer
#define DESTINC_0 0x00 // Increment destination pointer by 0 uint8_ts/uint16_ts after each transfer
#define DESTINC_1 0x01 // Increment destination pointer by 1 uint8_ts/uint16_ts after each transfer
#define DESTINC_2 0x02 // Increment destination pointer by 2 uint8_ts/uint16_ts after each transfer
#define DESTINC_M1 0x03 // Decrement destination pointer by 1 uint8_ts/uint16_ts after each transfer
#define IRQMASK_DISABLE 0x00 // Disable interrupt generation
#define IRQMASK_ENABLE 0x01 // Enable interrupt generation upon DMA channel done
#define M8_USE_8_BITS 0x00 // Use all 8 bits for transfer count
#define M8_USE_7_BITS 0x01 // Use 7 LSB for transfer count
#define PRI_LOW 0x00 // Low, CPU has priority
#define PRI_GUARANTEED 0x01 // Guaranteed, DMA at least every second try
#define PRI_HIGH 0x02 // High, DMA has priority
#define PRI_ABSOLUTE 0x03 // Highest, DMA has priority. Reserved for DMA port access.
#define SET_WORD(high, low, value) \
do { \
high = (uint8_t) ((uint16_t) value >> 8); \
low = (uint8_t) ((uint16_t) value); \
} while(0)
#define DMA_SET_ADDR_DESC0(a) \
do{ \
DMA0CFGH = (uint8_t)( (uint16_t)a >> 8 );\
DMA0CFGL = (uint8_t)( (uint16_t)a ); \
} while(0)
#define DMA_SET_ADDR_DESC1234(a) \
do{ \
DMA1CFGH = (uint8_t)( (uint16_t)a >> 8 );\
DMA1CFGL = (uint8_t)( (uint16_t)a ); \
} while(0)
#define DMA_ARM_CHANNEL(ch) \
do{ \
DMAARM = ((0x01 << ch) & 0x1F); \
} while(0)
#define DMA_ABORT_CHANNEL(ch) DMAARM = (0x80 | ((0x01 << ch) & 0x1F))
#define DMA_MAN_TRIGGER(ch) DMAREQ = (0x01 << ch)
#define DMA_START_CHANNEL(ch) DMA_MAN_TRIGGER(ch)
// Macro for quickly setting the destination address of a DMA structure
#define SET_DMA_DEST(pDmaDesc, dest) \
do{ \
pDmaDesc->DESTADDRH = (uint8_t) ((uint16_t)dest >> 8);\
pDmaDesc->DESTADDRL = (uint8_t) (uint16_t)dest; \
} while (0);
// Macro for quickly setting the source address of a DMA structure
#define SET_DMA_SOURCE(pDmaDesc, source) \
do{ \
pDmaDesc->SRCADDRH = (uint8_t) ((uint16_t)source >> 8);\
pDmaDesc->SRCADDRL = (uint8_t) (uint16_t)source; \
} while (0)
// Macro for quickly setting the number of uint8_ts to be transferred by the DMA.
// max lenght is 0x1FFF
#define SET_DMA_LENGTH(pDmaDesc, length) \
do{ \
pDmaDesc->LENH = (uint8_t) ((uint16_t)length >> 8);\
pDmaDesc->LENL = (uint8_t) (uint16_t)length; \
} while (0)
// Macro for getting the destination address of a DMA channel
#define GET_DMA_DEST(pDmaDesc) \
( (uint16_t)pDmaDesc->DESTADDRL | ( (uint16_t)pDmaDesc->DESTADDRH << 8 ))
// Macro for getting the source address of a DMA channel
#define GET_DMA_SOURCE(pDmaDesc) \
( (uint16_t)pDmaDesc->SRCADDRL | ( (uint16_t)pDmaDesc->SRCADDRH << 8 ))
|
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/camera_cmd/status.h | <reponame>tinyos-io/tinyos-3.x-contrib
/**
* This file is automatically generated by mig. DO NOT EDIT THIS FILE.
* This file defines the layout of the 'status' message type.
*/
#ifndef STATUS_H
#define STATUS_H
#include <message.h>
enum {
/** The default size of this message type in bytes. */
STATUS_SIZE = 8,
/** The Active Message type associated with this message. */
STATUS_AM_TYPE = 16,
/* Field node_id: type uint16_t, offset (bits) 0, size (bits) 16 */
/** Offset (in bytes) of the field 'node_id' */
STATUS_NODE_ID_OFFSET = 0,
/** Offset (in bits) of the field 'node_id' */
STATUS_NODE_ID_OFFSETBITS = 0,
/** Size (in bytes) of the field 'node_id' */
STATUS_NODE_ID_SIZE = 2,
/** Size (in bits) of the field 'node_id' */
STATUS_NODE_ID_SIZEBITS = 16,
/* Field seqNo: type uint16_t, offset (bits) 16, size (bits) 16 */
/** Offset (in bytes) of the field 'seqNo' */
STATUS_SEQNO_OFFSET = 2,
/** Offset (in bits) of the field 'seqNo' */
STATUS_SEQNO_OFFSETBITS = 16,
/** Size (in bytes) of the field 'seqNo' */
STATUS_SEQNO_SIZE = 2,
/** Size (in bits) of the field 'seqNo' */
STATUS_SEQNO_SIZEBITS = 16,
/* Field parent: type uint16_t, offset (bits) 32, size (bits) 16 */
/** Offset (in bytes) of the field 'parent' */
STATUS_PARENT_OFFSET = 4,
/** Offset (in bits) of the field 'parent' */
STATUS_PARENT_OFFSETBITS = 32,
/** Size (in bytes) of the field 'parent' */
STATUS_PARENT_SIZE = 2,
/** Size (in bits) of the field 'parent' */
STATUS_PARENT_SIZEBITS = 16,
/* Field ETX: type uint16_t, offset (bits) 48, size (bits) 16 */
/** Offset (in bytes) of the field 'ETX' */
STATUS_ETX_OFFSET = 6,
/** Offset (in bits) of the field 'ETX' */
STATUS_ETX_OFFSETBITS = 48,
/** Size (in bytes) of the field 'ETX' */
STATUS_ETX_SIZE = 2,
/** Size (in bits) of the field 'ETX' */
STATUS_ETX_SIZEBITS = 16,
};
/**
* Return the value of the field 'node_id'
*/
uint16_t status_node_id_get(tmsg_t *msg);
/**
* Set the value of the field 'node_id'
*/
void status_node_id_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'seqNo'
*/
uint16_t status_seqNo_get(tmsg_t *msg);
/**
* Set the value of the field 'seqNo'
*/
void status_seqNo_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'parent'
*/
uint16_t status_parent_get(tmsg_t *msg);
/**
* Set the value of the field 'parent'
*/
void status_parent_set(tmsg_t *msg, uint16_t value);
/**
* Return the value of the field 'ETX'
*/
uint16_t status_ETX_get(tmsg_t *msg);
/**
* Set the value of the field 'ETX'
*/
void status_ETX_set(tmsg_t *msg, uint16_t value);
#endif
|
tinyos-io/tinyos-3.x-contrib | ethz/tinynode184/tos/chips/sx1211/sx1211debug.h | //#include "DSN.h"
uint8_t var;
uint16_t lasterr;
void sx1211error(uint8_t loc, uint8_t value_) __attribute__ ((noinline)) {
// this is just to make sure the compiler doesn't optimize
// out calls to this function, since we use it as a gdb breakpoint
atomic var += value_ + loc;
}
void sx1211check(uint8_t loc, error_t err) __attribute__ ((noinline)) {
if (err != SUCCESS) {
atomic lasterr = loc;
sx1211error(loc, err);
//dsnlog("sx1211error %i %i\r",(uint32_t)loc,(uint32_t)err);
}
}
|
tinyos-io/tinyos-3.x-contrib | stanford-lgl/tos/chips/pxa27x/memsetup-pxa.h | <filename>stanford-lgl/tos/chips/pxa27x/memsetup-pxa.h<gh_stars>1-10
#ifndef MEMSETUP_PXA_H
#define MEMSETUP_PXA_H
extern void memsetup();
#endif //TOSH_HARDWARE_H
|
tinyos-io/tinyos-3.x-contrib | eon/tos/lib/tossim/EnergyMonitor.c |
#include "sim_energy.h"
#include "EnergyMonitor.h"
EnergyMonitor::EnergyMonitor(int id) {
sim_energy_init(id);
m_id = id;
}
EnergyMonitor::~EnergyMonitor() {
}
double EnergyMonitor::getEnergyStored()
{
return sim_node_energy(m_id);
}
double EnergyMonitor::getEnergyIn()
{
return sim_node_energy_in(m_id);
}
double EnergyMonitor::getEnergyOut()
{
return sim_node_energy_out(m_id);
}
double EnergyMonitor::getBatterySize()
{
return sim_node_batt_size(m_id);
}
double EnergyMonitor::getWaste()
{
return sim_node_waste(m_id);
}
void EnergyMonitor::setEnergyStored(double mJ)
{
set_sim_node_energy(m_id, mJ);
}
void EnergyMonitor::harvestEnergy(double mJ)
{
sim_harvest_energy(m_id, mJ);
}
void EnergyMonitor::consumeEnergy(double mJ)
{
sim_consume_energy(m_id, mJ);
}
void EnergyMonitor::setBatterySize(double mJ)
{
set_sim_node_batt_size(m_id, mJ);
}
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/chips/hcs08/adc/Hcs08Adc.h | /* Copyright (c) 2007, <NAME> <<EMAIL>>
* 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 University of Copenhagen 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.
*/
/*
@author <NAME> <<EMAIL>>
*/
#ifndef _H_Hcs08ADC_h
#define _H_Hcs08ADC_h
/* Adc channels */
enum
{
Hcs08_ADC_CH0 = 0,
Hcs08_ADC_CH1 = 1,
Hcs08_ADC_CH2 = 2,
Hcs08_ADC_CH3 = 3,
Hcs08_ADC_CH4 = 4,
Hcs08_ADC_CH5 = 5,
Hcs08_ADC_CH6 = 6,
Hcs08_ADC_CH7 = 7,
Hcs08_ADC_VREFH = 0x1E,
Hcs08_ADC_VREFL = 0x1F
};
/* Prescaler values */
enum
{
Hcs08_ADC_PRESCALE_2 = 0x0,
Hcs08_ADC_PRESCALE_4 = 0x1,
Hcs08_ADC_PRESCALE_6 = 0x2,
Hcs08_ADC_PRESCALE_8 = 0x3,
Hcs08_ADC_PRESCALE_10 = 0x4,
Hcs08_ADC_PRESCALE_12 = 0x5,
Hcs08_ADC_PRESCALE_14 = 0x6,
Hcs08_ADC_PRESCALE_16 = 0x7,
Hcs08_ADC_PRESCALE_18 = 0x8,
Hcs08_ADC_PRESCALE_20 = 0x9,
Hcs08_ADC_PRESCALE_22 = 0xA,
Hcs08_ADC_PRESCALE_24 = 0xB,
Hcs08_ADC_PRESCALE_26 = 0xC,
Hcs08_ADC_PRESCALE_28 = 0xD,
Hcs08_ADC_PRESCALE_30 = 0xE,
Hcs08_ADC_PRESCALE_32 = 0xF
};
#define UQ_HCS08ADC_RESOURCE "hcs08adc.resource"
#endif //_H_Hcs08ADC_h |
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/driver/driver_registry.c | /* LIBUSB-WIN32, Generic Windows USB Library
* Copyright (c) 2002-2005 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "libusb_driver.h"
/* missing in mingw's ddk headers */
#ifndef PLUGPLAY_REGKEY_DEVICE
#define PLUGPLAY_REGKEY_DEVICE 1
#endif
#define LIBUSB_REG_SURPRISE_REMOVAL_OK L"SurpriseRemovalOK"
static bool_t reg_get_property(DEVICE_OBJECT *physical_device_object,
int property, char *data, int size);
static bool_t reg_get_property(DEVICE_OBJECT *physical_device_object,
int property, char *data, int size)
{
WCHAR tmp[512];
ULONG ret;
ULONG i;
if(!physical_device_object || !data || !size)
{
return FALSE;
}
memset(data, 0, size);
memset(tmp, 0, sizeof(tmp));
if(NT_SUCCESS(IoGetDeviceProperty(physical_device_object,
property,
sizeof(tmp) - 2,
tmp,
&ret)) && ret)
{
/* convert unicode string to normal character string */
for(i = 0; (i < ret/2) && (i < ((ULONG)size - 1)); i++)
{
data[i] = (char)tmp[i];
}
_strlwr(data);
return TRUE;
}
return FALSE;
}
bool_t reg_get_properties(libusb_device_t *dev)
{
HANDLE key = NULL;
NTSTATUS status;
UNICODE_STRING name;
KEY_VALUE_FULL_INFORMATION *info;
ULONG length;
if(!dev->physical_device_object)
{
return FALSE;
}
/* default settings */
dev->surprise_removal_ok = FALSE;
dev->is_filter = TRUE;
status = IoOpenDeviceRegistryKey(dev->physical_device_object,
PLUGPLAY_REGKEY_DEVICE,
STANDARD_RIGHTS_ALL,
&key);
if(NT_SUCCESS(status))
{
RtlInitUnicodeString(&name, LIBUSB_REG_SURPRISE_REMOVAL_OK);
length = sizeof(KEY_VALUE_FULL_INFORMATION) + name.MaximumLength
+ sizeof(ULONG);
info = ExAllocatePool(NonPagedPool, length);
if(info)
{
memset(info, 0, length);
status = ZwQueryValueKey(key, &name, KeyValueFullInformation,
info, length, &length);
if(NT_SUCCESS(status) && (info->Type == REG_DWORD))
{
ULONG val = *((ULONG *)(((char *)info) + info->DataOffset));
dev->surprise_removal_ok = val ? TRUE : FALSE;
dev->is_filter = FALSE;
}
ExFreePool(info);
}
ZwClose(key);
}
return TRUE;
}
bool_t reg_get_hardware_id(DEVICE_OBJECT *physical_device_object,
char *data, int size)
{
if(!physical_device_object || !data || !size)
{
return FALSE;
}
return reg_get_property(physical_device_object, DevicePropertyHardwareID,
data, size);
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/compression/huffman/huffman_decomp.c | #ifndef __AVR_ATmega128__
#define prog_uint8_t uint8_t
#endif
#define DECOMPRESSOR
#include <inttypes.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../buffer.h"
#include CODESET
uint8_t membuffer[MEMBUFSIZE];
uint8_t *data;
uint8_t read_count;
uint16_t buffer;
static uint8_t read_bits(uint8_t len)
{
uint8_t res;
// Fill the buffer
while (read_count < len) {
buffer <<= 8;
buffer |= *data++;
read_count += 8;
}
res = (buffer >> (read_count - len)) & ((1 << len) - 1);
read_count -= len;
buffer &= (1 << read_count) - 1;
return res;
}
uint16_t bits_left()
{
uint16_t res = MEMBUFSIZE - (data - membuffer); // Amount of unread data;
/*
printf("Length: %d, data: %p, data_start: %p, diff: %d\n",
length, data, data_start, data - data_start);
*/
res *= 8;
res += read_count; // Bits read, but not outputted yet.
// printf("Bits left: %d\n", res);
return res;
}
void fill_buffer()
{
if (fread(membuffer, MEMBUFSIZE, 1, stdin) != 1) {
fprintf(stderr, "Error reading from stdin: %s\n",
strerror(errno));
exit(1);
}
read_count = 0;
buffer = 0;
data = membuffer;
}
int16_t get_sample()
{
struct huffman_node_t *cur_node = huffman_root;
while (cur_node->type == NT_Node) {
uint8_t tmp;
if (bits_left() == 0)
fill_buffer();
tmp = read_bits(1);
// fprintf(stderr, "%d", tmp);
cur_node = tmp ? cur_node->left : cur_node->right;
}
// fprintf(stderr, " = sample with value: %d\n", cur_node->value);
return cur_node->value;
}
int decompress_sample(int16_t *digi_x, int16_t *digi_y,
int16_t *digi_z, uint16_t *analog_x,
uint16_t *analog_y)
{
static int first = 1;
static int16_t last_vals[3];
int i;
if (first) {
fill_buffer();
first = 0;
#ifdef HUFFMAN_DIFFERENCE
for (i = 0; i < 3; i++) {
last_vals[i] = 0;
last_vals[i] |= (uint16_t)read_bits(4) << 8;
last_vals[i] |= read_bits(8);
if (last_vals[i] & 0x0800)
last_vals[i] |= 0xF000;
// fprintf(stderr, "Sample is %d\n", last_vals[i]);
}
*digi_x = last_vals[0];
*digi_y = last_vals[1];
*digi_z = last_vals[2];
return 0;
#endif
}
for (i = 0; i < 3; i++) {
#ifdef HUFFMAN_WHOLE_SYMBOLS
int16_t tmp = get_sample();
#else
int16_t tmp = get_sample() & 0xFF;
tmp |= (get_sample() << 8) & 0xFF00;
#endif
#ifdef HUFFMAN_DIFFERENCE
# ifdef HUFFMAN_WHOLE_SYMBOLS
last_vals[i] = ((last_vals[i] & 0xFFF) + tmp - 4096) & 0xFFF;
if (last_vals[i] & 0x800)
last_vals[i] |= 0xF000;
# else
last_vals[i] += tmp - 4096;
# endif
// fprintf(stderr, "Read sample is %d, last_val is now %d\n",
// tmp, last_vals[i]);
#else
# ifdef HUFFMAN_WHOLE_SYMBOLS
last_vals[i] = tmp - 2048;
# else
last_vals[i] = tmp;
# endif
#endif
}
*digi_x = last_vals[0];
*digi_y = last_vals[1];
*digi_z = last_vals[2];
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | ahhr-ipsn09/apps/HierarchicalRoutingDemo/TrafficStats.h | /*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
* this license. If you do not agree to this license, do not download,
* install, copy or use the software.
*
* Copyright (c) 2006-2008 Vrije Universiteit Amsterdam and
* Development Laboratories (DevLab), Eindhoven, the Netherlands.
* 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, the author, and the following
* disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, the author, and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Vrije Universiteit Amsterdam, nor the name of
* DevLab, nor the names of their 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 VRIJE
* UNIVERSITEIT AMSTERDAM, DEVLAB, OR THEIR 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.
*
* Authors: <NAME>
* CVS id: $Id: TrafficStats.h,v 1.1 2009/11/29 14:36:58 iwanicki Exp $
*/
#ifndef __TRAFFIC_STATS__H__
#define __TRAFFIC_STATS__H__
#include <message.h>
#include <AM.h>
/*
* This file contains data types used for traffic statistics.
*
* @author <NAME> <<EMAIL>>
*/
// *************************** Local structures ***************************
/**
* Statistics for outgoing traffic.
*/
typedef struct {
uint32_t schedMessages; // the number of messages scheduled
// for transmission
uint32_t schedBytes; // the number of bytes scheduled for
// transmission
uint32_t txedMessages; // the number of transmitted messages
uint32_t txedBytes; // the number of transmitted bytes
} traffic_stats_outgoing_stats_t;
/**
* Statistics for incoming traffic.
*/
typedef struct {
uint32_t rxedMessages; // the number of received messages
uint32_t rxedBytes; // the number of received bytes
} traffic_stats_incoming_stats_t;
// ************************** Message structures **************************
#endif //__TRAFFIC_STATS__H__
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/tinynode/mktime.c | <gh_stars>1-10
#ifndef MKTIME_C_INCLUDE
#define MKTIME_C_INCLUDE
#ifdef MKTIME_TEST
#include <stdint.h>
#include <time.h>
#endif
#define YEAR0 1900
#define EPOCH_YR 1970
#define SECS_DAY (24L * 60L * 60L)
#define LEAPYEAR(year) (!((year) % 4) && (((year) % 100) || !((year) % 400)))
#define YEARSIZE(year) (LEAPYEAR(year) ? 366 : 365)
#define TIME_MAX 2147483647L
//int _daylight = 0; // Non-zero if daylight savings time is used
//long _dstbias = 0; // Offset for Daylight Saving Time
/*const char *_days[] =
{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};*/
/*const char *_days_abbrev[] =
{
"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"
};*/
/*const char *_months[] =
{
"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
};*/
/*const char *_months_abbrev[] =
{
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"
};*/
const int _ytab[2][12] =
{
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
uint32_t my_mktime(uint16_t ayr, uint16_t amo, uint16_t ady, uint16_t ahr, uint16_t amin, uint16_t asec)
{
uint32_t yr = ayr;
uint32_t mo = amo;
uint32_t dy = ady;
uint32_t hr = ahr;
uint32_t min = amin;
uint32_t sec = asec;
int32_t day, year;
int32_t tm_year;
int32_t yday, month;
uint32_t seconds;
int32_t overflow;
int32_t dst;
min += sec / 60;
sec = sec % 60;
hr += min / 60;
min = min % 60;
day = hr / 24;
hr= hr % 24;
yr += mo / 12;
mo = mo % 12;
day += (dy - 1);
while (day < 0)
{
if(--mo < 0)
{
yr--;
mo = 11;
}
day += _ytab[LEAPYEAR(YEAR0 + yr)][mo];
}
while (day >= _ytab[LEAPYEAR(YEAR0 + yr)][mo])
{
day -= _ytab[LEAPYEAR(YEAR0 + yr)][mo];
if (++(mo) == 12)
{
mo = 0;
yr++;
}
}
dy = day + 1;
year = EPOCH_YR;
if (yr < year - YEAR0) return 0;
seconds = 0;
day = 0; // Means days since day 0 now
overflow = 0;
// Assume that when day becomes negative, there will certainly
// be overflow on seconds.
// The check for overflow needs not to be done for leapyears
// divisible by 400.
// The code only works when year (1970) is not a leapyear.
tm_year = yr + YEAR0;
if (TIME_MAX / 365 < tm_year - year) overflow++;
day = (tm_year - year) * 365;
if (TIME_MAX - day < (tm_year - year) / 4 + 1) overflow++;
day += (tm_year - year) / 4 + ((tm_year % 4) && tm_year % 4 < year % 4);
day -= (tm_year - year) / 100 + ((tm_year % 100) && tm_year % 100 < year % 100);
day += (tm_year - year) / 400 + ((tm_year % 400) && tm_year % 400 < year % 400);
yday = month = 0;
while (month < mo)
{
yday += _ytab[LEAPYEAR(tm_year)][month];
month++;
}
yday += (dy - 1);
if (day + yday < 0) overflow++;
day += yday;
//tmbuf->tm_yday = yday;
//tmbuf->tm_wday = (day + 4) % 7; // Day 0 was thursday (4)
seconds = ((hr * 60L) + min) * 60L + sec;
if ((TIME_MAX - seconds) / SECS_DAY < day) overflow++;
seconds += day * SECS_DAY;
// Now adjust according to timezone and daylight saving time
/*if (((_timezone > 0) && (TIME_MAX - _timezone < seconds))
|| ((_timezone < 0) && (seconds < -_timezone)))
overflow++;
seconds += _timezone;
*/
dst = 0;
if (dst > seconds) overflow++; // dst is always non-negative
seconds -= dst;
if (overflow) return 0;
if ((uint32_t) seconds != seconds) return 0;
return seconds;
}
uint32_t tl_mktime(uint16_t yr, uint16_t mo, uint16_t dy, uint16_t hr, uint16_t min, uint16_t sec)
{
//translates from real values.
if (yr < 2008 || yr > 2100) return 0;
if (mo < 1 || mo > 12) return 0;
if (dy < 1 || dy > 31) return 0;
if (hr > 25) return 0;
if (min > 61) return 0;
if (sec > 61) return 0;
return my_mktime(yr-1900, mo-1, dy, hr, min, sec);
}
#ifdef MKTIME_TEST
int main(int argc, char **argv)
{
uint32_t mt;
time_t my_t;
struct tm *mytm;
my_t = time(NULL);
mytm = gmtime(&my_t);
printf("%s\n %u secs since the Epoch(%u)\n",asctime(mytm),(uint32_t)my_t, sizeof(time_t));
printf("(mktime)%u secs since the Epoch\n",mktime(mytm));
printf("calling my_mktime(%u,%u,%u,%u,%u,%u);\n",mytm->tm_year, mytm->tm_mon, mytm->tm_mday, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
mt = my_mktime(mytm->tm_year, mytm->tm_mon, mytm->tm_mday, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
printf("my unix time %u secs since the Epoch\n", (uint32_t)mt);
printf("difference = %d\n", mt-my_t);
return(0);
}
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | dexma/tos/platforms/z1/chips/tmp102/TMP102.h | <gh_stars>0
/*
* 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 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
*/
/**
* Types and definitions for the TI TMP175
*
* @author <NAME> <<EMAIL>>
* @version $Revision: 1.1 $ $Date: 2010/04/12 07:53:55 $
*/
#ifndef _TMP102_H
#define _TMP102_H
#define TMP102_SLAVE_ADDR (0x48)
#define TMP102_PTR_TEMP (0x0)
#define TMP102_PTR_CFG (0x1)
#define TMP102_PTR_TLOW (0x2)
#define TMP102_PTR_THIGH (0x3)
#define TMP102_CFG_OS ((1 << 7) << 8)
#define TMP102_CFG_RES(_x) ((((_x) & 0x3) << 5) << 8)
#define TMP102_CFG_FQ(_x) ((((_x) & 0x3) << 3) << 8)
#define TMP102_CFG_POL ((1 << 2) << 8)
#define TMP102_CFG_TM ((1 << 1) << 8)
#define TMP102_CFG_SD ((1 << 0) << 8)
#define TMP102_CFG_CR(_x) (((_x) & 0x3) << 6)
#define TMP102_CFG_AL (1 << 5)
#define TMP102_CFG_EM (1 << 4)
typedef enum {
TMP102_FQD_1 = 0,
TMP102_FQD_2 = 1,
TMP102_FQD_4 = 2,
TMP102_FQD_6 = 3
} tmp102_fqd_t;
typedef enum {
TMP102_CR_025HZ,
TMP102_RES_1HZ,
TMP102_RES_4HZ,
TMP102_RES_8HZ
} tmp102_cr_t;
#endif /* _TMP102_H */
|
tinyos-io/tinyos-3.x-contrib | berkeley/quanto/tos/lib/quanto/QuantoLog/QuantoLogCompressedMyUartWriter.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef QLOG_COMP_MY_UART
#define QLOG_COMP_MY_UART
enum {
CBLOCKSIZE = 20, // # msgs compressed at once
BUFFERSIZE = 100, // # msgs in event buffer. Must be
// a multiple of CBLOCKSIZE.
BITBUFSIZE = 234, // # size in bytes of the bit buffer.
MTFSYNC = 10, // # reset mtf every MTFRESET blocks
};
/* The BitBuffer size has to be larger than the entry size X
* CBLOCKSIZE, because in the worst case an integer of b bits
* will take 2*b-1 bits to encode in Elias Gamma. In most cases,
* however, the size will be much smaller than b.
* Each entry has 12 bytes, but b/c of the way they are encoded
* (8,8,32,32,8,8) they will take at most 186 bits.
* 186x10 = 1860 = 232.5, hence 234 bytes. */
#endif
|
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/camera_cmd/cmd_msg.c | /**
* This file is automatically generated by mig. DO NOT EDIT THIS FILE.
* This file implements the functions for encoding and decoding the
* 'cmd_msg' message type. See cmd_msg.h for more details.
*/
#include <message.h>
#include "cmd_msg.h"
uint16_t cmd_msg_node_id_get(tmsg_t *msg)
{
return tmsg_read_ube(msg, 0, 16);
}
void cmd_msg_node_id_set(tmsg_t *msg, uint16_t value)
{
tmsg_write_ube(msg, 0, 16, value);
}
uint8_t cmd_msg_cmd_get(tmsg_t *msg)
{
return tmsg_read_ube(msg, 16, 8);
}
void cmd_msg_cmd_set(tmsg_t *msg, uint8_t value)
{
tmsg_write_ube(msg, 16, 8, value);
}
uint16_t cmd_msg_val1_get(tmsg_t *msg)
{
return tmsg_read_ube(msg, 24, 16);
}
void cmd_msg_val1_set(tmsg_t *msg, uint16_t value)
{
tmsg_write_ube(msg, 24, 16, value);
}
uint16_t cmd_msg_val2_get(tmsg_t *msg)
{
return tmsg_read_ube(msg, 40, 16);
}
void cmd_msg_val2_set(tmsg_t *msg, uint16_t value)
{
tmsg_write_ube(msg, 40, 16, value);
}
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinyos2/scheduler.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef SCHEDULER_H_INCLUDED
#define SCHEDULER_H_INCLUDED
/**************************
* The queues in the run time system represent pending
* incoming edges in the graph.
**************************/
#define QUEUE_DELAY 100
#define QUEUE_LENGTH 5
#define NEXT_IDX(X) ((X + 1) % QUEUE_LENGTH)
typedef struct EdgeIn
{
uint8_t src_id; //This limits the number of nodes to 2^8.
uint8_t dst_id;
bool src;
uint8_t idx;
//these are being removed to allow better concurrency management
//uint8_t *invar;
//uint8_t *outvar;
} EdgeIn;
typedef struct EdgeQueue
{
uint8_t head, tail;
//uint16_t lock;
EdgeIn edges[QUEUE_LENGTH];
} EdgeQueue;
#endif
|
tinyos-io/tinyos-3.x-contrib | asu-impact/lib/echote_telos/EchoTETelos.h | <gh_stars>1-10
/*
* Copyright (c) 2008, Arizona Board of Regents
* 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 Arizona State University 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.
*/
#ifndef ECHOTE_TELOS_H
#define ECHOTE_TELOS_H
/** Expanded error conditions for the Read interface. */
enum {
SOILERR_OVERFLOW = ELAST+1,
SOILERR_OVERFLOW2,
SOILERR_TRUNCATED,
SOILERR_TRUNCATED2,
SOILERR_TRUNCATED3,
SOILERR_NOT_DIGIT,
SOILERR_TIMEOUT
} echote_error;
/**
* Amount of time to wait for a reading to complete, in milliseconds.
* According to ECH2O-TE docs, the reading should complete in about 50 ms.
*/
enum {
ECHOTE_TIMEOUT = 500
};
/** Data from a soil sensor reading. */
typedef nx_struct {
/**
* Dielectric output. Use calibration equation to derive volumetric
* water content (VWC).
*/
nx_uint16_t dielectric;
/**
* Temperature in Celsius multiplied by 10 offset by 400: T*10 + 400.
*/
nx_uint16_t temp;
/**
* Electrical conductivity value. Divide by 100 for units of dS/m.
*/
nx_uint16_t ec;
} soil_reading_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | uob/apps/TrickleSim/TrickleSim.h | #ifndef TRICKLE_SIM_H
#define TRICKLE_SIM_H
// 2 * 1024
#define UOB_TAU_LOW (2048L)
// 128 * 1024
#define UOB_TAU_HIGH (131072L)
#define UOB_K 1
//#define UOB_K 2
//#define PUSH 1
// 40 * 1024 -> same cycle count
#define UOB_PUSH (40960L)
typedef nx_struct trickle_sim_msg {
nx_uint16_t sender;
nx_uint16_t counter;
} trickle_sim_msg_t;
enum {
AM_TRICKLE_SIM_MSG = 6,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | sensorscheme/tos/lib/SensorScheme/Types.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>sensorscheme/tos/lib/SensorScheme/Types.h
#ifndef TYPES_H
#define TYPES_H
typedef union ss_val_t {
uint16_t idx;
struct s {
uint16_t tp :2;
int16_t sval :13;
uint16_t gc :1;
} s;
struct sn {
uint16_t tp :2;
int16_t sval :14;
} sn;
} ss_val_t;
typedef union cell {
struct p {
ss_val_t car;
ss_val_t cdr;
} p;
struct l {
int32_t lval :31;
uint16_t gc :1;
} l;
struct ln {
int32_t lval;
} ln;
} ss_cell_t;
/* ss_types of cells */
#define T_PAIR 0x00
#define T_SMALLNUM 0x01
#define T_SYMBOL 0x02
#define T_BIGNUM 0x03
/* gc operations */
#define isGC(c) (car(c).idx >= 1<<15)
#define clrGC(c) (car(c).idx &= ~(1<<15))
#define setGC(c) (car(c).idx |= 1<<15)
#define isFree(c) (cdr(c).idx >= 1<<15)
#define setUsed(c) (cdr(c).idx &= ~(1<<15))
#define setFree(c) (cdr(c).idx |= 1<<15)
/* operations on cells */
#define ss_type(c) ((c).s.tp)
/* numbers */
#define isNumber(c) ((ss_type(c) & (T_SMALLNUM & T_BIGNUM)) != 0)
#define makeSmallnum(n) ((ss_val_t){.s.gc=0, .s.sval=n, .s.tp=T_SMALLNUM})
#define smallnumVal(c) (int32_t)((c).s.sval)
#define bignumIdx(c) ((ss_val_t){.idx=((c).idx - T_BIGNUM)})
#define makeBignum(n) ({ss_val_t t = ss_cons(SYM_NIL, SYM_NIL); \
cells(t).ln.lval = n & ~(1L<<31); \
t.s.tp = T_BIGNUM; \
t;})
/* pairs */
#define isPair(c) (ss_type(c) == T_PAIR)
#define car(c) (cells(c).p.car)
#define cdr(c) (cells(c).p.cdr)
#define eq(a, b) ((a).idx == (b).idx)
#define lteq(a, b) ((a).idx <= (b).idx)
#define lt(a, b) ((a).idx < (b).idx)
/* symbols */
#define isSymbol(c) (ss_type(c) == T_SYMBOL)
#define makeSymbol(c) ((ss_val_t){.s.gc=0, .s.sval=c, .s.tp=T_SYMBOL})
#define symVal(c) ((c).sn.sval)
/* Closures */
#define isClosure(c) (ss_type(c) == T_PAIR && eq(car(c), SYM(CLOSURE)))
#define makeClosure(l, e) ss_cons(SYM(CLOSURE), ss_cons(l, e))
#define closureLambda(c) car(cdr(c))
#define closureArgs(c) car(closureLambda(c))
#define closureCode(c) cdr(closureLambda(c))
#define closureEnv(c) cdr(cdr(c))
/* Continuations */
#define isContinuation(c) (isPair(c) && eq(car(c), SYM(CONTINUATION)))
#define makeContinuation(s, e) ss_cons(SYM(CONTINUATION), ss_cons(s, e))
#define contStack(c) car(cdr(c))
#define contEnv(c) cdr(cdr(c))
#define callContinuation(c, v) ({ stack = contStack(c); \
envir = contEnv(c); \
do_return(v); \
})
/* Primitives */
#define isPrimitive(c) (isPair(c) && c.idx < CELLS_START)
#define makePrimitive(v) ((ss_val_t){.s.gc=0, .s.sval=v, .s.tp=T_PAIR})
#define primVal(c) (c.sn.sval)
#define isNull(c) eq(c, SYM_NIL)
#define isBool(c) (eq(c, SYM_TRUE) || eq(c, SYM_FALSE))
#define isSingleton(c) (isnull(c) || isbool(c))
#define SYM(s) makeSymbol(s)
#define SYM_NIL SYM(_NIL)
#define SYM_TRUE SYM(_TRUE)
#define SYM_FALSE SYM(_FALSE)
#if defined(__MSP430__) || defined(__AVR__)
#define STACKSIZE 256
extern uint16_t _end;
extern uint16_t __stack;
#define STACKTOP &__stack
#define CELLS_START (((uint16_t)&_end + 2) & 0xfffc)
#define CELLS_END ((uint16_t)STACKTOP - STACKSIZE)
#define cells(i) (*(ss_cell_t*)((uint8_t *) (i).idx))
#endif
#ifdef TOSSIM
#define CELLS_START 0x1000
#define NUM_CELLS 0x2000
#define CELLS_END NUM_CELLS + CELLS_START
ss_cell_t cellArray[1000][NUM_CELLS];
#define cells(i) cellArray[sim_node()][((i).idx - CELLS_START) >> 2]
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | nxtmote/tos/chips/uc1601/LCD.h | /*
* Copyright (c) 2007 nxtmote project
* 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 nxtmote project 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 <NAME>
*/
#ifndef _LCD_H
#define _LCD_H
#define CMD 0
#define DAT 1
#define DISP_LINES 8
#define DISPLINELENGTH 100
uint32_t waiti;
uint32_t waitj;
#define waitspin(count) {\
atomic{\
waiti = 0;\
while(++waiti < count){\
waitj=0;\
while(++waitj < count);\
}\
}\
}
uint8_t initStr[] =
{
0xEB, // LCD bias setting = 1/9 0xEB
0x2F, // Power control = internal 0x2F
0xA4, // All points not on 0xA4
0xA6, // Not inverse 0xA6
0x40, // Start line = 0 0x40
0x81, // Electronic volume 0x81
0x5A, // -"- 0x5F
0xC4, // LCD mapping 0xC4
0x27, // Set temp comp. 0x27-
0x29, // Panel loading 0x28 0-1
0xA0, // Framerate 0xA0-
0x88, // CA++ 0x88-
0x23, // Multiplex 1:65 0x23
0xAF // Display on 0xAF
};
uint8_t DisplayLineString[8][3] =
{
{ 0xB0,0x10,0x00 },
{ 0xB1,0x10,0x00 },
{ 0xB2,0x10,0x00 },
{ 0xB3,0x10,0x00 },
{ 0xB4,0x10,0x00 },
{ 0xB5,0x10,0x00 },
{ 0xB6,0x10,0x00 },
{ 0xB7,0x10,0x00 }
};
//Used in file that includes LCD.h
uint8_t lcdstr[100];
typedef struct
{
UBYTE FormatMsb;
UBYTE FormatLsb;
UBYTE DataBytesMsb;
UBYTE DataBytesLsb;
UBYTE ItemsX;
UBYTE ItemsY;
UBYTE ItemPixelsX;
UBYTE ItemPixelsY;
UBYTE Data[];
} FONT;
const FONT Font =
{
0x04,0x00, // Graphics Format
0x02,0x40, // Graphics DataSize
0x10, // Graphics Count X
0x06, // Graphics Count Y
0x06, // Graphics Width
0x08, // Graphics Height
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x5F,0x06,0x00,0x00,0x07,0x03,0x00,0x07,0x03,0x00,0x24,0x7E,0x24,0x7E,0x24,0x00,0x24,0x2B,0x6A,0x12,0x00,0x00,0x63,0x13,0x08,0x64,0x63,0x00,0x30,0x4C,0x52,0x22,0x50,0x00,0x00,0x07,0x03,0x00,0x00,0x00,0x00,0x3E,0x41,0x00,0x00,0x00,0x00,0x41,0x3E,0x00,0x00,0x00,0x08,0x3E,0x1C,0x3E,0x08,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x80,0x60,0x60,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x00,
0x3E,0x51,0x49,0x45,0x3E,0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x22,0x49,0x49,0x49,0x36,0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x2F,0x49,0x49,0x49,0x31,0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00,0x6C,0x6C,0x00,0x00,0x00,0x00,0xEC,0x6C,0x00,0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x24,0x24,0x24,0x24,0x24,0x00,0x00,0x41,0x22,0x14,0x08,0x00,0x02,0x01,0x59,0x09,0x06,0x00,
0x3E,0x41,0x5D,0x55,0x1E,0x00,0x7E,0x11,0x11,0x11,0x7E,0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x7F,0x41,0x41,0x41,0x3E,0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x3E,0x41,0x49,0x49,0x7A,0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00,0x41,0x7F,0x41,0x00,0x00,0x30,0x40,0x40,0x40,0x3F,0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x7F,0x02,0x04,0x02,0x7F,0x00,0x7F,0x02,0x04,0x08,0x7F,0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,
0x7F,0x09,0x09,0x09,0x06,0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x7F,0x09,0x09,0x19,0x66,0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x3F,0x40,0x3C,0x40,0x3F,0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x07,0x08,0x70,0x08,0x07,0x00,0x71,0x49,0x45,0x43,0x00,0x00,0x00,0x7F,0x41,0x41,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,0x41,0x41,0x7F,0x00,0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x02,0x05,0x02,0x00,0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x7F,0x44,0x44,0x44,0x38,0x00,0x38,0x44,0x44,0x44,0x28,0x00,0x38,0x44,0x44,0x44,0x7F,0x00,0x38,0x54,0x54,0x54,0x08,0x00,0x08,0x7E,0x09,0x09,0x00,0x00,0x18,0x24,0xA4,0xA4,0xFC,0x00,0x7F,0x04,0x04,0x78,0x00,0x00,0x00,0x00,0x7D,0x40,0x00,0x00,0x40,0x80,0x84,0x7D,0x00,0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00,0x00,0x7F,0x40,0x00,0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x7C,0x04,0x04,0x78,0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00,
0xFC,0x44,0x44,0x44,0x38,0x00,0x38,0x44,0x44,0x44,0xFC,0x00,0x44,0x78,0x44,0x04,0x08,0x00,0x08,0x54,0x54,0x54,0x20,0x00,0x04,0x3E,0x44,0x24,0x00,0x00,0x3C,0x40,0x20,0x7C,0x00,0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x3C,0x60,0x30,0x60,0x3C,0x00,0x6C,0x10,0x10,0x6C,0x00,0x00,0x9C,0xA0,0x60,0x3C,0x00,0x00,0x64,0x54,0x54,0x4C,0x00,0x00,0x08,0x3E,0x41,0x41,0x00,0x00,0x00,0x00,0x77,0x00,0x00,0x00,0x00,0x41,0x41,0x3E,0x08,0x00,0x02,0x01,0x02,0x01,0x00,0x00,0x10,0x20,0x40,0x38,0x07,0x00}
};
// Actual transmit buffer
static uint8_t txbuf1[100];
static uint8_t rxbuf[100];
#endif /* _LCD_H */
|
tinyos-io/tinyos-3.x-contrib | kasetsart/tos/chips/atm328/spi/Atm328Spi.h | /**
* Definitions for ATmega328's SPI hardware
*
* @notes
* This file is modified from
* <code>tinyos-2.1.0/tos/chips/atm128/spi/Atm128Spi.h</code>
*
* @author
* <NAME> (<EMAIL>)
*/
#ifndef _H_Atm328SPI_h
#define _H_Atm328SPI_h
//====================== SPI Bus ==================================
enum {
ATM328_SPI_CLK_DIVIDE_4 = 0,
ATM328_SPI_CLK_DIVIDE_16 = 1,
ATM328_SPI_CLK_DIVIDE_64 = 2,
ATM328_SPI_CLK_DIVIDE_128 = 3,
};
/* SPI Control Register */
typedef struct {
uint8_t spie : 1; //!< SPI Interrupt Enable
uint8_t spe : 1; //!< SPI Enable
uint8_t dord : 1; //!< SPI Data Order
uint8_t mstr : 1; //!< SPI Master/Slave Select
uint8_t cpol : 1; //!< SPI Clock Polarity
uint8_t cpha : 1; //!< SPI Clock Phase
uint8_t spr : 2; //!< SPI Clock Rate
} Atm328SPIControl_s;
typedef union {
uint8_t flat;
Atm328SPIControl_s bits;
} Atm328SPIControl_t;
typedef Atm328SPIControl_t Atm328_SPCR_t; //!< SPI Control Register
/* SPI Status Register */
typedef struct {
uint8_t spif : 1; //!< SPI Interrupt Flag
uint8_t wcol : 1; //!< SPI Write COLision flag
uint8_t rsvd : 5; //!< Reserved
uint8_t spi2x : 1; //!< Whether we are in double speed
} Atm328SPIStatus_s;
typedef union {
uint8_t flat;
Atm328SPIStatus_s bits;
} Atm328SPIStatus_t;
typedef Atm328SPIStatus_t Atm328_SPSR_t; //!< SPI Status Register
typedef uint8_t Atm328_SPDR_t; //!< SPI Data Register
#endif //_H_Atm328SPI_h
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/tinynode/userstructs.h | #ifndef USERSTRUCTSH_H_INCLUDED
#define USERSTRUCTSH_H_INCLUDED
#include "gps.h"
#include "AM.h"
#include "uservariables.h"
//bundle types
enum
{
BTYPE_GPSFIRST = 1,
BTYPE_GPSSECOND = 2,
BTYPE_TEMP_WET = 3,
BTYPE_RTSTATE = 4,
BTYPE_RTPATH = 5,
BTYPE_CONN = 6,
};
enum
{
TX_HI_BW = 2500,
TX_LO_BW = 200,
};
enum
{
RX_HI_BW = 2500,
RX_LO_BW = 200,
};
enum
{
AM_BEACONMSG = 4,
//AM_ACCEPTMSG = 5,
AM_PREDATA = 8,
AM_OFFERMSG = 9,
AM_DATAMSG = 11,
AM_DATAACK = 12,
AM_ARCHIVEMSG = 13,
AM_ACKMSG = 14,
AM_COLLECTMSG = 15,
AM_STATUSMSG = 16,
AM_ACTIVATEMSG = 17,
};
enum
{
ACT_QUERY = 0,
ACT_ON = 1,
ACT_OFF = 2,
ACT_INIT = 3,
};
uint16_t g_yr;
uint16_t g_mo;
uint16_t g_dy;
uint16_t g_hr;
uint16_t g_min;
uint16_t g_sec;
typedef struct StatusMsg
{
uint16_t src_addr;
uint16_t volts;
uint32_t rt_clock;
uint8_t act;
uint8_t state;
uint8_t grade;
} StatusMsg_t;
typedef struct BeaconMsg
{
uint16_t src_addr; //the beaconers address
uint16_t src_delay; //the beaconers delay to the base station
uint16_t bw; //the maximum number of packets that the beaconer might send you
} BeaconMsg_t;
typedef struct OfferMsg
{
uint16_t addr; //the responders address
uint16_t delay; //the responders delay to the base station
uint16_t bw; //the maximum number of packets that the responder might recv from you
} OfferMsg_t;
typedef struct AckMsg{
uint8_t src;
uint8_t idx;
uint16_t addr;
uint16_t min_id;
uint16_t max_id;
}AckMsg_t;
#define DATA_MSG_HDR_LEN 6
#define DATA_MSG_DATA_LEN (TOSH_DATA_LENGTH-DATA_MSG_HDR_LEN)
#define MAX_CONSECUTIVE_DATA_TIMEOUTS 5
#define RECV_MSG_TIMEOUT_MS 1000
#define INTERESTED_ROUNDS 3
#define INTERESTED_INTERVAL 1000
#define SEND_TIMEOUT_MS 1000
#define MAX_CONSECUTIVE_TIMEOUTS 5
#define RECV_ACK_TIMEOUT_MS 1000
#define BUNDLE_ACK_HEADER_LENGTH 6
#define BUNDLE_ACK_DATA_LENGTH TOSH_DATA_LENGTH - BUNDLE_ACK_HEADER_LENGTH
#define PACKET_DATA_LENGTH 30
#define PACKET_HEADER_LENGTH 1
#define CHUNK_DATA_LENGTH (PACKET_DATA_LENGTH - PACKET_HEADER_LENGTH)
#define CHUNK_HEADER_LENGTH 6
#define CHUNK_PAYLOAD_LENGTH (CHUNK_DATA_LENGTH - CHUNK_HEADER_LENGTH)
typedef struct DataMsg
{
uint16_t src_addr;
uint8_t offerid;
unsigned int last : 1;
unsigned int length : 7;
uint16_t sequence;
uint8_t data[DATA_MSG_DATA_LEN];
}DataMsg_t;
typedef struct GpsData {
char date[NMEA_CHARS_PER_FIELD]; //ddmmyy
char time[NMEA_CHARS_PER_FIELD];//hhmmss.ss
bool timevalid;
GpsFixData fix;
} GpsData_t;
typedef struct packet_t
{
uint8_t data[PACKET_DATA_LENGTH];
uint8_t length;
} packet_t;
typedef struct ack_t
{
uint8_t data[PACKET_DATA_LENGTH];
uint8_t length;
} ack_t;
typedef struct chunk_t
{
uint8_t data[CHUNK_DATA_LENGTH];
uint8_t length;
} chunk_t;
typedef struct chunkarr_t {
chunk_t chunks[2];
uint8_t num;
} chunkarr_t;
typedef struct GetPageMsg {
uint16_t src_addr;
uint16_t page;
} GetPageMsg_t;
TOS_Msg g_deadlock_msg;
#endif // USERSTRUCTS_H_INCLUDED
|
tinyos-io/tinyos-3.x-contrib | ahhr-ipsn09/tos/le/LinkEstimator.h | <reponame>tinyos-io/tinyos-3.x-contrib
/*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
* this license. If you do not agree to this license, do not download,
* install, copy or use the software.
*
* Copyright (c) 2006-2008 Vrije Universiteit Amsterdam and
* Development Laboratories (DevLab), Eindhoven, the Netherlands.
* 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, the author, and the following
* disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, the author, and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Vrije Universiteit Amsterdam, nor the name of
* DevLab, nor the names of their 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 VRIJE
* UNIVERSITEIT AMSTERDAM, DEVLAB, OR THEIR 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.
*
* Authors: <NAME>
* CVS id: $Id: LinkEstimator.h,v 1.1 2009/04/07 08:42:27 iwanicki Exp $
*/
#ifndef __LINK_ESTIMATOR__H__
#define __LINK_ESTIMATOR__H__
#include <message.h>
#include <AM.h>
#include "Sequencing.h"
/*
* This file contains data types used for estimating the quality of
* the links between nodes.
*
* @author <NAME> <<EMAIL>>
*/
// *************************** Local structures ***************************
/**
* Information about a neighbor stored by a node.
*/
typedef struct {
am_addr_t llAddress; // the link-layer address of the neighbor
uint8_t flags; // the flags of an entry in the neighbor
sequencing_seqno_t seqNo; // the sequence number of the last packet
// received from the neighbor
uint8_t rcvCnt; // the number of received packtes,
// since the estimates were updated for
// the last time (inAge)
uint8_t drpCnt; // the number of dropped packets,
// since the estimates were updated for
// the last time (inAge)
uint8_t inLinkQ; // the inbound quality of the link
// (node->self)
uint8_t inAge; // the number of rounds since the last
// update of the inbound link quality
// and the number of neighbors
uint8_t outLinkQ; // the outbound quality of the link
// (self->node)
uint8_t outAge; // the number of rounds since the last
// update of the outbound link quality
} neighbor_t;
/**
* Iterator over the neighbor table.
*/
typedef struct {
uint8_t index; // current position of the iterator
} neighbor_iter_t;
/**
* Possible flags of the neighbor.
*/
enum {
// the entry contains a valid neighbor
NEIGHBOR_VALID = 0x01,
// we received the first packet from the neighbor
NEIGHBOR_INIT = 0x02,
// we computed the link quality for the neighbor after
// we received enough messages
NEIGHBOR_MATURE = 0x04,
// the neighbor is pinned so we cannot evict it
NEIGHBOR_PINNED = 0x08,
// the neighbor is suspected of being dead,
// as we have not receive a message from it
// in the last round; if we do not receive
// a message in the next round, we count as two
// rounds with no messages; this flag is necessary
// for dealing with random jitter to the
// transmission times
NEIGHBOR_SUSPECTED = 0x10,
// the neighbor already suffered from being suspected
NEIGHBOR_PENALIZED = 0x20,
// the neighbor is invalid but awaits for the eviction signal
NEIGHBOR_TO_EVICT = 0x40,
};
// CTCONFIG: The maximal number of neighbors in a node's neighbor table.
#ifndef DEF_MAX_NUM_NEIGHBORS
#define DEF_MAX_NUM_NEIGHBORS 100
#endif //DEF_MAX_NUM_NEIGHBORS
// ENDCTCONFIG
// ************************** Message structures **************************
/**
* A link estimator header.
*/
typedef nx_struct {
nx_uint8_t numRecordsAndFlags; // the number of neighbors in this
// particular message
} nx_le_header_t;
/**
* A link quality record in message.
*/
typedef nx_struct {
nx_am_addr_t llAddress; // the link-layer address of a node
nx_uint8_t lqIn; // the link quality from the node to
// the sender of the beacon
// (the reverse link quality)
} nx_link_record_t;
/**
* A link estimator footer.
*
* The footer is of a variable size.
* The 1 value is to prevent any code optimizations.
*/
typedef nx_struct {
nx_link_record_t records[0]; // link quality records
} nx_le_footer_t;
/**
* Constants related to the messages.
*/
enum {
// the mask used to obtain the number of records
// in the link estimator footer
LE_HEADER_NUM_RECORDS_MASK = 0x0f
};
#endif //__LINK_ESTIMATOR__H__
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/client/sfaccess/tinyrely.c | #include "tinyrely.h"
#include "telossource.h"
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
uint8_t suid=0;
int relyfd = 0;
uint8_t ackdsn = 0;
ConnStr connections[RELY_MAX_CONNECTIONS];
pthread_t recvthread;
bool done = FALSE;
pthread_mutex_t conn_mutex = {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __LOCK_INITIALIZER};
//prototypes
int getNewConnection();
uint8_t getNextUID();
int handle_connect(telospacket *packet);
int handle_msg(telospacket *packet);
int handle_ack(telospacket *packet);
int getIndexByUID(uint8_t whatsuid);
bool isValidConnectionID(int connid);
bool isValidConnection(int connid);
//recv routine
void *recv_routine(void *arg)
{
telospacket *packet;
dbg(TRELY,"Receive Thread Started\n");
while (!done)
{
packet = read_telos_packet(relyfd);
if (packet == NULL)
{
dbg(TRELY,"NULL packet: We're done\n");
done = TRUE;
break;
}
dbg(TRELY,"Incoming packet...(t=%i,a=%i,d=%i,l=%i,g=%i)\n",
packet->type, packet->addr,
packet->dsn, packet->length,
packet->group);
if (packet->type == AM_TINYRELYCONNECT)
{
dbg(TRELY,"connect...\n");
handle_connect(packet);
free_telos_packet(&packet);
}
else if (packet->type == AM_TINYRELYMSG)
{
dbg(TRELY,"data...\n");
handle_msg(packet);
free_telos_packet(&packet);
}
else if (packet->type == AM_TINYRELYACK)
{
dbg(TRELY,"ack...\n");
handle_ack(packet);
free_telos_packet(&packet);
}
else
{
dbg(TRELY,"not mine...\n");
//sleep(1);
free_telos_packet(&packet);
}
}
dbg(TRELY,"Receive Thread Done\n");
return NULL;
}
int tinyrely_init(const char* host, int port)
{
int i;
done = FALSE;
if (relyfd != 0)
{
//called twice. Not good
return -1;
}
for (i=0; i < RELY_MAX_CONNECTIONS; i++)
{
connections[i].valid = FALSE;
connections[i].callback = NULL;
pthread_mutex_init(&connections[i].mutex, NULL);
}
relyfd = open_telos_source(host, port);
if (relyfd < 0) return -1;
//spawn recv thread.
if(pthread_create(&recvthread, NULL, recv_routine, NULL))
return -1;
return 0;
}
int tinyrely_destroy()
{
done = TRUE; //tell recvthread to stop
close(relyfd);
dbg(TRELY,"TinyRely fd closed.\n");
//pthread_join(recvthread, NULL);
//dbg(TRELY,"TinyRely recv thread joined\n");
relyfd = 0;
//reset connections
return 0;
}
int tinyrely_send(int id, const uint8_t *data, int length)
{
bool failed = FALSE;
int left = length;
int err, counter = 0;
telospacket packet;
uint8_t buf[RELYMSGSIZE];
dbg(TRELY,"tinyrely_send(%i, %i)\n",id, length);
if (length <= 0 || !isValidConnection(id))
{
dbg(TRELY,"failed...\n");
return -1;
}
pthread_mutex_lock(&connections[id].mutex);
while (left > 0)
{
uint8_t chunksize;
if (left <= RELY_PAYLOAD_LENGTH)
{
chunksize = left;
}
else
{
chunksize = RELY_PAYLOAD_LENGTH;
}
//send a chunk
packet.length = CONNMSGSIZE;
packet.addr = 2;
packet.type = AM_TINYRELYMSG;
packet.data = buf;
hton_uint16(buf, TOS_UART_ADDR);
buf[2] = connections[id].suid;
buf[3] = connections[id].duid;
buf[4] = connections[id].txseq;
buf[5] = chunksize;
memcpy(buf+6, data+(length-left), chunksize);
left -= chunksize;
connections[id].txseq++;
connections[id].sending = TRUE;
counter = 0;
while (connections[id].sending)
{
if (counter % RELY_RESEND_TIMEOUT == 0)
{
err = write_telos_packet(relyfd, &packet);
dbg(TRELY,"write err=%i\n",err);
if (err)
{
connections[id].valid = FALSE;
connections[id].pending = FALSE;
break;
} //if err
}//if retry
usleep(RELY_ACKTIMER * 1000);
counter++;
if (counter > RELY_SEND_TIMEOUT)
{
break;
}
} //while
if (connections[id].sending)
{
//no go
failed = TRUE;
break;
}
}//while
if (failed || left > 0)
{
connections[id].valid = FALSE;
}
pthread_mutex_unlock(&connections[id].mutex);
if (connections[id].valid == FALSE)
{
return -1;
}
return 0;
}
int tinyrely_connect(recv_callback_t callback, int address)
{
int idx;
telospacket packet;
uint8_t data[CONNMSGSIZE];
int err;
int counter = 0;
idx = getNewConnection();
dbg(TRELY,"New Connection...%i\n",idx);
if (idx == RELY_IDX_INVALID)
{
return RELY_IDX_INVALID;
}
pthread_mutex_lock(&connections[idx].mutex);
connections[idx].callback = callback;
dbg(TRELY,"locked mutex...\n");
connections[idx].pending = TRUE;
//send connection request
packet.length = CONNMSGSIZE;
packet.addr = address;
packet.type = AM_TINYRELYCONNECT;
packet.data = data;
hton_uint16(data, 2);
dbg(TRELY,"getNextUID...");
data[2] = getNextUID();
dbg(TRELY,"DONE\n");
data[3] = 0;
data[4] = CONN_TYPE_REQUEST;
data[5] = RELY_OK;
connections[idx].suid = data[2];
err = write_telos_packet(relyfd, &packet);
dbg(TRELY,"err=%i\n",err);
if (err)
{
connections[idx].valid = FALSE;
connections[idx].pending = FALSE;
pthread_mutex_unlock(&connections[idx].mutex);
return RELY_IDX_INVALID;
}
while (connections[idx].pending &&
counter < RELY_TIMEOUT_COUNT)
{
counter++;
usleep(RELY_GRANULARITY * 1000);
/*err = write_telos_packet(relyfd, &packet);
dbg(TRELY,"err=%i\n",err);
if (err)
{
connections[idx].valid = FALSE;
connections[idx].pending = FALSE;
pthread_mutex_unlock(&connections[idx].mutex);
return RELY_IDX_INVALID;
}*/
}
if (connections[idx].pending)
{
dbg(TRELY,"Connection request timed out.\n");
connections[idx].valid = FALSE;
}
if (connections[idx].valid)
{
pthread_mutex_unlock(&connections[idx].mutex);
return idx;
}
pthread_mutex_unlock(&connections[idx].mutex);
return RELY_IDX_INVALID;
}
int tinyrely_close(int id)
{
telospacket packet;
uint8_t data[CONNMSGSIZE];
int err;
int counter = 0;
dbg(TRELY,"Close Connection...%i\n",id);
if (!isValidConnection(id))
{
return -1;
}
pthread_mutex_lock(&connections[id].mutex);
dbg(TRELY,"locked mutex...\n");
connections[id].closing = TRUE;
//send connection close request
packet.length = CONNMSGSIZE;
packet.addr = TOS_BCAST_ADDR;
packet.type = AM_TINYRELYCONNECT;
packet.data = data;
//form close msg
hton_uint16(data, TOS_UART_ADDR);
data[2] = connections[id].suid;
data[3] = connections[id].duid;
data[4] = CONN_TYPE_CLOSE;
data[5] = RELY_OK;
err = write_telos_packet(relyfd, &packet);
if (err)
{
dbg(TRELY,"err=%i\n",err);
connections[id].valid = FALSE;
connections[id].pending = FALSE;
pthread_mutex_unlock(&connections[id].mutex);
return -1;
}
connections[id].valid = FALSE;
connections[id].pending = FALSE;
pthread_mutex_unlock(&connections[id].mutex);
return 0;
}
//aux calls
/* Tries to find an available slot for the connection. Returns a -1 if one is not
found. Returns the slot index otherwise.
*/
int getNewConnection()
{
int connid = -1;
int i=0;
pthread_mutex_lock(&conn_mutex);
for (i=0; i < RELY_MAX_CONNECTIONS; i++)
{
if (connections[i].valid == FALSE)
{
//found a free slot
connections[i].valid = TRUE;
connid = i;
break;
}
}//for
pthread_mutex_unlock(&conn_mutex);
return connid;
}
/* Increments the global SUID and returns the next one. Should
never return a value of zero. This would be an error.
*/
uint8_t getNextUID()
{
bool isunique = FALSE;
int i=0;
pthread_mutex_lock(&conn_mutex);
while (!isunique)
{
isunique = TRUE;
//get next UID
suid = (suid + 1) % 255;
if (suid == 0)
suid++;
//check for uniqueness
for (i=0; i < RELY_MAX_CONNECTIONS; i++)
{
if (connections[i].valid && connections[i].suid == suid)
{
isunique = FALSE;
break;
}
} //for
}//while
pthread_mutex_unlock(&conn_mutex);
return suid;
}
int handle_connect(telospacket *packet)
{
uint16_t src;
uint8_t suid;
uint8_t duid;
uint8_t type;
uint8_t ok;
int idx;
ntoh_uint16(packet->data, &src);
suid = packet->data[2];
duid = packet->data[3];
type = packet->data[4];
ok = packet->data[5];
dbg(TRELY,"h_c src=%i\n",src);
dbg(TRELY,"h_c suid=%i\n",suid);
dbg(TRELY,"h_c duid=%i\n",duid);
dbg(TRELY,"h_c type=%i\n",type);
dbg(TRELY,"h_c ok=%i\n",ok);
if (type == CONN_TYPE_REQUEST)
{
dbg(TRELY,"conntype = conn_request(%i)\n",CONN_TYPE_REQUEST);
//currently do nothing
}
else if (type == CONN_TYPE_ACK)
{
//Someone is ack-ing our request
dbg(TRELY,"Connection ACK!\n");
pthread_mutex_lock(&conn_mutex);
idx = getIndexByUID(duid);
dbg(TRELY,"DUID: %d -> INDEX: %d\n",duid,idx);
if (idx != RELY_IDX_INVALID &&
connections[idx].pending == TRUE)
{
dbg(TRELY,"Valid Connection (%d,%d)\n",idx,connections[idx].pending);
connections[idx].duid = suid;
connections[idx].txseq = 0;
connections[idx].rxseq = 0;
connections[idx].full = TRUE;
connections[idx].count = 0;
connections[idx].pending = FALSE;
} else {
dbg(TRELY,"Invalid Connection (%d,%d)\n",idx,connections[idx].pending);
}
pthread_mutex_unlock(&conn_mutex);
}
else if (type == CONN_TYPE_CLOSE)
{
dbg(TRELY,"conntype = conn_close(%i)\n",CONN_TYPE_CLOSE);
}
else
{
dbg(TRELY,"ERROR: unknown type = %i\n",type);
return -1;
}
return 0;
}
int handle_msg(telospacket *packet)
{
uint16_t src;
uint8_t suid;
uint8_t duid;
uint8_t seq;
uint8_t length;
uint8_t * data;
uint8_t * ackdata;
int idx;
telospacket ackpkt;
ntoh_uint16(packet->data, &src);
suid = packet->data[2];
duid = packet->data[3];
seq = packet->data[4];
length = packet->data[5];
pthread_mutex_lock(&conn_mutex);
idx = getIndexByUID(duid);
if (!isValidConnection(idx) || length > RELY_PAYLOAD_LENGTH)
{
pthread_mutex_unlock(&conn_mutex);
return -1;
}
if (connections[idx].rxseq == seq)
{
data = malloc(length);
memcpy(data, packet->data+6, length);
connections[idx].callback(idx, data, length);
free(data);
data = NULL;
connections[idx].rxseq++;
}
//send ack
ackpkt.addr = TOS_BCAST_ADDR;
ackpkt.type = AM_TINYRELYACK;
ackpkt.dsn = ackdsn++;
ackpkt.length = ACKMSGSIZE;
ackdata = malloc(ACKMSGSIZE);
ackpkt.data = ackdata;
//fill in ack data here
hton_int16(ackdata, connections[idx].addr);
ackdata[2] = connections[idx].suid;
ackdata[3] = connections[idx].duid;
ackdata[4] = connections[idx].rxseq;
ackdata[5] = RELY_OK;
//send the ack
if (write_telos_packet(relyfd, &ackpkt))
{
dbg(TRELY,"Error sending ack!\n");
}
pthread_mutex_unlock(&conn_mutex);
return 0;
}
int handle_ack(telospacket *packet)
{
uint16_t src;
uint8_t suid;
uint8_t duid;
uint8_t seq;
uint8_t ok;
int idx;
ntoh_uint16(packet->data, &src);
suid = packet->data[2];
duid = packet->data[3];
seq = packet->data[4];
ok = packet->data[5];
pthread_mutex_lock(&conn_mutex);
idx = getIndexByUID(duid);
if (!isValidConnection(idx))
{
pthread_mutex_unlock(&conn_mutex);
return -1;
}
if (connections[idx].txseq != seq ||
connections[idx].sending == FALSE)
{
pthread_mutex_unlock(&conn_mutex);
return -1;
}
if (ok != RELY_OK)
{
connections[idx].valid = FALSE;
connections[idx].sending = FALSE;
pthread_mutex_unlock(&conn_mutex);
return -1;
}
connections[idx].sending = FALSE;
pthread_mutex_unlock(&conn_mutex);
return 0;
}
int getIndexByUID(uint8_t whatsuid)
{
int idx = RELY_IDX_INVALID;
int i;
pthread_mutex_lock(&conn_mutex);
for (i=0; i < RELY_MAX_CONNECTIONS; i++)
{
if (connections[i].valid && connections[i].suid == whatsuid)
{
idx = i;
break;
}
} //for
pthread_mutex_lock(&conn_mutex);
return idx;
}
bool isValidConnectionID(int connid)
{
return (connid > RELY_IDX_INVALID && connid < RELY_MAX_CONNECTIONS);
}
bool isValidConnection(int connid)
{
return (isValidConnectionID(connid) && connections[connid].valid);
}
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/include/math.h | <filename>diku/freescale/tos/platforms/dig528/include/math.h
/** Dummy header to avoid inclusion of the standard library header **/
#ifndef _MATH_H_
#define _MATH_H_
#endif
|
tinyos-io/tinyos-3.x-contrib | cedt/tos/chips/cc1000/sim/sim_channel.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
/**
* "Copyright (c) 2007 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc.
* 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 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc 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 CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* CENTRE FOR ELECTRONICS AND DESIGN TECHNOLOGY,IISc 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 CENTRE FOR ELECTRONICS
* AND DESIGN TECHNOLOGY,IISc HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
*/
/**
*
* @author <NAME>
* @author <NAME>
*/
#ifndef SIM_CHANNEL_H
#define SIM_CHANNEL_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sim_channel_t {
bool channel;
int nodeId;
}sim_channel_t;
void sim_channel_init();
void sim_channel_acquire();
bool sim_channel_get();
void sim_channel_release();
#ifdef __cplusplus
}
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | tinyos-programming/AntiTheftBook/6.5.2/antitheft.h | <gh_stars>1-10
/*
* Copyright (c) 2007-2009 Intel Corporation
* All rights reserved.
* This file is distributed under the terms in the attached INTEL-LICENS
* file. If you do not find this file, a copy can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#ifndef ANTITHEFT_H
#define ANTITHEFT_H
enum { AM_THEFT = 42, AM_SETTINGS = 43 };
enum { COL_THEFT = 54, DIS_THEFT = 55 };
typedef nx_struct theft {
nx_uint16_t who;
} theft_t;
typedef nx_struct settings {
nx_uint16_t accelVariance;
nx_uint16_t accelInterval;
} settings_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | iitk/TOSSIM/TossimRadioMsg.h | <filename>iitk/TOSSIM/TossimRadioMsg.h
#ifndef TOSSIM_RADIO_MSG_H
#define TOSSIM_RADIO_MSG_H
#include "AM.h"
typedef nx_struct tossim_header {
nx_am_addr_t dest;
nx_am_addr_t src;
nx_uint8_t length;
nx_am_group_t group;
nx_am_id_t type;
} tossim_header_t;
typedef nx_struct tossim_footer {
nxle_uint16_t crc;
} tossim_footer_t;
typedef nx_struct tossim_metadata {
nx_int8_t strength;
nx_uint8_t ack;
nx_uint16_t time;
} tossim_metadata_t;
typedef nx_struct SYN_packet {
nx_uint16_t packet_type;
nx_int16_t node_id;
nx_uint16_t next_sleep_time;
nx_uint16_t sleep_period;
} SYN_packet_t;
typedef nx_struct RTS_packet {
nx_uint16_t packet_type;
nx_int16_t src_id;
nx_int16_t dest_id;
nx_uint16_t duration;
} RTS_packet_t;
typedef nx_struct CTS_packet {
nx_uint16_t packet_type;
nx_int16_t src_id;
nx_int16_t dest_id;
nx_uint16_t duration;
} CTS_packet_t;
typedef nx_struct data_packet {
nx_uint16_t packet_type;
nx_uint8_t payload[16];
} data_packet_t;
typedef nx_struct FRTS_packet {
nx_uint16_t packet_type;
nx_int16_t src_id;
nx_int16_t dest_id;
nx_uint16_t duration;
} FRTS_packet_t;
typedef nx_struct DS_packet {
nx_uint16_t packet_type;
nx_int16_t src_id;
nx_int16_t dest_id;
nx_uint16_t duration;
} DS_packet_t;
typedef nx_struct preamble_packet {
nx_uint16_t packet_type;
nx_uint16_t dest_id;
nx_uint8_t seq_no;
} preamble_packet_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | uvigo/tos/lib/net/zigvigo/Nwk.h | /*
* Copyright (c) 2009 GTI/TC-1 Research Group. Universidade de Vigo.
* Gradiant (www.gradiant.org)
* 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 Universidade de Vigo 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 STANFORD
* UNIVERSITY 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.
*
* - Revision -------------------------------------------------------------
* $Revision: 1.1 $
* $Date: 2009/11/18 12:20:38 $
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>>
* ========================================================================
*/
#ifndef NWK_H
#define NWK_H
#include "AppProfile.h"
#include "Nwk_MicaZ.h"
#include "TKN154.h"
/**************************************************
* Zigbee Network Layer Enumerations
**************************************************/
typedef enum nwk_status {
//NWK Layer Status Values
NWK_SUCCESS = 0x00,
NWK_INVALID_PARAMETER = 0xC1,
NWK_INVALID_REQUEST = 0xC2,
NWK_NOT_PERMITTED = 0xC3,
NWK_STARTUP_FAILURE = 0xC4,
NWK_ALREADY_PRESENT = 0xC5,
NWK_SYNC_FAILURE = 0xC6,
NWK_NEIGHBOR_TABLE_FULL = 0xC7,
NWK_UNKNOWN_DEVICE = 0xC8,
NWK_UNSUPPORTED_ATTRIBUTE = 0xC9,
NWK_NO_NETWORKS = 0xCA,
NWK_MAX_FRM_COUNTER = 0xCC,
NWK_NO_KEY = 0xCD,
NWK_BAD_CCM_OUTPUT = 0xCE,
NWK_NO_ROUTING_CAPACITY = 0xCF,
NWK_ROUTE_DISCOVERY_FAILED = 0xD0,
NWK_ROUTE_ERROR = 0xD1,
NWK_BT_TABLE_FULL = 0xD2,
NWK_FRAME_NOT_BUFFERED = 0xD3
} nwk_status_t;
typedef enum route_status {
//Route Status Values
NWK_ACTIVE = 0x0,
NWK_DISCOVERY_UNDERWAY = 0x1,
NWK_DISCOVERY_FAILED = 0x2,
NWK_INACTIVE = 0x3,
NWK_VALIDATION_UNDERWAY = 0x4
} route_status_t;
typedef enum nwk_status_failure {
NWK_FAILURE_NO_ROUTE_AVAILABLE = 0x00,
NWK_FAILURE_TREE_LINK_FAILURE = 0x01,
NWK_FAILURE_NON_TREE_LINK_FAILURE = 0x02,
NWK_FAILURE_LOW_BATTERY_LEVEL = 0x03,
NWK_FAILURE_NO_ROUTING_CAPACITY = 0x04,
NWK_FAILURE_NO_INDIRECT_CAPACITY = 0x05,
NWK_FAILURE_INDIRECT_TRANSACTION_EXPIRITY = 0x06,
NWK_FAILURE_TARGET_DEVICE_UNVAILABLE = 0x07,
NWK_FAILURE_TARGET_ADDRESS_UNALLOCATED = 0x08,
NWK_FAILURE_PARENT_LINK_FAILURE = 0x09,
NWK_FAILURE_VALIDATE_ROUTE = 0x0A,
NWK_FAILURE_SOURCE_ROUTE_FAILURE = 0x0B,
NWK_FAILURE_MANY_TO_ONE_ROUTE_FAILURE = 0x0C,
NWK_FAILURE_ADDRESS_CONFLICT = 0x0D,
NWK_FAILURE_VERIFY_ADDRESSES = 0x0E,
NWK_FAILURE_PAN_IDENTIFIER_UPDATE = 0x0F,
NWK_FAILURE_NETWORK_ADDRESS_UPDATE = 0x10,
NWK_FAILURE_BAD_FRAME_COUNTER = 0x11,
NWK_FAILURE_BAD_KEY_SEQUENCE_NUMBER = 0x12,
} nwk_status_failure_t;
enum {
// NWK Layer Constants
nwkcCoordinatorCapable = NWK_PROFILE_nwkcCoordinatorCapable,//***
nwkcDefaultSecurityLevel = NWK_PROFILE_nwkcDefaultSecurityLevel,//***
nwkcDiscoveryRetryLimit = 0x03,
nwkcMinHeaderOverhead = 0x08,
nwkcProtocolVersion = 0x02,
nwkcWaitBeforeValidation = 0x500,
nwkcRouteDiscoveryTime = 0x2710,
nwkcMaxBroadcastJitter = 0x40,
nwkcInitialRREQRetries = 0x03,
nwkcRREQRetries = 0x02,
nwkcRREQRetryInterval = 0xFE,
nwkcMinRREQJitter = 0x01,
nwkcMaxRREQJitter = 0x40,
nwkcMACFrameOverhead = 0x0B
};
enum {
// NIB Attributes Ids
nwkPANId = 0x80,
nwkSequenceNumber = 0x81,
nwkPassiveAckTimeout = 0x82,
nwkMaxBroadcastRetries = 0x83,
nwkMaxChildren = 0x84,
nwkMaxDepth = 0x85,
nwkMaxRouters = 0x86,
nwkNeighborTable = 0x87,
nwkNetworkBroadcastDeliveryTime = 0x88,
nwkReportConstantCost = 0x89,
nwkRouteDiscoveryRetriesPermitted = 0x8A,
nwkRouteTable = 0x8B,
nwkTimeStamp = 0x8C,
nwkTxTotal = 0x8D,
nwkSymLink = 0x8E,
nwkCapabilityInformation = 0x8F,
nwkAddrAlloc = 0x90,
nwkUseTreeRouting = 0x91,
nwkManagerAddr = 0x92,
nwkMaxSourceRoute = 0x93,
nwkUpdateId = 0x94,
nwkTransactionPersistenceTime = 0x95,
nwkNetworkAddress = 0x96,
nwkStackProfile = 0x97,
nwkBroadcastTransactionTable = 0x98,
nwkGroupIDTable = 0x99,
nwkExtendedPANId = 0x9A,
nwkUseMulticast = 0x9B,
nwkRouteRecordTable = 0x9C,
nwkIsConcentrator = 0x9D,
nwkConcentratorRadius = 0x9E,
nwkConcentratorDiscoveryTime = 0x9F,
nwkSecurityLevel = 0xA0,
nwkSecurityMaterialSet = 0xA1,
nwkActiveKeySeqNumber = 0xA2,
nwkAllFresh = 0xA3,
nwkSecureAllFrames = 0xA5,
nwkLinkStatusPeriod = 0xA6,
nwkRouterAgeLimit = 0xA7,
nwkUniqueAddr = 0xA8,
nwkAddressMap = 0xA9
};
typedef enum nwk_device_type {
//NWK type of neighbor device
NWK_ZIGBEE_COORDINATOR = 0x00,
NWK_ZIGBEE_ROUTER = 0x01,
NWK_ZIGBEE_END_DEVICE = 0x02,
} nwk_device_type_t;
typedef enum nwk_relationship {
//NWK relationship between neighbor and device
NWK_NEIGHBOR_IS_PARENT = 0x00,
NWK_NEIGHBOR_IS_CHILD = 0x01,
NWK_NEIGHBOR_IS_SIBLING = 0x02,
NWK_NONE_OF_ABOVE = 0x03,
NWK_PREVIOUS_CHILD = 0x04,
NWK_UNAUNTHENTICATED_CHILD = 0x05,
} nwk_relationship_t;
/*
* Typedefs NIB value types
*/
typedef uint16_t nwkPANId_t;
typedef uint8_t nwkSequenceNumber_t;
typedef uint16_t nwkPassiveAckTimeout_t;
typedef uint8_t nwkMaxBroadcastRetries_t;
typedef uint8_t nwkMaxChildren_t;
typedef uint8_t nwkMaxDepth_t;
typedef uint8_t nwkMaxRouters_t;
typedef ieee154_CapabilityInformation_t nwkCapabilityInformation_t;
typedef struct {
bool used;
uint64_t ExtendedAddress;//Mandatory
uint16_t NetworkAddress;//Mandatory
nwk_device_type_t DeviceType;//Mandatory
bool RxOnWhenIdle;
nwk_relationship_t Relationship;//Mandatory
uint8_t TransmitFailure;//Mandatory
uint8_t LQI;//Mandatory
uint8_t OutgoingCost;//Mandatory if nwkSymLink == TRUE
uint8_t Age;//Mandatory if nwkSymLink == TRUE
// uint32_t IncomingBeaconTimestamp;//Optional
// uint32_t BeaconTransmissionTimeOffset;//Optional
//Additional Neighbor Table Fields
uint64_t ExtendedPANId;
uint8_t LogicalChannel;
uint8_t Depth;
uint8_t BeaconOrder;
bool PermitJoining;
uint8_t PotentialParent;
uint8_t StackProfile;
bool RouterCapacity;
bool EndDeviceCapacity;
uint8_t nwkUpdateId;
uint16_t PANId;
nwkCapabilityInformation_t CapabilityInfo;//has RxOnWhenIdle and DeviceType!
} nwkNeighborTable_t;//***
typedef uint8_t nwkNetworkBroadcastDeliveryTime_t;
typedef uint8_t nwkReportConstantCost_t;
typedef uint8_t nwkRouteDiscoveryRetriesPermitted_t;
typedef struct {
uint16_t DestinationAddress;
route_status_t Status;
bool NoRouteCache;
bool ManyToOne;
bool RouteRecordRequired;
bool GroupIDFlag;
uint8_t NextHopAddress;
} nwkRouteTable_t;//***
typedef bool nwkTimeStamp_t;
typedef uint16_t nwkTxTotal_t;
typedef bool nwkSymLink_t;
typedef uint8_t nwkAddrAlloc_t;
typedef bool nwkUseTreeRouting_t;
typedef uint16_t nwkManagerAddr_t;
typedef uint8_t nwkMaxSourceRoute_t;
typedef uint8_t nwkUpdateId_t;
typedef uint16_t nwkTransactionPersistenceTime_t;
typedef uint16_t nwkNetworkAddress_t;
typedef uint8_t nwkStackProfile_t;
typedef struct {
uint16_t SourceAddress;
uint8_t SequenceNumber;
uint8_t ExpirationTime;
} nwkBroadcastTransactionTable_t;//***
typedef uint16_t nwkGroupIDTable_t;//***
typedef uint64_t nwkExtendedPANId_t;
typedef bool nwkUseMulticast_t;
typedef struct {
uint16_t NetworkAddress;
uint16_t RelayCount;
uint16_t Path[NWK_ROUTE_TABLE_PATH_SIZE];
} nwkRouteRecordTable_t;//***
typedef bool nwkIsConcentrator_t;
typedef uint8_t nwkConcentratorRadius_t;
typedef uint8_t nwkConcentratorDiscoveryTime_t;
typedef enum {
None = 0x00,//No security implemented, always None-0x00
MIC_32 = 0x01,
MIC_64 = 0x02,
MIC_128 = 0x03,
ENC = 0x04,
ENC_MIC_32 = 0x05,
ENC_MIC_64 = 0x06,
ENC_MIC_128 = 0x07
} nwkSecurityLevel_t;//***// Security Attribute
//typedef uint8_t nwkSecurityMaterialSet_t;//***// Security Attribute
//typedef uint_t nwkActiveKeySeqNumber_t;//***// Security Attribute
//typedef uint_t nwkAllFresh_t;//***// Security Attribute
//typedef uint_t nwkSecureAllFrames_t;//*** Security Attribute
typedef uint8_t nwkLinkStatusPeriod_t;
typedef uint8_t nwkRouterAgeLimit_t;
typedef bool nwkUniqueAddr_t;
typedef struct {
uint64_t IeeeAddress64bit;
uint16_t NetworkAddress16bit;
} nwkAddressMap_t;//***
/*
* Network information base (NIB)
*/
typedef struct {
nwkPANId_t nwkPANId;
nwkSequenceNumber_t nwkSequenceNumber;
nwkPassiveAckTimeout_t nwkPassiveAckTimeout;
nwkMaxBroadcastRetries_t nwkMaxBroadcastRetries;
nwkMaxChildren_t nwkMaxChildren;
nwkMaxDepth_t nwkMaxDepth;
nwkMaxRouters_t nwkMaxRouters;
nwkNeighborTable_t nwkNeighborTable[NWK_NEIGHBOR_TABLE_SIZE];//***
nwkNetworkBroadcastDeliveryTime_t nwkNetworkBroadcastDeliveryTime;
nwkReportConstantCost_t nwkReportConstantCost;
nwkRouteDiscoveryRetriesPermitted_t nwkRouteDiscoveryRetriesPermitted;
nwkRouteTable_t nwkRouteTable[NWK_ROUTE_TABLE_SIZE];//***
nwkTimeStamp_t nwkTimeStamp;
nwkTxTotal_t nwkTxTotal;
nwkSymLink_t nwkSymLink;
nwkCapabilityInformation_t nwkCapabilityInformation;
nwkAddrAlloc_t nwkAddrAlloc;
nwkUseTreeRouting_t nwkUseTreeRouting;
nwkManagerAddr_t nwkManagerAddr;
nwkMaxSourceRoute_t nwkMaxSourceRoute;
nwkUpdateId_t nwkUpdateId;
nwkTransactionPersistenceTime_t nwkTransactionPersistenceTime;
nwkNetworkAddress_t nwkNetworkAddress;
nwkStackProfile_t nwkStackProfile;
nwkBroadcastTransactionTable_t nwkBroadcastTransactionTable[NWK_BROADCAST_TRANSACTION_TABLE_SIZE];//***
nwkGroupIDTable_t nwkGroupIDTable[NWK_GROUP_ID_TABLE_SIZE];//***
nwkExtendedPANId_t nwkExtendedPANId;
nwkUseMulticast_t nwkUseMulticast;
nwkRouteRecordTable_t nwkRouteRecordTable[NWK_ROUTE_RECORD_TABLE_SIZE];//***
nwkIsConcentrator_t nwkIsConcentrator;
nwkConcentratorRadius_t nwkConcentratorRadius;
nwkConcentratorDiscoveryTime_t nwkConcentratorDiscoveryTime;
nwkSecurityLevel_t nwkSecurityLevel;//***// Security Attribute
// nwkSecurityMaterialSet_t nwkSecurityMaterialSet;//***// Security Attribute
// nwkActiveKeySeqNumber_t nwkActiveKeySeqNumber;//***// Security Attribute
// nwkAllFresh_t nwkAllFresh;//***// Security Attribute
// nwkSecureAllFrames_t nwkSecureAllFrames;//***// Security Attribute
nwkLinkStatusPeriod_t nwkLinkStatusPeriod;
nwkRouterAgeLimit_t nwkRouterAgeLimit;
nwkUniqueAddr_t nwkUniqueAddr;
nwkAddressMap_t nwkAddressMap[NWK_ADDRESS_MAP_SIZE];//***
} NIB_t;
//NIB Defaults
#ifndef NWK_DEFAULT_nwkPANId
#define NWK_DEFAULT_nwkPANId 0xFFFF
#endif
// NWK_DEFAULT_nwkSequenceNumber = 0x81,
// NWK_DEFAULT_nwkPassiveAckTimeout = 0x82,
#ifndef NWK_DEFAULT_nwkMaxBroadcastRetries
#define NWK_DEFAULT_nwkMaxBroadcastRetries 0x03
#endif
// NWK_DEFAULT_nwkMaxChildren = 0x84,
// NWK_DEFAULT_nwkMaxDepth = 0x85,
// NWK_DEFAULT_nwkMaxRouters = 0x86,
#ifndef NWK_DEFAULT_nwkNeighborTable
#define NWK_DEFAULT_nwkNeighborTable NULL
#endif
// NWK_DEFAULT_nwkNetworkBroadcastDeliveryTime = 0x88,
#ifndef NWK_PROFILE_nwkNetworkBroadcastDeliveryTime
#define NWK_PROFILE_nwkNetworkBroadcastDeliveryTime (nwkNetworkBroadcastDeliveryTime_t)(2 * nib.nwkMaxDepth * ((0.05 + (nwkcMaxBroadcastJitter / 2)) + nib.nwkPassiveAckTimeout * nib.nwkMaxBroadcastRetries / 1000))
#endif
#ifndef NWK_DEFAULT_nwkReportConstantCost
#define NWK_DEFAULT_nwkReportConstantCost 0x00
#endif
#ifndef NWK_DEFAULT_nwkRouteDiscoveryRetriesPermitted
#define NWK_DEFAULT_nwkRouteDiscoveryRetriesPermitted nwkcDiscoveryRetryLimit
#endif
#ifndef NWK_DEFAULT_nwkRouteTable
#define NWK_DEFAULT_nwkRouteTable NULL
#endif
#ifndef NWK_DEFAULT_nwkTimeStamp
#define NWK_DEFAULT_nwkTimeStamp FALSE
#endif
#ifndef NWK_DEFAULT_nwkTxTotal
#define NWK_DEFAULT_nwkTxTotal 0
#endif
#ifndef NWK_DEFAULT_nwkSymLink
#define NWK_DEFAULT_nwkSymLink FALSE
#endif
#ifndef NWK_DEFAULT_nwkCapabilityInformation
#define NWK_DEFAULT_nwkCapabilityInformation 0x00
#endif
#ifndef NWK_DEFAULT_nwkAddrAlloc
#define NWK_DEFAULT_nwkAddrAlloc 0x00
#endif
#ifndef NWK_DEFAULT_nwkUseTreeRouting
#define NWK_DEFAULT_nwkUseTreeRouting TRUE
#endif
#ifndef NWK_DEFAULT_nwkManagerAddr
#define NWK_DEFAULT_nwkManagerAddr 0x0000
#endif
#ifndef NWK_DEFAULT_nwkMaxSourceRoute
#define NWK_DEFAULT_nwkMaxSourceRoute 0x0C
#endif
#ifndef NWK_DEFAULT_nwkUpdateId
#define NWK_DEFAULT_nwkUpdateId 0x00
#endif
#ifndef NWK_DEFAULT_nwkTransactionPersistenceTime
#define NWK_DEFAULT_nwkTransactionPersistenceTime 0x01F4
#endif
#ifndef NWK_DEFAULT_nwkNetworkAddress
#define NWK_DEFAULT_nwkNetworkAddress 0xFFFF
#endif
// NWK_DEFAULT_nwkStackProfile = 0x97,
#ifndef NWK_DEFAULT_nwkBroadcastTransactionTable
#define NWK_DEFAULT_nwkBroadcastTransactionTable NULL
#endif
#ifndef NWK_DEFAULT_nwkGroupIDTable
#define NWK_DEFAULT_nwkGroupIDTable NULL
#endif
#ifndef NWK_DEFAULT_nwkExtendedPANId
#define NWK_DEFAULT_nwkExtendedPANId 0x0000000000000000
#endif
#ifndef NWK_DEFAULT_nwkUseMulticast
#define NWK_DEFAULT_nwkUseMulticast TRUE
#endif
#ifndef NWK_DEFAULT_nwkRouteRecordTable
#define NWK_DEFAULT_nwkRouteRecordTable NULL
#endif
#ifndef NWK_DEFAULT_nwkIsConcentrator
#define NWK_DEFAULT_nwkIsConcentrator FALSE
#endif
#ifndef NWK_DEFAULT_nwkConcentratorRadius
#define NWK_DEFAULT_nwkConcentratorRadius 0x0000
#endif
#ifndef NWK_DEFAULT_nwkConcentratorDiscoveryTime
#define NWK_DEFAULT_nwkConcentratorDiscoveryTime 0x0000
#endif
#ifndef NWK_DEFAULT_nwkSecurityLevel
#define NWK_DEFAULT_nwkSecurityLevel 0x00
#endif
// NWK_DEFAULT_nwkSecurityMaterialSet = 0xA1,
// NWK_DEFAULT_nwkActiveKeySeqNumber = 0xA2,
// NWK_DEFAULT_nwkAllFresh = 0xA3,
// NWK_DEFAULT_nwkSecureAllFrames = 0xA5,
#ifndef NWK_DEFAULT_nwkLinkStatusPeriod
#define NWK_DEFAULT_nwkLinkStatusPeriod 0x0F
#endif
#ifndef NWK_DEFAULT_nwkRouterAgeLimit
#define NWK_DEFAULT_nwkRouterAgeLimit 3
#endif
#ifndef NWK_DEFAULT_nwkUniqueAddr
#define NWK_DEFAULT_nwkUniqueAddr TRUE
#endif
#ifndef NWK_DEFAULT_nwkAddressMap
#define NWK_DEFAULT_nwkAddressMap NULL
#endif
/**************************************************
* Zigbee Network Frame (NPDU)
**************************************************/
typedef nx_struct {
nxle_uint16_t FrameType :2;
nxle_uint16_t ProtocolVersion :4;
nxle_uint16_t DiscoverRoute :2;
nxle_uint16_t MulticastFlag :1;
nxle_uint16_t Security :1;
nxle_uint16_t SourceRoute :1;
nxle_uint16_t DestinationIEEEAddress :1;
nxle_uint16_t SourceIEEEAddress :1;
nxle_uint16_t Reserved :2;
} nwk_frameControlField;
typedef nx_struct nwk_header_common_t {
nwk_frameControlField FrameControl;
// nxle_uint16_t FrameControl;
nxle_uint16_t DestinationAddress;
nxle_uint16_t SourceAddress;
nxle_uint8_t Radius;
nxle_uint8_t SequenceNumber;
// 0 - nxle_uint64_t DestinationIEEEAddress;
// 0 - nxle_uint64_t SourceIEEEAddress;
// 0 - nxle_uint8_t MulticastControl;
// nxle_uint??_t SourceRouteSubframe;
} nwk_header_common_t;
typedef nx_struct {
nxle_uint8_t CommandIdentifier;
nx_struct {
nxle_uint8_t Reserved :5;
nxle_uint8_t Rejoin :1;
nxle_uint8_t Request :1;
nxle_uint8_t RemoveChildren :1;
} LeaveCommandOptionsField;
} nwk_frame_leave_t;
typedef nx_struct {
nxle_uint8_t CommandIdentifier;
nxle_uint16_t NetworkAddress;
nxle_uint8_t RejoinStatus;
} nwk_frame_rejoin_response;
enum {
NWK_FCF_FRAME_TYPE_MASK = 0x0003,
NWK_FCF_PROTOCOL_VERSION_MASK = 0x003C,
NWK_FCF_DISCOVER_ROUTE_MASK = 0x00C0,
NWK_FCF_MULTICAST_FLAG_MASK = 0x0100,
NWK_FCF_SECURITY_MASK = 0x0200,
NWK_FCF_SOURCE_ROUTE_MASK = 0x0400,
NWK_FCF_DESTINATION_IEEE_ADDRESS_MASK = 0x0800,
NWK_FCF_SOURCE_IEEE_ADDRESS_MASK = 0x1000,
NWK_FRAME_TYPE_DATA = 0x0,
NWK_FRAME_TYPE_COMMAND = 0x1,
NWK_DISCOVER_ROUTE_SUPRESS = 0x0,
NWK_DISCOVER_ROUTE_ENABLE = 0x1,
NWK_MCF_MULTICAST_MODE_MASK = 0x03,
NWK_MCF_NONMEMBERRADIUS_MASK = 0x1C,
NWK_MCF_MAXNONMEMBERRADIUS_MASK = 0xE0,
NWK_MULTICAST_MODE_NON_MEMBER_MODE = 0x0,
NWK_MULTICAST_MODE_MEMBER_MODE = 0x1,
};
typedef enum nwk_command_frame {
NWK_ROUTE_REQUEST = 0x01,
NWK_ROUTE_REPLY = 0x02,
NWK_NETWORK_STATUS = 0x03,
NWK_LEAVE = 0x04,
NWK_ROUTE_RECORD = 0x05,
NWK_REJOIN_REQUEST = 0x06,
NWK_REJOIN_RESPONSE = 0x07,
NWK_LINK_STATUS = 0x08,
NWK_NETWORK_REPORT = 0x09,
NWK_NETWORK_UPDATE = 0x0A,
} nwk_command_frame_t;
/**************************************************
* Zigbee Network Beacon Payload
**************************************************/
typedef nx_struct {
nxle_uint8_t ProtocolID :8;
nxle_uint8_t StackProfile :4;
nxle_uint8_t nwkcProtocolVersion :4;
nxle_uint8_t Reserved :2;
nxle_uint8_t RouterCapacity :1;
nxle_uint8_t DeviceDepth :4;
nxle_uint8_t EndDeviceCapacity :1;
nxle_uint64_t nwkExtendedPANId :64;
nxle_uint32_t TxOffset :24;
nxle_uint32_t nwkUpdateId :8;
} nwk_beacon_payload_t;
/*******************************************************
* Zigbee Network Descriptor for NLME_NETWORK_DISCOVERY
*******************************************************/
typedef struct {
uint64_t ExtendedPANId;
uint8_t LogicalChannel;
uint8_t StackProfile;
uint8_t ZigBeeVersion;
uint8_t BeaconOrder;
uint8_t SuperframeOrder;
bool PermitJoining;
bool RouterCapacity;
bool EndDeviceCapacity;
} nwk_NetworkDescriptor_t;
/*
* Disabled TKN154 services, we do not need them
*/
#define IEEE154_DISASSOCIATION_DISABLED
#endif // NWK_H
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/telos/nodequeue.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef NODE_Q_H_INCLUDED
#define NODE_Q_H_INCLUDED
/**************************
* The queues in the run time system represent pending
* incoming edges in the graph.
**************************/
#define QUEUE_DELAY 3
#define QUEUE_LENGTH 30
#define NEXT_IDX(X) ((X + 1) % QUEUE_LENGTH)
typedef struct EdgeIn
{
uint16_t node_id; //This limits the number of nodes to 2^16.
uint8_t **invar;
uint8_t **outvar;
} EdgeIn;
typedef struct EdgeQueue
{
uint16_t head, tail;
uint16_t lock;
EdgeIn edges[QUEUE_LENGTH];
} EdgeQueue;
bool
lockqueue (EdgeQueue * q)
{
bool gotset = FALSE;
atomic
{
if (q->lock == FALSE)
{
gotset = TRUE;
q->lock = TRUE;
}
} //atomic
return gotset;
}
bool
unlockqueue (EdgeQueue * q)
{
if (q->lock == FALSE)
{
return FALSE;
}
q->lock = TRUE;
return TRUE;
}
result_t
queue_init (EdgeQueue * q)
{
atomic
{
q->head = 0;
q->tail = 0;
}
return SUCCESS;
}
bool
isqueueempty (EdgeQueue * q)
{
return (q->tail == q->head);
}
bool
enqueue (EdgeQueue * q, EdgeIn edge)
{
bool result = FALSE;
atomic
{
if (NEXT_IDX (q->tail) == q->head)
{
//queue is full
result = FALSE;
}
else
{
memcpy (&q->edges[q->tail], &edge, sizeof (EdgeIn));
q->tail = NEXT_IDX (q->tail);
result = TRUE;
}
} //atomic
return result;
}
bool
dequeue (EdgeQueue * q, EdgeIn * edge)
{
bool result = FALSE;
atomic
{
if (q->tail == q->head)
{
//queue is empty
result = FALSE;
}
else
{
memcpy (edge, &q->edges[q->head], sizeof (EdgeIn));
q->head = NEXT_IDX (q->head);
result = TRUE;
}
} //atomic
return result;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/include/inttypes.h | /**
* @author <NAME>
* @author <NAME>
*/
#ifndef _INTTYPES_H
#define _INTTYPES_H 1
#include <stdtypes.h>
#ifndef __uint8_t_defined
#define __uint8_t_defined
// typedef Byte uint8_t;
typedef unsigned char uint8_t;
#endif
#ifndef __int8_t_defined
#define __int8_t_defined
// typedef sByte int8_t;
typedef signed char int8_t;
#endif
#ifndef __uint16_t_defined
#define __uint16_t_defined
// typedef Word uint16_t;
typedef unsigned short uint16_t;
#endif
#ifndef __int16_t_defined
#define __int16_t_defined
// typedef sWord int16_t;
typedef signed short int16_t;
#endif
// hc08 CW _always_ assume size_t is unsigned int
typedef unsigned int size_t;
#ifndef __uint32_t_defined
#define __uint32_t_defined
// #warning uint32_t defined to LWord
// typedef LWord uint32_t;
typedef unsigned long uint32_t;
#endif
#ifndef __int32_t_defined
#define __int32_t_defined
// typedef sLWord int32_t;
typedef signed long int32_t;
#endif
#ifndef __uint64_t_defined
#define __uint64_t_defined
#warning uint64_t defined to unsigned long long
typedef unsigned long long uint64_t;
#endif
#ifndef __int64_t_defined
#define __int64_t_defined
#warning int64_t defined to signed long long
typedef signed long long int64_t;
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | tub/apps/PacketSniffer_802_15_4/wiresharkPlugins/802_15_4/plugin.c | /* Do not modify this file. */
/* It is created automatically by the Makefile. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gmodule.h>
#include "moduleinfo.h"
#ifndef ENABLE_STATIC
G_MODULE_EXPORT const gchar version[] = VERSION;
/* Start the functions we need for the plugin stuff */
G_MODULE_EXPORT void
plugin_register (void)
{
{extern void proto_register_802_15_4 (void); proto_register_802_15_4 ();}
}
G_MODULE_EXPORT void
plugin_reg_handoff(void)
{
{extern void proto_reg_handoff_802_15_4 (void); proto_reg_handoff_802_15_4 ();}
}
#endif
|
tinyos-io/tinyos-3.x-contrib | gems/ttsp/tinyos/apps/ReferenceBroadcaster/ReferenceBroadcaster.h | <filename>gems/ttsp/tinyos/apps/ReferenceBroadcaster/ReferenceBroadcaster.h
#ifndef REFBROADCAST_H
#define REFBROADCAST_H
typedef nx_struct ReferenceMsg {
nx_uint16_t srcAddr;
nx_uint32_t refTimestamp;
nx_uint32_t refId;
} ReferenceMsg_t;
enum {
AM_REFERENCEMSG = 180
};
#endif |
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/lib/tossim/sim_noise.h | <reponame>tinyos-io/tinyos-3.x-contrib
/*
* "Copyright (c) 2005 Stanford 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 STANFORD 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 STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD 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 STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* Implementation of all of the SNIST primitives and utility
* functions.
*
* @author <NAME>
* @date Oct 13 2006
*/
// $Id: sim_noise.h,v 1.1 2014/11/26 19:31:35 carbajor Exp $
#ifndef _SIM_NOISE_HASH_H_
#define _SIM_NOISE_HASH_H_
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
NOISE_MIN = -115,
NOISE_MAX = -5,
NOISE_MIN_QUANTIZE = -115,
NOISE_QUANTIZE_INTERVAL = 5,
NOISE_BIN_SIZE = (NOISE_MAX - NOISE_MIN)/NOISE_QUANTIZE_INTERVAL,
NOISE_HISTORY = 20,
NOISE_DEFAULT_ELEMENT_SIZE = 8,
NOISE_HASHTABLE_SIZE = 128,
NOISE_MIN_TRACE = 128,
};
typedef struct sim_noise_hash_t {
char key[NOISE_HISTORY];
int numElements;
int size;
char *elements;
char flag;
float dist[NOISE_BIN_SIZE];
} sim_noise_hash_t;
typedef struct sim_noise_node_t {
char key[NOISE_HISTORY];
char freqKey[NOISE_HISTORY];
char lastNoiseVal;
uint32_t noiseGenTime;
struct hashtable *noiseTable;
char* noiseTrace;
uint32_t noiseTraceLen;
uint32_t noiseTraceIndex;
bool generated;
} sim_noise_node_t;
void sim_noise_init();
char sim_real_noise(uint16_t node_id, uint32_t cur_t);
char sim_noise_generate(uint16_t node_id, uint32_t cur_t);
void sim_noise_trace_add(uint16_t node_id, char val);
void sim_noise_create_model(uint16_t node_id);
#ifdef __cplusplus
}
#endif
#endif // _SIM_NOISE_HASH_H_
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/client/client.c | //#include "../mImpl.h"
//#include "rt_intercomm.h"
#include "sfaccess/telossource.h"
#include "sfaccess/teloscomm.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <time.h>
#define AM_REQUESTMSG 0x14
#define AM_REDIRECTMSG 0x15
#define AM_METAMSG 0x16
#define AM_DATAMSG 0x17
#define AM_DATAACK 0x18
#define MYADDR 2
int waitforfd(int fd, int seconds)
{
fd_set rfds;
struct timeval tv;
int retval;
/* Watch stdin (fd 0) to see when it has input. */
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
/* Wait up to five seconds. */
tv.tv_sec = seconds;
tv.tv_usec = 0;
retval = select(fd+1, &rfds, NULL, NULL, &tv);
return retval;
}
void dump_packet(telospacket *packet)
{
int i=0;
fprintf(stderr,"dumping packet...\n");
fprintf(stderr,"\tlength=%i\n", packet->length);
fprintf(stderr,"\taddr=%X\n", packet->addr);
for (i=0; i < packet->length; i++)
{
fprintf(stderr,"%X ", packet->data[i]);
}
fprintf(stderr,"\ndump done.\n");
}
telospacket *getMyPacket(int fd, uint16_t src, uint16_t suid)
{
telospacket *recvpacket;
int mine = 0;
uint16_t puid;
while (!mine)
{
if (!waitforfd(fd, 3))
{
fprintf(stderr,"Error! timeout\n");
exit(1);
}
recvpacket = read_telos_packet(fd);
if (recvpacket == NULL)
{
fprintf(stderr,"Error! Read error.\n");
exit(1);
}
ntoh_uint16(recvpacket->data+2, &puid);
fprintf(stderr,"Got packet (suid=%X, puid=%X)\n", suid, puid);
dump_packet(recvpacket);
if (puid == suid)
{
mine = 1;
} else {
free_telos_packet(&recvpacket);
}
}
return recvpacket;
}
int main(int argc, char **argv)
{
int port;
uint16_t rport;
int moteaddr;
char *url;
char *ipaddr;
int result;
int connid;
char redirect = 0;
uint32_t datalength;
int index;
char data;
int telosfd;
uint16_t suid;
uint8_t dsn=0;
uint16_t srcaddr = MYADDR;
int connectcount;
int sockfd, n;
struct sockaddr_in serv_addr;
struct hostent *server;
telospacket packet;
telospacket *recvpacket;
uint8_t buf[28]; //MSG_SIZE
if (argc != 5)
{
fprintf(stderr,"Usage: client <sf port> <mote address> <ipaddr> <object>\n");
fprintf(stderr,"Example: client 9001 2 172.16.31.10 movies/film.mpg\n\n");
exit(1);
}
port = atoi(argv[1]);
moteaddr = atoi(argv[2]);
ipaddr = argv[3];
url = argv[4];
telosfd = open_telos_source("localhost",port);
if (telosfd < 0)
{
fprintf(stderr,"Error! Could not open telos connection on port:%i\n",port);
exit(2);
}
srand(time(NULL));
suid = rand();
packet.type = AM_REQUESTMSG;
packet.addr = moteaddr;
packet.length = 60;
packet.data = buf;
bzero(buf,sizeof(buf));
hton_uint16(buf, srcaddr);
hton_uint16(buf+2, suid);
memcpy(buf+4, url, strlen(url));
fprintf(stderr, "Sending %s\n",url);
result = write_telos_packet(telosfd, &packet);
if (result < 0)
{
fprintf(stderr,"Error! Send get failed\n");
exit(1);
}
recvpacket = getMyPacket(telosfd, srcaddr, suid);
if (recvpacket->type == AM_METAMSG)
{
free_telos_packet(&recvpacket);
close(telosfd);
fprintf(stderr,"Error! File not found.\n");
exit(1);
}
if (recvpacket->type == AM_REDIRECTMSG)
{
ntoh_uint16(recvpacket->data+4, &rport);
free_telos_packet(&recvpacket);
close(telosfd);
//get on 802.11
//read port
printf("rport=%i\n",rport);
//sleep(8);
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
fprintf(stderr,"Error! Can't create socket.\n");
exit(1);
}
server = gethostbyname(argv[3]);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
printf("Host: %s\n",server->h_name);
printf("Type: %i\n",server->h_addrtype);
printf("length: %i\n",server->h_length);
printf("h_addr: %s\n",server->h_addr_list[0]);
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(rport);
connectcount = 0;
result = 0;
while (connectcount < 20)
{
usleep(500000);
result = connect(sockfd,&serv_addr,sizeof(serv_addr));
if (result == 0)
{
break;
} else {
connectcount++;
printf(".");
}
}
if (result < 0)
{
fprintf(stderr,"ERROR, connect failed(%X)\n", serv_addr.sin_addr.s_addr);
exit(1);
}
n = 1;
while (n > 0)
{
n = read(sockfd,&data,1);
if (n < 0)
{
fprintf(stderr,"ERROR, read error\n");
exit(1);
}
printf("%c",data);
}
close(sockfd);
return 0;
} //redirect
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | diku/mcs51/tos/chips/mcs51/unistd.h | /*
* Dummy to prevent inclution of system includes (that Keil don't like)
*/
|
tinyos-io/tinyos-3.x-contrib | ethz/nodule/tos/platforms/atevk1101/platform.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>ethz/nodule/tos/platforms/atevk1101/platform.h<gh_stars>0
/* $Id: platform.h,v 1.1 2007/12/05 18:08:29 yuecelm Exp $ */
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/linuxsim/energymgr.c | <reponame>tinyos-io/tinyos-3.x-contrib<filename>eon/eon/src/runtime/linuxsim/energymgr.c
#include <pthread.h>
#include "simworld.h"
#include "energymgr.h"
#include "../mNodes.h"
#include <stdint.h>
#define MAX_PATHS 10
typedef struct p_ent
{
int valid;
unsigned int session;
unsigned int pathid;
unsigned int energy; //uJ
int done;
} p_ent;
int pcount = 0;
int idle_uW=0;
p_ent __paths[MAX_PATHS];
int64_t __battery_energy=0;
int64_t __battery_capacity=0;
unsigned int __path_costs[NUMPATHS];
unsigned int __path_count[NUMPATHS];
unsigned int __path_pred_count[NUMPATHS][NUMSTATES];
pthread_mutex_t __p_mutex = PTHREAD_MUTEX_INITIALIZER;
int count_since_eval=0;
void plock()
{
pthread_mutex_lock(&__p_mutex);
}
void punlock()
{
pthread_mutex_unlock(&__p_mutex);
}
int doewma(int oldv, int newv, int num, int den)
{
int retval;
retval = ((oldv * (den-num)) + (newv * num))/den;
return retval;
}
int doeval()
{
energy_evaluation_struct_t * eval;
plock();
eval = reevaluate_energy_level(__battery_energy,__battery_capacity);
curstate = eval->energy_state;
curgrade = eval->state_grade;
free(eval);
punlock();
}
void energy_callback(int uJin, int uJout, unsigned int battery)
{
int idle_share;
int p_share;
int p_ind;
int i;
plock();
__battery_energy = battery;
if (pcount == 0)
{
//idle all
idle_share =uJout;
} else {
idle_share = idle_uW*ENERGY_TIME;
if (idle_share > uJout)
{
idle_share = uJout;
p_share = 0;
} else {
p_share = uJout - idle_share;
}
}
p_ind = (p_share / pcount)+1;
idle_uW = doewma(idle_uW, idle_share/ENERGY_TIME, 3,10);
for (i=0; i < MAX_PATHS; i++)
{
if (__paths[i].valid)
{
__paths[i].energy += p_ind;
if (__paths[i].done)
{
//factor path cost
__path_costs[__paths[i].pathid] = doewma(__path_costs[__paths[i].pathid], __paths[i].energy, 3,10);
__paths[i].valid = 0;
}
}
}
count_since_eval++;
punlock();
if (count_since_eval > EVAL_COUNT)
{
//signal eval.
doeval();
}
}
void start_path(unsigned int session)
{
int i;
plock();
for (i=0; i < MAX_PATHS; i++)
{
if (__paths[i].valid==0)
{
__paths[i].valid = 1;
__paths[i].session = session;
__paths[i].energy=0;
__paths[i].done = 0;
__paths[i].pathid=0;
break;
}
}
punlock();
}
void end_path(unsigned int session, unsigned int pathid)
{
int i;
plock();
__path_count[pathid]++;
for (i=0; i < MAX_PATHS; i++)
{
if (__paths[i].valid==1 && __paths[i].session==session)
{
__paths[i].done = 1;
__paths[i].pathid=pathid;
break;
}
}
punlock();
}
void start_energy_mgr()
{
set_energy_callback(energy_callback);
__battery_capacity = get_battery_size();
}
|
tinyos-io/tinyos-3.x-contrib | uob/tossdr/tos/lib/tossdr/sim_event_queue.h | // $Id: sim_event_queue.h,v 1.3 2010/03/26 15:17:01 mab-cn Exp $
/*
* "Copyright (c) 2005 Stanford 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 STANFORD 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 STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD 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 STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* The event queue is the core of the mote side of TOSSIM. It is a
* wrapper around the underlying heap. Unlike the 1.x version, it is
* not re-entrant: merging the Python console and TOSSIM means that
* functionality like packet injection/reception from external tools
* is on the Python side.
*
* @author <NAME>
* @date November 22 2005
*/
#ifndef SIM_EVENT_QUEUE_H_INCLUDED
#define SIM_EVENT_QUEUE_H_INCLUDED
#include <sim_tossdr.h>
struct sim_event;
typedef struct sim_event sim_event_t;
struct sim_event {
sim_time_t time;
unsigned long mote;
bool force; // Whether this event type should always be executed
// even if a mote is "turned off"
bool cancelled; // Whether this event has been cancelled
void* data;
void (*handle)(sim_event_t* e);
void (*cleanup)(sim_event_t* e);
};
sim_event_t* sim_queue_allocate_event();
void sim_queue_init();
void sim_queue_insert(sim_event_t* event);
bool sim_queue_is_empty();
long long int sim_queue_peek_time();
sim_event_t* sim_queue_pop();
void sim_queue_cleanup_none(sim_event_t* e);
void sim_queue_cleanup_event(sim_event_t* e);
void sim_queue_cleanup_data(sim_event_t* e) ;
void sim_queue_cleanup_total(sim_event_t* e);
#endif // EVENT_QUEUE_H_INCLUDED
|
tinyos-io/tinyos-3.x-contrib | berkeley/blip-2.0/support/sdk/c/blip/lib6lowpan/tests/test_unpack_address.c | <gh_stars>1-10
#include <stdint.h>
#include <stdio.h>
#include "Ieee154.h"
#include "ip.h"
#include "lib6lowpan.h"
#include "nwbyte.h"
#include "6lowpan.h"
uint8_t *unpack_address(struct in6_addr *addr, uint8_t dispatch,
int context, uint8_t *buf,
ieee154_addr_t *frame, ieee154_panid_t pan);
struct {
char *prefix;
uint8_t pfx_len;
} prefix_options[] = {
{"2002::", 64},
{"fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b", 128},
};
int lowpan_extern_read_context(struct in6_addr *addr, int context) {
struct in6_addr ctx;
inet_pton6(prefix_options[context].prefix, &ctx);
memcpy(addr->s6_addr, ctx.s6_addr, prefix_options[context].pfx_len / 8);
}
struct {
char *address;
int dispatch;
int context;
int len;
char buf[32];
char *l2addr;
ieee154_panid_t panid;
} test_cases[] = {
// context-free tests
{"fe80::1", LOWPAN_IPHC_AM_16, 0, 2, {0, 1}, "1", 1},
{"fe80::ffff", LOWPAN_IPHC_AM_16, 0, 2, {0xff, 0xff}, "1", 1},
{"fe80::abde:f012", LOWPAN_IPHC_AM_64, 0, 8, {0, 0, 0, 0, 0xab, 0xde, 0xf0, 0x12}, "1", 1},
{"fe80::1234:8765:abde:f012", LOWPAN_IPHC_AM_64, 0, 8, {0x12, 0x34, 0x87, 0x65, 0xab, 0xde, 0xf0, 0x12}, "1", 1},
{"fe80:1234:8765:abde:1234:8765:abde:f012", LOWPAN_IPHC_AM_128, 0, 16,
{0xfe, 0x80, 0x12, 0x34, 0x87, 0x65, 0xab, 0xde, 0x12, 0x34, 0x87, 0x65, 0xab, 0xde, 0xf0, 0x12}, "1", 1},
// derived from the MAC address
{"fe80::1234:8765:abde:f012", LOWPAN_IPHC_AM_0, 0, 0, {}, "12:34:87:65:ab:de:f0:12", 1},
// RFC4944-style addresses
{"fe80::1:00ff:fe00:25", LOWPAN_IPHC_AM_0, 0, 0, {}, "25", 1},
{"fe80::ffff:00ff:fe00:abcd", LOWPAN_IPHC_AM_0, 0, 0, {}, "abcd", 0xffff},
// tests using context
{"fc00:e968:6179::de52:7100", LOWPAN_IPHC_AC_CONTEXT | LOWPAN_IPHC_AM_16, 0, 2, {0, 0x12}, "1", 1},
{"fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b", LOWPAN_IPHC_AC_CONTEXT | LOWPAN_IPHC_AM_0, 1, 0, {}, "1", 1},
{"fdf8:f53e:61e4::18:5:6:7", LOWPAN_IPHC_AC_CONTEXT | LOWPAN_IPHC_AM_64, 0, 8, {0,4,0,5,0,6,0,7}, "1", 1},
{"::", LOWPAN_IPHC_AC_CONTEXT | LOWPAN_IPHC_AM_128, 0, 0, {}, "1", 1},
};
int run_tests() {
int i;
int success = 0, total = 0;
for (i = 0; i < (sizeof(test_cases) / sizeof(test_cases[0])); i++) {
struct in6_addr addr, correct;
uint8_t buf[512];
char *rv;
ieee154_addr_t l2addr;
total++;
inet_pton6(test_cases[i].address, &correct);
ieee154_parse(test_cases[i].l2addr, &l2addr);
ieee154_print(&l2addr, buf, 512);
printf("%s\n", buf);
printf("in6_addr: %s\n", test_cases[i].address);
rv = unpack_address(&addr, test_cases[i].dispatch, test_cases[i].context,
test_cases[i].buf, &l2addr, test_cases[i].panid);
inet_ntop6(&addr, buf, 512);
printf("result: %s length: %li\n", buf, rv - test_cases[i].buf);
if (test_cases[i].len != rv - test_cases[i].buf)
continue;
if (memcmp(&addr, &correct, 16) != 0)
continue;
success++;
}
printf("%s: %i/%i tests succeeded\n", __FILE__, success, total);
if (success == total) return 0;
return 1;
}
int main() {
return run_tests();
}
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/include/stdio.h | <reponame>tinyos-io/tinyos-3.x-contrib
/** Dummy header to avoid inclusion of the standard library header **/
#ifndef _STRING_H_
#define _STRING_H_
#endif
|
tinyos-io/tinyos-3.x-contrib | dexma/tos/chips/tmp102/TMP102.h | #ifndef TMP102_H
#define TMP102_H
#define TMP102_ADDRESS 0x48
#define TMP102_TEMPREG 0x00
#define TMP_READ_TMP 1
#endif |
tinyos-io/tinyos-3.x-contrib | uob/tossdr/ucla/gnuradio-802.15.4-demodulation/sos/config/pong/pong_app.c | <gh_stars>1-10
#include <sos.h>
/**
* Must also include the header file that defines the
* pong_get_header() function.
*/
mod_header_ptr pong_get_header();
mod_header_ptr loader_get_header();
/**
* application start
* This function is called once at the end od SOS initialization
*/
void sos_start(void)
{
ker_register_module(pong_get_header());
ker_register_module(loader_get_header());
}
|
tinyos-io/tinyos-3.x-contrib | kth/tkn154-gts-mod/apps/beacon-enabled/TestNetworkManager/app_profile.h | #ifndef __APP_PROFILE_H
#define __APP_PROFILE_H
enum {
RADIO_CHANNEL = 0x10,
PAN_ID = 0x1234,
COORDINATOR_ADDRESS = 0x0000,
BEACON_ORDER = 6,
SUPERFRAME_ORDER = 4,
TX_POWER_BEACON = 0,
TX_POWER = -20, // in dBm
};
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/util/lzss-c/lzari.c | <gh_stars>1-10
/**************************************************************
LZARI.C -- A Data Compression Program
(tab = 4 spaces)
***************************************************************
4/7/1989 <NAME>
Use, distribute, and modify this program freely.
Please send me your improved versions.
PC-VAN SCIENCE
NIFTY-Serve PAF01022
CompuServe 74050,1022
**************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/********** Bit I/O **********/
FILE *infile, *outfile;
unsigned long int textsize = 0, codesize = 0, printcount = 0;
void Error(char *message)
{
printf("\n%s\n", message);
exit(EXIT_FAILURE);
}
void PutBit(int bit) /* Output one bit (bit = 0,1) */
{
static unsigned int buffer = 0, mask = 128;
if (bit) buffer |= mask;
if ((mask >>= 1) == 0) {
if (putc(buffer, outfile) == EOF) Error("Write Error");
buffer = 0; mask = 128; codesize++;
}
}
void FlushBitBuffer(void) /* Send remaining bits */
{
int i;
for (i = 0; i < 7; i++) PutBit(0);
}
int GetBit(void) /* Get one bit (0 or 1) */
{
static unsigned int buffer, mask = 0;
if ((mask >>= 1) == 0) {
buffer = getc(infile); mask = 128;
}
return ((buffer & mask) != 0);
}
/********** LZSS with multiple binary trees **********/
#define N 4096 /* size of ring buffer */
#define F 60 /* upper limit for match_length */
#define THRESHOLD 2 /* encode string into position and length
if match_length is greater than this */
#define NIL N /* index for root of binary search trees */
unsigned char text_buf[N + F - 1]; /* ring buffer of size N,
with extra F-1 bytes to facilitate string comparison */
int match_position, match_length, /* of longest match. These are
set by the InsertNode() procedure. */
lson[N + 1], rson[N + 257], dad[N + 1]; /* left & right children &
parents -- These constitute binary search trees. */
void InitTree(void) /* Initialize trees */
{
int i;
/* For i = 0 to N - 1, rson[i] and lson[i] will be the right and
left children of node i. These nodes need not be initialized.
Also, dad[i] is the parent of node i. These are initialized to
NIL (= N), which stands for 'not used.'
For i = 0 to 255, rson[N + i + 1] is the root of the tree
for strings that begin with character i. These are initialized
to NIL. Note there are 256 trees. */
for (i = N + 1; i <= N + 256; i++) rson[i] = NIL; /* root */
for (i = 0; i < N; i++) dad[i] = NIL; /* node */
}
void InsertNode(int r)
/* Inserts string of length F, text_buf[r..r+F-1], into one of the
trees (text_buf[r]'th tree) and returns the longest-match position
and length via the global variables match_position and match_length.
If match_length = F, then removes the old node in favor of the new
one, because the old one will be deleted sooner.
Note r plays double role, as tree node and position in buffer. */
{
int i, p, cmp, temp;
unsigned char *key;
cmp = 1; key = &text_buf[r]; p = N + 1 + key[0];
rson[r] = lson[r] = NIL; match_length = 0;
for ( ; ; ) {
if (cmp >= 0) {
if (rson[p] != NIL) p = rson[p];
else { rson[p] = r; dad[r] = p; return; }
} else {
if (lson[p] != NIL) p = lson[p];
else { lson[p] = r; dad[r] = p; return; }
}
for (i = 1; i < F; i++)
if ((cmp = key[i] - text_buf[p + i]) != 0) break;
if (i > THRESHOLD) {
if (i > match_length) {
match_position = (r - p) & (N - 1);
if ((match_length = i) >= F) break;
} else if (i == match_length) {
if ((temp = (r - p) & (N - 1)) < match_position)
match_position = temp;
}
}
}
dad[r] = dad[p]; lson[r] = lson[p]; rson[r] = rson[p];
dad[lson[p]] = r; dad[rson[p]] = r;
if (rson[dad[p]] == p) rson[dad[p]] = r;
else lson[dad[p]] = r;
dad[p] = NIL; /* remove p */
}
void DeleteNode(int p) /* Delete node p from tree */
{
int q;
if (dad[p] == NIL) return; /* not in tree */
if (rson[p] == NIL) q = lson[p];
else if (lson[p] == NIL) q = rson[p];
else {
q = lson[p];
if (rson[q] != NIL) {
do { q = rson[q]; } while (rson[q] != NIL);
rson[dad[q]] = lson[q]; dad[lson[q]] = dad[q];
lson[q] = lson[p]; dad[lson[p]] = q;
}
rson[q] = rson[p]; dad[rson[p]] = q;
}
dad[q] = dad[p];
if (rson[dad[p]] == p) rson[dad[p]] = q;
else lson[dad[p]] = q;
dad[p] = NIL;
}
/********** Arithmetic Compression **********/
/* If you are not familiar with arithmetic compression, you should read
<NAME>, <NAME>, and <NAME>,
Communications of the ACM, Vol. 30, pp. 520-540 (1987),
from which much have been borrowed. */
#define M 15
/* Q1 (= 2 to the M) must be sufficiently large, but not so
large as the unsigned long 4 * Q1 * (Q1 - 1) overflows. */
#define Q1 (1UL << M)
#define Q2 (2 * Q1)
#define Q3 (3 * Q1)
#define Q4 (4 * Q1)
#define MAX_CUM (Q1 - 1)
#define N_CHAR (256 - THRESHOLD + F)
/* character code = 0, 1, ..., N_CHAR - 1 */
unsigned long int low = 0, high = Q4, value = 0;
int shifts = 0; /* counts for magnifying low and high around Q2 */
int char_to_sym[N_CHAR], sym_to_char[N_CHAR + 1];
unsigned int
sym_freq[N_CHAR + 1], /* frequency for symbols */
sym_cum[N_CHAR + 1], /* cumulative freq for symbols */
position_cum[N + 1]; /* cumulative freq for positions */
void StartModel(void) /* Initialize model */
{
int ch, sym, i;
sym_cum[N_CHAR] = 0;
for (sym = N_CHAR; sym >= 1; sym--) {
ch = sym - 1;
char_to_sym[ch] = sym; sym_to_char[sym] = ch;
sym_freq[sym] = 1;
sym_cum[sym - 1] = sym_cum[sym] + sym_freq[sym];
}
sym_freq[0] = 0; /* sentinel (!= sym_freq[1]) */
position_cum[N] = 0;
for (i = N; i >= 1; i--)
position_cum[i - 1] = position_cum[i] + 10000 / (i + 200);
/* empirical distribution function (quite tentative) */
/* Please devise a better mechanism! */
}
void UpdateModel(int sym)
{
int i, c, ch_i, ch_sym;
if (sym_cum[0] >= MAX_CUM) {
c = 0;
for (i = N_CHAR; i > 0; i--) {
sym_cum[i] = c;
c += (sym_freq[i] = (sym_freq[i] + 1) >> 1);
}
sym_cum[0] = c;
}
for (i = sym; sym_freq[i] == sym_freq[i - 1]; i--) ;
if (i < sym) {
ch_i = sym_to_char[i]; ch_sym = sym_to_char[sym];
sym_to_char[i] = ch_sym; sym_to_char[sym] = ch_i;
char_to_sym[ch_i] = sym; char_to_sym[ch_sym] = i;
}
sym_freq[i]++;
while (--i >= 0) sym_cum[i]++;
}
static void Output(int bit) /* Output 1 bit, followed by its complements */
{
PutBit(bit);
for ( ; shifts > 0; shifts--) PutBit(! bit);
}
void EncodeChar(int ch)
{
int sym;
unsigned long int range;
sym = char_to_sym[ch];
range = high - low;
high = low + (range * sym_cum[sym - 1]) / sym_cum[0];
low += (range * sym_cum[sym ]) / sym_cum[0];
for ( ; ; ) {
if (high <= Q2) Output(0);
else if (low >= Q2) {
Output(1); low -= Q2; high -= Q2;
} else if (low >= Q1 && high <= Q3) {
shifts++; low -= Q1; high -= Q1;
} else break;
low += low; high += high;
}
UpdateModel(sym);
}
void EncodePosition(int position)
{
unsigned long int range;
range = high - low;
high = low + (range * position_cum[position ]) / position_cum[0];
low += (range * position_cum[position + 1]) / position_cum[0];
for ( ; ; ) {
if (high <= Q2) Output(0);
else if (low >= Q2) {
Output(1); low -= Q2; high -= Q2;
} else if (low >= Q1 && high <= Q3) {
shifts++; low -= Q1; high -= Q1;
} else break;
low += low; high += high;
}
}
void EncodeEnd(void)
{
shifts++;
if (low < Q1) Output(0); else Output(1);
FlushBitBuffer(); /* flush bits remaining in buffer */
}
int BinarySearchSym(unsigned int x)
/* 1 if x >= sym_cum[1],
N_CHAR if sym_cum[N_CHAR] > x,
i such that sym_cum[i - 1] > x >= sym_cum[i] otherwise */
{
int i, j, k;
i = 1; j = N_CHAR;
while (i < j) {
k = (i + j) / 2;
if (sym_cum[k] > x) i = k + 1; else j = k;
}
return i;
}
int BinarySearchPos(unsigned int x)
/* 0 if x >= position_cum[1],
N - 1 if position_cum[N] > x,
i such that position_cum[i] > x >= position_cum[i + 1] otherwise */
{
int i, j, k;
i = 1; j = N;
while (i < j) {
k = (i + j) / 2;
if (position_cum[k] > x) i = k + 1; else j = k;
}
return i - 1;
}
void StartDecode(void)
{
int i;
for (i = 0; i < M + 2; i++)
value = 2 * value + GetBit();
}
int DecodeChar(void)
{
int sym, ch;
unsigned long int range;
range = high - low;
sym = BinarySearchSym((unsigned int)
(((value - low + 1) * sym_cum[0] - 1) / range));
high = low + (range * sym_cum[sym - 1]) / sym_cum[0];
low += (range * sym_cum[sym ]) / sym_cum[0];
for ( ; ; ) {
if (low >= Q2) {
value -= Q2; low -= Q2; high -= Q2;
} else if (low >= Q1 && high <= Q3) {
value -= Q1; low -= Q1; high -= Q1;
} else if (high > Q2) break;
low += low; high += high;
value = 2 * value + GetBit();
}
ch = sym_to_char[sym];
UpdateModel(sym);
return ch;
}
int DecodePosition(void)
{
int position;
unsigned long int range;
range = high - low;
position = BinarySearchPos((unsigned int)
(((value - low + 1) * position_cum[0] - 1) / range));
high = low + (range * position_cum[position ]) / position_cum[0];
low += (range * position_cum[position + 1]) / position_cum[0];
for ( ; ; ) {
if (low >= Q2) {
value -= Q2; low -= Q2; high -= Q2;
} else if (low >= Q1 && high <= Q3) {
value -= Q1; low -= Q1; high -= Q1;
} else if (high > Q2) break;
low += low; high += high;
value = 2 * value + GetBit();
}
return position;
}
/********** Encode and Decode **********/
void Encode(void)
{
int i, c, len, r, s, last_match_length;
fseek(infile, 0L, SEEK_END);
textsize = ftell(infile);
if (fwrite(&textsize, sizeof textsize, 1, outfile) < 1)
Error("Write Error"); /* output size of text */
codesize += sizeof textsize;
if (textsize == 0) return;
rewind(infile); textsize = 0;
StartModel(); InitTree();
s = 0; r = N - F;
for (i = s; i < r; i++) text_buf[i] = ' ';
for (len = 0; len < F && (c = getc(infile)) != EOF; len++)
text_buf[r + len] = c;
textsize = len;
for (i = 1; i <= F; i++) InsertNode(r - i);
InsertNode(r);
do {
if (match_length > len) match_length = len;
if (match_length <= THRESHOLD) {
match_length = 1; EncodeChar(text_buf[r]);
} else {
EncodeChar(255 - THRESHOLD + match_length);
EncodePosition(match_position - 1);
}
last_match_length = match_length;
for (i = 0; i < last_match_length &&
(c = getc(infile)) != EOF; i++) {
DeleteNode(s); text_buf[s] = c;
if (s < F - 1) text_buf[s + N] = c;
s = (s + 1) & (N - 1);
r = (r + 1) & (N - 1);
InsertNode(r);
}
if ((textsize += i) > printcount) {
printf("%12ld\r", textsize); printcount += 1024;
}
while (i++ < last_match_length) {
DeleteNode(s);
s = (s + 1) & (N - 1);
r = (r + 1) & (N - 1);
if (--len) InsertNode(r);
}
} while (len > 0);
EncodeEnd();
printf("In : %lu bytes\n", textsize);
printf("Out: %lu bytes\n", codesize);
printf("Out/In: %.3f\n", (double)codesize / textsize);
}
void Decode(void)
{
int i, j, k, r, c;
unsigned long int count;
if (fread(&textsize, sizeof textsize, 1, infile) < 1)
Error("Read Error"); /* read size of text */
if (textsize == 0) return;
StartDecode(); StartModel();
for (i = 0; i < N - F; i++) text_buf[i] = ' ';
r = N - F;
for (count = 0; count < textsize; ) {
c = DecodeChar();
if (c < 256) {
putc(c, outfile); text_buf[r++] = c;
r &= (N - 1); count++;
} else {
i = (r - DecodePosition() - 1) & (N - 1);
j = c - 255 + THRESHOLD;
for (k = 0; k < j; k++) {
c = text_buf[(i + k) & (N - 1)];
putc(c, outfile); text_buf[r++] = c;
r &= (N - 1); count++;
}
}
if (count > printcount) {
printf("%12lu\r", count); printcount += 1024;
}
}
printf("%12lu\n", count);
}
int main(int argc, char *argv[])
{
char *s;
if (argc != 4) {
printf("'lzari e file1 file2' encodes file1 into file2.\n"
"'lzari d file2 file1' decodes file2 into file1.\n");
return EXIT_FAILURE;
}
if ((s = argv[1], s[1] || strpbrk(s, "DEde") == NULL)
|| (s = argv[2], (infile = fopen(s, "rb")) == NULL)
|| (s = argv[3], (outfile = fopen(s, "wb")) == NULL)) {
printf("??? %s\n", s); return EXIT_FAILURE;
}
if (toupper(*argv[1]) == 'E') Encode(); else Decode();
fclose(infile); fclose(outfile);
return EXIT_SUCCESS;
}
|
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/driver/get_interface.c | /* LIBUSB-WIN32, Generic Windows USB Library
* Copyright (c) 2002-2005 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "libusb_driver.h"
NTSTATUS get_interface(libusb_device_t *dev,
int interface, unsigned char *altsetting,
int *ret, int timeout)
{
NTSTATUS status = STATUS_SUCCESS;
URB urb;
DEBUG_PRINT_NL();
DEBUG_MESSAGE("get_interface(): interface %d", interface);
DEBUG_MESSAGE("get_interface(): timeout %d", timeout);
if(!dev->config.value)
{
DEBUG_ERROR("get_interface(): invalid configuration 0");
return STATUS_INVALID_DEVICE_STATE;
}
memset(&urb, 0, sizeof(URB));
urb.UrbHeader.Function = URB_FUNCTION_GET_INTERFACE;
urb.UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_INTERFACE_REQUEST);
urb.UrbControlGetInterfaceRequest.TransferBufferLength = 1;
urb.UrbControlGetInterfaceRequest.TransferBuffer = altsetting;
urb.UrbControlGetInterfaceRequest.Interface = (USHORT)interface;
status = call_usbd(dev, &urb, IOCTL_INTERNAL_USB_SUBMIT_URB, timeout);
if(!NT_SUCCESS(status) || !USBD_SUCCESS(urb.UrbHeader.Status))
{
DEBUG_ERROR("get_interface(): getting interface "
"failed: status: 0x%x, urb-status: 0x%x",
status, urb.UrbHeader.Status);
*ret = 0;
}
else
{
*ret = urb.UrbControlGetInterfaceRequest.TransferBufferLength;
DEBUG_MESSAGE("get_interface(): current altsetting is %d", *altsetting);
}
return status;
}
|
tinyos-io/tinyos-3.x-contrib | rincon/apps/tests/TestParameterStorage/ComponentB.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
/**
* @author <NAME>
* @author <NAME> (<EMAIL>)
*/
#ifndef COMPONENTB_H
#define COMPONENTB_H
#define UQ_COMPONENTB_EXTENSION "componentB.ExtendMetadata"
typedef struct growing_struct_t {
uint8_t extendedParameters[uniqueCount(UQ_COMPONENTB_EXTENSION)];
} growing_struct_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | wsu/telosw/ccxx00/radios/cc1100/CC1100_500kBaud.h | <filename>wsu/telosw/ccxx00/radios/cc1100/CC1100_500kBaud.h
/*
* Copyright (c) 2005-2006 Rincon Research 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 Rincon Research 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
* RINCON RESEARCH 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
*/
/**
* 500 kBaud
*/
/**
* All frequency settings assume a 26 MHz crystal.
* If you have a 27 MHz crystal, you'll need to fix the defined FREQ registers
*
* @author <NAME>
* @author <NAME>
* @author <NAME>
*/
#ifndef CC1100_H
#define CC1100_H
#include "Blaze.h"
#warning "*** INCLUDING CC1100 RADIO ***"
enum {
CC1100_RADIO_ID = unique( UQ_BLAZE_RADIO ),
};
/**
* This helps calculate new FREQx register settings at runtime
* The frequency is in Hz
*/
#define CC1100_CRYSTAL_HZ 26000000
#define CC1100_315_MHZ 0
#define CC1100_433_MHZ 1
#define CC1100_868_MHZ 2
#define CC1100_915_MHZ 3
/**
* You can change the matching network at compile time
*/
#ifndef CC1100_MATCHING_NETWORK
#warning "Using CC1100 default matching network at 315 MHz"
#define CC1100_MATCHING_NETWORK CC1100_315_MHZ
#endif
/**
* All default channels and FREQx registers obtained from SmartRF studio. We
* are not trying to define channel frequencies to match up with any sort of
* specification; instead, we want flexibility. If you want to align with
* specs, then go for it.
*
* Note you can setup the CC1100 to match your antenna characteristics.
* Maybe your antenna is tuned to +/- 5 MHz with a center frequency of 315 MHz.
* You want your center frequency to be 314.996 MHz, and your lower edge to be
* 310 MHz and your upper edge to be 320 MHz.
*
* Lower Channel Calculation:
* CC1100_CHANNEL_MIN = [(310000 desired kHz) - (CC1100_LOWEST_FREQ)]
* ---------------------------------------------
* 199 kHz channel spacing
*
* Where CC1100_LOWEST_FREQ is defined for each band and 199 kHz is
* approximately the channel spacing, CC1100_CHANNEL_WIDTH
*
* CC1100_CHANNEL_MIN ~= 45
*
*
* Upper Channel Calculation:
* CC1100_CHANNEL_MAX = [(320000 desired kHz) - (CC1100_LOWEST_FREQ)]
* ---------------------------------------------
* 199 kHz channel spacing
*
* CC1100_CHANNEL_MAX ~= 95
*
* Incidentally, (95+45)/2 = 70, which is our default center channel.
*
* When you apply the MAX and MIN values, the radio stack will automatically
* make sure you're within bounds when you set the frequency or channel during
* runtime.
*
* We defined the minimum and maximum channels for the various bands below
* so they generally stay within the limits of the CC1100 radio defined in the
* datasheet.
*/
#if (CC1100_MATCHING_NETWORK == CC1100_315_MHZ)
/***************** 315 Matching Network ****************/
// Default channel is at 314.996490 MHz
#ifndef CC1100_DEFAULT_CHANNEL
#define CC1100_DEFAULT_CHANNEL 70
#endif
#ifndef CC1100_CHANNEL_MIN
#define CC1100_CHANNEL_MIN 0
#endif
#ifndef CC1100_CHANNEL_MAX
#define CC1100_CHANNEL_MAX 240
#endif
enum {
CC1100_LOWEST_FREQ = 300998, // kHz
CC1100_DEFAULT_FREQ2 = 0x0B,
CC1100_DEFAULT_FREQ1 = 0x93,
CC1100_DEFAULT_FREQ0 = 0xB1,
};
/**
* These values calculated using TI smart RF studio
*/
enum{
CC1100_PA_PLUS_10 = 0xC0,
CC1100_PA_PLUS_5 = 0x85,
CC1100_PA_PLUS_0 = 0x60,
CC1100_PA_MINUS_5 = 0x57,
CC1100_PA_MINUS_10 = 0x26,
};
#ifndef CC1100_PA
#define CC1100_PA CC1100_PA_PLUS_10
#endif
#elif (CC1100_MATCHING_NETWORK == CC1100_433_MHZ)
/***************** 433 MHz Matching Network ****************/
// Default channel is at 433.191833 MHz
#ifndef CC1100_DEFAULT_CHANNEL
#define CC1100_DEFAULT_CHANNEL 161
#endif
#ifndef CC1100_CHANNEL_MIN
#define CC1100_CHANNEL_MIN 0
#endif
#ifndef CC1100_CHANNEL_MAX
#define CC1100_CHANNEL_MAX 255
#endif
enum {
CC1100_LOWEST_FREQ = 400998,
CC1100_DEFAULT_FREQ2 = 0x0F,
CC1100_DEFAULT_FREQ1 = 0x6C,
CC1100_DEFAULT_FREQ0 = 0x4E,
};
/**
* These values calculated using TI smart RF studio
*/
enum{
CC1100_PA_PLUS_10 = 0xC0,
CC1100_PA_PLUS_5 = 0x85,
CC1100_PA_PLUS_0 = 0x60,
CC1100_PA_MINUS_5 = 0x57,
CC1100_PA_MINUS_10 = 0x26,
};
#ifndef CC1100_PA
#define CC1100_PA CC1100_PA_PLUS_10
#endif
#elif (CC1100_MATCHING_NETWORK == CC1100_868_MHZ)
/***************** 868 MHz Matching Network ****************/
// Default channel is at 868.192749 MHz
#ifndef CC1100_DEFAULT_CHANNEL
#define CC1100_DEFAULT_CHANNEL 141
#endif
#ifndef CC1100_CHANNEL_MIN
#define CC1100_CHANNEL_MIN 0
#endif
#ifndef CC1100_CHANNEL_MAX
#define CC1100_CHANNEL_MAX 255
#endif
enum {
CC1100_LOWEST_FREQ = 839998,
CC1100_DEFAULT_FREQ2 = 0x20,
CC1100_DEFAULT_FREQ1 = 0x4E,
CC1100_DEFAULT_FREQ0 = 0xC4,
};
/**
* These values calculated using TI smart RF studio
*/
enum{
CC1100_PA_PLUS_10 = 0xC3,
CC1100_PA_PLUS_5 = 0x85,
CC1100_PA_PLUS_0 = 0x8E,
CC1100_PA_MINUS_5 = 0x57,
CC1100_PA_MINUS_10 = 0x34,
};
#ifndef CC1100_PA
#define CC1100_PA CC1100_PA_PLUS_10
#endif
#else
/***************** 915 MHz Matching Network ****************/
// Default channel is at 914.996796 MHz
#ifndef CC1100_DEFAULT_CHANNEL
#define CC1100_DEFAULT_CHANNEL 65
#endif
#ifndef CC1100_CHANNEL_MIN
#define CC1100_CHANNEL_MIN 0
#endif
#ifndef CC1100_CHANNEL_MAX
#define CC1100_CHANNEL_MAX 135
#endif
enum {
CC1100_LOWEST_FREQ = 901998,
CC1100_DEFAULT_FREQ2 = 0x22,
CC1100_DEFAULT_FREQ1 = 0xB1,
CC1100_DEFAULT_FREQ0 = 0x3B,
};
/**
* These values calculated using TI smart RF studio
*/
enum{
CC1100_PA_PLUS_10 = 0xC0,
CC1100_PA_PLUS_5 = 0x85,
CC1100_PA_PLUS_0 = 0x8E,
CC1100_PA_MINUS_5 = 0x57,
CC1100_PA_MINUS_10 = 0x26,
};
#ifndef CC1100_PA
#define CC1100_PA CC1100_PA_PLUS_10
#endif
#endif
/**
* These are used for calculating channels at runtime
*/
#define CC1100_CHANNEL_WIDTH 199 // kHz : Do not edit
enum CC1100_config_reg_state_enums {
/** GDO2 is CHIP_RDY, even when the chip is first powered */
CC1100_CONFIG_IOCFG2 = 0x29,
/** GDO1 is High Impedance */
CC1100_CONFIG_IOCFG1 = 0x2E,
/** GDO0 asserts when there is data in the RX FIFO */
CC1100_CONFIG_IOCFG0 = 0x01,
CC1100_CONFIG_FIFOTHR = 0x0F,
CC1100_CONFIG_SYNC1 = 0xD3,
CC1100_CONFIG_SYNC0 = 0x91,
/** Maximum variable packet length is 61 per Errata */
CC1100_CONFIG_PKTLEN = 0x3D,
/** No hw address recognition for better ack rate, append 2 status bytes */
CC1100_CONFIG_PKTCTRL1 = 0x24,
/** CRC appending, variable length packets */
CC1100_CONFIG_PKTCTRL0 = 0x45,
CC1100_CONFIG_ADDR = 0x00,
CC1100_CONFIG_CHANNR = CC1100_DEFAULT_CHANNEL,
CC1100_CONFIG_FSCTRL1 = 0x0E,
CC1100_CONFIG_FSCTRL0 = 0x00,
CC1100_CONFIG_FREQ2 = CC1100_DEFAULT_FREQ2,
CC1100_CONFIG_FREQ1 = CC1100_DEFAULT_FREQ1,
CC1100_CONFIG_FREQ0 = CC1100_DEFAULT_FREQ0,
CC1100_CONFIG_MDMCFG4 = 0x0E,
CC1100_CONFIG_MDMCFG3 = 0x3B,
CC1100_CONFIG_MDMCFG2 = 0x73,
CC1100_CONFIG_MDMCFG1 = 0x42,
CC1100_CONFIG_MDMCFG0 = 0xF8,
CC1100_CONFIG_DEVIATN = 0x00,
CC1100_CONFIG_MCSM2 = 0x07,
/** TX on CCA; Stay in Rx after Rx and Tx */
CC1100_CONFIG_MCSM1 = 0x3F,
/** I experimented with a cal every 4th time, but I never saw any, ever..? */
CC1100_CONFIG_MCSM0 = 0x18,
CC1100_CONFIG_FOCCFG = 0x1D,
CC1100_CONFIG_BSCFG = 0x1C,
CC1100_CONFIG_AGCTRL2 = 0xC7, // If no Tx, lower LNA's (look at AGC)
CC1100_CONFIG_AGCTRL1 = 0x00, // CCA thresholds
CC1100_CONFIG_AGCTRL0 = 0xB0,
CC1100_CONFIG_WOREVT1 = 0x87,
CC1100_CONFIG_WOREVT0 = 0x6B,
CC1100_CONFIG_WORCTRL = 0xF8,
CC1100_CONFIG_FREND1 = 0xB6,
CC1100_CONFIG_FREND0 = 0x10,
CC1100_CONFIG_FSCAL3 = 0xEA,
CC1100_CONFIG_FSCAL2 = 0x2A,
CC1100_CONFIG_FSCAL1 = 0x00,
CC1100_CONFIG_FSCAL0 = 0x1F,
CC1100_CONFIG_RCCTRL1 = 0x41,
CC1100_CONFIG_RCCTRL0 = 0x00,
CC1100_CONFIG_FSTEST = 0x59,
CC1100_CONFIG_PTEST = 0x7F,
CC1100_CONFIG_AGCTST = 0x3F,
CC1100_CONFIG_TEST2 = 0x88,
CC1100_CONFIG_TEST1 = 0x31,
CC1100_CONFIG_TEST0 = 0x0B,
};
#ifndef CCXX00_RADIO_DEFINED
#define CCXX00_RADIO_DEFINED
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | vu/tos/lib/dfrf/Dfrf.h | <gh_stars>1-10
/*
* Copyright (c) 2009, 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: <NAME>, <NAME>
* <NAME>, <EMAIL>
* <NAME>
*/
#ifndef __DFRF_H__
#define __DFRF_H__
#include "AM.h"
#include "DfrfMsg.h"
/**
* Block is an encapsulation of data packet that is routed.
* Blocks are stored sequentially in a buffer that the user of FloodRouting
* provides.
*/
typedef struct block
{
uint8_t priority; // lower value is higher priority
uint32_t timeStamp; //time information is stored in the packet
uint8_t data[0]; // the packet data of length dataLength
} dfrf_block_t;
/**
* Descriptor is a logical structure which we build on top of a buffer (
* a 'chunk of data' provided by user), each parametrized FloodRouting
* interface has one descriptor.
* buffer is structured the following way: the first 10 bytes is a header and
* the next bytes are sequentially stored data packets (called blocks).
* sequential representation of blocks saves space, to be able to access the blocks,
* we use the fact that blocks have uniform size (blockLength), and we store
* a pointer to the first block (blocks) and to the last block(blocksEnd).
*/
typedef struct descriptor
{
uint8_t appId; // comes from parametrized FloodRouting interface
struct descriptor *nextDesc;// allows to go through multiple buffers
uint8_t dataLength; // size of a data packet in bytes (i.e. size of block.data)
uint8_t uniqueLength; // size of unique part of data a packet in bytes
uint8_t maxDataPerMsg; // how many packets can fit in the buffer
uint8_t dirty; // common information about states of all blocks
dfrf_block_t* blocksEnd;// pointer to the last block in the descriptor
dfrf_block_t blocks[0]; // pointer to the first block in the descriptor
} dfrf_desc_t;
#endif // __DFRF_H__
|
tinyos-io/tinyos-3.x-contrib | usc/senzip/SenZip_v1.0/SenZipApp/StorageVolumes.h | #ifndef STORAGE_VOLUMES_H
#define STORAGE_VOLUMES_H
enum {
VOLUME_BLOCKTEST,
};
#endif
#if defined(VS)
VS(VOLUME_BLOCKTEST, 1024)
#undef VS
#endif
#if defined(VB)
VB(VOLUME_BLOCKTEST, 0)
#undef VB
#endif
|
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/error.c | /*
* USB Error messages
*
* Copyright (c) 2000-2001 <NAME> <<EMAIL>>
*
* This library is covered by the LGPL, read LICENSE for details.
*/
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include "usb.h"
#include "error.h"
#include "driver_api.h"
char usb_error_str[1024] = "";
int usb_error_errno = 0;
int __usb_debug = LIBUSB_DEBUG_OFF;
usb_error_type_t usb_error_type = USB_ERROR_TYPE_NONE;
static void output_debug_string(const char *s, ...);
/* prints a message to the Windows debug system */
static void output_debug_string(const char *s, ...)
{
char tmp[512];
va_list args;
va_start(args, s);
_vsnprintf(tmp, sizeof(tmp) - 1, s, args);
va_end(args);
OutputDebugStringA(tmp);
}
char *usb_strerror(void)
{
switch (usb_error_type) {
case USB_ERROR_TYPE_NONE:
return "No error";
case USB_ERROR_TYPE_STRING:
return usb_error_str;
case USB_ERROR_TYPE_ERRNO:
if (usb_error_errno > -USB_ERROR_BEGIN)
return strerror(usb_error_errno);
else
/* Any error we don't know falls under here */
return "Unknown error";
}
return "Unknown error";
}
void usb_error(char *format, ...)
{
va_list args;
usb_error_type = USB_ERROR_TYPE_STRING;
va_start(args, format);
_vsnprintf(usb_error_str, sizeof(usb_error_str) - 1, format, args);
va_end(args);
if(__usb_debug >= LIBUSB_DEBUG_ERR)
{
fprintf(stderr, "LIBUSB_DLL: error: %s\n", usb_error_str);
fflush(stderr);
output_debug_string("LIBUSB_DLL: error: %s\n", usb_error_str);
}
}
void usb_message(char *format, ...)
{
char tmp[512];
va_list args;
if(__usb_debug >= LIBUSB_DEBUG_MSG)
{
va_start(args, format);
_vsnprintf(tmp, sizeof(tmp) - 1, format, args);
va_end(args);
fprintf(stderr, "LIBUSB_DLL: info: %s\n", tmp);
fflush(stderr);
output_debug_string("LIBUSB_DLL: info: %s\n", tmp);
}
}
/* returns Windows' last error in a human readable form */
const char *usb_win_error_to_string(void)
{
static char tmp[512];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
LANG_USER_DEFAULT, tmp, sizeof(tmp) - 1, NULL);
return tmp;
}
int usb_win_error_to_errno(void)
{
switch(GetLastError())
{
case ERROR_SUCCESS:
return 0;
case ERROR_INVALID_PARAMETER:
return EINVAL;
case ERROR_SEM_TIMEOUT:
case ERROR_OPERATION_ABORTED:
return ETIMEDOUT;
case ERROR_NOT_ENOUGH_MEMORY:
return ENOMEM;
default:
return EIO;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.