POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI ...

420
POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI-PLATFORM RF EMITTER LOCALIZATION USING EXTREMUM SEEKING CONTROL Dissertation Submitted to The School of Engineering of the UNIVERSITY OF DAYTON In Partial Fulfillment of the Requirements for The Degree of Doctor of Philosophy in Electrical Engineering By Huthaifa Ahmad Al Issa Dayton, Ohio August, 2012

Transcript of POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI ...

POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI-PLATFORM

RF EMITTER LOCALIZATION USING EXTREMUM SEEKING CONTROL

Dissertation

Submitted to

The School of Engineering of the

UNIVERSITY OF DAYTON

In Partial Fulfillment of the Requirements for

The Degree of

Doctor of Philosophy in Electrical Engineering

By

Huthaifa Ahmad Al Issa

Dayton, Ohio

August, 2012

POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI-PLATFORM RF

EMITTER LOCALIZATION USING EXTREMUM SEEKING CONTROL

Name: Al Issa, Huthaifa Ahmad

APPROVED BY:

Raul Ordonez, Ph.D.Advisor Committee ChairmanProfessor, Department of Electricaland Computer Engineering

Robert Penno, Ph.D.Committee MemberProfessor, Department of Electricaland Computer Engineering

John Loomis, Ph.D.Committee MemberProfessor, Department of Electricaland Computer Engineering

Robert Gorton, Ph.D.Committee MemberProfessor, Department ofMathematics

John G. Weber, Ph.D.Associate DeanSchool of Engineering

Tony E. Saliba, Ph.D.Dean, School of Engineering& Wilke Distinguished Professor

ii

c© Copyright by

Huthaifa Ahmad Al Issa

All rights reserved

2012

ABSTRACT

POSITION-ADAPTIVE DIRECTION FINDING FOR MULTI-PLATFORM RF

EMITTER LOCALIZATION USING EXTREMUM SEEKING CONTROL

Name: Al Issa, Huthaifa AhmadUniversity of DaytonAdvisor: Dr. Raul Ordonez

In recent years there has been growing interest in Ad-hoc and Wireless Sensor Networks

(WSNs) for a variety of indoor applications. Localization information in these networks is

an enabling technology and in some applications it is the parameter of primary importance.

WSNs are being used in a variety of ways – from reconnaissance and detection in military

to biomedical applications and a wide variety of commercial endeavors. In recent years,

position-based services have become more important. Thus, recent developments in com-

munications and RF technology have enabled system concept formulations and designs for

low-cost radar systems using state-of-the-art software radio modules, which are capable of

local processing and wireless communication, a reality. Such nodes are called as sensor

nodes. Each sensor node is capable of only a limited amount of processing.

This research focused on the modeling and implementation of distributed, mobile radar

sensor networks. In particular, we worked on the problem of Position-Adaptive Direction

Finding (PADF), to determine the location of a non-collaborative transmitter, possibly hid-

den within a structure, by using a team of cooperative intelligent sensor networks. Our

iii

purpose is to further develop and refine position-adaptive RF sensing techniques based

on the measurement and estimation of RF scattering metrics. Topics planned for this en-

trepreneurial research project are focused on the investigation, analysis/simulation, and

development of real time multi-model (i.e., complex multipath) environments scattering

decompositions for PADF geometries. PADF is based on the formulation and investigation

of path-loss based RF scattering metrics (i.e., estimation of distributed Path Loss Exponent,

or PLE) that are measured and estimated across multiple platforms in order to enable the

robotic/intelligent position-adaptation (or self-adjustment) of the location of each platform.

We provide a summary of recent experimental results in localization of a non-cooperative

sensor node using static and mobile sensor networks. In this study we used IRIS wireless

sensor nodes. In order to localize the transmitter, we used the Received Signal Strength In-

dicator (RSSI) data to approximate distance from the transmitter to the revolving receivers.

We provided an algorithm for on-line estimation of the PLE that is used in modeling the

distance based on RSSI measurements. The emitter position estimation is calculated based

on surrounding sensors RSSI values using Least-Square Estimation (LSE). The PADF has

been tested on a number of different configurations in the laboratory via the design and

implementation of four IRIS wireless sensor nodes as receivers and one hidden sensor as

a transmitter during the localization phase. The robustness of detecting the transmitter’s

position is initiated by getting the RSSI data through experiments and then data manipu-

lation in MATLAB will determine the robustness of each node and ultimately that of each

configuration. The parameters that are used in the functions are the median values of RSSI

and rms values. From the result it is determined which configurations possess high robust-

ness. High values obtained from the robustness function indicate high robustness, while

low values indicate lower robustness.

iv

Finally, we present the experimental performance analysis on the application aspect.

We apply Extremum Seeking Control (ESC) schemes by using the swarm seeking problem,

where the goal is to design a control law for each individual sensor that can minimize the

error metric by adapting the sensor positions in real-time, thereby minimizing the unknown

estimation error. As a result we achieved source seeking and collision avoidance of the

entire group of the sensor positions.

v

To my father

To my mother

To all my brothers and sisters

To Dr. Bader Almadi

To all those who have helped me along the way with their love and support

For without their support I would never have come this far.

vi

ACKNOWLEDGMENTS

I give a sincere gratitude to the people who do science with pure, unselfish and honest

passion as they are the people who made me grow and appreciate the world in the way I

see. They helped in ways ranging from personal to technical, and my gratitude to each

cannot be understated. I would like to express my gratitude to all those who gave me the

possibility to complete my Ph.D study. I would like to thank my family, friends, advisors,

and committee members for all they have given me over the last few years.

This dissertation would not have been possible without the support of many people

over the last few years. Over the last few years, I have had the privilege to work with

a number of people who have made my time at the University of Dayton enjoyable and

rewarding. I’d like to thank all of them. Without them this dissertation would not be

possible. First, I am deeply grateful to my advisor, Professor Raul Ordonez. Prof. Ordonez

is an outstanding control scientist with broad knowledge, sharp intuition, and grand vision.

Prof. Ordonez is also a great mentor. He is very patient and gives me lots of freedom

to explore the field by myself. Under his guidance, I was able to learn the fundamental

lessons of being a researcher: finding valuable problems, investigating innovative ideas

and presenting meaningful results. His inspiration and warm personality have won my

highest respect and trust. I am grateful for his continued support and guidance throughout

the whole dissertation process. I am very grateful to had his trust in my ability, and I have

often benefited from his insight and advice.

vii

I am extremely grateful to my dissertation committee members, Professor Robert Penno,

Professor John Loomis, Professor Robert Gorton for their providing valuable suggestions,

guidance, comments and encouragements, time and effort that they invested in criticizing

my dissertation, and for the interest they expressed for my research.

Many thanks to my colleagues at the University of Dayton for making this Ph.D such

an enjoyable experience. My special thanks goes to Professor Don Moon for his help and

support. I am thankful to the staff of University of Dayton: Marilyn Knisley for helping

me with all administrative issues, support and encouragement during all my studies.

My gratitude also goes to Dr. Mohammad Eyadat from the California State University

for his advice and encouragement.

I give special thanks to Dr. Mohammad Almajali. Directorate of Strategic Plan-

ning/JAF. International Cooperation Branch. For his support and his help.

I would like to thank senate: Tala Almadi for pushing me to get my Ph.D and for his

advice.

I wish to deeply thank Dr. Ali Rawabdeh for his help and advice.

I would like to thank Dr. Alan Jennings for his insight in LATEX. His help was greatly

appreciated.

I am fortunate to be among many good fellow students and friends. I give great thanks

to my friends for being there for me when I needed them the most. I would like to thank

the following friends for many helpful discussions and for friendships: Shamsul Anwar

Shamsudin , Mosa Abdesalam, Osama Abolaeha, Tanner Adams.

Finally, my gratitude goes to my family for their love, support and encouragement

during all my studies. Most of all, thank you dad, mum, sisters, and brothers for supporting

and encouraging me whenever fear or discouragement were looming over me. Without

viii

them, I would not have reached this point. I thank God for looking over me during these

past years and for granting me the ability to complete this degree.

ix

TABLE OF CONTENTS

Page

ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

DEDICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi

ACKNOWLEDGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

TABLE OF CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv

LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi

LIST OF ABBREVIATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

CHAPTERS:

I. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.1 Motivation and Significance . . . . . . . . . . . . . . . . . . . . . . . . 11.2 History and Literature Overview . . . . . . . . . . . . . . . . . . . . . . 71.3 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.4 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221.5 Wireless Sensor Networks . . . . . . . . . . . . . . . . . . . . . . . . . 24

1.5.1 Hardware Specifications . . . . . . . . . . . . . . . . . . . . . . 271.5.2 Sensor Node Protocol . . . . . . . . . . . . . . . . . . . . . . . 291.5.3 Wireless Sensor Networks Applications . . . . . . . . . . . . . . 33

1.6 What is Localization? . . . . . . . . . . . . . . . . . . . . . . . . . . . 351.6.1 Localization Principle . . . . . . . . . . . . . . . . . . . . . . . 381.6.2 Range-Free Vs Range-Based . . . . . . . . . . . . . . . . . . . 381.6.3 Localization Techniques . . . . . . . . . . . . . . . . . . . . . . 39

x

II. POSITION-ADAPTIVE DIRECTION FINDING (PADF) . . . . . . . . . . . 44

2.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452.2 Position-Adaptive Direction Finding Concepts . . . . . . . . . . . . . . 462.3 Hardware and Software Components . . . . . . . . . . . . . . . . . . . 50

2.3.1 IRIS Wireless Sensor Nodes . . . . . . . . . . . . . . . . . . . . 512.3.2 Tiny Operating System . . . . . . . . . . . . . . . . . . . . . . 522.3.3 IEEE 802.14.2 Technology . . . . . . . . . . . . . . . . . . . . 55

III. MODELING AND LOCALIZATION METHODOLOGY . . . . . . . . . . . 59

3.1 Position Estimation Based Signal Strength . . . . . . . . . . . . . . . . 593.1.1 Emitter Localization Estimation . . . . . . . . . . . . . . . . . . 623.1.2 RSSI Model on IRIS Sensor Nodes . . . . . . . . . . . . . . . . 63

3.2 Sensitivity and Robustness Issues . . . . . . . . . . . . . . . . . . . . . 663.2.1 Experimental Procedure . . . . . . . . . . . . . . . . . . . . . . 67

3.3 Error Metric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

IV. EXPERIMENTAL AND LAB SETUP . . . . . . . . . . . . . . . . . . . . . . 96

4.1 Case One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974.1.1 Case One: Experiments Without Obstruction . . . . . . . . . . . 974.1.2 Case One: Experiments With Obstruction . . . . . . . . . . . . . 97

4.2 Case Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994.2.1 Case Two: Experiments Without Obstruction . . . . . . . . . . . 994.2.2 Case Two: Experiments With Obstruction . . . . . . . . . . . . 101

V. EXPERIMENTAL RESULTS . . . . . . . . . . . . . . . . . . . . . . . . . . 105

5.1 At IDCAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1055.1.1 Case One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1105.1.2 Case Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

5.2 Experiments at AFRL MAV LAB . . . . . . . . . . . . . . . . . . . . . 115

VI. SOURCE SEEKING BASED EXTREMUM SEEKING CONTROL . . . . . . 122

6.1 Why Extremum Seeking Control . . . . . . . . . . . . . . . . . . . . . . 1226.1.1 History and Literature Overview . . . . . . . . . . . . . . . . . 1246.1.2 Applications of Extremum Seeking Control . . . . . . . . . . . . 126

6.2 Swarm Source Seeking . . . . . . . . . . . . . . . . . . . . . . . . . . . 1286.3 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1306.4 Simulation Results Without Obstruction for Two Different Cases . . . . . 133

6.4.1 Case One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1336.4.2 Case Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

xi

6.5 Simulation Results With Obstruction for Two Different Cases . . . . . . 1396.5.1 Case One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1396.5.2 Case Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

6.6 Monte Carlo Implementation . . . . . . . . . . . . . . . . . . . . . . . . 150

VII. CONCLUSIONS AND FUTURE WORK . . . . . . . . . . . . . . . . . . . . 160

7.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1607.2 Future Work and Open Problems . . . . . . . . . . . . . . . . . . . . . . 163

BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

APPENDICES:

A. GRAPHICAL USER INTERFACE (GUI) CODE BY MATLAB . . . . . . . . 192

A.1 How To Run The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 192A.2 Padf.Gui.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193A.3 Process Data Func Code . . . . . . . . . . . . . . . . . . . . . . . . . . 203A.4 Read Basestation Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 205A.5 Try Serial Reading Code . . . . . . . . . . . . . . . . . . . . . . . . . 206A.6 ABC values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

B. TINY OPERATING SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . 207

B.1 IRIS Mote Program: About This Software . . . . . . . . . . . . . . . . . 207B.1.1 How To Make Nc Code . . . . . . . . . . . . . . . . . . . . . . 207B.1.2 ReadME BEFORE Making . . . . . . . . . . . . . . . . . . . . 207B.1.3 RssiDemoMessages Code . . . . . . . . . . . . . . . . . . . . . 208

B.2 ForwardingMote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208B.2.1 ForwardToBaseAppC Code . . . . . . . . . . . . . . . . . . . . 208B.2.2 ForwardToBaseC Code . . . . . . . . . . . . . . . . . . . . . . 209

B.3 Build Iris Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210B.3.1 App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

B.4 InterceptBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372B.4.1 BaseStationC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372B.4.2 BaseStationP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

B.5 RssiBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376B.5.1 RssiBaseAppC Code . . . . . . . . . . . . . . . . . . . . . . . . 376B.5.2 RssiBaseC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377

B.6 SendingMote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378B.6.1 SendingMoteAppC . . . . . . . . . . . . . . . . . . . . . . . . 378B.6.2 SendingMoteC . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

xii

C. ROBUSTNESS CODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380

C.1 Robustness Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380C.1.1 Compute Median and Rms From Experimental Data . . . . . . . 380C.1.2 Huthaifa 2048 Code . . . . . . . . . . . . . . . . . . . . . . . . 380C.1.3 Robustness For Configuration I and II Code . . . . . . . . . . . 382

D. EXTREMUM SEEKING CONTROL . . . . . . . . . . . . . . . . . . . . . . 386

D.1 Extremum Seeking Control Code . . . . . . . . . . . . . . . . . . . . . 386D.1.1 Without Obstruction Code . . . . . . . . . . . . . . . . . . . . . 386D.1.2 Extremumswarming No2 Derivative Code . . . . . . . . . . . . 388D.1.3 Min2d Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389D.1.4 Metric Potential Code . . . . . . . . . . . . . . . . . . . . . . . 390D.1.5 Localization Error Code . . . . . . . . . . . . . . . . . . . . . . 391D.1.6 Compute Metric Code . . . . . . . . . . . . . . . . . . . . . . . 392

xiii

LIST OF FIGURES

Figure Page

1 Example of a wireless sensor network. . . . . . . . . . . . . . . . . . . . . 25

2 Sensor network communication structure. . . . . . . . . . . . . . . . . . . 27

3 Basic architecture of a wireless sensor node [115]. . . . . . . . . . . . . . . 28

4 Sensor node protocol stack . . . . . . . . . . . . . . . . . . . . . . . . . . 29

5 Position-adaptive radar concepts for single or multiple mini-UAVhelicopters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

6 (a) Notional PADF initial state. (b) Notional PADF final state. . . . . . . . 48

7 Basic functional block diagram model for PADF development. . . . . . . . 50

8 Modified IRIS sensor node for improved omni-directional RSSImeasurements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

9 IEEE 802.15.4 and ZigBee stack architectures. . . . . . . . . . . . . . . . 57

10 Estimated position of emitter lies in the intersections of the correspondingcircles graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

11 Model of a sensor network used to localize a non-cooperative emitter. . . . 61

12 Receiving sensors nodes in configuration I surrounding the transmitting node. 68

13 Median and rms plot for configuration I: (a)(0 to 1); (b)(0 to 2); (c)(0 to 3);(d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

xiv

14 Robustness values for each mote in configuration I: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

15 Receiving sensors nodes in configuration I surrounding the transmittingnode for improving robustness and accuracy by running mote 2 nine times(not to scale). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

16 Robustness for configuration I. . . . . . . . . . . . . . . . . . . . . . . . . 74

17 Receiving sensors nodes in configuration II surrounding the transmittingnode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

18 Median and rms plots for configuration II: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

19 Robustness values for each mote in configuration II: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

20 Receiving sensors nodes in configuration II surrounding the transmittingnode for improving robustness and accuracy by running mote 2 nine times(not to scale). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

21 Robustness for configuration II. . . . . . . . . . . . . . . . . . . . . . . . 79

22 Robustness for configurations I and II in the same axis. . . . . . . . . . . . 79

23 Receiving sensors nodes in configuration III surrounding the transmittingnode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

24 Median and rms plots for configuration III: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

25 Robustness values for each mote in configuration III: (a)(0 to 1);(b)(0 to 2) ; (c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . 83

26 Receiving sensors nodes in configuration III surrounding the transmittingnode for improving robustness and accuracy by running mote 2 nine times(not to scale). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

27 Robustness for configuration III. . . . . . . . . . . . . . . . . . . . . . . . 85

xv

28 Receiving sensors nodes in configuration IV surrounding the transmittingnode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

29 Median and rms plots for configuration IV: (a)(0 to 1); (b)(0 to 2) ;(c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

30 Robustness values for each mote in configuration IV: (a)(0 to 1);(b)(0 to 2); (c)(0 to 3); (d)(0 to 4). . . . . . . . . . . . . . . . . . . . . . . 88

31 Receiving sensors nodes in configuration IV surrounding the transmittingnode for improving robustness and accuracy by running mote 2 nine times(not to scale). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

32 Robustness for configuration IV. . . . . . . . . . . . . . . . . . . . . . . . 90

33 Robustness for configurations III and IV in the same axis. . . . . . . . . . . 91

34 Closed-loop to obtain true position-adaptive estimator. . . . . . . . . . . . 93

35 Metric and error for configurations I and II. . . . . . . . . . . . . . . . . . 95

36 Metric and error for configurations III and IV. . . . . . . . . . . . . . . . . 95

37 Discrete position-adaptive configurations without obstruction for case oneat IDCAST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

38 Discrete position-adaptive configurations with obstruction for case oneat IDCAST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

39 An intersection of circles with radii equal to RSS measured at individualnodes for configuration 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

40 Discrete position-adaptive configurations without obstruction for case twoat IDCAST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

41 Discrete position-adaptive configurations with obstruction for case twoat IDCAST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

42 Selected pictures of experimental apparatus developed for PADFinvestigations at IDCAST [7]. . . . . . . . . . . . . . . . . . . . . . . . . 106

xvi

43 MATLAB GUI for PADF calculation [99], showing sample outputdepicting a PLE-based RF scattering error metric (blue curve) versuslocalization error (red curve). . . . . . . . . . . . . . . . . . . . . . . . . . 108

44 Collection of pictures that illustrate the experimental apparatus developedfor PADF experiments at IDCAST. . . . . . . . . . . . . . . . . . . . . . . 109

45 Metric (unitless) and error (meters) for multiple configurations (correspondsto case one configurations 1-5 from Figure 37). . . . . . . . . . . . . . . . 111

46 Metric (unitless) and error (meters) for multiple configurations (case onecorresponds to configurations 1-5 from Figure 38). . . . . . . . . . . . . . 112

47 Metric (unitless) and error (meters) for multiple configurations (correspondsto case two configurations 1-6 from Figure 40). . . . . . . . . . . . . . . . 114

48 Metric (unitless) and error (meters) for multiple configurations (correspondsto case two configurations 1-6 from Figure 41). . . . . . . . . . . . . . . . 115

49 Functional block diagram model for PADF development with optional stepsfor improving robustness and accuracy. . . . . . . . . . . . . . . . . . . . . 116

50 MODE1 experimental PADF concept using MAVs with wireless sensornodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

51 MODE2 experimental PADF concept using MAVs with wireless sensornodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

52 Metric and error for circular trajectory. . . . . . . . . . . . . . . . . . . . . 120

53 Metric and error for 10-point zigzag. . . . . . . . . . . . . . . . . . . . . . 121

54 General block diagram for extremum seeking control. . . . . . . . . . . . . 123

55 Source Seeking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

56 ESC closed-loop with potential function that can attain trueposition-adaptive sensor network reconfiguration autonomously. . . . . . . 133

57 Trajectory of the swarm sensors “without obstruction” using ESC for caseone example one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

xvii

58 Potential functions “without obstruction” for case one example one. . . . . 135

59 Error metric “without obstruction” for case one example one that isminimized by ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

60 Localization error “without obstruction” for case one example onethat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 136

61 Trajectory of the swarm sensors “without obstruction” using ESC forcase one example two. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

62 Potential functions “without obstruction” for case two example two. . . . . 137

63 Error metric “without obstruction” for case one example two that isminimized by ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

64 Localization error “without obstruction” for case one example twothat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 138

65 Trajectory of the swarm sensors “without obstruction” using ESC forcase one example two. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

66 Potential functions “without obstruction” for case two example two. . . . . 140

67 Error metric for case one example two “without obstruction” that isminimized by ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

68 Localization error “without obstruction” for case oneexample two that is minimized by ESC. . . . . . . . . . . . . . . . . . . . 141

69 Trajectory of the swarm sensors “with obstruction” using ESC forcase one example one . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

70 Potential functions “with obstruction” for case one example one. . . . . . . 143

71 Error metric “with obstruction” for case one example one that is minimizedby ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

72 Localization error “with obstruction” for case one example onethat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 144

xviii

73 Trajectory of the swarm sensors “with obstruction” using ESC forcase one example two. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

74 Potential functions “with obstruction” for case one example two. . . . . . . 145

75 Error metric “with obstruction” for case one example two that is minimizedby ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

76 Localization error “with obstruction” for case one example twothat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 146

77 Trajectory of the swarm sensors “with obstruction” using ESC forcase two example one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

78 Potential functions “with obstruction” for case two example one. . . . . . . 148

79 Error metric “with obstruction” for case two example one is minimized byESC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

80 Localization error “with obstruction” for case two example onethat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 149

81 Trajectory of the swarm sensors “with obstruction” using ESC forcase two example two. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

82 Potential functions “with obstruction” for case two example two . . . . . . . 151

83 Error metric “with obstruction” for case two example two that is minimizedby ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

84 Localization error “with obstruction” for case two example twothat is minimized by ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 152

85 Case one Monte Carlo study: (a) mean error metric; (b) standard deviationerror metric; (c) median error metric. . . . . . . . . . . . . . . . . . . . . . 154

86 Case two Monte Carlo study: (a) mean error metric; (b) standard deviationerror metric; (c) median error metric. . . . . . . . . . . . . . . . . . . . . . 155

87 Case one Monte Carlo study: (a) mean localization error; (b) standarddeviation localization error; (c) median localization error. . . . . . . . . . . 156

xix

88 Case two Monte Carlo study: (a) mean localization error; (b) standarddeviation localization error; (c) median localization error. . . . . . . . . . . 157

89 Contour plot for error metric, where the sign indicates the position ofminimum metric value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

90 Contour plot for localization error, where the sign indicates the position ofminimum error value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

91 Sample TREX 600 RC helicopter platform recently acquired by IDCASTto support PADF research via integration of onboard IRIS sensor motes. . . 164

92 Integration and demonstration of IRIS sensor nodes onto multiple RChelicopters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

xx

LIST OF TABLES

Table Page

1 Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration I. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

2 Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration I. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

3 Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration II. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

4 Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration II. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

5 Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration III. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

6 Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration III. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

7 Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration IV. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

8 Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration IV. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

9 Position of sensors and emitter configurations for case one as shown inFigures 37 and 38. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

xxi

10 Position of sensors and emitter configurations for case two as shown inFigures 40 and 41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

11 IRIS platform for multiple configurations with error and error metric (caseone corresponds to configurations 1-5 from Figure 37). . . . . . . . . . . . 110

12 IRIS platform for multiple configurations with error and error metric (caseone corresponds to configurations 1-5 from Figure 38 ). . . . . . . . . . . . 112

13 IRIS platform for multiple configurations with error and error metric (casetwo corresponds to configurations 1-6 from Figure 40). . . . . . . . . . . . 113

14 IRIS platform for multiple configurations with error and error metric (casetwo corresponds to configurations 1-6 from Figure 41). . . . . . . . . . . . 114

15 Monte Carlo study for 500 simulations, where e(0) means error metric forinitial simulation, and e(50) means error metric for final simulations. . . . . 152

16 Monte Carlo study for 500 simulations, where e(0) means localization errorfor initial simulation, and e(50) means localization error for final simulations.153

xxii

LIST OF ABBREVIATIONS

WSNs Wireless Sensor Networks

PADF Position-Adaptive Direction Finding

LSE Least-Square Estimation

ESC Extremum Seeking Control

FCC Federal Communications Commissions

GPS Global Positioning System

MS Mobile Station

RF Radio Frequency

RSSI Received Signal Strength Indicator

ToF Time of Arrival

DoA Direction of Arrival

ISM Industrial, Scientific and Medical

WLAN Wireless Local Area Network

AFRL Air Force Research Laboratory

IDCAST Integration Lab at Institute for Development Commercialization

of Advanced Sensor Technology

RSSI Received Signal Strength Indicator

UAV s Unmanned Aerial Vehicles

xxiii

MEMS Microelectromechanical Systems

LoS Line-of-Sight

LS Least-Squares

DF Direction-Finding

ToF Time of Flight

MAV s Micro-Air Vehicles

DMPC Decentralized Model Predictive Control

MPC Model Predictive Control

MAV SeN Micro-Aerial Vehicle/Wireless Sensor Network

SUAV Small Unmanned Aerial Vehicle

PLE Path Loss Exponent

GUI Graphical User Interface

CCA Clear Channel Assessment

SFD Start Frame Delimiter

LLC Logical Link Control

MAC Medium Access Control

CRC Cyclic Redundancy Check

OLSR Optimized Link State Routing

AODV Ad-hoc On-demand Distance Vector

TCP Transport Control Protocol

UDP Universal Data Protocol

SMP Sensor Management Protocol

TADAP Task Assignment and Data Advertisement Protocol

SQDDP Sensor Query and Data Dissemination Protocol

xxiv

ESN Emergency Sensor Networks

TDoA Time Difference of Arrival

AoA Angle of Arrival

WPANs Wireless Personal Area Networks

CSMA/CA Carrier Sense Multiple Access with Collision Avoidance

UTRC United Technologies Research Center

SPSA Simultaneous Perturbation Stochastic Approximation

ABS Antilock Braking System

xxv

CHAPTER I

INTRODUCTION

1.1 Motivation and Significance

Wireless Sensor Networks (WSNs) are a significant technology attracting considerable

research interest. Recent advances in wireless communications and electronics have en-

abled the development of low-cost, low-power and multi-functional sensors that are small

in size and communicate over short distances. Cheap, smart sensors, networked through

wireless links and deployed in large numbers, provide unprecedented opportunities for

monitoring and controlling homes, cities, and the environment. In addition, networked sen-

sors have a broad spectrum of applications in the defense area, generating new capabilities

for reconnaissance and surveillance as well as other tactical applications [1]. Wireless com-

munication has enjoyed explosive growth over the past decade. As demands for increased

capacity and quality grow, improved methods for harnessing the multi-path wireless chan-

nel must be developed. One area driving research is public demand for improved safety

using wireless communications. Position location technologies have traditionally been of

interest to the military and intelligence communities. In addition to the traditional appli-

cations of position location technologies, two new commercial applications have spurred

research in this area: the use of position location technology for vehicle MAYDAY services

1

and position location for mobile phones dialing 911 under the Enhanced-911 standard. The

development of position location technologies for mobile phones has been prompted by the

Federal Communications Commission’s (FCC) requirement that wireless service providers,

such as cellular, specialized mobile radio, and the newly allocated personal communica-

tions services, be able to determine the location of mobile phone users dialing 911.

WSNs are often being used in different environments to perform various monitoring

tasks such as search, rescue, disaster relief, target tracking and a number of tasks in smart

environments. In many such tasks, node localization is inherently one of the system pa-

rameters. Node localization is required to report the origin of events, assist group querying

of sensors and to route and to answer questions on the network coverage. So, one of the

fundamental challenges in WSNs is node localization. Localization is a key aspect of such

networks, since the knowledge of a sensor’s location is critical in order to process informa-

tion originating from this sensor, to actuate responses to the environment, etc. Localization

in WSNs is becoming more important, because many applications need to locate the source

of incoming measurement as precisely as possible.

For a large number of applications in home automation, the service system requires

precisely sensing a user’s location by certain sensors. Moreover, the system sometimes

requires recognizing the time and the weather for making decisions. On the other hand,

the users always hope to be served correctly and suitably by the service system in the

house. For satisfying the user’s demands, one of the key success factors is to accurately

estimate the user’s location. It is considered a challenge to automatically serve a mobile

user in the house [2]. Indoor localization cannot be carried out effectively by the well-

known Global Positioning System (GPS), which is subject to be blockaded in the urban

2

and indoor environments [3, 4, 5, 6]. Thus, in recent years, WSNs are popularly used to

locate a mobile object in the indoor environment.

In recent years, location estimation in WSNs has raised a lot of interest from researchers.

The idea of having sensing data without any information of the location does not make

sense. Existing techniques, such as GPS, are usually inappropriate in large scale networks,

due to the increase in the cost and size of the nodes. For that reason a variety of location

estimation techniques has been proposed for WSNs. The success of outdoor positioning

and applications based on the GPS provides an incentive to the research and development

of indoor positioning systems. It has been developed over several decades and it relies on

a constellation of satellites. Ranges to several satellites are used in multilateration proce-

dure to infer the position of the receiver. This localization scheme requires hardware that

is both expensive and consumes significant power. As a result, indoor positioning systems

require alternative means to detect the Mobile Station (MS) location without relying on

the direct signal from GPS satellites. Infrared, Radio Frequency (RF), and ultra sound sig-

nals are major technologies used for indoor positioning systems. Unlike outdoor areas, the

indoor environment imposes different challenges on location discovery due to the dense

multi-path effect and building material dependent propagation effect. Thus, an in-depth

understanding of indoor radio propagation for positioning is crucial for efficient design and

deployment. Several localization techniques have been proposed in the literature. The GPS

provides global coverage but specialized equipment is needed, which is energy inefficient

and mostly ineligible for WSNs, except for the case of limited number of sensors with ex-

tended battery capabilities. Furthermore, GPS is not capable of operating indoors, because

of the large attenuation introduced by buildings’ walls and ceilings; therefore it cannot

comprise a ubiquitous localization method.

3

The position of the sensor nodes is very important for several reasons:

• Measurements without a location where they were gathered are generally useless.

• Full covered sensor networks enable energy aware geographic routing.

• Self-configuration and self-organization are key mechanisms for robustness and can

easily be supported by position information.

• In many applications the position itself is the information of interest.

Localization is important to make the sensor data valuable when the position of the

mote is in doubt. In some applications, location information is critical for the interpretation

of sensor data. We can use location information of each node to: display the topology of

the network, compare the readings from different sensors and analyze the distribution of

these readings according to their locations, resolve the specific positions of some nodes if

their readings seem special or unreasonable, and to observe the collaborations of each mote

in the network.

Indoor localization in the literature is based on various techniques, ranging from simple

Received Signal Strength Indicator (RSSI) to the more demanding Time of Arrival (ToA)

or Direction of Arrival (DoA) of the incoming signals. Indoor localization is one of the

newly emerging technologies having potential for numerous applications in the commercial

and public safety fields. RF localization has gained prominence because of its potential

for supporting various position based applications. RF localization based on RSSI uses

the strength of a received signal from a target by listening to infer the range, which is

subsequently used for position estimation. RF localization deals with position computation

of a wireless device. Research in this field has gained prominence because of its potential

4

applications like E-911, navigation, WSNs, asset tracking, patient monitoring, and many

more. RSSI-based estimations are based on the well-known radio propagation path-loss

model. This technique has become the most inexpensive and simple because RSSI or RF

signals can be measured during normal transmissions between nodes.

Location determination systems use different technologies and techniques to find the

position of a stationary or moving object. However, due to the large number of wireless

communications and their availability in most areas, many of the location estimation sys-

tems make use of RF based sensor technology. With this in mind, the employment of

IEEE 802.11 infrastructure for location determination recently attracted much attention.

The increasing popularity of these networks and their availability in most office and home

environments are advantageous. These networks work in Industrial, Scientific and Medical

(ISM) frequency band that is a hassle free frequency band and is used by a variety of de-

vices. An important advantage of using IEEE 802.11 technology for location determination

is that the resulted system can work on top of the existing Wireless Local Area Network

(WLAN) infrastructure and the need to customize hardware is eliminated. Every location

determination system that uses IEEE 802.11 network infrastructure has two major charac-

teristics. First, it maps the RSSI to locations and stores them in a database; and second it

searches the database to find the best match. At the present time, a number of methods have

been suggested and deployed in existing systems. However, the accuracy of these systems

are affected by a variety of parameters, most importantly, the RF propagation environment.

Since these systems rely heavily on RF propagation, a thorough evaluation of the factors

that affect RF propagation can be useful.

Position estimation refers to a process used to obtain location information of a MS

with respect to a set of reference positions within a pre-defined space. A system deployed

5

to determine or estimate the location of an entity is called a position location system or

positioning system. A wireless indoor positioning system refers to a wireless network in-

frastructure that provides indoor location information to any requesting end user. Position-

Adaptive radar concepts have been formulated and investigated at the Air Force Research

Laboratory (AFRL) within the past few years. Adopting a position-adaptive approach to

the design of distributed radar systems shows potential for the development of future radar

systems that function under new and challenging environments that contain large clutter

discretes and require co-functionality within multi-signal RF environments. This research

focuses on the modeling and implementation of distributed, mobile radar sensor networks.

In particular, we worked on the problem of Position-Adaptive Direction Finding (PADF),

to determine the location of a non-collaborative transmitter, possibly hidden within a struc-

ture, by using a team of cooperative intelligent sensor networks. Our purpose is to fur-

ther develop and refine position-adaptive RF sensing techniques based on the measurement

and estimation of RF scattering metrics. Topics planned for this entrepreneurial research

project are focused on the investigation, analysis/simulation, and development of real-time

multi-model (i.e., complex multipath) environments scattering decompositions for PADF

geometries.

This new PADF research approach incorporates RF scattering metrics into multiplat-

form objective functions and, based on the measurements at RF Systems Integration Lab at

Institute for Development Commercialization of Advanced Sensor Technology (IDCAST)

[7], shows potential for sensing and localization performance gains in embedded environ-

ments. As discussed above, this research will make a difference to the Air Force. This

approach to RF sensing provides the Air Force with low-cost approaches to designing

6

processing-intensive intelligent multi-Unmanned Aerial Vehicles (UAVs) systems that pro-

vide new RF sensing capabilities in challenging environments.

1.2 History and Literature Overview

In recent years there has been growing interest in ad-hoc and WSNs for a variety of

applications. The development of microelectromechanical systems (MEMS) technology as

well as the advancement in digital electronics and wireless communications has made it

possible to design small size, low-cost energy efficient sensor nodes that could be deployed

in different environments for a variety of applications [8].

The relatively new WSNs are currently subjected to a deep development in order to

exploit the benefits of these simple, cheap, and robust networks. In the last two decades,

many applications of wireless communications have become very successful. The starting

point was over a decades ago when, according to their characteristics, a wide range of

application possibilities, beyond the military domain, appeared. For example, nowadays

cellular phones play a very important role in our daily lives. Mainly, commercial domains

such industrial controls, automotive security, surveillance controls are the current research

topics within the WSNs. All these applications have appeared under the commercial name

of ZigBee, based on the IEEE 802.15.4 standard [9]. The current standard, agrees in terms

of the scalability and low-cost requirements needed for the developing of the previously

mentioned applications. There is extensive research in the development of new algorithms

for data aggregation [10], ad-hoc routing [11, 12, 13], and distributed signal processing in

the context of WSNs [14, 15]. As the algorithms and protocols for WSNs are developed,

they must be supported by a low-power, efficient and flexible hardware platform.

7

In [1], sensor networks are defined as those networks that use multiple sensors to collect

and process information on certain entities of interests. Under this definition, some network

systems with history of several decades can be regarded as some kinds of sensor networks.

For example, the radar networks for air traffic control or military purposes; the national

power grid with many sensors at different positions of the network, etc. These systems

were developed and deployed much earlier than the term sensor networks, which became

popular in recent years [1]. Akyildiz and Sankarasubramaniam et al. [8] presents a global

overview of the sensor networks. It describes the protocol stack as being divided in a

physical, data link, network, transport and application layers; and gives characteristics and

issues of each of them. A description of ad-hoc localization system is given in [16].

Localization in WSNs has recently become an active area of research. Much work

has been done on localization algorithms in WSNs; however, most of them are vulnerable

to location attacks, node malfunction and excessive environment noise since they do not

examine the rationality of the information they get before using them in the location esti-

mation. First studies to use the capabilities of sensor networks for localization have been

done by the group of Estrin and Heidemann [17] and Savvides et al. [18]. Nevertheless,

they only concentrated on an inherent localization problem in sensor networks. Numerous

studies have been performed since then for a civil use [19]. Researchers have pointed out

the influence of noise on the localization process [20], and the importance of various sys-

tem parameters on the accuracy and efficiency of the localization process [21], but there

is no consensus of a single best algorithm for localization in sensor networks. This in-

deed depends on the environment and the specifications of the used motes. The use of

mobile nodes has also been studied [22], should it be used for beacons or for nodes. A very

interesting algorithm that simulates mobility has been developed [23], and presents good

8

results, even if it needs a large amount of nodes. Indeed, localization is still a very active

and largely open field of research [8]. Review of wireless network localization techniques

can be found in [24, 25, 26]. The focus of these references is on localization techniques

in cellular network and WLAN environments and on the signal processing aspect of local-

ization techniques. Sensor networks vary significantly from traditional cellular networks

and WLAN, in that sensor nodes are assumed to be small, inexpensive, cooperative and

deployed in large quantity. These features of sensor networks present unique challenges

and opportunities for WSNs localization. In [27] described some general signal processing

tools that are useful in cooperative WSNs localization algorithms.

Hightower and Borriello In [28], presents a survey and taxonomy of location systems

for mobile computing applications. Comparing different techniques and their performance

can be very difficult because many different applications solves many different problems,

and each technique can differ from others in many ways. The physical media used for

the location, the context where the position is needed, power requirements, infrastructure

and resolution of results will all change from application to application. Hightower and

Borriello attempts to provide the means to make an easier comparison of implementations

and applications. Another survey is presented in [29], where Guolin et al. provide a sur-

vey of positioning designs for wireless communications technology, Guolin et al. look at

localization both in cellular technology and in wireless networks like WSNs. The survey

provides a categorization of the different technologies ranging from GPS to sensor network

techniques. Practical results concerning two key issues in the deployment of localization

service in WSNs are presented in [30], where Anlauff and Sunbul discusses both the se-

lection of appropriate sensors for acquiring the data needed to preform localization and the

9

actual localization algorithm. The authors looks at the use of motes or motes-like technolo-

gies and points out that for most applications there will not be any map of the monitored

area. Motes are tiny devices equipped with a sensor, an onboard computer and wireless

communication technology. Motes with both long and short distance antennas were tested

to determine the ranges of the transmissions [31].

In order to defend against location attacks, some secure localization schemes have been

proposed recently, among which are location verification [32], distance verification [33,

34], distance-bounding [35], RSSI measurements [36, 37, 38, 39] uses hidden and mobile

base stations to localize and verify location estimate. Location estimation in WSNs has

raised a lot of interest from researchers [40, 41, 42]. Existing techniques, such as GPS, are,

usually, inappropriate in large scale networks, due to the increase in the cost and size of the

nodes. For that reason a variety of location estimation techniques has been proposed for

wireless sensor networks [40]. Localization algorithms play an important role in enhancing

the utility of data collected, by enabling sensors to determine the location from which each

data packet is obtained [43, 44, 45, 24].

In [46] a technique that uses range measurements between pairs of nodes and the known

coordinates of the anchor nodes in wireless ad-hoc networks, to estimate the position of ev-

ery node is proposed. The method will first establish the position of the nodes close to

one of the anchor nodes, and then use this information to estimate positions of nodes fur-

ther away from the anchor nodes. Another similar distributed algorithm for localization

in WSNs is described in [47]. This algorithm is based on the iterative propagation of in-

formation through the network, and measurements, with limited accuracy, of the distances

between pairs of nodes used to derive position estimates. [47] mention the standard meth-

ods for acquiring these measurements, but the technique described is independent of the

10

method used for distance measurement. The authors also mention that different techniques

offer different tradeoffs between accuracy, complexity cost, etc. Errors in the measure-

ments can come from multi-path interference, Line-of-Sight (LoS) obstructions and more.

In [48] the DoA estimation [49] is reviewed, and the authors also considers a Least-

Squares (LS) method applied to the DoA bearing crossings to preform the source local-

ization. In [50] localization based on the use of a single mobile beacon is presented. The

technique uses RSSI to estimate the distances between nodes and the beacon. This gives

the method an accuracy of a few meters. The beacon will broadcast its own position and

any node receiving this messages can infer that it is positioned in a certain area with a

certain probability.

The RSSI is measured for every received beacon message and will place a constraint

on the possible position of a node. This technique can be implemented both centralized

and distributed, and scales well, both in terms of number of nodes and density of nodes.

The trajectory of the mobile beacon will affect the results and must be considered. A

localization technique that uses the signal strength from two static beacons is presented in

[51]. Interference and fading in the signals are handled by using the average over several

measurements within a certain time-frame. The two beacons are placed in two non-opposite

corners of a rectangle that encloses all devices. Problems occurring both with static and

mobile nodes are considered and the best performance in both scenarios is obtained in

a fast fading environment. The minimum error is in both cases where the variance in

error as a function of the size of the time-frame is said to be very small. Beacons are

also used in [52], where an efficient localization algorithm using four mobile beacons is

described. The rectangle, formed by the four beacon nodes, will have the sensor node in

the center, and localization is performed by moving the beacon nodes towards the node. The

11

node can then estimate its own position by position information from the four beacons. In

this method the beacon nodes will preform the distance measurements in several iterations

and provide the node with this information. In [53], an approximate maximum likelihood

strategy and the received strength of signals from nodes with well-known positions is used

to estimate the position of the receiving node. Beacons are used as the nodes with known

positions. A parameter called normalized collinearity is described. This new parameter

is used as a metric for the nodes to evaluate how the different beacon nodes are aligned

relative to the nodes. Based on the metric, the best aligned beacon nodes can be chosen

by the nodes. Ecolocation in [54], makes use of distance constraints based on RSSI and

develop sequences to determine the relative position of transmitter with respect to known

reference stations.

Many localization techniques have been developed in literature based on electromag-

netic signal properties which enable in inferring the location information. RF techniques

have been alternatively suggested in order to locate wireless units. RF position location

systems are classified into two broad categories: Direction-Finding (DF) and Range-Based

(RB) systems [55]. DF systems utilize antenna arrays and DoA estimation techniques in

order to locate the MS, and are mainly used in areas with limited clutter [56, 57, 58, 59,

60, 61, 62]. On the other hand, RB systems measure the distance between the MS and a

number of Base Stations (BS), and then the MS’s position arises as the intersection point

of the corresponding curves. The range of the MS is calculated using either ToA or RSSI

measurements [57, 59, 63, 64].

RADAR is a user tracking system [65]. It uses empirical as well as mathematical mod-

els to determine the signal strength. The RF based RADAR [65] is a Range-Based indoor

localization system that measures RSSI at all positions in the entire building and records

12

the RSSI into a database during the calibration phase. In the localization phase, the lo-

cation and orientation of a user are determined by finding the best match of a set of RSS

measurements in the database. Calamari uses RSSI and acoustic Time of Flight (ToF) to

estimate the distance [66]. It uses an audible frequency to reduce the complexity of the

system. SpotON is a RSSI based ad-hoc localization system for WSNs [67]. It can be

used for relative and absolute position determination. In this system, all the nodes need to

be calibrated before being used. The paper “RSS-based location estimation with unknown

path-loss model” [68] dynamically estimates the distance-power gradient; parameter of

the radio propagation path-loss model. It adapts automatically to the environment, thus

eliminating the need for extensive channel measurements. This leads to a more accurate

conversion of RSSI to distance.

The estimation of link distance on unknown indoor environments has been a topic of

research in recent years since it is a foundation for many different applications. As a re-

sult, many studies have explored new algorithms that exploit the RSSI collected in ad-hoc

measurement campaigns to calibrate the localization system. In particular, authors in [69]

evaluate the performance of their localization system based on fingerprinting technique,

deploying 20 anchors in about 1700m2. They show that their system can reach the 50th

and 80th percentile of the localization error with 0.9 meters and 1.6 meters, respectively.

MoteTrack [69] is a decentralized location tracking system based on RF. The location of

each blind node is computed using a RSS signature from the anchor nodes to a database

of signatures. This database is stored at the anchor nodes themselves. MoteTrack focuses

on a robust, decentralized implementation [69] as the most localization systems need a

base station for data processing. The majority of the nodes take over only a limited role

in the localization process to support the case that one or more base stations are down.

13

Cricket [70] is decentralized and uses RF and ultrasound to determine the location of a

blind node. The Cricket [70] location support system uses ultrasound instead for indoor lo-

calization. Anchor nodes broadcast beacon messages, together with the RF message, it will

transmit a ultrasonic pulse. A noteworthy survey is [71] by K. Langendoen. This survey

describes three algorithms: ad-hoc positioning [72], N-hop multilateration [18] and robust

positioning [47]. These algorithms are fully distributed algorithms; they require no central

processing node and are designed towards multi-hop localization.

A number of indoor location tracking systems have been proposed in the literature,

based on RF signals, ultrasound, infrared and some combinations of these. RF based po-

sitioning system are widely studied [65, 69]. Given a model of radio signal propagation

in a building or other environment, RSSI can be used to estimate the distance between the

transmitter and receiver [65, 73]. The existence of radio connectivity and the attenuation of

radio signal with distance are attractive properties that could potentially be exploited to es-

timate the positions of small wireless devices featuring low-power radios. RSSI, a standard

feature in most radios, has attracted a lot of attention in the recent literature for obvious

reasons. RSSI eliminates the need for additional hardware in small wireless devices, and

exhibits favourable properties with respect to power consumption, size and cost.

As RSSI values vary because of mobility and obstructions, the RSSI variation can be

used in the investigation of localization and mobility [65, 74]. Much of the research ex-

periment results in this area assume RSSI as a parameter in their localization algorithms

and confirm that the variation in RSSI values can be used for localization and mobility

[37, 75, 76]. Reference [77] describes a system where the signal strength of a mobiles

transmitter is measured on a statistical basis by a set of BSs. From a priori information of

the corresponding contours, the most probable location of the mobile is determined. Using

14

elementary geometric considerations, and a LS estimate to smooth measurement errors,

[78] develops a trilateration method based on RF travel time measurements between the

vehicle and fixed sensors located at the edges of a square. This method was further pursued

by [79] for channel allocation in cellular networks. Refined trilateration techniques for road

environments, using time delays between reception of a mobiles transmission at different

nodes as input data, are investigated by [80]. Signal strength measurements are used in [81]

to assign a mobile to a certain base station coverage zone. A channel allocation algorithm

is introduced which uses this information as a basic ingredient.

Mobile sensor networks and their application in sensing, localization, and control have

gained significant interest with the development of sensor networks and modern control

algorithms,[82, 83, 85, 86, 87] . Cooperative control algorithms that maximize the probabil-

ity of detection are given in [83] [87]. Control and coordination for groups of autonomous

vehicles performing distributed sensing was presented in [85]. With the development of

Micro-Air Vehicles (MAVs), cooperative control and sensing gained attention for applica-

tions such as military, weather forecast, chemical sensing, etc. A problem of cooperative

path planning for a fleet of UAVs in uncertain environments was presented in [82]. Simi-

larly, a robust decentralized model predictive control for a team of aerial vehicles is given

in [86] and for situations in urban terrain or urban battlefield in [88].

Li and Cassandras give a tutorial-style overview of sensor networks from a systems

and control theory perspective, providing a comprehensive background [83] on sensor net-

works. Complementing this overview, they later presented a distributed coverage control

scheme for cooperating mobile sensor networks [87]. They developed a gradient based

algorithm requiring local information at each sensor and maximizing the joint detection

probabilities of random events. Cortes et al. presented control and coordination algorithms

15

for groups of autonomous vehicle networks performing distributed sensing tasks where

each vehicle plays the role of a mobile tunable sensor [85]. Bellingham et al. address

the problem of cooperative path planning for a fleet of UAVs in uncertain or adverse en-

vironments, by modeling for the probability of UAV loss [82]. Similarly, Richards and

How implemented a robust Decentralized Model Predictive Control (DMPC) for a team

of cooperating UAVs [86]. Using this DMPC each vehicle plans only for its own actions,

but still allowing the UAVs to communicate relevant plan data to ensure those decisions

are consistent across the team. In a simple case like collision avoidance, DMPC guaran-

teed constraint satisfaction and offered significant computation improvement, compared to

an equivalent centralized algorithm, for only a small degradation in performance, such as

UAV flight time. Chandler et al. researched the development of cooperative rendezvous

and cooperative target classification agents in a hierarchical distributed control system for

unmanned aerospace vehicles [82]. For cooperative target classification he developed tem-

plates, followed optimal trajectories, and assigned adjacent vehicles to view at complemen-

tary aspect angles; hence, he combined these to maximize the probability of correct target

classification over various aspect angles. Singh and Fuller developed a receding-horizon

optimal control scheme for autonomous trajectory generation and flight control of an UAV

in an urban terrain [88]. Because environments may be dynamic, or the vehicles need to

change dynamics mid-flight due to sensor or actuator failure, they proposed a Model Pre-

dictive Control (MPC) scheme that navigates a vehicle with nonlinear dynamics through

a vector of known way-points to a goal, and manages constraints for missions that will

require vehicles with increased autonomy in dangerous situations and with tight maneu-

vering and operational capability e.g., missions in urban environments. Continuance and

improvements of research in these various areas are the motivation behind the creation of

16

the Louisiana Tech University Micro-Aerial Vehicle/Wireless Sensor Network (MAVSeN)

Laboratory.

Recent developments in communications and RF technology have enabled system con-

cept formulations and designs for low-cost radar systems using state-of-the-art software

radio modules. One of the major benefits of using these RF communications products is

the potential for generating frequency-agile waveforms that are re-programmable in real-

time and potentially adapt to a scattering environment. In addition, recent simulation re-

sults [89] indicate that this type of system enables the development and implementation of

multi-function RF systems that yield good performance within embedded shared-spectrum

environments. Previous work in this area position-adaptive radar [90, 91] has addressed

topics such as short-range monostatic position-adaptive radar design for mini-UAV heli-

copter platforms as well as electromagnetic phenomenology and associated signal process-

ing for position-adaptive radar.

Mitra formulates and investigates a concept of position-adaptive radar systems in [91,

92, 93, 94, 95, 96]. Adopting a position-adaptive approach to the design of distributed

radar systems shows potential for the development of future radar systems that function

under new and challenging environments that contain large clutter discretes and require co-

functionality within multi-signal RF environments [93]. Sean Young, Mitra and Ordonez

et al. present the designing position adaptive radar systems for multi-platform of Small

Unmanned Aerial Vehicle (SUAV) [97]. Specifically, they investigate notional control ge-

ometries and trajectories for multi-platform SUAV applications by integrating additional

electromagnetic scattering-based metrics within more generic overall objective functions

for multi-SUAV controls systems. They show that the formulation of these new categories

of objective functions lead to realizations of multi-platform SUAV trajectories that position

17

adaptively converge to a set of RF leakage points. They show that an embedded scatterer

(i.e., a metal cylinder) can be imaged by applying radar processing techniques derived for

sparse apertures [97].

Mitra and Ordonez et al. present several approaches to analysis and design of sensor

agnostic networks based on assuming canonically structured architectures that are com-

prised of low-cost wireless sensor node technologies. They provide a logical development

that motivates the potential adaptation of distributed low-cost sensor networks that lever-

age state-of-the-art wireless technologies and are specifically designed with pre-determined

hooks, or facets, in place that allow for quick and efficient sensor swaps between cost-low

RF sensors, EO sensors, and Chem/Bio sensors [98]. Ordonez, et al. provide a result on

a novel multi-platform RF emitter localization technique denoted as position-adaptive RF

direction finding [99]. These results indicate that this position-adaptive approach shows

potential for accurate emitter localization in challenging embedded multi-path environ-

ments (i.e., urban environments)[99]. As part of a general introductory discussion on PADF

techniques, Gates, Al Issa, and Ordonez, et al. [100, 101] provide a summary of the re-

cent results on PADF, and give a discussion on the underlying and enabling concepts that

provide potential enhancements in RF localization accuracy in challenging environments.

Also, they provide an outline of recent results that incorporate sample approaches to real-

time multi-platform data pruning as part of a discussion on potential approaches to refining

a basic PADF technique in order to integrate and perform distributed self-sensitivity and

self-consistency analysis as part of a PADF technique with distributed robotic/intelligent

features [100, 101]. Some of these position-adaptive radar designs are based on state-of-

the-art ultra-wideband impulse radar technology. An integral part of this “smart sensor”

18

concept is to interface the onboard radar system with the onboard autonomous control sys-

tem so that the mini-UAV helicopter platform has the capability to “positionally-adapt” to

characteristics of a “leakage signal” that is measured by the radar.

1.3 Contributions

WSNs are being used in a variety of ways – from reconnaissance and detection in the

military to biomedical applications and a wide variety of commercial endeavors. In recent

years, position based services have increased. Thus, recent developments in communica-

tions and RF technology have enabled system concept formulations and designs for low-

cost radar systems using state-of-the-art software radio modules. WSNs are thus popularly

used to locate a mobile object in an indoor environment. Some physical features are widely

discussed to solve indoor localization in WSNs.

In WSNs, the distance between sensor nodes can be estimated by measuring RSSI. The

wireless RSSI based localization techniques have attracted significant research interest for

their simplicity. The RSSI based localization techniques can be divided into two categories:

the distance estimation based and the RSSI profiling based techniques. The Path Loss

Exponent (PLE) is a key parameter in the distance estimation based localization algorithms,

where distance is estimated from the RSSI.

The main goal of this dissertation is to study and focus on a multi-platform RF emit-

ter localization technique denoted as Position-Adaptive RF Direction Finding (PADF),

with the specific goal of addressing the need and potential for developing real-time multi-

platform control metrics based on RF-scattering. These control metrics should enable the

development and advancement of RF sensing capabilities in complex multi-path environ-

ments. In particular, we worked on the problem of PADF, to determine the location of a

19

non-collaborative transmitter, possibly hidden within a structure, by using a team of coop-

erative intelligent sensor networks. We provide a summary of recent experimental results in

localization of a non-cooperative sensor node using static and mobile sensor networks. We

designed and integrated commercial state-of-the-art wireless sensor node/mote technolo-

gies onto PADF-platforms. In this study we used IRIS wireless sensor nodes. In order to

localize the transmitter, we use the RSSI data to approximate distance from the transmitter

to the revolving receivers. We have experimentally demonstrated that RSSI can effectively

be used for localization of hidden emitters in WSNs environment. Localization accuracy

is improved as the number of sensor nodes and their spatial distribution/spread increases.

We provide an algorithm for on-line estimation of the PLE that is used in modeling the

distance based on RSSI measurements. The emitter position estimation is calculated based

on surrounding sensor’s RSSI values using LSE. We developed a set of experiments that

read sensor data, convert the data into approximate distance values based on approximated

PLE values, and estimate the position of the emitter using the LSE method. The PADF has

been tested on a number of different configurations in the laboratory via the design and im-

plementation of four stationary sensors as receivers and one hidden sensor as a transmitter

during the localization phase. Several experiments were performed to test optimal RSSI

values. Among these experiments some were tested with obstruction and some without

obstruction. We placed the emitter inside of a partially sealed enclosure that was covered

on three sides with aluminum foil to shield the radio signal. This creates a more challeng-

ing environment to detect the hidden emitter, similar to situations where there is an RF

leakage point or leakage areas. We have developed a Graphical User Interface (GUI) using

MATLAB that allows for easy implementation of the PADF concepts.

20

In this dissertation we first provide an overview of the basics of cooperative WSNs,

hardware specifications, sensor node protocol and WSNs applications in Section 1.5. Fur-

thermore, we give a brief introduction of the localization principle, range-free and range-

based and localization techniques in Section 1.6.

In Chapters 2 and 3, we propose a novel sensor-node based approach to emitter localiza-

tion that is PADF. We demonstrate that this approach shows potential for accurate emitter

localization in challenging embedded multi-path environments (i.e., urban environments).

PADF is based on the formulation and investigation of path-loss based RF scattering met-

rics (i.e., estimation of distributed PLE) that is measured and estimated across multiple

platforms in order to enable the robotic/intelligent position-adaptation (or self-adjustment)

of the location of each platform.

The dissertation is organized into seven chapters. Chapter 2, Section 2 introduces the

concept of PADF, and hardware modules using cooperative WSN technologies. We present

in Chapter 3 the position estimation based signal strength methodology, emitter localization

estimation, and RSSI model on IRIS sensor nodes. Then, we introduce the experimental

procedure for sensitivity and robustness issues. Then we explain the PADF error metric

we proposed. Moreover, the PADF has been tested on a number of different configurations

in the laboratory via the design and implementation of four IRIS wireless sensor nodes

as receivers and one hidden sensor as a transmitter during the localization phase. The ro-

bustness of detecting the transmitter’s position is initiated by getting the RSSI data through

experiments and then data manipulation in MATLAB will determine the robustness of each

node and ultimately that of each configuration. The parameters that are used in the func-

tions are the median values of RSSI and rms values. From the result it is determined which

21

configurations possess high robustness. High values obtained from the robustness function

indicate high robustness, while low values indicate lower robustness.

In Chapter 4, we present the details that were involved to set up the experimental

testbed, and the lab setup.

Chapter 5 contains the results from the aforementioned experiments, and illustrates

these approaches to MAV/sensor platform integration and indoor flight test simulation ge-

ometries presently under investigation within the AFRL MAV Lab facility at the AFRL Air

Vehicles Directorate.

In Chapter 6, we present the experimental performance analysis on the application as-

pect. We apply Extremum Seeking Control (ESC) schemes by using the swarm seeking

problem, where the goal is to design a control law for each individual sensor that can mini-

mize the error metric by adapting the sensor positions in real-time, thereby minimizing the

unknown estimation error. As a result we achieved source seeking and collision avoidance

of the entire group of the sensor positions.

Chapter 7 presents the conclusions for the dissertation and closes out the dissertation

by imparting some future work thoughts.

1.4 Outline

PADF configuration concepts are developed for purposes of investigating potential re-

finements in consistency, sensitivity, and robustness via the design and implementation of

four stationary sensors as receivers and one hidden sensor as a transmitter during the local-

ization phase. We first review the most relevant WSNs and localization algorithms. Then,

we survey the existing body of literature on these fields. Furthermore, the results on PADF

are present. The PADF tests are conducted with an emitter inside a partially metal-sealed

22

enclosure where varied hardware simulations are performed across several sets of discrete

position-adaptive sensor node configurations/geometries. We provide a summary of recent

experimental results in localization of a non-cooperative sensor node using static and mo-

bile sensor networks. The PADF has been tested on a number of different configurations

in the laboratory via the design and implementation of four stationary sensors as receivers

and one hidden sensor as a transmitter during the localization phase. The resulting analysis

and simulation has been applied towards the development of intelligent and cooperative

real-time networked PADF processing mechanisms with features that enable localization

performance enhancements such as multi-platform self-data-pruning capabilities that in-

tegrate on-going and recent results in the area of consistency and sensitivity analysis of

experimental PADF solutions. We used a combination of experimental data and MATLAB

simulations to gain better insight into the difficult problems of quality of estimation, data

reliability, and sensitivity. Then we performed analysis of these results grounded on solid

nonlinear analysis tools and our observations. The end result of our analysis was the de-

velopment of a theoretically sound control algorithm that is able to adapt in real-time the

positions of the sensor network in order to provide the best possible estimates.

A brief review of WSNs and hardware specifications, is presented in Section 1.5. The

localization principles and localization techniques are presented in Section 1.6. The re-

mainder of this dissertation is organized as follows: in Chapter 2, a novel PADF is pro-

posed. We have introduced the concept of PADF applied to localization of a hidden, non-

cooperative emitter where static and mobile nodes cooperate in the localization mission.

We introduce as well the hardware and software modules using cooperative WSNs tech-

nologies. Then, in Chapter 3, we present the position estimation method based on signal

23

strength using LSE and the robustness and the sensitivity issues. Furthermore, in Chap-

ter 4, we discuss the experimental and lab setup. In this chapter, we study two different

cases, where each case has different configurations. Chapter 5 contains the results from the

aforementioned experiments, and illustrates these approaches to MAV/sensor platform in-

tegration and indoor flight test simulation geometries presently under investigation within

the AFRL MAV Lab facility at the AFRL Air Vehicles Directorate. In Chapter 6, we present

the experimental performance analysis on the application aspect. We design a control sys-

tem using extremum seeking methods that can minimize the error metric by adapting the

sensor positions in real-time, thereby minimizing the unknown estimation error, by using

the swarm seeking problem, where we design a control law for each individual sensor to

achieve source seeking and collision avoidance of the entire group of the sensor positions.

Chapter 7, concludes the dissertation and the future work. Following this chapter are

an appendices.

1.5 Wireless Sensor Networks

Mobile communications and wireless networking technology has seen a thriving devel-

opment in recent years. There has been growing interest in ad-hoc and WSNs for a variety

of indoor applications. A WSN [8, 102, 103, 104, 105, 106, 107, 108] is a network of many

small sensing and communicating devices called sensor nodes or motes, which can sense

the environment and communicate the information gathered from the monitored field (e.g.,

an area or volume) through wireless links [109]. Typically, a WSN contains one node, the

base station, that connects the network to a more capable computer as illustrated in Figure

1, and probably to a network of general purpose computers through it. Sensors attached to

these nodes allow them to sense various phenomena within the environment. The typical

24

purpose of a sensor network is to collect data via sensing interfaces and propagate those

data to the central computer, allowing easy monitoring of an environment [110].

Figure 1: Example of a wireless sensor network.

Sensor networks consist of a large number of independent autonomous intelligent sen-

sor nodes communicating in a cooperative manner over a wireless channel to achieve a

common goal. This goal varies between simple data collection to complex measurements

[111]. Each node has a CPU, a power supply and a radio transceiver for communica-

tion. Interconnection between nodes is achieved via the transceiver. WSN is a kind of

ad-hoc network densely populated with small, low cost, resource constrained, wireless-

communication enabled and immobile sensor nodes. Each node, or sensor, will have a

very limited functionality; this will normally consist of some type of short range wireless

25

communication capabilities and some form of sensing, or actuator, equipment. The sens-

ing or monitoring of, for example, temperature, humidity, etc., constitutes one of the two

main tasks of each sensor. The other main task is packet forwarding using the equipped

wireless technology. Whichever way data is transmitted, the network must provide a way

of transporting information from different sensors to wherever this information is needed.

A WSN is composed of a number of low-cost, tiny sensor nodes that are capable of sens-

ing, data processing, short range wireless communication, and even actuation [112, 113].

The data collected is routed to special nodes, called sink nodes, also called BS, in a multi-

hop basis, as shown in Figure 2. Then, typically, the sink node sends data to the user the

Internet or satellite, through a gateway, though, depending on the distance between the user

and the network, a gateway might not be needed (local monitoring). Due to the small size

of the wireless sensor nodes, they can be deployed very easily. For example, a large number

of small sensors can be spread by aircrafts to a battlefield or a wild forest. The architecture

of a typical sensor network is shown in Figure 2, where the sensor nodes can send their

data to the sink node, and it is possible to remotely operate the sensor network through the

Internet. The wireless link can allow the sensor nodes to communicate and forward infor-

mation. In some systems, for example the Crossbow [223], the battery life can be more

than one year. Moreover, some systems like Crossbow provide programming interface and

customizable sensing units depending on the specific applications.

Sensor nodes have many limitations regarding computational power, but actually their

only task is to report their sensing values to a single base station or sink node which is, in

most cases, connected to a PC or notebook with a lot of computational resources. This way

we can put the intelligence into the software application. Large amounts of cheap motes

26

Figure 2: Sensor network communication structure.

construct the network by collaborating with each other, and the data sensed by each mote

congregate to the base station. Indeed, a formal definition of WSN is given in [8].

1.5.1 Hardware Specifications

Typically, a sensor node consists of four basic components: sensing unit, processing

unit, a radio transceiver (transmitter and receiver), and a power (usually, a battery) unit.

Figure 3 shows the basic architecture of a sensor node. The following is a brief explana-

tion on what each of these components does. The analog signals that are measured by the

sensors are digitized via an ADC and in turn fed into the processing unit. The processing

unit and its associated storage manage the procedures that make the sensor node carry out

its assigned sensing and collaboration tasks. The radio transceiver connects the node with

the network and serves as the communication medium of the node. The power unit is the

most important component of the sensor mote because it implicitly determines the lifetime

27

of the entire network. Due to size limitations AA batteries or quartz cells are used as the

primary sources of power.

Figure 3: Basic architecture of a wireless sensor node [115].

Recent advancements allow for the current generation of sensor nodes to become even

smaller and cheaper [8]. Consequently, nodes have reduced memory and processing capac-

ities. Battery is, typically, limited. Moreover, due to a short transmission range (caused by

restrained transmission power), nodes can only communicate with its local neighbors. The

transmission power for each mote is often low to avoid interfacing with each other. Thus

the range of communication or range of connectivity is limited to some extent. In a large

WSN, the readings from each mote may have to arrive at the base station via several steps.

28

In sensor network, finding and maintaining a high efficient multi-hop routing algorithm is

very important to guarantee the high reliability and low energy consuming [115].

1.5.2 Sensor Node Protocol

In this section, we specify the task of each layer of the stack and the most common

protocols coupled with each layer as shown in Figure 4 [8].

Figure 4: Sensor node protocol stack

29

1. Physical Layer: The physical layer is responsible for carrier frequency generation,

frequency selection, signal detection, modulation and data encryption. Techniques

such as Ultra Wideband, Impulse Radio and Pulse Position modulation have been

used to reduce complexity and energy requirements, whilst improving reliability and

reducing path loss effects and shadowing. The physical layer, commonly referred to

as Layer 1, interfaces the protocol stack to the network communications hardware to

transmit and receive messages one bit or symbol at a time. Individual physical layer

functions include Clear Channel Assessment (CCA), data frame synchronization, and

encryption. The CCA mechanism senses the physical channel medium to determine

if another transmission is currently in progress in order to prevent communications

collisions. Data frame synchronization occurs by appending a preamble and Start

Frame Delimiter (SFD) sequence of bits to align the radio timing among the network

radios. Finally, once the radios are synchronized, the physical layer receives analog

symbols from the medium and converts them to digital bits for further processing

in higher protocol layers. WSN IEEE 802.15.4 standard radio platforms also offer

additional physical layer functions to provide encryption and auto-acknowledgement

messages.

2. Data Link Layer: The data link layer, commonly referred to as the link layer or

Layer 2, interfaces with both the network and the physical layer. The link layer is

comprised of two separate functions: the Logical Link Control (LLC) module and the

Medium Access Control (MAC) layer. The data link layer is responsible for medium

access, error control, multiplexing of data streams and data frame detection. It en-

sures reliable point to point and point to multi-hop connections in the network. Due

30

to the network constraints conventional MAC protocols are not suited to sensor net-

works. The LLC provides the standard interface between the link and network layer

by encapsulating the message segment from the network layer with additional header

information that ensures proper sequencing on the distant end. The LLC also assem-

bles and disassembles MAC frames which include data, control information, Cyclic

Redundancy Check (CRC) calculation, source address, destination address, and the

intermediate network device addresses. For WSNs seeking to conserve energy, the

MAC layer offers significant opportunities to reduce energy and prolong network

lifetime since it controls the radio. The MAC layer provides a fair contention mecha-

nism to share access to the medium, data authenticity/privacy security options, and a

reliable delivery system using a frame exchange protocol. The frame exchange pro-

tocol supports successful delivery by employing acknowledgement frames and data

integrity CRC checks.

3. Network Layer: The network layer, commonly referred to as Layer 3, provides the

end-to-end routing protocol to connect the sending and receiving stations. Unlike the

single-link responsibility of the link layer, the network layer protocol determines the

entire delivery sequence of links a packet will traverse across the network on its way

to the destination. The network layer is responsible for routing information through

the sensor network i.e., finding the most efficient path for the packet to travel on

its way to a destination. Based upon the network source or destination address of a

packet, the network layer uses algorithmic strategies to optimize the packet routing

across various links traversing a network. Wireless ad hoc networks can proactively

send control messages to maintain an accurate routing table or reactively determine

a route on demand. WSNs can use either method, but proactive route discovery

31

techniques like Optimized Link State Routing (OLSR) require additional energy for

periodic control messages and memory table allocation for routes that may never be

utilized [116]. The Ad-hoc On-demand Distance Vector (AODV) algorithm [117] en-

ables dynamic, self-starting, multi-hop routing between communicating nodes. Since

the protocol establishes routes upon request, nodes do not need to maintain routes to

inactive nodes.

4. Transport Layer: The transport layer, or Layer 4, offers the ability to regulate traffic

flow through the network to the distant end and provide data delivery reliability mea-

sures. The transport layer divides large, upper layer application data into sequential

segments for delivery. The Transport Layer is needed when the sensor network in-

tends to be accessed through the internet. However, no scheme has been devised to

fully address this issue. Upon receipt of these segments, the destination’s transport

layer reorders and reassembles them into data packages for forwarding up to the ap-

plication layer. Depending on the application requirements, the transport layer can ei-

ther send out message segments without any reliability mechanisms, or the transport

layer can provide flow control, high-level packet error checking, data acknowledge-

ment, and network congestion control. The two standard transport protocol options

are Transport Control Protocol (TCP) and Universal Data Protocol (UDP). TCP of-

fers the reliable delivery mechanisms, and UDP maintains simplicity for applications

that do not require the control overhead. Unlike the wired transport layer, the wire-

less transport layer cannot make the assumption that unacknowledged packets are

indicative of a congested network. Standard TCP mechanisms which significantly

reduce the rate of flow due to perceived congestion will actually cause the system

harm in wireless systems.

32

5. Application Layer: The applications layer is responsible presenting all required infor-

mation to the application and propagating requests from the application layer down

to the lower layers. Some preliminary protocols in this area include Sensor Manage-

ment Protocol (SMP) Task Assignment and Data Advertisement Protocol (TADAP),

Sensor Query and Data Dissemination Protocol (SQDDP). Network applications pro-

vide the purpose for the entire protocol stack. The application layer offers network

services directly to the user for electronic mail, file transfers, virtual terminal, and

file servers. Network applications use application layer protocols to define the format

and order of message exchanges between processes operating on separate networked

computers [118, 119, 120].

1.5.3 Wireless Sensor Networks Applications

WSNs are quickly gaining popularity due to the fact that they are potentially low cost

solutions to a variety of real-world challenges [8]. Advancement in wireless sensing tech-

nologies has encouraged in developing a model for indoor object-tracking application us-

ing low power IEEE 802.15.4 compliant radios. Stimulus used in this model is RSSI. This

application is not only limited to object tracking in an indoor environment. Concierge ser-

vices enable users to become aware of nearest supporting facilities. For example, smart

home applications such as multimedia appliances that forward multimedia stream to the

nearest video screen can be achieved with a home positioning system [121]. In the field

of robotics, a robot can navigate by itself using the assistance of indoor positioning system

[122]. Granularity of location information is most important in location determination ap-

plications. For example, to locate a book in a library requires coarse grained granularity

whereas locating a user requires coarse grained granularity.

33

Sensor nodes are deployed in areas of interest to cooperatively monitor physical or

environmental conditions, such as sound, vibration, temperature, pressure, motion, electro-

magnetic disturbance, etc. There are several applications for WSNs, which involve moni-

toring and tracking. WSNs have shown a wide range popularity for both military applica-

tions [8, 123, 124, 125, 126, 127, 128] and civil applications, including industrial process

monitoring and control [129, 130, 131, 132, 133], structure health monitoring [134, 135,

136, 137, 138], environmental monitoring that can be embedded into a hospital building to

track and monitor patients and all medical resources, disaster relief [139], home automa-

tion [140], habitat and environment monitoring [141, 142, 143, 144, 145, 146], health-care

applications [167, 148, 149, 150, 151, 152], home automation [153, 154, 155, 156, 157],

vehicle networks and intelligent transportation systems [158, 159, 160, 161, 162] sensor

networks have been used for vehicle traffic monitoring and control for some time, biomed-

ical applications [163, 164, 165, 166, 167], environmental sensing applications [168] that

can be used for animal tracking, forest surveillance, flood detection, and weather forecast-

ing, and a variety of commercial endeavors [43], and infrastructure security [1].

Some of the most important application areas of sensor networks include hurricane

areas, volcano areas, forest fire areas, etc. and these networks are usually known as Emer-

gency Sensor Networks (ESN) [169]. In most of the applications related to ESN the data

collected will become useless unless the location information can be discerned from it. The

above mentioned applications of WSNs are just a few examples. WSN technology is said

to be one of the most important technologies in this century, and a lot of applications of

using WSNs were proposed and some demo systems were developed in the works men-

tioned above. Similar to many technological developments. Today, WSNs have become

a key technology for different types of smart environments. An intense research effort is

34

currently underway to enable the application of WSNs for a wide range of industrial prob-

lems. Wireless networks are of particular importance when a large number of sensor nodes

have to be deployed, and/or in hazardous situations [170]. WSNs can also be employed in

hazardous environment or diasters zones, that may present danger to people or simply be

unreachable by other means. A self calibrating sensor network could be placed out cov-

ering a large area, and with very little user input quickly start collecting data, transporting

and presenting this data to a user at a safe distance.

1.6 What is Localization?

In recent years, location estimation in WSNs has raised a lot of interest from researchers,

and many efforts have been made in developing algorithms and methodologies for building

efficient localization mechanisms for indoor and outdoor environments. The idea of having

sensing data without any information of the location does not make sense. Estimating the

node localization is an extremely significant task in this field. Node localization is consid-

ered one of the complicated issues in WSNs. Localization is considered the fundamental

service that is analogous to various operations such as cluster creation, routing, commu-

nication, coverage of network, etc. With the aid of cooperation [171], localization can be

achieved with the help of sensor nodes itself without any involvement of humans. The

critical issues in WSN operation is to determine the substantial locus of the sensor nodes

as the position information will be deployed to find the locus at which the sensor reading

originates as well as in any energy aware geographic routing.

Localization means to determine location of nodes in a network. With the support of

some infrastructure, a node can determine its location in the network by extracting infor-

mation received from the infrastructure; also, by making a node send signals periodically,

35

the infrastructure can calculate the location of the node. Localization can usually be de-

scribed as the process of dynamically determining the position, or location, of someone or

something, relative to someone or something else. For sensor networks this simply means

locating a sensor node in a network. Localization refers to the ability to determine the po-

sition (relative or absolute) of a sensor node, with an acceptable accuracy. Sensor network

localization algorithms estimate the locations of sensors with initially unknown location

information by using knowledge of the absolute positions of a few sensors and inter-sensor

measurements such as distance and bearing measurements. Sensors with known location

information are called anchors and their locations can be obtained by using a GPS, or by

installing anchors at points with known coordinates. In applications requiring a global co-

ordinate system, these anchors will determine the location of the sensor network in the

global coordinate system [172]. Most WSN applications require knowing or measuring

locations of thousands of sensors accurately. For example, sensing data without knowing

the sensor location is often meaningless [173]. Locations of sensor nodes are fundamental

to providing location stamps, locating and tracking objects, forming clusters, facilitating

routing, etc. However, a priori knowledge of locations is unavailable in large scale and

ad-hoc deployments, and a pure GPS [174, 175] solution is viable only with costly GPS

receivers and good satellite coverage. GPS techniques are usually inappropriate in large

scale networks, due to the increase in the cost and size of the nodes. For that reason a vari-

ety of location estimation techniques have been proposed for WSNs [40]. These techniques

have raised considerable interest from researchers [176, 177]. GPS is a typical localization

system. In a general scenario, only a few anchor nodes are aware of their positions either

through manual configuration or equipped with GPS receivers, and the others (called un-

known nodes) have to estimate their positions by making use of the positions of anchors.

36

Though GPS is a popular location estimation system, it does not work indoors because it

uses signals from satellites. This system requires LoS to some satellites, consumes ad-

ditional energy and is too expensive to get integrated on hundreds of energy constrained

sensor nodes. Using sensor networks instead of GPS makes indoor localization possible.

Thus localization algorithms [44, 178, 202, 45] play a significant role in the domain of

WSNs. The localization issue is important for WSNs since many applications such as en-

vironment monitoring, vehicle tracking and mapping depend on knowing the locations of

sensor nodes where there is an uncertainty about some positioning. If the sensor network

is used for monitoring the temperature in a building, it is likely that we can know the exact

position of each node. On the contrary, if the sensor network is used for monitoring the

temperature in a remote forest, nodes may be deployed from an airplane and the precise

location of most sensors may be unknown. An effective localization algorithm can then

use all the available information from the motes to compute all the positions. Localization

in mobile indoor WSNs can be used for tracking objects or people. In some applications,

location information is critical for the interpretation of sensor data. We can use location

information of each node to display the topology of the network, compare the readings

from different sensors, and analyze the distribution of these readings according to their

locations, resolving the specific positions of some nodes if their readings seem special or

unreasonable, and observe the collaborations of each mote in the network.

Since most applications depend on a successful localization, i.e., to compute their po-

sitions in some fixed coordinate system, it is of great importance to design efficient local-

ization algorithms. In large scale ad-hoc networks, node localization can assist in routing

[180, 181, 182]. In the smart kindergarten [183] node localization can be used to monitor

the progress of the children by tracking their interaction with toys and also with each other.

37

It can also be used in hospital environments to keep track of equipment, patients, doctors

and nurses [180].

1.6.1 Localization Principle

Localization in sensor networks is to identify sensor node’s position. For any WSN, the

accuracy of its localization technique is highly desired. To estimate a node position, most

recently proposed localization algorithms for wireless ad-hoc networks engage each node

and is able to estimate the distance to all nodes within its radio range, and an appropriate

set of location aware nodes called references or anchors are established within the net-

work. There were many algorithms on localization which have been discussed in the past

to provide localization information for every node. The existing algorithms for localization

can be broadly classified into two basic categories: range-based technique, and range-free

technique.

1.6.2 Range-Free Vs Range-Based

Range-free approaches normally rely on proximity, near-far information or less accu-

rate distance estimation to infer the locations of unknown nodes [184, 185, 72, 186, 187],

and range-based approaches require accurate distance or angle measurements to locate the

unknown nodes [65, 188, 189]. Both approaches must rely on the positions of anchor

nodes and some measured/estimated parameters, and the localization accuracy depends on

the accuracy of reference positions and relative parameters. The range-based approach uses

absolute distance estimate or angle estimate, meaning that a node in a network can measure

the distances from itself to the beacons. In contrast, range-free approach means that it is

impossible for a node to measure the direct distances from itself to beacons. Only through

38

connectivity and proximity, a node can estimate its regions or areas where it stays. The

range-based approach is precise while the range-free method is often inaccurate.

1.6.3 Localization Techniques

[184] gives an overview of the various localization techniques. There are many differ-

ent techniques through which a position can be found relative to other known positions.

These can be split up mainly into the categories of time based, signal strength based, and

proximity to a reference point based techniques.

In range-based mechanisms, such as Cricket [190], Radar [65], APS [188] Pin-Point

[191], TPS [192], etc, the location of a sensor node can be determined with the help of the

distance. The distance between the receiver node and a reference point is determined by

the time of flight of the communication signal. There are different ranging approaches to

measure distance between two nodes. These approaches are ToA (time taken by the radio

signal to propagate from one node to another), Time Difference of Arrival (TDoA) (time

interval between the reception of a radio signal and an ultrasound emitted by a beacon),

Angle of Arrival (AoA) (an estimate of the relative angles between nodes), and RSSI (an

index of received signal power).

The range-free localization is being considered as a cost-effective alternative to range-

based methods because of hardware limitation of deployment of WSN devices. Irregularity

in transmission propagation as well as stringent restriction on the cost of hardware has

rendered localization a challenge. The range-free localization is more capable of achiev-

ing higher localization accuracy without introducing any extra hardware in comparison to

range-based technique of localization which depends on RSSI to calculate absolute point-

to-point distance. The range-free localization technique deploys information related to

39

network topology as well as connectivity status for evaluating location. Low cost, no extra

hardware, little communication traffic as well as flexible precision in position estimation are

some of the advantageous features of range-free methods. Therefore the range-free tech-

nique is considered to be the most effective solution for the localization issues in WSNs

[193].

In [65, 72, 46], the RSSI, which is the easiest to obtain for the current sensors, is

utilized. Range-based techniques are highly accurate, but they are equipped with highly

expensive hardware and require a lot of computation. It increases the cost of the network

and is inefficient in terms of computations.

In range-free techniques, the position of the sensor node is identified on the basis infor-

mation transmitted by nearby anchor nodes or neighboring nodes, based on hop or on trian-

gulation basis. The various range-free techniques are APIT [194], chord selection approach

[195], three dimensional multilateration approach [196], SerLOC [197], centroid scheme

[198], etc. Many more techniques are discussed in [172, 199, 200, 170]. The range-free

techniques have an error in accuracy up to 10% of the communication range of individual

node [195], but these techniques are much cheaper than the range-based techniques.

Among them, RSSI based localization techniques have received considerable research

interest [201, 65, 51, 202, 203, 204, 205, 206]. Although RSSI based localization tech-

niques can only provide a coarse-grained location estimate, they are attractive because of

their simplicity. RSSI has become a standard feature in most wireless devices. RSSI is a

generic metric to measure the energy integral of a radio signal. As RSSI values vary be-

cause of mobility and obstructions, the RSSI variation can be used in the investigation of

localization and mobility [65].

40

In many ways, RSS is considered as an appealing modality for range estimation in

WSNs, mostly because RSSI information can be obtained at almost no additional cost

with each radio message sent and received [207, 208]. The major challenge is that radio

signal strength is so unpredictable [209, 210, 211, 212, 213, 214], where reflecting and

attenuating caused by objects in the environment can have much larger effects on RSS

than distance, making it difficult to infer distance from RSS without a detailed model of

the physical environment [207, 208, 215]. RSSI measures the power of the signal at the

receiver and based on the known transmit power, the effective propagation loss can be

calculated. Next, by using theoretical and empirical models we can translate this loss into

a distance estimate. This method has been used mainly for RF signals. RSSI is a relatively

cheap solution without any extra devices, as all sensor nodes are likely to have radios. The

performance, however, is not as good as other ranging techniques due to the multi-path

propagation of radio signals. In [207], the authors characterize the limits of a variety of

approaches to indoor localization using signal strengths from 802.11 routers. They also

suggest that adding additional hardware or altering the model of the environment is the

only alternative to improve the localization performance.

Much of the research experiment results in this area assume RSSI as a parameter in

their localization algorithms and confirm that the variation in RSSI values can be used for

localization and mobility [75, 76]. RSSI is one of the few ranging techniques that does not

require additional hardware. Many radio chips can measure the RSSI of a message. By

applying a radio signal propagation model, one can calculate the distance from the RSSI.

According to path-loss models, the RSSI varies as a function of distance. This fact

helps to determine the distance of an object transmitting a radio wave to a receiver from

the signal strength that the receiver measures. Three receivers can measure the RSSI of

41

an object and calculate their distance to the transmitter. Therefore RSSI based localization

techniques require no additional hardware, and are unlikely to significantly impact local

power consumption, sensor size and thus cost. RSSI based localization techniques can be

further divided into distance-estimation based [201, 51, 202, 203, 204] and RSSI-profiling

based techniques [65, 205, 216, 217]. The RSSI method works on the principle that the en-

ergy of a signal decreases as it move farther away from its source. Therefore, if one knows

the relationship between the decrease in energy and the distance traveled (i.e., a Path-Loss

Equation (PLE)), the distance between the receiver and transmitter can be calculated from

the signal strength observed at the receiver. One simple form of the PLE is:

P (d) (dBm) = P0 (dBm)− 10α log (d/d0) , (1)

where α is a PLE, and P 0 power at distance at some distance d0(dBm).

Existing distance-estimation based techniques rely on a log-normal radio propagation

model [218] to estimate inter-sensor distances from RSSI measurements. The PLE is a

key parameter in the log-normal model. An accurate knowledge of the PLE is required

in order to obtain an accurate estimate of the inter-sensor distance from the corresponding

RSSI measurement. Existing techniques either consider the PLE is known a priori by as-

suming the WSN’s environment is free space, or obtain the PLE through extensive channel

measurement and modeling by measuring both RSSI and distances in the same environ-

ment of WSNs prior to system deployment. However, the PLE is environment dependent.

Even in the same environment, the channel characteristics may change considerably over

a long period of time due to seasonal changes and weather changes [218]. Therefore it

is an over-simplification to assume a free space environment. On the other hand priori

channel measurement and modeling may not be possible for monitoring and surveillance

42

applications in hostile or inaccessible environments. More detailed information about how

to compute the RSSI or PLE equations will be discussed in chapter 3.

43

CHAPTER II

POSITION-ADAPTIVE DIRECTION FINDING (PADF)

Position-Adaptive radar concepts have been formulated [91, 92, 93, 94, 95, 96, 97]

and investigated at the AFRL within the past few years. Adopting a position-adaptive

approach to the design of distributed radar systems shows potential for the development

of future radar systems. These radar systems will function under new and challenging

environments that contain large clutter discretes and require co-functionality within multi-

signal RF environments.

This research introduces a PADF method using mobile sensor networks, and presents

the latest experimental results in the localization of a non-cooperative sensor node using

static and mobile sensor networks [219]. PADF is based on the formulation and investiga-

tion of path-loss (i.e., PLE) based metrics that are measured and estimated across multiple

platforms in order to robotically/intelligently adapt the location of each platform [99]. This

approach shows potential for accurate emitter localization in challenging embedded multi-

path environments (i.e., urban environments) [93]. Initial experimental test results (with

ground-based distributed RF sensor nodes) conducted within the AFRL and RF Systems

Integration Lab at IDCAST [7] indicate correlated trends between multi-platform RF-based

control metrics formulated for this investigation and localization accuracy. These tests

are conducted with an emitter inside a partially metal-sealed enclosure where variational

44

hardware simulations are performed across several sets of discrete position-adaptive sensor

node configurations/geometries.

A sensor swarm adapts its position based on the sensed values, which in turn depend on

the environment medium, and converges towards leakage points in order to detect a hidden

RF source. By using the relationship between RSS values and the associated distance

between sender and receiver, the transmitter position can be approximated. We developed

a set of experiments that read sensor data, converted the data into approximate distance

values based on approximated PLE values, and estimated the position of the emitter using

the Least-Square Estimation (LSE) method. The algorithm is based on the LSE method

described in detail in [220].

2.1 Problem Statement

This research focuses on the modeling and implementation of distributed, mobile radar

sensor networks. In particular, we worked on the problem of PADF, to determine the lo-

cation of a non-collaborative transmitter, possibly hidden within a structure, by using a

team of cooperative intelligent sensor networks. Our purpose is to further develop and re-

fine position-adaptive RF sensing techniques based on the measurement and estimation of

RF scattering metrics. Topics planned for this entrepreneurial research project are focused

on the investigation, analysis/simulation, and development of real-time multi-model (i.e.,

complex multipath) environments scattering decompositions for PADF geometries. The

objective of this task is to conduct basic research activities and experiments in the PADF

area, with the specific goal of addressing the need and potential for developing real-time

45

multi-platform control metrics based on RF-scattering. These control metrics should en-

able the development and advancement of RF sensing capabilities in complex multi-path

environments.

2.2 Position-Adaptive Direction Finding Concepts

Position-adaptive radar concepts [92] are based on the development of “smart” radar

sensors for SUAV platforms in an effort to detect and exploit “leakage signals” that, for

example, propagate between two buildings or “leak through” penetrable surfaces such as

walls or layers of the ground. These concepts are developed such that either a passive re-

ceiver or a monostatic radar receiver measures and processes leakage signals and then “self

adapts” in position to establish LoS between a mini-UAV platform and a obscuration chan-

nel that propagates the leakage signal. This allows a mini-UAV platform to process signals

in real-time while gathering intelligence information and locating objects-of-interest that

may be embedded within a obscuration channel.

In Figure 5, one mini-UAV or several mini-UAVs surround a building-type structure to

position-adaptively isolate leakage points, i.e., converge to the neighborhood of windows

and doors based on real-time analysis of on-board radar returns. Under this concept, once

this set of mini-UAVs has position-adaptively converged to the neighborhood of a set leak-

age points, the leakage signals are transmitted by three UAVs at three different frequencies

and received by the forth UAV. This receive UAV processes signals over the entire band-

width of the transmit tones from the three transmitting UAVs to analyze and characterize

objects-of-interest that may be embedded within a building-type structure and can poten-

tially map the internal structure of a building.

46

Figure 5: Position-adaptive radar concepts for single or multiple mini-UAVhelicopters.

A short-range monostatic position-adaptive radar design for mini-UAV helicopter plat-

forms that is compatible with the concept illustrated in Figure 5 is outlined in [90]. The

radar portion of the design is based on state-of-the-art ultra-wideband impulse radar tech-

nology. An integral part of this “smart sensor” concept is to interface the onboard radar

system with the onboard autonomous control system so that the mini-UAV helicopter plat-

form has the capability to “positionally-adapt” to characteristics of a “leakage signal” that

is measured by the radar.

The concept of PADF was introduced in [219, 93, 221, 222]. Figure 6 illustrates two

states of a notional PADF geometry using three UAVs that are integrated with sensor motes

programmed to function as RF receivers [219, 93].

Dimensions for the notional urban structure in Figure 6 are 10m × 10m for each of

the six (2 × 3) cells, 3 m for the width of each of the channels, and 0.5 m for each of the

47

(a)

(b)

Figure 6: (a) Notional PADF initial state. (b) Notional PADF final state.

48

openings in the cells. A 2.4 GHz [114, 223] source is located in the center (5 m from each

wall) of the front-center cell of this urban structure. UAV-1 is used as the (0, 0) location

reference for these sample 2-D calculations. For both of the sample geometries in Figure

6, UAV-1 is assumed to be located 10 m in front of the center of the urban structure.

Each of the three notional UAVs are associated with a set of basic sensor mote radio

parameters for receiver sensitivity and transmit power:

Rx(min) ∼= −100(dBm). (2)

Tx(max) ∼= 20(dBm). (3)

A theoretical signal analysis for this geometry is provided in [219] for purposes of for-

mulating and illustrating this technique. As shown in Figure 7, the formulation and inves-

tigation of PLE based metrics that are measured across multiple platforms are intrinsic to

this technique. For purposes of preliminary illustration of this concept, a series of approxi-

mate sample computations is considered in [219] that correspond to a notional initial state

multi-platform geometry, as depicted in Figure 6a, and a notional final state multi-platform

geometry, as depicted in Figure 6b. The following PLE based multi-platform control metric

for initial state, denoted as PLEPADF0 was adopted in [219]:

PLEPADF0 = min

(Pr1(dB)− Pr2(dB)

10 log10(d2d1

),Pr1(dB)− Pr3(dB)

10 log10(d3d1

)

), (4)

where P r1, P r2, and P r3, are based on a theoretical model for RSSI values at sensors 1, 2

and 3, respectively. Similarly, d1, d2, and d3 represent theoretical distance estimates from

49

each sensor to an RF emitter and are also derived from a theoretical model developed for

RSSI measurements at each mote.

Alternative multi-platform control metrics can be defined/investigated that estimate

PLE values within the closed-loop of Figure 7 via a series of cooperative transmissions

between the UAV platforms.

Figure 7: Basic functional block diagram model for PADF development.

2.3 Hardware and Software Components

RF direction finding is performed using mobile sensors that cooperate in sensing mis-

sions, adapt position in real-time, and localize an unknown hidden RF source based on op-

timal detection algorithms. For instance, a possible implementation of this scenario would

50

use MAVs equipped with light-weight RF sensors. In this study we use IRIS wireless sen-

sor nodes [114, 223]. In order to localize the transmitter, we use RSSI as an approximation

of distance from the transmitter to the mobile receivers.

During the initial phases of this investigation, a series of basic sensor mote tests and

distributed software control/measurement functions were developed for the purpose of per-

forming PADF experiments and hardware simulations using IRIS networked wireless sen-

sor motes [114, 223]. In order to obtain more reliable RSSI measurements a portion of

this experiment design phase was allocated to customizing the aperture plane on the sensor

motes, as shown in Figure 8.

The following hardware and software modules were used in the PADF experiment with

wireless sensor nodes: MEMSIC IRIS wireless sensor nodes, MATLAB, and TinyOS [224]

programs. A brief description of these components along with a synopsis of how they are

integrated in the system is defined in the following sections.

2.3.1 IRIS Wireless Sensor Nodes

The IRIS 2.4 GHz mote by MEMSIC Technology, shown in Figure 8, is a module

used for enabling low-power WSNs. The IRIS Mote features several new capabilities

that enhance the overall functionality of MEMSIC’s wireless sensor networking products

[114, 223]. It has a 2.4 to 2.48 GHz globally compatible ISM band; a 250 kbps high data

rate radio (outdoor LoS tests yielded ranges as far as 500 meters between nodes without

amplification); an IEEE 802.15.4 compliant RF transceiver; and a direct sequence spread

spectrum radio (resistant to RF interference/provides inherent data security).

The IRIS supported by MoteWorks WSN platform for reliable, ad-hoc mesh network-

ing, and plug and play with MEMSIC’s sensor boards, data acquisition boards, gateways,

51

and software. MoteWorks enables the development of custom sensor applications and is

specifically optimized for low-power, battery-operated networks. MoteWorks is based on

the open-source TinyOS operating system and provides reliable, ad-hoc mesh network-

ing, over-the-air-programming capabilities, cross development tools, server middleware

for enterprise network integration and client user interface for analysis and configuration

[114, 223].

The IRIS platform consists of the low-power microcontroller Atmega 1281 which runs

MoteWorks from its internal flash memory, the FLASH memory AT45DB041 and the radio

transceiver AT86RF230 from Atmel. ATmega1281 is a low-power 8-bit microcontroller. It

is part of Atmels well known AVR series. The microcontroller runs with up to 16 MIPS

throughput at 16 MHz and there is 128-K Byte flash program memory and 8-K Byte SRAM

included.

As shown in Figure 8, we added a ground antenna plane that shields the rest of the node

electronics from interfering with RSSI measurements. This creates more omnidirectional

measurements, which is very important for integration with ground vehicles and MAVs.

These nodes are used as a basis for the localization of the RF transmitter. We used four

nodes in the development stage to test the functionality of PADF. Their primary function

is not only to detect the RF source (which is also an IRIS mote), but also transmit the

RSSI values between neighboring nodes and the transmitter. These RSSI values will be

instrumental in determining the position of the transmitter using the LSE.

2.3.2 Tiny Operating System

The WSNs architecture we used here includes both a hardware platform and an operat-

ing system designed specifically to address the needs of WSNs. TinyOS has been designed

52

Figure 8: Modified IRIS sensor node for improved omni-directional RSSImeasurements.

to meet the requirements of sensor networks. TinyOS is an operating system for WSNs.

Its innovative architecture was motivated by the specialized hardware characteristics it is

running on. Sensor networks are potentially constructed of thousands of tiny nodes, which

communicate among each other through radio channels, infrared or various techniques.

TinyOS [224] is a component based operating system designed to run in resource con-

strained wireless devices. It provides highly efficient communication primitives and fine-

grained concurrency mechanisms to application and protocol developers. A key concept in

TinyOS is the use of event based programming in conjunction with a highly efficient com-

ponent model. TinyOS enables system-wide optimization by providing a tight coupling

between hardware and software, as well as flexible mechanisms for building application

specific modules. There are four broad requirements that motivate the design of TinyOS.

First of all, motes have very limited resources. Because of their small size, it is hard to

include powerful hardware (8-K Bytes of program memory, 512 Bytes of RAM is typical).

Low power consumption is important, most of them are powered by battery or ambient

53

energy, so efficient energy management is essential. A node has to handle a lot of events

like sampling sensors, local data processing, routing data, etc. Many of these events re-

quire real-time response. That is why reactive concurrency needs an effective concurrency

management.

Flexibility is a also a challenge. There are many different hardware platforms which

are developed very fast. It would be an asset if the operating system could be adapted

in an accurate way. The extreme constraints of these devices makes the use of legacy

systems impractical. TinyOS has been designed to run on a generalized architecture where

a single CPU is shared between application and protocol processing [225]. In the past

years, TinyOS has become a de facto standard in academic research on WSNs.

The current version of TinyOS has already been ported to over a dozen platforms and

numerous sensor boards. Over 500 research groups and companies are using TinyOS on the

Berkeley/Crossbow motes for simulation and development of various algorithms and pro-

tocols. Multiple groups actively contribute code to the sourceforge [226] site and working

together to establish standard, interoperable network services. TinyOS started as a collab-

oration between the University of Berkeley, California, in co-operation with Intel Research

and Crossbow Technology, and has since grown to be an international consortium, the

TinyOS Alliance. TinyOS has several important features such as component-based archi-

tecture, a simple event-based concurrency model and split-phase operations that influence

the development phases and techniques when writing application code. TinyOS is strictly

tied to the NesC “Network embedded system C” programming language having native

support for TinyOSs features. NesC is a dialect of the C programming language optimized

for the memory limitations of sensor networks. Its supplementary tools are mainly in the

form of Java and shell script front-ends. The software components are connected with each

54

other by using interfaces[227]. TinyOS’s component library includes network protocols,

distributed services, sensor drivers, and data acquisition tools.

TinyOS’s event based communication is encapsulated in a component model that al-

lows state-machine based components to be efficiently composed together into application-

specific configurations. The TinyOS communication system is based on the active mes-

sages communication paradigm taken from high-performance computing environments.

When data is received from the network, message-specific handlers are automatically in-

voked. TinyOS includes a special-purpose memory model which allows a fixed set of

message buffers to be pre-allocated and shared amongst several applications.

Finally, we can conclude that sensor networks are opening up many new areas of study

and facilitate many new applications. The underlying hardware for those sensor nodes is

developed very fast. The big challenge is to shrink the physical dimensions while maintain-

ing or even increasing the performance of those nodes. TinyOS is an open-source operating

system designed to address the special difficulties in such an operating area. Its component

based architecture enables rapid innovations, while reducing the code size to a minimum.

The event-driven execution model allows a fain-grained power management and follows

the concurrent nature of sensor networks. TinyOS is not a finished system. It is developed

by a wide community and continues to evolve.

2.3.3 IEEE 802.14.2 Technology

The IEEE 802.15.4 wireless technology is a short-range communication system in-

tended to provide applications with relaxed throughput and latency requirements in Wire-

less Personal Area Networks (WPANs). The key features of the IEEE 802.15.4 wireless

55

technology are low complexity, low cost, low power consumption, low data rate transmis-

sions, to be supported by cheap (either fixed or moving) devices.

• The IEEE 802.15.4 [228] protocol has been adopted as a communication standard

for low data rate, low power consumption and low cost WSNs. This protocol is quite

flexible for a wide range of applications if appropriate tuning of its parameters is

carried out. Most of the mote platforms use this standard for communication be-

tween the motes. Rene, IRIS, TelosB, SunSPOT and LOTUS are all IEEE 802.15.4

compliant motes. This standard intends to define the fundamentals of network layers

used mainly in WPANs where the point is to establish a ubiquitous communica-

tion cost-effectively. Important features include real-time suitability by reservation

of guaranteed time slots, collision avoidance through Carrier Sense Multiple Access

with Collision Avoidance (CSMA/CA) and integrated support for secure communi-

cations. Devices also include power management functions such as link quality and

energy detection [229]. This standard defines MAC and the physical layer protocol

for low-power devices. Figure 9 shows the various layers of the ZigBee wireless

technology architecture the relationship of the IEEE 802.15.4 standard to the ZigBee

Alliance MAC layer protocol model. These layers facilitate the features that make

ZigBee very attractive: low cost, very low power consumption, reliable data trans-

fer, and easy implementation. Using the IEEE 802.15.4 specifications, the Alliance

focuses on the design issues related to the network, security and applications layers.

• The ZigBee technology is based on the IEEE 802.15.4 standard and guarantees theo-

retically a transmission data rate equal to 250 kpbs in a wireless communication link.

ZigBee [230] is a standard for a suite of high level communication for low power

and low data rate radio communications. ZigBee is initiated and maintained by the

56

Figure 9: IEEE 802.15.4 and ZigBee stack architectures.

57

ZigBee Alliance - a large consortium of industry players. The ZigBee Alliance added

the network layer and the network framework in the application layer based on the

IEEE 802.15.4 MAC and physical layer. The ZigBee Alliance was formed because

its members felt that existing standard technologies were not applicable to ultra-low

power application scenarios. ZigBee networks can be configured to operate in a va-

riety of different ways to suit the application and environment. Supported topologies

include peer to peer (ad-hoc) and star configuration. The ZigBee communication is

effective for the short range information exchange. The key feature is low power and

no infrastructure required. The typical application areas of ZigBee include: smart

energy monitoring; health care monitoring; remote control; building automation and

home automation. However, most past studies on localization systems carried out the

performance evaluation on systems based on 802.11 for WLANs, and there has been

insufficient investigation of using ZigBee or IEEE 802.15.4.

58

CHAPTER III

MODELING AND LOCALIZATION METHODOLOGY

3.1 Position Estimation Based Signal Strength

In the following, a position estimation method based on signal strength using LSE is

introduced.

Consider two sensor nodes at locations Ti = (xi,yi), Tj = (xj ,yj), and an emitter in the

x-y plane located at C = (x,y). It follows that the distances between the emitter C and the

sensors are given by:

ri =

√(x− xi)2 + (y − yi)2

rj =

√(x− xj)2 + (y − yj)2

. (5)

We assume the sensors provide enough information (i.e., that two or more sensors are

used) such that, using RSSI measurements, ri and rj can be calculated. The problem is

to determine the location of the emitter C, or equivalently, to solve two equations for two

unknowns in Equation (5). The solution to the system of equations is the intersections of

the corresponding circles or radii ri and rj , as shown in Figure 10. However, three receiving

nodes are required to precisely determine the position of the emitter.

59

Figure 10: Estimated position of emitter lies in the intersections of the correspondingcircles graph.

In the case of N surrounding sensors, the problem is to determine the location of the

emitter C or to solve the following system of equation

ri =

√(x− xi)2 + (y − yi)2, (6)

where i = 1, 2, · · ·N .

Knowing that sensor measurements are noisy and that the system of Equation (6) has

larger number of equations than unknowns, we use LS to determine the location estimate

(x, y).

The PLE is a key parameter in the distance estimation based localization algorithms,

where distance is estimated from the RSS. The PLE depends on the medium of RF signal

propagation and is not known a priori.

60

Consider the model given in Figure 11, consisting of a network of sensors Si (i=1,2,3,4)

and a non-cooperative emitter S0. Distance between nodes i and j is denoted as dij . The

signal strength received from node i at node j is denoted as P ij . Note that in Figure 10 this

notation is simplified by letting d0j = dj

Figure 11: Model of a sensor network used to localize a non-cooperative emitter.

Assumption 1 . A symmetric wireless signal propagation model is considered,

i.e., P ij = P ji for i,j ∈ {0, 1, 2, 3, 4}.

Assumption 2 . Location of sensor nodes Si (i=1,2,3,4) is known. Location of emitter

S0 is unknown.

61

The RSS model is given by [231]

Pij (dBm) = P0 (dBm)− 10α log (dij/d0) , (7)

where α is a PLE, P ij(dBm) is power received at node j from node i in dBm and

P 0(dBm) is a reference power received at some distance d0. Note that the calibration

method requires measurements of P 0 and d0.

3.1.1 Emitter Localization Estimation

The PLE estimation is given by the following optimization problem, where it is required

to find a minimum of the quadratic cost function f (α)

f (α) =4∑

i,j=1

(Pij (dBm)− P0 (dBm) + 10α log (dij/d0)

)2. (8)

The optimal value of the α is given by

∂fα

∂α= 2

4∑i,j=1

10 log (dij/d0)(Pij (dBm)− P0 (dBm) + 10α log (dij/d0)

)= 0. (9)

Therefore, the solution is given by

α =

4∑i,j=1

log (dij/d0)(P0 (dBm)− Pij (dBm)

)10

4∑i,j=1

(log (dij/d0)

)2 . (10)

This PLE estimate is a maximum likelihood estimator value. Note also that calculation

of PLE given by Equation (10) requires prior calibration between sensors Si (i=1,2,3,4). In

the case that there are more than four nodes, the Equation (10) still applies requiring just

larger number of sensor nodes to be considered.

62

3.1.2 RSSI Model on IRIS Sensor Nodes

If distances ri and rj in Equation (5) are not known, they can be calculated based on

RSSI data. The RSSI model that is used is given by

P0i = −10α log (di)−K, (11)

where α is the estimated PLE, d is the distance between transmitter and receiver, and K is

the conversion constant of RSSI to dBm (in the case of IRIS motes, K = -91). Therefore,

the distance estimate is given by

di = 10−Poi+K

10α. (12)

The algorithm attempts to guess whether the hidden transmitter is behind an obstruc-

tion. To detect an obstruction, the algorithm first computes the average distance between

motes,

T =1

N

N−1∑i=1

N∑j=i+1

‖ Ti − Tj ‖. (13)

If di > γT , then we modify the distance estimate to be

di = γ10−Poi+K

10α. (14)

The value of γ is found experimentally. It is the average observed attenuation of RSSI

due to obstructions. In this dissertation, we select γ = 0.75.

Let C = (x, y) be the estimated position of the emitter. The matrix of receiver geometry

(known x− y coordinates of receivers) is

63

A =

hx(2,1) hy(2,1)

......

hx(N,1) hy(N,1)...

...hx(N,N−1) hy(N,N−1)

(N2 )×2

, (15)

where N is the number of receiver, and hx(i,j) = 2 (xj − xi), hy(i,j) = 2 (yj − yi).

The matrix of RSSI measurements is

B =

b2,1

...bN−1

...bN,N−1

(N1 )×1

, (16)

where bi,j = r2i − r2j + x2j − x2i + y2j − y2i .

Specifically, the following set is formulated the for purpose of localization of non-

cooperative emitters:

PLi,j = median(

10RSSIi,j

10

), (17)

PLdBi,j = 10 log10

(PLi,j

), (18)

PLEi,j = log10

(10

PLdBi,j10

), (19)

where i, j denote cooperative transmissions between sensor i and sensor j.

Then, the following modified LS approach can be adopted to produce the position esti-

mate, where the distance terms in the A-matrix are weighted by the inverse of vector cross

64

PLE terms that are estimated from a set of cooperative RSSI measurements between four

platforms.

CPLE =[PLE1,2, PLE1,3, PLE1,4, PLE2,3, PLE2,4, PLE3,4

], (20)

MPLE = mean(CPLE

), (21)

W =

[MPLE

PLE1,2

,MPLE

PLE1,3

,MPLE

PLE1,4

,MPLE

PLE2,3

,MPLE

PLE2,4

,MPLE

PLE3,4

]. (22)

As illustrated by the following derivation, this set of cooperative inverse PLE weights

has the relative effect of de-emphasizing measurements that are affected by non-line-of-

sight propagation losses due multi-path and materials attenuation. Hence, in the four re-

ceiver case, Equations (15) and (16) becomes

A =

2(x2 − x1) 2(y2 − y1)2(x3 − x1) 2(y3 − y1)2(x4 − x1) 2(y4 − y1)2(x3 − x2) 2(y3 − y2)2(x4 − x2) 2(y4 − y2)2(x4 − x3) 2(y4 − y3)

, (23)

B =

x22 − x21 − y22 − y21 − d21 − d22x23 − x21 − y23 − y21 − d21 − d23x24 − x21 − y24 − y21 − d21 − d24x23 − x22 − y23 − y22 − d22 − d23x24 − x22 − y24 − y22 − d22 − d24x24 − x23 − y24 − y23 − d23 − d24

. (24)

Let · denote element-wise multiplication, and define

AWx = Ax ·W, (25)

65

where Ax is the first column of A, and

AWy = Ay ·W, (26)

where Ay is the second column of A. Hence, the weighted matrix AW is defined as AW =

[AWx AWy].

Then, the estimated transmitter location is calculated based on

AWC = B, (27)

and is given by [83]

C = (ATWAW )−1AT

WB. (28)

3.2 Sensitivity and Robustness Issues

Robustness is of crucial importance in control system designs because real engineer-

ing systems are vulnerable to external disturbances and measurement noise. There are

always differences between mathematical models used for the design and the actual sys-

tem. Typically, a control engineer is required to design a controller which will stabilize

a plant if it is not stable originally, and satisfy certain performance levels in the presence

of disturbance signals, noise interference, un-modeled plant dynamics and plant parame-

ter variations. Those design objectives are best realized via feedback control mechanism,

though, which brings in the issues of high cost (the use of sensors), system complexity, and

concerns on stability. In classical single-input single-output control, robustness is achieved

by ensuring adequate gain and phase margins.

66

In order to further investigate PADF concepts in an indoor IDCAST lab environment,

many PADF configuration concepts were developed. These configurations are based on po-

tential refinements in consistency, sensitivity, and robustness via the design and implemen-

tation of four stationary sensors and one hidden transmitter during the localization phase.

These results indicate the potential for developing intelligent PADF systems. The develop-

ment of these systems may demonstrate a degree of robustness and localization accuracy by

some analytical data processes. Then, a robustness figure data manipulation in MATLAB

determines of each node and ultimately that of each configuration. The parameters that are

used to compute the robustness figure are median values of RSSI and the rms values. From

the result it is determined which configurations possess high robustness, (in the sense that

it can be experimentally verified that they are not sensitive to small changes in sensor po-

sition). High values obtained from the robustness function indicate high robustness, while

low values indicate lower robustness.

3.2.1 Experimental Procedure

The data is gathered by running the experiment nine times for each configuration. Each

configuration has one mobile sensor node. Each configuration involves different position

of the motes 1, 2, 3, and 4, to detect the hidden transmitter which is assigned at (0, 2.5)

meters (used throughout the dissertation). Here, the transmitter is designated as mote 0.

Example one:

In configuration I in Figure 12, mote 1 is at (0, 0); mote 2 is at (-1.5, 1.5); mote 3 is at

(0, 5); and mote 4 is at (1.5, 3).

67

Figure 12: Receiving sensors nodes in configuration I surrounding the transmitting node.

Thus we will have the dBm data between (0 to 1), (0 to 2), (0 to 3), and (0 to 4). For

each data set, a plot of their robustness based on the median and rms values of the dBm

is generated. The median is the middle of the Poi data, after they are sorted in ascending

order. For mote i, the median and rms values are calculated as such

{mediani

e = P0iM+12, if M : Odd

medianie = P0iM

2, if M : Even

, (29)

rmsie =

√√√√ 1

M

M∑l=1

P 20i, (30)

where e is the experiment number, M is the length of data in that experiment, and P0i is the

RSSI in dBm.

68

The median data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for

configuration I are shown in Table 1.

Experiment MedianNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 -51 -46 -62 -602 -51 -48 -63 -593 -51 -46 -62 -594 -51 -49 -64 -605 -51 -47 -64 -58.56 -51 -49 -64 -597 -51 -47 -62 -608 -51 -49 -63 -589 -51 -52 -64 -58

Table 1: Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration I.

The rms data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for config-

uration I are shown in Table 2.

Next, these values are plotted and the distribution indicates the robustness or sensitivity

of the data. Some of the plots are shown below in Figure 13.

We observe that the median and rms values can overlap one another. This indicates

the difference between a robust system and a sensitive system. We propose to evaluate

robustness using

Rie =

rmsie+ | medianie |

(rmsie)2

, (31)

where i=1, 2, 3, and 4.

69

(a) (b)

(c) (d)

Figure 13: Median and rms plot for configuration I: (a)(0 to 1); (b)(0 to 2); (c)(0 to 3);(d)(0 to 4).

70

Experiment RmsNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 52.1567 46.9246 62.2505 59.88882 53.2752 49.2691 62.9554 60.63123 52.6817 49.8293 62.2976 59.38914 53.6649 52.4256 63.8596 59.83975 53.2982 50.0050 63.7829 59.37836 52.1895 50.1750 63.5718 59.18347 53.3020 48.8601 62.3420 59.73158 54.7527 49.7731 63.1766 58.53209 53.5966 53.9702 64.7914 58.4367

Table 2: Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration I.

This formula uses median and rms values because they both represent two different

kinds of averages calculated from the RSSI data. A higher median value (corresponding to

a stronger signal) indicates that the data is more trustworthy. Similarly, a smaller value for

rms means the data is more trustworthy. Figure 14, shows the results of robustness for each

mote.

The experiment is repeated nine times. In each case the location of mote 2 is moved 5

cm to the north, south, east, west, northeast, northwest, southwest, and southeast. However,

the locations of all other motes (1, 3, 4) are unchanged. The aim is to see which position is

more robust by analyzing the sensitivity of the data after changing the position 5 cm in the

directions stated above. Figure 15 shows graph (not to scale) with nine repetitions.

The next step is to combine these results so that we get a robustness reading for the

whole configuration I. To do this, we sum up the robustness values from each respective

experiment from each mote as denoted by

71

(a) (b)

(c) (d)

Figure 14: Robustness values for each mote in configuration I: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4).

72

Figure 15: Receiving sensors nodes in configuration I surrounding the transmitting nodefor improving robustness and accuracy by running mote 2 nine times (not to scale).

Re =4∑

i=1

Rie, (32)

where i is the mote number and Rie is the robustness of that mote.

The results are shown below in Figure 16.

We then repeated these steps for another configuration, say configuration II, shown in

Figure 17, where mote 1 is at (0, 0); mote 2 is at (-1.5, 3); mote 3 is at (0, 5); and mote 4 is

at (1.5, 3).

73

Figure 16: Robustness for configuration I.

Figure 17: Receiving sensors nodes in configuration II surrounding the transmitting node.

74

We applied the robustness formula for each experiment and plotted the individual ro-

bustness results. As before, we combined these robustness values so that an overall robust-

ness value for configuration II can be calculated. The results are shown in the following

Figures [18 - 21].

The median data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for

configuration II are shown in Table 3.

Experiment MedianNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 -51 -62 -64 -552 -51 -69 -64 -553 -51 -61 -64 -554 -50 -69 -61 -555 -50 -70 -61 -556 -50 -53 -61 -557 -49 -60 -61 -558 -49 -63 -61 -549 -49 -60 -61 -55

Table 3: Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration II.

The rms data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for config-

uration II are shown in Table 4.

Moreover, Figure 22 shows the two robustness curves plotted in the same axis for con-

figurations I and II. That also highlights what we have seen earlier [84].

75

(a) (b)

(c) (d)

Figure 18: Median and rms plots for configuration II: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4).

76

(a) (b)

(c) (d)

Figure 19: Robustness values for each mote in configuration II: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4).

77

Experiment RmsNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 51.5447 63.0793 65.3756 54.98652 51.5499 68.7873 65.4295 54.98563 52.2440 61.8355 63.2072 54.95354 51.4922 68.9230 61.0114 56.47525 50.6998 70.4066 61.1498 56.98746 51.3384 55.3407 60.9756 58.35777 49.5458 61.1896 60.9991 56.30188 49.0316 63.9805 61.2216 55.64039 49.7152 59.5341 61.7830 57.2794

Table 4: Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration II.

Figure 20: Receiving sensors nodes in configuration II surrounding the transmitting nodefor improving robustness and accuracy by running mote 2 nine times (not to scale).

78

Figure 21: Robustness for configuration II.

Figure 22: Robustness for configurations I and II in the same axis.

79

Example Two:

A second study for this scenario will consider two new different configurations. In

configuration III as shown in Figure 23. Mote 1 is located at (0, 0); mote 2 is at (-1.5, 1.5);

mote 3 is at (0, 5); and mote 4 is at (1.5, 1.5).

Figure 23: Receiving sensors nodes in configuration III surrounding the transmitting node.

Just as before, we will have the dBm data between (0 to 1), (0 to 2), (0 to 3), and (0 to

4). For each data set, a plot of their robustness based on the median and rms values of the

dBm is generated.

For mote i, the median and rms values are calculated using Equations 29 and 30. Then,

these values are plotted and the distribution indicates the robustness or sensitivity of the

data. Some of the plots are shown below in Figure 24.

80

The median data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for

configuration III are shown in Table 5.

Experiment MedianNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 -51 -46 -62 -442 -51 -47 -61 -433 -51 -46 -63 -444 -51 -49 -64 -445 -51 -47 -64 -446 -51 -49 -64 -437 -51 -49 -64 -448 -51 -46 -64 -449 -51 -52 -64 -44

Table 5: Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration III.

The rms data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for config-

uration III are shown in Table 6.

So, by using Equation 31, the robustness of each mote can be evaluated. Figure 25

shows the results of robustness for each mote in configuration III.

As before, the experiment is repeated nine times. In each case the location of mote 2 is

moved 5 cm to the north, south, east, west, northeast, northwest, southwest, and southeast.

Nonetheless, the locations of all other motes (1, 3, 4) are fixed. The aim is to see which

position is more robust by analyzing the sensitivity of the data after changing the position 5

cm in the directions stated above. Figure 26 shows graph (not to scale) with nine repetitions.

Next, a robustness value for the whole configuration III is obtained by Equation 32.

The results are shown below in Figure 27.

81

(a) (b)

(c) (d)

Figure 24: Median and rms plots for configuration III: (a)(0 to 1); (b)(0 to 2);(c)(0 to 3); (d)(0 to 4).

82

(a) (b)

(c) (d)

Figure 25: Robustness values for each mote in configuration III: (a)(0 to 1);(b)(0 to 2) ; (c)(0 to 3); (d)(0 to 4).

83

Experiment RmsNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 53.2684 46 62.5775 44.06522 56.1309 49.3946 61.4929 45.32363 54.4150 46.6309 63.3026 47.60984 54.0550 50.5704 63.6392 45.18805 51.2332 47.5501 64.2559 47.80576 51.6010 50.9574 63.7745 44.56627 52.1349 50.0001 64.5193 43.51278 54.3950 49.6348 63.9671 47.06829 55.5227 55.7275 64.4670 46.3696

Table 6: Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration III.

Figure 26: Receiving sensors nodes in configuration III surrounding the transmitting nodefor improving robustness and accuracy by running mote 2 nine times (not to scale).

84

Figure 27: Robustness for configuration III.

Now consider configuration IV, shown in Figure 28, where mote 1 is located at (0, 0);

mote 2 is at (-1.5, 3); mote 3 is at (0, 5); and mote 4 is at (1.5, 1.5).

Next, we applied the robustness formula for each experiment and plotted the individual

robustness results. These robustness values are combined so that an overall robustness

value for configuration IV can be calculated. The results are shown in the following Figures

[29 - 32].

The median data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for

configuration IV are shown in Table 7.

The rms data values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4) in dBm for config-

uration IV are shown in Table 8.

85

Figure 28: Receiving sensors nodes in configuration IV surrounding the transmitting node.

Experiment MedianNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 -49 -62 -61 -432 -49 -66 -61 -433 -49 -59 -61 -434 -49 -65 -61 -435 -49 -67 -61 -436 -49 -55 -61 -437 -49 -67 -61 -438 -49 -67 -61 -439 -49 -58 -61 -43

Table 7: Median values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration IV.

86

(a) (b)

(c) (d)

Figure 29: Median and rms plots for configuration IV: (a)(0 to 1); (b)(0 to 2) ;(c)(0 to 3); (d)(0 to 4).

87

(a) (b)

(c) (d)

Figure 30: Robustness values for each mote in configuration IV: (a)(0 to 1);(b)(0 to 2); (c)(0 to 3); (d)(0 to 4).

88

Experiment RmsNumber (0 to 1) (0 to 2) (0 to 3) (0 to 4)

1 50.1423 63.0303 61.3691 44.25522 49.8982 67.2019 60.9837 45.54513 51.0099 61.2284 60.9387 45.19894 49.6118 65.8375 60.9596 43.28575 49.1497 67.7272 61.5690 44.39406 49.0483 57.8283 61.0256 44.58017 49.2932 67.6912 60.9508 43.46468 49.9885 67.9835 61.0000 44.98089 49.5125 58.0154 61.0707 43.5127

Table 8: Rms values between (0 to 1), (0 to 2), (0 to 3), and (0 to 4)for configuration IV.

Figure 31: Receiving sensors nodes in configuration IV surrounding the transmitting nodefor improving robustness and accuracy by running mote 2 nine times (not to scale).

89

Figure 32: Robustness for configuration IV.

As well as, Figure 33 shows the two robustness curves plotted in the same axis for

configurations III and IV. That also highlights what we have seen earlier.

From configurations III and IV, we see that for all experiments except one (number

nine), the robustness of III is larger than that of IV as expected. Thus, this proves our

hypothesis on the relationship between robustness and sensitivity of the mote in any con-

figuration.

Furthermore, we repeated this procedure on many other configurations. From these,

we observed that the less sensitive configurations had higher robustness values while the

more sensitive configurations had lower robustness values. As will be shown later, a higher

robustness value for a given experiment is correlated with a smaller estimation error.

90

Figure 33: Robustness for configurations III and IV in the same axis.

3.3 Error Metric

The localization error e is defined as the difference between an actual position and

its estimated position, e = ‖ C − C ‖. This error is not available from the experiment.

However, we propose an error metric e that provides an estimate of the localization error.

This estimate is not expected, nor required, to approximate the actual error e. Instead, all

that is required is that the slope of e (with respect to time) be of the same sign and similar

magnitude as that of e, and that the values attained by e be consistent with those of e.

That is, if for two configurations one has two error values, say e1 < e2, we expect to have

e1 < e2 as well. Similarly, if for the two configurations we have e1 ∼= e2, we expect to have

e1 ∼= e2.

91

This problem can be thought of as a function approximation problem. That is, we want

to build a function

e = F (Θ) , (33)

that approximates e in some sense, where Θ is a vector of inputs. Possible ways to do

this include the use of a neural network or other universal approximators, but this would

require the use of off-line training. Additionally, it is not clear how to choose the inputs

to form the vector Θ. Instead, here we take an ad-hoc approach, where we pick the inputs

and the function F manually, based on experience with the experiment. We recognize this

is not easy to generalize, but it does allow for a possible way forward towards attaining

closed-loop control as in Figure 56. Figure 56 given later in chapter 6.

In [231], an alternative multi-platform error metric is defined to estimate PLE values

within the closed-loop multi-platform control structure depicted in Figure 7, via a series of

cooperative transmissions between a combination of mobile sensor platforms.

The procedure of the multi-platform error metric structure is shown in Figure 34. The

sensors detect the signal from the hidden emitter. Then the system estimates the location of

the emitter based on RSSI measurements using LSE. The signals Pi,j, CPLE, Ti are used

to produce e.

Based on difference between distance estimates D and a sensor positions, we define D

as

Di = ‖ Ti − C ‖, (34)

92

Figure 34: Closed-loop to obtain true position-adaptive estimator.

where Ti is the sensor position, i = 1, ..., N .

From here we compute {Dmax = max

(| D − D |

)Dmin = min

(| D − D |

) . (35)

Next, the error metric we propose is given by:

e =

(3

√Dmax

10 +Dmin

+2√

|MPLE|+

1

std(G)

)1

Re

, (36)

where, for k = 1, 2, ..., 6,

93

CPLEk = [PLE1, ..., PLE6],

G = AWk · CPLEk, (37)

AWk =

√A2

k1 + A2k2

2.

The resulting error metric in (36) is investigated as a multi-platform RF scattering based

objective function for purposes of multi platform position adaptation and, in turn, multi

platform localization of embedded emitters.

The application of such a metric is useful in determining the robustness of a configu-

rations. The overall robustness of configurations I and II in Figures 12 and 17 was using

metric and error. We see in Figure 35 that for all experiments except one (number nine),

the robustness of I is larger than that of II.

This is true as well for configurations III and IV in Figures 23 and 28. We see in Figure

36 that for all experiments except one (number nine), the robustness of III is larger than

that of IV.

As can be seen, the error metric serves the original proposed objective: while its value

is not a good approximation of the localization error itself, the metric’s slope is similar to

the error’s shape, and the metric’s values are also consistent with the error values.

94

Figure 35: Metric and error for configurations I and II.

Figure 36: Metric and error for configurations III and IV.

95

CHAPTER IV

EXPERIMENTAL AND LAB SETUP

During the initial phases of this investigation, a series of basic sensor mote tests and dis-

tributed software control/measurement functions were developed for purposes of perform-

ing PADF experiments and hardware simulations using IRIS networked wireless sensor

motes [114, 223]. We present a set of experiments using mobile sensor networks to local-

ize a non-cooperative sensor node based on measured RSSI at surrounding sensor network.

Related results are given in [99, 50].

We use on-line estimation of the PLE to model the distance, based on measured RSS. A

detailed analysis on PLE estimation and modeling is given in [231], which is then used in

distance calculations based on RSS measurements. The experiments that were developed

read sensor data, convert the data into approximate distance values based on approximated

PLE values, and estimate the position of the emitter using the LSE method [220].

Using four IRIS nodes as receivers and one IRIS node as a transmitter, several exper-

iments were performed to test optimal RSSI values. Also performed were several exper-

iments to test the proper configuration that gives the best hidden emitter estimation accu-

racy. We grouped these experiments into two different cases, case one and case two, where

each case tested different configurations. Among these experiments, some were tested with

obstruction and some without obstruction.

96

4.1 Case One

4.1.1 Case One: Experiments Without Obstruction

After designing and implementing a PADF experimental apparatus with distributed

wireless sensor motes, a number of discrete configurations were synthesized for purposes

of investigating PADF concepts, as outlined in previous sections. This set of experimental

configurations is shown in Figure 37.

The location of the sensors and emitter configurations in case one, are shown below in

Table 9, relative to the x and y coordinate plane.

Configuration Emitter Sensor 1 Sensor 2 Sensor 3 Sensor 4Number x y x y x y x y x y

1 0 2.5 0 0 -2.5 2.5 0 5 2.5 2.52 0 2.5 0 0 -1 0 0 5 2.5 2.53 0 2.5 0 0 -1 0 0 5 1 04 0 2.5 0 0 -1 0 0 1 1 05 0 2.5 0 0 -1 0 0 -1 1 0

Table 9: Position of sensors and emitter configurations for case one as shown in Figures 37and 38.

4.1.2 Case One: Experiments With Obstruction

Using the initial setup from the previous experiments, the same tests were performed.

We placed the emitter inside of a partially sealed enclosure that was covered on three sides

with aluminum foil to shield the radio signal. This creates a more challenging environment

to detect the hidden emitter, similar to situations where there is an RF leakage point or

leakage area. We measured the response of the IRIS nodes and corresponding RSSI values.

97

Figure 37: Discrete position-adaptive configurations without obstruction for case oneat IDCAST.

98

It is expected that the degradation of the RF signal passing through the enclosure would

degrade the accuracy of the LSE position of the transmitter. This set of experimental con-

figurations is shown in Figure 38. For example, the diagram for configuration 1 is a top

view perspective of a simulated initial, or initial state, platform geometry with all four sen-

sor motes spaced 2.5 meters apart in both the x and y dimensions (all the receiving nodes

surround the transmitter equilaterally). Similarly, the diagram for configuration 3 is a top

view perspective of a simulated sensor geometry after two iterative position readjustments

of the platform locations. In this configuration, three sensor motes are depicted to adapt in

position to locations in front of the RF leakage point that is associated with the (aluminum

foil covered) enclosure that, in turn, contains the embedded RF emitter in the center. In

this case (i.e., configuration 3), the three sensor motes in front of the enclosure are located

1 meter apart.

Each receiver has a corresponding “disc area” that acts as the sensing radius for the

node. The LSE uses the intersections of these disc areas to determine the position of the

transmitter located at the red X in the center. Figure 39 shows a MATLAB visualization

of the intersecting disc areas and the actual location of the transmitter for experimental

configuration 1 as shown in Figure 37.

4.2 Case Two

4.2.1 Case Two: Experiments Without Obstruction

Figure 40 shows the experimental setup for case two. The tests that were conducted for

case one were also performed for case two. However, different configurations were used

to test optimal RSSI values. Also performed were several experiments to test the proper

configuration that gives the best hidden emitter estimation accuracy.

99

Figure 38: Discrete position-adaptive configurations with obstruction for case oneat IDCAST.

100

Figure 39: An intersection of circles with radii equal to RSS measured at individual nodesfor configuration 1.

The location of the sensors and emitter configurations in case two are shown below in

Table 10, relative to the x and y coordinate plane.

4.2.2 Case Two: Experiments With Obstruction

Using the configurations shown in Figure 40, the same experiments were conducted,

but this time the emitter was placed inside of a partially sealed enclosure. This set of

experimental configurations are shown in Figure 41.

Chapter 5 provides sets of experimental data analysis using this PADF technique, in

two different experimental environments.

101

Figure 40: Discrete position-adaptive configurations without obstruction for case two atIDCAST.

102

Figure 41: Discrete position-adaptive configurations with obstruction for case twoat IDCAST.

103

Configuration Emitter Sensor 1 Sensor 2 Sensor 3 Sensor 4Number x y x y x y x y x y

1 0 2.5 0 0 -1 0 1 1 1 02 0 2.5 0 0 -1 1 0 5 -1.5 43 0 2.5 1 1 -1 1 0 5 -1.5 44 0 2.5 0 0 -1 0 2.5 2.5 1 05 0 2.5 0 0 -2.5 2.5 0 5 1 06 0 2.5 0 0 -2.5 2.5 0 5 -1.5 1

Table 10: Position of sensors and emitter configurations for case two as shown in Figures40 and 41.

104

CHAPTER V

EXPERIMENTAL RESULTS

5.1 At IDCAST

We ran the tests with and without obstructions in the sensing field. The accuracy of the

estimation was determined by comparing the estimated and actual positions of the emitter.

Figure 42 is a collection of pictures that illustrate the experimental apparatus developed

for PADF experiments at IDCAST [7]. The partially sealed enclosure with the embedded

non-cooperative emitter is shown in the two pictures on the left and also in the picture on

the lower right. The enclosure is covered with aluminum foil on all sides, except the front,

in order to simulate an embedded RF environment with one leakage point. The base station

for this WSN is shown on the upper right.

We have developed a Graphical User Interface (GUI) using MATLAB that allows for

easy implementation of the PADF concepts. The GUI inputs the cartesian coordinates

of known nodes, along with the hidden emitter, and gives a prediction or estimation as

to where the hidden node could be. Based on the location of the actual hidden emitter

compared to estimated hidden emitter, we determine an absolute error, which shows the

accuracy of the localization technique. For a proof of concept, we know the location of

the hidden emitter. Four x and y positions are used to estimate the transmitter’s position.

105

Figure 42: Selected pictures of experimental apparatus developed for PADFinvestigations at IDCAST [7].

106

On the other side of the loop, the IRIS nodes themselves gather the RSS from emitter to

receiver and forward that information to the base station wirelessly, which is then sent to

the same MATLAB station via USB. The GUI merges the position data of the nodes as

well as its corresponding RSSI measurements, and performs the LSE in order to estimate

the location of the hidden emitter.

The blue curve in Figure 43 depicts the resulting PADF error metric e that we pro-

posed in chapter 3 as a multi-platform RF-scattering-based objective function for purposes

of multi-platform position adaptation and, in turn, multi-platform localization of embedded

emitters. Rough correlation between the basic trends in new RF objective function (blue

curve) and localization error (red curve) indicates potential for further development of this

type of technique for RF measurement and sensing applications. There exists a distinctly

observable correlation between the overall trend or shape of the red curve and blue curve

for this particular data set. This type of correlated trend between the two curves implies

that the PADF error metric e developed during this investigation shows promise for fur-

ther development and investigation as a multi-platform objective function for purposes of

furthering the advancement of PADF systems.

The basic trends and potential candidate approaches to further analysis/development of

PADF techniques that are indicated via analysis of this IDCAST data set as shown in Figure

43.

Moreover, Figure 44 shows a different collection of pictures that illustrate the experi-

mental apparatus developed for PADF experiments at IDCAST.

107

Figure 43: MATLAB GUI for PADF calculation [99], showing sample outputdepicting a PLE-based RF scattering error metric (blue curve) versuslocalization error (red curve).

108

Figure 44: Collection of pictures that illustrate the experimental apparatus developed forPADF experiments at IDCAST.

109

5.1.1 Case One

Without Obstruction

After running five different configurations, the first configuration had the lowest error.

This is an expected result since LSE is based on the intersection of the RSSI circles from all

of the receiving nodes. According to Table 11, the first two configurations have the lowest

localization error.

Test Actual (m) Error ErrorCofig. x y (m) Metric

1 0 2.5 0.2231 12.28182 0 2.5 0.8182 10.58443 0 2.5 0.8343 12.82444 0 2.5 1.4954 17.79535 0 2.5 1.6901 17.2774

Table 11: IRIS platform for multiple configurations with error and error metric (case onecorresponds to configurations 1-5 from Figure 37).

We can observe from Figure 45 that there is a high value of cross-correlation. To see

this, let

Z =| e− e |

e. (38)

For Figure 45, we obtain mean(Z) = 0.9315, and std(Z) = 0.0305, which denote

high correlations. Similarly, for the experiment with obstruction in Figure 46, we obtain

mean(Z) = 0.8971, and std(Z) = 0.0296.

110

Figure 45: Metric (unitless) and error (meters) for multiple configurations(corresponds to case one configurations 1-5 from Figure 37).

With Obstruction

These experiments were carried out with sensor nodes placed around the partially sealed

enclosure. In this case, configurations where nodes were grouped in front of the leakage

point allowed for more accurate emitter localization. The foil on the three sides shields

the RF signal and attenuates the RSSI values. The only opening was the front face of the

enclosure, causing the RSSI values to be larger in the front of the enclosure. Thus, the

position estimation is more accurate. These results are shown in Table 12.

111

Test Actual (m) Error ErrorCofig. x y (m) Metric

1 0 2.5 0.7965 15.01352 0 2.5 1.3937 13.50183 0 2.5 1.2931 11.91084 0 2.5 1.9275 15.83725 0 2.5 1.9959 15.5860

Table 12: IRIS platform for multiple configurations with error and error metric (case onecorresponds to configurations 1-5 from Figure 38 ).

Figure 46: Metric (unitless) and error (meters) for multiple configurations(case one corresponds to configurations 1-5 from Figure 38).

112

5.1.2 Case Two

Without Obstruction

After running six different configurations for case two, configuration 4 had the lowest

error. Table 13, shown below, is the error and error metric results for case two.

Test Actual (m) Error ErrorCofig. x y (m) Metric

1 0 2.5 0.9051 10.82692 0 2.5 1.1319 11.44253 0 2.5 0.7636 10.18564 0 2.5 0.2122 12.32025 0 2.5 0.5622 10.95006 0 2.5 0.2879 10.4371

Table 13: IRIS platform for multiple configurations with error and error metric(case two corresponds to configurations 1-6 from Figure 40).

By using Equation 38, we can observe a high value of cross-correlation, similar to case

one. For Figure 47, we obtainmean(Z) = 0.9411, and std(Z) = 0.0324, which denote high

correlations as well. Similarly, for the experiment with obstruction in Figure 48, we obtain

mean(Z) = 0.9139, and std(Z) = 0.0273.

With Obstruction

These experiments were carried out with sensor nodes placed around the partially sealed

enclosure. In this case, configurations where nodes were grouped in front of the leakage

point allowed for more accurate emitter localization, similar to case one. The results for

case two are shown in Table 14.

113

Figure 47: Metric (unitless) and error (meters) for multiple configurations(corresponds to case two configurations 1-6 from Figure 40).

Test Actual (m) Error ErrorCofig. x y (m) Metric

1 0 2.5 1.8478 13.77812 0 2.5 1.3102 16.35383 0 2.5 1.7472 17.23234 0 2.5 0.6920 9.53685 0 2.5 0.7942 11.65126 0 2.5 0.8170 13.5178

Table 14: IRIS platform for multiple configurations with error and error metric(case two corresponds to configurations 1-6 from Figure 41).

114

Figure 48: Metric (unitless) and error (meters) for multiple configurations(corresponds to case two configurations 1-6 from Figure 41).

5.2 Experiments at AFRL MAV LAB

As previously mentioned, integrating the networked PADF mote sensors from the dis-

cretized PADF experiment design at IDCAST onto a combination of continuously adapt-

able mobile platforms can enable the investigation of a number of significant refinements

to the present baseline PADF technique as outlined in the previous sections. These poten-

tial refinements are described and modeled within the dotted circle block of the modified

functional PADF block diagram in Figure 49.

In order to further investigate PADF concepts in a indoor MAV Lab environment, two

scenarios were experimentally evaluated, as shown in Figures 50 and 51. In these sce-

narios (labeled MODE1 and MODE2), three receivers are stationary and one is mobile.

115

Figure 49: Functional block diagram model for PADF development with optional steps forimproving robustness and accuracy.

In MODE1, the mobile sensor follows a circular trajectory, and in MODE2 it follows a

zig-zag trajectory.

As depicted in Figure 50, in MODE1 a MAV that is integrated with a custom sensor

mote for networked cooperative PADF is flown in a circular trajectory around an experi-

mental region-of-interest. The box partially wrapped with aluminum foil and then covered

with black cloth to avoid inducing ambiguities in the distributed camera-based optical nav-

igation system. An embedded emitter (i.e., a non-cooperative sensor mote) is placed in

the embedded closure in the vicinity of a RF leakage point that is cut out from the front

of the enclosure. The basic functionality of MODE1 is the detection and demarcation of

a contoured sub-interval as indicated by the contour endpoint symbols, C1 and C2, in the

MODE1 diagram in Figure 50. The MODE2 configuration is shown on Figure 51.

116

Figure 50: MODE1 experimental PADF concept using MAVs with wireless sensor nodes.

117

Figure 51: MODE2 experimental PADF concept using MAVs with wireless sensor nodes.

118

The contour limits, C1 and C2, in MODE1 are computed by applying thresholds on the

RSSI data collected by the MAV during the circular trajectory encompassed by MODE1.

Computation of the C1 and C2 sub-contour limits, in turn, enable the placement of two

RC-controlled ground vehicles in the vicinity of points C1 and C2 during the beginning

phases of MODE2 data collections. In addition, the MAV helicopter platform is placed at a

slight standoff distance from the center of the detected contour interval for the RF leakage

point in front of the enclosure.

During the dynamic data collection phases of the MODE2 portion of these MAV lab

experiments, a fourth PADF sensor mote platform (i.e., another RC-controlled ground ve-

hicle) is operated in either a localized zig-zag pattern or a localized circular pattern. For the

data analysis in this paper, data from moving the forth PADF sensor mote platform along a

10-point localized circular pattern is presented.

Figures 52 and 53 illustrate some desirable properties of potential error metric e de-

veloped for this investigation in the sense that the PLE RF-scattering-based multi-platform

control metric computation (blue curve) displays the same general trends as the localization

error (red curve). One of the most significant interpretations that can be derived via obser-

vation and analysis of these plots is the occurrence of isolated regions of relative stability

associated with the distance.

119

Figure 52: Metric and error for circular trajectory.

120

Figure 53: Metric and error for 10-point zigzag.

121

CHAPTER VI

SOURCE SEEKING BASED EXTREMUM SEEKING CONTROL

6.1 Why Extremum Seeking Control

Traditional control system design deals with the problem of stabilization of a system

about a known reference trajectory or set point while attaining certain design criteria. This

general stabilization problem includes the so-called “tracking” and “regulation” problem.

The reference is often easily determined. However, in some occasions it can be very diffi-

cult to find a suitable reference value. For instance, the fuel consumption of a car depends

on the ignition angle. It is necessary to change the ignition angle as the condition of the

road and the load of the car change to maintain optimal efficiency.

Tracking a varying maximum or minimum (extremum, optimum) of a performance

(output, cost) function is called Extremum Seeking Control (ESC) [232]. It has two layers

of meaning: first, we need to seek an extremum of the output function; secondly, we need to

be able to control (stabilize) the system and drive the performance output to that extremum

[233]. In the traditional optimal control problem, the performance function generally is an

integral function of the state and control, that is, the extremum of the performance function

is a trajectory. Therefore, the calculus of variation method is involved in the design, and

122

the analytical form of the performance function is needed to obtain the necessary condi-

tions of the optimal control. However, in ESC, the performance function is generally a

function of the state and not known or poorly known in the design. We can only design an

extremum seeking controller based on the measurements of the performance output or its

derivatives if available [234]. The goal of an ESC is to operate at a set-point that optimizes

the performance function. A general block diagram of ESC can be found on Figure 54.

Figure 54: General block diagram for extremum seeking control.

ESC is related to optimization; many of the ideas used in ESC have been transferred

from numerical optimization. Developments in computers and optimization have led to a

renewed interest in ESC. Many investigations of ESC systems assume that the system is

static, which can be justified if the time between the changes in the optimal reference is

sufficiently long. Then, the extremum seeking is reduced to an optimization problem in

some sense.

ESC is applicable in situations where there is a nonlinearity in the control problem, and

the nonlinearity has a local minimum or a maximum. The nonlinearity may be in the plant,

as a physical nonlinearity, possibly manifesting itself through an equilibrium, or it may be

123

in the control objective, added to the system through a cost functional of an optimization

problem. Hence, one can use ESC both for tuning a set point to achieve an optimal value

of the output, or for tuning parameters of a feedback law [235]. ESC is of great practical

interest, since even small improvements in the performance can lead to large savings in raw

material and energy consumption. There are commercial extremum seeking controllers.

6.1.1 History and Literature Overview

The emergence of ESC dates as far back as the 1922 paper of Leblanc [236], and it

was popular in 1950s and 1960s [237, 238, 239, 240, 241, 242], which have been pursued

largely by Russian researchers and much before the theoretical breakthroughs in adaptive

linear control of the 1980’s. A historical development of ESC is stated in [235] and then it

reviews the existing literature especially for the last decades. Several books in the 1950s-

60s have been exclusively or partly dedicated to extremum seeking control, such, Tsien

[243] (1954), Feldbaum [244] (1959), Krasovskii [245] (1964), Wilde [246], and Chinaev

[247] (1969).

In the traditional application of ESC, the optimal parameters were assumed to vary

rather slowly. Then, system dynamics were typically neglected and the algorithm was

analyzed and designed using traditional “static optimization” techniques [248, 249]. Many

investigations of ESC systems assume that the dynamic system is static, which can be

justified if the time between the changes in the optimal reference is sufficiently long. ESC

of static systems is in essence a problem of numerical optimization [232], which can be

approached by the continuous (analog) implementations of some optimization methods,

the so called “analog optimization” approach (such as sinusoidal perturbation and sliding

124

mode-based analog optimization). ESC witnessed a resurgence of interest after Krstic’s

publication of stability studies on perturbation-based ESC in [250] and [251].

The first rigorous proof [250] of local stability of perturbation based ESC scheme uses

averaging analysis and singular perturbation, where a high-pass filter and slow perturba-

tion signal are employed to derive the gradient information. Reference [235] presents a

systematic description of the perturbation-based ESC and its applications. New progress

in semiglobal stability appears in [252]. Gradient estimation-based extremum seeking con-

trol is studied in [253]. ESC based on sliding mode are studied in [255, 256, 257], where

time delay, excessive oscillation and performance improvement issues are addressed. Ex-

tremum seeking via continuous time nonderivative optimizers is proposed in [259]. An

ESC problem is proposed and solved in [258] for a class of nonlinear systems with un-

known parameters, where an explicit structure information for the performance function to

be maximized is required.

Numerical optimization-based ESC methods were used successfully. Now, the require-

ment for gradient measurements is not continuous, and it may have time to collect enough

output measurements to estimate the gradient. Moreover, there are non-gradient numeri-

cal optimization algorithms that can be implemented as well. ESC via triangular search

as in Zhang [265] was employed to attenuate combustor thermoacoustic oscillations and

minimize diffuser losses at United Technologies Research Center (UTRC). Nonlinear pro-

gramming was successfully used in extremum seeking control by defining a readout map as

a steady state output function [254]. Simultaneous Perturbation Stochastic Approximation

(SPSA) recursive algorithm is used in the ESC design [259]. More systematic studies by

Zhang and Ordonez on numerical optimization-based ESC first appeared in [260], and then

125

in [261, 262, 263, 264], where numerical optimization algorithm and state regulation are

combined to design the ESC scheme.

6.1.2 Applications of Extremum Seeking Control

An extremum controller having no special trial steps or oscillations can be designed

if some a priori knowledge about the plant and its disturbance exist [266]. That is, the

extremum characteristic of the plant is unimodal and can be approximated by second or

third-order polynomials, the distribution of the disturbances is close to uniform and the

value of the optimum changes slowly. A self tuning concept is applied to the extremum

control problem in [267]. ESC of Wiener type systems is consider in [268], the linear

subsystem is described by a discrete-time systems with delay and Gaussian distributed

white noise. The nonlinearity is described as a quadratic function with a unique minimum.

Therefore, the author solves the minimum of the output and the purpose of the control is

to keep the output as close as possible to the minimum. ESC based on probing strategy

can be found in [269], the stability and performance issues are performed further in [270].

Discrete-time extremum seeking algorithms for SISO nonlinear systems are proposed in

[271], where the reference-to-output equilibrium map is approximated via a quadratic poly-

nomial. The extremum can be explicitly solved by the polynomial parameters, then three

extremum seeking algorithms are proposed based on the way how they estimate the poly-

nomial parameters, which are least square estimation, parabola approximation and ellipse

approximation. A similar study can be found in [272].

126

Among the many applications of ESC overviewed in [248] and [232] are combustion

processes, grinding processes, solar cell and radio telescope antenna adjustment to maxi-

mize the received signal, and blade adjustment in water turbines and wind mills to max-

imize the generated power. Recent applications include Antilock Braking System(ABS)

design [235], exercise machine [273], optimizing bioreactor [274] formation control [275]

limit cycle minimization [276], axial-flow compressor [277], combustion instability [278],

fermentation processes [279], engine optimization [280], wind turbine [281], flow sepa-

ration control in diffusers [282], tubular reactor [283], electromechanical valve actuator

[284], thermoacoustic cooler [285], blending processes [286], plasma control [287], PID

tuning [288], maximum power point tracking [289] and source seeking without position

measurements [290].

Control of a single or a group of autonomous agent and sensor networks is one of

the most active research area recently. Source seeking or (source localization), i.e., the

design of control algorithms for autonomous agents to seek a source with unknown spatial

distribution is of great interest, where ESC can be naturally used in the design. Even though

it is an application having great theoretical interest, it also does have a significant impact

on engineering applications: for instance, in the problem of the developing vehicles with

more autonomy, such as the situation where no GPS information is available, or to reduce

cost due to position sensors. Some of the direct applications of source seeking can be found

in contaminant plume control, autonomous odor sensing or toxic leakage localization. In

the application of source seeking, the task of the vehicle is to find a source that emits a

signal that decays as a function of distance away from the source, where the signal field is

unknown and only the measurement of the signal at the current agent location is available

[233].

127

A basic diagram of source seeking in Figure 55, where the control goal is for the agent

to seek an extremum of an unknown signal field based on the measurement of the signal

only [233].

Figure 55: Source Seeking.

The application of ESC in group source seeking (namely, swarm seeking) has emerged

recently as well. Swarm seeking is approached via a leader-follower format in [291], and

ESC is used to guide the leader vehicle to seek the source; then a passivity framework is

used to design the followers’ coordination laws.

6.2 Swarm Source Seeking

The problem of coordination and control of autonomous vehicles (agents) has been

receiving an extraordinary amount of attention during the past decade due to its critical

importance for military, as well as civilian applications. Research on vehicle autonomy will

open up the door to a myriad of applications. For instance, the use of robots for navigating

and inspecting dangerous areas could be made cheap, reliable and wide-spread. Other

similar uses include search over wide areas and automated geographical and topological

surveying. Moreover, providing vehicles and robots with autonomy would enormously

128

facilitate planetary exploration, where automated construction of structures and surveying

of areas would help reduce the amount of the much more costly and risky alternative, that

of direct human intervention. Possible applications could range from autonomous robot

assembly to UAVs scout and counter insurgency. Compared to individuals, swarms, flocks,

and schools can have remarkable group-level characteristics, which may allow them to

perform complicated task efficiently [233].

In recent years it has become an active area of research to study the biological world and

apply the derived principles to the design of engineering. The topic of distributed coordina-

tion and control of multiple autonomous agents has gained lots of attention [292, 293, 294].

Cooperative agents can often be used to perform tasks that are too difficult for a single one

to perform. Instead of the traditional trajectory tracking problem, people began to study co-

ordinated tracking [295, 296] The swarm source seeking problem is to find a coordinated

control scheme for a group of agents to make them achieve and maintain some given geo-

metrical formation. At the same time, the agents need to seek a source of a scalar signal, or

track a moving target [234]. Thus, there is a trade-off between maintaining formation and

arriving at the final goal [291, 298, 297]. Motivated by the work in [299], swarm tracking

is achieved via artificial potentials and ESC. Possible approaches for formation control in-

clude leader-following and the virtual structure approaches [300, 301]. In both approaches,

one agent, which could be real or virtual, is designated as leader to perform the tracking

task without considering the followers, and the remaining agents only have to stay from the

leader within a desired offset, without considering the target. However, these approaches

are centralized and therefore not robust – if the leader fails, the task would also fail. In that

case, decentralized formation control is preferred as discussed in [302], where feedback

control laws are used to keep the formation during tracking process.

129

The potential functions have been first widely used for robot navigation and control

including multi-agent coordination [300, 303, 304, 305]. A potential function is created

to contain the scalar signal to be tracked, as well as the interaction rules for the group of

agents. By minimizing the potential function, one is able to achieve source seeking, forma-

tion control, and collision avoidance. Extremum seeking techniques are used to design the

controller for each agent.

6.3 Problem Statement

The problem statement is mainly based on the work by Yao, Ordonez and Gazi in

[299]. Consider a multi-agent system (i.e., a swarm) consisting of N individuals in an

n-dimensional Euclidean space. We assume synchronous motion and no time delays. Let

x ∈ Rn denote a vector n-dimensional Euclidean space, and xi ∈ Rn denote the position

vector of individual agent i, whose motion is governed by the following velocity actuated

point-mass kinematic model,

xi = ui, (39)

where ui ∈ Rn is the control input for the ith sensor. Our purpose is to design a control

law for each individual sensor using extremum seeking methods that can minimize the

error metric by adapting the sensor positions in real-time, thereby minimizing the unknown

estimation error. As a result, we can achieve source seeking and collision avoidance.

In this chapter we consider a potential function composed of several parts. First, the

inter-connection component puts a constraint on the sensor, based on its neighbors’ posi-

tions, in order to maintain a group structure. This part includes functions of the relative

distance between each pair of neighbors. In addition, a tracking component containing the

130

error metric to be tracked is added in order to direct the group’s behavior for source seek-

ing. This tracking component could be an artificial potential function given the knowledge

of target position, or the concentration of a chemical source, or an RF source, as in our

problem [233].

The specific form of potential function is defined according to the desired geometric

formation. The choice of a potential function is important because different potentials

might result in different performance even with the same control algorithm.

First, consider a potential of the form of the error metric we proposed in chapter three

to estimate the localization error for a given sensor configuration, given by:

Jmetric(x1, x2, . . . , xN , xt) =

(3

√Dmax

10 +Dmin

+2√

|MPLE|+

1

std(G)

). (40)

Second, consider the potential function for “sensor to sensor” interaction, given by

Jaa(x1, x2, . . . , xN) =

N−1∑i=1

N∑j=1,j 6=i

1

ε+ (‖xi − xj‖), (41)

where1

ε+ (‖xi − xj‖)is the potential between the ith and the jth sensor agents, whose

purpose is to provide a repulsive force between agents. Such potentials can be obtained if

one knows the relative distance between sensors, or by measuring a possible field distribu-

tion generated by the sensor.

131

Now, we can put the swarm tracking problem into the framework of ESC design. Let

y = J(x1, x2, . . . , xN , xt)

= KatJmetric(x1, x2, . . . , xN , xt) +KaaJaa(x

1, x2, . . . , xN)

= Kat(3

√Dmax

10 +Dmin

+2√

|MPLE|+

1

std(G)) +Kaa

N−1∑i=1

N∑j=1,j 6=i

1

ε+ (‖xi − xj‖),

(42)

be the performance function of the system (39) for i = 1, . . . , N , where Kat, Kaa are

the weights of the potential components, which is important in balancing the priority in

source seeking and inter-agent avoidance. Our objective is to reach the sensor network

configuration that minimizes the localization error, while avoiding collisions. A block

diagram can be found in Figure 56.

In particular, successful implementation of the detection system initiates the integra-

tion of a sensor position control system in the feedback loop so as to make the process

autonomous using ESC, as shown in Figure 56. This figure, as we can see, describes the

ESC closed-loop with the potential function (42) that was used in this simulation and im-

plementation.

Now, we will study two cases where each one considers two situations, which is with

and without obstruction. In the first case, one moving mote, used as a mobile sensor, is used

together with three fixed motes. The second case considers four moving motes together as

mobile sensors. Furthermore, another simulation implemented the Monte Carlo method of

testing to determine the mean, standard deviation and median of the localization error and

the error metric.

132

Figure 56: ESC closed-loop with potential function that can attain trueposition-adaptive sensor network reconfiguration autonomously.

6.4 Simulation Results Without Obstruction for Two Different Cases

6.4.1 Case One

In this case, we considered three sensor agents fixed and one moving as a mobile sensor,

where the target emitter is fixed at (0, 2.5) (used throughout these cases).

Example One

In this example, we considered three sensor agents fixed, sensor agent number 1 as-

signed at (0, 0), sensor agent 2 at (-1, 0), sensor agent 3 at (0, -1), and sensor agent number

4 is consider as a mobile sensor, where the initial position at (1, 0).

133

The results for this example experiments are shown below in Figures [57 - 60]. The

entire movements of the sensors can be found in Figure 57, where source seeking and col-

lision avoidance are successfully achieved. The initial position of sensor agent number 4

is shown with a green circle, and the agents’ final positions are shown with yellow square.

The hidden transmitter is marked with a green asterisk. The performance function is mini-

mized as seen in Figure 58. The error metric is minimized as well and can be seen in Figure

59, and the localization error is minimized and can be seen in Figure 60.

For simulation purposes, we consider a two dimensional case where n = 2 and four

sensors N = 4, Kat = 1, Kaa = 0.1, ε = 0.1. The simulation time interval is [0, 50] time

units.

Figure 57: Trajectory of the swarm sensors “without obstruction” using ESC for caseone example one.

134

Figure 58: Potential functions “without obstruction” for case one example one.

Figure 59: Error metric “without obstruction” for case one example one that isminimized by ESC .

135

Figure 60: Localization error “without obstruction” for case one example onethat is minimized by ESC.

Example Two

In this example, we considered three sensor agents fixed, sensor agent number 1 as-

signed at (0, 0), sensor agent 2 at (-1, 0), sensor agent 3 at (0, -1), and sensor agent number

4 is considered as a mobile sensor, where the initial position is chosen randomly.

The results for this example experiments are shown below in Figures [61 - 64]. The

entire movements of the sensors can be found in Figure 61, where source seeking and col-

lision avoidance are successfully achieved. The initial position of sensor agent number 4

is shown with a green circle, and the agents’ final positions are shown with yellow square.

The hidden transmitter is marked with a green asterisk. The performance function is mini-

mized as seen in Figure 62. The error metric is minimized as well and can be seen in Figure

63, and the localization error is minimized and can be seen in Figure 64.

136

Figure 61: Trajectory of the swarm sensors “without obstruction” using ESC forcase one example two.

Figure 62: Potential functions “without obstruction” for case two example two.

137

Figure 63: Error metric “without obstruction” for case one example two that isminimized by ESC .

Figure 64: Localization error “without obstruction” for case one example twothat is minimized by ESC.

138

6.4.2 Case Two

For case two, we considered all four sensor agents moving together as mobile sensors,

and the target emitter fixed.

Example One

In this example, we consider all four sensor agents moving together as mobile sensors,

where the initial positions of the sensor agents mobile sensors are chosen randomly.

The results for this example experiments are shown below in Figures [65 - 68]. The

entire movements of the sensors can be found in Figure 65, where source seeking and col-

lision avoidance are successfully achieved. The initial position of sensor agent number 4

is shown with a green circle, and the agents’ final positions are shown with yellow square.

The hidden transmitter is marked with a green asterisk. The performance function is mini-

mized as seen in Figure 66. The error metric is minimized as well and can be seen in Figure

67, and the localization error is minimized and can be seen in Figure 68.

6.5 Simulation Results With Obstruction for Two Different Cases

6.5.1 Case One

In this case, we considered three sensor agents fixed and one moving as a mobile sensor,

where the target emitter is fixed at (0, 2.5) (used throughout these cases).

Example One

In this example, we considered three sensor agents fixed, sensor agent number 1 as-

signed at (0, 0), sensor agent 2 at (-2.5, 2.5), sensor agent 3 at (0, 5), and sensor agent

number 4 is consider as a mobile sensor, where the initial position at (2.5, 2.5).

139

Figure 65: Trajectory of the swarm sensors “without obstruction” using ESC forcase one example two.

Figure 66: Potential functions “without obstruction” for case two example two.

140

Figure 67: Error metric for case one example two “without obstruction” that isminimized by ESC .

Figure 68: Localization error “without obstruction” for case oneexample two that is minimized by ESC.

141

The results for this example experiments are shown below in Figures [69 - 72]. The

entire movements of the sensors can be found in Figure 69, where source seeking and col-

lision avoidance are successfully achieved. The initial position of sensor agent number 4

is shown with a green circle, and the agents’ final positions are shown with yellow square.

The hidden transmitter is marked with a green asterisk. The performance function is mini-

mized as seen in Figure 70. The error metric is minimized as well and can be seen in Figure

71, and the localization error is minimized and can be seen in Figure 72.

For simulation purposes, we consider a two dimensional case where n = 2 and four

sensors N = 4, Kat = 1, Kaa = 0.1, ε = 0.1. The simulation time interval is [0, 50] time

units.

Figure 69: Trajectory of the swarm sensors “with obstruction” using ESC forcase one example one .

142

Figure 70: Potential functions “with obstruction” for case one example one.

Figure 71: Error metric “with obstruction” for case one example one that is minimized byESC .

143

Figure 72: Localization error “with obstruction” for case one example onethat is minimized by ESC.

Example Two

In this example, we considered three sensor agents fixed, sensor agent number 1 as-

signed at (0, 0), sensor agent 2 at (-2.5, 2.5), sensor agent 3 at (0, 5), and sensor agent

number 4 is considered as a mobile sensor, where the initial position is chosen randomly.

The results for this example experiment are shown below in Figures [73 - 76]. The

entire movements of the sensors can be found in Figure 73, where source seeking and col-

lision avoidance are successfully achieved. The initial position of sensor agent number 4

is shown with a green circle, and the agents’ final positions are shown with yellow square.

The hidden transmitter is marked with a green asterisk. The performance function is mini-

mized as seen in Figure 74. The error metric is minimized as well and can be seen in Figure

75. The localization error is minimized and can be seen in Figure 76.

144

Figure 73: Trajectory of the swarm sensors “with obstruction” using ESC forcase one example two.

Figure 74: Potential functions “with obstruction” for case one example two.

145

Figure 75: Error metric “with obstruction” for case one example two that is minimized byESC.

Figure 76: Localization error “with obstruction” for case one example twothat is minimized by ESC.

146

6.5.2 Case Two

For case two, we considered all four sensor agents moving together as mobile sensors,

and the target emitter fixed.

Example One

In this example, we considered all four sensor agents moving together as mobile sen-

sors, where the initial position of sensor agent number 1 are chosen at (0, 0), sensor agent

2 at (-2.5, 2.5), sensor agent 3 at (0, 5), and sensor agent 4 at (2.5, 2.5).

The results for this example experiment are shown below in Figures [77 - 80]. The

entire movement of the sensors can be found in Figure 77, where source seeking and col-

lision avoidance are successfully achieved. The sensor agents’ positions are shown with

green circles, and the agents’ final positions are shown with yellow square. The hidden

transmitter is marked with a green asterisk. The performance function is minimized as

seen in Figure 78. The error metric is minimized as well and can be seen in Figure 79. The

localization error is minimized and can be seen in Figure 80.

Example Two

In this example, we consider all four sensor agents moving together as mobile sensors,

where the initial positions of the sensor agents mobile sensors are chosen randomly.

The results for this example experiment are shown below in Figures [81 - 84]. The

entire movements of the sensors can be found in Figure 81, where source seeking and

collision avoidance are successfully achieved. The sensor agents’ positions are shown with

green circles, and the agents’ final positions are shown with yellow square. The hidden

transmitter is marked with a green asterisk. The performance function is minimized as

147

Figure 77: Trajectory of the swarm sensors “with obstruction” using ESC forcase two example one.

Figure 78: Potential functions “with obstruction” for case two example one.

148

Figure 79: Error metric “with obstruction” for case two example one is minimized by ESC.

Figure 80: Localization error “with obstruction” for case two example onethat is minimized by ESC.

149

seen in Figure 82. The error metric is minimized as well and can be seen in Figure 83. The

localization error is minimized and can be seen in Figure 84.

Figure 81: Trajectory of the swarm sensors “with obstruction” using ESC forcase two example two.

6.6 Monte Carlo Implementation

A Monte Carlo experimental approach was taken to simulate the two different cases,

mentioned above, where the initial positions of the mobile sensors are chosen randomly for

each simulation run. This was used to verify the ESC algorithms, to prove that the error

metric and localization error are minimized on average by adapting the sensors’ positions.

For the two cases mentioned above, the standard deviation, median, and mean error metric

and localization error were calculated for five hundred randomized experiments. In each

150

Figure 82: Potential functions “with obstruction” for case two example two .

Figure 83: Error metric “with obstruction” for case two example two that is minimized byESC.

151

Figure 84: Localization error “with obstruction” for case two example twothat is minimized by ESC.

simulation, four mote positions were chosen randomly. The standard deviation, median,

and the mean for the error metric and localization error were then calculated for the initial

and final simulations. Tables 15 and 16, shown below, show the calculated values for both

experimental cases. The simulation time interval is [0, 50] time units.

Experiment Mean Std. Median Mean Std. MedianCase (e(0)) (e(0)) ( e(0)) ( e(50)) ( e(50)) ( e(50))

One sensor moving 2.5625 0.5056 2.5020 2.3045 0.4387 2.3242

Four sensors moving 2.6061 0.5156 2.5708 2.4941 0.4698 2.4082

Table 15: Monte Carlo study for 500 simulations, where e(0) means error metric for initialsimulation, and e(50) means error metric for final simulations.

152

Experiment Mean Std. Median Mean Std. MedianCase (e(0)) (e(0)) ( e(0)) ( e(50)) ( e(50)) ( e(50))

One sensor moving 2.4100 0.9284 2.8469 2.2743 0.7531 2.4280

Four sensors moving 2.2236 0.3424 2.0634 2.0878 0.6275 1.9794

Table 16: Monte Carlo study for 500 simulations, where e(0) means localization error forinitial simulation, and e(50) means localization error for final simulations.

As shown in Table 15, the initial mean for case one and case two were 2.5626 and

2.6061, respectively. The final mean for case one and case two were 2.3045 and 2.4941,

respectively. The final values were lower than the initial values, which suggest that the

ESC algorithms operated as intended. The same holds true for the initial and final standard

deviations, and the initial and final medians as well.

Moreover, Figure 85 shows the plot of the five hundred calculated values of the mean

error metric, standard deviation, and median for case one. This plot holds true, as well, for

case 2 and can be see in Figure 86.

Figure 87 shows the plot of the five hundred calculated values of the mean localization

error, standard deviation, and median for case one. This plot holds true, as well, for case 2

and can be see in Figure 88.

Figures 89 and 90 show the contour plot of the error metric and the localization error,

respectively, for case one, where mote number four moved on a grid spanning the space

[-2.5, 2.5] × [0, 5] meters, at intervals of 5 cm along each dimension, and the other three

motes are fixed. Mote number one is at (0, 0), mote two at (-2.5, -2.5) and mote three at (0,

5) in the Cartesian plane. These plots show that the error metric is sufficiently correlated

with the localization error, although it is not perfect. The mismatch between error metric

153

(a) (b)

(c)

Figure 85: Case one Monte Carlo study: (a) mean error metric; (b) standard deviationerror metric; (c) median error metric.

154

(a) (b)

(c)

Figure 86: Case two Monte Carlo study: (a) mean error metric; (b) standard deviationerror metric; (c) median error metric.

155

(a) (b)

(c)

Figure 87: Case one Monte Carlo study: (a) mean localization error; (b) standarddeviation localization error; (c) median localization error.

156

(a) (b)

(c)

Figure 88: Case two Monte Carlo study: (a) mean localization error; (b) standarddeviation localization error; (c) median localization error.

157

and actual error is the main reason why even though the ESC mechanism does manage to

minimize the potential, it does not always minimize the error.

Figure 89: Contour plot for error metric, where the sign indicates the position ofminimum metric value.

158

Figure 90: Contour plot for localization error, where the sign indicates the position ofminimum error value.

159

CHAPTER VII

CONCLUSIONS AND FUTURE WORK

7.1 Conclusions

In recent years, location estimation in WSN has raised a lot of interest from researchers.

The idea of having sensing data without any information of the location does not make

sense. Existing techniques, such as GPS are, usually, inappropriate in large scale networks,

due to the increase in the cost and size of the nodes. For that reason, a variety of lo-

cation estimation techniques has been proposed for WSNs. Recent advances in wireless

communications and electronics have enabled the development of low-cost, low-power and

multi-functional sensors that are small in size and communicate in short distances. Cheap,

smart sensors, networked through wireless links and deployed in large numbers, provide

unprecedented opportunities for monitoring and controlling homes, cities, and the environ-

ment.

WSNs is a kind of ad-hoc network. WSN is a network of many small sensing and

communicating devices called sensor nodes or motes, which can sense the environment

and communicate the information gathered from the monitored field through wireless links.

Sensor networks are low cost and low power devices, designed to collect data, do some

local computation and transmit partially processed data via radio frequency or bluetooth.

160

WSNs are being used in a variety of ways: from reconnaissance and detection in the

military to biomedical applications toward environmental sensing applications and a va-

riety of commercial endeavors. Most WSNs applications require knowing or measuring

locations of thousands of sensors accurately. For example, sensing data without knowing

the sensor location is often meaningless. Localization is the process of determining the

positions of nodes in an ad hoc network. It is an important problem that has attracted much

attention recently.

In WSNs, the distance between sensor nodes can be estimated by measuring RSSI.

The wireless RSSI based localization techniques have attracted significant research interest

for their simplicity. The RSSI based localization techniques can be divided into two cate-

gories: the distance estimation based and the RSSI profiling based techniques. The PLE is

a key parameter in the distance estimation based localization algorithms, where distance is

estimated from the RSSI.

Position-Adaptive radar concepts have been formulated and investigated at the AFRL.

This research introduced a PADF method using mobile sensor networks and presents the

latest experimental results in the localization of a non-cooperative sensor node using static

and mobile sensor networks. PADF is based on the formulation and investigation of path-

loss (PLE) based metrics that are measured and estimated across multiple platforms in order

to robotically/intelligently adapt the location of each platform. This approach shows po-

tential for accurate emitter localization in challenging embedded multi-path environments

(i.e., urban environments).

The results indicate the potential for developing intelligent PADF systems that incorpo-

rate novel and advanced processing features such as the capability to delimit or select the

useful data during dynamic PADF operations. Further pursuit of this type of PADF research

161

shows potential for the development of PADF systems that may demonstrate a degree of

robustness and localization accuracy via development and implementation of advanced dis-

tributed self data- pruning processes. In addition, some novel platform concepts are under

consideration for future tiers of research including PADF concepts with launchable pro-

jectiles and wirelessly remote-controlled integrated and ejectable RC helicopter blades and

RF apertures.

We have experimentally demonstrated that RSSI can effectively be used for localiza-

tion of hidden emitters in wireless sensor networks environment. Localization accuracy

is improved as the number of sensor nodes and their spatial distribution/spread increases.

We first reviewed the most relevant WSNs and localization algorithms. Then, we surveyed

the existing body of literature on these fields. Furthermore, initial results on PADF were

presented. We have introduced the concept of PADF applied to localization of hidden, non-

cooperative emitters where static and mobile nodes cooperate in the localization mission.

We provided a summary of recent experimental results in localization of a non-cooperative

sensor node using static and mobile sensor networks. In this study we used IRIS wireless

sensor nodes. In order to localize the transmitter, we used the RSSI data to approximate

the distance from the transmitter to the revolving receivers. We provided an algorithm for

on-line estimation of the PLE that is used in modeling the distance based on RSSI measure-

ments. The emitter position estimation was calculated based on surrounding sensors’ RSSI

values using LSE. The PADF method was tested on a number of different configurations

in the laboratory via the design and implementation of four IRIS wireless sensor nodes as

receivers and one hidden sensor as a transmitter during the localization phase. The robust-

ness of detecting the transmitter’s position was initiated by getting the RSSI data through

experiments and then data manipulation in MATLAB determined the robustness of each

162

node and ultimately of each configuration. The parameters that were used in the functions

are the median values of RSSI and rms values. From the result, it was determined which

configurations possess high robustness. High values obtained from the robustness function

indicated high robustness, while low values indicated lower robustness.

Finally, successful implementation of the detection system initiated the integration of a

sensor position control system in the feedback loop so as to make the process autonomous

using ESC. We presented the experimental performance analysis on the application aspect.

We applied ESC schemes by using the swarm source seeking approach, where we designed

a control law for each individual sensor using extremum seeking methods that can mini-

mize the error metric by adapting the sensor positions in real-time, thereby minimizing the

unknown estimation error. As a result, we achieved source seeking and collision avoidance.

7.2 Future Work and Open Problems

Currently we adopted this concept and integrated wireless sensor nodes to MAVs, thus

creating mobile nodes that can adapt their position to localize an RF source in three dimen-

sional space. This will be vital in detecting frequency signatures of harmful entities, for

instance explosives.

Some specific near-term plans include the integration and demonstration of IRIS sensor

nodes onto multiple TREX 600 RC helicopters (see Figures 91 and 92 [306]) platforms

(and/or combination of similar platforms) to demonstrate novel approaches to PADF.

Other than implementation, open problems that remain include the following:

• Improving the error metric function, potentially by using function approximators

such as neural networks.

163

Figure 91: Sample TREX 600 RC helicopter platform recently acquired by IDCAST tosupport PADF research via integration of onboard IRIS sensor motes.

• Studying theoretically the “estimation limits”, that is, the best possible level of accu-

racy achievable given a fixed number of sensors and the complexity of the environ-

ment.

• Application of the cooperative localization method explored in this dissertation to

problems not involving RF sensors, but instead for instance chemical and other types

of signals.

164

Figure 92: Integration and demonstration of IRIS sensor nodes onto multiple RChelicopters.

165

BIBLIOGRAPHY

[1] C-Y. Chong, S. P. Kumar, “Sensor networks: Evolution, opportunities, and chal-lenges,” Proceedings of the IEEE, Vol. 91, no. 8, August 2003.

[2] Y-T. Chen, C-L. Yang, Y-K. Chang and C-P. Chu, “A RSSI-based Algorithm for In-door Localization Using ZigBee in Wireless Sensor Network,” In Proceedings of the15th International Conference on Distributed Multimedia Systems (DMS 2009) , pp.70-75, San Francisco, USA, September 2009.

[3] E- E-L. Lau, B-G. Lee, S-C. Lee, and W-Y Chung, “Enhanced RSSI-Based HighAccuracy Real-Time User Location Tracking System for Indoor and Outdoor Envi-ronments,” International Journal on Smart Sensing and Intelligent Systems, Vol. 1,No. 2, June 2008.

[4] Y. Gwon, R. Jain, and T. Kawahara, “Robust Indoor Location Estimation of Stationaryand Mobile Users,” in Proc. of IEEE INFOCOM, March 2004.

[5] M. Sugano, T. Kawazoe, Y. Ohta, and M. Murata, “Indoor Localization System UsingRSSI Measurement of Wireless Sensor Network Based on ZigBee Standard,”in Proc.of Wireless Sensor Networks (WSN 2006), July 2006.

[6] S. Tennina, M. Renzo, F. Graziosi and F. Santucci, “Locating ZigBee Nodes Usingthe TI’s CC2431 Location Engine: A Testbed Platform and New Solutions for Posi-tioning Estimation of WSNs in Dynamic Indoor Environments,”in Proc. of the FirstACM International Workshop on Mobile Entity Localization and Tracking in GPS-less Environments (MELT 2008), September 2008.

[7] http://www.idcast.com/Pages/home.aspx.

[8] I. F. Akyildiz, W. Su, Y. Sankarasubramaniam, and E. Cayirci, “A Survey on SensorNetworks,” IEEE Communication Magazine, August 2002.

[9] IEEE Computer Society. IEE standard for information technology telecommunica-tions and information exchange between systems local and metropolitan area net-works specific requirements. In Part 15.4: Wireless Medium Access Control (MAC)and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Net-works (WPANs), 2006.

166

[10] S. Madden, et al., “TAG: A Tiny AGgregation Service for Ad-Hoc Sensor Networks,”OSDI, 2002.

[11] C. Intanagonwiwat, R. Govindan, and D. Estrin, “Directed Diffusion: A Scalableand Robust Communication Paradigm for Sensor Networks,” Mobile Computing andNetworking, 2000.

[12] C. Perkins, “Ad-hoc on-demand distance vector routing. MILCOM,” 1997.

[13] Berkeley, University of California, “800 node self-organized wireless sensor net-work,” 2001: http://today.cs.berkeley.edu/800demo/.

[14] L. Doherty, “Algorithms for Position and Data Recovery in Wireless Sensor Net-works,” UC Berkeley EECS Masters Report, 2000.

[15] J. Mclurkin, “Algorithms for distributed sensor networks,” Masters Thesis for Elec-trical Engineering at the University of California, Berkeley, 1999.

[16] K. Whitehouse and D.Culler, “Micro-calibration in Sensor/Actuator Networks,” UCBerkeley, 2003.

[17] N. Bulushu, D. Estrin, L. Girod, and J. Heidemann, “Scalable Coodination for Wire-less Sensor Networks: Self-Configuring Localization Systems,” Proceedings of 6thInternational Symposium on Communication Theory and Applications (ISCTA’01),Ambleside, Lake District, UK, 2001.

[18] A. Savvides, C.-C. Han, and M. B. Strivastava, “Dynamic fine-grained localization inAd-hoc networks of sensors,” Proceedings of 7th Annual ACM/IEEE InternationalConference on Mobile Computing and Networking (MobiCOM’01), PP. 166-179,Rome, Italy, 2001.

[19] D. Culler, D. Estrin, and M. Strivastava, “Overview of Sensor Networks,” IEEE Com-puter Society, 2004.

[20] D. Moore, J. Leonard, D. Rus, and S. Teller, “Robust distributed network localizationwith noisy range measurements,” in Proceedings of the Second ACM Conference onEmbedded Networked Sensor Systems (SenSys 04), Baltimore, USA, 2004.

[21] S. N. Simic, and S. Sastry, “A distributed algorithm for localization in random wirelessnetworks,” Discrete Applied Mathematics, UC Berkeley, November 2002.

[22] L. Hu, and D. Evans, “Localization for Mobile Sensor Networks,” Proceedings ofTenth Annual International Conference on Mobile Computing and Networking, 2004.

[23] T. He, C. Huang, B. Blum, J. Stankovic, and T. Abdelzaher, “Rangefree localizationschemes in large scale sensor networks,” In :Proc ACM-IEEE 9th Annu. Int. Conf.Mobile Computing and Networking MobiCom 03, 2003.

167

[24] A. H. Sayed, A. Tarighat, N. Khajehnouri, “Network-based wireless location : chal-lenges faced in developing techniques for accurate wireless location information,”IEEE Signal Processing Magazine, vol. 22, pp. 24-40, July 2005.

[25] S. Guolin, C. Jie, G. Wei, and K. J. R. Liu, “Signal processing techniques in network-aided positioning: a survey of state-of-the-art positioning designs,” IEEE Signal Pro-cessing Magazine, vol. 22, no. 4, pp. 1223, 2005.

[26] F. Gustafsson, and F. Gunnarsson, “Mobile positioning using wireless networks: pos-sibilities and fundamental limitations based on available wireless network measure-ments,” IEEE Signal Processing Magazine, vol. 22, no. 4, pp. 4153, 2005.

[27] N. Patwari, J. Ash, S. Kyperountas, I. Hero, A. O., R. Moses, and N. Correal, “Lo-cating the nodes: cooperative localization in wireless sensor networks,” IEEE SignalProcessing Magazine, vol. 22, no. 4, pp. 5469, 2005.

[28] J. Hightower, and G. Borriello, “Location systems for ubiquitous computing,” IEEEComputer, vol. 34, no. 8, pp. 5766, 2001.

[29] G. Sun, J. Chen, W. Guo, and K. J. R. Liu, “Signal processing techniques in net-workaided positioning a survey of state-of-the-art positioning designs,” IEEE SignalProcessing Magazine, vol.22, no. 4, pp. 73100, 2005.

[30] , M. Anlauff and A. Sunbul, “Deploying localization services in wireless sensor net-works,” In 24th International Conference on Distributed Computing Systems Work-shops, pp. 782787, 2004.

[31] R. Slaaen, “Clustering based localization for wireless sensor networks,” Masters the-sis, Washington State University, May 2006.

[32] S. Brands and D. Chaum, “Distance-bounding protocols,” In: Workshop on the theoryand application of cryptographic techniques on Advances in cryptology, PP. 344-359,New York: Springer-Verlag, 1993.

[33] N. Sastry, U. Shankar , D. Wagner, “Secure verification of location claims,” In: Pro-ceedings of the 2nd ACM workshop on Wireless security, PP. 1-10, San Diego, CA,USA, 2003.

[34] B. Waters E. Felten,“Proving the Location of Tamper Resistant Devices,” TechnicalReport. Princeton University, 2003.

[35] S. C apkun, L. nButtya, and H. J. P. SECTOR,“Secure tracking of node encounters inmulti-hop wireless networks,” In: Proceedings of the 1st ACM workshop on Securityof ad hoc and sensor networks, PP. 21-32, Fairfax, Virginia: ACM, 2003.

168

[36] P. Tao, A. Rudys , M. A. Ladd, et al.,“Wireless lan location-sensing for security ap-plications,” In: Proceedings of the ACM Workshop on Wireless Security, PP. 11-20,New York, NY, USA: ACM, 2003.

[37] R- H. Wu, Y-H. Lee, H-W. Tseng, Y- G. Jan, and M-H. Chuang,“Study of character-istics of RSSI signal,” Industrial Technology, ICIT 2008. IEEE International Confer-ence on, pp. 21-24, 1-3 April, 2008.

[38] Specification of the Bluetooth Core System 1.1, www.bluetooth.org.

[39] S. Capkun and J. Hubaux, “Securing localization with hidden and mobile base sta-tions,” to appear in Proceedings of IEEE Infocom, 2006.

[40] J. Bachrach and C. Taylor, “Localization in Sensor Networks,” Wiley and Sons, 2005.

[41] A. Boukerche, H. Oliveira, E. Nakamura, and A. Loureiro, “Localization systems forwireless sensor networks,” Wireless Communications, IEEE, vol. 14, no. 6, pp. 6-12,December 2007.

[42] H. Wymeersch, J. Lien, and M. Win, “Cooperative localization in wireless networks,”Proceedings of the IEEE, vol. 97, no. 2, pp. 427- 450, February 2009.

[43] A. S. K. Pathan, C. S. Hong, and H-W. Lee, “Smartening the environment using wire-less sensor networks in a developing country,” Advanced Communication Technol-ogy, 2006. ICACT 2006, The 8th International Conference, 1(20- 22): pp. 709-714,February 2006.

[44] M. Bal, M. Liu, W. Shen, and H. Ghenniwa, “Localization in cooperative WirelessSensor Networks: A review,” 13th International Conference on Computer SupportedCooperative Work in Design, pp. 438-443, April 2009.

[45] C. Wang and L. Xiao, “Sensor Localization under Limited Measurement Capabili-ties,” IEEE Network. Vol. 21, No. 3, pp. 16-23, May-June 2007.

[46] C. Savarese, J. M. Rabaey, and J. Beutel, “Locationing in distributed ad-hoc wirelesssensor networks,”In ICASSP, IEEE International Conference on Acoustics, Speechand Signal Processing, vol. 4, pp. 20372040, 2001.

[47] C. Savarese, J. Rabaey, and K. Langendoen, “Robust positioning algorithms for dis-tributed ad-hoc wireless sensor networks,” In USENIX technical annual conference,vol. 2. Monterey, CA, 2002.

[48] P. Bergamo, S. Asgari, H. Wang, D. Maniezzo, L. Yip, R. E. Hudson, K. Yao, and D.Estrin., “Collaborative sensor networking towards real-time acoustical beamformingin freespace and limited reverberance,” IEEE Transactions on Mobile Computing, vol.3, pp. 211224, 2004.

169

[49] J. Chen, R. Hudson, and K. Yao, “Maximum-likelihood source localization and un-known sensor location estimation for wideband signals in the near-field,” IEEE Trans-actions on Signal Processing, vol. 50, no. 8, pp. 18431854, 2002.

[50] M. L. Sichitiu and V. Ramadurai, “Localization of wireless sensor networks with amobile beacon,” IEEE International Conference on Mobile Ad-hoc and Sensor Sys-tems, October 2004.

[51] P. Bergamo and G. Mazzini, “Localization in sensor networks with fading and mo-bility,” in The 13th IEEE International Symposium on Personal, Indoor and MobileRadio Communications, vol. 2, pp. 750-754, 2002.

[52] R. K. Patro, “Localization in wireless sensor network with mobile beacons,” In 23rdIEEE Convention of Electrical and Electronics Engineers in Israel, pp. 2224, 2004.

[53] C. Poggi and G. Mazzini, “Collinearity for sensor network localization,”In IEEE 58thVehicular Technology Conference, volume 5, pp. 30403044, 2003.

[54] K. Yedavalli, B. Krishnamachari, S. Ravula, and B. Srinivasan, “Ecolocation: A se-quence based technique for RF Localization in Wireless Sensor Networks,” Informa-tion Processing in Sensor Networks, pp. 285 - 292, 15 April, 2005.

[55] J. Liberti and T. S. Rappaport, “Smart Antennas for Wireless Communications: IS-95 and Third Generation CDMA Application,” Prentice Hall PTR, New Jersey, April1999.

[56] H. B. Song, H.-G. Wang, K. Hong, and L. Wang, “ A novel source localization schemebased on unitary ESPRIT and city electronic maps in urban environments,” ProgressIn Electromagnetics Research, Vol. 94, pp. 243-262, 2009.

[57] A. Tayebi, J. Gomez, F. S. d. Adana, and O. Gutierez, “The application of ray-tracingto mobile localization using the direction of arrival and received signal strength inmultipath indoor environments,” Progress In Electromagnetics Research, Vol. 91, pp.1-15, 2009.

[58] Y. Zhang, Q. Wan, and A.-M. Huang, “Localization of narrow band sources in thepresence of mutual coupling via sparse solution finding,” Progress In Electromagnet-ics Research, Vol. 86, pp. 243-257, 2008.

[59] C. K. Seow and S. Y. Tan, “Localization of omnidirectional mobile device in multipathenvironments,” Progress In Electromagnetics Research, Vol. 85, pp. 323-348, 2008.

[60] W. Zhang, A. Hoorfar, and L. Li, “Through-the-wall target localization with timereversal MUSIC method,” Progress In Electromagnetics Research, Vol. 106, pp. 75-89, 2010.

170

[61] S. H. Zainud-Deen, H. A. El-Azem Malhat, K. H. Awadalla, and E. S. El-Hadad,“Direction of arrival and state of polarization estimation using radial basis functionneural network (RBFNN),” Progress In Electromagnetics Research B, Vol. 2, pp. 137-150, 2008.

[62] Y. Wu, H.-C. So, and C. Hou, “Passive near field source localization based on spatial-temporal structure,” Progress In Electromagnetics Research C, Vol. 8, pp. 27-41,2009.

[63] O. A. M. Alyt, A. S. Omar, and A. Z. Elsherbeni, “Detection and localization of RFradar pulses in noise environments using wavelet packet transform and higher orderstatistics,” Progress In Electromagnetics Research, Vol. 58, pp. 301-317, 2006.

[64] H. Q. Liu and H.-C. So, “Target tracking with line-of-sight identification in sensor net-works under unknown measurement noises,” Progress In Electromagnetics Research,Vol. 97, pp. 373-389, 2009.

[65] P. Bahl and V. N. Padmanabhan, “RADAR: An in-building RF-based user locationand tracking system,” In: Proceedings of 19th Annual Joint Conference of the IEEEComputer and Communications Societies. Tel-Aviv, Israel: IEEE Computer Society,pp. 775-784, March 2000.

[66] C. D. Whitehouse, “The Design of Calamari: an Ad-hoc Localization System for Sen-sor Networks,”Master’s Thesis, Department of Electrical Engineering and ComputerSciences, University of California at Berkeley, 2002.

[67] J. Hightower, C. Vakili, G. Borriello, and R. Want., “Design and Calibration of theSpotON Ad-Hoc Location Sensing System,” University of Washington, Seattle, Tech-nical Report UW CSE 01-08, August 2001.

[68] X. Li, “RSS-based location estimation with unknown pathloss model”. IEEE Trans-actions on Wireless Communications, vol. 5, no. 12, pp. 3626, 2006.

[69] K. Lorincz and M. Welsh, “MoteTrack: a robust, decentralized approach to RF-basedlocation tracking,” Personal and Ubiquitous Computing, vol. 11, no. 6, pp. 489-503,2007.

[70] N. Priyantha, A. Chakraborty, and H. Balakrishnan, “The cricket location-support sys-tem,” in Proceedings of the 6th annual international conference on Mobile computingand networking, pp. 32-43, ACM New York, NY, USA, 2000.

[71] K. Langendoen and N. Reijers, “Distributed localization in wireless sensor networks:a quantitative comparison,” Computer Networks, vol. 43, no. 4, pp. 499-518, 2003.

[72] D. Niculescu and B.Nath, “DV based positioning in ad hoc networks,” Journal ofTelecommunication Systems,vol. 22, no. 4, pp. 267-280, 2003.

171

[73] Z. Xiang, S. Song, J. Chen, H. Wang, J. Huang, and X. Gao., “A wireless LAN-basedindoor positioning technology,” IBM Journal of Research and Development, vol. 48,no. 5/6, pp. 617-626, September-November 2004.

[74] Z. Xiang, S. Song, J. Chen, H. Wang, J. Huang, and X. Gao, “, A wireless LAN-based indoor positioning technology,” IBM Journal of Research, vol. 48, no. 5/6, pp.617-624, September-November 2004.

[75] A. Parameswaran, M. I. Husain, and S. Upadhyaya, “Is RSSI a Reliable Parameter inSensor Localization Algorithms: An Experimental Study,” Field Failure Data Analy-sis Workshop (F2DA’09), New York, 2009.

[76] W. W. Perkins, “DATA COMPRESSION WITH APPLICATION TO GEO-LOCATION,” White Paper Proposal Submitted for 2010 AFRL Sensors Directorate,AUGUST 2010.

[77] W. G. Figel, N. H. Shepherd, and W. F. Trammell, “Vehicle location by a signalattenuation method,” IEEE Trans. Veh. Technol., vol. VT-18, pp. 105-109, November1969.

[78] H. Staras and S. N. Honickman, “The accuracy of vehicle location by trilaterationin a dense urban environment,” IEEE Trans. Veh. Technol.,vol. VT-21, pp. 38-43,February 1972.

[79] H. Hashemi, “Pulse ranging radiolocation technique and its application to channelassignment in digital cellular radio,” in IEEE 41st Veh. Technol. Conf. pp. 675-680,1991.

[80] T. E. Wisloff and S. Andresen, “Positioning and traffic information by cellular radio”. in IEEE-IEE Vehicle Navigation and Information Syst Conf., pp. 287-290, Ottawa,Canada, 1993.

[81] M. Hata and T. Nagatsu, “Mobile location using signal strength measurements in acellular system”. IEEE Trans. Veh. Technol., vol. VT-29, pp. 245-252, May 1980.

[82] P. R. Chandler, M. Patcher, and S. Rasmussen, “UAV cooperative control,” Proc. theAmerican Control Conference, Arlington, VA, June 2001.

[83] C. G. Cassandras and W. Li, “Sensor networks and cooperative control,” EuropeanJournal of Control, pp. 436-463, June 2005.

[84] H. Al Issa and R. Ordonez, “Robust Multiplatform RF Emitter Localization,” in Evo-lutionary and Bio-Inspired Computation: Theory and Application VI, Proceedings ofSPIE Defense, Security, and Sensing, Vol. 8402, Baltimore, Maryland, USA, April,2012.

172

[85] J. Cortes, S. Martinez, T. Karatas, and F. Bullo, , “Coverage control for mobile sensingnetworks,” IEEE Transactions on Robotics and Automation, vol. 20, no. 2, pp. 243-255, 2004.

[86] A. Richards, and J. How, “Decentralized model predictive control of cooperatingUAVs ,” , Proc. the 43rd IEEE Conference on Decision and Control, Atlantis, Par-adise Island, Bahamas, December 2004.

[87] W. Li, and C. G. Cassandras, “Distributed cooperative coverage control of sensornetworks,” Proc. 44th IEEE Conference on Decision and Control, Seville, Spain, De-cember 2005.

[88] L. Singh and J. Fuller, “Trajectory generation for a UAV in urban terrain, using non-linear MPC ,” Proc the American Control Conference, Arlington, VA, 2001.

[89] A. Mitra, “Multi-Platform Multi-Function Avionics Architecture,” US Patent6,867,727 , 15 March, 2008.

[90] A. K. Mitra, and K. M. Pasala, “Low-Cost Position-Adaptive UAV Radar Design withState-of-the- Art COTS Technology,” Radar Sensor Technology X, DSS, 2004.

[91] A. K. Mitra, “Leakage Signal Analysis for Position-Adaptive UAV Radar Applica-tions,” Radar Sensor Technology XI, SPIE Defense and Security Symposium, Or-lando, Florida, USA, April 2005.

[92] A. K. Mitra, “Position-Adaptive UAV Radar for Low-Altitude Sensing Applications,”Proceedings of the IEEE Aerospace Conference, Big Sky, Montana, March 2003.

[93] A. K. Mitra, “Position-Adaptive UAV Radar for Urban Environments,” Proceedingsof the International Radar Conference, Adelaide, Australia, September 2003.

[94] A. K. Mitra, “Passive Position-Adaptive Radar Modes for non-LOS Interrogation ofEmbedded Objects,” Radar Sensor Technology X, SPIE Defense and Security Sym-posium, Orlando, Florida, USA, March 2004.

[95] A. K. Mitra, “Multitone Radar Design Using Software Radio Components,” RadarSensor Technology XIII, SPIE Defense and Security Symposium, Orlando, Florida,USA, April 2009.

[96] A. K. Mitra, “Distributed Postion-Adaptive UAV Radar Concepts for Building Ge-ometries with Multiple Signal-Leakage Points,” Radar Sensor Technology XII, SPIEDefense and Security Symposium, April 2006.

[97] S. Young, A. Mitra, T. Morton, and R. Ordonez, “Position-Adaptive Scatterer Lo-calization for Radar Imaging Applications,” Radar Sensor Technology XIII, SPIEDefense and Security Symposium, Orlando, Florida, USA, April 2009.

173

[98] A. Mitra, et. , “Sensor Agnostics for Networked MAV Applications,” Proceedingsof the 2010 SPIE Defense,Security, and Sensing Symposium, Evolutionary and Bio-Inspired Computation: Theory and Applications IV, vol. 7704, April 15, 2010.

[99] R. Ordonez, M. Gates, A. Mitra, R. Selmic, P. Detweiler, K. Moma, and G. Parker,“RF emitter localization with positionadaptive MAV platforms,” Proc 2010 IEEENAECON, Dayton, July 2010.

[100] M. Gates, C. Barber, R. Selmic, H. Al Issa, R. Ordonez, and A. Mitra, “PADF RFlocalization criteria for multimodel scattering environments”, in Radar Sensor Tech-nology XV, Proceedings of SPIE Defense, Security, and Sensing, Vol. 8021, Orlando,Florida, USA, April 2011.

[101] C. Barber, M. Gates, R. Selmic, H. Al Issa, R. Ordonez and A. Mitra, “PADF RF lo-calization experiments with multi-agent caged-MAV platforms”, in Evolutionary andBio-Inspired Computation: Theory and Applications V, Proceedings of SPIE Defense,Security, and Sensing, Vol. 8059, Orlando, Florida, USA, April 2011.

[102] M. Tubaishat and S. Madria, “Sensor networks: an overview,” IEEE Potentials , vol.22, no.2, pp. 2030, 2003.

[103] A. Hac, “Wireless Sensor Network Designs,” Wiley, Chichester, 2003.

[104] C. Raghavendra, K. M. Sivalingam, and T. Znati, “Wireless Sensor Networks,”Kluwer Academic Publishers Boston, 2004.

[105] K. Sohrabi, J. Gao, V. Ailawadhi, and G. Pottie, “Protocols for self-organization ofa wireless sensor network,” IEEE Pers. Commun. vol. 7, no. 5, pp. 1627, 2000.

[106] D. Culler, D. Estrin, and M. Srivastava, “Overview of sensor networks,” IEEE Com-put. vol. 37, no. 8, pp. 4149, 2004.

[107] V. Rajaravivarma, Y. Yang, and T. Yang, “An overview of wireless sensor networkand applications,” in Proceedings of Southeastern Symposium on System Theory(SSST), pp. 432436, Morgantown, WV, USA, 2003.

[108] R. Verdone, “Wireless sensor networks.,” in Proceedings of the 5th European Con-ference on Wireless Sensor Networks, EWSN 2008, Bologna, Italy, Springer, Heidel-berg, 2008.

[109] R. Verdone, D. Dardari, G. Mazzini, and A. Conti, “Wireless Sensor and ActuatorNetworks: Technologies, Analysis and Design,” Elsevier, London, 2008.

[110] M. v. de. Goor, “Indoor Localization in wireless sensor network,” Master thesis’s,Radboud University Nijmegen, march 2009.

174

[111] Krisztin Veress, “Radio communication testbed for Wireless Sensor Networks,”Master thesis’s, University of Szeged, 2010.

[112] J. Hill, M. Horton, R.Kling, and L. Krishnamurthy, “The platforms enabling wirelesssensor networks,” Communications of the ACM, vol. 47, no. 6, pp. 41-46, June 2004.

[113] D. Culler, D. Estrin, and M. Srivastava, “Guest editors introduction: overview ofsensor networks,” Computer, vol. 37, no. 8, pp. 41-49, August 2004.

[114] “ www.xbow.com/Products/Product pdf files/Wireless pdf/IRIS Datasheet.pdf”

[115] L. Brito, and L. Peralta, “An Analysis of Localization Problems and Solutions inWireless Sensor Networks,” Polytechnical Studies Review, 2008.

[116] “Optimized Link State Routing Protocol (OLSR),” Networking Working Group,Project Hipercom, INRIA, October 2003.

[117] Internet Engineering Task Force (IETF),“Ad hoc On-Demand Distance Vector(AODV) Routing draft-ietf-manet-aodv-13,” Mobile Ad Hoc Networking WorkingGroup, February 2003.

[118] J. Kurose and K. Ross, “Computer Networking: A top-down approach featuring theInternet,” Addison-Wesley, Boston, Mass, 2002.

[119] M. Brownfield, “Energy-efficient Wireless Sensor Network MAC Protocol,” Ph.DDissertation, Virginia Polytechnic Institute and State University,Blacksburg, VA,March 31, 2006.

[120] Sophia Kaplantzis, “Security Models for Wireless Sensor Networks,” March 20,2006.

[121] I. Ramani, R. Bharadwaja, and P. V. Rangan, “Location tracking for media appli-ances in wireless home networks,” in Proc. International Conference on Multimediaand Expo (ICME’03), pp. 769-772, July 2003.

[122] A. M. Ladd, K. E. Bekris, G. Marceau, A. Rudys, L. E. Kavraki, and D. S. Wallach,“Robotics-based location sensing using wireless ethernet,”in Proc. ACM InternationalConference on Mobile Computing and Networking (MOBICOM’02), pp. 227-238,2002.

[123] S. J. Pister, “Military Applications of Sensor Networks,” Institute for Defense Anal-yses Paper P-3531, Defense Science Study Group, 2000.

[124] G. Simon, M. Maroti, A. Ledeczi, G. Balogh, B. Kusy, A. Nadas, G. Pap, J. Sallai,and K. Frampton, “Sensor network-based countersniper system,” In Proceedings ofthe 2nd International Conference on Embedded Networked Sensor Systems (SenSys04), pp. 1-12, Baltimore, MD, USA, 3-5 November , 2004.

175

[125] A. Arora, P. Dutta, S. Bapat, V. Kulathumani, H. Zhang, V. Naik, V. Mittal, H.Cao, M. Demirbas, M. Gouda, Y. Choi, T. Herman, S. Kulkarni, Arumugam, U.Nesterenko, A. Vora, and M. Miyashita, “A line in the sand: a wireless sensor networkfor target detection, classification, and tracking,” Computer Networks, vol. 46, no. 5,pp. 605-634, December 2004.

[126] A. Ledeczi, A. Nadas, P. Volgyesi, G. Balogh, B. Kusy, J. Sallai, G. Pap, S. Dora, K.Molnar, M. Maroti, and G. Simon, “Countersniper system for urban warfare,” ACMTransactions on Sensor Networks, vol. 1, no.2, pp. 153-177, November 2005.

[127] T. He, S. Krishnamurthy, L. Luo, T. Yan, L. Gu, R. Stoleru, G. Zhou, Q. Cao, P.Vicaire, J. A. Stankovic, T. F. Abdelzaher, J. Hui, and B. Krogh, “Vigilnet: an inte-grated sensor network system for energy-efficient surveillance,” ACM Transactionson Sensor Networks, vol. 2, no. 1, pp. 1-38, February 2006.

[128] P. Volgyesi, G. Balogh, A. Nadas, C. B. Nash, and A. Ledeczi, “Shooter localizationand weapon classification with soldier-wearable networked sensors,” In Proceedingsof the 5th international Conference on Mobile Systems, Applications and Services(MobiSys ’07), San Juan, Puerto Rico, pp. 113-126, 11-13 June, 2007.

[129] S. Choi, B. Kim, J. Park, C. Kang, and D. Eom, “An implementation of wirelesssensor network,” IEEE Transactions on Consumer Electronics, vol. 50, no. 1, pp.236-244, February 2004.

[130] R. Glidden, C. Bockorick, S. Cooper, C. Diorio, D. Dressler, V. Gutnik, C. Hagen,D. Hara, T. Hass, T. Humes, J. Hyde, R. Oliver, O. Onen, A. Pesavento, K. Sund-strom, and M. Thomas, “Design of ultra-low-cost UHF RFID tags for supply chainapplications,” IEEE Communications Magazine, vol. 42, no. 8, pp. 140-151, August2004.

[131] R. Morais, M. A. Fernandes, S. G. Matos, C. Serdio, P. J. Ferreira, and M. J. Reis,“A ZigBee multi-powered wireless acquisition device for remote sensing applicationsin precision viticulture,” Computers and Electronics in Agriculture, vol. 62, no. 2, pp.94-106, July 2008.

[132] J. Eriksson, L. Girod, B. Hull, R. Newton, S. Madden, and H. Balakrishnan, “Thepothole patrol: using a mobile sensor network for road surface monitoring,” In Pro-ceeding of the 6th international Conference on Mobile Systems, Applications, andServices (MobiSys ’08), pp. 29-39, Breckenridge, CO, USA, 17-20 June, 2008.

[133] V. C. Gungor and G. P. Hancke, “Industrial wireless sensor networks: challenges,design principles, and technical approaches,” IEEE Transactions on Industrial Elec-tronics, vol. 56, no. 10, pp. 4258-4265, October 2009.

176

[134] N. Xu, S. Rangwala, K. K. Chintalapudi, D. Ganesan, A. Broad, R. Govindan, andD. Estrin, “A wireless sensor network for structural monitoring,” In Proceedings ofthe 2nd international conference on embedded networked sensor systems (SenSys04), pp. 13-24.03-05, Baltimore, MD, USA, November 2004.

[135] K. Chintalapudi, T. Fu, J. Paek, N. Kothari, S. Rangwala, J. Caffrey, R. Govindan,E. Johnson, and S. Masri, “Monitoring Civil Structures with a Wireless Sensor Net-work,” IEEE Internet Computing, vol. 10, no. 2, pp. 26-34, March 2006.

[136] S. Kim, S. Pakzad, D. Culler, J. Demmel, G. Fenves, S. Glaser, and M. Turon,“Health monitoring of civil infrastructures using wireless sensor networks,” In Pro-ceedings of the 6th international Conference on information Processing in SensorNetworks (IPSN ’07), pp. 254-263, Cambridge, Massachusetts, USA, 25-27 April,2007.

[137] K. Chebrolu, B. Raman, N. Mishra, P. K. Valiveti, and R. Kumar, “Brimon: a sensornetwork system for railway bridge monitoring,” In Proceeding of the 6th internationalConference on Mobile Systems, Applications, and Services (MobiSys ’08), pp. 2-14,Breckenridge, CO, USA, June 17-20, 2008.

[138] F. Stajano, N. Hoult, I. Wassell, P. Bennett, C. Middleton, and K. Soga, “Smartbridges, smart tunnels: transforming wireless sensor networks from research proto-types into robust engineering infrastructure,” Ad Hoc Networks, vol. 8, no. 8, pp.872-888, November 2010.

[139] G. Werner Allen, J. Johnson, M. Ruiz, J. Lees, and M. Welsh, “Monitoring vol-canic eruptions with a wireless sensor network,” Wireless Sensor Networks. Proceed-ings of the Second European Workshop on, pp. 108120, 2005. [Online]. Available:http://ieeexplore.ieee.org/xpl/freeabs all. jsp arnumber=1462003.

[140] D. Gurganious, M. Hatlerand, and M. Ritter, “Wsn for smart homes,” ON WorldInc., Tech. Rep., February 2008.

[141] P. Juang, H. Oki, Y. Wang, M. Martonosi, L. S. Peh, and D. Rubenstein,, “Energy-efficient computing for wildlife tracking: design tradeoffs and early experiences withZebraNet,” In Proceedings of the 10th international Conference on Architectural Sup-port For Programming Languages and Operating Systems (ASPLOS-X), San Jose,California, pp. 96-107, 05-09 October, 2002.

[142] R. Szewczyk, E. Osterweil, J. Polastre,, M. Hamilton, A. Mainwaring, and D. Estrin,,“Habitat monitoring with sensor networks,” Communications of the ACM, vol. 47, no.6, pp. 34-40, June 2004.

[143] G. Tolle, J. Polastre, R. Szewczyk, D. Culler, N. Turner, K. Tu,, S. Burgess, T.Dawson, P. Buonadonna, D. Gay, and W. Hong, “A macroscope in the redwoods,”

177

In Proceedings of the 3rd international Conference on Embedded Networked SensorSystems (SenSys 05), San Diego, California, USA, pp. 51-63, 02-04 November, 2005.

[144] G. Werner-Allen, K. Lorincz, M. Welsh, O. Marcillo, J. Johnson, M. Ruiz, and J.Lees, “Deploying a wireless sensor network on an active volcano,” IEEE InternetComputing, vol. 10, no. 2, pp. 18-25, March 2006.

[145] L. Mo, Y. He, Y. Liu, J. Zhao, S. Tang, X. Li, and G. Dai, “Canopy closure estimateswith GreenOrbs: sustainable sensing in the forest,” In Proceedings of the 7th Interna-tional Conference on Embedded Networked Sensor Systems (SenSys ’09), Berkeley,CA, USA, pp. 99-112, 04-06 November, 2009.

[146] P. Tokekar, D. Bhadauria, A. Studenski, and V. Isler, “A robotic system for monitor-ing carp in Minnesota lakes,” Journal of Field Robotics, to appear, 2010.

[147] L. Schwiebert, S. K. Gupta, and J. Weinmann, “Research challenges in wirelessnetworks of biomedical sensors,” In Proceedings of the 7th Annual international Con-ference on Mobile Computing and Networking(MobiCom 01), pp. 151-165 Rome,Italy, 16-21 July, 2001.

[148] U. Varshney, “Pervasive Healthcare,” IEEE Computer, vol. 36, no. 12, pp. 138-140,December 2003.

[149] C. Efstratiou, N. Davies, G. Kortuem, J. Finney, R. Hooper, and M. Lowton, “Ex-periences of designing and deploying intelligent sensor nodes to monitor hand-armvibrations in the field,” In Proceedings of the 5th international Conference on Mo-bile Systems, Applications and Services (MobiSys 07), San Juan, Puerto Rico, pp.127-138, 11-13 June, 2007.

[150] S. Iyengar, F. T. Bonda, R. Gravina, A. Guerrieri, G. Fortino, and A. Sangiovanni-Vincentelli, “A framework for creating healthcare monitoring applications using wire-less body sensor networks,” In Proceedings of the ICST 3rd international Conferenceon Body Area Networks, Tempe, Arizona, pp. 1-2, March 13-17, 2008.

[151] K. Lorincz, B. Chen, G. W. Challen, A. R. Chowdhury, S. Patel, P. Bonato, andM. Welsh, “Mercury: a wearable sensor network platform for high-fidelity motionanalysis,” In Proceedings of the 7th ACM Conference on Embedded Networked Sen-sor Systems (SenSys 09), pp. 183-196, 04-06 November Berkeley, California, USA,2009.

[152] E. I. Shih, A. H. Shoeb, and J. V. Guttag, “Sensor selection for energy-efficientambulatory medical monitoring,” In Proceedings of the 7th international Conferenceon Mobile Systems, Applications, and Services (MobiSys 09), Krakow, Poland, pp.347-358, 22-25 June , 2009.

178

[153] J. M. Kahn, R. H. Katz, and K. S. Pister, “Next century challenges: mobile network-ing for “Smart Dust” ,” In Proceedings of the 5th Annual ACM/IEEE internationalConference on Mobile Computing and Networking (MobiCom 99), Seattle, Wash-ington, USA, pp. 271-278, August 15-19, 1999.

[154] S. S. Intille, “Designing a home of the future,” IEEE Pervasive Computing, vol. 1,no. 2, pp. 76-82, June 2002.

[155] K. Yap, V. Srinivasan, and M. Motani, “MAX: Wide area human-centric search ofthe physical world,” ACM Transactions on Sensor Networks, vol. 4, no. 4, pp. 1-34,August 2008.

[156] C. Lin, S. Wang, S. Kuo, and C. Chen, ”Increasing service availability in a wirelesshome network environment,” The Computer Journal, vol. 52, no. 8, pp. 851-860,November 2009.

[157] E. K. Hansen, “Denmark’s Net-Zero-Energy Home,” IEEE Spectrum, pp. 34-38,August 2010.

[158] J. Jeong, S. Guo, T. He, D. Du, “APL: autonomous passive localization for wirelesssensors deployed in road networks,” In Proceedings of the 27th IEEE Conferenceon Computer Communications (INFOCOM ’08), pp. 583-591, Phoenix, AZ, USA,13-18 April, 2008.

[159] X. Li, W. Shu, M. Li, H. Huang, P. Luo, M. Wu, “Performance evaluation of vehicle-based mobile sensor networks for traffic monitoring,” IEEE Transactions on VehicularTechnology, vol. 58, no.4, pp. 1647-1653, May 2009.

[160] M. Tubaishat, P. Zhuang, Q. Qi, and Y. Shang, “Wireless sensor networks in intel-ligent transportation systems,” Wireless communications and mobile computing, vol.9, no. 3, pp. 287302, March 2009.

[161] T. Semertzidis, K. Dimitropoulos, A. Koutsia, N. Grammalidis, “Video sensor net-work for real-time traffic monitoring and surveillance,” IET Intelligent Transport Sys-tems, vol. 4, no. 2, pp.103-112, June 2010.

[162] C. Harrison, B. Eckman, R. Hamilton, P. Hartswick, J. Kalagnanam, J. Paraszczak,P. Williams, “Foundations for smarter cities,” IBM Journal of Research and Develop-ment, vol 54, no 4, pp. 1-16, August 2010.

[163] G. J. Pottie and W.J. Kaiser, “Wireless Integrated Network Sensors,” Communica-tions of the ACM, Vol. 43, no. 5, May 2000.

[164] D. Estrin, D. Culler, K. Pister, and G. Sukhatme, “Connecting the Physical Worldwith Pervasive Networks,” IEEE Pervasive Computing, January 2002.

179

[165] J. M. Kahn, R. H. Katz, and K. S. J. Pister, “Emerging Challenges: Mobile Net-working for ’Smart Dust’,” Journal of Communications and Networks, Vol 2, no 3,September 2000.

[166] A. Mainwaring, J. Polastre, R. Szewczyk, D. Culler, and John Anderson, “WirelessSensor Net-works for Habitat Monitoring ”, ACM International Workshop on Wire-less Sensor Networks and Applications, 2002.

[167] L. Schwiebert, S. K. Gupta, and J. Weinmann, “Research Challenges in WirelessNetworks of Biomedical Sensors,” ACM Mobicomm, pp. 151-165, 2001.

[168] D. C. Steere, A. Baptista, D. McNamee, C. Pu, and J. Walpole, “Research Challengesin Environmental Observation and Forcasting Systems,” ACM Mobicomm, 2000.

[169] M. Jadliwala, S. Upadhyaya, H. R. Rao, and R. Sharman, “Security and dependabil-ity issues in location estimation for emergency sensor networks,” The Fourth Work-shop on e-Business (WeB 2005), Venetian, Las Vegas, Nevada, USA, December 2005.

[170] Youssef Chraibi, “Localization in wireless sensor network,” Masters thesis, KTHStockholm, Sweden, 2005.

[171] X. Wang, D.-w. Bi , L. Ding, and S. Wang, “Agent Collaborative Target Localizationand Classification, Wireless Sensor Networks” , pp.1359-1386, 2007.

[172] G. Mao, B. Fidan, and B. D. O. Anderson, “Wireless sensor network localiza-tion techniques,” In Computer Network: The International Journal of Computer andTelecommunications Networking, ACM, Vol. 51, Issue 10, pp. 2529-2553, July 11,2007.

[173] N. Patwari, I. Hero, A. O, M. Perkins, N. Correal, and R. O Dea, “Relative locationestimation in wireless sensor networks,” IEEE Transactions on Signal Processing, vol.51, no. 8, pp. 2137-2148, 2003.

[174] D. Niculescu , B. Nath, “Ad hoc positioning system (APS),” In:Proceedings ofthe IEEE Global Communications Conference of GLOBECOM. San Antonio: IEEEComputer Society, 29262931, 2001.

[175] X. Li, B. Hua, Y. Shang, and Y. Xiong, “A robust localization algorithm in wirelesssensor networks,” presented at Frontiers of Computer Science in China, pp.438-450,2008.

[176] A. Boukerche, H. Oliveira, E. Nakamura, and A. Loureiro, “Localization systems forwireless sensor networks,” Wireless Communications, IEEE, vol 14, no 6, pp. 6-12,December 2007.

[177] H. Wymeersch, J. Lien, and M. Win, “Cooperative localization in wireless net-works,” Proceedings of the IEEE, vol 97, no 2, pp. 427-450, February 2009.

180

[178] S. J. Halder, T. Y. Choi, J. H. Park, S. H. Kang, S. W. Park, and J. G. Park, “En-hanced ranging using adaptive filter of ZIGBEE RSSI and LQI measurement,” iiWAS’08: Proceedings of the 10th International Conference on Information Integration andWeb-based Applications and Services, ACM, November 2008.

[179] E. Elnahrawy, X. Li, and R. Martin, “The limits of localization using signal strength:a comparative study,” in First Annual IEEE Communications Society ConferenceSensor and Ad Hoc Communications and Networks, 2004, pp. 406-414.

[180] J. Li, J. Jannotti, D. S. J. DeCouto, D. R. Karger and R. Morris, “A Scalable Lo-cation Service for Geographic Ad-Hoc Routing,” in Proceedings of Sixth Annual In-ternational Conference on Mobile Computing and Networking, pp. 120-130, Boston,Massachusetts, USA, August 2000.

[181] K. Amouris, S. Papavassiliou, M. Li, “A Position-Based Multi-Zone Routing Pro-tocol for Wide Area Mobile Ad-Hoc Networks,” In Proceedings of IEEE VehicularTechnology Conference (VTC ’99), Vol. 2, pp. 1365-1369, Houston, Texas, USA ,May 1999.

[182] M. Mauve, J. Widmer, and H. Hartenstein, “A Survey on Position Based Routingin Mobile Ad-hoc Networks,” IEEE Network Magazine, vol. 15, no. 6, pp. 3039,November 2001.

[183] M. B. Srivastava , R. Muntz, and M. Potkonjak, “Smart Kindergarten: Sensor-basedWireless Networks for Smart Developmental Problem-solving Environments,” In Pro-ceedings of Seventh Annual Inernationatl Conference on Mobile Computing and Net-working, pp. 132-138, Rome, Italy, July 2001.

[184] N. Bulusu, J. Heidemann, D. Estrin, “GPS-less low cost outdoor localization for verysmall devices,” IEEE Personal Communications Magazine, vol. 7, No. 5, pp. 28-34,2000.

[185] T. He , C. Huang, “Range-free localization schemes for large scale sensor networks,”In: Proceedings of the 9th annual international conference on Mobile computing andnetworking. San Diego: ACM, pp. 81-95, 2003.

[186] R. Nagpal and et al., “Organizing a global coordinate system from local informationon an ad hoc sensor network,” In: Proceedings of 2nd International Workshop onIPSN. Berlin: Springer, pp. 333-348, 2003.

[187] L. Doherty and K. Pister, “Convex position estimation in wireless sensor networks,”In: Proceedings of 20th Annual Joint Conference of the IEEE Computer and Com-munications Societies. Anchorage, AK, USA: IEEE, pp. 1655-1663, 2001.

181

[188] D. Niculescu and h. Natb, “Ad hoc positioning system (APS) using AOA.,” In: Pro-ceedings of 22 Annual Joint Conference of the IEEE Computer and CommunicationsSocieties. San Francisco, CA: IEEE Press, pp. 1734-1743, 2003.

[189] D. Lymberopoulos , Q. Lindsey, “An Empirical Analysis of Radio Signal StrengthVariability in IEEE 802.15.4 Networks using Monopole Antennas,” ENALAB Tech-nical Report 050501. Yale University, 2006.

[190] N. B. Priyantha, A. Chakraborty, and H. Balakrishnan, “The Cricket locationsup-port system,” In Proceedings of the 6th Annual international Conference on MobileComputing and Networking, Boston, Massachusetts, USA, pp. 32-43, August 06-11,2000.

[191] M. Youssef, A. Youssef, C. Rieger, U. Shankar, and A. Agrawala, “PinPoint: anasynchronous time-Based location determination system,” In Proceedings of the 4thinternational Conference on Mobile Systems, Applications and Services, pp. 165-176,Uppsala, Sweden, 19-22 June, 2006.

[192] X. Cheng, A. Thaeler, G. Xue, D. Chen, “ TPS: a time-based positioning scheme foroutdoor wireless sensor networks,” In Proceedings of the 23rd Annual Joint Confer-ence of the IEEE Computer and Communications Societies (INFOCOM 04), HongKong, China, 7-11, pp. 2685-2696, March 2004.

[193] S. S. Kumar, M. N. Kumar, V. S Sheeba, “Obstacle based Range-Free Localization-Error Estimation for WSN,” IJCSI International Journal of Computer Science Issues,Vol. 8, Issue 5, No 2, pp. 1694-0814, September 2011.

[194] Brian M. Blum, John A. Stankovic, Tarek Abdelzaher, Tian He and Chengdu Huang,“Range-free localization and its impact on large scale sensor networks,” In ACMTransactions on Embedded Computing Systems, volume 4, pp. 877-906, November2005.

[195] C.-H. Ou and K.-F. Ssu., “Sensor position determination with flying anchor in threedimensional wireless sensor networks,” In IEEE Transactions on Mobile Computing,pp. 1084-1097, September 2008.

[196] J. Jin, Y. Wang, C. Tian, W. Liu, and Mo. Yijun, “Localization and synchronizationfor 3d underwater acoustic sensor networks,” In Springer, Ubiquitous Intelligence andComputing, pp. 622-631, Hong Kong, China, July 2007.

[197] L. Lazos and R. Poovendran, “SeRLoc: Robust localization for wireless sensor net-works,” In ACM Transactions on Sensor Networks, pp. 73-100, August 2005.

[198] M. Martins, H. C. So, H. Chen, P. Huang, and K. Sezaki, “Novel centroid localiza-tion algorithm for three-dimensional wireless sensor networks,” In IEEE Transactions

182

on Wireless Communication, Networking and Mobile Computing, pp. 1-4, October2008.

[199] R. Yu, Z. Sun, and M. Shunliang, “A power aware and range free localization algo-rithm for sensor network,” In IEEE Transactions on Communications, pp. 1-5, August2006.

[200] T. He, R. Stoleru, and J. A. Stankovic, ”Range free localization,” Technical report,University of Virginia, 2006.

[201] N. Patwari, I. Hero, A. O, M. Perkins, N. Correal, and R. O Dea, “Ad hoc positioningsystem (APS),” In: Proceedings of the IEEE Global Communications Conference ofGLOBECOM. San Antonio: IEEE Computer Society, pp. 2926-2931, 2001.

[202] E. Elnahrawy, X. Li, and R. Martin, “The limits of localization using signal strength:a comparative study,” in First Annual IEEE Communications Society ConferenceSensor and Ad Hoc Communications and Networks, pp. 406-414, 2004.

[203] D. Madigan, E. Einahrawy, R. Martin, W.-H. Ju, P. Krishnan, and A. Krishnakumar,“Bayesian indoor positioning systems,” in IEEE INFOCOM, vol. 2, pp. 1217-1227,2005.

[204] D. Niculescu and B. Nath, “Localized positioning in ad hoc networks,” in IEEEInternational Workshop on Sensor Network Protocols and Applications, pp. 42-50,2003.

[205] P. Prasithsangaree, P. Krishnamurthy, and P. Chrysanthis, “On indoor position lo-cation with wireless lans,” In The 13th IEEE International Symposium on Personal,Indoor and Mobile Radio Communications, vol. 2, pp. 720-724, 2002.

[206] S. Ray, W. Lai, and I. Paschalidis, “Deployment optimization of sensornet-basedstochastic location-detection systems,” In IEEE INFOCOM 2005, vol. 4, pp. 2279-2289, 2005.

[207] E. Elnahrawy, X. Li, and R. Martin, “The Limits of Localization Using SignalStrength: A Comparative Study,” in Proceedings of IEEE SECON, pp. 406-414, SantaClara, California, USA, October, 2004.

[208] K. Whitehouse, C. Karlof, and D. Culler, “A practical evaluation of radio signalstrength for ranging-based localization,” SIGMOBILE Mobile Computing and Com-munications Review, vol. 11, no. 1, pp. 41-52, January 2007.

[209] G. Zhou, T. He, S. Krishnamurthy, and J. A. Stankovic, “Impact of radio irregularityon wireless sensor networks,” In Proceedings of the 2nd international Conference onMobile Systems, Applications, and Services (MobiSys 04), pp. 125-138, Boston, MA,USA, 06-09 Junuary, 2004.

183

[210] D. Ganesan, B. Krishnamachari, A. Woo, D. Culler, D. Estrin, and S. Wicker, “Com-plex behavior at scale: An experimental study of low-power wireless sensor net-works,” Technical Report UCLA/CSD-TR 02-0013, UCLA Computer Science, 2002.

[211] K. Srinivasan, P. Dutta, A. Tavakoli, and P. Levis, “ Understanding the causes ofpacket delivery success and failure in dense wireless sensor networks,” In Proceedingsof the 4th international Conference on Embedded Networked Sensor Systems (SenSys’06), Boulder, Colorado, USA, pp. 419-420. 31 October- 03 November, 2006.

[212] E. Miluzzo, X. Zheng, K. Fodor, and A. T. Campbell, “Radio characterization of802.15.4 and its impact on the design of mobile sensor networks,” In Proceedings ofthe 5th European Conference on Wireless Sensor Networks (EWSN ’08), pp. 171-188, Bologna, Italy, 30 January - 01 Februry, 2008.

[213] K. Smith, “Antennas for Low Power Applications,” RFM Corp., Dallas. Available athttp://www.rfm.com/corp/appdata/antenna.pdf

[214] “Chapter 18: Radio propagation models,” The ns manual, Editor: Kevin Fall, etal,May, 2009. Available at http://www.isi.edu/nsnam/ns/doc/index.html.

[215] K. Whitehouse, C. Karlof, A. Woo, F. Jiang, and D. Culler, “The effects of rangingnoise on multihop localization: an empirical study,” In Proceedings of the 4th inter-national Symposium on information Processing in Sensor Networks (IPSN 05), pp.73-80, LosAngeles, California, USA, 24-27 April, 2005.

[216] P. Krishnan, A. Krishnakumar, W.-H. Ju, C. Mallows, and S. Gamt, “A system forlease: location estimation assisted by stationary emitters for indoor rf wireless net-works,” In IEEE INFOCOM, vol. 2, pp. 1001-1011, 2004.

[217] T. Roos, P. Myllymaki, and H. Tirri, “A statistical modeling approach to locationestimation,” IEEE Transactions on Mobile Computing, vol. 1, no. 1, pp. 59-69, 2002.

[218] T. S. Rappaport, “Wireless Communications: Principles and Practice,” 2nd ed. Pren-tice Hall PTR, 2001.

[219] A. Mitra, etc., “Sensor Agnostics for Networked MAV Applications,” Proceedings ofthe SPIE Defense,Security, and Sensing Symposium, Evolutionary and Bio- InspiredComputation: Theory and Applications IV, vol.7704, April 15, 2010.

[220] S. Feldmann, K. Kyamakya, A. Zapater, and Z. Lue, “An Indoor Bluetooth-based po-sitioning system: concept, implementation, and experimental evaluation,” Technicalreport, University of Hannover, (2003).

[221] A. Mitra, “Sensors and Distributed Sensor-Platform Technologies,” 88 ABW/PADocument Number 88 ABW-09-4576, October, 2009.

184

[222] A. Mitra, “RF Direction Finding with Position Adaptive MAV Sensors,” AFRL Mi-nority Leaders Program Workshop,Dayton, Ohio, November 13, 2008.

[223] “IRIS Datasheet.pdf,” www.xbow.com

[224] TinyOS. Retrieved from www.tinyos.net, 2010.

[225] J. L. Hill, “System Architecture for Wireless Sensor Networks,” Ph.D dissertation,UNIVERISY OF CALIFORNIA, BERKELEY, 2003.

[226] sourceforge.net, “An open source development site,”http://www.sourceforge.net.

[227] D. Gay, P. Levis, D. Culler, and E. Brewer., “nesC 1.1 Language Reference Manual,”May, 2003.

[228] IEEE, IEEE Standard 802.15.4: Wireless Medium Access Control (MAC) and Phys-ical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (LR-WPANs), 2003.

[229] IEEE-802.14.5-2006 on Wikipedia http://en.wikipedia.org/wiki/IEEE 802.15.4-2006.

[230] ZigBee Specification v.1.0. ZigBee Alliance, 2005.

[231] G. Mao, B. D. O. Anderson and B. Fidan, “Path loss exponent estimation for wirelesssensor network localization,” Computer Networks, vol. 51, no. 10, pp. 2467-2483,July 2007.

[232] K. J. Astrom and B. Wittenmark, “Adaptive Control,” Boston, MA: Wiley, 1994.

[233] C. Zhang and R. Ordonez, “Extremum Seeking Control and Applications - A Nu-merical Optimization Based Approach,” Springer, 2012.

[234] C. Zhang, “Numerical Optimization and Perturbation-based Extremum SeekingControl and Applications,” Ph.D dissertation, University of Dayton, Dayton, Ohio,May 2006.

[235] K. B. Ariyur, and M. Krstic, “ Real-Time Optimization by Extremum-Seeking Con-trol,” Hoboken, NJ: Wiley-Interscience, 2003.

[236] M. Leblanc, “Sur l’electrification des chemins de fer au moyen de courants alternat-ifs de frequence elevee,” Revue generale de l’Electricite, 1922.

[237] I. I. Ostrovskii, “Extremum regulation,” Automatic & Remote Control, no. 18, pp.900907, 1957.

[238] A. A. Pervozvanskii, “Continuous extremum control system in the presence of ran-dom noise,” Automation and Remote Control, no. 21, pp. 673677, 1960.

185

[239] P. F. Blackman, “Extremum-seeking control,” J. H. Westcott Ed., An Exposi tion ofAdaptive Control, The Macmillan Company, New York, NY, 1962.

[240] C. S. Drapper and Y. T. Li, “Principles of optimalizing control systems and an ap-plication to the internal combustion engine,” R. Oldenburger Ed., Optimal and self-Optimizing Control, MIT Press, Boston, MA, 1962.

[241] S. M. Meerkov, “Asymptotic methods for investigating quasistationary states in con-tinuous systems of automatic optimization,” Automation and Remote Control, no. 11,pp. 17261743, 1967.

[242] O. L. R. Jacobs and G. C. Shering, “Design of a single-input sinusoidalperturbationextremum-control system,” in Proceedings of the IEE, vol. 115, pp. 212217, 1968.

[243] H. S. Tsien, Engineering Cybernetics. New York, NY: McGraw-Hill, 1954.

[244] A. A. Feldbaum, Computers in Automatic Control Systems. 1959, in Russian.

[245] A. A. Krasovskii, Dynamics of Continuous Self-Tuning Systems. 1963, in Russian.

[246] D. J. Wilde, Optimum Seeking Methods. Prentice Hall, 1964.

[247] E. P. I. Chinaev, Self-Tuning Systems Handbook. 1969, in Russian.

[248] J. Sternby, “Extremum control systems: An area for adaptive control,” in Preprintsof the Joint American Control Conference, 1980.

[249] M. A. Rotea, “Analysis of multivariable extremum seeking algorithms., “ in Pro-ceedings of the American Control Conference, vol. 1, pp. 433437, 2000.

[250] M. Krstic and H.-H. Wang, “Design and stability analysis of extremum seeking feed-back for general nonlinear systems., “ Automatica, vol. 36, no. 2, pp. 595601, 2000.

[251] M. Krstic, “Performance improvement and limitations in extremum seeking control.,“ Systems and Control Letters, vol. 39, no. 5, pp. 313326, 2000.

[252] Y. Tan, D. Nesic, and I. Mareels, “On non-local stability properties of extremumseeking control., “ in Proceedings of the 16th IFAC World Congress, 2005.

[253] R. N. Banavar, D. F. Chichka, and J. L. Speyer, “Convergence and synthesis issuesin extremum seeking control., “ International Journal of adaptive Control and SignalProcessing, vol. 17, pp. 751762, 2002.

[254] A. R. Teel and D. Popovic, “Solving smooth and nonsmooth multivariable extremumseeking problems by the methods of nonlinear programming., “ in Proceedings of theAmerican Control Conference, vol. 3, pp. 23942399, 2001.

186

[255] H. Yu and U. Ozgune, “Extremum-seeking control via sliding mode with periodicsearch signals., “ in Proceedings of the Conference on Decision and Control, vol. 1,pp. 323328, 2002.

[256] H. Yu and U. Ozgune., “Smooth extremum-seeking control via second order slidingmode., “ in Proceedings of the American Control Conference, vol. 4, pp. 32483253,2003.

[257] Y. Pan, U. Ozgune, and T. Acarman, “Stability and performance improvement ofextremum seeking control with sliding mode., “ International Journal of Control, vol.76, no. 9/10, pp. 968985, 2003.

[258] M. Guay, and T. Zhang, “Adaptive extremum seeking control of nonlinear dynamicsystems with parametric uncertainties., “ Automatica, vol. 39, no. 7, pp. 12831293,2003.

[259] Nusawardhana, and S. H. Zak., “Extremum seeking using analog nonderivative opti-mizers., “ in Proceedings of the American Control Conference, vol. 4, pp. 32423247,2003.

[260] C. Zhang, and R Ordonez, “Numerical optimization-based extremum seeking con-trol of lti systems., “ in Proceedings of the Conference on Decision and Control, 2005.

[261] Chunlei Zhang and R. Ordonez, “Non-gradient extremum seeking control of feed-back linearizable systems with application to abs design., “ in submitted to the Con-ference Decision and Control, 2006.

[262] C. Zhang and R. Ordonez, “Numerical optimization-based extremum seeking con-trol with application to abs design., “ IEEE Transactions on Automatic Control, ac-cepted for publication.

[263] C. Zhang and R. Ordonez,”Extremum seeking control based on numerical optimiza-tion and state regulation part i: Theory and framework, “ in submitted to the Confer-ence Decision and Control, 2006.

[264] C. Zhang and R. Ordonez, “Extremum seeking control based on numerical optimiza-tion and state regulation part ii: Robust and adaptive control design,” in submitted tothe Conference Decision and Control, 2006.

[265] Y. Zhang, “Stability and performance tradeoff with discrete time triangular searchminimum seeking., “ in Proceedings of the American Control Conference, vol. 1, pp.423427, 2000.

[266] A. G. Ivakhnenko, “On constructing an extremum controller without hunting oscil-lations.,” IEEE Transactions on Automatic Control, vol. 12, no. 2, pp. 144153, 1967.

187

[267] P. Wellstead, and P. Scotson, “Self-tuning extremum control,” IEEE ProceedingsControl Theory and Applications, vol. 137, no. 3, pp. 165175, 1990.

[268] B. Wittenmark, and R. J. Evans, “Extremal control of wiener model processes,” inProceedings of the Conference on Decision and Control, pp. 46374642, 2002.

[269] S. Velut and P. Hagander, “Analysis of probing control strategy,” in Proceedings ofthe American Control Conference, vol. 4, pp. 609614, 2003.

[270] S. Velut and P. Hagander, “A probing control strategy: stability and performance,”in Proceedings of the Conference on Decision and Control, pp. 46074612, 2004.

[271] Y. Pan and U. Ozgune, “Discrete-time extremum seeking algorithms,” in Proceed-ings of the American Control Conference, vol. 4, pp. 31473152, 2002.

[272] B. Egardt and S. Larsson, “On a parameter adaptive extremum controller,” in Pro-ceedings of the Conference on Decision and Control, pp. 48094814, 2005.

[273] P. Y. Li, and R. Horowitz, “Control of smart exercise machine part ii: Selfoptimizingcontrol,” IEEE Transactions on Mechatronics, vol. 2, no. 4, pp. 248 258, 1997.

[274] H.-H. Wang, M. Krstic, and G. Bastin, “Optimizing bioreactors by extremum seek-ing,” International Journal of adaptive Control and Signal Processing, vol. 13, no. 8,pp. 651669, 1999.

[275] D. F. Chichka, J. L. Speyer, and C. G. Park, “Peaking-seeking control with appli-cation to formation flight,” in Proceedings of the 38th Conference on Decision andControl, vol. 5, pp. 24632470, 1999.

[276] H.-H. Wang and M. Krstic, “Extremum seeking for limit cycle minimization., “IEEE Transactions on Automatic Control, vol. 45, no. 12, pp. 24322436, 2000.

[277] H.-H. Wang, S. Yeung, and M. Krstic, “Experimental application of extremum seek-ing on an axial-flow compressor,” IEEE Transactions on Control Systems Technology,vol. 8, no. 2, pp. 300309, 2000.

[278] G. Schneider, K. B. Ariyur, and M. Krstic, “Tuning of a combustion controller byextremum seeking: a simulation study,” in Proceedings of the 39th Confer- ence onDecision and Control, vol. 5, pp. 52195223, 2000.

[279] S. K. Nguang and X. D. Cheng, “Extremum seeking scheme for continuous fermen-tation processes described by an unstructured fermentation model,” Bio-processingEngineering, vol. 23, no. 5, pp. 417420, 2000.

[280] M. Gafvert, K.- E. Arzen, and L. M. Pederson, “Simple linear feedback and ex-tremum control of gdi engines., ” in Seoul 2000 FISITA World Automotive Congress,2000.

188

[281] M. Komatsu, H. Miyamoto, H. Ohmori, and A. Sano, “Output maximization controlof wind turbine based on extremum control strategy, ” in Proceedings of the AmericanControl Conference, vol. 2, pp. 17391740, 2001.

[282] A. Banaszuk, S. Narayanan, and Y. Zhang, “Adaptive control of flow separation in aplanar diffuser,” in 41st Aerospace Sciences Meeting & Exhibit, 2003.

[283] N. Hudon, M. Perrier, M. Guay, and D. Dochain., “Adaptive extremum seeking con-trol of a non-isothermal tubular reactor with unknown kinetics,” Computer and Chem-ical Engineering, vol. 29, pp. 839849, 2005.

[284] K. S. Peterson and A. G. Stefanopoulou, “Extremum seeking control for soft landingof an electromechanical valve actuator,” Automatica, vol. 40, no. 6, pp. 10631069,2004.

[285] Y. Li, M. A. Rotea, G. T. -C. Chiu, L. G. Mongeau, and I.-S. Paek, “Exetremumseeking control of tunable thermoacoustic cooler,” in Proceedings of the AmericanControl Conference, pp. 20332038, 2004.

[286] T. A. Johansen and D. Sbarbaro, “Lyapunov-based optimizing control of nonlinearblending processes,” IEEE Transactions on Control Systems Technology, vol. 13, no.4, pp. 631638, 2005.

[287] C. Centioli, F. Iannone, G. Mazza, M. Panella, L. Pangione, S. Podda, A. Tuccillo,V. Vitale, and L. Zaccarian, “Extremum seeking applied to the plasma control systemof the frascati tokamak upgrade,” in Proceedings of the Conference on Decision andControl, pp. 82278232, 2005.

[288] N. Killingsworth and M. Krstic, “Pid tuning using extremum seeking,” Control Sys-tems Magazine, vol. 26, pp. 7079, 2006.

[289] R. Leyva, C. Alonso, I. Queinnec, A. Cid-pastor, D. Lagrange, and L.Mart´nezsalamero, “Mppt of photovoltaic systems using extremum-seeking control,”IEEE Transactions on Aerospace and Electronic Systems, vol. 42, no. 1, pp. 249258,2005.

[290] C. Zhang, A. Siranosian, and M. Krstic, “Extremum seeking for moderately unsta-ble systems and for autonomous target tracking without position measurements,” inProceedings of the American Control Conference, 2006.

[291] E. Biyik and M. Arcak, “Gradient climbing in formation via extremum seeking andpassivity-based corrdination rules,” in Proceedings of the Conference on Decision andControl, pp. 3133-3138, 2007.

[292] T. Balch and R. C. Arkin, “Behavior-based formation control for multirobot teams,”IEEE Transactions on Robotics and Automation, vol. 14, pp. 926939, December1998.

189

[293] R. Olfati-Saber and R. M. Murray, “Distributed cooperative control of multiple vehi-cle formations using structural potential functions,” in Proceedings of the IFAC WorldCongress, Barcelona, Spain, June 2002.

[294] D. H. Kim, H. O. Wang, G. Ye, and S. Shin, “Decentralized control of autonomousswarm systems using artificial potential functions: Analytical design guidelines,” inProceedings of the IEEE Conference on Decision and Control, December 2004.

[295] R. L. Raffard, C. J. Tomlin, and S. P. Boyd, “Distributed optimization for cooperativeagents: Application to formation flight,” in Proceedings of the IEEE Conference onDecision and Control, December 2004.

[296] H. Yamaguchi, “A cooperative hunting behavior by mobile-robot troops,” The Inter-national Journal of Robotics Research, vol. 18, pp. 931940, September 1999.

[297] N. Ghods, P. Frihauf, and M. Krstic., “Multi-agent deployment in the plane usingstochastic extremum seeking,” 49th IEEE Conference on Decision and Control(CDC),pp.5505-5510, 15-17 Deceber, 2010.

[298] N. Ghods and M. Krstic, “Multiagent Deployment Over a Source,” IEEE Transac-tions on Control Systems Technology, vol. 20, no. 1, pp. 277-285, January 2012.

[299] J. Yao, R. Ordonez, and V. Gazi, “Swarm tracking using artificial potentials andsliding mode control,” J. Dyn. Syst. Meas. Control, pp. 749-754, 2007.

[300] J. P. Desai, J. Ostrowski, and V. Kumar, “Controlling formations of multiple mobilerobots,” in Proc. 1998 IEEE Int. Conf. Robotics and Automation, Leuven, Belgium,pp. 28642869, May 1998.

[301] P. Ogren, E. Fiorelli, and N. E. Leonard, “Cooperative control of mobile sensor net-works: Adaptive gradient climbing in a distributed environment,” IEEE Transactionon Automatic Control, vol. 49, pp. 12921302, August 2004.

[302] J. R. Lawton, B. J. Young, and R. W. Beard, “A decentralized approach to elementaryformation maneuvers,” in Proceedings of the IEEE International Conf. on Roboticsand Automation, San Francisco, CA, pp. 27282743, April 2000.

[303] J. H. Reif and H. Wang, “Social potential fields: A distributed behavioral control forautonomous robots,” Robotics and Autonomous Systems, vol. 27, pp. 171194, May1999.

[304] E. Rimon and D. E. Koditschek, “Exact robot navigation using artificial potentialfunctions,” IEEE Transaction on Robotics and Automation, vol. 8, pp. 501 518, Oc-tober 1992.

190

[305] N. E. Leonard and E. Fiorelli, “Virtual leaders, artificial potentials and coordinatedcontrol of groups,” in Proceedings of the IEEE Conf. Decision and Control, Orlando,FL, pp. 29682973, December 2001.

[306] “http://www.align-trex.com/trex-600-gf-kit-combo-p-2114.html”

191

APPENDIX A

GRAPHICAL USER INTERFACE (GUI) CODE BY MATLAB

We have developed a Graphical User Interface (GUI) using MATLAB that allows for

easy implementation of the PADF concepts. The GUI inputs the cartesian coordinates of

known nodes, along with the hidden emitter, and gives a prediction or estimation as to

where the hidden node could be. Based on the location of actual hidden emitter compared

to estimated hidden emitter, we determine an absolute error, which shows the accuracy of

the localization technique. For a proof of concept, we know the location of the hidden

emitter. Four x and y positions are used to estimate the transmitter’s position. On the

other side of the loop, the IRIS nodes themselves gather the RSS from emitter to receiver

and forward that information to the base station wirelessly, which is then sent to the same

MATLAB station via USB. The GUI merges the position data of the nodes as well as its

corresponding RSSI measurements, and performs the LSE in order to estimate the location

of the hidden emitter.

A.1 How To Run The Code

1. Open MATLAB, change to the directory where the code is.

2. Type ’padf gui’ in MATLAB’s command window.

192

3. When the GUI opens, make sure the TX mote number 0 is on, and that the receiver

motes number 1-4 are on and in the desired positions.

4. Enter the positions of the RX motes and the TX motes in the GUI. When ready, click

on the ’Estimate Position’ button. Wait till data acquisition is done and the estimate

appears.

5. If desired, click the ’Save data’ button, which produces a mat file called ’rssi data

(number).dat’, where number is the current experiment number.

6. Other parameters you can change in the GUI:

a: Ranges for x and y axes. These are used in the determination of when an estimate

is reliable or not.

b: The number of samples desired.

c: The ’Fudge’ factor used to make a guess of when an RX mote is behind an ob-

struction.

7. If you need to modify the GUI: type ’guide’ in the MATLAB command window, then

open the ’padf gui.fig’ file.

A.2 Padf.Gui.m

function varargout = padf_gui(varargin)% PADF_GUI M-file for padf_gui.fig% PADF_GUI, by itself, creates a new% PADF_GUI or raises the existing% singleton*.% H = PADF_GUI returns the handle% to a new PADF_GUI or the handle to% the existing singleton*.%% PADF_GUI(’CALLBACK’,hObject,eventData,handles,...)% calls the local% function named CALLBACK in PADF_GUI.M% with the given input arguments.%% PADF_GUI(’Property’,’Value’,...) creates a new PADF_GUI or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before padf_gui_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to padf_gui_OpeningFcn via varargin.

193

%% *See GUI Options on GUIDE’s Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% Author: Huthaifa Al Issa, Raul Ordonez% Date started: 5-Apr-2010% Last modified: 14-May-2010%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help padf_gui% Last Modified by GUIDE v2.5 11-May-2010 10:50:55% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(’gui_Name’, mfilename, ...

’gui_Singleton’, gui_Singleton, ...’gui_OpeningFcn’, @padf_gui_OpeningFcn, ...’gui_OutputFcn’, @padf_gui_OutputFcn, ...’gui_LayoutFcn’, [] , ...’gui_Callback’, []);

if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});

endif nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else

gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before padf_gui is made visible.function padf_gui_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to padf_gui (see VARARGIN)% Choose default command line output for padf_guihandles.output = hObject;% Add fields to handle object for error, metric and experiment number% trackinghandles.exp_number = 0;handles.error = [];handles.metric = [];% Update handles structureguidata(hObject, handles);% UIWAIT makes padf_gui wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = padf_gui_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;% --- Executes on mouse press over axes background.function padf_fig_ButtonDownFcn(hObject, eventdata, handles)% hObject handle to padf_fig (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function m2_x_Callback(hObject, eventdata, handles)% hObject handle to m2_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionx_axis = eval(get(handles.x_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= x_axis(1) && ...val <= x_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.

194

function m2_x_CreateFcn(hObject, eventdata, handles)% hObject handle to m2_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,’String’) returns contents of edit2 as text% str2double(get(hObject,’String’)) returns contents of edit2 as a double% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,’String’) returns contents of edit3 as text% str2double(get(hObject,’String’)) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,’String’) returns contents of edit4 as text% str2double(get(hObject,’String’)) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);end% --- Executes on button press in estimate_pos.function estimate_pos_Callback(hObject, eventdata, handles)% hObject handle to estimate_pos (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.save_button,’Enable’,’off’);handles.exp_number = handles.exp_number + 1;[y, Fs, nbits, readinfo] = wavread(’purr.wav’);m2 = [str2double(get(handles.m2_x,’String’))str2double(get(handles.m2_y,’String’))];m3 = [str2double(get(handles.m3_x,’String’))str2double(get(handles.m3_y,’String’))];m4 = [str2double(get(handles.m4_x,’String’))str2double(get(handles.m4_y,’String’))];m5 = [str2double(get(handles.m5_x,’String’))str2double(get(handles.m5_y,’String’))];hm = [str2double(get(handles.hm_x,’String’))str2double(get(handles.hm_y,’String’))];x_axis = eval(get(handles.x_axis,’String’));y_axis = eval(get(handles.y_axis,’String’));% Plot mote positionsplot(handles.padf_fig,m2(1), m2(2), ’go’,’LineWidth’,5)

195

hold(handles.padf_fig,’on’);plot(handles.padf_fig,m3(1), m3(2), ’go’,’LineWidth’,5)plot(handles.padf_fig,m4(1), m4(2), ’go’,’LineWidth’,5)plot(handles.padf_fig,m5(1), m5(2), ’go’,’LineWidth’,5)plot(handles.padf_fig,hm(1), hm(2), ’r*’,’LineWidth’,5)% compute offset for mote label positionsoff_x = (x_axis(2)-x_axis(1))/20;off_y = (y_axis(2)-y_axis(1))/20;% text(handles.padf_fig, m2(1)+off_x, m2(2)+off_y,’2’,’FontSize’,16,’Color’,’Green’)% text(handles.padf_fig, m3(1)+off_x, m3(2)+off_y,’3’,’FontSize’,16,’Color’,’Green’)% text(handles.padf_fig, m4(1)+off_x, m4(2)+off_y,’4’,’FontSize’,16,’Color’,’Green’)% text(handles.padf_fig, m5(1)+off_x, m5(2)+off_y,’5’,’FontSize’,16,’Color’,’Green’)axis(handles.padf_fig, [x_axis y_axis])grid(handles.padf_fig)% Perform position estimateset(handles.show_msg,’String’,’Acquiring data...’)pause(1)num_samples = str2double(get(handles.num_samples,’String’));handles.data(handles.exp_number).rssi_data = read_basestation(num_samples);% load off_line_data_analysis/experiments_14_may_2010_withtop/rssi_data4.mat% handles.data(handles.exp_number).rssi_data = rssi_data;[D, cross_PLE, avg_TX_toall] = process_data_func(handles.data(handles.exp_number).rssi_data);T = [m2; m3; m4; m5];handles.data(handles.exp_number).T = T;fudge = str2double(get(handles.fudge,’String’));% used to discriminate between yes or no blockage present% The larger this number, the less likely it is to detect a% true blockage, but also the less likely it is to have a false% positivet1=1;t2=1;for j=1:6 % 6 distance combinations for 4 motes

if t2<4t2=t2+1;

endsizeT(j) = norm(T(t2,:)-T(t1,:));if t2==4

t2=t1+1;t1=t1+1;

endendmax_sep = max(sizeT)-min(sizeT); % not currently usedD’mean(sizeT)*fudge;RSSI_edge=avg_TX_toall(2,1)discard=0;for j=1:4% if D(j)>max_sep*fudge;

if D(j)>mean(sizeT)*fudge;D(j)=D(j)*0.75;

endif D(j) > x_axis(2)-x_axis(1) | D(j) > y_axis(2)-y_axis(1)

% At least one distance estimate is too large, so discard experimentdiscard=1;

endenddistance_weight = mean(cross_PLE)./cross_PLE;A.mat = [ 2*(T(2,1)-T(1,1)) 2*(T(2,2)-T(1,2))

2*(T(3,1)-T(1,1)) 2*(T(3,2)-T(1,2))2*(T(4,1)-T(1,1)) 2*(T(4,2)-T(1,2))2*(T(3,1)-T(2,1)) 2*(T(3,2)-T(2,2))2*(T(4,1)-T(2,1)) 2*(T(4,2)-T(2,2))2*(T(4,1)-T(3,1)) 2*(T(4,2)-T(3,2)) ];

A.mat_wgt(:,1) = A.mat(:,1).*distance_weight(:,1);A.mat_wgt(:,2) = A.mat(:,2).*distance_weight(:,1);B.mat = -[ (T(1,1)ˆ2-T(2,1)ˆ2)+(T(1,2)ˆ2-T(2,2)ˆ2)+(D(2)ˆ2-D(1)ˆ2)

(T(1,1)ˆ2-T(3,1)ˆ2)+(T(1,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(1)ˆ2)(T(1,1)ˆ2-T(4,1)ˆ2)+(T(1,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(1)ˆ2)(T(2,1)ˆ2-T(3,1)ˆ2)+(T(2,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(2)ˆ2)(T(2,1)ˆ2-T(4,1)ˆ2)+(T(2,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(2)ˆ2)(T(3,1)ˆ2-T(4,1)ˆ2)+(T(3,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(3)ˆ2) ];

C.pos = (A.mat_wgt’*A.mat_wgt)\A.mat_wgt’*B.mat;% Draw circles based on distance estimatesttl=’’;for j = 1:4

fh = @(x,y) sqrt((x-T(j,1)).ˆ2 + (y-T(j,2)).ˆ2 - D(j)ˆ2);ezplot(handles.padf_fig,fh);

endplot(handles.padf_fig, C.pos(1),C.pos(2),’mx’,’LineWidth’,5)% axis equalxlabel(handles.padf_fig,’x - coordinate’)ylabel(handles.padf_fig,’y - coordinate’)handles.error(handles.exp_number) = norm(C.pos-[hm(1);hm(2)]);ttl = sprintf(’Results for experiment #%d.’, ...

handles.exp_number);

196

title(handles.padf_fig,ttl)hold(handles.padf_fig,’off’);% Evaluate and plot performance metrichandles.data(handles.exp_number).dBm = avg_TX_toall(2,:); % not currently usedfor j=1:size(A.mat,1)

mtrc_distance_weight(j) = norm(A.mat(j,:)/2);end% compute distance from each mote to estimatefor j=1:4

D_est(j)=norm(T(j,:)-C.pos’);endmaxD=max(abs(D-D_est’));minD=min(abs(D-D_est’));mean_cross_PLE=mean(cross_PLE);std_cross_PLE_wgt=std(mtrc_distance_weight.*cross_PLE’);handles.metric(handles.exp_number) = ...

3*(maxD./(10+minD)).ˆ(1/2)+2./abs(mean_cross_PLE).ˆ(1/2)+...1./(std_cross_PLE_wgt).ˆ(1/1);

plot(handles.error_metric_fig, [1:1:handles.exp_number],...handles.metric, ’b-o’,’LineWidth’,2);hold(handles.error_metric_fig,’on’);plot(handles.error_metric_fig, [1:1:handles.exp_number], ...handles.error, ’r-o’,’LineWidth’,2);legend(handles.error_metric_fig, ’Metric’, ’Error’)grid onxlabel(’Experiment number’)ylabel(’Pos. error and metric’)ttl = sprintf(’History of Position Error and Performance Metric. ...Error = %0.5g, Metric = %0.5g.’, ...

handles.error(handles.exp_number), handles.metric(handles.exp_number));title(handles.error_metric_fig,ttl)hold(handles.error_metric_fig,’off’);handles.RSSI_edge(handles.exp_number) = RSSI_edge;% Check sanity of resultsdiscard=0;if discard

handles.exp_number = handles.exp_number - 1;set(handles.show_msg,’String’,’Unreliable results’)set(handles.save_button,’Enable’,’off’)

elseset(handles.save_button,’Enable’,’on’)set(handles.show_msg,’String’,’Estimate complete’)

endsound(y, Fs);% Update handles structureguidata(hObject, handles);function m2_y_Callback(hObject, eventdata, handles)% hObject handle to m2_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positiony_axis = eval(get(handles.y_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= y_axis(1) && ...val <= y_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m2_y_CreateFcn(hObject, eventdata, handles)% hObject handle to m2_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’), ...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m3_x_Callback(hObject, eventdata, handles)% hObject handle to m3_x (see GCBO)

197

% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionx_axis = eval(get(handles.x_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= x_axis(1) && ...val <= x_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m3_x_CreateFcn(hObject, eventdata, handles)% hObject handle to m3_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m3_y_Callback(hObject, eventdata, handles)% hObject handle to m3_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positiony_axis = eval(get(handles.y_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= y_axis(1) && ...val <= y_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m3_y_CreateFcn(hObject, eventdata, handles)% hObject handle to m3_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’), ...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m4_x_Callback(hObject, eventdata, handles)% hObject handle to m4_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionx_axis = eval(get(handles.x_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= x_axis(1) && ...val <= x_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);

198

% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m4_x_CreateFcn(hObject, eventdata, handles)% hObject handle to m4_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m4_y_Callback(hObject, eventdata, handles)% hObject handle to m4_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positiony_axis = eval(get(handles.y_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= y_axis(1) && ...val <= y_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m4_y_CreateFcn(hObject, eventdata, handles)% hObject handle to m4_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’), ...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m5_x_Callback(hObject, eventdata, handles)% hObject handle to m5_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionx_axis = eval(get(handles.x_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= x_axis(1) && ...val <= x_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m5_x_CreateFcn(hObject, eventdata, handles)% hObject handle to m5_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.

199

if ispc && isequal(get(hObject,’BackgroundColor’), ...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction m5_y_Callback(hObject, eventdata, handles)% hObject handle to m5_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positiony_axis = eval(get(handles.y_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= y_axis(1) && ...val <= y_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function m5_y_CreateFcn(hObject, eventdata, handles)% hObject handle to m5_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction x_axis_Callback(hObject, eventdata, handles)% hObject handle to x_axis (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Test that the time vector is not too large, is not scalar,% and increases monotonically. First fail if EVAL cannot parse it.% Disable the Plot button ... until proven innocentset(handles.estimate_pos,’Enable’,’off’)try

x_axis = eval(get(handles.x_axis,’String’));if ˜isnumeric(x_axis)

% x_axis is not a numberset(handles.show_msg,’String’,’x_axis is not numeric’)

elseif length(x_axis) < 2% x_axis is not a vectorset(handles.show_msg,’String’,’x_axis must be vector’)

elseif length(x_axis) > 2% x_axis is too long a vector to plot clearlyset(handles.show_msg,’String’,’x_axis is too long’)

elseif min(diff(x_axis)) < 0% x_axis is not monotonically increasingset(handles.show_msg,’String’,’x_axis must increase’)

else% All OK; Enable the Plot button with its original nameset(handles.estimate_pos,’Enable’,’on’)return

end% Found an input error other than a bad expression% Give the edit text box focus so user can correct the erroruicontrol(hObject)

catch EM% Cannot evaluate expression user typedset(handles.estimate_pos,’String’,’Cannot plot’)% Give the edit text box focus so user can correct the erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)% --- Executes during object creation, after setting all properties.function x_axis_CreateFcn(hObject, eventdata, handles)% hObject handle to x_axis (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

200

set(hObject,’BackgroundColor’,’white’);endfunction y_axis_Callback(hObject, eventdata, handles)% hObject handle to y_axis (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Test that the time vector is not too large, is not scalar,% and increases monotonically. First fail if EVAL cannot parse it.% Disable the Plot button ... until proven innocentset(handles.estimate_pos,’Enable’,’off’)try

y_axis = eval(get(handles.y_axis,’String’));if ˜isnumeric(y_axis)

% y_axis is not a numberset(handles.show_msg,’String’,’y_axis is not numeric’)

elseif length(y_axis) < 2% y_axis is not a vectorset(handles.show_msg,’String’,’y_axis must be vector’)

elseif length(y_axis) > 2% y_axis is too long a vector to plot clearlyset(handles.show_msg,’String’,’y_axis is too long’)

elseif min(diff(y_axis)) < 0% y_axis is not monotonically increasingset(handles.show_msg,’String’,’y_axis must increase’)

else% All OK; Enable the Plot button with its original nameset(handles.estimate_pos,’Enable’,’on’)return

end% Found an input error other than a bad expression% Give the edit text box focus so user can correct the erroruicontrol(hObject)

catch EM% Cannot evaluate expression user typedset(handles.estimate_pos,’String’,’Cannot plot’)% Give the edit text box focus so user can correct the erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)% --- Executes during object creation, after setting all properties.function y_axis_CreateFcn(hObject, eventdata, handles)% hObject handle to y_axis (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’), ...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction hm_x_Callback(hObject, eventdata, handles)% hObject handle to hm_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionx_axis = eval(get(handles.x_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= x_axis(1) && ...val <= x_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function hm_x_CreateFcn(hObject, eventdata, handles)% hObject handle to hm_x (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);end

201

function hm_y_Callback(hObject, eventdata, handles)% hObject handle to hm_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positiony_axis = eval(get(handles.y_axis,’String’));if isnumeric(val) && length(val)==1 && ...

val >= y_axis(1) && ...val <= y_axis(2)% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)set(handles.save_button,’Enable’,’off’)% --- Executes during object creation, after setting all properties.function hm_y_CreateFcn(hObject, eventdata, handles)% hObject handle to hm_y (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);endfunction num_samples_Callback(hObject, eventdata, handles)% hObject handle to num_samples (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionnum_samples = eval(get(handles.num_samples,’String’));if isnumeric(val) && length(val)==1 && val >= 10

% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’At least 10!’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)% --- Executes during object creation, after setting all properties.function num_samples_CreateFcn(hObject, eventdata, handles)% hObject handle to num_samples (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);end% --- Executes on button press in save_button.function save_button_Callback(hObject, eventdata, handles)% hObject handle to save_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.estimate_pos,’Enable’,’off’)filename = strcat(’rssi_data’, num2str(handles.exp_number));rssi_data=handles.data(handles.exp_number).rssi_data;T=handles.data(handles.exp_number).T;error=handles.error(handles.exp_number);metric=handles.metric(handles.exp_number);fudge = str2double(get(handles.fudge,’String’));RSSI_edge = handles.RSSI_edge(handles.exp_number);hidden_mote = [str2double(get(handles.hm_x,’String’)) ...str2double(get(handles.hm_y,’String’))];save(filename, ’rssi_data’, ’T’, ’error’, ’metric’, ’fudge’, ’hidden_mote’, ’RSSI_edge’)set(handles.estimate_pos,’Enable’,’on’)

202

set(handles.show_msg,’String’,’Done saving.’)function fudge_Callback(hObject, eventdata, handles)% hObject handle to fudge (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)val = str2double(get(hObject,’String’));% Determine whether val is a valid positionif isnumeric(val) && length(val)==1 && ...

val > 0 && ...val <= 3% Enable the Plot button with its original nameset(handles.estimate_pos,’String’,’Estimate position’)set(handles.estimate_pos,’Enable’,’on’)

elseset(hObject,’String’,...[’Invalid entry’]);% Disable the Plot button and change its string to say whyset(handles.estimate_pos,’String’,’Cannot estimate’)set(handles.estimate_pos,’Enable’,’off’)% Restore focus to the edit text box after erroruicontrol(hObject)

endset(handles.show_msg,’String’,’’)% --- Executes during object creation,%after setting all properties.function fudge_CreateFcn(hObject, eventdata, handles)% hObject handle to fudge (see GCBO)% eventdata reserved - to be defined in a%future version of MATLAB% handles empty - handles not created% until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc && isequal(get(hObject,’BackgroundColor’),...get(0,’defaultUicontrolBackgroundColor’))

set(hObject,’BackgroundColor’,’white’);end

A.3 Process Data Func Codefunction [D, cross_PLE, avg_TXtoall] = process_data_func(rssi_data)%% Description% This function receives RSSI data in the parameter ’rssi_data’, which is% written by the java program RssiDemo.% The file has three columns per line. First one is the sender node number.% The second one is the receiver (forwarding) node number. The third one is% the RSSI value measured by the receiver node.% The function separates the data corresponding to each sender-receiver% pair, then returns PLE and other values.%% Author: Huthiafa Al Issa, Raul Ordonez, Atindra Mitra% Date started: 1-Feb-2010% Last modified: 10-May-2010%%% Initialize and read datahidden_tx = 10; % node_id used for the "hidden" transmitter node%% Separate data by node pairs (sender-receiver), going line by linesender_count=0; % how many senders have been recorded so fardata = struct(’sender’,[],’receiver’,[],’rssi’,[], ’dBm’,[]);senders = []; % Used to keep track of all senders registered so far.

% It duplicates the information in data.sender, except that% in this structure, each sender is recorded individually% together with all its associated receivers. But this data% structure is not easily searchable, hence the need for% the array.

for k = 1:length(rssi_data)found_sender = find(senders==rssi_data(k,1));if isempty(found_sender) % is it a sender node not yet recorded?

sender_count = sender_count+1;senders(sender_count) = rssi_data(k,1);data(sender_count).sender = rssi_data(k,1);data(sender_count).receiver = rssi_data(k,2);data(sender_count).rssi = rssi_data(k,3);

else % OK, it’s a known sender, now organize by receiverfound_receiver = find(data(found_sender).receiver == rssi_data(k,2));if isempty(found_receiver) % is it a receiver not yet recorded?

data(found_sender).receiver(length(data(found_sender).receiver)+1)...= rssi_data(k,2);data(found_sender).rssi(size(data(found_sender).rssi,1)+1,1) =...rssi_data(k,3);if size(data(found_sender).rssi,2)>1

data(found_sender).rssi(size(data(found_sender).rssi,1),2:end) = -1;% pad with -1 to denote empty space

203

endelse

idx = find(data(found_sender).rssi(found_receiver,:)==-1);% find all -1 paddings for current nodeif isempty(idx)

% OK, no padding found, so pad all other nodesdata(found_sender).rssi(:,size(data(found_sender).rssi,2)+1) = -1;% Now, record rssi value for the found receiver of current% senderdata(found_sender).rssi(found_receiver,size(data(found_sender).rssi,2))...= rssi_data(k,3);

else% record data in left-most positiondata(found_sender).rssi(found_receiver,min(idx)) = rssi_data(k,3);

endend

endend%% Convert RSSI to dBm% Use this if RssiBase is configured to return PHY_ED_LEVEL (received% message energy level)for k=1:sender_count

data(k).dBm = data(k).rssi - 91;end% Use this if RssiBase is configured to return true RSSI values% for k=1:sender_count% data(k).dBm = 3*data(k).rssi - 91;% end%% Order data by sender, then by receiver, for easier handling% Always put hidden tx in first positionidx = find(senders==hidden_tx);temp = senders(1);senders(1)=senders(idx);senders(idx)=temp;temp = data(1);data(1) = data(idx);data(idx) = temp;% Now do the rest of the sendersfor k = 2:sender_count-1

[y,idx]=min(senders(k:end));idx = idx+k-1;% Assuming we never have more than 255 nodes working at oncetemp = senders(k);senders(k)=senders(idx);senders(idx)=temp;temp = data(k);data(k) = data(idx);data(idx) = temp;

end% Now that we ordered by senders, let’s order each entry by receiversfor j = 1:sender_count

for k = 1:length(data(j).receiver)-1[y,idx]=min(data(j).receiver(k:end));idx = idx+k-1;temp = data(j).receiver(k);data(j).receiver(k) = data(j).receiver(idx);data(j).receiver(idx) = temp;temp = data(j).rssi(k,:);data(j).rssi(k,:) = data(j).rssi(idx,:);data(j).rssi(idx,:) = temp;temp = data(j).dBm(k,:);data(j).dBm(k,:) = data(j).dBm(idx,:);data(j).dBm(idx,:) = temp;

endend%% Compute outputsPLE = -13.82;%load dist_model;a=2.218065227302679e-15;b=8.303884930269744;c=2.361192808137663;j=1; % only look at TX to receiver datafor k=1:length(data(j).receiver)

PL = median( 10.ˆ(data(j).dBm(k,find(data(j).rssi(k,:)˜=-1))/10) );PL_dB = (10*log10(PL));

% D(k,1) = 10ˆ(PL_dB/(10*PLE));D(k,1) = mean( a*(-data(j).dBm(k,find(data(j).rssi(k,:)˜=-1))).ˆb + c);avg_TXtoall(1,k) = data(j).receiver(k);avg_TXtoall(2,k) = mean(data(j).dBm(k,find(data(j).rssi(k,:)˜=-1)));

end% this choice looks at data from node 2 to 3from_node=2;to_node=1;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );

204

PLE23 = log10( 10ˆ(PL_dB/10) );% this choice looks at data from node ID 2 to 4from_node=2;to_node=2;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );PLE24 = log10( 10ˆ(PL_dB/10) );% this choice looks at data from node ID 2 to 5from_node=2;to_node=3;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );PLE25 = log10( 10ˆ(PL_dB/10) );% this choice looks at data from node ID 3 to 4from_node=3;to_node=2;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );PLE34 = log10( 10ˆ(PL_dB/10) );% this choice looks at data from node ID 3 to 5from_node=3;to_node=3;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );PLE35 = log10( 10ˆ(PL_dB/10) );% this choice looks at data from node ID 4 to 5from_node=4;to_node=3;PL = median( 10.ˆ(data(from_node).dBm(to_node,find(data(from_node)....rssi(to_node,:)˜=-1))/10) );PL_dB = 10*log10( PL );PLE45 = log10( 10ˆ(PL_dB/10) );cross_PLE=[PLE23 PLE24 PLE25 PLE34 PLE35 PLE45]’;% cross_PLE=PLE1;

A.4 Read Basestation Codefunction data = read_basestation(num_samples)

%% Description%% This function reads the USB port where the Iris base station is connected% and directly reads the packets arriving. It extracts three items:% from_node, to_node and rssi_value.%% It returns an array with as many rows as the argument num_samples% specifies.%% Author: Huthaifa Al Issa, Raul Ordonez% Date started: 27-Apr-2010% Last modified: 27-Apr-2010%%% Initialize USB ports = serial(’COM4’,’BaudRate’,57600);fopen(s);counter = 0;PACKETSIZE=22; % this size was determined by trial and errordata = [];%% Read data, throwing away any bad packetswhile(counter < num_samples)

if (s.BytesAvailable > PACKETSIZE)packet = fread(s,PACKETSIZE);from_node = packet(14);to_node = packet(7);rssi = packet(12);if from_node == 10 & to_node == 2

counter = counter+1; % only increase counter for 10 to 2 packetend% the positions of these items was determined by trial and error, and% a lot of observationsif from_node < 2 | from_node > 10 | to_node < 2 | to_node > 10

fclose(s);fopen(s);

% counter = counter - 1;disp(’Bad packet’)

elsedata = [data; from_node to_node rssi];msg=sprintf(’Sample #%d. From: %d To: %d RSSI:%d’,counter, from_node, to_node, rssi);disp(msg)

205

endend

endfclose(s);

A.5 Try Serial Reading Code%Author: Huthaifa Al Issa, Raul Ordonezclcs = serial(’/dev/tty.usbserial-XBSDY4SBB’,’BaudRate’,57600);fopen(s);counter = 0;PACKETSIZE=22;while(counter<100)

if (s.BytesAvailable > PACKETSIZE)packet = fread(s,PACKETSIZE);

counter = counter+1;from_node = packet(14);to_node = packet(7);rssi = packet(12);[from_node to_node rssi]if from_node < 2 | from_node > 10 | to_node < 2 | to_node > 10

disp(’Bad packet’)fclose(s);fopen(s);

% pause(0.1)end

endendfclose(s);

A.6 ABC valuesa=2.218065227302679e-15;\\b=8.303884930269744;\\c=2.361192808137663;

206

APPENDIX B

TINY OPERATING SYSTEM

B.1 IRIS Mote Program: About This SoftwareUSE:1. Install the ’SendingMote’ program in a single mote to function as the ”hidden” transmitter, to be located by cooperative RSSI

value measurements. I use NODE ID=10 for this mote in my experiments.

2. Install ’RssiBase’ on a base station attached to a computer via USB. This mote must have NODE ID=1.

3. Install ’ForwardingMote’ on one or more motes that act as RSSI sensors. These motes measure the RSSI value as they receivethe packages broadcast by ’SendingMote’, and then forward the package to the base station but now with the measured RSSI valueinserted. Also, different from v1, now each forwarding mote also broadcasts to all other forwarding motes, which also measure theinter-mote RSSI values and then send to the base station.

AUTHOR:Raul Ordonez, Huthaifa Al Issa Dept. Electrical and Computer Engineering University of Dayton

DATE:25-Feb-2010 11-Mar-2010

B.1.1 How To Make Nc Code**NOTE**Use com6 to program if using the standalone (black) base station. Then, use

export MOTECOM=serial@COM7:iris

IF using the individual USB programming board with separate IRIS radio, use com8 to program, and

export MOTECOM=serial@COM9:iris

To program, use

make iris install mib520,com6or (to give a specific ID to the node)

make iris install,NODE ID mib520,com6/* * Copyright (c) 2008 Dimas Abreu Dutra * All rights reserved */

/** * @author Dimas Abreu Dutra *//** * @author Raul Ordonez, Huthaifa AL Issa * Dept. Eletrical and Computer Engineering * University of Dayton * Started:

26-Jan-2010 * @date 28-Feb-2010 */

B.1.2 ReadME BEFORE MakingMAKE NOTES:Be sure to usemake iris install,NODE ID mib520,com8with a different NODE ID for each forwarding mote.

Whatever NODE ID is chosen, it **must** be different from the following:

* 1 (reserved for base station mote NODE ID)* any sending mote NODE ID

In all my tests, I use node ID’s in the range 2 to 5 for the forwarding motes.

207

B.1.3 RssiDemoMessages Code/** Copyright (c) 2008 Dimas Abreu Dutra* All rights reserved*//*** @author Dimas Abreu Dutra*//*** @author Raul Ordonez, Huthaifa Al Issa* Dept. Eletrical and Computer Engineering* University of Dayton* Started: 26-Jan-2010* @date 28-Feb-2010*/#ifndef RSSIDEMOMESSAGES_H__#define RSSIDEMOMESSAGES_H__enum {

AM_RSSIMSG = 6,AM_FORWARDTOBASE = 6,AM_BASE_ID = 1,SEND_INTERVAL_MS = 1000,FWD_INTERVAL_MS = 1300

};typedef nx_struct RssiMsg{

nx_int16_t rssi;nx_uint16_t sender_id;nx_uint16_t forwarder_id;nx_bool forwarded;nx_uint16_t counter;

} RssiMsg;#endif //RSSIDEMOMESSAGES_H__

B.2 ForwardingMote

B.2.1 ForwardToBaseAppC Code/*** Waits for a message to arrive from sender mote, then writes its own node id* and measured RSSI value in the message, and forwards it to the base station* mote for achival on the PC.** @author Raul Ordonez and Huthaifa Al Issa* Dept. Eletrical and Computer Engineering* University of Dayton* Started: 26-Jan-2010* @date 25-Feb-2010*/#include <Timer.h>#include "RssiDemoMessages.h"configuration ForwardToBaseAppC {}implementation {

components MainC;components LedsC;components new TimerMilliC() as Timer0;components ForwardToBaseC as App;components ActiveMessageC;components new AMSenderC(AM_RSSIMSG);components new AMReceiverC(AM_RSSIMSG);

#ifdef __CC2420_H__components CC2420ActiveMessageC;App -> CC2420ActiveMessageC.CC2420Packet;

#elif defined(PLATFORM_IRIS)components RF230ActiveMessageC;App -> RF230ActiveMessageC.PacketRSSI;

#elif defined(TDA5250_MESSAGE_H)components Tda5250ActiveMessageC;App -> Tda5250ActiveMessageC.Tda5250Packet;

#endifApp.Boot -> MainC;App.Leds -> LedsC;App.Timer0 -> Timer0;App.Packet -> AMSenderC;App.AMPacket -> AMSenderC;App.AMControl -> ActiveMessageC;App.AMSend -> AMSenderC;App.Receive -> AMReceiverC;

}

208

B.2.2 ForwardToBaseC Code/*** Waits for a message to arrive from sender mote, then writes its own node id* and measured RSSI value in the message, and forwards it to the base station* mote for achival on the PC.** @author Raul Ordonez and Huthaifa Al Issa* Dept. Eletrical and Computer Engineering* University of Dayton* Started: 26-Jan-2010* @date 25-Feb-2010*/#include "RssiDemoMessages.h"module ForwardToBaseC {

uses interface Boot;uses interface Leds;uses interface Packet;uses interface Timer<TMilli> as Timer0;uses interface AMPacket;uses interface AMSend;uses interface Receive;uses interface SplitControl as AMControl;

#ifdef __CC2420_H__uses interface CC2420Packet;

#elif defined(TDA5250_MESSAGE_H)uses interface Tda5250Packet;

#elseuses interface PacketField<uint8_t> as PacketRSSI;

#endif}implementation {

uint16_t getRssi(message_t *msg);message_t pkt;bool busy = FALSE;void setLeds(uint16_t val) {

if (val & 0x01)call Leds.led0On();

elsecall Leds.led0Off();

if (val & 0x02)call Leds.led1On();

elsecall Leds.led1Off();

if (val & 0x04)call Leds.led2On();

elsecall Leds.led2Off();

}task void toggle(){

call Leds.led0Toggle();}event void Boot.booted() {

call AMControl.start();}event void AMControl.startDone(error_t err) {

if (err == SUCCESS) {call Timer0.startPeriodic(FWD_INTERVAL_MS);

post toggle();}else {

call AMControl.start();}

}event void AMControl.stopDone(error_t err) {}// Broadcast packages to all other forwarding nodes so they can measure the// inter-mote RSSI values.event void Timer0.fired() {

if (!busy) {RssiMsg* btrpkt = (RssiMsg*)(call Packet.getPayload(&pkt, sizeof(RssiMsg)));

if (btrpkt == NULL) {return;}

btrpkt->sender_id = TOS_NODE_ID;btrpkt->counter = 0;

btrpkt->forwarded = FALSE;if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(RssiMsg)) == SUCCESS) {

busy = TRUE;}

}}event void AMSend.sendDone(message_t* msg, error_t err) {

busy = FALSE;}event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len){

209

RssiMsg* btrpkt = (RssiMsg*)payload;// check if the message received is "fresh" or whether it has already been forwarded// by some other moteif (btrpkt->forwarded) {return msg;}// OK, we have a fresh message, so fill in the information before forwarding

btrpkt->forwarder_id = TOS_NODE_ID;btrpkt->forwarded = TRUE;

btrpkt->rssi = getRssi(msg);setLeds(btrpkt->counter);// Now we are ready to send the message to the base station for archivalif (call AMSend.send(AM_BROADCAST_ADDR, msg, sizeof(RssiMsg)) == SUCCESS) {busy = TRUE;}return msg;

}#ifdef __CC2420_H__

uint16_t getRssi(message_t *msg){return (uint16_t) call CC2420Packet.getRssi(msg);

}#elif defined(CC1K_RADIO_MSG_H)

uint16_t getRssi(message_t *msg){cc1000_metadata_t *md =(cc1000_metadata_t*) msg->metadata;return md->strength_or_preamble;

}#elif defined(PLATFORM_IRIS)

uint16_t getRssi(message_t *msg){if(call PacketRSSI.isSet(msg))return (uint16_t) call PacketRSSI.get(msg);

elsereturn 0xFFFF;

}#elif defined(TDA5250_MESSAGE_H)

uint16_t getRssi(message_t *msg){return call Tda5250Packet.getSnr(msg);

}#else

#error Radio chip not supported! This demo currently works only \for motes with CC1000, CC2420, RF230 or TDA5250 radios.

#endif}

B.3 Build Iris Code

B.3.1 App#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# 116 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\stdint.h" 3typedef int int8_t __attribute((__mode__(__QI__))) ;typedef unsigned int uint8_t __attribute((__mode__(__QI__))) ;typedef int int16_t __attribute((__mode__(__HI__))) ;typedef unsigned int uint16_t __attribute((__mode__(__HI__))) ;typedef int int32_t __attribute((__mode__(__SI__))) ;typedef unsigned int uint32_t __attribute((__mode__(__SI__))) ;typedef int int64_t __attribute((__mode__(__DI__))) ;typedef unsigned int uint64_t __attribute((__mode__(__DI__))) ;#line 135typedef int16_t intptr_t;typedef uint16_t uintptr_t;#line 152typedef int8_t int_least8_t;typedef uint8_t uint_least8_t;typedef int16_t int_least16_t;typedef uint16_t uint_least16_t;typedef int32_t int_least32_t;typedef uint32_t uint_least32_t;typedef int64_t int_least64_t;typedef uint64_t uint_least64_t;#line 200typedef int8_t int_fast8_t;typedef uint8_t uint_fast8_t;typedef int16_t int_fast16_t;typedef uint16_t uint_fast16_t;typedef int32_t int_fast32_t;

210

typedef uint32_t uint_fast32_t;typedef int64_t int_fast64_t;typedef uint64_t uint_fast64_t;#line 249typedef int64_t intmax_t;typedef uint64_t uintmax_t;# 76 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\inttypes.h"typedef int32_t int_farptr_t;typedef uint32_t uint_farptr_t;# 235 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint8_t __nesc_ntoh_uint8(const void *source);static __inline uint8_t __nesc_hton_uint8(void *target, uint8_t value);static __inline uint8_t __nesc_ntoh_leuint8(const void *source);static __inline uint8_t __nesc_hton_leuint8(void *target, uint8_t value);static __inline int8_t __nesc_ntoh_int8(const void *source);#line 257static __inline int8_t __nesc_hton_int8(void *target, int8_t value);static __inline uint16_t __nesc_ntoh_uint16(const void *source);static __inline uint16_t __nesc_hton_uint16(void *target, uint16_t value);static __inline uint16_t __nesc_ntoh_leuint16(const void *source);static __inline uint16_t __nesc_hton_leuint16(void *target, uint16_t value);static __inline int16_t __nesc_hton_int16(void *target, int16_t value);static __inline uint32_t __nesc_ntoh_uint32(const void *source);static __inline uint32_t __nesc_hton_uint32(void *target, uint32_t value);#line 326static __inline int32_t __nesc_ntoh_int32(const void *source);#line 326static __inline int32_t __nesc_hton_int32(void *target, int32_t value);#line 385typedef 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 ;# 213 "C:\\Crossbow\\cygwin\\usr\\local\\lib\\gcc\\avr\\3.4.5\\include\\stddef.h" 3typedef unsigned int size_t;# 113 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\string.h" 3extern void *memset(void *, int , size_t );# 325 "C:\\Crossbow\\cygwin\\usr\\local\\lib\\gcc\\avr\\3.4.5\\include\\stddef.h" 3typedef int wchar_t;# 69 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\stdlib.h"#line 66typedef struct __nesc_unnamed4242 {

int quot;int rem;

} div_t;#line 72typedef struct __nesc_unnamed4243 {

long quot;long rem;

} ldiv_t;typedef int (*__compar_fn_t)(const void *, const void *);# 151 "C:\\Crossbow\\cygwin\\usr\\local\\lib\\gcc\\avr\\3.4.5\\include\\stddef.h" 3typedef int ptrdiff_t;

211

# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\safe\\include\\annots_stage1.h"struct __nesc_attr_safe {};#line 41struct __nesc_attr_unsafe {};# 23 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\tos.h"typedef uint8_t bool;enum __nesc_unnamed4244 {#line 24

FALSE = 0, TRUE = 1};typedef nx_int8_t nx_bool;uint16_t TOS_NODE_ID = 1;struct __nesc_attr_atmostonce {};#line 35struct __nesc_attr_atleastonce {};#line 36struct __nesc_attr_exactlyonce {};# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\TinyError.h"enum __nesc_unnamed4245 {

SUCCESS = 0,FAIL = 1,ESIZE = 2,ECANCEL = 3,EOFF = 4,EBUSY = 5,EINVAL = 6,ERETRY = 7,ERESERVE = 8,EALREADY = 9,ENOMEM = 10,ENOACK = 11,ELAST = 11

};typedef uint8_t error_t ;static inline error_t ecombine(error_t r1, error_t r2) ;# 203 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\avr\\pgmspace.h" 3typedef void prog_void __attribute((__progmem__)) ;typedef char prog_char __attribute((__progmem__)) ;typedef unsigned char prog_uchar __attribute((__progmem__)) ;typedef int8_t prog_int8_t __attribute((__progmem__)) ;typedef uint8_t prog_uint8_t __attribute((__progmem__)) ;typedef int16_t prog_int16_t __attribute((__progmem__)) ;typedef uint16_t prog_uint16_t __attribute((__progmem__)) ;typedef int32_t prog_int32_t __attribute((__progmem__)) ;typedef uint32_t prog_uint32_t __attribute((__progmem__)) ;typedef int64_t prog_int64_t __attribute((__progmem__)) ;typedef uint64_t prog_uint64_t __attribute((__progmem__)) ;# 25 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\atm128const.h"typedef uint8_t const_uint8_t __attribute((__progmem__)) ;typedef uint16_t const_uint16_t __attribute((__progmem__)) ;typedef uint32_t const_uint32_t __attribute((__progmem__)) ;typedef int8_t const_int8_t __attribute((__progmem__)) ;typedef int16_t const_int16_t __attribute((__progmem__)) ;typedef int32_t const_int32_t __attribute((__progmem__)) ;# 105 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\atm128hardware.h"static __inline void __nesc_enable_interrupt(void) ;static __inline void __nesc_disable_interrupt(void) ;typedef uint8_t __nesc_atomic_t;__nesc_atomic_t __nesc_atomic_start(void );void __nesc_atomic_end(__nesc_atomic_t original_SREG);#line 125__inline __nesc_atomic_t__nesc_atomic_start(void ) ;#line 135__inline void__nesc_atomic_end(__nesc_atomic_t original_SREG) ;typedef uint8_t mcu_power_t ;enum __nesc_unnamed4246 {

ATM128_POWER_IDLE = 0,ATM128_POWER_ADC_NR = 1,ATM128_POWER_EXT_STANDBY = 2,ATM128_POWER_SAVE = 3,ATM128_POWER_STANDBY = 4,ATM128_POWER_DOWN = 5

};static inline mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) ;#line 170

212

#line 162typedef struct __nesc_unnamed4247 {

uint8_t porf : 1;uint8_t extrf : 1;uint8_t borf : 1;uint8_t wdrf : 1;uint8_t jtrf : 1;uint8_t resv1 : 3;

} Atm128_MCUSR_t;#line 173typedef struct __nesc_unnamed4248 {

uint8_t srw00 : 1;uint8_t srw01 : 1;uint8_t srw10 : 1;uint8_t srw11 : 1;uint8_t srl : 3;uint8_t sre : 1;

} Atm128_XMCRA_t;#line 184typedef struct __nesc_unnamed4249 {

uint8_t xmm : 3;uint8_t resv1 : 4;uint8_t xmbk : 1;

} Atm128_XMCRB_t;# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\adc\\Atm128Adc.h"enum __nesc_unnamed4250 {

ATM128_ADC_VREF_OFF = 0,ATM128_ADC_VREF_AVCC = 1,ATM128_ADC_VREF_RSVD,ATM128_ADC_VREF_2_56 = 3

};enum __nesc_unnamed4251 {

ATM128_ADC_RIGHT_ADJUST = 0,ATM128_ADC_LEFT_ADJUST = 1

};enum __nesc_unnamed4252 {

ATM128_ADC_SNGL_ADC0 = 0,ATM128_ADC_SNGL_ADC1,ATM128_ADC_SNGL_ADC2,ATM128_ADC_SNGL_ADC3,ATM128_ADC_SNGL_ADC4,ATM128_ADC_SNGL_ADC5,ATM128_ADC_SNGL_ADC6,ATM128_ADC_SNGL_ADC7,ATM128_ADC_DIFF_ADC00_10x,ATM128_ADC_DIFF_ADC10_10x,ATM128_ADC_DIFF_ADC00_200x,ATM128_ADC_DIFF_ADC10_200x,ATM128_ADC_DIFF_ADC22_10x,ATM128_ADC_DIFF_ADC32_10x,ATM128_ADC_DIFF_ADC22_200x,ATM128_ADC_DIFF_ADC32_200x,ATM128_ADC_DIFF_ADC01_1x,ATM128_ADC_DIFF_ADC11_1x,ATM128_ADC_DIFF_ADC21_1x,ATM128_ADC_DIFF_ADC31_1x,ATM128_ADC_DIFF_ADC41_1x,ATM128_ADC_DIFF_ADC51_1x,ATM128_ADC_DIFF_ADC61_1x,ATM128_ADC_DIFF_ADC71_1x,ATM128_ADC_DIFF_ADC02_1x,ATM128_ADC_DIFF_ADC12_1x,ATM128_ADC_DIFF_ADC22_1x,ATM128_ADC_DIFF_ADC32_1x,ATM128_ADC_DIFF_ADC42_1x,ATM128_ADC_DIFF_ADC52_1x,ATM128_ADC_SNGL_1_23,ATM128_ADC_SNGL_GND

};#line 113typedef struct __nesc_unnamed4253 {

uint8_t mux : 5;uint8_t adlar : 1;uint8_t refs : 2;

} Atm128Admux_t;enum __nesc_unnamed4254 {

ATM128_ADC_PRESCALE_2 = 0,ATM128_ADC_PRESCALE_2b,ATM128_ADC_PRESCALE_4,ATM128_ADC_PRESCALE_8,ATM128_ADC_PRESCALE_16,ATM128_ADC_PRESCALE_32,ATM128_ADC_PRESCALE_64,ATM128_ADC_PRESCALE_128,ATM128_ADC_PRESCALE

};

213

enum __nesc_unnamed4255 {ATM128_ADC_ENABLE_OFF = 0,ATM128_ADC_ENABLE_ON

};enum __nesc_unnamed4256 {

ATM128_ADC_START_CONVERSION_OFF = 0,ATM128_ADC_START_CONVERSION_ON

};enum __nesc_unnamed4257 {

ATM128_ADC_FREE_RUNNING_OFF = 0,ATM128_ADC_FREE_RUNNING_ON

};enum __nesc_unnamed4258 {

ATM128_ADC_INT_FLAG_OFF = 0,ATM128_ADC_INT_FLAG_ON

};enum __nesc_unnamed4259 {

ATM128_ADC_INT_ENABLE_OFF = 0,ATM128_ADC_INT_ENABLE_ON

};#line 169typedef struct __nesc_unnamed4260 {

uint8_t adps : 3;uint8_t adie : 1;uint8_t adif : 1;uint8_t adate : 1;uint8_t adsc : 1;uint8_t aden : 1;

} Atm128Adcsra_t;#line 180typedef struct __nesc_unnamed4261 {

uint8_t adts : 3;uint8_t mux5 : 1;uint8_t resv1 : 2;uint8_t acme : 1;uint8_t resv2 : 1;

} Atm128Adcsrb_t;typedef uint8_t Atm128_ADCH_t;typedef uint8_t Atm128_ADCL_t;# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.h"typedef struct __nesc_unnamed4262 {#line 29

int notUsed;}#line 29TMilli;typedef struct __nesc_unnamed4263 {#line 30

int notUsed;}#line 30T32khz;typedef struct __nesc_unnamed4264 {#line 31

int notUsed;}#line 31TMicro;# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm128Timer.h"enum __nesc_unnamed4265 {

ATM128_CLK8_OFF = 0x0,ATM128_CLK8_NORMAL = 0x1,ATM128_CLK8_DIVIDE_8 = 0x2,ATM128_CLK8_DIVIDE_32 = 0x3,ATM128_CLK8_DIVIDE_64 = 0x4,ATM128_CLK8_DIVIDE_128 = 0x5,ATM128_CLK8_DIVIDE_256 = 0x6,ATM128_CLK8_DIVIDE_1024 = 0x7

};enum __nesc_unnamed4266 {

ATM128_CLK16_OFF = 0x0,ATM128_CLK16_NORMAL = 0x1,ATM128_CLK16_DIVIDE_8 = 0x2,ATM128_CLK16_DIVIDE_64 = 0x3,ATM128_CLK16_DIVIDE_256 = 0x4,ATM128_CLK16_DIVIDE_1024 = 0x5,ATM128_CLK16_EXTERNAL_FALL = 0x6,ATM128_CLK16_EXTERNAL_RISE = 0x7

};enum __nesc_unnamed4267 {

AVR_CLOCK_OFF = 0,AVR_CLOCK_ON = 1,AVR_CLOCK_DIVIDE_8 = 2

};enum __nesc_unnamed4268 {

214

ATM128_TIMER_COMPARE_NORMAL = 0,ATM128_TIMER_COMPARE_TOGGLE,ATM128_TIMER_COMPARE_CLEAR,ATM128_TIMER_COMPARE_SET

};enum __nesc_unnamed4269 {

ATM128_WAVE8_NORMAL = 0,ATM128_WAVE8_PWM,ATM128_WAVE8_CTC,ATM128_WAVE8_PWM_FAST

};enum __nesc_unnamed4270 {

ATM128_WAVE16_NORMAL = 0,ATM128_WAVE16_PWM_8BIT,ATM128_WAVE16_PWM_9BIT,ATM128_WAVE16_PWM_10BIT,ATM128_WAVE16_CTC_COMPARE,ATM128_WAVE16_PWM_FAST_8BIT,ATM128_WAVE16_PWM_FAST_9BIT,ATM128_WAVE16_PWM_FAST_10BIT,ATM128_WAVE16_PWM_CAPTURE_LOW,ATM128_WAVE16_PWM_COMPARE_LOW,ATM128_WAVE16_PWM_CAPTURE_HIGH,ATM128_WAVE16_PWM_COMPARE_HIGH,ATM128_WAVE16_CTC_CAPTURE,ATM128_WAVE16_RESERVED,ATM128_WAVE16_PWM_FAST_CAPTURE,ATM128_WAVE16_PWM_FAST_COMPARE

};enum __nesc_unnamed4271 {

ATM128_COMPARE_OFF = 0,ATM128_COMPARE_TOGGLE,ATM128_COMPARE_CLEAR,ATM128_COMPARE_SET

};#line 148#line 136typedef union __nesc_unnamed4272 {

uint8_t flat;struct __nesc_unnamed4273 {

uint8_t wgm00 : 1;uint8_t wgm01 : 1;uint8_t resv1 : 2;uint8_t com0b0 : 1;uint8_t com0b1 : 1;uint8_t com0a0 : 1;uint8_t com0a1 : 1;

} bits;} Atm128_TCCR0A_t;#line 163#line 151typedef union __nesc_unnamed4274 {

uint8_t flat;struct __nesc_unnamed4275 {

uint8_t cs00 : 1;uint8_t cs01 : 1;uint8_t cs02 : 2;uint8_t wgm02 : 1;uint8_t resv1 : 2;uint8_t foc0b : 1;uint8_t foc0a : 1;

} bits;} Atm128_TCCR0B_t;#line 175#line 166typedef union __nesc_unnamed4276 {

uint8_t flat;struct __nesc_unnamed4277 {

uint8_t toie0 : 1;uint8_t ocie0a : 1;uint8_t ocie0e : 1;uint8_t resv1 : 5;

} bits;} Atm128_TIMSK0_t;#line 187#line 178typedef union __nesc_unnamed4278 {

uint8_t flat;struct __nesc_unnamed4279 {

uint8_t tov0 : 1;uint8_t ocf0a : 1;uint8_t ocf0b : 1;uint8_t resv1 : 5;

} bits;} Atm128_TIFR0_t;#line 203#line 190

215

typedef union __nesc_unnamed4280 {uint8_t flat;struct __nesc_unnamed4281 {

uint8_t tcr2bub : 1;uint8_t tcr2aub : 1;uint8_t ocr2bub : 1;uint8_t ocr2aub : 1;uint8_t tcn2ub : 1;uint8_t as2 : 1;uint8_t exclk : 1;uint8_t resv1 : 1;

} bits;} Atm128_ASSR_t;#line 216#line 206typedef union __nesc_unnamed4282 {

uint8_t flat;struct __nesc_unnamed4283 {

uint8_t wgm20 : 1;uint8_t wgm21 : 1;uint8_t resv1 : 2;uint8_t comb : 2;uint8_t coma : 2;

} bits;} Atm128_TCCR2A_t;#line 229#line 219typedef union __nesc_unnamed4284 {

uint8_t flat;struct __nesc_unnamed4285 {

uint8_t cs : 3;uint8_t wgm22 : 1;uint8_t resv1 : 2;uint8_t foc2b : 1;uint8_t foc2a : 1;

} bits;} Atm128_TCCR2B_t;#line 241#line 232typedef union __nesc_unnamed4286 {

uint8_t flat;struct __nesc_unnamed4287 {

uint8_t toie : 1;uint8_t ociea : 1;uint8_t ocieb : 1;uint8_t resv1 : 5;

} bits;} Atm128_TIMSK2_t;#line 253#line 244typedef union __nesc_unnamed4288 {

uint8_t flat;struct __nesc_unnamed4289 {

uint8_t tov : 1;uint8_t ocfa : 1;uint8_t ocfb : 1;uint8_t resv1 : 5;

} bits;} Atm128_TIFR2_t;#line 266#line 257typedef union __nesc_unnamed4290 {

uint8_t flat;struct __nesc_unnamed4291 {

uint8_t wgm01 : 2;uint8_t comc : 2;uint8_t comb : 2;uint8_t coma : 2;

} bits;} Atm128_TCCRA_t;#line 279#line 269typedef union __nesc_unnamed4292 {

uint8_t flat;struct __nesc_unnamed4293 {

uint8_t cs : 3;uint8_t wgm23 : 2;uint8_t resv1 : 1;uint8_t ices : 1;uint8_t icnc : 1;

} bits;} Atm128_TCCRB_t;#line 291#line 282typedef union __nesc_unnamed4294 {

uint8_t flat;

216

struct __nesc_unnamed4295 {uint8_t resv1 : 5;uint8_t focc : 1;uint8_t focb : 1;uint8_t foca : 1;

} bits;} Atm128_TCCRC_t;#line 306#line 294typedef union __nesc_unnamed4296 {

uint8_t flat;struct __nesc_unnamed4297 {

uint8_t toie : 1;uint8_t ociea : 1;uint8_t ocieb : 1;uint8_t ociec : 1;uint8_t resv1 : 1;uint8_t icie : 1;uint8_t resv2 : 2;

} bits;} Atm128_TIMSK_t;#line 321#line 309typedef union __nesc_unnamed4298 {

uint8_t flat;struct __nesc_unnamed4299 {

uint8_t tov : 1;uint8_t ocfa : 1;uint8_t ocfb : 1;uint8_t ocfc : 1;uint8_t resv1 : 1;uint8_t icf : 1;uint8_t resv2 : 2;

} bits;} Atm128_TIFR_t;#line 333#line 324typedef union __nesc_unnamed4300 {

uint8_t flat;struct __nesc_unnamed4301 {

uint8_t psrsync : 1;uint8_t psrasy : 1;uint8_t resv1 : 5;uint8_t tsm : 1;

} bits;} Atm128_GTCCR_t;typedef uint8_t Atm128_TCNT1H_t;typedef uint8_t Atm128_TCNT1L_t;typedef uint8_t Atm128_TCNT3H_t;typedef uint8_t Atm128_TCNT3L_t;typedef uint8_t Atm128_TCNT4H_t;typedef uint8_t Atm128_TCNT4L_t;typedef uint8_t Atm128_TCNT5H_t;typedef uint8_t Atm128_TCNT5L_t;typedef uint8_t Atm128_OCR1AH_t;typedef uint8_t Atm128_OCR1AL_t;typedef uint8_t Atm128_OCR1BH_t;typedef uint8_t Atm128_OCR1BL_t;typedef uint8_t Atm128_OCR1CH_t;typedef uint8_t Atm128_OCR1CL_t;typedef uint8_t Atm128_OCR3AH_t;typedef uint8_t Atm128_OCR3AL_t;typedef uint8_t Atm128_OCR3BH_t;typedef uint8_t Atm128_OCR3BL_t;typedef uint8_t Atm128_OCR3CH_t;typedef uint8_t Atm128_OCR3CL_t;typedef uint8_t Atm128_OCR4AH_t;typedef uint8_t Atm128_OCR4AL_t;typedef uint8_t Atm128_OCR4BH_t;typedef uint8_t Atm128_OCR4BL_t;typedef uint8_t Atm128_OCR4CH_t;typedef uint8_t Atm128_OCR4CL_t;typedef uint8_t Atm128_OCR5AH_t;typedef uint8_t Atm128_OCR5AL_t;typedef uint8_t Atm128_OCR5BH_t;typedef uint8_t Atm128_OCR5BL_t;typedef uint8_t Atm128_OCR5CH_t;typedef uint8_t Atm128_OCR5CL_t;typedef uint8_t Atm128_ICR1H_t;typedef uint8_t Atm128_ICR1L_t;typedef uint8_t Atm128_ICR3H_t;typedef uint8_t Atm128_ICR3L_t;typedef uint8_t Atm128_ICR4H_t;

217

typedef uint8_t Atm128_ICR4L_t;typedef uint8_t Atm128_ICR5H_t;typedef uint8_t Atm128_ICR5L_t;# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\MicaTimer.h"typedef struct __nesc_unnamed4302 {}#line 74T64khz;typedef struct __nesc_unnamed4303 {}#line 75T128khz;typedef struct __nesc_unnamed4304 {}#line 76T2mhz;typedef struct __nesc_unnamed4305 {}#line 77T4mhz;#line 147typedef TMicro TOne;typedef TMicro TThree;typedef uint32_t counter_one_overflow_t;typedef uint16_t counter_three_overflow_t;enum __nesc_unnamed4306 {

MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_8,MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 5,MICA_PRESCALER_THREE = ATM128_CLK16_DIVIDE_8,MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 0,EXT_STANDBY_T0_THRESHOLD = 12

};enum __nesc_unnamed4307 {

PLATFORM_MHZ = 8};# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\micaz\\hardware.h"enum __nesc_unnamed4308 {

CHANNEL_THERMISTOR = ATM128_ADC_SNGL_ADC1};enum __nesc_unnamed4309 {

PLATFORM_BAUDRATE = 57600L};# 21 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\RssiDemoMessages.h"enum __nesc_unnamed4310 {

AM_RSSIMSG = 6,AM_FORWARDTOBASE = 6,AM_BASE_ID = 1,SEND_INTERVAL_MS = 1000,FWD_INTERVAL_MS = 1300

};#line 29typedef nx_struct RssiMsg {

nx_int16_t rssi;nx_uint16_t sender_id;nx_uint16_t forwarder_id;nx_bool forwarded;nx_uint16_t counter;

} __attribute__((packed)) RssiMsg;# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\Leds.h"enum __nesc_unnamed4311 {

LEDS_LED0 = 1 << 0,LEDS_LED1 = 1 << 1,LEDS_LED2 = 1 << 2,LEDS_LED3 = 1 << 3,LEDS_LED4 = 1 << 4,LEDS_LED5 = 1 << 5,LEDS_LED6 = 1 << 6,LEDS_LED7 = 1 << 7

};# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.h"#line 27typedef nx_struct ieee154_header_t {

nxle_uint8_t length;nxle_uint16_t fcf;nxle_uint8_t dsn;nxle_uint16_t destpan;nxle_uint16_t dest;nxle_uint16_t src;nxle_uint8_t network;nxle_uint8_t type;

} __attribute__((packed)) ieee154_header_t;#line 45

218

typedef nx_struct ieee154_footer_t {nxle_uint16_t crc;

} __attribute__((packed)) ieee154_footer_t;enum ieee154_fcf_enums {

IEEE154_FCF_FRAME_TYPE = 0,IEEE154_FCF_SECURITY_ENABLED = 3,IEEE154_FCF_FRAME_PENDING = 4,IEEE154_FCF_ACK_REQ = 5,IEEE154_FCF_INTRAPAN = 6,IEEE154_FCF_DEST_ADDR_MODE = 10,IEEE154_FCF_SRC_ADDR_MODE = 14

};enum ieee154_fcf_type_enums {

IEEE154_TYPE_BEACON = 0,IEEE154_TYPE_DATA = 1,IEEE154_TYPE_ACK = 2,IEEE154_TYPE_MAC_CMD = 3,IEEE154_TYPE_MASK = 7

};enum iee154_fcf_addr_mode_enums {

IEEE154_ADDR_NONE = 0,IEEE154_ADDR_SHORT = 2,IEEE154_ADDR_EXT = 3,IEEE154_ADDR_MASK = 3

};# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Packet.h"typedef ieee154_header_t rf230packet_header_t;#line 31typedef nx_struct rf230packet_footer_t {} __attribute__((packed))rf230packet_footer_t;#line 36typedef struct rf230packet_metadata_t {

uint8_t flags;uint8_t lqi;uint8_t power;uint32_t timestamp;

} rf230packet_metadata_t;enum rf230packet_metadata_flags {

RF230PACKET_WAS_ACKED = 0x01,RF230PACKET_TIMESTAMP = 0x02,RF230PACKET_TXPOWER = 0x04,RF230PACKET_RSSI = 0x08,RF230PACKET_TIMESYNC = 0x10,RF230PACKET_LPL_SLEEPINT = 0x20,RF230PACKET_CLEAR_METADATA = 0x00

};# 6 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\AM.h"typedef nx_uint8_t nx_am_id_t;typedef nx_uint8_t nx_am_group_t;typedef nx_uint16_t nx_am_addr_t;typedef uint8_t am_id_t;typedef uint8_t am_group_t;typedef uint16_t am_addr_t;enum __nesc_unnamed4312 {

AM_BROADCAST_ADDR = 0xffff};enum __nesc_unnamed4313 {

TOS_AM_GROUP = 0x22,TOS_AM_ADDRESS = 1

};# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\serial\\Serial.h"typedef uint8_t uart_id_t;enum __nesc_unnamed4314 {

HDLC_FLAG_BYTE = 0x7e,HDLC_CTLESC_BYTE = 0x7d

};enum __nesc_unnamed4315 {

TOS_SERIAL_ACTIVE_MESSAGE_ID = 0,TOS_SERIAL_CC1000_ID = 1,TOS_SERIAL_802_15_4_ID = 2,TOS_SERIAL_UNKNOWN_ID = 255

};enum __nesc_unnamed4316 {

SERIAL_PROTO_ACK = 67,SERIAL_PROTO_PACKET_ACK = 68,SERIAL_PROTO_PACKET_NOACK = 69,SERIAL_PROTO_PACKET_UNKNOWN = 255

};#line 110#line 98typedef struct radio_stats {

uint8_t version;

219

uint8_t flags;uint8_t reserved;uint8_t platform;uint16_t MTU;uint16_t radio_crc_fail;uint16_t radio_queue_drops;uint16_t serial_crc_fail;uint16_t serial_tx_fail;uint16_t serial_short_packets;uint16_t serial_proto_drops;

} radio_stats_t;#line 112typedef nx_struct serial_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;

} __attribute__((packed)) serial_header_t;#line 120typedef nx_struct serial_packet {

serial_header_t header;nx_uint8_t data[];

} __attribute__((packed)) serial_packet_t;#line 125typedef nx_struct serial_metadata {

nx_uint8_t ack;} __attribute__((packed)) serial_metadata_t;# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\platform_message.h"#line 68typedef union message_header {

rf230packet_header_t rf230;serial_header_t serial;

} message_header_t;#line 73typedef union message_footer {

rf230packet_footer_t rf230;} message_footer_t;#line 77typedef union message_metadata {

rf230packet_metadata_t rf230;} message_metadata_t;# 19 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\message.h"#line 14typedef nx_struct message_t {

nx_uint8_t header[sizeof(message_header_t )];nx_uint8_t data[28];nx_uint8_t footer[sizeof(message_footer_t )];nx_uint8_t metadata[sizeof(message_metadata_t )];

} __attribute__((packed)) message_t;# 27 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230.h"enum rf230_registers_enum {

RF230_TRX_STATUS = 0x01,RF230_TRX_STATE = 0x02,RF230_TRX_CTRL_0 = 0x03,RF230_PHY_TX_PWR = 0x05,RF230_PHY_RSSI = 0x06,RF230_PHY_ED_LEVEL = 0x07,RF230_PHY_CC_CCA = 0x08,RF230_CCA_THRES = 0x09,RF230_IRQ_MASK = 0x0E,RF230_IRQ_STATUS = 0x0F,RF230_VREG_CTRL = 0x10,RF230_BATMON = 0x11,RF230_XOSC_CTRL = 0x12,RF230_PLL_CF = 0x1A,RF230_PLL_DCU = 0x1B,RF230_PART_NUM = 0x1C,RF230_VERSION_NUM = 0x1D,RF230_MAN_ID_0 = 0x1E,RF230_MAN_ID_1 = 0x1F,RF230_SHORT_ADDR_0 = 0x20,RF230_SHORT_ADDR_1 = 0x21,RF230_PAN_ID_0 = 0x22,RF230_PAN_ID_1 = 0x23,RF230_IEEE_ADDR_0 = 0x24,RF230_IEEE_ADDR_1 = 0x25,RF230_IEEE_ADDR_2 = 0x26,RF230_IEEE_ADDR_3 = 0x27,RF230_IEEE_ADDR_4 = 0x28,RF230_IEEE_ADDR_5 = 0x29,RF230_IEEE_ADDR_6 = 0x2A,RF230_IEEE_ADDR_7 = 0x2B,RF230_XAH_CTRL = 0x2C,

220

RF230_CSMA_SEED_0 = 0x2D,RF230_CSMA_SEED_1 = 0x2E

};enum rf230_trx_register_enums {

RF230_CCA_DONE = 1 << 7,RF230_CCA_STATUS = 1 << 6,RF230_TRX_STATUS_MASK = 0x1F,RF230_P_ON = 0,RF230_BUSY_RX = 1,RF230_BUSY_TX = 2,RF230_RX_ON = 6,RF230_TRX_OFF = 8,RF230_PLL_ON = 9,RF230_SLEEP = 15,RF230_BUSY_RX_AACK = 16,RF230_BUSR_TX_ARET = 17,RF230_RX_AACK_ON = 22,RF230_TX_ARET_ON = 25,RF230_RX_ON_NOCLK = 28,RF230_AACK_ON_NOCLK = 29,RF230_BUSY_RX_AACK_NOCLK = 30,RF230_STATE_TRANSITION_IN_PROGRESS = 31,RF230_TRAC_STATUS_MASK = 0xE0,RF230_TRAC_SUCCESS = 0,RF230_TRAC_CHANNEL_ACCESS_FAILURE = 3 << 5,RF230_TRAC_NO_ACK = 5 << 5,RF230_TRX_CMD_MASK = 0x1F,RF230_NOP = 0,RF230_TX_START = 2,RF230_FORCE_TRX_OFF = 3

};enum rf230_phy_register_enums {

RF230_TX_AUTO_CRC_ON = 1 << 7,RF230_TX_PWR_MASK = 0x0F,RF230_TX_PWR_DEFAULT = 0,RF230_RSSI_MASK = 0x1F,RF230_CCA_REQUEST = 1 << 7,RF230_CCA_MODE_0 = 0 << 5,RF230_CCA_MODE_1 = 1 << 5,RF230_CCA_MODE_2 = 2 << 5,RF230_CCA_MODE_3 = 3 << 5,RF230_CHANNEL_DEFAULT = 11,RF230_CHANNEL_MASK = 0x1F,RF230_CCA_CS_THRES_SHIFT = 4,RF230_CCA_ED_THRES_SHIFT = 0

};enum rf230_irq_register_enums {

RF230_IRQ_BAT_LOW = 1 << 7,RF230_IRQ_TRX_UR = 1 << 6,RF230_IRQ_TRX_END = 1 << 3,RF230_IRQ_RX_START = 1 << 2,RF230_IRQ_PLL_UNLOCK = 1 << 1,RF230_IRQ_PLL_LOCK = 1 << 0

};enum rf230_control_register_enums {

RF230_AVREG_EXT = 1 << 7,RF230_AVDD_OK = 1 << 6,RF230_DVREG_EXT = 1 << 3,RF230_DVDD_OK = 1 << 2,RF230_BATMON_OK = 1 << 5,RF230_BATMON_VHR = 1 << 4,RF230_BATMON_VTH_MASK = 0x0F,RF230_XTAL_MODE_OFF = 0 << 4,RF230_XTAL_MODE_EXTERNAL = 4 << 4,RF230_XTAL_MODE_INTERNAL = 15 << 4

};enum rf230_pll_register_enums {

RF230_PLL_CF_START = 1 << 7,RF230_PLL_DCU_START = 1 << 7

};enum rf230_spi_command_enums {

RF230_CMD_REGISTER_READ = 0x80,RF230_CMD_REGISTER_WRITE = 0xC0,RF230_CMD_REGISTER_MASK = 0x3F,RF230_CMD_FRAME_READ = 0x20,RF230_CMD_FRAME_WRITE = 0x60,RF230_CMD_SRAM_READ = 0x00,RF230_CMD_SRAM_WRITE = 0x40

};# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.h"enum __nesc_unnamed4317 {

RF230_TRX_CTRL_0_VALUE = 0,RF230_CCA_MODE_VALUE = RF230_CCA_MODE_3,RF230_CCA_THRES_VALUE = 0xC7

};typedef TOne TRF230;

221

# 28 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TimeSyncMessage.h"typedef nx_int32_t timesync_relative_t;typedef uint32_t timesync_absolute_t;# 250 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\util\\crc16.h"#line 249static __inline uint16_t_crc_ccitt_update(uint16_t __crc, uint8_t __data);# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.h"enum __nesc_unnamed4318 {

ATM128_SPI_CLK_DIVIDE_4 = 0,ATM128_SPI_CLK_DIVIDE_16 = 1,ATM128_SPI_CLK_DIVIDE_64 = 2,ATM128_SPI_CLK_DIVIDE_128 = 3

};#line 49#line 40typedef struct __nesc_unnamed4319 {

uint8_t spie : 1;uint8_t spe : 1;uint8_t dord : 1;uint8_t mstr : 1;uint8_t cpol : 1;uint8_t cpha : 1;uint8_t spr : 2;

}Atm128SPIControl_s;#line 50typedef union __nesc_unnamed4320 {

uint8_t flat;Atm128SPIControl_s bits;

} Atm128SPIControl_t;typedef Atm128SPIControl_t Atm128_SPCR_t;#line 58typedef struct __nesc_unnamed4321 {

uint8_t spif : 1;uint8_t wcol : 1;uint8_t rsvd : 5;uint8_t spi2x : 1;

}Atm128SPIStatus_s;#line 65typedef union __nesc_unnamed4322 {

uint8_t flat;Atm128SPIStatus_s bits;

} Atm128SPIStatus_t;typedef Atm128SPIStatus_t Atm128_SPSR_t;typedef uint8_t Atm128_SPDR_t;# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\Resource.h"typedef uint8_t resource_client_id_t;enum HilTimerMilliC$__nesc_unnamed4323 {

HilTimerMilliC$TIMER_COUNT = 2U};typedef TMilli /*AlarmCounterMilliP.Atm128AlarmAsyncC*/Atm128AlarmAsyncC$0$precision;typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC*/Atm128AlarmAsyncC$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$precision;typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$precision_tag;typedef uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$size_type;typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$precision_tag;typedef uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$size_type;typedef uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$size_type;typedef uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$timer_size;typedef uint8_t HplAtm1281Timer2AsyncP$Compare$size_type;typedef uint8_t HplAtm1281Timer2AsyncP$Timer$timer_size;typedef TMilli /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$precision_tag;typedef /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$precision_tag /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$precision_tag;typedef uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type;typedef /*HilTimerMilliC.AlarmToTimerC*/

222

AlarmToTimerC$0$precision_tag /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$precision_tag;typedef TMilli /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$precision_tag;typedef /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$precision_tag /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$precision_tag;typedef /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$precision_tag /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$precision_tag;typedef TMilli /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$precision_tag;typedef /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$precision_tag /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$LocalTime$precision_tag;typedef /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$precision_tag /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$precision_tag;typedef uint32_t /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$size_type;typedef TMilli ForwardToBaseC$Timer0$precision_tag;typedef uint8_t ForwardToBaseC$PacketRSSI$value_type;typedef uint8_t RF230PacketP$PacketRSSI$value_type;typedef uint8_t RF230PacketP$PacketTransmitPower$value_type;typedef uint16_t RF230PacketP$PacketSleepInterval$value_type;typedef uint8_t RF230PacketP$PacketTimeSyncOffset$value_type;typedef TRF230 RF230PacketP$PacketTimeStampRadio$precision_tag;typedef uint32_t RF230PacketP$PacketTimeStampRadio$size_type;typedef TRF230 RF230PacketP$LocalTimeRadio$precision_tag;typedef uint8_t RF230PacketP$PacketLinkQuality$value_type;typedef TMilli RF230PacketP$LocalTimeMilli$precision_tag;typedef TMilli RF230PacketP$PacketTimeStampMilli$precision_tag;typedef uint32_t RF230PacketP$PacketTimeStampMilli$size_type;typedef uint16_t HplAtm1281Timer1P$CompareA$size_type;typedef uint16_t HplAtm1281Timer1P$Capture$size_type;typedef uint16_t HplAtm1281Timer1P$CompareB$size_type;typedef uint16_t HplAtm1281Timer1P$CompareC$size_type;typedef uint16_t HplAtm1281Timer1P$Timer$timer_size;typedef uint16_t /*InitOneP.InitOne*/Atm128TimerInitC$0$timer_size;typedef /*InitOneP.InitOne*/Atm128TimerInitC$0$timer_size /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$timer_size;typedef TOne/*CounterOne16C.NCounter*/Atm128CounterC$0$frequency_tag;typedef uint16_t /*CounterOne16C.NCounter*/Atm128CounterC$0$timer_size;typedef /*CounterOne16C.NCounter*/Atm128CounterC$0$frequency_tag /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$precision_tag;typedef /*CounterOne16C.NCounter*/Atm128CounterC$0$timer_size/*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$size_type;typedef /*CounterOne16C.NCounter*/Atm128CounterC$0$timer_size/*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$timer_size;typedef TMicro /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_precision_tag;typedef uint32_t /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type;typedef TMicro /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_precision_tag;typedef uint16_t /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_size_type;typedef uint32_t /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$upper_count_type;typedef /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_precision_tag/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$precision_tag;typedef /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_size_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$size_type;typedef /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_precision_tag /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$precision_tag;typedef /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type/*LocalTimeMicroC.TransformCounterC*/

223

TransformCounterC$0$Counter$size_type;typedef TMicro /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$precision_tag;typedef /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$precision_tag/*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$LocalTime$precision_tag;typedef /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$precision_tag/*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$precision_tag;typedef uint32_t /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$size_type;typedef TRF230 RadioAlarmP$Alarm$precision_tag;typedef uint16_t RadioAlarmP$Alarm$size_type;typedef TMilli TrafficMonitorLayerP$Timer$precision_tag;typedef uint16_t RandomMlcgC$SeedInit$parameter;typedef TMicro RF230LayerP$BusyWait$precision_tag;typedef uint16_t RF230LayerP$BusyWait$size_type;typedef uint8_t RF230LayerP$PacketRSSI$value_type;typedef TRF230 RF230LayerP$PacketTimeStamp$precision_tag;typedef uint32_t RF230LayerP$PacketTimeStamp$size_type;typedef uint8_t RF230LayerP$PacketTransmitPower$value_type;typedef TRF230 RF230LayerP$LocalTime$precision_tag;typedef uint8_t RF230LayerP$PacketTimeSyncOffset$value_type;typedef uint8_t RF230LayerP$PacketLinkQuality$value_type;typedef uint16_t HplRF230P$Capture$size_type;typedef TOne /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$frequency_tag;typedef uint16_t /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size;typedef /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$frequency_tag /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$precision_tag;typedef /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$size_type;typedef /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type;typedef /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size;enum /*HplRF230C.AlarmC*/AlarmOne16C$0$__nesc_unnamed4324 {

AlarmOne16C$0$COMPARE_ID = 0U};typedef TMicro BusyWaitMicroC$BusyWait$precision_tag;typedef uint16_t BusyWaitMicroC$BusyWait$size_type;enum AMQueueP$__nesc_unnamed4325 {

AMQueueP$NUM_CLIENTS = 1U};# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t PlatformP$Init$init(void);#line 51static error_t MotePlatformP$PlatformInit$init(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$set(void);static void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$clr(void);static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$set(void);static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$clr(void);static void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$toggle(void);static void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$set(void);static void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$clr(void);static void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$makeInput(void);

224

#line 30static void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr(void);static void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$set(void);static void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$clr(void);static void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set(void);static void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr(void);static void /*HplAtm128GeneralIOC.PortB.Bit1*/HplAtm128GeneralIOPinP$9$IO$makeOutput(void);#line 35static void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void);#line 33static void /*HplAtm128GeneralIOC.PortB.Bit3*/HplAtm128GeneralIOPinP$11$IO$makeInput(void);static void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$makeOutput(void);#line 29static void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$set(void);static void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$clr(void);static void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput(void);#line 30static void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$clr(void);static void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$makeInput(void);#line 30static void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$clr(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t MeasureClockC$Init$init(void);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t SchedulerBasicP$TaskBasic$postTask(# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"uint8_t arg_0x1a1206b8);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void SchedulerBasicP$TaskBasic$default$runTask(# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"uint8_t arg_0x1a1206b8);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Scheduler.nc"static void SchedulerBasicP$Scheduler$init(void);#line 61static void SchedulerBasicP$Scheduler$taskLoop(void);#line 54static bool SchedulerBasicP$Scheduler$runNextTask(void);# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuSleep.nc"static void McuSleepC$McuSleep$sleep(void);# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerState.nc"static void McuSleepC$McuPowerState$update(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t LedsP$Init$init(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"static void LedsP$Leds$led0Off(void);static void LedsP$Leds$led0Toggle(void);static void LedsP$Leds$led1On(void);static void LedsP$Leds$led1Off(void);#line 83static void LedsP$Leds$led2Off(void);#line 45static void LedsP$Leds$led0On(void);

225

#line 78static void LedsP$Leds$led2On(void);# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$size_type/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getNow(void);#line 92static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$startAt(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$size_type arg_0x1a631548,/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$size_type arg_0x1a6316d8);#line 105static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$size_type/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getAlarm(void);#line 62static void/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$stop(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Init$init(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$size_type/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$get(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$fired(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$overflow(void);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl8.nc"static uint8_t HplAtm1281Timer2AsyncP$TimerCtrl$getInterruptFlag(void);#line 62static void HplAtm1281Timer2AsyncP$TimerCtrl$setControlB(uint8_t arg_0x1a696350);#line 61static void HplAtm1281Timer2AsyncP$TimerCtrl$setControlA(uint8_t arg_0x1a680e28);# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerOverride.nc"static mcu_power_t HplAtm1281Timer2AsyncP$McuPowerOverride$lowestState(void);# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerAsync.nc"static void HplAtm1281Timer2AsyncP$TimerAsync$setTimer2Asynchronous(void);#line 75static int HplAtm1281Timer2AsyncP$TimerAsync$compareABusy(void);# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static HplAtm1281Timer2AsyncP$Compare$size_typeHplAtm1281Timer2AsyncP$Compare$get(void);static void HplAtm1281Timer2AsyncP$Compare$set(HplAtm1281Timer2AsyncP$Compare$size_type arg_0x1a6924f0);static void HplAtm1281Timer2AsyncP$Compare$start(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static HplAtm1281Timer2AsyncP$Timer$timer_size HplAtm1281Timer2AsyncP$Timer$get(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask(void);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$fired(void);# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$getNow(void);#line 118static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(uint32_t arg_0x1a5e3738, uint32_t arg_0x1a5e38c8);

226

#line 67static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$stop(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask(void);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$fired(void);#line 72static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"uint8_t arg_0x1a7c0cb8);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"uint8_t arg_0x1a7c0cb8,# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"uint32_t arg_0x1a5d0490);#line 67static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"uint8_t arg_0x1a7c0cb8);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void ForwardToBaseC$Timer0$fired(void);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"static void ForwardToBaseC$AMControl$startDone(error_t arg_0x1a894678);#line 117static void ForwardToBaseC$AMControl$stopDone(error_t arg_0x1a892250);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Boot.nc"static void ForwardToBaseC$Boot$booted(void);# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static void ForwardToBaseC$AMSend$sendDone(message_t *arg_0x1a8821c0, error_t arg_0x1a882348);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void ForwardToBaseC$toggle$runTask(void);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *ForwardToBaseC$Receive$receive(message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"static uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getUpdatePeriod(void);static uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getChannelTime(message_t *arg_0x1a9545e0);#line 79static void RF230ActiveMessageP$TrafficMonitorConfig$timerTick(void);#line 43static am_addr_t RF230ActiveMessageP$TrafficMonitorConfig$getSender(message_t *arg_0x1a954b08);# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SlottedCollisionConfig.nc"static void RF230ActiveMessageP$SlottedCollisionConfig$default$timerTick(void);# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageConfig.nc"static error_t RF230ActiveMessageP$ActiveMessageConfig$checkPacket(message_t *arg_0x1a960140);# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"static void RF230ActiveMessageP$SoftwareAckConfig$reportChannelError(void);#line 68static void RF230ActiveMessageP$SoftwareAckConfig$createAckPacket(message_t *arg_0x1a945e08, message_t *arg_0x1a944010);

227

#line 38static bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckWait(message_t *arg_0x1a948ef0);#line 50static bool RF230ActiveMessageP$SoftwareAckConfig$isAckPacket(message_t *arg_0x1a947b00);static bool RF230ActiveMessageP$SoftwareAckConfig$verifyAckPacket(message_t *arg_0x1a945120, message_t *arg_0x1a9452d0);#line 32static uint16_t RF230ActiveMessageP$SoftwareAckConfig$getAckTimeout(void);static void RF230ActiveMessageP$SoftwareAckConfig$setAckReceived(message_t *arg_0x1a947450, bool arg_0x1a9475d8);#line 63static bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckReply(message_t *arg_0x1a9458d0);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RF230ActiveMessageP$RadioAlarm$fired(void);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"static void RF230ActiveMessageP$UniqueConfig$setSequenceNumber(message_t *arg_0x1a941cd8, uint8_t arg_0x1a941e60);static void RF230ActiveMessageP$UniqueConfig$reportChannelError(void);#line 31static uint8_t RF230ActiveMessageP$UniqueConfig$getSequenceNumber(message_t *arg_0x1a9412c8);static am_addr_t RF230ActiveMessageP$UniqueConfig$getSender(message_t *arg_0x1a9417d8);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"static uint16_t RF230ActiveMessageP$RandomCollisionConfig$getCongestionBackoff(message_t *arg_0x1a9681f8);#line 29static uint16_t RF230ActiveMessageP$RandomCollisionConfig$getInitialBackoff(message_t *arg_0x1a955c98);static uint16_t RF230ActiveMessageP$RandomCollisionConfig$getMinimumBackoff(void);static uint16_t RF230ActiveMessageP$RandomCollisionConfig$getTransmitBarrier(message_t *arg_0x1a968ac0);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"static uint8_t RF230ActiveMessageP$RF230Config$getHeaderLength(void);static uint8_t RF230ActiveMessageP$RF230Config$getDefaultChannel(void);#line 46static uint8_t *RF230ActiveMessageP$RF230Config$getPayload(message_t *arg_0x1a934a08);#line 39static void RF230ActiveMessageP$RF230Config$setLength(message_t *arg_0x1a934378, uint8_t arg_0x1a934500);#line 34static uint8_t RF230ActiveMessageP$RF230Config$getLength(message_t *arg_0x1a938d68);#line 60static uint8_t RF230ActiveMessageP$RF230Config$getMaxLength(void);#line 72static bool RF230ActiveMessageP$RF230Config$requiresRssiCca(message_t *arg_0x1a932c88);# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static void RF230PacketP$PacketRSSI$clear(message_t *arg_0x1a8a8718);#line 35static RF230PacketP$PacketRSSI$value_type RF230PacketP$PacketRSSI$get(message_t *arg_0x1a8a8190);#line 29static bool RF230PacketP$PacketRSSI$isSet(message_t *arg_0x1a890c68);#line 46static void RF230PacketP$PacketRSSI$set(message_t *arg_0x1a8a8c00, RF230PacketP$PacketRSSI$value_type arg_0x1a8a8d90);# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"static void RF230PacketP$Packet$clear(message_t *arg_0x1a8658f8);#line 67static uint8_t RF230PacketP$Packet$payloadLength(message_t *arg_0x1a865ea8);#line 115static void *RF230PacketP$Packet$getPayload(message_t *arg_0x1a862358, uint8_t arg_0x1a8624e0);

228

#line 95static uint8_t RF230PacketP$Packet$maxPayloadLength(void);#line 83static void RF230PacketP$Packet$setPayloadLength(message_t *arg_0x1a864548, uint8_t arg_0x1a8646d0);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static RF230PacketP$PacketTransmitPower$value_type RF230PacketP$PacketTransmitPower$get(message_t *arg_0x1a8a8190);#line 29static bool RF230PacketP$PacketTransmitPower$isSet(message_t *arg_0x1a890c68);static RF230PacketP$PacketTimeSyncOffset$value_type RF230PacketP$PacketTimeSyncOffset$get(message_t *arg_0x1a8a8190);#line 29static bool RF230PacketP$PacketTimeSyncOffset$isSet(message_t *arg_0x1a890c68);# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\PacketTimeStamp.nc"static void RF230PacketP$PacketTimeStampRadio$clear(message_t *arg_0x1a8e38f8);static void RF230PacketP$PacketTimeStampRadio$set(message_t *arg_0x1a8e3e20, RF230PacketP$PacketTimeStampRadio$size_type arg_0x1a8e2010);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static void RF230PacketP$PacketLinkQuality$set(message_t *arg_0x1a8a8c00, RF230PacketP$PacketLinkQuality$value_type arg_0x1a8a8d90);# 124 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"static uint8_t IEEE154PacketP$IEEE154Packet$getDSN(message_t *arg_0x1a986010);#line 79static bool IEEE154PacketP$IEEE154Packet$isAckFrame(message_t *arg_0x1a972d18);#line 172static void IEEE154PacketP$IEEE154Packet$set6LowPan(message_t *arg_0x1a982518, uint8_t arg_0x1a9826a0);#line 160static void IEEE154PacketP$IEEE154Packet$setSrcAddr(message_t *arg_0x1a983898, uint16_t arg_0x1a983a28);#line 73static void IEEE154PacketP$IEEE154Packet$createDataFrame(message_t *arg_0x1a972768);#line 129static void IEEE154PacketP$IEEE154Packet$setDSN(message_t *arg_0x1a986500, uint8_t arg_0x1a986688);#line 92static void IEEE154PacketP$IEEE154Packet$createAckReply(message_t *arg_0x1a971838, message_t *arg_0x1a9719e8);#line 39static ieee154_header_t *IEEE154PacketP$IEEE154Packet$getHeader(message_t *arg_0x1a975498);#line 155static uint16_t IEEE154PacketP$IEEE154Packet$getSrcAddr(message_t *arg_0x1a983388);#line 67static bool IEEE154PacketP$IEEE154Packet$isDataFrame(message_t *arg_0x1a972228);#line 184static void IEEE154PacketP$IEEE154Packet$setType(message_t *arg_0x1a9811c0, am_id_t arg_0x1a981348);#line 103static bool IEEE154PacketP$IEEE154Packet$getAckRequired(message_t *arg_0x1a989768);#line 98static bool IEEE154PacketP$IEEE154Packet$verifyAckReply(message_t *arg_0x1a989010, message_t *arg_0x1a9891c0);#line 49static void IEEE154PacketP$IEEE154Packet$setLength(message_t *arg_0x1a975ee0, uint8_t arg_0x1a973088);#line 167static uint8_t IEEE154PacketP$IEEE154Packet$get6LowPan(message_t *arg_0x1a982010);#line 190static bool IEEE154PacketP$IEEE154Packet$requiresAckWait(message_t *arg_0x1a981848);#line 150static void IEEE154PacketP$IEEE154Packet$setDestAddr(message_t *arg_0x1a985ca8, uint16_t arg_0x1a985e38);#line 44static uint8_t IEEE154PacketP$IEEE154Packet$getLength(message_t *arg_0x1a9759d0);#line 140static void IEEE154PacketP$IEEE154Packet$setDestPan(message_t *arg_0x1a9850e0, uint16_t arg_0x1a985270);

229

#line 179static am_id_t IEEE154PacketP$IEEE154Packet$getType(message_t *arg_0x1a982ca8);#line 196static bool IEEE154PacketP$IEEE154Packet$requiresAckReply(message_t *arg_0x1a981db0);#line 145static uint16_t IEEE154PacketP$IEEE154Packet$getDestAddr(message_t *arg_0x1a985798);# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"static am_addr_t IEEE154PacketP$AMPacket$address(void);static am_addr_t IEEE154PacketP$AMPacket$destination(message_t *arg_0x1a875eb0);#line 110static void IEEE154PacketP$AMPacket$setSource(message_t *arg_0x1a873358, am_addr_t arg_0x1a8734e8);#line 92static void IEEE154PacketP$AMPacket$setDestination(message_t *arg_0x1a874a90, am_addr_t arg_0x1a874c20);#line 136static am_id_t IEEE154PacketP$AMPacket$type(message_t *arg_0x1a872610);#line 151static void IEEE154PacketP$AMPacket$setType(message_t *arg_0x1a872ba8, am_id_t arg_0x1a872d30);#line 125static bool IEEE154PacketP$AMPacket$isForMe(message_t *arg_0x1a873ca0);#line 176static void IEEE154PacketP$AMPacket$setGroup(message_t *arg_0x1a870c48, am_group_t arg_0x1a870dd8);static am_group_t IEEE154PacketP$AMPacket$localGroup(void);# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\ActiveMessageAddressC.nc"static am_addr_t ActiveMessageAddressC$amAddress(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ActiveMessageAddress.nc"static am_addr_t ActiveMessageAddressC$ActiveMessageAddress$amAddress(void);static am_group_t ActiveMessageAddressC$ActiveMessageAddress$amGroup(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl16.nc"static uint8_t HplAtm1281Timer1P$TimerCtrl$getInterruptFlag(void);#line 63static void HplAtm1281Timer1P$TimerCtrl$setControlB(uint8_t arg_0x1aaf4848);#line 60static uint8_t HplAtm1281Timer1P$TimerCtrl$getControlB(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void HplAtm1281Timer1P$CompareA$reset(void);#line 45static void HplAtm1281Timer1P$CompareA$set(HplAtm1281Timer1P$CompareA$size_type arg_0x1a6924f0);static void HplAtm1281Timer1P$CompareA$start(void);static void HplAtm1281Timer1P$CompareA$stop(void);# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"static void HplAtm1281Timer1P$Capture$setEdge(bool arg_0x1ab09b48);#line 38static HplAtm1281Timer1P$Capture$size_type HplAtm1281Timer1P$Capture$get(void);#line 55static void HplAtm1281Timer1P$Capture$reset(void);static void HplAtm1281Timer1P$Capture$start(void);static void HplAtm1281Timer1P$Capture$stop(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void HplAtm1281Timer1P$CompareB$default$fired(void);#line 49static void HplAtm1281Timer1P$CompareC$default$fired(void);# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static bool HplAtm1281Timer1P$Timer$test(void);#line 52static HplAtm1281Timer1P$Timer$timer_size HplAtm1281Timer1P$Timer$get(void);#line 95

230

static void HplAtm1281Timer1P$Timer$setScale(uint8_t arg_0x1a670da8);#line 58static void HplAtm1281Timer1P$Timer$set(HplAtm1281Timer1P$Timer$timer_size arg_0x1a671120);static void HplAtm1281Timer1P$Timer$start(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t /*InitOneP.InitOne*/Atm128TimerInitC$0$Init$init(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$overflow(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$size_type /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$get(void);static bool /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$isOverflowPending(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$overflow(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static void /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$overflow(void);#line 53static /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$size_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$get(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\LocalTime.nc"static uint32_t /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$LocalTime$get(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static void /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$overflow(void);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RadioAlarmP$RadioAlarm$default$fired(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98);# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RadioAlarmP$RadioAlarm$wait(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98,# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"uint16_t arg_0x1a995d20);static void RadioAlarmP$RadioAlarm$cancel(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98);# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static bool RadioAlarmP$RadioAlarm$isFree(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static uint16_t RadioAlarmP$RadioAlarm$getNow(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static void RadioAlarmP$Alarm$fired(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void RadioAlarmP$Tasklet$run(void);static void TaskletC$Tasklet$schedule(void);#line 61

231

static void TaskletC$Tasklet$suspend(void);static void TaskletC$Tasklet$resume(void);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void ActiveMessageLayerC$SubSend$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *ActiveMessageLayerC$SubReceive$receive(message_t *arg_0x1a897260,void *arg_0x1a897400, uint8_t arg_0x1a897588);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static error_t ActiveMessageLayerC$AMSend$send(# 28 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abea478,# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"am_addr_t arg_0x1a885e28, message_t *arg_0x1a884010,uint8_t arg_0x1a884198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *ActiveMessageLayerC$Snoop$default$receive(# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abe93d0,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);#line 67static message_t *ActiveMessageLayerC$Receive$default$receive(# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abeada8,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400,uint8_t arg_0x1a897588);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void IEEE154NetworkLayerP$SubSend$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *IEEE154NetworkLayerP$SubReceive$receive(message_t *arg_0x1a897260, void *arg_0x1a897400,uint8_t arg_0x1a897588);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t IEEE154NetworkLayerP$Send$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *IEEE154NetworkLayerP$NonTinyosReceive$default$receive(# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"uint8_t arg_0x1ac03a10,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"static error_t MessageBufferLayerP$SplitControl$start(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t MessageBufferLayerP$SoftwareInit$init(void);# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"static void MessageBufferLayerP$RadioState$done(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t MessageBufferLayerP$Send$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *MessageBufferLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool MessageBufferLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"

232

static void MessageBufferLayerP$stateDoneTask$runTask(void);#line 64static void MessageBufferLayerP$sendTask$runTask(void);#line 64static void MessageBufferLayerP$deliverTask$runTask(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void MessageBufferLayerP$RadioSend$ready(void);#line 45static void MessageBufferLayerP$RadioSend$sendDone(error_t arg_0x1ac23360);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void MessageBufferLayerP$Tasklet$run(void);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void UniqueLayerP$SubSend$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *UniqueLayerP$SubReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool UniqueLayerP$SubReceive$header(message_t *arg_0x1ac3d3e0);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t UniqueLayerP$Send$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static void UniqueLayerP$Neighborhood$evicted(uint8_t arg_0x1ac93270);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t UniqueLayerP$Init$init(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"static void NeighborhoodP$NeighborhoodFlag$clearAll(# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"uint8_t arg_0x1acba860);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"static bool NeighborhoodP$NeighborhoodFlag$get(# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"uint8_t arg_0x1acba860,# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"uint8_t arg_0x1ac900b8);static void NeighborhoodP$NeighborhoodFlag$set(# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"uint8_t arg_0x1acba860,# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"uint8_t arg_0x1ac90590);# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static uint8_t NeighborhoodP$Neighborhood$insertNode(am_addr_t arg_0x1ac95c40);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t NeighborhoodP$Init$init(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void TrafficMonitorLayerP$SubSend$ready(void);#line 45static void TrafficMonitorLayerP$SubSend$sendDone(error_t arg_0x1ac23360);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"static void TrafficMonitorLayerP$TrafficMonitorConfig$channelError(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *TrafficMonitorLayerP$SubReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool TrafficMonitorLayerP$SubReceive$header(message_t *arg_0x1ac3d3e0);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"

233

static error_t TrafficMonitorLayerP$RadioState$turnOn(void);#line 58static void TrafficMonitorLayerP$SubState$done(void);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static void TrafficMonitorLayerP$Neighborhood$evicted(uint8_t arg_0x1ac93270);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void TrafficMonitorLayerP$Tasklet$run(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t TrafficMonitorLayerP$RadioSend$send(message_t *arg_0x1ac24c88);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void TrafficMonitorLayerP$startStopTimer$runTask(void);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void TrafficMonitorLayerP$Timer$fired(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void RandomCollisionLayerP$SubSend$ready(void);#line 45static void RandomCollisionLayerP$SubSend$sendDone(error_t arg_0x1ac23360);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *RandomCollisionLayerP$SubReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool RandomCollisionLayerP$SubReceive$header(message_t *arg_0x1ac3d3e0);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RandomCollisionLayerP$RadioAlarm$fired(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t RandomCollisionLayerP$RadioSend$send(message_t *arg_0x1ac24c88);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void RandomCollisionLayerP$calcNextRandom$runTask(void);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Random.nc"static uint16_t RandomMlcgC$Random$rand16(void);#line 35static uint32_t RandomMlcgC$Random$rand32(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t RandomMlcgC$Init$init(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void SoftwareAckLayerP$SubSend$ready(void);#line 45static void SoftwareAckLayerP$SubSend$sendDone(error_t arg_0x1ac23360);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *SoftwareAckLayerP$SubReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool SoftwareAckLayerP$SubReceive$header(message_t *arg_0x1ac3d3e0);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void SoftwareAckLayerP$RadioAlarm$fired(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t SoftwareAckLayerP$RadioSend$send(message_t *arg_0x1ac24c88);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioCCA.nc"static void RF230LayerP$RadioCCA$default$done(error_t arg_0x1ac3a920);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t RF230LayerP$SoftwareInit$init(void);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"static error_t RF230LayerP$RadioState$turnOn(void);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RF230LayerP$RadioAlarm$fired(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"

234

static error_t RF230LayerP$PlatformInit$init(void);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static void RF230LayerP$SpiResource$granted(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t RF230LayerP$RadioSend$send(message_t *arg_0x1ac24c88);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"static void RF230LayerP$IRQ$captured(uint16_t arg_0x1ad7c680);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void RF230LayerP$Tasklet$run(void);# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"static uint8_t HplRF230P$HplRF230$spiSplitRead(void);static uint8_t HplRF230P$HplRF230$spiSplitReadWrite(uint8_t arg_0x1ad62980);static uint8_t HplRF230P$HplRF230$spiWrite(uint8_t arg_0x1ad62e90);#line 41static void HplRF230P$HplRF230$spiSplitWrite(uint8_t arg_0x1ad62010);#line 33static uint16_t HplRF230P$HplRF230$crcByte(uint16_t arg_0x1ad638f8, uint8_t arg_0x1ad63a80);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"static void HplRF230P$Capture$captured(HplRF230P$Capture$size_type arg_0x1ab0a540);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t HplRF230P$PlatformInit$init(void);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"static void HplRF230P$IRQ$disable(void);#line 42static error_t HplRF230P$IRQ$captureRisingEdge(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void Atm128SpiP$zeroTask$runTask(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SpiPacket.nc"static void Atm128SpiP$SpiPacket$default$sendDone(uint8_t *arg_0x1ae20390, uint8_t *arg_0x1ae20538,uint16_t arg_0x1ae206c8,error_t arg_0x1ae20860);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static void Atm128SpiP$ResourceArbiter$granted(# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae49b10);# 34 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SpiByte.nc"static uint8_t Atm128SpiP$SpiByte$write(uint8_t arg_0x1ad653c8);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"static void Atm128SpiP$Spi$dataReady(uint8_t arg_0x1ae46728);# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$Resource$release(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$Resource$immediateRequest(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$Resource$request(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static void Atm128SpiP$Resource$default$granted(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

235

\\interfaces\\Resource.nc"static bool Atm128SpiP$Resource$isOwner(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"static void HplAtm128SpiP$SPI$sleep(void);#line 66static void HplAtm128SpiP$SPI$initMaster(void);#line 105static void HplAtm128SpiP$SPI$setMasterBit(bool arg_0x1ae43438);#line 96static void HplAtm128SpiP$SPI$enableInterrupt(bool arg_0x1ae46c70);#line 80static uint8_t HplAtm128SpiP$SPI$read(void);#line 125static void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool arg_0x1ae40db0);#line 114static void HplAtm128SpiP$SPI$setClock(uint8_t arg_0x1ae42c58);#line 108static void HplAtm128SpiP$SPI$setClockPolarity(bool arg_0x1ae43c90);#line 86static void HplAtm128SpiP$SPI$write(uint8_t arg_0x1ae46218);#line 99static void HplAtm128SpiP$SPI$enableSpi(bool arg_0x1ae45480);#line 111static void HplAtm128SpiP$SPI$setClockPhase(bool arg_0x1ae42490);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init(void);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceQueue.nc"static error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(resource_client_id_t arg_0x1af2d208);#line 43static bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEmpty(void);static bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEnqueued(resource_client_id_t arg_0x1af2f7f8);static resource_client_id_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$dequeue(void);# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af22688);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af22688);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af20188);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af20188);# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af23d10);# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"

236

uint8_t arg_0x1af23d10);# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af23d10);# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$isOwner(# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af23d10);# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ArbiterInfo.nc"static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask(void);# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$size_type/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$getNow(void);#line 92static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$size_type arg_0x1a631548, /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$size_type arg_0x1a6316d8);#line 55static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$start(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$size_type arg_0x1a633438);static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$stop(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\BusyWait.nc"static void BusyWaitMicroC$BusyWait$wait(BusyWaitMicroC$BusyWait$size_type arg_0x1ad79c98);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static error_t /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t arg_0x1a885e28, message_t *arg_0x1a884010,uint8_t arg_0x1a884198);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *arg_0x1abe2010,error_t arg_0x1abe2198);# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"am_id_t arg_0x1b0184e8,# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"message_t *arg_0x1a8821c0, error_t arg_0x1a882348);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"uint8_t arg_0x1b019b68,# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);#line 89static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

237

\\system\\AMQueueImplP.nc"uint8_t arg_0x1b019b68,# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void);#line 64static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t PlatformP$MoteInit$init(void);#line 51static error_t PlatformP$MeasureClock$init(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\mica\\PlatformP.nc"static inline void PlatformP$power_init(void);static inline error_t PlatformP$Init$init(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t MotePlatformP$SubInit$init(void);# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void MotePlatformP$SerialIdPin$makeInput(void);#line 30static void MotePlatformP$SerialIdPin$clr(void);# 26 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\micaz\\MotePlatformP.nc"static inline error_t MotePlatformP$PlatformInit$init(void);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput(void);#line 46static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput(void);#line 46static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$clr(void);static inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$toggle(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$makeOutput(void);#line 47static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$makeInput(void);#line 46static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$makeOutput(void);#line 46static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput(void);#line 52static __inline void /*HplAtm128GeneralIOC.PortB.Bit1*/HplAtm128GeneralIOPinP$9$IO$makeOutput(void);#line 52static __inline void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void);#line 50static __inline void /*HplAtm128GeneralIOC.PortB.Bit3*/

238

HplAtm128GeneralIOPinP$11$IO$makeInput(void);#line 46static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$set(void);static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$makeOutput(void);#line 47static __inline void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput(void);#line 47static __inline void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$clr(void);static __inline void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$makeInput(void);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\MeasureClockC.nc"enum MeasureClockC$__nesc_unnamed4326 {

MeasureClockC$MAGIC = 488 / (16 / PLATFORM_MHZ)};uint16_t MeasureClockC$cycles;static inline error_t MeasureClockC$Init$init(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t RealMainP$SoftwareInit$init(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Boot.nc"static void RealMainP$Boot$booted(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"static error_t RealMainP$PlatformInit$init(void);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Scheduler.nc"static void RealMainP$Scheduler$init(void);#line 61static void RealMainP$Scheduler$taskLoop(void);#line 54static bool RealMainP$Scheduler$runNextTask(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RealMainP.nc"int main(void) ;# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void SchedulerBasicP$TaskBasic$runTask(# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"uint8_t arg_0x1a1206b8);# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuSleep.nc"static void SchedulerBasicP$McuSleep$sleep(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"enum SchedulerBasicP$__nesc_unnamed4327 {

SchedulerBasicP$NUM_TASKS = 12U,SchedulerBasicP$NO_TASK = 255

};uint8_t SchedulerBasicP$m_head;uint8_t SchedulerBasicP$m_tail;uint8_t SchedulerBasicP$m_next[SchedulerBasicP$NUM_TASKS];static __inline uint8_t SchedulerBasicP$popTask(void);#line 86static inline bool SchedulerBasicP$isWaiting(uint8_t id);static inline bool SchedulerBasicP$pushTask(uint8_t id);#line 113static inline void SchedulerBasicP$Scheduler$init(void);static bool SchedulerBasicP$Scheduler$runNextTask(void);#line 138static inline void SchedulerBasicP$Scheduler$taskLoop(void);#line 159static error_t SchedulerBasicP$TaskBasic$postTask(uint8_t id);static void SchedulerBasicP$TaskBasic$default$runTask(uint8_t id);# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerOverride.nc"static mcu_power_t McuSleepC$McuPowerOverride$lowestState(void);# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\McuSleepC.nc"const_uint8_t McuSleepC$atm128PowerBits[ATM128_POWER_DOWN + 1] = {0,1 << 1, ((1 << 3) | (1 << 2)) | (1 << 1), (

239

1 << 2) | (1 << 1), (1 << 3) | (1 << 2),1 << 2 };static inline mcu_power_t McuSleepC$getPowerState(void);#line 128static inline void McuSleepC$McuSleep$sleep(void);#line 142static inline void McuSleepC$McuPowerState$update(void);# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void LedsP$Led0$toggle(void);static void LedsP$Led0$makeOutput(void);#line 29static void LedsP$Led0$set(void);static void LedsP$Led0$clr(void);static void LedsP$Led1$makeOutput(void);#line 29static void LedsP$Led1$set(void);static void LedsP$Led1$clr(void);static void LedsP$Led2$makeOutput(void);#line 29static void LedsP$Led2$set(void);static void LedsP$Led2$clr(void);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline error_t LedsP$Init$init(void);#line 63static inline void LedsP$Leds$led0On(void);static inline void LedsP$Leds$led0Off(void);static inline void LedsP$Leds$led0Toggle(void);static inline void LedsP$Leds$led1On(void);static inline void LedsP$Leds$led1Off(void);static inline void LedsP$Leds$led2On(void);static inline void LedsP$Leds$led2Off(void);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl8.nc"static uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$getInterruptFlag(void);#line 62static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlB(uint8_t arg_0x1a696350);#line 61static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlA(uint8_t arg_0x1a680e28);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$fired(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$overflow(void);# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerAsync.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerAsync$setTimer2Asynchronous(void);#line 75static int /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerAsync$compareABusy(void);# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$size_type/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$get(void);static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$size_type arg_0x1a6924f0);static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$start(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$timer_size

240

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get(void);# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$set;uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$t0;#line 63uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$dt;uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base;enum /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$__nesc_unnamed4328 {

Atm1281AlarmAsyncP$0$MINDT = 2,Atm1281AlarmAsyncP$0$MAXT = 230

};static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt(void);static inline error_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Init$init(void);#line 101static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setOcr2A(uint8_t n);#line 117static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt(void);#line 176static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$fired(void);#line 188static uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$get(void);#line 231static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$stop(void);static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$startAt(uint32_t nt0, uint32_t ndt);static inline uint32_t/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getNow(void);static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getAlarm(void);static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$overflow(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void HplAtm1281Timer2AsyncP$Compare$fired(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void HplAtm1281Timer2AsyncP$Timer$overflow(void);# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline uint8_t HplAtm1281Timer2AsyncP$Timer$get(void);#line 111static inline void HplAtm1281Timer2AsyncP$TimerCtrl$setControlA(uint8_t x);static inline void HplAtm1281Timer2AsyncP$TimerCtrl$setControlB(uint8_t x);#line 134static inline uint8_t HplAtm1281Timer2AsyncP$TimerCtrl$getInterruptFlag(void);#line 161static inline void HplAtm1281Timer2AsyncP$Compare$start(void);static inline uint8_t HplAtm1281Timer2AsyncP$Compare$get(void);static inline void HplAtm1281Timer2AsyncP$Compare$set(uint8_t t);static __inline void HplAtm1281Timer2AsyncP$stabiliseTimer2(void);#line 199static inline mcu_power_t HplAtm1281Timer2AsyncP$McuPowerOverride$lowestState(void);#line 222void __vector_13(void) __attribute((signal)) ;void __vector_15(void) __attribute((signal)) ;#line 246

241

static inline void HplAtm1281Timer2AsyncP$TimerAsync$setTimer2Asynchronous(void);#line 258static inline int HplAtm1281Timer2AsyncP$TimerAsync$compareABusy(void);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$postTask(void);# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getNow(void);#line 92static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$startAt(/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x1a631548,/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x1a6316d8);#line 105static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getAlarm(void);#line 62static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$stop(void);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$fired(void);# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"enum /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$__nesc_unnamed4329 {#line 63

AlarmToTimerC$0$fired = 0U};#line 63typedef int /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$__nesc_sillytask_fired[/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired];#line 44uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_dt;bool /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_oneshot;static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$start(uint32_t t0, uint32_t dt, bool oneshot);#line 60static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$stop(void);static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask(void);static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$fired(void);#line 82static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(uint32_t t0, uint32_t dt);static inline uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$getNow(void);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask(void);# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow(void);#line 118static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(uint32_t arg_0x1a5e3738, uint32_t arg_0x1a5e38c8);#line 67static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$stop(void);static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$fired(# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"uint8_t arg_0x1a7c0cb8);#line 60enum /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4330 {#line 60

VirtualizeTimerC$0$updateFromTimer = 1U};

242

#line 60typedef int /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_sillytask_updateFromTimer[/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer];#line 42enum /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4331 {

VirtualizeTimerC$0$NUM_TIMERS = 2,VirtualizeTimerC$0$END_OF_LIST = 255

};#line 48typedef struct /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4332 {

uint32_t t0;uint32_t dt;bool isoneshot : 1;bool isrunning : 1;bool _reserved : 6;

} /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer_t;/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$NUM_TIMERS];static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$fireTimers(uint32_t now);#line 89static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask(void);#line 128static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$fired(void);static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$startTimer(uint8_t num, uint32_t t0, uint32_t dt, bool isoneshot);static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(uint8_t num, uint32_t dt);static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(uint8_t num);#line 193static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(uint8_t num);# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\CounterToLocalTimeC.nc"static inline void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void ForwardToBaseC$Timer0$startPeriodic(uint32_t arg_0x1a5d0490);# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"static error_t ForwardToBaseC$AMControl$start(void);# 115 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"static void *ForwardToBaseC$Packet$getPayload(message_t *arg_0x1a862358, uint8_t arg_0x1a8624e0);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static error_t ForwardToBaseC$AMSend$send(am_addr_t arg_0x1a885e28, message_t *arg_0x1a884010, uint8_t arg_0x1a884198);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static ForwardToBaseC$PacketRSSI$value_type ForwardToBaseC$PacketRSSI$get(message_t *arg_0x1a8a8190);#line 29static bool ForwardToBaseC$PacketRSSI$isSet(message_t *arg_0x1a890c68);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t ForwardToBaseC$toggle$postTask(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"static void ForwardToBaseC$Leds$led0Off(void);static void ForwardToBaseC$Leds$led0Toggle(void);static void ForwardToBaseC$Leds$led1On(void);static void ForwardToBaseC$Leds$led1Off(void);#line 83static void ForwardToBaseC$Leds$led2Off(void);#line 45static void ForwardToBaseC$Leds$led0On(void);#line 78static void ForwardToBaseC$Leds$led2On(void);# 53 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"enum ForwardToBaseC$__nesc_unnamed4333 {

243

#line 53ForwardToBaseC$toggle = 2U

};#line 53typedef int ForwardToBaseC$__nesc_sillytask_toggle[ForwardToBaseC$toggle];#line 34static inline uint16_t ForwardToBaseC$getRssi(message_t *msg);message_t ForwardToBaseC$pkt;bool ForwardToBaseC$busy = FALSE;static inline void ForwardToBaseC$setLeds(uint16_t val);#line 53static inline void ForwardToBaseC$toggle$runTask(void);static inline void ForwardToBaseC$Boot$booted(void);static inline void ForwardToBaseC$AMControl$startDone(error_t err);static inline void ForwardToBaseC$AMControl$stopDone(error_t err);static inline void ForwardToBaseC$Timer0$fired(void);#line 92static inline void ForwardToBaseC$AMSend$sendDone(message_t *msg, error_t err);static inline message_t *ForwardToBaseC$Receive$receive(message_t *msg, void *payload, uint8_t len);#line 127static inline uint16_t ForwardToBaseC$getRssi(message_t *msg);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"static void RF230ActiveMessageP$TrafficMonitorConfig$channelError(void);# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SlottedCollisionConfig.nc"static void RF230ActiveMessageP$SlottedCollisionConfig$timerTick(void);# 124 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"static uint8_t RF230ActiveMessageP$IEEE154Packet$getDSN(message_t *arg_0x1a986010);#line 79static bool RF230ActiveMessageP$IEEE154Packet$isAckFrame(message_t *arg_0x1a972d18);#line 129static void RF230ActiveMessageP$IEEE154Packet$setDSN(message_t *arg_0x1a986500, uint8_t arg_0x1a986688);#line 92static void RF230ActiveMessageP$IEEE154Packet$createAckReply(message_t *arg_0x1a971838, message_t *arg_0x1a9719e8);#line 39static ieee154_header_t *RF230ActiveMessageP$IEEE154Packet$getHeader(message_t *arg_0x1a975498);#line 155static uint16_t RF230ActiveMessageP$IEEE154Packet$getSrcAddr(message_t *arg_0x1a983388);#line 67static bool RF230ActiveMessageP$IEEE154Packet$isDataFrame(message_t *arg_0x1a972228);#line 103static bool RF230ActiveMessageP$IEEE154Packet$getAckRequired(message_t *arg_0x1a989768);#line 98static bool RF230ActiveMessageP$IEEE154Packet$verifyAckReply(message_t *arg_0x1a989010,message_t *arg_0x1a9891c0);#line 49static void RF230ActiveMessageP$IEEE154Packet$setLength(message_t *arg_0x1a975ee0, uint8_t arg_0x1a973088);#line 190static bool RF230ActiveMessageP$IEEE154Packet$requiresAckWait(message_t *arg_0x1a981848);#line 44static uint8_t RF230ActiveMessageP$IEEE154Packet$getLength(message_t *arg_0x1a9759d0);#line 196static bool RF230ActiveMessageP$IEEE154Packet$requiresAckReply(message_t *arg_0x1a981db0);# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"static void RF230ActiveMessageP$Packet$clear(message_t *arg_0x1a8658f8);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static uint16_t RF230ActiveMessageP$RadioAlarm$getNow(void);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$RF230Config$getLength(message_t *msg);static inline void RF230ActiveMessageP$RF230Config$setLength(message_t *msg, uint8_t len);static inline uint8_t *RF230ActiveMessageP$RF230Config$getPayload(message_t *msg);static __inline rf230packet_metadata_t *RF230ActiveMessageP$

244

getMeta(message_t *msg);static inline uint8_t RF230ActiveMessageP$RF230Config$getHeaderLength(void);static inline uint8_t RF230ActiveMessageP$RF230Config$getMaxLength(void);static inline uint8_t RF230ActiveMessageP$RF230Config$getDefaultChannel(void);static inline bool RF230ActiveMessageP$RF230Config$requiresRssiCca(message_t *msg);static inline bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckWait(message_t *msg);static inline bool RF230ActiveMessageP$SoftwareAckConfig$isAckPacket(message_t *msg);static inline bool RF230ActiveMessageP$SoftwareAckConfig$verifyAckPacket(message_t *data, message_t *ack);static inline bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckReply(message_t *msg);static inline void RF230ActiveMessageP$SoftwareAckConfig$createAckPacket(message_t *data, message_t *ack);static void RF230ActiveMessageP$SoftwareAckConfig$setAckReceived(message_t *msg, bool acked);static inline uint16_t RF230ActiveMessageP$SoftwareAckConfig$getAckTimeout(void);static inline void RF230ActiveMessageP$SoftwareAckConfig$reportChannelError(void);static inline uint8_t RF230ActiveMessageP$UniqueConfig$getSequenceNumber(message_t *msg);static inline void RF230ActiveMessageP$UniqueConfig$setSequenceNumber(message_t *msg, uint8_t dsn);static inline am_addr_t RF230ActiveMessageP$UniqueConfig$getSender(message_t *msg);static inline void RF230ActiveMessageP$UniqueConfig$reportChannelError(void);static inline error_t RF230ActiveMessageP$ActiveMessageConfig$checkPacket(message_t *msg);#line 184enum RF230ActiveMessageP$__nesc_unnamed4334 {

RF230ActiveMessageP$TRAFFIC_UPDATE_PERIOD = 100,RF230ActiveMessageP$TRAFFIC_MAX_BYTES = (uint16_t )(RF230ActiveMessageP$TRAFFIC_UPDATE_PERIOD * 1000UL / 32)

};static inline uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getUpdatePeriod(void);static uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getChannelTime(message_t *msg);#line 208static inline am_addr_t RF230ActiveMessageP$TrafficMonitorConfig$getSender(message_t *msg);static inline void RF230ActiveMessageP$TrafficMonitorConfig$timerTick(void);#line 229static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getMinimumBackoff(void);static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getInitialBackoff(message_t *msg);static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getCongestionBackoff(message_t *msg);static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getTransmitBarrier(message_t *msg);#line 260static inline void RF230ActiveMessageP$RadioAlarm$fired(void);#line 291static inline void RF230ActiveMessageP$SlottedCollisionConfig$default$timerTick(void);# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"static void RF230PacketP$IEEE154Packet$createDataFrame(message_t *arg_0x1a972768);#line 49static void RF230PacketP$IEEE154Packet$setLength(message_t *arg_0x1a975ee0, uint8_t arg_0x1a973088);#line 44static uint8_t RF230PacketP$IEEE154Packet$getLength(message_t *arg_0x1a9759d0);# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"enum RF230PacketP$__nesc_unnamed4335 {

RF230PacketP$PACKET_LENGTH_INCREASE =sizeof(rf230packet_header_t ) - 1+ sizeof(ieee154_footer_t )

245

};static __inline rf230packet_metadata_t *RF230PacketP$getMeta(message_t *msg);static inline void RF230PacketP$Packet$clear(message_t *msg);static __inline void RF230PacketP$Packet$setPayloadLength(message_t *msg, uint8_t len);static __inline uint8_t RF230PacketP$Packet$payloadLength(message_t *msg);static __inline uint8_t RF230PacketP$Packet$maxPayloadLength(void);static inline void *RF230PacketP$Packet$getPayload(message_t *msg, uint8_t len);#line 135static inline void RF230PacketP$PacketLinkQuality$set(message_t *msg, uint8_t value);#line 152static inline void RF230PacketP$PacketTimeStampRadio$clear(message_t *msg);static void RF230PacketP$PacketTimeStampRadio$set(message_t *msg, uint32_t value);#line 193static inline bool RF230PacketP$PacketTransmitPower$isSet(message_t *msg);static inline uint8_t RF230PacketP$PacketTransmitPower$get(message_t *msg);#line 217static inline bool RF230PacketP$PacketRSSI$isSet(message_t *msg);static inline uint8_t RF230PacketP$PacketRSSI$get(message_t *msg);static inline void RF230PacketP$PacketRSSI$clear(message_t *msg);static inline void RF230PacketP$PacketRSSI$set(message_t *msg, uint8_t value);static inline bool RF230PacketP$PacketTimeSyncOffset$isSet(message_t *msg);static inline uint8_t RF230PacketP$PacketTimeSyncOffset$get(message_t *msg);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ActiveMessageAddress.nc"static am_addr_t IEEE154PacketP$ActiveMessageAddress$amAddress(void);static am_group_t IEEE154PacketP$ActiveMessageAddress$amGroup(void);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"enum IEEE154PacketP$__nesc_unnamed4336 {

IEEE154PacketP$IEEE154_DATA_FRAME_MASK =(((IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE)| (1 << IEEE154_FCF_INTRAPAN))| (IEEE154_ADDR_MASK << IEEE154_FCF_DEST_ADDR_MODE))| (IEEE154_ADDR_MASK << IEEE154_FCF_SRC_ADDR_MODE),IEEE154PacketP$IEEE154_DATA_FRAME_VALUE =(((IEEE154_TYPE_DATA << IEEE154_FCF_FRAME_TYPE)| (1 << IEEE154_FCF_INTRAPAN))| (IEEE154_ADDR_SHORT << IEEE154_FCF_DEST_ADDR_MODE))| (IEEE154_ADDR_SHORT << IEEE154_FCF_SRC_ADDR_MODE),IEEE154PacketP$IEEE154_ACK_FRAME_LENGTH = 5,IEEE154PacketP$IEEE154_ACK_FRAME_MASK =IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE,IEEE154PacketP$IEEE154_ACK_FRAME_VALUE =IEEE154_TYPE_ACK << IEEE154_FCF_FRAME_TYPE

};static __inline ieee154_header_t *IEEE154PacketP$getHeader(message_t *msg);static __inline ieee154_header_t *IEEE154PacketP$IEEE154Packet$getHeader(message_t *msg);static __inline uint8_t IEEE154PacketP$IEEE154Packet$getLength(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$setLength(message_t *msg, uint8_t length);#line 88static __inline bool IEEE154PacketP$IEEE154Packet$isDataFrame(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$createDataFrame(message_t *msg);static __inline bool IEEE154PacketP$IEEE154Packet$isAckFrame(message_t *msg);#line 111static __inline void IEEE154PacketP$IEEE154Packet$createAckReply(message_t *data, message_t *ack);static __inline bool IEEE154PacketP$IEEE154Packet$verifyAckReply(message_t *data, message_t *ack);

246

static __inline bool IEEE154PacketP$IEEE154Packet$getAckRequired(message_t *msg);#line 154static __inline uint8_t IEEE154PacketP$IEEE154Packet$getDSN(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$setDSN(message_t *msg, uint8_t dsn);static __inline void IEEE154PacketP$IEEE154Packet$setDestPan(message_t *msg, uint16_t pan);static __inline uint16_t IEEE154PacketP$IEEE154Packet$getDestAddr(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$setDestAddr(message_t *msg, uint16_t addr);static __inline uint16_t IEEE154PacketP$IEEE154Packet$getSrcAddr(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$setSrcAddr(message_t *msg, uint16_t addr);static __inline uint8_t IEEE154PacketP$IEEE154Packet$get6LowPan(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$set6LowPan(message_t *msg, uint8_t network);static __inline am_id_t IEEE154PacketP$IEEE154Packet$getType(message_t *msg);static __inline void IEEE154PacketP$IEEE154Packet$setType(message_t *msg, am_id_t type);static inline bool IEEE154PacketP$IEEE154Packet$requiresAckWait(message_t *msg);static bool IEEE154PacketP$IEEE154Packet$requiresAckReply(message_t *msg);#line 238static __inline am_addr_t IEEE154PacketP$AMPacket$address(void);static __inline am_group_t IEEE154PacketP$AMPacket$localGroup(void);static __inline am_addr_t IEEE154PacketP$AMPacket$destination(message_t *msg);static __inline void IEEE154PacketP$AMPacket$setDestination(message_t *msg, am_addr_t addr);static __inline void IEEE154PacketP$AMPacket$setSource(message_t *msg, am_addr_t addr);static __inline bool IEEE154PacketP$AMPacket$isForMe(message_t *msg);static __inline am_id_t IEEE154PacketP$AMPacket$type(message_t *msg);static __inline void IEEE154PacketP$AMPacket$setType(message_t *msg, am_id_t type);static __inline void IEEE154PacketP$AMPacket$setGroup(message_t *msg, am_group_t grp);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\ActiveMessageAddressC.nc"am_addr_t ActiveMessageAddressC$addr = TOS_AM_ADDRESS;am_group_t ActiveMessageAddressC$group = TOS_AM_GROUP;static inline am_addr_t ActiveMessageAddressC$ActiveMessageAddress$amAddress(void);#line 82static inline am_group_t ActiveMessageAddressC$ActiveMessageAddress$amGroup(void);#line 95static am_addr_t ActiveMessageAddressC$amAddress(void);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void HplAtm1281Timer1P$CompareA$fired(void);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"static void HplAtm1281Timer1P$Capture$captured(HplAtm1281Timer1P$Capture$size_type arg_0x1ab0a540);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void HplAtm1281Timer1P$CompareB$fired(void);#line 49static void HplAtm1281Timer1P$CompareC$fired(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void HplAtm1281Timer1P$Timer$overflow(void);# 70 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline uint16_t HplAtm1281Timer1P$Timer$get(void);static inline void HplAtm1281Timer1P$Timer$set(uint16_t t);static inline void HplAtm1281Timer1P$Timer$setScale(uint8_t s);static inline uint8_t HplAtm1281Timer1P$TimerCtrl$getControlB(void);#line 106static inline void HplAtm1281Timer1P$TimerCtrl$setControlB(uint8_t x);

247

#line 125static inline uint8_t HplAtm1281Timer1P$TimerCtrl$getInterruptFlag(void);static inline void HplAtm1281Timer1P$Capture$setEdge(bool up);static inline void HplAtm1281Timer1P$Capture$reset(void);static inline void HplAtm1281Timer1P$CompareA$reset(void);static inline void HplAtm1281Timer1P$Timer$start(void);static inline void HplAtm1281Timer1P$Capture$start(void);static inline void HplAtm1281Timer1P$CompareA$start(void);static inline void HplAtm1281Timer1P$Capture$stop(void);static inline void HplAtm1281Timer1P$CompareA$stop(void);static inline bool HplAtm1281Timer1P$Timer$test(void);#line 194static inline void HplAtm1281Timer1P$CompareA$set(uint16_t t);static inline uint16_t HplAtm1281Timer1P$Capture$get(void);void __vector_17(void) __attribute((interrupt)) ;static inline void HplAtm1281Timer1P$CompareB$default$fired(void);void __vector_18(void) __attribute((interrupt)) ;static inline void HplAtm1281Timer1P$CompareC$default$fired(void);void __vector_19(void) __attribute((interrupt)) ;void __vector_16(void) __attribute((interrupt)) ;void __vector_20(void) __attribute((interrupt)) ;# 95 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$setScale(uint8_t arg_0x1a670da8);#line 58static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$set(/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$timer_size arg_0x1a671120);static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$start(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128TimerInitC.nc"static inline error_t /*InitOneP.InitOne*/Atm128TimerInitC$0$Init$init(void);static inline void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$overflow(void);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static void /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$overflow(void);# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static bool /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$test(void);#line 52static /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$get(void);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128CounterC.nc"static inline /*CounterOne16C.NCounter*/Atm128CounterC$0$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$get(void);static inline bool /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$isOverflowPending(void);static inline void /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$overflow(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$size_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$get(void);static bool /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$isOverflowPending(void);static void /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$overflow(void);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\TransformCounterC.nc"/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$upper_count_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$m_upper;enum /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$__nesc_unnamed4337 {

TransformCounterC$0$LOW_SHIFT_RIGHT = 0,TransformCounterC$0$HIGH_SHIFT_LEFT =8 * sizeof(/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_size_type ) -/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$LOW_SHIFT_RIGHT,

248

TransformCounterC$0$NUM_UPPER_BITS = 8 *sizeof(/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type ) - 8 *sizeof(/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_size_type ) + 0,TransformCounterC$0$OVERFLOW_MASK =/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$NUM_UPPER_BITS ?((/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$upper_count_type )2 <<(/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$NUM_UPPER_BITS - 1)) - 1 : 0

};static /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$get(void);#line 122static inline void /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$overflow(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"static /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$size_type /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$get(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\CounterToLocalTimeC.nc"static inline uint32_t /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$LocalTime$get(void);static inline void /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$overflow(void);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RadioAlarmP$RadioAlarm$fired(# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t arg_0x1abccd98);# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static RadioAlarmP$Alarm$size_type RadioAlarmP$Alarm$getNow(void);#line 55static void RadioAlarmP$Alarm$start(RadioAlarmP$Alarm$size_type arg_0x1a633438);static void RadioAlarmP$Alarm$stop(void);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void RadioAlarmP$Tasklet$schedule(void);# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"uint8_t RadioAlarmP$state;enum RadioAlarmP$__nesc_unnamed4338 {

RadioAlarmP$STATE_READY = 0,RadioAlarmP$STATE_WAIT = 1,RadioAlarmP$STATE_FIRED = 2

};uint8_t RadioAlarmP$alarm;static inline void RadioAlarmP$Alarm$fired(void);static __inline uint16_t RadioAlarmP$RadioAlarm$getNow(uint8_t id);static inline void RadioAlarmP$Tasklet$run(void);static inline void RadioAlarmP$RadioAlarm$default$fired(uint8_t id);static __inline bool RadioAlarmP$RadioAlarm$isFree(uint8_t id);static inline void RadioAlarmP$RadioAlarm$wait(uint8_t id, uint16_t timeout);static inline void RadioAlarmP$RadioAlarm$cancel(uint8_t id);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void TaskletC$Tasklet$run(void);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TaskletC.nc"uint8_t TaskletC$state;static void TaskletC$doit(void);#line 83static __inline void TaskletC$Tasklet$suspend(void);static void TaskletC$Tasklet$resume(void);#line 101static void TaskletC$Tasklet$schedule(void);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_tActiveMessageLayerC$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

249

\\interfaces\\AMSend.nc"static void ActiveMessageLayerC$AMSend$sendDone(# 28 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abea478,# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"message_t *arg_0x1a8821c0, error_t arg_0x1a882348);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *ActiveMessageLayerC$Snoop$receive(# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abe93d0,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageConfig.nc"static error_t ActiveMessageLayerC$Config$checkPacket(message_t *arg_0x1a960140);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *ActiveMessageLayerC$Receive$receive(# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"am_id_t arg_0x1abeada8,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"static am_addr_t ActiveMessageLayerC$AMPacket$address(void);#line 110static void ActiveMessageLayerC$AMPacket$setSource(message_t *arg_0x1a873358, am_addr_t arg_0x1a8734e8);#line 92static void ActiveMessageLayerC$AMPacket$setDestination(message_t *arg_0x1a874a90, am_addr_t arg_0x1a874c20);#line 136static am_id_t ActiveMessageLayerC$AMPacket$type(message_t *arg_0x1a872610);#line 151static void ActiveMessageLayerC$AMPacket$setType(message_t *arg_0x1a872ba8, am_id_t arg_0x1a872d30);#line 125static bool ActiveMessageLayerC$AMPacket$isForMe(message_t *arg_0x1a873ca0);#line 176static void ActiveMessageLayerC$AMPacket$setGroup(message_t *arg_0x1a870c48, am_group_t arg_0x1a870dd8);static am_group_t ActiveMessageLayerC$AMPacket$localGroup(void);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static error_t ActiveMessageLayerC$AMSend$send(am_id_t id, am_addr_t addr, message_t *msg, uint8_t len);#line 61static __inline void ActiveMessageLayerC$SubSend$sendDone(message_t *msg, error_t error);#line 87static inline message_t *ActiveMessageLayerC$SubReceive$receive(message_t *msg, void *payload, uint8_t len);static inline message_t *ActiveMessageLayerC$Receive$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len);static inline message_t *ActiveMessageLayerC$Snoop$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t IEEE154NetworkLayerP$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);#line 89static void IEEE154NetworkLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *IEEE154NetworkLayerP$NonTinyosReceive$receive(# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"uint8_t arg_0x1ac03a10,# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588);# 172 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"

250

static void IEEE154NetworkLayerP$IEEE154Packet$set6LowPan(message_t *arg_0x1a982518, uint8_t arg_0x1a9826a0);#line 167static uint8_t IEEE154NetworkLayerP$IEEE154Packet$get6LowPan(message_t *arg_0x1a982010);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *IEEE154NetworkLayerP$Receive$receive(message_t *arg_0x1a897260, void *arg_0x1a897400,uint8_t arg_0x1a897588);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"static inline error_t IEEE154NetworkLayerP$Send$send(message_t *msg, uint8_t len);#line 69static inline void IEEE154NetworkLayerP$SubSend$sendDone(message_t *msg, error_t error);static inline message_t *IEEE154NetworkLayerP$SubReceive$receive(message_t *msg, void *payload, uint8_t len);static inline message_t *IEEE154NetworkLayerP$NonTinyosReceive$default$receive(uint8_t network, message_t *msg, void *payload, uint8_t len);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"static void MessageBufferLayerP$SplitControl$startDone(error_t arg_0x1a894678);#line 117static void MessageBufferLayerP$SplitControl$stopDone(error_t arg_0x1a892250);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"static error_t MessageBufferLayerP$RadioState$turnOn(void);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void MessageBufferLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"static uint8_t MessageBufferLayerP$Packet$payloadLength(message_t *arg_0x1a865ea8);#line 115static void *MessageBufferLayerP$Packet$getPayload(message_t *arg_0x1a862358, uint8_t arg_0x1a8624e0);#line 95static uint8_t MessageBufferLayerP$Packet$maxPayloadLength(void);#line 83static void MessageBufferLayerP$Packet$setPayloadLength(message_t *arg_0x1a864548, uint8_t arg_0x1a8646d0);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t MessageBufferLayerP$stateDoneTask$postTask(void);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"static message_t *MessageBufferLayerP$Receive$receive(message_t *arg_0x1a897260,void *arg_0x1a897400, uint8_t arg_0x1a897588);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t MessageBufferLayerP$sendTask$postTask(void);#line 56static error_t MessageBufferLayerP$deliverTask$postTask(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t MessageBufferLayerP$RadioSend$send(message_t *arg_0x1ac24c88);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void MessageBufferLayerP$Tasklet$suspend(void);static void MessageBufferLayerP$Tasklet$resume(void);# 101 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"enum MessageBufferLayerP$__nesc_unnamed4339 {#line 101

MessageBufferLayerP$stateDoneTask = 3U};#line 101typedef int MessageBufferLayerP$__nesc_sillytask_stateDoneTask[MessageBufferLayerP$stateDoneTask];#line 139enum MessageBufferLayerP$__nesc_unnamed4340 {#line 139

MessageBufferLayerP$sendTask = 4U};#line 139typedef int MessageBufferLayerP$__nesc_sillytask_sendTask[MessageBufferLayerP$sendTask];#line 267

251

enum MessageBufferLayerP$__nesc_unnamed4341 {#line 267

MessageBufferLayerP$deliverTask = 5U};#line 267typedef int MessageBufferLayerP$__nesc_sillytask_deliverTask[MessageBufferLayerP$deliverTask];#line 52uint8_t MessageBufferLayerP$state;enum MessageBufferLayerP$__nesc_unnamed4342 {

MessageBufferLayerP$STATE_READY = 0,MessageBufferLayerP$STATE_TX_PENDING = 1,MessageBufferLayerP$STATE_TX_SEND = 2,MessageBufferLayerP$STATE_TX_DONE = 3,MessageBufferLayerP$STATE_TURN_ON = 4,MessageBufferLayerP$STATE_TURN_OFF = 5

};static error_t MessageBufferLayerP$SplitControl$start(void);#line 101static inline void MessageBufferLayerP$stateDoneTask$runTask(void);#line 117static inline void MessageBufferLayerP$RadioState$done(void);#line 132message_t *MessageBufferLayerP$txMsg;error_t MessageBufferLayerP$txError;uint8_t MessageBufferLayerP$retries;enum MessageBufferLayerP$__nesc_unnamed4343 {#line 137

MessageBufferLayerP$MAX_RETRIES = 5};static inline void MessageBufferLayerP$sendTask$runTask(void);#line 170static inline void MessageBufferLayerP$RadioSend$sendDone(error_t error);static inline error_t MessageBufferLayerP$Send$send(message_t *msg, uint8_t len);#line 195static inline void MessageBufferLayerP$RadioSend$ready(void);static inline void MessageBufferLayerP$Tasklet$run(void);#line 236enum MessageBufferLayerP$__nesc_unnamed4344 {

MessageBufferLayerP$RECEIVE_QUEUE_SIZE = 3};message_t MessageBufferLayerP$receiveQueueData[MessageBufferLayerP$RECEIVE_QUEUE_SIZE];message_t *MessageBufferLayerP$receiveQueue[MessageBufferLayerP$RECEIVE_QUEUE_SIZE];uint8_t MessageBufferLayerP$receiveQueueHead;uint8_t MessageBufferLayerP$receiveQueueSize;static inline error_t MessageBufferLayerP$SoftwareInit$init(void);static inline bool MessageBufferLayerP$RadioReceive$header(message_t *msg);static inline void MessageBufferLayerP$deliverTask$runTask(void);#line 298static inline message_t *MessageBufferLayerP$RadioReceive$receive(message_t *msg);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t UniqueLayerP$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"static bool UniqueLayerP$NeighborhoodFlag$get(uint8_t arg_0x1ac900b8);static void UniqueLayerP$NeighborhoodFlag$set(uint8_t arg_0x1ac90590);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void UniqueLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static uint8_t UniqueLayerP$Neighborhood$insertNode(am_addr_t arg_0x1ac95c40);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *UniqueLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool UniqueLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"static void UniqueLayerP$UniqueConfig$setSequenceNumber(message_t *arg_0x1a941cd8, uint8_t arg_0x1a941e60);static void UniqueLayerP$UniqueConfig$reportChannelError(void);

252

#line 31static uint8_t UniqueLayerP$UniqueConfig$getSequenceNumber(message_t *arg_0x1a9412c8);static am_addr_t UniqueLayerP$UniqueConfig$getSender(message_t *arg_0x1a9417d8);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"uint8_t UniqueLayerP$sequenceNumber;static inline error_t UniqueLayerP$Init$init(void);static inline error_t UniqueLayerP$Send$send(message_t *msg, uint8_t len);static inline void UniqueLayerP$SubSend$sendDone(message_t *msg, error_t error);#line 84static inline bool UniqueLayerP$SubReceive$header(message_t *msg);uint8_t UniqueLayerP$receivedNumbers[5];static inline message_t *UniqueLayerP$SubReceive$receive(message_t *msg);#line 115static inline void UniqueLayerP$Neighborhood$evicted(uint8_t index);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static void NeighborhoodP$Neighborhood$evicted(uint8_t arg_0x1ac93270);# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"am_addr_t NeighborhoodP$nodes[5];uint8_t NeighborhoodP$ages[5];uint8_t NeighborhoodP$flags[5];uint8_t NeighborhoodP$time;uint8_t NeighborhoodP$last;static inline error_t NeighborhoodP$Init$init(void);#line 83static uint8_t NeighborhoodP$Neighborhood$insertNode(am_addr_t node);#line 147static __inline bool NeighborhoodP$NeighborhoodFlag$get(uint8_t bit, uint8_t index);static __inline void NeighborhoodP$NeighborhoodFlag$set(uint8_t bit, uint8_t index);static inline void NeighborhoodP$NeighborhoodFlag$clearAll(uint8_t bit);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t TrafficMonitorLayerP$SubSend$send(message_t *arg_0x1ac24c88);# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"static uint16_t TrafficMonitorLayerP$TrafficMonitorConfig$getUpdatePeriod(void);static uint16_t TrafficMonitorLayerP$TrafficMonitorConfig$getChannelTime(message_t *arg_0x1a9545e0);#line 79static void TrafficMonitorLayerP$TrafficMonitorConfig$timerTick(void);#line 43static am_addr_t TrafficMonitorLayerP$TrafficMonitorConfig$getSender(message_t *arg_0x1a954b08);# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"static void TrafficMonitorLayerP$RadioState$done(void);#line 45static error_t TrafficMonitorLayerP$SubState$turnOn(void);# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"static uint8_t TrafficMonitorLayerP$Neighborhood$insertNode(am_addr_t arg_0x1ac95c40);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *TrafficMonitorLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool TrafficMonitorLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"static void TrafficMonitorLayerP$NeighborhoodFlag$clearAll(void);#line 35static bool TrafficMonitorLayerP$NeighborhoodFlag$get(uint8_t arg_0x1ac900b8);static void TrafficMonitorLayerP$NeighborhoodFlag$set(uint8_t arg_0x1ac90590);# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void TrafficMonitorLayerP$Tasklet$suspend(void);static void TrafficMonitorLayerP$Tasklet$resume(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void TrafficMonitorLayerP$RadioSend$ready(void);

253

#line 45static void TrafficMonitorLayerP$RadioSend$sendDone(error_t arg_0x1ac23360);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t TrafficMonitorLayerP$startStopTimer$postTask(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"static void TrafficMonitorLayerP$Timer$startPeriodic(uint32_t arg_0x1a5d0490);#line 67static void TrafficMonitorLayerP$Timer$stop(void);# 229 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"enum TrafficMonitorLayerP$__nesc_unnamed4345 {#line 229

TrafficMonitorLayerP$startStopTimer = 6U};#line 229typedef int TrafficMonitorLayerP$__nesc_sillytask_startStopTimer[TrafficMonitorLayerP$startStopTimer];#line 61message_t *TrafficMonitorLayerP$txMsg;uint8_t TrafficMonitorLayerP$neighborCount;uint16_t TrafficMonitorLayerP$txAverage;uint16_t TrafficMonitorLayerP$rxAverage;uint8_t TrafficMonitorLayerP$neighborAverage;uint8_t TrafficMonitorLayerP$errorAverage;enum TrafficMonitorLayerP$__nesc_unnamed4346 {

TrafficMonitorLayerP$TRAFFIC_MONITOR_UINT8_MAX = 1 << (7 - 3),TrafficMonitorLayerP$TRAFFIC_MONITOR_MASK = (1 << 3) - 1,TrafficMonitorLayerP$TRAFFIC_MONITOR_ROUND_UP = (1 << 3) - 1

};static inline void TrafficMonitorLayerP$SubSend$ready(void);static inline error_t TrafficMonitorLayerP$RadioSend$send(message_t *msg);static void TrafficMonitorLayerP$SubSend$sendDone(error_t error);static inline bool TrafficMonitorLayerP$SubReceive$header(message_t *msg);static inline message_t *TrafficMonitorLayerP$SubReceive$receive(message_t *msg);#line 124static inline void TrafficMonitorLayerP$TrafficMonitorConfig$channelError(void);static inline void TrafficMonitorLayerP$Timer$fired(void);#line 171static inline void TrafficMonitorLayerP$Tasklet$run(void);#line 195static inline void TrafficMonitorLayerP$Neighborhood$evicted(uint8_t index);enum TrafficMonitorLayerP$__nesc_unnamed4347 {

TrafficMonitorLayerP$RADIO_CMD_NONE = 0,TrafficMonitorLayerP$RADIO_CMD_TURNON = 1,TrafficMonitorLayerP$RADIO_CMD_TURNOFF = 2

};uint8_t TrafficMonitorLayerP$radioCmd;#line 217static inline error_t TrafficMonitorLayerP$RadioState$turnOn(void);#line 229static inline void TrafficMonitorLayerP$startStopTimer$runTask(void);static inline void TrafficMonitorLayerP$SubState$done(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t RandomCollisionLayerP$SubSend$send(message_t *arg_0x1ac24c88);# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RandomCollisionLayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20);#line 33static bool RandomCollisionLayerP$RadioAlarm$isFree(void);#line 53static uint16_t RandomCollisionLayerP$RadioAlarm$getNow(void);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Random.nc"static uint16_t RandomCollisionLayerP$Random$rand16(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"static uint16_t RandomCollisionLayerP$Config$getCongestionBackoff(message_t *arg_0x1a9681f8);#line 29static uint16_t RandomCollisionLayerP$Config$getInitialBackoff(message_t *arg_0x1a955c98);static uint16_t RandomCollisionLayerP$Config$getMinimumBackoff(void);

254

static uint16_t RandomCollisionLayerP$Config$getTransmitBarrier(message_t *arg_0x1a968ac0);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *RandomCollisionLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool RandomCollisionLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void RandomCollisionLayerP$RadioSend$ready(void);#line 45static void RandomCollisionLayerP$RadioSend$sendDone(error_t arg_0x1ac23360);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t RandomCollisionLayerP$calcNextRandom$postTask(void);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"enum RandomCollisionLayerP$__nesc_unnamed4348 {#line 67

RandomCollisionLayerP$calcNextRandom = 7U};#line 67typedef int RandomCollisionLayerP$__nesc_sillytask_calcNextRandom[RandomCollisionLayerP$calcNextRandom];#line 46uint8_t RandomCollisionLayerP$state;enum RandomCollisionLayerP$__nesc_unnamed4349 {

RandomCollisionLayerP$STATE_READY = 0,RandomCollisionLayerP$STATE_TX_PENDING_FIRST = 1,RandomCollisionLayerP$STATE_TX_PENDING_SECOND = 2,RandomCollisionLayerP$STATE_TX_SENDING = 3,RandomCollisionLayerP$STATE_BARRIER = 0x80

};message_t *RandomCollisionLayerP$txMsg;uint16_t RandomCollisionLayerP$txBarrier;static inline void RandomCollisionLayerP$SubSend$ready(void);uint16_t RandomCollisionLayerP$nextRandom;static inline void RandomCollisionLayerP$calcNextRandom$runTask(void);static uint16_t RandomCollisionLayerP$getBackoff(uint16_t maxBackoff);#line 87static inline error_t RandomCollisionLayerP$RadioSend$send(message_t *msg);#line 99static inline void RandomCollisionLayerP$RadioAlarm$fired(void);#line 144static inline void RandomCollisionLayerP$SubSend$sendDone(error_t error);static inline bool RandomCollisionLayerP$SubReceive$header(message_t *msg);static inline message_t *RandomCollisionLayerP$SubReceive$receive(message_t *msg);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RandomMlcgC.nc"uint32_t RandomMlcgC$seed;static inline error_t RandomMlcgC$Init$init(void);#line 58static uint32_t RandomMlcgC$Random$rand32(void);#line 78static inline uint16_t RandomMlcgC$Random$rand16(void);# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static error_t SoftwareAckLayerP$SubSend$send(message_t *arg_0x1ac24c88);# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void SoftwareAckLayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20);static void SoftwareAckLayerP$RadioAlarm$cancel(void);#line 33static bool SoftwareAckLayerP$RadioAlarm$isFree(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *SoftwareAckLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool SoftwareAckLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"static void SoftwareAckLayerP$SoftwareAckConfig$reportChannelError(void);#line 68

255

static void SoftwareAckLayerP$SoftwareAckConfig$createAckPacket(message_t *arg_0x1a945e08, message_t *arg_0x1a944010);#line 38static bool SoftwareAckLayerP$SoftwareAckConfig$requiresAckWait(message_t *arg_0x1a948ef0);#line 50static bool SoftwareAckLayerP$SoftwareAckConfig$isAckPacket(message_t *arg_0x1a947b00);static bool SoftwareAckLayerP$SoftwareAckConfig$verifyAckPacket(message_t *arg_0x1a945120, message_t *arg_0x1a9452d0);#line 32static uint16_t SoftwareAckLayerP$SoftwareAckConfig$getAckTimeout(void);static void SoftwareAckLayerP$SoftwareAckConfig$setAckReceived(message_t *arg_0x1a947450, bool arg_0x1a9475d8);#line 63static bool SoftwareAckLayerP$SoftwareAckConfig$requiresAckReply(message_t *arg_0x1a9458d0);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void SoftwareAckLayerP$RadioSend$ready(void);#line 45static void SoftwareAckLayerP$RadioSend$sendDone(error_t arg_0x1ac23360);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"uint8_t SoftwareAckLayerP$state;enum SoftwareAckLayerP$__nesc_unnamed4350 {

SoftwareAckLayerP$STATE_READY = 0,SoftwareAckLayerP$STATE_DATA_SEND = 1,SoftwareAckLayerP$STATE_ACK_WAIT = 2,SoftwareAckLayerP$STATE_ACK_SEND = 3

};message_t *SoftwareAckLayerP$txMsg;message_t SoftwareAckLayerP$ackMsg;static inline void SoftwareAckLayerP$SubSend$ready(void);static inline error_t SoftwareAckLayerP$RadioSend$send(message_t *msg);#line 83static inline void SoftwareAckLayerP$SubSend$sendDone(error_t error);#line 110static inline void SoftwareAckLayerP$RadioAlarm$fired(void);static inline bool SoftwareAckLayerP$SubReceive$header(message_t *msg);static inline message_t *SoftwareAckLayerP$SubReceive$receive(message_t *msg);# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioCCA.nc"static void RF230LayerP$RadioCCA$done(error_t arg_0x1ac3a920);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\BusyWait.nc"static void RF230LayerP$BusyWait$wait(RF230LayerP$BusyWait$size_type arg_0x1ad79c98);# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static void RF230LayerP$PacketRSSI$clear(message_t *arg_0x1a8a8718);static void RF230LayerP$PacketRSSI$set(message_t *arg_0x1a8a8c00, RF230LayerP$PacketRSSI$value_type arg_0x1a8a8d90);# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\PacketTimeStamp.nc"static void RF230LayerP$PacketTimeStamp$clear(message_t *arg_0x1a8e38f8);static void RF230LayerP$PacketTimeStamp$set(message_t *arg_0x1a8e3e20, RF230LayerP$PacketTimeStamp$size_type arg_0x1a8e2010);# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"static uint8_t RF230LayerP$HplRF230$spiSplitRead(void);static uint8_t RF230LayerP$HplRF230$spiSplitReadWrite(uint8_t arg_0x1ad62980);static uint8_t RF230LayerP$HplRF230$spiWrite(uint8_t arg_0x1ad62e90);#line 41static void RF230LayerP$HplRF230$spiSplitWrite(uint8_t arg_0x1ad62010);#line 33static uint16_t RF230LayerP$HplRF230$crcByte(uint16_t arg_0x1ad638f8, uint8_t arg_0x1ad63a80);# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"static void RF230LayerP$RadioState$done(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void RF230LayerP$RSTN$makeOutput(void);#line 29

256

static void RF230LayerP$RSTN$set(void);static void RF230LayerP$RSTN$clr(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static RF230LayerP$PacketTransmitPower$value_type RF230LayerP$PacketTransmitPower$get(message_t *arg_0x1a8a8190);#line 29static bool RF230LayerP$PacketTransmitPower$isSet(message_t *arg_0x1a890c68);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\LocalTime.nc"static uint32_t RF230LayerP$LocalTime$get(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void RF230LayerP$SLP_TR$makeOutput(void);#line 29static void RF230LayerP$SLP_TR$set(void);static void RF230LayerP$SLP_TR$clr(void);# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"static message_t *RF230LayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8);#line 35static bool RF230LayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0);# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RF230LayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20);#line 33static bool RF230LayerP$RadioAlarm$isFree(void);#line 53static uint16_t RF230LayerP$RadioAlarm$getNow(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static RF230LayerP$PacketTimeSyncOffset$value_type RF230LayerP$PacketTimeSyncOffset$get(message_t *arg_0x1a8a8190);#line 29static bool RF230LayerP$PacketTimeSyncOffset$isSet(message_t *arg_0x1a890c68);# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t RF230LayerP$SpiResource$release(void);#line 87static error_t RF230LayerP$SpiResource$immediateRequest(void);#line 78static error_t RF230LayerP$SpiResource$request(void);#line 118static bool RF230LayerP$SpiResource$isOwner(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void RF230LayerP$SELN$makeOutput(void);#line 29static void RF230LayerP$SELN$set(void);static void RF230LayerP$SELN$clr(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"static void RF230LayerP$RadioSend$ready(void);#line 45static void RF230LayerP$RadioSend$sendDone(error_t arg_0x1ac23360);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"static void RF230LayerP$IRQ$disable(void);#line 42static error_t RF230LayerP$IRQ$captureRisingEdge(void);# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"static void RF230LayerP$PacketLinkQuality$set(message_t *arg_0x1a8a8c00, RF230LayerP$PacketLinkQuality$value_type arg_0x1a8a8d90);# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"static void RF230LayerP$Tasklet$schedule(void);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"static uint8_t RF230LayerP$RF230Config$getHeaderLength(void);static uint8_t RF230LayerP$RF230Config$getDefaultChannel(void);#line 46static uint8_t *RF230LayerP$RF230Config$getPayload(message_t *arg_0x1a934a08);#line 39

257

static void RF230LayerP$RF230Config$setLength(message_t *arg_0x1a934378, uint8_t arg_0x1a934500);#line 34static uint8_t RF230LayerP$RF230Config$getLength(message_t *arg_0x1a938d68);#line 60static uint8_t RF230LayerP$RF230Config$getMaxLength(void);#line 72static bool RF230LayerP$RF230Config$requiresRssiCca(message_t *arg_0x1a932c88);# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"uint8_t RF230LayerP$state;enum RF230LayerP$__nesc_unnamed4351 {

RF230LayerP$STATE_P_ON = 0,RF230LayerP$STATE_SLEEP = 1,RF230LayerP$STATE_SLEEP_2_TRX_OFF = 2,RF230LayerP$STATE_TRX_OFF = 3,RF230LayerP$STATE_TRX_OFF_2_RX_ON = 4,RF230LayerP$STATE_RX_ON = 5,RF230LayerP$STATE_BUSY_TX_2_RX_ON = 6,RF230LayerP$STATE_PLL_ON_2_RX_ON = 7

};uint8_t RF230LayerP$cmd;enum RF230LayerP$__nesc_unnamed4352 {

RF230LayerP$CMD_NONE = 0,RF230LayerP$CMD_TURNOFF = 1,RF230LayerP$CMD_STANDBY = 2,RF230LayerP$CMD_TURNON = 3,RF230LayerP$CMD_TRANSMIT = 4,RF230LayerP$CMD_RECEIVE = 5,RF230LayerP$CMD_CCA = 6,RF230LayerP$CMD_CHANNEL = 7,RF230LayerP$CMD_SIGNAL_DONE = 8,RF230LayerP$CMD_DOWNLOAD = 9

};bool RF230LayerP$radioIrq;uint8_t RF230LayerP$txPower;uint8_t RF230LayerP$channel;message_t *RF230LayerP$rxMsg;message_t RF230LayerP$rxMsgBuffer;uint16_t RF230LayerP$capturedTime;uint8_t RF230LayerP$rssiClear;uint8_t RF230LayerP$rssiBusy;static __inline void RF230LayerP$writeRegister(uint8_t reg, uint8_t value);#line 135static __inline uint8_t RF230LayerP$readRegister(uint8_t reg);#line 151enum RF230LayerP$__nesc_unnamed4353 {

RF230LayerP$SLEEP_WAKEUP_TIME =(uint16_t )(880 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2)) / 1000000UL),

RF230LayerP$CCA_REQUEST_TIME =(uint16_t )(140 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2)) / 1000000UL),

RF230LayerP$TX_SFD_DELAY =(uint16_t )(176 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2)) / 1000000UL),RF230LayerP$RX_SFD_DELAY =(uint16_t )(8 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2)) / 1000000UL)

};static inline void RF230LayerP$RadioAlarm$fired(void);#line 186static inline error_t RF230LayerP$PlatformInit$init(void);#line 204static inline error_t RF230LayerP$SoftwareInit$init(void);static inline void RF230LayerP$initRadio(void);#line 238static inline void RF230LayerP$SpiResource$granted(void);#line 252static bool RF230LayerP$isSpiAcquired(void);#line 287static __inline void RF230LayerP$changeChannel(void);#line 305static __inline void RF230LayerP$changeState(void);#line 372static inline error_t RF230LayerP$RadioState$turnOn(void);#line 389static error_t RF230LayerP$RadioSend$send(message_t *msg);#line 537static inline void RF230LayerP$RadioCCA$default$done(error_t error);

258

static __inline void RF230LayerP$downloadMessage(void);#line 622static inline void RF230LayerP$IRQ$captured(uint16_t time);#line 635static inline void RF230LayerP$serviceRadio(void);#line 787static inline void RF230LayerP$Tasklet$run(void);# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void HplRF230P$PortCLKM$makeInput(void);#line 30static void HplRF230P$PortCLKM$clr(void);# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"static void HplRF230P$Capture$setEdge(bool arg_0x1ab09b48);#line 38static HplRF230P$Capture$size_type HplRF230P$Capture$get(void);#line 55static void HplRF230P$Capture$reset(void);static void HplRF230P$Capture$start(void);static void HplRF230P$Capture$stop(void);# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void HplRF230P$PortIRQ$makeInput(void);#line 30static void HplRF230P$PortIRQ$clr(void);# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"static void HplRF230P$IRQ$captured(uint16_t arg_0x1ad7c680);# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static inline error_t HplRF230P$PlatformInit$init(void);static inline void HplRF230P$Capture$captured(uint16_t time);static inline error_t HplRF230P$IRQ$captureRisingEdge(void);#line 83static inline void HplRF230P$IRQ$disable(void);static __inline uint16_t HplRF230P$HplRF230$crcByte(uint16_t crc, uint8_t data);static __inline void HplRF230P$HplRF230$spiSplitWrite(uint8_t data);static __inline uint8_t HplRF230P$HplRF230$spiSplitRead(void);static __inline uint8_t HplRF230P$HplRF230$spiSplitReadWrite(uint8_t data);#line 121static __inline uint8_t HplRF230P$HplRF230$spiWrite(uint8_t data);# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SpiPacket.nc"static void Atm128SpiP$SpiPacket$sendDone(uint8_t *arg_0x1ae20390, uint8_t *arg_0x1ae20538,uint16_t arg_0x1ae206c8,error_t arg_0x1ae20860);# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$ResourceArbiter$release(# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae49b10);# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$ResourceArbiter$immediateRequest(# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae49b10);# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static error_t Atm128SpiP$ResourceArbiter$request(# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae49b10);# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static bool Atm128SpiP$ResourceArbiter$isOwner(# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae49b10);# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"static void Atm128SpiP$Spi$sleep(void);#line 66static void Atm128SpiP$Spi$initMaster(void);#line 96static void Atm128SpiP$Spi$enableInterrupt(bool arg_0x1ae46c70);#line 80static uint8_t Atm128SpiP$Spi$read(void);

259

#line 125static void Atm128SpiP$Spi$setMasterDoubleSpeed(bool arg_0x1ae40db0);#line 114static void Atm128SpiP$Spi$setClock(uint8_t arg_0x1ae42c58);#line 108static void Atm128SpiP$Spi$setClockPolarity(bool arg_0x1ae43c90);#line 86static void Atm128SpiP$Spi$write(uint8_t arg_0x1ae46218);#line 99static void Atm128SpiP$Spi$enableSpi(bool arg_0x1ae45480);#line 111static void Atm128SpiP$Spi$setClockPhase(bool arg_0x1ae42490);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static void Atm128SpiP$Resource$granted(# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"uint8_t arg_0x1ae4d8e0);# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerState.nc"static void Atm128SpiP$McuPowerState$update(void);# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ArbiterInfo.nc"static bool Atm128SpiP$ArbiterInfo$inUse(void);# 207 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"enum Atm128SpiP$__nesc_unnamed4354 {#line 207

Atm128SpiP$zeroTask = 8U};#line 207typedef int Atm128SpiP$__nesc_sillytask_zeroTask[Atm128SpiP$zeroTask];#line 90uint16_t Atm128SpiP$len;uint8_t *Atm128SpiP$txBuffer;uint8_t *Atm128SpiP$rxBuffer;uint16_t Atm128SpiP$pos;enum Atm128SpiP$__nesc_unnamed4355 {

Atm128SpiP$SPI_IDLE,Atm128SpiP$SPI_BUSY,Atm128SpiP$SPI_ATOMIC_SIZE = 10

};static void Atm128SpiP$startSpi(void);#line 119static inline void Atm128SpiP$stopSpi(void);static uint8_t Atm128SpiP$SpiByte$write(uint8_t tx);#line 162static inline error_t Atm128SpiP$sendNextPart(void);#line 207static inline void Atm128SpiP$zeroTask$runTask(void);#line 262static inline#line 261void Atm128SpiP$SpiPacket$default$sendDone(uint8_t *_txbuffer, uint8_t *_rxbuffer,uint16_t _length, error_t _success);static inline void Atm128SpiP$Spi$dataReady(uint8_t data);#line 305static inline error_t Atm128SpiP$Resource$immediateRequest(uint8_t id);static error_t Atm128SpiP$Resource$request(uint8_t id);static error_t Atm128SpiP$Resource$release(uint8_t id);static inline uint8_t Atm128SpiP$Resource$isOwner(uint8_t id);static inline void Atm128SpiP$ResourceArbiter$granted(uint8_t id);static inline void Atm128SpiP$Resource$default$granted(uint8_t id);# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void HplAtm128SpiP$MISO$makeInput(void);static void HplAtm128SpiP$SCK$makeOutput(void);# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerState.nc"static void HplAtm128SpiP$Mcu$update(void);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"static void HplAtm128SpiP$SPI$dataReady(uint8_t arg_0x1ae46728);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"static void HplAtm128SpiP$MOSI$makeOutput(void);# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$initMaster(void);#line 94static inline void HplAtm128SpiP$SPI$sleep(void);static inline uint8_t HplAtm128SpiP$SPI$read(void);

260

static inline void HplAtm128SpiP$SPI$write(uint8_t d);void __vector_24(void) __attribute((signal)) ;#line 115static void HplAtm128SpiP$SPI$enableInterrupt(bool enabled);#line 130static void HplAtm128SpiP$SPI$enableSpi(bool enabled);#line 156static inline void HplAtm128SpiP$SPI$setMasterBit(bool isMaster);#line 169static inline void HplAtm128SpiP$SPI$setClockPolarity(bool highWhenIdle);#line 183static inline void HplAtm128SpiP$SPI$setClockPhase(bool sampleOnTrailing);#line 200static inline void HplAtm128SpiP$SPI$setClock(uint8_t v);#line 213static inline void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool on);# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\FcfsResourceQueueC.nc"enum /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$__nesc_unnamed4356 {#line 39

FcfsResourceQueueC$0$NO_ENTRY = 0xFF};uint8_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ[1U];uint8_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead =/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;uint8_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qTail =/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;static inline error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init(void);static inline bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEmpty(void);static inline bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEnqueued(resource_client_id_t id);static inline resource_client_id_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$dequeue(void);#line 72static inline error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(resource_client_id_t id);# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$requested(# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af22688);# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$immediateRequested(# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af22688);# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af20188);# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af20188);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceQueue.nc"static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(resource_client_id_t arg_0x1af2d208);#line 43static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$isEmpty(void);#line 60static resource_client_id_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$dequeue(void);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"static void /*Atm128SpiC.Arbiter.Arbiter*/

261

SimpleArbiterP$0$Resource$granted(# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"uint8_t arg_0x1af23d10);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$postTask(void);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4357 {#line 69

SimpleArbiterP$0$grantedTask = 9U};#line 69typedef int /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_sillytask_grantedTask[/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask];#line 62enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4358 {#line 62

SimpleArbiterP$0$RES_IDLE = 0, SimpleArbiterP$0$RES_GRANTING =1, SimpleArbiterP$0$RES_BUSY = 2

};#line 63enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4359 {#line 63

SimpleArbiterP$0$NO_RES = 0xFF};uint8_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_IDLE;uint8_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$NO_RES;uint8_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$reqResId;static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(uint8_t id);#line 84static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(uint8_t id);#line 97static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(uint8_t id);#line 123static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void);#line 147static inline uint8_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$isOwner(uint8_t id);static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask(void);#line 166static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(uint8_t id);static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(uint8_t id);static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(uint8_t id);static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(uint8_t id);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$fired(void);# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset(void);#line 45static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type arg_0x1a6924f0);static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start(void);static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop(void);# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"static /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get(void);

262

# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$getNow(void);#line 65static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$stop(void);static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$start(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size dt);static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size t0, /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size dt);#line 110static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void);static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void);# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\micaz\\BusyWaitMicroC.nc"static __inline void BusyWaitMicroC$BusyWait$wait(uint16_t dt);# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(message_t *arg_0x1a8821c0,error_t arg_0x1a882348);# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static error_t /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$send(message_t *arg_0x1abe5ef8,uint8_t arg_0x1abe4090);# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(message_t *arg_0x1a874a90, am_addr_t arg_0x1a874c20);#line 151static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setType(message_t *arg_0x1a872ba8, am_id_t arg_0x1a872d30);# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueEntryP.nc"static error_t /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t dest,message_t *msg,uint8_t len);static inline void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *m, error_t err);# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"am_id_t arg_0x1b0184e8,# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"am_addr_t arg_0x1a885e28,message_t *arg_0x1a884010, uint8_t arg_0x1a884198);# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"uint8_t arg_0x1b019b68,# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"message_t *arg_0x1abe2010, error_t arg_0x1abe2198);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(message_t *arg_0x1a865ea8);#line 83static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(message_t *arg_0x1a864548, uint8_t arg_0x1a8646d0);# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask(void);# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"

263

static am_addr_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(message_t *arg_0x1a875eb0);#line 136static am_id_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(message_t *arg_0x1a872610);# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"enum /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4360 {#line 118

AMQueueImplP$0$CancelTask = 10U};#line 118typedef int /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_sillytask_CancelTask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask];#line 161enum /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4361 {#line 161

AMQueueImplP$0$errorTask = 11U};#line 161typedef int /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_sillytask_errorTask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask];#line 49#line 47typedef struct /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4362 {

message_t *msg;} /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue_entry_t;uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue_entry_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[1];uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[1 / 8 + 1];static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void);static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket(void);#line 82static inline error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(uint8_t clientId, message_t *msg,uint8_t len);#line 118static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask(void);#line 155static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(uint8_t last, message_t *msg, error_t err);static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void);static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void);#line 181static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(am_id_t id, message_t *msg, error_t err);#line 207static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(uint8_t id, message_t *msg, error_t err);# 109 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\atm128hardware.h"static __inline void __nesc_disable_interrupt(void)#line 109{

__asm volatile ("cli");}#line 126#line 125__inline __nesc_atomic_t__nesc_atomic_start(void ){

__nesc_atomic_t result = * (volatile uint8_t *)(0x3F + 0x20);#line 129

__nesc_disable_interrupt();__asm volatile ("" : : : "memory");return result;

}#line 135__inline void__nesc_atomic_end(__nesc_atomic_t original_SREG){

__asm volatile ("" : : : "memory");

264

* (volatile uint8_t *)(0x3F + 0x20) = original_SREG;}# 113 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"static inline void SchedulerBasicP$Scheduler$init(void){

/* atomic removed: atomic calls only */{

memset((void *)SchedulerBasicP$m_next,SchedulerBasicP$NO_TASK, sizeof SchedulerBasicP$m_next);SchedulerBasicP$m_head = SchedulerBasicP$NO_TASK;SchedulerBasicP$m_tail = SchedulerBasicP$NO_TASK;

}}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Scheduler.nc"inline static void RealMainP$Scheduler$init(void){#line 46

SchedulerBasicP$Scheduler$init();#line 46}#line 46# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\types\\TinyError.h"static inline error_t ecombine(error_t r1, error_t r2){

return r1 == r2 ? r1 : FAIL;}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\mica\\PlatformP.nc"static inline void PlatformP$power_init(void)#line 42{

/* atomic removed: atomic calls only */#line 43

{* (volatile uint8_t *)(0X35 + 0x20) = 1 << 0;

}}# 106 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$TimerCtrl$setControlB(uint8_t x)#line 106{

* (volatile uint8_t *)0x81 = x;}#line 93static inline uint8_t HplAtm1281Timer1P$TimerCtrl$getControlB(void)#line 93{

return * (volatile uint8_t *)0x81;}#line 82static inline void HplAtm1281Timer1P$Timer$setScale(uint8_t s)#line 82{

Atm128_TCCRB_t x = (Atm128_TCCRB_t )HplAtm1281Timer1P$TimerCtrl$getControlB();#line 84

x.bits.cs = s;HplAtm1281Timer1P$TimerCtrl$setControlB(x.flat);

}# 95 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$setScale(uint8_t arg_0x1a670da8){#line 95

HplAtm1281Timer1P$Timer$setScale(arg_0x1a670da8);#line 95}#line 95# 144 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Timer$start(void)#line 144{#line 144

* (volatile uint8_t *)0x6F |= 1 << 0;}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$start(void){#line 69

HplAtm1281Timer1P$Timer$start();#line 69}#line 69

265

# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Timer$set(uint16_t t)#line 73{#line 73

* (volatile uint16_t *)0x84 = t;}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$set(/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$timer_size arg_0x1a671120){#line 58

HplAtm1281Timer1P$Timer$set(arg_0x1a671120);#line 58}#line 58# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128TimerInitC.nc"static inline error_t /*InitOneP.InitOne*/Atm128TimerInitC$0$Init$init(void)#line 42{

/* atomic removed: atomic calls only */#line 43

{/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$set(0);/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$start();/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$setScale(2);

}return SUCCESS;

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"inline static error_t MotePlatformP$SubInit$init(void){#line 51

unsigned char result;#line 51#line 51

result = /*InitOneP.InitOne*/Atm128TimerInitC$0$Init$init();#line 51#line 51

return result;#line 51}#line 51# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)34U &= ˜(1 << 4);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void MotePlatformP$SerialIdPin$clr(void){#line 30

/*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr();#line 30}#line 30# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$makeInput(void)#line 50{#line 50

* (volatile uint8_t *)33U &= ˜(1 << 4);}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void MotePlatformP$SerialIdPin$makeInput(void){#line 33

/*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$makeInput();#line 33}#line 33# 26 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\micaz\\MotePlatformP.nc"static inline error_t MotePlatformP$PlatformInit$init(void)#line 26{

* (volatile uint8_t *)(0x08 + 0x20) = 0;

266

* (volatile uint8_t *)(0x07 + 0x20) = 0xff;MotePlatformP$SerialIdPin$makeInput();MotePlatformP$SerialIdPin$clr();return MotePlatformP$SubInit$init();

}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)34U |= 1 << 0;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led2$set(void){#line 29

/*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$set();

#line 29}#line 29# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)34U |= 1 << 1;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led1$set(void){#line 29

/*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$set();

#line 29}#line 29# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)34U |= 1 << 2;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led0$set(void){#line 29

/*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$set();

#line 29}#line 29# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)33U |= 1 << 0;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led2$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput();

#line 35}#line 35# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)33U |= 1 << 1;

267

}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led1$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput();

#line 35}#line 35# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)33U |= 1 << 2;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led0$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$makeOutput();

#line 35}#line 35# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline error_t LedsP$Init$init(void)#line 45{

/* atomic removed: atomic calls only */#line 46

{;LedsP$Led0$makeOutput();LedsP$Led1$makeOutput();LedsP$Led2$makeOutput();LedsP$Led0$set();LedsP$Led1$set();LedsP$Led2$set();

}return SUCCESS;

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"inline static error_t PlatformP$MoteInit$init(void){#line 51

unsigned char result;#line 51#line 51

result = LedsP$Init$init();#line 51

result = ecombine(result, MotePlatformP$PlatformInit$init());#line 51#line 51

return result;#line 51}#line 51# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\MeasureClockC.nc"static inline error_t MeasureClockC$Init$init(void)#line 64{

/* atomic removed: atomic calls only */{

uint8_t now;#line 70

uint8_t wraps;uint16_t start;* (volatile uint8_t *)0x81 = 1 << 0;* (volatile uint8_t *)0xB6 = 1 << 5;* (volatile uint8_t *)0xB1 = (1 << 1) | (1 << 0);start = * (volatile uint16_t *)0x84;for (wraps = MeasureClockC$MAGIC / 2; wraps; ){uint16_t next = * (volatile uint16_t *)0x84;if (next < start) {

wraps--;}

#line 88start = next;

}now = * (volatile uint8_t *)0xB2;

268

while (* (volatile uint8_t *)0xB2 == now) ;start = * (volatile uint16_t *)0x84;now = * (volatile uint8_t *)0xB2;while (* (volatile uint8_t *)0xB2 == now) ;MeasureClockC$cycles = * (volatile uint16_t *)0x84;MeasureClockC$cycles =(MeasureClockC$cycles - start + 16) >> 5;* (volatile uint8_t *)0xB6 = * (volatile uint8_t *)0x81 =* (volatile uint8_t *)0xB1 = 0;* (volatile uint8_t *)0xB2 = 0;* (volatile uint16_t *)0x84 = 0;* (volatile uint8_t *)(0x16 + 0x20) =* (volatile uint8_t *)(0x17 + 0x20) = 0xff;while (* (volatile uint8_t *)0xB6 & (((1 << 4) | (1 << 2)) | (1 << 0)))

;}return SUCCESS;

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"inline static error_t PlatformP$MeasureClock$init(void){#line 51

unsigned char result;#line 51#line 51

result = MeasureClockC$Init$init();#line 51#line 51

return result;#line 51}#line 51# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\mica\\PlatformP.nc"static inline error_t PlatformP$Init$init(void){

error_t ok;ok = PlatformP$MeasureClock$init();ok = ecombine(ok, PlatformP$MoteInit$init());if (ok != SUCCESS) {

return ok;}

PlatformP$power_init();return SUCCESS;

}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)34U |= 1 << 6;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$RSTN$set(void){#line 29

/*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$set();

#line 29}#line 29# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)33U |= 1 << 6;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$RSTN$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$makeOutput();

#line 35}#line 35# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$clr(void)

269

#line 47{#line 47

* (volatile uint8_t *)37U &= ˜(1 << 7);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SLP_TR$clr(void){#line 30

/*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$clr();

#line 30}#line 30# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)36U |= 1 << 7;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SLP_TR$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$makeOutput();

#line 35}#line 35# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)37U |= 1 << 0;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SELN$set(void){#line 29

/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set();#line 29}#line 29# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)36U |= 1 << 0;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SELN$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput();

#line 35}#line 35# 186 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline error_t RF230LayerP$PlatformInit$init(void){

RF230LayerP$SELN$makeOutput();RF230LayerP$SELN$set();RF230LayerP$SLP_TR$makeOutput();RF230LayerP$SLP_TR$clr();RF230LayerP$RSTN$makeOutput();RF230LayerP$RSTN$set();RF230LayerP$rxMsg = &RF230LayerP$rxMsgBuffer;RF230LayerP$rssiClear = 0;RF230LayerP$rssiBusy = 90;return SUCCESS;

}# 151 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Capture$stop(void)

270

#line 151{#line 151

* (volatile uint8_t *)0x6F &= ˜(1 << 5);}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static void HplRF230P$Capture$stop(void){#line 61

HplAtm1281Timer1P$Capture$stop();#line 61}#line 61# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)43U &= ˜(1 << 4);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplRF230P$PortIRQ$clr(void){#line 30

/*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$clr();

#line 30}#line 30# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput(void)#line 50{#line 50

* (volatile uint8_t *)42U &= ˜(1 << 4);}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplRF230P$PortIRQ$makeInput(void){#line 33

/*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput();

#line 33}#line 33# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)43U &= ˜(1 << 6);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplRF230P$PortCLKM$clr(void){#line 30

/*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$clr();

#line 30}#line 30# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$makeInput(void)#line 50{#line 50

* (volatile uint8_t *)42U &= ˜(1 << 6);}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplRF230P$PortCLKM$makeInput(void){#line 33

/*HplAtm128GeneralIOC.PortD.Bit6*/HplAtm128GeneralIOPinP$30$IO$makeInput();

#line 33}#line 33# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"

271

static inline error_t HplRF230P$PlatformInit$init(void){

HplRF230P$PortCLKM$makeInput();HplRF230P$PortCLKM$clr();HplRF230P$PortIRQ$makeInput();HplRF230P$PortIRQ$clr();HplRF230P$Capture$stop();return SUCCESS;

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"inline static error_t RealMainP$PlatformInit$init(void){#line 51

unsigned char result;#line 51#line 51

result = HplRF230P$PlatformInit$init();#line 51

result = ecombine(result, RF230LayerP$PlatformInit$init());#line 51

result = ecombine(result, PlatformP$Init$init());#line 51#line 51

return result;#line 51}#line 51# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Scheduler.nc"inline static bool RealMainP$Scheduler$runNextTask(void){#line 54

unsigned char result;#line 54#line 54

result = SchedulerBasicP$Scheduler$runNextTask();#line 54#line 54

return result;#line 54}#line 54# 92 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$AMSend$sendDone(message_t *msg, error_t err)#line 92{

ForwardToBaseC$busy = FALSE;}# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"inline static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(message_t *arg_0x1a8821c0, error_t arg_0x1a882348){#line 99

ForwardToBaseC$AMSend$sendDone(arg_0x1a8821c0, arg_0x1a882348);#line 99}#line 99# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueEntryP.nc"static inline void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *m, error_t err)#line 57{

/*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(m, err);

}# 207 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(uint8_t id, message_t *msg, error_t err)#line 207{}# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(uint8_t arg_0x1b019b68, message_t *arg_0x1abe2010,error_t arg_0x1abe2198){#line 89

switch (arg_0x1b019b68) {#line 89

case 0U:#line 89

272

/*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(arg_0x1abe2010, arg_0x1abe2198);

#line 89break;

#line 89default:

#line 89/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(arg_0x1b019b68, arg_0x1abe2010, arg_0x1abe2198);

#line 89break;

#line 89}

#line 89}#line 89# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask(void)#line 118{

uint8_t i;#line 119

uint8_t j;#line 119

uint8_t mask;#line 119

uint8_t last;message_t *msg;

#line 121for (i = 0; i < 1 / 8 + 1; i++) {

if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i]) {

for (mask = 1, j = 0; j < 8; j++) {if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i] & mask) {

last = i * 8 + j;msg = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg = (void *)0;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i] &= ˜mask;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(last, msg, ECANCEL);

}mask <<= 1;

}}

}}#line 161static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void)#line 161{

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current, /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg, FAIL);

}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask);

#line 56#line 56

return result;#line 56}#line 56# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"inline static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(am_id_t arg_0x1b0184e8, am_addr_t arg_0x1a885e28,message_t *arg_0x1a884010, uint8_t arg_0x1a884198){#line 69

273

unsigned char result;#line 69#line 69

result = ActiveMessageLayerC$AMSend$send(arg_0x1b0184e8, arg_0x1a885e28, arg_0x1a884010, arg_0x1a884198);

#line 69#line 69

return result;#line 69}#line 69# 246 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint8_t __nesc_ntoh_leuint8(const void *source)#line 246{

const uint8_t *base = source;#line 248

return base[0];}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline ieee154_header_t *IEEE154PacketP$getHeader(message_t *msg){

return (ieee154_header_t *)(msg->data - sizeof(ieee154_header_t ));}static __inline uint8_t IEEE154PacketP$IEEE154Packet$getLength(message_t *msg){

return __nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->length);

}# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static uint8_t RF230PacketP$IEEE154Packet$getLength(message_t *arg_0x1a9759d0){#line 44

unsigned char result;#line 44#line 44

result = IEEE154PacketP$IEEE154Packet$getLength(arg_0x1a9759d0);#line 44#line 44

return result;#line 44}#line 44# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static __inline uint8_t RF230PacketP$Packet$payloadLength(message_t *msg){

return RF230PacketP$IEEE154Packet$getLength(msg) - RF230PacketP$PACKET_LENGTH_INCREASE;

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(message_t *arg_0x1a865ea8){#line 67

unsigned char result;#line 67#line 67

result = RF230PacketP$Packet$payloadLength(arg_0x1a865ea8);#line 67#line 67

return result;#line 67}#line 67# 276 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint16_t __nesc_ntoh_leuint16(const void *source)#line 276{

const uint8_t *base = source;#line 278

return ((uint16_t )base[1] << 8) | base[0];}# 174 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline uint16_t IEEE154PacketP$IEEE154Packet$getDestAddr(message_t *msg){

return __nesc_ntoh_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->dest);

}

274

#line 249static __inline am_addr_t IEEE154PacketP$AMPacket$destination(message_t *msg){

return IEEE154PacketP$IEEE154Packet$getDestAddr(msg);}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static am_addr_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(message_t *arg_0x1a875eb0){#line 67

unsigned short result;#line 67#line 67

result = IEEE154PacketP$AMPacket$destination(arg_0x1a875eb0);#line 67#line 67

return result;#line 67}#line 67# 208 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline am_id_t IEEE154PacketP$IEEE154Packet$getType(message_t *msg){

return __nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->type);

}#line 275static __inline am_id_t IEEE154PacketP$AMPacket$type(message_t *msg){

return IEEE154PacketP$IEEE154Packet$getType(msg);}# 136 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static am_id_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(message_t *arg_0x1a872610){#line 136

unsigned char result;#line 136#line 136

result = IEEE154PacketP$AMPacket$type(arg_0x1a872610);#line 136#line 136

return result;#line 136}#line 136# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket(void)#line 57{

uint8_t i;#line 59

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current = (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current + 1) % 1;for (i = 0; i < 1; i++) {

if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg == (void *)0 ||/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current / 8] & (1 << /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current % 8)){

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current =(/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current + 1) % 1;

}else {

break;}

}if (i >= 1) {

#line 70/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;}

}#line 166static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void)#line 166{

275

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket();if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current < 1) {

error_t nextErr;message_t *nextMsg = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg;am_id_t nextId = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(nextMsg);am_addr_t nextDest = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(nextMsg);uint8_t len = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(nextMsg);

#line 174nextErr = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(nextId, nextDest, nextMsg, len);if (nextErr != SUCCESS) {

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask();

}}

}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static __inline rf230packet_metadata_t *RF230PacketP$getMeta(message_t *msg){

return (rf230packet_metadata_t *)msg->metadata;}# 281 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint16_t __nesc_hton_leuint16(void *target, uint16_t value)#line 281{

uint8_t *base = target;#line 283

base[0] = value;base[1] = value >> 8;return value;

}# 93 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$createDataFrame(message_t *msg){

__nesc_hton_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->fcf, IEEE154PacketP$IEEE154_DATA_FRAME_VALUE);

}# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static void RF230PacketP$IEEE154Packet$createDataFrame(message_t *arg_0x1a972768){#line 73

IEEE154PacketP$IEEE154Packet$createDataFrame(arg_0x1a972768);#line 73}#line 73# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void RF230PacketP$Packet$clear(message_t *msg){

RF230PacketP$IEEE154Packet$createDataFrame(msg);RF230PacketP$getMeta(msg)->flags = RF230PACKET_CLEAR_METADATA;

}# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static void RF230ActiveMessageP$Packet$clear(message_t *arg_0x1a8658f8){#line 54

RF230PacketP$Packet$clear(arg_0x1a8658f8);#line 54}#line 54# 88 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline bool IEEE154PacketP$IEEE154Packet$isDataFrame(message_t *msg){

return (__nesc_ntoh_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->fcf) &IEEE154PacketP$IEEE154_DATA_FRAME_MASK) ==IEEE154PacketP$IEEE154_DATA_FRAME_VALUE;

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"

276

inline static bool RF230ActiveMessageP$IEEE154Packet$isDataFrame(message_t *arg_0x1a972228){#line 67

unsigned char result;#line 67#line 67

result = IEEE154PacketP$IEEE154Packet$isDataFrame(arg_0x1a972228);#line 67#line 67

return result;#line 67}#line 67# 166 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline error_t RF230ActiveMessageP$ActiveMessageConfig$checkPacket(message_t *msg){

if (!RF230ActiveMessageP$IEEE154Packet$isDataFrame(msg)) {RF230ActiveMessageP$Packet$clear(msg);}

return SUCCESS;}# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageConfig.nc"inline static error_t ActiveMessageLayerC$Config$checkPacket(message_t *arg_0x1a960140){#line 31

unsigned char result;#line 31#line 31

result = RF230ActiveMessageP$ActiveMessageConfig$checkPacket(arg_0x1a960140);

#line 31#line 31

return result;#line 31}#line 31# 189 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$setSrcAddr(message_t *msg, uint16_t addr){

__nesc_hton_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->src, addr);

}#line 264static __inline void IEEE154PacketP$AMPacket$setSource(message_t *msg, am_addr_t addr){

IEEE154PacketP$IEEE154Packet$setSrcAddr(msg, addr);}# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static void ActiveMessageLayerC$AMPacket$setSource(message_t *arg_0x1a873358, am_addr_t arg_0x1a8734e8){#line 110

IEEE154PacketP$AMPacket$setSource(arg_0x1a873358, arg_0x1a8734e8);#line 110}#line 110# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\ActiveMessageAddressC.nc"static inline am_addr_t ActiveMessageAddressC$ActiveMessageAddress$amAddress(void)#line 61{

return ActiveMessageAddressC$amAddress();}# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ActiveMessageAddress.nc"inline static am_addr_t IEEE154PacketP$ActiveMessageAddress$amAddress(void){#line 50

unsigned short result;#line 50#line 50

result = ActiveMessageAddressC$ActiveMessageAddress$amAddress();#line 50#line 50

return result;#line 50}#line 50# 238 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

277

\\chips\\rf230\\IEEE154PacketP.nc"static __inline am_addr_t IEEE154PacketP$AMPacket$address(void){

return IEEE154PacketP$ActiveMessageAddress$amAddress();}# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static am_addr_t ActiveMessageLayerC$AMPacket$address(void){#line 57

unsigned short result;#line 57#line 57

result = IEEE154PacketP$AMPacket$address();#line 57#line 57

return result;#line 57}#line 57# 169 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$setDestPan(message_t *msg, uint16_t pan){

__nesc_hton_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->destpan, pan);

}#line 290static __inline void IEEE154PacketP$AMPacket$setGroup(message_t *msg, am_group_t grp){

IEEE154PacketP$IEEE154Packet$setDestPan(msg, grp);}# 176 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static void ActiveMessageLayerC$AMPacket$setGroup(message_t *arg_0x1a870c48, am_group_t arg_0x1a870dd8){#line 176

IEEE154PacketP$AMPacket$setGroup(arg_0x1a870c48, arg_0x1a870dd8);#line 176}#line 176# 82 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\ActiveMessageAddressC.nc"static inline am_group_t ActiveMessageAddressC$ActiveMessageAddress$amGroup(void)#line 82{

am_group_t myGroup;#line 84

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 84

myGroup = ActiveMessageAddressC$group;#line 84

__nesc_atomic_end(__nesc_atomic); }return myGroup;

}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ActiveMessageAddress.nc"inline static am_group_t IEEE154PacketP$ActiveMessageAddress$amGroup(void){#line 55

unsigned char result;#line 55#line 55

result = ActiveMessageAddressC$ActiveMessageAddress$amGroup();#line 55#line 55

return result;#line 55}#line 55# 243 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline am_group_t IEEE154PacketP$AMPacket$localGroup(void){

return IEEE154PacketP$ActiveMessageAddress$amGroup();}# 184 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static am_group_t ActiveMessageLayerC$AMPacket$localGroup(void){#line 184

unsigned char result;#line 184#line 184

result = IEEE154PacketP$AMPacket$localGroup();

278

#line 184#line 184

return result;#line 184}#line 184# 251 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint8_t __nesc_hton_leuint8(void *target, uint8_t value)#line 251{

uint8_t *base = target;#line 253

base[0] = value;return value;

}# 213 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$setType(message_t *msg, am_id_t type){

__nesc_hton_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->type, type);

}#line 280static __inline void IEEE154PacketP$AMPacket$setType(message_t *msg, am_id_t type){

IEEE154PacketP$IEEE154Packet$setType(msg, type);}# 151 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static void ActiveMessageLayerC$AMPacket$setType(message_t *arg_0x1a872ba8, am_id_t arg_0x1a872d30){#line 151

IEEE154PacketP$AMPacket$setType(arg_0x1a872ba8, arg_0x1a872d30);#line 151}#line 151# 179 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$setDestAddr(message_t *msg, uint16_t addr){

__nesc_hton_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->dest, addr);

}#line 259static __inline void IEEE154PacketP$AMPacket$setDestination(message_t *msg, am_addr_t addr){

IEEE154PacketP$IEEE154Packet$setDestAddr(msg, addr);}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static void ActiveMessageLayerC$AMPacket$setDestination(message_t *arg_0x1a874a90, am_addr_t arg_0x1a874c20){#line 92

IEEE154PacketP$AMPacket$setDestination(arg_0x1a874a90, arg_0x1a874c20);#line 92}#line 92# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t MessageBufferLayerP$sendTask$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(MessageBufferLayerP$sendTask);

#line 56#line 56

return result;#line 56}#line 56# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$setLength(message_t *msg, uint8_t length){

__nesc_hton_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->length, length);

}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

279

\\chips\\rf230\\IEEE154Packet.nc"inline static void RF230PacketP$IEEE154Packet$setLength(message_t *arg_0x1a975ee0, uint8_t arg_0x1a973088){#line 49

IEEE154PacketP$IEEE154Packet$setLength(arg_0x1a975ee0, arg_0x1a973088);#line 49}#line 49# 75 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static __inline void RF230PacketP$Packet$setPayloadLength(message_t *msg, uint8_t len){

RF230PacketP$IEEE154Packet$setLength(msg, len +RF230PacketP$PACKET_LENGTH_INCREASE);

}# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static void MessageBufferLayerP$Packet$setPayloadLength(message_t *arg_0x1a864548, uint8_t arg_0x1a8646d0){#line 83

RF230PacketP$Packet$setPayloadLength(arg_0x1a864548, arg_0x1a8646d0);#line 83}#line 83# 85 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static __inline uint8_t RF230PacketP$Packet$maxPayloadLength(void){

return 28;}# 95 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static uint8_t MessageBufferLayerP$Packet$maxPayloadLength(void){#line 95

unsigned char result;#line 95#line 95

result = RF230PacketP$Packet$maxPayloadLength();#line 95#line 95

return result;#line 95}#line 95# 178 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline error_t MessageBufferLayerP$Send$send(message_t *msg, uint8_t len){

if (len > MessageBufferLayerP$Packet$maxPayloadLength()) {return EINVAL;}

else {#line 182

if (MessageBufferLayerP$state !=MessageBufferLayerP$STATE_READY) {return EBUSY;}

}#line 185

MessageBufferLayerP$Packet$setPayloadLength(msg, len);MessageBufferLayerP$txMsg = msg;MessageBufferLayerP$state = MessageBufferLayerP$STATE_TX_PENDING;MessageBufferLayerP$retries = 0;MessageBufferLayerP$sendTask$postTask();return SUCCESS;

}# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static error_t UniqueLayerP$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090){#line 64

unsigned char result;#line 64#line 64

result = MessageBufferLayerP$Send$send(arg_0x1abe5ef8, arg_0x1abe4090);#line 64#line 64

return result;#line 64}#line 64# 159 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"

280

static __inline void IEEE154PacketP$IEEE154Packet$setDSN(message_t *msg, uint8_t dsn){

__nesc_hton_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->dsn, dsn);

}# 129 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static void RF230ActiveMessageP$IEEE154Packet$setDSN(message_t *arg_0x1a986500, uint8_t arg_0x1a986688){#line 129

IEEE154PacketP$IEEE154Packet$setDSN(arg_0x1a986500, arg_0x1a986688);#line 129}#line 129# 149 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline voidRF230ActiveMessageP$UniqueConfig$setSequenceNumber(message_t *msg, uint8_t dsn){

RF230ActiveMessageP$IEEE154Packet$setDSN(msg, dsn);}# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"inline static void UniqueLayerP$UniqueConfig$setSequenceNumber(message_t *arg_0x1a941cd8, uint8_t arg_0x1a941e60){#line 41

RF230ActiveMessageP$UniqueConfig$setSequenceNumber(arg_0x1a941cd8, arg_0x1a941e60);

#line 41}#line 41# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline error_t UniqueLayerP$Send$send(message_t *msg, uint8_t len){

UniqueLayerP$UniqueConfig$setSequenceNumber(msg, ++UniqueLayerP$sequenceNumber);return UniqueLayerP$SubSend$send(msg, len);

}# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static error_t IEEE154NetworkLayerP$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090){#line 64

unsigned char result;#line 64#line 64

result = UniqueLayerP$Send$send(arg_0x1abe5ef8, arg_0x1abe4090);#line 64#line 64

return result;#line 64}#line 64# 201 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$set6LowPan(message_t *msg, uint8_t network){

__nesc_hton_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->network, network);

}# 172 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static void IEEE154NetworkLayerP$IEEE154Packet$set6LowPan(message_t *arg_0x1a982518, uint8_t arg_0x1a9826a0){#line 172

IEEE154PacketP$IEEE154Packet$set6LowPan(arg_0x1a982518, arg_0x1a9826a0);#line 172}#line 172# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"static inline error_t IEEE154NetworkLayerP$Send$send(message_t *msg, uint8_t len){

IEEE154NetworkLayerP$IEEE154Packet$set6LowPan(msg, 0x3f);return IEEE154NetworkLayerP$SubSend$send(msg, len);

}# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static error_t ActiveMessageLayerC$SubSend$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090){

281

#line 64unsigned char result;

#line 64#line 64

result = IEEE154NetworkLayerP$Send$send(arg_0x1abe5ef8, arg_0x1abe4090);

#line 64#line 64

return result;#line 64}#line 64# 86 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"static inline bool SchedulerBasicP$isWaiting(uint8_t id){

return SchedulerBasicP$m_next[id] !=SchedulerBasicP$NO_TASK || SchedulerBasicP$m_tail == id;

}static inline bool SchedulerBasicP$pushTask(uint8_t id){

if (!SchedulerBasicP$isWaiting(id)){if (SchedulerBasicP$m_head == SchedulerBasicP$NO_TASK)

{SchedulerBasicP$m_head = id;SchedulerBasicP$m_tail = id;

}else

{SchedulerBasicP$m_next[SchedulerBasicP$m_tail] = id;SchedulerBasicP$m_tail = id;

}return TRUE;

}else

{return FALSE;

}}# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void RF230LayerP$Tasklet$schedule(void){#line 48

TaskletC$Tasklet$schedule();#line 48}#line 48# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t RF230LayerP$SpiResource$release(void){#line 110

unsigned char result;#line 110#line 110

result = Atm128SpiP$Resource$release(0U);#line 110#line 110

return result;#line 110}#line 110# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$set(void)#line 46{#line 46

* (volatile uint8_t *)37U |= 1 << 7;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SLP_TR$set(void){#line 29

/*HplAtm128GeneralIOC.PortB.Bit7*/HplAtm128GeneralIOPinP$15$IO$set();

#line 29}#line 29# 102 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static __inline uint8_t HplRF230P$HplRF230$spiSplitRead(void){

while (!(* (volatile uint8_t *)(0x2D + 0x20) & 0x80));

return * (volatile uint8_t *)(0X2E + 0x20);}

282

# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"inline static uint8_t RF230LayerP$HplRF230$spiSplitRead(void){#line 47

unsigned char result;#line 47#line 47

result = HplRF230P$HplRF230$spiSplitRead();#line 47#line 47

return result;#line 47}#line 47# 109 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static __inline uint8_t HplRF230P$HplRF230$spiSplitReadWrite(uint8_t data){

uint8_t b;while (!(* (volatile uint8_t *)(0x2D + 0x20) & 0x80))

;b = * (volatile uint8_t *)(0X2E + 0x20);* (volatile uint8_t *)(0X2E + 0x20) = data;return b;

}# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"inline static uint8_t RF230LayerP$HplRF230$spiSplitReadWrite(uint8_t arg_0x1ad62980){#line 53

unsigned char result;#line 53#line 53

result = HplRF230P$HplRF230$spiSplitReadWrite(arg_0x1ad62980);#line 53#line 53

return result;#line 53}#line 53# 94 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static __inline void HplRF230P$HplRF230$spiSplitWrite(uint8_t data){

* (volatile uint8_t *)(0X2E + 0x20) = data;}# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"inline static void RF230LayerP$HplRF230$spiSplitWrite(uint8_t arg_0x1ad62010){#line 41

HplRF230P$HplRF230$spiSplitWrite(arg_0x1ad62010);#line 41}#line 41# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)37U &= ˜(1 << 0);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$SELN$clr(void){#line 30

/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr();

#line 30}#line 30# 123 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static __inline void RF230LayerP$writeRegister(uint8_t reg, uint8_t value){

for (; 0; ) ;for (; 0; ) ;RF230LayerP$SELN$clr();RF230LayerP$HplRF230$spiSplitWrite(RF230_CMD_REGISTER_WRITE | reg);RF230LayerP$HplRF230$spiSplitReadWrite(value);RF230LayerP$HplRF230$spiSplitRead();RF230LayerP$SELN$set();

283

}# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$RF230Config$getDefaultChannel(void){

return 11;}# 66 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static uint8_t RF230LayerP$RF230Config$getDefaultChannel(void){#line 66

unsigned char result;#line 66#line 66

result = RF230ActiveMessageP$RF230Config$getDefaultChannel();#line 66#line 66

return result;#line 66}#line 66# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\micaz\\BusyWaitMicroC.nc"static __inline void BusyWaitMicroC$BusyWait$wait(uint16_t dt)#line 35{

if (dt) {__asm volatile ("1: sbiw %0,1\n"" adiw %0,1\n"" sbiw %0,1\n"" brne 1b" : "+w"(dt));}

}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\BusyWait.nc"inline static void RF230LayerP$BusyWait$wait(RF230LayerP$BusyWait$size_type arg_0x1ad79c98){#line 55

BusyWaitMicroC$BusyWait$wait(arg_0x1ad79c98);#line 55}#line 55# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)34U &= ˜(1 << 6);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void RF230LayerP$RSTN$clr(void){#line 30

/*HplAtm128GeneralIOC.PortA.Bit6*/HplAtm128GeneralIOPinP$6$IO$clr();

#line 30}#line 30# 210 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline void RF230LayerP$initRadio(void){

RF230LayerP$BusyWait$wait(510);RF230LayerP$RSTN$clr();RF230LayerP$SLP_TR$clr();RF230LayerP$BusyWait$wait(6);RF230LayerP$RSTN$set();RF230LayerP$writeRegister(RF230_TRX_CTRL_0, RF230_TRX_CTRL_0_VALUE);RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_TRX_OFF);RF230LayerP$BusyWait$wait(510);RF230LayerP$writeRegister(RF230_IRQ_MASK,((RF230_IRQ_TRX_UR | RF230_IRQ_PLL_LOCK) |RF230_IRQ_TRX_END) | RF230_IRQ_RX_START);RF230LayerP$writeRegister(RF230_CCA_THRES, RF230_CCA_THRES_VALUE);RF230LayerP$writeRegister

284

(RF230_PHY_TX_PWR, RF230_TX_AUTO_CRC_ON | RF230_TX_PWR_DEFAULT);RF230LayerP$txPower = RF230_TX_PWR_DEFAULT;RF230LayerP$channel = RF230LayerP$RF230Config$getDefaultChannel() &RF230_CHANNEL_MASK;RF230LayerP$writeRegister(RF230_PHY_CC_CCA, RF230_CCA_MODE_VALUE | RF230LayerP$channel);RF230LayerP$SLP_TR$set();RF230LayerP$state = RF230LayerP$STATE_SLEEP;

}static inline void RF230LayerP$SpiResource$granted(void){

RF230LayerP$SELN$makeOutput();RF230LayerP$SELN$set();if (RF230LayerP$state == RF230LayerP$STATE_P_ON)

{RF230LayerP$initRadio();RF230LayerP$SpiResource$release();

}else {

RF230LayerP$Tasklet$schedule();}

}# 340 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline void Atm128SpiP$Resource$default$granted(uint8_t id)#line 340{}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static void Atm128SpiP$Resource$granted(uint8_t arg_0x1ae4d8e0){#line 92

switch (arg_0x1ae4d8e0) {#line 92

case 0U:#line 92

RF230LayerP$SpiResource$granted();#line 92

break;#line 92

default:#line 92

Atm128SpiP$Resource$default$granted(arg_0x1ae4d8e0);#line 92

break;#line 92

}#line 92}#line 92# 336 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline void Atm128SpiP$ResourceArbiter$granted(uint8_t id)#line 336{

Atm128SpiP$Resource$granted(id);}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$granted(uint8_t arg_0x1af23d10){#line 92

Atm128SpiP$ResourceArbiter$granted(arg_0x1af23d10);#line 92}#line 92# 170 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(uint8_t id)#line 170{}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(uint8_t arg_0x1af20188){#line 49

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(arg_0x1af20188);

#line 49}#line 49# 154 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline void /*Atm128SpiC.Arbiter.Arbiter*/

285

SimpleArbiterP$0$grantedTask$runTask(void)#line 154{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 155

{/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$reqResId;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_BUSY;

}#line 158

__nesc_atomic_end(__nesc_atomic); }/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId);/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$granted(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId);

}static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(uint8_t id)#line 172{}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceConfigure.nc"inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(uint8_t arg_0x1af20188){#line 55

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(arg_0x1af20188);

#line 55}#line 55# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask);

#line 56#line 56

return result;#line 56}#line 56# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\FcfsResourceQueueC.nc"static inline resource_client_id_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$dequeue(void)#line 58{

/* atomic removed: atomic calls only */#line 59

{if (/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead != /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY) {

uint8_t id = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead;

#line 62/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead= /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ[/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead];if (/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead ==/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY) {

/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qTail = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;}

#line 65/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ[id] =/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;{unsigned char __nesc_temp =

#line 66id;

#line 66return __nesc_temp;

286

}}

#line 68{

unsigned char __nesc_temp =#line 68

/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;#line 68

return __nesc_temp;}

}}# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceQueue.nc"inline static resource_client_id_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$dequeue(void){#line 60

unsigned char result;#line 60#line 60

result = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$dequeue();

#line 60#line 60

return result;#line 60}#line 60# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\FcfsResourceQueueC.nc"static inline bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEmpty(void)#line 50{

return /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead ==/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;

}# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceQueue.nc"inline static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$isEmpty(void){#line 43

unsigned char result;#line 43#line 43

result = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEmpty();

#line 43#line 43

return result;#line 43}#line 43# 97 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(uint8_t id)#line 97{

bool released = FALSE;#line 99

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 99

{if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state ==/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_BUSY &&/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId == id) {if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$isEmpty() == FALSE) {

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$reqResId = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$dequeue();/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_GRANTING;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$postTask();

}else {

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$NO_RES;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_IDLE;

287

}released = TRUE;

}}

#line 112__nesc_atomic_end(__nesc_atomic); }

if (released == TRUE) {/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(id);return SUCCESS;

}return FAIL;

}# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t Atm128SpiP$ResourceArbiter$release(uint8_t arg_0x1ae49b10){#line 110

unsigned char result;#line 110#line 110

result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(arg_0x1ae49b10);

#line 110#line 110

return result;#line 110}#line 110# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ArbiterInfo.nc"inline static bool Atm128SpiP$ArbiterInfo$inUse(void){#line 80

unsigned char result;#line 80#line 80

result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse();

#line 80#line 80

return result;#line 80}#line 80# 142 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\McuSleepC.nc"static inline void McuSleepC$McuPowerState$update(void)#line 142{}# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerState.nc"inline static void Atm128SpiP$McuPowerState$update(void){#line 44

McuSleepC$McuPowerState$update();#line 44}#line 44# 94 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$sleep(void)#line 94{}# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$sleep(void){#line 72

HplAtm128SpiP$SPI$sleep();#line 72}#line 72#line 99inline static void Atm128SpiP$Spi$enableSpi(bool arg_0x1ae45480){#line 99

HplAtm128SpiP$SPI$enableSpi(arg_0x1ae45480);#line 99}#line 99# 119 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline void Atm128SpiP$stopSpi(void)#line 119{

Atm128SpiP$Spi$enableSpi(FALSE);/* atomic removed: atomic calls only */

#line 121

288

{Atm128SpiP$Spi$sleep();

}Atm128SpiP$McuPowerState$update();

}# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerState.nc"inline static void HplAtm128SpiP$Mcu$update(void){#line 44

McuSleepC$McuPowerState$update();#line 44}#line 44# 260 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$RadioAlarm$fired(void)#line 260{}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void RandomCollisionLayerP$RadioSend$sendDone(error_t arg_0x1ac23360){#line 45

TrafficMonitorLayerP$SubSend$sendDone(arg_0x1ac23360);#line 45}#line 45# 239 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getCongestionBackoff(message_t *msg){

return (uint16_t )(2240 * (7372800UL / 8 / 32 * (1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000.0));

}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"inline static uint16_t RandomCollisionLayerP$Config$getCongestionBackoff(message_t *arg_0x1a9681f8){#line 35

unsigned short result;#line 35#line 35

result = RF230ActiveMessageP$RandomCollisionConfig$getCongestionBackoff(arg_0x1a9681f8);

#line 35#line 35

return result;#line 35}#line 35# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static void SoftwareAckLayerP$SoftwareAckConfig$setAckReceived(message_t *arg_0x1a947450, bool arg_0x1a9475d8){#line 43

RF230ActiveMessageP$SoftwareAckConfig$setAckReceived(arg_0x1a947450, arg_0x1a9475d8);

#line 43}#line 43# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static error_t SoftwareAckLayerP$SubSend$send(message_t *arg_0x1ac24c88){#line 37

unsigned char result;#line 37#line 37

result = RF230LayerP$RadioSend$send(arg_0x1ac24c88);#line 37#line 37

return result;#line 37}#line 37# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline error_t SoftwareAckLayerP$RadioSend$send(message_t *msg){

error_t error;if (SoftwareAckLayerP$state == SoftwareAckLayerP$STATE_READY)

{if ((error = SoftwareAckLayerP$SubSend$send(msg)) == SUCCESS)

{

289

SoftwareAckLayerP$SoftwareAckConfig$setAckReceived(msg, FALSE);SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_DATA_SEND;SoftwareAckLayerP$txMsg = msg;

}}

else {error = EBUSY;}

return error;}# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static error_t RandomCollisionLayerP$SubSend$send(message_t *arg_0x1ac24c88){#line 37

unsigned char result;#line 37#line 37

result = SoftwareAckLayerP$RadioSend$send(arg_0x1ac24c88);#line 37#line 37

return result;#line 37}#line 37# 195 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$RadioSend$ready(void){

if (MessageBufferLayerP$state == MessageBufferLayerP$STATE_TX_PENDING) {

MessageBufferLayerP$sendTask$postTask();}

}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void TrafficMonitorLayerP$RadioSend$ready(void){#line 52

MessageBufferLayerP$RadioSend$ready();#line 52}#line 52# 81 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$SubSend$ready(void){

TrafficMonitorLayerP$RadioSend$ready();}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void RandomCollisionLayerP$RadioSend$ready(void){#line 52

TrafficMonitorLayerP$SubSend$ready();#line 52}#line 52# 70 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline uint16_t HplAtm1281Timer1P$Timer$get(void)#line 70{#line 70

return * (volatile uint16_t *)0x84;}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get(void){#line 52

unsigned short result;#line 52#line 52

result = HplAtm1281Timer1P$Timer$get();#line 52#line 52

return result;#line 52}#line 52# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$getNow(void)

290

#line 53{

return /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get();

}# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static RadioAlarmP$Alarm$size_type RadioAlarmP$Alarm$getNow(void){#line 98

unsigned short result;#line 98#line 98

result = /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$getNow();

#line 98#line 98

return result;#line 98}#line 98# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static __inline uint16_t RadioAlarmP$RadioAlarm$getNow(uint8_t id){

return RadioAlarmP$Alarm$getNow();}# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static uint16_t RandomCollisionLayerP$RadioAlarm$getNow(void){#line 53

unsigned short result;#line 53#line 53

result = RadioAlarmP$RadioAlarm$getNow(1U);#line 53#line 53

return result;#line 53}#line 53# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline void RandomCollisionLayerP$RadioAlarm$fired(void){

error_t error;int16_t delay;for (; 0; ) ;delay = (int16_t )RandomCollisionLayerP$txBarrier -RandomCollisionLayerP$RadioAlarm$getNow();if (RandomCollisionLayerP$state ==RandomCollisionLayerP$STATE_BARRIER){RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_READY;RandomCollisionLayerP$RadioSend$ready();return;

}else {

#line 115if (RandomCollisionLayerP$state &RandomCollisionLayerP$STATE_BARRIER && delay > 0) {error = EBUSY;}

else {#line 118

error = RandomCollisionLayerP$SubSend$send(RandomCollisionLayerP$txMsg);}

}#line 120

if (error != SUCCESS){if ((RandomCollisionLayerP$state &˜RandomCollisionLayerP$STATE_BARRIER) ==RandomCollisionLayerP$STATE_TX_PENDING_FIRST){

RandomCollisionLayerP$state =(RandomCollisionLayerP$state &RandomCollisionLayerP$STATE_BARRIER) |RandomCollisionLayerP$STATE_TX_PENDING_SECOND;RandomCollisionLayerP$RadioAlarm$wait(RandomCollisionLayerP$getBackoff(RandomCollisionLayerP$Config$

291

getCongestionBackoff(RandomCollisionLayerP$txMsg)));}

else{if (RandomCollisionLayerP$state &RandomCollisionLayerP$STATE_BARRIER && delay > 0){RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_BARRIER;RandomCollisionLayerP$RadioAlarm$wait(delay);

}else {RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_READY;}

RandomCollisionLayerP$RadioSend$sendDone(error);}

}else {

RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_TX_SENDING;}

}#line 144static inline void RandomCollisionLayerP$SubSend$sendDone(error_t error){

for (; 0; ) ;RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_READY;RandomCollisionLayerP$RadioSend$sendDone(error);

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void SoftwareAckLayerP$RadioSend$sendDone(error_t arg_0x1ac23360){#line 45

RandomCollisionLayerP$SubSend$sendDone(arg_0x1ac23360);#line 45}#line 45# 124 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$TrafficMonitorConfig$channelError(void){

if (TrafficMonitorLayerP$errorAverage < 255) {++TrafficMonitorLayerP$errorAverage;}

}# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"inline static void RF230ActiveMessageP$TrafficMonitorConfig$channelError(void){#line 50

TrafficMonitorLayerP$TrafficMonitorConfig$channelError();#line 50}#line 50# 137 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$SoftwareAckConfig$reportChannelError(void){

RF230ActiveMessageP$TrafficMonitorConfig$channelError();}# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static void SoftwareAckLayerP$SoftwareAckConfig$reportChannelError(void){#line 74

RF230ActiveMessageP$SoftwareAckConfig$reportChannelError();#line 74}#line 74# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline void SoftwareAckLayerP$RadioAlarm$fired(void){

for (; 0; ) ;SoftwareAckLayerP$SoftwareAckConfig$reportChannelError();SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_READY;SoftwareAckLayerP$RadioSend$sendDone(SUCCESS);

}# 537 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

292

\\chips\\rf230\\RF230LayerP.nc"static inline void RF230LayerP$RadioCCA$default$done(error_t error)#line 537{}# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioCCA.nc"inline static void RF230LayerP$RadioCCA$done(error_t arg_0x1ac3a920){#line 41

RF230LayerP$RadioCCA$default$done(arg_0x1ac3a920);#line 41}#line 41# 135 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static __inline uint8_t RF230LayerP$readRegister(uint8_t reg){

for (; 0; ) ;for (; 0; ) ;RF230LayerP$SELN$clr();RF230LayerP$HplRF230$spiSplitWrite(RF230_CMD_REGISTER_READ | reg);RF230LayerP$HplRF230$spiSplitReadWrite(0);reg = RF230LayerP$HplRF230$spiSplitRead();RF230LayerP$SELN$set();return reg;

}#line 160static inline void RF230LayerP$RadioAlarm$fired(void){

if (RF230LayerP$state == RF230LayerP$STATE_SLEEP_2_TRX_OFF) {RF230LayerP$state = RF230LayerP$STATE_TRX_OFF;}

else {#line 164

if (RF230LayerP$cmd == RF230LayerP$CMD_CCA){

uint8_t cca;for (; 0; ) ;RF230LayerP$cmd = RF230LayerP$CMD_NONE;cca = RF230LayerP$readRegister(RF230_TRX_STATUS);for (; 0; ) ;RF230LayerP$RadioCCA$done(cca & RF230_CCA_DONE ? cca & RF230_CCA_STATUS ? SUCCESS : EBUSY : FAIL);

}else {

for (; 0; ) ;}

}RF230LayerP$Tasklet$schedule();

}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static inline void RadioAlarmP$RadioAlarm$default$fired(uint8_t id){}# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static void RadioAlarmP$RadioAlarm$fired(uint8_t arg_0x1abccd98){#line 48

switch (arg_0x1abccd98) {#line 48

case 0U:#line 48

RF230ActiveMessageP$RadioAlarm$fired();#line 48

break;#line 48

case 1U:#line 48

RandomCollisionLayerP$RadioAlarm$fired();#line 48

break;#line 48

case 2U:#line 48

SoftwareAckLayerP$RadioAlarm$fired();#line 48

break;#line 48

case 3U:#line 48

RF230LayerP$RadioAlarm$fired();#line 48

break;#line 48

default:#line 48

293

RadioAlarmP$RadioAlarm$default$fired(arg_0x1abccd98);#line 48

break;#line 48

}#line 48}#line 48# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static inline void RadioAlarmP$Tasklet$run(void){

if (RadioAlarmP$state == RadioAlarmP$STATE_FIRED){RadioAlarmP$state = RadioAlarmP$STATE_READY;RadioAlarmP$RadioAlarm$fired(RadioAlarmP$alarm);

}}# 201 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$Tasklet$run(void){}# 171 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$Tasklet$run(void){}# 82 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static __inline bool RadioAlarmP$RadioAlarm$isFree(uint8_t id){

return RadioAlarmP$state == RadioAlarmP$STATE_READY;}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static bool RandomCollisionLayerP$RadioAlarm$isFree(void){#line 33

unsigned char result;#line 33#line 33

result = RadioAlarmP$RadioAlarm$isFree(1U);#line 33#line 33

return result;#line 33}#line 33# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline void RandomCollisionLayerP$SubSend$ready(void){

if (RandomCollisionLayerP$state ==RandomCollisionLayerP$STATE_READY &&RandomCollisionLayerP$RadioAlarm$isFree()) {

RandomCollisionLayerP$RadioSend$ready();}

}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void SoftwareAckLayerP$RadioSend$ready(void){#line 52

RandomCollisionLayerP$SubSend$ready();#line 52}#line 52# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline void SoftwareAckLayerP$SubSend$ready(void){

if (SoftwareAckLayerP$state == SoftwareAckLayerP$STATE_READY) {SoftwareAckLayerP$RadioSend$ready();}

}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void RF230LayerP$RadioSend$ready(void){#line 52

SoftwareAckLayerP$SubSend$ready();#line 52}#line 52# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t MessageBufferLayerP$stateDoneTask$postTask(void){

294

#line 56unsigned char result;

#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(MessageBufferLayerP$stateDoneTask);

#line 56#line 56

return result;#line 56}#line 56# 117 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$RadioState$done(void){

MessageBufferLayerP$stateDoneTask$postTask();}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"inline static void TrafficMonitorLayerP$RadioState$done(void){#line 58

MessageBufferLayerP$RadioState$done();#line 58}#line 58# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t TrafficMonitorLayerP$startStopTimer$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(TrafficMonitorLayerP$startStopTimer);

#line 56#line 56

return result;#line 56}#line 56# 237 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$SubState$done(void){

TrafficMonitorLayerP$startStopTimer$postTask();TrafficMonitorLayerP$RadioState$done();

}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"inline static void RF230LayerP$RadioState$done(void){#line 58

TrafficMonitorLayerP$SubState$done();#line 58}#line 58# 287 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static __inline void RF230LayerP$changeChannel(void){

for (; 0; ) ;for (; 0; ) ;if (RF230LayerP$isSpiAcquired())

{RF230LayerP$writeRegister(RF230_PHY_CC_CCA,RF230_CCA_MODE_VALUE | RF230LayerP$channel);if (RF230LayerP$state == RF230LayerP$STATE_RX_ON) {

RF230LayerP$state = RF230LayerP$STATE_TRX_OFF_2_RX_ON;}

else {#line 299

RF230LayerP$cmd = RF230LayerP$CMD_SIGNAL_DONE;}

}}# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static inline void HplRF230P$IRQ$disable(void){

HplRF230P$Capture$stop();}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"inline static void RF230LayerP$IRQ$disable(void){#line 55

295

HplRF230P$IRQ$disable();#line 55}#line 55# 145 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Capture$start(void)#line 145{#line 145

* (volatile uint8_t *)0x6F |= 1 << 5;}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static void HplRF230P$Capture$start(void){#line 58

HplAtm1281Timer1P$Capture$start();#line 58}#line 58# 139 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Capture$reset(void)#line 139{#line 139

* (volatile uint8_t *)(0x16 + 0x20) = 1 << 5;}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static void HplRF230P$Capture$reset(void){#line 55

HplAtm1281Timer1P$Capture$reset();#line 55}#line 55# 135 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$Capture$setEdge(bool up)#line 135{#line 135

if (up) {#line 135

* (volatile uint8_t *)0x81 |= 1 << 6;}

else {#line 135

* (volatile uint8_t *)0x81 &= ˜(1 << 6);}

}# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static void HplRF230P$Capture$setEdge(bool arg_0x1ab09b48){#line 79

HplAtm1281Timer1P$Capture$setEdge(arg_0x1ab09b48);#line 79}#line 79# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static inline error_t HplRF230P$IRQ$captureRisingEdge(void){

HplRF230P$Capture$setEdge(TRUE);HplRF230P$Capture$reset();HplRF230P$Capture$start();return SUCCESS;

}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"inline static error_t RF230LayerP$IRQ$captureRisingEdge(void){#line 42

unsigned char result;#line 42#line 42

result = HplRF230P$IRQ$captureRisingEdge();#line 42#line 42

return result;#line 42}#line 42# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$start

296

(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size dt){

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get(), dt);

}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void RadioAlarmP$Alarm$start(RadioAlarmP$Alarm$size_type arg_0x1a633438){#line 55

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$start(arg_0x1a633438);

#line 55}#line 55# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static inline void RadioAlarmP$RadioAlarm$wait(uint8_t id, uint16_t timeout){

for (; 0; ) ;RadioAlarmP$alarm = id;RadioAlarmP$state = RadioAlarmP$STATE_WAIT;RadioAlarmP$Alarm$start(timeout);

}# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static void RF230LayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20){#line 38

RadioAlarmP$RadioAlarm$wait(3U, arg_0x1a995d20);#line 38}#line 38#line 33inline static bool RF230LayerP$RadioAlarm$isFree(void){#line 33

unsigned char result;#line 33#line 33

result = RadioAlarmP$RadioAlarm$isFree(3U);#line 33#line 33

return result;#line 33}#line 33# 305 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static __inline void RF230LayerP$changeState(void){

if ((#line 307

RF230LayerP$cmd == RF230LayerP$CMD_STANDBY ||RF230LayerP$cmd == RF230LayerP$CMD_TURNON)&& RF230LayerP$state ==RF230LayerP$STATE_SLEEP && RF230LayerP$RadioAlarm$isFree()){RF230LayerP$SLP_TR$clr();RF230LayerP$RadioAlarm$wait(RF230LayerP$SLEEP_WAKEUP_TIME);RF230LayerP$state = RF230LayerP$STATE_SLEEP_2_TRX_OFF;

}else {

#line 315if (RF230LayerP$cmd == RF230LayerP$CMD_TURNON &&RF230LayerP$state == RF230LayerP$STATE_TRX_OFF&& RF230LayerP$isSpiAcquired()){for (; 0; ) ;RF230LayerP$readRegister(RF230_IRQ_STATUS);RF230LayerP$IRQ$captureRisingEdge();RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_RX_ON);RF230LayerP$state = RF230LayerP$STATE_TRX_OFF_2_RX_ON;

}else {

if ((#line 325

RF230LayerP$cmd == RF230LayerP$CMD_TURNOFF ||RF230LayerP$cmd == RF230LayerP$CMD_STANDBY)&& RF230LayerP$state == RF230LayerP$STATE_RX_ON &&RF230LayerP$isSpiAcquired()){

RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_FORCE_TRX_OFF);RF230LayerP$IRQ$disable();RF230LayerP$radioIrq = FALSE;

297

RF230LayerP$state = RF230LayerP$STATE_TRX_OFF;}

}}

#line 336if (RF230LayerP$cmd == RF230LayerP$CMD_TURNOFF &&RF230LayerP$state == RF230LayerP$STATE_TRX_OFF)

{RF230LayerP$SLP_TR$set();RF230LayerP$state = RF230LayerP$STATE_SLEEP;RF230LayerP$cmd = RF230LayerP$CMD_SIGNAL_DONE;

}else {

#line 342if (RF230LayerP$cmd == RF230LayerP$CMD_STANDBY &&RF230LayerP$state == RF230LayerP$STATE_TRX_OFF) {RF230LayerP$cmd = RF230LayerP$CMD_SIGNAL_DONE;}

}}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t MessageBufferLayerP$deliverTask$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(MessageBufferLayerP$deliverTask);

#line 56#line 56

return result;#line 56}#line 56# 298 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline message_t *MessageBufferLayerP$RadioReceive$receive(message_t *msg){

message_t *m;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{if (MessageBufferLayerP$receiveQueueSize >=MessageBufferLayerP$RECEIVE_QUEUE_SIZE) {

m = msg;}

else {uint8_t index = MessageBufferLayerP$receiveQueueHead +MessageBufferLayerP$receiveQueueSize;

#line 309if (index >= MessageBufferLayerP$RECEIVE_QUEUE_SIZE) {index -= MessageBufferLayerP$RECEIVE_QUEUE_SIZE;}

m = MessageBufferLayerP$receiveQueue[index];MessageBufferLayerP$receiveQueue[index] = msg;++MessageBufferLayerP$receiveQueueSize;MessageBufferLayerP$deliverTask$postTask();

}}

#line 318__nesc_atomic_end(__nesc_atomic); }

return m;}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static message_t *UniqueLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8){#line 42

nx_struct message_t *result;#line 42#line 42

result = MessageBufferLayerP$RadioReceive$receive(arg_0x1ac3dab8);#line 42#line 42

return result;#line 42}#line 42# 152 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"static __inline void NeighborhoodP$NeighborhoodFlag$set(uint8_t bit, uint8_t index){

NeighborhoodP$flags[index] |= 1 << bit;

298

}# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"inline static void UniqueLayerP$NeighborhoodFlag$set(uint8_t arg_0x1ac90590){#line 40

NeighborhoodP$NeighborhoodFlag$set(0U, arg_0x1ac90590);#line 40}#line 40# 159 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$UniqueConfig$reportChannelError(void){

RF230ActiveMessageP$TrafficMonitorConfig$channelError();}# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"inline static void UniqueLayerP$UniqueConfig$reportChannelError(void){#line 47

RF230ActiveMessageP$UniqueConfig$reportChannelError();#line 47}#line 47# 147 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"static __inline bool NeighborhoodP$NeighborhoodFlag$get(uint8_t bit, uint8_t index){

return NeighborhoodP$flags[index] & (1 << bit);}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"inline static bool UniqueLayerP$NeighborhoodFlag$get(uint8_t arg_0x1ac900b8){#line 35

unsigned char result;#line 35#line 35

result = NeighborhoodP$NeighborhoodFlag$get(0U, arg_0x1ac900b8);#line 35#line 35

return result;#line 35}#line 35# 154 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline uint8_t IEEE154PacketP$IEEE154Packet$getDSN(message_t *msg){

return __nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->dsn);

}# 124 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static uint8_t RF230ActiveMessageP$IEEE154Packet$getDSN(message_t *arg_0x1a986010){#line 124

unsigned char result;#line 124#line 124

result = IEEE154PacketP$IEEE154Packet$getDSN(arg_0x1a986010);#line 124#line 124

return result;#line 124}#line 124# 144 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$UniqueConfig$getSequenceNumber(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$getDSN(msg);}# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"inline static uint8_t UniqueLayerP$UniqueConfig$getSequenceNumber(message_t *arg_0x1a9412c8){#line 31

unsigned char result;#line 31#line 31

result = RF230ActiveMessageP$UniqueConfig$

299

getSequenceNumber(arg_0x1a9412c8);#line 31#line 31

return result;#line 31}#line 31# 184 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline uint16_t IEEE154PacketP$IEEE154Packet$getSrcAddr(message_t *msg){

return __nesc_ntoh_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->src);

}# 155 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static uint16_t RF230ActiveMessageP$IEEE154Packet$getSrcAddr(message_t *arg_0x1a983388){#line 155

unsigned short result;#line 155#line 155

result = IEEE154PacketP$IEEE154Packet$getSrcAddr(arg_0x1a983388);#line 155#line 155

return result;#line 155}#line 155# 154 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline am_addr_t RF230ActiveMessageP$UniqueConfig$getSender(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$getSrcAddr(msg);}# 36 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueConfig.nc"inline static am_addr_t UniqueLayerP$UniqueConfig$getSender(message_t *arg_0x1a9417d8){#line 36

unsigned short result;#line 36#line 36

result = RF230ActiveMessageP$UniqueConfig$getSender(arg_0x1a9417d8);#line 36#line 36

return result;#line 36}#line 36# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"inline static uint8_t UniqueLayerP$Neighborhood$insertNode(am_addr_t arg_0x1ac95c40){#line 60

unsigned char result;#line 60#line 60

result = NeighborhoodP$Neighborhood$insertNode(arg_0x1ac95c40);#line 60#line 60

return result;#line 60}#line 60# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline message_t *UniqueLayerP$SubReceive$receive(message_t *msg){

uint8_t index = UniqueLayerP$Neighborhood$insertNode(UniqueLayerP$UniqueConfig$getSender(msg));uint8_t dsn = UniqueLayerP$UniqueConfig$getSequenceNumber(msg);if (UniqueLayerP$NeighborhoodFlag$get(index))

{uint8_t diff = dsn - UniqueLayerP$receivedNumbers[index];if (diff == 0){

UniqueLayerP$UniqueConfig$reportChannelError();return msg;

}}

else {UniqueLayerP$NeighborhoodFlag$set(index);

300

}UniqueLayerP$receivedNumbers[index] = dsn;return UniqueLayerP$RadioReceive$receive(msg);

}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static message_t *TrafficMonitorLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8){#line 42

nx_struct message_t *result;#line 42#line 42

result = UniqueLayerP$SubReceive$receive(arg_0x1ac3dab8);#line 42#line 42

return result;#line 42}#line 42# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"inline static void TrafficMonitorLayerP$NeighborhoodFlag$set(uint8_t arg_0x1ac90590){#line 40

NeighborhoodP$NeighborhoodFlag$set(1U, arg_0x1ac90590);#line 40}#line 40#line 35inline static bool TrafficMonitorLayerP$NeighborhoodFlag$get(uint8_t arg_0x1ac900b8){#line 35

unsigned char result;#line 35#line 35

result = NeighborhoodP$NeighborhoodFlag$get(1U, arg_0x1ac900b8);

#line 35#line 35

return result;#line 35}#line 35# 208 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline am_addr_t RF230ActiveMessageP$TrafficMonitorConfig$getSender(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$getSrcAddr(msg);}# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"inline static am_addr_t TrafficMonitorLayerP$TrafficMonitorConfig$getSender(message_t *arg_0x1a954b08){#line 43

unsigned short result;#line 43#line 43

result = RF230ActiveMessageP$TrafficMonitorConfig$getSender(arg_0x1a954b08);

#line 43#line 43

return result;#line 43}#line 43# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"inline static uint8_t TrafficMonitorLayerP$Neighborhood$insertNode(am_addr_t arg_0x1ac95c40){#line 60

unsigned char result;#line 60#line 60

result = NeighborhoodP$Neighborhood$insertNode(arg_0x1ac95c40);#line 60#line 60

return result;#line 60}#line 60# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"inline static uint16_t TrafficMonitorLayerP$TrafficMonitorConfig$getChannelTime(message_t *arg_0x1a9545e0){#line 37

unsigned short result;

301

#line 37#line 37

result = RF230ActiveMessageP$TrafficMonitorConfig$getChannelTime(arg_0x1a9545e0);

#line 37#line 37

return result;#line 37}#line 37# 105 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline message_t *TrafficMonitorLayerP$SubReceive$receive(message_t *msg){

uint8_t index;TrafficMonitorLayerP$rxAverage += TrafficMonitorLayerP$TrafficMonitorConfig$getChannelTime(msg);index = TrafficMonitorLayerP$Neighborhood$insertNode(TrafficMonitorLayerP$TrafficMonitorConfig$getSender(msg));if (!TrafficMonitorLayerP$NeighborhoodFlag$get(index))

{if (TrafficMonitorLayerP$neighborCount <TrafficMonitorLayerP$TRAFFIC_MONITOR_UINT8_MAX)

{++TrafficMonitorLayerP$neighborCount;TrafficMonitorLayerP$NeighborhoodFlag$set(index);

}}

return TrafficMonitorLayerP$RadioReceive$receive(msg);}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static message_t *RandomCollisionLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8){#line 42

nx_struct message_t *result;#line 42#line 42

result = TrafficMonitorLayerP$SubReceive$receive(arg_0x1ac3dab8);#line 42#line 42

return result;#line 42}#line 42# 196 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static bool RF230ActiveMessageP$IEEE154Packet$requiresAckReply(message_t *arg_0x1a981db0){#line 196

unsigned char result;#line 196#line 196

result = IEEE154PacketP$IEEE154Packet$requiresAckReply(arg_0x1a981db0);#line 196#line 196

return result;#line 196}#line 196# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static uint16_t RF230ActiveMessageP$RadioAlarm$getNow(void){#line 53

unsigned short result;#line 53#line 53

result = RadioAlarmP$RadioAlarm$getNow(0U);#line 53#line 53

return result;#line 53}#line 53# 244 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getTransmitBarrier(message_t *msg){

uint16_t time;time = RF230ActiveMessageP$RadioAlarm$getNow();if (RF230ActiveMessageP$IEEE154Packet$requiresAckReply(msg)) {

time += (uint16_t )(32 * (-5 + 16 + 11 + 5) * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000.0));}

302

else {#line 255

time += (uint16_t )(32 * (-5 + 5) * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000.0));}

return time;}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"inline static uint16_t RandomCollisionLayerP$Config$getTransmitBarrier(message_t *arg_0x1a968ac0){#line 46

unsigned short result;#line 46#line 46

result = RF230ActiveMessageP$RandomCollisionConfig$getTransmitBarrier(arg_0x1a968ac0);

#line 46#line 46

return result;#line 46}#line 46# 157 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline message_t *RandomCollisionLayerP$SubReceive$receive(message_t *msg){

int16_t delay;RandomCollisionLayerP$txBarrier = RandomCollisionLayerP$Config$getTransmitBarrier(msg);delay = RandomCollisionLayerP$txBarrier -RandomCollisionLayerP$RadioAlarm$getNow();if (delay > 0)

{if (RandomCollisionLayerP$state ==RandomCollisionLayerP$STATE_READY)

{RandomCollisionLayerP$RadioAlarm$wait(delay);RandomCollisionLayerP$state =RandomCollisionLayerP$STATE_BARRIER;

}else {

RandomCollisionLayerP$state |=RandomCollisionLayerP$STATE_BARRIER;}

}return RandomCollisionLayerP$RadioReceive$receive(msg);

}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static message_t *SoftwareAckLayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8){#line 42

nx_struct message_t *result;#line 42#line 42

result = RandomCollisionLayerP$SubReceive$receive(arg_0x1ac3dab8);#line 42#line 42

return result;#line 42}#line 42# 111 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline void IEEE154PacketP$IEEE154Packet$createAckReply(message_t *data, message_t *ack){

ieee154_header_t *header = IEEE154PacketP$getHeader(ack);__nesc_hton_leuint8((unsigned char *)&header->length,IEEE154PacketP$IEEE154_ACK_FRAME_LENGTH);__nesc_hton_leuint16((unsigned char *)&header->fcf,IEEE154PacketP$IEEE154_ACK_FRAME_VALUE);__nesc_hton_leuint8((unsigned char *)&header->dsn,__nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(data)->dsn));

}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static void RF230ActiveMessageP$IEEE154Packet$createAckReply(message_t *arg_0x1a971838, message_t *arg_0x1a9719e8){#line 92

IEEE154PacketP$IEEE154Packet$createAckReply(arg_0x1a971838, arg_0x1a9719e8);

303

#line 92}#line 92# 119 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$SoftwareAckConfig$createAckPacket(message_t *data, message_t *ack){

RF230ActiveMessageP$IEEE154Packet$createAckReply(data, ack);}# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static void SoftwareAckLayerP$SoftwareAckConfig$createAckPacket(message_t *arg_0x1a945e08, message_t *arg_0x1a944010){#line 68

RF230ActiveMessageP$SoftwareAckConfig$createAckPacket(arg_0x1a945e08, arg_0x1a944010);

#line 68}#line 68# 114 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckReply(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$requiresAckReply(msg);}# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static bool SoftwareAckLayerP$SoftwareAckConfig$requiresAckReply(message_t *arg_0x1a9458d0){#line 63

unsigned char result;#line 63#line 63

result = RF230ActiveMessageP$SoftwareAckConfig$requiresAckReply(arg_0x1a9458d0);

#line 63#line 63

return result;#line 63}#line 63# 152 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareA$stop(void)#line 152{#line 152

* (volatile uint8_t *)0x6F &= ˜(1 << 1);}# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop(void){#line 59

HplAtm1281Timer1P$CompareA$stop();#line 59}#line 59# 65 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$stop(void)#line 65{

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop();}# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void RadioAlarmP$Alarm$stop(void){#line 62

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$stop();#line 62}#line 62# 96 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static inline void RadioAlarmP$RadioAlarm$cancel(uint8_t id){

for (; 0; ) ;for (; 0; ) ;RadioAlarmP$Alarm$stop();RadioAlarmP$state = RadioAlarmP$STATE_READY;

}# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

304

\\chips\\rf230\\RadioAlarm.nc"inline static void SoftwareAckLayerP$RadioAlarm$cancel(void){#line 43

RadioAlarmP$RadioAlarm$cancel(2U);#line 43}#line 43# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline bool IEEE154PacketP$IEEE154Packet$isAckFrame(message_t *msg){

return (__nesc_ntoh_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->fcf) & IEEE154PacketP$IEEE154_ACK_FRAME_MASK) ==IEEE154PacketP$IEEE154_ACK_FRAME_VALUE;

}# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static bool RF230ActiveMessageP$IEEE154Packet$isAckFrame(message_t *arg_0x1a972d18){#line 79

unsigned char result;#line 79#line 79

result = IEEE154PacketP$IEEE154Packet$isAckFrame(arg_0x1a972d18);#line 79#line 79

return result;#line 79}#line 79# 104 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline bool RF230ActiveMessageP$SoftwareAckConfig$isAckPacket(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$isAckFrame(msg);}# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static bool SoftwareAckLayerP$SoftwareAckConfig$isAckPacket(message_t *arg_0x1a947b00){#line 50

unsigned char result;#line 50#line 50

result = RF230ActiveMessageP$SoftwareAckConfig$isAckPacket(arg_0x1a947b00);

#line 50#line 50

return result;#line 50}#line 50# 128 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline message_t *SoftwareAckLayerP$SubReceive$receive(message_t *msg){

bool ack = SoftwareAckLayerP$SoftwareAckConfig$isAckPacket(msg);for (; 0; ) ;if (SoftwareAckLayerP$state == SoftwareAckLayerP$STATE_ACK_WAIT)

{for (; 0; ) ;SoftwareAckLayerP$RadioAlarm$cancel();SoftwareAckLayerP$SoftwareAckConfig$setAckReceived(SoftwareAckLayerP$txMsg, ack);SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_READY;SoftwareAckLayerP$RadioSend$sendDone(SUCCESS);

}if (ack) {

return msg;}

if (SoftwareAckLayerP$SoftwareAckConfig$requiresAckReply(msg))

{SoftwareAckLayerP$SoftwareAckConfig$createAckPacket(msg, &SoftwareAckLayerP$ackMsg);if (SoftwareAckLayerP$SubSend$send(&SoftwareAckLayerP$ackMsg) == SUCCESS) {SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_ACK_SEND;}

else {#line 156

for (; 0; ) ;}

305

}return SoftwareAckLayerP$RadioReceive$receive(msg);

}# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static message_t *RF230LayerP$RadioReceive$receive(message_t *arg_0x1ac3dab8){#line 42

nx_struct message_t *result;#line 42#line 42

result = SoftwareAckLayerP$SubReceive$receive(arg_0x1ac3dab8);#line 42#line 42

return result;#line 42}#line 42# 135 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void RF230PacketP$PacketLinkQuality$set(message_t *msg, uint8_t value){

RF230PacketP$getMeta(msg)->lqi = value;}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static void RF230LayerP$PacketLinkQuality$set(message_t *arg_0x1a8a8c00,RF230LayerP$PacketLinkQuality$value_type arg_0x1a8a8d90){#line 46

RF230PacketP$PacketLinkQuality$set(arg_0x1a8a8c00, arg_0x1a8a8d90);

#line 46}#line 46# 250 "C:\\Crossbow\\cygwin\\usr\\local\\avr\\include\\util\\crc16.h"#line 249static __inline uint16_t_crc_ccitt_update(uint16_t __crc, uint8_t __data){

uint16_t __ret;__asm volatile ("eor %A0,%1""\n\t""mov __tmp_reg__,%A0""\n\t""swap %A0""\n\t""andi %A0,0xf0""\n\t""eor %A0,__tmp_reg__""\n\t""mov __tmp_reg__,%B0""\n\t""mov %B0,%A0""\n\t""swap %A0""\n\t""andi %A0,0x0f""\n\t""eor __tmp_reg__,%A0""\n\t""lsr %A0""\n\t""eor %B0,%A0""\n\t""eor %A0,%B0""\n\t""lsl %A0""\n\t""lsl %A0""\n\t""lsl %A0""\n\t""eor %A0,__tmp_reg__" :"=d"(__ret) :"r"(__data), "0"(__crc) :"r0");return __ret;

}# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static __inline uint16_t HplRF230P$HplRF230$crcByte(uint16_t crc, uint8_t data){

return _crc_ccitt_update(crc, data);}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"inline static uint16_t RF230LayerP$HplRF230$crcByte(uint16_t arg_0x1ad638f8, uint8_t arg_0x1ad63a80){#line 33

unsigned short result;#line 33#line 33

result = HplRF230P$HplRF230$crcByte(arg_0x1ad638f8, arg_0x1ad63a80);

#line 33

306

#line 33return result;

#line 33}#line 33# 257 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline bool MessageBufferLayerP$RadioReceive$header(message_t *msg){

bool notFull;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 262notFull = MessageBufferLayerP$receiveQueueSize <MessageBufferLayerP$RECEIVE_QUEUE_SIZE;

#line 262__nesc_atomic_end(__nesc_atomic); }

return notFull;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static bool UniqueLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0){#line 35

unsigned char result;#line 35#line 35

result = MessageBufferLayerP$RadioReceive$header(arg_0x1ac3d3e0);

#line 35#line 35

return result;#line 35}#line 35# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline bool UniqueLayerP$SubReceive$header(message_t *msg){

return UniqueLayerP$RadioReceive$header(msg);}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static bool TrafficMonitorLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0){#line 35

unsigned char result;#line 35#line 35

result = UniqueLayerP$SubReceive$header(arg_0x1ac3d3e0);#line 35#line 35

return result;#line 35}#line 35# 100 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline bool TrafficMonitorLayerP$SubReceive$header(message_t *msg){

return TrafficMonitorLayerP$RadioReceive$header(msg);}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static bool RandomCollisionLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0){#line 35

unsigned char result;#line 35#line 35

result = TrafficMonitorLayerP$SubReceive$header(arg_0x1ac3d3e0);#line 35#line 35

return result;#line 35}#line 35# 152 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline bool RandomCollisionLayerP$SubReceive$header(message_t *msg){

return RandomCollisionLayerP$RadioReceive$header(msg);}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos

307

\\chips\\rf230\\RadioReceive.nc"inline static bool SoftwareAckLayerP$RadioReceive$header(message_t *arg_0x1ac3d3e0){#line 35

unsigned char result;#line 35#line 35

result = RandomCollisionLayerP$SubReceive$header(arg_0x1ac3d3e0);#line 35#line 35

return result;#line 35}#line 35# 120 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline bool IEEE154PacketP$IEEE154Packet$verifyAckReply(message_t *data, message_t *ack){

ieee154_header_t *header = IEEE154PacketP$getHeader(ack);return __nesc_ntoh_leuint8((unsigned char *)&header->dsn) ==__nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(data)->dsn)&& (__nesc_ntoh_leuint16((unsigned char *)&header->fcf) &IEEE154PacketP$IEEE154_ACK_FRAME_MASK) ==IEEE154PacketP$IEEE154_ACK_FRAME_VALUE;

}# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static bool RF230ActiveMessageP$IEEE154Packet$verifyAckReply(message_t *arg_0x1a989010,message_t *arg_0x1a9891c0){#line 98

unsigned char result;#line 98#line 98

result = IEEE154PacketP$IEEE154Packet$verifyAckReply(arg_0x1a989010, arg_0x1a9891c0);

#line 98#line 98

return result;#line 98}#line 98# 109 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline bool RF230ActiveMessageP$SoftwareAckConfig$verifyAckPacket(message_t *data, message_t *ack){

return RF230ActiveMessageP$IEEE154Packet$verifyAckReply(data, ack);}# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static bool SoftwareAckLayerP$SoftwareAckConfig$verifyAckPacket(message_t *arg_0x1a945120, message_t *arg_0x1a9452d0){#line 57

unsigned char result;#line 57#line 57

result = RF230ActiveMessageP$SoftwareAckConfig$verifyAckPacket(arg_0x1a945120, arg_0x1a9452d0);

#line 57#line 57

return result;#line 57}#line 57# 120 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline bool SoftwareAckLayerP$SubReceive$header(message_t *msg){

if (SoftwareAckLayerP$SoftwareAckConfig$isAckPacket(msg)) {return SoftwareAckLayerP$state ==SoftwareAckLayerP$STATE_ACK_WAIT &&SoftwareAckLayerP$SoftwareAckConfig$verifyAckPacket(SoftwareAckLayerP$txMsg, msg);

}else {

#line 125return SoftwareAckLayerP$RadioReceive$header(msg);}

}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioReceive.nc"inline static bool RF230LayerP$RadioReceive$

308

header(message_t *arg_0x1ac3d3e0){#line 35

unsigned char result;#line 35#line 35

result = SoftwareAckLayerP$SubReceive$header(arg_0x1ac3d3e0);#line 35#line 35

return result;#line 35}#line 35# 75 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$RF230Config$getHeaderLength(void){

return 7;}# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static uint8_t RF230LayerP$RF230Config$getHeaderLength(void){#line 55

unsigned char result;#line 55#line 55

result = RF230ActiveMessageP$RF230Config$getHeaderLength();#line 55#line 55

return result;#line 55}#line 55# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline ieee154_header_t *IEEE154PacketP$IEEE154Packet$getHeader(message_t *msg){

return IEEE154PacketP$getHeader(msg);}# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static ieee154_header_t *RF230ActiveMessageP$IEEE154Packet$getHeader(message_t *arg_0x1a975498){#line 39

nx_struct ieee154_header_t *result;#line 39#line 39

result = IEEE154PacketP$IEEE154Packet$getHeader(arg_0x1a975498);

#line 39#line 39

return result;#line 39}#line 39# 65 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t *RF230ActiveMessageP$RF230Config$getPayload(message_t *msg){

return (uint8_t *)RF230ActiveMessageP$IEEE154Packet$getHeader(msg) + 1;

}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static uint8_t *RF230LayerP$RF230Config$getPayload(message_t *arg_0x1a934a08){#line 46

unsigned char *result;#line 46#line 46

result = RF230ActiveMessageP$RF230Config$getPayload(arg_0x1a934a08);

#line 46#line 46

return result;#line 46}#line 46# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static void RF230ActiveMessageP$IEEE154Packet$setLength(message_t *arg_0x1a975ee0, uint8_t arg_0x1a973088){#line 49

IEEE154PacketP$IEEE154Packet$

309

setLength(arg_0x1a975ee0, arg_0x1a973088);#line 49}#line 49# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$RF230Config$setLength(message_t *msg, uint8_t len){

RF230ActiveMessageP$IEEE154Packet$setLength(msg, len);}# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static void RF230LayerP$RF230Config$setLength(message_t *arg_0x1a934378, uint8_t arg_0x1a934500){#line 39

RF230ActiveMessageP$RF230Config$setLength(arg_0x1a934378, arg_0x1a934500);

#line 39}#line 39# 81 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$RF230Config$getMaxLength(void){

return sizeof(rf230packet_header_t ) - 1 + 28 +sizeof(ieee154_footer_t );

}# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static uint8_t RF230LayerP$RF230Config$getMaxLength(void){#line 60

unsigned char result;#line 60#line 60

result = RF230ActiveMessageP$RF230Config$getMaxLength();

#line 60#line 60

return result;#line 60}#line 60# 121 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static __inline uint8_t HplRF230P$HplRF230$spiWrite(uint8_t data){

* (volatile uint8_t *)(0X2E + 0x20) = data;while (!(* (volatile uint8_t *)(0x2D + 0x20) & 0x80))

;return * (volatile uint8_t *)(0X2E + 0x20);

}# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230.nc"inline static uint8_t RF230LayerP$HplRF230$spiWrite(uint8_t arg_0x1ad62e90){#line 59

unsigned char result;#line 59#line 59

result = HplRF230P$HplRF230$spiWrite(arg_0x1ad62e90);#line 59#line 59

return result;#line 59}#line 59# 541 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static __inline void RF230LayerP$downloadMessage(void){

uint8_t length;uint16_t crc;RF230LayerP$SELN$clr();RF230LayerP$HplRF230$spiWrite(RF230_CMD_FRAME_READ);length = RF230LayerP$HplRF230$spiWrite(0);if (length >= 3 && length <= RF230LayerP$RF230Config$getMaxLength())

{uint8_t read;uint8_t *data;RF230LayerP$HplRF230$spiSplitWrite(0);

310

RF230LayerP$RF230Config$setLength(RF230LayerP$rxMsg, length);data = RF230LayerP$RF230Config$getPayload(RF230LayerP$rxMsg);crc = 0;length -= 2;read = RF230LayerP$RF230Config$getHeaderLength();if (length < read) {

read = length;}

length -= read;do {

crc = RF230LayerP$HplRF230$crcByte(crc, * data++ = RF230LayerP$HplRF230$spiSplitReadWrite(0));

}while (--read != 0);if (RF230LayerP$RadioReceive$header(RF230LayerP$rxMsg))

{while (length-- != 0)crc = RF230LayerP$HplRF230$crcByte(crc, * data++= RF230LayerP$HplRF230$spiSplitReadWrite(0));

crc = RF230LayerP$HplRF230$crcByte(crc, RF230LayerP$HplRF230$spiSplitReadWrite(0));crc = RF230LayerP$HplRF230$crcByte(crc, RF230LayerP$HplRF230$spiSplitReadWrite(0));RF230LayerP$PacketLinkQuality$set(RF230LayerP$rxMsg, RF230LayerP$HplRF230$spiSplitRead());

}else {crc = 1;}

}else {

#line 593crc = 1;}

RF230LayerP$SELN$set();RF230LayerP$state = RF230LayerP$STATE_RX_ON;

#line 613RF230LayerP$cmd = RF230LayerP$CMD_NONE;if (crc == 0) {

RF230LayerP$rxMsg = RF230LayerP$RadioReceive$receive(RF230LayerP$rxMsg);}

}# 227 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void RF230PacketP$PacketRSSI$clear(message_t *msg){

RF230PacketP$getMeta(msg)->flags &= ˜RF230PACKET_RSSI;}# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static void RF230LayerP$PacketRSSI$clear(message_t *arg_0x1a8a8718){#line 40

RF230PacketP$PacketRSSI$clear(arg_0x1a8a8718);#line 40}#line 40# 232 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void RF230PacketP$PacketRSSI$set(message_t *msg, uint8_t value){

RF230PacketP$getMeta(msg)->flags &= ˜RF230PACKET_TXPOWER;RF230PacketP$getMeta(msg)->flags |= RF230PACKET_RSSI;RF230PacketP$getMeta(msg)->power = value;

}# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static void RF230LayerP$PacketRSSI$set(message_t *arg_0x1a8a8c00, RF230LayerP$PacketRSSI$value_type arg_0x1a8a8d90){#line 46

RF230PacketP$PacketRSSI$set(arg_0x1a8a8c00, arg_0x1a8a8d90);#line 46}#line 46# 132 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$SoftwareAckConfig$getAckTimeout(void){

return (uint16_t )(800 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000.0));

}

311

# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static uint16_t SoftwareAckLayerP$SoftwareAckConfig$getAckTimeout(void){#line 32

unsigned short result;#line 32#line 32

result = RF230ActiveMessageP$SoftwareAckConfig$getAckTimeout();

#line 32#line 32

return result;#line 32}#line 32# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static void SoftwareAckLayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20){#line 38

RadioAlarmP$RadioAlarm$wait(2U, arg_0x1a995d20);#line 38}#line 38#line 33inline static bool SoftwareAckLayerP$RadioAlarm$isFree(void){#line 33

unsigned char result;#line 33#line 33

result = RadioAlarmP$RadioAlarm$isFree(2U);#line 33#line 33

return result;#line 33}#line 33# 128 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline bool IEEE154PacketP$IEEE154Packet$getAckRequired(message_t *msg){

return __nesc_ntoh_leuint16((unsigned char *)&IEEE154PacketP$getHeader(msg)->fcf) & (1 << IEEE154_FCF_ACK_REQ);

}#line 218static inline bool IEEE154PacketP$IEEE154Packet$requiresAckWait(message_t *msg){

return IEEE154PacketP$IEEE154Packet$getAckRequired(msg)&& IEEE154PacketP$IEEE154Packet$isDataFrame(msg)&& IEEE154PacketP$IEEE154Packet$getDestAddr(msg) != 0xFFFF;

}# 190 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static bool RF230ActiveMessageP$IEEE154Packet$requiresAckWait(message_t *arg_0x1a981848){#line 190

unsigned char result;#line 190#line 190

result = IEEE154PacketP$IEEE154Packet$requiresAckWait(arg_0x1a981848);

#line 190#line 190

return result;#line 190}#line 190# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline bool RF230ActiveMessageP$SoftwareAckConfig$requiresAckWait(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$requiresAckWait(msg);}# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckConfig.nc"inline static bool SoftwareAckLayerP$SoftwareAckConfig$requiresAckWait(message_t *arg_0x1a948ef0){#line 38

unsigned char result;#line 38#line 38

result = RF230ActiveMessageP$SoftwareAckConfig$

312

requiresAckWait(arg_0x1a948ef0);#line 38#line 38

return result;#line 38}#line 38# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SoftwareAckLayerP.nc"static inline void SoftwareAckLayerP$SubSend$sendDone(error_t error){

if (SoftwareAckLayerP$state == SoftwareAckLayerP$STATE_ACK_SEND){for (; 0; ) ;SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_READY;

}else

{for (; 0; ) ;for (; 0; ) ;if (error == SUCCESS &&SoftwareAckLayerP$SoftwareAckConfig$requiresAckWait(SoftwareAckLayerP$txMsg) &&SoftwareAckLayerP$RadioAlarm$isFree()){SoftwareAckLayerP$RadioAlarm$wait(SoftwareAckLayerP$SoftwareAckConfig$getAckTimeout());SoftwareAckLayerP$state =SoftwareAckLayerP$STATE_ACK_WAIT;

}else

{SoftwareAckLayerP$state = SoftwareAckLayerP$STATE_READY;SoftwareAckLayerP$RadioSend$sendDone(error);

}}

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void RF230LayerP$RadioSend$sendDone(error_t arg_0x1ac23360){#line 45

SoftwareAckLayerP$SubSend$sendDone(arg_0x1ac23360);#line 45}#line 45# 152 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void RF230PacketP$PacketTimeStampRadio$clear(message_t *msg){

RF230PacketP$getMeta(msg)->flags &= ˜RF230PACKET_TIMESTAMP;}# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\PacketTimeStamp.nc"inline static void RF230LayerP$PacketTimeStamp$clear(message_t *arg_0x1a8e38f8){#line 59

RF230PacketP$PacketTimeStampRadio$clear(arg_0x1a8e38f8);#line 59}#line 59inline static void RF230LayerP$PacketTimeStamp$set(message_t *arg_0x1a8e3e20,RF230LayerP$PacketTimeStamp$size_type arg_0x1a8e2010){#line 67

RF230PacketP$PacketTimeStampRadio$set(arg_0x1a8e3e20, arg_0x1a8e2010);#line 67}#line 67# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$size_type /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$get(void){#line 53

unsigned long result;#line 53#line 53

result = /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$get();

#line 53#line 53

return result;#line 53}

313

#line 53# 42 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\CounterToLocalTimeC.nc"static inline uint32_t /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$LocalTime$get(void){

return /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$get();

}# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\LocalTime.nc"inline static uint32_t RF230LayerP$LocalTime$get(void){#line 50

unsigned long result;#line 50#line 50

result = /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$LocalTime$get();

#line 50#line 50

return result;#line 50}#line 50# 635 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline void RF230LayerP$serviceRadio(void){

if (RF230LayerP$isSpiAcquired()){

uint16_t time;uint32_t time32;uint8_t irq;uint8_t temp;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 644time = RF230LayerP$capturedTime;

#line 644__nesc_atomic_end(__nesc_atomic); }

RF230LayerP$radioIrq = FALSE;irq = RF230LayerP$readRegister(RF230_IRQ_STATUS);

#line 666if (irq & RF230_IRQ_PLL_LOCK)

{if (RF230LayerP$cmd == RF230LayerP$CMD_TURNON ||RF230LayerP$cmd == RF230LayerP$CMD_CHANNEL){for (; 0; ) ;RF230LayerP$state = RF230LayerP$STATE_RX_ON;RF230LayerP$cmd = RF230LayerP$CMD_SIGNAL_DONE;

}else {

#line 675if (RF230LayerP$cmd == RF230LayerP$CMD_TRANSMIT){for (; 0; ) ;

}else {for (; 0; ) ;}

}}

#line 683if (irq & RF230_IRQ_RX_START)

{if (RF230LayerP$cmd == RF230LayerP$CMD_CCA){RF230LayerP$RadioCCA$done(FAIL);RF230LayerP$cmd = RF230LayerP$CMD_NONE;

}if (RF230LayerP$cmd == RF230LayerP$CMD_NONE){for (; 0; ) ;if (irq == RF230_IRQ_RX_START){temp = RF230LayerP$readRegister(RF230_PHY_RSSI) &RF230_RSSI_MASK;RF230LayerP$rssiBusy +=temp - (RF230LayerP$rssiBusy >> 2);

}#line 717

if (irq == RF230_IRQ_RX_START){time32 = RF230LayerP$LocalTime$get();time32 +=(int16_t )(time - RF230LayerP$RX_SFD_DELAY) - (int16_t )time32;

314

RF230LayerP$PacketTimeStamp$set(RF230LayerP$rxMsg, time32);

}else {RF230LayerP$PacketTimeStamp$clear(RF230LayerP$rxMsg);}

RF230LayerP$cmd = RF230LayerP$CMD_RECEIVE;}

else {for (; 0; ) ;}

}if (irq & RF230_IRQ_TRX_END)

{if (RF230LayerP$cmd == RF230LayerP$CMD_TRANSMIT){for (; 0; ) ;RF230LayerP$state = RF230LayerP$STATE_RX_ON;RF230LayerP$cmd = RF230LayerP$CMD_NONE;RF230LayerP$RadioSend$sendDone(SUCCESS);for (; 0; ) ;

}else {

#line 745if (RF230LayerP$cmd == RF230LayerP$CMD_RECEIVE){for (; 0; ) ;if (irq == RF230_IRQ_TRX_END) {RF230LayerP$PacketRSSI$set(RF230LayerP$rxMsg,RF230LayerP$readRegister(RF230_PHY_ED_LEVEL));}

else {#line 752

RF230LayerP$PacketRSSI$clear(RF230LayerP$rxMsg);}

if (RF230LayerP$state == RF230LayerP$STATE_PLL_ON_2_RX_ON){for (; 0; ) ;RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_RX_ON);RF230LayerP$state =RF230LayerP$STATE_RX_ON;

}else{RF230LayerP$rssiClear +=(RF230LayerP$readRegister(RF230_PHY_RSSI) & RF230_RSSI_MASK)- (RF230LayerP$rssiClear >> 2);

}RF230LayerP$cmd = RF230LayerP$CMD_DOWNLOAD;

}else {for (; 0; ) ;}

}}

}}static inline void RF230LayerP$Tasklet$run(void){

if (RF230LayerP$radioIrq) {RF230LayerP$serviceRadio();}

if (RF230LayerP$cmd != RF230LayerP$CMD_NONE){

if (RF230LayerP$cmd == RF230LayerP$CMD_DOWNLOAD) {RF230LayerP$downloadMessage();}

else {#line 796

if (RF230LayerP$CMD_TURNOFF <= RF230LayerP$cmd &&RF230LayerP$cmd <= RF230LayerP$CMD_TURNON) {RF230LayerP$changeState();}

else {#line 798

if (RF230LayerP$cmd == RF230LayerP$CMD_CHANNEL) {RF230LayerP$changeChannel();}

}}

#line 801if (RF230LayerP$cmd == RF230LayerP$CMD_SIGNAL_DONE)

{

315

RF230LayerP$cmd = RF230LayerP$CMD_NONE;RF230LayerP$RadioState$done();

}}

if (RF230LayerP$cmd == RF230LayerP$CMD_NONE && RF230LayerP$state ==RF230LayerP$STATE_RX_ON && !RF230LayerP$radioIrq) {RF230LayerP$RadioSend$ready();}

if (RF230LayerP$cmd == RF230LayerP$CMD_NONE) {RF230LayerP$SpiResource$release();}

}# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void TaskletC$Tasklet$run(void){#line 37

RF230LayerP$Tasklet$run();#line 37

TrafficMonitorLayerP$Tasklet$run();#line 37

MessageBufferLayerP$Tasklet$run();#line 37

RadioAlarmP$Tasklet$run();#line 37}#line 37# 147 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline uint8_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$isOwner(uint8_t id)#line 147{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 148

{if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId ==id && /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state ==/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_BUSY) {

unsigned char __nesc_temp =#line 149

TRUE;{

#line 149__nesc_atomic_end(__nesc_atomic);

#line 149return __nesc_temp;

}}

else#line 150

{unsigned char __nesc_temp =

#line 150FALSE;{

#line 150__nesc_atomic_end(__nesc_atomic);

#line 150return __nesc_temp;

}}

}#line 153

__nesc_atomic_end(__nesc_atomic); }}# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static bool Atm128SpiP$ResourceArbiter$isOwner(uint8_t arg_0x1ae49b10){#line 118

unsigned char result;#line 118#line 118

result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$isOwner(arg_0x1ae49b10);

#line 118#line 118

return result;#line 118}#line 118# 332 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline uint8_t Atm128SpiP$Resource$isOwner(uint8_t id)#line 332{

return Atm128SpiP$ResourceArbiter$isOwner(id);}

316

# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static bool RF230LayerP$SpiResource$isOwner(void){#line 118

unsigned char result;#line 118#line 118

result = Atm128SpiP$Resource$isOwner(0U);#line 118#line 118

return result;#line 118}#line 118# 168 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(uint8_t id)#line 168{}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$immediateRequested(uint8_t arg_0x1af22688){#line 51

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(arg_0x1af22688);

#line 51}#line 51# 84 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(uint8_t id)#line 84{

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$immediateRequested(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId);{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 86{if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state ==/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_IDLE) {

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_BUSY;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId = id;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId);{unsigned char __nesc_temp =

#line 91SUCCESS;{

#line 91__nesc_atomic_end(__nesc_atomic);

#line 91return __nesc_temp;

}}

}#line 93

{unsigned char __nesc_temp =

#line 93FAIL;{

#line 93__nesc_atomic_end(__nesc_atomic);

#line 93return __nesc_temp;

}}

}#line 96

__nesc_atomic_end(__nesc_atomic); }}# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t Atm128SpiP$ResourceArbiter$immediateRequest(uint8_t arg_0x1ae49b10){#line 87

unsigned char result;#line 87

317

#line 87result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(arg_0x1ae49b10);

#line 87#line 87

return result;#line 87}#line 87# 305 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline error_t Atm128SpiP$Resource$immediateRequest(uint8_t id)#line 305{

error_t result = Atm128SpiP$ResourceArbiter$immediateRequest(id);#line 307

if (result == SUCCESS) {Atm128SpiP$startSpi();

}return result;

}# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t RF230LayerP$SpiResource$immediateRequest(void){#line 87

unsigned char result;#line 87#line 87

result = Atm128SpiP$Resource$immediateRequest(0U);#line 87#line 87

return result;#line 87}#line 87# 156 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$setMasterBit(bool isMaster)#line 156{

if (isMaster) {* (volatile uint8_t *)(0x2C + 0x20) |= 1 << 4;

}else {

* (volatile uint8_t *)(0x2C + 0x20) &= ˜(1 << 4);}

}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit1*/HplAtm128GeneralIOPinP$9$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)36U |= 1 << 1;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplAtm128SpiP$SCK$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortB.Bit1*/HplAtm128GeneralIOPinP$9$IO$makeOutput();

#line 35}#line 35# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortB.Bit3*/HplAtm128GeneralIOPinP$11$IO$makeInput(void)#line 50{#line 50

* (volatile uint8_t *)36U &= ˜(1 << 3);}# 33 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplAtm128SpiP$MISO$makeInput(void){#line 33

/*HplAtm128GeneralIOC.PortB.Bit3*/HplAtm128GeneralIOPinP$11$IO$makeInput();

#line 33}#line 33# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"

318

static __inline void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void)#line 52{#line 52

* (volatile uint8_t *)36U |= 1 << 2;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void HplAtm128SpiP$MOSI$makeOutput(void){#line 35

/*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput();

#line 35}#line 35# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$initMaster(void)#line 79{

HplAtm128SpiP$MOSI$makeOutput();HplAtm128SpiP$MISO$makeInput();HplAtm128SpiP$SCK$makeOutput();HplAtm128SpiP$SPI$setMasterBit(TRUE);

}# 66 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$initMaster(void){#line 66

HplAtm128SpiP$SPI$initMaster();#line 66}#line 66# 213 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool on)#line 213{

if (on) {* (volatile uint8_t *)(0x2D + 0x20) |= 1 << 0;

}else {

* (volatile uint8_t *)(0x2D + 0x20) &= ˜(1 << 0);}

}# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$setMasterDoubleSpeed(bool arg_0x1ae40db0){#line 125

HplAtm128SpiP$SPI$setMasterDoubleSpeed(arg_0x1ae40db0);#line 125}#line 125# 169 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$setClockPolarity(bool highWhenIdle)#line 169{

if (highWhenIdle) {* (volatile uint8_t *)(0x2C + 0x20) |= 1 << 3;

}else {

* (volatile uint8_t *)(0x2C + 0x20) &= ˜(1 << 3);}

}# 108 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$setClockPolarity(bool arg_0x1ae43c90){#line 108

HplAtm128SpiP$SPI$setClockPolarity(arg_0x1ae43c90);#line 108}#line 108# 183 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$setClockPhase(bool sampleOnTrailing)#line 183{

if (sampleOnTrailing) {* (volatile uint8_t *)(0x2C + 0x20) |= 1 << 2;

}

319

else {* (volatile uint8_t *)(0x2C + 0x20) &= ˜(1 << 2);

}}# 111 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$setClockPhase(bool arg_0x1ae42490){#line 111

HplAtm128SpiP$SPI$setClockPhase(arg_0x1ae42490);#line 111}#line 111# 200 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$setClock(uint8_t v)#line 200{

v &= 1 | 0;* (volatile uint8_t *)(0x2C + 0x20) =(* (volatile uint8_t *)(0x2C + 0x20) & ˜(1 | 0)) | v;

}# 114 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$setClock(uint8_t arg_0x1ae42c58){#line 114

HplAtm128SpiP$SPI$setClock(arg_0x1ae42c58);#line 114}#line 114# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\FcfsResourceQueueC.nc"static inline bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEnqueued(resource_client_id_t id)#line 54{

return /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ[id] !=/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY ||/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qTail == id;

}#line 72static inline error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(resource_client_id_t id)#line 72{

/* atomic removed: atomic calls only */#line 73

{if (!/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEnqueued(id)) {

if (/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead == /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY) {/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qHead = id;}

else {#line 78

/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ[/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qTail] = id;}

#line 79/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$qTail = id;{unsigned char __nesc_temp =

#line 80SUCCESS;

#line 80return __nesc_temp;

}}

#line 82{

unsigned char __nesc_temp =#line 82

EBUSY;#line 82

return __nesc_temp;}

}}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceQueue.nc"inline static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(resource_client_id_t arg_0x1af2d208){

320

#line 69unsigned char result;

#line 69#line 69

result = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(arg_0x1af2d208);

#line 69#line 69

return result;#line 69}#line 69# 166 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(uint8_t id)#line 166{}# 43 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\ResourceRequested.nc"inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$requested(uint8_t arg_0x1af22688){#line 43

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(arg_0x1af22688);

#line 43}#line 43# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(uint8_t id)#line 71{

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$requested(/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$resId);{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 73{if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state ==/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_IDLE) {

/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state =/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_GRANTING;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$reqResId= id;/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$postTask();{unsigned char __nesc_temp =

#line 78SUCCESS;{

#line 78__nesc_atomic_end(__nesc_atomic);

#line 78return __nesc_temp;

}}

}#line 80

{unsigned char __nesc_temp =

#line 80/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(id);{

#line 80__nesc_atomic_end(__nesc_atomic);

#line 80return __nesc_temp;

}}

}#line 83

__nesc_atomic_end(__nesc_atomic); }}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t Atm128SpiP$ResourceArbiter$request(uint8_t arg_0x1ae49b10){

321

#line 78unsigned char result;

#line 78#line 78

result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(arg_0x1ae49b10);

#line 78#line 78

return result;#line 78}#line 78# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$get(void){#line 52

unsigned short result;#line 52#line 52

result = HplAtm1281Timer1P$Timer$get();#line 52#line 52

return result;#line 52}#line 52# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128CounterC.nc"static inline /*CounterOne16C.NCounter*/Atm128CounterC$0$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$get(void){

return /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$get();}# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$size_type /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$get(void){#line 53

unsigned short result;#line 53#line 53

result = /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$get();

#line 53#line 53

return result;#line 53}#line 53# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline uint8_t HplAtm1281Timer1P$TimerCtrl$getInterruptFlag(void)#line 125{

return * (volatile uint8_t *)(0x16 + 0x20);}#line 156static inline bool HplAtm1281Timer1P$Timer$test(void)#line 156{

return ((Atm128_TIFR_t )HplAtm1281Timer1P$TimerCtrl$getInterruptFlag()).bits.tov;

}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static bool /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$test(void){#line 78

unsigned char result;#line 78#line 78

result = HplAtm1281Timer1P$Timer$test();#line 78#line 78

return result;#line 78}#line 78# 46 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128CounterC.nc"static inline bool /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$isOverflowPending(void)

322

{return /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$test();

}# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static bool /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$isOverflowPending(void){#line 60

unsigned char result;#line 60#line 60

result = /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$isOverflowPending();

#line 60#line 60

return result;#line 60}#line 60# 194 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareA$set(uint16_t t)#line 194{#line 194

* (volatile uint16_t *)0x88 = t;}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type arg_0x1a6924f0){#line 45

HplAtm1281Timer1P$CompareA$set(arg_0x1a6924f0);#line 45}#line 45# 140 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareA$reset(void)#line 140{#line 140

* (volatile uint8_t *)(0x16 + 0x20) = 1 << 1;}# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset(void){#line 53

HplAtm1281Timer1P$CompareA$reset();#line 53}#line 53# 146 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareA$start(void)#line 146{#line 146

* (volatile uint8_t *)0x6F |= 1 << 1;}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start(void){#line 56

HplAtm1281Timer1P$CompareA$start();#line 56}#line 56# 103 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static bool RF230ActiveMessageP$IEEE154Packet$getAckRequired(message_t *arg_0x1a989768){#line 103

unsigned char result;#line 103#line 103

result = IEEE154PacketP$IEEE154Packet$getAckRequired(arg_0x1a989768);#line 103#line 103

return result;#line 103}#line 103

323

# 170 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$RadioSend$sendDone(error_t error){

for (; 0; ) ;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 174MessageBufferLayerP$txError = error;

#line 174__nesc_atomic_end(__nesc_atomic); }

MessageBufferLayerP$sendTask$postTask();}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static void TrafficMonitorLayerP$RadioSend$sendDone(error_t arg_0x1ac23360){#line 45

MessageBufferLayerP$RadioSend$sendDone(arg_0x1ac23360);#line 45}#line 45# 70 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static __inline rf230packet_metadata_t *RF230ActiveMessageP$getMeta(message_t *msg){

return (rf230packet_metadata_t *)msg->metadata;}# 193 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline bool RF230PacketP$PacketTransmitPower$isSet(message_t *msg){

return RF230PacketP$getMeta(msg)->flags & RF230PACKET_TXPOWER;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static bool RF230LayerP$PacketTransmitPower$isSet(message_t *arg_0x1a890c68){#line 29

unsigned char result;#line 29#line 29

result = RF230PacketP$PacketTransmitPower$isSet(arg_0x1a890c68);#line 29#line 29

return result;#line 29}#line 29# 198 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline uint8_t RF230PacketP$PacketTransmitPower$get(message_t *msg){

return RF230PacketP$getMeta(msg)->power;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static RF230LayerP$PacketTransmitPower$value_type RF230LayerP$PacketTransmitPower$get(message_t *arg_0x1a8a8190){#line 35

unsigned char result;#line 35#line 35

result = RF230PacketP$PacketTransmitPower$get(arg_0x1a8a8190);#line 35#line 35

return result;#line 35}#line 35# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline bool RF230ActiveMessageP$RF230Config$requiresRssiCca(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$isDataFrame(msg);}# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static bool RF230LayerP$RF230Config$requiresRssiCca(message_t *arg_0x1a932c88){#line 72

324

unsigned char result;#line 72#line 72

result = RF230ActiveMessageP$RF230Config$requiresRssiCca(arg_0x1a932c88);

#line 72#line 72

return result;#line 72}#line 72# 241 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline bool RF230PacketP$PacketTimeSyncOffset$isSet(message_t *msg){

return RF230PacketP$getMeta(msg)->flags & RF230PACKET_TIMESYNC;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static bool RF230LayerP$PacketTimeSyncOffset$isSet(message_t *arg_0x1a890c68){#line 29

unsigned char result;#line 29#line 29

result = RF230PacketP$PacketTimeSyncOffset$isSet(arg_0x1a890c68);

#line 29#line 29

return result;#line 29}#line 29# 246 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline uint8_t RF230PacketP$PacketTimeSyncOffset$get(message_t *msg){

return RF230PacketP$IEEE154Packet$getLength(msg) -RF230PacketP$PACKET_LENGTH_INCREASE - sizeof(timesync_absolute_t );

}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static RF230LayerP$PacketTimeSyncOffset$value_type RF230LayerP$PacketTimeSyncOffset$get(message_t *arg_0x1a8a8190){#line 35

unsigned char result;#line 35#line 35

result = RF230PacketP$PacketTimeSyncOffset$get(arg_0x1a8a8190);#line 35#line 35

return result;#line 35}#line 35# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"inline static uint16_t RF230LayerP$RadioAlarm$getNow(void){#line 53

unsigned short result;#line 53#line 53

result = RadioAlarmP$RadioAlarm$getNow(3U);#line 53#line 53

return result;#line 53}#line 53# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static uint8_t RF230ActiveMessageP$IEEE154Packet$getLength(message_t *arg_0x1a9759d0){#line 44

unsigned char result;#line 44#line 44

result = IEEE154PacketP$IEEE154Packet$getLength(arg_0x1a9759d0);#line 44#line 44

return result;#line 44}#line 44

325

# 55 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint8_t RF230ActiveMessageP$RF230Config$getLength(message_t *msg){

return RF230ActiveMessageP$IEEE154Packet$getLength(msg);}# 34 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230Config.nc"inline static uint8_t RF230LayerP$RF230Config$getLength(message_t *arg_0x1a938d68){#line 34

unsigned char result;#line 34#line 34

result = RF230ActiveMessageP$RF230Config$getLength(arg_0x1a938d68);

#line 34#line 34

return result;#line 34}#line 34# 301 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint32_t __nesc_hton_uint32(void *target, uint32_t value)#line 301{

uint8_t *base = target;#line 303

base[3] = value;base[2] = value >> 8;base[1] = value >> 16;base[0] = value >> 24;return value;

}#line 326static __inline int32_t __nesc_hton_int32(void *target, int32_t value)#line 326{#line 326

__nesc_hton_uint32(target, value);#line 326

return value;}#line 294static __inline uint32_t __nesc_ntoh_uint32(const void *source)#line 294{

const uint8_t *base = source;#line 296

return ((((uint32_t )base[0] << 24) | ((uint32_t )base[1] << 16)) | ((uint32_t )base[2] << 8)) | base[3];

}#line 326static __inline int32_t __nesc_ntoh_int32(const void *source)#line 326{#line 326

return __nesc_ntoh_uint32(source);}# 115 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline void UniqueLayerP$Neighborhood$evicted(uint8_t index)#line 115{}# 195 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$Neighborhood$evicted(uint8_t index)#line 195{}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Neighborhood.nc"inline static void NeighborhoodP$Neighborhood$evicted(uint8_t arg_0x1ac93270){#line 69

TrafficMonitorLayerP$Neighborhood$evicted(arg_0x1ac93270);#line 69

UniqueLayerP$Neighborhood$evicted(arg_0x1ac93270);#line 69

326

}#line 69# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t RandomCollisionLayerP$calcNextRandom$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(RandomCollisionLayerP$calcNextRandom);

#line 56#line 56

return result;#line 56}#line 56# 229 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getMinimumBackoff(void){

return (uint16_t )(320 *(7372800UL / 8 / 32 * (1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2)/ 1000000.0));

}# 40 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"inline static uint16_t RandomCollisionLayerP$Config$getMinimumBackoff(void){#line 40

unsigned short result;#line 40#line 40

result = RF230ActiveMessageP$RandomCollisionConfig$getMinimumBackoff();

#line 40#line 40

return result;#line 40}#line 40# 262 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline#line 261void Atm128SpiP$SpiPacket$default$sendDone(uint8_t *_txbuffer, uint8_t *_rxbuffer,uint16_t _length, error_t _success)#line 263{}# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SpiPacket.nc"inline static void Atm128SpiP$SpiPacket$sendDone(uint8_t *arg_0x1ae20390, uint8_t *arg_0x1ae20538,uint16_t arg_0x1ae206c8, error_t arg_0x1ae20860){#line 71

Atm128SpiP$SpiPacket$default$sendDone(arg_0x1ae20390, arg_0x1ae20538,arg_0x1ae206c8, arg_0x1ae20860);

#line 71}#line 71# 207 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static inline void Atm128SpiP$zeroTask$runTask(void)#line 207{

uint16_t myLen;uint8_t *rx;uint8_t *tx;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 212{myLen = Atm128SpiP$len;rx = Atm128SpiP$rxBuffer;tx = Atm128SpiP$txBuffer;Atm128SpiP$rxBuffer = (void *)0;Atm128SpiP$txBuffer = (void *)0;Atm128SpiP$len = 0;Atm128SpiP$pos = 0;Atm128SpiP$SpiPacket$sendDone(tx, rx, myLen, SUCCESS);

}

327

#line 221__nesc_atomic_end(__nesc_atomic); }

}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RandomMlcgC.nc"static inline uint16_t RandomMlcgC$Random$rand16(void)#line 78{

return (uint16_t )RandomMlcgC$Random$rand32();}# 41 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Random.nc"inline static uint16_t RandomCollisionLayerP$Random$rand16(void){#line 41

unsigned short result;#line 41#line 41

result = RandomMlcgC$Random$rand16();#line 41#line 41

return result;#line 41}#line 41# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline void RandomCollisionLayerP$calcNextRandom$runTask(void){

uint16_t a = RandomCollisionLayerP$Random$rand16();#line 70

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 70

RandomCollisionLayerP$nextRandom = a;#line 70

__nesc_atomic_end(__nesc_atomic); }}# 153 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(uint8_t num){

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num].isrunning = FALSE;

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void TrafficMonitorLayerP$Timer$stop(void){#line 67

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(1U);

#line 67}#line 67# 190 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getUpdatePeriod(void){

return RF230ActiveMessageP$TRAFFIC_UPDATE_PERIOD;}# 32 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"inline static uint16_t TrafficMonitorLayerP$TrafficMonitorConfig$getUpdatePeriod(void){#line 32

unsigned short result;#line 32#line 32

result = RF230ActiveMessageP$TrafficMonitorConfig$getUpdatePeriod();

#line 32#line 32

return result;#line 32}#line 32# 249 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getNow(void)#line 249{

return /*AlarmCounterMilliP.Atm128AlarmAsyncC.

328

Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$get();

}# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getNow(void){#line 98

unsigned long result;#line 98#line 98

result = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getNow();

#line 98#line 98

return result;#line 98}#line 98# 85 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"static inline uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$getNow(void){#line 86

return /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getNow();

}# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow(void){#line 125

unsigned long result;#line 125#line 125

result = /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$getNow();

#line 125#line 125

return result;#line 125}#line 125# 143 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(uint8_t num, uint32_t dt){

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$startTimer(num, /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow(), dt, FALSE);

}# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void TrafficMonitorLayerP$Timer$startPeriodic(uint32_t arg_0x1a5d0490){#line 53

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(1U, arg_0x1a5d0490);

#line 53}#line 53# 229 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$startStopTimer$runTask(void){

if (TrafficMonitorLayerP$radioCmd ==TrafficMonitorLayerP$RADIO_CMD_TURNON) {TrafficMonitorLayerP$Timer$startPeriodic(TrafficMonitorLayerP$TrafficMonitorConfig$getUpdatePeriod());}

else {#line 233

if (TrafficMonitorLayerP$radioCmd ==TrafficMonitorLayerP$RADIO_CMD_TURNOFF) {TrafficMonitorLayerP$Timer$stop();}

}}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask(void){

329

#line 56unsigned char result;

#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer);

#line 56#line 56

return result;#line 56}#line 56# 134 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline uint8_t HplAtm1281Timer2AsyncP$TimerCtrl$getInterruptFlag(void)#line 134{

return * (volatile uint8_t *)(0x17 + 0x20);}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl8.nc"inline staticuint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$getInterruptFlag(void){#line 69

unsigned char result;#line 69#line 69

result = HplAtm1281Timer2AsyncP$TimerCtrl$getInterruptFlag();#line 69#line 69

return result;#line 69}#line 69# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static uint8_t MessageBufferLayerP$Packet$payloadLength(message_t *arg_0x1a865ea8){#line 67

unsigned char result;#line 67#line 67

result = RF230PacketP$Packet$payloadLength(arg_0x1a865ea8);#line 67#line 67

return result;#line 67}#line 67# 90 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline void *RF230PacketP$Packet$getPayload(message_t *msg, uint8_t len){

if (len > 28) {return (void *)0;}

return msg->data;}# 115 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static void *MessageBufferLayerP$Packet$getPayload(message_t *arg_0x1a862358, uint8_t arg_0x1a8624e0){#line 115

void *result;#line 115#line 115

result = RF230PacketP$Packet$getPayload(arg_0x1a862358, arg_0x1a8624e0);

#line 115#line 115

return result;#line 115}#line 115# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"static inline message_t*IEEE154NetworkLayerP$NonTinyosReceive$default$receive(uint8_t network, message_t *msg, void *payload, uint8_t len){

return msg;}

330

# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"inline static message_t *IEEE154NetworkLayerP$NonTinyosReceive$receive(uint8_t arg_0x1ac03a10,message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588){#line 67

nx_struct message_t *result;#line 67#line 67

result = IEEE154NetworkLayerP$NonTinyosReceive$default$receive(arg_0x1ac03a10, arg_0x1a897260, arg_0x1a897400, arg_0x1a897588);

#line 67#line 67

return result;#line 67}#line 67# 103 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static inline message_t *ActiveMessageLayerC$Snoop$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len){

return msg;}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"inline static message_t *ActiveMessageLayerC$Snoop$receive(am_id_t arg_0x1abe93d0, message_t *arg_0x1a897260,void *arg_0x1a897400, uint8_t arg_0x1a897588){#line 67

nx_struct message_t *result;#line 67#line 67

result = ActiveMessageLayerC$Snoop$default$receive(arg_0x1abe93d0, arg_0x1a897260,arg_0x1a897400, arg_0x1a897588);

#line 67#line 67

return result;#line 67}#line 67# 264 "C:\\Crossbow\\cygwin\\lib\\ncc\\nesc_nx.h"static __inline uint16_t __nesc_ntoh_uint16(const void *source)#line 264{

const uint8_t *base = source;#line 266

return ((uint16_t )base[0] << 8) | base[1];}static __inline uint16_t __nesc_hton_uint16(void *target, uint16_t value)#line 269{

uint8_t *base = target;#line 271

base[1] = value;base[0] = value >> 8;return value;

}#line 288static __inline int16_t __nesc_hton_int16(void *target, int16_t value)#line 288{#line 288

__nesc_hton_uint16(target, value);#line 288

return value;}#line 240static __inline uint8_t __nesc_hton_uint8(void *target, uint8_t value)#line 240{

uint8_t *base = target;#line 242

base[0] = value;return value;

}#line 257static __inline int8_t __nesc_hton_int8(void *target, int8_t value)#line 257{#line 257

__nesc_hton_uint8(target, value);

331

#line 257return value;

}#line 235static __inline uint8_t __nesc_ntoh_uint8(const void *source)#line 235{

const uint8_t *base = source;#line 237

return base[0];}#line 257static __inline int8_t __nesc_ntoh_int8(const void *source)#line 257{#line 257

return __nesc_ntoh_uint8(source);}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"inline static error_t ForwardToBaseC$AMSend$send(am_addr_t arg_0x1a885e28,message_t *arg_0x1a884010, uint8_t arg_0x1a884198){#line 69

unsigned char result;#line 69#line 69

result = /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(arg_0x1a885e28, arg_0x1a884010, arg_0x1a884198);

#line 69#line 69

return result;#line 69}#line 69# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led2Off(void)#line 98{

LedsP$Led2$set();;

#line 100;

}# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led2Off(void){#line 83

LedsP$Leds$led2Off();#line 83}#line 83# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)34U &= ˜(1 << 0);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led2$clr(void){#line 30

/*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$clr();

#line 30}#line 30# 93 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led2On(void)#line 93{

LedsP$Led2$clr();;

#line 95;

}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led2On(void){#line 78

LedsP$Leds$led2On();#line 78}

332

#line 78# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led1Off(void)#line 83{

LedsP$Led1$set();;

#line 85;

}# 66 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led1Off(void){#line 66

LedsP$Leds$led1Off();#line 66}#line 66# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)34U &= ˜(1 << 1);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led1$clr(void){#line 30

/*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$clr();

#line 30}#line 30# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led1On(void)#line 78{

LedsP$Led1$clr();;

#line 80;

}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led1On(void){#line 61

LedsP$Leds$led1On();#line 61}#line 61# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led0Off(void)#line 68{

LedsP$Led0$set();;

#line 70;

}# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led0Off(void){#line 50

LedsP$Leds$led0Off();#line 50}#line 50# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$clr(void)#line 47{#line 47

* (volatile uint8_t *)34U &= ˜(1 << 2);}# 30 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led0$clr(void){#line 30

/*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$clr();

#line 30}

333

#line 30# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led0On(void)#line 63{

LedsP$Led0$clr();;

#line 65;

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led0On(void){#line 45

LedsP$Leds$led0On();#line 45}#line 45# 38 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$setLeds(uint16_t val)#line 38{

if (val & 0x01) {ForwardToBaseC$Leds$led0On();}

else {#line 42

ForwardToBaseC$Leds$led0Off();}

#line 43if (val & 0x02) {

ForwardToBaseC$Leds$led1On();}

else {#line 46

ForwardToBaseC$Leds$led1Off();}

#line 47if (val & 0x04) {

ForwardToBaseC$Leds$led2On();}

else {#line 50

ForwardToBaseC$Leds$led2Off();}

}# 222 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline uint8_t RF230PacketP$PacketRSSI$get(message_t *msg){

return RF230PacketP$getMeta(msg)->power;}# 35 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static ForwardToBaseC$PacketRSSI$value_typeForwardToBaseC$PacketRSSI$get(message_t *arg_0x1a8a8190){#line 35

unsigned char result;#line 35#line 35

result = RF230PacketP$PacketRSSI$get(arg_0x1a8a8190);#line 35#line 35

return result;#line 35}#line 35# 217 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static inline bool RF230PacketP$PacketRSSI$isSet(message_t *msg){

return RF230PacketP$getMeta(msg)->flags & RF230PACKET_RSSI;}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\PacketField.nc"inline static bool ForwardToBaseC$PacketRSSI$isSet(message_t *arg_0x1a890c68){#line 29

unsigned char result;#line 29#line 29

result = RF230PacketP$PacketRSSI$isSet(arg_0x1a890c68);#line 29#line 29

return result;#line 29

334

}#line 29# 127 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline uint16_t ForwardToBaseC$getRssi(message_t *msg)#line 127{

if (ForwardToBaseC$PacketRSSI$isSet(msg)) {return (uint16_t )ForwardToBaseC$PacketRSSI$get(msg);}

else {#line 131

return 0xFFFF;}

}#line 96static inline message_t *ForwardToBaseC$Receive$receive(message_t *msg, void *payload, uint8_t len)#line 96{

RssiMsg *btrpkt = (RssiMsg *)payload;if (__nesc_ntoh_int8((unsigned char *)&btrpkt->forwarded)) {

return msg;}

__nesc_hton_uint16((unsigned char *)&btrpkt->forwarder_id, TOS_NODE_ID);__nesc_hton_int8((unsigned char *)&btrpkt->forwarded, TRUE);__nesc_hton_int16((unsigned char *)&btrpkt->rssi, ForwardToBaseC$getRssi(msg));ForwardToBaseC$setLeds(__nesc_ntoh_uint16((unsigned char *)&btrpkt->counter));if (ForwardToBaseC$AMSend$send(AM_BROADCAST_ADDR, msg, sizeof(RssiMsg )) ==SUCCESS) {

ForwardToBaseC$busy = TRUE;}

return msg;}# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static inline message_t *ActiveMessageLayerC$Receive$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len){

return msg;}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"inline static message_t *ActiveMessageLayerC$Receive$receive(am_id_t arg_0x1abeada8,message_t *arg_0x1a897260,void *arg_0x1a897400, uint8_t arg_0x1a897588){#line 67

nx_struct message_t *result;#line 67#line 67

switch (arg_0x1abeada8) {#line 67

case 6:#line 67

result = ForwardToBaseC$Receive$receive(arg_0x1a897260, arg_0x1a897400, arg_0x1a897588);

#line 67break;

#line 67default:

#line 67result = ActiveMessageLayerC$Receive$default$receive(arg_0x1abeada8,arg_0x1a897260, arg_0x1a897400, arg_0x1a897588);

#line 67break;

#line 67}

#line 67#line 67

return result;#line 67}#line 67# 269 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline bool IEEE154PacketP$AMPacket$isForMe(message_t *msg){

am_addr_t addr = IEEE154PacketP$AMPacket$destination(msg);

335

#line 272return addr == IEEE154PacketP$AMPacket$address() || addr ==AM_BROADCAST_ADDR;

}# 125 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static bool ActiveMessageLayerC$AMPacket$isForMe(message_t *arg_0x1a873ca0){#line 125

unsigned char result;#line 125#line 125

result = IEEE154PacketP$AMPacket$isForMe(arg_0x1a873ca0);#line 125#line 125

return result;#line 125}#line 125#line 136inline static am_id_t ActiveMessageLayerC$AMPacket$type(message_t *arg_0x1a872610){#line 136

unsigned char result;#line 136#line 136

result = IEEE154PacketP$AMPacket$type(arg_0x1a872610);#line 136#line 136

return result;#line 136}#line 136# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static inline message_t *ActiveMessageLayerC$SubReceive$receive(message_t *msg, void *payload, uint8_t len){

am_id_t type = ActiveMessageLayerC$AMPacket$type(msg);msg = ActiveMessageLayerC$AMPacket$isForMe(msg) ?ActiveMessageLayerC$Receive$receive(type, msg, payload, len) :ActiveMessageLayerC$Snoop$receive(type, msg, payload, len);return msg;

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"inline static message_t *IEEE154NetworkLayerP$Receive$receive(message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588){#line 67

nx_struct message_t *result;#line 67#line 67

result = ActiveMessageLayerC$SubReceive$receive(arg_0x1a897260, arg_0x1a897400, arg_0x1a897588);

#line 67#line 67

return result;#line 67}#line 67# 196 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static __inline uint8_t IEEE154PacketP$IEEE154Packet$get6LowPan(message_t *msg){

return __nesc_ntoh_leuint8((unsigned char *)&IEEE154PacketP$getHeader(msg)->network);

}# 167 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154Packet.nc"inline static uint8_t IEEE154NetworkLayerP$IEEE154Packet$get6LowPan(message_t *arg_0x1a982010){#line 167

unsigned char result;#line 167#line 167

result = IEEE154PacketP$IEEE154Packet$get6LowPan(arg_0x1a982010);

#line 167#line 167

return result;#line 167}#line 167# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"

336

static inline message_t *IEEE154NetworkLayerP$SubReceive$receive(message_t *msg, void *payload, uint8_t len){

uint8_t network = IEEE154NetworkLayerP$IEEE154Packet$get6LowPan(msg);

#line 77if (network == 0x3f) {

return IEEE154NetworkLayerP$Receive$receive(msg, payload, len);}

else {#line 80

return IEEE154NetworkLayerP$NonTinyosReceive$receive(network, msg, payload, len);}

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Receive.nc"inline static message_t *MessageBufferLayerP$Receive$receive(message_t *arg_0x1a897260, void *arg_0x1a897400, uint8_t arg_0x1a897588){#line 67

nx_struct message_t *result;#line 67#line 67

result = IEEE154NetworkLayerP$SubReceive$receive(arg_0x1a897260, arg_0x1a897400, arg_0x1a897588);

#line 67#line 67

return result;#line 67}#line 67# 267 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$deliverTask$runTask(void){

for (; ; ){

message_t *msg;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{if (MessageBufferLayerP$receiveQueueSize == 0) {{

#line 277__nesc_atomic_end(__nesc_atomic);

#line 277return;

}}

#line 279msg = MessageBufferLayerP$receiveQueue[MessageBufferLayerP$receiveQueueHead];

}#line 280

__nesc_atomic_end(__nesc_atomic); }msg = MessageBufferLayerP$Receive$receive(msg,MessageBufferLayerP$Packet$getPayload(msg, MessageBufferLayerP$Packet$maxPayloadLength()),MessageBufferLayerP$Packet$payloadLength(msg));{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{MessageBufferLayerP$receiveQueue[MessageBufferLayerP$receiveQueueHead] = msg;if (++MessageBufferLayerP$receiveQueueHead >=MessageBufferLayerP$RECEIVE_QUEUE_SIZE) {MessageBufferLayerP$receiveQueueHead = 0;}

--MessageBufferLayerP$receiveQueueSize;}

#line 294__nesc_atomic_end(__nesc_atomic); }

}}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMPacket.nc"inline static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(message_t *arg_0x1a874a90, am_addr_t arg_0x1a874c20){#line 92

IEEE154PacketP$AMPacket$setDestination(arg_0x1a874a90, arg_0x1a874c20);#line 92}#line 92#line 151inline static void /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setTyp

337

e(message_t *arg_0x1a872ba8, am_id_t arg_0x1a872d30){#line 151

IEEE154PacketP$AMPacket$setType(arg_0x1a872ba8, arg_0x1a872d30);#line 151}#line 151# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(message_t *arg_0x1a864548, uint8_t arg_0x1a8646d0){#line 83

RF230PacketP$Packet$setPayloadLength(arg_0x1a864548, arg_0x1a8646d0);

#line 83}#line 83# 82 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static inline error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(uint8_t clientId, message_t *msg,uint8_t len)#line 83{

if (clientId >= 1) {return FAIL;

}if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg != (void *)0) {

return EBUSY;}

;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg = msg;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(msg, len);if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current >= 1) {

error_t err;am_id_t amId = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(msg);am_addr_t dest = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(msg);;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current = clientId;err = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(amId, dest, msg, len);if (err != SUCCESS) {

;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg = (void *)0;

}return err;

}else {

;}

return SUCCESS;}# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static error_t /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$send(message_t *arg_0x1abe5ef8, uint8_t arg_0x1abe4090){#line 64

unsigned char result;#line 64#line 64

result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(0U, arg_0x1abe5ef8, arg_0x1abe4090);

#line 64#line 64

return result;#line 64}#line 64# 181 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(am_id_t id, message_t *msg, error_t err)#line 181{

if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current >= 1) {return;

338

}if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg == msg) {

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$current, msg, err);

}else {

;}

}# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\AMSend.nc"inline static void ActiveMessageLayerC$AMSend$sendDone(am_id_t arg_0x1abea478, message_t *arg_0x1a8821c0,error_t arg_0x1a882348){#line 99

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(arg_0x1abea478, arg_0x1a8821c0, arg_0x1a882348);

#line 99}#line 99# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static __inline void ActiveMessageLayerC$SubSend$sendDone(message_t *msg, error_t error){

ActiveMessageLayerC$AMSend$sendDone(ActiveMessageLayerC$AMPacket$type(msg), msg, error);

}# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static void IEEE154NetworkLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198){#line 89

ActiveMessageLayerC$SubSend$sendDone(arg_0x1abe2010, arg_0x1abe2198);

#line 89}#line 89# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154NetworkLayerP.nc"static inline void IEEE154NetworkLayerP$SubSend$sendDone(message_t *msg, error_t error){

IEEE154NetworkLayerP$Send$sendDone(msg, error);}# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static void UniqueLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198){#line 89

IEEE154NetworkLayerP$SubSend$sendDone(arg_0x1abe2010, arg_0x1abe2198);

#line 89}#line 89# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline void UniqueLayerP$SubSend$sendDone(message_t *msg, error_t error){

UniqueLayerP$Send$sendDone(msg, error);}# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Send.nc"inline static void MessageBufferLayerP$Send$sendDone(message_t *arg_0x1abe2010, error_t arg_0x1abe2198){#line 89

UniqueLayerP$SubSend$sendDone(arg_0x1abe2010, arg_0x1abe2198);#line 89}#line 89# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void MessageBufferLayerP$Tasklet$resume(void){#line 68

TaskletC$Tasklet$resume();#line 68}#line 68# 234 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline uint16_t RF230ActiveMessageP$RandomCollisionConfig$getInitialBackoff(message_t *msg)

339

{return (uint16_t )(9920 * (7372800UL / 8 / 32 *(1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000.0));

}# 29 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionConfig.nc"inline static uint16_t RandomCollisionLayerP$Config$getInitialBackoff(message_t *arg_0x1a955c98){#line 29

unsigned short result;#line 29#line 29

result = RF230ActiveMessageP$RandomCollisionConfig$getInitialBackoff(arg_0x1a955c98);

#line 29#line 29

return result;#line 29}#line 29# 87 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static inline error_t RandomCollisionLayerP$RadioSend$send(message_t *msg){

if (RandomCollisionLayerP$state != RandomCollisionLayerP$STATE_READY || !RandomCollisionLayerP$RadioAlarm$isFree()) {

return EBUSY;}

RandomCollisionLayerP$txMsg = msg;RandomCollisionLayerP$state = RandomCollisionLayerP$STATE_TX_PENDING_FIRST;RandomCollisionLayerP$RadioAlarm$wait(RandomCollisionLayerP$getBackoff(RandomCollisionLayerP$Config$getInitialBackoff(msg)));return SUCCESS;

}# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static error_t TrafficMonitorLayerP$SubSend$send(message_t *arg_0x1ac24c88){#line 37

unsigned char result;#line 37#line 37

result = RandomCollisionLayerP$RadioSend$send(arg_0x1ac24c88);

#line 37#line 37

return result;#line 37}#line 37# 86 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline error_t TrafficMonitorLayerP$RadioSend$send(message_t *msg){

TrafficMonitorLayerP$txMsg = msg;return TrafficMonitorLayerP$SubSend$send(msg);

}# 37 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioSend.nc"inline static error_t MessageBufferLayerP$RadioSend$send(message_t *arg_0x1ac24c88){#line 37

unsigned char result;#line 37#line 37

result = TrafficMonitorLayerP$RadioSend$send(arg_0x1ac24c88);#line 37#line 37

return result;#line 37}#line 37# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TaskletC.nc"static __inline void TaskletC$Tasklet$suspend(void){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 85

++TaskletC$state;#line 85

__nesc_atomic_end(__nesc_atomic); }}

340

# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void MessageBufferLayerP$Tasklet$suspend(void){#line 61

TaskletC$Tasklet$suspend();#line 61}#line 61# 139 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$sendTask$runTask(void){

error_t error;for (; 0; ) ;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 145error = MessageBufferLayerP$txError;

#line 145__nesc_atomic_end(__nesc_atomic); }

if ((MessageBufferLayerP$state ==MessageBufferLayerP$STATE_TX_SEND &&error == SUCCESS) || ++MessageBufferLayerP$retries >MessageBufferLayerP$MAX_RETRIES) {MessageBufferLayerP$state =MessageBufferLayerP$STATE_TX_DONE;}

else {MessageBufferLayerP$Tasklet$suspend();error = MessageBufferLayerP$RadioSend$send(MessageBufferLayerP$txMsg);if (error == SUCCESS) {MessageBufferLayerP$state =MessageBufferLayerP$STATE_TX_SEND;}

else {#line 155

if (MessageBufferLayerP$retries ==MessageBufferLayerP$MAX_RETRIES) {MessageBufferLayerP$state =MessageBufferLayerP$STATE_TX_DONE;}

else {#line 158

MessageBufferLayerP$state =MessageBufferLayerP$STATE_TX_PENDING;}

}#line 160

MessageBufferLayerP$Tasklet$resume();}

if (MessageBufferLayerP$state ==MessageBufferLayerP$STATE_TX_DONE){MessageBufferLayerP$state =MessageBufferLayerP$STATE_READY;MessageBufferLayerP$Send$sendDone(MessageBufferLayerP$txMsg, error);

}}# 72 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$AMControl$stopDone(error_t err)#line 72{}# 117 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"inline static void MessageBufferLayerP$SplitControl$stopDone(error_t arg_0x1a892250){#line 117

ForwardToBaseC$AMControl$stopDone(arg_0x1a892250);#line 117}#line 117#line 83inline static error_t ForwardToBaseC$AMControl$start(void){#line 83

unsigned char result;#line 83#line 83

result = MessageBufferLayerP$SplitControl$start();#line 83#line 83

return result;#line 83}

341

#line 83# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t ForwardToBaseC$toggle$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(ForwardToBaseC$toggle);

#line 56#line 56

return result;#line 56}#line 56# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void ForwardToBaseC$Timer0$startPeriodic(uint32_t arg_0x1a5d0490){#line 53

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(0U, arg_0x1a5d0490);

#line 53}#line 53# 62 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$AMControl$startDone(error_t err)#line 62{

if (err == SUCCESS) {ForwardToBaseC$Timer0$startPeriodic(FWD_INTERVAL_MS);ForwardToBaseC$toggle$postTask();

}else {

ForwardToBaseC$AMControl$start();}

}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\SplitControl.nc"inline static void MessageBufferLayerP$SplitControl$startDone(error_t arg_0x1a894678){#line 92

ForwardToBaseC$AMControl$startDone(arg_0x1a894678);#line 92}#line 92# 101 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline void MessageBufferLayerP$stateDoneTask$runTask(void){

uint8_t s;s = MessageBufferLayerP$state;if (s == MessageBufferLayerP$STATE_TURN_ON || s ==MessageBufferLayerP$STATE_TURN_OFF) {MessageBufferLayerP$state =MessageBufferLayerP$STATE_READY;}

if (s == MessageBufferLayerP$STATE_TURN_ON) {MessageBufferLayerP$SplitControl$startDone(SUCCESS);}

else {#line 114

MessageBufferLayerP$SplitControl$stopDone(SUCCESS);}

}# 372 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline error_t RF230LayerP$RadioState$turnOn(void){

if (RF230LayerP$cmd != RF230LayerP$CMD_NONE ||(RF230LayerP$state == RF230LayerP$STATE_SLEEP &&!RF230LayerP$RadioAlarm$isFree())) {

return EBUSY;}

else {#line 376

if (RF230LayerP$state == RF230LayerP$STATE_RX_ON) {return EALREADY;}

}#line 379

RF230LayerP$cmd = RF230LayerP$CMD_TURNON;

342

RF230LayerP$Tasklet$schedule();return SUCCESS;

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"inline static error_t TrafficMonitorLayerP$SubState$turnOn(void){#line 45

unsigned char result;#line 45#line 45

result = RF230LayerP$RadioState$turnOn();#line 45#line 45

return result;#line 45}#line 45# 217 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline error_t TrafficMonitorLayerP$RadioState$turnOn(void){

TrafficMonitorLayerP$radioCmd =TrafficMonitorLayerP$RADIO_CMD_TURNON;return TrafficMonitorLayerP$SubState$turnOn();

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioState.nc"inline static error_t MessageBufferLayerP$RadioState$turnOn(void){#line 45

unsigned char result;#line 45#line 45

result = TrafficMonitorLayerP$RadioState$turnOn();#line 45#line 45

return result;#line 45}#line 45# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\pins\\HplAtm128GeneralIOPinP.nc"static inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$toggle(void)#line 48{#line 48

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 48

* (volatile uint8_t *)34U ˆ= 1 << 2;#line 48

__nesc_atomic_end(__nesc_atomic); }}# 31 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GeneralIO.nc"inline static void LedsP$Led0$toggle(void){#line 31

/*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$toggle();

#line 31}#line 31# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\LedsP.nc"static inline void LedsP$Leds$led0Toggle(void)#line 73{

LedsP$Led0$toggle();;

#line 75;

}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Leds.nc"inline static void ForwardToBaseC$Leds$led0Toggle(void){#line 56

LedsP$Leds$led0Toggle();#line 56}#line 56# 53 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$toggle$runTask(void){

ForwardToBaseC$Leds$led0Toggle();

343

}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$startAt(/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x1a631548,/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x1a6316d8){#line 92

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$startAt(arg_0x1a631548, arg_0x1a6316d8);

#line 92}#line 92# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$start(uint32_t t0, uint32_t dt, bool oneshot){

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_dt = dt;/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_oneshot = oneshot;/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$startAt(t0, dt);

}#line 82static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(uint32_t t0, uint32_t dt){#line 83

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$start(t0, dt, TRUE);}# 118 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(uint32_t arg_0x1a5e3738, uint32_t arg_0x1a5e38c8){#line 118

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(arg_0x1a5e3738, arg_0x1a5e38c8);

#line 118}#line 118# 231 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$stop(void)#line 231{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 232

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$set = FALSE;

#line 232__nesc_atomic_end(__nesc_atomic); }

}# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$stop(void){#line 62

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$stop();

#line 62}#line 62# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$stop(void){#line 61

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$stop();}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$stop(void){#line 67

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$stop();#line 67}#line 67# 89 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static inline void /*HilTimerMilliC.VirtualizeTimerC*/

344

VirtualizeTimerC$0$updateFromTimer$runTask(void){

uint32_t now = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow();int32_t min_remaining = (1UL << 31) - 1;bool min_remaining_isset = FALSE;uint8_t num;/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$stop();for (num = 0; num < /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$NUM_TIMERS; num++)

{/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer_t *timer= &/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num];if (timer->isrunning){

uint32_t elapsed = now - timer->t0;int32_t remaining = timer->dt - elapsed;if (remaining < min_remaining){min_remaining = remaining;min_remaining_isset = TRUE;

}}

}if (min_remaining_isset)

{if (min_remaining <= 0) {/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$fireTimers(now);}

else {#line 124

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(now, min_remaining);}

}}# 115 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Packet.nc"inline static void *ForwardToBaseC$Packet$getPayload(message_t *arg_0x1a862358, uint8_t arg_0x1a8624e0){#line 115

void *result;#line 115#line 115

result = RF230PacketP$Packet$getPayload(arg_0x1a862358, arg_0x1a8624e0);#line 115#line 115

return result;#line 115}#line 115# 76 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$Timer0$fired(void)#line 76{

if (!ForwardToBaseC$busy) {RssiMsg *btrpkt = (RssiMsg *)ForwardToBaseC$Packet$getPayload(&ForwardToBaseC$pkt, sizeof(RssiMsg ));

#line 79if (btrpkt == (void *)0) {

return;}

__nesc_hton_uint16((unsigned char *)&btrpkt->sender_id, TOS_NODE_ID);__nesc_hton_uint16((unsigned char *)&btrpkt->counter, 0);__nesc_hton_int8((unsigned char *)&btrpkt->forwarded, FALSE);if (ForwardToBaseC$AMSend$send(AM_BROADCAST_ADDR, &ForwardToBaseC$pkt,sizeof(RssiMsg )) == SUCCESS) {

ForwardToBaseC$busy = TRUE;}

}}# 68 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void TrafficMonitorLayerP$Tasklet$resume(void){#line 68

345

TaskletC$Tasklet$resume();#line 68}#line 68# 291 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$SlottedCollisionConfig$default$timerTick(void)#line 291{}# 60 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\SlottedCollisionConfig.nc"inline static void RF230ActiveMessageP$SlottedCollisionConfig$timerTick(void){#line 60

RF230ActiveMessageP$SlottedCollisionConfig$default$timerTick();#line 60}#line 60# 213 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static inline void RF230ActiveMessageP$TrafficMonitorConfig$timerTick(void){

RF230ActiveMessageP$SlottedCollisionConfig$timerTick();}# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorConfig.nc"inline static void TrafficMonitorLayerP$TrafficMonitorConfig$timerTick(void){#line 79

RF230ActiveMessageP$TrafficMonitorConfig$timerTick();#line 79}#line 79# 162 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"static inline void NeighborhoodP$NeighborhoodFlag$clearAll(uint8_t bit){

uint8_t i;bit = ˜(1 << bit);for (i = 0; i < 5; ++i)

NeighborhoodP$flags[i] &= bit;}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodFlag.nc"inline static void TrafficMonitorLayerP$NeighborhoodFlag$clearAll(void){#line 51

NeighborhoodP$NeighborhoodFlag$clearAll(1U);#line 51}#line 51# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void TrafficMonitorLayerP$Tasklet$suspend(void){#line 61

TaskletC$Tasklet$suspend();#line 61}#line 61# 132 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static inline void TrafficMonitorLayerP$Timer$fired(void){

uint8_t fraction;TrafficMonitorLayerP$Tasklet$suspend();TrafficMonitorLayerP$txAverage -=TrafficMonitorLayerP$txAverage >> 3;TrafficMonitorLayerP$rxAverage -=TrafficMonitorLayerP$rxAverage >> 3;TrafficMonitorLayerP$errorAverage -=TrafficMonitorLayerP$errorAverage >> 3;fraction = TrafficMonitorLayerP$neighborAverage >> 3;if (fraction == TrafficMonitorLayerP$neighborCount &&(TrafficMonitorLayerP$neighborAverage &TrafficMonitorLayerP$TRAFFIC_MONITOR_MASK) != 0) {

--TrafficMonitorLayerP$neighborAverage;}

else {#line 147

TrafficMonitorLayerP$neighborAverage +=

346

TrafficMonitorLayerP$neighborCount - fraction;}

TrafficMonitorLayerP$NeighborhoodFlag$clearAll();TrafficMonitorLayerP$neighborCount = 0;TrafficMonitorLayerP$TrafficMonitorConfig$timerTick();TrafficMonitorLayerP$Tasklet$resume();

}# 193 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(uint8_t num){}# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$fired(uint8_t arg_0x1a7c0cb8){#line 72

switch (arg_0x1a7c0cb8) {#line 72

case 0U:#line 72

ForwardToBaseC$Timer0$fired();#line 72

break;#line 72

case 1U:#line 72

TrafficMonitorLayerP$Timer$fired();#line 72

break;#line 72

default:#line 72

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(arg_0x1a7c0cb8);

#line 72break;

#line 72}

#line 72}#line 72# 174 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline void HplAtm1281Timer2AsyncP$Compare$set(uint8_t t)#line 174{

/* atomic removed: atomic calls only */{

while (* (volatile uint8_t *)0xB6 & (1 << 3));

* (volatile uint8_t *)0xB3 = t;}

}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$size_type arg_0x1a6924f0){#line 45

HplAtm1281Timer2AsyncP$Compare$set(arg_0x1a6924f0);#line 45}#line 45# 79 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline uint8_t HplAtm1281Timer2AsyncP$Timer$get(void)#line 79{#line 79

return * (volatile uint8_t *)0xB2;}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$timer_size/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get(void){#line 52

unsigned char result;#line 52#line 52

result = HplAtm1281Timer2AsyncP$Timer$get();

347

#line 52#line 52

return result;#line 52}#line 52# 258 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline intHplAtm1281Timer2AsyncP$TimerAsync$compareABusy(void)#line 258{

return (* (volatile uint8_t *)0xB6 & (1 << 3)) != 0;}# 75 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerAsync.nc"inline static int /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerAsync$compareABusy(void){#line 75

int result;#line 75#line 75

result = HplAtm1281Timer2AsyncP$TimerAsync$compareABusy();#line 75#line 75

return result;#line 75}#line 75# 101 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setOcr2A(uint8_t n)#line 101{

while (/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerAsync$compareABusy())

;if (n == /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get()) {

n++;}

if (/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base + n + 1 </*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base) {

n = -/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base - 1;}

#line 111/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$set(n);

}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"inline static error_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$postTask(void){#line 56

unsigned char result;#line 56#line 56

result = SchedulerBasicP$TaskBasic$postTask(/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired);

#line 56#line 56

return result;#line 56}#line 56# 70 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$fired(void){#line 71

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$postTask();

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$fired(void){#line 67

/*HilTimerMilliC.AlarmToTimerC*/

348

AlarmToTimerC$0$Alarm$fired();#line 67}#line 67# 128 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$fired(void){

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$fireTimers(/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow());

}# 72 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Timer.nc"inline static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$fired(void){#line 72

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$fired();

#line 72}#line 72# 253 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline uint32_t/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getAlarm(void)#line 253{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 254

{unsigned long __nesc_temp =

#line 254/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$t0 +/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$dt;{

#line 254__nesc_atomic_end(__nesc_atomic);

#line 254return __nesc_temp;

}}

#line 256__nesc_atomic_end(__nesc_atomic); }

}# 105 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getAlarm(void){#line 105

unsigned long result;#line 105#line 105

result = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$getAlarm();

#line 105#line 105

return result;#line 105}#line 105# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\AlarmToTimerC.nc"static inline void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask(void){

if (/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_oneshot == FALSE) {

/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$start(/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getAlarm(),/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$m_dt, FALSE);}

#line 67/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$fired();

}# 161 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline void HplAtm1281Timer2AsyncP$Compare$start(void)#line 161

349

{#line 161

* (volatile uint8_t *)0x70 |= 1 << 1;}# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$start(void){#line 56

HplAtm1281Timer2AsyncP$Compare$start();#line 56}#line 56# 117 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline void HplAtm1281Timer2AsyncP$TimerCtrl$setControlB(uint8_t x)#line 117{

while (* (volatile uint8_t *)0xB6 & (1 << 0));

* (volatile uint8_t *)0xB1 = ((Atm128_TCCR2B_t )x).flat;}# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl8.nc"inline static void/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlB(uint8_t arg_0x1a696350){#line 62

HplAtm1281Timer2AsyncP$TimerCtrl$setControlB(arg_0x1a696350);

#line 62}#line 62# 111 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline void HplAtm1281Timer2AsyncP$TimerCtrl$setControlA(uint8_t x)#line 111{

while (* (volatile uint8_t *)0xB6 & (1 << 1));

* (volatile uint8_t *)0xB0 = ((Atm128_TCCR2A_t )x).flat;}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerCtrl8.nc"inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlA(uint8_t arg_0x1a680e28){#line 61

HplAtm1281Timer2AsyncP$TimerCtrl$setControlA(arg_0x1a680e28);#line 61}#line 61# 246 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline void HplAtm1281Timer2AsyncP$TimerAsync$setTimer2Asynchronous(void)#line 246{

* (volatile uint8_t *)0xB6 |= 1 << 5;}# 57 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm128TimerAsync.nc"inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerAsync$setTimer2Asynchronous(void){#line 57

HplAtm1281Timer2AsyncP$TimerAsync$setTimer2Asynchronous();#line 57}#line 57# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline error_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Init$init(void)#line 78{

/* atomic removed: atomic calls only */{

Atm128_TCCR2A_t x;Atm128_TCCR2B_t y;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/

350

Atm1281AlarmAsyncP$0$TimerAsync$setTimer2Asynchronous();x.flat = 0;x.bits.wgm21 = 1;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlA(x.flat);y.flat = 0;y.bits.cs = 3;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$setControlB(y.flat);/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MAXT);/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$start();

}/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt();return SUCCESS;

}# 247 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static inline error_t MessageBufferLayerP$SoftwareInit$init(void){

uint8_t i;for (i = 0; i < MessageBufferLayerP$RECEIVE_QUEUE_SIZE; ++i)

MessageBufferLayerP$receiveQueue[i] =MessageBufferLayerP$receiveQueueData + i;

return SUCCESS;}# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\UniqueLayerP.nc"static inline error_t UniqueLayerP$Init$init(void){

UniqueLayerP$sequenceNumber = TOS_NODE_ID << 4;return SUCCESS;

}# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"static inline error_t NeighborhoodP$Init$init(void){

uint8_t i;for (i = 0; i < 5; ++i)

NeighborhoodP$nodes[i] = AM_BROADCAST_ADDR;return SUCCESS;

}# 44 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RandomMlcgC.nc"static inline error_t RandomMlcgC$Init$init(void)#line 44{

/* atomic removed: atomic calls only */#line 45

RandomMlcgC$seed = (uint32_t )(TOS_NODE_ID + 1);return SUCCESS;

}# 78 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Resource.nc"inline static error_t RF230LayerP$SpiResource$request(void){#line 78

unsigned char result;#line 78#line 78

result = Atm128SpiP$Resource$request(0U);#line 78#line 78

return result;#line 78}#line 78# 204 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline error_t RF230LayerP$SoftwareInit$init(void){

return RF230LayerP$SpiResource$request();}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\FcfsResourceQueueC.nc"static inline error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init(void)#line 45{

memset(/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ,

351

/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY,sizeof /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ);return SUCCESS;

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Init.nc"inline static error_t RealMainP$SoftwareInit$init(void){#line 51

unsigned char result;#line 51#line 51

result = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init();

#line 51result = ecombine(result, RF230LayerP$SoftwareInit$init());

#line 51result = ecombine(result, RandomMlcgC$Init$init());

#line 51result = ecombine(result, NeighborhoodP$Init$init());

#line 51result = ecombine(result, UniqueLayerP$Init$init());

#line 51result = ecombine(result, MessageBufferLayerP$SoftwareInit$init());

#line 51result = ecombine(result, /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Init$init());

#line 51#line 51

return result;#line 51}#line 51# 58 "C:\\Crossbow\\cygwin\\home\\ordonez\\rssi_ordonez_v2\\ForwardingMote\\ForwardToBaseC.nc"static inline void ForwardToBaseC$Boot$booted(void)#line 58{

ForwardToBaseC$AMControl$start();}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Boot.nc"inline static void RealMainP$Boot$booted(void){#line 49

ForwardToBaseC$Boot$booted();#line 49}#line 49# 199 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline mcu_power_t HplAtm1281Timer2AsyncP$McuPowerOverride$lowestState(void)#line 199{

uint8_t diff;if (* (volatile uint8_t *)0x70 & ((1 << 1) | (1 << 0))) {

while (* (volatile uint8_t *)0xB6 & (((1 << 4) |(1 << 3)) | (1 << 1)));

diff = * (volatile uint8_t *)0xB3 - *(volatile uint8_t *)0xB2;if (diff < EXT_STANDBY_T0_THRESHOLD ||* (volatile uint8_t *)0xB2 > 256 -EXT_STANDBY_T0_THRESHOLD) {return ATM128_POWER_EXT_STANDBY;}

#line 214return ATM128_POWER_SAVE;

}else {

return ATM128_POWER_DOWN;}

}# 54 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuPowerOverride.nc"inline static mcu_power_t McuSleepC$McuPowerOverride$lowestState(void){#line 54

unsigned char result;#line 54#line 54

result = HplAtm1281Timer2AsyncP$McuPowerOverride$lowestState();

#line 54#line 54

return result;#line 54}

352

#line 54# 88 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\McuSleepC.nc"static inline mcu_power_t McuSleepC$getPowerState(void)#line 88{

if ((#line 98

* (volatile uint8_t *)0x6E & ((1 << 1) |(1 << 2)) ||* (volatile uint8_t *)0x6F & ((((1 << 5) |(1 << 1)) | (1 << 2)) | (1 << 3))) ||* (volatile uint8_t *)0x71 & ((((1 << 5) |(1 << 1)) | (1 << 2)) | (1 << 3)))

{return ATM128_POWER_IDLE;

}else {

if (* (volatile uint8_t *)(uint16_t )& *(volatile uint8_t *)(0x2C + 0x20) & (1 << 7)) {

return ATM128_POWER_IDLE;}

else {if (* (volatile uint8_t *)0XC1 &((1 << 6) | (1 << 7))) {

return ATM128_POWER_IDLE;}

else {#line 112

if (* (volatile uint8_t *)0XC9 & ((1 << 6) |(1 << 7))) {

return ATM128_POWER_IDLE;}

else {if (* (volatile uint8_t *)(uint16_t )& *(volatile uint8_t *)0xBC & (1 << 2)) {

return ATM128_POWER_IDLE;}

else {if (* (volatile uint8_t *)(uint16_t )& *(volatile uint8_t *)0x7A & (1 << 7)) {

return ATM128_POWER_ADC_NR;}

else {return ATM128_POWER_DOWN;

}}

}}

}}

}# 157 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\atm128hardware.h"static inline mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2)#line 157{

return m1 < m2 ? m1 : m2;}# 128 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\McuSleepC.nc"static inline void McuSleepC$McuSleep$sleep(void)#line 128{

uint8_t powerState;powerState = mcombine(McuSleepC$getPowerState(),McuSleepC$McuPowerOverride$lowestState());* (volatile uint8_t *)(0x33 + 0x20) = ((* (volatile uint8_t *)(0x33 + 0x20) & 0xf0) |(1 << 0)) | __extension__ ({

#line 133uint16_t __addr16 = (uint16_t )(uint16_t )&McuSleepC$atm128PowerBits[powerState];

#line 133uint8_t __result;

#line 133__asm ("lpm %0, Z""\n\t" : "=r"(__result) :"z"(__addr16));__result;

});

#line 134__asm volatile ("sei");__asm volatile ("sleep" : : : "memory");__asm volatile ("cli");

353

* (volatile uint8_t *)(0x33 + 0x20) &= ˜(1 << 0);}# 59 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\McuSleep.nc"inline static void SchedulerBasicP$McuSleep$sleep(void){#line 59

McuSleepC$McuSleep$sleep();#line 59}#line 59# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"static __inline uint8_t SchedulerBasicP$popTask(void){

if (SchedulerBasicP$m_head != SchedulerBasicP$NO_TASK){

uint8_t id = SchedulerBasicP$m_head;#line 72

SchedulerBasicP$m_head = SchedulerBasicP$m_next[SchedulerBasicP$m_head];if (SchedulerBasicP$m_head == SchedulerBasicP$NO_TASK)

{SchedulerBasicP$m_tail = SchedulerBasicP$NO_TASK;

}SchedulerBasicP$m_next[id] = SchedulerBasicP$NO_TASK;return id;

}else

{return SchedulerBasicP$NO_TASK;

}}#line 138static inline void SchedulerBasicP$Scheduler$taskLoop(void){

for (; ; ){uint8_t nextTask;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{while ((nextTask = SchedulerBasicP$popTask()) ==SchedulerBasicP$NO_TASK){SchedulerBasicP$McuSleep$sleep();

}}

#line 150__nesc_atomic_end(__nesc_atomic); }

SchedulerBasicP$TaskBasic$runTask(nextTask);}

}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\Scheduler.nc"inline static void RealMainP$Scheduler$taskLoop(void){#line 61

SchedulerBasicP$Scheduler$taskLoop();#line 61}#line 61# 184 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static __inline void HplAtm1281Timer2AsyncP$stabiliseTimer2(void)#line 184{

* (volatile uint8_t *)0xB0 = * (volatile uint8_t *)0xB0;while (* (volatile uint8_t *)0xB6 & (1 << 1));

}# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\CounterToLocalTimeC.nc"static inline void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void){}# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$overflow(void){#line 71

/*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow();

#line 71}#line 71# 105 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\atm128hardware.h"

354

static __inline void __nesc_enable_interrupt(void)#line 105{

__asm volatile ("sei");}# 171 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"static inline uint8_t HplAtm1281Timer2AsyncP$Compare$get(void)#line 171{#line 171

return * (volatile uint8_t *)0xB3;}# 39 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$size_type/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$get(void){#line 39

unsigned char result;#line 39#line 39

result = HplAtm1281Timer2AsyncP$Compare$get();#line 39#line 39

return result;#line 39}#line 39# 176 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$fired(void)#line 176{

int overflowed;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base +=/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$get() + 1U;overflowed = !/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base;__nesc_enable_interrupt();/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt();if (overflowed) {

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$overflow();}

}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void HplAtm1281Timer2AsyncP$Compare$fired(void){#line 49

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$fired();

#line 49}#line 49# 257 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$overflow(void)#line 257{}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static void HplAtm1281Timer2AsyncP$Timer$overflow(void){#line 61

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$overflow();

#line 61}#line 61# 48 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\Tasklet.nc"inline static void RadioAlarmP$Tasklet$schedule(void){#line 48

TaskletC$Tasklet$schedule();#line 48}#line 48

355

# 53 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarmP.nc"static inline void RadioAlarmP$Alarm$fired(void){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{if (RadioAlarmP$state == RadioAlarmP$STATE_WAIT) {

RadioAlarmP$state = RadioAlarmP$STATE_FIRED;}

}#line 60

__nesc_atomic_end(__nesc_atomic); }RadioAlarmP$Tasklet$schedule();

}# 67 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Alarm.nc"inline static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$fired(void){#line 67

RadioAlarmP$Alarm$fired();#line 67}#line 67# 110 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void)#line 110{

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop();;__nesc_enable_interrupt();/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$fired();

}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void HplAtm1281Timer1P$CompareA$fired(void){#line 49

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired();

#line 49}#line 49# 209 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareB$default$fired(void)#line 209{}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void HplAtm1281Timer1P$CompareB$fired(void){#line 49

HplAtm1281Timer1P$CompareB$default$fired();#line 49}#line 49# 213 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline void HplAtm1281Timer1P$CompareC$default$fired(void)#line 213{}# 49 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Compare.nc"inline static void HplAtm1281Timer1P$CompareC$fired(void){#line 49

HplAtm1281Timer1P$CompareC$default$fired();#line 49}#line 49# 622 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static inline void RF230LayerP$IRQ$captured(uint16_t time){

for (; 0; ) ;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{RF230LayerP$capturedTime = time;RF230LayerP$radioIrq = TRUE;

}#line 630

__nesc_atomic_end(__nesc_atomic); }RF230LayerP$Tasklet$schedule();

}

356

# 50 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\GpioCapture.nc"inline static void HplRF230P$IRQ$captured(uint16_t arg_0x1ad7c680){#line 50

RF230LayerP$IRQ$captured(arg_0x1ad7c680);#line 50}#line 50# 199 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"static inline uint16_t HplAtm1281Timer1P$Capture$get(void)#line 199{#line 199

return * (volatile uint16_t *)0x86;}# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static HplRF230P$Capture$size_type HplRF230P$Capture$get(void){#line 38

unsigned short result;#line 38#line 38

result = HplAtm1281Timer1P$Capture$get();#line 38#line 38

return result;#line 38}#line 38# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\platforms\\iris\\chips\\rf230\\HplRF230P.nc"static inline void HplRF230P$Capture$captured(uint16_t time){

time = HplRF230P$Capture$get();HplRF230P$IRQ$captured(time);

}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Capture.nc"inline static void HplAtm1281Timer1P$Capture$captured(HplAtm1281Timer1P$Capture$size_type arg_0x1ab0a540){#line 51

HplRF230P$Capture$captured(arg_0x1ab0a540);#line 51}#line 51# 47 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\CounterToLocalTimeC.nc"static inline void /*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$overflow(void){}# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static void /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$overflow(void){#line 71

/*LocalTimeMicroC.CounterToLocalTimeC*/CounterToLocalTimeC$1$Counter$overflow();

#line 71}#line 71# 122 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\TransformCounterC.nc"static inline void /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$overflow(void){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$m_upper++;if ((/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$m_upper & /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$OVERFLOW_MASK) == 0) {

/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$overflow();}

}#line 130

__nesc_atomic_end(__nesc_atomic); }}# 71 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\Counter.nc"inline static void /*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$overflow(void){#line 71

357

/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$overflow();

#line 71}#line 71# 56 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128CounterC.nc"static inline void /*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$overflow(void){

/*CounterOne16C.NCounter*/Atm128CounterC$0$Counter$overflow();}# 51 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128TimerInitC.nc"static inline void /*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$overflow(void)#line 51{}# 117 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static inline void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void)#line 117{}# 61 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\HplAtm128Timer.nc"inline static void HplAtm1281Timer1P$Timer$overflow(void){#line 61

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow();

#line 61/*InitOneP.InitOne*/Atm128TimerInitC$0$Timer$overflow();

#line 61/*CounterOne16C.NCounter*/Atm128CounterC$0$Timer$overflow();

#line 61}#line 61# 98 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline uint8_t HplAtm128SpiP$SPI$read(void)#line 98{#line 98

return * (volatile uint8_t *)(0X2E + 0x20);}# 80 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static uint8_t Atm128SpiP$Spi$read(void){#line 80

unsigned char result;#line 80#line 80

result = HplAtm128SpiP$SPI$read();#line 80#line 80

return result;#line 80}#line 80# 99 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static inline void HplAtm128SpiP$SPI$write(uint8_t d)#line 99{#line 99

* (volatile uint8_t *)(0X2E + 0x20) = d;}# 86 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void Atm128SpiP$Spi$write(uint8_t arg_0x1ae46218){#line 86

HplAtm128SpiP$SPI$write(arg_0x1ae46218);#line 86}#line 86inline static void Atm128SpiP$Spi$enableInterrupt(bool arg_0x1ae46c70){#line 96

HplAtm128SpiP$SPI$enableInterrupt(arg_0x1ae46c70);#line 96}#line 96# 162 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"

358

static inline error_t Atm128SpiP$sendNextPart(void)#line 162{

uint16_t end;uint16_t tmpPos;uint16_t myLen;uint8_t *tx;uint8_t *rx;/* atomic removed: atomic calls only */

#line 169{

myLen = Atm128SpiP$len;tx = Atm128SpiP$txBuffer;rx = Atm128SpiP$rxBuffer;tmpPos = Atm128SpiP$pos;end = Atm128SpiP$pos + Atm128SpiP$SPI_ATOMIC_SIZE;end = end > Atm128SpiP$len ? Atm128SpiP$len : end;

}for (; tmpPos < end - 1; tmpPos++) {

uint8_t val;#line 180

if (tx != (void *)0) {val = Atm128SpiP$SpiByte$write(tx[tmpPos]);}

else {#line 183

val = Atm128SpiP$SpiByte$write(0);}

if (rx != (void *)0) {rx[tmpPos] = val;

}}

Atm128SpiP$Spi$enableInterrupt(TRUE);/* atomic removed: atomic calls only */

#line 193{

if (tx != (void *)0) {Atm128SpiP$Spi$write(tx[tmpPos]);}

else {#line 197

Atm128SpiP$Spi$write(0);}

Atm128SpiP$pos = tmpPos;}return SUCCESS;

}#line 265static inline void Atm128SpiP$Spi$dataReady(uint8_t data)#line 265{

bool again;/* atomic removed: atomic calls only */

#line 268{

if (Atm128SpiP$rxBuffer != (void *)0) {Atm128SpiP$rxBuffer[Atm128SpiP$pos] = data;

}Atm128SpiP$pos++;

}Atm128SpiP$Spi$enableInterrupt(FALSE);/* atomic removed: atomic calls only */{

again = Atm128SpiP$pos < Atm128SpiP$len;}if (again) {

Atm128SpiP$sendNextPart();}

else {uint8_t discard;uint16_t myLen;uint8_t *rx;uint8_t *tx;/* atomic removed: atomic calls only */

#line 290{myLen = Atm128SpiP$len;rx = Atm128SpiP$rxBuffer;tx = Atm128SpiP$txBuffer;Atm128SpiP$rxBuffer = (void *)0;Atm128SpiP$txBuffer = (void *)0;Atm128SpiP$len = 0;Atm128SpiP$pos = 0;

}discard = Atm128SpiP$Spi$read();

359

Atm128SpiP$SpiPacket$sendDone(tx, rx, myLen, SUCCESS);}

}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128Spi.nc"inline static void HplAtm128SpiP$SPI$dataReady(uint8_t arg_0x1ae46728){#line 92

Atm128SpiP$Spi$dataReady(arg_0x1ae46728);#line 92}#line 92# 52 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RealMainP.nc"

int main(void)#line 52{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{{}

#line 60;RealMainP$Scheduler$init();RealMainP$PlatformInit$init();while (RealMainP$Scheduler$runNextTask()) ;RealMainP$SoftwareInit$init();while (RealMainP$Scheduler$runNextTask()) ;

}#line 77

__nesc_atomic_end(__nesc_atomic); }__nesc_enable_interrupt();RealMainP$Boot$booted();RealMainP$Scheduler$taskLoop();return -1;

}# 123 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"static bool SchedulerBasicP$Scheduler$runNextTask(void){

uint8_t nextTask;/* atomic removed: atomic calls only */

#line 127{

nextTask = SchedulerBasicP$popTask();if (nextTask == SchedulerBasicP$NO_TASK){

{unsigned char __nesc_temp =

#line 131FALSE;

#line 131return __nesc_temp;

}}

}#line 134

SchedulerBasicP$TaskBasic$runTask(nextTask);return TRUE;

}#line 164static void SchedulerBasicP$TaskBasic$default$runTask(uint8_t id){}# 64 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\interfaces\\TaskBasic.nc"static void SchedulerBasicP$TaskBasic$runTask(uint8_t arg_0x1a1206b8){#line 64

switch (arg_0x1a1206b8) {#line 64

case /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired:

#line 64/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask();

#line 64break;

#line 64case /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer:

#line 64/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask();

#line 64break;

360

#line 64case ForwardToBaseC$toggle:

#line 64ForwardToBaseC$toggle$runTask();

#line 64break;

#line 64case MessageBufferLayerP$stateDoneTask:

#line 64MessageBufferLayerP$stateDoneTask$runTask();

#line 64break;

#line 64case MessageBufferLayerP$sendTask:

#line 64MessageBufferLayerP$sendTask$runTask();

#line 64break;

#line 64case MessageBufferLayerP$deliverTask:

#line 64MessageBufferLayerP$deliverTask$runTask();

#line 64break;

#line 64case TrafficMonitorLayerP$startStopTimer:

#line 64TrafficMonitorLayerP$startStopTimer$runTask();

#line 64break;

#line 64case RandomCollisionLayerP$calcNextRandom:

#line 64RandomCollisionLayerP$calcNextRandom$runTask();

#line 64break;

#line 64case Atm128SpiP$zeroTask:

#line 64Atm128SpiP$zeroTask$runTask();

#line 64break;

#line 64case /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask:

#line 64/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask();

#line 64break;

#line 64case /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask:

#line 64/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask();

#line 64break;

#line 64case /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask:

#line 64/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask();

#line 64break;

#line 64default:

#line 64SchedulerBasicP$TaskBasic$default$runTask(arg_0x1a1206b8);

#line 64break;

#line 64}

#line 64}#line 64# 155 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueImplP.nc"static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(uint8_t last, message_t *msg, error_t err)#line 155{

/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg = (void *)0;/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend();/*AMQueueP.AMQueueImplP*/AMQueueImplP$0$

361

Send$sendDone(last, msg, err);}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\ActiveMessageLayerC.nc"static error_t ActiveMessageLayerC$AMSend$send(am_id_t id, am_addr_t addr, message_t *msg, uint8_t len){

error_t error;error = ActiveMessageLayerC$Config$checkPacket(msg);if (error != SUCCESS) {

return error;}

ActiveMessageLayerC$AMPacket$setSource(msg, ActiveMessageLayerC$AMPacket$address());ActiveMessageLayerC$AMPacket$setGroup(msg, ActiveMessageLayerC$AMPacket$localGroup());ActiveMessageLayerC$AMPacket$setType(msg, id);ActiveMessageLayerC$AMPacket$setDestination(msg, addr);return ActiveMessageLayerC$SubSend$send(msg, len);

}# 95 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\ActiveMessageAddressC.nc"static am_addr_t ActiveMessageAddressC$amAddress(void)#line 95{

am_addr_t myAddr;#line 97

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 97

myAddr = ActiveMessageAddressC$addr;#line 97

__nesc_atomic_end(__nesc_atomic); }return myAddr;

}# 159 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SchedulerBasicP.nc"static error_t SchedulerBasicP$TaskBasic$postTask(uint8_t id){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 161

{#line 161

{unsigned char __nesc_temp =

#line 161SchedulerBasicP$pushTask(id) ? SUCCESS : EBUSY;{

#line 161__nesc_atomic_end(__nesc_atomic);

#line 161return __nesc_temp;

}}

}#line 164

__nesc_atomic_end(__nesc_atomic); }}# 322 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static error_t Atm128SpiP$Resource$release(uint8_t id)#line 322{

error_t error = Atm128SpiP$ResourceArbiter$release(id);#line 324

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 324

{if (!Atm128SpiP$ArbiterInfo$inUse()) {

Atm128SpiP$stopSpi();}

}#line 328

__nesc_atomic_end(__nesc_atomic); }return error;

}# 123 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\SimpleArbiterP.nc"static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void)#line 123{

/* atomic removed: atomic calls only */

362

#line 124{

if (/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$state ==/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$RES_IDLE){

unsigned char __nesc_temp =#line 126

FALSE;#line 126

return __nesc_temp;}

}#line 128

return TRUE;}# 130 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static void HplAtm128SpiP$SPI$enableSpi(bool enabled)#line 130{

if (enabled) {* (volatile uint8_t *)(0x2C + 0x20) |= 1 << 6;HplAtm128SpiP$Mcu$update();

}else {

* (volatile uint8_t *)(0x2C + 0x20) &= ˜(1 << 6);HplAtm128SpiP$Mcu$update();

}}# 101 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TaskletC.nc"static void TaskletC$Tasklet$schedule(void){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{if (TaskletC$state != 0)

{TaskletC$state |= 0x80;{

#line 108__nesc_atomic_end(__nesc_atomic);

#line 108return;

}}

TaskletC$state = 1;}

#line 112__nesc_atomic_end(__nesc_atomic); }

TaskletC$doit();}#line 63static void TaskletC$doit(void){

for (; ; ){

TaskletC$Tasklet$run();{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{if (TaskletC$state == 1){TaskletC$state = 0;{

#line 74__nesc_atomic_end(__nesc_atomic);

#line 74return;

}}

for (; 0; ) ;TaskletC$state = 1;

}#line 79

__nesc_atomic_end(__nesc_atomic); }}

}# 252 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static bool RF230LayerP$isSpiAcquired(void){

if (RF230LayerP$SpiResource$isOwner()) {return TRUE;}

if (RF230LayerP$SpiResource$immediateRequest() == SUCCESS){

RF230LayerP$SELN$makeOutput();RF230LayerP$SELN$set();

363

return TRUE;}

RF230LayerP$SpiResource$request();return FALSE;

}# 105 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static void Atm128SpiP$startSpi(void)#line 105{

Atm128SpiP$Spi$enableSpi(FALSE);{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

#line 107{Atm128SpiP$Spi$initMaster();Atm128SpiP$Spi$enableInterrupt(FALSE);Atm128SpiP$Spi$setMasterDoubleSpeed(TRUE);Atm128SpiP$Spi$setClockPolarity(FALSE);Atm128SpiP$Spi$setClockPhase(FALSE);Atm128SpiP$Spi$setClock(0);Atm128SpiP$Spi$enableSpi(TRUE);

}#line 115

__nesc_atomic_end(__nesc_atomic); }Atm128SpiP$McuPowerState$update();

}# 115 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"static void HplAtm128SpiP$SPI$enableInterrupt(bool enabled)#line 115{

if (enabled) {* (volatile uint8_t *)(0x2C + 0x20) |= 1 << 7;HplAtm128SpiP$Mcu$update();

}else {

* (volatile uint8_t *)(0x2C + 0x20) &= ˜(1 << 7);HplAtm128SpiP$Mcu$update();

}}# 313 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static error_t Atm128SpiP$Resource$request(uint8_t id)#line 313{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();#line 314

{if (!Atm128SpiP$ArbiterInfo$inUse()) {

Atm128SpiP$startSpi();}

}#line 318

__nesc_atomic_end(__nesc_atomic); }return Atm128SpiP$ResourceArbiter$request(id);

}# 69 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\TransformCounterC.nc"static /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$Counter$get(void){

/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type rv = 0;

#line 72{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$upper_count_type high =/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$m_upper;/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$from_size_type low =/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$get();

#line 76if (/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$isOverflowPending()){

high++;low = /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$CounterFrom$get();

}{/*LocalTimeMicroC.TransformCounterC*/

364

TransformCounterC$0$to_size_type high_to = high;/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$to_size_type low_to = low >>/*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$LOW_SHIFT_RIGHT;

#line 90rv = (high_to << /*LocalTimeMicroC.TransformCounterC*/TransformCounterC$0$HIGH_SHIFT_LEFT) | low_to;

}}

#line 92__nesc_atomic_end(__nesc_atomic); }

return rv;}# 157 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230PacketP.nc"static void RF230PacketP$PacketTimeStampRadio$set(message_t *msg, uint32_t value){

RF230PacketP$getMeta(msg)->flags |=RF230PACKET_TIMESTAMP;RF230PacketP$getMeta(msg)->timestamp = value;

}# 74 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\timer\\Atm128AlarmC.nc"static void /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size t0,/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size dt)#line 74{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size now;

#line 83/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size elapsed;

#line 83/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$timer_size expires;;now = /*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get();elapsed = now + 3 - t0;if (elapsed >= dt) {expires = now + 3;}

else {#line 93

expires = t0 + dt;}

if (expires == 0) {expires = 1;}

/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(expires - 1);/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset();/*HplRF230C.AlarmC.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start();

}#line 107

__nesc_atomic_end(__nesc_atomic); }}# 92 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TrafficMonitorLayerP.nc"static void TrafficMonitorLayerP$SubSend$sendDone(error_t error){

if (error == SUCCESS) {TrafficMonitorLayerP$txAverage += TrafficMonitorLayerP$TrafficMonitorConfig$getChannelTime(TrafficMonitorLayerP$txMsg);}

TrafficMonitorLayerP$RadioSend$sendDone(error);}# 195 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230ActiveMessageP.nc"static uint16_t RF230ActiveMessageP$TrafficMonitorConfig$getChannelTime(message_t *msg){

uint8_t len = RF230ActiveMessageP$IEEE154Packet$getLength(msg);

#line 205return RF230ActiveMessageP$IEEE154Packet$getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10;

}#line 124static void RF230ActiveMessageP$SoftwareAckConfig$

365

setAckReceived(message_t *msg, bool acked){

if (acked) {RF230ActiveMessageP$getMeta(msg)->flags |=RF230PACKET_WAS_ACKED;}

else {#line 129

RF230ActiveMessageP$getMeta(msg)->flags &=˜RF230PACKET_WAS_ACKED;}

}# 225 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\IEEE154PacketP.nc"static bool IEEE154PacketP$IEEE154Packet$requiresAckReply(message_t *msg){

return IEEE154PacketP$IEEE154Packet$getAckRequired(msg)&& IEEE154PacketP$IEEE154Packet$isDataFrame(msg)&& IEEE154PacketP$IEEE154Packet$getDestAddr(msg) ==IEEE154PacketP$ActiveMessageAddress$amAddress();

}# 389 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RF230LayerP.nc"static error_t RF230LayerP$RadioSend$send(message_t *msg){

uint16_t time;uint8_t length;uint8_t *data;uint8_t header;uint32_t time32;void *timesync;if (((RF230LayerP$cmd != RF230LayerP$CMD_NONE ||RF230LayerP$state != RF230LayerP$STATE_RX_ON) ||!RF230LayerP$isSpiAcquired()) || RF230LayerP$radioIrq) {return EBUSY;}

length = (RF230LayerP$PacketTransmitPower$isSet(msg) ?RF230LayerP$PacketTransmitPower$get(msg) : 0) &RF230_TX_PWR_MASK;if (length != RF230LayerP$txPower)

{RF230LayerP$txPower = length;RF230LayerP$writeRegister(RF230_PHY_TX_PWR,RF230_TX_AUTO_CRC_ON | RF230LayerP$txPower);

}if (

#line 410RF230LayerP$RF230Config$requiresRssiCca(msg)&& (RF230LayerP$readRegister(RF230_PHY_RSSI) &RF230_RSSI_MASK) > (RF230LayerP$rssiClear +RF230LayerP$rssiBusy) >> 3) {return EBUSY;}

RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_PLL_ON);time32 = RF230LayerP$LocalTime$get();timesync = RF230LayerP$PacketTimeSyncOffset$isSet(msg)? msg->data + RF230LayerP$PacketTimeSyncOffset$get(msg) : 0;if ((RF230LayerP$readRegister(RF230_TRX_STATUS) &RF230_TRX_STATUS_MASK) != RF230_PLL_ON)

{for (; 0; ) ;RF230LayerP$state = RF230LayerP$STATE_PLL_ON_2_RX_ON;return EBUSY;

}{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{RF230LayerP$SLP_TR$set();time = RF230LayerP$RadioAlarm$getNow() +RF230LayerP$TX_SFD_DELAY;

}#line 433

__nesc_atomic_end(__nesc_atomic); }RF230LayerP$SLP_TR$clr();for (; 0; ) ;RF230LayerP$SELN$clr();RF230LayerP$HplRF230$spiSplitWrite(RF230_CMD_FRAME_WRITE);length = RF230LayerP$RF230Config$getLength(msg);data = RF230LayerP$RF230Config$getPayload(msg);RF230LayerP$HplRF230$spiSplitReadWrite(length);length -= 2;header = RF230LayerP$RF230Config$getHeaderLength();

366

if (header > length) {header = length;}

length -= header;do {

RF230LayerP$HplRF230$spiSplitReadWrite(* data++);}

while (--header != 0);time32 += (int16_t )time - (int16_t )time32;if (timesync != 0) {

__nesc_hton_int32((unsigned char *)&*(timesync_relative_t *)timesync, * (timesync_absolute_t *)timesync - time32);}

do {RF230LayerP$HplRF230$spiSplitReadWrite(* data++);

}while (--length != 0);RF230LayerP$HplRF230$spiSplitRead();RF230LayerP$SELN$set();

#line 489RF230LayerP$writeRegister(RF230_TRX_STATE, RF230_RX_ON);

#line 504if (timesync != 0) {

* (timesync_absolute_t *)timesync =__nesc_ntoh_int32((unsigned char *)&*(timesync_relative_t *)timesync) + time32;}

RF230LayerP$PacketTimeStamp$set(msg, time32);RF230LayerP$state = RF230LayerP$STATE_BUSY_TX_2_RX_ON;RF230LayerP$cmd = RF230LayerP$CMD_TRANSMIT;return SUCCESS;

}# 38 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RadioAlarm.nc"static void RandomCollisionLayerP$RadioAlarm$wait(uint16_t arg_0x1a995d20){#line 38

RadioAlarmP$RadioAlarm$wait(1U, arg_0x1a995d20);#line 38}#line 38# 83 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\NeighborhoodP.nc"static uint8_t NeighborhoodP$Neighborhood$insertNode(am_addr_t node){

uint8_t i;uint8_t maxAge;if (NeighborhoodP$nodes[NeighborhoodP$last] == node)

{if (NeighborhoodP$ages[NeighborhoodP$last] ==NeighborhoodP$time) {return NeighborhoodP$last;}

NeighborhoodP$ages[NeighborhoodP$last] =++NeighborhoodP$time;maxAge = 0x80;

}else

{uint8_t oldest = 0;

#line 99maxAge = 0;for (i = 0; i < 5; ++i){

uint8_t age;if (NeighborhoodP$nodes[i] == node){NeighborhoodP$last = i;if (NeighborhoodP$ages[i] == NeighborhoodP$time) {return i;}

NeighborhoodP$ages[i] = ++NeighborhoodP$time;maxAge = 0x80;break;

}age = NeighborhoodP$time - NeighborhoodP$ages[i];if (age > maxAge){maxAge = age;oldest = i;

}}

if (i == 5){

367

NeighborhoodP$Neighborhood$evicted(oldest);NeighborhoodP$last = oldest;NeighborhoodP$nodes[oldest] = node;NeighborhoodP$ages[oldest] = ++NeighborhoodP$time;NeighborhoodP$flags[oldest] = 0;

}}

if ((NeighborhoodP$time & 0x7F) == 0x7F && maxAge >= 0x7F){for (i = 0; i < 5; ++i)

{if ((NeighborhoodP$ages[i] | 0x7F) != NeighborhoodP$time) {NeighborhoodP$ages[i] = NeighborhoodP$time & 0x80;}

}}

return NeighborhoodP$last;}# 73 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\RandomCollisionLayerP.nc"static uint16_t RandomCollisionLayerP$getBackoff(uint16_t maxBackoff){

uint16_t a;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{a = RandomCollisionLayerP$nextRandom;RandomCollisionLayerP$nextRandom += 273;

}#line 81

__nesc_atomic_end(__nesc_atomic); }RandomCollisionLayerP$calcNextRandom$postTask();return a % maxBackoff + RandomCollisionLayerP$Config$getMinimumBackoff();

}# 58 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\RandomMlcgC.nc"static uint32_t RandomMlcgC$Random$rand32(void)#line 58{

uint32_t mlcg;#line 59

uint32_t p;#line 59

uint32_t q;uint64_t tmpseed;

#line 61{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{tmpseed = (uint64_t )33614U * (uint64_t )RandomMlcgC$seed;q = tmpseed;q = q >> 1;p = tmpseed >> 32;mlcg = p + q;if (mlcg & 0x80000000) {

mlcg = mlcg & 0x7FFFFFFF;mlcg++;

}RandomMlcgC$seed = mlcg;

}#line 73

__nesc_atomic_end(__nesc_atomic); }return mlcg;

}# 133 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$startTimer(uint8_t num, uint32_t t0, uint32_t dt, bool isoneshot){

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer_t *timer = &/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num];

#line 136timer->t0 = t0;timer->dt = dt;timer->isoneshot = isoneshot;timer->isrunning = TRUE;/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask();

}# 188 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$get(void)

368

#line 188{

uint32_t now;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{uint8_t now8 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get();if (((Atm128_TIFR2_t )/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$getInterruptFlag()).bits.ocfa) {

now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$get() + 1 + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get();}

else {now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base + now8;}

}#line 206

__nesc_atomic_end(__nesc_atomic); }#line 206

return now;}# 45 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\system\\AMQueueEntryP.nc"static error_t /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t dest,message_t *msg,uint8_t len)#line 47{

/*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(msg, dest);/*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setType(msg, 6);return /*ForwardToBaseAppC.AMSenderC.AMQueueEntryP*/AMQueueEntryP$0$Send$send(msg, len);

}# 88 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\TaskletC.nc"static void TaskletC$Tasklet$resume(void){

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{

if (--TaskletC$state != 0x80) {{

#line 93__nesc_atomic_end(__nesc_atomic);

#line 93return;

}}

#line 95TaskletC$state = 1;

}#line 96

__nesc_atomic_end(__nesc_atomic); }TaskletC$doit();

}# 63 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\rf230\\MessageBufferLayerP.nc"static error_t MessageBufferLayerP$SplitControl$start(void){

error_t error;MessageBufferLayerP$Tasklet$suspend();if (MessageBufferLayerP$state != MessageBufferLayerP$STATE_READY) {

error = EBUSY;}

else {#line 72

error = MessageBufferLayerP$RadioState$turnOn();}

if (error == SUCCESS) {MessageBufferLayerP$state = MessageBufferLayerP$STATE_TURN_ON;}

MessageBufferLayerP$Tasklet$resume();return error;

}# 62 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\lib\\timer\\VirtualizeTimerC.nc"

369

static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$fireTimers(uint32_t now){

uint8_t num;for (num = 0; num < /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$NUM_TIMERS; num++)

{/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer_t *timer = &/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num];if (timer->isrunning)

{uint32_t elapsed = now - timer->t0;if (elapsed >= timer->dt){if (timer->isoneshot) {timer->isrunning = FALSE;}

else {#line 79

timer->t0 += timer->dt;}

/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$fired(num);break;

}}

}/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask();

}# 239 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\Atm1281AlarmAsyncP.nc"static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$startAt(uint32_t nt0, uint32_t ndt)#line 239{

{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();{

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$set = TRUE;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$t0 = nt0;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$dt = ndt;

}#line 245

__nesc_atomic_end(__nesc_atomic); }/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt();

}#line 117static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setInterrupt(void)#line 117{

bool fired = FALSE;{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();

{uint8_t interrupt_in = 1 +/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Compare$get()- /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Timer$get();uint8_t newOcr2A;uint8_t tifr2 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$TimerCtrl$getInterruptFlag();

#line 128;if ((interrupt_in != 0 && interrupt_in </*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MINDT) || tifr2 & (1 << 1)) {

if (interrupt_in < /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MINDT) {

;}

else {;

}{

#line 136__nesc_atomic_end(__nesc_atomic);

#line 136return;

}

370

}if (!/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$set) {

newOcr2A = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MAXT;;

}else

{uint32_t now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Counter$get();

#line 147;if ((uint32_t )(now - /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$t0) >=/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$dt){/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$set = FALSE;fired = TRUE;newOcr2A = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MAXT;

}else{uint32_t alarm_in = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$t0 +/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$dt - /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$base;if (alarm_in > /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MAXT) {newOcr2A = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MAXT;}

else {#line 163

if ((uint8_t )alarm_in < /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MINDT) {

newOcr2A = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$MINDT;}

else {#line 166

newOcr2A = alarm_in;}

}}

}#line 169

newOcr2A--;/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$setOcr2A(newOcr2A);

}#line 171

__nesc_atomic_end(__nesc_atomic); }if (fired) {

/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm1281AlarmAsyncP*/Atm1281AlarmAsyncP$0$Alarm$fired();}

}# 222 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer2AsyncP.nc"__attribute((signal)) void __vector_13(void)#line 222{

HplAtm1281Timer2AsyncP$stabiliseTimer2();HplAtm1281Timer2AsyncP$Compare$fired();

}__attribute((signal)) void __vector_15(void)#line 230{

HplAtm1281Timer2AsyncP$stabiliseTimer2();HplAtm1281Timer2AsyncP$Timer$overflow();

}# 206 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm1281\\timer\\HplAtm1281Timer1P.nc"__attribute((interrupt)) void __vector_17(void)#line 206{

371

HplAtm1281Timer1P$CompareA$fired();}__attribute((interrupt)) void __vector_18(void)#line 210{

HplAtm1281Timer1P$CompareB$fired();}__attribute((interrupt)) void __vector_19(void)#line 214{

HplAtm1281Timer1P$CompareC$fired();}__attribute((interrupt)) void __vector_16(void)#line 218{

HplAtm1281Timer1P$Capture$captured(HplAtm1281Timer1P$Timer$get());}__attribute((interrupt)) void __vector_20(void)#line 222{

HplAtm1281Timer1P$Timer$overflow();}# 102 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\HplAtm128SpiP.nc"__attribute((signal)) void __vector_24(void)#line 102{

HplAtm128SpiP$SPI$dataReady(HplAtm128SpiP$SPI$read());}# 127 "C:\\Crossbow\\cygwin\\opt\\MoteWorks\\tinyos-2.x\\tos\\chips\\atm128\\spi\\Atm128SpiP.nc"static uint8_t Atm128SpiP$SpiByte$write(uint8_t tx)#line 127{

Atm128SpiP$Spi$enableSpi(TRUE);Atm128SpiP$McuPowerState$update();Atm128SpiP$Spi$write(tx);while (!(* (volatile uint8_t *)(0x2D + 0x20) & 0x80)) ;return Atm128SpiP$Spi$read();

}

B.4 InterceptBase

B.4.1 BaseStationC/** "Copyright (c) 2000-2003 The Regents of the University of California.* All rights reserved.** Permission to use, copy, modify, and distribute this software and its* documentation for any purpose, without fee, and without written agreement is* hereby granted, provided that the above copyright notice, the following* two paragraphs and the author appear in all copies of this software.** IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.** THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."** Copyright (c) 2002-2003 Intel Corporation* All rights reserved.** This file is distributed under the terms in the attached INTEL-LICENSE* file. If you do not find these files, copies can be found by writing to* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,* 94704. Attention: Intel License Inquiry.*//*** The TinyOS 2.x base station that forwards packets between the UART* and radio.It replaces the GenericBase of TinyOS 1.0 and the* TOSBase of TinyOS 1.1.** <p>On the serial link, BaseStation sends and receives simple active* messages (not particular radio packets): on the radio link, it* sends radio active messages, whose format depends on the network* stack being used. BaseStation will copy its compiled-in group ID to* messages moving from the serial link to the radio, and will filter* out incoming radio messages that do not contain that group ID.</p>*

372

* <p>BaseStation includes queues in both directions, with a guarantee* that once a message enters a queue, it will eventually leave on the* other interface. The queues allow the BaseStation to handle load* spikes.</p>** <p>BaseStation acknowledges a message arriving over the serial link* only if that message was successfully enqueued for delivery to the* radio link.</p>** <p>The LEDS are programmed to toggle as follows:</p>* <ul>* <li><b>RED Toggle:</b>: Message bridged from serial to radio</li>* <li><b>GREEN Toggle:</b> Message bridged from radio to serial</li>* <li><b>YELLOW/BLUE Toggle:</b> Dropped message due to queue overflow in either direction</li>* </ul>** @author Phil Buonadonna* @author Gilman Tolle* @author David Gay* @author Philip Levis* @author Dimas Abreu Dutra* @date January 29 2008*/configuration BaseStationC {

provides interface Intercept as RadioIntercept[am_id_t amid];provides interface Intercept as SerialIntercept[am_id_t amid];

}implementation {

components MainC, BaseStationP, LedsC;components ActiveMessageC as Radio, SerialActiveMessageC as Serial;RadioIntercept = BaseStationP.RadioIntercept;SerialIntercept = BaseStationP.SerialIntercept;MainC.Boot <- BaseStationP;BaseStationP.RadioControl -> Radio;BaseStationP.SerialControl -> Serial;BaseStationP.UartSend -> Serial;BaseStationP.UartReceive -> Serial;BaseStationP.UartPacket -> Serial;BaseStationP.UartAMPacket -> Serial;BaseStationP.RadioSend -> Radio;BaseStationP.RadioReceive -> Radio.Receive;BaseStationP.RadioSnoop -> Radio.Snoop;BaseStationP.RadioPacket -> Radio;BaseStationP.RadioAMPacket -> Radio;BaseStationP.Leds -> LedsC;

}

B.4.2 BaseStationP/** "Copyright (c) 2000-2005 The Regents of the University of California.* All rights reserved.** Permission to use, copy, modify, and distribute this software and its* documentation for any purpose, without fee, and without written agreement is* hereby granted, provided that the above copyright notice, the following* two paragraphs and the author appear in all copies of this software.** IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.** THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."** Copyright (c) 2002-2005 Intel Corporation* All rights reserved.** This file is distributed under the terms in the attached INTEL-LICENSE* file. If you do not find these files, copies can be found by writing to* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,* 94704. Attention: Intel License Inquiry.*//** @author Phil Buonadonna* @author Gilman Tolle* @author David Gay* @author Dimas Abreu Dutra*//** BaseStationP bridges packets between a serial channel and the radio.* Messages moving from serial to radio will be tagged with the group* ID compiled into the TOSBase, and messages moving from radio to

373

* serial will be filtered by that same group id.*/#include "AM.h"#include "Serial.h"module BaseStationP @safe() {

uses {interface Boot;interface SplitControl as SerialControl;interface SplitControl as RadioControl;interface AMSend as UartSend[am_id_t id];interface Receive as UartReceive[am_id_t id];interface Packet as UartPacket;interface AMPacket as UartAMPacket;interface AMSend as RadioSend[am_id_t id];interface Receive as RadioReceive[am_id_t id];interface Receive as RadioSnoop[am_id_t id];interface Packet as RadioPacket;interface AMPacket as RadioAMPacket;interface Leds;

}provides interface Intercept as RadioIntercept[am_id_t amid];provides interface Intercept as SerialIntercept[am_id_t amid];

}implementation{

enum {UART_QUEUE_LEN = 12,RADIO_QUEUE_LEN = 12,

};message_t uartQueueBufs[UART_QUEUE_LEN];message_t *uartQueue[UART_QUEUE_LEN];uint8_t uartIn, uartOut;bool uartBusy, uartFull;message_t radioQueueBufs[RADIO_QUEUE_LEN];message_t *radioQueue[RADIO_QUEUE_LEN];uint8_t radioIn, radioOut;bool radioBusy, radioFull;task void uartSendTask();task void radioSendTask();void dropBlink() {

call Leds.led2Toggle();}void failBlink() {

call Leds.led2Toggle();}event void Boot.booted() {

uint8_t i;for (i = 0; i < UART_QUEUE_LEN; i++)

uartQueue[i] = &uartQueueBufs[i];uartIn = uartOut = 0;uartBusy = FALSE;uartFull = TRUE;for (i = 0; i < RADIO_QUEUE_LEN; i++)

radioQueue[i] = &radioQueueBufs[i];radioIn = radioOut = 0;radioBusy = FALSE;radioFull = TRUE;call RadioControl.start();call SerialControl.start();

}event void RadioControl.startDone(error_t error) {

if (error == SUCCESS) {radioFull = FALSE;

}}event void SerialControl.startDone(error_t error) {

if (error == SUCCESS) {uartFull = FALSE;

}}event void SerialControl.stopDone(error_t error) {}event void RadioControl.stopDone(error_t error) {}uint8_t count = 0;message_t* receive(message_t* msg, void* payload,

uint8_t len, am_id_t id);event message_t *RadioSnoop.receive[am_id_t id](message_t *msg,

void *payload,uint8_t len) {return receive(msg, payload, len, id);

}event message_t *RadioReceive.receive[am_id_t id](message_t *msg,

void *payload,uint8_t len) {

374

return receive(msg, payload, len, id);}message_t* receive(message_t *msg, void *payload, uint8_t len, am_id_t id) {message_t *ret = msg;if (!signal RadioIntercept.forward[id](msg,payload,len))return ret;

atomic {if (!uartFull)

{ret = uartQueue[uartIn];uartQueue[uartIn] = msg;uartIn = (uartIn + 1) % UART_QUEUE_LEN;if (uartIn == uartOut)

uartFull = TRUE;if (!uartBusy)

{post uartSendTask();uartBusy = TRUE;

}}

elsedropBlink();

}return ret;

}uint8_t tmpLen;task void uartSendTask() {

uint8_t len;am_id_t id;am_addr_t addr, src;message_t* msg;atomicif (uartIn == uartOut && !uartFull)

{uartBusy = FALSE;return;

}msg = uartQueue[uartOut];tmpLen = len = call RadioPacket.payloadLength(msg);id = call RadioAMPacket.type(msg);addr = call RadioAMPacket.destination(msg);src = call RadioAMPacket.source(msg);call UartAMPacket.setSource(msg, src);if (call UartSend.send[id](addr, uartQueue[uartOut], len) == SUCCESS)

call Leds.led1Toggle();else

{failBlink();post uartSendTask();

}}event void UartSend.sendDone[am_id_t id](message_t* msg, error_t error) {

if (error != SUCCESS)failBlink();

elseatomic

if (msg == uartQueue[uartOut]){

if (++uartOut >= UART_QUEUE_LEN)uartOut = 0;

if (uartFull)uartFull = FALSE;

}post uartSendTask();

}event message_t *UartReceive.receive[am_id_t id](message_t *msg,void *payload,uint8_t len) {message_t *ret = msg;bool reflectToken = FALSE;if (!signal SerialIntercept.forward[id](msg,payload,len))return ret;

atomicif (!radioFull)

{reflectToken = TRUE;ret = radioQueue[radioIn];radioQueue[radioIn] = msg;if (++radioIn >= RADIO_QUEUE_LEN)

radioIn = 0;if (radioIn == radioOut)

radioFull = TRUE;if (!radioBusy)

{post radioSendTask();radioBusy = TRUE;

375

}}

elsedropBlink();

if (reflectToken) {//call UartTokenReceive.ReflectToken(Token);

}return ret;

}task void radioSendTask() {

uint8_t len;am_id_t id;am_addr_t addr;message_t* msg;atomicif (radioIn == radioOut && !radioFull)

{radioBusy = FALSE;return;

}msg = radioQueue[radioOut];len = call UartPacket.payloadLength(msg);addr = call UartAMPacket.destination(msg);id = call UartAMPacket.type(msg);if (call RadioSend.send[id](addr, msg, len) == SUCCESS)

call Leds.led0Toggle();else

{failBlink();post radioSendTask();

}}event void RadioSend.sendDone[am_id_t id](message_t* msg, error_t error) {if (error != SUCCESS)failBlink();

elseatomic

if (msg == radioQueue[radioOut]){

if (++radioOut >= RADIO_QUEUE_LEN)radioOut = 0;

if (radioFull)radioFull = FALSE;

}post radioSendTask();

}default event boolRadioIntercept.forward[am_id_t amid](message_t* msg,

void* payload,uint8_t len) {

return TRUE;}default event boolSerialIntercept.forward[am_id_t amid](message_t* msg,

void* payload,uint8_t len) {

return TRUE;}

}

B.5 RssiBaseB.5.1 RssiBaseAppC Code/** Copyright (c) 2008 Dimas Abreu Dutra* All rights reserved*//*** @author Dimas Abreu Dutra*//** Modified by Raul Ordonez and Huthaifa Al Issa* Dept. Eletrical and Computer Engineering* University of Dayton* Started: 26-Jan-2010* Last modified: 26-Jan-2010*/#include "RssiDemoMessages.h"#include "message.h"configuration RssiBaseAppC {} implementation {

components BaseStationC;

376

components RssiBaseC as App;#ifdef __CC2420_H__

components CC2420ActiveMessageC;App -> CC2420ActiveMessageC.CC2420Packet;

#elif defined(PLATFORM_IRIS)components RF230ActiveMessageC;App -> RF230ActiveMessageC.PacketRSSI;

#elif defined(TDA5250_MESSAGE_H)components Tda5250ActiveMessageC;App -> Tda5250ActiveMessageC.Tda5250Packet;

#endifApp-> BaseStationC.RadioIntercept[AM_RSSIMSG];

}

B.5.2 RssiBaseC/** Copyright (c) 2008 Dimas Abreu Dutra* All rights reserved*//*** @author Dimas Abreu Dutra*//*** @author Raul Ordonez* Dept. Eletrical and Computer Engineering* University of Dayton* Started: 26-Jan-2010* @date 1-Feb-2010*/#include "RssiDemoMessages.h"module RssiBaseC {

uses interface Intercept as RssiMsgIntercept;#ifdef __CC2420_H__

uses interface CC2420Packet;#elif defined(TDA5250_MESSAGE_H)

uses interface Tda5250Packet;#else

uses interface PacketField<uint8_t> as PacketRSSI;#endif} implementation {

uint16_t getRssi(message_t *msg);event bool RssiMsgIntercept.forward(message_t *msg,

void *payload,uint8_t len) {

RssiMsg *rssiMsg = (RssiMsg*) payload;// rssiMsg->rssi = getRssi(msg);

if (rssiMsg->forwarded)return TRUE;elsereturn FALSE;

}#ifdef __CC2420_H__

uint16_t getRssi(message_t *msg){return (uint16_t) call CC2420Packet.getRssi(msg);

}#elif defined(CC1K_RADIO_MSG_H)

uint16_t getRssi(message_t *msg){cc1000_metadata_t *md =(cc1000_metadata_t*) msg->metadata;return md->strength_or_preamble;

}#elif defined(PLATFORM_IRIS)

uint16_t getRssi(message_t *msg){if(call PacketRSSI.isSet(msg))return (uint16_t) call PacketRSSI.get(msg);

elsereturn 0xFFFF;

}#elif defined(TDA5250_MESSAGE_H)

uint16_t getRssi(message_t *msg){return call Tda5250Packet.getSnr(msg);

}#else

#error Radio chip not supported! This demo currently works only \for motes with CC1000, CC2420, RF230 or TDA5250 radios.

#endif}

377

B.6 SendingMote

B.6.1 SendingMoteAppC/*** Broadcasts messages to be received by the forwarding motes, which read* RSSI values and then send over to the base station for recording.** @author Raul Ordonez and Huthaifa Al Issa* Dept. Eletrical and Computer Engineering* University of Dayton* @date 26-Jan-2010* Last modified: 1-Feb-2010*/#include <Timer.h>#include "RssiDemoMessages.h"configuration SendingMoteAppC {}implementation {

components MainC;components LedsC;components SendingMoteC as App;components new TimerMilliC() as Timer0;components ActiveMessageC;components new AMSenderC(AM_RSSIMSG);components new AMReceiverC(AM_RSSIMSG);App.Boot -> MainC;App.Leds -> LedsC;App.Timer0 -> Timer0;App.Packet -> AMSenderC;App.AMPacket -> AMSenderC;App.AMControl -> ActiveMessageC;App.AMSend -> AMSenderC;App.Receive -> AMReceiverC;

}

B.6.2 SendingMoteC/*** Broadcasts messages to be received by the forwarding motes, which read* RSSI values and then send over to the base station for recording.** @author Raul Ordonez* Dept. Eletrical and Computer Engineering* University of Dayton* @date 26-Jan-2010* Last modified: 28-Feb-2010*/#include <Timer.h>#include "RssiDemoMessages.h"module SendingMoteC {

uses interface Boot;uses interface Leds;uses interface Timer<TMilli> as Timer0;uses interface Packet;uses interface AMPacket;uses interface AMSend;uses interface Receive;uses interface SplitControl as AMControl;

}implementation {

uint16_t counter;message_t pkt;bool busy = FALSE;void setLeds(uint16_t val) {

if (val & 0x01)call Leds.led0On();

elsecall Leds.led0Off();

if (val & 0x02)call Leds.led1On();

elsecall Leds.led1Off();

if (val & 0x04)call Leds.led2On();

elsecall Leds.led2Off();

}event void Boot.booted() {

call AMControl.start();}event void AMControl.startDone(error_t err) {

378

if (err == SUCCESS) {call Timer0.startPeriodic(SEND_INTERVAL_MS);

}else {

call AMControl.start();}

}event void AMControl.stopDone(error_t err) {}event void Timer0.fired() {

counter++;if (!busy) {

RssiMsg* btrpkt =(RssiMsg*)(call Packet.getPayload(&pkt, sizeof(RssiMsg)));

if (btrpkt == NULL) {return;

}btrpkt->sender_id = TOS_NODE_ID;btrpkt->counter = counter;

btrpkt->forwarded = FALSE;if (call AMSend.send(AM_BROADCAST_ADDR,

&pkt, sizeof(RssiMsg)) == SUCCESS) {busy = TRUE;

}}

}event void AMSend.sendDone(message_t* msg, error_t err) {

if (&pkt == msg) {busy = FALSE;

}}event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len){if (len == sizeof(RssiMsg)) {RssiMsg* btrpkt = (RssiMsg*)payload;setLeds(btrpkt->counter);

}return msg;

}}

379

APPENDIX C

ROBUSTNESS CODE

C.1 Robustness Code

C.1.1 Compute Median and Rms From Experimental Data%% Description% This script compute the median and rms for configuration I and II%%% Author: Huthaifa Al_Issa, Raul Ordonez,% Date started: 8-10-2010% Last modified: 10-11-2010close allclear allclcHuthaifa_2048datanum = input(’Data number needed: ’);for ii = 1:length(data(datanum).receiver)

if datanum ˜= data(datanum).receiver(ii)inputdata = sprintf(’Data%d%d’,datanum,data(datanum).receiver(ii))StdDev = std(data(datanum).dBm(ii,:))meann = mean(data(datanum).dBm(ii,:))media = median(data(datanum).dBm(ii,:))Dsqr = (data(datanum).dBm(ii,:)).ˆ2;Root_mean = sqrt(1/length(data(1).dBm)*sum(Dsqr))disp(’=============================’)

endend

C.1.2 Huthaifa 2048 Code%%%% Description% This script compute the robustness for configuration I and II.% This script compute the fft for RSSI data Collect from a single experiment.% consisting of 2048 samples,%%% Author: Huthaifa Al_Issa, Raul Ordonez,% Date started: 8-10-2010% Last modified: 10-11-2010clear, close all, clcload rssi_data1[D, cross_PLE, avg_TXtoall, data] = process_data_func(rssi_data);% N = 1024;N = length(data(1).dBm);data(1).dBm(1,1:N);data(1).dBm(2,1:N);data(1).dBm(3,1:N);data(1).dBm(4,1:N);figure(1); clf;hold on;plot (data(1).dBm(1,1:N));gridxlabel(’Time (seconds)’);ylabel(’Signal’);title(’Data for Mote # (2)’);hold off;figure(2);clf;hold on;plot (data(1).dBm(2,1:N));grid

380

xlabel(’Time (seconds)’);ylabel(’Signal’);title(’Data for Mote # (3)’);hold off;figure(3);clf;hold on;plot (data(1).dBm(3,1:N));gridxlabel(’Time (seconds)’);ylabel(’Signal’);title(’Data for Mote # (4)’);hold off;figure(4);clf;hold on;plot (data(1).dBm(4,1:N));gridxlabel(’Time (seconds)’);ylabel(’Signal’);title(’Data for Mote # (5)’);hold off;%% Use fft to compute the exponential Fourier series coefficientsDn2 = fft(data(1).dBm(1,1:N)-mean(data(1).dBm(1,1:N)))/(2*N);

% need to scale by 1/(2*N) to get right valuesDn3 = fft(data(1).dBm(2,1:N)-mean(data(1).dBm(2,1:N)))/(2*N);Dn4 = fft(data(1).dBm(3,1:N)-mean(data(1).dBm(3,1:N)))/(2*N);Dn5 = fft(data(1).dBm(4,1:N)-mean(data(1).dBm(4,1:N)))/(2*N);n = [-N/2 : N/2-0*1]; % range of index nn = linspace(-.5,.5,N);figure(5);clf;subplot(2,1,1);stem(n,abs(fftshift(Dn2)));

% use fftshift to get D(0) at the center of spectrumhold on;plot(n,abs(fftshift(Dn2)),’r--’);

% plot envelope for better visualizationgrid ;xlabel(’n’);ylabel(’|D_n|’);title(’Exponential Fourier series coefficients(Dn2)’)subplot(2,1,2);stem(n,angle(fftshift(Dn2))); % now, plot angleshold on;plot(n,angle(fftshift(Dn2)),’r--’);grid;% ylim([-4 4]);xlabel(’n’);ylabel(’\angle D_n (rad)’);figure(6);clf;subplot(2,1,1);stem(n,abs(fftshift(Dn3)));

% use fftshift to get D(0) at the center of spectrumhold on;plot(n,abs(fftshift(Dn3)),’r--’);% plot envelope for better visualizationgrid ;xlabel(’n’);ylabel(’|D_n|’);title(’Exponential Fourier series coefficients(Dn3)’)subplot(2,1,2);stem(n,angle(fftshift(Dn3))); % now, plot angleshold on;plot(n,angle(fftshift(Dn3)),’r--’);grid;% ylim([-4 4]);xlabel(’n’);ylabel(’\angle D_n (rad)’);figure(7);clf;subplot(2,1,1);stem(n,abs(fftshift(Dn4)));

% use fftshift to get D(0) at the center of spectrumhold on;plot(n,abs(fftshift(Dn4)),’r--’);

% plot envelope for better visualizationgrid ;xlabel(’n’);ylabel(’|D_n|’);title(’Exponential Fourier series coefficients(Dn4)’)subplot(2,1,2);stem(n,angle(fftshift(Dn4))); % now, plot angleshold on;plot(n,angle(fftshift(Dn4)),’r--’);grid;% ylim([-4 4]);xlabel(’n’);ylabel(’\angle D_n (rad)’);

381

figure(8);clf;subplot(2,1,1);stem(n,abs(fftshift(Dn5)));

% use fftshift to get D(0) at the center of spectrumhold on;plot(n,abs(fftshift(Dn5)),’r--’);

% plot envelope for better visualizationgrid ;xlabel(’n’);ylabel(’|D_n|’);title(’Exponential Fourier series coefficients(Dn5)’)subplot(2,1,2);stem(n,angle(fftshift(Dn5))); % now, plot angleshold on;plot(n,angle(fftshift(Dn5)),’r--’);grid;% ylim([-4 4]);xlabel(’n’);ylabel(’\angle D_n (rad)’);figure (13);clf;subplot(4,1,1)plot(data(1).dBm(1,1:N)),gridtitle(’Sensitivity (Dn2)’);subplot(4,1,2)plot(data(1).dBm(2,1:N)),gridtitle(’Sensitivity (Dn3)’);subplot(4,1,3)plot(data(1).dBm(3,1:N)),gridtitle(’Sensitivity (Dn4)’);subplot(4,1,4)plot(data(1).dBm(4,1:N)),gridtitle(’Sensitivity (Dn5)’);

C.1.3 Robustness For Configuration I and II Code%% Description% This script compute the robustness for configuration I and II%%% Author: Huthaifa Al_Issa, Raul Ordonez,% Date started: 8-10-2010% Last modified: 10-11-2010close allclear allclcrms_I_10_2 = [52.1567, 53.2752, 52.6817, 53.6649, 53.2982, 52.1895, 53.3020, 54.7527, 53.5966];median_I_10_2 = [-51, -51, -51, -51, -51, -51, -51, -51, -51];rms_I_10_3 = [46.9246, 49.2691, 49.8293, 52.4256, 50.0050, 50.1750, 48.8601, 49.7731, 53.9702];median_I_10_3 = [-46, -48, -46, -49, -47, -49, -47, -49, -52];rms_I_10_4 = [62.2505, 62.9554, 62.2976, 63.8596, 63.7829, 63.5718, 62.3420, 63.1766, 64.7914];median_I_10_4 = [-62, -63, -62, -64, -64, -64, -62, -63, -64];rms_I_10_5 = [59.8888, 60.6312, 59.3891, 59.8397, 59.3783, 59.1834, 59.7315, 58.5320, 58.4367];median_I_10_5 = [-60, -59, -59, -60, -58.5, -59, -60, -58, -58];Expnums = length(median_I_10_3);new_metric_I_median = [13.3172,14.0110, 13.6210, 13.7976, 13.1483,13.4017, 13.5191, 14.8098, 12.6258];error_I=[0.67615, 0.59429, 0.708, 0.7095, 0.70115, 0.67096,0.2, 0.61426, 0.62821];figure(1)plot(1:Expnums,abs(median_I_10_2),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_I_10_2,’rs’)title(’Median and rms for I (0 to 1)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(2)plot(1:Expnums,abs(median_I_10_3),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_I_10_3,’rs’)title(’Median and rms for I (0 to 2)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(3)plot(1:Expnums,abs(median_I_10_4),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_I_10_4,’rs’)title(’Median and rms for I (0 to 3)’,’linewidth’, 3)legend(’Median’,’RMS’)

382

xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(4)plot(1:Expnums,abs(median_I_10_5),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_I_10_5,’rs’)title(’Median and rms for I (0 to 4)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridrms_II_10_2 = [51.5447, 51.5499, 52.2440, 51.4922, 50.6998,51.3384, 49.5458, 49.0316, 49.7152 ];median_II_10_2 = [-51, -51, -51, -50, -50, -50, -49, -49, -49];rms_II_10_3 =[63.0793, 68.7873, 61.8355, 68.9230, 70.4066,55.3407, 61.1896, 63.9805, 59.5341];median_II_10_3 = [-62, -69, -61, -69, -70, -53, -60, -63, -60];rms_II_10_4 = [65.3756, 65.4295, 63.2072, 61.0114, 61.1498,60.9756, 60.9991, 61.2216, 61.7830];median_II_10_4 = [-64, -64, -64, -61, -61, -61, -61, -61, -61];rms_II_10_5 = [54.9865, 54.9856, 54.9535, 56.4752, 56.9874,58.3577, 56.3018, 55.6403, 57.2794];median_II_10_5 = [-55, -55, -55, -55, -55, -55, -55, -54, -55];new_metric_II_median = [12.6110, 14.3836, 13.2137, 16.1268,18.6422, 12.3092, 13.9985, 15.0935, 13.5461];Metric_B= [12.5510, 14.3424, 13.1844, 16.0450, 18.5383,

12.1673, 13.9269, 15.0211,13.4719];error_II= [0.89564, 2.7948, 1.0245, 3.1446, 4.1013, 0.41865,0.50343, 1.0101, 0.34061];figure(5)plot(1:Expnums,abs(median_II_10_2),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_II_10_2,’rs’)title(’Median and rms for II (0 to 1)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(6)plot(1:Expnums,abs(median_II_10_3),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_II_10_3,’rs’)title(’Median and rms for II (0 to 2)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(7)plot(1:Expnums,abs(median_II_10_4),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_II_10_4,’rs’)title(’Median and rms for II (0 to 3)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridfigure(8)plot(1:Expnums,abs(median_II_10_5),’bo’,’linewidth’, 3)hold onplot(1:Expnums,rms_II_10_5,’rs’)title(’Median and rms for II (0 to 4)’,’linewidth’, 3)legend(’Median’,’RMS’)xlabel(’Experiment number’);ylabel(’RSSI’);gridFC1 = (rms_I_10_2 + abs(median_I_10_2))./rms_I_10_2.ˆ2;FC2 = (rms_I_10_3 + abs(median_I_10_3))./rms_I_10_3.ˆ2;FC3 = (rms_I_10_4 + abs(median_I_10_4))./rms_I_10_4.ˆ2;FC4 = (rms_I_10_5 + abs(median_I_10_5))./rms_I_10_5.ˆ2;figure(9)plot(1:Expnums,FC1,’r-’,’linewidth’,3)hold onplot(1:Expnums,FC1,’bo’,’linewidth’,3)title(’Configuration I (0 to 1)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(10)plot(1:Expnums,FC2,’r-’,’linewidth’,3)hold onplot(1:Expnums,FC2,’bo’,’linewidth’,3)title(’Configuration I (0 to 2)’)xlabel(’Experiment number’);

383

ylabel(’Robustness’);gridfigure(11)plot(1:Expnums,FC3,’r-’,’linewidth’,3)hold onplot(1:Expnums,FC3,’bo’,’linewidth’,3)title(’Configuration I (0 to 3)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(12)plot(1:Expnums,FC4,’r-’,’linewidth’,3)hold onplot(1:Expnums,FC4,’bo’,’linewidth’,3)title(’Configuration I (0 to 4)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridFE1 = (rms_II_10_2 + abs(median_II_10_2))./rms_II_10_2.ˆ2;FE2 = (rms_II_10_3 + abs(median_II_10_3))./rms_II_10_3.ˆ2;FE3 = (rms_II_10_4 + abs(median_II_10_4))./rms_II_10_4.ˆ2;FE4 = (rms_II_10_5 + abs(median_II_10_5))./rms_II_10_5.ˆ2;figure(13)plot(1:Expnums,FE1,’r-’,’linewidth’,3)hold onplot(1:Expnums,FE1,’bo’,’linewidth’,3)title(’Configuration II (0 to 1)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(14)plot(1:Expnums,FE2,’r-’,’linewidth’,3)hold onplot(1:Expnums,FE2,’bo’,’linewidth’,3)title(’Configuration II (0 to 2)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(15)plot(1:Expnums,FE3,’r-’,’linewidth’,3)hold onplot(1:Expnums,FE3,’bo’,’linewidth’,3)title(’Configuration II (0 to 3)’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(16)plot(1:Expnums,FE4,’r-’,’linewidth’,3)hold onplot(1:Expnums,FE4,’bo’,’linewidth’,3)title(’Configuration II (0 to 4)’)xlabel(’Experiment number’);ylabel(’Robustness’);grid%%RC = FC1 + FC2 + FC3 +FC4 ;figure(17)plot(1:Expnums,RC,’r-’,’linewidth’,3)hold onplot(1:Expnums,RC,’bo’,’linewidth’,3)title(’Robustness for whole configuration I’)xlabel(’Experiment number’);ylabel(’Robustness’);gridRE = FE1 + FE2 + FE3 +FE4 ;figure(18)plot(1:Expnums,RE,’r-’,’linewidth’,3)hold onplot(1:Expnums,RE,’bo’,’linewidth’,3)title(’Robustness for whole configuration II’)xlabel(’Experiment number’);ylabel(’Robustness’);gridfigure(19)hold onplot(RC,’k-’,’linewidth’, 3)plot(RC, ’bo’,’linewidth’, 3)plot(RE,’r--’,’linewidth’, 3)plot(RE, ’bo’,’linewidth’, 3)legend(’R-I’,’exp-#’,’R-II’,’exp-#’)title(’Robustness for configurations I and II ’)xlabel(’Experiment Number’);ylabel(’Robustness’)grid

384

figure(20)hold ongridplot(new_metric_I_median,’ko-’,’linewidth’, 2.5)plot(error_I, ’gs--’,’linewidth’, 2.5)plot(new_metric_II_median,’bo-’,’linewidth’, 2.5)plot(error_II, ’rs--’,’linewidth’, 2.5)legend(’Metric(I)’,’Error(I)’,’Metric(II)’,’Error(II)’)title(’Position error and performance metric for I and II ’)xlabel(’Experiment number’)ylabel(’Metric and error’)figure(21)hold ongridplot(new_metric_I_median,’ko-’,’linewidth’, 3)plot(error_I, ’gs--’,’linewidth’, 3)legend(’Metric_I’,’Error_I’)title(’Metric and Error for I ’)xlabel(’Experiment number’)ylabel(’Metric & Error values’)figure(22)hold ongridplot(new_metric_II_median,’bo-’,’linewidth’, 3)plot(error_II, ’rs--’,’linewidth’, 3)legend(’Metric_II’,’Error_II’)title(’Metric and Error for II ’)xlabel(’Experiment number’)ylabel(’Metric & Error’)

385

APPENDIX D

EXTREMUM SEEKING CONTROL

D.1 Extremum Seeking Control Code

D.1.1 Without Obstruction Code% M-member n-dimensional CT-swarm% The agents have point mass dynamics% Extremum seeking control is used to force the vehicle converge% to the minimum of the position% The algorithm uses the positions of all the other% members to update its position% by Hutahifa Al_Issa and Raul Ordonezclear all; close all;clc;global M dt time k;global a c;global w ;epsilon = 0.1;global regsize regsizemin regnum flag;% obstacleflag=0;% parameter of swarmingM = 4;a = 1;c = sqrt(2)*a; %3.3,3.2, 2%sqrt(2.5)*c/2.5;%b = 2/5;% parameter of trust regionif flag==0

regsize(1:M)=1*ones(1,M);end% if flag==1% regsize(1:M)=1*ones(1,M);% endregsizemin=0.1;regnum=2;if flag==0

% Potential function weightw=2;% Controller gaink=5;% opimizier intervaldt = 0.005;

endx0 = [0 -1 0 1 0; 0 0 -1 0 2.5; zeros(1, M+1)];%x0 = [0 -1 0 rand(1,1) 0; 0 0 -1 rand(1,1) 2.5; zeros(1, M+1)];% mote 4 is random position% Ode solvert0 = 0.0;tf = 50;time=0;%tspan = [t0 tf];tspan = t0:tf;myoptions = odeset(’OutputFcn’,’odeplot’);[t, x] = ode15s(’extremumswarming_no2_derivative’, tspan, x0, myoptions);% position of vehiclesr=length(x);x1=x(1:r,1);y1=x(1:r,2);x2=x(1:r,4);y2=x(1:r,5);

386

x3=x(1:r,7);y3=x(1:r,8);x4=x(1:r,10);y4=x(1:r,11);xt=x(1:r,13);yt=x(1:r,14);% Potential Functionden = 2;for iii = 1 : length(t)

J(iii)=metric_potential(x4(iii),y4(iii),x1(iii),y1(iii),x2(iii),y2(iii),x3(iii),y3(iii),xt(iii),yt(iii));Ja(iii)= 1 / (epsilon + norm([x4(iii);y4(iii)]-[x1(iii);y1(iii)])+ norm([x4(iii);y4(iii)]-[x2(iii); y2(iii)])+norm([x4(iii);y4(iii)]-[x3(iii); y3(iii)]));

end% plot simulation results% source seeking, formation control and obstacle avoidancefigure;plot(x1(1), y1(1), ’o’,...

x3(1), y3(1), ’o’,...x2(1), y2(1), ’o’,...x4(1), y4(1), ’o’,...’LineWidth’,2, ’MarkerEdgeColor’,’b’,...’MarkerFaceColor’,’g’,...’MarkerSize’,12);

hold on;plot(xt(1,1), yt(1,1), ’g*’,...

’LineWidth’,2 ,’MarkerSize’,12);plot(x1,y1, ’-’,’LineWidth’,2);plot(x2,y2, ’-’,’LineWidth’,2);plot(x3,y3, ’-’,’LineWidth’,2);plot(x4,y4, ’-’,’LineWidth’,2);plot(xt,yt, ’g-’,’LineWidth’,5);plot(xt(r), yt(r),’g*’,’LineWidth’,2,’MarkerSize’,12);plot((x1+x2+x3+x4)./(den+1),(y1+y2+y3+y4)./(den+1),’r-.’,’LineWidth’,3);plot(x1(r), y1(r), ’o’,...

x2(r), y2(r), ’o’,...x3(r), y3(r), ’o’,...x4(r), y4(r), ’o’,...’LineWidth’,2, ’MarkerEdgeColor’,’b’,...’MarkerFaceColor’,’g’,...’MarkerSize’,12);

for i=1:8:r-8,plot([x1(i), x2(i)], [y1(i), y2(i)], ’r--’,’LineWidth’,2);plot([x2(i), x3(i)], [y2(i), y3(i)], ’r--’,’LineWidth’,2);plot([x3(i), x4(i)], [y3(i), y4(i)], ’r--’,’LineWidth’,2);plot([x4(i), x1(i)], [y4(i), y1(i)], ’r--’,’LineWidth’,2);plot((x1(i)+x2(i)+x3(i)+x4(i))./(den+1),(y1(i)+y2(i)+y3(i)+y4(i))./(den+1),’p’,...

’MarkerEdgeColor’,’b’,’LineWidth’,2,...’MarkerFaceColor’,’r’,’MarkerSize’,12);

end;% Second Figurehold off;xlabel(’x’,’FontSize’,18,’FontWeight’,’bold’);ylabel(’y’,’FontSize’,18,’FontWeight’,’bold’);title(’Swarm Trajectories’,’FontSize’,18,’FontWeight’,’bold’);grid onif flag==0

saveas(gcf,’swarmpath_noasmesc.eps’,’psc2’);endaxis tightclear mov;mov=avifile(’movie_swarm_no_ob.avi’,’fps’,3);for f=1:length(t);clf;figure(2);plot(x1(1), y1(1), ’o’,...

x2(1), y2(1), ’o’,...x3(1), y3(1), ’o’,...x4(1), y4(1), ’o’,...’LineWidth’,2, ’MarkerEdgeColor’,’b’,...’MarkerFaceColor’,’g’,...’MarkerSize’,12);

hold on;plot(xt(1,1), yt(1,1), ’g*’,...

’LineWidth’,2 ,’MarkerSize’,12);plot(x1(1:f),y1(1:f), ’-’,’LineWidth’,2);plot(x2(1:f),y2(1:f), ’-’,’LineWidth’,2);plot(x3(1:f),y3(1:f), ’-’,’LineWidth’,2);plot(x4(1:f),y4(1:f), ’-’,’LineWidth’,2);plot(xt(1:f),yt(1:f), ’g-’,’LineWidth’,5);if f==length(t)

plot(xt(r), yt(r),’g*’,’LineWidth’,2,’MarkerSize’,12);

387

plot(x1(r), y1(r), ’o’,...x2(r), y2(r), ’o’,...x3(r), y3(r), ’o’,...x4(r), y4(r), ’rs’,...’LineWidth’,2, ’MarkerEdgeColor’,’b’,...’MarkerFaceColor’,’y’,...’MarkerSize’,12);

endhold off;xlabel(’x’,’FontSize’,18,’FontWeight’,’bold’);ylabel(’y’,’FontSize’,18,’FontWeight’,’bold’);title(’Swarm Trajectories’,’FontSize’,18,’FontWeight’,’bold’);grid onF=getframe(gcf);mov=addframe(mov,F);drawnow;end;mov=close(mov);% plot metric potentialfigureplot(t, J, ’linewidth’, 3)xlabel(’t’,’FontSize’,18,’FontWeight’,’bold’);title(’J’,’FontSize’,18,’FontWeight’,’bold’);axis tightgrid;% % potential functionsfigure,subplot(1,2,1)plot(t, J,’LineWidth’,3);xlabel(’t’,’FontSize’,18,’FontWeight’,’bold’);title(’J’,’FontSize’,18,’FontWeight’,’bold’);axis tightgrid;subplot(1,2,2)plot(t, (Ja)/2,’LineWidth’,3);xlabel(’t’,’FontSize’,18,’FontWeight’,’bold’);title(’J_{aa}’,’FontSize’,18,’FontWeight’,’bold’);grid;axis tightfor iii = 1 : length(t)

e4(iii)=localization_error(x4(iii),y4(iii),x1(iii),y1(iii),x2(iii),y2(iii),x3(iii),y3(iii),xt(iii),yt(iii));

ende = e4;for iii = 1 : length(t)

metric4(iii)=compute_metric(x4(iii),y4(iii),x1(iii),y1(iii),x2(iii),y2(iii),x3(iii),y3(iii),xt(iii),yt(iii));

endmetric = metric4;figureplot (t, metric, ’linewidth’, 3)legend(’J_{metric}’)xlabel(’t’,’FontSize’,18,’FontWeight’,’bold’);title(’J_{metric}’,’FontSize’,18,’FontWeight’,’bold’);axis tightgrid;figureplot (t, e, ’linewidth’, 3)legend(’e’)xlabel(’t’,’FontSize’,18,’FontWeight’,’bold’);title(’e’,’FontSize’,18,’FontWeight’,’bold’);axis tightgrid;

D.1.2 Extremumswarming No2 Derivative Codefunction xdot = extremumswarming_no2_derivative(t, x)global M xp0 yp0 xs ys dt time k;global a b c;global w;global regsize regsizemin regnum;% variable matrix% A1 A2 A3 T% x xt% y ytepsilon=0.1;sen = 3;z = zeros(sen, M+1);zdot = zeros(sen, M+1);for i=1:M+1,

z(:, i) = x(sen*(i-1)+1:sen*i);

388

end;% keyboard%%%%%% targettar=z(1:2,M+1);xt=tar(1);yt=tar(2);tar_dot(1)=.25*0;%0.25;tar_dot(2)=sin(0.25*t)*0;%sin(0.25*t);for i=1:M

xp(i)=z(1,i);%xp2=z(1,2);xp3=z(1,3);yp(i)=z(2,i);%yp2=z(2,2);yp3=z(2,3);eta(i)=z(3,i);%eta(2)=z(3,2);eta(3)=z(3,3);

endif t==0 | t-time>=dt% Direct Searchxtemp=linspace(-0.5*regsize(1)+xp(1),0.5*regsize(1)+xp(1),regnum);ytemp=linspace(-0.5*regsize(1)+yp(1),0.5*regsize(1)+yp(1),regnum);[X1,Y1]=meshgrid(xtemp,ytemp);xtemp=linspace(-0.5*regsize(2)+xp(2),0.5*regsize(2)+xp(2),regnum);ytemp=linspace(-0.5*regsize(2)+yp(2),0.5*regsize(2)+yp(2),regnum);[X2,Y2]=meshgrid(xtemp,ytemp);xtemp=linspace(-0.5*regsize(3)+xp(3),0.5*regsize(3)+xp(3),regnum);ytemp=linspace(-0.5*regsize(3)+yp(3),0.5*regsize(3)+yp(3),regnum);[X3,Y3]=meshgrid(xtemp,ytemp);% keyboardxtemp=linspace(-0.5*regsize(4)+xp(4),0.5*regsize(4)+xp(4),regnum);ytemp=linspace(-0.5*regsize(4)+yp(4),0.5*regsize(4)+yp(4),regnum);[X4,Y4]=meshgrid(xtemp,ytemp);J4=metric_potential(X4,Y4,xp(1),yp(1),xp(2),yp(2),xp(3),yp(3),xt,yt);J4c=metric_potential(xp(4),yp(4),xp(1),yp(1),xp(2),yp(2),xp(3),yp(3),xt,yt);[J4_min,J4_row,J4_col] = min2d(J4);% Update as compass searchif J4_min==J4c

regsize(4)=max(regsize(4)/2,regsizemin);endxs(4)=X4(J4_row,J4_col);ys(4)=Y4(J4_row,J4_col);xp0=xp;yp0=yp;time=t;end% for i=1:M% vx(i)=-k*(xp(i)-xs(i));% vy(i)=-k*(yp(i)-ys(i));% end

for i=1:Mif i==4vx(i)=-k*(xp(i)-xs(i));vy(i)=-k*(yp(i)-ys(i));else

vx(i)=0;vy(i)=0;end

end% for i=1:M% vx(i)=-(1/dt)*(xp(i)-xs(i));% vy(i)=-(1/dt)*(yp(i)-ys(i));% end% for i=1:M% vx(i)=-(1/dt)*sign(xp(i)-xs(i));% vy(i)=-(1/dt)*sign(yp(i)-ys(i));% end% vehicle dyanmics (pointmass + high pass filter)for i=1:M

% velocity, high pass filterzdot(1:sen,i) = [vx(i);vy(i);0];

end;% Target dynamicszdot(1:2, M+1) = tar_dot(:);% Return a column vectorfor i=1:M+1,

xdot(sen*(i-1)+1:sen*i) = zdot(:, i);end;xdot = xdot’; %’

D.1.3 Min2d Codefunction [Y,I_row,I_col] = min2d(X)%% [Y,I_row,I_col] = min2d(X)%% X Input 2D array% Y The minimum point in the 2D array

389

% I_row row index of the minimum% I_col column index of the minimum%% Finding the minimum in the 2D array% NaN’s are ignored when computing the minimum.% returns the indices of the minimum value in I_row, I_col%% Author: Chunlei Zhang% University of Dayton% 02/15/2002[temp_col,I]=min(X,[],1); %Finding the minimum along the column[Y,II]=min(temp_col); %Finding the final minimum in the temp 1d arrayI_row=I(II);I_col=II;

D.1.4 Metric Potential Codefunction J = metric_potential(x1,y1,x2,y2,x3,y3,x4,y4,xt,yt)global a c w wo;global flag;den = 2;epsilon= 0.1;[m,n] = size(x1); % or size(y1) because x1 and y1 have the same sizefor dim1 = 1 : m

for dim2 = 1 : nRec = [x1(dim1,dim2), x2, x3, x4;...

y1(dim1,dim2), y2, y3, y4];Tran=[xt; yt];CPLE = [ -5.2 -5.8 -6.6 -5.8 -6.4 -6.5 -6.8 -5.5924 -7.5 -6.7];PLE(1,2) = CPLE(1); PLE(2,1) = CPLE(1);PLE(1,3) = CPLE(2); PLE(3,1) = CPLE(2);PLE(1,4) = CPLE(3); PLE(4,1) = CPLE(3);PLE(1,5) = CPLE(4); PLE(5,1) = CPLE(4);PLE(2,3) = CPLE(5); PLE(3,2) = CPLE(5);PLE(2,4) = CPLE(6); PLE(4,2) = CPLE(6);PLE(2,5) = CPLE(7); PLE(5,2) = CPLE(7);PLE(3,4) = CPLE(8); PLE(4,3) = CPLE(8);PLE(3,5) = CPLE(9); PLE(5,3) = CPLE(9);PLE(4,5) = CPLE(10); PLE(5,4) = CPLE(10);Rec2 = [xt, x1(dim1,dim2), x2, x3, x4;...

yt, y1(dim1,dim2), y2, y3, y4];for ii = 1:5

p1 = Rec2(:,ii);for jj = 1:5

if jj == iicontinue

elsep2 = Rec2(:,jj);di = norm(p2 - p1);dBm(ii,jj) = -32 + (PLE(ii,jj))*10*log10(di);

endend

endCPLE2 = CPLE(5:10);T = Rec’;fudge = 0.8;x_axis = [-6 6]; y_axis = [-6 6];t1=1;t2=1;for j=1:6 % 6 distance combinations for 4 motes

if t2<4t2=t2+1;

endsizeT(j) = norm(T(t2,:)-T(t1,:));if t2==4

t2=t1+1;t1=t1+1;

endendmax_sep = max(sizeT)-min(sizeT); % not currently used% D’%load dist_model;a=2.218065227302679e-15;b=8.303884930269744;c=2.361192808137663;j = 1; % only look at TX to receiver datafor k = 2:5

D(k-1,1) = mean( a*dBm(k,j)ˆb + c);endmean(sizeT)*fudge;RSSI_edge = transpose(dBm(2:5,1)); %avg_TXtoall(2,1)discard=0;for j=1:4

% if D(j)>max_sep*fudge;if D(j)>mean(sizeT)*fudge;

D(j)=D(j)*0.75;

390

endif D(j) > x_axis(2)-x_axis(1) | D(j) > y_axis(2)-y_axis(1)

% At least one distance estimate is too large, so discard experimentdiscard=1;

endendcross_PLE = CPLE2;distance_weight = mean(cross_PLE)./cross_PLE;A.mat = [ 2*(T(2,1)-T(1,1)) 2*(T(2,2)-T(1,2))

2*(T(3,1)-T(1,1)) 2*(T(3,2)-T(1,2))2*(T(4,1)-T(1,1)) 2*(T(4,2)-T(1,2))2*(T(3,1)-T(2,1)) 2*(T(3,2)-T(2,2))2*(T(4,1)-T(2,1)) 2*(T(4,2)-T(2,2))2*(T(4,1)-T(3,1)) 2*(T(4,2)-T(3,2)) ];

A.mat_wgt(:,1) = A.mat(:,1).*distance_weight(:,1);A.mat_wgt(:,2) = A.mat(:,2).*distance_weight(:,1);B.mat = -[ (T(1,1)ˆ2-T(2,1)ˆ2)+(T(1,2)ˆ2-T(2,2)ˆ2)+(D(2)ˆ2-D(1)ˆ2)

(T(1,1)ˆ2-T(3,1)ˆ2)+(T(1,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(1)ˆ2)(T(1,1)ˆ2-T(4,1)ˆ2)+(T(1,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(1)ˆ2)(T(2,1)ˆ2-T(3,1)ˆ2)+(T(2,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(2)ˆ2)(T(2,1)ˆ2-T(4,1)ˆ2)+(T(2,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(2)ˆ2)(T(3,1)ˆ2-T(4,1)ˆ2)+(T(3,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(3)ˆ2) ];

C_hat = real((A.mat_wgt’*A.mat_wgt)\A.mat_wgt’*B.mat);for j=1:size(A.mat,1)

mtrc_distance_weight(j) = norm(A.mat(j,:)/2);end% compute distance from each mote to estimatefor j=1:4

D_est(j)=norm(T(j,:)-C_hat’);endmaxD=max(abs(D-D_est’));minD=min(abs(D-D_est’));mean_cross_PLE=mean(cross_PLE);% keyboardstd_cross_PLE_wgt=std(mtrc_distance_weight.*cross_PLE);metric(dim1,dim2) = 3*(maxD./(10+minD)).ˆ(1/2)+2./abs(mean_cross_PLE).ˆ(1/2)+1./(std_cross_PLE_wgt).ˆ(1/1);Ja(dim1, dim2)= 1 / (epsilon + norm([x1(dim1, dim2);y1(dim1, dim2)]-[x2; y2])+norm([x1(dim1, dim2);y1(dim1, dim2)]-[x3; y3])+norm([x1(dim1, dim2);y1(dim1, dim2)]-[x4; y4]));

endendif flag==0

% potential function for single vehicleJ=metric+w*(Ja)/2;

end

D.1.5 Localization Error Codefunction error = localization_error(x1,y1,x2,y2,x3,y3,x4,y4,xt,yt)[m,n] = size(x1); % or size(y1) because x1 and y1 have the same sizefor dim1 = 1 : m

for dim2 = 1 : nRec = [x1(m,n), x2, x3, x4;...

y1(m,n), y2, y3, y4];% Set up transmitter [x;y]Tran=[xt; yt];CPLE = [ -5.2 -5.8 -6.6 -5.8 -6.4 -6.5 -6.8 -5.5924 -7.5 -6.7];PLE(1,2) = CPLE(1); PLE(2,1) = CPLE(1);PLE(1,3) = CPLE(2); PLE(3,1) = CPLE(2);PLE(1,4) = CPLE(3); PLE(4,1) = CPLE(3);PLE(1,5) = CPLE(4); PLE(5,1) = CPLE(4);PLE(2,3) = CPLE(5); PLE(3,2) = CPLE(5);PLE(2,4) = CPLE(6); PLE(4,2) = CPLE(6);PLE(2,5) = CPLE(7); PLE(5,2) = CPLE(7);PLE(3,4) = CPLE(8); PLE(4,3) = CPLE(8);PLE(3,5) = CPLE(9); PLE(5,3) = CPLE(9);PLE(4,5) = CPLE(10); PLE(5,4) = CPLE(10);Rec2 = [xt, x1(m,n), x2, x3, x4;...

yt, y1(m,n), y2, y3, y4];for ii = 1:5

p1 = Rec2(:,ii);for jj = 1:5

if jj == iicontinue

elsep2 = Rec2(:,jj);% if jj ˜= 1% p2 = Rec2(:,jj);% else% p2 = Tran;% enddi = norm(p2 - p1);dBm(ii,jj) = -32 + (PLE(ii,jj))*10*log10(di);

391

endend

endCPLE2 = CPLE(5:10);T = Rec’;fudge = 0.8;x_axis = [-6 6]; y_axis = [-6 6];t1=1;t2=1;for j=1:6 % 6 distance combinations for 4 motes

if t2<4t2=t2+1;

endsizeT(j) = norm(T(t2,:)-T(t1,:));if t2==4

t2=t1+1;t1=t1+1;

endendmax_sep = max(sizeT)-min(sizeT); % not currently used% D’%load dist_model;a=2.218065227302679e-15;b=8.303884930269744;c=2.361192808137663;j = 1; % only look at TX to receiver datafor k = 2:5

D(k-1,1) = mean( a*dBm(k,j)ˆb + c);endmean(sizeT)*fudge;RSSI_edge = transpose(dBm(2:5,1)); %avg_TXtoall(2,1)discard=0;for j=1:4

% if D(j)>max_sep*fudge;if D(j)>mean(sizeT)*fudge;

D(j)=D(j)*0.75;endif D(j) > x_axis(2)-x_axis(1) | D(j) > y_axis(2)-y_axis(1)

% At least one distance estimate is too large, so discard experimentdiscard=1;

endendcross_PLE = CPLE2;distance_weight = mean(cross_PLE)./cross_PLE;A.mat = [ 2*(T(2,1)-T(1,1)) 2*(T(2,2)-T(1,2))

2*(T(3,1)-T(1,1)) 2*(T(3,2)-T(1,2))2*(T(4,1)-T(1,1)) 2*(T(4,2)-T(1,2))2*(T(3,1)-T(2,1)) 2*(T(3,2)-T(2,2))2*(T(4,1)-T(2,1)) 2*(T(4,2)-T(2,2))2*(T(4,1)-T(3,1)) 2*(T(4,2)-T(3,2)) ];

A.mat_wgt(:,1) = A.mat(:,1).*distance_weight(:,1);A.mat_wgt(:,2) = A.mat(:,2).*distance_weight(:,1);B.mat = -[ (T(1,1)ˆ2-T(2,1)ˆ2)+(T(1,2)ˆ2-T(2,2)ˆ2)+(D(2)ˆ2-D(1)ˆ2)

(T(1,1)ˆ2-T(3,1)ˆ2)+(T(1,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(1)ˆ2)(T(1,1)ˆ2-T(4,1)ˆ2)+(T(1,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(1)ˆ2)(T(2,1)ˆ2-T(3,1)ˆ2)+(T(2,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(2)ˆ2)(T(2,1)ˆ2-T(4,1)ˆ2)+(T(2,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(2)ˆ2)(T(3,1)ˆ2-T(4,1)ˆ2)+(T(3,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(3)ˆ2) ];

C_hat = real((A.mat_wgt’*A.mat_wgt)\A.mat_wgt’*B.mat);error = norm(C_hat - Tran);

endend

D.1.6 Compute Metric Codefunction metric = compute_metric(x1,y1,x2,y2,x3,y3,x4,y4,xt,yt)global a c w wo;global flag;den = 2;% J1t=(1/den)*(((x1-xt).ˆ2+(y1-yt).ˆ2)-aˆ2).ˆ2;epsilon= 0.1;[m,n] = size(x1); % or size(y1) because x1 and y1 have the same sizefor dim1 = 1 : m

for dim2 = 1 : nRec = [x1(dim1,dim2), x2, x3, x4;...

y1(dim1,dim2), y2, y3, y4];% Set up transmitter [x;y]Tran=[xt; yt];CPLE = [ -5.2 -5.8 -6.6 -5.8 -6.4 -6.5 -6.8 -5.5924 -7.5 -6.7];PLE(1,2) = CPLE(1); PLE(2,1) = CPLE(1);PLE(1,3) = CPLE(2); PLE(3,1) = CPLE(2);PLE(1,4) = CPLE(3); PLE(4,1) = CPLE(3);PLE(1,5) = CPLE(4); PLE(5,1) = CPLE(4);PLE(2,3) = CPLE(5); PLE(3,2) = CPLE(5);PLE(2,4) = CPLE(6); PLE(4,2) = CPLE(6);PLE(2,5) = CPLE(7); PLE(5,2) = CPLE(7);

392

PLE(3,4) = CPLE(8); PLE(4,3) = CPLE(8);PLE(3,5) = CPLE(9); PLE(5,3) = CPLE(9);PLE(4,5) = CPLE(10); PLE(5,4) = CPLE(10);Rec2 = [xt, x1(dim1,dim2), x2, x3, x4;...

yt, y1(dim1,dim2), y2, y3, y4];for ii = 1:5

p1 = Rec2(:,ii);% if ii ˜= 1% p1 = Rec2(:,ii);% else% p1 = Tran;% endfor jj = 1:5

if jj == iicontinue

elsep2 = Rec2(:,jj);di = norm(p2 - p1);dBm(ii,jj) = -32 + (PLE(ii,jj))*10*log10(di);

endend

endCPLE2 = CPLE(5:10);T = Rec’;fudge = 0.8;x_axis = [-6 6]; y_axis = [-6 6];t1=1;t2=1;for j=1:6 % 6 distance combinations for 4 motes

if t2<4t2=t2+1;

endsizeT(j) = norm(T(t2,:)-T(t1,:));if t2==4

t2=t1+1;t1=t1+1;

endendmax_sep = max(sizeT)-min(sizeT); % not currently used% D’%load dist_model;a=2.218065227302679e-15;b=8.303884930269744;c=2.361192808137663;j = 1; % only look at TX to receiver datafor k = 2:5

D(k-1,1) = mean( a*dBm(k,j)ˆb + c);endmean(sizeT)*fudge;RSSI_edge = transpose(dBm(2:5,1)); %avg_TXtoall(2,1)discard=0;for j=1:4

% if D(j)>max_sep*fudge;if D(j)>mean(sizeT)*fudge;

D(j)=D(j)*0.75;endif D(j) > x_axis(2)-x_axis(1) | D(j) > y_axis(2)-y_axis(1)

% At least one distance estimate is too large, so discard experimentdiscard=1;

endendcross_PLE = CPLE2;distance_weight = mean(cross_PLE)./cross_PLE;A.mat = [ 2*(T(2,1)-T(1,1)) 2*(T(2,2)-T(1,2))

2*(T(3,1)-T(1,1)) 2*(T(3,2)-T(1,2))2*(T(4,1)-T(1,1)) 2*(T(4,2)-T(1,2))2*(T(3,1)-T(2,1)) 2*(T(3,2)-T(2,2))2*(T(4,1)-T(2,1)) 2*(T(4,2)-T(2,2))2*(T(4,1)-T(3,1)) 2*(T(4,2)-T(3,2)) ];

A.mat_wgt(:,1) = A.mat(:,1).*distance_weight(:,1);A.mat_wgt(:,2) = A.mat(:,2).*distance_weight(:,1);B.mat = -[ (T(1,1)ˆ2-T(2,1)ˆ2)+(T(1,2)ˆ2-T(2,2)ˆ2)+(D(2)ˆ2-D(1)ˆ2)

(T(1,1)ˆ2-T(3,1)ˆ2)+(T(1,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(1)ˆ2)(T(1,1)ˆ2-T(4,1)ˆ2)+(T(1,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(1)ˆ2)(T(2,1)ˆ2-T(3,1)ˆ2)+(T(2,2)ˆ2-T(3,2)ˆ2)+(D(3)ˆ2-D(2)ˆ2)(T(2,1)ˆ2-T(4,1)ˆ2)+(T(2,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(2)ˆ2)(T(3,1)ˆ2-T(4,1)ˆ2)+(T(3,2)ˆ2-T(4,2)ˆ2)+(D(4)ˆ2-D(3)ˆ2) ];

C_hat = real((A.mat_wgt’*A.mat_wgt)\A.mat_wgt’*B.mat);for j=1:size(A.mat,1)

mtrc_distance_weight(j) = norm(A.mat(j,:)/2);end% compute distance from each mote to estimatefor j=1:4

D_est(j)=norm(T(j,:)-C_hat’);endmaxD=max(abs(D-D_est’));minD=min(abs(D-D_est’));mean_cross_PLE=mean(cross_PLE);

393

std_cross_PLE_wgt=std(mtrc_distance_weight.*cross_PLE);metric(dim1,dim2) = 3*(maxD./(10+minD)).ˆ(1/2)+2./abs(mean_cross_PLE).ˆ(1/2)+1./(std_cross_PLE_wgt).ˆ(1/1);

endend

394