repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
---|---|---|
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/compress/huffmanUncompress.h | #include <inttypes.h>
void Huffman_Uncompress( uint8_t *in, uint8_t *out, uint16_t insize, uint16_t outsize );
|
tinyos-io/tinyos-3.x-contrib | tinybt/tos/lib/bluetooth/btpackets.h | <gh_stars>0
/**
*
* $Rev:: 112 $: Revision of last commit
* $Author: sengg $: Author of last commit
* $Date: 2011/12/09 19:48:58 $: Date of last commit
*
**/
#ifndef __BTPACKET_H__
#define __BTPACKET_H__
// Remember that this packet size must be "large enough" to contain both
// data AND what ever headers the stack decides to put on.
// At the moment that is:
//
// 1 byte from HCIPacket.addTransport() - serial transport +
// 4 byte max (HCI_COMMAND_HDR_SIZE,
// HCI_ACL_HDR_SIZE,
// HCI_SCO_HDR_SIZE,
// HCI_EVENT_HDR_SIZE )
// = 5 bytes
enum {
HCIPACKET_BUF_SIZE=300,
MAX_DLEN=HCIPACKET_BUF_SIZE-5
};
#include "hci.h"
#include "additional_hci.h"
/*
* Header that defines a generic packet structure for use with Bluetooth.
*
* Copyright (C) 2002 & 2003 <NAME>, <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* */
// Apparently defines are bad mkay... At least it doesn't work if I include
// This file from other .nc files...
// Defines a generic packet structure "gen_pkt"
// - start is the first full byte
// - end is the first empty byte
// start==end means the buffer is empty
// All packets (ie. the ones ending in _pkt) defined below can be
// typecast to this buffer
// Remember that when seting start and end to the begining and end of data:
// _________
// data: x|0|1|2|3|4|x|x
// * @
// * Start has to point to data[0]
// @ While end has to point to data+NO_ELEMENTS=data[last+1]
// Since end points to the _next_ element, not the last!!
// Order _is_ important to be most efficient the program takes advantage
// of the order of data!!
typedef enum {
OK=0x00,
UNKNOWN_PTYPE=0x01,
UNKNOWN_PTYPE_DONE=0x02,
EVENT_PKT_TOO_LONG=0x03,
ACL_PKT_TOO_LONG=0x04,
UNKNOWN_EVENT=0x05,
UNKNOWN_CMD_COMPLETE=0x06,
HW_ERROR=0x07,
// parm=evtNo of evt that took too long
// Data corruption has occured
UART_UNABLE_TO_HANDLE_EVENTS=0x08,
HCIPACKET_SEND_OVERFLOW=0x09,
EVENT_HANDLER_TO_SLOW=0x10,
// parm=evtNo of evt that took too long
// New event will be droped!!
HCI_UNABLE_TO_HANDLE_EVENTS = 0x11,
NO_FREE_RECV_PACKET = 0x12,
WRONG_ACK = 0x13,
} errcode;
typedef enum {
HCI_COMMAND = 0x01,
HCI_ACLDATA = 0x02,
HCI_SCODATA = 0x03,
HCI_EVENT = 0x04
} hci_data_t;
typedef struct {
uint8_t *end;
uint8_t *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) gen_pkt;
// Reset the buffer to appear empty
static inline void rst_pkt(gen_pkt *pkt) {
pkt->start = pkt->data;
pkt->end = pkt->data;
}
// Setup the buffer to appear empty, but start/end at the other end
// -> what you wan't when you're about to send in this buffer
static inline void rst_send_pkt(gen_pkt *pkt) {
pkt->start = &pkt->data[HCIPACKET_BUF_SIZE];
pkt->end = &pkt->data[HCIPACKET_BUF_SIZE];
}
// Copy a pkt. This keeps the layout but only copies the data between
// start and end.
static inline void pkt_cpy(gen_pkt *dest, const gen_pkt *src) {
dest->start =
((uint8_t *) dest) + (((uint8_t *) src->start) - ((uint8_t *) src));
dest->end =
((uint8_t *) dest) + (((uint8_t *) src->end) - ((uint8_t *) src));
memcpy(dest->start, src->start,
(((uint8_t *) src->end) - ((uint8_t *) src->start)));
}
/*****************************************************************************
* Response structures *
*****************************************************************************/
// Inquiry response
// start is an array of responses - this is not what the spec describes,
// but it is the only thing that makes sense
typedef struct {
uint8_t *end;
struct {
uint8_t numresp;
inquiry_info info[(MAX_DLEN - 1)/sizeof(inquiry_info)];
} *devices;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) inq_resp_pkt;
typedef struct {
uint8_t *end;
struct {
uint8_t numresp;
inquiry_rssi_info info[(MAX_DLEN - 1)/sizeof(inquiry_rssi_info)];
} *devices;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) inq_resp_rssi_pkt;
// Response to a create_conn
typedef struct {
uint8_t *end;
evt_conn_complete *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) conn_complete_pkt;
// Incoming connection request
typedef struct {
uint8_t *end;
evt_conn_request *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) conn_request_pkt;
typedef struct {
uint8_t *end;
evt_disconn_complete *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) disconn_complete_pkt;
typedef struct {
uint8_t *end;
evt_num_comp_pkts *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) num_comp_pkts_pkt;
typedef struct {
uint8_t *end;
evt_mode_change *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) evt_mode_change_pkt;
typedef struct {
uint8_t *end;
evt_role_change *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) evt_role_change_pkt;
typedef struct {
uint8_t *end;
evt_conn_ptype_changed *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) evt_conn_ptype_changed_pkt;
/****************/
typedef struct {
uint8_t *end;
read_bd_addr_rp *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) read_bd_addr_pkt;
typedef struct {
uint8_t *end;
read_buffer_size_rp *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) read_buf_size_pkt;
typedef struct {
uint8_t *end;
write_link_policy_rp *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) write_link_policy_complete_pkt;
/**
* A lot of commands return a simple status parameter. Error codes can be read
* on p. 766 of the V1.1 spec
*/
typedef struct {
uint8_t status;
} __attribute__ ((packed)) status_rp;
typedef struct {
uint8_t *end;
status_rp *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) status_pkt;
/*****************************************************************************
* Request structures *
*****************************************************************************/
// Inquiry request
typedef struct {
uint8_t *end;// = &data[HCIPACKET_BUF_SIZE-1];
inquiry_cp *start;// = &req;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(inquiry_cp)];
inquiry_cp req;
} __attribute__ ((packed)) inq_req_pkt;
typedef struct {
uint8_t *end;
write_inq_activity_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(write_inq_activity_cp)];
write_inq_activity_cp cp;
} __attribute__ ((packed)) write_inq_activity_pkt;
typedef struct {
uint8_t *end;
periodic_inq_mode_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(periodic_inq_mode_cp)];
periodic_inq_mode_cp cp;
} __attribute__ ((packed)) periodic_inq_mode_pkt;
// Create conn request
typedef struct {
uint8_t *end;
create_conn_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(create_conn_cp)];
create_conn_cp cp;
} __attribute__ ((packed)) create_conn_pkt;
// Accept incoming connection request
typedef struct {
uint8_t *end;
accept_conn_req_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(accept_conn_req_cp)];
accept_conn_req_cp cp;
} __attribute__ ((packed)) accept_conn_req_pkt;
// Reject incomming connection request
typedef struct {
uint8_t *end;
reject_conn_req_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(reject_conn_req_cp)];
reject_conn_req_cp cp;
} __attribute__ ((packed)) reject_conn_req_pkt;
/** Request disconnect */
typedef struct {
uint8_t *end;
disconnect_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(disconnect_cp)];
disconnect_cp cp;
} __attribute__ ((packed)) disconnect_pkt;
/** Sniff mode */
typedef struct {
uint8_t *end;
sniff_mode_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(sniff_mode_cp)];
sniff_mode_cp cp;
} __attribute__ ((packed)) sniff_mode_pkt;
/** Write the link policy */
typedef struct {
uint8_t *end;
write_link_policy_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(write_link_policy_cp)];
write_link_policy_cp cp;
} __attribute__ ((packed)) write_link_policy_pkt;
typedef struct {
uint8_t *end;
write_default_link_policy_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(write_default_link_policy_cp)];
write_default_link_policy_cp cp;
} __attribute__ ((packed)) write_default_link_policy_pkt;
typedef struct {
uint8_t *end;
switch_role_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(switch_role_cp)];
switch_role_cp cp;
} __attribute__ ((packed)) switch_role_pkt;
typedef struct {
uint8_t *end;
set_conn_ptype_cp *start;
uint8_t data[HCIPACKET_BUF_SIZE-sizeof(set_conn_ptype_cp)];
set_conn_ptype_cp cp;
} __attribute__ ((packed)) set_conn_ptype_pkt;
/*****************************************************************************
* Send/recv data *
*****************************************************************************/
typedef struct {
uint8_t *end;
hci_acl_hdr *start;
uint8_t data[HCIPACKET_BUF_SIZE];
} __attribute__ ((packed)) hci_acl_data_pkt;
#endif
|
tinyos-io/tinyos-3.x-contrib | wustl/upma/lib/macs/scp-wustl/ScpConstants.h | /*
* Copyright (c) 2007 Washington University in St. Louis
* and the University of Southern 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 WASHINGTON UNIVERSITY IN ST. LOUIS OR THE
* UNIVERSITY OF SOUTHERN 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS OR THE UNIVERSITY OF SOUTHERN CALIFORNIA HAS
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS AND THE UNIVERSITY OF SOUTHERN
* CALIFORNIA SPECIFICALLY DISCLAIM 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO OBLIGATION
* TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*
*/
/*
* Portions of this file are derived from the files PhyConst.h
* and ScpConst.h from the original implementation of SCP by the
* University of Southern California. These files are under the
* following license:
*
******
*
* Copyright (C) 2005 the University of Southern California.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition to releasing this program under the LGPL, the authors are
* willing to dual-license it under other terms. You may contact the authors
* of this project by writing to <NAME>, USC/ISI, 4676 Admirality Way, Suite
* 1001, <NAME>, CA 90292, USA.
*
*****
*
* The authors at USC have given a special exemption of their license
* to allow those contents to be included here.
*
*/
#ifndef __SCPCONSTANTS_H
#define __SCPCONSTANTS_H
#ifdef CC2420_DEF_CHANNEL
/*
* Authors: <NAME>
*
* Physical layer parameters
*/
enum
{
PHY_BASE_PREAMBLE_LEN = 4,
PHY_NUM_SYNC_BYTES = 1,
PHY_MAX_PKT_LEN = 120,
PHY_WAKEUP_DELAY = 2,
PHY_TX_BYTE_TIME = 32,
PHY_MAX_CS_EXT = 3,
PHY_CS_SAMPLE_INTERVAL = 130,
PHY_LOADTONE_DELAY = 1,
PHY_BASE_PRE_BYTES = PHY_BASE_PREAMBLE_LEN + PHY_NUM_SYNC_BYTES
};
#else
#error PHY constants are not defined for this radio
#endif
/*
* Authors: <NAME>
*
* SCP-MAC constants that can be used by applications
*/
enum
{
LPL_MIN_POLL_BYTES = 1,
LPL_MAX_POLL_BYTES = LPL_MIN_POLL_BYTES + PHY_MAX_CS_EXT,
SCP_GUARD_TIME = 4,
SCP_TONE_CONT_WIN = 7,
SCP_PKT_CONT_WIN = 15,
SCP_NUM_HI_RATE_POLL = 3,
// TODO: fix once RTS/CTS is added
DIFS = 2,
CSMA_RTS_DURATION = 0,
CSMA_CTS_DURATION = 0,
CSMA_ACK_DURATION = 0,
CSMA_PROCESSING_DELAY = 0,
MAX_BASE_PKT_LEN = PHY_BASE_PRE_BYTES + PHY_MAX_PKT_LEN,
WAKEUP_DELAY_BYTES = PHY_WAKEUP_DELAY * 1024 / PHY_TX_BYTE_TIME + 1,
MIN_TONE_LEN = PHY_MAX_CS_EXT + WAKEUP_DELAY_BYTES + LPL_MAX_POLL_BYTES +
SCP_GUARD_TIME,
TX_TIME_SCHED = (SCP_TONE_CONT_WIN + 1 + PHY_MAX_CS_EXT) *
PHY_CS_SAMPLE_INTERVAL / 1000 + 1 + PHY_LOADTONE_DELAY,
MAX_TONE_TIME = PHY_TX_BYTE_TIME /* * PHY_NUMBER_OF_TONES */ *
MAX_BASE_PKT_LEN / 1000 + 1 + PHY_LOADTONE_DELAY,
MAX_CS_WAKEUP_TIME = PHY_WAKEUP_DELAY +
(SCP_TONE_CONT_WIN + 1 + SCP_PKT_CONT_WIN + DIFS + PHY_MAX_CS_EXT) * PHY_CS_SAMPLE_INTERVAL / 1000 +
1 + MIN_TONE_LEN * PHY_TX_BYTE_TIME / 1000 + 1,
MAX_BCAST_TIME = MAX_CS_WAKEUP_TIME + MAX_TONE_TIME +
MAX_BASE_PKT_LEN * PHY_TX_BYTE_TIME / 1000 + 1,
MAX_UCAST_TIME = MAX_BCAST_TIME + CSMA_RTS_DURATION + CSMA_CTS_DURATION +
CSMA_ACK_DURATION + CSMA_PROCESSING_DELAY * 4,
HI_RATE_POLL_PERIOD = MAX_UCAST_TIME,
};
enum
{
S_IDLE = 0,
S_BUFFERED = 1,
S_STARTING = 2,
S_PREAMBLE = 3,
S_PACKET = 4,
S_STOPPED = 5,
S_BOOTING = 6,
};
enum
{
AM_PREAMBLEPACKET = 199,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | tinybt/tos/platforms/btnode3/Latch.h | <filename>tinybt/tos/platforms/btnode3/Latch.h
#ifndef LATCH_H
#define LATCH_H
#define LATCH_PIN_LED0 0
#define LATCH_PIN_LED1 1
#define LATCH_PIN_LED2 2
#define LATCH_PIN_LED3 3
#define LATCH_PIN_CCPOWER 4
#define LATCH_PIN_IOPOWER 5
#define LATCH_PIN_BTPOWER 6
#define LATCH_PIN_BTRESET 7
#endif //LATCH_H
|
tinyos-io/tinyos-3.x-contrib | berkeley/quanto/tools/quanto/labjack/ue9.c | <gh_stars>1-10
//Author: LabJack
//Aug. 8, 2008
//Example UE9 helper functions. Function descriptions are in ue9.h.
#include "ue9.h"
void normalChecksum(uint8 *b, int n)
{
b[0]=normalChecksum8(b, n);
}
void extendedChecksum(uint8 *b, int n)
{
uint16 a;
a = extendedChecksum16(b, n);
b[4] = (uint8)(a & 0xff);
b[5] = (uint8)((a / 256) & 0xff);
b[0] = extendedChecksum8(b);
}
uint8 normalChecksum8(uint8 *b, int n)
{
int i;
uint16 a, bb;
//Sums bytes 1 to n-1 unsigned to a 2 byte value. Sums quotient and
//remainder of 256 division. Again, sums quotient and remainder of
//256 division.
for(i = 1, a = 0; i < n; i++)
a+=(uint16)b[i];
bb = a / 256;
a = (a - 256 * bb) + bb;
bb = a / 256;
return (uint8)((a-256*bb)+bb);
}
uint16 extendedChecksum16(uint8 *b, int n)
{
int i, a = 0;
//Sums bytes 6 to n-1 to a unsigned 2 byte value
for(i = 6; i < n; i++)
a += (uint16)b[i];
return a;
}
/* Sum bytes 1 to 5. Sum quotient and remainder of 256 division. Again, sum
quotient and remainder of 256 division. Return result as uint8. */
uint8 extendedChecksum8(uint8 *b)
{
int i, a, bb;
//Sums bytes 1 to 5. Sums quotient and remainder of 256 division. Again, sums
//quotient and remainder of 256 division.
for(i = 1, a = 0; i < 6; i++)
a+=(uint16)b[i];
bb = a / 256;
a = (a - 256 * bb) + bb;
bb = a / 256;
return (uint8)((a - 256 * bb) + bb);
}
int openTCPConnection(char *ipAddress, int port)
{
int socketFd;
struct sockaddr_in address;
#ifdef WIN32
WSADATA info;
struct hostent *he;
if (WSAStartup(MAKEWORD(1,1), &info) != 0)
{
printf("Error: Cannot initilize winsock\n");
return 0;
}
#endif
socketFd = socket(PF_INET, SOCK_STREAM,IPPROTO_TCP);
if(socketFd == -1)
{
fprintf(stderr,"Could not create socket. Exiting\n");
return -1;
}
address.sin_family=AF_INET;
address.sin_port=htons(port);
#ifdef WIN32
he = gethostbyname(ipAddress);
address.sin_addr = *((struct in_addr *)he->h_addr);
#else
inet_pton(AF_INET, ipAddress, &address.sin_addr);
int window_size = 128 * 1024; //current window size is 128 kilobytes
int rw = 0;
socklen_t size = sizeof(rw);
int err;
err = setsockopt(socketFd, SOL_SOCKET, SO_RCVBUF, (char*)&window_size, sizeof(window_size));
err = getsockopt(socketFd, SOL_SOCKET, SO_RCVBUF, (char*)&rw, &size );
#endif
if((connect(socketFd,(struct sockaddr *)&address,sizeof(address))) < 0)
{
fprintf(stderr,"Could not connect to %s:%d\n",inet_ntoa(address.sin_addr), port);
return -2;
}
return socketFd;
}
int closeTCPConnection(int fd)
{
#ifdef WIN32
int err;
err = closesocket(fd);
WSACleanup();
return err;
#else
return close(fd);
#endif
}
long getTickCount()
{
#ifdef WIN32
return ( (long)(GetTickCount()) );
#else
struct timeval tv;
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
#endif
}
long getCalibrationInfo(int fd, ue9CalibrationInfo *caliInfo)
{
uint8 sendBuffer[8];
uint8 recBuffer[136];
int sentRec = 0;
/* reading block 0 from memory */
sendBuffer[1] = (uint8)(0xF8); //command byte
sendBuffer[2] = (uint8)(0x01); //number of data words
sendBuffer[3] = (uint8)(0x2A); //extended command number
sendBuffer[6] = (uint8)(0x00);
sendBuffer[7] = (uint8)(0x00); //Blocknum = 0
extendedChecksum(sendBuffer, 8);
sentRec = send(fd, sendBuffer, 8, 0);
if(sentRec < 8)
{
if(sentRec == -1)
goto sendError0;
else
goto sendError1;
}
sentRec= recv(fd, recBuffer, 136, 0);
if(sentRec < 136)
{
if(sentRec == -1)
goto recvError0;
else
goto recvError1;
}
if(recBuffer[1] != (uint8)(0xF8) || recBuffer[2] != (uint8)(0x41) || recBuffer[3] != (uint8)(0x2A))
goto commandByteError;
//block data starts on byte 8 of the buffer
caliInfo->unipolarSlope[0] = FPuint8ArrayToFPDouble(recBuffer + 8, 0);
caliInfo->unipolarOffset[0] = FPuint8ArrayToFPDouble(recBuffer + 8, 8);
caliInfo->unipolarSlope[1] = FPuint8ArrayToFPDouble(recBuffer + 8, 16);
caliInfo->unipolarOffset[1] = FPuint8ArrayToFPDouble(recBuffer + 8, 24);
caliInfo->unipolarSlope[2] = FPuint8ArrayToFPDouble(recBuffer + 8, 32);
caliInfo->unipolarOffset[2] = FPuint8ArrayToFPDouble(recBuffer + 8, 40);
caliInfo->unipolarSlope[3] = FPuint8ArrayToFPDouble(recBuffer + 8, 48);
caliInfo->unipolarOffset[3] = FPuint8ArrayToFPDouble(recBuffer + 8, 56);
/* reading block 1 from memory */
sendBuffer[7] = (uint8)(0x01); //Blocknum = 1
extendedChecksum(sendBuffer, 8);
sentRec = send(fd, sendBuffer, 8, 0);
if(sentRec < 8)
{
if(sentRec == -1)
goto sendError0;
else
goto sendError1;
}
sentRec= recv(fd, recBuffer, 136, 0);
if(sentRec < 136)
{
if(sentRec == -1)
goto recvError0;
else
goto recvError1;
}
if(recBuffer[1] != (uint8)(0xF8) || recBuffer[2] != (uint8)(0x41) || recBuffer[3] != (uint8)(0x2A))
goto commandByteError;
//block data starts on byte 8 of the buffer
caliInfo->bipolarSlope = FPuint8ArrayToFPDouble(recBuffer + 8, 0);
caliInfo->bipolarOffset = FPuint8ArrayToFPDouble(recBuffer + 8, 8);
/* reading block 2 from memory */
sendBuffer[7] = (uint8)(0x02); //Blocknum = 2
extendedChecksum(sendBuffer, 8);
sentRec = send(fd, sendBuffer, 8, 0);
if(sentRec < 8)
{
if(sentRec == -1)
goto sendError0;
else
goto sendError1;
}
sentRec= recv(fd, recBuffer, 136, 0);
if(sentRec < 136)
{
if(sentRec == -1)
goto recvError0;
else
goto recvError1;
}
if(recBuffer[1] != (uint8)(0xF8) || recBuffer[2] != (uint8)(0x41) || recBuffer[3] != (uint8)(0x2A))
goto commandByteError;
//block data starts on byte 8 of the buffer
caliInfo->DACSlope[0] = FPuint8ArrayToFPDouble(recBuffer + 8, 0);
caliInfo->DACOffset[0] = FPuint8ArrayToFPDouble(recBuffer + 8, 8);
caliInfo->DACSlope[1] = FPuint8ArrayToFPDouble(recBuffer + 8, 16);
caliInfo->DACOffset[1] = FPuint8ArrayToFPDouble(recBuffer + 8, 24);
caliInfo->tempSlope = FPuint8ArrayToFPDouble(recBuffer + 8, 32);
caliInfo->tempSlopeLow = FPuint8ArrayToFPDouble(recBuffer + 8, 48);
caliInfo->calTemp = FPuint8ArrayToFPDouble(recBuffer + 8, 64);
caliInfo->Vref = FPuint8ArrayToFPDouble(recBuffer + 8, 72);
caliInfo->VrefDiv2 = FPuint8ArrayToFPDouble(recBuffer + 8, 88);
caliInfo->VsSlope = FPuint8ArrayToFPDouble(recBuffer + 8, 96);
/* reading block 3 from memory */
sendBuffer[7] = (uint8)(0x03); //Blocknum = 3
extendedChecksum(sendBuffer, 8);
sentRec = send(fd, sendBuffer, 8, 0);
if(sentRec < 8)
{
if(sentRec == -1)
goto sendError0;
else
goto sendError1;
}
sentRec= recv(fd, recBuffer, 136, 0);
if(sentRec < 136)
{
if(sentRec == -1)
goto recvError0;
else
goto recvError1;
}
if(recBuffer[1] != (uint8)(0xF8) || recBuffer[2] != (uint8)(0x41) || recBuffer[3] != (uint8)(0x2A))
goto commandByteError;
//block data starts on byte 8 of the buffer
caliInfo->hiResUnipolarSlope = FPuint8ArrayToFPDouble(recBuffer + 8, 0);
caliInfo->hiResUnipolarOffset = FPuint8ArrayToFPDouble(recBuffer + 8, 8);
/* reading block 4 from memory */
sendBuffer[7] = (uint8)(0x04); //Blocknum = 4
extendedChecksum(sendBuffer, 8);
sentRec = send(fd, sendBuffer, 8, 0);
if(sentRec < 8)
{
if(sentRec == -1)
goto sendError0;
else
goto sendError1;
}
sentRec= recv(fd, recBuffer, 136, 0);
if(sentRec < 136)
{
if(sentRec == -1)
goto recvError0;
else
goto recvError1;
}
if(recBuffer[1] != (uint8)(0xF8) || recBuffer[2] != (uint8)(0x41) || recBuffer[3] != (uint8)(0x2A))
goto commandByteError;
//block data starts on byte 8 of the buffer
caliInfo->hiResBipolarSlope = FPuint8ArrayToFPDouble(recBuffer + 8, 0);
caliInfo->hiResBipolarOffset = FPuint8ArrayToFPDouble(recBuffer + 8, 8);
caliInfo->prodID = 9;
return 0;
sendError0:
printf("Error : getCalibrationInfo send failed\n");
return -1;
sendError1:
printf("Error : getCalibrationInfo send did not send all of the buffer\n");
return -1;
recvError0:
printf("Error : getCalibrationInfo recv failed\n");
return -1;
recvError1:
printf("Error : getCalibrationInfo recv did not receive all of the buffer\n");
return -1;
commandByteError:
printf("Error : received buffer at byte 1, 2, or 3 are not 0xA3, 0x01, 0x2A \n");
return -1;
}
long getLJTDACCalibrationInfo(int fd, ue9LJTDACCalibrationInfo *caliInfo, uint8 DIOAPinNum) {
int err;
uint8 options, speedAdjust, sdaPinNum, sclPinNum, address, numByteToSend, numBytesToReceive, errorcode;
uint8 bytesCommand[1];
uint8 bytesResponse[32];
uint8 ackArray[4];
err = 0;
//Setting up I2C command for LJTDAC
options = 0; //I2COptions : 0
speedAdjust = 0; //SpeedAdjust : 0 (for max communication speed of about 130 kHz)
sdaPinNum = DIOAPinNum+1; //SDAPinNum : FIO channel connected to pin DIOB
sclPinNum = DIOAPinNum; //SCLPinNum : FIO channel connected to pin DIOA
address = (uint8)(0xA0); //Address : h0xA0 is the address for EEPROM
numByteToSend = 1; //NumI2CByteToSend : 1 byte for the EEPROM address
numBytesToReceive = 32; //NumI2CBytesToReceive : getting 32 bytes starting at EEPROM address specified in I2CByte0
bytesCommand[0] = 64; //I2CByte0 : Memory Address (starting at address 64 (DACA Slope)
//Performing I2C low-level call
err = I2C(fd, options, speedAdjust, sdaPinNum, sclPinNum, address, numByteToSend, numBytesToReceive, bytesCommand, &errorcode, ackArray, bytesResponse);
if(errorcode != 0)
{
printf("Getting LJTDAC calibration info error : received errorcode %d in response\n", errorcode);
err = -1;
}
if(err == -1)
return err;
caliInfo->DACSlopeA = FPuint8ArrayToFPDouble(bytesResponse, 0);
caliInfo->DACOffsetA = FPuint8ArrayToFPDouble(bytesResponse, 8);
caliInfo->DACSlopeB = FPuint8ArrayToFPDouble(bytesResponse, 16);
caliInfo->DACOffsetB = FPuint8ArrayToFPDouble(bytesResponse, 24);
caliInfo->prodID = 9;
return err;
}
double FPuint8ArrayToFPDouble(uint8 *buffer, int startIndex)
{
uint32 resultDec = 0;
uint32 resultWh = 0;
int i;
for(i = 0; i < 4; i++)
{
resultDec += (uint32)buffer[startIndex + i] * pow(2, (i*8));
resultWh += (uint32)buffer[startIndex + i + 4] * pow(2, (i*8));
}
return ( (double)((int)resultWh) + (double)(resultDec)/4294967296.0 );
}
long isCalibrationInfoValid(ue9CalibrationInfo *caliInfo)
{
if(caliInfo == NULL)
goto invalid;
if(caliInfo->prodID != 9)
goto invalid;
return 1;
invalid:
printf("Error: Invalid calibration info.\n");
return -1;
}
long isLJTDACCalibrationInfoValid(ue9LJTDACCalibrationInfo *caliInfo)
{
if(caliInfo == NULL)
goto invalid;
if(caliInfo->prodID != 9)
goto invalid;
return 1;
invalid:
printf("Error: Invalid LJTDAC calibration info.\n");
return -1;
}
long binaryToCalibratedAnalogVoltage(ue9CalibrationInfo *caliInfo, uint8 gainBip, uint8 resolution, uint16 bytesVoltage, double *analogVoltage)
{
double slope;
double offset;
if(isCalibrationInfoValid(caliInfo) == -1)
return -1;
if(resolution < 18)
{
switch( (unsigned int)gainBip )
{
case 0:
slope = caliInfo->unipolarSlope[0];
offset = caliInfo->unipolarOffset[0];
break;
case 1:
slope = caliInfo->unipolarSlope[1];
offset = caliInfo->unipolarOffset[1];
break;
case 2:
slope = caliInfo->unipolarSlope[2];
offset = caliInfo->unipolarOffset[2];
break;
case 3:
slope = caliInfo->unipolarSlope[3];
offset = caliInfo->unipolarOffset[3];
break;
case 8:
slope = caliInfo->bipolarSlope;
offset = caliInfo->bipolarOffset;
break;
default:
goto invalidGainBip;
}
}
else //UE9 Pro high res
{
switch( (unsigned int)gainBip )
{
case 0:
slope = caliInfo->hiResUnipolarSlope;
offset = caliInfo->hiResUnipolarOffset;
break;
case 8:
slope = caliInfo->hiResBipolarSlope;
offset = caliInfo->hiResBipolarOffset;
break;
default:
goto invalidGainBip;
}
}
*analogVoltage = (slope * bytesVoltage) + offset;
return 0;
invalidGainBip:
printf("binaryToCalibratedAnalogVoltage error: invalid GainBip.\n");
return -1;
}
long analogToCalibratedBinaryVoltage(ue9CalibrationInfo *caliInfo, int DACNumber, double analogVoltage, uint16 *bytesVoltage)
{
double slope;
double offset;
double tempBytesVoltage;
if(isCalibrationInfoValid(caliInfo) == -1)
return -1;
switch(DACNumber)
{
case 0:
slope = caliInfo->DACSlope[0];
offset = caliInfo->DACOffset[0];
break;
case 1:
slope = caliInfo->DACSlope[1];
offset = caliInfo->DACOffset[1];
break;
default:
printf("analogToCalibratedBinaryVoltage error: invalid DACNumber.\n");
return -1;
}
tempBytesVoltage = slope * analogVoltage + offset;
//Checking to make sure bytesVoltage will be a value between 0 and 4095,
//or that a uint16 overflow does not occur. A too high analogVoltage
//(above 5 volts) or too low analogVoltage (below 0 volts) will cause a
//value not between 0 and 4095.
if(tempBytesVoltage < 0)
tempBytesVoltage = 0;
if(tempBytesVoltage > 4095)
tempBytesVoltage = 4095;
*bytesVoltage = (uint16)tempBytesVoltage;
return 0;
}
long LJTDACAnalogToCalibratedBinaryVoltage(ue9LJTDACCalibrationInfo *caliInfo, int DACNumber, double analogVoltage, uint16 *bytesVoltage)
{
double slope;
double offset;
double tempBytesVoltage;
if(isLJTDACCalibrationInfoValid(caliInfo) == -1)
return -1;
switch(DACNumber)
{
case 0:
slope = caliInfo->DACSlopeA;
offset = caliInfo->DACOffsetA;
break;
case 1:
slope = caliInfo->DACSlopeB;
offset = caliInfo->DACOffsetB;
break;
default:
printf("LJTDACAnalogToCalibratedBinaryVoltage error: invalid DACNumber.\n");
return -1;
}
tempBytesVoltage = slope*analogVoltage + offset;
//Checking to make sure bytesVoltage will be a value between 0 and 65535. A
//too high analogVoltage (above 10 volts) or too low analogVoltage (below
//-10 volts) will create a value not between 0 and 65535.
if(tempBytesVoltage < 0)
tempBytesVoltage = 0;
if(tempBytesVoltage > 65535)
tempBytesVoltage = 65535;
*bytesVoltage = (uint16)tempBytesVoltage;
return 0;
}
long binaryToCalibratedAnalogTemperature(ue9CalibrationInfo *caliInfo, int powerLevel, uint16 bytesTemperature, double *analogTemperature)
{
double slope = 0;
if(isCalibrationInfoValid(caliInfo) == -1)
return -1;
switch( (unsigned int)powerLevel )
{
case 0: //high power
slope = caliInfo->tempSlope;
break;
case 1: //low power
slope = caliInfo->tempSlopeLow;
break;
default:
printf("binaryToCalibratedAnalogTemperatureK error: invalid powerLevel.\n");
return -1;
}
*analogTemperature = (double)(bytesTemperature)*slope;
return 0;
}
long binaryToUncalibratedAnalogVoltage(uint8 gainBip, uint8 resolution, uint16 bytesVoltage, double *analogVoltage)
{
double slope;
double offset;
if(resolution < 18)
{
switch( (unsigned int)gainBip )
{
case 0:
slope = 0.000077503;
offset = -0.012;
break;
case 1:
slope = 0.000038736;
offset = -0.012;
break;
case 2:
slope = 0.000019353;
offset = -0.012;
break;
case 3:
slope = 0.0000096764;
offset = -0.012;
break;
case 8:
slope = 0.00015629;
offset = -5.1760;
break;
default:
goto invalidGainBip;
}
}
else //UE9 Pro high res
{
switch( (unsigned int)gainBip )
{
case 0:
slope = 0.000077503;
offset = 0.012;
break;
case 8:
slope = 0.00015629;
offset = -5.176;
break;
default:
goto invalidGainBip;
}
}
*analogVoltage = (slope*bytesVoltage) + offset;
return 0;
invalidGainBip:
printf("binaryToUncalibratedAnalogVoltage error: invalid GainBip.\n");
return -1;
}
long analogToUncalibratedBinaryVoltage(double analogVoltage, uint16 *bytesVoltage)
{
double tempBytesVoltage;
tempBytesVoltage = 842.59*analogVoltage;
//Checking to make sure bytesVoltage will be a value between 0 and 4095,
//or that a uint16 overflow does not occur. A too high analogVoltage
//(above 5 volts) or too low analogVoltage (below 0 volts) will cause a
//value not between 0 and 4095.
if(tempBytesVoltage < 0)
tempBytesVoltage = 0;
if(tempBytesVoltage > 4095)
tempBytesVoltage = 4095;
*bytesVoltage = (uint16)tempBytesVoltage;
return 0;
}
long binaryToUncalibratedAnalogTemperature(uint16 bytesTemperature, double *analogTemperature)
{
*analogTemperature = (double)(bytesTemperature)*0.012968;
return 0;
}
long I2C(int fd, uint8 I2COptions, uint8 SpeedAdjust, uint8 SDAPinNum, uint8 SCLPinNum, uint8 AddressByte, uint8 NumI2CBytesToSend, uint8 NumI2CBytesToReceive, uint8 *I2CBytesCommand, uint8 *Errorcode, uint8 *AckArray, uint8 *I2CBytesResponse) {
uint8 *sendBuff, *recBuff;
int sendChars, recChars, sendSize, recSize, i, ret;
uint16 checksumTotal = 0;
uint32 ackArrayTotal, expectedAckArray;
*Errorcode = 0;
ret = 0;
sendSize = 6 + 8 + ((NumI2CBytesToSend%2 != 0)?(NumI2CBytesToSend + 1):(NumI2CBytesToSend));
recSize = 6 + 6 + ((NumI2CBytesToReceive%2 != 0)?(NumI2CBytesToReceive + 1):(NumI2CBytesToReceive));
sendBuff = malloc(sizeof(uint8)*sendSize);
recBuff = malloc(sizeof(uint8)*recSize);
sendBuff[sendSize - 1] = 0;
//I2C command
sendBuff[1] = (uint8)(0xF8); //command byte
sendBuff[2] = (sendSize - 6)/2; //number of data words = 4 + NumI2CBytesToSend
sendBuff[3] = (uint8)(0x3B); //extended command number
sendBuff[6] = I2COptions; //I2COptions
sendBuff[7] = SpeedAdjust; //SpeedAdjust
sendBuff[8] = SDAPinNum; //SDAPinNum
sendBuff[9] = SCLPinNum; //SCLPinNum
sendBuff[10] = AddressByte; //AddressByte: bit 0 needs to be zero,
// bits 1-7 is the address
sendBuff[11] = 0; //Reserved
sendBuff[12] = NumI2CBytesToSend; //NumI2CByteToSend
sendBuff[13] = NumI2CBytesToReceive; //NumI2CBytesToReceive
for(i = 0; i < NumI2CBytesToSend; i++)
sendBuff[14 + i] = I2CBytesCommand[i]; //I2CByte
extendedChecksum(sendBuff, sendSize);
//Sending command to UE9
sendChars = send(fd, sendBuff, sendSize, 0);
if(sendChars < sendSize)
{
if(sendChars == 0)
printf("I2C Error : write failed\n");
else
printf("I2C Error : did not write all of the buffer\n");
ret = -1;
goto cleanmem;
}
//Reading response from UE9
recChars = recv(fd, recBuff, recSize, 0);
if(recChars < recSize)
{
if(recChars == 0)
printf("I2C Error : read failed\n");
else
{
printf("I2C Error : did not read all of the buffer\n");
if(recChars >= 12)
*Errorcode = recBuff[6];
}
ret = -1;
goto cleanmem;
}
*Errorcode = recBuff[6];
AckArray[0] = recBuff[8];
AckArray[1] = recBuff[9];
AckArray[2] = recBuff[10];
AckArray[3] = recBuff[11];
for(i = 0; i < NumI2CBytesToReceive; i++)
I2CBytesResponse[i] = recBuff[12 + i];
if((uint8)(extendedChecksum8(recBuff)) != recBuff[0])
{
printf("I2C Error : read buffer has bad checksum (%d)\n", recBuff[0]);
ret = -1;
}
if(recBuff[1] != (uint8)(0xF8))
{
printf("I2C Error : read buffer has incorrect command byte (%d)\n", recBuff[1]);
ret = -1;
}
if(recBuff[2] != (uint8)((recSize - 6)/2))
{
printf("I2C Error : read buffer has incorrect number of data words (%d)\n", recBuff[2]);
ret = -1;
}
if(recBuff[3] != (uint8)(0x3B))
{
printf("I2C Error : read buffer has incorrect extended command number (%d)\n", recBuff[3]);
ret = -1;
}
checksumTotal = extendedChecksum16(recBuff, recSize);
if( (uint8)((checksumTotal / 256) & 0xff) != recBuff[5] || (uint8)(checksumTotal & 255) != recBuff[4])
{
printf("I2C error : read buffer has bad checksum16 (%d)\n", checksumTotal);
ret = -1;
}
//ackArray should ack the Address byte in the first ack bit, but did not until control firmware 1.84
ackArrayTotal = AckArray[0] + AckArray[1]*256 + AckArray[2]*65536 + AckArray[3]*16777216;
expectedAckArray = pow(2.0, NumI2CBytesToSend+1)-1;
if(ackArrayTotal != expectedAckArray)
printf("I2C error : expected an ack of %d, but received %d\n", expectedAckArray, ackArrayTotal);
cleanmem:
free(sendBuff);
free(recBuff);
sendBuff = NULL;
recBuff = NULL;
return ret;
}
long eAIN(int fd, ue9CalibrationInfo *caliInfo, long ChannelP, long ChannelN, double *Voltage, long Range, long Resolution, long Settling, long Binary, long Reserved1, long Reserved2)
{
uint8 IOType, Channel, AINM, AINH, ainGain;
uint16 bytesVT;
if(Range == LJ_rgBIP5V)
ainGain = 8;
else if(Range == LJ_rgUNI5V)
ainGain = 0;
else if(Range == LJ_rgUNI2P5V)
ainGain = 1;
else if(Range == LJ_rgUNI1P25V)
ainGain = 2;
else if(Range == LJ_rgUNIP625V)
ainGain = 3;
else
{
printf("eAIN error: Invalid Range\n");
return -1;
}
if(ehSingleIO(fd, 4, (uint8)ChannelP, ainGain, (uint8)Resolution, (uint8)Settling, &IOType, &Channel, NULL, &AINM, &AINH) < 0)
return -1;
bytesVT = AINM + AINH*256;
if(Binary != 0)
{
*Voltage = (double)bytesVT;
}
else
{
if(isCalibrationInfoValid(caliInfo) == -1)
{
if(Channel == 133 || ChannelP == 141)
{
binaryToUncalibratedAnalogTemperature(bytesVT, Voltage);
}
else
{
if(binaryToUncalibratedAnalogVoltage(ainGain, Resolution, bytesVT, Voltage) < 0)
return -1;
}
}
else
{
if(ChannelP == 133 || ChannelP == 141)
{
if(binaryToCalibratedAnalogTemperature(caliInfo, 0, bytesVT, Voltage) < 0)
return -1;
}
else
{
if(binaryToCalibratedAnalogVoltage(caliInfo, ainGain, (uint8)Resolution, bytesVT, Voltage) < 0)
return -1;
}
}
}
return 0;
}
long eDAC(int fd, ue9CalibrationInfo *caliInfo, long Channel, double Voltage, long Binary, long Reserved1, long Reserved2)
{
uint8 IOType, channel;
uint16 bytesVoltage;
if(isCalibrationInfoValid(caliInfo) == -1)
{
analogToUncalibratedBinaryVoltage(Voltage, &bytesVoltage);
}
else
{
if(analogToCalibratedBinaryVoltage(caliInfo, (uint8)Channel, Voltage, &bytesVoltage) < 0)
return -1;
}
return ehSingleIO(fd, 5, (uint8)Channel, (uint8)( bytesVoltage & (0x00FF) ), (uint8)(( bytesVoltage /256 ) + 192), 0, &IOType, &channel, NULL, NULL, NULL);
}
long eDI(int fd, long Channel, long *State)
{
uint8 state;
if(Channel > 22)
{
printf("eDI error: Invalid Channel");
return -1;
}
if(ehDIO_Feedback(fd, (uint8)Channel, 0, &state) < 0)
return -1;
*State = state;
return 0;
}
long eDO(int fd, long Channel, long State)
{
uint8 state;
state = (uint8)State;
if(Channel > 22)
{
printf("Error: Invalid Channel");
return -1;
}
return ehDIO_Feedback(fd, (uint8)Channel, 1, &state);
}
long eTCConfig(int fd, long *aEnableTimers, long *aEnableCounters, long TCPinOffset, long TimerClockBaseIndex, long TimerClockDivisor, long *aTimerModes, double *aTimerValues, long Reserved1, long Reserved2)
{
uint8 enableMask;
uint8 timerMode[6], counterMode[2];
uint16 timerValue[6];
int numTimers, numTimersStop, i;
//Setting EnableMask
enableMask = 128; //Bit 7: UpdateConfig
if(aEnableCounters[1] != 0)
enableMask += 16; //Bit 4: Enable Counter1
if(aEnableCounters[0] |= 0)
enableMask += 8; //Bit 3: Enable Counter0
numTimers = 0;
numTimersStop = 0;
for(i = 0; i < 6; i++)
{
if(aEnableTimers[i] != 0 && numTimersStop == 0)
{
numTimers++;
timerMode[i] = (uint8)aTimerModes[i]; //TimerMode
timerValue[i] = (uint16)aTimerValues[i]; //TimerValue
}
else
{
numTimersStop = 1;
timerMode[i] = 0;
timerValue[i] = 0;
}
}
enableMask += numTimers; //Bits 2-0: Number of Timers
counterMode[0] = 0; //Counter0Mode
counterMode[1] = 0; //Counter1Mode
return ehTimerCounter(fd, (uint8)TimerClockDivisor, enableMask, (uint8)TimerClockBaseIndex, 0, timerMode, timerValue, counterMode, NULL, NULL);
}
long eTCValues(int fd, long *aReadTimers, long *aUpdateResetTimers, long *aReadCounters, long *aResetCounters, double *aTimerValues, double *aCounterValues, long Reserved1, long Reserved2)
{
uint8 updateReset, timerMode[6], counterMode[2];
uint16 timerValue[6];
uint32 timer[6], counter[2];
int i;
long errorcode;
//UpdateReset
updateReset = 0;
for(i = 0; i < 6; i++)
{
updateReset += ((aUpdateResetTimers[i] != 0) ? pow(2, i) : 0);
timerMode[i] = 0;
timerValue[i] = 0;
}
for(i = 0; i < 2; i++)
{
updateReset += ((aResetCounters[i] != 0) ? pow(2, 6 + i) : 0);
counterMode[i] = 0;
}
if( (errorcode = ehTimerCounter(fd, 0, 0, 0, updateReset, timerMode, timerValue, counterMode, timer, counter)) != 0)
return errorcode;
for(i = 0; i < 6; i++)
aTimerValues[i] = timer[i];
for(i = 0; i < 2; i++)
aCounterValues[i] = counter[i];
return 0;
}
long ehSingleIO(int fd, uint8 inIOType, uint8 inChannel, uint8 inDirBipGainDACL, uint8 inStateResDACH, uint8 inSettlingTime, uint8 *outIOType, uint8 *outChannel, uint8 *outDirAINL, uint8 *outStateAINM, uint8 *outAINH)
{
uint8 sendBuff[8], recBuff[8];
int sendChars, recChars;
sendBuff[1] = (uint8)(0xA3); //command byte
sendBuff[2] = inIOType; //IOType
sendBuff[3] = inChannel; //Channel
sendBuff[4] = inDirBipGainDACL; //Dir/BipGain/DACL
sendBuff[5] = inStateResDACH; //State/Resolution/DACH
sendBuff[6] = inSettlingTime; //Settling time
sendBuff[7] = 0; //Reserved
sendBuff[0] = normalChecksum8(sendBuff, 8);
//Sending command to UE9
sendChars = send(fd, sendBuff, 8, 0);;
if(sendChars < 8)
{
if(sendChars == 0)
printf("SingleIO error : write failed\n");
else
printf("SingleIO error : did not write all of the buffer\n");
return -1;
}
//Reading response from UE9
recChars = recv(fd, recBuff, 8, 0);;
if(recChars < 8)
{
if(recChars == 0)
printf("SingleIO error : read failed\n");
else
printf("SingleIO error : did not read all of the buffer\n");
return -1;
}
if((uint8)(normalChecksum8(recBuff, 8)) != recBuff[0])
{
printf("SingleIO error : read buffer has bad checksum\n");
return -1;
}
if(recBuff[1] != (uint8)(0xA3))
{
printf("SingleIO error : read buffer has wrong command byte\n");
return -1;
}
if(outIOType != NULL)
*outIOType = recBuff[2];
if(outChannel != NULL)
*outChannel = recBuff[3];
if(outDirAINL != NULL)
*outDirAINL = recBuff[4];
if(outStateAINM != NULL)
*outStateAINM = recBuff[5];
if(outAINH != NULL)
*outAINH = recBuff[6];
return 0;
}
long ehDIO_Feedback(int fd, uint8 channel, uint8 direction, uint8 *state)
{
uint8 sendBuff[34], recBuff[64];
int sendChars, recChars;
int i;
uint8 tempDir, tempState, tempByte;
uint16 checksumTotal;
sendBuff[1] = (uint8)(0xF8); //command byte
sendBuff[2] = (uint8)(0x0E); //number of data words
sendBuff[3] = (uint8)(0x00); //extended command number
for(i = 6; i < 34; i++)
sendBuff[i] = 0;
tempDir = ((direction < 1) ? 0 : 1);
tempState = ((*state < 1) ? 0 : 1);
if(channel <= 7)
{
tempByte = pow(2, channel);
sendBuff[6] = tempByte;
if(tempDir)
sendBuff[7] = tempByte;
if(tempState)
sendBuff[8] = tempByte;
}
else if(channel <= 15)
{
tempByte = pow( 2, (channel - 8));
sendBuff[9] = tempByte;
if(tempDir)
sendBuff[10] = tempByte;
if(tempState)
sendBuff[11] = tempByte;
}
else if(channel <= 19)
{
tempByte = pow( 2, (channel - 16));
sendBuff[12] = tempByte;
if(tempDir)
sendBuff[13] = tempByte*16;
if(tempState)
sendBuff[13] += tempByte;
}
else if(channel <= 22)
{
tempByte = pow( 2, (channel - 20));
sendBuff[14] = tempByte;
if(tempDir)
sendBuff[15] = tempByte*16;
if(tempState)
sendBuff[15] += tempByte;
}
else
{
printf("DIO Feedback error: Invalid Channel\n");
return -1;
}
extendedChecksum(sendBuff, 34);
//Sending command to UE9
sendChars = send(fd, sendBuff, 34, 0);;
if(sendChars < 34)
{
if(sendChars == 0)
printf("DIO Feedback error : write failed\n");
else
printf("DIO Feedback error : did not write all of the buffer\n");
return -1;
}
//Reading response from UE9
recChars = recv(fd, recBuff, 64, 0);
if(recChars < 64)
{
if(recChars == 0)
printf("DIO Feedback error : read failed\n");
else
printf("DIO Feedback error : did not read all of the buffer\n");
return -1;
}
checksumTotal = extendedChecksum16(recBuff, 64);
if( (uint8)((checksumTotal / 256) & 0xff) != recBuff[5])
{
printf("DIO Feedback error : read buffer has bad checksum16(MSB)\n");
return -1;
}
if( (uint8)(checksumTotal & 0xff) != recBuff[4])
{
printf("DIO Feedback error : read buffer has bad checksum16(LBS)\n");
return -1;
}
if( extendedChecksum8(recBuff) != recBuff[0])
{
printf("DIO Feedback error : read buffer has bad checksum8\n");
return -1;
}
if(recBuff[1] != (uint8)(0xF8) || recBuff[2] != (uint8)(0x1D) || recBuff[3] != (uint8)(0x00))
{
printf("DIO Feedback error : read buffer has wrong command bytes \n");
return -1;
}
if(channel <= 7)
*state = ((recBuff[7]&tempByte) ? 1 : 0);
else if(channel <= 15)
*state = ((recBuff[9]&tempByte) ? 1 : 0);
else if(channel <= 19)
*state = ((recBuff[10]&tempByte) ? 1 : 0);
else if(channel <= 22)
*state = ((recBuff[11]&tempByte) ? 1 : 0);
return 0;
}
long ehTimerCounter(int fd, uint8 inTimerClockDivisor, uint8 inEnableMask, uint8 inTimerClockBase, uint8 inUpdateReset, uint8 *inTimerMode, uint16 *inTimerValue, uint8 *inCounterMode, uint32 *outTimer, uint32 *outCounter)
{
uint8 sendBuff[30], recBuff[40];
int sendChars, recChars, i, j;
uint16 checksumTotal;
sendBuff[1] = (uint8)(0xF8); //command byte
sendBuff[2] = (uint8)(0x0C); //number of data words
sendBuff[3] = (uint8)(0x18); //extended command number
sendBuff[6] = inTimerClockDivisor; //TimerClockDivisor
sendBuff[7] = inEnableMask; //EnableMask
sendBuff[8] = inTimerClockBase; //TimerClockBase
sendBuff[9] = inUpdateReset; //UpdateReset
for(i = 0; i < 6; i++)
{
sendBuff[10 + i*3] = inTimerMode[i]; //TimerMode
sendBuff[11 + i*3] = (uint8)(inTimerValue[i]&0x00FF); //TimerValue (low byte)
sendBuff[12 + i*3] = (uint8)((inTimerValue[i]&0xFF00)/256); //TimerValue (high byte)
}
for(i = 0; i < 2; i++)
sendBuff[28 + i] = inCounterMode[i]; //CounterMode
extendedChecksum(sendBuff, 30);
//Sending command to UE9
sendChars = send(fd, sendBuff, 30, 0);;
if(sendChars < 30)
{
if(sendChars == 0)
printf("ehTimerCounter error : write failed\n");
else
printf("ehTimerCounter error : did not write all of the buffer\n");
return -1;
}
//Reading response from UE9
recChars = recv(fd, recBuff, 40, 0);
if(recChars < 40)
{
if(recChars == 0)
printf("ehTimerCounter error : read failed\n");
else
printf("ehTimerCounter error : did not read all of the buffer\n");
return -1;
}
checksumTotal = extendedChecksum16(recBuff, 40);
if( (uint8)((checksumTotal / 256) & 0xff) != recBuff[5])
{
printf("ehTimerCounter error : read buffer has bad checksum16(MSB)\n");
return -1;
}
if( (uint8)(checksumTotal & 0xff) != recBuff[4])
{
printf("ehTimerCounter error : read buffer has bad checksum16(LBS)\n");
return -1;
}
if( extendedChecksum8(recBuff) != recBuff[0])
{
printf("ehTimerCounter error : read buffer has bad checksum8\n");
return -1;
}
if(recBuff[1] != (uint8)(0xF8) || recBuff[2] != (uint8)(0x11) || recBuff[3] != (uint8)(0x18))
{
printf("ehTimerCounter error : read buffer has wrong command bytes for TimerCounter\n");
return -1;
}
if(outTimer != NULL)
{
for(i = 0; i < 6; i++)
{
outTimer[i] = 0;
for(j = 0; j < 4; j++)
outTimer[i] += recBuff[8 + j + i*4]*pow(2, 8*j);
}
}
if(outCounter != NULL)
{
for(i = 0; i < 2; i++)
{
outCounter[i] = 0;
for(j = 0; j < 4; j++)
outCounter[i] += recBuff[32 + j + i*4]*pow(2, 8*j);
}
}
return recBuff[6];
}
|
tinyos-io/tinyos-3.x-contrib | shimmer/swtest/SerialTime/serial_recv.c | /*
* Read usb-dongle attached sd card
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <inttypes.h>
#include <sys/ioctl.h>
#include <linux/types.h>
void bailout(char *msg)
{
perror(msg);
fprintf(stderr,"errno=%d\n", errno);
exit(-1);
}
int main(int argc, char **argv)
{
int fd, i, n;
unsigned char vvv[256], * scout;
int rs232_fd;
struct termios ios;
/* Create the socket */
rs232_fd = open("/dev/ttyUSB1", O_RDONLY);
if(rs232_fd < 0)
bailout("socket");
memset(&ios, 0, sizeof(ios));
ios.c_cflag=B115200|CLOCAL|CREAD|CS8;
ios.c_cc[VMIN]=1;
tcsetattr(rs232_fd, TCSANOW, &ios);
i = 0;
for(;;){
if((n = read(rs232_fd, vvv, 1)) > 0)
fprintf(stderr, "%c ", *vvv);
}
close(rs232_fd);
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/tos/system/tos.h |
// This file is a copy of the tinyos tos.h header. It adds a
// combine function for booleans
#if !defined(__CYGWIN__)
#if defined(__MSP430__)
#include <sys/inttypes.h>
#else
#include <inttypes.h>
#endif
#else //cygwin
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stddef.h>
#include <ctype.h>
typedef uint8_t bool __attribute__((combine(bcombine)));
enum { FALSE = 0, TRUE = 1 };
bool bcombine(bool r1, bool r2)
/* Returns: r1 if r1 == r2, FALSE otherwise. This is the standard error
combination function: two successes, or two identical errors are
preserved, while conflicting errors are represented by FALSE.
*/
{
return r1 == r2 ? r1 : FALSE;
}
typedef nx_int8_t nx_bool;
uint16_t TOS_NODE_ID = 1;
/* This macro is used to mark pointers that represent ownership
transfer in interfaces. See TEP 3 for more discussion. */
#define PASS
struct @atmostonce { };
struct @atleastonce { };
struct @exactlyonce { };
/* This platform_bootstrap macro exists in accordance with TEP
107. A platform may override this through a platform.h file. */
#include <platform.h>
#ifndef platform_bootstrap
#define platform_bootstrap() {}
#endif
#ifndef TOSSIM
#define dbg(s, ...)
#define dbgerror(s, ...)
#define dbg_clear(s, ...)
#define dbgerror_clear(s, ...)
#endif
|
tinyos-io/tinyos-3.x-contrib | iowa/T2.tsync/IAtsync/OTime.h | #ifndef TS_OTIME
/**
* NestArch definition of TimeSync interface structures
*/
typedef struct timeSync_t {
uint16_t ClockH; // jiffies for this clock are 1/(4 Mhz) or 0.25 microsec
// so we use 48-bit clock (about 2.2 years of jiffies)
uint32_t ClockL;
} timeSync_t;
typedef timeSync_t * timeSyncPtr;
typedef union bigClock {
struct { uint64_t g; } bigInt;
struct { uint32_t lo; uint32_t hi; } partsInt;
} bigClock;
// Tuning Constants for Skew, Sleep, etc
enum { MAX_SKEW_AMT = 300,
INTERVAL_WO_SKEW = 1048576u, // 2**20 SysTime units
INTERVAL_WO_SKEW_POWER = 20, // log of above
ONE_BYTE_TIME_UNIT = 146, // actually rounded (145.636 on MicaZ)
DO_SKEW_ADJUST = TRUE // use skew/or not
};
#if defined(PLATFORM_MICAZ) || defined(PLATFORM_MICA2)
enum { TPS = 921600u }; // the timer rate using 1/8 prescaler
// as determined by Miklos at Vandy
// BUT, my own measurements indicate that
// the actual rate is 921778
#endif
#ifdef PLATFORM_MICA128
enum { TPS = 500000u }; // on a Mica128, we have 4 Mhz, so
// we have 921.6e3 * (4.0/MicaZ),
// which is something like
// 4.0 / { 7.37 7.36801 7.368 7.3679 7.3728 }e3
// --- some variance, hence the guess of 500288
// (the atmega128 datasheet says 7.3728 is the
// oscillator frequency, which would give us
// 500,000 precisely)
#endif
#if defined(PLATFORM_TMOTE) || defined(PLATFORM_TMOTEINVENT) || defined(PLATFORM_TELOSB)
enum { TPS = 1048576u }; // = 1024*1024, aka, binary million
#endif
#define TS_OTIME
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinyos/rt_structs.h | #ifndef RT_STRUCTS_H_INCLUDED
#define RT_STRUCTS_H_INCLUDED
#include "nodes.h"
typedef struct rt_data
{
uint16_t sessionID;
uint16_t weight;
uint8_t minstate;
} rt_data;
typedef struct GenericNode
{
rt_data _pdata;
} GenericNode;
#define SRC_QUEUE_SIZE 3
#define RTCLOCKSEC (5L)
#define RTCLOCKINTERVAL (RTCLOCKSEC * 1024L)
#define EVALINTERVAL (60L*60L * 1024L)
//#define EVALINTERVAL (5L * 60L * 1024L)
//save runtime data every 3 hours
#define RT_SAVE_SEC (60L * 60L * 3L)
#define RT_SAVE_TIME (RT_SAVE_SEC * 1024L)
#define RT_RECOVER_TIME (15L * 1024L)
//typedef uint8_t request_t[50];
#define LOAD_WEIGHT (0.04)
#ifndef BATTERY_SIZE
#warning 'Using default battery size (200mAhr)'
#define BATTERY_SIZE (200LL * 360LL * 37LL * 1000LL) //uJ
#else
#warning 'Using CUSTOM battery size.'
#endif
uint64_t BATTERY_CAPACITY = BATTERY_SIZE;
typedef struct __runtime_state
{
uint16_t save_flag;
double load_avg;
uint8_t srcprob[NUMSOURCES];
uint8_t spc[NUMSOURCES];
uint8_t prob[NUMPATHS];
uint8_t pc[NUMPATHS];
int32_t pathenergy[NUMPATHS];
int64_t batt_reserve;
int32_t clock;
} __runtime_state_t;
__runtime_state_t __rtstate;
//uint16_t *g_lastmem = (uint16_t*)3967;
//uint16_t deadlocked_edge_id = 0xFFFF;
//int16_t alloc_size = 0xFFFF;
uint32_t rt_clock = 0;
bool booted = TRUE;
int save_state;
int save_retries;
int16_t last_volts = 0;
void *queue_ptr = NULL;
#define MAX_SAVE_RET 10
#define SAVE_PAGE 0
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/common/lib/simplemac/cc2420.h | #ifndef CC2420_H
#define CC2420_H
#include <packet.h>
enum cc2420_defaults {
CC2420_DEFAULT_CHANNEL = 17, // IEEE channel 11-26
CC2420_DEFAULT_POWER = 100, // Power in procent
};
enum cc2420_error_codes {
// FAIL = 0,
// SUCCESS = 1,
CC2420_ERROR_CCA = 0x02,
CC2420_ERROR_TX = 0x03,
CC2420_ERROR_RADIO_OFF = 0x04,
};
#endif //CC2420_H
|
tinyos-io/tinyos-3.x-contrib | eon/apps/null_test/impl/tinyos/typechecks.h | #ifndef TYPECHECKS_H_INCLUDED
#define TYPECHECKS_H_INCLUDED
bool IsEven(int val)
{
return ((val % 2) == 0);
}
bool IsOdd(int val)
{
return !IsEven(val);
}
#endif // TYPECHECKS_H_INCLUDED
|
tinyos-io/tinyos-3.x-contrib | uob/tossdr/ucla/gnuradio-802.15.4-demodulation/src/lib/ucla_manchester_ff.h | /* -*- c++ -*- */
/*
* Copyright 2004 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef INCLUDED_UCLA_MANCHESTER_FF_H
#define INCLUDED_UCLA_MANCHESTER_FF_H
#include <gr_sync_interpolator.h>
class ucla_manchester_ff;
typedef boost::shared_ptr<ucla_manchester_ff> ucla_manchester_ff_sptr;
ucla_manchester_ff_sptr ucla_make_manchester_ff ();
/*!
* \brief
* \ingroup ucla
*
* input:
*
*/
class ucla_manchester_ff : public gr_sync_interpolator
{
friend ucla_manchester_ff_sptr ucla_make_manchester_ff ();
ucla_manchester_ff();
public:
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
};
#endif
|
tinyos-io/tinyos-3.x-contrib | berkeley/acme/tools/ACReport.h | /*
* "Copyright (c) 2008 The Regents of the University of California.
* All rights reserved."
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
*/
#ifndef _UDPREPORT_H
#define _UDPREPORT_H
nx_struct ac_report {
nx_uint32_t power;
nx_uint32_t energy;
nx_uint32_t maxPower;
nx_uint32_t minPower;
nx_uint32_t averagePower;
nx_uint32_t seq;
};
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/doc/mTypes.h | #ifndef _MTYPES_H_
#define _MTYPES_H_
/*
StargateTestAudio 1
StargateTestVideo 2
StargateTestImage 3
*/
bool
StargateTestAudio (uint8_t value)
{
return value == 1;
}
bool
StargateTestVideo (uint8_t value)
{
return value == 2;
}
bool
TestVideo (uint8_t value)
{
return FALSE;
}
bool
TestAudio (uint8_t value)
{
return FALSE;
}
bool
StargateTestImage (uint8_t value)
{
return value == 3;
}
bool
TestImage (uint8_t value)
{
return FALSE;
}
bool
TestText (uint8_t value)
{
return FALSE;
}
#endif // _MTYPES_H_
|
tinyos-io/tinyos-3.x-contrib | wsu/telosw/ccxx00/lpl/boxmac/Boxmac.h | <filename>wsu/telosw/ccxx00/lpl/boxmac/Boxmac.h
#ifndef BOXMAC_H
#define BOXMAC_H
/**
* This is what we divide the original wake-up transmission by. The more
* divisions, the more efficient your wake-up transmission with less time
* on-air, but your receptions will become less reliable.
* See the readme.txt file.
*/
#ifndef BOXMAC_WAKEUP_TRANSMISSION_DIVISIONS
#define BOXMAC_WAKEUP_TRANSMISSION_DIVISIONS 4
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/stargate/sfaccess/teloscomm.c | <reponame>tinyos-io/tinyos-3.x-contrib
#include "teloscomm.h"
#include <pthread.h>
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
const char *dbglevel[] = {"TELOSSOURCE","TINYRELY","APP"};
void hton_int16(uint8_t *buf, int16_t data)
{
buf[0] = data & 0x00ff;
buf[1] = (data >> 8) & 0x00ff;
}
void hton_int32(uint8_t *buf, int32_t data)
{
buf[0] = data & 0x00ff;
buf[1] = (data >> 8) & 0x00ff;
buf[2] = (data >> 16) & 0x00ff;
buf[3] = (data >> 24) & 0x00ff;
}
void hton_uint16(uint8_t *buf, uint16_t data)
{
hton_int16(buf,data);
}
void hton_uint32(uint8_t *buf, uint32_t data)
{
hton_int32(buf,data);
}
void ntoh_int16(uint8_t *buf, int16_t *data)
{
*data = buf[0] | (buf[1] << 8);
}
void ntoh_int32(uint8_t *buf, int32_t *data)
{
*data = ((int32_t)buf[0]) |
(((int32_t)buf[1]) << 8) |
(((int32_t)buf[2]) << 16) |
(((int32_t)buf[3]) << 24);
}
void ntoh_uint16(uint8_t *buf, uint16_t *data)
{
ntoh_int16(buf,(int16_t*)data);
}
void ntoh_uint32(uint8_t *buf, uint32_t *data)
{
ntoh_int32(buf,(int32_t*)data);
}
int dbg(int level, const char* format, ...)
{
int val = 0;
#ifdef DEBUG
va_list ap;
pthread_mutex_lock(&mutex);
va_start(ap, format);
val = vprintf(format, ap);
va_end(ap);
pthread_mutex_unlock(&mutex);
#endif
return val;
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/compression/buffer_pc.c | <reponame>tinyos-io/tinyos-3.x-contrib
#include <stdio.h>
#include "buffer.h"
void handle_full_buffer(uint8_t *buffer, uint16_t nobytes)
{
fwrite(buffer, nobytes, 1, stdout);
}
|
tinyos-io/tinyos-3.x-contrib | wsu/tools/simx/simx/test/Octopus/motes/OctopusConfig.h | <filename>wsu/tools/simx/simx/test/Octopus/motes/OctopusConfig.h
// $Id: OctopusConfig.h,v 1.4 2008/03/13 14:16:37 a_barbirato Exp $
/* tab:4
* Copyright (c) 2007 University College Dublin.
* 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 and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL UNIVERSITY COLLEGE DUBLIN 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
* UNIVERSITY COLLEGE DUBLIN HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* UNIVERSITY COLLEGE DUBLIN 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 UNIVERSITY COLLEGE DUBLIN HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*
* Authors: <NAME>, <NAME>, and <NAME>
* Date created: 2007/09/07
*
*/
/**
* @author <NAME>, <NAME>, and <NAME>
*/
#ifndef OCTOPUS_CONFIG_H
#define OCTOPUS_CONFIG_H
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file includes every constant that can be defined by *
* a final user. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
Choice of the protocol used to repatriate data to the root
of the network.
Two protocols can't have the same name, even if they are
not of the same type
*/
//#define LOW_POWER_LISTENING
#define COLLECTION_PROTOCOL // cf TEP 119: Collection.
//#define DUMMY_COLLECT_PROTOCOL // not working
/*
Choice of the protocol used to broadcast data over the network
*/
#define DISSEMINATION_PROTOCOL // cf TEP 118: Dissemination.
//#define DUMMY_BROADCAST_PROTOCOL // not working
/*
S E N S O R
Sampling of the sensor. The unit is the milliseconds.
MINIMUM_SAMPLING_PERIOD is the minimum value that should
be broadcasted to the network to avoid congestion issues.
A formula that can be used is, with N the number of motes
of the network, and MINIMUM_SAMPLING_PERIOD in ms :
MINIMUM_SAMPLING_PERIOD = 100 * N
Threshold of the sensor. A threshold of 0 means that
the value is sent every time. Else the threshold is
a 16-bits unsigned integer.
M O D E
The user can choose either the automatic aka timer-driven
mode (MODE_AUTO) or the manual aka request-driven mode
(MODE_QUERY).
S L E E P & A W A K E D U T Y C Y C L E
The user can define the sleep duty cycle and the awake
duty cycle in units of [percent * 100]. For example, to
get a 0.05% duty cycle, use the value 5, and for a 100%
duty cycle (always on), use the value 10000.
This is the equivalent of setting the local sleep
interval explicitly.
*/
enum {
DEFAULT_SAMPLING_PERIOD = 1024,
MINIMUM_SAMPLING_PERIOD = 1024,
DEFAULT_THRESHOLD = 0,
DEFAULT_MODE = MODE_AUTO,
DEFAULT_SLEEP_DUTY_CYCLE = 2000, // 20%
DEFAULT_AWAKE_DUTY_CYCLE = 9000 // 90%
};
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/tos/chips/msp430/dac12/Msp430Dac12.h |
/**
* @author <NAME>
*/
#ifndef MSP430DAC12_H
#define MSP430DAC12_H
/**
* DAC12 Control Register
*/
typedef struct {
/** MSB is reserved */
unsigned int reserved : 1;
/** Reference Voltage. 0 = Vref+; 1 = Vref+; 2 = VeRef+; 3 = VeRef+ */
unsigned int dac12srefx : 2;
/** Resolution. 0 = 12-bit resolution; 1 = 8-bit resolution */
unsigned int dac12res : 1;
/**
* DAC12 Load Select. Selects the load trigger for the DAC12 latch.
* DAC12ENC must be set for the DAC to update, except when DAC12LSELx = 0.
* 0 = DAC12 latch loads when DAC12_xDAT written (DAC12ENC is ignored)
* 1 = DAC12 latch loads when DAC12_xDAT written, or, when grouped,
* when all DAC12_xDAT registers in the group have been written.
* 2 = Rising edge of Timer_A.OUT1 (TA1)
* 3 = Rising edge of Timer_B.OUT2 (TB2)
*/
unsigned int dac12lselx : 2;
/** Calibration. This bit initiates calibration and is automatically reset */
unsigned int dac12calon : 1;
/**
* Input Range. This bit sets the reference input and voltage output range.
* 0 = DAC12 full-scale output = 3x reference voltage.
* 1 = DAC12 full-scale output = 1x reference voltage.
*/
unsigned int dac12ir : 1;
/**
* DAC12 Amplifier setting. These bits select settling time vs. current
* consumption for the DAC12 input and output amplifiers.
*
* DAC12AMPx | Input Buffer | Output Buffer
* ______________|______________________|_______________________________
* 0 | Off | DAC12 off, output high Z
* 1 | Off | DAC12 off, output 0V
* 2 | Low speed/current | Low speed/current
* 3 | Low speed/current | Medium speed/current
* 4 | Low speed/current | High speed/current
* 5 | Medium speed/current | Medium speed/current
* 6 | Medium speed/current | High speed/current
* 7 | High speed/current | High speed/current
*/
unsigned int dac12ampx : 3;
/** Data Format. 0 = Straight binary; 1 = 2's compliment */
unsigned int dac12df : 1;
/** Interrupt Enable. 0 = Disabled; 1 = Enabled */
unsigned int dac12ie : 1;
/** Interrupt Flag */
unsigned int dac12ifg : 1;
/**
* DAC12 Enable Conversion. This bit enables the DAC12 module when
* DAC12LSELx > 0. When DAC12LSELx = 0, DAC12ENC is ignored.
* 0 = DAC12 disabled
* 1 = DAC12 enabled
*/
unsigned int dac12enc : 1;
/** Groups DAC12_x with the next higher DAC12_x. 0 = Not Grouped; 1 = Grouped */
unsigned int dac12grp : 1;
} msp430_dac12_control_t;
/**
* Reference voltage source settings
*/
enum dac12sref_enum {
DAC12SREF_VREF = 0,
DAC12SREF_VEREF = 3,
};
/**
* Data resolution settings
*/
enum dac12res_enum {
DAC12RES_12BIT = 0,
DAC12RES_8BIT = 1,
};
/**
* Load select settings
*/
enum dac12lsel_enum {
DAC12LSEL_DATA_WRITTEN_ALWAYS = 0,
DAC12LSEL_DATA_WRITTEN_WHEN_ENABLED = 1,
DAC12LSEL_RISINGEDGE_TIMERA1 = 2,
DAC12LSEL_RISINGEDGE_TIMERB2 = 3,
};
/**
* Input Range settings
*/
enum dac12ir_enum {
DAC12IR_3X_VOLTREF = 0,
DAC12IR_1X_VOLTREF = 1,
};
enum dac12amp_enum {
DAC12AMP_INPUTOFF_OUTPUTHIGHZ = 0,
DAC12AMP_INPUTOFF_OUTPUT0V = 1,
DAC12AMP_INPUTLOW_OUTPUTLOW = 2,
DAC12AMP_INPUTLOW_OUTPUTMED = 3,
DAC12AMP_INPUTLOW_OUTPUTHIGH = 4,
DAC12AMP_INPUTMED_OUTPUTMED = 5,
DAC12AMP_INPUTMED_OUTPUTHIGH = 6,
DAC12AMP_INPUTHIGH_OUTPUTHIGH = 7,
};
enum dac12df_enum {
DAC12_DATAFORMAT_BINARY = 0,
DAC12_DATAFORMAT_TWOSCOMPLIMENT = 1,
};
enum dac12ie_enum {
DAC12_INTERRUPTS_DISABLED = 0,
DAC12_INTERRUPTS_ENABLED = 1,
};
enum dac12enc_enum {
DAC12_DISABLED = 0,
DAC12_ENABLED = 1,
};
enum dac12grp_enum {
DAC12_NOT_GROUPED = 0,
DAC12_GROUPED = 1,
};
/**
* DAC12 Control Bit Locations
*/
enum dac12_ctl_bits {
DAC12_DAC12SREF = 14, // Reference Voltage (LSB = Don't Care)
DAC12_DAC12RES = 12, // Resolution
DAC12_DAC12LSEL = 10, // Load Select
DAC12_DAC12CALON = 9, // Calibration On. Automatically resets.
DAC12_DAC12IR = 8, // Input Range (1x or 3x reference voltage)
DAC12_DAC12AMP = 5, // Amplifier Setting
DAC12_DAC12DF = 4, // Data Format
DAC12_DAC12IE = 3, // Interrupt Enable
DAC12_DAC12IFG = 2, // Interrupt Flag
DAC12_DAC12ENC = 1, // Enable Conversion
DAC12_DAC12GRP = 0, // Group with the next higher DAC12_x
};
#endif
|
tinyos-io/tinyos-3.x-contrib | ethz/snpk/apps/DSNBoot/msp430usart.h | <reponame>tinyos-io/tinyos-3.x-contrib
// $Id: msp430usart.h,v 1.1 2007/02/23 14:51:41 rlim Exp $
/*
* "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."
*/
/**
* @author <NAME>
* Revision: $Revision: 1.1 $
*/
#ifndef MSP430USART_H
#define MSP430USART_H
typedef enum
{
USART_NONE = 0,
USART_UART = 1,
USART_UART_TX = 2,
USART_UART_RX = 3,
USART_SPI = 4,
USART_I2C = 5
} msp430_usartmode_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/tos/platforms/blaze2/hardware.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
#ifndef _H_hardware_h
#define _H_hardware_h
#include "msp430hardware.h"
//#include "MSP430ADC12.h"
//#include "CC2420Const.h"
//#include "AM.h"
// P1
TOSH_ASSIGN_PIN(TILT_SENSE, 1, 7);
TOSH_ASSIGN_PIN(EXT_INT4, 1, 6);
TOSH_ASSIGN_PIN(EXT_VCC_SENSE, 1, 5);
TOSH_ASSIGN_PIN(CC2500_GDO2, 1, 4);
TOSH_ASSIGN_PIN(CC2500_GDO0, 1, 3);
TOSH_ASSIGN_PIN(CC1101_GDO2, 1, 2);
TOSH_ASSIGN_PIN(BSL_TX, 1, 1);
TOSH_ASSIGN_PIN(CC1101_GDO0, 1, 0);
// P2
TOSH_ASSIGN_PIN(LNAPA_CC1101_MODE, 2, 7);
TOSH_ASSIGN_PIN(EXT_INT3, 2, 6);
TOSH_ASSIGN_PIN(ROSC, 2, 5);
TOSH_ASSIGN_PIN(NBD_CC1101_GDO2, 2, 4);
TOSH_ASSIGN_PIN(NBD_CC1101_GDO0, 2, 3);
TOSH_ASSIGN_PIN(BSL_RX, 2, 2);
TOSH_ASSIGN_PIN(AUX_ENABLE, 2, 1);
TOSH_ASSIGN_PIN(EXT_INT5, 2, 0);
// P3
TOSH_ASSIGN_PIN(UART1_RX, 3, 7);
TOSH_ASSIGN_PIN(UART1_TX, 3, 6);
TOSH_ASSIGN_PIN(NBD_CC1101_CS, 3, 5);
TOSH_ASSIGN_PIN(GPS_CS, 3, 4);
TOSH_ASSIGN_PIN(SPI0_CLK, 3, 3);
TOSH_ASSIGN_PIN(SPI0_MISO, 3, 2);
TOSH_ASSIGN_PIN(SPI0_MOSI, 3, 1);
TOSH_ASSIGN_PIN(CC1101_CS, 3, 0);
// P4
TOSH_ASSIGN_PIN(FLASH_HOLD, 4, 7);
TOSH_ASSIGN_PIN(CTRL_P46, 4, 6);
TOSH_ASSIGN_PIN(PA_ENABLE, 4, 5);
TOSH_ASSIGN_PIN(FLASH_CS, 4, 4);
TOSH_ASSIGN_PIN(LNA_ENABLE, 4, 3);
TOSH_ASSIGN_PIN(ACCEL_ENABLE, 4, 2);
TOSH_ASSIGN_PIN(RS232_ENABLE, 4, 1);
TOSH_ASSIGN_PIN(SDIO_CLK, 4, 0);
// P5
TOSH_ASSIGN_PIN(CC2500_CS, 5, 7);
TOSH_ASSIGN_PIN(CTRL_P56, 5, 6);
TOSH_ASSIGN_PIN(CTRL_P55, 5, 5);
TOSH_ASSIGN_PIN(LNAPA_CC2500_MODE, 5, 4);
TOSH_ASSIGN_PIN(SPI1_CLK, 5, 3);
TOSH_ASSIGN_PIN(SPI1_MISO, 5, 2);
TOSH_ASSIGN_PIN(SPI1_MOSI, 5, 1);
TOSH_ASSIGN_PIN(SPI1_STE, 5, 0);
// P6
TOSH_ASSIGN_PIN(SDIO_DAT3, 6, 7);
TOSH_ASSIGN_PIN(SDIO_DAT2, 6, 6);
TOSH_ASSIGN_PIN(SDIO_DAT1, 6, 5);
TOSH_ASSIGN_PIN(GPS_ENABLE, 6, 4);
TOSH_ASSIGN_PIN(TILT_ENABLE, 6, 3);
TOSH_ASSIGN_PIN(FET_ENABLE, 6, 2);
TOSH_ASSIGN_PIN(PORT61, 6, 1);
TOSH_ASSIGN_PIN(PORT60, 6, 0);
// UART pin aliases
TOSH_ASSIGN_PIN(URXD1, 3, 7);
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD0, 3, 5);
TOSH_ASSIGN_PIN(UTXD0, 3, 4);
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(SIMO0, 3, 1);
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(SIMO1, 5, 1);
// need to undef atomic inside header files or nesC ignores the directive
#undef atomic
#endif // _H_hardware_h
|
tinyos-io/tinyos-3.x-contrib | antlab-polimi/dpcm_C/dpcm.h |
int dpcm_encode(uint8_t* input,uint16_t width,uint16_t height,uint8_t qual,char * filename);
int dpcm_decode(char * filename,uint8_t frame_num);
|
tinyos-io/tinyos-3.x-contrib | ahhr-ipsn09/tos/utils/NxVector.h | /*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
* this license. If you do not agree to this license, do not download,
* install, copy or use the software.
*
* Copyright (c) 2006-2008 Vrije Universiteit Amsterdam and
* Development Laboratories (DevLab), Eindhoven, the Netherlands.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions, the author, and the following
* disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, the author, and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Vrije Universiteit Amsterdam, nor the name of
* DevLab, nor the names of their contributors may be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VRIJE
* UNIVERSITEIT AMSTERDAM, DEVLAB, OR THEIR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: <NAME>
* CVS id: $Id: NxVector.h,v 1.1 2009/04/07 08:42:27 iwanicki Exp $
*/
#ifndef __NX_VECTOR__H__
#define __NX_VECTOR__H__
/**
* This file contains data types necessary to support variable-size
* vectors inside TinyOS messages.
*
* @author <NAME> <<EMAIL>>
*/
/**
* A variable size vector.
*
* The length of the vector is encoded in the first byte
* of the vector. The size of the structure may vary based on
* the encoded length.
*/
typedef nx_struct {
nx_uint8_t data[1];
} nx_vect_t;
#endif //__NX_VECTOR__H__
|
tinyos-io/tinyos-3.x-contrib | eon/tos/lib/tossim/sim_radio.h | /*
* "Copyright (c) 2005 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* The C functions that allow TOSSIM-side code to access the SimMoteP
* component.
*
* @author <NAME>
* @date Nov 22 2005
*/
/**
* Simplified to improve performance for the eon simulator
* @author <NAME>
*
*/
#ifndef SIM_RADIO_H_INCLUDED
#define SIM_RADIO_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <tos.h>
//#include <sim_tossim.h>
typedef struct radio_entry {
int mote;
int cap;
double energy_per_pkt;
sim_time_t expires;
struct radio_entry* next;
} radio_entry_t;
void sim_radio_add(int src, int dest, int cap, double energy_per_pkt, sim_time_t expires);
int sim_radio_capacity(int src, int dest);
void sim_radio_set_capacity(int src, int dest, int newcap);
bool sim_radio_consume_capacity(int src, int dest, int delta);
bool sim_radio_connected(int src, int dest);
void sim_radio_remove(int src, int dest);
radio_entry_t* sim_radio_first(int src);
radio_entry_t* sim_radio_next(radio_entry_t* e);
#ifdef __cplusplus
}
#endif
#endif // SIM_GAIN_H_INCLUDED
|
tinyos-io/tinyos-3.x-contrib | ucd/Octopus/motes/build/aquisgrain/app.c | #define nx_struct struct
#define nx_union union
#define dbg(mode, format, ...) ((void)0)
#define dbg_clear(mode, format, ...) ((void)0)
#define dbg_active(mode) 0
# 65 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/stdint.h"
typedef signed char int8_t;
typedef unsigned char uint8_t;
# 104 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/stdint.h" 3
typedef int int16_t;
typedef unsigned int uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#line 155
typedef int16_t intptr_t;
typedef uint16_t uintptr_t;
# 235 "/usr/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 257
static __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);
#line 294
static __inline uint32_t __nesc_ntoh_uint32(const void *source);
static __inline uint32_t __nesc_hton_uint32(void *target, uint32_t value);
#line 385
typedef struct { char data[1]; } __attribute__((packed)) nx_int8_t;typedef int8_t __nesc_nxbase_nx_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_int16_t;typedef int16_t __nesc_nxbase_nx_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_int32_t;typedef int32_t __nesc_nxbase_nx_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_int64_t;typedef int64_t __nesc_nxbase_nx_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nx_uint8_t;typedef uint8_t __nesc_nxbase_nx_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_uint16_t;typedef uint16_t __nesc_nxbase_nx_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_uint32_t;typedef uint32_t __nesc_nxbase_nx_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_uint64_t;typedef uint64_t __nesc_nxbase_nx_uint64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_int8_t;typedef int8_t __nesc_nxbase_nxle_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_int16_t;typedef int16_t __nesc_nxbase_nxle_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_int32_t;typedef int32_t __nesc_nxbase_nxle_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_int64_t;typedef int64_t __nesc_nxbase_nxle_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_uint8_t;typedef uint8_t __nesc_nxbase_nxle_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_uint16_t;typedef uint16_t __nesc_nxbase_nxle_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_uint32_t;typedef uint32_t __nesc_nxbase_nxle_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_uint64_t;typedef uint64_t __nesc_nxbase_nxle_uint64_t ;
# 213 "/usr/lib/gcc/avr/3.4.3/include/stddef.h" 3
typedef unsigned int size_t;
# 67 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/string.h"
extern void *memcpy(void *, const void *, size_t );
extern void *memset(void *, int , size_t );
# 325 "/usr/lib/gcc/avr/3.4.3/include/stddef.h" 3
typedef int wchar_t;
# 69 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/stdlib.h"
#line 66
typedef struct __nesc_unnamed4242 {
int quot;
int rem;
} div_t;
#line 72
typedef struct __nesc_unnamed4243 {
long quot;
long rem;
} ldiv_t;
typedef int (*__compar_fn_t)(const void *, const void *);
# 138 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/math.h" 3
extern double sin(double __x) __attribute((const)) ;
# 151 "/usr/lib/gcc/avr/3.4.3/include/stddef.h" 3
typedef int ptrdiff_t;
# 20 "/opt/tinyos-2.x/tos/system/tos.h"
typedef uint8_t bool;
enum __nesc_unnamed4244 {
#line 21
FALSE = 0, TRUE = 1
};
typedef nx_int8_t nx_bool;
uint16_t TOS_NODE_ID = 1;
struct __nesc_attr_atmostonce {
};
#line 31
struct __nesc_attr_atleastonce {
};
#line 32
struct __nesc_attr_exactlyonce {
};
# 34 "/opt/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
};
typedef uint8_t error_t ;
static inline error_t ecombine(error_t r1, error_t r2);
# 90 "/usr/lib/gcc/avr/3.4.3/../../../../avr/include/avr/pgmspace.h"
typedef 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 "/opt/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__)) ;
# 82 "/opt/tinyos-2.x/tos/chips/atm128/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 102
__inline __nesc_atomic_t
__nesc_atomic_start(void ) ;
#line 111
__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);
# 34 "/opt/tinyos-2.x/tos/chips/atm128/adc/Atm128Adc.h"
enum __nesc_unnamed4247 {
ATM128_ADC_VREF_OFF = 0,
ATM128_ADC_VREF_AVCC = 1,
ATM128_ADC_VREF_RSVD,
ATM128_ADC_VREF_2_56 = 3
};
enum __nesc_unnamed4248 {
ATM128_ADC_RIGHT_ADJUST = 0,
ATM128_ADC_LEFT_ADJUST = 1
};
enum __nesc_unnamed4249 {
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 85
typedef struct __nesc_unnamed4250 {
uint8_t mux : 5;
uint8_t adlar : 1;
uint8_t refs : 2;
} Atm128Admux_t;
enum __nesc_unnamed4251 {
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
};
enum __nesc_unnamed4252 {
ATM128_ADC_ENABLE_OFF = 0,
ATM128_ADC_ENABLE_ON
};
enum __nesc_unnamed4253 {
ATM128_ADC_START_CONVERSION_OFF = 0,
ATM128_ADC_START_CONVERSION_ON
};
enum __nesc_unnamed4254 {
ATM128_ADC_FREE_RUNNING_OFF = 0,
ATM128_ADC_FREE_RUNNING_ON
};
enum __nesc_unnamed4255 {
ATM128_ADC_INT_FLAG_OFF = 0,
ATM128_ADC_INT_FLAG_ON
};
enum __nesc_unnamed4256 {
ATM128_ADC_INT_ENABLE_OFF = 0,
ATM128_ADC_INT_ENABLE_ON
};
#line 141
typedef struct __nesc_unnamed4257 {
uint8_t adps : 3;
uint8_t adie : 1;
uint8_t adif : 1;
uint8_t adfr : 1;
uint8_t adsc : 1;
uint8_t aden : 1;
} Atm128Adcsra_t;
typedef uint8_t Atm128_ADCH_t;
typedef uint8_t Atm128_ADCL_t;
# 29 "/opt/tinyos-2.x/tos/lib/timer/Timer.h"
typedef struct __nesc_unnamed4258 {
}
#line 29
TMilli;
typedef struct __nesc_unnamed4259 {
}
#line 30
T32khz;
typedef struct __nesc_unnamed4260 {
}
#line 31
TMicro;
# 43 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128Timer.h"
enum __nesc_unnamed4261 {
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_unnamed4262 {
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_unnamed4263 {
AVR_CLOCK_OFF = 0,
AVR_CLOCK_ON = 1,
AVR_CLOCK_DIVIDE_8 = 2
};
enum __nesc_unnamed4264 {
ATM128_WAVE8_NORMAL = 0,
ATM128_WAVE8_PWM,
ATM128_WAVE8_CTC,
ATM128_WAVE8_PWM_FAST
};
enum __nesc_unnamed4265 {
ATM128_COMPARE_OFF = 0,
ATM128_COMPARE_TOGGLE,
ATM128_COMPARE_CLEAR,
ATM128_COMPARE_SET
};
#line 99
#line 89
typedef union __nesc_unnamed4266 {
uint8_t flat;
struct __nesc_unnamed4267 {
uint8_t cs : 3;
uint8_t wgm1 : 1;
uint8_t com : 2;
uint8_t wgm0 : 1;
uint8_t foc : 1;
} bits;
} Atm128TimerControl_t;
typedef Atm128TimerControl_t Atm128_TCCR0_t;
typedef uint8_t Atm128_TCNT0_t;
typedef uint8_t Atm128_OCR0_t;
typedef Atm128TimerControl_t Atm128_TCCR2_t;
typedef uint8_t Atm128_TCNT2_t;
typedef uint8_t Atm128_OCR2_t;
#line 121
#line 111
typedef union __nesc_unnamed4268 {
uint8_t flat;
struct __nesc_unnamed4269 {
uint8_t tcr0ub : 1;
uint8_t ocr0ub : 1;
uint8_t tcn0ub : 1;
uint8_t as0 : 1;
uint8_t rsvd : 4;
} bits;
} Atm128Assr_t;
#line 137
#line 124
typedef union __nesc_unnamed4270 {
uint8_t flat;
struct __nesc_unnamed4271 {
uint8_t toie0 : 1;
uint8_t ocie0 : 1;
uint8_t toie1 : 1;
uint8_t ocie1b : 1;
uint8_t ocie1a : 1;
uint8_t ticie1 : 1;
uint8_t toie2 : 1;
uint8_t ocie2 : 1;
} bits;
} Atm128_TIMSK_t;
#line 154
#line 141
typedef union __nesc_unnamed4272 {
uint8_t flat;
struct __nesc_unnamed4273 {
uint8_t tov0 : 1;
uint8_t ocf0 : 1;
uint8_t tov1 : 1;
uint8_t ocf1b : 1;
uint8_t ocf1a : 1;
uint8_t icf1 : 1;
uint8_t tov2 : 1;
uint8_t ocf2 : 1;
} bits;
} Atm128_TIFR_t;
#line 169
#line 158
typedef union __nesc_unnamed4274 {
uint8_t flat;
struct __nesc_unnamed4275 {
uint8_t psr321 : 1;
uint8_t psr0 : 1;
uint8_t pud : 1;
uint8_t acme : 1;
uint8_t rsvd : 3;
uint8_t tsm : 1;
} bits;
} Atm128_SFIOR_t;
enum __nesc_unnamed4276 {
ATM128_TIMER_COMPARE_NORMAL = 0,
ATM128_TIMER_COMPARE_TOGGLE,
ATM128_TIMER_COMPARE_CLEAR,
ATM128_TIMER_COMPARE_SET
};
#line 193
#line 184
typedef union __nesc_unnamed4277 {
uint8_t flat;
struct __nesc_unnamed4278 {
uint8_t wgm10 : 2;
uint8_t comC : 2;
uint8_t comB : 2;
uint8_t comA : 2;
} bits;
} Atm128TimerCtrlCompare_t;
typedef Atm128TimerCtrlCompare_t Atm128_TCCR1A_t;
typedef Atm128TimerCtrlCompare_t Atm128_TCCR3A_t;
enum __nesc_unnamed4279 {
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
};
#line 232
#line 222
typedef union __nesc_unnamed4280 {
uint8_t flat;
struct __nesc_unnamed4281 {
uint8_t cs : 3;
uint8_t wgm32 : 2;
uint8_t rsvd : 1;
uint8_t ices1 : 1;
uint8_t icnc1 : 1;
} bits;
} Atm128TimerCtrlCapture_t;
typedef Atm128TimerCtrlCapture_t Atm128_TCCR1B_t;
typedef Atm128TimerCtrlCapture_t Atm128_TCCR3B_t;
#line 250
#line 241
typedef union __nesc_unnamed4282 {
uint8_t flat;
struct __nesc_unnamed4283 {
uint8_t rsvd : 5;
uint8_t focC : 1;
uint8_t focB : 1;
uint8_t focA : 1;
} bits;
} Atm128TimerCtrlClock_t;
typedef Atm128TimerCtrlClock_t Atm128_TCCR1C_t;
typedef Atm128TimerCtrlClock_t Atm128_TCCR3C_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_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_ICR1H_t;
typedef uint8_t Atm128_ICR1L_t;
typedef uint8_t Atm128_ICR3H_t;
typedef uint8_t Atm128_ICR3L_t;
#line 300
#line 288
typedef union __nesc_unnamed4284 {
uint8_t flat;
struct __nesc_unnamed4285 {
uint8_t ocie1c : 1;
uint8_t ocie3c : 1;
uint8_t toie3 : 1;
uint8_t ocie3b : 1;
uint8_t ocie3a : 1;
uint8_t ticie3 : 1;
uint8_t rsvd : 2;
} bits;
} Atm128_ETIMSK_t;
#line 315
#line 303
typedef union __nesc_unnamed4286 {
uint8_t flat;
struct __nesc_unnamed4287 {
uint8_t ocf1c : 1;
uint8_t ocf3c : 1;
uint8_t tov3 : 1;
uint8_t ocf3b : 1;
uint8_t ocf3a : 1;
uint8_t icf3 : 1;
uint8_t rsvd : 2;
} bits;
} Atm128_ETIFR_t;
# 52 "/opt/tinyos-2.x/tos/platforms/aquisgrain/AGtimer.h"
typedef struct __nesc_unnamed4288 {
}
#line 52
T64khz;
typedef struct __nesc_unnamed4289 {
}
#line 53
T128khz;
typedef struct __nesc_unnamed4290 {
}
#line 54
T2mhz;
typedef struct __nesc_unnamed4291 {
}
#line 55
T4mhz;
#line 108
typedef T32khz TOne;
typedef TMicro TThree;
typedef uint16_t counter_one_overflow_t;
typedef uint16_t counter_three_overflow_t;
enum __nesc_unnamed4292 {
AG_PRESCALER_ONE = ATM128_CLK16_DIVIDE_256,
AG_DIVIDE_ONE_FOR_32KHZ_LOG2 = 0,
AG_PRESCALER_THREE = ATM128_CLK16_DIVIDE_8,
AG_DIVIDE_THREE_FOR_MICRO_LOG2 = 0,
EXT_STANDBY_T0_THRESHOLD = 12
};
enum __nesc_unnamed4293 {
PLATFORM_MHZ = 8
};
# 16 "/opt/tinyos-2.x/tos/platforms/aquisgrain/hardware.h"
enum __nesc_unnamed4294 {
PLATFORM_BAUDRATE = 57600L
};
# 6 "/opt/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_unnamed4295 {
AM_BROADCAST_ADDR = 0xffff
};
enum __nesc_unnamed4296 {
TOS_AM_GROUP = 0x22,
TOS_AM_ADDRESS = 1
};
# 10 "./Octopus.h"
enum __nesc_unnamed4297 {
AM_OCTOPUS_COLLECTED_MSG = 0x93,
AM_OCTOPUS_BROADCAST_MSG = 0x71,
AM_OCTOPUS_SENT_MSG = 0x65,
NO_REPLY = 0x00,
BATTERY_AND_MODE_REPLY = 0x20,
PERIOD_REPLY = 0x40,
THRESHOLD_REPLY = 0x60,
SLEEP_DUTY_CYCLE_REPLY = 0x80,
AWAKE_DUTY_CYCLE_REPLY = 0xA0,
REPLY_MASK = 0xE0,
MODE_MASK = 0x01,
SLEEP_MASK = 0x02,
SLEEPING = 0x02,
AWAKE = 0x00,
SET_MODE_AUTO_REQUEST = 1,
SET_MODE_QUERY_REQUEST = 2,
SET_PERIOD_REQUEST = 3,
SET_THRESHOLD_REQUEST = 4,
GET_STATUS_REQUEST = 5,
SLEEP_REQUEST = 6,
WAKE_UP_REQUEST = 7,
GET_PERIOD_REQUEST = 8,
GET_THRESHOLD_REQUEST = 9,
GET_READING_REQUEST = 10,
GET_SLEEP_DUTY_CYCLE_REQUEST = 11,
GET_AWAKE_DUTY_CYCLE_REQUEST = 12,
SET_SLEEP_DUTY_CYCLE_REQUEST = 13,
SET_AWAKE_DUTY_CYCLE_REQUEST = 14,
BROADCAST_DIS_KEY = 42,
MODE_AUTO = 1,
MODE_QUERY = 0
};
# 57 "./OctopusConfig.h"
enum __nesc_unnamed4298 {
DEFAULT_SAMPLING_PERIOD = 1024,
MINIMUM_SAMPLING_PERIOD = 1024,
DEFAULT_THRESHOLD = 0,
DEFAULT_MODE = MODE_AUTO,
DEFAULT_SLEEP_DUTY_CYCLE = 2000,
DEFAULT_AWAKE_DUTY_CYCLE = 9000
};
# 57 "./Octopus.h"
#line 50
typedef nx_struct octopus_collected_msg {
nx_am_addr_t moteId;
nx_uint16_t count;
nx_uint16_t reading;
nx_uint16_t quality;
nx_am_addr_t parentId;
nx_uint8_t reply;
} __attribute__((packed)) octopus_collected_msg_t;
#line 93
#line 89
typedef nx_struct octopus_sent_msg {
nx_am_addr_t targetId;
nx_uint8_t request;
nx_uint16_t parameters;
} __attribute__((packed)) octopus_sent_msg_t;
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420.h"
typedef uint8_t cc2420_status_t;
#line 59
#line 45
typedef nx_struct cc2420_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 type;
} __attribute__((packed)) cc2420_header_t;
#line 64
typedef nx_struct cc2420_footer_t {
} __attribute__((packed)) cc2420_footer_t;
#line 86
#line 71
typedef nx_struct cc2420_metadata_t {
nx_uint8_t tx_power;
nx_uint8_t rssi;
nx_uint8_t lqi;
nx_bool crc;
nx_bool ack;
nx_uint16_t time;
nx_uint16_t rxInterval;
} __attribute__((packed))
cc2420_metadata_t;
#line 89
typedef nx_struct cc2420_packet_t {
cc2420_header_t packet;
nx_uint8_t data[];
} __attribute__((packed)) cc2420_packet_t;
#line 123
enum __nesc_unnamed4299 {
MAC_HEADER_SIZE = sizeof(cc2420_header_t ) - 1,
MAC_FOOTER_SIZE = sizeof(uint16_t ),
MAC_PACKET_SIZE = MAC_HEADER_SIZE + 28 + MAC_FOOTER_SIZE
};
enum cc2420_enums {
CC2420_TIME_ACK_TURNAROUND = 7,
CC2420_TIME_VREN = 20,
CC2420_TIME_SYMBOL = 2,
CC2420_BACKOFF_PERIOD = 20 / CC2420_TIME_SYMBOL,
CC2420_MIN_BACKOFF = 20 / CC2420_TIME_SYMBOL,
CC2420_ACK_WAIT_DELAY = 128
};
enum cc2420_status_enums {
CC2420_STATUS_RSSI_VALID = 1 << 1,
CC2420_STATUS_LOCK = 1 << 2,
CC2420_STATUS_TX_ACTIVE = 1 << 3,
CC2420_STATUS_ENC_BUSY = 1 << 4,
CC2420_STATUS_TX_UNDERFLOW = 1 << 5,
CC2420_STATUS_XOSC16M_STABLE = 1 << 6
};
enum cc2420_config_reg_enums {
CC2420_SNOP = 0x00,
CC2420_SXOSCON = 0x01,
CC2420_STXCAL = 0x02,
CC2420_SRXON = 0x03,
CC2420_STXON = 0x04,
CC2420_STXONCCA = 0x05,
CC2420_SRFOFF = 0x06,
CC2420_SXOSCOFF = 0x07,
CC2420_SFLUSHRX = 0x08,
CC2420_SFLUSHTX = 0x09,
CC2420_SACK = 0x0a,
CC2420_SACKPEND = 0x0b,
CC2420_SRXDEC = 0x0c,
CC2420_SRXENC = 0x0d,
CC2420_SAES = 0x0e,
CC2420_MAIN = 0x10,
CC2420_MDMCTRL0 = 0x11,
CC2420_MDMCTRL1 = 0x12,
CC2420_RSSI = 0x13,
CC2420_SYNCWORD = 0x14,
CC2420_TXCTRL = 0x15,
CC2420_RXCTRL0 = 0x16,
CC2420_RXCTRL1 = 0x17,
CC2420_FSCTRL = 0x18,
CC2420_SECCTRL0 = 0x19,
CC2420_SECCTRL1 = 0x1a,
CC2420_BATTMON = 0x1b,
CC2420_IOCFG0 = 0x1c,
CC2420_IOCFG1 = 0x1d,
CC2420_MANFIDL = 0x1e,
CC2420_MANFIDH = 0x1f,
CC2420_FSMTC = 0x20,
CC2420_MANAND = 0x21,
CC2420_MANOR = 0x22,
CC2420_AGCCTRL = 0x23,
CC2420_AGCTST0 = 0x24,
CC2420_AGCTST1 = 0x25,
CC2420_AGCTST2 = 0x26,
CC2420_FSTST0 = 0x27,
CC2420_FSTST1 = 0x28,
CC2420_FSTST2 = 0x29,
CC2420_FSTST3 = 0x2a,
CC2420_RXBPFTST = 0x2b,
CC2420_FMSTATE = 0x2c,
CC2420_ADCTST = 0x2d,
CC2420_DACTST = 0x2e,
CC2420_TOPTST = 0x2f,
CC2420_TXFIFO = 0x3e,
CC2420_RXFIFO = 0x3f
};
enum cc2420_ram_addr_enums {
CC2420_RAM_TXFIFO = 0x000,
CC2420_RAM_RXFIFO = 0x080,
CC2420_RAM_KEY0 = 0x100,
CC2420_RAM_RXNONCE = 0x110,
CC2420_RAM_SABUF = 0x120,
CC2420_RAM_KEY1 = 0x130,
CC2420_RAM_TXNONCE = 0x140,
CC2420_RAM_CBCSTATE = 0x150,
CC2420_RAM_IEEEADR = 0x160,
CC2420_RAM_PANID = 0x168,
CC2420_RAM_SHORTADR = 0x16a
};
enum cc2420_nonce_enums {
CC2420_NONCE_BLOCK_COUNTER = 0,
CC2420_NONCE_KEY_SEQ_COUNTER = 2,
CC2420_NONCE_FRAME_COUNTER = 3,
CC2420_NONCE_SOURCE_ADDRESS = 7,
CC2420_NONCE_FLAGS = 15
};
enum cc2420_main_enums {
CC2420_MAIN_RESETn = 15,
CC2420_MAIN_ENC_RESETn = 14,
CC2420_MAIN_DEMOD_RESETn = 13,
CC2420_MAIN_MOD_RESETn = 12,
CC2420_MAIN_FS_RESETn = 11,
CC2420_MAIN_XOSC16M_BYPASS = 0
};
enum cc2420_mdmctrl0_enums {
CC2420_MDMCTRL0_RESERVED_FRAME_MODE = 13,
CC2420_MDMCTRL0_PAN_COORDINATOR = 12,
CC2420_MDMCTRL0_ADR_DECODE = 11,
CC2420_MDMCTRL0_CCA_HYST = 8,
CC2420_MDMCTRL0_CCA_MOD = 6,
CC2420_MDMCTRL0_AUTOCRC = 5,
CC2420_MDMCTRL0_AUTOACK = 4,
CC2420_MDMCTRL0_PREAMBLE_LENGTH = 0
};
enum cc2420_mdmctrl1_enums {
CC2420_MDMCTRL1_CORR_THR = 6,
CC2420_MDMCTRL1_DEMOD_AVG_MODE = 5,
CC2420_MDMCTRL1_MODULATION_MODE = 4,
CC2420_MDMCTRL1_TX_MODE = 2,
CC2420_MDMCTRL1_RX_MODE = 0
};
enum cc2420_rssi_enums {
CC2420_RSSI_CCA_THR = 8,
CC2420_RSSI_RSSI_VAL = 0
};
enum cc2420_syncword_enums {
CC2420_SYNCWORD_SYNCWORD = 0
};
enum cc2420_txctrl_enums {
CC2420_TXCTRL_TXMIXBUF_CUR = 14,
CC2420_TXCTRL_TX_TURNAROUND = 13,
CC2420_TXCTRL_TXMIX_CAP_ARRAY = 11,
CC2420_TXCTRL_TXMIX_CURRENT = 9,
CC2420_TXCTRL_PA_CURRENT = 6,
CC2420_TXCTRL_RESERVED = 5,
CC2420_TXCTRL_PA_LEVEL = 0
};
enum cc2420_rxctrl0_enums {
CC2420_RXCTRL0_RXMIXBUF_CUR = 12,
CC2420_RXCTRL0_HIGH_LNA_GAIN = 10,
CC2420_RXCTRL0_MED_LNA_GAIN = 8,
CC2420_RXCTRL0_LOW_LNA_GAIN = 6,
CC2420_RXCTRL0_HIGH_LNA_CURRENT = 4,
CC2420_RXCTRL0_MED_LNA_CURRENT = 2,
CC2420_RXCTRL0_LOW_LNA_CURRENT = 0
};
enum cc2420_rxctrl1_enums {
CC2420_RXCTRL1_RXBPF_LOCUR = 13,
CC2420_RXCTRL1_RXBPF_MIDCUR = 12,
CC2420_RXCTRL1_LOW_LOWGAIN = 11,
CC2420_RXCTRL1_MED_LOWGAIN = 10,
CC2420_RXCTRL1_HIGH_HGM = 9,
CC2420_RXCTRL1_MED_HGM = 8,
CC2420_RXCTRL1_LNA_CAP_ARRAY = 6,
CC2420_RXCTRL1_RXMIX_TAIL = 4,
CC2420_RXCTRL1_RXMIX_VCM = 2,
CC2420_RXCTRL1_RXMIX_CURRENT = 0
};
enum cc2420_rsctrl_enums {
CC2420_FSCTRL_LOCK_THR = 14,
CC2420_FSCTRL_CAL_DONE = 13,
CC2420_FSCTRL_CAL_RUNNING = 12,
CC2420_FSCTRL_LOCK_LENGTH = 11,
CC2420_FSCTRL_LOCK_STATUS = 10,
CC2420_FSCTRL_FREQ = 0
};
enum cc2420_secctrl0_enums {
CC2420_SECCTRL0_RXFIFO_PROTECTION = 9,
CC2420_SECCTRL0_SEC_CBC_HEAD = 8,
CC2420_SECCTRL0_SEC_SAKEYSEL = 7,
CC2420_SECCTRL0_SEC_TXKEYSEL = 6,
CC2420_SECCTRL0_SEC_RXKEYSEL = 5,
CC2420_SECCTRL0_SEC_M = 2,
CC2420_SECCTRL0_SEC_MODE = 0
};
enum cc2420_secctrl1_enums {
CC2420_SECCTRL1_SEC_TXL = 8,
CC2420_SECCTRL1_SEC_RXL = 0
};
enum cc2420_battmon_enums {
CC2420_BATTMON_BATT_OK = 6,
CC2420_BATTMON_BATTMON_EN = 5,
CC2420_BATTMON_BATTMON_VOLTAGE = 0
};
enum cc2420_iocfg0_enums {
CC2420_IOCFG0_BCN_ACCEPT = 11,
CC2420_IOCFG0_FIFO_POLARITY = 10,
CC2420_IOCFG0_FIFOP_POLARITY = 9,
CC2420_IOCFG0_SFD_POLARITY = 8,
CC2420_IOCFG0_CCA_POLARITY = 7,
CC2420_IOCFG0_FIFOP_THR = 0
};
enum cc2420_iocfg1_enums {
CC2420_IOCFG1_HSSD_SRC = 10,
CC2420_IOCFG1_SFDMUX = 5,
CC2420_IOCFG1_CCAMUX = 0
};
enum cc2420_manfidl_enums {
CC2420_MANFIDL_PARTNUM = 12,
CC2420_MANFIDL_MANFID = 0
};
enum cc2420_manfidh_enums {
CC2420_MANFIDH_VERSION = 12,
CC2420_MANFIDH_PARTNUM = 0
};
enum cc2420_fsmtc_enums {
CC2420_FSMTC_TC_RXCHAIN2RX = 13,
CC2420_FSMTC_TC_SWITCH2TX = 10,
CC2420_FSMTC_TC_PAON2TX = 6,
CC2420_FSMTC_TC_TXEND2SWITCH = 3,
CC2420_FSMTC_TC_TXEND2PAOFF = 0
};
enum cc2420_sfdmux_enums {
CC2420_SFDMUX_SFD = 0,
CC2420_SFDMUX_XOSC16M_STABLE = 24
};
# 72 "/opt/tinyos-2.x/tos/lib/serial/Serial.h"
typedef uint8_t uart_id_t;
enum __nesc_unnamed4300 {
HDLC_FLAG_BYTE = 0x7e,
HDLC_CTLESC_BYTE = 0x7d
};
enum __nesc_unnamed4301 {
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_unnamed4302 {
SERIAL_PROTO_ACK = 67,
SERIAL_PROTO_PACKET_ACK = 68,
SERIAL_PROTO_PACKET_NOACK = 69,
SERIAL_PROTO_PACKET_UNKNOWN = 255
};
#line 110
#line 98
typedef struct radio_stats {
uint8_t version;
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 112
typedef 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 120
typedef nx_struct serial_packet {
serial_header_t header;
nx_uint8_t data[];
} __attribute__((packed)) serial_packet_t;
# 49 "/opt/tinyos-2.x/tos/platforms/aquisgrain/platform_message.h"
#line 46
typedef union message_header {
cc2420_header_t cc2420;
serial_header_t serial;
} message_header_t;
#line 51
typedef union message_footer {
cc2420_footer_t cc2420;
} message_footer_t;
#line 55
typedef union message_metadata {
cc2420_metadata_t cc2420;
} message_metadata_t;
# 19 "/opt/tinyos-2.x/tos/types/message.h"
#line 14
typedef 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;
# 30 "/opt/tinyos-2.x/tos/types/Leds.h"
enum __nesc_unnamed4303 {
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
};
# 39 "/opt/tinyos-2.x/tos/chips/atm128/crc.h"
uint16_t crcTable[256] __attribute((__progmem__)) = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 };
static uint16_t crcByte(uint16_t oldCrc, uint8_t byte) __attribute((noinline)) ;
# 32 "/opt/tinyos-2.x/tos/chips/atm128/Atm128Uart.h"
typedef uint8_t Atm128_UDR0_t;
typedef uint8_t Atm128_UDR1_t;
#line 48
#line 36
typedef union __nesc_unnamed4304 {
struct Atm128_UCSRA_t {
uint8_t mpcm : 1;
uint8_t u2x : 1;
uint8_t upe : 1;
uint8_t dor : 1;
uint8_t fe : 1;
uint8_t udre : 1;
uint8_t txc : 1;
uint8_t rxc : 1;
} bits;
uint8_t flat;
} Atm128UartStatus_t;
typedef Atm128UartStatus_t Atm128_UCSR0A_t;
typedef Atm128UartStatus_t Atm128_UCSR1A_t;
#line 66
#line 54
typedef union __nesc_unnamed4305 {
struct Atm128_UCSRB_t {
uint8_t txb8 : 1;
uint8_t rxb8 : 1;
uint8_t ucsz2 : 1;
uint8_t txen : 1;
uint8_t rxen : 1;
uint8_t udrie : 1;
uint8_t txcie : 1;
uint8_t rxcie : 1;
} bits;
uint8_t flat;
} Atm128UartControl_t;
typedef Atm128UartControl_t Atm128_UCSR0B_t;
typedef Atm128UartControl_t Atm128_UCSR1B_t;
enum __nesc_unnamed4306 {
ATM128_UART_DATA_SIZE_5_BITS = 0,
ATM128_UART_DATA_SIZE_6_BITS = 1,
ATM128_UART_DATA_SIZE_7_BITS = 2,
ATM128_UART_DATA_SIZE_8_BITS = 3
};
#line 89
#line 79
typedef union __nesc_unnamed4307 {
uint8_t flat;
struct Atm128_UCSRC_t {
uint8_t ucpol : 1;
uint8_t ucsz : 2;
uint8_t usbs : 1;
uint8_t upm : 2;
uint8_t umsel : 1;
uint8_t rsvd : 1;
} bits;
} Atm128UartMode_t;
typedef Atm128UartMode_t Atm128_UCSR0C_t;
typedef Atm128UartMode_t Atm128_UCSR1C_t;
enum __nesc_unnamed4308 {
ATM128_19200_BAUD_4MHZ = 12,
ATM128_38400_BAUD_4MHZ = 6,
ATM128_57600_BAUD_4MHZ = 3,
ATM128_19200_BAUD_4MHZ_2X = 25,
ATM128_38400_BAUD_4MHZ_2X = 12,
ATM128_57600_BAUD_4MHZ_2X = 8,
ATM128_19200_BAUD_7MHZ = 23,
ATM128_38400_BAUD_7MHZ = 11,
ATM128_57600_BAUD_7MHZ = 7,
ATM128_19200_BAUD_7MHZ_2X = 47,
ATM128_38400_BAUD_7MHZ_2X = 23,
ATM128_57600_BAUD_7MHZ_2X = 15,
ATM128_19200_BAUD_8MHZ = 25,
ATM128_38400_BAUD_8MHZ = 12,
ATM128_57600_BAUD_8MHZ = 8,
ATM128_19200_BAUD_8MHZ_2X = 51,
ATM128_38400_BAUD_8MHZ_2X = 34,
ATM128_57600_BAUD_8MHZ_2X = 11
};
typedef uint8_t Atm128_UBRR0L_t;
typedef uint8_t Atm128_UBRR0H_t;
typedef uint8_t Atm128_UBRR1L_t;
typedef uint8_t Atm128_UBRR1H_t;
# 38 "/opt/tinyos-2.x/tos/chips/cc2420/IEEE802154.h"
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
};
enum iee154_fcf_addr_mode_enums {
IEEE154_ADDR_NONE = 0,
IEEE154_ADDR_SHORT = 2,
IEEE154_ADDR_EXT = 3
};
# 32 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.h"
enum __nesc_unnamed4309 {
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 40
typedef struct __nesc_unnamed4310 {
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 50
typedef union __nesc_unnamed4311 {
uint8_t flat;
Atm128SPIControl_s bits;
} Atm128SPIControl_t;
typedef Atm128SPIControl_t Atm128_SPCR_t;
#line 58
typedef struct __nesc_unnamed4312 {
uint8_t spif : 1;
uint8_t wcol : 1;
uint8_t rsvd : 5;
uint8_t spi2x : 1;
}
Atm128SPIStatus_s;
#line 65
typedef union __nesc_unnamed4313 {
uint8_t flat;
Atm128SPIStatus_s bits;
} Atm128SPIStatus_t;
typedef Atm128SPIStatus_t Atm128_SPSR_t;
typedef uint8_t Atm128_SPDR_t;
# 33 "/opt/tinyos-2.x/tos/types/Resource.h"
typedef uint8_t resource_client_id_t;
# 31 "/opt/tinyos-2.x/tos/lib/net/ctp/Collection.h"
enum __nesc_unnamed4314 {
AM_COLLECTION_DATA = 20,
AM_COLLECTION_CONTROL = 21,
AM_COLLECTION_DEBUG = 22
};
typedef uint8_t collection_id_t;
typedef nx_uint8_t nx_collection_id_t;
# 51 "/opt/tinyos-2.x/tos/lib/net/ctp/Ctp.h"
enum __nesc_unnamed4315 {
AM_CTP_DATA = 23,
AM_CTP_ROUTING = 24,
AM_CTP_DEBUG = 25,
CTP_OPT_PULL = 0x80,
CTP_OPT_ECN = 0x40
};
typedef nx_uint8_t nx_ctp_options_t;
typedef uint8_t ctp_options_t;
#line 65
typedef nx_struct __nesc_unnamed4316 {
nx_ctp_options_t options;
nx_uint8_t thl;
nx_uint16_t etx;
nx_am_addr_t origin;
nx_uint8_t originSeqNo;
nx_collection_id_t type;
nx_uint8_t data[0];
} __attribute__((packed)) ctp_data_header_t;
#line 75
typedef nx_struct __nesc_unnamed4317 {
nx_ctp_options_t options;
nx_am_addr_t parent;
nx_uint16_t etx;
nx_uint8_t data[0];
} __attribute__((packed)) ctp_routing_header_t;
# 60 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngine.h"
enum __nesc_unnamed4318 {
FORWARD_PACKET_TIME = 32
};
enum __nesc_unnamed4319 {
SENDDONE_FAIL_OFFSET = 512,
SENDDONE_NOACK_OFFSET = FORWARD_PACKET_TIME << 2,
SENDDONE_OK_OFFSET = FORWARD_PACKET_TIME << 2,
LOOPY_OFFSET = FORWARD_PACKET_TIME << 4,
SENDDONE_FAIL_WINDOW = SENDDONE_FAIL_OFFSET - 1,
LOOPY_WINDOW = LOOPY_OFFSET - 1,
SENDDONE_NOACK_WINDOW = SENDDONE_NOACK_OFFSET - 1,
SENDDONE_OK_WINDOW = SENDDONE_OK_OFFSET - 1,
CONGESTED_WAIT_OFFSET = FORWARD_PACKET_TIME << 2,
CONGESTED_WAIT_WINDOW = CONGESTED_WAIT_OFFSET - 1
};
enum __nesc_unnamed4320 {
MAX_RETRIES = 30
};
#line 103
#line 97
typedef nx_struct __nesc_unnamed4321 {
nx_uint8_t control;
nx_am_addr_t origin;
nx_uint8_t seqno;
nx_uint8_t collectid;
nx_uint16_t gradient;
} __attribute__((packed)) network_header_t;
#line 116
#line 112
typedef struct __nesc_unnamed4322 {
message_t *msg;
uint8_t client;
uint8_t retries;
} fe_queue_entry_t;
# 7 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpDebugMsg.h"
enum __nesc_unnamed4323 {
NET_C_DEBUG_STARTED = 0xDE,
NET_C_FE_MSG_POOL_EMPTY = 0x10,
NET_C_FE_SEND_QUEUE_FULL = 0x11,
NET_C_FE_NO_ROUTE = 0x12,
NET_C_FE_SUBSEND_OFF = 0x13,
NET_C_FE_SUBSEND_BUSY = 0x14,
NET_C_FE_BAD_SENDDONE = 0x15,
NET_C_FE_QENTRY_POOL_EMPTY = 0x16,
NET_C_FE_SUBSEND_SIZE = 0x17,
NET_C_FE_LOOP_DETECTED = 0x18,
NET_C_FE_SEND_BUSY = 0x19,
NET_C_FE_SENDQUEUE_EMPTY = 0x50,
NET_C_FE_PUT_MSGPOOL_ERR = 0x51,
NET_C_FE_PUT_QEPOOL_ERR = 0x52,
NET_C_FE_GET_MSGPOOL_ERR = 0x53,
NET_C_FE_GET_QEPOOL_ERR = 0x54,
NET_C_FE_QUEUE_SIZE = 0x55,
NET_C_FE_SENT_MSG = 0x20,
NET_C_FE_RCV_MSG = 0x21,
NET_C_FE_FWD_MSG = 0x22,
NET_C_FE_DST_MSG = 0x23,
NET_C_FE_SENDDONE_FAIL = 0x24,
NET_C_FE_SENDDONE_WAITACK = 0x25,
NET_C_FE_SENDDONE_FAIL_ACK_SEND = 0x26,
NET_C_FE_SENDDONE_FAIL_ACK_FWD = 0x27,
NET_C_FE_DUPLICATE_CACHE = 0x28,
NET_C_FE_DUPLICATE_QUEUE = 0x29,
NET_C_FE_DUPLICATE_CACHE_AT_SEND = 0x2A,
NET_C_FE_CONGESTION_SENDWAIT = 0x2B,
NET_C_FE_CONGESTION_BEGIN = 0x2C,
NET_C_FE_CONGESTION_END = 0x2D,
NET_C_FE_CONGESTED = 0x2E,
NET_C_TREE_NO_ROUTE = 0x30,
NET_C_TREE_NEW_PARENT = 0x31,
NET_C_TREE_ROUTE_INFO = 0x32,
NET_C_TREE_SENT_BEACON = 0x33,
NET_C_TREE_RCV_BEACON = 0x34,
NET_C_DBG_1 = 0x40,
NET_C_DBG_2 = 0x41,
NET_C_DBG_3 = 0x42
};
#line 79
#line 58
typedef nx_struct CollectionDebugMsg {
nx_uint8_t type;
nx_union __nesc_unnamed4324 {
nx_uint16_t arg;
nx_struct __nesc_unnamed4325 {
nx_uint16_t msg_uid;
nx_am_addr_t origin;
nx_am_addr_t other_node;
} __attribute__((packed)) msg;
nx_struct __nesc_unnamed4326 {
nx_am_addr_t parent;
nx_uint8_t hopcount;
nx_uint16_t metric;
} __attribute__((packed)) route_info;
nx_struct __nesc_unnamed4327 {
nx_uint16_t a;
nx_uint16_t b;
nx_uint16_t c;
} __attribute__((packed)) dbg;
} __attribute__((packed)) data;
nx_uint16_t seqno;
} __attribute__((packed)) CollectionDebugMsg;
# 38 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.h"
enum __nesc_unnamed4328 {
NUM_ENTRIES_FLAG = 15
};
#line 54
#line 51
typedef nx_struct linkest_header {
nx_uint8_t flags;
nx_uint8_t seq;
} __attribute__((packed)) linkest_header_t;
#line 59
typedef nx_struct neighbor_stat_entry {
nx_am_addr_t ll_addr;
nx_uint8_t inquality;
} __attribute__((packed)) neighbor_stat_entry_t;
#line 65
typedef nx_struct linkest_footer {
neighbor_stat_entry_t neighborList[1];
} __attribute__((packed)) linkest_footer_t;
enum __nesc_unnamed4329 {
VALID_ENTRY = 0x1,
MATURE_ENTRY = 0x2,
INIT_ENTRY = 0x4,
PINNED_ENTRY = 0x8
};
#line 118
#line 86
typedef struct neighbor_table_entry {
am_addr_t ll_addr;
uint8_t lastseq;
uint8_t rcvcnt;
uint8_t failcnt;
uint8_t flags;
uint8_t inage;
uint8_t outage;
uint8_t inquality;
uint8_t outquality;
uint16_t eetx;
uint8_t data_success;
uint8_t data_total;
} neighbor_table_entry_t;
# 4 "/opt/tinyos-2.x/tos/lib/net/ctp/TreeRouting.h"
enum __nesc_unnamed4330 {
AM_TREE_ROUTING_CONTROL = 0xCE,
BEACON_INTERVAL = 8192,
INVALID_ADDR = 0xFFFF,
ETX_THRESHOLD = 50,
PARENT_SWITCH_THRESHOLD = 15,
MAX_METRIC = 0xFFFF
};
#line 14
typedef struct __nesc_unnamed4331 {
am_addr_t parent;
uint16_t etx;
bool haveHeard;
bool congested;
} route_info_t;
#line 21
typedef struct __nesc_unnamed4332 {
am_addr_t neighbor;
route_info_t info;
} routing_table_entry;
static __inline void routeInfoInit(route_info_t *ri);
# 40 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngine.h"
enum __nesc_unnamed4333 {
AM_DISSEMINATION_MESSAGE = 13,
AM_DISSEMINATION_PROBE_MESSAGE = 14,
DISSEMINATION_SEQNO_UNKNOWN = 0
};
#line 46
typedef nx_struct dissemination_message {
nx_uint16_t key;
nx_uint32_t seqno;
nx_uint8_t data[0];
} __attribute__((packed)) dissemination_message_t;
#line 52
typedef nx_struct dissemination_probe_message {
nx_uint16_t key;
} __attribute__((packed)) dissemination_probe_message_t;
typedef uint16_t OctopusC$Read$val_t;
typedef octopus_sent_msg_t OctopusC$RequestUpdate$t;
typedef octopus_sent_msg_t OctopusC$RequestValue$t;
typedef TMilli OctopusC$Timer$precision_tag;
enum HilTimerMilliC$__nesc_unnamed4334 {
HilTimerMilliC$TIMER_COUNT = 8U
};
typedef TMilli /*AlarmCounterMilliP.Atm128AlarmAsyncC*/Atm128AlarmAsyncC$0$precision;
typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC*/Atm128AlarmAsyncC$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$precision;
typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$precision_tag;
typedef uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$size_type;
typedef /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$precision /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$precision_tag;
typedef uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$size_type;
typedef uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$size_type;
typedef uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$timer_size;
typedef uint8_t HplAtm128Timer0AsyncP$Compare$size_type;
typedef uint8_t HplAtm128Timer0AsyncP$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*/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 uint16_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$val_t;
typedef uint16_t RandomMlcgP$SeedInit$parameter;
typedef TMicro /*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$precision_tag;
typedef uint32_t /*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$size_type;
typedef uint16_t HplAtm128Timer3P$CompareA$size_type;
typedef uint16_t HplAtm128Timer3P$Capture$size_type;
typedef uint16_t HplAtm128Timer3P$CompareB$size_type;
typedef uint16_t HplAtm128Timer3P$CompareC$size_type;
typedef uint16_t HplAtm128Timer3P$Timer$timer_size;
typedef uint16_t /*InitThreeP.InitThree*/Atm128TimerInitC$0$timer_size;
typedef /*InitThreeP.InitThree*/Atm128TimerInitC$0$timer_size /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$timer_size;
typedef TThree /*CounterThree16C.NCounter*/Atm128CounterC$0$frequency_tag;
typedef uint16_t /*CounterThree16C.NCounter*/Atm128CounterC$0$timer_size;
typedef /*CounterThree16C.NCounter*/Atm128CounterC$0$frequency_tag /*CounterThree16C.NCounter*/Atm128CounterC$0$Counter$precision_tag;
typedef /*CounterThree16C.NCounter*/Atm128CounterC$0$timer_size /*CounterThree16C.NCounter*/Atm128CounterC$0$Counter$size_type;
typedef /*CounterThree16C.NCounter*/Atm128CounterC$0$timer_size /*CounterThree16C.NCounter*/Atm128CounterC$0$Timer$timer_size;
typedef TMicro /*CounterMicro32C.Transform32*/TransformCounterC$0$to_precision_tag;
typedef uint32_t /*CounterMicro32C.Transform32*/TransformCounterC$0$to_size_type;
typedef TThree /*CounterMicro32C.Transform32*/TransformCounterC$0$from_precision_tag;
typedef uint16_t /*CounterMicro32C.Transform32*/TransformCounterC$0$from_size_type;
typedef counter_three_overflow_t /*CounterMicro32C.Transform32*/TransformCounterC$0$upper_count_type;
typedef /*CounterMicro32C.Transform32*/TransformCounterC$0$from_precision_tag /*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$precision_tag;
typedef /*CounterMicro32C.Transform32*/TransformCounterC$0$from_size_type /*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$size_type;
typedef /*CounterMicro32C.Transform32*/TransformCounterC$0$to_precision_tag /*CounterMicro32C.Transform32*/TransformCounterC$0$Counter$precision_tag;
typedef /*CounterMicro32C.Transform32*/TransformCounterC$0$to_size_type /*CounterMicro32C.Transform32*/TransformCounterC$0$Counter$size_type;
enum SerialAMQueueP$__nesc_unnamed4335 {
SerialAMQueueP$NUM_CLIENTS = 1U
};
typedef T32khz CC2420ControlP$StartupTimer$precision_tag;
typedef uint32_t CC2420ControlP$StartupTimer$size_type;
typedef uint16_t CC2420ControlP$ReadRssi$val_t;
typedef uint16_t HplAtm128Timer1P$CompareA$size_type;
typedef uint16_t HplAtm128Timer1P$Capture$size_type;
typedef uint16_t HplAtm128Timer1P$CompareB$size_type;
typedef uint16_t HplAtm128Timer1P$CompareC$size_type;
typedef uint16_t HplAtm128Timer1P$Timer$timer_size;
typedef TOne /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$frequency_tag;
typedef uint16_t /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$frequency_tag /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$precision_tag;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$size_type;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size;
enum /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16*/AlarmOne16C$0$__nesc_unnamed4336 {
AlarmOne16C$0$COMPARE_ID = 0U
};
typedef uint16_t /*InitOneP.InitOne*/Atm128TimerInitC$1$timer_size;
typedef /*InitOneP.InitOne*/Atm128TimerInitC$1$timer_size /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$timer_size;
typedef TOne /*CounterOne16C.NCounter*/Atm128CounterC$1$frequency_tag;
typedef uint16_t /*CounterOne16C.NCounter*/Atm128CounterC$1$timer_size;
typedef /*CounterOne16C.NCounter*/Atm128CounterC$1$frequency_tag /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$precision_tag;
typedef /*CounterOne16C.NCounter*/Atm128CounterC$1$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$size_type;
typedef /*CounterOne16C.NCounter*/Atm128CounterC$1$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$timer_size;
typedef T32khz /*Counter32khz32C.Transform32*/TransformCounterC$1$to_precision_tag;
typedef uint32_t /*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type;
typedef T32khz /*Counter32khz32C.Transform32*/TransformCounterC$1$from_precision_tag;
typedef uint16_t /*Counter32khz32C.Transform32*/TransformCounterC$1$from_size_type;
typedef counter_one_overflow_t /*Counter32khz32C.Transform32*/TransformCounterC$1$upper_count_type;
typedef /*Counter32khz32C.Transform32*/TransformCounterC$1$from_precision_tag /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$precision_tag;
typedef /*Counter32khz32C.Transform32*/TransformCounterC$1$from_size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$size_type;
typedef /*Counter32khz32C.Transform32*/TransformCounterC$1$to_precision_tag /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$precision_tag;
typedef /*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$size_type;
typedef T32khz /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_precision_tag;
typedef uint32_t /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type;
typedef TOne /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_precision_tag;
typedef uint16_t /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_size_type;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_precision_tag /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$precision_tag;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$size_type;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_precision_tag /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$precision_tag;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$size_type;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_precision_tag /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$precision_tag;
typedef /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$size_type;
typedef uint16_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$size_type;
typedef TMilli HplCC2420InterruptsP$CCATimer$precision_tag;
enum /*CC2420ControlC.Spi*/CC2420SpiC$0$__nesc_unnamed4337 {
CC2420SpiC$0$CLIENT_ID = 0U
};
enum /*CC2420ControlC.SyncSpiC*/CC2420SpiC$1$__nesc_unnamed4338 {
CC2420SpiC$1$CLIENT_ID = 1U
};
enum /*CC2420ControlC.RssiResource*/CC2420SpiC$2$__nesc_unnamed4339 {
CC2420SpiC$2$CLIENT_ID = 2U
};
typedef T32khz CC2420TransmitP$BackoffTimer$precision_tag;
typedef uint32_t CC2420TransmitP$BackoffTimer$size_type;
typedef TMilli CC2420TransmitP$LplDisableTimer$precision_tag;
enum /*CC2420TransmitC.Spi*/CC2420SpiC$3$__nesc_unnamed4340 {
CC2420SpiC$3$CLIENT_ID = 3U
};
enum /*CC2420ReceiveC.Spi*/CC2420SpiC$4$__nesc_unnamed4341 {
CC2420SpiC$4$CLIENT_ID = 4U
};
enum CtpP$__nesc_unnamed4342 {
CtpP$CLIENT_COUNT = 1U, CtpP$FORWARD_COUNT = 12, CtpP$TREE_ROUTING_TABLE_SIZE = 10, CtpP$QUEUE_SIZE = CtpP$CLIENT_COUNT + CtpP$FORWARD_COUNT, CtpP$CACHE_SIZE = 4
};
typedef message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$t;
typedef TMilli /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$precision_tag;
typedef TMilli /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$precision_tag;
typedef fe_queue_entry_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t;
typedef fe_queue_entry_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$t;
typedef message_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$t;
typedef message_t /*CtpP.MessagePoolP*/PoolC$0$pool_t;
typedef /*CtpP.MessagePoolP*/PoolC$0$pool_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t;
typedef /*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$t;
typedef fe_queue_entry_t /*CtpP.QEntryPoolP*/PoolC$1$pool_t;
typedef /*CtpP.QEntryPoolP*/PoolC$1$pool_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t;
typedef /*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$t;
typedef fe_queue_entry_t */*CtpP.SendQueueP*/QueueC$0$queue_t;
typedef /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$t;
typedef message_t */*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$t;
enum AMQueueP$__nesc_unnamed4343 {
AMQueueP$NUM_CLIENTS = 4U
};
typedef TMilli /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$precision_tag;
typedef TMilli /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$precision_tag;
typedef octopus_sent_msg_t /*OctopusAppC.DisseminatorC*/DisseminatorC$0$t;
enum /*OctopusAppC.DisseminatorC*/DisseminatorC$0$__nesc_unnamed4344 {
DisseminatorC$0$TIMER_ID = 0U
};
typedef /*OctopusAppC.DisseminatorC*/DisseminatorC$0$t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t;
typedef /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$t;
typedef /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$t;
typedef TMilli /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$precision_tag;
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t PlatformP$Init$init(void);
#line 51
static error_t MeasureClockC$Init$init(void);
# 60 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128Calibrate.nc"
static uint16_t MeasureClockC$Atm128Calibrate$baudrateRegister(uint32_t arg_0x7ef53898);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t MotePlatformP$PlatformInit$init(void);
# 31 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$toggle(void);
static void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput(void);
#line 29
static 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$toggle(void);
static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput(void);
#line 29
static 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 29
static 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);
#line 30
static void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr(void);
static void /*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput(void);
#line 29
static 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 35
static void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void);
#line 33
static void /*HplAtm128GeneralIOC.PortB.Bit3*/HplAtm128GeneralIOPinP$11$IO$makeInput(void);
static void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$makeOutput(void);
#line 29
static void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$set(void);
static void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput(void);
#line 32
static bool /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$get(void);
static void /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$makeInput(void);
#line 32
static bool /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$get(void);
static void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$makeOutput(void);
#line 29
static void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$set(void);
static void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$clr(void);
static bool /*HplAtm128GeneralIOC.PortE.Bit4*/HplAtm128GeneralIOPinP$36$IO$get(void);
#line 32
static bool /*HplAtm128GeneralIOC.PortE.Bit5*/HplAtm128GeneralIOPinP$37$IO$get(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t SchedulerBasicP$TaskBasic$postTask(
# 45 "/opt/tinyos-2.x/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x7f080b18);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SchedulerBasicP$TaskBasic$default$runTask(
# 45 "/opt/tinyos-2.x/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x7f080b18);
# 46 "/opt/tinyos-2.x/tos/interfaces/Scheduler.nc"
static void SchedulerBasicP$Scheduler$init(void);
#line 61
static void SchedulerBasicP$Scheduler$taskLoop(void);
#line 54
static bool SchedulerBasicP$Scheduler$runNextTask(void);
# 59 "/opt/tinyos-2.x/tos/interfaces/McuSleep.nc"
static void McuSleepC$McuSleep$sleep(void);
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
static void McuSleepC$McuPowerState$update(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void OctopusC$CollectSend$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 49 "/opt/tinyos-2.x/tos/interfaces/Boot.nc"
static void OctopusC$Boot$booted(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void OctopusC$SerialControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void OctopusC$SerialControl$stopDone(error_t arg_0x7ebf06e8);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *OctopusC$Snoop$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void OctopusC$RadioControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void OctopusC$RadioControl$stopDone(error_t arg_0x7ebf06e8);
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static void OctopusC$Read$readDone(error_t arg_0x7eaf5668, OctopusC$Read$val_t arg_0x7eaf57f0);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void OctopusC$SerialSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *OctopusC$SerialReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void OctopusC$serialSendTask$runTask(void);
#line 64
static void OctopusC$collectSendTask$runTask(void);
# 61 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
static void OctopusC$RequestValue$changed(void);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void OctopusC$Timer$fired(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *OctopusC$CollectReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t LedsP$Init$init(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
static void LedsP$Leds$led0Toggle(void);
static void LedsP$Leds$led1On(void);
static void LedsP$Leds$led1Toggle(void);
#line 89
static void LedsP$Leds$led2Toggle(void);
#line 45
static void LedsP$Leds$led0On(void);
#line 78
static void LedsP$Leds$led2On(void);
# 98 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$size_type /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getNow(void);
#line 92
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$startAt(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$size_type arg_0x7e9d39e0, /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$size_type arg_0x7e9d3b70);
#line 105
static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$size_type /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getAlarm(void);
#line 62
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$stop(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Init$init(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$size_type /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$get(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$overflow(void);
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
static Atm128_TIFR_t HplAtm128Timer0AsyncP$TimerCtrl$getInterruptFlag(void);
#line 37
static void HplAtm128Timer0AsyncP$TimerCtrl$setControl(Atm128TimerControl_t arg_0x7e986ce8);
# 54 "/opt/tinyos-2.x/tos/interfaces/McuPowerOverride.nc"
static mcu_power_t HplAtm128Timer0AsyncP$McuPowerOverride$lowestState(void);
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerAsync.nc"
static int HplAtm128Timer0AsyncP$TimerAsync$compareBusy(void);
#line 32
static void HplAtm128Timer0AsyncP$TimerAsync$setTimer0Asynchronous(void);
# 39 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static HplAtm128Timer0AsyncP$Compare$size_type HplAtm128Timer0AsyncP$Compare$get(void);
static void HplAtm128Timer0AsyncP$Compare$set(HplAtm128Timer0AsyncP$Compare$size_type arg_0x7e981c38);
static void HplAtm128Timer0AsyncP$Compare$start(void);
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static HplAtm128Timer0AsyncP$Timer$timer_size HplAtm128Timer0AsyncP$Timer$get(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask(void);
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$fired(void);
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$getNow(void);
#line 118
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(uint32_t arg_0x7eb05010, uint32_t arg_0x7eb051a0);
#line 67
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$stop(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask(void);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$fired(void);
#line 125
static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getNow(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 140 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getdt(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 133 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$gett0(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 81 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static bool /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$isRunning(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8,
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
uint32_t arg_0x7eb13ce0);
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8,
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
uint32_t arg_0x7eb11338);
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$runTask(void);
# 55 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static error_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$read(void);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t RandomMlcgP$Random$rand16(void);
#line 35
static uint32_t RandomMlcgP$Random$rand32(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t RandomMlcgP$Init$init(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$send(
# 36 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
am_id_t arg_0x7e7a9030,
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$getPayload(
# 36 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
am_id_t arg_0x7e7a9030,
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb20600);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 83
static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$default$receive(
# 37 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
am_id_t arg_0x7e7a9960,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 67 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$destination(message_t *arg_0x7e7c1cd8);
#line 92
static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 136
static am_id_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(message_t *arg_0x7e7b7258);
#line 151
static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
# 83 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static error_t SerialP$SplitControl$start(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SerialP$stopDoneTask$runTask(void);
#line 64
static void SerialP$RunTx$runTask(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t SerialP$Init$init(void);
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialFlush.nc"
static void SerialP$SerialFlush$flushDone(void);
#line 38
static void SerialP$SerialFlush$default$flush(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SerialP$startDoneTask$runTask(void);
# 83 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
static void SerialP$SerialFrameComm$dataReceived(uint8_t arg_0x7e719010);
static void SerialP$SerialFrameComm$putDone(void);
#line 74
static void SerialP$SerialFrameComm$delimiterReceived(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SerialP$defaultSerialFlushTask$runTask(void);
# 60 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
static error_t SerialP$SendBytePacket$completeSend(void);
#line 51
static error_t SerialP$SendBytePacket$startSend(uint8_t arg_0x7e729780);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$runTask(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$send(
# 40 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e6923e0,
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 89
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$default$sendDone(
# 40 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e6923e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$runTask(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$default$receive(
# 39 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e693b98,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$upperLength(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98,
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
message_t *arg_0x7e755808, uint8_t arg_0x7e755998);
#line 15
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$offset(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98);
# 23 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$dataLinkLength(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98,
# 23 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
message_t *arg_0x7e755010, uint8_t arg_0x7e7551a0);
# 70 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$nextByte(void);
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$sendCompleted(error_t arg_0x7e728818);
# 51 "/opt/tinyos-2.x/tos/lib/serial/ReceiveBytePacket.nc"
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$startPacket(void);
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$byteReceived(uint8_t arg_0x7e725838);
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$endPacket(error_t arg_0x7e725e08);
# 79 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
static void HdlcTranslateC$UartStream$receivedByte(uint8_t arg_0x7e635010);
#line 99
static void HdlcTranslateC$UartStream$receiveDone(uint8_t *arg_0x7e635ce0, uint16_t arg_0x7e635e70, error_t arg_0x7e633010);
#line 57
static void HdlcTranslateC$UartStream$sendDone(uint8_t *arg_0x7e637f00, uint16_t arg_0x7e6360b0, error_t arg_0x7e636238);
# 45 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
static error_t HdlcTranslateC$SerialFrameComm$putDelimiter(void);
#line 68
static void HdlcTranslateC$SerialFrameComm$resetReceive(void);
#line 54
static error_t HdlcTranslateC$SerialFrameComm$putData(uint8_t arg_0x7e721d40);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$Init$init(void);
# 48 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$send(uint8_t *arg_0x7e637768, uint16_t arg_0x7e6378f8);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$overflow(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$rxDone(uint8_t arg_0x7e603b30);
#line 47
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$txDone(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$start(void);
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$stop(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t HplAtm128UartP$Uart0Init$init(void);
# 46 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
static void HplAtm128UartP$HplUart0$tx(uint8_t arg_0x7e603068);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t HplAtm128UartP$Uart1Init$init(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
static void HplAtm128UartP$HplUart1$default$rxDone(uint8_t arg_0x7e603b30);
#line 47
static void HplAtm128UartP$HplUart1$default$txDone(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t HplAtm128UartP$Uart0RxControl$start(void);
static error_t HplAtm128UartP$Uart0RxControl$stop(void);
#line 74
static error_t HplAtm128UartP$Uart0TxControl$start(void);
static error_t HplAtm128UartP$Uart0TxControl$stop(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl16.nc"
static void HplAtm128Timer3P$TimerCtrl$setCtrlCapture(Atm128TimerCtrlCapture_t arg_0x7e5653f0);
#line 37
static Atm128TimerCtrlCapture_t HplAtm128Timer3P$TimerCtrl$getCtrlCapture(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer3P$CompareA$default$fired(void);
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void HplAtm128Timer3P$Capture$default$captured(HplAtm128Timer3P$Capture$size_type arg_0x7e55c120);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer3P$CompareB$default$fired(void);
#line 49
static void HplAtm128Timer3P$CompareC$default$fired(void);
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static HplAtm128Timer3P$Timer$timer_size HplAtm128Timer3P$Timer$get(void);
#line 95
static void HplAtm128Timer3P$Timer$setScale(uint8_t arg_0x7e9930f8);
#line 58
static void HplAtm128Timer3P$Timer$set(HplAtm128Timer3P$Timer$timer_size arg_0x7e9953c0);
static void HplAtm128Timer3P$Timer$start(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*InitThreeP.InitThree*/Atm128TimerInitC$0$Init$init(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$overflow(void);
#line 61
static void /*CounterThree16C.NCounter*/Atm128CounterC$0$Timer$overflow(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$overflow(void);
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
static uint8_t SerialPacketInfoActiveMessageP$Info$upperLength(message_t *arg_0x7e755808, uint8_t arg_0x7e755998);
#line 15
static uint8_t SerialPacketInfoActiveMessageP$Info$offset(void);
static uint8_t SerialPacketInfoActiveMessageP$Info$dataLinkLength(message_t *arg_0x7e755010, uint8_t arg_0x7e7551a0);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$getPayload(message_t *arg_0x7eb20600);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void */*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$getPayload(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54c58);
#line 89
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void);
#line 64
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void CC2420ActiveMessageP$SubSend$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ActiveMessageP$SubReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t CC2420ActiveMessageP$AMSend$send(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437398,
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void *CC2420ActiveMessageP$AMSend$getPayload(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437398,
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb20600);
#line 112
static uint8_t CC2420ActiveMessageP$AMSend$maxPayloadLength(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437398);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ActiveMessageP$Snoop$default$receive(
# 41 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e4354e0,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t CC2420ActiveMessageP$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void *CC2420ActiveMessageP$Packet$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 95
static uint8_t CC2420ActiveMessageP$Packet$maxPayloadLength(void);
#line 83
static void CC2420ActiveMessageP$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ActiveMessageP$Receive$default$receive(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437cc8,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t CC2420ActiveMessageP$AMPacket$source(message_t *arg_0x7e7c0360);
#line 57
static am_addr_t CC2420ActiveMessageP$AMPacket$address(void);
static am_addr_t CC2420ActiveMessageP$AMPacket$destination(message_t *arg_0x7e7c1cd8);
#line 92
static void CC2420ActiveMessageP$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 136
static am_id_t CC2420ActiveMessageP$AMPacket$type(message_t *arg_0x7e7b7258);
#line 151
static void CC2420ActiveMessageP$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
#line 125
static bool CC2420ActiveMessageP$AMPacket$isForMe(message_t *arg_0x7e7b9b10);
# 83 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static error_t CC2420CsmaP$SplitControl$start(void);
# 94 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
static void CC2420CsmaP$RadioBackoff$default$requestCca(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 94 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e441268);
#line 72
static void CC2420CsmaP$RadioBackoff$default$requestInitialBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 72 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e4420a8);
static void CC2420CsmaP$RadioBackoff$default$requestCongestionBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 79 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e442660);
static void CC2420CsmaP$RadioBackoff$default$requestLplBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 87 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e442c18);
#line 72
static void CC2420CsmaP$SubBackoff$requestInitialBackoff(message_t *arg_0x7e4420a8);
static void CC2420CsmaP$SubBackoff$requestCongestionBackoff(message_t *arg_0x7e442660);
static void CC2420CsmaP$SubBackoff$requestLplBackoff(message_t *arg_0x7e442c18);
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
static void CC2420CsmaP$CC2420Transmit$sendDone(message_t *arg_0x7e35dd90, error_t arg_0x7e35df18);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t CC2420CsmaP$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t CC2420CsmaP$Init$init(void);
# 76 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
static void CC2420CsmaP$CC2420Power$startOscillatorDone(void);
#line 56
static void CC2420CsmaP$CC2420Power$startVRegDone(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420CsmaP$Resource$granted(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void CC2420CsmaP$sendDone_task$runTask(void);
#line 64
static void CC2420CsmaP$stopDone_task$runTask(void);
#line 64
static void CC2420CsmaP$startDone_task$runTask(void);
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Config.nc"
static void CC2420ControlP$CC2420Config$default$syncDone(error_t arg_0x7e326b98);
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void CC2420ControlP$StartupTimer$fired(void);
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static void CC2420ControlP$ReadRssi$default$readDone(error_t arg_0x7eaf5668, CC2420ControlP$ReadRssi$val_t arg_0x7eaf57f0);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t CC2420ControlP$Init$init(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420ControlP$SpiResource$granted(void);
#line 92
static void CC2420ControlP$SyncResource$granted(void);
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
static error_t CC2420ControlP$CC2420Power$startOscillator(void);
#line 90
static error_t CC2420ControlP$CC2420Power$rxOn(void);
#line 51
static error_t CC2420ControlP$CC2420Power$startVReg(void);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420ControlP$Resource$release(void);
#line 78
static error_t CC2420ControlP$Resource$request(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void CC2420ControlP$syncDone_task$runTask(void);
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static void CC2420ControlP$InterruptCCA$fired(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420ControlP$RssiResource$granted(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl16.nc"
static void HplAtm128Timer1P$TimerCtrl$setCtrlCapture(Atm128TimerCtrlCapture_t arg_0x7e5653f0);
#line 37
static Atm128TimerCtrlCapture_t HplAtm128Timer1P$TimerCtrl$getCtrlCapture(void);
# 53 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer1P$CompareA$reset(void);
#line 45
static void HplAtm128Timer1P$CompareA$set(HplAtm128Timer1P$CompareA$size_type arg_0x7e981c38);
static void HplAtm128Timer1P$CompareA$start(void);
static void HplAtm128Timer1P$CompareA$stop(void);
# 79 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void HplAtm128Timer1P$Capture$setEdge(bool arg_0x7e55b710);
#line 55
static void HplAtm128Timer1P$Capture$reset(void);
static void HplAtm128Timer1P$Capture$start(void);
static void HplAtm128Timer1P$Capture$stop(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer1P$CompareB$default$fired(void);
#line 49
static void HplAtm128Timer1P$CompareC$default$fired(void);
# 78 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static bool HplAtm128Timer1P$Timer$test(void);
#line 52
static HplAtm128Timer1P$Timer$timer_size HplAtm128Timer1P$Timer$get(void);
#line 95
static void HplAtm128Timer1P$Timer$setScale(uint8_t arg_0x7e9930f8);
#line 58
static void HplAtm128Timer1P$Timer$set(HplAtm128Timer1P$Timer$timer_size arg_0x7e9953c0);
static void HplAtm128Timer1P$Timer$start(void);
# 92 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$size_type arg_0x7e9d39e0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$size_type arg_0x7e9d3b70);
#line 62
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$stop(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*InitOneP.InitOne*/Atm128TimerInitC$1$Init$init(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$overflow(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$size_type /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$get(void);
static bool /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$isOverflowPending(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$overflow(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$overflow(void);
#line 53
static /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$get(void);
# 98 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$getNow(void);
#line 92
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$size_type arg_0x7e9d39e0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$size_type arg_0x7e9d3b70);
#line 55
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$start(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$size_type arg_0x7e9d48c8);
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$stop(void);
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$fired(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$overflow(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t NoInitC$Init$init(void);
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
static error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureFallingEdge(void);
#line 42
static error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureRisingEdge(void);
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$captured(/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$size_type arg_0x7e55c120);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$fired(void);
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static error_t /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$enableFallingEdge(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$IrqSignal$fired(void);
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$clear(void);
#line 40
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$disable(void);
#line 59
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$edge(bool arg_0x7e0f14c8);
#line 35
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$enable(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$default$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$IrqSignal$fired(void);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void HplCC2420InterruptsP$CCATimer$fired(void);
# 49 "/opt/tinyos-2.x/tos/interfaces/Boot.nc"
static void HplCC2420InterruptsP$Boot$booted(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void HplCC2420InterruptsP$stopTask$runTask(void);
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static error_t HplCC2420InterruptsP$CCA$disable(void);
#line 42
static error_t HplCC2420InterruptsP$CCA$enableRisingEdge(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void HplCC2420InterruptsP$CCATask$runTask(void);
# 71 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
static void CC2420SpiImplP$SpiPacket$sendDone(uint8_t *arg_0x7e014290, uint8_t *arg_0x7e014438, uint16_t arg_0x7e0145c8,
error_t arg_0x7e014760);
# 62 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static error_t CC2420SpiImplP$Fifo$continueRead(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 62 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e039bf0, uint8_t arg_0x7e039d78);
#line 91
static void CC2420SpiImplP$Fifo$default$writeDone(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e0364c8, uint8_t arg_0x7e036650, error_t arg_0x7e0367d8);
#line 82
static cc2420_status_t CC2420SpiImplP$Fifo$write(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e038cc8, uint8_t arg_0x7e038e50);
#line 51
static cc2420_status_t CC2420SpiImplP$Fifo$beginRead(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 51 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e039458, uint8_t arg_0x7e0395e0);
#line 71
static void CC2420SpiImplP$Fifo$default$readDone(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e0383f0, uint8_t arg_0x7e038578, error_t arg_0x7e038700);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420SpiImplP$SpiResource$granted(void);
# 63 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Ram.nc"
static cc2420_status_t CC2420SpiImplP$Ram$write(
# 41 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint16_t arg_0x7e01e9f0,
# 63 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Ram.nc"
uint8_t arg_0x7e30f388, uint8_t *arg_0x7e30f530, uint8_t arg_0x7e30f6b8);
# 47 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420SpiImplP$Reg$read(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01d0f8,
# 47 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
uint16_t *arg_0x7e30c4a0);
static cc2420_status_t CC2420SpiImplP$Reg$write(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01d0f8,
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
uint16_t arg_0x7e30ca10);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420SpiImplP$Resource$release(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01f6b8);
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420SpiImplP$Resource$immediateRequest(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01f6b8);
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420SpiImplP$Resource$request(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01f6b8);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420SpiImplP$Resource$default$granted(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01f6b8);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420SpiImplP$Strobe$strobe(
# 43 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01d7d8);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void Atm128SpiP$zeroTask$runTask(void);
# 59 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
static error_t Atm128SpiP$SpiPacket$send(uint8_t *arg_0x7e0157f0, uint8_t *arg_0x7e015998, uint16_t arg_0x7e015b28);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void Atm128SpiP$ResourceArbiter$granted(
# 84 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfb9bf0);
# 34 "/opt/tinyos-2.x/tos/interfaces/SpiByte.nc"
static uint8_t Atm128SpiP$SpiByte$write(uint8_t arg_0x7e018088);
# 92 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
static void Atm128SpiP$Spi$dataReady(uint8_t arg_0x7dfb2858);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$Resource$release(
# 80 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfbca68);
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$Resource$immediateRequest(
# 80 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfbca68);
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$Resource$request(
# 80 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfbca68);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void Atm128SpiP$Resource$default$granted(
# 80 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfbca68);
# 72 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
static void HplAtm128SpiP$SPI$sleep(void);
#line 66
static void HplAtm128SpiP$SPI$initMaster(void);
#line 105
static void HplAtm128SpiP$SPI$setMasterBit(bool arg_0x7dfa3548);
#line 96
static void HplAtm128SpiP$SPI$enableInterrupt(bool arg_0x7dfb2da0);
#line 80
static uint8_t HplAtm128SpiP$SPI$read(void);
#line 125
static void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool arg_0x7dfa0ee0);
#line 114
static void HplAtm128SpiP$SPI$setClock(uint8_t arg_0x7dfa2d70);
#line 108
static void HplAtm128SpiP$SPI$setClockPolarity(bool arg_0x7dfa3da0);
#line 86
static void HplAtm128SpiP$SPI$write(uint8_t arg_0x7dfb2348);
#line 99
static void HplAtm128SpiP$SPI$enableSpi(bool arg_0x7dfb1598);
#line 111
static void HplAtm128SpiP$SPI$setClockPhase(bool arg_0x7dfa25a8);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/ResourceQueue.nc"
static error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(resource_client_id_t arg_0x7def8010);
#line 43
static bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEmpty(void);
static bool /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$isEnqueued(resource_client_id_t arg_0x7defa5e0);
static resource_client_id_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$dequeue(void);
# 43 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(
# 52 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee23e8);
# 51 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(
# 52 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee23e8);
# 55 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(
# 56 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee2ed0);
# 49 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(
# 56 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee2ed0);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(
# 51 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee3a00);
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(
# 51 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee3a00);
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(
# 51 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee3a00);
# 80 "/opt/tinyos-2.x/tos/interfaces/ArbiterInfo.nc"
static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask(void);
# 56 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
static void CC2420TransmitP$RadioBackoff$setLplBackoff(uint16_t arg_0x7e444590);
#line 49
static void CC2420TransmitP$RadioBackoff$setCongestionBackoff(uint16_t arg_0x7e444010);
#line 43
static void CC2420TransmitP$RadioBackoff$setInitialBackoff(uint16_t arg_0x7e4459b0);
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
static void CC2420TransmitP$CaptureSFD$captured(uint16_t arg_0x7e124ab8);
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void CC2420TransmitP$BackoffTimer$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
static void CC2420TransmitP$CC2420Receive$receive(uint8_t arg_0x7de51408, message_t *arg_0x7de515b8);
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
static error_t CC2420TransmitP$Send$send(message_t *arg_0x7e364d08, bool arg_0x7e364e90);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t CC2420TransmitP$Init$init(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void CC2420TransmitP$startLplTimer$runTask(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420TransmitP$SpiResource$granted(void);
# 39 "/opt/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc"
static void CC2420TransmitP$TimeStamp$default$transmittedSFD(uint16_t arg_0x7de73460, message_t *arg_0x7de73610);
static void CC2420TransmitP$TimeStamp$default$receivedSFD(uint16_t arg_0x7de73b40);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t CC2420TransmitP$StdControl$start(void);
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static void CC2420TransmitP$TXFIFO$writeDone(uint8_t *arg_0x7e0364c8, uint8_t arg_0x7e036650, error_t arg_0x7e0367d8);
#line 71
static void CC2420TransmitP$TXFIFO$readDone(uint8_t *arg_0x7e0383f0, uint8_t arg_0x7e038578, error_t arg_0x7e038700);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void CC2420TransmitP$LplDisableTimer$fired(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void CC2420ReceiveP$receiveDone_task$runTask(void);
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
static void CC2420ReceiveP$CC2420Receive$sfd_dropped(void);
#line 47
static void CC2420ReceiveP$CC2420Receive$sfd(uint16_t arg_0x7de52aa8);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t CC2420ReceiveP$Init$init(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420ReceiveP$SpiResource$granted(void);
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static void CC2420ReceiveP$RXFIFO$writeDone(uint8_t *arg_0x7e0364c8, uint8_t arg_0x7e036650, error_t arg_0x7e0367d8);
#line 71
static void CC2420ReceiveP$RXFIFO$readDone(uint8_t *arg_0x7e0383f0, uint8_t arg_0x7e038578, error_t arg_0x7e038700);
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static void CC2420ReceiveP$InterruptFIFOP$fired(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t CC2420ReceiveP$StdControl$start(void);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *CC2420PacketC$CC2420Packet$getHeader(message_t *arg_0x7e448670);
static cc2420_metadata_t *CC2420PacketC$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0);
# 48 "/opt/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc"
static error_t CC2420PacketC$Acks$requestAck(message_t *arg_0x7e7b46d8);
#line 74
static bool CC2420PacketC$Acks$wasAcked(message_t *arg_0x7e7b3568);
# 42 "/opt/tinyos-2.x/tos/system/ActiveMessageAddressC.nc"
static am_addr_t ActiveMessageAddressC$amAddress(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void UniqueSendP$SubSend$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
#line 64
static error_t UniqueSendP$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t UniqueSendP$Init$init(void);
#line 51
static error_t StateImplP$Init$init(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/State.nc"
static void StateImplP$State: Exp $toIdle(
# 67 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
uint8_t arg_0x7dd1b010);
# 45 "/opt/tinyos-2.x/tos/interfaces/State.nc"
static error_t StateImplP$State: Exp $requestState(
# 67 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
uint8_t arg_0x7dd1b010,
# 45 "/opt/tinyos-2.x/tos/interfaces/State.nc"
uint8_t arg_0x7dd3b6f0);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *UniqueReceiveP$SubReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t UniqueReceiveP$Init$init(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *UniqueReceiveP$DuplicateReceive$default$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 76 "/opt/tinyos-2.x/tos/interfaces/LowPowerListening.nc"
static void CC2420LplDummyP$LowPowerListening$setLocalDutyCycle(uint16_t arg_0x7eb90890);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$SubReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 50 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEvent(uint8_t arg_0x7dc74e50);
#line 62
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEventMsg(uint8_t arg_0x7dc67338, uint16_t arg_0x7dc674c8, am_addr_t arg_0x7dc67658, am_addr_t arg_0x7dc677e8);
# 43 "/opt/tinyos-2.x/tos/lib/net/CollectionPacket.nc"
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(message_t *arg_0x7dc97920);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(message_t *arg_0x7dc94010);
# 67 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$evicted(am_addr_t arg_0x7dc7bf00);
# 31 "/opt/tinyos-2.x/tos/interfaces/Intercept.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$default$forward(
# 136 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc545c0,
# 31 "/opt/tinyos-2.x/tos/interfaces/Intercept.nc"
message_t *arg_0x7dc9bdf0, void *arg_0x7dc9a010, uint16_t arg_0x7dc9a1a0);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 95
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$maxPayloadLength(void);
#line 83
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$fired(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$default$receive(
# 135 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc56e20,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$send(
# 133 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc57c78,
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$getPayload(
# 133 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc57c78,
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54c58);
#line 101
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$maxPayloadLength(
# 133 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc57c78);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$default$sendDone(
# 133 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc57c78,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$stopDone(error_t arg_0x7ebf06e8);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$fired(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$runTask(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Init$init(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$default$receive(
# 134 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc56680,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 7 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpCongestion.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpCongestion$isCongested(void);
# 51 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$routeFound(void);
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$noRoute(void);
# 51 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpPacket.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$option(message_t *arg_0x7dc87010, ctp_options_t arg_0x7dc871a0);
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setEtx(message_t *arg_0x7dc86638, uint16_t arg_0x7dc867c8);
#line 48
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$clearOption(message_t *arg_0x7dc919a0, ctp_options_t arg_0x7dc91b30);
static uint16_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getEtx(message_t *arg_0x7dc86190);
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(message_t *arg_0x7dc86c90);
#line 45
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setOption(message_t *arg_0x7dc91358, ctp_options_t arg_0x7dc914e8);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(message_t *arg_0x7dc87658);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(message_t *arg_0x7dc857e8);
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$matchInstance(message_t *arg_0x7dc83ec8, message_t *arg_0x7dc820a8);
#line 65
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(message_t *arg_0x7dc83358);
#line 54
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setThl(message_t *arg_0x7dc87b00, uint8_t arg_0x7dc87c88);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$StdControl$start(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSnoop$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 46 "/opt/tinyos-2.x/tos/lib/net/CollectionId.nc"
static collection_id_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$default$fetch(
# 165 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc157e8);
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
static /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$t */*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$get(void);
#line 80
static uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$maxSize(void);
#line 61
static bool /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$empty(void);
#line 88
static error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$put(/*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$t *arg_0x7dc2ab50);
#line 72
static uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$size(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Init$init(void);
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
static /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$t */*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$get(void);
#line 61
static bool /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$empty(void);
#line 88
static error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$put(/*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$t *arg_0x7dc2ab50);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Init$init(void);
# 73 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
static /*CtpP.SendQueueP*/QueueC$0$Queue$t /*CtpP.SendQueueP*/QueueC$0$Queue$head(void);
#line 90
static error_t /*CtpP.SendQueueP*/QueueC$0$Queue$enqueue(/*CtpP.SendQueueP*/QueueC$0$Queue$t arg_0x7dc30d30);
static /*CtpP.SendQueueP*/QueueC$0$Queue$t /*CtpP.SendQueueP*/QueueC$0$Queue$element(uint8_t arg_0x7dc2f330);
#line 65
static uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$maxSize(void);
#line 81
static /*CtpP.SendQueueP*/QueueC$0$Queue$t /*CtpP.SendQueueP*/QueueC$0$Queue$dequeue(void);
#line 50
static bool /*CtpP.SendQueueP*/QueueC$0$Queue$empty(void);
static uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$size(void);
# 40 "/opt/tinyos-2.x/tos/interfaces/Cache.nc"
static void /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$insert(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$t arg_0x7dc16088);
static bool /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$lookup(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$t arg_0x7dc165e0);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Init$init(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *LinkEstimatorP$SubReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 38 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static uint8_t LinkEstimatorP$LinkEstimator$getLinkQuality(uint16_t arg_0x7dc7d4e8);
#line 57
static error_t LinkEstimatorP$LinkEstimator$txAck(am_addr_t arg_0x7dc7b138);
#line 50
static error_t LinkEstimatorP$LinkEstimator$pinNeighbor(am_addr_t arg_0x7dc7c7e8);
static error_t LinkEstimatorP$LinkEstimator$txNoAck(am_addr_t arg_0x7dc7b5d0);
#line 47
static error_t LinkEstimatorP$LinkEstimator$insertNeighbor(am_addr_t arg_0x7dc7c348);
#line 64
static error_t LinkEstimatorP$LinkEstimator$clearDLQ(am_addr_t arg_0x7dc7ba70);
#line 53
static error_t LinkEstimatorP$LinkEstimator$unpinNeighbor(am_addr_t arg_0x7dc7cc88);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t LinkEstimatorP$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void *LinkEstimatorP$Packet$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 95
static uint8_t LinkEstimatorP$Packet$maxPayloadLength(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t LinkEstimatorP$Send$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void *LinkEstimatorP$Send$getPayload(message_t *arg_0x7eb20600);
#line 112
static uint8_t LinkEstimatorP$Send$maxPayloadLength(void);
#line 99
static void LinkEstimatorP$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t LinkEstimatorP$Init$init(void);
# 79 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static void *LinkEstimatorP$Receive$getPayload(message_t *arg_0x7eb45a48, uint8_t *arg_0x7eb45bf0);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t LinkEstimatorP$StdControl$start(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 112
static uint8_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$maxPayloadLength(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$sendDone(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void */*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$getPayload(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54c58);
#line 101
static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$maxPayloadLength(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$default$sendDone(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$runTask(void);
#line 64
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$CancelTask$runTask(void);
# 43 "/opt/tinyos-2.x/tos/lib/net/RootControl.nc"
static bool /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$isRoot(void);
#line 41
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$setRoot(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$runTask(void);
# 68 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$default$logEventRoute(uint8_t arg_0x7dc67c90, am_addr_t arg_0x7dc67e20, uint8_t arg_0x7dc66010, uint16_t arg_0x7dc661a0);
# 67 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$evicted(am_addr_t arg_0x7dc7bf00);
# 46 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingPacket.nc"
static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpRoutingPacket$getOption(message_t *arg_0x7da337b0, ctp_options_t arg_0x7da33940);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$stopDone(error_t arg_0x7ebf06e8);
# 70 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$recomputeRoutes(void);
#line 58
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerRouteUpdate(void);
#line 51
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getEtx(uint16_t *arg_0x7eb34478);
#line 65
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerImmediateRouteUpdate(void);
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$setNeighborCongested(am_addr_t arg_0x7eb324d8, bool arg_0x7eb32668);
#line 41
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getParent(am_addr_t *arg_0x7eb43e58);
#line 80
static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$isNeighborCongested(am_addr_t arg_0x7eb32b50);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$runTask(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$Init$init(void);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$fired(void);
#line 72
static void /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$fired(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$StdControl$start(void);
# 49 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
static bool /*CtpP.Router*/CtpRoutingEngineP$0$Routing$hasRoute(void);
#line 48
static am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$Routing$nextHop(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 46 "/opt/tinyos-2.x/tos/lib/net/CollectionId.nc"
static collection_id_t /*OctopusAppC.CollectionSenderC.CollectionSenderP.CollectionIdP*/CollectionIdP$0$CollectionId$fetch(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *DisseminationEngineImplP$ProbeReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void DisseminationEngineImplP$ProbeAMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
#line 99
static void DisseminationEngineImplP$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 82 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void DisseminationEngineImplP$TrickleTimer$fired(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 77 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void DisseminationEngineImplP$TrickleTimer$default$incrementCounter(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 72 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void DisseminationEngineImplP$TrickleTimer$default$reset(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 60 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static error_t DisseminationEngineImplP$TrickleTimer$default$start(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 48 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void DisseminationEngineImplP$DisseminationCache$default$storeData(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0,
# 48 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
void *arg_0x7d943e80, uint8_t arg_0x7d942030, uint32_t arg_0x7d9421c0);
static void DisseminationEngineImplP$DisseminationCache$newData(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0);
# 45 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static error_t DisseminationEngineImplP$DisseminationCache$start(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0);
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static uint32_t DisseminationEngineImplP$DisseminationCache$default$requestSeqno(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0);
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void *DisseminationEngineImplP$DisseminationCache$default$requestData(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0,
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
uint8_t *arg_0x7d9439c0);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *DisseminationEngineImplP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t DisseminationEngineImplP$StdControl$start(void);
#line 74
static error_t DisseminationEngineImplP$DisseminatorControl$default$start(
# 51 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d937030);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$getPayload(message_t *arg_0x7eb20600);
#line 112
static uint8_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$maxPayloadLength(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
#line 89
static void /*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestData(uint8_t *arg_0x7d9439c0);
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$storeData(void *arg_0x7d943e80, uint8_t arg_0x7d942030, uint32_t arg_0x7d9421c0);
static uint32_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestSeqno(void);
# 52 "/opt/tinyos-2.x/tos/lib/net/DisseminationUpdate.nc"
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$change(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$t *arg_0x7eb71010);
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
static const /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$t */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$get(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$StdControl$start(void);
# 82 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$default$fired(
# 50 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
uint8_t arg_0x7d8c0f00);
# 77 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$incrementCounter(
# 50 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
uint8_t arg_0x7d8c0f00);
# 72 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$reset(
# 50 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
uint8_t arg_0x7d8c0f00);
# 60 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$start(
# 50 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
uint8_t arg_0x7d8c0f00);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Init$init(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$runTask(void);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$fired(void);
# 34 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clearAll(void);
#line 58
static void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clear(uint16_t arg_0x7d8b7510);
#line 46
static bool /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$get(uint16_t arg_0x7d8b8a68);
static void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$set(uint16_t arg_0x7d8b7010);
#line 34
static void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clearAll(void);
#line 58
static void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clear(uint16_t arg_0x7d8b7510);
#line 46
static bool /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$get(uint16_t arg_0x7d8b8a68);
static void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$set(uint16_t arg_0x7d8b7010);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t PlatformP$MoteInit$init(void);
#line 51
static error_t PlatformP$MeasureClock$init(void);
#line 51
static error_t PlatformP$LedsInit$init(void);
# 18 "/opt/tinyos-2.x/tos/platforms/aquisgrain/PlatformP.nc"
static inline void PlatformP$power_init(void);
static inline error_t PlatformP$Init$init(void);
# 33 "/opt/tinyos-2.x/tos/platforms/aquisgrain/MeasureClockC.nc"
enum MeasureClockC$__nesc_unnamed4345 {
MeasureClockC$MAGIC = 488 / (16 / PLATFORM_MHZ)
};
uint16_t MeasureClockC$cycles;
static inline error_t MeasureClockC$Init$init(void);
#line 120
static inline uint16_t MeasureClockC$Atm128Calibrate$baudrateRegister(uint32_t baudrate);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t MotePlatformP$SubInit$init(void);
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void MotePlatformP$SerialIdPin$makeInput(void);
#line 30
static void MotePlatformP$SerialIdPin$clr(void);
# 26 "/opt/tinyos-2.x/tos/platforms/aquisgrain/MotePlatformP.nc"
static inline error_t MotePlatformP$PlatformInit$init(void);
# 46 "/opt/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$toggle(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$makeOutput(void);
#line 46
static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$set(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$clr(void);
static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$toggle(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$makeOutput(void);
#line 46
static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$set(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$clr(void);
static void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$toggle(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit2*/HplAtm128GeneralIOPinP$2$IO$makeOutput(void);
#line 47
static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$clr(void);
static __inline void /*HplAtm128GeneralIOC.PortA.Bit4*/HplAtm128GeneralIOPinP$4$IO$makeInput(void);
#line 46
static __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 52
static __inline void /*HplAtm128GeneralIOC.PortB.Bit1*/HplAtm128GeneralIOPinP$9$IO$makeOutput(void);
#line 52
static __inline void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void);
#line 50
static __inline void /*HplAtm128GeneralIOC.PortB.Bit3*/HplAtm128GeneralIOPinP$11$IO$makeInput(void);
#line 46
static __inline void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$set(void);
static __inline void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$makeOutput(void);
#line 45
static __inline bool /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$get(void);
static __inline void /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput(void);
#line 45
static __inline bool /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$get(void);
static __inline void /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$makeInput(void);
#line 46
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$set(void);
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$clr(void);
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$makeOutput(void);
#line 45
static __inline bool /*HplAtm128GeneralIOC.PortE.Bit4*/HplAtm128GeneralIOPinP$36$IO$get(void);
#line 45
static __inline bool /*HplAtm128GeneralIOC.PortE.Bit5*/HplAtm128GeneralIOPinP$37$IO$get(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t RealMainP$SoftwareInit$init(void);
# 49 "/opt/tinyos-2.x/tos/interfaces/Boot.nc"
static void RealMainP$Boot$booted(void);
# 51 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
static error_t RealMainP$PlatformInit$init(void);
# 46 "/opt/tinyos-2.x/tos/interfaces/Scheduler.nc"
static void RealMainP$Scheduler$init(void);
#line 61
static void RealMainP$Scheduler$taskLoop(void);
#line 54
static bool RealMainP$Scheduler$runNextTask(void);
# 52 "/opt/tinyos-2.x/tos/system/RealMainP.nc"
int main(void) ;
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SchedulerBasicP$TaskBasic$runTask(
# 45 "/opt/tinyos-2.x/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x7f080b18);
# 59 "/opt/tinyos-2.x/tos/interfaces/McuSleep.nc"
static void SchedulerBasicP$McuSleep$sleep(void);
# 50 "/opt/tinyos-2.x/tos/system/SchedulerBasicP.nc"
enum SchedulerBasicP$__nesc_unnamed4346 {
SchedulerBasicP$NUM_TASKS = 29U,
SchedulerBasicP$NO_TASK = 255
};
volatile uint8_t SchedulerBasicP$m_head;
volatile uint8_t SchedulerBasicP$m_tail;
volatile uint8_t SchedulerBasicP$m_next[SchedulerBasicP$NUM_TASKS];
static __inline uint8_t SchedulerBasicP$popTask(void);
#line 86
static inline bool SchedulerBasicP$isWaiting(uint8_t id);
static inline bool SchedulerBasicP$pushTask(uint8_t id);
#line 113
static inline void SchedulerBasicP$Scheduler$init(void);
static bool SchedulerBasicP$Scheduler$runNextTask(void);
#line 138
static inline void SchedulerBasicP$Scheduler$taskLoop(void);
#line 159
static error_t SchedulerBasicP$TaskBasic$postTask(uint8_t id);
static void SchedulerBasicP$TaskBasic$default$runTask(uint8_t id);
# 54 "/opt/tinyos-2.x/tos/interfaces/McuPowerOverride.nc"
static mcu_power_t McuSleepC$McuPowerOverride$lowestState(void);
# 58 "/opt/tinyos-2.x/tos/chips/atm128/McuSleepC.nc"
const_uint8_t McuSleepC$atm128PowerBits[ATM128_POWER_DOWN + 1] = {
0,
1 << 3, ((
1 << 2) | (1 << 4)) | (1 << 3), (
1 << 4) | (1 << 3), (
1 << 2) | (1 << 4),
1 << 4 };
static inline mcu_power_t McuSleepC$getPowerState(void);
#line 97
static inline void McuSleepC$McuSleep$sleep(void);
#line 109
static inline void McuSleepC$McuPowerState$update(void);
# 41 "/opt/tinyos-2.x/tos/lib/net/RootControl.nc"
static error_t OctopusC$RootControl$setRoot(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t OctopusC$CollectSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void *OctopusC$CollectSend$getPayload(message_t *arg_0x7eb54c58);
# 83 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static error_t OctopusC$SerialControl$start(void);
#line 83
static error_t OctopusC$RadioControl$start(void);
# 76 "/opt/tinyos-2.x/tos/interfaces/LowPowerListening.nc"
static void OctopusC$LowPowerListening$setLocalDutyCycle(uint16_t arg_0x7eb90890);
# 55 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static error_t OctopusC$Read$read(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t OctopusC$CollectControl$start(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t OctopusC$SerialSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void *OctopusC$SerialSend$getPayload(message_t *arg_0x7eb20600);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t OctopusC$BroadcastControl$start(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t OctopusC$serialSendTask$postTask(void);
# 51 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
static error_t OctopusC$CollectInfo$getEtx(uint16_t *arg_0x7eb34478);
#line 41
static error_t OctopusC$CollectInfo$getParent(am_addr_t *arg_0x7eb43e58);
# 56 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
static void OctopusC$Leds$led0Toggle(void);
static void OctopusC$Leds$led1On(void);
static void OctopusC$Leds$led1Toggle(void);
#line 89
static void OctopusC$Leds$led2Toggle(void);
#line 45
static void OctopusC$Leds$led0On(void);
#line 78
static void OctopusC$Leds$led2On(void);
# 52 "/opt/tinyos-2.x/tos/lib/net/DisseminationUpdate.nc"
static void OctopusC$RequestUpdate$change(OctopusC$RequestUpdate$t *arg_0x7eb71010);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t OctopusC$collectSendTask$postTask(void);
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
static const OctopusC$RequestValue$t *OctopusC$RequestValue$get(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void OctopusC$Timer$startPeriodic(uint32_t arg_0x7eb13ce0);
#line 67
static void OctopusC$Timer$stop(void);
# 86 "OctopusC.nc"
enum OctopusC$__nesc_unnamed4347 {
#line 86
OctopusC$collectSendTask = 0U
};
#line 86
typedef int OctopusC$__nesc_sillytask_collectSendTask[OctopusC$collectSendTask];
enum OctopusC$__nesc_unnamed4348 {
#line 87
OctopusC$serialSendTask = 1U
};
#line 87
typedef int OctopusC$__nesc_sillytask_serialSendTask[OctopusC$serialSendTask];
#line 65
octopus_collected_msg_t OctopusC$localCollectedMsg;
message_t OctopusC$fwdMsg;
message_t OctopusC$sndMsg;
bool OctopusC$fwdBusy;
#line 68
bool OctopusC$sendBusy;
#line 68
bool OctopusC$uartBusy;
uint16_t OctopusC$samplingPeriod;
uint16_t OctopusC$threshold;
bool OctopusC$modeAuto;
#line 71
bool OctopusC$sleeping;
#line 71
bool OctopusC$root = FALSE;
uint16_t OctopusC$battery;
#line 72
uint16_t OctopusC$sleepDutyCycle;
#line 72
uint16_t OctopusC$awakeDutyCycle;
uint16_t OctopusC$oldSensorValue = 0;
static void OctopusC$fatalProblem(void);
inline static void OctopusC$reportProblem(void);
inline static void OctopusC$reportSent(void);
inline static void OctopusC$reportReceived(void);
static void OctopusC$processRequest(octopus_sent_msg_t *newRequest);
static void OctopusC$fillPacket(void);
static void OctopusC$setLocalDutyCycle(void);
static inline void OctopusC$Boot$booted(void);
#line 114
static inline void OctopusC$RadioControl$startDone(error_t error);
#line 127
static inline void OctopusC$RadioControl$stopDone(error_t error);
static inline void OctopusC$SerialControl$startDone(error_t error);
static inline void OctopusC$SerialControl$stopDone(error_t error);
static void OctopusC$processRequest(octopus_sent_msg_t *newRequest);
#line 236
static inline message_t *OctopusC$SerialReceive$receive(message_t *msg, void *payload, uint8_t len);
#line 249
static inline void OctopusC$collectSendTask$runTask(void);
static inline void OctopusC$serialSendTask$runTask(void);
static void OctopusC$CollectSend$sendDone(message_t *msg, error_t error);
static void OctopusC$SerialSend$sendDone(message_t *msg, error_t error);
#line 295
static void OctopusC$fillPacket(void);
#line 314
static inline void OctopusC$RequestValue$changed(void);
static inline void OctopusC$Timer$fired(void);
static inline void OctopusC$Read$readDone(error_t ok, uint16_t val);
#line 370
static message_t *OctopusC$CollectReceive$receive(message_t *msg, void *payload, uint8_t len);
#line 390
static inline message_t *OctopusC$Snoop$receive(message_t *msg, void *payload, uint8_t len);
static void OctopusC$setLocalDutyCycle(void);
# 31 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void LedsP$Led0$toggle(void);
static void LedsP$Led0$makeOutput(void);
#line 29
static void LedsP$Led0$set(void);
static void LedsP$Led0$clr(void);
static void LedsP$Led1$toggle(void);
static void LedsP$Led1$makeOutput(void);
#line 29
static void LedsP$Led1$set(void);
static void LedsP$Led1$clr(void);
static void LedsP$Led2$toggle(void);
static void LedsP$Led2$makeOutput(void);
#line 29
static void LedsP$Led2$set(void);
static void LedsP$Led2$clr(void);
# 45 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline error_t LedsP$Init$init(void);
#line 63
static inline void LedsP$Leds$led0On(void);
static inline void LedsP$Leds$led0Toggle(void);
static inline void LedsP$Leds$led1On(void);
static inline void LedsP$Leds$led1Toggle(void);
static inline void LedsP$Leds$led2On(void);
static inline void LedsP$Leds$led2Toggle(void);
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
static Atm128_TIFR_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$getInterruptFlag(void);
#line 37
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$setControl(Atm128TimerControl_t arg_0x7e986ce8);
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$fired(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$overflow(void);
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerAsync.nc"
static int /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$compareBusy(void);
#line 32
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$setTimer0Asynchronous(void);
# 39 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$size_type /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$get(void);
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$size_type arg_0x7e981c38);
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$start(void);
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$timer_size /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get(void);
# 38 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
uint8_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$set;
uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$t0;
#line 39
uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$dt;
uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base;
enum /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$__nesc_unnamed4349 {
Atm128AlarmAsyncP$0$MINDT = 2,
Atm128AlarmAsyncP$0$MAXT = 230
};
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt(void);
static inline error_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Init$init(void);
#line 74
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setOcr0(uint8_t n);
#line 90
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt(void);
#line 139
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$fired(void);
#line 151
static uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$get(void);
#line 194
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$stop(void);
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$startAt(uint32_t nt0, uint32_t ndt);
static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getNow(void);
static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getAlarm(void);
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$overflow(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer0AsyncP$Compare$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void HplAtm128Timer0AsyncP$Timer$overflow(void);
# 50 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline uint8_t HplAtm128Timer0AsyncP$Timer$get(void);
#line 76
static inline void HplAtm128Timer0AsyncP$TimerCtrl$setControl(Atm128TimerControl_t x);
#line 94
static inline Atm128_TIFR_t HplAtm128Timer0AsyncP$TimerCtrl$getInterruptFlag(void);
#line 122
static inline void HplAtm128Timer0AsyncP$Compare$start(void);
static inline uint8_t HplAtm128Timer0AsyncP$Compare$get(void);
static inline void HplAtm128Timer0AsyncP$Compare$set(uint8_t t);
static __inline void HplAtm128Timer0AsyncP$stabiliseTimer0(void);
#line 155
static inline mcu_power_t HplAtm128Timer0AsyncP$McuPowerOverride$lowestState(void);
#line 178
void __vector_15(void) __attribute((signal)) ;
void __vector_16(void) __attribute((signal)) ;
#line 198
static inline void HplAtm128Timer0AsyncP$TimerAsync$setTimer0Asynchronous(void);
static inline int HplAtm128Timer0AsyncP$TimerAsync$compareBusy(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$postTask(void);
# 98 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getNow(void);
#line 92
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$startAt(/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x7e9d39e0, /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x7e9d3b70);
#line 105
static /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$getAlarm(void);
#line 62
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$stop(void);
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$fired(void);
# 63 "/opt/tinyos-2.x/tos/lib/timer/AlarmToTimerC.nc"
enum /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$__nesc_unnamed4350 {
#line 63
AlarmToTimerC$0$fired = 2U
};
#line 63
typedef int /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$__nesc_sillytask_fired[/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired];
#line 44
uint32_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 60
static 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 82
static 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 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask(void);
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow(void);
#line 118
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(uint32_t arg_0x7eb05010, uint32_t arg_0x7eb051a0);
#line 67
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$stop(void);
static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$fired(
# 37 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
uint8_t arg_0x7e871cd8);
#line 60
enum /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4351 {
#line 60
VirtualizeTimerC$0$updateFromTimer = 3U
};
#line 60
typedef int /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_sillytask_updateFromTimer[/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer];
#line 42
enum /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4352 {
VirtualizeTimerC$0$NUM_TIMERS = 8,
VirtualizeTimerC$0$END_OF_LIST = 255
};
#line 48
typedef struct /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$__nesc_unnamed4353 {
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 88
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask(void);
#line 127
static 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 void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(uint8_t num, uint32_t dt);
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(uint8_t num, uint32_t dt);
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(uint8_t num);
static inline bool /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$isRunning(uint8_t num);
#line 177
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getNow(uint8_t num);
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$gett0(uint8_t num);
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getdt(uint8_t num);
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(uint8_t num);
# 47 "/opt/tinyos-2.x/tos/lib/timer/CounterToLocalTimeC.nc"
static inline void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$postTask(void);
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static void /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$readDone(error_t arg_0x7eaf5668, /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$val_t arg_0x7eaf57f0);
# 33 "/opt/tinyos-2.x/tos/system/SineSensorC.nc"
enum /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$__nesc_unnamed4354 {
#line 33
SineSensorC$0$readTask = 4U
};
#line 33
typedef int /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$__nesc_sillytask_readTask[/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask];
#line 26
uint32_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$counter;
static inline void /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$runTask(void);
static inline error_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$read(void);
# 41 "/opt/tinyos-2.x/tos/system/RandomMlcgP.nc"
uint32_t RandomMlcgP$seed;
static inline error_t RandomMlcgP$Init$init(void);
#line 58
static uint32_t RandomMlcgP$Random$rand32(void);
#line 78
static inline uint16_t RandomMlcgP$Random$rand16(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$sendDone(
# 36 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
am_id_t arg_0x7e7a9030,
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$receive(
# 37 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
am_id_t arg_0x7e7a9960,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 49 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline serial_header_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(message_t *msg);
static error_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$send(am_id_t id, am_addr_t dest,
message_t *msg,
uint8_t len);
#line 77
static inline void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$getPayload(am_id_t id, message_t *m);
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$sendDone(message_t *msg, error_t result);
static inline message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$default$receive(uint8_t id, message_t *msg, void *payload, uint8_t len);
#line 102
static inline message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubReceive$receive(message_t *msg, void *payload, uint8_t len);
static inline uint8_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$payloadLength(message_t *msg);
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$setPayloadLength(message_t *msg, uint8_t len);
static void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$getPayload(message_t *msg, uint8_t *len);
static am_addr_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$destination(message_t *amsg);
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setDestination(message_t *amsg, am_addr_t addr);
#line 158
static am_id_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(message_t *amsg);
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setType(message_t *amsg, am_id_t type);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void SerialP$SplitControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void SerialP$SplitControl$stopDone(error_t arg_0x7ebf06e8);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t SerialP$stopDoneTask$postTask(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t SerialP$SerialControl$start(void);
static error_t SerialP$SerialControl$stop(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t SerialP$RunTx$postTask(void);
# 38 "/opt/tinyos-2.x/tos/lib/serial/SerialFlush.nc"
static void SerialP$SerialFlush$flush(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t SerialP$startDoneTask$postTask(void);
# 45 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
static error_t SerialP$SerialFrameComm$putDelimiter(void);
#line 68
static void SerialP$SerialFrameComm$resetReceive(void);
#line 54
static error_t SerialP$SerialFrameComm$putData(uint8_t arg_0x7e721d40);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t SerialP$defaultSerialFlushTask$postTask(void);
# 70 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
static uint8_t SerialP$SendBytePacket$nextByte(void);
static void SerialP$SendBytePacket$sendCompleted(error_t arg_0x7e728818);
# 51 "/opt/tinyos-2.x/tos/lib/serial/ReceiveBytePacket.nc"
static error_t SerialP$ReceiveBytePacket$startPacket(void);
static void SerialP$ReceiveBytePacket$byteReceived(uint8_t arg_0x7e725838);
static void SerialP$ReceiveBytePacket$endPacket(error_t arg_0x7e725e08);
# 189 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
enum SerialP$__nesc_unnamed4355 {
#line 189
SerialP$RunTx = 5U
};
#line 189
typedef int SerialP$__nesc_sillytask_RunTx[SerialP$RunTx];
#line 320
enum SerialP$__nesc_unnamed4356 {
#line 320
SerialP$startDoneTask = 6U
};
#line 320
typedef int SerialP$__nesc_sillytask_startDoneTask[SerialP$startDoneTask];
enum SerialP$__nesc_unnamed4357 {
#line 326
SerialP$stopDoneTask = 7U
};
#line 326
typedef int SerialP$__nesc_sillytask_stopDoneTask[SerialP$stopDoneTask];
enum SerialP$__nesc_unnamed4358 {
#line 335
SerialP$defaultSerialFlushTask = 8U
};
#line 335
typedef int SerialP$__nesc_sillytask_defaultSerialFlushTask[SerialP$defaultSerialFlushTask];
#line 79
enum SerialP$__nesc_unnamed4359 {
SerialP$RX_DATA_BUFFER_SIZE = 2,
SerialP$TX_DATA_BUFFER_SIZE = 4,
SerialP$SERIAL_MTU = 255,
SerialP$SERIAL_VERSION = 1,
SerialP$ACK_QUEUE_SIZE = 5
};
enum SerialP$__nesc_unnamed4360 {
SerialP$RXSTATE_NOSYNC,
SerialP$RXSTATE_PROTO,
SerialP$RXSTATE_TOKEN,
SerialP$RXSTATE_INFO,
SerialP$RXSTATE_INACTIVE
};
enum SerialP$__nesc_unnamed4361 {
SerialP$TXSTATE_IDLE,
SerialP$TXSTATE_PROTO,
SerialP$TXSTATE_SEQNO,
SerialP$TXSTATE_INFO,
SerialP$TXSTATE_FCS1,
SerialP$TXSTATE_FCS2,
SerialP$TXSTATE_ENDFLAG,
SerialP$TXSTATE_ENDWAIT,
SerialP$TXSTATE_FINISH,
SerialP$TXSTATE_ERROR,
SerialP$TXSTATE_INACTIVE
};
#line 109
typedef enum SerialP$__nesc_unnamed4362 {
SerialP$BUFFER_AVAILABLE,
SerialP$BUFFER_FILLING,
SerialP$BUFFER_COMPLETE
} SerialP$tx_data_buffer_states_t;
enum SerialP$__nesc_unnamed4363 {
SerialP$TX_ACK_INDEX = 0,
SerialP$TX_DATA_INDEX = 1,
SerialP$TX_BUFFER_COUNT = 2
};
#line 122
typedef struct SerialP$__nesc_unnamed4364 {
uint8_t writePtr;
uint8_t readPtr;
uint8_t buf[SerialP$RX_DATA_BUFFER_SIZE + 1];
} SerialP$rx_buf_t;
#line 128
typedef struct SerialP$__nesc_unnamed4365 {
uint8_t state;
uint8_t buf;
} SerialP$tx_buf_t;
#line 133
typedef struct SerialP$__nesc_unnamed4366 {
uint8_t writePtr;
uint8_t readPtr;
uint8_t buf[SerialP$ACK_QUEUE_SIZE + 1];
} SerialP$ack_queue_t;
SerialP$rx_buf_t SerialP$rxBuf;
SerialP$tx_buf_t SerialP$txBuf[SerialP$TX_BUFFER_COUNT];
uint8_t SerialP$rxState;
uint8_t SerialP$rxByteCnt;
uint8_t SerialP$rxProto;
uint8_t SerialP$rxSeqno;
uint16_t SerialP$rxCRC;
uint8_t SerialP$txState;
uint8_t SerialP$txByteCnt;
uint8_t SerialP$txProto;
uint8_t SerialP$txSeqno;
uint16_t SerialP$txCRC;
uint8_t SerialP$txPending;
uint8_t SerialP$txIndex;
SerialP$ack_queue_t SerialP$ackQ;
bool SerialP$offPending = FALSE;
static __inline void SerialP$txInit(void);
static __inline void SerialP$rxInit(void);
static __inline void SerialP$ackInit(void);
static __inline bool SerialP$ack_queue_is_full(void);
static __inline bool SerialP$ack_queue_is_empty(void);
static __inline void SerialP$ack_queue_push(uint8_t token);
static __inline uint8_t SerialP$ack_queue_top(void);
static inline uint8_t SerialP$ack_queue_pop(void);
static __inline void SerialP$rx_buffer_push(uint8_t data);
static __inline uint8_t SerialP$rx_buffer_top(void);
static __inline uint8_t SerialP$rx_buffer_pop(void);
static __inline uint16_t SerialP$rx_current_crc(void);
static void SerialP$rx_state_machine(bool isDelimeter, uint8_t data);
static void SerialP$MaybeScheduleTx(void);
static __inline void SerialP$txInit(void);
#line 205
static __inline void SerialP$rxInit(void);
static __inline void SerialP$ackInit(void);
static inline error_t SerialP$Init$init(void);
#line 232
static __inline bool SerialP$ack_queue_is_full(void);
static __inline bool SerialP$ack_queue_is_empty(void);
static __inline void SerialP$ack_queue_push(uint8_t token);
static __inline uint8_t SerialP$ack_queue_top(void);
static inline uint8_t SerialP$ack_queue_pop(void);
#line 295
static __inline void SerialP$rx_buffer_push(uint8_t data);
static __inline uint8_t SerialP$rx_buffer_top(void);
static __inline uint8_t SerialP$rx_buffer_pop(void);
static __inline uint16_t SerialP$rx_current_crc(void);
static inline void SerialP$startDoneTask$runTask(void);
static inline void SerialP$stopDoneTask$runTask(void);
static inline void SerialP$SerialFlush$flushDone(void);
static inline void SerialP$defaultSerialFlushTask$runTask(void);
static inline void SerialP$SerialFlush$default$flush(void);
static inline error_t SerialP$SplitControl$start(void);
static void SerialP$testOff(void);
#line 384
static inline void SerialP$SerialFrameComm$delimiterReceived(void);
static inline void SerialP$SerialFrameComm$dataReceived(uint8_t data);
static inline bool SerialP$valid_rx_proto(uint8_t proto);
static void SerialP$rx_state_machine(bool isDelimeter, uint8_t data);
#line 502
static void SerialP$MaybeScheduleTx(void);
static inline error_t SerialP$SendBytePacket$completeSend(void);
static inline error_t SerialP$SendBytePacket$startSend(uint8_t b);
#line 539
static inline void SerialP$RunTx$runTask(void);
#line 642
static inline void SerialP$SerialFrameComm$putDone(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$postTask(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$sendDone(
# 40 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e6923e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$postTask(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$receive(
# 39 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e693b98,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$upperLength(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98,
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
message_t *arg_0x7e755808, uint8_t arg_0x7e755998);
#line 15
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$offset(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98);
# 23 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$dataLinkLength(
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
uart_id_t arg_0x7e692d98,
# 23 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
message_t *arg_0x7e755010, uint8_t arg_0x7e7551a0);
# 60 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$completeSend(void);
#line 51
static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$startSend(uint8_t arg_0x7e729780);
# 152 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
enum /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_unnamed4367 {
#line 152
SerialDispatcherP$0$signalSendDone = 9U
};
#line 152
typedef int /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_sillytask_signalSendDone[/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone];
#line 269
enum /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_unnamed4368 {
#line 269
SerialDispatcherP$0$receiveTask = 10U
};
#line 269
typedef int /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_sillytask_receiveTask[/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask];
#line 55
#line 51
typedef enum /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_unnamed4369 {
SerialDispatcherP$0$SEND_STATE_IDLE = 0,
SerialDispatcherP$0$SEND_STATE_BEGIN = 1,
SerialDispatcherP$0$SEND_STATE_DATA = 2
} /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$send_state_t;
enum /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_unnamed4370 {
SerialDispatcherP$0$RECV_STATE_IDLE = 0,
SerialDispatcherP$0$RECV_STATE_BEGIN = 1,
SerialDispatcherP$0$RECV_STATE_DATA = 2
};
#line 63
typedef struct /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$__nesc_unnamed4371 {
uint8_t which : 1;
uint8_t bufZeroLocked : 1;
uint8_t bufOneLocked : 1;
uint8_t state : 2;
} /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recv_state_t;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recv_state_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState = { 0, 0, 0, /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_IDLE };
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvType = TOS_SERIAL_UNKNOWN_ID;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex = 0;
message_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messages[2];
message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messagePtrs[2] = { &/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messages[0], &/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messages[1] };
uint8_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBuffer = (uint8_t *)&/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messages[0];
uint8_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendBuffer = (void *)0;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$send_state_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendState = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SEND_STATE_IDLE;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendLen = 0;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex = 0;
error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendError = SUCCESS;
bool /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendCancelled = FALSE;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendId = 0;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskPending = FALSE;
uart_id_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskType = 0;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskWhich;
message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskBuf = (void *)0;
uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskSize = 0;
static inline error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$send(uint8_t id, message_t *msg, uint8_t len);
#line 152
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$runTask(void);
#line 172
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$nextByte(void);
#line 188
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$sendCompleted(error_t error);
static inline bool /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$isCurrentBufferLocked(void);
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$lockCurrentBuffer(void);
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$unlockBuffer(uint8_t which);
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBufferSwap(void);
static inline error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$startPacket(void);
#line 238
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$byteReceived(uint8_t b);
#line 269
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$runTask(void);
#line 290
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$endPacket(error_t result);
#line 349
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$offset(uart_id_t id);
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$dataLinkLength(uart_id_t id, message_t *msg,
uint8_t upperLen);
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$upperLength(uart_id_t id, message_t *msg,
uint8_t dataLinkLen);
static inline message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$default$receive(uart_id_t idxxx, message_t *msg,
void *payload,
uint8_t len);
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$default$sendDone(uart_id_t idxxx, message_t *msg, error_t error);
# 48 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
static error_t HdlcTranslateC$UartStream$send(uint8_t *arg_0x7e637768, uint16_t arg_0x7e6378f8);
# 83 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
static void HdlcTranslateC$SerialFrameComm$dataReceived(uint8_t arg_0x7e719010);
static void HdlcTranslateC$SerialFrameComm$putDone(void);
#line 74
static void HdlcTranslateC$SerialFrameComm$delimiterReceived(void);
# 47 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
#line 44
typedef struct HdlcTranslateC$__nesc_unnamed4372 {
uint8_t sendEscape : 1;
uint8_t receiveEscape : 1;
} HdlcTranslateC$HdlcState;
HdlcTranslateC$HdlcState HdlcTranslateC$state = { 0, 0 };
uint8_t HdlcTranslateC$txTemp;
uint8_t HdlcTranslateC$m_data;
static inline void HdlcTranslateC$SerialFrameComm$resetReceive(void);
static inline void HdlcTranslateC$UartStream$receivedByte(uint8_t data);
#line 86
static error_t HdlcTranslateC$SerialFrameComm$putDelimiter(void);
static error_t HdlcTranslateC$SerialFrameComm$putData(uint8_t data);
#line 104
static inline void HdlcTranslateC$UartStream$sendDone(uint8_t *buf, uint16_t len,
error_t error);
static inline void HdlcTranslateC$UartStream$receiveDone(uint8_t *buf, uint16_t len, error_t error);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$start(void);
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$stop(void);
# 79 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receivedByte(uint8_t arg_0x7e635010);
#line 99
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receiveDone(uint8_t *arg_0x7e635ce0, uint16_t arg_0x7e635e70, error_t arg_0x7e633010);
#line 57
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$sendDone(uint8_t *arg_0x7e637f00, uint16_t arg_0x7e6360b0, error_t arg_0x7e636238);
# 46 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
static void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$tx(uint8_t arg_0x7e603068);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$start(void);
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$stop(void);
# 56 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
uint8_t */*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf;
#line 56
uint8_t */*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_buf;
uint16_t /*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_len;
#line 57
uint16_t /*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_len;
uint16_t /*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_pos;
#line 58
uint16_t /*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_pos;
uint16_t /*Atm128Uart0C.UartP*/Atm128UartP$0$m_byte_time;
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$Init$init(void);
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$start(void);
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$stop(void);
#line 107
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$rxDone(uint8_t data);
#line 123
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$send(uint8_t *buf, uint16_t len);
#line 139
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$txDone(void);
#line 174
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$overflow(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
static void HplAtm128UartP$HplUart0$rxDone(uint8_t arg_0x7e603b30);
#line 47
static void HplAtm128UartP$HplUart0$txDone(void);
static void HplAtm128UartP$HplUart1$rxDone(uint8_t arg_0x7e603b30);
#line 47
static void HplAtm128UartP$HplUart1$txDone(void);
# 60 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128Calibrate.nc"
static uint16_t HplAtm128UartP$Atm128Calibrate$baudrateRegister(uint32_t arg_0x7ef53898);
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
static void HplAtm128UartP$McuPowerState$update(void);
# 87 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart0Init$init(void);
#line 107
static inline error_t HplAtm128UartP$Uart0TxControl$start(void);
static inline error_t HplAtm128UartP$Uart0TxControl$stop(void);
static inline error_t HplAtm128UartP$Uart0RxControl$start(void);
static inline error_t HplAtm128UartP$Uart0RxControl$stop(void);
#line 167
static void HplAtm128UartP$HplUart0$tx(uint8_t data);
void __vector_18(void) __attribute((signal)) ;
void __vector_20(void) __attribute((interrupt)) ;
static inline error_t HplAtm128UartP$Uart1Init$init(void);
#line 271
void __vector_30(void) __attribute((signal)) ;
void __vector_32(void) __attribute((interrupt)) ;
static inline void HplAtm128UartP$HplUart1$default$txDone(void);
static inline void HplAtm128UartP$HplUart1$default$rxDone(uint8_t data);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer3P$CompareA$fired(void);
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void HplAtm128Timer3P$Capture$captured(HplAtm128Timer3P$Capture$size_type arg_0x7e55c120);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer3P$CompareB$fired(void);
#line 49
static void HplAtm128Timer3P$CompareC$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void HplAtm128Timer3P$Timer$overflow(void);
# 47 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline uint16_t HplAtm128Timer3P$Timer$get(void);
static inline void HplAtm128Timer3P$Timer$set(uint16_t t);
static inline void HplAtm128Timer3P$Timer$setScale(uint8_t s);
static inline Atm128TimerCtrlCapture_t HplAtm128Timer3P$TimerCtrl$getCtrlCapture(void);
static inline uint16_t HplAtm128Timer3P$TimerCtrlCapture2int(Atm128TimerCtrlCapture_t x);
static inline void HplAtm128Timer3P$TimerCtrl$setCtrlCapture(Atm128_TCCR3B_t x);
#line 127
static inline void HplAtm128Timer3P$Timer$start(void);
#line 188
static inline void HplAtm128Timer3P$CompareA$default$fired(void);
void __vector_26(void) __attribute((interrupt)) ;
static inline void HplAtm128Timer3P$CompareB$default$fired(void);
void __vector_27(void) __attribute((interrupt)) ;
static inline void HplAtm128Timer3P$CompareC$default$fired(void);
void __vector_28(void) __attribute((interrupt)) ;
static inline void HplAtm128Timer3P$Capture$default$captured(uint16_t time);
void __vector_25(void) __attribute((interrupt)) ;
void __vector_29(void) __attribute((interrupt)) ;
# 95 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$setScale(uint8_t arg_0x7e9930f8);
#line 58
static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$set(/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$timer_size arg_0x7e9953c0);
static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$start(void);
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline error_t /*InitThreeP.InitThree*/Atm128TimerInitC$0$Init$init(void);
static inline void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$overflow(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*CounterThree16C.NCounter*/Atm128CounterC$0$Counter$overflow(void);
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline void /*CounterThree16C.NCounter*/Atm128CounterC$0$Timer$overflow(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*CounterMicro32C.Transform32*/TransformCounterC$0$Counter$overflow(void);
# 56 "/opt/tinyos-2.x/tos/lib/timer/TransformCounterC.nc"
/*CounterMicro32C.Transform32*/TransformCounterC$0$upper_count_type /*CounterMicro32C.Transform32*/TransformCounterC$0$m_upper;
enum /*CounterMicro32C.Transform32*/TransformCounterC$0$__nesc_unnamed4373 {
TransformCounterC$0$LOW_SHIFT_RIGHT = 0,
TransformCounterC$0$HIGH_SHIFT_LEFT = 8 * sizeof(/*CounterMicro32C.Transform32*/TransformCounterC$0$from_size_type ) - /*CounterMicro32C.Transform32*/TransformCounterC$0$LOW_SHIFT_RIGHT,
TransformCounterC$0$NUM_UPPER_BITS = 8 * sizeof(/*CounterMicro32C.Transform32*/TransformCounterC$0$to_size_type ) - 8 * sizeof(/*CounterMicro32C.Transform32*/TransformCounterC$0$from_size_type ) + 0,
TransformCounterC$0$OVERFLOW_MASK = /*CounterMicro32C.Transform32*/TransformCounterC$0$NUM_UPPER_BITS ? ((/*CounterMicro32C.Transform32*/TransformCounterC$0$upper_count_type )2 << (/*CounterMicro32C.Transform32*/TransformCounterC$0$NUM_UPPER_BITS - 1)) - 1 : 0
};
#line 122
static inline void /*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$overflow(void);
# 40 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfoActiveMessageP.nc"
static inline uint8_t SerialPacketInfoActiveMessageP$Info$offset(void);
static inline uint8_t SerialPacketInfoActiveMessageP$Info$dataLinkLength(message_t *msg, uint8_t upperLen);
static inline uint8_t SerialPacketInfoActiveMessageP$Info$upperLength(message_t *msg, uint8_t dataLinkLen);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void */*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$getPayload(message_t *arg_0x7eb54c58);
# 92 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 151
static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static error_t /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len);
static inline void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *m, error_t err);
static inline void */*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$getPayload(message_t *m);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$getPayload(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb20600);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 83
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(message_t *arg_0x7e7c1cd8);
#line 136
static am_id_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(message_t *arg_0x7e7b7258);
# 118 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
enum /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4374 {
#line 118
AMQueueImplP$0$CancelTask = 11U
};
#line 118
typedef int /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_sillytask_CancelTask[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask];
#line 161
enum /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4375 {
#line 161
AMQueueImplP$0$errorTask = 12U
};
#line 161
typedef int /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_sillytask_errorTask[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask];
#line 49
#line 47
typedef struct /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$__nesc_unnamed4376 {
message_t *msg;
} /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue_entry_t;
uint8_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue_entry_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[1];
uint8_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[1 / 8 + 1];
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void);
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket(void);
#line 82
static inline error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(uint8_t clientId, message_t *msg,
uint8_t len);
#line 118
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask(void);
#line 155
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(uint8_t last, message_t *msg, error_t err);
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void);
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void);
#line 181
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(am_id_t id, message_t *msg, error_t err);
#line 203
static inline void */*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$getPayload(uint8_t id, message_t *m);
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(uint8_t id, message_t *msg, error_t err);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t CC2420ActiveMessageP$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static am_addr_t CC2420ActiveMessageP$amAddress(void);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void CC2420ActiveMessageP$AMSend$sendDone(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437398,
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ActiveMessageP$Snoop$receive(
# 41 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e4354e0,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *CC2420ActiveMessageP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ActiveMessageP$Receive$receive(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
am_id_t arg_0x7e437cc8,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 54 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
enum CC2420ActiveMessageP$__nesc_unnamed4377 {
CC2420ActiveMessageP$CC2420_SIZE = MAC_HEADER_SIZE + MAC_FOOTER_SIZE
};
static error_t CC2420ActiveMessageP$AMSend$send(am_id_t id, am_addr_t addr,
message_t *msg,
uint8_t len);
#line 74
static inline uint8_t CC2420ActiveMessageP$AMSend$maxPayloadLength(am_id_t id);
static inline void *CC2420ActiveMessageP$AMSend$getPayload(am_id_t id, message_t *m);
#line 98
static inline void CC2420ActiveMessageP$SubSend$sendDone(message_t *msg, error_t result);
static inline message_t *CC2420ActiveMessageP$SubReceive$receive(message_t *msg, void *payload, uint8_t len);
static inline am_addr_t CC2420ActiveMessageP$AMPacket$address(void);
static am_addr_t CC2420ActiveMessageP$AMPacket$destination(message_t *amsg);
static am_addr_t CC2420ActiveMessageP$AMPacket$source(message_t *amsg);
static void CC2420ActiveMessageP$AMPacket$setDestination(message_t *amsg, am_addr_t addr);
static inline bool CC2420ActiveMessageP$AMPacket$isForMe(message_t *amsg);
static am_id_t CC2420ActiveMessageP$AMPacket$type(message_t *amsg);
static void CC2420ActiveMessageP$AMPacket$setType(message_t *amsg, am_id_t type);
static inline message_t *CC2420ActiveMessageP$Receive$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len);
static inline message_t *CC2420ActiveMessageP$Snoop$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len);
static inline uint8_t CC2420ActiveMessageP$Packet$payloadLength(message_t *msg);
static void CC2420ActiveMessageP$Packet$setPayloadLength(message_t *msg, uint8_t len);
static inline uint8_t CC2420ActiveMessageP$Packet$maxPayloadLength(void);
static void *CC2420ActiveMessageP$Packet$getPayload(message_t *msg, uint8_t *len);
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
static void CC2420CsmaP$SplitControl$startDone(error_t arg_0x7ebf1af0);
#line 117
static void CC2420CsmaP$SplitControl$stopDone(error_t arg_0x7ebf06e8);
# 94 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
static void CC2420CsmaP$RadioBackoff$requestCca(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 94 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e441268);
#line 72
static void CC2420CsmaP$RadioBackoff$requestInitialBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 72 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e4420a8);
static void CC2420CsmaP$RadioBackoff$requestCongestionBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 79 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e442660);
static void CC2420CsmaP$RadioBackoff$requestLplBackoff(
# 42 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
am_id_t arg_0x7e36c010,
# 87 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
message_t *arg_0x7e442c18);
#line 56
static void CC2420CsmaP$SubBackoff$setLplBackoff(uint16_t arg_0x7e444590);
#line 49
static void CC2420CsmaP$SubBackoff$setCongestionBackoff(uint16_t arg_0x7e444010);
#line 43
static void CC2420CsmaP$SubBackoff$setInitialBackoff(uint16_t arg_0x7e4459b0);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *CC2420CsmaP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
static cc2420_metadata_t *CC2420CsmaP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0);
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
static error_t CC2420CsmaP$CC2420Transmit$send(message_t *arg_0x7e364d08, bool arg_0x7e364e90);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void CC2420CsmaP$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t CC2420CsmaP$Random$rand16(void);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t CC2420CsmaP$SubControl$start(void);
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
static error_t CC2420CsmaP$CC2420Power$startOscillator(void);
#line 90
static error_t CC2420CsmaP$CC2420Power$rxOn(void);
#line 51
static error_t CC2420CsmaP$CC2420Power$startVReg(void);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420CsmaP$Resource$release(void);
#line 78
static error_t CC2420CsmaP$Resource$request(void);
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t CC2420CsmaP$AMPacket$address(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t CC2420CsmaP$sendDone_task$postTask(void);
#line 56
static error_t CC2420CsmaP$startDone_task$postTask(void);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
enum CC2420CsmaP$__nesc_unnamed4378 {
#line 77
CC2420CsmaP$startDone_task = 13U
};
#line 77
typedef int CC2420CsmaP$__nesc_sillytask_startDone_task[CC2420CsmaP$startDone_task];
enum CC2420CsmaP$__nesc_unnamed4379 {
#line 79
CC2420CsmaP$stopDone_task = 14U
};
#line 79
typedef int CC2420CsmaP$__nesc_sillytask_stopDone_task[CC2420CsmaP$stopDone_task];
enum CC2420CsmaP$__nesc_unnamed4380 {
#line 80
CC2420CsmaP$sendDone_task = 15U
};
#line 80
typedef int CC2420CsmaP$__nesc_sillytask_sendDone_task[CC2420CsmaP$sendDone_task];
#line 58
enum CC2420CsmaP$__nesc_unnamed4381 {
CC2420CsmaP$S_PREINIT,
CC2420CsmaP$S_STOPPED,
CC2420CsmaP$S_STARTING,
CC2420CsmaP$S_STARTED,
CC2420CsmaP$S_STOPPING,
CC2420CsmaP$S_TRANSMIT
};
message_t *CC2420CsmaP$m_msg;
uint8_t CC2420CsmaP$m_state = CC2420CsmaP$S_PREINIT;
error_t CC2420CsmaP$sendErr = SUCCESS;
bool CC2420CsmaP$ccaOn;
static inline error_t CC2420CsmaP$Init$init(void);
static inline error_t CC2420CsmaP$SplitControl$start(void);
#line 119
static inline error_t CC2420CsmaP$Send$send(message_t *p_msg, uint8_t len);
#line 195
static inline void CC2420CsmaP$CC2420Transmit$sendDone(message_t *p_msg, error_t err);
static inline void CC2420CsmaP$CC2420Power$startVRegDone(void);
static inline void CC2420CsmaP$Resource$granted(void);
static inline void CC2420CsmaP$CC2420Power$startOscillatorDone(void);
static void CC2420CsmaP$SubBackoff$requestInitialBackoff(message_t *msg);
static inline void CC2420CsmaP$SubBackoff$requestCongestionBackoff(message_t *msg);
static inline void CC2420CsmaP$SubBackoff$requestLplBackoff(message_t *msg);
#line 242
static inline void CC2420CsmaP$sendDone_task$runTask(void);
static inline void CC2420CsmaP$startDone_task$runTask(void);
static inline void CC2420CsmaP$stopDone_task$runTask(void);
#line 274
static inline void CC2420CsmaP$RadioBackoff$default$requestInitialBackoff(am_id_t amId,
message_t *msg);
static inline void CC2420CsmaP$RadioBackoff$default$requestCongestionBackoff(am_id_t amId,
message_t *msg);
static inline void CC2420CsmaP$RadioBackoff$default$requestLplBackoff(am_id_t amId,
message_t *msg);
static inline void CC2420CsmaP$RadioBackoff$default$requestCca(am_id_t amId,
message_t *msg);
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Config.nc"
static void CC2420ControlP$CC2420Config$syncDone(error_t arg_0x7e326b98);
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420ControlP$RXCTRL1$write(uint16_t arg_0x7e30ca10);
# 55 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void CC2420ControlP$StartupTimer$start(CC2420ControlP$StartupTimer$size_type arg_0x7e9d48c8);
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420ControlP$MDMCTRL0$write(uint16_t arg_0x7e30ca10);
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420ControlP$RSTN$makeOutput(void);
#line 29
static void CC2420ControlP$RSTN$set(void);
static void CC2420ControlP$RSTN$clr(void);
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
static void CC2420ControlP$ReadRssi$readDone(error_t arg_0x7eaf5668, CC2420ControlP$ReadRssi$val_t arg_0x7eaf57f0);
# 47 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420ControlP$RSSI$read(uint16_t *arg_0x7e30c4a0);
static cc2420_status_t CC2420ControlP$IOCFG0$write(uint16_t arg_0x7e30ca10);
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420ControlP$CSN$makeOutput(void);
#line 29
static void CC2420ControlP$CSN$set(void);
static void CC2420ControlP$CSN$clr(void);
static void CC2420ControlP$VREN$makeOutput(void);
#line 29
static void CC2420ControlP$VREN$set(void);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420ControlP$SXOSCON$strobe(void);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420ControlP$SpiResource$release(void);
#line 78
static error_t CC2420ControlP$SpiResource$request(void);
#line 110
static error_t CC2420ControlP$SyncResource$release(void);
# 76 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
static void CC2420ControlP$CC2420Power$startOscillatorDone(void);
#line 56
static void CC2420ControlP$CC2420Power$startVRegDone(void);
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420ControlP$IOCFG1$write(uint16_t arg_0x7e30ca10);
#line 55
static cc2420_status_t CC2420ControlP$FSCTRL$write(uint16_t arg_0x7e30ca10);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420ControlP$SRXON$strobe(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void CC2420ControlP$Resource$granted(void);
# 63 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Ram.nc"
static cc2420_status_t CC2420ControlP$PANID$write(uint8_t arg_0x7e30f388, uint8_t *arg_0x7e30f530, uint8_t arg_0x7e30f6b8);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t CC2420ControlP$syncDone_task$postTask(void);
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static error_t CC2420ControlP$InterruptCCA$disable(void);
#line 42
static error_t CC2420ControlP$InterruptCCA$enableRisingEdge(void);
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t CC2420ControlP$AMPacket$address(void);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420ControlP$RssiResource$release(void);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420ControlP$SRFOFF$strobe(void);
# 99 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
enum CC2420ControlP$__nesc_unnamed4382 {
#line 99
CC2420ControlP$syncDone_task = 16U
};
#line 99
typedef int CC2420ControlP$__nesc_sillytask_syncDone_task[CC2420ControlP$syncDone_task];
#line 84
#line 78
typedef enum CC2420ControlP$__nesc_unnamed4383 {
CC2420ControlP$S_VREG_STOPPED,
CC2420ControlP$S_VREG_STARTING,
CC2420ControlP$S_VREG_STARTED,
CC2420ControlP$S_XOSC_STARTING,
CC2420ControlP$S_XOSC_STARTED
} CC2420ControlP$cc2420_control_state_t;
uint8_t CC2420ControlP$m_channel = 26;
uint16_t CC2420ControlP$m_pan = TOS_AM_GROUP;
uint16_t CC2420ControlP$m_short_addr;
bool CC2420ControlP$m_sync_busy;
CC2420ControlP$cc2420_control_state_t CC2420ControlP$m_state = CC2420ControlP$S_VREG_STOPPED;
static inline error_t CC2420ControlP$Init$init(void);
#line 119
static inline error_t CC2420ControlP$Resource$request(void);
static inline error_t CC2420ControlP$Resource$release(void);
static inline error_t CC2420ControlP$CC2420Power$startVReg(void);
#line 155
static inline error_t CC2420ControlP$CC2420Power$startOscillator(void);
#line 210
static inline error_t CC2420ControlP$CC2420Power$rxOn(void);
#line 278
static inline void CC2420ControlP$SyncResource$granted(void);
#line 304
static inline void CC2420ControlP$SpiResource$granted(void);
static inline void CC2420ControlP$RssiResource$granted(void);
#line 322
static inline void CC2420ControlP$StartupTimer$fired(void);
static inline void CC2420ControlP$InterruptCCA$fired(void);
#line 346
static inline void CC2420ControlP$syncDone_task$runTask(void);
static inline void CC2420ControlP$CC2420Config$default$syncDone(error_t error);
static inline void CC2420ControlP$ReadRssi$default$readDone(error_t error, uint16_t data);
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
static Atm128_TIFR_t HplAtm128Timer1P$Timer0Ctrl$getInterruptFlag(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer1P$CompareA$fired(void);
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void HplAtm128Timer1P$Capture$captured(HplAtm128Timer1P$Capture$size_type arg_0x7e55c120);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void HplAtm128Timer1P$CompareB$fired(void);
#line 49
static void HplAtm128Timer1P$CompareC$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void HplAtm128Timer1P$Timer$overflow(void);
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline uint16_t HplAtm128Timer1P$Timer$get(void);
static inline void HplAtm128Timer1P$Timer$set(uint16_t t);
static inline void HplAtm128Timer1P$Timer$setScale(uint8_t s);
static inline Atm128TimerCtrlCapture_t HplAtm128Timer1P$TimerCtrl$getCtrlCapture(void);
static inline uint16_t HplAtm128Timer1P$TimerCtrlCapture2int(Atm128TimerCtrlCapture_t x);
static inline void HplAtm128Timer1P$TimerCtrl$setCtrlCapture(Atm128_TCCR1B_t x);
#line 122
static inline void HplAtm128Timer1P$Capture$setEdge(bool up);
static inline void HplAtm128Timer1P$Capture$reset(void);
static inline void HplAtm128Timer1P$CompareA$reset(void);
static inline void HplAtm128Timer1P$Timer$start(void);
static inline void HplAtm128Timer1P$Capture$start(void);
static inline void HplAtm128Timer1P$CompareA$start(void);
static inline void HplAtm128Timer1P$Capture$stop(void);
static inline void HplAtm128Timer1P$CompareA$stop(void);
static inline bool HplAtm128Timer1P$Timer$test(void);
#line 183
static inline void HplAtm128Timer1P$CompareA$set(uint16_t t);
#line 195
void __vector_12(void) __attribute((interrupt)) ;
static inline void HplAtm128Timer1P$CompareB$default$fired(void);
void __vector_13(void) __attribute((interrupt)) ;
static inline void HplAtm128Timer1P$CompareC$default$fired(void);
void __vector_24(void) __attribute((interrupt)) ;
void __vector_11(void) __attribute((interrupt)) ;
void __vector_14(void) __attribute((interrupt)) ;
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$fired(void);
# 53 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset(void);
#line 45
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type arg_0x7e981c38);
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start(void);
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop(void);
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get(void);
# 65 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$stop(void);
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size t0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size dt);
#line 110
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void);
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void);
# 95 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$setScale(uint8_t arg_0x7e9930f8);
#line 58
static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$set(/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$timer_size arg_0x7e9953c0);
static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$start(void);
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline error_t /*InitOneP.InitOne*/Atm128TimerInitC$1$Init$init(void);
static inline void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$overflow(void);
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static void /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$overflow(void);
# 78 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
static bool /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$test(void);
#line 52
static /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$get(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline /*CounterOne16C.NCounter*/Atm128CounterC$1$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$get(void);
static inline bool /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$isOverflowPending(void);
static inline void /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$overflow(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$get(void);
static bool /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$isOverflowPending(void);
static void /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$overflow(void);
# 56 "/opt/tinyos-2.x/tos/lib/timer/TransformCounterC.nc"
/*Counter32khz32C.Transform32*/TransformCounterC$1$upper_count_type /*Counter32khz32C.Transform32*/TransformCounterC$1$m_upper;
enum /*Counter32khz32C.Transform32*/TransformCounterC$1$__nesc_unnamed4384 {
TransformCounterC$1$LOW_SHIFT_RIGHT = 0,
TransformCounterC$1$HIGH_SHIFT_LEFT = 8 * sizeof(/*Counter32khz32C.Transform32*/TransformCounterC$1$from_size_type ) - /*Counter32khz32C.Transform32*/TransformCounterC$1$LOW_SHIFT_RIGHT,
TransformCounterC$1$NUM_UPPER_BITS = 8 * sizeof(/*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type ) - 8 * sizeof(/*Counter32khz32C.Transform32*/TransformCounterC$1$from_size_type ) + 0,
TransformCounterC$1$OVERFLOW_MASK = /*Counter32khz32C.Transform32*/TransformCounterC$1$NUM_UPPER_BITS ? ((/*Counter32khz32C.Transform32*/TransformCounterC$1$upper_count_type )2 << (/*Counter32khz32C.Transform32*/TransformCounterC$1$NUM_UPPER_BITS - 1)) - 1 : 0
};
static /*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$get(void);
#line 122
static inline void /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$overflow(void);
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$fired(void);
#line 92
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$size_type arg_0x7e9d39e0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$size_type arg_0x7e9d3b70);
#line 62
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$stop(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
static /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$get(void);
# 66 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0;
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt;
enum /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$__nesc_unnamed4385 {
TransformAlarmC$0$MAX_DELAY_LOG2 = 8 * sizeof(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_size_type ) - 1 - 0,
TransformAlarmC$0$MAX_DELAY = (/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type )1 << /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$MAX_DELAY_LOG2
};
static inline /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$getNow(void);
#line 91
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$stop(void);
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$set_alarm(void);
#line 136
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type t0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type dt);
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$start(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type dt);
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$fired(void);
#line 166
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$overflow(void);
# 22 "/opt/tinyos-2.x/tos/system/NoInitC.nc"
static inline error_t NoInitC$Init$init(void);
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captured(uint16_t arg_0x7e124ab8);
# 79 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$setEdge(bool arg_0x7e55b710);
#line 55
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$reset(void);
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$start(void);
static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$stop(void);
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128GpioCaptureC.nc"
static error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$enableCapture(uint8_t mode);
static inline error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureRisingEdge(void);
static inline error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureFallingEdge(void);
static inline void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$captured(uint16_t time);
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$clear(void);
#line 40
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$disable(void);
#line 59
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$edge(bool arg_0x7e0f14c8);
#line 35
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$enable(void);
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$fired(void);
# 15 "/opt/tinyos-2.x/tos/chips/atm128/pins/Atm128GpioInterruptC.nc"
static inline error_t /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$enable(bool rising);
#line 29
static inline error_t /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$enableFallingEdge(void);
static inline void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
static void HplAtm128InterruptSigP$IntSig6$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig1$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig4$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig7$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig2$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig5$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig0$fired(void);
#line 41
static void HplAtm128InterruptSigP$IntSig3$fired(void);
# 46 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSigP.nc"
void __vector_1(void) __attribute((signal)) ;
void __vector_2(void) __attribute((signal)) ;
void __vector_3(void) __attribute((signal)) ;
void __vector_4(void) __attribute((signal)) ;
void __vector_5(void) __attribute((signal)) ;
void __vector_6(void) __attribute((signal)) ;
void __vector_7(void) __attribute((signal)) ;
void __vector_8(void) __attribute((signal)) ;
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$fired(void);
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$clear(void);
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$enable(void);
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$disable(void);
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$edge(bool low_to_high);
#line 61
static inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$IrqSignal$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$default$fired(void);
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
static void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$fired(void);
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$IrqSignal$fired(void);
static inline void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$default$fired(void);
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void HplCC2420InterruptsP$CCATimer$startPeriodic(uint32_t arg_0x7eb13ce0);
static void HplCC2420InterruptsP$CCATimer$startOneShot(uint32_t arg_0x7eb11338);
static void HplCC2420InterruptsP$CCATimer$stop(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t HplCC2420InterruptsP$stopTask$postTask(void);
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static bool HplCC2420InterruptsP$CC_CCA$get(void);
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static void HplCC2420InterruptsP$CCA$fired(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t HplCC2420InterruptsP$CCATask$postTask(void);
# 97 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
enum HplCC2420InterruptsP$__nesc_unnamed4386 {
#line 97
HplCC2420InterruptsP$CCATask = 17U
};
#line 97
typedef int HplCC2420InterruptsP$__nesc_sillytask_CCATask[HplCC2420InterruptsP$CCATask];
#line 123
enum HplCC2420InterruptsP$__nesc_unnamed4387 {
#line 123
HplCC2420InterruptsP$stopTask = 18U
};
#line 123
typedef int HplCC2420InterruptsP$__nesc_sillytask_stopTask[HplCC2420InterruptsP$stopTask];
#line 77
uint8_t HplCC2420InterruptsP$ccaWaitForState;
uint8_t HplCC2420InterruptsP$ccaLastState;
bool HplCC2420InterruptsP$ccaTimerDisabled = FALSE;
static inline void HplCC2420InterruptsP$Boot$booted(void);
static inline void HplCC2420InterruptsP$CCATask$runTask(void);
static inline error_t HplCC2420InterruptsP$CCA$enableRisingEdge(void);
#line 123
static inline void HplCC2420InterruptsP$stopTask$runTask(void);
static inline error_t HplCC2420InterruptsP$CCA$disable(void);
static inline void HplCC2420InterruptsP$CCATimer$fired(void);
# 59 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
static error_t CC2420SpiImplP$SpiPacket$send(uint8_t *arg_0x7e0157f0, uint8_t *arg_0x7e015998, uint16_t arg_0x7e015b28);
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static void CC2420SpiImplP$Fifo$writeDone(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e0364c8, uint8_t arg_0x7e036650, error_t arg_0x7e0367d8);
#line 71
static void CC2420SpiImplP$Fifo$readDone(
# 40 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01e068,
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
uint8_t *arg_0x7e0383f0, uint8_t arg_0x7e038578, error_t arg_0x7e038700);
# 34 "/opt/tinyos-2.x/tos/interfaces/SpiByte.nc"
static uint8_t CC2420SpiImplP$SpiByte$write(uint8_t arg_0x7e018088);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420SpiImplP$SpiResource$release(void);
#line 87
static error_t CC2420SpiImplP$SpiResource$immediateRequest(void);
#line 78
static error_t CC2420SpiImplP$SpiResource$request(void);
#line 92
static void CC2420SpiImplP$Resource$granted(
# 39 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
uint8_t arg_0x7e01f6b8);
#line 54
enum CC2420SpiImplP$__nesc_unnamed4388 {
CC2420SpiImplP$RESOURCE_COUNT = 5U,
CC2420SpiImplP$NO_HOLDER = 0xff
};
uint16_t CC2420SpiImplP$m_addr;
bool CC2420SpiImplP$m_resource_busy = FALSE;
uint8_t CC2420SpiImplP$m_requests = 0;
uint8_t CC2420SpiImplP$m_holder = CC2420SpiImplP$NO_HOLDER;
static inline void CC2420SpiImplP$Resource$default$granted(uint8_t id);
static error_t CC2420SpiImplP$Resource$request(uint8_t id);
#line 80
static error_t CC2420SpiImplP$Resource$immediateRequest(uint8_t id);
#line 94
static error_t CC2420SpiImplP$Resource$release(uint8_t id);
#line 127
static inline void CC2420SpiImplP$SpiResource$granted(void);
static inline cc2420_status_t CC2420SpiImplP$Fifo$beginRead(uint8_t addr, uint8_t *data,
uint8_t len);
#line 153
static inline error_t CC2420SpiImplP$Fifo$continueRead(uint8_t addr, uint8_t *data,
uint8_t len);
static inline cc2420_status_t CC2420SpiImplP$Fifo$write(uint8_t addr, uint8_t *data,
uint8_t len);
#line 202
static void CC2420SpiImplP$SpiPacket$sendDone(uint8_t *tx_buf, uint8_t *rx_buf,
uint16_t len, error_t error);
static cc2420_status_t CC2420SpiImplP$Ram$write(uint16_t addr, uint8_t offset,
uint8_t *data,
uint8_t len);
#line 233
static inline cc2420_status_t CC2420SpiImplP$Reg$read(uint8_t addr, uint16_t *data);
#line 251
static cc2420_status_t CC2420SpiImplP$Reg$write(uint8_t addr, uint16_t data);
#line 264
static cc2420_status_t CC2420SpiImplP$Strobe$strobe(uint8_t addr);
static inline void CC2420SpiImplP$Fifo$default$readDone(uint8_t addr, uint8_t *rx_buf, uint8_t rx_len, error_t error);
static inline void CC2420SpiImplP$Fifo$default$writeDone(uint8_t addr, uint8_t *tx_buf, uint8_t tx_len, error_t error);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t Atm128SpiP$zeroTask$postTask(void);
# 71 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
static void Atm128SpiP$SpiPacket$sendDone(uint8_t *arg_0x7e014290, uint8_t *arg_0x7e014438, uint16_t arg_0x7e0145c8,
error_t arg_0x7e014760);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$ResourceArbiter$release(
# 84 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfb9bf0);
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$ResourceArbiter$immediateRequest(
# 84 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfb9bf0);
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t Atm128SpiP$ResourceArbiter$request(
# 84 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfb9bf0);
# 72 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
static void Atm128SpiP$Spi$sleep(void);
#line 66
static void Atm128SpiP$Spi$initMaster(void);
#line 96
static void Atm128SpiP$Spi$enableInterrupt(bool arg_0x7dfb2da0);
#line 80
static uint8_t Atm128SpiP$Spi$read(void);
#line 125
static void Atm128SpiP$Spi$setMasterDoubleSpeed(bool arg_0x7dfa0ee0);
#line 114
static void Atm128SpiP$Spi$setClock(uint8_t arg_0x7dfa2d70);
#line 108
static void Atm128SpiP$Spi$setClockPolarity(bool arg_0x7dfa3da0);
#line 86
static void Atm128SpiP$Spi$write(uint8_t arg_0x7dfb2348);
#line 99
static void Atm128SpiP$Spi$enableSpi(bool arg_0x7dfb1598);
#line 111
static void Atm128SpiP$Spi$setClockPhase(bool arg_0x7dfa25a8);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void Atm128SpiP$Resource$granted(
# 80 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
uint8_t arg_0x7dfbca68);
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
static void Atm128SpiP$McuPowerState$update(void);
# 80 "/opt/tinyos-2.x/tos/interfaces/ArbiterInfo.nc"
static bool Atm128SpiP$ArbiterInfo$inUse(void);
# 207 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
enum Atm128SpiP$__nesc_unnamed4389 {
#line 207
Atm128SpiP$zeroTask = 19U
};
#line 207
typedef int Atm128SpiP$__nesc_sillytask_zeroTask[Atm128SpiP$zeroTask];
#line 90
uint8_t *Atm128SpiP$txBuffer;
uint8_t *Atm128SpiP$rxBuffer;
uint16_t Atm128SpiP$len;
uint16_t Atm128SpiP$pos;
enum Atm128SpiP$__nesc_unnamed4390 {
Atm128SpiP$SPI_IDLE,
Atm128SpiP$SPI_BUSY,
Atm128SpiP$SPI_ATOMIC_SIZE = 10
};
bool Atm128SpiP$started;
static void Atm128SpiP$startSpi(void);
#line 120
static inline void Atm128SpiP$stopSpi(void);
static uint8_t Atm128SpiP$SpiByte$write(uint8_t tx);
#line 164
static error_t Atm128SpiP$sendNextPart(void);
#line 207
static inline void Atm128SpiP$zeroTask$runTask(void);
#line 240
static error_t Atm128SpiP$SpiPacket$send(uint8_t *writeBuf,
uint8_t *readBuf,
uint16_t bufLen);
#line 264
static inline void Atm128SpiP$Spi$dataReady(uint8_t data);
#line 304
static inline error_t Atm128SpiP$Resource$immediateRequest(uint8_t id);
static error_t Atm128SpiP$Resource$request(uint8_t id);
static inline error_t Atm128SpiP$Resource$release(uint8_t id);
#line 335
static inline void Atm128SpiP$ResourceArbiter$granted(uint8_t id);
static inline void Atm128SpiP$Resource$default$granted(uint8_t id);
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void HplAtm128SpiP$MISO$makeInput(void);
static void HplAtm128SpiP$SCK$makeOutput(void);
#line 35
static void HplAtm128SpiP$SS$makeOutput(void);
#line 29
static void HplAtm128SpiP$SS$set(void);
static void HplAtm128SpiP$SS$clr(void);
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
static void HplAtm128SpiP$Mcu$update(void);
# 92 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
static void HplAtm128SpiP$SPI$dataReady(uint8_t arg_0x7dfb2858);
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void HplAtm128SpiP$MOSI$makeOutput(void);
# 79 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$initMaster(void);
#line 95
static inline void HplAtm128SpiP$SPI$sleep(void);
static inline uint8_t HplAtm128SpiP$SPI$read(void);
static inline void HplAtm128SpiP$SPI$write(uint8_t d);
void __vector_17(void) __attribute((signal)) ;
#line 116
static void HplAtm128SpiP$SPI$enableInterrupt(bool enabled);
#line 131
static void HplAtm128SpiP$SPI$enableSpi(bool enabled);
#line 157
static inline void HplAtm128SpiP$SPI$setMasterBit(bool isMaster);
#line 170
static inline void HplAtm128SpiP$SPI$setClockPolarity(bool highWhenIdle);
#line 184
static inline void HplAtm128SpiP$SPI$setClockPhase(bool sampleOnTrailing);
#line 201
static inline void HplAtm128SpiP$SPI$setClock(uint8_t v);
#line 214
static inline void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool on);
# 39 "/opt/tinyos-2.x/tos/system/FcfsResourceQueueC.nc"
enum /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$__nesc_unnamed4391 {
#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 72
static inline error_t /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(resource_client_id_t id);
# 43 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$requested(
# 52 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee23e8);
# 51 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$immediateRequested(
# 52 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee23e8);
# 55 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(
# 56 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee2ed0);
# 49 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(
# 56 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee2ed0);
# 69 "/opt/tinyos-2.x/tos/interfaces/ResourceQueue.nc"
static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(resource_client_id_t arg_0x7def8010);
#line 43
static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$isEmpty(void);
#line 60
static resource_client_id_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$dequeue(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$granted(
# 51 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
uint8_t arg_0x7dee3a00);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$postTask(void);
# 69 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4392 {
#line 69
SimpleArbiterP$0$grantedTask = 20U
};
#line 69
typedef int /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_sillytask_grantedTask[/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask];
#line 62
enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4393 {
#line 62
SimpleArbiterP$0$RES_IDLE = 0, SimpleArbiterP$0$RES_GRANTING = 1, SimpleArbiterP$0$RES_BUSY = 2
};
#line 63
enum /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$__nesc_unnamed4394 {
#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 84
static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(uint8_t id);
#line 97
static inline error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(uint8_t id);
#line 123
static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void);
#line 150
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask(void);
#line 162
static 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);
# 72 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
static void CC2420TransmitP$RadioBackoff$requestInitialBackoff(message_t *arg_0x7e4420a8);
static void CC2420TransmitP$RadioBackoff$requestCongestionBackoff(message_t *arg_0x7e442660);
static void CC2420TransmitP$RadioBackoff$requestLplBackoff(message_t *arg_0x7e442c18);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420TransmitP$STXONCCA$strobe(void);
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
static error_t CC2420TransmitP$CaptureSFD$captureFallingEdge(void);
#line 42
static error_t CC2420TransmitP$CaptureSFD$captureRisingEdge(void);
# 55 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
static void CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$BackoffTimer$size_type arg_0x7e9d48c8);
static void CC2420TransmitP$BackoffTimer$stop(void);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *CC2420TransmitP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
static cc2420_metadata_t *CC2420TransmitP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0);
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420TransmitP$TXCTRL$write(uint16_t arg_0x7e30ca10);
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
static void CC2420TransmitP$CC2420Receive$sfd_dropped(void);
#line 47
static void CC2420TransmitP$CC2420Receive$sfd(uint16_t arg_0x7de52aa8);
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
static void CC2420TransmitP$Send$sendDone(message_t *arg_0x7e35dd90, error_t arg_0x7e35df18);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420TransmitP$SFLUSHTX$strobe(void);
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420TransmitP$CSN$makeOutput(void);
#line 29
static void CC2420TransmitP$CSN$set(void);
static void CC2420TransmitP$CSN$clr(void);
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
static cc2420_status_t CC2420TransmitP$MDMCTRL1$write(uint16_t arg_0x7e30ca10);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t CC2420TransmitP$startLplTimer$postTask(void);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420TransmitP$SpiResource$release(void);
#line 87
static error_t CC2420TransmitP$SpiResource$immediateRequest(void);
#line 78
static error_t CC2420TransmitP$SpiResource$request(void);
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420TransmitP$CCA$makeInput(void);
#line 32
static bool CC2420TransmitP$CCA$get(void);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420TransmitP$SNOP$strobe(void);
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420TransmitP$SFD$makeInput(void);
#line 32
static bool CC2420TransmitP$SFD$get(void);
# 39 "/opt/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc"
static void CC2420TransmitP$TimeStamp$transmittedSFD(uint16_t arg_0x7de73460, message_t *arg_0x7de73610);
static void CC2420TransmitP$TimeStamp$receivedSFD(uint16_t arg_0x7de73b40);
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static cc2420_status_t CC2420TransmitP$TXFIFO$write(uint8_t *arg_0x7e038cc8, uint8_t arg_0x7e038e50);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420TransmitP$STXON$strobe(void);
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void CC2420TransmitP$LplDisableTimer$startOneShot(uint32_t arg_0x7eb11338);
# 137 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
enum CC2420TransmitP$__nesc_unnamed4395 {
#line 137
CC2420TransmitP$startLplTimer = 21U
};
#line 137
typedef int CC2420TransmitP$__nesc_sillytask_startLplTimer[CC2420TransmitP$startLplTimer];
#line 87
#line 75
typedef enum CC2420TransmitP$__nesc_unnamed4396 {
CC2420TransmitP$S_STOPPED,
CC2420TransmitP$S_STARTED,
CC2420TransmitP$S_LOAD,
CC2420TransmitP$S_SAMPLE_CCA,
CC2420TransmitP$S_BEGIN_TRANSMIT,
CC2420TransmitP$S_SFD,
CC2420TransmitP$S_EFD,
CC2420TransmitP$S_ACK_WAIT,
CC2420TransmitP$S_LOAD_CANCEL,
CC2420TransmitP$S_TX_CANCEL,
CC2420TransmitP$S_CCA_CANCEL
} CC2420TransmitP$cc2420_transmit_state_t;
enum CC2420TransmitP$__nesc_unnamed4397 {
CC2420TransmitP$CC2420_ABORT_PERIOD = 320
};
message_t *CC2420TransmitP$m_msg;
bool CC2420TransmitP$m_cca;
uint8_t CC2420TransmitP$m_tx_power;
CC2420TransmitP$cc2420_transmit_state_t CC2420TransmitP$m_state = CC2420TransmitP$S_STOPPED;
bool CC2420TransmitP$m_receiving = FALSE;
uint16_t CC2420TransmitP$m_prev_time;
bool CC2420TransmitP$signalSendDone;
bool CC2420TransmitP$continuousModulation;
int8_t CC2420TransmitP$totalCcaChecks;
uint16_t CC2420TransmitP$myInitialBackoff;
uint16_t CC2420TransmitP$myCongestionBackoff;
uint16_t CC2420TransmitP$myLplBackoff;
static inline error_t CC2420TransmitP$send(message_t *p_msg, bool cca);
static void CC2420TransmitP$loadTXFIFO(void);
static void CC2420TransmitP$attemptSend(void);
static void CC2420TransmitP$congestionBackoff(void);
static error_t CC2420TransmitP$acquireSpiResource(void);
static inline error_t CC2420TransmitP$releaseSpiResource(void);
static void CC2420TransmitP$signalDone(error_t err);
static inline error_t CC2420TransmitP$Init$init(void);
static inline error_t CC2420TransmitP$StdControl$start(void);
#line 170
static inline error_t CC2420TransmitP$Send$send(message_t *p_msg, bool useCca);
#line 216
static inline void CC2420TransmitP$RadioBackoff$setInitialBackoff(uint16_t backoffTime);
static inline void CC2420TransmitP$RadioBackoff$setCongestionBackoff(uint16_t backoffTime);
static inline void CC2420TransmitP$RadioBackoff$setLplBackoff(uint16_t backoffTime);
#line 263
static inline void CC2420TransmitP$CaptureSFD$captured(uint16_t time);
#line 332
static inline void CC2420TransmitP$CC2420Receive$receive(uint8_t type, message_t *ack_msg);
#line 358
static inline void CC2420TransmitP$SpiResource$granted(void);
#line 401
static inline void CC2420TransmitP$TXFIFO$writeDone(uint8_t *tx_buf, uint8_t tx_len,
error_t error);
#line 444
static inline void CC2420TransmitP$TXFIFO$readDone(uint8_t *tx_buf, uint8_t tx_len,
error_t error);
static inline void CC2420TransmitP$BackoffTimer$fired(void);
#line 502
static inline void CC2420TransmitP$LplDisableTimer$fired(void);
#line 514
static inline error_t CC2420TransmitP$send(message_t *p_msg, bool cca);
#line 592
static void CC2420TransmitP$attemptSend(void);
#line 685
static void CC2420TransmitP$congestionBackoff(void);
#line 698
static error_t CC2420TransmitP$acquireSpiResource(void);
static inline error_t CC2420TransmitP$releaseSpiResource(void);
#line 728
static void CC2420TransmitP$loadTXFIFO(void);
#line 754
static void CC2420TransmitP$signalDone(error_t err);
static inline void CC2420TransmitP$startLplTimer$runTask(void);
static inline void CC2420TransmitP$TimeStamp$default$transmittedSFD(uint16_t time, message_t *p_msg);
static inline void CC2420TransmitP$TimeStamp$default$receivedSFD(uint16_t time);
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static bool CC2420ReceiveP$FIFO$get(void);
# 58 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static am_addr_t CC2420ReceiveP$amAddress(void);
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static bool CC2420ReceiveP$FIFOP$get(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t CC2420ReceiveP$receiveDone_task$postTask(void);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *CC2420ReceiveP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
static cc2420_metadata_t *CC2420ReceiveP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0);
# 61 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
static void CC2420ReceiveP$CC2420Receive$receive(uint8_t arg_0x7de51408, message_t *arg_0x7de515b8);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420ReceiveP$SACK$strobe(void);
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
static void CC2420ReceiveP$CSN$set(void);
static void CC2420ReceiveP$CSN$clr(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *CC2420ReceiveP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
static error_t CC2420ReceiveP$SpiResource$release(void);
#line 87
static error_t CC2420ReceiveP$SpiResource$immediateRequest(void);
#line 78
static error_t CC2420ReceiveP$SpiResource$request(void);
# 62 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
static error_t CC2420ReceiveP$RXFIFO$continueRead(uint8_t *arg_0x7e039bf0, uint8_t arg_0x7e039d78);
#line 51
static cc2420_status_t CC2420ReceiveP$RXFIFO$beginRead(uint8_t *arg_0x7e039458, uint8_t arg_0x7e0395e0);
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
static error_t CC2420ReceiveP$InterruptFIFOP$enableFallingEdge(void);
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
static cc2420_status_t CC2420ReceiveP$SFLUSHRX$strobe(void);
# 100 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
enum CC2420ReceiveP$__nesc_unnamed4398 {
#line 100
CC2420ReceiveP$receiveDone_task = 22U
};
#line 100
typedef int CC2420ReceiveP$__nesc_sillytask_receiveDone_task[CC2420ReceiveP$receiveDone_task];
#line 68
#line 63
typedef enum CC2420ReceiveP$__nesc_unnamed4399 {
CC2420ReceiveP$S_STOPPED,
CC2420ReceiveP$S_STARTED,
CC2420ReceiveP$S_RX_HEADER,
CC2420ReceiveP$S_RX_PAYLOAD
} CC2420ReceiveP$cc2420_receive_state_t;
enum CC2420ReceiveP$__nesc_unnamed4400 {
CC2420ReceiveP$RXFIFO_SIZE = 128,
CC2420ReceiveP$TIMESTAMP_QUEUE_SIZE = 8
};
uint16_t CC2420ReceiveP$m_timestamp_queue[CC2420ReceiveP$TIMESTAMP_QUEUE_SIZE];
uint8_t CC2420ReceiveP$m_timestamp_head;
uint8_t CC2420ReceiveP$m_timestamp_size;
uint8_t CC2420ReceiveP$m_missed_packets;
bool CC2420ReceiveP$fallingEdgeEnabled;
uint8_t CC2420ReceiveP$m_bytes_left;
message_t *CC2420ReceiveP$m_p_rx_buf;
message_t CC2420ReceiveP$m_rx_buf;
CC2420ReceiveP$cc2420_receive_state_t CC2420ReceiveP$m_state;
static void CC2420ReceiveP$reset_state(void);
static void CC2420ReceiveP$beginReceive(void);
static void CC2420ReceiveP$receive(void);
static void CC2420ReceiveP$waitForNextPacket(void);
static void CC2420ReceiveP$flush(void);
static inline error_t CC2420ReceiveP$Init$init(void);
static inline error_t CC2420ReceiveP$StdControl$start(void);
#line 157
static inline void CC2420ReceiveP$CC2420Receive$sfd(uint16_t time);
static inline void CC2420ReceiveP$CC2420Receive$sfd_dropped(void);
static inline void CC2420ReceiveP$InterruptFIFOP$fired(void);
static inline void CC2420ReceiveP$SpiResource$granted(void);
static inline void CC2420ReceiveP$RXFIFO$readDone(uint8_t *rx_buf, uint8_t rx_len,
error_t error);
#line 281
static inline void CC2420ReceiveP$RXFIFO$writeDone(uint8_t *tx_buf, uint8_t tx_len, error_t error);
static inline void CC2420ReceiveP$receiveDone_task$runTask(void);
#line 309
static void CC2420ReceiveP$beginReceive(void);
#line 322
static void CC2420ReceiveP$flush(void);
#line 339
static void CC2420ReceiveP$receive(void);
static void CC2420ReceiveP$waitForNextPacket(void);
#line 374
static void CC2420ReceiveP$reset_state(void);
# 50 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420PacketC.nc"
static inline cc2420_header_t *CC2420PacketC$CC2420Packet$getHeader(message_t *msg);
static inline cc2420_metadata_t *CC2420PacketC$CC2420Packet$getMetadata(message_t *msg);
static inline error_t CC2420PacketC$Acks$requestAck(message_t *p_msg);
static inline bool CC2420PacketC$Acks$wasAcked(message_t *p_msg);
# 46 "/opt/tinyos-2.x/tos/system/ActiveMessageAddressC.nc"
am_addr_t ActiveMessageAddressC$addr = TOS_AM_ADDRESS;
static inline am_addr_t ActiveMessageAddressC$amAddress(void);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t UniqueSendP$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *UniqueSendP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void UniqueSendP$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t UniqueSendP$Random$rand16(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/State.nc"
static void UniqueSendP$State: Exp $toIdle(void);
#line 45
static error_t UniqueSendP$State: Exp $requestState(uint8_t arg_0x7dd3b6f0);
# 54 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueSendP.nc"
uint8_t UniqueSendP$localSendId;
enum UniqueSendP$__nesc_unnamed4401 {
UniqueSendP$S_IDLE,
UniqueSendP$S_SENDING
};
static inline error_t UniqueSendP$Init$init(void);
#line 75
static inline error_t UniqueSendP$Send$send(message_t *msg, uint8_t len);
#line 104
static inline void UniqueSendP$SubSend$sendDone(message_t *msg, error_t error);
# 74 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
uint8_t StateImplP$state[2U];
enum StateImplP$__nesc_unnamed4402 {
StateImplP$S_IDLE = 0
};
static inline error_t StateImplP$Init$init(void);
#line 96
static inline error_t StateImplP$State: Exp $requestState(uint8_t id, uint8_t reqState);
#line 118
static inline void StateImplP$State: Exp $toIdle(uint8_t id);
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
static cc2420_header_t *UniqueReceiveP$CC2420Packet$getHeader(message_t *arg_0x7e448670);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *UniqueReceiveP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
#line 67
static message_t *UniqueReceiveP$DuplicateReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 59 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueReceiveP.nc"
#line 56
struct UniqueReceiveP$__nesc_unnamed4403 {
am_addr_t source;
uint8_t dsn;
} UniqueReceiveP$receivedMessages[4];
uint8_t UniqueReceiveP$writeIndex = 0;
uint8_t UniqueReceiveP$recycleSourceElement;
enum UniqueReceiveP$__nesc_unnamed4404 {
UniqueReceiveP$INVALID_ELEMENT = 0xFF
};
static inline error_t UniqueReceiveP$Init$init(void);
static inline bool UniqueReceiveP$hasSeen(uint16_t msgSource, uint8_t msgDsn);
static inline void UniqueReceiveP$insert(uint16_t msgSource, uint8_t msgDsn);
#line 104
static inline message_t *UniqueReceiveP$SubReceive$receive(message_t *msg, void *payload,
uint8_t len);
#line 130
static inline bool UniqueReceiveP$hasSeen(uint16_t msgSource, uint8_t msgDsn);
#line 156
static inline void UniqueReceiveP$insert(uint16_t msgSource, uint8_t msgDsn);
#line 177
static inline message_t *UniqueReceiveP$DuplicateReceive$default$receive(message_t *msg, void *payload, uint8_t len);
# 54 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420LplDummyP.nc"
static inline void CC2420LplDummyP$LowPowerListening$setLocalDutyCycle(uint16_t dutyCycle);
# 43 "/opt/tinyos-2.x/tos/lib/net/RootControl.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$RootControl$isRoot(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 112
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$maxPayloadLength(void);
# 50 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(uint8_t arg_0x7dc74e50);
#line 62
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(uint8_t arg_0x7dc67338, uint16_t arg_0x7dc674c8, am_addr_t arg_0x7dc67658, am_addr_t arg_0x7dc677e8);
# 57 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txAck(am_addr_t arg_0x7dc7b138);
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txNoAck(am_addr_t arg_0x7dc7b5d0);
# 40 "/opt/tinyos-2.x/tos/interfaces/Cache.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$insert(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$t arg_0x7dc16088);
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$lookup(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$t arg_0x7dc165e0);
# 31 "/opt/tinyos-2.x/tos/interfaces/Intercept.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$forward(
# 136 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc545c0,
# 31 "/opt/tinyos-2.x/tos/interfaces/Intercept.nc"
message_t *arg_0x7dc9bdf0, void *arg_0x7dc9a010, uint16_t arg_0x7dc9a1a0);
# 81 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$isRunning(void);
#line 62
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$startOneShot(uint32_t arg_0x7eb11338);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$receive(
# 135 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc56e20,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Random$rand16(void);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$sendDone(
# 133 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc57c78,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 81 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$isRunning(void);
#line 62
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$startOneShot(uint32_t arg_0x7eb11338);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask(void);
# 73 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$head(void);
#line 90
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$enqueue(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t arg_0x7dc30d30);
static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$element(uint8_t arg_0x7dc2f330);
#line 65
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$maxSize(void);
#line 81
static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue(void);
#line 50
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$empty(void);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$size(void);
# 70 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$recomputeRoutes(void);
#line 58
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerRouteUpdate(void);
#line 51
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$getEtx(uint16_t *arg_0x7eb34478);
#line 65
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerImmediateRouteUpdate(void);
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$setNeighborCongested(am_addr_t arg_0x7eb324d8, bool arg_0x7eb32668);
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$isNeighborCongested(am_addr_t arg_0x7eb32b50);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 95
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$maxPayloadLength(void);
#line 83
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$receive(
# 134 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
collection_id_t arg_0x7dc56680,
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 49 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$hasRoute(void);
#line 48
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$nextHop(void);
# 48 "/opt/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc"
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$requestAck(message_t *arg_0x7e7b46d8);
#line 74
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$wasAcked(message_t *arg_0x7e7b3568);
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
static /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$t */*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$get(void);
#line 61
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$empty(void);
#line 88
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$put(/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$t *arg_0x7dc2ab50);
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$source(message_t *arg_0x7e7c0360);
#line 57
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$address(void);
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(message_t *arg_0x7e7c1cd8);
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
static /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$t */*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$get(void);
#line 80
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$maxSize(void);
#line 61
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$empty(void);
#line 88
static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$put(/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$t *arg_0x7dc2ab50);
#line 72
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$size(void);
# 46 "/opt/tinyos-2.x/tos/lib/net/CollectionId.nc"
static collection_id_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$fetch(
# 165 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
uint8_t arg_0x7dc157e8);
#line 259
enum /*CtpP.Forwarder*/CtpForwardingEngineP$0$__nesc_unnamed4405 {
#line 259
CtpForwardingEngineP$0$sendTask = 23U
};
#line 259
typedef int /*CtpP.Forwarder*/CtpForwardingEngineP$0$__nesc_sillytask_sendTask[/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask];
#line 175
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(uint16_t mask, uint16_t offset);
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startCongestionTimer(uint16_t mask, uint16_t offset);
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$clientCongested = FALSE;
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$parentCongested = FALSE;
uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$congestionThreshold;
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$running = FALSE;
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$radioOn = FALSE;
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$ackPending = FALSE;
bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = FALSE;
am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$lastParent;
uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$seqno;
enum /*CtpP.Forwarder*/CtpForwardingEngineP$0$__nesc_unnamed4406 {
CtpForwardingEngineP$0$CLIENT_COUNT = 1U
};
fe_queue_entry_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$clientEntries[/*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT];
fe_queue_entry_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[/*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT];
message_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsg;
message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr;
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Init$init(void);
#line 247
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$StdControl$start(void);
#line 264
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$startDone(error_t err);
#line 278
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$routeFound(void);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$noRoute(void);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$stopDone(error_t err);
static inline ctp_data_header_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(message_t *m);
#line 307
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$send(uint8_t client, message_t *msg, uint8_t len);
#line 357
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$maxPayloadLength(uint8_t client);
static inline void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$getPayload(uint8_t client, message_t *msg);
#line 382
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$runTask(void);
#line 525
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendDoneBug(void);
#line 541
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$sendDone(message_t *msg, error_t error);
#line 641
static inline message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$forward(message_t *m);
#line 728
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubReceive$receive(message_t *msg, void *payload, uint8_t len);
#line 811
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSnoop$receive(message_t *msg, void *payload, uint8_t len);
#line 827
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$fired(void);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$fired(void);
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpCongestion$isCongested(void);
#line 861
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(message_t *msg);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$setPayloadLength(message_t *msg, uint8_t len);
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$maxPayloadLength(void);
static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(message_t *msg, uint8_t *len);
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(message_t *msg);
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(message_t *msg);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(message_t *msg);
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(message_t *msg);
static inline uint16_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getEtx(message_t *msg);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(message_t *msg);
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(message_t *msg);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setThl(message_t *msg, uint8_t thl);
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$option(message_t *msg, ctp_options_t opt);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setOption(message_t *msg, ctp_options_t opt);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$clearOption(message_t *msg, ctp_options_t opt);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setEtx(message_t *msg, uint16_t e);
static inline bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$matchInstance(message_t *m1, message_t *m2);
#line 933
static inline
#line 932
void
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$default$sendDone(uint8_t client, message_t *msg, error_t error);
static inline
#line 936
bool
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$default$forward(collection_id_t collectid, message_t *msg, void *payload,
uint16_t len);
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$default$receive(collection_id_t collectid, message_t *msg, void *payload,
uint8_t len);
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$default$receive(collection_id_t collectid, message_t *msg, void *payload,
uint8_t len);
static inline collection_id_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$default$fetch(uint8_t client);
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(uint16_t mask, uint16_t offset);
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startCongestionTimer(uint16_t mask, uint16_t offset);
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$evicted(am_addr_t neighbor);
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEvent(uint8_t type);
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEventMsg(uint8_t type, uint16_t msg, am_addr_t origin, am_addr_t node);
# 60 "/opt/tinyos-2.x/tos/system/PoolP.nc"
uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$free;
uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$index;
/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t */*CtpP.MessagePoolP.PoolP*/PoolP$0$queue[12];
/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$pool[12];
static inline error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Init$init(void);
static inline bool /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$empty(void);
static inline uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$size(void);
static inline uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$maxSize(void);
static inline /*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t */*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$get(void);
#line 100
static error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$put(/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t *newVal);
#line 60
uint8_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$free;
uint8_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$index;
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t */*CtpP.QEntryPoolP.PoolP*/PoolP$1$queue[12];
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool[12];
static inline error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Init$init(void);
static inline bool /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$empty(void);
static inline /*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t */*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$get(void);
#line 100
static error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$put(/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t *newVal);
# 48 "/opt/tinyos-2.x/tos/system/QueueC.nc"
/*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$queue[13];
uint8_t /*CtpP.SendQueueP*/QueueC$0$head = 0;
uint8_t /*CtpP.SendQueueP*/QueueC$0$tail = 0;
uint8_t /*CtpP.SendQueueP*/QueueC$0$size = 0;
static inline bool /*CtpP.SendQueueP*/QueueC$0$Queue$empty(void);
static inline uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$size(void);
static inline uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$maxSize(void);
static inline /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$head(void);
static inline void /*CtpP.SendQueueP*/QueueC$0$printQueue(void);
#line 85
static /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$dequeue(void);
#line 97
static error_t /*CtpP.SendQueueP*/QueueC$0$Queue$enqueue(/*CtpP.SendQueueP*/QueueC$0$queue_t newVal);
#line 112
static inline /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$element(uint8_t idx);
# 59 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpPacket.nc"
static am_addr_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getOrigin(message_t *arg_0x7dc86c90);
#line 53
static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getThl(message_t *arg_0x7dc87658);
static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getSequenceNumber(message_t *arg_0x7dc857e8);
static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getType(message_t *arg_0x7dc83358);
# 58 "/opt/tinyos-2.x/tos/lib/net/ctp/LruCtpMsgCacheP.nc"
#line 53
typedef struct /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$__nesc_unnamed4407 {
am_addr_t origin;
uint8_t seqno;
collection_id_t type;
uint8_t thl;
} /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$ctp_packet_sig_t;
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$ctp_packet_sig_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[4];
uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first;
uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count;
static inline error_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Init$init(void);
#line 84
static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$lookup(message_t *m);
#line 100
static inline void /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$remove(uint8_t i);
#line 116
static inline void /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$insert(message_t *m);
#line 135
static inline bool /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$lookup(message_t *m);
# 67 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static void LinkEstimatorP$LinkEstimator$evicted(am_addr_t arg_0x7dc7bf00);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void LinkEstimatorP$Send$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
#line 69
static error_t LinkEstimatorP$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t LinkEstimatorP$SubPacket$payloadLength(message_t *arg_0x7e7c7ee0);
#line 108
static void *LinkEstimatorP$SubPacket$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500);
#line 95
static uint8_t LinkEstimatorP$SubPacket$maxPayloadLength(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static message_t *LinkEstimatorP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198);
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t LinkEstimatorP$SubAMPacket$source(message_t *arg_0x7e7c0360);
#line 57
static am_addr_t LinkEstimatorP$SubAMPacket$address(void);
static am_addr_t LinkEstimatorP$SubAMPacket$destination(message_t *arg_0x7e7c1cd8);
# 55 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
enum LinkEstimatorP$__nesc_unnamed4408 {
LinkEstimatorP$EVICT_EETX_THRESHOLD = 55,
LinkEstimatorP$MAX_AGE = 6,
LinkEstimatorP$MAX_PKT_GAP = 10,
LinkEstimatorP$BEST_EETX = 0,
LinkEstimatorP$INVALID_RVAL = 0xff,
LinkEstimatorP$INVALID_NEIGHBOR_ADDR = 0xff,
LinkEstimatorP$INFINITY = 0xff,
LinkEstimatorP$ALPHA = 2,
LinkEstimatorP$DLQ_PKT_WINDOW = 5,
LinkEstimatorP$BLQ_PKT_WINDOW = 3,
LinkEstimatorP$LARGE_EETX_VALUE = 60
};
neighbor_table_entry_t LinkEstimatorP$NeighborTable[10];
uint8_t LinkEstimatorP$linkEstSeq = 0;
uint8_t LinkEstimatorP$prevSentIdx = 0;
static inline linkest_header_t *LinkEstimatorP$getHeader(message_t *m);
static inline linkest_footer_t *LinkEstimatorP$getFooter(message_t *m, uint8_t len);
static inline uint8_t LinkEstimatorP$addLinkEstHeaderAndFooter(message_t *msg, uint8_t len);
#line 150
static void LinkEstimatorP$initNeighborIdx(uint8_t i, am_addr_t ll_addr);
#line 166
static uint8_t LinkEstimatorP$findIdx(am_addr_t ll_addr);
#line 179
static uint8_t LinkEstimatorP$findEmptyNeighborIdx(void);
#line 192
static uint8_t LinkEstimatorP$findWorstNeighborIdx(uint8_t thresholdEETX);
#line 226
static inline void LinkEstimatorP$updateReverseQuality(am_addr_t neighbor, uint8_t outquality);
#line 238
static void LinkEstimatorP$updateEETX(neighbor_table_entry_t *ne, uint16_t newEst);
static void LinkEstimatorP$updateDEETX(neighbor_table_entry_t *ne);
#line 280
static inline uint8_t LinkEstimatorP$computeBidirEETX(uint8_t q1, uint8_t q2);
#line 296
static inline void LinkEstimatorP$updateNeighborTableEst(am_addr_t n);
#line 347
static void LinkEstimatorP$updateNeighborEntryIdx(uint8_t idx, uint8_t seq);
#line 382
static void LinkEstimatorP$print_neighbor_table(void);
#line 396
static void LinkEstimatorP$print_packet(message_t *msg, uint8_t len);
static inline void LinkEstimatorP$initNeighborTable(void);
static inline error_t LinkEstimatorP$StdControl$start(void);
static inline error_t LinkEstimatorP$Init$init(void);
static uint8_t LinkEstimatorP$LinkEstimator$getLinkQuality(am_addr_t neighbor);
#line 466
static inline error_t LinkEstimatorP$LinkEstimator$insertNeighbor(am_addr_t neighbor);
#line 494
static error_t LinkEstimatorP$LinkEstimator$pinNeighbor(am_addr_t neighbor);
static inline error_t LinkEstimatorP$LinkEstimator$unpinNeighbor(am_addr_t neighbor);
#line 516
static error_t LinkEstimatorP$LinkEstimator$txAck(am_addr_t neighbor);
#line 533
static inline error_t LinkEstimatorP$LinkEstimator$txNoAck(am_addr_t neighbor);
#line 549
static inline error_t LinkEstimatorP$LinkEstimator$clearDLQ(am_addr_t neighbor);
#line 564
static inline error_t LinkEstimatorP$Send$send(am_addr_t addr, message_t *msg, uint8_t len);
static inline void LinkEstimatorP$AMSend$sendDone(message_t *msg, error_t error);
static inline uint8_t LinkEstimatorP$Send$maxPayloadLength(void);
static inline void *LinkEstimatorP$Send$getPayload(message_t *msg);
static inline void LinkEstimatorP$processReceivedMessage(message_t *msg, void *payload, uint8_t len);
#line 678
static inline message_t *LinkEstimatorP$SubReceive$receive(message_t *msg,
void *payload,
uint8_t len);
static inline void *LinkEstimatorP$Receive$getPayload(message_t *msg, uint8_t *len);
#line 702
static inline uint8_t LinkEstimatorP$Packet$payloadLength(message_t *msg);
#line 721
static inline uint8_t LinkEstimatorP$Packet$maxPayloadLength(void);
static void *LinkEstimatorP$Packet$getPayload(message_t *msg, uint8_t *len);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 101
static uint8_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$maxPayloadLength(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 151
static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len);
static inline void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$sendDone(message_t *m, error_t err);
static inline uint8_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$maxPayloadLength(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$send(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$getPayload(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40,
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
message_t *arg_0x7eb20600);
#line 112
static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$maxPayloadLength(
# 40 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
am_id_t arg_0x7e48ab40);
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$sendDone(
# 38 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
uint8_t arg_0x7e48a1e0,
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
message_t *arg_0x7eb54010, error_t arg_0x7eb54198);
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$payloadLength(message_t *arg_0x7e7c7ee0);
#line 83
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$postTask(void);
# 67 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$destination(message_t *arg_0x7e7c1cd8);
#line 136
static am_id_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$type(message_t *arg_0x7e7b7258);
# 118 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
enum /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$__nesc_unnamed4409 {
#line 118
AMQueueImplP$1$CancelTask = 24U
};
#line 118
typedef int /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$__nesc_sillytask_CancelTask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$CancelTask];
#line 161
enum /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$__nesc_unnamed4410 {
#line 161
AMQueueImplP$1$errorTask = 25U
};
#line 161
typedef int /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$__nesc_sillytask_errorTask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask];
#line 49
#line 47
typedef struct /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$__nesc_unnamed4411 {
message_t *msg;
} /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue_entry_t;
uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = 4;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue_entry_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[4];
uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$cancelMask[4 / 8 + 1];
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$tryToSend(void);
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$nextPacket(void);
#line 82
static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(uint8_t clientId, message_t *msg,
uint8_t len);
#line 118
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$CancelTask$runTask(void);
#line 155
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$sendDone(uint8_t last, message_t *msg, error_t err);
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$runTask(void);
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$tryToSend(void);
#line 181
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$sendDone(am_id_t id, message_t *msg, error_t err);
#line 199
static inline uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$maxPayloadLength(uint8_t id);
static inline void */*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$getPayload(uint8_t id, message_t *m);
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$default$sendDone(uint8_t id, message_t *msg, error_t err);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask(void);
# 68 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$logEventRoute(uint8_t arg_0x7dc67c90, am_addr_t arg_0x7dc67e20, uint8_t arg_0x7dc66010, uint16_t arg_0x7dc661a0);
# 50 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$pinNeighbor(am_addr_t arg_0x7dc7c7e8);
#line 47
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$insertNeighbor(am_addr_t arg_0x7dc7c348);
#line 64
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$clearDLQ(am_addr_t arg_0x7dc7ba70);
#line 53
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$unpinNeighbor(am_addr_t arg_0x7dc7cc88);
#line 38
static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$getLinkQuality(uint16_t arg_0x7dc7d4e8);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand16(void);
#line 35
static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand32(void);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$postTask(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void */*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$getPayload(message_t *arg_0x7eb20600);
#line 112
static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$maxPayloadLength(void);
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getNow(void);
#line 140
static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getdt(void);
#line 133
static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$gett0(void);
#line 53
static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startPeriodic(uint32_t arg_0x7eb13ce0);
static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(uint32_t arg_0x7eb11338);
static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$stop(void);
#line 53
static void /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$startPeriodic(uint32_t arg_0x7eb13ce0);
# 7 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpCongestion.nc"
static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpCongestion$isCongested(void);
# 79 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
static void */*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$getPayload(message_t *arg_0x7eb45a48, uint8_t *arg_0x7eb45bf0);
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$source(message_t *arg_0x7e7c0360);
#line 57
static am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$address(void);
# 51 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$Routing$routeFound(void);
static void /*CtpP.Router*/CtpRoutingEngineP$0$Routing$noRoute(void);
# 267 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
enum /*CtpP.Router*/CtpRoutingEngineP$0$__nesc_unnamed4412 {
#line 267
CtpRoutingEngineP$0$updateRouteTask = 26U
};
#line 267
typedef int /*CtpP.Router*/CtpRoutingEngineP$0$__nesc_sillytask_updateRouteTask[/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask];
#line 385
enum /*CtpP.Router*/CtpRoutingEngineP$0$__nesc_unnamed4413 {
#line 385
CtpRoutingEngineP$0$sendBeaconTask = 27U
};
#line 385
typedef int /*CtpP.Router*/CtpRoutingEngineP$0$__nesc_sillytask_sendBeaconTask[/*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask];
#line 122
bool /*CtpP.Router*/CtpRoutingEngineP$0$ECNOff = TRUE;
bool /*CtpP.Router*/CtpRoutingEngineP$0$radioOn = FALSE;
bool /*CtpP.Router*/CtpRoutingEngineP$0$running = FALSE;
bool /*CtpP.Router*/CtpRoutingEngineP$0$sending = FALSE;
bool /*CtpP.Router*/CtpRoutingEngineP$0$justEvicted = FALSE;
route_info_t /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo;
bool /*CtpP.Router*/CtpRoutingEngineP$0$state_is_root;
am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$my_ll_addr;
message_t /*CtpP.Router*/CtpRoutingEngineP$0$beaconMsgBuffer;
ctp_routing_header_t */*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg;
routing_table_entry /*CtpP.Router*/CtpRoutingEngineP$0$routingTable[10];
uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive;
uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$parentChanges;
uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$routeUpdateTimerCount;
enum /*CtpP.Router*/CtpRoutingEngineP$0$__nesc_unnamed4414 {
CtpRoutingEngineP$0$DEATH_TEST_INTERVAL = 1024 * 4 / (BEACON_INTERVAL / 1024)
};
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$routingTableInit(void);
static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(am_addr_t );
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableUpdateEntry(am_addr_t , am_addr_t , uint16_t );
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableEvict(am_addr_t neighbor);
uint16_t /*CtpP.Router*/CtpRoutingEngineP$0$currentInterval = 1;
uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$t;
bool /*CtpP.Router*/CtpRoutingEngineP$0$tHasPassed;
static void /*CtpP.Router*/CtpRoutingEngineP$0$chooseAdvertiseTime(void);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$resetInterval(void);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$decayInterval(void);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$remainingInterval(void);
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$Init$init(void);
#line 217
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$StdControl$start(void);
#line 234
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$startDone(error_t error);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$stopDone(error_t error);
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$passLinkEtxThreshold(uint16_t etx);
static inline uint16_t /*CtpP.Router*/CtpRoutingEngineP$0$evaluateEtx(uint8_t quality);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$runTask(void);
#line 385
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$runTask(void);
#line 427
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$sendDone(message_t *msg, error_t error);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$fired(void);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$fired(void);
#line 456
static inline ctp_routing_header_t */*CtpP.Router*/CtpRoutingEngineP$0$getHeader(message_t *m);
static inline message_t */*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$receive(message_t *msg, void *payload, uint8_t len);
#line 514
static void /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$evicted(am_addr_t neighbor);
#line 526
static inline am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$Routing$nextHop(void);
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$Routing$hasRoute(void);
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getParent(am_addr_t *parent);
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getEtx(uint16_t *etx);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$recomputeRoutes(void);
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerRouteUpdate(void);
#line 568
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerImmediateRouteUpdate(void);
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$setNeighborCongested(am_addr_t n, bool congested);
#line 591
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$isNeighborCongested(am_addr_t n);
#line 607
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$setRoot(void);
#line 632
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$isRoot(void);
#line 654
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$routingTableInit(void);
static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(am_addr_t neighbor);
#line 672
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableUpdateEntry(am_addr_t from, am_addr_t parent, uint16_t etx);
#line 715
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableEvict(am_addr_t neighbor);
#line 744
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$default$logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t etx);
static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpRoutingPacket$getOption(message_t *msg, ctp_options_t opt);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
# 92 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 151
static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len);
static inline void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$sendDone(message_t *m, error_t err);
# 50 "/opt/tinyos-2.x/tos/lib/net/CollectionIdP.nc"
static inline collection_id_t /*OctopusAppC.CollectionSenderC.CollectionSenderP.CollectionIdP*/CollectionIdP$0$CollectionId$fetch(void);
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static error_t DisseminationEngineImplP$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0);
#line 125
static void *DisseminationEngineImplP$AMSend$getPayload(message_t *arg_0x7eb20600);
#line 112
static uint8_t DisseminationEngineImplP$AMSend$maxPayloadLength(void);
# 77 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void DisseminationEngineImplP$TrickleTimer$incrementCounter(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 72 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void DisseminationEngineImplP$TrickleTimer$reset(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 60 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static error_t DisseminationEngineImplP$TrickleTimer$start(
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d938688);
# 48 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void DisseminationEngineImplP$DisseminationCache$storeData(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0,
# 48 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
void *arg_0x7d943e80, uint8_t arg_0x7d942030, uint32_t arg_0x7d9421c0);
static uint32_t DisseminationEngineImplP$DisseminationCache$requestSeqno(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0);
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void *DisseminationEngineImplP$DisseminationCache$requestData(
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d939bb0,
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
uint8_t *arg_0x7d9439c0);
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
static error_t DisseminationEngineImplP$DisseminatorControl$start(
# 51 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
uint16_t arg_0x7d937030);
#line 64
enum DisseminationEngineImplP$__nesc_unnamed4415 {
#line 64
DisseminationEngineImplP$NUM_DISSEMINATORS = 1U
};
message_t DisseminationEngineImplP$m_buf;
bool DisseminationEngineImplP$m_running;
bool DisseminationEngineImplP$m_bufBusy;
static void DisseminationEngineImplP$sendObject(uint16_t key);
static inline error_t DisseminationEngineImplP$StdControl$start(void);
#line 91
static inline error_t DisseminationEngineImplP$DisseminationCache$start(uint16_t key);
static inline void DisseminationEngineImplP$DisseminationCache$newData(uint16_t key);
static inline void DisseminationEngineImplP$TrickleTimer$fired(uint16_t key);
#line 129
static void DisseminationEngineImplP$sendObject(uint16_t key);
#line 153
static inline void DisseminationEngineImplP$ProbeAMSend$sendDone(message_t *msg, error_t error);
static inline void DisseminationEngineImplP$AMSend$sendDone(message_t *msg, error_t error);
static inline message_t *DisseminationEngineImplP$Receive$receive(message_t *msg,
void *payload,
uint8_t len);
#line 217
static inline message_t *DisseminationEngineImplP$ProbeReceive$receive(message_t *msg,
void *payload,
uint8_t len);
#line 234
static inline void *
DisseminationEngineImplP$DisseminationCache$default$requestData(uint16_t key, uint8_t *size);
static inline
#line 237
void
DisseminationEngineImplP$DisseminationCache$default$storeData(uint16_t key, void *data,
uint8_t size,
uint32_t seqno);
static inline
#line 242
uint32_t
DisseminationEngineImplP$DisseminationCache$default$requestSeqno(uint16_t key);
static inline error_t DisseminationEngineImplP$TrickleTimer$default$start(uint16_t key);
static inline void DisseminationEngineImplP$TrickleTimer$default$reset(uint16_t key);
static inline void DisseminationEngineImplP$TrickleTimer$default$incrementCounter(uint16_t key);
static inline error_t DisseminationEngineImplP$DisseminatorControl$default$start(uint16_t id);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static error_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010);
#line 114
static void */*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$getPayload(message_t *arg_0x7eb54c58);
#line 101
static uint8_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$maxPayloadLength(void);
# 92 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8);
#line 151
static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968);
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len);
static inline void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$sendDone(message_t *m, error_t err);
static inline uint8_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$maxPayloadLength(void);
static inline void */*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$getPayload(message_t *m);
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
static void /*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38);
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$Send$sendDone(message_t *m, error_t err);
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$newData(void);
#line 45
static error_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$start(void);
# 61 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$changed(void);
# 55 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$valueCache;
bool /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$m_running;
uint32_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno = DISSEMINATION_SEQNO_UNKNOWN;
static inline error_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$StdControl$start(void);
#line 74
static inline const /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$get(void);
static inline void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$change(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t *newVal);
#line 94
static inline void */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestData(uint8_t *size);
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$storeData(void *data, uint8_t size,
uint32_t newSeqno);
static inline uint32_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestSeqno(void);
# 34 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clearAll(void);
#line 58
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clear(uint16_t arg_0x7d8b7510);
#line 46
static bool /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$get(uint16_t arg_0x7d8b8a68);
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$set(uint16_t arg_0x7d8b7010);
#line 34
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clearAll(void);
#line 58
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clear(uint16_t arg_0x7d8b7510);
#line 46
static bool /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$get(uint16_t arg_0x7d8b8a68);
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$set(uint16_t arg_0x7d8b7010);
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
static uint16_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Random$rand16(void);
# 82 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$fired(
# 50 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
uint8_t arg_0x7d8c0f00);
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$postTask(void);
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getNow(void);
#line 140
static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getdt(void);
#line 133
static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$gett0(void);
#line 62
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$startOneShot(uint32_t arg_0x7eb11338);
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$stop(void);
# 146 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
enum /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$__nesc_unnamed4416 {
#line 146
TrickleTimerImplP$0$timerTask = 28U
};
#line 146
typedef int /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$__nesc_sillytask_timerTask[/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask];
#line 67
#line 62
typedef struct /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$__nesc_unnamed4417 {
uint16_t period;
uint32_t time;
uint32_t remainder;
uint8_t count;
} /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickle_t;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickle_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[1U];
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer(void);
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(uint8_t id);
static inline error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Init$init(void);
#line 92
static inline error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$start(uint8_t id);
#line 122
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$reset(uint8_t id);
#line 142
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$incrementCounter(uint8_t id);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$runTask(void);
#line 168
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$fired(void);
#line 203
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer(void);
#line 246
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(uint8_t id);
#line 270
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$default$fired(uint8_t id);
# 40 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
typedef uint8_t /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$int_type;
enum /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$__nesc_unnamed4418 {
BitVectorC$0$ELEMENT_SIZE = 8 * sizeof(/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$int_type ),
BitVectorC$0$ARRAY_SIZE = (1U + /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$ELEMENT_SIZE - 1) / /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$ELEMENT_SIZE
};
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$int_type /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$ARRAY_SIZE];
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getIndex(uint16_t bitnum);
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getMask(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clearAll(void);
static inline bool /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$get(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$set(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clear(uint16_t bitnum);
#line 40
typedef uint8_t /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$int_type;
enum /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$__nesc_unnamed4419 {
BitVectorC$1$ELEMENT_SIZE = 8 * sizeof(/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$int_type ),
BitVectorC$1$ARRAY_SIZE = (1U + /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$ELEMENT_SIZE - 1) / /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$ELEMENT_SIZE
};
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$int_type /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$ARRAY_SIZE];
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getIndex(uint16_t bitnum);
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getMask(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clearAll(void);
static inline bool /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$get(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$set(uint16_t bitnum);
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clear(uint16_t bitnum);
# 86 "/opt/tinyos-2.x/tos/chips/atm128/atm128hardware.h"
static __inline void __nesc_disable_interrupt(void)
#line 86
{
__asm volatile ("cli");}
#line 103
#line 102
__inline __nesc_atomic_t
__nesc_atomic_start(void )
{
__nesc_atomic_t result = * (volatile uint8_t *)(0x3F + 0x20);
#line 106
__nesc_disable_interrupt();
return result;
}
#line 111
__inline void
__nesc_atomic_end(__nesc_atomic_t original_SREG)
{
* (volatile uint8_t *)(0x3F + 0x20) = original_SREG;
}
# 113 "/opt/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 "/opt/tinyos-2.x/tos/interfaces/Scheduler.nc"
inline static void RealMainP$Scheduler$init(void){
#line 46
SchedulerBasicP$Scheduler$init();
#line 46
}
#line 46
# 18 "/opt/tinyos-2.x/tos/platforms/aquisgrain/PlatformP.nc"
static inline void PlatformP$power_init(void)
#line 18
{
/* atomic removed: atomic calls only */
#line 19
{
* (volatile uint8_t *)(0x35 + 0x20) = 1 << 5;
}
}
# 49 "/opt/tinyos-2.x/tos/types/TinyError.h"
static inline error_t ecombine(error_t r1, error_t r2)
{
return r1 == r2 ? r1 : FAIL;
}
# 79 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline uint16_t HplAtm128Timer3P$TimerCtrlCapture2int(Atm128TimerCtrlCapture_t x)
#line 79
{
#line 79
union __nesc_unnamed4420 {
#line 79
Atm128TimerCtrlCapture_t f;
#line 79
uint16_t t;
}
#line 79
c = { .f = x };
#line 79
return c.t;
}
static inline void HplAtm128Timer3P$TimerCtrl$setCtrlCapture(Atm128_TCCR3B_t x)
#line 86
{
* (volatile uint8_t *)0x8A = HplAtm128Timer3P$TimerCtrlCapture2int(x);
}
#line 69
static inline Atm128TimerCtrlCapture_t HplAtm128Timer3P$TimerCtrl$getCtrlCapture(void)
#line 69
{
return * (Atm128TimerCtrlCapture_t *)& * (volatile uint8_t *)0x8A;
}
#line 59
static inline void HplAtm128Timer3P$Timer$setScale(uint8_t s)
#line 59
{
Atm128TimerCtrlCapture_t x = HplAtm128Timer3P$TimerCtrl$getCtrlCapture();
#line 61
x.bits.cs = s;
HplAtm128Timer3P$TimerCtrl$setCtrlCapture(x);
}
# 95 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$setScale(uint8_t arg_0x7e9930f8){
#line 95
HplAtm128Timer3P$Timer$setScale(arg_0x7e9930f8);
#line 95
}
#line 95
# 127 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$Timer$start(void)
#line 127
{
#line 127
* (volatile uint8_t *)0x7D |= 1 << 2;
}
# 69 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$start(void){
#line 69
HplAtm128Timer3P$Timer$start();
#line 69
}
#line 69
# 50 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$Timer$set(uint16_t t)
#line 50
{
#line 50
* (volatile uint16_t *)0x88 = t;
}
# 58 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$set(/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$timer_size arg_0x7e9953c0){
#line 58
HplAtm128Timer3P$Timer$set(arg_0x7e9953c0);
#line 58
}
#line 58
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline error_t /*InitThreeP.InitThree*/Atm128TimerInitC$0$Init$init(void)
#line 42
{
/* atomic removed: atomic calls only */
#line 43
{
/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$set(0);
/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$start();
/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$setScale(2);
}
return SUCCESS;
}
# 81 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline uint16_t HplAtm128Timer1P$TimerCtrlCapture2int(Atm128TimerCtrlCapture_t x)
#line 81
{
#line 81
union __nesc_unnamed4421 {
#line 81
Atm128TimerCtrlCapture_t f;
#line 81
uint16_t t;
}
#line 81
c = { .f = x };
#line 81
return c.t;
}
static inline void HplAtm128Timer1P$TimerCtrl$setCtrlCapture(Atm128_TCCR1B_t x)
#line 88
{
* (volatile uint8_t *)(0x2E + 0x20) = HplAtm128Timer1P$TimerCtrlCapture2int(x);
}
#line 71
static inline Atm128TimerCtrlCapture_t HplAtm128Timer1P$TimerCtrl$getCtrlCapture(void)
#line 71
{
return * (Atm128TimerCtrlCapture_t *)& * (volatile uint8_t *)(0x2E + 0x20);
}
#line 61
static inline void HplAtm128Timer1P$Timer$setScale(uint8_t s)
#line 61
{
Atm128TimerCtrlCapture_t x = HplAtm128Timer1P$TimerCtrl$getCtrlCapture();
#line 63
x.bits.cs = s;
HplAtm128Timer1P$TimerCtrl$setCtrlCapture(x);
}
# 95 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$setScale(uint8_t arg_0x7e9930f8){
#line 95
HplAtm128Timer1P$Timer$setScale(arg_0x7e9930f8);
#line 95
}
#line 95
# 131 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Timer$start(void)
#line 131
{
#line 131
* (volatile uint8_t *)(0x37 + 0x20) |= 1 << 2;
}
# 69 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$start(void){
#line 69
HplAtm128Timer1P$Timer$start();
#line 69
}
#line 69
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Timer$set(uint16_t t)
#line 52
{
#line 52
* (volatile uint16_t *)(0x2C + 0x20) = t;
}
# 58 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$set(/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$timer_size arg_0x7e9953c0){
#line 58
HplAtm128Timer1P$Timer$set(arg_0x7e9953c0);
#line 58
}
#line 58
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline error_t /*InitOneP.InitOne*/Atm128TimerInitC$1$Init$init(void)
#line 42
{
/* atomic removed: atomic calls only */
#line 43
{
/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$set(0);
/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$start();
/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$setScale(4);
}
return SUCCESS;
}
# 51 "/opt/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$1$Init$init();
#line 51
result = ecombine(result, /*InitThreeP.InitThree*/Atm128TimerInitC$0$Init$init());
#line 51
#line 51
return result;
#line 51
}
#line 51
# 47 "/opt/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 *)59U &= ~(1 << 4);
}
# 30 "/opt/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 "/opt/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 *)58U &= ~(1 << 4);
}
# 33 "/opt/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 "/opt/tinyos-2.x/tos/platforms/aquisgrain/MotePlatformP.nc"
static inline error_t MotePlatformP$PlatformInit$init(void)
#line 26
{
MotePlatformP$SerialIdPin$makeInput();
MotePlatformP$SerialIdPin$clr();
return MotePlatformP$SubInit$init();
}
# 51 "/opt/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 = MotePlatformP$PlatformInit$init();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 41 "/opt/tinyos-2.x/tos/platforms/aquisgrain/MeasureClockC.nc"
static inline error_t MeasureClockC$Init$init(void)
#line 41
{
/* atomic removed: atomic calls only */
{
uint8_t now;
#line 47
uint8_t wraps;
uint16_t start;
* (volatile uint8_t *)(0x2E + 0x20) = 1 << 0;
* (volatile uint8_t *)(0x30 + 0x20) = 1 << 3;
* (volatile uint8_t *)(0x33 + 0x20) = (1 << 1) | (1 << 0);
start = * (volatile uint16_t *)(0x2C + 0x20);
for (wraps = MeasureClockC$MAGIC / 2; wraps; )
{
uint16_t next = * (volatile uint16_t *)(0x2C + 0x20);
if (next < start) {
wraps--;
}
#line 65
start = next;
}
now = * (volatile uint8_t *)(0x32 + 0x20);
while (* (volatile uint8_t *)(0x32 + 0x20) == now) ;
start = * (volatile uint16_t *)(0x2C + 0x20);
now = * (volatile uint8_t *)(0x32 + 0x20);
while (* (volatile uint8_t *)(0x32 + 0x20) == now) ;
MeasureClockC$cycles = * (volatile uint16_t *)(0x2C + 0x20);
MeasureClockC$cycles = (MeasureClockC$cycles - start + 16) >> 5;
* (volatile uint8_t *)(0x30 + 0x20) = * (volatile uint8_t *)(0x2E + 0x20) = * (volatile uint8_t *)(0x33 + 0x20) = 0;
* (volatile uint8_t *)(0x32 + 0x20) = 0;
* (volatile uint16_t *)(0x2C + 0x20) = 0;
* (volatile uint8_t *)0x7C = * (volatile uint8_t *)(0x36 + 0x20) = 0xff;
while (* (volatile uint8_t *)(0x30 + 0x20) & (((1 << 2) | (1 << 1)) | (1 << 0)))
;
}
return SUCCESS;
}
# 51 "/opt/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
# 46 "/opt/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 *)59U |= 1 << 0;
}
# 29 "/opt/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 "/opt/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 *)59U |= 1 << 1;
}
# 29 "/opt/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 "/opt/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 *)59U |= 1 << 2;
}
# 29 "/opt/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 "/opt/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 *)58U |= 1 << 0;
}
# 35 "/opt/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 "/opt/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 *)58U |= 1 << 1;
}
# 35 "/opt/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 "/opt/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 *)58U |= 1 << 2;
}
# 35 "/opt/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 "/opt/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 "/opt/tinyos-2.x/tos/interfaces/Init.nc"
inline static error_t PlatformP$LedsInit$init(void){
#line 51
unsigned char result;
#line 51
#line 51
result = LedsP$Init$init();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 25 "/opt/tinyos-2.x/tos/platforms/aquisgrain/PlatformP.nc"
static inline error_t PlatformP$Init$init(void)
#line 25
{
error_t ok;
#line 27
PlatformP$LedsInit$init();
ok = PlatformP$MeasureClock$init();
ok = ecombine(ok, PlatformP$MoteInit$init());
if (ok != SUCCESS) {
return ok;
}
PlatformP$power_init();
return SUCCESS;
}
# 51 "/opt/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 = PlatformP$Init$init();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 54 "/opt/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
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 110 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$TrickleTimer$fired(uint16_t key)
#line 110
{
if (!DisseminationEngineImplP$m_running || DisseminationEngineImplP$m_bufBusy) {
#line 112
return;
}
DisseminationEngineImplP$sendObject(key);
}
# 270 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$default$fired(uint8_t id)
#line 270
{
return;
}
# 82 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$fired(uint8_t arg_0x7d8c0f00){
#line 82
switch (arg_0x7d8c0f00) {
#line 82
case /*OctopusAppC.DisseminatorC*/DisseminatorC$0$TIMER_ID:
#line 82
DisseminationEngineImplP$TrickleTimer$fired(42);
#line 82
break;
#line 82
default:
#line 82
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$default$fired(arg_0x7d8c0f00);
#line 82
break;
#line 82
}
#line 82
}
#line 82
# 55 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getMask(uint16_t bitnum)
{
return 1 << bitnum % /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$ELEMENT_SIZE;
}
#line 50
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getIndex(uint16_t bitnum)
{
return bitnum / /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$ELEMENT_SIZE;
}
#line 86
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clear(uint16_t bitnum)
{
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getIndex(bitnum)] &= ~/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getMask(bitnum);
}
# 58 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clear(uint16_t arg_0x7d8b7510){
#line 58
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clear(arg_0x7d8b7510);
#line 58
}
#line 58
# 76 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline bool /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$get(uint16_t bitnum)
{
return /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getIndex(bitnum)] & /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getMask(bitnum) ? TRUE : FALSE;
}
# 46 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static bool /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$get(uint16_t arg_0x7d8b8a68){
#line 46
unsigned char result;
#line 46
#line 46
result = /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$get(arg_0x7d8b8a68);
#line 46
#line 46
return result;
#line 46
}
#line 46
# 146 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$runTask(void)
#line 146
{
uint8_t i;
#line 148
for (i = 0; i < 1U; i++) {
bool fire = FALSE;
#line 150
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 150
{
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$get(i)) {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clear(i);
fire = TRUE;
}
}
#line 155
__nesc_atomic_end(__nesc_atomic); }
if (fire) {
;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$fired(i);
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$postTask();
return;
}
}
}
# 78 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline void *CC2420ActiveMessageP$AMSend$getPayload(am_id_t id, message_t *m)
#line 78
{
return CC2420ActiveMessageP$Packet$getPayload(m, (void *)0);
}
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void */*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$getPayload(am_id_t arg_0x7e48ab40, message_t *arg_0x7eb20600){
#line 125
void *result;
#line 125
#line 125
result = CC2420ActiveMessageP$AMSend$getPayload(arg_0x7e48ab40, arg_0x7eb20600);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 203 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void */*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$getPayload(uint8_t id, message_t *m)
#line 203
{
return /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$getPayload(0, m);
}
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void */*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$getPayload(message_t *arg_0x7eb54c58){
#line 114
void *result;
#line 114
#line 114
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$getPayload(2U, arg_0x7eb54c58);
#line 114
#line 114
return result;
#line 114
}
#line 114
# 65 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void */*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$getPayload(message_t *m)
#line 65
{
return /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$getPayload(m);
}
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void *DisseminationEngineImplP$AMSend$getPayload(message_t *arg_0x7eb20600){
#line 125
void *result;
#line 125
#line 125
result = /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$getPayload(arg_0x7eb20600);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 94 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static inline void */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestData(uint8_t *size)
#line 94
{
*size = sizeof(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t );
return &/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$valueCache;
}
# 234 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void *
DisseminationEngineImplP$DisseminationCache$default$requestData(uint16_t key, uint8_t *size)
#line 235
{
#line 235
return (void *)0;
}
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
inline static void *DisseminationEngineImplP$DisseminationCache$requestData(uint16_t arg_0x7d939bb0, uint8_t *arg_0x7d9439c0){
#line 47
void *result;
#line 47
#line 47
switch (arg_0x7d939bb0) {
#line 47
case 42:
#line 47
result = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestData(arg_0x7d9439c0);
#line 47
break;
#line 47
default:
#line 47
result = DisseminationEngineImplP$DisseminationCache$default$requestData(arg_0x7d939bb0, arg_0x7d9439c0);
#line 47
break;
#line 47
}
#line 47
#line 47
return result;
#line 47
}
#line 47
# 176 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline uint8_t CC2420ActiveMessageP$Packet$maxPayloadLength(void)
#line 176
{
return 28;
}
#line 74
static inline uint8_t CC2420ActiveMessageP$AMSend$maxPayloadLength(am_id_t id)
#line 74
{
return CC2420ActiveMessageP$Packet$maxPayloadLength();
}
# 112 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$maxPayloadLength(am_id_t arg_0x7e48ab40){
#line 112
unsigned char result;
#line 112
#line 112
result = CC2420ActiveMessageP$AMSend$maxPayloadLength(arg_0x7e48ab40);
#line 112
#line 112
return result;
#line 112
}
#line 112
# 199 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$maxPayloadLength(uint8_t id)
#line 199
{
return /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$maxPayloadLength(0);
}
# 101 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static uint8_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$maxPayloadLength(void){
#line 101
unsigned char result;
#line 101
#line 101
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$maxPayloadLength(2U);
#line 101
#line 101
return result;
#line 101
}
#line 101
# 61 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline uint8_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$maxPayloadLength(void)
#line 61
{
return /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$maxPayloadLength();
}
# 112 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static uint8_t DisseminationEngineImplP$AMSend$maxPayloadLength(void){
#line 112
unsigned char result;
#line 112
#line 112
result = /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$maxPayloadLength();
#line 112
#line 112
return result;
#line 112
}
#line 112
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(2U, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 151 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968){
#line 151
CC2420ActiveMessageP$AMPacket$setType(arg_0x7e7b77e0, arg_0x7e7b7968);
#line 151
}
#line 151
#line 92
inline static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8){
#line 92
CC2420ActiveMessageP$AMPacket$setDestination(arg_0x7e7c0928, arg_0x7e7c0ab8);
#line 92
}
#line 92
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len)
#line 47
{
/*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setDestination(msg, dest);
/*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMPacket$setType(msg, 13);
return /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$send(msg, len);
}
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t DisseminationEngineImplP$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$send(arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 83 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8){
#line 83
CC2420ActiveMessageP$Packet$setPayloadLength(arg_0x7e7c6570, arg_0x7e7c66f8);
#line 83
}
#line 83
# 136 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_id_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$type(message_t *arg_0x7e7b7258){
#line 136
unsigned char result;
#line 136
#line 136
result = CC2420ActiveMessageP$AMPacket$type(arg_0x7e7b7258);
#line 136
#line 136
return result;
#line 136
}
#line 136
#line 67
inline static am_addr_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$destination(message_t *arg_0x7e7c1cd8){
#line 67
unsigned int result;
#line 67
#line 67
result = CC2420ActiveMessageP$AMPacket$destination(arg_0x7e7c1cd8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$send(am_id_t arg_0x7e48ab40, am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = CC2420ActiveMessageP$AMSend$send(arg_0x7e48ab40, arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 251 "/usr/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;
}
# 118 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
static inline void StateImplP$State: Exp $toIdle(uint8_t id)
#line 118
{
StateImplP$state[id] = StateImplP$S_IDLE;
}
# 56 "/opt/tinyos-2.x/tos/interfaces/State.nc"
inline static void UniqueSendP$State: Exp $toIdle(void){
#line 56
StateImplP$State: Exp $toIdle(0U);
#line 56
}
#line 56
# 246 "/usr/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];
}
#line 269
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 240
static __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 257
static __inline int8_t __nesc_hton_int8(void *target, int8_t value)
#line 257
{
#line 257
__nesc_hton_uint8(target, value);
#line 257
return value;
}
#line 281
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;
}
#line 276
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];
}
# 514 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline error_t CC2420TransmitP$send(message_t *p_msg, bool cca)
#line 514
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 515
{
if ((
#line 516
CC2420TransmitP$m_state == CC2420TransmitP$S_LOAD_CANCEL
|| CC2420TransmitP$m_state == CC2420TransmitP$S_CCA_CANCEL)
|| CC2420TransmitP$m_state == CC2420TransmitP$S_TX_CANCEL) {
{
unsigned char __nesc_temp =
#line 519
ECANCEL;
{
#line 519
__nesc_atomic_end(__nesc_atomic);
#line 519
return __nesc_temp;
}
}
}
#line 522
if (CC2420TransmitP$m_state != CC2420TransmitP$S_STARTED) {
{
unsigned char __nesc_temp =
#line 523
FAIL;
{
#line 523
__nesc_atomic_end(__nesc_atomic);
#line 523
return __nesc_temp;
}
}
}
#line 526
CC2420TransmitP$m_state = CC2420TransmitP$S_LOAD;
CC2420TransmitP$m_cca = cca;
CC2420TransmitP$m_msg = p_msg;
CC2420TransmitP$totalCcaChecks = 0;
}
#line 530
__nesc_atomic_end(__nesc_atomic); }
if (CC2420TransmitP$acquireSpiResource() == SUCCESS) {
CC2420TransmitP$loadTXFIFO();
}
return SUCCESS;
}
#line 170
static inline error_t CC2420TransmitP$Send$send(message_t *p_msg, bool useCca)
#line 170
{
return CC2420TransmitP$send(p_msg, useCca);
}
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
inline static error_t CC2420CsmaP$CC2420Transmit$send(message_t *arg_0x7e364d08, bool arg_0x7e364e90){
#line 49
unsigned char result;
#line 49
#line 49
result = CC2420TransmitP$Send$send(arg_0x7e364d08, arg_0x7e364e90);
#line 49
#line 49
return result;
#line 49
}
#line 49
# 286 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$RadioBackoff$default$requestCca(am_id_t amId,
message_t *msg)
#line 287
{
}
# 94 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$RadioBackoff$requestCca(am_id_t arg_0x7e36c010, message_t *arg_0x7e441268){
#line 94
CC2420CsmaP$RadioBackoff$default$requestCca(arg_0x7e36c010, arg_0x7e441268);
#line 94
}
#line 94
# 52 "/opt/tinyos-2.x/tos/system/ActiveMessageAddressC.nc"
static inline am_addr_t ActiveMessageAddressC$amAddress(void)
#line 52
{
return ActiveMessageAddressC$addr;
}
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
inline static am_addr_t CC2420ActiveMessageP$amAddress(void){
#line 49
unsigned int result;
#line 49
#line 49
result = ActiveMessageAddressC$amAddress();
#line 49
#line 49
return result;
#line 49
}
#line 49
#line 113
static inline am_addr_t CC2420ActiveMessageP$AMPacket$address(void)
#line 113
{
return CC2420ActiveMessageP$amAddress();
}
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t CC2420CsmaP$AMPacket$address(void){
#line 57
unsigned int result;
#line 57
#line 57
result = CC2420ActiveMessageP$AMPacket$address();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 54 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420PacketC.nc"
static inline cc2420_metadata_t *CC2420PacketC$CC2420Packet$getMetadata(message_t *msg)
#line 54
{
return (cc2420_metadata_t *)msg->metadata;
}
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_metadata_t *CC2420CsmaP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0){
#line 82
nx_struct cc2420_metadata_t *result;
#line 82
#line 82
result = CC2420PacketC$CC2420Packet$getMetadata(arg_0x7e448bc0);
#line 82
#line 82
return result;
#line 82
}
#line 82
# 50 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420PacketC.nc"
static inline cc2420_header_t *CC2420PacketC$CC2420Packet$getHeader(message_t *msg)
#line 50
{
return (cc2420_header_t *)(msg->data - sizeof(cc2420_header_t ));
}
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_header_t *CC2420CsmaP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 119 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline error_t CC2420CsmaP$Send$send(message_t *p_msg, uint8_t len)
#line 119
{
unsigned char *__nesc_temp47;
unsigned char *__nesc_temp46;
#line 121
cc2420_header_t *header = CC2420CsmaP$CC2420Packet$getHeader(p_msg);
cc2420_metadata_t *metadata = CC2420CsmaP$CC2420Packet$getMetadata(p_msg);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 124
{
if (CC2420CsmaP$m_state != CC2420CsmaP$S_STARTED)
{
unsigned char __nesc_temp =
#line 126
FAIL;
{
#line 126
__nesc_atomic_end(__nesc_atomic);
#line 126
return __nesc_temp;
}
}
#line 127
CC2420CsmaP$m_state = CC2420CsmaP$S_TRANSMIT;
CC2420CsmaP$m_msg = p_msg;
}
#line 129
__nesc_atomic_end(__nesc_atomic); }
__nesc_hton_leuint8((unsigned char *)&header->length, len);
(__nesc_temp46 = (unsigned char *)&header->fcf, __nesc_hton_leuint16(__nesc_temp46, __nesc_ntoh_leuint16(__nesc_temp46) & (1 << IEEE154_FCF_ACK_REQ)));
(__nesc_temp47 = (unsigned char *)&header->fcf, __nesc_hton_leuint16(__nesc_temp47, __nesc_ntoh_leuint16(__nesc_temp47) | ((((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))));
__nesc_hton_leuint16((unsigned char *)&header->src, CC2420CsmaP$AMPacket$address());
__nesc_hton_int8((unsigned char *)&metadata->ack, FALSE);
__nesc_hton_uint8((unsigned char *)&metadata->rssi, 0);
__nesc_hton_uint8((unsigned char *)&metadata->lqi, 0);
__nesc_hton_uint16((unsigned char *)&metadata->time, 0);
CC2420CsmaP$ccaOn = TRUE;
CC2420CsmaP$RadioBackoff$requestCca(__nesc_ntoh_leuint8((unsigned char *)&((cc2420_header_t *)(CC2420CsmaP$m_msg->data -
sizeof(cc2420_header_t )))->type), CC2420CsmaP$m_msg);
CC2420CsmaP$CC2420Transmit$send(CC2420CsmaP$m_msg, CC2420CsmaP$ccaOn);
return SUCCESS;
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t UniqueSendP$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = CC2420CsmaP$Send$send(arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_header_t *UniqueSendP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 96 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
static inline error_t StateImplP$State: Exp $requestState(uint8_t id, uint8_t reqState)
#line 96
{
error_t returnVal = FAIL;
#line 98
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 98
{
if (reqState == StateImplP$S_IDLE || StateImplP$state[id] == StateImplP$S_IDLE) {
StateImplP$state[id] = reqState;
returnVal = SUCCESS;
}
}
#line 103
__nesc_atomic_end(__nesc_atomic); }
return returnVal;
}
# 45 "/opt/tinyos-2.x/tos/interfaces/State.nc"
inline static error_t UniqueSendP$State: Exp $requestState(uint8_t arg_0x7dd3b6f0){
#line 45
unsigned char result;
#line 45
#line 45
result = StateImplP$State: Exp $requestState(0U, arg_0x7dd3b6f0);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 75 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueSendP.nc"
static inline error_t UniqueSendP$Send$send(message_t *msg, uint8_t len)
#line 75
{
error_t error;
#line 77
if (UniqueSendP$State: Exp $requestState(UniqueSendP$S_SENDING) == SUCCESS) {
__nesc_hton_leuint8((unsigned char *)&UniqueSendP$CC2420Packet$getHeader(msg)->dsn, UniqueSendP$localSendId++);
if ((error = UniqueSendP$SubSend$send(msg, len)) != SUCCESS) {
UniqueSendP$State: Exp $toIdle();
}
return error;
}
return EBUSY;
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t CC2420ActiveMessageP$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = UniqueSendP$Send$send(arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420TransmitP$SpiResource$immediateRequest(void){
#line 87
unsigned char result;
#line 87
#line 87
result = CC2420SpiImplP$Resource$immediateRequest(/*CC2420TransmitC.Spi*/CC2420SpiC$3$CLIENT_ID);
#line 87
#line 87
return result;
#line 87
}
#line 87
# 166 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(uint8_t id)
#line 166
{
}
# 49 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$configure(uint8_t arg_0x7dee2ed0){
#line 49
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$configure(arg_0x7dee2ed0);
#line 49
}
#line 49
# 164 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(uint8_t id)
#line 164
{
}
# 51 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$immediateRequested(uint8_t arg_0x7dee23e8){
#line 51
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$immediateRequested(arg_0x7dee23e8);
#line 51
}
#line 51
# 84 "/opt/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);
/* atomic removed: atomic calls only */
#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 91
SUCCESS;
#line 91
return __nesc_temp;
}
}
#line 93
{
unsigned char __nesc_temp =
#line 93
FAIL;
#line 93
return __nesc_temp;
}
}
}
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t Atm128SpiP$ResourceArbiter$immediateRequest(uint8_t arg_0x7dfb9bf0){
#line 87
unsigned char result;
#line 87
#line 87
result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$immediateRequest(arg_0x7dfb9bf0);
#line 87
#line 87
return result;
#line 87
}
#line 87
# 304 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline error_t Atm128SpiP$Resource$immediateRequest(uint8_t id)
#line 304
{
error_t result = Atm128SpiP$ResourceArbiter$immediateRequest(id);
#line 306
if (result == SUCCESS) {
Atm128SpiP$startSpi();
}
return result;
}
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420SpiImplP$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
# 109 "/opt/tinyos-2.x/tos/chips/atm128/McuSleepC.nc"
static inline void McuSleepC$McuPowerState$update(void)
#line 109
{
}
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
inline static void HplAtm128SpiP$Mcu$update(void){
#line 44
McuSleepC$McuPowerState$update();
#line 44
}
#line 44
# 47 "/opt/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 *)56U &= ~(1 << 0);
}
# 30 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void HplAtm128SpiP$SS$clr(void){
#line 30
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr();
#line 30
}
#line 30
# 157 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$setMasterBit(bool isMaster)
#line 157
{
if (isMaster) {
* (volatile uint8_t *)(0x0D + 0x20) |= 1 << 4;
}
else {
* (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 4);
}
}
# 52 "/opt/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 *)55U |= 1 << 0;
}
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void HplAtm128SpiP$SS$makeOutput(void){
#line 35
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput();
#line 35
}
#line 35
# 52 "/opt/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 *)55U |= 1 << 1;
}
# 35 "/opt/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 "/opt/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 *)55U &= ~(1 << 3);
}
# 33 "/opt/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 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortB.Bit2*/HplAtm128GeneralIOPinP$10$IO$makeOutput(void)
#line 52
{
#line 52
* (volatile uint8_t *)55U |= 1 << 2;
}
# 35 "/opt/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 "/opt/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$SS$makeOutput();
HplAtm128SpiP$SPI$setMasterBit(TRUE);
HplAtm128SpiP$SS$clr();
}
# 66 "/opt/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
# 214 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$setMasterDoubleSpeed(bool on)
#line 214
{
if (on) {
* (volatile uint8_t *)(0x0E + 0x20) |= 1 << 0;
}
else {
* (volatile uint8_t *)(0x0E + 0x20) &= ~(1 << 0);
}
}
# 125 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void Atm128SpiP$Spi$setMasterDoubleSpeed(bool arg_0x7dfa0ee0){
#line 125
HplAtm128SpiP$SPI$setMasterDoubleSpeed(arg_0x7dfa0ee0);
#line 125
}
#line 125
# 170 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$setClockPolarity(bool highWhenIdle)
#line 170
{
if (highWhenIdle) {
* (volatile uint8_t *)(0x0D + 0x20) |= 1 << 3;
}
else {
* (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 3);
}
}
# 108 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void Atm128SpiP$Spi$setClockPolarity(bool arg_0x7dfa3da0){
#line 108
HplAtm128SpiP$SPI$setClockPolarity(arg_0x7dfa3da0);
#line 108
}
#line 108
# 184 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$setClockPhase(bool sampleOnTrailing)
#line 184
{
if (sampleOnTrailing) {
* (volatile uint8_t *)(0x0D + 0x20) |= 1 << 2;
}
else {
* (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 2);
}
}
# 111 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void Atm128SpiP$Spi$setClockPhase(bool arg_0x7dfa25a8){
#line 111
HplAtm128SpiP$SPI$setClockPhase(arg_0x7dfa25a8);
#line 111
}
#line 111
# 201 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$setClock(uint8_t v)
#line 201
{
v &= 1 | 0;
* (volatile uint8_t *)(0x0D + 0x20) = (* (volatile uint8_t *)(0x0D + 0x20) & ~(1 | 0)) | v;
}
# 114 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void Atm128SpiP$Spi$setClock(uint8_t arg_0x7dfa2d70){
#line 114
HplAtm128SpiP$SPI$setClock(arg_0x7dfa2d70);
#line 114
}
#line 114
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420TransmitP$SpiResource$request(void){
#line 78
unsigned char result;
#line 78
#line 78
result = CC2420SpiImplP$Resource$request(/*CC2420TransmitC.Spi*/CC2420SpiC$3$CLIENT_ID);
#line 78
#line 78
return result;
#line 78
}
#line 78
inline static error_t CC2420SpiImplP$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
# 54 "/opt/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 72
static 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 80
SUCCESS;
#line 80
return __nesc_temp;
}
}
#line 82
{
unsigned char __nesc_temp =
#line 82
EBUSY;
#line 82
return __nesc_temp;
}
}
}
# 69 "/opt/tinyos-2.x/tos/interfaces/ResourceQueue.nc"
inline static error_t /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(resource_client_id_t arg_0x7def8010){
#line 69
unsigned char result;
#line 69
#line 69
result = /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$FcfsQueue$enqueue(arg_0x7def8010);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 56 "/opt/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
# 162 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(uint8_t id)
#line 162
{
}
# 43 "/opt/tinyos-2.x/tos/interfaces/ResourceRequested.nc"
inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$requested(uint8_t arg_0x7dee23e8){
#line 43
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceRequested$default$requested(arg_0x7dee23e8);
#line 43
}
#line 43
# 71 "/opt/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);
/* atomic removed: atomic calls only */
#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 78
SUCCESS;
#line 78
return __nesc_temp;
}
}
#line 80
{
unsigned char __nesc_temp =
#line 80
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Queue$enqueue(id);
#line 80
return __nesc_temp;
}
}
}
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t Atm128SpiP$ResourceArbiter$request(uint8_t arg_0x7dfb9bf0){
#line 78
unsigned char result;
#line 78
#line 78
result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$request(arg_0x7dfb9bf0);
#line 78
#line 78
return result;
#line 78
}
#line 78
# 86 "/opt/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;
}
}
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
inline static cc2420_status_t CC2420TransmitP$TXCTRL$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_TXCTRL, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 100 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$write(uint8_t d)
#line 100
{
#line 100
* (volatile uint8_t *)(0x0F + 0x20) = d;
}
# 86 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void Atm128SpiP$Spi$write(uint8_t arg_0x7dfb2348){
#line 86
HplAtm128SpiP$SPI$write(arg_0x7dfb2348);
#line 86
}
#line 86
# 59 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
inline static error_t CC2420SpiImplP$SpiPacket$send(uint8_t *arg_0x7e0157f0, uint8_t *arg_0x7e015998, uint16_t arg_0x7e015b28){
#line 59
unsigned char result;
#line 59
#line 59
result = Atm128SpiP$SpiPacket$send(arg_0x7e0157f0, arg_0x7e015998, arg_0x7e015b28);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 34 "/opt/tinyos-2.x/tos/interfaces/SpiByte.nc"
inline static uint8_t CC2420SpiImplP$SpiByte$write(uint8_t arg_0x7e018088){
#line 34
unsigned char result;
#line 34
#line 34
result = Atm128SpiP$SpiByte$write(arg_0x7e018088);
#line 34
#line 34
return result;
#line 34
}
#line 34
# 159 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline cc2420_status_t CC2420SpiImplP$Fifo$write(uint8_t addr, uint8_t *data,
uint8_t len)
#line 160
{
uint8_t status = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 164
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 166
status;
{
#line 166
__nesc_atomic_end(__nesc_atomic);
#line 166
return __nesc_temp;
}
}
}
}
#line 170
__nesc_atomic_end(__nesc_atomic); }
#line 170
CC2420SpiImplP$m_addr = addr;
status = CC2420SpiImplP$SpiByte$write(CC2420SpiImplP$m_addr);
CC2420SpiImplP$SpiPacket$send(data, (void *)0, len);
return status;
}
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
inline static cc2420_status_t CC2420TransmitP$TXFIFO$write(uint8_t *arg_0x7e038cc8, uint8_t arg_0x7e038e50){
#line 82
unsigned char result;
#line 82
#line 82
result = CC2420SpiImplP$Fifo$write(CC2420_TXFIFO, arg_0x7e038cc8, arg_0x7e038e50);
#line 82
#line 82
return result;
#line 82
}
#line 82
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t Atm128SpiP$zeroTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(Atm128SpiP$zeroTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 301 "/usr/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;
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 278 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$routeFound(void)
#line 278
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
# 51 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$Routing$routeFound(void){
#line 51
/*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$routeFound();
#line 51
}
#line 51
# 282 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$noRoute(void)
#line 282
{
}
# 52 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$Routing$noRoute(void){
#line 52
/*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$noRoute();
#line 52
}
#line 52
# 549 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline error_t LinkEstimatorP$LinkEstimator$clearDLQ(am_addr_t neighbor)
#line 549
{
neighbor_table_entry_t *ne;
uint8_t nidx = LinkEstimatorP$findIdx(neighbor);
#line 552
if (nidx == LinkEstimatorP$INVALID_RVAL) {
return FAIL;
}
ne = &LinkEstimatorP$NeighborTable[nidx];
ne->data_total = 0;
ne->data_success = 0;
return SUCCESS;
}
# 64 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$clearDLQ(am_addr_t arg_0x7dc7ba70){
#line 64
unsigned char result;
#line 64
#line 64
result = LinkEstimatorP$LinkEstimator$clearDLQ(arg_0x7dc7ba70);
#line 64
#line 64
return result;
#line 64
}
#line 64
#line 50
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$pinNeighbor(am_addr_t arg_0x7dc7c7e8){
#line 50
unsigned char result;
#line 50
#line 50
result = LinkEstimatorP$LinkEstimator$pinNeighbor(arg_0x7dc7c7e8);
#line 50
#line 50
return result;
#line 50
}
#line 50
# 504 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline error_t LinkEstimatorP$LinkEstimator$unpinNeighbor(am_addr_t neighbor)
#line 504
{
uint8_t nidx = LinkEstimatorP$findIdx(neighbor);
#line 506
if (nidx == LinkEstimatorP$INVALID_RVAL) {
return FAIL;
}
LinkEstimatorP$NeighborTable[nidx].flags &= ~PINNED_ENTRY;
return SUCCESS;
}
# 53 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$unpinNeighbor(am_addr_t arg_0x7dc7cc88){
#line 53
unsigned char result;
#line 53
#line 53
result = LinkEstimatorP$LinkEstimator$unpinNeighbor(arg_0x7dc7cc88);
#line 53
#line 53
return result;
#line 53
}
#line 53
# 744 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$default$logEventRoute(uint8_t type, am_addr_t parent, uint8_t hopcount, uint16_t etx)
#line 744
{
return SUCCESS;
}
# 68 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$logEventRoute(uint8_t arg_0x7dc67c90, am_addr_t arg_0x7dc67e20, uint8_t arg_0x7dc66010, uint16_t arg_0x7dc661a0){
#line 68
unsigned char result;
#line 68
#line 68
result = /*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$default$logEventRoute(arg_0x7dc67c90, arg_0x7dc67e20, arg_0x7dc66010, arg_0x7dc661a0);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 177 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$resetInterval(void)
#line 177
{
/*CtpP.Router*/CtpRoutingEngineP$0$currentInterval = 1;
/*CtpP.Router*/CtpRoutingEngineP$0$chooseAdvertiseTime();
}
#line 252
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$passLinkEtxThreshold(uint16_t etx)
#line 252
{
return TRUE;
return etx < ETX_THRESHOLD;
}
# 38 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$getLinkQuality(uint16_t arg_0x7dc7d4e8){
#line 38
unsigned char result;
#line 38
#line 38
result = LinkEstimatorP$LinkEstimator$getLinkQuality(arg_0x7dc7d4e8);
#line 38
#line 38
return result;
#line 38
}
#line 38
# 259 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline uint16_t /*CtpP.Router*/CtpRoutingEngineP$0$evaluateEtx(uint8_t quality)
#line 259
{
return quality + 10;
}
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$runTask(void)
#line 267
{
uint8_t i;
routing_table_entry *entry;
routing_table_entry *best;
uint16_t minEtx;
uint16_t currentEtx;
uint16_t linkEtx;
#line 273
uint16_t pathEtx;
if (/*CtpP.Router*/CtpRoutingEngineP$0$state_is_root) {
return;
}
best = (void *)0;
minEtx = MAX_METRIC;
currentEtx = MAX_METRIC;
;
for (i = 0; i < /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive; i++) {
entry = &/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[i];
if (entry->info.parent == INVALID_ADDR || entry->info.parent == /*CtpP.Router*/CtpRoutingEngineP$0$my_ll_addr) {
;
continue;
}
linkEtx = /*CtpP.Router*/CtpRoutingEngineP$0$evaluateEtx(/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$getLinkQuality(entry->neighbor));
;
pathEtx = linkEtx + entry->info.etx;
if (entry->neighbor == /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent) {
;
currentEtx = pathEtx;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 308
{
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx = entry->info.etx;
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.congested = entry->info.congested;
}
#line 311
__nesc_atomic_end(__nesc_atomic); }
continue;
}
if (entry->info.congested) {
continue;
}
if (!/*CtpP.Router*/CtpRoutingEngineP$0$passLinkEtxThreshold(linkEtx)) {
;
continue;
}
if (pathEtx < minEtx) {
minEtx = pathEtx;
best = entry;
}
}
#line 342
if (minEtx != MAX_METRIC) {
if ((
#line 343
currentEtx == MAX_METRIC || (
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.congested && minEtx < /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx + 10)) ||
minEtx + PARENT_SWITCH_THRESHOLD < currentEtx) {
/*CtpP.Router*/CtpRoutingEngineP$0$parentChanges++;
/*CtpP.Router*/CtpRoutingEngineP$0$resetInterval();
;
/*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$logEventRoute(NET_C_TREE_NEW_PARENT, best->neighbor, 0, best->info.etx);
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$unpinNeighbor(/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent);
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$pinNeighbor(best->neighbor);
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$clearDLQ(best->neighbor);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 357
{
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent = best->neighbor;
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx = best->info.etx;
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.congested = best->info.congested;
}
#line 361
__nesc_atomic_end(__nesc_atomic); }
}
}
if (/*CtpP.Router*/CtpRoutingEngineP$0$justEvicted && /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == INVALID_ADDR) {
/*CtpP.Router*/CtpRoutingEngineP$0$Routing$noRoute();
}
else {
if (
#line 374
!/*CtpP.Router*/CtpRoutingEngineP$0$justEvicted &&
currentEtx == MAX_METRIC &&
minEtx != MAX_METRIC) {
/*CtpP.Router*/CtpRoutingEngineP$0$Routing$routeFound();
}
}
#line 378
/*CtpP.Router*/CtpRoutingEngineP$0$justEvicted = FALSE;
}
# 35 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand32(void){
#line 35
unsigned long result;
#line 35
#line 35
result = RandomMlcgP$Random$rand32();
#line 35
#line 35
return result;
#line 35
}
#line 35
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask(void){
#line 56
unsigned 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
# 94 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline Atm128_TIFR_t HplAtm128Timer0AsyncP$TimerCtrl$getInterruptFlag(void)
#line 94
{
return * (Atm128_TIFR_t *)& * (volatile uint8_t *)(0x36 + 0x20);
}
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
inline static Atm128_TIFR_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$getInterruptFlag(void){
#line 44
union __nesc_unnamed4272 result;
#line 44
#line 44
result = HplAtm128Timer0AsyncP$TimerCtrl$getInterruptFlag();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 264 "/usr/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];
}
#line 235
static __inline uint8_t __nesc_ntoh_uint8(const void *source)
#line 235
{
const uint8_t *base = source;
#line 237
return base[0];
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(1U, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 151 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968){
#line 151
CC2420ActiveMessageP$AMPacket$setType(arg_0x7e7b77e0, arg_0x7e7b7968);
#line 151
}
#line 151
#line 92
inline static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8){
#line 92
CC2420ActiveMessageP$AMPacket$setDestination(arg_0x7e7c0928, arg_0x7e7c0ab8);
#line 92
}
#line 92
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len)
#line 47
{
/*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setDestination(msg, dest);
/*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMPacket$setType(msg, 24);
return /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$send(msg, len);
}
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t LinkEstimatorP$AMSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$send(arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 95 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static uint8_t LinkEstimatorP$SubPacket$maxPayloadLength(void){
#line 95
unsigned char result;
#line 95
#line 95
result = CC2420ActiveMessageP$Packet$maxPayloadLength();
#line 95
#line 95
return result;
#line 95
}
#line 95
# 98 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline linkest_footer_t *LinkEstimatorP$getFooter(message_t *m, uint8_t len)
#line 98
{
return (linkest_footer_t *)(len + (uint8_t *)LinkEstimatorP$Packet$getPayload(m, (void *)0));
}
# 108 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static void *LinkEstimatorP$SubPacket$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500){
#line 108
void *result;
#line 108
#line 108
result = CC2420ActiveMessageP$Packet$getPayload(arg_0x7e7c5358, arg_0x7e7c5500);
#line 108
#line 108
return result;
#line 108
}
#line 108
# 93 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline linkest_header_t *LinkEstimatorP$getHeader(message_t *m)
#line 93
{
return (linkest_header_t *)LinkEstimatorP$SubPacket$getPayload(m, (void *)0);
}
static inline uint8_t LinkEstimatorP$addLinkEstHeaderAndFooter(message_t *msg, uint8_t len)
#line 105
{
unsigned char *__nesc_temp52;
#line 106
uint8_t newlen;
linkest_header_t *hdr;
linkest_footer_t *footer;
uint8_t i;
#line 109
uint8_t j;
#line 109
uint8_t k;
uint8_t maxEntries;
#line 110
uint8_t newPrevSentIdx;
#line 111
;
hdr = LinkEstimatorP$getHeader(msg);
footer = LinkEstimatorP$getFooter(msg, len);
maxEntries = (LinkEstimatorP$SubPacket$maxPayloadLength() - len - sizeof(linkest_header_t ))
/ sizeof(linkest_footer_t );
if (maxEntries > NUM_ENTRIES_FLAG) {
maxEntries = NUM_ENTRIES_FLAG;
}
;
j = 0;
newPrevSentIdx = 0;
for (i = 0; i < 10 && j < maxEntries; i++) {
k = (LinkEstimatorP$prevSentIdx + i + 1) % 10;
if (LinkEstimatorP$NeighborTable[k].flags & VALID_ENTRY) {
__nesc_hton_uint16((unsigned char *)&footer->neighborList[j].ll_addr, LinkEstimatorP$NeighborTable[k].ll_addr);
__nesc_hton_uint8((unsigned char *)&footer->neighborList[j].inquality, LinkEstimatorP$NeighborTable[k].inquality);
newPrevSentIdx = k;
;
j++;
}
}
LinkEstimatorP$prevSentIdx = newPrevSentIdx;
__nesc_hton_uint8((unsigned char *)&hdr->seq, LinkEstimatorP$linkEstSeq++);
__nesc_hton_uint8((unsigned char *)&hdr->flags, 0);
(__nesc_temp52 = (unsigned char *)&hdr->flags, __nesc_hton_uint8(__nesc_temp52, __nesc_ntoh_uint8(__nesc_temp52) | (NUM_ENTRIES_FLAG & j)));
newlen = sizeof(linkest_header_t ) + len + j * sizeof(linkest_footer_t );
;
return newlen;
}
#line 564
static inline error_t LinkEstimatorP$Send$send(am_addr_t addr, message_t *msg, uint8_t len)
#line 564
{
uint8_t newlen;
#line 566
newlen = LinkEstimatorP$addLinkEstHeaderAndFooter(msg, len);
;
;
LinkEstimatorP$print_packet(msg, newlen);
return LinkEstimatorP$AMSend$send(addr, msg, newlen);
}
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = LinkEstimatorP$Send$send(arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 7 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpCongestion.nc"
inline static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpCongestion$isCongested(void){
#line 7
unsigned char result;
#line 7
#line 7
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpCongestion$isCongested();
#line 7
#line 7
return result;
#line 7
}
#line 7
# 385 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$runTask(void)
#line 385
{
unsigned char *__nesc_temp54;
unsigned char *__nesc_temp53;
#line 386
error_t eval;
#line 387
if (/*CtpP.Router*/CtpRoutingEngineP$0$sending) {
return;
}
__nesc_hton_uint8((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->options, 0);
if (/*CtpP.Router*/CtpRoutingEngineP$0$CtpCongestion$isCongested()) {
(__nesc_temp53 = (unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->options, __nesc_hton_uint8(__nesc_temp53, __nesc_ntoh_uint8(__nesc_temp53) | CTP_OPT_ECN));
}
__nesc_hton_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->parent, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent);
if (/*CtpP.Router*/CtpRoutingEngineP$0$state_is_root) {
__nesc_hton_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->etx, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx);
}
else {
#line 402
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == INVALID_ADDR) {
__nesc_hton_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->etx, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx);
(__nesc_temp54 = (unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->options, __nesc_hton_uint8(__nesc_temp54, __nesc_ntoh_uint8(__nesc_temp54) | CTP_OPT_PULL));
}
else
#line 405
{
__nesc_hton_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->etx, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx +
/*CtpP.Router*/CtpRoutingEngineP$0$evaluateEtx(/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$getLinkQuality(/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent)));
}
}
;
/*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$logEventRoute(NET_C_TREE_SENT_BEACON, __nesc_ntoh_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->parent), 0, __nesc_ntoh_uint16((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg->etx));
eval = /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$send(AM_BROADCAST_ADDR,
&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsgBuffer,
sizeof(ctp_routing_header_t ));
if (eval == SUCCESS) {
/*CtpP.Router*/CtpRoutingEngineP$0$sending = TRUE;
}
else {
#line 421
if (eval == EOFF) {
/*CtpP.Router*/CtpRoutingEngineP$0$radioOn = FALSE;
;
}
}
}
# 118 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$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 121
for (i = 0; i < 4 / 8 + 1; i++) {
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$cancelMask[i]) {
for (mask = 1, j = 0; j < 8; j++) {
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$cancelMask[i] & mask) {
last = i * 8 + j;
msg = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[last].msg;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[last].msg = (void *)0;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$cancelMask[i] &= ~mask;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$sendDone(last, msg, ECANCEL);
}
mask <<= 1;
}
}
}
}
# 153 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$ProbeAMSend$sendDone(message_t *msg, error_t error)
#line 153
{
DisseminationEngineImplP$m_bufBusy = FALSE;
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
DisseminationEngineImplP$ProbeAMSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$Send$sendDone(message_t *m, error_t err)
#line 57
{
/*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$AMSend$sendDone(m, err);
}
# 157 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$AMSend$sendDone(message_t *msg, error_t error)
#line 157
{
DisseminationEngineImplP$m_bufBusy = FALSE;
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
DisseminationEngineImplP$AMSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$sendDone(message_t *m, error_t err)
#line 57
{
/*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$AMSend$sendDone(m, err);
}
# 427 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$sendDone(message_t *msg, error_t error)
#line 427
{
if (msg != &/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsgBuffer || !/*CtpP.Router*/CtpRoutingEngineP$0$sending) {
return;
}
/*CtpP.Router*/CtpRoutingEngineP$0$sending = FALSE;
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void LinkEstimatorP$Send$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 575 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void LinkEstimatorP$AMSend$sendDone(message_t *msg, error_t error)
#line 575
{
return LinkEstimatorP$Send$sendDone(msg, error);
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
LinkEstimatorP$AMSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$sendDone(message_t *m, error_t err)
#line 57
{
/*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$AMSend$sendDone(m, err);
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$sendDone(message_t *m, error_t err)
#line 57
{
/*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$sendDone(m, err);
}
# 983 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEvent(uint8_t type)
#line 983
{
return SUCCESS;
}
# 50 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(uint8_t arg_0x7dc74e50){
#line 50
unsigned char result;
#line 50
#line 50
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEvent(arg_0x7dc74e50);
#line 50
#line 50
return result;
#line 50
}
#line 50
# 525 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendDoneBug(void)
#line 525
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_BAD_SENDDONE);
}
# 257 "/usr/lib/ncc/nesc_nx.h"
static __inline int8_t __nesc_ntoh_int8(const void *source)
#line 257
{
#line 257
return __nesc_ntoh_uint8(source);
}
# 68 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420PacketC.nc"
static inline bool CC2420PacketC$Acks$wasAcked(message_t *p_msg)
#line 68
{
return __nesc_ntoh_int8((unsigned char *)&CC2420PacketC$CC2420Packet$getMetadata(p_msg)->ack);
}
# 74 "/opt/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$wasAcked(message_t *arg_0x7e7b3568){
#line 74
unsigned char result;
#line 74
#line 74
result = CC2420PacketC$Acks$wasAcked(arg_0x7e7b3568);
#line 74
#line 74
return result;
#line 74
}
#line 74
# 533 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline error_t LinkEstimatorP$LinkEstimator$txNoAck(am_addr_t neighbor)
#line 533
{
neighbor_table_entry_t *ne;
uint8_t nidx = LinkEstimatorP$findIdx(neighbor);
#line 536
if (nidx == LinkEstimatorP$INVALID_RVAL) {
return FAIL;
}
ne = &LinkEstimatorP$NeighborTable[nidx];
ne->data_total++;
if (ne->data_total >= LinkEstimatorP$DLQ_PKT_WINDOW) {
LinkEstimatorP$updateDEETX(ne);
}
return SUCCESS;
}
# 61 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txNoAck(am_addr_t arg_0x7dc7b5d0){
#line 61
unsigned char result;
#line 61
#line 61
result = LinkEstimatorP$LinkEstimator$txNoAck(arg_0x7dc7b5d0);
#line 61
#line 61
return result;
#line 61
}
#line 61
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 552 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$recomputeRoutes(void)
#line 552
{
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
}
# 70 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$recomputeRoutes(void){
#line 70
/*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$recomputeRoutes();
#line 70
}
#line 70
# 933 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline
#line 932
void
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$default$sendDone(uint8_t client, message_t *msg, error_t error)
#line 933
{
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$sendDone(uint8_t arg_0x7dc57c78, message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
switch (arg_0x7dc57c78) {
#line 89
case 0U:
#line 89
OctopusC$CollectSend$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
default:
#line 89
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$default$sendDone(arg_0x7dc57c78, arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
}
#line 89
}
#line 89
# 31 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void LedsP$Led1$toggle(void){
#line 31
/*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$toggle();
#line 31
}
#line 31
# 88 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led1Toggle(void)
#line 88
{
LedsP$Led1$toggle();
;
#line 90
;
}
# 72 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led1Toggle(void){
#line 72
LedsP$Leds$led1Toggle();
#line 72
}
#line 72
# 83 "OctopusC.nc"
inline static void OctopusC$reportSent(void)
#line 83
{
#line 83
OctopusC$Leds$led1Toggle();
}
# 69 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline void /*CtpP.SendQueueP*/QueueC$0$printQueue(void)
#line 69
{
}
# 57 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txAck(am_addr_t arg_0x7dc7b138){
#line 57
unsigned char result;
#line 57
#line 57
result = LinkEstimatorP$LinkEstimator$txAck(arg_0x7dc7b138);
#line 57
#line 57
return result;
#line 57
}
#line 57
# 78 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$size(void)
#line 78
{
return /*CtpP.MessagePoolP.PoolP*/PoolP$0$free;
}
# 72 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$size(void){
#line 72
unsigned char result;
#line 72
#line 72
result = /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$size();
#line 72
#line 72
return result;
#line 72
}
#line 72
# 82 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline uint8_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$maxSize(void)
#line 82
{
return 12;
}
# 80 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$maxSize(void){
#line 80
unsigned char result;
#line 80
#line 80
result = /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$maxSize();
#line 80
#line 80
return result;
#line 80
}
#line 80
# 65 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpPacket.nc"
inline static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getType(message_t *arg_0x7dc83358){
#line 65
unsigned char result;
#line 65
#line 65
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(arg_0x7dc83358);
#line 65
#line 65
return result;
#line 65
}
#line 65
#line 53
inline static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getThl(message_t *arg_0x7dc87658){
#line 53
unsigned char result;
#line 53
#line 53
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(arg_0x7dc87658);
#line 53
#line 53
return result;
#line 53
}
#line 53
inline static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getSequenceNumber(message_t *arg_0x7dc857e8){
#line 62
unsigned char result;
#line 62
#line 62
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(arg_0x7dc857e8);
#line 62
#line 62
return result;
#line 62
}
#line 62
#line 59
inline static am_addr_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getOrigin(message_t *arg_0x7dc86c90){
#line 59
unsigned int result;
#line 59
#line 59
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(arg_0x7dc86c90);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 100 "/opt/tinyos-2.x/tos/lib/net/ctp/LruCtpMsgCacheP.nc"
static inline void /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$remove(uint8_t i)
#line 100
{
uint8_t j;
#line 102
if (i >= /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count) {
return;
}
#line 104
if (i == 0) {
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first = (/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + 1) % 4;
}
else
#line 107
{
for (j = i; j < /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count; j++) {
memcpy(&/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(j + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first) % 4], &/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(j + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + 1) % 4], sizeof(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$ctp_packet_sig_t ));
}
}
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count--;
}
static inline void /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$insert(message_t *m)
#line 116
{
uint8_t i;
#line 118
if (/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count == 4) {
i = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$lookup(m);
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$remove(i % /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count);
}
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count) % 4].origin = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getOrigin(m);
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count) % 4].seqno = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getSequenceNumber(m);
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count) % 4].thl = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getThl(m);
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[(/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count) % 4].type = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getType(m);
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count++;
}
# 40 "/opt/tinyos-2.x/tos/interfaces/Cache.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$insert(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$t arg_0x7dc16088){
#line 40
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$insert(arg_0x7dc16088);
#line 40
}
#line 40
# 155 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$sendDone(uint8_t last, message_t *msg, error_t err)
#line 155
{
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[last].msg = (void *)0;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$tryToSend();
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$sendDone(last, msg, err);
}
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$runTask(void)
#line 161
{
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$sendDone(/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current, /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current].msg, FAIL);
}
#line 57
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$nextPacket(void)
#line 57
{
uint8_t i;
#line 59
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current + 1) % 4;
for (i = 0; i < 4; i++) {
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current].msg == (void *)0 ||
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$cancelMask[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current / 8] & (1 << /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current % 8))
{
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current + 1) % 4;
}
else {
break;
}
}
if (i >= 4) {
#line 70
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = 4;
}
}
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_header_t *CC2420ActiveMessageP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 167 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline uint8_t CC2420ActiveMessageP$Packet$payloadLength(message_t *msg)
#line 167
{
return __nesc_ntoh_leuint8((unsigned char *)&CC2420ActiveMessageP$CC2420Packet$getHeader(msg)->length) - CC2420ActiveMessageP$CC2420_SIZE;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static uint8_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$payloadLength(message_t *arg_0x7e7c7ee0){
#line 67
unsigned char result;
#line 67
#line 67
result = CC2420ActiveMessageP$Packet$payloadLength(arg_0x7e7c7ee0);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 95 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$maxPayloadLength(void){
#line 95
unsigned char result;
#line 95
#line 95
result = CC2420ActiveMessageP$Packet$maxPayloadLength();
#line 95
#line 95
return result;
#line 95
}
#line 95
# 869 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$maxPayloadLength(void)
#line 869
{
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$maxPayloadLength() - sizeof(ctp_data_header_t );
}
# 83 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8){
#line 83
CC2420ActiveMessageP$Packet$setPayloadLength(arg_0x7e7c6570, arg_0x7e7c66f8);
#line 83
}
#line 83
# 865 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$setPayloadLength(message_t *msg, uint8_t len)
#line 865
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$setPayloadLength(msg, len + sizeof(ctp_data_header_t ));
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(0U, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 151 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968){
#line 151
CC2420ActiveMessageP$AMPacket$setType(arg_0x7e7b77e0, arg_0x7e7b7968);
#line 151
}
#line 151
#line 92
inline static void /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8){
#line 92
CC2420ActiveMessageP$AMPacket$setDestination(arg_0x7e7c0928, arg_0x7e7c0ab8);
#line 92
}
#line 92
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline error_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len)
#line 47
{
/*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setDestination(msg, dest);
/*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMPacket$setType(msg, 23);
return /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$send(msg, len);
}
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$send(arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 108 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$getPayload(message_t *arg_0x7e7c5358, uint8_t *arg_0x7e7c5500){
#line 108
void *result;
#line 108
#line 108
result = CC2420ActiveMessageP$Packet$getPayload(arg_0x7e7c5358, arg_0x7e7c5500);
#line 108
#line 108
return result;
#line 108
}
#line 108
# 294 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline ctp_data_header_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(message_t *m)
#line 294
{
return (ctp_data_header_t *)/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$getPayload(m, (void *)0);
}
#line 909
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$clearOption(message_t *msg, ctp_options_t opt)
#line 909
{
unsigned char *__nesc_temp51;
#line 910
(__nesc_temp51 = (unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->options, __nesc_hton_uint8(__nesc_temp51, __nesc_ntoh_uint8(__nesc_temp51) & ~opt));
}
#line 905
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setOption(message_t *msg, ctp_options_t opt)
#line 905
{
unsigned char *__nesc_temp50;
#line 906
(__nesc_temp50 = (unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->options, __nesc_hton_uint8(__nesc_temp50, __nesc_ntoh_uint8(__nesc_temp50) | opt));
}
# 58 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420PacketC.nc"
static inline error_t CC2420PacketC$Acks$requestAck(message_t *p_msg)
#line 58
{
unsigned char *__nesc_temp48;
#line 59
(__nesc_temp48 = (unsigned char *)&CC2420PacketC$CC2420Packet$getHeader(p_msg)->fcf, __nesc_hton_leuint16(__nesc_temp48, __nesc_ntoh_leuint16(__nesc_temp48) | (1 << IEEE154_FCF_ACK_REQ)));
return SUCCESS;
}
# 48 "/opt/tinyos-2.x/tos/interfaces/PacketAcknowledgements.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$requestAck(message_t *arg_0x7e7b46d8){
#line 48
unsigned char result;
#line 48
#line 48
result = CC2420PacketC$Acks$requestAck(arg_0x7e7b46d8);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 913 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setEtx(message_t *msg, uint16_t e)
#line 913
{
#line 913
__nesc_hton_uint16((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->etx, e);
}
# 51 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$getEtx(uint16_t *arg_0x7eb34478){
#line 51
unsigned char result;
#line 51
#line 51
result = /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getEtx(arg_0x7eb34478);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 861 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(message_t *msg)
#line 861
{
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$payloadLength(msg) - sizeof(ctp_data_header_t );
}
#line 942
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$default$receive(collection_id_t collectid, message_t *msg, void *payload,
uint8_t len)
#line 944
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$receive(collection_id_t arg_0x7dc56680, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7dc56680) {
#line 67
case AM_OCTOPUS_COLLECTED_MSG:
#line 67
result = OctopusC$CollectReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$default$receive(arg_0x7dc56680, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 632 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$isRoot(void)
#line 632
{
return /*CtpP.Router*/CtpRoutingEngineP$0$state_is_root;
}
# 43 "/opt/tinyos-2.x/tos/lib/net/RootControl.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$RootControl$isRoot(void){
#line 43
unsigned char result;
#line 43
#line 43
result = /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$isRoot();
#line 43
#line 43
return result;
#line 43
}
#line 43
# 81 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue(void){
#line 81
struct __nesc_unnamed4322 *result;
#line 81
#line 81
result = /*CtpP.SendQueueP*/QueueC$0$Queue$dequeue();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 135 "/opt/tinyos-2.x/tos/lib/net/ctp/LruCtpMsgCacheP.nc"
static inline bool /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$lookup(message_t *m)
#line 135
{
return /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$lookup(m) < /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count;
}
# 48 "/opt/tinyos-2.x/tos/interfaces/Cache.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$lookup(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$t arg_0x7dc165e0){
#line 48
unsigned char result;
#line 48
#line 48
result = /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Cache$lookup(arg_0x7dc165e0);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 212 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getNow(void)
#line 212
{
return /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$get();
}
# 98 "/opt/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.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getNow();
#line 98
#line 98
return result;
#line 98
}
#line 98
# 85 "/opt/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 "/opt/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
# 147 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(uint8_t num, uint32_t dt)
{
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$startTimer(num, /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow(), dt, TRUE);
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(6U, arg_0x7eb11338);
#line 62
}
#line 62
# 78 "/opt/tinyos-2.x/tos/system/RandomMlcgP.nc"
static inline uint16_t RandomMlcgP$Random$rand16(void)
#line 78
{
return (uint16_t )RandomMlcgP$Random$rand32();
}
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint16_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Random$rand16(void){
#line 41
unsigned int result;
#line 41
#line 41
result = RandomMlcgP$Random$rand16();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 966 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startCongestionTimer(uint16_t mask, uint16_t offset)
#line 966
{
uint16_t r = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Random$rand16();
#line 968
r &= mask;
r += offset;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$startOneShot(r);
;
}
# 157 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline bool /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$isRunning(uint8_t num)
{
return /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num].isrunning;
}
# 81 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$isRunning(void){
#line 81
unsigned char result;
#line 81
#line 81
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$isRunning(6U);
#line 81
#line 81
return result;
#line 81
}
#line 81
# 591 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$isNeighborCongested(am_addr_t n)
#line 591
{
uint8_t idx;
if (/*CtpP.Router*/CtpRoutingEngineP$0$ECNOff) {
return FALSE;
}
idx = /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(n);
if (idx < /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive) {
return /*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.congested;
}
return FALSE;
}
# 80 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$isNeighborCongested(am_addr_t arg_0x7eb32b50){
#line 80
unsigned char result;
#line 80
#line 80
result = /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$isNeighborCongested(arg_0x7eb32b50);
#line 80
#line 80
return result;
#line 80
}
#line 80
# 526 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$Routing$nextHop(void)
#line 526
{
return /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent;
}
# 48 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
inline static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$nextHop(void){
#line 48
unsigned int result;
#line 48
#line 48
result = /*CtpP.Router*/CtpRoutingEngineP$0$Routing$nextHop();
#line 48
#line 48
return result;
#line 48
}
#line 48
# 65 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$head(void)
#line 65
{
return /*CtpP.SendQueueP*/QueueC$0$queue[/*CtpP.SendQueueP*/QueueC$0$head];
}
# 73 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$head(void){
#line 73
struct __nesc_unnamed4322 *result;
#line 73
#line 73
result = /*CtpP.SendQueueP*/QueueC$0$Queue$head();
#line 73
#line 73
return result;
#line 73
}
#line 73
# 529 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline bool /*CtpP.Router*/CtpRoutingEngineP$0$Routing$hasRoute(void)
#line 529
{
return /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent != INVALID_ADDR;
}
# 49 "/opt/tinyos-2.x/tos/lib/net/UnicastNameFreeRouting.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$hasRoute(void){
#line 49
unsigned char result;
#line 49
#line 49
result = /*CtpP.Router*/CtpRoutingEngineP$0$Routing$hasRoute();
#line 49
#line 49
return result;
#line 49
}
#line 49
# 53 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline bool /*CtpP.SendQueueP*/QueueC$0$Queue$empty(void)
#line 53
{
return /*CtpP.SendQueueP*/QueueC$0$size == 0;
}
# 50 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$empty(void){
#line 50
unsigned char result;
#line 50
#line 50
result = /*CtpP.SendQueueP*/QueueC$0$Queue$empty();
#line 50
#line 50
return result;
#line 50
}
#line 50
# 382 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$runTask(void)
#line 382
{
;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SEND_BUSY);
return;
}
else {
#line 389
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$empty()) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SENDQUEUE_EMPTY);
return;
}
else {
#line 394
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$RootControl$isRoot() &&
!/*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$hasRoute()) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$startOneShot(10000);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_NO_ROUTE);
return;
}
else
{
error_t subsendResult;
fe_queue_entry_t *qe = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$head();
uint8_t payloadLen = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$payloadLength(qe->msg);
am_addr_t dest = /*CtpP.Forwarder*/CtpForwardingEngineP$0$UnicastNameFreeRouting$nextHop();
uint16_t gradient;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$isNeighborCongested(dest)) {
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$parentCongested) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$parentCongested = TRUE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_CONGESTION_BEGIN);
}
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$isRunning()) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startCongestionTimer(CONGESTED_WAIT_WINDOW, CONGESTED_WAIT_OFFSET);
}
;
return;
}
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$parentCongested) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$parentCongested = FALSE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_CONGESTION_END);
}
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$lookup(qe->msg)) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_DUPLICATE_CACHE_AT_SEND);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
return;
}
if (dest != /*CtpP.Forwarder*/CtpForwardingEngineP$0$lastParent) {
qe->retries = MAX_RETRIES;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$lastParent = dest;
}
;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$RootControl$isRoot()) {
collection_id_t collectid = __nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(qe->msg)->type);
#line 457
memcpy(/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr, qe->msg, sizeof(message_t ));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$ackPending = FALSE;
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$receive(collectid, /*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr, (void *)0),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$sendDone(qe->msg, SUCCESS);
return;
}
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$getEtx(&gradient) != SUCCESS) {
gradient = 0;
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setEtx(qe->msg, gradient);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$ackPending = /*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$requestAck(qe->msg) == SUCCESS;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpCongestion$isCongested()) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setOption(qe->msg, CTP_OPT_ECN);
}
else {
#line 482
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$clearOption(qe->msg, CTP_OPT_ECN);
}
subsendResult = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$send(dest, qe->msg, payloadLen);
if (subsendResult == SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = TRUE;
;
if (qe->client < /*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT) {
;
}
else {
;
}
return;
}
else {
#line 497
if (subsendResult == EOFF) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$radioOn = FALSE;
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SUBSEND_OFF);
}
else {
#line 506
if (subsendResult == EBUSY) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SUBSEND_BUSY);
}
else {
#line 516
if (subsendResult == ESIZE) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$setPayloadLength(qe->msg, /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$maxPayloadLength());
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SUBSEND_SIZE);
}
}
}
}
}
}
}
}
# 49 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline serial_header_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(message_t *msg)
#line 49
{
return (serial_header_t *)(msg->data - sizeof(serial_header_t ));
}
#line 144
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setDestination(message_t *amsg, am_addr_t addr)
#line 144
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(amsg);
#line 146
__nesc_hton_uint16((unsigned char *)&header->dest, addr);
}
# 92 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(message_t *arg_0x7e7c0928, am_addr_t arg_0x7e7c0ab8){
#line 92
/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setDestination(arg_0x7e7c0928, arg_0x7e7c0ab8);
#line 92
}
#line 92
# 163 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setType(message_t *amsg, am_id_t type)
#line 163
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(amsg);
#line 165
__nesc_hton_uint8((unsigned char *)&header->type, type);
}
# 151 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setType(message_t *arg_0x7e7b77e0, am_id_t arg_0x7e7b7968){
#line 151
/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$setType(arg_0x7e7b77e0, arg_0x7e7b7968);
#line 151
}
#line 151
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(am_id_t arg_0x7e48ab40, am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$send(arg_0x7e48ab40, arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 67 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(message_t *arg_0x7e7c1cd8){
#line 67
unsigned int result;
#line 67
#line 67
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$destination(arg_0x7e7c1cd8);
#line 67
#line 67
return result;
#line 67
}
#line 67
#line 136
inline static am_id_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(message_t *arg_0x7e7b7258){
#line 136
unsigned char result;
#line 136
#line 136
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(arg_0x7e7b7258);
#line 136
#line 136
return result;
#line 136
}
#line 136
# 115 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$setPayloadLength(message_t *msg, uint8_t len)
#line 115
{
__nesc_hton_uint8((unsigned char *)&/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(msg)->length, len);
}
# 83 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(message_t *arg_0x7e7c6570, uint8_t arg_0x7e7c66f8){
#line 83
/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$setPayloadLength(arg_0x7e7c6570, arg_0x7e7c66f8);
#line 83
}
#line 83
# 82 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(uint8_t clientId, message_t *msg,
uint8_t len)
#line 83
{
if (clientId >= 1) {
return FAIL;
}
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg != (void *)0) {
return EBUSY;
}
;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg = msg;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$setPayloadLength(msg, len);
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current >= 1) {
error_t err;
am_id_t amId = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(msg);
am_addr_t dest = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(msg);
;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = clientId;
err = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(amId, dest, msg, len);
if (err != SUCCESS) {
;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[clientId].msg = (void *)0;
}
return err;
}
else {
;
}
return SUCCESS;
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$send(0U, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 522 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline error_t SerialP$SendBytePacket$startSend(uint8_t b)
#line 522
{
bool not_busy = FALSE;
#line 524
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 524
{
if (SerialP$txBuf[SerialP$TX_DATA_INDEX].state == SerialP$BUFFER_AVAILABLE) {
SerialP$txBuf[SerialP$TX_DATA_INDEX].state = SerialP$BUFFER_FILLING;
SerialP$txBuf[SerialP$TX_DATA_INDEX].buf = b;
not_busy = TRUE;
}
}
#line 530
__nesc_atomic_end(__nesc_atomic); }
if (not_busy) {
SerialP$MaybeScheduleTx();
return SUCCESS;
}
return EBUSY;
}
# 51 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
inline static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$startSend(uint8_t arg_0x7e729780){
#line 51
unsigned char result;
#line 51
#line 51
result = SerialP$SendBytePacket$startSend(arg_0x7e729780);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 43 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfoActiveMessageP.nc"
static inline uint8_t SerialPacketInfoActiveMessageP$Info$dataLinkLength(message_t *msg, uint8_t upperLen)
#line 43
{
return upperLen + sizeof(serial_header_t );
}
# 352 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$dataLinkLength(uart_id_t id, message_t *msg,
uint8_t upperLen)
#line 353
{
return 0;
}
# 23 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
inline static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$dataLinkLength(uart_id_t arg_0x7e692d98, message_t *arg_0x7e755010, uint8_t arg_0x7e7551a0){
#line 23
unsigned char result;
#line 23
#line 23
switch (arg_0x7e692d98) {
#line 23
case TOS_SERIAL_ACTIVE_MESSAGE_ID:
#line 23
result = SerialPacketInfoActiveMessageP$Info$dataLinkLength(arg_0x7e755010, arg_0x7e7551a0);
#line 23
break;
#line 23
default:
#line 23
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$dataLinkLength(arg_0x7e692d98, arg_0x7e755010, arg_0x7e7551a0);
#line 23
break;
#line 23
}
#line 23
#line 23
return result;
#line 23
}
#line 23
# 40 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfoActiveMessageP.nc"
static inline uint8_t SerialPacketInfoActiveMessageP$Info$offset(void)
#line 40
{
return (uint8_t )(sizeof(message_header_t ) - sizeof(serial_header_t ));
}
# 349 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$offset(uart_id_t id)
#line 349
{
return 0;
}
# 15 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
inline static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$offset(uart_id_t arg_0x7e692d98){
#line 15
unsigned char result;
#line 15
#line 15
switch (arg_0x7e692d98) {
#line 15
case TOS_SERIAL_ACTIVE_MESSAGE_ID:
#line 15
result = SerialPacketInfoActiveMessageP$Info$offset();
#line 15
break;
#line 15
default:
#line 15
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$offset(arg_0x7e692d98);
#line 15
break;
#line 15
}
#line 15
#line 15
return result;
#line 15
}
#line 15
# 100 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$send(uint8_t id, message_t *msg, uint8_t len)
#line 100
{
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendState != /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SEND_STATE_IDLE) {
return EBUSY;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 105
{
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$offset(id);
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex > sizeof(message_header_t )) {
{
unsigned char __nesc_temp =
#line 108
ESIZE;
{
#line 108
__nesc_atomic_end(__nesc_atomic);
#line 108
return __nesc_temp;
}
}
}
#line 111
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendError = SUCCESS;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendBuffer = (uint8_t *)msg;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendState = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SEND_STATE_DATA;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendId = id;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendCancelled = FALSE;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendLen = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$dataLinkLength(id, msg, len) + /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex;
}
#line 123
__nesc_atomic_end(__nesc_atomic); }
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$startSend(id) == SUCCESS) {
return SUCCESS;
}
else {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendState = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SEND_STATE_IDLE;
return FAIL;
}
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$send(TOS_SERIAL_ACTIVE_MESSAGE_ID, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t SerialP$RunTx$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(SerialP$RunTx);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 48 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static inline void /*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$toggle(void)
#line 48
{
#line 48
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 48
* (volatile uint8_t *)59U ^= 1 << 0;
#line 48
__nesc_atomic_end(__nesc_atomic); }
}
# 31 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void LedsP$Led2$toggle(void){
#line 31
/*HplAtm128GeneralIOC.PortA.Bit0*/HplAtm128GeneralIOPinP$0$IO$toggle();
#line 31
}
#line 31
# 103 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led2Toggle(void)
#line 103
{
LedsP$Led2$toggle();
;
#line 105
;
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led2Toggle(void){
#line 89
LedsP$Leds$led2Toggle();
#line 89
}
#line 89
# 84 "OctopusC.nc"
inline static void OctopusC$reportReceived(void)
#line 84
{
#line 84
OctopusC$Leds$led2Toggle();
}
#line 390
static inline message_t *OctopusC$Snoop$receive(message_t *msg, void *payload, uint8_t len)
#line 390
{
return msg;
}
# 948 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$default$receive(collection_id_t collectid, message_t *msg, void *payload,
uint8_t len)
#line 950
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$receive(collection_id_t arg_0x7dc56e20, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7dc56e20) {
#line 67
case AM_OCTOPUS_COLLECTED_MSG:
#line 67
result = OctopusC$Snoop$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$default$receive(arg_0x7dc56e20, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 75 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$setNeighborCongested(am_addr_t arg_0x7eb324d8, bool arg_0x7eb32668){
#line 75
/*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$setNeighborCongested(arg_0x7eb324d8, arg_0x7eb32668);
#line 75
}
#line 75
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(3U, arg_0x7eb11338);
#line 62
}
#line 62
# 152 "/opt/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 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$stop(void){
#line 67
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(3U);
#line 67
}
#line 67
# 177 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getNow(uint8_t num)
{
return /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$getNow();
}
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getNow(void){
#line 125
unsigned long result;
#line 125
#line 125
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getNow(3U);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 187 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getdt(uint8_t num)
{
return /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num].dt;
}
# 140 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getdt(void){
#line 140
unsigned long result;
#line 140
#line 140
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getdt(3U);
#line 140
#line 140
return result;
#line 140
}
#line 140
# 182 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline uint32_t /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$gett0(uint8_t num)
{
return /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$m_timers[num].t0;
}
# 133 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static uint32_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$gett0(void){
#line 133
unsigned long result;
#line 133
#line 133
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$gett0(3U);
#line 133
#line 133
return result;
#line 133
}
#line 133
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint16_t /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand16(void){
#line 41
unsigned int result;
#line 41
#line 41
result = RandomMlcgP$Random$rand16();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 556 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerRouteUpdate(void)
#line 556
{
uint16_t beaconDelay = /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand16();
#line 559
beaconDelay &= 0x3f;
beaconDelay += 64;
if (
#line 561
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$gett0() + /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getdt() -
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$getNow() >= beaconDelay) {
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$stop();
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(beaconDelay);
}
}
# 58 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerRouteUpdate(void){
#line 58
/*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerRouteUpdate();
#line 58
}
#line 58
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$source(message_t *arg_0x7e7c0360){
#line 77
unsigned int result;
#line 77
#line 77
result = CC2420ActiveMessageP$AMPacket$source(arg_0x7e7c0360);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 811 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSnoop$receive(message_t *msg, void *payload, uint8_t len)
#line 812
{
am_addr_t proximalSrc = /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$source(msg);
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$option(msg, CTP_OPT_PULL)) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerRouteUpdate();
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$setNeighborCongested(proximalSrc, /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$option(msg, CTP_OPT_ECN));
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$Snoop$receive(/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(msg),
msg, payload + sizeof(ctp_data_header_t ),
len - sizeof(ctp_data_header_t ));
}
# 156 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline message_t *CC2420ActiveMessageP$Snoop$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len)
#line 156
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *CC2420ActiveMessageP$Snoop$receive(am_id_t arg_0x7e4354e0, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7e4354e0) {
#line 67
case 23:
#line 67
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSnoop$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = CC2420ActiveMessageP$Snoop$default$receive(arg_0x7e4354e0, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 65 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerImmediateRouteUpdate(void){
#line 65
/*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerImmediateRouteUpdate();
#line 65
}
#line 65
# 88 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$put(/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$t *arg_0x7dc2ab50){
#line 88
unsigned char result;
#line 88
#line 88
result = /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$put(arg_0x7dc2ab50);
#line 88
#line 88
return result;
#line 88
}
#line 88
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$put(/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$t *arg_0x7dc2ab50){
#line 88
unsigned char result;
#line 88
#line 88
result = /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$put(arg_0x7dc2ab50);
#line 88
#line 88
return result;
#line 88
}
#line 88
# 81 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$isRunning(void){
#line 81
unsigned char result;
#line 81
#line 81
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$isRunning(5U);
#line 81
#line 81
return result;
#line 81
}
#line 81
# 67 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(message_t *arg_0x7e7c1cd8){
#line 67
unsigned int result;
#line 67
#line 67
result = CC2420ActiveMessageP$AMPacket$destination(arg_0x7e7c1cd8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 884 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(message_t *msg)
#line 884
{
#line 884
return __nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->originSeqNo);
}
#line 992
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEventMsg(uint8_t type, uint16_t msg, am_addr_t origin, am_addr_t node)
#line 992
{
return SUCCESS;
}
# 62 "/opt/tinyos-2.x/tos/lib/net/CollectionDebug.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(uint8_t arg_0x7dc67338, uint16_t arg_0x7dc674c8, am_addr_t arg_0x7dc67658, am_addr_t arg_0x7dc677e8){
#line 62
unsigned char result;
#line 62
#line 62
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$default$logEventMsg(arg_0x7dc67338, arg_0x7dc674c8, arg_0x7dc67658, arg_0x7dc677e8);
#line 62
#line 62
return result;
#line 62
}
#line 62
# 893 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline uint16_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getEtx(message_t *msg)
#line 893
{
#line 893
return __nesc_ntoh_uint16((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->etx);
}
# 90 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$enqueue(/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t arg_0x7dc30d30){
#line 90
unsigned char result;
#line 90
#line 90
result = /*CtpP.SendQueueP*/QueueC$0$Queue$enqueue(arg_0x7dc30d30);
#line 90
#line 90
return result;
#line 90
}
#line 90
# 86 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline /*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t */*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$get(void)
#line 86
{
if (/*CtpP.MessagePoolP.PoolP*/PoolP$0$free) {
/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t *rval = /*CtpP.MessagePoolP.PoolP*/PoolP$0$queue[/*CtpP.MessagePoolP.PoolP*/PoolP$0$index];
#line 89
/*CtpP.MessagePoolP.PoolP*/PoolP$0$queue[/*CtpP.MessagePoolP.PoolP*/PoolP$0$index] = (void *)0;
/*CtpP.MessagePoolP.PoolP*/PoolP$0$free--;
/*CtpP.MessagePoolP.PoolP*/PoolP$0$index++;
if (/*CtpP.MessagePoolP.PoolP*/PoolP$0$index == 12) {
/*CtpP.MessagePoolP.PoolP*/PoolP$0$index = 0;
}
return rval;
}
return (void *)0;
}
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$t */*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$get(void){
#line 96
nx_struct message_t *result;
#line 96
#line 96
result = /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$get();
#line 96
#line 96
return result;
#line 96
}
#line 96
# 86 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline /*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t */*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$get(void)
#line 86
{
if (/*CtpP.QEntryPoolP.PoolP*/PoolP$1$free) {
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t *rval = /*CtpP.QEntryPoolP.PoolP*/PoolP$1$queue[/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index];
#line 89
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$queue[/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index] = (void *)0;
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$free--;
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index++;
if (/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index == 12) {
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index = 0;
}
return rval;
}
return (void *)0;
}
# 96 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$t */*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$get(void){
#line 96
struct __nesc_unnamed4322 *result;
#line 96
#line 96
result = /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$get();
#line 96
#line 96
return result;
#line 96
}
#line 96
# 75 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline bool /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$empty(void)
#line 75
{
return /*CtpP.QEntryPoolP.PoolP*/PoolP$1$free == 0;
}
# 61 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$empty(void){
#line 61
unsigned char result;
#line 61
#line 61
result = /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$empty();
#line 61
#line 61
return result;
#line 61
}
#line 61
# 75 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline bool /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$empty(void)
#line 75
{
return /*CtpP.MessagePoolP.PoolP*/PoolP$0$free == 0;
}
# 61 "/opt/tinyos-2.x/tos/interfaces/Pool.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$empty(void){
#line 61
unsigned char result;
#line 61
#line 61
result = /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$empty();
#line 61
#line 61
return result;
#line 61
}
#line 61
# 641 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline message_t */*CtpP.Forwarder*/CtpForwardingEngineP$0$forward(message_t *m)
#line 641
{
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$empty()) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_MSG_POOL_EMPTY);
}
else {
#line 647
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$empty()) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_QENTRY_POOL_EMPTY);
}
else {
message_t *newMsg;
fe_queue_entry_t *qe;
uint16_t gradient;
qe = /*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$get();
if (qe == (void *)0) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_GET_MSGPOOL_ERR);
return m;
}
newMsg = /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$get();
if (newMsg == (void *)0) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_GET_QEPOOL_ERR);
return m;
}
memset(newMsg, 0, sizeof(message_t ));
memset(m->metadata, 0, sizeof(message_metadata_t ));
qe->msg = m;
qe->client = 0xff;
qe->retries = MAX_RETRIES;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$enqueue(qe) == SUCCESS) {
;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$getEtx(&gradient) == SUCCESS) {
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getEtx(m) < gradient) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerImmediateRouteUpdate();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(LOOPY_WINDOW, LOOPY_OFFSET);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_LOOP_DETECTED,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(m),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(m),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(m));
}
}
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$isRunning()) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
return newMsg;
}
else
#line 703
{
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$put(newMsg) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_MSGPOOL_ERR);
}
#line 707
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$put(qe) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_QEPOOL_ERR);
}
}
}
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$triggerImmediateRouteUpdate();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SEND_QUEUE_FULL);
return m;
}
#line 937
static inline
#line 936
bool
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$default$forward(collection_id_t collectid, message_t *msg, void *payload,
uint16_t len)
#line 938
{
return TRUE;
}
# 31 "/opt/tinyos-2.x/tos/interfaces/Intercept.nc"
inline static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$forward(collection_id_t arg_0x7dc545c0, message_t *arg_0x7dc9bdf0, void *arg_0x7dc9a010, uint16_t arg_0x7dc9a1a0){
#line 31
unsigned char result;
#line 31
#line 31
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$default$forward(arg_0x7dc545c0, arg_0x7dc9bdf0, arg_0x7dc9a010, arg_0x7dc9a1a0);
#line 31
#line 31
return result;
#line 31
}
#line 31
# 919 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$matchInstance(message_t *m1, message_t *m2)
#line 919
{
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(m1) == /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(m2) &&
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(m1) == /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(m2) &&
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(m1) == /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(m2) &&
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(m1) == /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(m2);
}
# 112 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$element(uint8_t idx)
#line 112
{
idx += /*CtpP.SendQueueP*/QueueC$0$head;
idx %= 13;
return /*CtpP.SendQueueP*/QueueC$0$queue[idx];
}
# 101 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$element(uint8_t arg_0x7dc2f330){
#line 101
struct __nesc_unnamed4322 *result;
#line 101
#line 101
result = /*CtpP.SendQueueP*/QueueC$0$Queue$element(arg_0x7dc2f330);
#line 101
#line 101
return result;
#line 101
}
#line 101
# 57 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$size(void)
#line 57
{
return /*CtpP.SendQueueP*/QueueC$0$size;
}
# 58 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$size(void){
#line 58
unsigned char result;
#line 58
#line 58
result = /*CtpP.SendQueueP*/QueueC$0$Queue$size();
#line 58
#line 58
return result;
#line 58
}
#line 58
# 101 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static uint8_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$maxPayloadLength(void){
#line 101
unsigned char result;
#line 101
#line 101
result = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$maxPayloadLength(0U);
#line 101
#line 101
return result;
#line 101
}
#line 101
# 61 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline uint8_t /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$maxPayloadLength(void)
#line 61
{
return /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$maxPayloadLength();
}
# 112 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$maxPayloadLength(void){
#line 112
unsigned char result;
#line 112
#line 112
result = /*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$AMSend$maxPayloadLength();
#line 112
#line 112
return result;
#line 112
}
#line 112
# 897 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setThl(message_t *msg, uint8_t thl)
#line 897
{
#line 897
__nesc_hton_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->thl, thl);
}
#line 728
static inline message_t *
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SubReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 729
{
uint8_t netlen;
collection_id_t collectid;
bool duplicate = FALSE;
fe_queue_entry_t *qe;
uint8_t i;
#line 734
uint8_t thl;
collectid = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(msg);
thl = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(msg);
thl++;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$setThl(msg, thl);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_RCV_MSG,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
if (len > /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$maxPayloadLength()) {
return msg;
}
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$lookup(msg)) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_DUPLICATE_CACHE);
return msg;
}
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$size() > 0) {
for (i = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$size(); --i; ) {
qe = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$element(i);
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$matchInstance(qe->msg, msg)) {
duplicate = TRUE;
break;
}
}
}
if (duplicate) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_DUPLICATE_QUEUE);
return msg;
}
else {
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$RootControl$isRoot()) {
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$Receive$receive(collectid, msg,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(msg, &netlen),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(msg));
}
else {
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$Intercept$forward(collectid, msg,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(msg, &netlen),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$payloadLength(msg))) {
return msg;
}
else
#line 786
{
;
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$forward(msg);
}
}
}
}
# 702 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline uint8_t LinkEstimatorP$Packet$payloadLength(message_t *msg)
#line 702
{
linkest_header_t *hdr;
#line 704
hdr = LinkEstimatorP$getHeader(msg);
return LinkEstimatorP$SubPacket$payloadLength(msg)
- sizeof(linkest_header_t )
- sizeof(linkest_footer_t ) * (NUM_ENTRIES_FLAG & __nesc_ntoh_uint8((unsigned char *)&hdr->flags));
}
# 672 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableUpdateEntry(am_addr_t from, am_addr_t parent, uint16_t etx)
#line 672
{
uint8_t idx;
uint16_t linkEtx;
#line 675
linkEtx = /*CtpP.Router*/CtpRoutingEngineP$0$evaluateEtx(/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$getLinkQuality(from));
idx = /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(from);
if (idx == 10) {
;
return FAIL;
}
else {
#line 686
if (idx == /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive) {
if (/*CtpP.Router*/CtpRoutingEngineP$0$passLinkEtxThreshold(linkEtx)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 689
{
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].neighbor = from;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.parent = parent;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.etx = etx;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.haveHeard = 1;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.congested = FALSE;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive++;
}
#line 696
__nesc_atomic_end(__nesc_atomic); }
;
}
else
#line 698
{
;
}
}
else
#line 701
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 703
{
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].neighbor = from;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.parent = parent;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.etx = etx;
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.haveHeard = 1;
}
#line 708
__nesc_atomic_end(__nesc_atomic); }
;
}
}
#line 711
return SUCCESS;
}
# 975 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$evicted(am_addr_t neighbor)
#line 975
{
}
# 67 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static void LinkEstimatorP$LinkEstimator$evicted(am_addr_t arg_0x7dc7bf00){
#line 67
/*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$evicted(arg_0x7dc7bf00);
#line 67
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$evicted(arg_0x7dc7bf00);
#line 67
}
#line 67
# 466 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline error_t LinkEstimatorP$LinkEstimator$insertNeighbor(am_addr_t neighbor)
#line 466
{
uint8_t nidx;
nidx = LinkEstimatorP$findIdx(neighbor);
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
return SUCCESS;
}
nidx = LinkEstimatorP$findEmptyNeighborIdx();
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
LinkEstimatorP$initNeighborIdx(nidx, neighbor);
return SUCCESS;
}
else
#line 480
{
nidx = LinkEstimatorP$findWorstNeighborIdx(LinkEstimatorP$BEST_EETX);
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
LinkEstimatorP$LinkEstimator$evicted(LinkEstimatorP$NeighborTable[nidx].ll_addr);
LinkEstimatorP$initNeighborIdx(nidx, neighbor);
return SUCCESS;
}
}
return FAIL;
}
# 47 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimator.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$insertNeighbor(am_addr_t arg_0x7dc7c348){
#line 47
unsigned char result;
#line 47
#line 47
result = LinkEstimatorP$LinkEstimator$insertNeighbor(arg_0x7dc7c348);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 77 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$source(message_t *arg_0x7e7c0360){
#line 77
unsigned int result;
#line 77
#line 77
result = CC2420ActiveMessageP$AMPacket$source(arg_0x7e7c0360);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 463 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline message_t */*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 463
{
am_addr_t from;
ctp_routing_header_t *rcvBeacon;
bool congested;
if (len != sizeof(ctp_routing_header_t )) {
;
return msg;
}
from = /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$source(msg);
rcvBeacon = (ctp_routing_header_t *)payload;
congested = /*CtpP.Router*/CtpRoutingEngineP$0$CtpRoutingPacket$getOption(msg, CTP_OPT_ECN);
;
if (__nesc_ntoh_uint16((unsigned char *)&rcvBeacon->parent) != INVALID_ADDR) {
if (__nesc_ntoh_uint16((unsigned char *)&rcvBeacon->etx) == 0) {
;
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$insertNeighbor(from);
/*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$pinNeighbor(from);
}
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableUpdateEntry(from, __nesc_ntoh_uint16((unsigned char *)&rcvBeacon->parent), __nesc_ntoh_uint16((unsigned char *)&rcvBeacon->etx));
/*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$setNeighborCongested(from, congested);
}
if (/*CtpP.Router*/CtpRoutingEngineP$0$CtpRoutingPacket$getOption(msg, CTP_OPT_PULL)) {
/*CtpP.Router*/CtpRoutingEngineP$0$resetInterval();
}
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *LinkEstimatorP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
result = /*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 226 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void LinkEstimatorP$updateReverseQuality(am_addr_t neighbor, uint8_t outquality)
#line 226
{
uint8_t idx;
#line 228
idx = LinkEstimatorP$findIdx(neighbor);
if (idx != LinkEstimatorP$INVALID_RVAL) {
LinkEstimatorP$NeighborTable[idx].outquality = outquality;
LinkEstimatorP$NeighborTable[idx].outage = LinkEstimatorP$MAX_AGE;
}
}
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t LinkEstimatorP$SubAMPacket$address(void){
#line 57
unsigned int result;
#line 57
#line 57
result = CC2420ActiveMessageP$AMPacket$address();
#line 57
#line 57
return result;
#line 57
}
#line 57
#line 77
inline static am_addr_t LinkEstimatorP$SubAMPacket$source(message_t *arg_0x7e7c0360){
#line 77
unsigned int result;
#line 77
#line 77
result = CC2420ActiveMessageP$AMPacket$source(arg_0x7e7c0360);
#line 77
#line 77
return result;
#line 77
}
#line 77
#line 67
inline static am_addr_t LinkEstimatorP$SubAMPacket$destination(message_t *arg_0x7e7c1cd8){
#line 67
unsigned int result;
#line 67
#line 67
result = CC2420ActiveMessageP$AMPacket$destination(arg_0x7e7c1cd8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 595 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void LinkEstimatorP$processReceivedMessage(message_t *msg, void *payload, uint8_t len)
#line 595
{
uint8_t nidx;
uint8_t num_entries;
;
LinkEstimatorP$print_packet(msg, len);
if (LinkEstimatorP$SubAMPacket$destination(msg) == AM_BROADCAST_ADDR) {
linkest_header_t *hdr = LinkEstimatorP$getHeader(msg);
linkest_footer_t *footer;
am_addr_t ll_addr;
ll_addr = LinkEstimatorP$SubAMPacket$source(msg);
;
num_entries = __nesc_ntoh_uint8((unsigned char *)&hdr->flags) & NUM_ENTRIES_FLAG;
LinkEstimatorP$print_neighbor_table();
#line 628
nidx = LinkEstimatorP$findIdx(ll_addr);
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
LinkEstimatorP$updateNeighborEntryIdx(nidx, __nesc_ntoh_uint8((unsigned char *)&hdr->seq));
}
else
#line 632
{
nidx = LinkEstimatorP$findEmptyNeighborIdx();
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
LinkEstimatorP$initNeighborIdx(nidx, ll_addr);
LinkEstimatorP$updateNeighborEntryIdx(nidx, __nesc_ntoh_uint8((unsigned char *)&hdr->seq));
}
else
#line 638
{
nidx = LinkEstimatorP$findWorstNeighborIdx(LinkEstimatorP$EVICT_EETX_THRESHOLD);
if (nidx != LinkEstimatorP$INVALID_RVAL) {
;
LinkEstimatorP$LinkEstimator$evicted(LinkEstimatorP$NeighborTable[nidx].ll_addr);
LinkEstimatorP$initNeighborIdx(nidx, ll_addr);
}
else
#line 645
{
;
}
}
}
if (nidx != LinkEstimatorP$INVALID_RVAL && num_entries > 0) {
;
footer = (linkest_footer_t *)((uint8_t *)LinkEstimatorP$SubPacket$getPayload(msg, (void *)0)
+ LinkEstimatorP$SubPacket$payloadLength(msg)
- num_entries * sizeof(linkest_footer_t ));
{
uint8_t i;
#line 657
uint8_t my_ll_addr;
#line 658
my_ll_addr = LinkEstimatorP$SubAMPacket$address();
for (i = 0; i < num_entries; i++) {
;
if (__nesc_ntoh_uint16((unsigned char *)&footer->neighborList[i].ll_addr) == my_ll_addr) {
LinkEstimatorP$updateReverseQuality(ll_addr, __nesc_ntoh_uint8((unsigned char *)&footer->neighborList[i].inquality));
}
}
}
}
LinkEstimatorP$print_neighbor_table();
}
}
static inline message_t *LinkEstimatorP$SubReceive$receive(message_t *msg,
void *payload,
uint8_t len)
#line 680
{
;
LinkEstimatorP$processReceivedMessage(msg, payload, len);
return LinkEstimatorP$Receive$receive(msg,
LinkEstimatorP$Packet$getPayload(msg, (void *)0),
LinkEstimatorP$Packet$payloadLength(msg));
}
# 294 "/usr/lib/ncc/nesc_nx.h"
static __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];
}
# 142 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$incrementCounter(uint8_t id)
#line 142
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].count++;
}
# 251 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$TrickleTimer$default$incrementCounter(uint16_t key)
#line 251
{
}
# 77 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
inline static void DisseminationEngineImplP$TrickleTimer$incrementCounter(uint16_t arg_0x7d938688){
#line 77
switch (arg_0x7d938688) {
#line 77
case 42:
#line 77
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$incrementCounter(/*OctopusAppC.DisseminatorC*/DisseminatorC$0$TIMER_ID);
#line 77
break;
#line 77
default:
#line 77
DisseminationEngineImplP$TrickleTimer$default$incrementCounter(arg_0x7d938688);
#line 77
break;
#line 77
}
#line 77
}
#line 77
# 249 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$TrickleTimer$default$reset(uint16_t key)
#line 249
{
}
# 72 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
inline static void DisseminationEngineImplP$TrickleTimer$reset(uint16_t arg_0x7d938688){
#line 72
switch (arg_0x7d938688) {
#line 72
case 42:
#line 72
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$reset(/*OctopusAppC.DisseminatorC*/DisseminatorC$0$TIMER_ID);
#line 72
break;
#line 72
default:
#line 72
DisseminationEngineImplP$TrickleTimer$default$reset(arg_0x7d938688);
#line 72
break;
#line 72
}
#line 72
}
#line 72
# 238 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline
#line 237
void
DisseminationEngineImplP$DisseminationCache$default$storeData(uint16_t key, void *data,
uint8_t size,
uint32_t seqno)
#line 240
{
}
# 48 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
inline static void DisseminationEngineImplP$DisseminationCache$storeData(uint16_t arg_0x7d939bb0, void *arg_0x7d943e80, uint8_t arg_0x7d942030, uint32_t arg_0x7d9421c0){
#line 48
switch (arg_0x7d939bb0) {
#line 48
case 42:
#line 48
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$storeData(arg_0x7d943e80, arg_0x7d942030, arg_0x7d9421c0);
#line 48
break;
#line 48
default:
#line 48
DisseminationEngineImplP$DisseminationCache$default$storeData(arg_0x7d939bb0, arg_0x7d943e80, arg_0x7d942030, arg_0x7d9421c0);
#line 48
break;
#line 48
}
#line 48
}
#line 48
# 106 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static inline uint32_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestSeqno(void)
#line 106
{
return /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno;
}
# 243 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline
#line 242
uint32_t
DisseminationEngineImplP$DisseminationCache$default$requestSeqno(uint16_t key)
#line 243
{
#line 243
return DISSEMINATION_SEQNO_UNKNOWN;
}
# 49 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
inline static uint32_t DisseminationEngineImplP$DisseminationCache$requestSeqno(uint16_t arg_0x7d939bb0){
#line 49
unsigned long result;
#line 49
#line 49
switch (arg_0x7d939bb0) {
#line 49
case 42:
#line 49
result = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$requestSeqno();
#line 49
break;
#line 49
default:
#line 49
result = DisseminationEngineImplP$DisseminationCache$default$requestSeqno(arg_0x7d939bb0);
#line 49
break;
#line 49
}
#line 49
#line 49
return result;
#line 49
}
#line 49
# 161 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline message_t *DisseminationEngineImplP$Receive$receive(message_t *msg,
void *payload,
uint8_t len)
#line 163
{
dissemination_message_t *dMsg =
(dissemination_message_t *)payload;
uint16_t key = __nesc_ntoh_uint16((unsigned char *)&dMsg->key);
uint32_t incomingSeqno = __nesc_ntoh_uint32((unsigned char *)&dMsg->seqno);
uint32_t currentSeqno = DisseminationEngineImplP$DisseminationCache$requestSeqno(key);
if (!DisseminationEngineImplP$m_running) {
#line 172
return msg;
}
if (currentSeqno == DISSEMINATION_SEQNO_UNKNOWN &&
incomingSeqno != DISSEMINATION_SEQNO_UNKNOWN) {
DisseminationEngineImplP$DisseminationCache$storeData(key,
dMsg->data,
len - sizeof(dissemination_message_t ),
incomingSeqno);
DisseminationEngineImplP$TrickleTimer$reset(key);
return msg;
}
if (incomingSeqno == DISSEMINATION_SEQNO_UNKNOWN &&
currentSeqno != DISSEMINATION_SEQNO_UNKNOWN) {
DisseminationEngineImplP$TrickleTimer$reset(key);
return msg;
}
if ((int32_t )(incomingSeqno - currentSeqno) > 0) {
DisseminationEngineImplP$DisseminationCache$storeData(key,
dMsg->data,
len - sizeof(dissemination_message_t ),
incomingSeqno);
;
DisseminationEngineImplP$TrickleTimer$reset(key);
}
else {
#line 202
if ((int32_t )(incomingSeqno - currentSeqno) == 0) {
DisseminationEngineImplP$TrickleTimer$incrementCounter(key);
}
else {
DisseminationEngineImplP$sendObject(key);
}
}
return msg;
}
static inline message_t *DisseminationEngineImplP$ProbeReceive$receive(message_t *msg,
void *payload,
uint8_t len)
#line 219
{
dissemination_probe_message_t *dpMsg =
(dissemination_probe_message_t *)payload;
if (!DisseminationEngineImplP$m_running) {
#line 224
return msg;
}
if (DisseminationEngineImplP$DisseminationCache$requestSeqno(__nesc_ntoh_uint16((unsigned char *)&dpMsg->key)) !=
DISSEMINATION_SEQNO_UNKNOWN) {
DisseminationEngineImplP$sendObject(__nesc_ntoh_uint16((unsigned char *)&dpMsg->key));
}
return msg;
}
# 152 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline message_t *CC2420ActiveMessageP$Receive$default$receive(am_id_t id, message_t *msg, void *payload, uint8_t len)
#line 152
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *CC2420ActiveMessageP$Receive$receive(am_id_t arg_0x7e437cc8, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7e437cc8) {
#line 67
case 13:
#line 67
result = DisseminationEngineImplP$Receive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
case 14:
#line 67
result = DisseminationEngineImplP$ProbeReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
case 23:
#line 67
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
case 24:
#line 67
result = LinkEstimatorP$SubReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = CC2420ActiveMessageP$Receive$default$receive(arg_0x7e437cc8, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 137 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline bool CC2420ActiveMessageP$AMPacket$isForMe(message_t *amsg)
#line 137
{
return CC2420ActiveMessageP$AMPacket$destination(amsg) == CC2420ActiveMessageP$AMPacket$address() ||
CC2420ActiveMessageP$AMPacket$destination(amsg) == AM_BROADCAST_ADDR;
}
#line 104
static inline message_t *CC2420ActiveMessageP$SubReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 104
{
if (CC2420ActiveMessageP$AMPacket$isForMe(msg)) {
return CC2420ActiveMessageP$Receive$receive(CC2420ActiveMessageP$AMPacket$type(msg), msg, payload, len - CC2420ActiveMessageP$CC2420_SIZE);
}
else {
return CC2420ActiveMessageP$Snoop$receive(CC2420ActiveMessageP$AMPacket$type(msg), msg, payload, len - CC2420ActiveMessageP$CC2420_SIZE);
}
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *UniqueReceiveP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
result = CC2420ActiveMessageP$SubReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 156 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueReceiveP.nc"
static inline void UniqueReceiveP$insert(uint16_t msgSource, uint8_t msgDsn)
#line 156
{
uint8_t element = UniqueReceiveP$recycleSourceElement;
bool increment = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 160
{
if (element == UniqueReceiveP$INVALID_ELEMENT || UniqueReceiveP$writeIndex == element) {
element = UniqueReceiveP$writeIndex;
increment = TRUE;
}
UniqueReceiveP$receivedMessages[element].source = msgSource;
UniqueReceiveP$receivedMessages[element].dsn = msgDsn;
if (increment) {
UniqueReceiveP$writeIndex++;
UniqueReceiveP$writeIndex %= 4;
}
}
#line 173
__nesc_atomic_end(__nesc_atomic); }
}
static inline message_t *UniqueReceiveP$DuplicateReceive$default$receive(message_t *msg, void *payload, uint8_t len)
#line 177
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *UniqueReceiveP$DuplicateReceive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
result = UniqueReceiveP$DuplicateReceive$default$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 130 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueReceiveP.nc"
static inline bool UniqueReceiveP$hasSeen(uint16_t msgSource, uint8_t msgDsn)
#line 130
{
int i;
#line 132
UniqueReceiveP$recycleSourceElement = UniqueReceiveP$INVALID_ELEMENT;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 134
{
for (i = 0; i < 4; i++) {
if (UniqueReceiveP$receivedMessages[i].source == msgSource) {
if (UniqueReceiveP$receivedMessages[i].dsn == msgDsn) {
{
unsigned char __nesc_temp =
#line 139
TRUE;
{
#line 139
__nesc_atomic_end(__nesc_atomic);
#line 139
return __nesc_temp;
}
}
}
#line 142
UniqueReceiveP$recycleSourceElement = i;
}
}
}
#line 145
__nesc_atomic_end(__nesc_atomic); }
return FALSE;
}
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_header_t *UniqueReceiveP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 104 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueReceiveP.nc"
static inline message_t *UniqueReceiveP$SubReceive$receive(message_t *msg, void *payload,
uint8_t len)
#line 105
{
uint16_t msgSource = __nesc_ntoh_leuint16((unsigned char *)&UniqueReceiveP$CC2420Packet$getHeader(msg)->src);
uint8_t msgDsn = __nesc_ntoh_leuint8((unsigned char *)&UniqueReceiveP$CC2420Packet$getHeader(msg)->dsn);
if (UniqueReceiveP$hasSeen(msgSource, msgDsn)) {
return UniqueReceiveP$DuplicateReceive$receive(msg, payload, len);
}
else {
UniqueReceiveP$insert(msgSource, msgDsn);
return UniqueReceiveP$Receive$receive(msg, payload, len);
}
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t *CC2420ReceiveP$Receive$receive(message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
result = UniqueReceiveP$SubReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_metadata_t *CC2420ReceiveP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0){
#line 82
nx_struct cc2420_metadata_t *result;
#line 82
#line 82
result = CC2420PacketC$CC2420Packet$getMetadata(arg_0x7e448bc0);
#line 82
#line 82
return result;
#line 82
}
#line 82
#line 77
inline static cc2420_header_t *CC2420ReceiveP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 289 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$receiveDone_task$runTask(void)
#line 289
{
cc2420_header_t *header = CC2420ReceiveP$CC2420Packet$getHeader(CC2420ReceiveP$m_p_rx_buf);
cc2420_metadata_t *metadata = CC2420ReceiveP$CC2420Packet$getMetadata(CC2420ReceiveP$m_p_rx_buf);
uint8_t *buf = (uint8_t *)header;
uint8_t length = buf[0];
__nesc_hton_int8((unsigned char *)&metadata->crc, buf[length] >> 7);
__nesc_hton_uint8((unsigned char *)&metadata->rssi, buf[length - 1]);
__nesc_hton_uint8((unsigned char *)&metadata->lqi, buf[length] & 0x7f);
CC2420ReceiveP$m_p_rx_buf = CC2420ReceiveP$Receive$receive(CC2420ReceiveP$m_p_rx_buf, CC2420ReceiveP$m_p_rx_buf->data,
length);
CC2420ReceiveP$waitForNextPacket();
}
# 74 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static inline const /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t */*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$get(void)
#line 74
{
return &/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$valueCache;
}
# 47 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
inline static const OctopusC$RequestValue$t *OctopusC$RequestValue$get(void){
#line 47
nx_struct octopus_sent_msg const *result;
#line 47
#line 47
result = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$get();
#line 47
#line 47
return result;
#line 47
}
#line 47
# 314 "OctopusC.nc"
static inline void OctopusC$RequestValue$changed(void)
#line 314
{
octopus_sent_msg_t *newRequest = (octopus_sent_msg_t *)OctopusC$RequestValue$get();
OctopusC$processRequest(newRequest);
}
# 61 "/opt/tinyos-2.x/tos/lib/net/DisseminationValue.nc"
inline static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$changed(void){
#line 61
OctopusC$RequestValue$changed();
#line 61
}
#line 61
# 67 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void OctopusC$Timer$stop(void){
#line 67
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(0U);
#line 67
}
#line 67
# 51 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static error_t OctopusC$CollectInfo$getEtx(uint16_t *arg_0x7eb34478){
#line 51
unsigned char result;
#line 51
#line 51
result = /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getEtx(arg_0x7eb34478);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 534 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getParent(am_addr_t *parent)
#line 534
{
if (parent == (void *)0) {
return FAIL;
}
#line 537
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == INVALID_ADDR) {
return FAIL;
}
#line 539
*parent = /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent;
return SUCCESS;
}
# 41 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpInfo.nc"
inline static error_t OctopusC$CollectInfo$getParent(am_addr_t *arg_0x7eb43e58){
#line 41
unsigned char result;
#line 41
#line 41
result = /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getParent(arg_0x7eb43e58);
#line 41
#line 41
return result;
#line 41
}
#line 41
# 54 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420LplDummyP.nc"
static inline void CC2420LplDummyP$LowPowerListening$setLocalDutyCycle(uint16_t dutyCycle)
#line 54
{
}
# 76 "/opt/tinyos-2.x/tos/interfaces/LowPowerListening.nc"
inline static void OctopusC$LowPowerListening$setLocalDutyCycle(uint16_t arg_0x7eb90890){
#line 76
CC2420LplDummyP$LowPowerListening$setLocalDutyCycle(arg_0x7eb90890);
#line 76
}
#line 76
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint16_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Random$rand16(void){
#line 41
unsigned int result;
#line 41
#line 41
result = RandomMlcgP$Random$rand16();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 125 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getNow(void){
#line 125
unsigned long result;
#line 125
#line 125
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getNow(7U);
#line 125
#line 125
return result;
#line 125
}
#line 125
inline static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$gett0(void){
#line 133
unsigned long result;
#line 133
#line 133
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$gett0(7U);
#line 133
#line 133
return result;
#line 133
}
#line 133
# 55 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getMask(uint16_t bitnum)
{
return 1 << bitnum % /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$ELEMENT_SIZE;
}
#line 50
static inline uint16_t /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getIndex(uint16_t bitnum)
{
return bitnum / /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$ELEMENT_SIZE;
}
#line 76
static inline bool /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$get(uint16_t bitnum)
{
return /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getIndex(bitnum)] & /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getMask(bitnum) ? TRUE : FALSE;
}
# 46 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static bool /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$get(uint16_t arg_0x7d8b8a68){
#line 46
unsigned char result;
#line 46
#line 46
result = /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$get(arg_0x7d8b8a68);
#line 46
#line 46
return result;
#line 46
}
#line 46
# 86 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clear(uint16_t bitnum)
{
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getIndex(bitnum)] &= ~/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getMask(bitnum);
}
# 58 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clear(uint16_t arg_0x7d8b7510){
#line 58
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clear(arg_0x7d8b7510);
#line 58
}
#line 58
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(7U, arg_0x7eb11338);
#line 62
}
#line 62
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$stop(void){
#line 67
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(7U);
#line 67
}
#line 67
# 280 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline uint8_t LinkEstimatorP$computeBidirEETX(uint8_t q1, uint8_t q2)
#line 280
{
uint16_t q;
#line 282
if (q1 > 0 && q2 > 0) {
q = 65025u / q1;
q = 10 * q / q2 - 10;
if (q > 255) {
q = LinkEstimatorP$LARGE_EETX_VALUE;
}
return (uint8_t )q;
}
else
#line 289
{
return LinkEstimatorP$LARGE_EETX_VALUE;
}
}
static inline void LinkEstimatorP$updateNeighborTableEst(am_addr_t n)
#line 296
{
uint8_t i;
#line 297
uint8_t totalPkt;
neighbor_table_entry_t *ne;
uint8_t newEst;
uint8_t minPkt;
minPkt = LinkEstimatorP$BLQ_PKT_WINDOW;
;
for (i = 0; i < 10; i++) {
ne = &LinkEstimatorP$NeighborTable[i];
if (ne->ll_addr == n) {
if (ne->flags & VALID_ENTRY) {
if (ne->inage > 0) {
ne->inage--;
}
#line 310
if (ne->outage > 0) {
ne->outage--;
}
if (ne->inage == 0 && ne->outage == 0) {
ne->flags ^= VALID_ENTRY;
ne->inquality = ne->outquality = 0;
}
else
#line 316
{
;
ne->flags |= MATURE_ENTRY;
totalPkt = ne->rcvcnt + ne->failcnt;
;
if (totalPkt < minPkt) {
totalPkt = minPkt;
}
if (totalPkt == 0) {
ne->inquality = LinkEstimatorP$ALPHA * ne->inquality / 10;
}
else
#line 326
{
newEst = 255 * ne->rcvcnt / totalPkt;
;
ne->inquality = (LinkEstimatorP$ALPHA * ne->inquality + (10 - LinkEstimatorP$ALPHA) * newEst) / 10;
}
ne->rcvcnt = 0;
ne->failcnt = 0;
}
LinkEstimatorP$updateEETX(ne, LinkEstimatorP$computeBidirEETX(ne->inquality, ne->outquality));
}
else {
;
}
}
}
}
# 715 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableEvict(am_addr_t neighbor)
#line 715
{
uint8_t idx;
#line 716
uint8_t i;
#line 717
idx = /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(neighbor);
if (idx == /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive) {
return FAIL;
}
#line 720
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive--;
for (i = idx; i < /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive; i++) {
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[i] = /*CtpP.Router*/CtpRoutingEngineP$0$routingTable[i + 1];
}
return SUCCESS;
}
# 688 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void *LinkEstimatorP$Receive$getPayload(message_t *msg, uint8_t *len)
#line 688
{
return LinkEstimatorP$Packet$getPayload(msg, len);
}
# 79 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static void */*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$getPayload(message_t *arg_0x7eb45a48, uint8_t *arg_0x7eb45bf0){
#line 79
void *result;
#line 79
#line 79
result = LinkEstimatorP$Receive$getPayload(arg_0x7eb45a48, arg_0x7eb45bf0);
#line 79
#line 79
return result;
#line 79
}
#line 79
# 456 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline ctp_routing_header_t */*CtpP.Router*/CtpRoutingEngineP$0$getHeader(message_t *m)
#line 456
{
return (ctp_routing_header_t *)/*CtpP.Router*/CtpRoutingEngineP$0$BeaconReceive$getPayload(m, (void *)0);
}
# 87 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ReceiveP$SpiResource$immediateRequest(void){
#line 87
unsigned char result;
#line 87
#line 87
result = CC2420SpiImplP$Resource$immediateRequest(/*CC2420ReceiveC.Spi*/CC2420SpiC$4$CLIENT_ID);
#line 87
#line 87
return result;
#line 87
}
#line 87
# 153 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline error_t CC2420SpiImplP$Fifo$continueRead(uint8_t addr, uint8_t *data,
uint8_t len)
#line 154
{
CC2420SpiImplP$SpiPacket$send((void *)0, data, len);
return SUCCESS;
}
#line 133
static inline cc2420_status_t CC2420SpiImplP$Fifo$beginRead(uint8_t addr, uint8_t *data,
uint8_t len)
#line 134
{
cc2420_status_t status = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 138
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 140
status;
{
#line 140
__nesc_atomic_end(__nesc_atomic);
#line 140
return __nesc_temp;
}
}
}
}
#line 144
__nesc_atomic_end(__nesc_atomic); }
#line 144
CC2420SpiImplP$m_addr = addr | 0x40;
status = CC2420SpiImplP$SpiByte$write(CC2420SpiImplP$m_addr);
CC2420SpiImplP$Fifo$continueRead(addr, data, len);
return status;
}
# 51 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
inline static cc2420_status_t CC2420ReceiveP$RXFIFO$beginRead(uint8_t *arg_0x7e039458, uint8_t arg_0x7e0395e0){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420SpiImplP$Fifo$beginRead(CC2420_RXFIFO, arg_0x7e039458, arg_0x7e0395e0);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ReceiveP$SpiResource$request(void){
#line 78
unsigned char result;
#line 78
#line 78
result = CC2420SpiImplP$Resource$request(/*CC2420ReceiveC.Spi*/CC2420SpiC$4$CLIENT_ID);
#line 78
#line 78
return result;
#line 78
}
#line 78
# 82 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_metadata_t *CC2420TransmitP$CC2420Packet$getMetadata(message_t *arg_0x7e448bc0){
#line 82
nx_struct cc2420_metadata_t *result;
#line 82
#line 82
result = CC2420PacketC$CC2420Packet$getMetadata(arg_0x7e448bc0);
#line 82
#line 82
return result;
#line 82
}
#line 82
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void CC2420TransmitP$LplDisableTimer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(2U, arg_0x7eb11338);
#line 62
}
#line 62
# 762 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$startLplTimer$runTask(void)
#line 762
{
CC2420TransmitP$LplDisableTimer$startOneShot(__nesc_ntoh_uint16((unsigned char *)&CC2420TransmitP$CC2420Packet$getMetadata(CC2420TransmitP$m_msg)->rxInterval) + 10);
}
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
inline static cc2420_status_t CC2420ControlP$RXCTRL1$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_RXCTRL1, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
inline static cc2420_status_t CC2420ControlP$MDMCTRL0$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_MDMCTRL0, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
inline static cc2420_status_t CC2420ControlP$FSCTRL$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_FSCTRL, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
inline static cc2420_status_t CC2420ControlP$IOCFG0$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_IOCFG0, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420ControlP$SXOSCON$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SXOSCON);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t HplCC2420InterruptsP$CCATask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(HplCC2420InterruptsP$CCATask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline bool /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$get(void)
#line 45
{
#line 45
return (* (volatile uint8_t *)48U & (1 << 5)) != 0;
}
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static bool HplCC2420InterruptsP$CC_CCA$get(void){
#line 32
unsigned char result;
#line 32
#line 32
result = /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$get();
#line 32
#line 32
return result;
#line 32
}
#line 32
# 104 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline error_t HplCC2420InterruptsP$CCA$enableRisingEdge(void)
#line 104
{
/* atomic removed: atomic calls only */
#line 105
HplCC2420InterruptsP$ccaWaitForState = TRUE;
/* atomic removed: atomic calls only */
#line 106
HplCC2420InterruptsP$ccaTimerDisabled = FALSE;
HplCC2420InterruptsP$ccaLastState = HplCC2420InterruptsP$CC_CCA$get();
HplCC2420InterruptsP$CCATask$postTask();
return SUCCESS;
}
# 42 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
inline static error_t CC2420ControlP$InterruptCCA$enableRisingEdge(void){
#line 42
unsigned char result;
#line 42
#line 42
result = HplCC2420InterruptsP$CCA$enableRisingEdge();
#line 42
#line 42
return result;
#line 42
}
#line 42
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
inline static cc2420_status_t CC2420ControlP$IOCFG1$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_IOCFG1, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 155 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$CC2420Power$startOscillator(void)
#line 155
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 156
{
if (CC2420ControlP$m_state != CC2420ControlP$S_VREG_STARTED) {
{
unsigned char __nesc_temp =
#line 158
FAIL;
{
#line 158
__nesc_atomic_end(__nesc_atomic);
#line 158
return __nesc_temp;
}
}
}
#line 161
CC2420ControlP$m_state = CC2420ControlP$S_XOSC_STARTING;
CC2420ControlP$IOCFG1$write(CC2420_SFDMUX_XOSC16M_STABLE <<
CC2420_IOCFG1_CCAMUX);
CC2420ControlP$InterruptCCA$enableRisingEdge();
CC2420ControlP$SXOSCON$strobe();
CC2420ControlP$IOCFG0$write((1 << CC2420_IOCFG0_FIFOP_POLARITY) | (
127 << CC2420_IOCFG0_FIFOP_THR));
CC2420ControlP$FSCTRL$write((1 << CC2420_FSCTRL_LOCK_THR) | (((
CC2420ControlP$m_channel - 11) * 5 + 357)
<< CC2420_FSCTRL_FREQ));
CC2420ControlP$MDMCTRL0$write(((((((1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE) | (
1 << CC2420_MDMCTRL0_ADR_DECODE)) | (
2 << CC2420_MDMCTRL0_CCA_HYST)) | (
3 << CC2420_MDMCTRL0_CCA_MOD)) | (
1 << CC2420_MDMCTRL0_AUTOCRC)) | (
0 << CC2420_MDMCTRL0_AUTOACK)) | (
2 << CC2420_MDMCTRL0_PREAMBLE_LENGTH));
CC2420ControlP$RXCTRL1$write(((((((1 << CC2420_RXCTRL1_RXBPF_LOCUR) | (
1 << CC2420_RXCTRL1_LOW_LOWGAIN)) | (
1 << CC2420_RXCTRL1_HIGH_HGM)) | (
1 << CC2420_RXCTRL1_LNA_CAP_ARRAY)) | (
1 << CC2420_RXCTRL1_RXMIX_TAIL)) | (
1 << CC2420_RXCTRL1_RXMIX_VCM)) | (
2 << CC2420_RXCTRL1_RXMIX_CURRENT));
}
#line 194
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
inline static error_t CC2420CsmaP$CC2420Power$startOscillator(void){
#line 71
unsigned char result;
#line 71
#line 71
result = CC2420ControlP$CC2420Power$startOscillator();
#line 71
#line 71
return result;
#line 71
}
#line 71
# 204 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$Resource$granted(void)
#line 204
{
CC2420CsmaP$CC2420Power$startOscillator();
}
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static void CC2420ControlP$Resource$granted(void){
#line 92
CC2420CsmaP$Resource$granted();
#line 92
}
#line 92
# 30 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$CSN$clr(void){
#line 30
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr();
#line 30
}
#line 30
# 304 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$SpiResource$granted(void)
#line 304
{
CC2420ControlP$CSN$clr();
CC2420ControlP$Resource$granted();
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t CC2420ControlP$syncDone_task$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(CC2420ControlP$syncDone_task);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ControlP$SyncResource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420SpiImplP$Resource$release(/*CC2420ControlC.SyncSpiC*/CC2420SpiC$1$CLIENT_ID);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 46 "/opt/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 *)56U |= 1 << 0;
}
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$CSN$set(void){
#line 29
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set();
#line 29
}
#line 29
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420ControlP$SRXON$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SRXON);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 63 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Ram.nc"
inline static cc2420_status_t CC2420ControlP$PANID$write(uint8_t arg_0x7e30f388, uint8_t *arg_0x7e30f530, uint8_t arg_0x7e30f6b8){
#line 63
unsigned char result;
#line 63
#line 63
result = CC2420SpiImplP$Ram$write(CC2420_RAM_PANID, arg_0x7e30f388, arg_0x7e30f530, arg_0x7e30f6b8);
#line 63
#line 63
return result;
#line 63
}
#line 63
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420ControlP$SRFOFF$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SRFOFF);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 278 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$SyncResource$granted(void)
#line 278
{
nxle_uint16_t id[2];
uint8_t channel;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 283
{
channel = CC2420ControlP$m_channel;
__nesc_hton_leuint16((unsigned char *)&id[0], CC2420ControlP$m_pan);
__nesc_hton_leuint16((unsigned char *)&id[1], CC2420ControlP$m_short_addr);
}
#line 287
__nesc_atomic_end(__nesc_atomic); }
CC2420ControlP$CSN$clr();
CC2420ControlP$SRFOFF$strobe();
CC2420ControlP$FSCTRL$write((1 << CC2420_FSCTRL_LOCK_THR) | (((
channel - 11) * 5 + 357) << CC2420_FSCTRL_FREQ));
CC2420ControlP$PANID$write(0, (uint8_t *)id, sizeof id);
CC2420ControlP$CSN$set();
CC2420ControlP$CSN$clr();
CC2420ControlP$SRXON$strobe();
CC2420ControlP$CSN$set();
CC2420ControlP$SyncResource$release();
CC2420ControlP$syncDone_task$postTask();
}
#line 355
static inline void CC2420ControlP$ReadRssi$default$readDone(error_t error, uint16_t data)
#line 355
{
}
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
inline static void CC2420ControlP$ReadRssi$readDone(error_t arg_0x7eaf5668, CC2420ControlP$ReadRssi$val_t arg_0x7eaf57f0){
#line 63
CC2420ControlP$ReadRssi$default$readDone(arg_0x7eaf5668, arg_0x7eaf57f0);
#line 63
}
#line 63
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ControlP$RssiResource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420SpiImplP$Resource$release(/*CC2420ControlC.RssiResource*/CC2420SpiC$2$CLIENT_ID);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 233 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline cc2420_status_t CC2420SpiImplP$Reg$read(uint8_t addr, uint16_t *data)
#line 233
{
cc2420_status_t status = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 237
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 239
status;
{
#line 239
__nesc_atomic_end(__nesc_atomic);
#line 239
return __nesc_temp;
}
}
}
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
#line 243
status = CC2420SpiImplP$SpiByte$write(addr | 0x40);
*data = (uint16_t )CC2420SpiImplP$SpiByte$write(0) << 8;
*data |= CC2420SpiImplP$SpiByte$write(0);
return status;
}
# 47 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
inline static cc2420_status_t CC2420ControlP$RSSI$read(uint16_t *arg_0x7e30c4a0){
#line 47
unsigned char result;
#line 47
#line 47
result = CC2420SpiImplP$Reg$read(CC2420_RSSI, arg_0x7e30c4a0);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 309 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$RssiResource$granted(void)
#line 309
{
uint16_t data;
#line 311
CC2420ControlP$CSN$clr();
CC2420ControlP$RSSI$read(&data);
CC2420ControlP$CSN$set();
CC2420ControlP$RssiResource$release();
data += 0x7f;
data &= 0x00ff;
CC2420ControlP$ReadRssi$readDone(SUCCESS, data);
}
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420TransmitP$SpiResource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420SpiImplP$Resource$release(/*CC2420TransmitC.Spi*/CC2420SpiC$3$CLIENT_ID);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 706 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline error_t CC2420TransmitP$releaseSpiResource(void)
#line 706
{
CC2420TransmitP$SpiResource$release();
return SUCCESS;
}
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420TransmitP$CSN$set(void){
#line 29
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set();
#line 29
}
#line 29
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420TransmitP$SFLUSHTX$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SFLUSHTX);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 30 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420TransmitP$CSN$clr(void){
#line 30
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr();
#line 30
}
#line 30
# 358 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$SpiResource$granted(void)
#line 358
{
uint8_t cur_state;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 361
{
cur_state = CC2420TransmitP$m_state;
}
#line 363
__nesc_atomic_end(__nesc_atomic); }
switch (cur_state) {
case CC2420TransmitP$S_LOAD:
CC2420TransmitP$loadTXFIFO();
break;
case CC2420TransmitP$S_BEGIN_TRANSMIT:
CC2420TransmitP$attemptSend();
break;
case CC2420TransmitP$S_LOAD_CANCEL:
case CC2420TransmitP$S_CCA_CANCEL:
case CC2420TransmitP$S_TX_CANCEL:
CC2420TransmitP$CSN$clr();
CC2420TransmitP$SFLUSHTX$strobe();
CC2420TransmitP$CSN$set();
CC2420TransmitP$releaseSpiResource();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 381
{
if (CC2420TransmitP$signalSendDone) {
CC2420TransmitP$signalDone(ECANCEL);
}
else
#line 384
{
CC2420TransmitP$m_state = CC2420TransmitP$S_STARTED;
}
}
#line 387
__nesc_atomic_end(__nesc_atomic); }
break;
default:
CC2420TransmitP$releaseSpiResource();
break;
}
}
# 185 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$SpiResource$granted(void)
#line 185
{
CC2420ReceiveP$receive();
}
# 64 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline void CC2420SpiImplP$Resource$default$granted(uint8_t id)
#line 64
{
}
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static void CC2420SpiImplP$Resource$granted(uint8_t arg_0x7e01f6b8){
#line 92
switch (arg_0x7e01f6b8) {
#line 92
case /*CC2420ControlC.Spi*/CC2420SpiC$0$CLIENT_ID:
#line 92
CC2420ControlP$SpiResource$granted();
#line 92
break;
#line 92
case /*CC2420ControlC.SyncSpiC*/CC2420SpiC$1$CLIENT_ID:
#line 92
CC2420ControlP$SyncResource$granted();
#line 92
break;
#line 92
case /*CC2420ControlC.RssiResource*/CC2420SpiC$2$CLIENT_ID:
#line 92
CC2420ControlP$RssiResource$granted();
#line 92
break;
#line 92
case /*CC2420TransmitC.Spi*/CC2420SpiC$3$CLIENT_ID:
#line 92
CC2420TransmitP$SpiResource$granted();
#line 92
break;
#line 92
case /*CC2420ReceiveC.Spi*/CC2420SpiC$4$CLIENT_ID:
#line 92
CC2420ReceiveP$SpiResource$granted();
#line 92
break;
#line 92
default:
#line 92
CC2420SpiImplP$Resource$default$granted(arg_0x7e01f6b8);
#line 92
break;
#line 92
}
#line 92
}
#line 92
# 127 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline void CC2420SpiImplP$SpiResource$granted(void)
#line 127
{
uint8_t holder;
#line 129
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 129
holder = CC2420SpiImplP$m_holder;
#line 129
__nesc_atomic_end(__nesc_atomic); }
CC2420SpiImplP$Resource$granted(holder);
}
# 339 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline void Atm128SpiP$Resource$default$granted(uint8_t id)
#line 339
{
}
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static void Atm128SpiP$Resource$granted(uint8_t arg_0x7dfbca68){
#line 92
switch (arg_0x7dfbca68) {
#line 92
case 0U:
#line 92
CC2420SpiImplP$SpiResource$granted();
#line 92
break;
#line 92
default:
#line 92
Atm128SpiP$Resource$default$granted(arg_0x7dfbca68);
#line 92
break;
#line 92
}
#line 92
}
#line 92
# 335 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline void Atm128SpiP$ResourceArbiter$granted(uint8_t id)
#line 335
{
Atm128SpiP$Resource$granted(id);
}
# 92 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$granted(uint8_t arg_0x7dee3a00){
#line 92
Atm128SpiP$ResourceArbiter$granted(arg_0x7dee3a00);
#line 92
}
#line 92
# 150 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask(void)
#line 150
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 151
{
/*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 154
__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);
}
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
inline static void Atm128SpiP$McuPowerState$update(void){
#line 44
McuSleepC$McuPowerState$update();
#line 44
}
#line 44
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void HplAtm128SpiP$SS$set(void){
#line 29
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set();
#line 29
}
#line 29
# 95 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline void HplAtm128SpiP$SPI$sleep(void)
#line 95
{
HplAtm128SpiP$SS$set();
}
# 72 "/opt/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 99
inline static void Atm128SpiP$Spi$enableSpi(bool arg_0x7dfb1598){
#line 99
HplAtm128SpiP$SPI$enableSpi(arg_0x7dfb1598);
#line 99
}
#line 99
# 120 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline void Atm128SpiP$stopSpi(void)
#line 120
{
Atm128SpiP$Spi$enableSpi(FALSE);
Atm128SpiP$started = FALSE;
/* atomic removed: atomic calls only */
#line 123
{
Atm128SpiP$Spi$sleep();
}
Atm128SpiP$McuPowerState$update();
}
# 80 "/opt/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
# 168 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static inline void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(uint8_t id)
#line 168
{
}
# 55 "/opt/tinyos-2.x/tos/interfaces/ResourceConfigure.nc"
inline static void /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(uint8_t arg_0x7dee2ed0){
#line 55
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$default$unconfigure(arg_0x7dee2ed0);
#line 55
}
#line 55
# 58 "/opt/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 66
id;
#line 66
return __nesc_temp;
}
}
#line 68
{
unsigned char __nesc_temp =
#line 68
/*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY;
#line 68
return __nesc_temp;
}
}
}
# 60 "/opt/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 "/opt/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 "/opt/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 "/opt/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;
/* atomic removed: atomic calls only */
#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;
}
released = TRUE;
}
}
if (released == TRUE) {
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ResourceConfigure$unconfigure(id);
return SUCCESS;
}
return FAIL;
}
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t Atm128SpiP$ResourceArbiter$release(uint8_t arg_0x7dfb9bf0){
#line 110
unsigned char result;
#line 110
#line 110
result = /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$Resource$release(arg_0x7dfb9bf0);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 321 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline error_t Atm128SpiP$Resource$release(uint8_t id)
#line 321
{
error_t error = Atm128SpiP$ResourceArbiter$release(id);
/* atomic removed: atomic calls only */
#line 323
{
if (!Atm128SpiP$ArbiterInfo$inUse()) {
Atm128SpiP$stopSpi();
}
}
return error;
}
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420SpiImplP$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
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t CC2420CsmaP$sendDone_task$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(CC2420CsmaP$sendDone_task);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 195 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$CC2420Transmit$sendDone(message_t *p_msg, error_t err)
#line 195
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 196
CC2420CsmaP$sendErr = err;
#line 196
__nesc_atomic_end(__nesc_atomic); }
CC2420CsmaP$sendDone_task$postTask();
}
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Transmit.nc"
inline static void CC2420TransmitP$Send$sendDone(message_t *arg_0x7e35dd90, error_t arg_0x7e35df18){
#line 71
CC2420CsmaP$CC2420Transmit$sendDone(arg_0x7e35dd90, arg_0x7e35df18);
#line 71
}
#line 71
# 216 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$RadioBackoff$setInitialBackoff(uint16_t backoffTime)
#line 216
{
CC2420TransmitP$myInitialBackoff = backoffTime + 1;
}
# 43 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$SubBackoff$setInitialBackoff(uint16_t arg_0x7e4459b0){
#line 43
CC2420TransmitP$RadioBackoff$setInitialBackoff(arg_0x7e4459b0);
#line 43
}
#line 43
# 274 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$RadioBackoff$default$requestInitialBackoff(am_id_t amId,
message_t *msg)
#line 275
{
}
# 72 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$RadioBackoff$requestInitialBackoff(am_id_t arg_0x7e36c010, message_t *arg_0x7e4420a8){
#line 72
CC2420CsmaP$RadioBackoff$default$requestInitialBackoff(arg_0x7e36c010, arg_0x7e4420a8);
#line 72
}
#line 72
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline uint16_t HplAtm128Timer1P$Timer$get(void)
#line 49
{
#line 49
return * (volatile uint16_t *)(0x2C + 0x20);
}
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$get(void){
#line 52
unsigned int result;
#line 52
#line 52
result = HplAtm128Timer1P$Timer$get();
#line 52
#line 52
return result;
#line 52
}
#line 52
# 41 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline /*CounterOne16C.NCounter*/Atm128CounterC$1$timer_size /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$get(void)
{
return /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$get();
}
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$get(void){
#line 53
unsigned int result;
#line 53
#line 53
result = /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$get();
#line 53
#line 53
return result;
#line 53
}
#line 53
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
inline static Atm128_TIFR_t HplAtm128Timer1P$Timer0Ctrl$getInterruptFlag(void){
#line 44
union __nesc_unnamed4272 result;
#line 44
#line 44
result = HplAtm128Timer0AsyncP$TimerCtrl$getInterruptFlag();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 144 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline bool HplAtm128Timer1P$Timer$test(void)
#line 144
{
return HplAtm128Timer1P$Timer0Ctrl$getInterruptFlag().bits.tov1;
}
# 78 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static bool /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$test(void){
#line 78
unsigned char result;
#line 78
#line 78
result = HplAtm128Timer1P$Timer$test();
#line 78
#line 78
return result;
#line 78
}
#line 78
# 46 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline bool /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$isOverflowPending(void)
{
return /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$test();
}
# 60 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static bool /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$isOverflowPending(void){
#line 60
unsigned char result;
#line 60
#line 60
result = /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$isOverflowPending();
#line 60
#line 60
return result;
#line 60
}
#line 60
# 133 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareA$start(void)
#line 133
{
#line 133
* (volatile uint8_t *)(0x37 + 0x20) |= 1 << 4;
}
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start(void){
#line 56
HplAtm128Timer1P$CompareA$start();
#line 56
}
#line 56
# 127 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareA$reset(void)
#line 127
{
#line 127
* (volatile uint8_t *)(0x36 + 0x20) = 1 << 4;
}
# 53 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset(void){
#line 53
HplAtm128Timer1P$CompareA$reset();
#line 53
}
#line 53
# 183 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareA$set(uint16_t t)
#line 183
{
#line 183
* (volatile uint16_t *)(0x2A + 0x20) = t;
}
# 45 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$size_type arg_0x7e981c38){
#line 45
HplAtm128Timer1P$CompareA$set(arg_0x7e981c38);
#line 45
}
#line 45
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$timer_size /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$get(void){
#line 52
unsigned int result;
#line 52
#line 52
result = HplAtm128Timer1P$Timer$get();
#line 52
#line 52
return result;
#line 52
}
#line 52
# 74 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size t0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size dt)
#line 74
{
/* atomic removed: atomic calls only */
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size now;
#line 83
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size elapsed;
#line 83
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$timer_size expires;
;
now = /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.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;
}
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$set(expires - 1);
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$reset();
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$start();
}
}
# 92 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$size_type arg_0x7e9d39e0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$size_type arg_0x7e9d3b70){
#line 92
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$startAt(arg_0x7e9d39e0, arg_0x7e9d3b70);
#line 92
}
#line 92
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420TransmitP$STXONCCA$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_STXONCCA);
#line 45
#line 45
return result;
#line 45
}
#line 45
inline static cc2420_status_t CC2420TransmitP$STXON$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_STXON);
#line 45
#line 45
return result;
#line 45
}
#line 45
inline static cc2420_status_t CC2420TransmitP$SNOP$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SNOP);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t CC2420TransmitP$startLplTimer$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(CC2420TransmitP$startLplTimer);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 282 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$RadioBackoff$default$requestLplBackoff(am_id_t amId,
message_t *msg)
#line 283
{
}
# 87 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$RadioBackoff$requestLplBackoff(am_id_t arg_0x7e36c010, message_t *arg_0x7e442c18){
#line 87
CC2420CsmaP$RadioBackoff$default$requestLplBackoff(arg_0x7e36c010, arg_0x7e442c18);
#line 87
}
#line 87
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint16_t CC2420CsmaP$Random$rand16(void){
#line 41
unsigned int result;
#line 41
#line 41
result = RandomMlcgP$Random$rand16();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 232 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$RadioBackoff$setLplBackoff(uint16_t backoffTime)
#line 232
{
CC2420TransmitP$myLplBackoff = backoffTime + 1;
}
# 56 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$SubBackoff$setLplBackoff(uint16_t arg_0x7e444590){
#line 56
CC2420TransmitP$RadioBackoff$setLplBackoff(arg_0x7e444590);
#line 56
}
#line 56
# 229 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$SubBackoff$requestLplBackoff(message_t *msg)
#line 229
{
CC2420CsmaP$SubBackoff$setLplBackoff(CC2420CsmaP$Random$rand16() % 10);
CC2420CsmaP$RadioBackoff$requestLplBackoff(__nesc_ntoh_leuint8((unsigned char *)&((cc2420_header_t *)(msg->data -
sizeof(cc2420_header_t )))->type), msg);
}
# 87 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420TransmitP$RadioBackoff$requestLplBackoff(message_t *arg_0x7e442c18){
#line 87
CC2420CsmaP$SubBackoff$requestLplBackoff(arg_0x7e442c18);
#line 87
}
#line 87
# 278 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$RadioBackoff$default$requestCongestionBackoff(am_id_t amId,
message_t *msg)
#line 279
{
}
# 79 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$RadioBackoff$requestCongestionBackoff(am_id_t arg_0x7e36c010, message_t *arg_0x7e442660){
#line 79
CC2420CsmaP$RadioBackoff$default$requestCongestionBackoff(arg_0x7e36c010, arg_0x7e442660);
#line 79
}
#line 79
# 224 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$RadioBackoff$setCongestionBackoff(uint16_t backoffTime)
#line 224
{
CC2420TransmitP$myCongestionBackoff = backoffTime + 1;
}
# 49 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420CsmaP$SubBackoff$setCongestionBackoff(uint16_t arg_0x7e444010){
#line 49
CC2420TransmitP$RadioBackoff$setCongestionBackoff(arg_0x7e444010);
#line 49
}
#line 49
# 221 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$SubBackoff$requestCongestionBackoff(message_t *msg)
#line 221
{
CC2420CsmaP$SubBackoff$setCongestionBackoff(CC2420CsmaP$Random$rand16()
% (0x7 * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
CC2420CsmaP$RadioBackoff$requestCongestionBackoff(__nesc_ntoh_leuint8((unsigned char *)&((cc2420_header_t *)(msg->data -
sizeof(cc2420_header_t )))->type), msg);
}
# 79 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420TransmitP$RadioBackoff$requestCongestionBackoff(message_t *arg_0x7e442660){
#line 79
CC2420CsmaP$SubBackoff$requestCongestionBackoff(arg_0x7e442660);
#line 79
}
#line 79
# 71 "/opt/tinyos-2.x/tos/interfaces/SpiPacket.nc"
inline static void Atm128SpiP$SpiPacket$sendDone(uint8_t *arg_0x7e014290, uint8_t *arg_0x7e014438, uint16_t arg_0x7e0145c8, error_t arg_0x7e014760){
#line 71
CC2420SpiImplP$SpiPacket$sendDone(arg_0x7e014290, arg_0x7e014438, arg_0x7e0145c8, arg_0x7e014760);
#line 71
}
#line 71
# 207 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline void Atm128SpiP$zeroTask$runTask(void)
#line 207
{
uint8_t *rx;
uint8_t *tx;
uint16_t myLen;
#line 211
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 211
{
rx = Atm128SpiP$rxBuffer;
tx = Atm128SpiP$txBuffer;
myLen = Atm128SpiP$len;
Atm128SpiP$rxBuffer = (void *)0;
Atm128SpiP$txBuffer = (void *)0;
Atm128SpiP$len = 0;
Atm128SpiP$pos = 0;
Atm128SpiP$SpiPacket$sendDone(tx, rx, myLen, SUCCESS);
}
#line 220
__nesc_atomic_end(__nesc_atomic); }
}
# 444 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$TXFIFO$readDone(uint8_t *tx_buf, uint8_t tx_len,
error_t error)
#line 445
{
}
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ReceiveP$SpiResource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420SpiImplP$Resource$release(/*CC2420ReceiveC.Spi*/CC2420SpiC$4$CLIENT_ID);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ReceiveP$CSN$set(void){
#line 29
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$set();
#line 29
}
#line 29
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t CC2420ReceiveP$receiveDone_task$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(CC2420ReceiveP$receiveDone_task);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 139 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareA$stop(void)
#line 139
{
#line 139
* (volatile uint8_t *)(0x37 + 0x20) &= ~(1 << 4);
}
# 59 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop(void){
#line 59
HplAtm128Timer1P$CompareA$stop();
#line 59
}
#line 59
# 65 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$stop(void)
#line 65
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop();
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$stop(void){
#line 62
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$stop();
#line 62
}
#line 62
# 91 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$stop(void)
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$stop();
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void CC2420TransmitP$BackoffTimer$stop(void){
#line 62
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$stop();
#line 62
}
#line 62
# 77 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Packet.nc"
inline static cc2420_header_t *CC2420TransmitP$CC2420Packet$getHeader(message_t *arg_0x7e448670){
#line 77
nx_struct cc2420_header_t *result;
#line 77
#line 77
result = CC2420PacketC$CC2420Packet$getHeader(arg_0x7e448670);
#line 77
#line 77
return result;
#line 77
}
#line 77
# 332 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$CC2420Receive$receive(uint8_t type, message_t *ack_msg)
#line 332
{
cc2420_header_t *ack_header;
cc2420_header_t *msg_header;
cc2420_metadata_t *msg_metadata;
uint8_t *ack_buf;
uint8_t length;
if (type == IEEE154_TYPE_ACK) {
ack_header = CC2420TransmitP$CC2420Packet$getHeader(ack_msg);
msg_header = CC2420TransmitP$CC2420Packet$getHeader(CC2420TransmitP$m_msg);
msg_metadata = CC2420TransmitP$CC2420Packet$getMetadata(CC2420TransmitP$m_msg);
ack_buf = (uint8_t *)ack_header;
length = __nesc_ntoh_leuint8((unsigned char *)&ack_header->length);
if (CC2420TransmitP$m_state == CC2420TransmitP$S_ACK_WAIT && __nesc_ntoh_leuint8((unsigned char *)&
msg_header->dsn) == __nesc_ntoh_leuint8((unsigned char *)&ack_header->dsn)) {
CC2420TransmitP$BackoffTimer$stop();
__nesc_hton_int8((unsigned char *)&msg_metadata->ack, TRUE);
__nesc_hton_uint8((unsigned char *)&msg_metadata->rssi, ack_buf[length - 1]);
__nesc_hton_uint8((unsigned char *)&msg_metadata->lqi, ack_buf[length] & 0x7f);
CC2420TransmitP$signalDone(SUCCESS);
}
}
}
# 61 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
inline static void CC2420ReceiveP$CC2420Receive$receive(uint8_t arg_0x7de51408, message_t *arg_0x7de515b8){
#line 61
CC2420TransmitP$CC2420Receive$receive(arg_0x7de51408, arg_0x7de515b8);
#line 61
}
#line 61
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420ReceiveP$SACK$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SACK);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 30 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ReceiveP$CSN$clr(void){
#line 30
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$clr();
#line 30
}
#line 30
# 58 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
inline static am_addr_t CC2420ReceiveP$amAddress(void){
#line 58
unsigned int result;
#line 58
#line 58
result = ActiveMessageAddressC$amAddress();
#line 58
#line 58
return result;
#line 58
}
#line 58
# 62 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
inline static error_t CC2420ReceiveP$RXFIFO$continueRead(uint8_t *arg_0x7e039bf0, uint8_t arg_0x7e039d78){
#line 62
unsigned char result;
#line 62
#line 62
result = CC2420SpiImplP$Fifo$continueRead(CC2420_RXFIFO, arg_0x7e039bf0, arg_0x7e039d78);
#line 62
#line 62
return result;
#line 62
}
#line 62
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline bool /*HplAtm128GeneralIOC.PortE.Bit4*/HplAtm128GeneralIOPinP$36$IO$get(void)
#line 45
{
#line 45
return (* (volatile uint8_t *)33U & (1 << 4)) != 0;
}
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static bool CC2420ReceiveP$FIFOP$get(void){
#line 32
unsigned char result;
#line 32
#line 32
result = /*HplAtm128GeneralIOC.PortE.Bit4*/HplAtm128GeneralIOPinP$36$IO$get();
#line 32
#line 32
return result;
#line 32
}
#line 32
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline bool /*HplAtm128GeneralIOC.PortE.Bit5*/HplAtm128GeneralIOPinP$37$IO$get(void)
#line 45
{
#line 45
return (* (volatile uint8_t *)33U & (1 << 5)) != 0;
}
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static bool CC2420ReceiveP$FIFO$get(void){
#line 32
unsigned char result;
#line 32
#line 32
result = /*HplAtm128GeneralIOC.PortE.Bit5*/HplAtm128GeneralIOPinP$37$IO$get();
#line 32
#line 32
return result;
#line 32
}
#line 32
# 194 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$RXFIFO$readDone(uint8_t *rx_buf, uint8_t rx_len,
error_t error)
#line 195
{
cc2420_header_t *header = CC2420ReceiveP$CC2420Packet$getHeader(CC2420ReceiveP$m_p_rx_buf);
cc2420_metadata_t *metadata = CC2420ReceiveP$CC2420Packet$getMetadata(CC2420ReceiveP$m_p_rx_buf);
uint8_t *buf = (uint8_t *)header;
uint8_t length = buf[0];
switch (CC2420ReceiveP$m_state) {
case CC2420ReceiveP$S_RX_HEADER:
CC2420ReceiveP$m_state = CC2420ReceiveP$S_RX_PAYLOAD;
if (length + 1 > CC2420ReceiveP$m_bytes_left) {
CC2420ReceiveP$flush();
}
else {
if (!CC2420ReceiveP$FIFO$get() && !CC2420ReceiveP$FIFOP$get()) {
CC2420ReceiveP$m_bytes_left -= length + 1;
}
if (length <= MAC_PACKET_SIZE) {
if (length > 0) {
CC2420ReceiveP$RXFIFO$continueRead((uint8_t *)CC2420ReceiveP$CC2420Packet$getHeader(
CC2420ReceiveP$m_p_rx_buf) + 1, length);
}
else {
CC2420ReceiveP$CSN$set();
CC2420ReceiveP$SpiResource$release();
CC2420ReceiveP$waitForNextPacket();
}
}
else {
CC2420ReceiveP$flush();
}
}
break;
case CC2420ReceiveP$S_RX_PAYLOAD:
CC2420ReceiveP$CSN$set();
if (((__nesc_ntoh_leuint16((unsigned char *)&
#line 238
header->fcf) >> IEEE154_FCF_ACK_REQ) & 0x01) == 1
&& __nesc_ntoh_leuint16((unsigned char *)&header->dest) == CC2420ReceiveP$amAddress()
&& ((__nesc_ntoh_leuint16((unsigned char *)&header->fcf) >> IEEE154_FCF_FRAME_TYPE) & 7) == IEEE154_TYPE_DATA) {
CC2420ReceiveP$CSN$clr();
CC2420ReceiveP$SACK$strobe();
CC2420ReceiveP$CSN$set();
}
CC2420ReceiveP$SpiResource$release();
if (CC2420ReceiveP$m_timestamp_size) {
if (length > 10) {
__nesc_hton_uint16((unsigned char *)&metadata->time, CC2420ReceiveP$m_timestamp_queue[CC2420ReceiveP$m_timestamp_head]);
CC2420ReceiveP$m_timestamp_head = (CC2420ReceiveP$m_timestamp_head + 1) % CC2420ReceiveP$TIMESTAMP_QUEUE_SIZE;
CC2420ReceiveP$m_timestamp_size--;
}
}
else
#line 255
{
__nesc_hton_uint16((unsigned char *)&metadata->time, 0xffff);
}
if (buf[length] >> 7 && rx_buf) {
uint8_t type = (__nesc_ntoh_leuint16((unsigned char *)&header->fcf) >> IEEE154_FCF_FRAME_TYPE) & 7;
#line 262
CC2420ReceiveP$CC2420Receive$receive(type, CC2420ReceiveP$m_p_rx_buf);
if (type == IEEE154_TYPE_DATA) {
CC2420ReceiveP$receiveDone_task$postTask();
return;
}
}
CC2420ReceiveP$waitForNextPacket();
break;
default:
CC2420ReceiveP$CSN$set();
CC2420ReceiveP$SpiResource$release();
break;
}
}
# 274 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline void CC2420SpiImplP$Fifo$default$readDone(uint8_t addr, uint8_t *rx_buf, uint8_t rx_len, error_t error)
#line 274
{
}
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
inline static void CC2420SpiImplP$Fifo$readDone(uint8_t arg_0x7e01e068, uint8_t *arg_0x7e0383f0, uint8_t arg_0x7e038578, error_t arg_0x7e038700){
#line 71
switch (arg_0x7e01e068) {
#line 71
case CC2420_TXFIFO:
#line 71
CC2420TransmitP$TXFIFO$readDone(arg_0x7e0383f0, arg_0x7e038578, arg_0x7e038700);
#line 71
break;
#line 71
case CC2420_RXFIFO:
#line 71
CC2420ReceiveP$RXFIFO$readDone(arg_0x7e0383f0, arg_0x7e038578, arg_0x7e038700);
#line 71
break;
#line 71
default:
#line 71
CC2420SpiImplP$Fifo$default$readDone(arg_0x7e01e068, arg_0x7e0383f0, arg_0x7e038578, arg_0x7e038700);
#line 71
break;
#line 71
}
#line 71
}
#line 71
# 45 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Strobe.nc"
inline static cc2420_status_t CC2420ReceiveP$SFLUSHRX$strobe(void){
#line 45
unsigned char result;
#line 45
#line 45
result = CC2420SpiImplP$Strobe$strobe(CC2420_SFLUSHRX);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 53 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$get(void){
#line 53
unsigned long result;
#line 53
#line 53
result = /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$get();
#line 53
#line 53
return result;
#line 53
}
#line 53
# 75 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
static inline /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$getNow(void)
{
return /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$get();
}
#line 146
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$start(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type dt)
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$getNow(), dt);
}
# 55 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$BackoffTimer$size_type arg_0x7e9d48c8){
#line 55
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$start(arg_0x7e9d48c8);
#line 55
}
#line 55
# 72 "/opt/tinyos-2.x/tos/chips/cc2420/RadioBackoff.nc"
inline static void CC2420TransmitP$RadioBackoff$requestInitialBackoff(message_t *arg_0x7e4420a8){
#line 72
CC2420CsmaP$SubBackoff$requestInitialBackoff(arg_0x7e4420a8);
#line 72
}
#line 72
# 401 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$TXFIFO$writeDone(uint8_t *tx_buf, uint8_t tx_len,
error_t error)
#line 402
{
CC2420TransmitP$CSN$set();
if (CC2420TransmitP$m_state == CC2420TransmitP$S_LOAD_CANCEL) {
/* atomic removed: atomic calls only */
#line 406
{
CC2420TransmitP$CSN$clr();
CC2420TransmitP$SFLUSHTX$strobe();
CC2420TransmitP$CSN$set();
}
CC2420TransmitP$releaseSpiResource();
if (CC2420TransmitP$signalSendDone) {
CC2420TransmitP$signalDone(ECANCEL);
}
else
#line 414
{
CC2420TransmitP$m_state = CC2420TransmitP$S_STARTED;
}
}
else {
#line 418
if (!CC2420TransmitP$m_cca) {
/* atomic removed: atomic calls only */
#line 419
{
if (CC2420TransmitP$m_state == CC2420TransmitP$S_LOAD_CANCEL) {
CC2420TransmitP$m_state = CC2420TransmitP$S_TX_CANCEL;
}
else
#line 422
{
CC2420TransmitP$m_state = CC2420TransmitP$S_BEGIN_TRANSMIT;
}
}
CC2420TransmitP$attemptSend();
}
else {
CC2420TransmitP$releaseSpiResource();
/* atomic removed: atomic calls only */
#line 430
{
if (CC2420TransmitP$m_state == CC2420TransmitP$S_LOAD_CANCEL) {
CC2420TransmitP$m_state = CC2420TransmitP$S_CCA_CANCEL;
}
else
#line 433
{
CC2420TransmitP$m_state = CC2420TransmitP$S_SAMPLE_CCA;
}
}
CC2420TransmitP$RadioBackoff$requestInitialBackoff(CC2420TransmitP$m_msg);
CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$myInitialBackoff);
}
}
}
# 281 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$RXFIFO$writeDone(uint8_t *tx_buf, uint8_t tx_len, error_t error)
#line 281
{
}
# 275 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static inline void CC2420SpiImplP$Fifo$default$writeDone(uint8_t addr, uint8_t *tx_buf, uint8_t tx_len, error_t error)
#line 275
{
}
# 91 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Fifo.nc"
inline static void CC2420SpiImplP$Fifo$writeDone(uint8_t arg_0x7e01e068, uint8_t *arg_0x7e0364c8, uint8_t arg_0x7e036650, error_t arg_0x7e0367d8){
#line 91
switch (arg_0x7e01e068) {
#line 91
case CC2420_TXFIFO:
#line 91
CC2420TransmitP$TXFIFO$writeDone(arg_0x7e0364c8, arg_0x7e036650, arg_0x7e0367d8);
#line 91
break;
#line 91
case CC2420_RXFIFO:
#line 91
CC2420ReceiveP$RXFIFO$writeDone(arg_0x7e0364c8, arg_0x7e036650, arg_0x7e0367d8);
#line 91
break;
#line 91
default:
#line 91
CC2420SpiImplP$Fifo$default$writeDone(arg_0x7e01e068, arg_0x7e0364c8, arg_0x7e036650, arg_0x7e0367d8);
#line 91
break;
#line 91
}
#line 91
}
#line 91
# 67 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void HplCC2420InterruptsP$CCATimer$stop(void){
#line 67
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$stop(1U);
#line 67
}
#line 67
# 123 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline void HplCC2420InterruptsP$stopTask$runTask(void)
#line 123
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 124
{
if (HplCC2420InterruptsP$ccaTimerDisabled) {
HplCC2420InterruptsP$CCATimer$stop();
}
}
#line 128
__nesc_atomic_end(__nesc_atomic); }
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void HplCC2420InterruptsP$CCATimer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(1U, arg_0x7eb11338);
#line 62
}
#line 62
# 97 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline void HplCC2420InterruptsP$CCATask$runTask(void)
#line 97
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 98
{
if (!HplCC2420InterruptsP$ccaTimerDisabled) {
HplCC2420InterruptsP$CCATimer$startOneShot(500);
}
}
#line 102
__nesc_atomic_end(__nesc_atomic); }
}
# 352 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$CC2420Config$default$syncDone(error_t error)
#line 352
{
}
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Config.nc"
inline static void CC2420ControlP$CC2420Config$syncDone(error_t arg_0x7e326b98){
#line 53
CC2420ControlP$CC2420Config$default$syncDone(arg_0x7e326b98);
#line 53
}
#line 53
# 346 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$syncDone_task$runTask(void)
#line 346
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 347
CC2420ControlP$m_sync_busy = FALSE;
#line 347
__nesc_atomic_end(__nesc_atomic); }
CC2420ControlP$CC2420Config$syncDone(SUCCESS);
}
# 181 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$sendDone(am_id_t id, message_t *msg, error_t err)
#line 181
{
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current >= 4) {
return;
}
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current].msg == msg) {
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$sendDone(/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current, msg, err);
}
else {
;
}
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void CC2420ActiveMessageP$AMSend$sendDone(am_id_t arg_0x7e437398, message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$sendDone(arg_0x7e437398, arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 98 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static inline void CC2420ActiveMessageP$SubSend$sendDone(message_t *msg, error_t result)
#line 98
{
CC2420ActiveMessageP$AMSend$sendDone(CC2420ActiveMessageP$AMPacket$type(msg), msg, result);
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void UniqueSendP$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
CC2420ActiveMessageP$SubSend$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
}
#line 89
# 104 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueSendP.nc"
static inline void UniqueSendP$SubSend$sendDone(message_t *msg, error_t error)
#line 104
{
UniqueSendP$State: Exp $toIdle();
UniqueSendP$Send$sendDone(msg, error);
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void CC2420CsmaP$Send$sendDone(message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
UniqueSendP$SubSend$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
}
#line 89
# 242 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$sendDone_task$runTask(void)
#line 242
{
error_t packetErr;
#line 244
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 244
packetErr = CC2420CsmaP$sendErr;
#line 244
__nesc_atomic_end(__nesc_atomic); }
CC2420CsmaP$m_state = CC2420CsmaP$S_STARTED;
CC2420CsmaP$Send$sendDone(CC2420CsmaP$m_msg, packetErr);
}
# 127 "OctopusC.nc"
static inline void OctopusC$RadioControl$stopDone(error_t error)
#line 127
{
}
# 288 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$stopDone(error_t err)
#line 288
{
if (err == SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$radioOn = FALSE;
}
}
# 245 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$stopDone(error_t error)
#line 245
{
/*CtpP.Router*/CtpRoutingEngineP$0$radioOn = FALSE;
;
}
# 117 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static void CC2420CsmaP$SplitControl$stopDone(error_t arg_0x7ebf06e8){
#line 117
/*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$stopDone(arg_0x7ebf06e8);
#line 117
/*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$stopDone(arg_0x7ebf06e8);
#line 117
OctopusC$RadioControl$stopDone(arg_0x7ebf06e8);
#line 117
}
#line 117
# 257 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$stopDone_task$runTask(void)
#line 257
{
CC2420CsmaP$m_state = CC2420CsmaP$S_STOPPED;
CC2420CsmaP$SplitControl$stopDone(SUCCESS);
}
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void OctopusC$Timer$startPeriodic(uint32_t arg_0x7eb13ce0){
#line 53
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(0U, arg_0x7eb13ce0);
#line 53
}
#line 53
# 81 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$set(uint16_t bitnum)
{
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getIndex(bitnum)] |= /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$getMask(bitnum);
}
# 52 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$set(uint16_t arg_0x7d8b7010){
#line 52
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$set(arg_0x7d8b7010);
#line 52
}
#line 52
# 92 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$start(uint8_t id)
#line 92
{
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time != 0) {
return EBUSY;
}
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].remainder = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].count = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(id);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 100
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$set(id);
}
#line 102
__nesc_atomic_end(__nesc_atomic); }
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer();
;
return SUCCESS;
}
# 245 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline error_t DisseminationEngineImplP$TrickleTimer$default$start(uint16_t key)
#line 245
{
#line 245
return FAIL;
}
# 60 "/opt/tinyos-2.x/tos/lib/net/TrickleTimer.nc"
inline static error_t DisseminationEngineImplP$TrickleTimer$start(uint16_t arg_0x7d938688){
#line 60
unsigned char result;
#line 60
#line 60
switch (arg_0x7d938688) {
#line 60
case 42:
#line 60
result = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$start(/*OctopusAppC.DisseminatorC*/DisseminatorC$0$TIMER_ID);
#line 60
break;
#line 60
default:
#line 60
result = DisseminationEngineImplP$TrickleTimer$default$start(arg_0x7d938688);
#line 60
break;
#line 60
}
#line 60
#line 60
return result;
#line 60
}
#line 60
# 91 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline error_t DisseminationEngineImplP$DisseminationCache$start(uint16_t key)
#line 91
{
error_t result = DisseminationEngineImplP$TrickleTimer$start(key);
#line 93
DisseminationEngineImplP$TrickleTimer$reset(key);
return result;
}
# 45 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
inline static error_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$start(void){
#line 45
unsigned char result;
#line 45
#line 45
result = DisseminationEngineImplP$DisseminationCache$start(42);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 62 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static inline error_t /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$StdControl$start(void)
#line 62
{
error_t result = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$start();
#line 64
if (result == SUCCESS) {
#line 64
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$m_running = TRUE;
}
#line 65
return result;
}
# 253 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline error_t DisseminationEngineImplP$DisseminatorControl$default$start(uint16_t id)
#line 253
{
#line 253
return FAIL;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t DisseminationEngineImplP$DisseminatorControl$start(uint16_t arg_0x7d937030){
#line 74
unsigned char result;
#line 74
#line 74
switch (arg_0x7d937030) {
#line 74
case /*OctopusAppC.DisseminatorC*/DisseminatorC$0$TIMER_ID:
#line 74
result = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$StdControl$start();
#line 74
break;
#line 74
default:
#line 74
result = DisseminationEngineImplP$DisseminatorControl$default$start(arg_0x7d937030);
#line 74
break;
#line 74
}
#line 74
#line 74
return result;
#line 74
}
#line 74
# 73 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline error_t DisseminationEngineImplP$StdControl$start(void)
#line 73
{
uint8_t i;
#line 75
for (i = 0; i < DisseminationEngineImplP$NUM_DISSEMINATORS; i++) {
DisseminationEngineImplP$DisseminatorControl$start(i);
}
DisseminationEngineImplP$m_running = TRUE;
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t OctopusC$BroadcastControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = DisseminationEngineImplP$StdControl$start();
#line 74
#line 74
return result;
#line 74
}
#line 74
# 607 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$setRoot(void)
#line 607
{
bool route_found = FALSE;
#line 609
route_found = /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == INVALID_ADDR;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 610
{
/*CtpP.Router*/CtpRoutingEngineP$0$state_is_root = 1;
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent = /*CtpP.Router*/CtpRoutingEngineP$0$my_ll_addr;
/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx = 0;
}
#line 614
__nesc_atomic_end(__nesc_atomic); }
if (route_found) {
/*CtpP.Router*/CtpRoutingEngineP$0$Routing$routeFound();
}
#line 617
;
/*CtpP.Router*/CtpRoutingEngineP$0$CollectionDebug$logEventRoute(NET_C_TREE_NEW_PARENT, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent, 0, /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx);
return SUCCESS;
}
# 41 "/opt/tinyos-2.x/tos/lib/net/RootControl.nc"
inline static error_t OctopusC$RootControl$setRoot(void){
#line 41
unsigned char result;
#line 41
#line 41
result = /*CtpP.Router*/CtpRoutingEngineP$0$RootControl$setRoot();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 415 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline error_t LinkEstimatorP$StdControl$start(void)
#line 415
{
;
return SUCCESS;
}
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$startPeriodic(uint32_t arg_0x7eb13ce0){
#line 53
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(4U, arg_0x7eb13ce0);
#line 53
}
#line 53
# 217 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$StdControl$start(void)
#line 217
{
if (!/*CtpP.Router*/CtpRoutingEngineP$0$running) {
/*CtpP.Router*/CtpRoutingEngineP$0$running = TRUE;
/*CtpP.Router*/CtpRoutingEngineP$0$resetInterval();
/*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$startPeriodic(BEACON_INTERVAL);
;
}
return SUCCESS;
}
# 247 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$StdControl$start(void)
#line 247
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$running = TRUE;
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t OctopusC$CollectControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$StdControl$start();
#line 74
result = ecombine(result, /*CtpP.Router*/CtpRoutingEngineP$0$StdControl$start());
#line 74
result = ecombine(result, LinkEstimatorP$StdControl$start());
#line 74
#line 74
return result;
#line 74
}
#line 74
# 114 "OctopusC.nc"
static inline void OctopusC$RadioControl$startDone(error_t error)
#line 114
{
if (error == SUCCESS) {
if (OctopusC$CollectControl$start() != SUCCESS) {
OctopusC$fatalProblem();
}
#line 118
if (OctopusC$root) {
OctopusC$RootControl$setRoot();
}
#line 120
if (OctopusC$BroadcastControl$start() != SUCCESS) {
OctopusC$fatalProblem();
}
#line 122
OctopusC$setLocalDutyCycle();
OctopusC$Timer$startPeriodic(OctopusC$samplingPeriod);
}
else {
#line 125
OctopusC$fatalProblem();
}
}
# 264 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$startDone(error_t err)
#line 264
{
if (err == SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$radioOn = TRUE;
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$empty()) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
}
}
# 234 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$startDone(error_t error)
#line 234
{
/*CtpP.Router*/CtpRoutingEngineP$0$radioOn = TRUE;
;
if (/*CtpP.Router*/CtpRoutingEngineP$0$running) {
uint16_t nextInt;
#line 239
nextInt = /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand16() % BEACON_INTERVAL;
nextInt += BEACON_INTERVAL >> 1;
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(nextInt);
}
}
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static void CC2420CsmaP$SplitControl$startDone(error_t arg_0x7ebf1af0){
#line 92
/*CtpP.Router*/CtpRoutingEngineP$0$RadioControl$startDone(arg_0x7ebf1af0);
#line 92
/*CtpP.Forwarder*/CtpForwardingEngineP$0$RadioControl$startDone(arg_0x7ebf1af0);
#line 92
OctopusC$RadioControl$startDone(arg_0x7ebf1af0);
#line 92
}
#line 92
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ControlP$SpiResource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420SpiImplP$Resource$release(/*CC2420ControlC.Spi*/CC2420SpiC$0$CLIENT_ID);
#line 110
#line 110
return result;
#line 110
}
#line 110
# 127 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$Resource$release(void)
#line 127
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 128
{
CC2420ControlP$CSN$set();
{
unsigned char __nesc_temp =
#line 130
CC2420ControlP$SpiResource$release();
{
#line 130
__nesc_atomic_end(__nesc_atomic);
#line 130
return __nesc_temp;
}
}
}
#line 133
__nesc_atomic_end(__nesc_atomic); }
}
# 110 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420CsmaP$Resource$release(void){
#line 110
unsigned char result;
#line 110
#line 110
result = CC2420ControlP$Resource$release();
#line 110
#line 110
return result;
#line 110
}
#line 110
# 210 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$CC2420Power$rxOn(void)
#line 210
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 211
{
if (CC2420ControlP$m_state != CC2420ControlP$S_XOSC_STARTED) {
{
unsigned char __nesc_temp =
#line 213
FAIL;
{
#line 213
__nesc_atomic_end(__nesc_atomic);
#line 213
return __nesc_temp;
}
}
}
#line 215
CC2420ControlP$SRXON$strobe();
}
#line 216
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 90 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
inline static error_t CC2420CsmaP$CC2420Power$rxOn(void){
#line 90
unsigned char result;
#line 90
#line 90
result = CC2420ControlP$CC2420Power$rxOn();
#line 90
#line 90
return result;
#line 90
}
#line 90
# 42 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$enable(void)
#line 42
{
#line 42
* (volatile uint8_t *)(0x39 + 0x20) |= 1 << 4;
}
# 35 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$enable(void){
#line 35
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$enable();
#line 35
}
#line 35
# 47 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$edge(bool low_to_high)
#line 47
{
* (volatile uint8_t *)90U |= 1 << 1;
if (low_to_high) {
* (volatile uint8_t *)90U |= 1 << 0;
}
else {
#line 53
* (volatile uint8_t *)90U &= ~(1 << 0);
}
}
# 59 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$edge(bool arg_0x7e0f14c8){
#line 59
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$edge(arg_0x7e0f14c8);
#line 59
}
#line 59
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$clear(void)
#line 41
{
#line 41
* (volatile uint8_t *)(0x38 + 0x20) = 1 << 4;
}
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$clear(void){
#line 45
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$clear();
#line 45
}
#line 45
# 43 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static __inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$disable(void)
#line 43
{
#line 43
* (volatile uint8_t *)(0x39 + 0x20) &= ~(1 << 4);
}
# 40 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$disable(void){
#line 40
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$disable();
#line 40
}
#line 40
# 15 "/opt/tinyos-2.x/tos/chips/atm128/pins/Atm128GpioInterruptC.nc"
static inline error_t /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$enable(bool rising)
#line 15
{
/* atomic removed: atomic calls only */
#line 16
{
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$disable();
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$clear();
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$edge(rising);
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$enable();
}
return SUCCESS;
}
static inline error_t /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$enableFallingEdge(void)
#line 29
{
return /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$enable(FALSE);
}
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
inline static error_t CC2420ReceiveP$InterruptFIFOP$enableFallingEdge(void){
#line 43
unsigned char result;
#line 43
#line 43
result = /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$enableFallingEdge();
#line 43
#line 43
return result;
#line 43
}
#line 43
# 110 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline error_t CC2420ReceiveP$StdControl$start(void)
#line 110
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 111
{
CC2420ReceiveP$reset_state();
CC2420ReceiveP$m_state = CC2420ReceiveP$S_STARTED;
CC2420ReceiveP$InterruptFIFOP$enableFallingEdge();
}
#line 118
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128GpioCaptureC.nc"
static inline error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureRisingEdge(void)
#line 52
{
return /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$enableCapture(TRUE);
}
# 42 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
inline static error_t CC2420TransmitP$CaptureSFD$captureRisingEdge(void){
#line 42
unsigned char result;
#line 42
#line 42
result = /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureRisingEdge();
#line 42
#line 42
return result;
#line 42
}
#line 42
# 148 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline error_t CC2420TransmitP$StdControl$start(void)
#line 148
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 149
{
CC2420TransmitP$CaptureSFD$captureRisingEdge();
CC2420TransmitP$m_state = CC2420TransmitP$S_STARTED;
CC2420TransmitP$m_receiving = FALSE;
CC2420TransmitP$m_tx_power = 0;
}
#line 154
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t CC2420CsmaP$SubControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = CC2420TransmitP$StdControl$start();
#line 74
result = ecombine(result, CC2420ReceiveP$StdControl$start());
#line 74
#line 74
return result;
#line 74
}
#line 74
# 249 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$startDone_task$runTask(void)
#line 249
{
CC2420CsmaP$SubControl$start();
CC2420CsmaP$CC2420Power$rxOn();
CC2420CsmaP$Resource$release();
CC2420CsmaP$m_state = CC2420CsmaP$S_STARTED;
CC2420CsmaP$SplitControl$startDone(SUCCESS);
}
# 138 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Capture$stop(void)
#line 138
{
#line 138
* (volatile uint8_t *)(0x37 + 0x20) &= ~(1 << 5);
}
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$stop(void){
#line 61
HplAtm128Timer1P$Capture$stop();
#line 61
}
#line 61
# 122 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Capture$setEdge(bool up)
#line 122
{
#line 122
if (up) {
#line 122
* (volatile uint8_t *)(0x2E + 0x20) |= 1 << 6;
}
else {
#line 122
* (volatile uint8_t *)(0x2E + 0x20) &= ~(1 << 6);
}
}
# 79 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$setEdge(bool arg_0x7e55b710){
#line 79
HplAtm128Timer1P$Capture$setEdge(arg_0x7e55b710);
#line 79
}
#line 79
# 132 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Capture$start(void)
#line 132
{
#line 132
* (volatile uint8_t *)(0x37 + 0x20) |= 1 << 5;
}
# 58 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$start(void){
#line 58
HplAtm128Timer1P$Capture$start();
#line 58
}
#line 58
# 47 "/opt/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 *)59U &= ~(1 << 2);
}
# 30 "/opt/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
}
#line 30
# 63 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led0On(void)
#line 63
{
LedsP$Led0$clr();
;
#line 65
;
}
# 45 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led0On(void){
#line 45
LedsP$Leds$led0On();
#line 45
}
#line 45
# 47 "/opt/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 *)59U &= ~(1 << 1);
}
# 30 "/opt/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 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led1On(void)
#line 78
{
LedsP$Led1$clr();
;
#line 80
;
}
# 61 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led1On(void){
#line 61
LedsP$Leds$led1On();
#line 61
}
#line 61
# 47 "/opt/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 *)59U &= ~(1 << 0);
}
# 30 "/opt/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 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led2On(void)
#line 93
{
LedsP$Led2$clr();
;
#line 95
;
}
# 78 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led2On(void){
#line 78
LedsP$Leds$led2On();
#line 78
}
#line 78
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
OctopusC$SerialSend$sendDone(arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 57 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(message_t *m, error_t err)
#line 57
{
/*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$sendDone(m, err);
}
# 207 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(uint8_t id, message_t *msg, error_t err)
#line 207
{
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(uint8_t arg_0x7e48a1e0, message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
switch (arg_0x7e48a1e0) {
#line 89
case 0U:
#line 89
/*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
default:
#line 89
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$default$sendDone(arg_0x7e48a1e0, arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
}
#line 89
}
#line 89
# 118 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*SerialAMQueueP.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 121
for (i = 0; i < 1 / 8 + 1; i++) {
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i]) {
for (mask = 1, j = 0; j < 8; j++) {
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i] & mask) {
last = i * 8 + j;
msg = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg = (void *)0;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[i] &= ~mask;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(last, msg, ECANCEL);
}
mask <<= 1;
}
}
}
}
#line 161
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask(void)
#line 161
{
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current, /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg, FAIL);
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 110 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline uint8_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$payloadLength(message_t *msg)
#line 110
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(msg);
#line 112
return __nesc_ntoh_uint8((unsigned char *)&header->length);
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
inline static uint8_t /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(message_t *arg_0x7e7c7ee0){
#line 67
unsigned char result;
#line 67
#line 67
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$payloadLength(arg_0x7e7c7ee0);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 57 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket(void)
#line 57
{
uint8_t i;
#line 59
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current + 1) % 1;
for (i = 0; i < 1; i++) {
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg == (void *)0 ||
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$cancelMask[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current / 8] & (1 << /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current % 8))
{
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current + 1) % 1;
}
else {
break;
}
}
if (i >= 1) {
#line 70
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current = 1;
}
}
#line 166
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend(void)
#line 166
{
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$nextPacket();
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current < 1) {
error_t nextErr;
message_t *nextMsg = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg;
am_id_t nextId = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$type(nextMsg);
am_addr_t nextDest = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMPacket$destination(nextMsg);
uint8_t len = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Packet$payloadLength(nextMsg);
#line 174
nextErr = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$send(nextId, nextDest, nextMsg, len);
if (nextErr != SUCCESS) {
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$postTask();
}
}
}
static inline void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(am_id_t id, message_t *msg, error_t err)
#line 181
{
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current >= 1) {
return;
}
if (/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current].msg == msg) {
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$current, msg, err);
}
else {
;
}
}
# 99 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$sendDone(am_id_t arg_0x7e7a9030, message_t *arg_0x7eb219b0, error_t arg_0x7eb21b38){
#line 99
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$sendDone(arg_0x7e7a9030, arg_0x7eb219b0, arg_0x7eb21b38);
#line 99
}
#line 99
# 81 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline void /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$sendDone(message_t *msg, error_t result)
#line 81
{
/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$sendDone(/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(msg), msg, result);
}
# 367 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$default$sendDone(uart_id_t idxxx, message_t *msg, error_t error)
#line 367
{
return;
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$sendDone(uart_id_t arg_0x7e6923e0, message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
switch (arg_0x7e6923e0) {
#line 89
case TOS_SERIAL_ACTIVE_MESSAGE_ID:
#line 89
/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
default:
#line 89
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$default$sendDone(arg_0x7e6923e0, arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
}
#line 89
}
#line 89
# 152 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$runTask(void)
#line 152
{
error_t error;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendState = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SEND_STATE_IDLE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 156
error = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendError;
#line 156
__nesc_atomic_end(__nesc_atomic); }
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendCancelled) {
#line 158
error = ECANCEL;
}
#line 159
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Send$sendDone(/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendId, (message_t *)/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendBuffer, error);
}
#line 206
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$unlockBuffer(uint8_t which)
#line 206
{
if (which) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufOneLocked = 0;
}
else {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufZeroLocked = 0;
}
}
# 102 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static inline void DisseminationEngineImplP$DisseminationCache$newData(uint16_t key)
#line 102
{
if (!DisseminationEngineImplP$m_running || DisseminationEngineImplP$m_bufBusy) {
#line 104
return;
}
DisseminationEngineImplP$sendObject(key);
DisseminationEngineImplP$TrickleTimer$reset(key);
}
# 50 "/opt/tinyos-2.x/tos/lib/net/DisseminationCache.nc"
inline static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$newData(void){
#line 50
DisseminationEngineImplP$DisseminationCache$newData(42);
#line 50
}
#line 50
# 82 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static inline void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$change(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t *newVal)
#line 82
{
if (!/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$m_running) {
#line 83
return;
}
#line 84
memcpy(&/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$valueCache, newVal, sizeof(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t ));
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno >> 16;
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno++;
if (/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno == DISSEMINATION_SEQNO_UNKNOWN) {
#line 88
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno++;
}
#line 89
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno = /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno << 16;
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno += TOS_NODE_ID;
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$newData();
}
# 52 "/opt/tinyos-2.x/tos/lib/net/DisseminationUpdate.nc"
inline static void OctopusC$RequestUpdate$change(OctopusC$RequestUpdate$t *arg_0x7eb71010){
#line 52
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationUpdate$change(arg_0x7eb71010);
#line 52
}
#line 52
# 236 "OctopusC.nc"
static inline message_t *OctopusC$SerialReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 236
{
octopus_sent_msg_t *newRequest = payload;
#line 238
if (len == sizeof(octopus_sent_msg_t )) {
OctopusC$RequestUpdate$change(newRequest);
OctopusC$processRequest(newRequest);
}
return msg;
}
# 89 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$default$receive(uint8_t id, message_t *msg, void *payload, uint8_t len)
#line 89
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$receive(am_id_t arg_0x7e7a9960, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7e7a9960) {
#line 67
case 101:
#line 67
result = OctopusC$SerialReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$default$receive(arg_0x7e7a9960, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 102 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline message_t */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 102
{
return /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Receive$receive(/*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(msg), msg, msg->data, len);
}
# 362 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$default$receive(uart_id_t idxxx, message_t *msg,
void *payload,
uint8_t len)
#line 364
{
return msg;
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Receive.nc"
inline static message_t */*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$receive(uart_id_t arg_0x7e693b98, message_t *arg_0x7eb51e50, void *arg_0x7eb45010, uint8_t arg_0x7eb45198){
#line 67
nx_struct message_t *result;
#line 67
#line 67
switch (arg_0x7e693b98) {
#line 67
case TOS_SERIAL_ACTIVE_MESSAGE_ID:
#line 67
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubReceive$receive(arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
default:
#line 67
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$default$receive(arg_0x7e693b98, arg_0x7eb51e50, arg_0x7eb45010, arg_0x7eb45198);
#line 67
break;
#line 67
}
#line 67
#line 67
return result;
#line 67
}
#line 67
# 46 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfoActiveMessageP.nc"
static inline uint8_t SerialPacketInfoActiveMessageP$Info$upperLength(message_t *msg, uint8_t dataLinkLen)
#line 46
{
return dataLinkLen - sizeof(serial_header_t );
}
# 356 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$upperLength(uart_id_t id, message_t *msg,
uint8_t dataLinkLen)
#line 357
{
return 0;
}
# 31 "/opt/tinyos-2.x/tos/lib/serial/SerialPacketInfo.nc"
inline static uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$upperLength(uart_id_t arg_0x7e692d98, message_t *arg_0x7e755808, uint8_t arg_0x7e755998){
#line 31
unsigned char result;
#line 31
#line 31
switch (arg_0x7e692d98) {
#line 31
case TOS_SERIAL_ACTIVE_MESSAGE_ID:
#line 31
result = SerialPacketInfoActiveMessageP$Info$upperLength(arg_0x7e755808, arg_0x7e755998);
#line 31
break;
#line 31
default:
#line 31
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$default$upperLength(arg_0x7e692d98, arg_0x7e755808, arg_0x7e755998);
#line 31
break;
#line 31
}
#line 31
#line 31
return result;
#line 31
}
#line 31
# 269 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$runTask(void)
#line 269
{
uart_id_t myType;
message_t *myBuf;
uint8_t mySize;
uint8_t myWhich;
#line 274
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 274
{
myType = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskType;
myBuf = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskBuf;
mySize = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskSize;
myWhich = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskWhich;
}
#line 279
__nesc_atomic_end(__nesc_atomic); }
mySize -= /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$offset(myType);
mySize = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$upperLength(myType, myBuf, mySize);
myBuf = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$Receive$receive(myType, myBuf, myBuf, mySize);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 283
{
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messagePtrs[myWhich] = myBuf;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$unlockBuffer(myWhich);
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskPending = FALSE;
}
#line 287
__nesc_atomic_end(__nesc_atomic); }
}
# 132 "OctopusC.nc"
static inline void OctopusC$SerialControl$stopDone(error_t error)
#line 132
{
}
# 117 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static void SerialP$SplitControl$stopDone(error_t arg_0x7ebf06e8){
#line 117
OctopusC$SerialControl$stopDone(arg_0x7ebf06e8);
#line 117
}
#line 117
# 44 "/opt/tinyos-2.x/tos/interfaces/McuPowerState.nc"
inline static void HplAtm128UartP$McuPowerState$update(void){
#line 44
McuSleepC$McuPowerState$update();
#line 44
}
#line 44
# 128 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart0RxControl$stop(void)
#line 128
{
* (volatile uint8_t *)(0x0A + 0x20) &= ~(1 << 7);
* (volatile uint8_t *)(0x0A + 0x20) &= ~(1 << 4);
HplAtm128UartP$McuPowerState$update();
return SUCCESS;
}
# 84 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$stop(void){
#line 84
unsigned char result;
#line 84
#line 84
result = HplAtm128UartP$Uart0RxControl$stop();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 114 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart0TxControl$stop(void)
#line 114
{
* (volatile uint8_t *)(0x0A + 0x20) &= ~(1 << 6);
* (volatile uint8_t *)(0x0A + 0x20) &= ~(1 << 3);
HplAtm128UartP$McuPowerState$update();
return SUCCESS;
}
# 84 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$stop(void){
#line 84
unsigned char result;
#line 84
#line 84
result = HplAtm128UartP$Uart0TxControl$stop();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 75 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$stop(void)
#line 75
{
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$stop();
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$stop();
return SUCCESS;
}
# 84 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t SerialP$SerialControl$stop(void){
#line 84
unsigned char result;
#line 84
#line 84
result = /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$stop();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 330 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$SerialFlush$flushDone(void)
#line 330
{
SerialP$SerialControl$stop();
SerialP$SplitControl$stopDone(SUCCESS);
}
static inline void SerialP$defaultSerialFlushTask$runTask(void)
#line 335
{
SerialP$SerialFlush$flushDone();
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t SerialP$defaultSerialFlushTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(SerialP$defaultSerialFlushTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 338 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$SerialFlush$default$flush(void)
#line 338
{
SerialP$defaultSerialFlushTask$postTask();
}
# 38 "/opt/tinyos-2.x/tos/lib/serial/SerialFlush.nc"
inline static void SerialP$SerialFlush$flush(void){
#line 38
SerialP$SerialFlush$default$flush();
#line 38
}
#line 38
# 326 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$stopDoneTask$runTask(void)
#line 326
{
SerialP$SerialFlush$flush();
}
# 128 "OctopusC.nc"
static inline void OctopusC$SerialControl$startDone(error_t error)
#line 128
{
if (error != SUCCESS) {
OctopusC$fatalProblem();
}
}
# 92 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static void SerialP$SplitControl$startDone(error_t arg_0x7ebf1af0){
#line 92
OctopusC$SerialControl$startDone(arg_0x7ebf1af0);
#line 92
}
#line 92
# 121 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart0RxControl$start(void)
#line 121
{
* (volatile uint8_t *)(0x0A + 0x20) |= 1 << 7;
* (volatile uint8_t *)(0x0A + 0x20) |= 1 << 4;
HplAtm128UartP$McuPowerState$update();
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = HplAtm128UartP$Uart0RxControl$start();
#line 74
#line 74
return result;
#line 74
}
#line 74
# 107 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart0TxControl$start(void)
#line 107
{
* (volatile uint8_t *)(0x0A + 0x20) |= 1 << 6;
* (volatile uint8_t *)(0x0A + 0x20) |= 1 << 3;
HplAtm128UartP$McuPowerState$update();
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = HplAtm128UartP$Uart0TxControl$start();
#line 74
#line 74
return result;
#line 74
}
#line 74
# 69 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$start(void)
#line 69
{
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartTxControl$start();
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUartRxControl$start();
return SUCCESS;
}
# 74 "/opt/tinyos-2.x/tos/interfaces/StdControl.nc"
inline static error_t SerialP$SerialControl$start(void){
#line 74
unsigned char result;
#line 74
#line 74
result = /*Atm128Uart0C.UartP*/Atm128UartP$0$StdControl$start();
#line 74
#line 74
return result;
#line 74
}
#line 74
# 320 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$startDoneTask$runTask(void)
#line 320
{
SerialP$SerialControl$start();
SerialP$SplitControl$startDone(SUCCESS);
}
# 45 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
inline static error_t SerialP$SerialFrameComm$putDelimiter(void){
#line 45
unsigned char result;
#line 45
#line 45
result = HdlcTranslateC$SerialFrameComm$putDelimiter();
#line 45
#line 45
return result;
#line 45
}
#line 45
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 188 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$sendCompleted(error_t error)
#line 188
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 189
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendError = error;
#line 189
__nesc_atomic_end(__nesc_atomic); }
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$postTask();
}
# 80 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
inline static void SerialP$SendBytePacket$sendCompleted(error_t arg_0x7e728818){
#line 80
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$sendCompleted(arg_0x7e728818);
#line 80
}
#line 80
# 242 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static __inline bool SerialP$ack_queue_is_empty(void)
#line 242
{
bool ret;
#line 244
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 244
ret = SerialP$ackQ.writePtr == SerialP$ackQ.readPtr;
#line 244
__nesc_atomic_end(__nesc_atomic); }
return ret;
}
static __inline uint8_t SerialP$ack_queue_top(void)
#line 258
{
uint8_t tmp = 0;
/* atomic removed: atomic calls only */
#line 260
{
if (!SerialP$ack_queue_is_empty()) {
tmp = SerialP$ackQ.buf[SerialP$ackQ.readPtr];
}
}
return tmp;
}
static inline uint8_t SerialP$ack_queue_pop(void)
#line 268
{
uint8_t retval = 0;
#line 270
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 270
{
if (SerialP$ackQ.writePtr != SerialP$ackQ.readPtr) {
retval = SerialP$ackQ.buf[SerialP$ackQ.readPtr];
if (++ SerialP$ackQ.readPtr > SerialP$ACK_QUEUE_SIZE) {
#line 273
SerialP$ackQ.readPtr = 0;
}
}
}
#line 276
__nesc_atomic_end(__nesc_atomic); }
#line 276
return retval;
}
#line 539
static inline void SerialP$RunTx$runTask(void)
#line 539
{
uint8_t idle;
uint8_t done;
uint8_t fail;
error_t result = SUCCESS;
bool send_completed = FALSE;
bool start_it = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 556
{
SerialP$txPending = 0;
idle = SerialP$txState == SerialP$TXSTATE_IDLE;
done = SerialP$txState == SerialP$TXSTATE_FINISH;
fail = SerialP$txState == SerialP$TXSTATE_ERROR;
if (done || fail) {
SerialP$txState = SerialP$TXSTATE_IDLE;
SerialP$txBuf[SerialP$txIndex].state = SerialP$BUFFER_AVAILABLE;
}
}
#line 565
__nesc_atomic_end(__nesc_atomic); }
if (done || fail) {
SerialP$txSeqno++;
if (SerialP$txProto == SERIAL_PROTO_ACK) {
SerialP$ack_queue_pop();
}
else {
result = done ? SUCCESS : FAIL;
send_completed = TRUE;
}
idle = TRUE;
}
if (idle) {
bool goInactive;
#line 583
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 583
goInactive = SerialP$offPending;
#line 583
__nesc_atomic_end(__nesc_atomic); }
if (goInactive) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 585
SerialP$txState = SerialP$TXSTATE_INACTIVE;
#line 585
__nesc_atomic_end(__nesc_atomic); }
}
else {
uint8_t myAckState;
uint8_t myDataState;
#line 591
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 591
{
myAckState = SerialP$txBuf[SerialP$TX_ACK_INDEX].state;
myDataState = SerialP$txBuf[SerialP$TX_DATA_INDEX].state;
}
#line 594
__nesc_atomic_end(__nesc_atomic); }
if (!SerialP$ack_queue_is_empty() && myAckState == SerialP$BUFFER_AVAILABLE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 596
{
SerialP$txBuf[SerialP$TX_ACK_INDEX].state = SerialP$BUFFER_COMPLETE;
SerialP$txBuf[SerialP$TX_ACK_INDEX].buf = SerialP$ack_queue_top();
}
#line 599
__nesc_atomic_end(__nesc_atomic); }
SerialP$txProto = SERIAL_PROTO_ACK;
SerialP$txIndex = SerialP$TX_ACK_INDEX;
start_it = TRUE;
}
else {
#line 604
if (myDataState == SerialP$BUFFER_FILLING || myDataState == SerialP$BUFFER_COMPLETE) {
SerialP$txProto = SERIAL_PROTO_PACKET_NOACK;
SerialP$txIndex = SerialP$TX_DATA_INDEX;
start_it = TRUE;
}
else {
}
}
}
}
else {
}
if (send_completed) {
SerialP$SendBytePacket$sendCompleted(result);
}
if (SerialP$txState == SerialP$TXSTATE_INACTIVE) {
SerialP$testOff();
return;
}
if (start_it) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 629
{
SerialP$txCRC = 0;
SerialP$txByteCnt = 0;
SerialP$txState = SerialP$TXSTATE_PROTO;
}
#line 633
__nesc_atomic_end(__nesc_atomic); }
if (SerialP$SerialFrameComm$putDelimiter() != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 635
SerialP$txState = SerialP$TXSTATE_ERROR;
#line 635
__nesc_atomic_end(__nesc_atomic); }
SerialP$MaybeScheduleTx();
}
}
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t SerialP$stopDoneTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(SerialP$stopDoneTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
inline static error_t OctopusC$serialSendTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(OctopusC$serialSendTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
inline static error_t OctopusC$collectSendTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(OctopusC$collectSendTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 333 "OctopusC.nc"
static inline void OctopusC$Read$readDone(error_t ok, uint16_t val)
#line 333
{
unsigned int __nesc_temp45;
unsigned char *__nesc_temp44;
#line 334
if (ok == SUCCESS) {
(__nesc_temp44 = (unsigned char *)&OctopusC$localCollectedMsg.count, __nesc_hton_uint16(__nesc_temp44, (__nesc_temp45 = __nesc_ntoh_uint16(__nesc_temp44)) + 1), __nesc_temp45);
OctopusC$fillPacket();
if (!OctopusC$modeAuto) {
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, val);
if (!OctopusC$root) {
OctopusC$collectSendTask$postTask();
}
else {
#line 342
OctopusC$serialSendTask$postTask();
}
}
else {
#line 343
if (val > OctopusC$oldSensorValue && !(0xFFFF - OctopusC$oldSensorValue < OctopusC$threshold)) {
if (OctopusC$oldSensorValue + OctopusC$threshold < val) {
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, val);
if (!OctopusC$root) {
OctopusC$collectSendTask$postTask();
}
else {
#line 349
OctopusC$serialSendTask$postTask();
}
}
}
else {
#line 351
if (val < OctopusC$oldSensorValue && !(OctopusC$oldSensorValue < OctopusC$threshold)) {
if (OctopusC$oldSensorValue - OctopusC$threshold > val) {
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, val);
if (!OctopusC$root) {
OctopusC$collectSendTask$postTask();
}
else {
#line 357
OctopusC$serialSendTask$postTask();
}
}
}
}
}
}
}
# 63 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
inline static void /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$readDone(error_t arg_0x7eaf5668, /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$val_t arg_0x7eaf57f0){
#line 63
OctopusC$Read$readDone(arg_0x7eaf5668, arg_0x7eaf57f0);
#line 63
}
#line 63
# 33 "/opt/tinyos-2.x/tos/system/SineSensorC.nc"
static inline void /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$runTask(void)
#line 33
{
float val = (float )/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$counter;
#line 35
val = val / 20.0;
val = sin(val) * 32768.0;
val += 32768.0;
/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$counter++;
/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$readDone(SUCCESS, (uint16_t )val);
}
# 92 "/opt/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_0x7e9d39e0, /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$size_type arg_0x7e9d3b70){
#line 92
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$startAt(arg_0x7e9d39e0, arg_0x7e9d3b70);
#line 92
}
#line 92
# 47 "/opt/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 82
static 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 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(uint32_t arg_0x7eb05010, uint32_t arg_0x7eb051a0){
#line 118
/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Timer$startOneShotAt(arg_0x7eb05010, arg_0x7eb051a0);
#line 118
}
#line 118
# 194 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$stop(void)
#line 194
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 195
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$set = FALSE;
#line 195
__nesc_atomic_end(__nesc_atomic); }
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$stop(void){
#line 62
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$stop();
#line 62
}
#line 62
# 60 "/opt/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 "/opt/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
# 88 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline void /*HilTimerMilliC.VirtualizeTimerC*/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 123
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$TimerFrom$startOneShotAt(now, min_remaining);
}
}
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 41 "/opt/tinyos-2.x/tos/system/SineSensorC.nc"
static inline error_t /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$read(void)
#line 41
{
/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$postTask();
return SUCCESS;
}
# 55 "/opt/tinyos-2.x/tos/interfaces/Read.nc"
inline static error_t OctopusC$Read$read(void){
#line 55
unsigned char result;
#line 55
#line 55
result = /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$Read$read();
#line 55
#line 55
return result;
#line 55
}
#line 55
# 323 "OctopusC.nc"
static inline void OctopusC$Timer$fired(void)
#line 323
{
if (!OctopusC$sleeping && OctopusC$modeAuto) {
OctopusC$Read$read();
}
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t CC2420CsmaP$startDone_task$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(CC2420CsmaP$startDone_task);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 208 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$CC2420Power$startOscillatorDone(void)
#line 208
{
CC2420CsmaP$startDone_task$postTask();
}
# 76 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
inline static void CC2420ControlP$CC2420Power$startOscillatorDone(void){
#line 76
CC2420CsmaP$CC2420Power$startOscillatorDone();
#line 76
}
#line 76
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t HplCC2420InterruptsP$stopTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(HplCC2420InterruptsP$stopTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 130 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline error_t HplCC2420InterruptsP$CCA$disable(void)
#line 130
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 131
HplCC2420InterruptsP$ccaTimerDisabled = TRUE;
#line 131
__nesc_atomic_end(__nesc_atomic); }
HplCC2420InterruptsP$stopTask$postTask();
return SUCCESS;
}
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
inline static error_t CC2420ControlP$InterruptCCA$disable(void){
#line 50
unsigned char result;
#line 50
#line 50
result = HplCC2420InterruptsP$CCA$disable();
#line 50
#line 50
return result;
#line 50
}
#line 50
# 332 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$InterruptCCA$fired(void)
#line 332
{
nxle_uint16_t id[2];
#line 334
CC2420ControlP$m_state = CC2420ControlP$S_XOSC_STARTED;
__nesc_hton_leuint16((unsigned char *)&id[0], CC2420ControlP$m_pan);
__nesc_hton_leuint16((unsigned char *)&id[1], CC2420ControlP$m_short_addr);
CC2420ControlP$InterruptCCA$disable();
CC2420ControlP$IOCFG1$write(0);
CC2420ControlP$PANID$write(0, (uint8_t *)&id, 4);
CC2420ControlP$CSN$set();
CC2420ControlP$CSN$clr();
CC2420ControlP$CC2420Power$startOscillatorDone();
}
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
inline static void HplCC2420InterruptsP$CCA$fired(void){
#line 57
CC2420ControlP$InterruptCCA$fired();
#line 57
}
#line 57
# 139 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline void HplCC2420InterruptsP$CCATimer$fired(void)
#line 139
{
uint8_t CCAState;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 143
{
if (HplCC2420InterruptsP$ccaTimerDisabled) {
{
#line 145
__nesc_atomic_end(__nesc_atomic);
#line 145
return;
}
}
}
#line 148
__nesc_atomic_end(__nesc_atomic); }
CCAState = HplCC2420InterruptsP$CC_CCA$get();
if (HplCC2420InterruptsP$ccaLastState != HplCC2420InterruptsP$ccaWaitForState && CCAState == HplCC2420InterruptsP$ccaWaitForState) {
HplCC2420InterruptsP$CCA$fired();
}
HplCC2420InterruptsP$ccaLastState = CCAState;
HplCC2420InterruptsP$CCATask$postTask();
return;
}
# 55 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Register.nc"
inline static cc2420_status_t CC2420TransmitP$MDMCTRL1$write(uint16_t arg_0x7e30ca10){
#line 55
unsigned char result;
#line 55
#line 55
result = CC2420SpiImplP$Reg$write(CC2420_MDMCTRL1, arg_0x7e30ca10);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 502 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$LplDisableTimer$fired(void)
#line 502
{
CC2420TransmitP$MDMCTRL1$write(0 << CC2420_MDMCTRL1_TX_MODE);
CC2420TransmitP$signalDone(SUCCESS);
}
# 182 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$decayInterval(void)
#line 182
{
if (!/*CtpP.Router*/CtpRoutingEngineP$0$state_is_root) {
/*CtpP.Router*/CtpRoutingEngineP$0$currentInterval *= 2;
if (/*CtpP.Router*/CtpRoutingEngineP$0$currentInterval > 1024) {
/*CtpP.Router*/CtpRoutingEngineP$0$currentInterval = 1024;
}
}
/*CtpP.Router*/CtpRoutingEngineP$0$chooseAdvertiseTime();
}
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startPeriodic(uint32_t arg_0x7eb13ce0){
#line 53
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(3U, arg_0x7eb13ce0);
#line 53
}
#line 53
# 192 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$remainingInterval(void)
#line 192
{
uint32_t remaining = /*CtpP.Router*/CtpRoutingEngineP$0$currentInterval;
#line 194
remaining *= 1024;
remaining -= /*CtpP.Router*/CtpRoutingEngineP$0$t;
/*CtpP.Router*/CtpRoutingEngineP$0$tHasPassed = TRUE;
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startPeriodic(/*CtpP.Router*/CtpRoutingEngineP$0$t);
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 441 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$fired(void)
#line 441
{
if (/*CtpP.Router*/CtpRoutingEngineP$0$radioOn && /*CtpP.Router*/CtpRoutingEngineP$0$running) {
if (!/*CtpP.Router*/CtpRoutingEngineP$0$tHasPassed) {
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
/*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$postTask();
;
/*CtpP.Router*/CtpRoutingEngineP$0$remainingInterval();
}
else {
/*CtpP.Router*/CtpRoutingEngineP$0$decayInterval();
}
}
}
#line 435
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$fired(void)
#line 435
{
if (/*CtpP.Router*/CtpRoutingEngineP$0$radioOn && /*CtpP.Router*/CtpRoutingEngineP$0$running) {
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
}
}
# 827 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$fired(void)
#line 827
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = FALSE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
static inline void /*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$fired(void)
#line 832
{
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
# 81 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$set(uint16_t bitnum)
{
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits[/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getIndex(bitnum)] |= /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$getMask(bitnum);
}
# 52 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$set(uint16_t arg_0x7d8b7010){
#line 52
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$set(arg_0x7d8b7010);
#line 52
}
#line 52
# 140 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static uint32_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getdt(void){
#line 140
unsigned long result;
#line 140
#line 140
result = /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$getdt(7U);
#line 140
#line 140
return result;
#line 140
}
#line 140
# 168 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$fired(void)
#line 168
{
uint8_t i;
uint32_t dt = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getdt();
for (i = 0; i < 1U; i++) {
uint32_t remaining = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].time;
#line 174
if (remaining != 0) {
remaining -= dt;
if (remaining == 0) {
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].count < 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 178
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$set(i);
}
#line 180
__nesc_atomic_end(__nesc_atomic); }
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$postTask();
}
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(i);
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].count = 0;
}
else {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].time = remaining;
}
}
}
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer();
}
# 192 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static inline void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(uint8_t num)
{
}
# 72 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$fired(uint8_t arg_0x7e871cd8){
#line 72
switch (arg_0x7e871cd8) {
#line 72
case 0U:
#line 72
OctopusC$Timer$fired();
#line 72
break;
#line 72
case 1U:
#line 72
HplCC2420InterruptsP$CCATimer$fired();
#line 72
break;
#line 72
case 2U:
#line 72
CC2420TransmitP$LplDisableTimer$fired();
#line 72
break;
#line 72
case 3U:
#line 72
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$fired();
#line 72
break;
#line 72
case 4U:
#line 72
/*CtpP.Router*/CtpRoutingEngineP$0$RouteTimer$fired();
#line 72
break;
#line 72
case 5U:
#line 72
/*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$fired();
#line 72
break;
#line 72
case 6U:
#line 72
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CongestionTimer$fired();
#line 72
break;
#line 72
case 7U:
#line 72
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$fired();
#line 72
break;
#line 72
default:
#line 72
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$default$fired(arg_0x7e871cd8);
#line 72
break;
#line 72
}
#line 72
}
#line 72
# 135 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline void HplAtm128Timer0AsyncP$Compare$set(uint8_t t)
#line 135
{
* (volatile uint8_t *)(0x31 + 0x20) = t;
}
# 45 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$size_type arg_0x7e981c38){
#line 45
HplAtm128Timer0AsyncP$Compare$set(arg_0x7e981c38);
#line 45
}
#line 45
# 50 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline uint8_t HplAtm128Timer0AsyncP$Timer$get(void)
#line 50
{
#line 50
return * (volatile uint8_t *)(0x32 + 0x20);
}
# 52 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$timer_size /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get(void){
#line 52
unsigned char result;
#line 52
#line 52
result = HplAtm128Timer0AsyncP$Timer$get();
#line 52
#line 52
return result;
#line 52
}
#line 52
# 206 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline int HplAtm128Timer0AsyncP$TimerAsync$compareBusy(void)
#line 206
{
return (* (volatile uint8_t *)(0x30 + 0x20) & (1 << 1)) != 0;
}
# 44 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerAsync.nc"
inline static int /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$compareBusy(void){
#line 44
int result;
#line 44
#line 44
result = HplAtm128Timer0AsyncP$TimerAsync$compareBusy();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 74 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setOcr0(uint8_t n)
#line 74
{
while (/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$compareBusy())
;
if (n == /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get()) {
n++;
}
if (/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base + n + 1 < /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base) {
n = -/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base - 1;
}
#line 84
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$set(n);
}
# 56 "/opt/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 "/opt/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 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$fired(void){
#line 67
/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$Alarm$fired();
#line 67
}
#line 67
# 127 "/opt/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 "/opt/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
# 216 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getAlarm(void)
#line 216
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 217
{
unsigned long __nesc_temp =
#line 217
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$t0 + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$dt;
{
#line 217
__nesc_atomic_end(__nesc_atomic);
#line 217
return __nesc_temp;
}
}
#line 219
__nesc_atomic_end(__nesc_atomic); }
}
# 105 "/opt/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.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$getAlarm();
#line 105
#line 105
return result;
#line 105
}
#line 105
# 63 "/opt/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();
}
# 31 "/opt/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 "/opt/tinyos-2.x/tos/system/LedsP.nc"
static inline void LedsP$Leds$led0Toggle(void)
#line 73
{
LedsP$Led0$toggle();
;
#line 75
;
}
# 56 "/opt/tinyos-2.x/tos/interfaces/Leds.nc"
inline static void OctopusC$Leds$led0Toggle(void){
#line 56
LedsP$Leds$led0Toggle();
#line 56
}
#line 56
# 82 "OctopusC.nc"
inline static void OctopusC$reportProblem(void)
#line 82
{
#line 82
OctopusC$Leds$led0Toggle();
}
# 69 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static error_t OctopusC$SerialSend$send(am_addr_t arg_0x7eb22678, message_t *arg_0x7eb22828, uint8_t arg_0x7eb229b0){
#line 69
unsigned char result;
#line 69
#line 69
result = /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(arg_0x7eb22678, arg_0x7eb22828, arg_0x7eb229b0);
#line 69
#line 69
return result;
#line 69
}
#line 69
# 77 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static inline void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$getPayload(am_id_t id, message_t *m)
#line 77
{
return /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$getPayload(m, (void *)0);
}
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void */*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$getPayload(am_id_t arg_0x7e48ab40, message_t *arg_0x7eb20600){
#line 125
void *result;
#line 125
#line 125
result = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$getPayload(arg_0x7e48ab40, arg_0x7eb20600);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 203 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static inline void */*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$getPayload(uint8_t id, message_t *m)
#line 203
{
return /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$AMSend$getPayload(0, m);
}
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void */*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$getPayload(message_t *arg_0x7eb54c58){
#line 114
void *result;
#line 114
#line 114
result = /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$getPayload(0U, arg_0x7eb54c58);
#line 114
#line 114
return result;
#line 114
}
#line 114
# 65 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static inline void */*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$getPayload(message_t *m)
#line 65
{
return /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$getPayload(m);
}
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void *OctopusC$SerialSend$getPayload(message_t *arg_0x7eb20600){
#line 125
void *result;
#line 125
#line 125
result = /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$getPayload(arg_0x7eb20600);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 260 "OctopusC.nc"
static inline void OctopusC$serialSendTask$runTask(void)
#line 260
{
if (!OctopusC$uartBusy && OctopusC$root) {
octopus_collected_msg_t *o = (octopus_collected_msg_t *)OctopusC$SerialSend$getPayload(&OctopusC$sndMsg);
#line 263
memcpy(o, &OctopusC$localCollectedMsg, sizeof(octopus_collected_msg_t ));
if (OctopusC$SerialSend$send(0xffff, &OctopusC$sndMsg, sizeof(octopus_collected_msg_t )) == SUCCESS) {
OctopusC$uartBusy = TRUE;
}
else {
#line 267
OctopusC$reportProblem();
}
}
}
# 50 "/opt/tinyos-2.x/tos/lib/net/CollectionIdP.nc"
static inline collection_id_t /*OctopusAppC.CollectionSenderC.CollectionSenderP.CollectionIdP*/CollectionIdP$0$CollectionId$fetch(void)
#line 50
{
return 147;
}
# 954 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline collection_id_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$default$fetch(uint8_t client)
#line 954
{
return 0;
}
# 46 "/opt/tinyos-2.x/tos/lib/net/CollectionId.nc"
inline static collection_id_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$fetch(uint8_t arg_0x7dc157e8){
#line 46
unsigned char result;
#line 46
#line 46
switch (arg_0x7dc157e8) {
#line 46
case 0U:
#line 46
result = /*OctopusAppC.CollectionSenderC.CollectionSenderP.CollectionIdP*/CollectionIdP$0$CollectionId$fetch();
#line 46
break;
#line 46
default:
#line 46
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$default$fetch(arg_0x7dc157e8);
#line 46
break;
#line 46
}
#line 46
#line 46
return result;
#line 46
}
#line 46
# 357 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$maxPayloadLength(uint8_t client)
#line 357
{
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$maxPayloadLength();
}
#line 307
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$send(uint8_t client, message_t *msg, uint8_t len)
#line 307
{
ctp_data_header_t *hdr;
fe_queue_entry_t *qe;
#line 310
;
if (!/*CtpP.Forwarder*/CtpForwardingEngineP$0$running) {
#line 311
return EOFF;
}
#line 312
if (len > /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$maxPayloadLength(client)) {
#line 312
return ESIZE;
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$setPayloadLength(msg, len);
hdr = /*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg);
__nesc_hton_uint16((unsigned char *)&hdr->origin, TOS_NODE_ID);
__nesc_hton_uint8((unsigned char *)&hdr->originSeqNo, /*CtpP.Forwarder*/CtpForwardingEngineP$0$seqno++);
__nesc_hton_uint8((unsigned char *)&hdr->type, /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionId$fetch(client));
__nesc_hton_uint8((unsigned char *)&hdr->thl, 0);
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[client] == (void *)0) {
;
return EBUSY;
}
qe = /*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[client];
qe->msg = msg;
qe->client = client;
qe->retries = MAX_RETRIES;
;
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$enqueue(qe) == SUCCESS) {
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$radioOn && !/*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$isRunning()) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$postTask();
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[client] = (void *)0;
return SUCCESS;
}
else {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_SEND_QUEUE_FULL);
return FAIL;
}
}
# 64 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static error_t OctopusC$CollectSend$send(message_t *arg_0x7eb60dd8, uint8_t arg_0x7eb55010){
#line 64
unsigned char result;
#line 64
#line 64
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$send(0U, arg_0x7eb60dd8, arg_0x7eb55010);
#line 64
#line 64
return result;
#line 64
}
#line 64
# 361 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$getPayload(uint8_t client, message_t *msg)
#line 361
{
return /*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(msg, (void *)0);
}
# 114 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
inline static void *OctopusC$CollectSend$getPayload(message_t *arg_0x7eb54c58){
#line 114
void *result;
#line 114
#line 114
result = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$getPayload(0U, arg_0x7eb54c58);
#line 114
#line 114
return result;
#line 114
}
#line 114
# 249 "OctopusC.nc"
static inline void OctopusC$collectSendTask$runTask(void)
#line 249
{
if (!OctopusC$sendBusy && !OctopusC$root) {
octopus_collected_msg_t *o = (octopus_collected_msg_t *)OctopusC$CollectSend$getPayload(&OctopusC$sndMsg);
#line 252
memcpy(o, &OctopusC$localCollectedMsg, sizeof(octopus_collected_msg_t ));
if (OctopusC$CollectSend$send(&OctopusC$sndMsg, sizeof(octopus_collected_msg_t )) == SUCCESS) {
OctopusC$sendBusy = TRUE;
}
else {
#line 256
OctopusC$reportProblem();
}
}
}
# 122 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline void HplAtm128Timer0AsyncP$Compare$start(void)
#line 122
{
#line 122
* (volatile uint8_t *)(0x37 + 0x20) |= 1 << 1;
}
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$start(void){
#line 56
HplAtm128Timer0AsyncP$Compare$start();
#line 56
}
#line 56
# 76 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline void HplAtm128Timer0AsyncP$TimerCtrl$setControl(Atm128TimerControl_t x)
#line 76
{
* (volatile uint8_t *)(0x33 + 0x20) = x.flat;
}
# 37 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerCtrl8.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$setControl(Atm128TimerControl_t arg_0x7e986ce8){
#line 37
HplAtm128Timer0AsyncP$TimerCtrl$setControl(arg_0x7e986ce8);
#line 37
}
#line 37
# 198 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline void HplAtm128Timer0AsyncP$TimerAsync$setTimer0Asynchronous(void)
#line 198
{
* (volatile uint8_t *)(0x30 + 0x20) |= 1 << 3;
}
# 32 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerAsync.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$setTimer0Asynchronous(void){
#line 32
HplAtm128Timer0AsyncP$TimerAsync$setTimer0Asynchronous();
#line 32
}
#line 32
# 54 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline error_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Init$init(void)
#line 54
{
/* atomic removed: atomic calls only */
{
Atm128TimerControl_t x;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerAsync$setTimer0Asynchronous();
x.flat = 0;
x.bits.cs = 3;
x.bits.wgm1 = 1;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$setControl(x);
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$set(/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MAXT);
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$start();
}
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt();
return SUCCESS;
}
# 44 "/opt/tinyos-2.x/tos/system/RandomMlcgP.nc"
static inline error_t RandomMlcgP$Init$init(void)
#line 44
{
/* atomic removed: atomic calls only */
#line 45
RandomMlcgP$seed = (uint32_t )(TOS_NODE_ID + 1);
return SUCCESS;
}
# 214 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static __inline void SerialP$ackInit(void)
#line 214
{
SerialP$ackQ.writePtr = SerialP$ackQ.readPtr = 0;
}
#line 205
static __inline void SerialP$rxInit(void)
#line 205
{
SerialP$rxBuf.writePtr = SerialP$rxBuf.readPtr = 0;
SerialP$rxState = SerialP$RXSTATE_NOSYNC;
SerialP$rxByteCnt = 0;
SerialP$rxProto = 0;
SerialP$rxSeqno = 0;
SerialP$rxCRC = 0;
}
#line 193
static __inline void SerialP$txInit(void)
#line 193
{
uint8_t i;
/* atomic removed: atomic calls only */
#line 195
for (i = 0; i < SerialP$TX_BUFFER_COUNT; i++) SerialP$txBuf[i].state = SerialP$BUFFER_AVAILABLE;
SerialP$txState = SerialP$TXSTATE_IDLE;
SerialP$txByteCnt = 0;
SerialP$txProto = 0;
SerialP$txSeqno = 0;
SerialP$txCRC = 0;
SerialP$txPending = FALSE;
SerialP$txIndex = 0;
}
#line 218
static inline error_t SerialP$Init$init(void)
#line 218
{
SerialP$txInit();
SerialP$rxInit();
SerialP$ackInit();
return SUCCESS;
}
# 61 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$Init$init(void)
#line 61
{
if (PLATFORM_BAUDRATE == 19200UL) {
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_byte_time = 200;
}
else {
#line 64
if (PLATFORM_BAUDRATE == 57600UL) {
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_byte_time = 68;
}
}
#line 66
return SUCCESS;
}
# 120 "/opt/tinyos-2.x/tos/platforms/aquisgrain/MeasureClockC.nc"
static inline uint16_t MeasureClockC$Atm128Calibrate$baudrateRegister(uint32_t baudrate)
#line 120
{
return ((uint32_t )MeasureClockC$cycles << 12) / baudrate - 1;
}
# 60 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128Calibrate.nc"
inline static uint16_t HplAtm128UartP$Atm128Calibrate$baudrateRegister(uint32_t arg_0x7ef53898){
#line 60
unsigned int result;
#line 60
#line 60
result = MeasureClockC$Atm128Calibrate$baudrateRegister(arg_0x7ef53898);
#line 60
#line 60
return result;
#line 60
}
#line 60
# 184 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline error_t HplAtm128UartP$Uart1Init$init(void)
#line 184
{
Atm128UartMode_t mode;
Atm128UartStatus_t stts;
Atm128UartControl_t ctrl;
uint16_t ubrr1;
ctrl.bits = (struct Atm128_UCSRB_t ){ .rxcie = 0, .txcie = 0, .rxen = 0, .txen = 0 };
stts.bits = (struct Atm128_UCSRA_t ){ .u2x = 1 };
mode.bits = (struct Atm128_UCSRC_t ){ .ucsz = ATM128_UART_DATA_SIZE_8_BITS };
ubrr1 = HplAtm128UartP$Atm128Calibrate$baudrateRegister(PLATFORM_BAUDRATE);
* (volatile uint8_t *)0x99 = ubrr1;
* (volatile uint8_t *)0x98 = ubrr1 >> 8;
* (volatile uint8_t *)0x9B = stts.flat;
* (volatile uint8_t *)0x9D = mode.flat;
* (volatile uint8_t *)0x9A = ctrl.flat;
return SUCCESS;
}
#line 87
static inline error_t HplAtm128UartP$Uart0Init$init(void)
#line 87
{
Atm128UartMode_t mode;
Atm128UartStatus_t stts;
Atm128UartControl_t ctrl;
uint16_t ubrr0;
ctrl.bits = (struct Atm128_UCSRB_t ){ .rxcie = 0, .txcie = 0, .rxen = 0, .txen = 0 };
stts.bits = (struct Atm128_UCSRA_t ){ .u2x = 1 };
mode.bits = (struct Atm128_UCSRC_t ){ .ucsz = ATM128_UART_DATA_SIZE_8_BITS };
ubrr0 = HplAtm128UartP$Atm128Calibrate$baudrateRegister(PLATFORM_BAUDRATE);
* (volatile uint8_t *)(0x09 + 0x20) = ubrr0;
* (volatile uint8_t *)0x90 = ubrr0 >> 8;
* (volatile uint8_t *)(0x0B + 0x20) = stts.flat;
* (volatile uint8_t *)0x95 = mode.flat;
* (volatile uint8_t *)(0x0A + 0x20) = ctrl.flat;
return SUCCESS;
}
# 83 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline error_t CC2420CsmaP$Init$init(void)
#line 83
{
if (CC2420CsmaP$m_state != CC2420CsmaP$S_PREINIT) {
return FAIL;
}
CC2420CsmaP$m_state = CC2420CsmaP$S_STOPPED;
return SUCCESS;
}
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t CC2420ControlP$AMPacket$address(void){
#line 57
unsigned int result;
#line 57
#line 57
result = CC2420ActiveMessageP$AMPacket$address();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 52 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$makeOutput(void)
#line 52
{
#line 52
* (volatile uint8_t *)55U |= 1 << 5;
}
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$VREN$makeOutput(void){
#line 35
/*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$makeOutput();
#line 35
}
#line 35
# 52 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$makeOutput(void)
#line 52
{
#line 52
* (volatile uint8_t *)49U |= 1 << 7;
}
# 35 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$RSTN$makeOutput(void){
#line 35
/*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$makeOutput();
#line 35
}
#line 35
inline static void CC2420ControlP$CSN$makeOutput(void){
#line 35
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput();
#line 35
}
#line 35
# 102 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$Init$init(void)
#line 102
{
CC2420ControlP$CSN$makeOutput();
CC2420ControlP$RSTN$makeOutput();
CC2420ControlP$VREN$makeOutput();
CC2420ControlP$m_short_addr = CC2420ControlP$AMPacket$address();
return SUCCESS;
}
# 45 "/opt/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, /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$NO_ENTRY, sizeof /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$resQ);
return SUCCESS;
}
# 22 "/opt/tinyos-2.x/tos/system/NoInitC.nc"
static inline error_t NoInitC$Init$init(void)
#line 22
{
return SUCCESS;
}
# 50 "/opt/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 *)49U &= ~(1 << 4);
}
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420TransmitP$SFD$makeInput(void){
#line 33
/*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$makeInput();
#line 33
}
#line 33
inline static void CC2420TransmitP$CSN$makeOutput(void){
#line 35
/*HplAtm128GeneralIOC.PortB.Bit0*/HplAtm128GeneralIOPinP$8$IO$makeOutput();
#line 35
}
#line 35
# 50 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$makeInput(void)
#line 50
{
#line 50
* (volatile uint8_t *)49U &= ~(1 << 5);
}
# 33 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420TransmitP$CCA$makeInput(void){
#line 33
/*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$makeInput();
#line 33
}
#line 33
# 140 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline error_t CC2420TransmitP$Init$init(void)
#line 140
{
CC2420TransmitP$CCA$makeInput();
CC2420TransmitP$CSN$makeOutput();
CC2420TransmitP$SFD$makeInput();
return SUCCESS;
}
# 103 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline error_t CC2420ReceiveP$Init$init(void)
#line 103
{
CC2420ReceiveP$fallingEdgeEnabled = FALSE;
CC2420ReceiveP$m_p_rx_buf = &CC2420ReceiveP$m_rx_buf;
return SUCCESS;
}
# 41 "/opt/tinyos-2.x/tos/interfaces/Random.nc"
inline static uint16_t UniqueSendP$Random$rand16(void){
#line 41
unsigned int result;
#line 41
#line 41
result = RandomMlcgP$Random$rand16();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 62 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueSendP.nc"
static inline error_t UniqueSendP$Init$init(void)
#line 62
{
UniqueSendP$localSendId = UniqueSendP$Random$rand16();
return SUCCESS;
}
# 81 "/opt/tinyos-2.x/tos/system/StateImplP.nc"
static inline error_t StateImplP$Init$init(void)
#line 81
{
int i;
#line 83
for (i = 0; i < 2U; i++) {
StateImplP$state[i] = StateImplP$S_IDLE;
}
return SUCCESS;
}
# 71 "/opt/tinyos-2.x/tos/chips/cc2420/UniqueReceiveP.nc"
static inline error_t UniqueReceiveP$Init$init(void)
#line 71
{
int i;
#line 73
for (i = 0; i < 4; i++) {
UniqueReceiveP$receivedMessages[i].source = (am_addr_t )0xFFFF;
UniqueReceiveP$receivedMessages[i].dsn = 0;
}
return SUCCESS;
}
# 407 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void LinkEstimatorP$initNeighborTable(void)
#line 407
{
uint8_t i;
for (i = 0; i < 10; i++) {
LinkEstimatorP$NeighborTable[i].flags = 0;
}
}
static inline error_t LinkEstimatorP$Init$init(void)
#line 425
{
;
LinkEstimatorP$initNeighborTable();
return SUCCESS;
}
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$address(void){
#line 57
unsigned int result;
#line 57
#line 57
result = CC2420ActiveMessageP$AMPacket$address();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 61 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static inline uint8_t /*CtpP.SendQueueP*/QueueC$0$Queue$maxSize(void)
#line 61
{
return 13;
}
# 65 "/opt/tinyos-2.x/tos/interfaces/Queue.nc"
inline static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$maxSize(void){
#line 65
unsigned char result;
#line 65
#line 65
result = /*CtpP.SendQueueP*/QueueC$0$Queue$maxSize();
#line 65
#line 65
return result;
#line 65
}
#line 65
# 234 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static inline error_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$Init$init(void)
#line 234
{
int i;
#line 236
for (i = 0; i < /*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT; i++) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[i] = /*CtpP.Forwarder*/CtpForwardingEngineP$0$clientEntries + i;
;
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$congestionThreshold = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$maxSize() >> 1;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsgPtr = &/*CtpP.Forwarder*/CtpForwardingEngineP$0$loopbackMsg;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$lastParent = /*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$address();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$seqno = 0;
return SUCCESS;
}
# 721 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline uint8_t LinkEstimatorP$Packet$maxPayloadLength(void)
#line 721
{
return LinkEstimatorP$SubPacket$maxPayloadLength() - sizeof(linkest_header_t );
}
#line 584
static inline uint8_t LinkEstimatorP$Send$maxPayloadLength(void)
#line 584
{
return LinkEstimatorP$Packet$maxPayloadLength();
}
# 112 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$maxPayloadLength(void){
#line 112
unsigned char result;
#line 112
#line 112
result = LinkEstimatorP$Send$maxPayloadLength();
#line 112
#line 112
return result;
#line 112
}
#line 112
# 588 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static inline void *LinkEstimatorP$Send$getPayload(message_t *msg)
#line 588
{
return LinkEstimatorP$Packet$getPayload(msg, (void *)0);
}
# 125 "/opt/tinyos-2.x/tos/interfaces/AMSend.nc"
inline static void */*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$getPayload(message_t *arg_0x7eb20600){
#line 125
void *result;
#line 125
#line 125
result = LinkEstimatorP$Send$getPayload(arg_0x7eb20600);
#line 125
#line 125
return result;
#line 125
}
#line 125
# 57 "/opt/tinyos-2.x/tos/interfaces/AMPacket.nc"
inline static am_addr_t /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$address(void){
#line 57
unsigned int result;
#line 57
#line 57
result = CC2420ActiveMessageP$AMPacket$address();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 654 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline void /*CtpP.Router*/CtpRoutingEngineP$0$routingTableInit(void)
#line 654
{
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive = 0;
}
# 26 "/opt/tinyos-2.x/tos/lib/net/ctp/TreeRouting.h"
static __inline void routeInfoInit(route_info_t *ri)
#line 26
{
ri->parent = INVALID_ADDR;
ri->etx = 0;
ri->haveHeard = 0;
ri->congested = FALSE;
}
# 200 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static inline error_t /*CtpP.Router*/CtpRoutingEngineP$0$Init$init(void)
#line 200
{
uint8_t maxLength;
#line 202
/*CtpP.Router*/CtpRoutingEngineP$0$routeUpdateTimerCount = 0;
/*CtpP.Router*/CtpRoutingEngineP$0$radioOn = FALSE;
/*CtpP.Router*/CtpRoutingEngineP$0$running = FALSE;
/*CtpP.Router*/CtpRoutingEngineP$0$parentChanges = 0;
/*CtpP.Router*/CtpRoutingEngineP$0$state_is_root = 0;
routeInfoInit(&/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo);
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableInit();
/*CtpP.Router*/CtpRoutingEngineP$0$my_ll_addr = /*CtpP.Router*/CtpRoutingEngineP$0$AMPacket$address();
/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsg = /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$getPayload(&/*CtpP.Router*/CtpRoutingEngineP$0$beaconMsgBuffer);
maxLength = /*CtpP.Router*/CtpRoutingEngineP$0$BeaconSend$maxPayloadLength();
;
return SUCCESS;
}
# 65 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static inline error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Init$init(void)
#line 65
{
int i;
#line 67
for (i = 0; i < 12; i++) {
/*CtpP.MessagePoolP.PoolP*/PoolP$0$queue[i] = &/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool[i];
}
/*CtpP.MessagePoolP.PoolP*/PoolP$0$free = 12;
/*CtpP.MessagePoolP.PoolP*/PoolP$0$index = 0;
return SUCCESS;
}
#line 65
static inline error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Init$init(void)
#line 65
{
int i;
#line 67
for (i = 0; i < 12; i++) {
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$queue[i] = &/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool[i];
}
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$free = 12;
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$index = 0;
return SUCCESS;
}
# 64 "/opt/tinyos-2.x/tos/lib/net/ctp/LruCtpMsgCacheP.nc"
static inline error_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Init$init(void)
#line 64
{
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first = 0;
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count = 0;
return SUCCESS;
}
# 66 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clearAll(void)
{
memset(/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits, 0, sizeof /*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$m_bits);
}
# 34 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clearAll(void){
#line 34
/*DisseminationTimerP.TrickleTimerMilliC.ChangeVector*/BitVectorC$1$BitVector$clearAll();
#line 34
}
#line 34
# 66 "/opt/tinyos-2.x/tos/system/BitVectorC.nc"
static inline void /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clearAll(void)
{
memset(/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits, 0, sizeof /*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$m_bits);
}
# 34 "/opt/tinyos-2.x/tos/interfaces/BitVector.nc"
inline static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clearAll(void){
#line 34
/*DisseminationTimerP.TrickleTimerMilliC.PendingVector*/BitVectorC$0$BitVector$clearAll();
#line 34
}
#line 34
# 74 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static inline error_t /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Init$init(void)
#line 74
{
int i;
#line 76
for (i = 0; i < 1U; i++) {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].period = 1024;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].count = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].time = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].remainder = 0;
}
/* atomic removed: atomic calls only */
#line 82
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Pending$clearAll();
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clearAll();
}
return SUCCESS;
}
# 51 "/opt/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 = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Init$init();
#line 51
result = ecombine(result, /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$Init$init());
#line 51
result = ecombine(result, /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Init$init());
#line 51
result = ecombine(result, /*CtpP.MessagePoolP.PoolP*/PoolP$0$Init$init());
#line 51
result = ecombine(result, /*CtpP.Router*/CtpRoutingEngineP$0$Init$init());
#line 51
result = ecombine(result, /*CtpP.Forwarder*/CtpForwardingEngineP$0$Init$init());
#line 51
result = ecombine(result, LinkEstimatorP$Init$init());
#line 51
result = ecombine(result, UniqueReceiveP$Init$init());
#line 51
result = ecombine(result, StateImplP$Init$init());
#line 51
result = ecombine(result, UniqueSendP$Init$init());
#line 51
result = ecombine(result, CC2420ReceiveP$Init$init());
#line 51
result = ecombine(result, CC2420TransmitP$Init$init());
#line 51
result = ecombine(result, NoInitC$Init$init());
#line 51
result = ecombine(result, /*Atm128SpiC.Arbiter.Queue*/FcfsResourceQueueC$0$Init$init());
#line 51
result = ecombine(result, CC2420ControlP$Init$init());
#line 51
result = ecombine(result, CC2420CsmaP$Init$init());
#line 51
result = ecombine(result, HplAtm128UartP$Uart0Init$init());
#line 51
result = ecombine(result, HplAtm128UartP$Uart1Init$init());
#line 51
result = ecombine(result, /*Atm128Uart0C.UartP*/Atm128UartP$0$Init$init());
#line 51
result = ecombine(result, SerialP$Init$init());
#line 51
result = ecombine(result, RandomMlcgP$Init$init());
#line 51
result = ecombine(result, /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Init$init());
#line 51
#line 51
return result;
#line 51
}
#line 51
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t SerialP$startDoneTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(SerialP$startDoneTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 342 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline error_t SerialP$SplitControl$start(void)
#line 342
{
SerialP$startDoneTask$postTask();
return SUCCESS;
}
# 83 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static error_t OctopusC$SerialControl$start(void){
#line 83
unsigned char result;
#line 83
#line 83
result = SerialP$SplitControl$start();
#line 83
#line 83
return result;
#line 83
}
#line 83
# 55 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void CC2420ControlP$StartupTimer$start(CC2420ControlP$StartupTimer$size_type arg_0x7e9d48c8){
#line 55
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$start(arg_0x7e9d48c8);
#line 55
}
#line 55
# 46 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$set(void)
#line 46
{
#line 46
* (volatile uint8_t *)56U |= 1 << 5;
}
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$VREN$set(void){
#line 29
/*HplAtm128GeneralIOC.PortB.Bit5*/HplAtm128GeneralIOPinP$13$IO$set();
#line 29
}
#line 29
# 135 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$CC2420Power$startVReg(void)
#line 135
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 136
{
if (CC2420ControlP$m_state != CC2420ControlP$S_VREG_STOPPED) {
{
unsigned char __nesc_temp =
#line 138
FAIL;
{
#line 138
__nesc_atomic_end(__nesc_atomic);
#line 138
return __nesc_temp;
}
}
}
#line 140
CC2420ControlP$m_state = CC2420ControlP$S_VREG_STARTING;
}
#line 141
__nesc_atomic_end(__nesc_atomic); }
CC2420ControlP$VREN$set();
CC2420ControlP$StartupTimer$start(CC2420_TIME_VREN);
return SUCCESS;
}
# 51 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
inline static error_t CC2420CsmaP$CC2420Power$startVReg(void){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420ControlP$CC2420Power$startVReg();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 92 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline error_t CC2420CsmaP$SplitControl$start(void)
#line 92
{
if (CC2420CsmaP$m_state != CC2420CsmaP$S_STOPPED) {
return FAIL;
}
CC2420CsmaP$m_state = CC2420CsmaP$S_STARTING;
CC2420CsmaP$CC2420Power$startVReg();
return SUCCESS;
}
# 83 "/opt/tinyos-2.x/tos/interfaces/SplitControl.nc"
inline static error_t OctopusC$RadioControl$start(void){
#line 83
unsigned char result;
#line 83
#line 83
result = CC2420CsmaP$SplitControl$start();
#line 83
#line 83
return result;
#line 83
}
#line 83
# 96 "OctopusC.nc"
static inline void OctopusC$Boot$booted(void)
#line 96
{
if (OctopusC$RadioControl$start() != SUCCESS) {
OctopusC$fatalProblem();
}
#line 99
if (TOS_NODE_ID == 0) {
OctopusC$root = TRUE;
if (OctopusC$SerialControl$start() != SUCCESS) {
OctopusC$fatalProblem();
}
}
#line 104
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.moteId, TOS_NODE_ID);
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, NO_REPLY);
OctopusC$samplingPeriod = DEFAULT_SAMPLING_PERIOD;
OctopusC$threshold = DEFAULT_THRESHOLD;
OctopusC$modeAuto = DEFAULT_MODE;
OctopusC$sleeping = FALSE;
OctopusC$sleepDutyCycle = DEFAULT_SLEEP_DUTY_CYCLE;
OctopusC$awakeDutyCycle = DEFAULT_AWAKE_DUTY_CYCLE;
}
# 53 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
inline static void HplCC2420InterruptsP$CCATimer$startPeriodic(uint32_t arg_0x7eb13ce0){
#line 53
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startPeriodic(1U, arg_0x7eb13ce0);
#line 53
}
#line 53
# 88 "/opt/tinyos-2.x/tos/platforms/aquisgrain/chips/cc2420/HplCC2420InterruptsP.nc"
static inline void HplCC2420InterruptsP$Boot$booted(void)
#line 88
{
HplCC2420InterruptsP$CCATimer$startPeriodic(100);
}
# 49 "/opt/tinyos-2.x/tos/interfaces/Boot.nc"
inline static void RealMainP$Boot$booted(void){
#line 49
HplCC2420InterruptsP$Boot$booted();
#line 49
OctopusC$Boot$booted();
#line 49
}
#line 49
# 155 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline mcu_power_t HplAtm128Timer0AsyncP$McuPowerOverride$lowestState(void)
#line 155
{
uint8_t diff;
if (* (volatile uint8_t *)(0x37 + 0x20) & ((1 << 1) | (1 << 0))) {
while (* (volatile uint8_t *)(0x30 + 0x20) & (((1 << 2) | (1 << 1)) | (1 << 0)))
;
diff = * (volatile uint8_t *)(0x31 + 0x20) - * (volatile uint8_t *)(0x32 + 0x20);
if (diff < EXT_STANDBY_T0_THRESHOLD ||
* (volatile uint8_t *)(0x32 + 0x20) > 256 - EXT_STANDBY_T0_THRESHOLD) {
return ATM128_POWER_EXT_STANDBY;
}
#line 170
return ATM128_POWER_SAVE;
}
else {
return ATM128_POWER_DOWN;
}
}
# 54 "/opt/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 = HplAtm128Timer0AsyncP$McuPowerOverride$lowestState();
#line 54
#line 54
return result;
#line 54
}
#line 54
# 66 "/opt/tinyos-2.x/tos/chips/atm128/McuSleepC.nc"
static inline mcu_power_t McuSleepC$getPowerState(void)
#line 66
{
if (* (volatile uint8_t *)(0x37 + 0x20) & ~((((1 << 1) | (1 << 0)) | (1 << 2)) | (1 << 6)) ||
* (volatile uint8_t *)0x7D & ~(1 << 2)) {
return ATM128_POWER_IDLE;
}
else {
if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)(0x0D + 0x20) & (1 << 6)) {
return ATM128_POWER_IDLE;
}
else {
if ((* (volatile uint8_t *)(0x0A + 0x20) | * (volatile uint8_t *)0x9A) & ((1 << 6) | (1 << 7))) {
return ATM128_POWER_IDLE;
}
else {
if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)0x74 & (1 << 2)) {
return ATM128_POWER_IDLE;
}
else {
if (* (volatile uint8_t *)(uint16_t )& * (volatile uint8_t *)(0x06 + 0x20) & (1 << 7)) {
return ATM128_POWER_ADC_NR;
}
else {
return ATM128_POWER_DOWN;
}
}
}
}
}
}
# 132 "/opt/tinyos-2.x/tos/chips/atm128/atm128hardware.h"
static inline mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2)
#line 132
{
return m1 < m2 ? m1 : m2;
}
# 97 "/opt/tinyos-2.x/tos/chips/atm128/McuSleepC.nc"
static inline void McuSleepC$McuSleep$sleep(void)
#line 97
{
uint8_t powerState;
powerState = mcombine(McuSleepC$getPowerState(), McuSleepC$McuPowerOverride$lowestState());
* (volatile uint8_t *)(0x35 + 0x20) = ((
* (volatile uint8_t *)(0x35 + 0x20) & 0xe3) | (1 << 5)) | ({
#line 102
uint16_t __addr16 = (uint16_t )(uint16_t )&McuSleepC$atm128PowerBits[powerState];
#line 102
uint8_t __result;
#line 102
__asm ("lpm %0, Z""\n\t" : "=r"(__result) : "z"(__addr16));__result;
}
);
#line 104
__asm volatile ("sei");
__asm volatile ("sleep");
__asm volatile ("cli");}
# 59 "/opt/tinyos-2.x/tos/interfaces/McuSleep.nc"
inline static void SchedulerBasicP$McuSleep$sleep(void){
#line 59
McuSleepC$McuSleep$sleep();
#line 59
}
#line 59
# 67 "/opt/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 138
static 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 "/opt/tinyos-2.x/tos/interfaces/Scheduler.nc"
inline static void RealMainP$Scheduler$taskLoop(void){
#line 61
SchedulerBasicP$Scheduler$taskLoop();
#line 61
}
#line 61
# 140 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static __inline void HplAtm128Timer0AsyncP$stabiliseTimer0(void)
#line 140
{
* (volatile uint8_t *)(0x33 + 0x20) = * (volatile uint8_t *)(0x33 + 0x20);
while (* (volatile uint8_t *)(0x30 + 0x20) & (1 << 0))
;
}
# 47 "/opt/tinyos-2.x/tos/lib/timer/CounterToLocalTimeC.nc"
static inline void /*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow(void)
{
}
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$overflow(void){
#line 71
/*HilTimerMilliC.CounterToLocalTimeC*/CounterToLocalTimeC$0$Counter$overflow();
#line 71
}
#line 71
# 82 "/opt/tinyos-2.x/tos/chips/atm128/atm128hardware.h"
static __inline void __nesc_enable_interrupt(void)
#line 82
{
__asm volatile ("sei");}
# 132 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
static inline uint8_t HplAtm128Timer0AsyncP$Compare$get(void)
#line 132
{
#line 132
return * (volatile uint8_t *)(0x31 + 0x20);
}
# 39 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$size_type /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$get(void){
#line 39
unsigned char result;
#line 39
#line 39
result = HplAtm128Timer0AsyncP$Compare$get();
#line 39
#line 39
return result;
#line 39
}
#line 39
# 139 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$fired(void)
#line 139
{
int overflowed;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base += /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$get() + 1U;
overflowed = !/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base;
__nesc_enable_interrupt();
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt();
if (overflowed) {
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$overflow();
}
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer0AsyncP$Compare$fired(void){
#line 49
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$fired();
#line 49
}
#line 49
# 220 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static inline void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$overflow(void)
#line 220
{
}
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void HplAtm128Timer0AsyncP$Timer$overflow(void){
#line 61
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$overflow();
#line 61
}
#line 61
# 387 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$SerialFrameComm$dataReceived(uint8_t data)
#line 387
{
SerialP$rx_state_machine(FALSE, data);
}
# 83 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
inline static void HdlcTranslateC$SerialFrameComm$dataReceived(uint8_t arg_0x7e719010){
#line 83
SerialP$SerialFrameComm$dataReceived(arg_0x7e719010);
#line 83
}
#line 83
# 384 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$SerialFrameComm$delimiterReceived(void)
#line 384
{
SerialP$rx_state_machine(TRUE, 0);
}
# 74 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
inline static void HdlcTranslateC$SerialFrameComm$delimiterReceived(void){
#line 74
SerialP$SerialFrameComm$delimiterReceived();
#line 74
}
#line 74
# 61 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static inline void HdlcTranslateC$UartStream$receivedByte(uint8_t data)
#line 61
{
if (data == HDLC_FLAG_BYTE) {
HdlcTranslateC$SerialFrameComm$delimiterReceived();
return;
}
else {
#line 73
if (data == HDLC_CTLESC_BYTE) {
HdlcTranslateC$state.receiveEscape = 1;
return;
}
else {
#line 78
if (HdlcTranslateC$state.receiveEscape) {
HdlcTranslateC$state.receiveEscape = 0;
data = data ^ 0x20;
}
}
}
#line 83
HdlcTranslateC$SerialFrameComm$dataReceived(data);
}
# 79 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
inline static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receivedByte(uint8_t arg_0x7e635010){
#line 79
HdlcTranslateC$UartStream$receivedByte(arg_0x7e635010);
#line 79
}
#line 79
# 116 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static inline void HdlcTranslateC$UartStream$receiveDone(uint8_t *buf, uint16_t len, error_t error)
#line 116
{
}
# 99 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
inline static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receiveDone(uint8_t *arg_0x7e635ce0, uint16_t arg_0x7e635e70, error_t arg_0x7e633010){
#line 99
HdlcTranslateC$UartStream$receiveDone(arg_0x7e635ce0, arg_0x7e635e70, arg_0x7e633010);
#line 99
}
#line 99
# 107 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$rxDone(uint8_t data)
#line 107
{
if (/*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_buf) {
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_buf[/*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_pos++] = data;
if (/*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_pos >= /*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_len) {
uint8_t *buf = /*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_buf;
#line 113
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_buf = (void *)0;
/*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receiveDone(buf, /*Atm128Uart0C.UartP*/Atm128UartP$0$m_rx_len, SUCCESS);
}
}
else {
/*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$receivedByte(data);
}
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
inline static void HplAtm128UartP$HplUart0$rxDone(uint8_t arg_0x7e603b30){
#line 49
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$rxDone(arg_0x7e603b30);
#line 49
}
#line 49
# 391 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline bool SerialP$valid_rx_proto(uint8_t proto)
#line 391
{
switch (proto) {
case SERIAL_PROTO_PACKET_ACK:
return TRUE;
case SERIAL_PROTO_ACK:
case SERIAL_PROTO_PACKET_NOACK:
default:
return FALSE;
}
}
# 197 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$lockCurrentBuffer(void)
#line 197
{
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufOneLocked = 1;
}
else {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufZeroLocked = 1;
}
}
#line 193
static inline bool /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$isCurrentBufferLocked(void)
#line 193
{
return /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which ? /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufZeroLocked : /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.bufOneLocked;
}
#line 220
static inline error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$startPacket(void)
#line 220
{
error_t result = SUCCESS;
/* atomic removed: atomic calls only */
#line 222
{
if (!/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$isCurrentBufferLocked()) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$lockCurrentBuffer();
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.state = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_BEGIN;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex = 0;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvType = TOS_SERIAL_UNKNOWN_ID;
}
else {
result = EBUSY;
}
}
return result;
}
# 51 "/opt/tinyos-2.x/tos/lib/serial/ReceiveBytePacket.nc"
inline static error_t SerialP$ReceiveBytePacket$startPacket(void){
#line 51
unsigned char result;
#line 51
#line 51
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$startPacket();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 309 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static __inline uint16_t SerialP$rx_current_crc(void)
#line 309
{
uint16_t crc;
uint8_t tmp = SerialP$rxBuf.writePtr;
#line 312
tmp = tmp == 0 ? SerialP$RX_DATA_BUFFER_SIZE : tmp - 1;
crc = SerialP$rxBuf.buf[tmp] & 0x00ff;
crc = (crc << 8) & 0xFF00;
tmp = tmp == 0 ? SerialP$RX_DATA_BUFFER_SIZE : tmp - 1;
crc |= SerialP$rxBuf.buf[tmp] & 0x00FF;
return crc;
}
# 69 "/opt/tinyos-2.x/tos/lib/serial/ReceiveBytePacket.nc"
inline static void SerialP$ReceiveBytePacket$endPacket(error_t arg_0x7e725e08){
#line 69
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$endPacket(arg_0x7e725e08);
#line 69
}
#line 69
# 215 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBufferSwap(void)
#line 215
{
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which ? 0 : 1;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBuffer = (uint8_t *)/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$messagePtrs[/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which];
}
# 56 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
inline static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$postTask(void){
#line 56
unsigned char result;
#line 56
#line 56
result = SchedulerBasicP$TaskBasic$postTask(/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 232 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static __inline bool SerialP$ack_queue_is_full(void)
#line 232
{
uint8_t tmp;
#line 233
uint8_t tmp2;
/* atomic removed: atomic calls only */
#line 234
{
tmp = SerialP$ackQ.writePtr;
tmp2 = SerialP$ackQ.readPtr;
}
if (++tmp > SerialP$ACK_QUEUE_SIZE) {
#line 238
tmp = 0;
}
#line 239
return tmp == tmp2;
}
static __inline void SerialP$ack_queue_push(uint8_t token)
#line 248
{
if (!SerialP$ack_queue_is_full()) {
/* atomic removed: atomic calls only */
#line 250
{
SerialP$ackQ.buf[SerialP$ackQ.writePtr] = token;
if (++ SerialP$ackQ.writePtr > SerialP$ACK_QUEUE_SIZE) {
#line 252
SerialP$ackQ.writePtr = 0;
}
}
#line 254
SerialP$MaybeScheduleTx();
}
}
# 238 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$byteReceived(uint8_t b)
#line 238
{
/* atomic removed: atomic calls only */
#line 239
{
switch (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.state) {
case /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_BEGIN:
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.state = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_DATA;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$PacketInfo$offset(b);
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvType = b;
break;
case /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_DATA:
if (/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex < sizeof(message_t )) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBuffer[/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex] = b;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex++;
}
else {
}
break;
case /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_IDLE:
default:
#line 260
;
}
}
}
# 58 "/opt/tinyos-2.x/tos/lib/serial/ReceiveBytePacket.nc"
inline static void SerialP$ReceiveBytePacket$byteReceived(uint8_t arg_0x7e725838){
#line 58
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$byteReceived(arg_0x7e725838);
#line 58
}
#line 58
# 299 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static __inline uint8_t SerialP$rx_buffer_top(void)
#line 299
{
uint8_t tmp = SerialP$rxBuf.buf[SerialP$rxBuf.readPtr];
#line 301
return tmp;
}
#line 303
static __inline uint8_t SerialP$rx_buffer_pop(void)
#line 303
{
uint8_t tmp = SerialP$rxBuf.buf[SerialP$rxBuf.readPtr];
#line 305
if (++ SerialP$rxBuf.readPtr > SerialP$RX_DATA_BUFFER_SIZE) {
#line 305
SerialP$rxBuf.readPtr = 0;
}
#line 306
return tmp;
}
#line 295
static __inline void SerialP$rx_buffer_push(uint8_t data)
#line 295
{
SerialP$rxBuf.buf[SerialP$rxBuf.writePtr] = data;
if (++ SerialP$rxBuf.writePtr > SerialP$RX_DATA_BUFFER_SIZE) {
#line 297
SerialP$rxBuf.writePtr = 0;
}
}
# 55 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static inline void HdlcTranslateC$SerialFrameComm$resetReceive(void)
#line 55
{
HdlcTranslateC$state.receiveEscape = 0;
}
# 68 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
inline static void SerialP$SerialFrameComm$resetReceive(void){
#line 68
HdlcTranslateC$SerialFrameComm$resetReceive();
#line 68
}
#line 68
#line 54
inline static error_t SerialP$SerialFrameComm$putData(uint8_t arg_0x7e721d40){
#line 54
unsigned char result;
#line 54
#line 54
result = HdlcTranslateC$SerialFrameComm$putData(arg_0x7e721d40);
#line 54
#line 54
return result;
#line 54
}
#line 54
# 513 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline error_t SerialP$SendBytePacket$completeSend(void)
#line 513
{
bool ret = FAIL;
/* atomic removed: atomic calls only */
#line 515
{
SerialP$txBuf[SerialP$TX_DATA_INDEX].state = SerialP$BUFFER_COMPLETE;
ret = SUCCESS;
}
return ret;
}
# 60 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
inline static error_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$completeSend(void){
#line 60
unsigned char result;
#line 60
#line 60
result = SerialP$SendBytePacket$completeSend();
#line 60
#line 60
return result;
#line 60
}
#line 60
# 172 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static inline uint8_t /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$nextByte(void)
#line 172
{
uint8_t b;
uint8_t indx;
/* atomic removed: atomic calls only */
#line 175
{
b = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendBuffer[/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex];
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex++;
indx = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendIndex;
}
if (indx > /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$sendLen) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$completeSend();
return 0;
}
else {
return b;
}
}
# 70 "/opt/tinyos-2.x/tos/lib/serial/SendBytePacket.nc"
inline static uint8_t SerialP$SendBytePacket$nextByte(void){
#line 70
unsigned char result;
#line 70
#line 70
result = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$SendBytePacket$nextByte();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 642 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static inline void SerialP$SerialFrameComm$putDone(void)
#line 642
{
{
error_t txResult = SUCCESS;
switch (SerialP$txState) {
case SerialP$TXSTATE_PROTO:
txResult = SerialP$SerialFrameComm$putData(SerialP$txProto);
SerialP$txState = SerialP$TXSTATE_INFO;
SerialP$txCRC = crcByte(SerialP$txCRC, SerialP$txProto);
break;
case SerialP$TXSTATE_SEQNO:
txResult = SerialP$SerialFrameComm$putData(SerialP$txSeqno);
SerialP$txState = SerialP$TXSTATE_INFO;
SerialP$txCRC = crcByte(SerialP$txCRC, SerialP$txSeqno);
break;
case SerialP$TXSTATE_INFO:
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 666
{
txResult = SerialP$SerialFrameComm$putData(SerialP$txBuf[SerialP$txIndex].buf);
SerialP$txCRC = crcByte(SerialP$txCRC, SerialP$txBuf[SerialP$txIndex].buf);
++SerialP$txByteCnt;
if (SerialP$txIndex == SerialP$TX_DATA_INDEX) {
uint8_t nextByte;
#line 673
nextByte = SerialP$SendBytePacket$nextByte();
if (SerialP$txBuf[SerialP$txIndex].state == SerialP$BUFFER_COMPLETE || SerialP$txByteCnt >= SerialP$SERIAL_MTU) {
SerialP$txState = SerialP$TXSTATE_FCS1;
}
else {
SerialP$txBuf[SerialP$txIndex].buf = nextByte;
}
}
else {
SerialP$txState = SerialP$TXSTATE_FCS1;
}
}
#line 684
__nesc_atomic_end(__nesc_atomic); }
break;
case SerialP$TXSTATE_FCS1:
txResult = SerialP$SerialFrameComm$putData(SerialP$txCRC & 0xff);
SerialP$txState = SerialP$TXSTATE_FCS2;
break;
case SerialP$TXSTATE_FCS2:
txResult = SerialP$SerialFrameComm$putData((SerialP$txCRC >> 8) & 0xff);
SerialP$txState = SerialP$TXSTATE_ENDFLAG;
break;
case SerialP$TXSTATE_ENDFLAG:
txResult = SerialP$SerialFrameComm$putDelimiter();
SerialP$txState = SerialP$TXSTATE_ENDWAIT;
break;
case SerialP$TXSTATE_ENDWAIT:
SerialP$txState = SerialP$TXSTATE_FINISH;
case SerialP$TXSTATE_FINISH:
SerialP$MaybeScheduleTx();
break;
case SerialP$TXSTATE_ERROR:
default:
txResult = FAIL;
break;
}
if (txResult != SUCCESS) {
SerialP$txState = SerialP$TXSTATE_ERROR;
SerialP$MaybeScheduleTx();
}
}
}
# 89 "/opt/tinyos-2.x/tos/lib/serial/SerialFrameComm.nc"
inline static void HdlcTranslateC$SerialFrameComm$putDone(void){
#line 89
SerialP$SerialFrameComm$putDone();
#line 89
}
#line 89
# 48 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
inline static error_t HdlcTranslateC$UartStream$send(uint8_t *arg_0x7e637768, uint16_t arg_0x7e6378f8){
#line 48
unsigned char result;
#line 48
#line 48
result = /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$send(arg_0x7e637768, arg_0x7e6378f8);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 104 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static inline void HdlcTranslateC$UartStream$sendDone(uint8_t *buf, uint16_t len,
error_t error)
#line 105
{
if (HdlcTranslateC$state.sendEscape) {
HdlcTranslateC$state.sendEscape = 0;
HdlcTranslateC$m_data = HdlcTranslateC$txTemp;
HdlcTranslateC$UartStream$send(&HdlcTranslateC$m_data, 1);
}
else {
HdlcTranslateC$SerialFrameComm$putDone();
}
}
# 57 "/opt/tinyos-2.x/tos/interfaces/UartStream.nc"
inline static void /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$sendDone(uint8_t *arg_0x7e637f00, uint16_t arg_0x7e6360b0, error_t arg_0x7e636238){
#line 57
HdlcTranslateC$UartStream$sendDone(arg_0x7e637f00, arg_0x7e6360b0, arg_0x7e636238);
#line 57
}
#line 57
# 46 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
inline static void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$tx(uint8_t arg_0x7e603068){
#line 46
HplAtm128UartP$HplUart0$tx(arg_0x7e603068);
#line 46
}
#line 46
# 139 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$txDone(void)
#line 139
{
if (/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_pos < /*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_len) {
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$tx(/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf[/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_pos++]);
}
else {
uint8_t *buf = /*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf;
#line 146
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf = (void *)0;
/*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$sendDone(buf, /*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_len, SUCCESS);
}
}
# 47 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
inline static void HplAtm128UartP$HplUart0$txDone(void){
#line 47
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$txDone();
#line 47
}
#line 47
# 283 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline void HplAtm128UartP$HplUart1$default$rxDone(uint8_t data)
#line 283
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
inline static void HplAtm128UartP$HplUart1$rxDone(uint8_t arg_0x7e603b30){
#line 49
HplAtm128UartP$HplUart1$default$rxDone(arg_0x7e603b30);
#line 49
}
#line 49
# 282 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static inline void HplAtm128UartP$HplUart1$default$txDone(void)
#line 282
{
}
# 47 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128Uart.nc"
inline static void HplAtm128UartP$HplUart1$txDone(void){
#line 47
HplAtm128UartP$HplUart1$default$txDone();
#line 47
}
#line 47
# 188 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$CompareA$default$fired(void)
#line 188
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer3P$CompareA$fired(void){
#line 49
HplAtm128Timer3P$CompareA$default$fired();
#line 49
}
#line 49
# 192 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$CompareB$default$fired(void)
#line 192
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer3P$CompareB$fired(void){
#line 49
HplAtm128Timer3P$CompareB$default$fired();
#line 49
}
#line 49
# 196 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$CompareC$default$fired(void)
#line 196
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer3P$CompareC$fired(void){
#line 49
HplAtm128Timer3P$CompareC$default$fired();
#line 49
}
#line 49
# 200 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline void HplAtm128Timer3P$Capture$default$captured(uint16_t time)
#line 200
{
}
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void HplAtm128Timer3P$Capture$captured(HplAtm128Timer3P$Capture$size_type arg_0x7e55c120){
#line 51
HplAtm128Timer3P$Capture$default$captured(arg_0x7e55c120);
#line 51
}
#line 51
# 47 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
static inline uint16_t HplAtm128Timer3P$Timer$get(void)
#line 47
{
#line 47
return * (volatile uint16_t *)0x88;
}
# 174 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static inline void /*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$overflow(void)
#line 174
{
}
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static void /*CounterMicro32C.Transform32*/TransformCounterC$0$Counter$overflow(void){
#line 71
/*Atm128Uart0C.UartP*/Atm128UartP$0$Counter$overflow();
#line 71
}
#line 71
# 122 "/opt/tinyos-2.x/tos/lib/timer/TransformCounterC.nc"
static inline void /*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$overflow(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
/*CounterMicro32C.Transform32*/TransformCounterC$0$m_upper++;
if ((/*CounterMicro32C.Transform32*/TransformCounterC$0$m_upper & /*CounterMicro32C.Transform32*/TransformCounterC$0$OVERFLOW_MASK) == 0) {
/*CounterMicro32C.Transform32*/TransformCounterC$0$Counter$overflow();
}
}
#line 130
__nesc_atomic_end(__nesc_atomic); }
}
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static void /*CounterThree16C.NCounter*/Atm128CounterC$0$Counter$overflow(void){
#line 71
/*CounterMicro32C.Transform32*/TransformCounterC$0$CounterFrom$overflow();
#line 71
}
#line 71
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline void /*CounterThree16C.NCounter*/Atm128CounterC$0$Timer$overflow(void)
{
/*CounterThree16C.NCounter*/Atm128CounterC$0$Counter$overflow();
}
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline void /*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$overflow(void)
#line 51
{
}
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void HplAtm128Timer3P$Timer$overflow(void){
#line 61
/*InitThreeP.InitThree*/Atm128TimerInitC$0$Timer$overflow();
#line 61
/*CounterThree16C.NCounter*/Atm128CounterC$0$Timer$overflow();
#line 61
}
#line 61
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420ControlP$SpiResource$request(void){
#line 78
unsigned char result;
#line 78
#line 78
result = CC2420SpiImplP$Resource$request(/*CC2420ControlC.Spi*/CC2420SpiC$0$CLIENT_ID);
#line 78
#line 78
return result;
#line 78
}
#line 78
# 119 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline error_t CC2420ControlP$Resource$request(void)
#line 119
{
return CC2420ControlP$SpiResource$request();
}
# 78 "/opt/tinyos-2.x/tos/interfaces/Resource.nc"
inline static error_t CC2420CsmaP$Resource$request(void){
#line 78
unsigned char result;
#line 78
#line 78
result = CC2420ControlP$Resource$request();
#line 78
#line 78
return result;
#line 78
}
#line 78
# 200 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static inline void CC2420CsmaP$CC2420Power$startVRegDone(void)
#line 200
{
CC2420CsmaP$Resource$request();
}
# 56 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Power.nc"
inline static void CC2420ControlP$CC2420Power$startVRegDone(void){
#line 56
CC2420CsmaP$CC2420Power$startVRegDone();
#line 56
}
#line 56
# 46 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$set(void)
#line 46
{
#line 46
* (volatile uint8_t *)50U |= 1 << 7;
}
# 29 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$RSTN$set(void){
#line 29
/*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$set();
#line 29
}
#line 29
# 47 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline void /*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$clr(void)
#line 47
{
#line 47
* (volatile uint8_t *)50U &= ~(1 << 7);
}
# 30 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static void CC2420ControlP$RSTN$clr(void){
#line 30
/*HplAtm128GeneralIOC.PortD.Bit7*/HplAtm128GeneralIOPinP$31$IO$clr();
#line 30
}
#line 30
# 322 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ControlP.nc"
static inline void CC2420ControlP$StartupTimer$fired(void)
#line 322
{
if (CC2420ControlP$m_state == CC2420ControlP$S_VREG_STARTING) {
CC2420ControlP$m_state = CC2420ControlP$S_VREG_STARTED;
CC2420ControlP$RSTN$clr();
CC2420ControlP$RSTN$set();
CC2420ControlP$CC2420Power$startVRegDone();
}
}
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static bool CC2420TransmitP$CCA$get(void){
#line 32
unsigned char result;
#line 32
#line 32
result = /*HplAtm128GeneralIOC.PortD.Bit5*/HplAtm128GeneralIOPinP$29$IO$get();
#line 32
#line 32
return result;
#line 32
}
#line 32
# 456 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$BackoffTimer$fired(void)
#line 456
{
/* atomic removed: atomic calls only */
#line 457
{
switch (CC2420TransmitP$m_state) {
case CC2420TransmitP$S_SAMPLE_CCA:
if (CC2420TransmitP$CCA$get()) {
CC2420TransmitP$m_state = CC2420TransmitP$S_BEGIN_TRANSMIT;
CC2420TransmitP$BackoffTimer$start(CC2420_TIME_ACK_TURNAROUND);
}
else {
CC2420TransmitP$congestionBackoff();
}
break;
case CC2420TransmitP$S_CCA_CANCEL:
CC2420TransmitP$m_state = CC2420TransmitP$S_TX_CANCEL;
case CC2420TransmitP$S_BEGIN_TRANSMIT:
case CC2420TransmitP$S_TX_CANCEL:
if (CC2420TransmitP$acquireSpiResource() == SUCCESS) {
CC2420TransmitP$attemptSend();
}
break;
case CC2420TransmitP$S_ACK_WAIT:
CC2420TransmitP$signalDone(SUCCESS);
break;
case CC2420TransmitP$S_SFD:
CC2420TransmitP$SFLUSHTX$strobe();
CC2420TransmitP$CaptureSFD$captureRisingEdge();
CC2420TransmitP$releaseSpiResource();
CC2420TransmitP$signalDone(ERETRY);
break;
default:
break;
}
}
}
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$fired(void){
#line 67
CC2420TransmitP$BackoffTimer$fired();
#line 67
CC2420ControlP$StartupTimer$fired();
#line 67
}
#line 67
# 151 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$fired(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
if (/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt == 0)
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$fired();
}
else
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$set_alarm();
}
}
#line 163
__nesc_atomic_end(__nesc_atomic); }
}
# 67 "/opt/tinyos-2.x/tos/lib/timer/Alarm.nc"
inline static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$fired(void){
#line 67
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$fired();
#line 67
}
#line 67
# 110 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired(void)
#line 110
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$stop();
;
__nesc_enable_interrupt();
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$Alarm$fired();
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer1P$CompareA$fired(void){
#line 49
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Compare$fired();
#line 49
}
#line 49
# 198 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareB$default$fired(void)
#line 198
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer1P$CompareB$fired(void){
#line 49
HplAtm128Timer1P$CompareB$default$fired();
#line 49
}
#line 49
# 202 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$CompareC$default$fired(void)
#line 202
{
}
# 49 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Compare.nc"
inline static void HplAtm128Timer1P$CompareC$fired(void){
#line 49
HplAtm128Timer1P$CompareC$default$fired();
#line 49
}
#line 49
# 166 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$CC2420Receive$sfd_dropped(void)
#line 166
{
if (CC2420ReceiveP$m_timestamp_size) {
CC2420ReceiveP$m_timestamp_size--;
}
}
# 53 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
inline static void CC2420TransmitP$CC2420Receive$sfd_dropped(void){
#line 53
CC2420ReceiveP$CC2420Receive$sfd_dropped();
#line 53
}
#line 53
# 45 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static __inline bool /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$get(void)
#line 45
{
#line 45
return (* (volatile uint8_t *)48U & (1 << 4)) != 0;
}
# 32 "/opt/tinyos-2.x/tos/interfaces/GeneralIO.nc"
inline static bool CC2420TransmitP$SFD$get(void){
#line 32
unsigned char result;
#line 32
#line 32
result = /*HplAtm128GeneralIOC.PortD.Bit4*/HplAtm128GeneralIOPinP$28$IO$get();
#line 32
#line 32
return result;
#line 32
}
#line 32
# 157 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$CC2420Receive$sfd(uint16_t time)
#line 157
{
if (CC2420ReceiveP$m_timestamp_size < CC2420ReceiveP$TIMESTAMP_QUEUE_SIZE) {
uint8_t tail = (CC2420ReceiveP$m_timestamp_head + CC2420ReceiveP$m_timestamp_size) %
CC2420ReceiveP$TIMESTAMP_QUEUE_SIZE;
#line 161
CC2420ReceiveP$m_timestamp_queue[tail] = time;
CC2420ReceiveP$m_timestamp_size++;
}
}
# 47 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420Receive.nc"
inline static void CC2420TransmitP$CC2420Receive$sfd(uint16_t arg_0x7de52aa8){
#line 47
CC2420ReceiveP$CC2420Receive$sfd(arg_0x7de52aa8);
#line 47
}
#line 47
# 770 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$TimeStamp$default$receivedSFD(uint16_t time)
#line 770
{
}
# 50 "/opt/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc"
inline static void CC2420TransmitP$TimeStamp$receivedSFD(uint16_t arg_0x7de73b40){
#line 50
CC2420TransmitP$TimeStamp$default$receivedSFD(arg_0x7de73b40);
#line 50
}
#line 50
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128GpioCaptureC.nc"
static inline error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureFallingEdge(void)
#line 56
{
return /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$enableCapture(FALSE);
}
# 43 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
inline static error_t CC2420TransmitP$CaptureSFD$captureFallingEdge(void){
#line 43
unsigned char result;
#line 43
#line 43
result = /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captureFallingEdge();
#line 43
#line 43
return result;
#line 43
}
#line 43
# 767 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$TimeStamp$default$transmittedSFD(uint16_t time, message_t *p_msg)
#line 767
{
}
# 39 "/opt/tinyos-2.x/tos/interfaces/RadioTimeStamping.nc"
inline static void CC2420TransmitP$TimeStamp$transmittedSFD(uint16_t arg_0x7de73460, message_t *arg_0x7de73610){
#line 39
CC2420TransmitP$TimeStamp$default$transmittedSFD(arg_0x7de73460, arg_0x7de73610);
#line 39
}
#line 39
# 263 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static inline void CC2420TransmitP$CaptureSFD$captured(uint16_t time)
#line 263
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 264
{
switch (CC2420TransmitP$m_state) {
case CC2420TransmitP$S_SFD:
CC2420TransmitP$CaptureSFD$captureFallingEdge();
CC2420TransmitP$TimeStamp$transmittedSFD(time, CC2420TransmitP$m_msg);
CC2420TransmitP$releaseSpiResource();
CC2420TransmitP$BackoffTimer$stop();
CC2420TransmitP$m_state = CC2420TransmitP$S_EFD;
if (((__nesc_ntoh_leuint16((unsigned char *)&CC2420TransmitP$CC2420Packet$getHeader(CC2420TransmitP$m_msg)->fcf) >> IEEE154_FCF_FRAME_TYPE) & 7) == IEEE154_TYPE_DATA) {
__nesc_hton_uint16((unsigned char *)&CC2420TransmitP$CC2420Packet$getMetadata(CC2420TransmitP$m_msg)->time, time);
}
if (CC2420TransmitP$SFD$get()) {
break;
}
case CC2420TransmitP$S_EFD:
CC2420TransmitP$CaptureSFD$captureRisingEdge();
if (__nesc_ntoh_leuint16((unsigned char *)&CC2420TransmitP$CC2420Packet$getHeader(CC2420TransmitP$m_msg)->fcf) & (1 << IEEE154_FCF_ACK_REQ)) {
CC2420TransmitP$m_state = CC2420TransmitP$S_ACK_WAIT;
CC2420TransmitP$BackoffTimer$start(CC2420_ACK_WAIT_DELAY);
}
else
#line 287
{
CC2420TransmitP$signalDone(SUCCESS);
}
if (!CC2420TransmitP$SFD$get()) {
break;
}
default:
if (!CC2420TransmitP$m_receiving) {
CC2420TransmitP$CaptureSFD$captureFallingEdge();
CC2420TransmitP$TimeStamp$receivedSFD(time);
CC2420TransmitP$CC2420Receive$sfd(time);
CC2420TransmitP$m_receiving = TRUE;
CC2420TransmitP$m_prev_time = time;
if (CC2420TransmitP$SFD$get()) {
{
__nesc_atomic_end(__nesc_atomic);
#line 312
return;
}
}
}
CC2420TransmitP$CaptureSFD$captureRisingEdge();
CC2420TransmitP$m_receiving = FALSE;
if (time - CC2420TransmitP$m_prev_time < 10) {
CC2420TransmitP$CC2420Receive$sfd_dropped();
}
break;
}
}
#line 323
__nesc_atomic_end(__nesc_atomic); }
}
# 50 "/opt/tinyos-2.x/tos/interfaces/GpioCapture.nc"
inline static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captured(uint16_t arg_0x7e124ab8){
#line 50
CC2420TransmitP$CaptureSFD$captured(arg_0x7e124ab8);
#line 50
}
#line 50
# 126 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
static inline void HplAtm128Timer1P$Capture$reset(void)
#line 126
{
#line 126
* (volatile uint8_t *)(0x36 + 0x20) = 1 << 5;
}
# 55 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$reset(void){
#line 55
HplAtm128Timer1P$Capture$reset();
#line 55
}
#line 55
# 64 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128GpioCaptureC.nc"
static inline void /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$captured(uint16_t time)
#line 64
{
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$reset();
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Capture$captured(time);
}
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Capture.nc"
inline static void HplAtm128Timer1P$Capture$captured(HplAtm128Timer1P$Capture$size_type arg_0x7e55c120){
#line 51
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$captured(arg_0x7e55c120);
#line 51
}
#line 51
# 117 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow(void)
#line 117
{
}
# 166 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
static inline void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$overflow(void)
{
}
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static void /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$overflow(void){
#line 71
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$overflow();
#line 71
}
#line 71
# 122 "/opt/tinyos-2.x/tos/lib/timer/TransformCounterC.nc"
static inline void /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$overflow(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
/*Counter32khz32C.Transform32*/TransformCounterC$1$m_upper++;
if ((/*Counter32khz32C.Transform32*/TransformCounterC$1$m_upper & /*Counter32khz32C.Transform32*/TransformCounterC$1$OVERFLOW_MASK) == 0) {
/*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$overflow();
}
}
#line 130
__nesc_atomic_end(__nesc_atomic); }
}
# 71 "/opt/tinyos-2.x/tos/lib/timer/Counter.nc"
inline static void /*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$overflow(void){
#line 71
/*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$overflow();
#line 71
}
#line 71
# 56 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128CounterC.nc"
static inline void /*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$overflow(void)
{
/*CounterOne16C.NCounter*/Atm128CounterC$1$Counter$overflow();
}
# 51 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128TimerInitC.nc"
static inline void /*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$overflow(void)
#line 51
{
}
# 61 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer.nc"
inline static void HplAtm128Timer1P$Timer$overflow(void){
#line 61
/*InitOneP.InitOne*/Atm128TimerInitC$1$Timer$overflow();
#line 61
/*CounterOne16C.NCounter*/Atm128CounterC$1$Timer$overflow();
#line 61
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Alarm16.NAlarm*/Atm128AlarmC$0$HplAtm128Timer$overflow();
#line 61
}
#line 61
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig0$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin0*/HplAtm128InterruptPinP$0$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig1$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin1*/HplAtm128InterruptPinP$1$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig2$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin2*/HplAtm128InterruptPinP$2$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig3$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin3*/HplAtm128InterruptPinP$3$IrqSignal$fired();
#line 41
}
#line 41
# 174 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static inline void CC2420ReceiveP$InterruptFIFOP$fired(void)
#line 174
{
if (CC2420ReceiveP$m_state == CC2420ReceiveP$S_STARTED) {
CC2420ReceiveP$beginReceive();
}
else {
CC2420ReceiveP$m_missed_packets++;
}
}
# 57 "/opt/tinyos-2.x/tos/interfaces/GpioInterrupt.nc"
inline static void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$fired(void){
#line 57
CC2420ReceiveP$InterruptFIFOP$fired();
#line 57
}
#line 57
# 38 "/opt/tinyos-2.x/tos/chips/atm128/pins/Atm128GpioInterruptC.nc"
static inline void /*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$fired(void)
#line 38
{
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Interrupt$fired();
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$fired(void){
#line 64
/*HplCC2420InterruptsC.InterruptFIFOPC*/Atm128GpioInterruptC$0$Atm128Interrupt$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig4$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin4*/HplAtm128InterruptPinP$4$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig5$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin5*/HplAtm128InterruptPinP$5$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig6$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin6*/HplAtm128InterruptPinP$6$IrqSignal$fired();
#line 41
}
#line 41
# 63 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$default$fired(void)
#line 63
{
}
# 64 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128Interrupt.nc"
inline static void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$fired(void){
#line 64
/*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$default$fired();
#line 64
}
#line 64
# 61 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptPinP.nc"
static inline void /*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$IrqSignal$fired(void)
#line 61
{
#line 61
/*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$Irq$fired();
}
# 41 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSig.nc"
inline static void HplAtm128InterruptSigP$IntSig7$fired(void){
#line 41
/*HplAtm128InterruptC.IntPin7*/HplAtm128InterruptPinP$7$IrqSignal$fired();
#line 41
}
#line 41
# 99 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static inline uint8_t HplAtm128SpiP$SPI$read(void)
#line 99
{
#line 99
return * (volatile uint8_t *)(0x0F + 0x20);
}
# 80 "/opt/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
#line 96
inline static void Atm128SpiP$Spi$enableInterrupt(bool arg_0x7dfb2da0){
#line 96
HplAtm128SpiP$SPI$enableInterrupt(arg_0x7dfb2da0);
#line 96
}
#line 96
# 264 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static inline void Atm128SpiP$Spi$dataReady(uint8_t data)
#line 264
{
bool again;
/* atomic removed: atomic calls only */
#line 267
{
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 *rx;
uint8_t *tx;
uint16_t myLen;
uint8_t discard;
/* atomic removed: atomic calls only */
#line 289
{
rx = Atm128SpiP$rxBuffer;
tx = Atm128SpiP$txBuffer;
myLen = Atm128SpiP$len;
Atm128SpiP$rxBuffer = (void *)0;
Atm128SpiP$txBuffer = (void *)0;
Atm128SpiP$len = 0;
Atm128SpiP$pos = 0;
}
discard = Atm128SpiP$Spi$read();
Atm128SpiP$SpiPacket$sendDone(tx, rx, myLen, SUCCESS);
}
}
# 92 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128Spi.nc"
inline static void HplAtm128SpiP$SPI$dataReady(uint8_t arg_0x7dfb2858){
#line 92
Atm128SpiP$Spi$dataReady(arg_0x7dfb2858);
#line 92
}
#line 92
# 52 "/opt/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 "/opt/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 131
FALSE;
#line 131
return __nesc_temp;
}
}
}
#line 134
SchedulerBasicP$TaskBasic$runTask(nextTask);
return TRUE;
}
#line 164
static void SchedulerBasicP$TaskBasic$default$runTask(uint8_t id)
{
}
# 64 "/opt/tinyos-2.x/tos/interfaces/TaskBasic.nc"
static void SchedulerBasicP$TaskBasic$runTask(uint8_t arg_0x7f080b18){
#line 64
switch (arg_0x7f080b18) {
#line 64
case OctopusC$collectSendTask:
#line 64
OctopusC$collectSendTask$runTask();
#line 64
break;
#line 64
case OctopusC$serialSendTask:
#line 64
OctopusC$serialSendTask$runTask();
#line 64
break;
#line 64
case /*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired:
#line 64
/*HilTimerMilliC.AlarmToTimerC*/AlarmToTimerC$0$fired$runTask();
#line 64
break;
#line 64
case /*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer:
#line 64
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$runTask();
#line 64
break;
#line 64
case /*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask:
#line 64
/*OctopusAppC.Sensor.DemoChannel*/SineSensorC$0$readTask$runTask();
#line 64
break;
#line 64
case SerialP$RunTx:
#line 64
SerialP$RunTx$runTask();
#line 64
break;
#line 64
case SerialP$startDoneTask:
#line 64
SerialP$startDoneTask$runTask();
#line 64
break;
#line 64
case SerialP$stopDoneTask:
#line 64
SerialP$stopDoneTask$runTask();
#line 64
break;
#line 64
case SerialP$defaultSerialFlushTask:
#line 64
SerialP$defaultSerialFlushTask$runTask();
#line 64
break;
#line 64
case /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone:
#line 64
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$signalSendDone$runTask();
#line 64
break;
#line 64
case /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask:
#line 64
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$runTask();
#line 64
break;
#line 64
case /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask:
#line 64
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$CancelTask$runTask();
#line 64
break;
#line 64
case /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask:
#line 64
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$errorTask$runTask();
#line 64
break;
#line 64
case CC2420CsmaP$startDone_task:
#line 64
CC2420CsmaP$startDone_task$runTask();
#line 64
break;
#line 64
case CC2420CsmaP$stopDone_task:
#line 64
CC2420CsmaP$stopDone_task$runTask();
#line 64
break;
#line 64
case CC2420CsmaP$sendDone_task:
#line 64
CC2420CsmaP$sendDone_task$runTask();
#line 64
break;
#line 64
case CC2420ControlP$syncDone_task:
#line 64
CC2420ControlP$syncDone_task$runTask();
#line 64
break;
#line 64
case HplCC2420InterruptsP$CCATask:
#line 64
HplCC2420InterruptsP$CCATask$runTask();
#line 64
break;
#line 64
case HplCC2420InterruptsP$stopTask:
#line 64
HplCC2420InterruptsP$stopTask$runTask();
#line 64
break;
#line 64
case Atm128SpiP$zeroTask:
#line 64
Atm128SpiP$zeroTask$runTask();
#line 64
break;
#line 64
case /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask:
#line 64
/*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$grantedTask$runTask();
#line 64
break;
#line 64
case CC2420TransmitP$startLplTimer:
#line 64
CC2420TransmitP$startLplTimer$runTask();
#line 64
break;
#line 64
case CC2420ReceiveP$receiveDone_task:
#line 64
CC2420ReceiveP$receiveDone_task$runTask();
#line 64
break;
#line 64
case /*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask:
#line 64
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendTask$runTask();
#line 64
break;
#line 64
case /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$CancelTask:
#line 64
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$CancelTask$runTask();
#line 64
break;
#line 64
case /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask:
#line 64
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$runTask();
#line 64
break;
#line 64
case /*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask:
#line 64
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$runTask();
#line 64
break;
#line 64
case /*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask:
#line 64
/*CtpP.Router*/CtpRoutingEngineP$0$sendBeaconTask$runTask();
#line 64
break;
#line 64
case /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask:
#line 64
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$timerTask$runTask();
#line 64
break;
#line 64
default:
#line 64
SchedulerBasicP$TaskBasic$default$runTask(arg_0x7f080b18);
#line 64
break;
#line 64
}
#line 64
}
#line 64
# 129 "/opt/tinyos-2.x/tos/lib/net/DisseminationEngineImplP.nc"
static void DisseminationEngineImplP$sendObject(uint16_t key)
#line 129
{
void *object;
uint8_t objectSize = 0;
dissemination_message_t *dMsg =
(dissemination_message_t *)DisseminationEngineImplP$AMSend$getPayload(&DisseminationEngineImplP$m_buf);
DisseminationEngineImplP$m_bufBusy = TRUE;
__nesc_hton_uint16((unsigned char *)&dMsg->key, key);
__nesc_hton_uint32((unsigned char *)&dMsg->seqno, DisseminationEngineImplP$DisseminationCache$requestSeqno(key));
if (__nesc_ntoh_uint32((unsigned char *)&dMsg->seqno) != DISSEMINATION_SEQNO_UNKNOWN) {
object = DisseminationEngineImplP$DisseminationCache$requestData(key, &objectSize);
if (objectSize + sizeof(dissemination_message_t ) >
DisseminationEngineImplP$AMSend$maxPayloadLength()) {
objectSize = DisseminationEngineImplP$AMSend$maxPayloadLength() - sizeof(dissemination_message_t );
}
memcpy(dMsg->data, object, objectSize);
}
DisseminationEngineImplP$AMSend$send(AM_BROADCAST_ADDR,
&DisseminationEngineImplP$m_buf, sizeof(dissemination_message_t ) + objectSize);
}
# 180 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static void *CC2420ActiveMessageP$Packet$getPayload(message_t *msg, uint8_t *len)
#line 180
{
if (len != (void *)0) {
*len = CC2420ActiveMessageP$Packet$payloadLength(msg);
}
return msg->data;
}
#line 127
static void CC2420ActiveMessageP$AMPacket$setDestination(message_t *amsg, am_addr_t addr)
#line 127
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(amsg);
#line 129
__nesc_hton_leuint16((unsigned char *)&header->dest, addr);
}
#line 147
static void CC2420ActiveMessageP$AMPacket$setType(message_t *amsg, am_id_t type)
#line 147
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(amsg);
#line 149
__nesc_hton_leuint8((unsigned char *)&header->type, type);
}
# 82 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static error_t /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$send(uint8_t clientId, message_t *msg,
uint8_t len)
#line 83
{
if (clientId >= 4) {
return FAIL;
}
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[clientId].msg != (void *)0) {
return EBUSY;
}
;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[clientId].msg = msg;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$setPayloadLength(msg, len);
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current >= 4) {
error_t err;
am_id_t amId = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$type(msg);
am_addr_t dest = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$destination(msg);
;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = clientId;
err = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$send(amId, dest, msg, len);
if (err != SUCCESS) {
;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current = 4;
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[clientId].msg = (void *)0;
}
return err;
}
else {
;
}
return SUCCESS;
}
# 172 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static void CC2420ActiveMessageP$Packet$setPayloadLength(message_t *msg, uint8_t len)
#line 172
{
__nesc_hton_leuint8((unsigned char *)&CC2420ActiveMessageP$CC2420Packet$getHeader(msg)->length, len + CC2420ActiveMessageP$CC2420_SIZE);
}
#line 142
static am_id_t CC2420ActiveMessageP$AMPacket$type(message_t *amsg)
#line 142
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(amsg);
#line 144
return __nesc_ntoh_leuint8((unsigned char *)&header->type);
}
#line 117
static am_addr_t CC2420ActiveMessageP$AMPacket$destination(message_t *amsg)
#line 117
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(amsg);
#line 119
return __nesc_ntoh_leuint16((unsigned char *)&header->dest);
}
#line 59
static error_t CC2420ActiveMessageP$AMSend$send(am_id_t id, am_addr_t addr,
message_t *msg,
uint8_t len)
#line 61
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(msg);
#line 63
__nesc_hton_leuint8((unsigned char *)&header->type, id);
__nesc_hton_leuint16((unsigned char *)&header->dest, addr);
__nesc_hton_leuint16((unsigned char *)&header->destpan, TOS_AM_GROUP);
return CC2420ActiveMessageP$SubSend$send(msg, len + CC2420ActiveMessageP$CC2420_SIZE);
}
# 698 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static error_t CC2420TransmitP$acquireSpiResource(void)
#line 698
{
error_t error = CC2420TransmitP$SpiResource$immediateRequest();
#line 700
if (error != SUCCESS) {
CC2420TransmitP$SpiResource$request();
}
return error;
}
# 80 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static error_t CC2420SpiImplP$Resource$immediateRequest(uint8_t id)
#line 80
{
error_t error;
#line 82
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 82
{
if (CC2420SpiImplP$m_resource_busy)
{
unsigned char __nesc_temp =
#line 84
EBUSY;
{
#line 84
__nesc_atomic_end(__nesc_atomic);
#line 84
return __nesc_temp;
}
}
#line 85
error = CC2420SpiImplP$SpiResource$immediateRequest();
if (error == SUCCESS) {
CC2420SpiImplP$m_holder = id;
CC2420SpiImplP$m_resource_busy = TRUE;
}
}
#line 90
__nesc_atomic_end(__nesc_atomic); }
return error;
}
# 106 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static void Atm128SpiP$startSpi(void)
#line 106
{
Atm128SpiP$Spi$enableSpi(FALSE);
/* atomic removed: atomic calls only */
#line 108
{
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);
}
Atm128SpiP$McuPowerState$update();
}
# 131 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
static void HplAtm128SpiP$SPI$enableSpi(bool enabled)
#line 131
{
if (enabled) {
* (volatile uint8_t *)(0x0D + 0x20) |= 1 << 6;
HplAtm128SpiP$Mcu$update();
}
else {
* (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 6);
HplAtm128SpiP$Mcu$update();
}
}
#line 116
static void HplAtm128SpiP$SPI$enableInterrupt(bool enabled)
#line 116
{
if (enabled) {
* (volatile uint8_t *)(0x0D + 0x20) |= 1 << 7;
HplAtm128SpiP$Mcu$update();
}
else {
* (volatile uint8_t *)(0x0D + 0x20) &= ~(1 << 7);
HplAtm128SpiP$Mcu$update();
}
}
# 67 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static error_t CC2420SpiImplP$Resource$request(uint8_t id)
#line 67
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 68
{
if (CC2420SpiImplP$m_resource_busy) {
CC2420SpiImplP$m_requests |= 1 << id;
}
else
#line 71
{
CC2420SpiImplP$m_holder = id;
CC2420SpiImplP$m_resource_busy = TRUE;
CC2420SpiImplP$SpiResource$request();
}
}
#line 76
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 312 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static error_t Atm128SpiP$Resource$request(uint8_t id)
#line 312
{
/* atomic removed: atomic calls only */
#line 313
{
if (!Atm128SpiP$ArbiterInfo$inUse()) {
Atm128SpiP$startSpi();
}
}
return Atm128SpiP$ResourceArbiter$request(id);
}
# 123 "/opt/tinyos-2.x/tos/system/SimpleArbiterP.nc"
static bool /*Atm128SpiC.Arbiter.Arbiter*/SimpleArbiterP$0$ArbiterInfo$inUse(void)
#line 123
{
/* atomic removed: atomic calls only */
#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;
}
# 159 "/opt/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 161
SchedulerBasicP$pushTask(id) ? SUCCESS : EBUSY;
{
#line 161
__nesc_atomic_end(__nesc_atomic);
#line 161
return __nesc_temp;
}
}
}
#line 164
__nesc_atomic_end(__nesc_atomic); }
}
# 728 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static void CC2420TransmitP$loadTXFIFO(void)
#line 728
{
cc2420_header_t *header = CC2420TransmitP$CC2420Packet$getHeader(CC2420TransmitP$m_msg);
uint8_t tx_power = __nesc_ntoh_uint8((unsigned char *)&CC2420TransmitP$CC2420Packet$getMetadata(CC2420TransmitP$m_msg)->tx_power);
if (!tx_power) {
tx_power = 31;
}
CC2420TransmitP$CSN$clr();
if (CC2420TransmitP$m_tx_power != tx_power) {
CC2420TransmitP$TXCTRL$write((((2 << CC2420_TXCTRL_TXMIXBUF_CUR) | (
3 << CC2420_TXCTRL_PA_CURRENT)) | (
1 << CC2420_TXCTRL_RESERVED)) | ((
tx_power & 0x1F) << CC2420_TXCTRL_PA_LEVEL));
}
CC2420TransmitP$m_tx_power = tx_power;
CC2420TransmitP$TXFIFO$write((uint8_t *)header, __nesc_ntoh_leuint8((unsigned char *)&header->length) - 1);
}
# 251 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static cc2420_status_t CC2420SpiImplP$Reg$write(uint8_t addr, uint16_t data)
#line 251
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 252
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 254
0;
{
#line 254
__nesc_atomic_end(__nesc_atomic);
#line 254
return __nesc_temp;
}
}
}
}
#line 258
__nesc_atomic_end(__nesc_atomic); }
#line 258
CC2420SpiImplP$SpiByte$write(addr);
CC2420SpiImplP$SpiByte$write(data >> 8);
return CC2420SpiImplP$SpiByte$write(data & 0xff);
}
# 129 "/opt/tinyos-2.x/tos/chips/atm128/spi/Atm128SpiP.nc"
static uint8_t Atm128SpiP$SpiByte$write(uint8_t tx)
#line 129
{
Atm128SpiP$Spi$enableSpi(TRUE);
Atm128SpiP$McuPowerState$update();
Atm128SpiP$Spi$write(tx);
while (!(* (volatile uint8_t *)(0x0E + 0x20) & 0x80)) ;
return Atm128SpiP$Spi$read();
}
#line 240
static error_t Atm128SpiP$SpiPacket$send(uint8_t *writeBuf,
uint8_t *readBuf,
uint16_t bufLen)
#line 242
{
uint8_t discard;
#line 244
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 244
{
Atm128SpiP$txBuffer = writeBuf;
Atm128SpiP$rxBuffer = readBuf;
Atm128SpiP$len = bufLen;
Atm128SpiP$pos = 0;
}
#line 249
__nesc_atomic_end(__nesc_atomic); }
if (bufLen > 0) {
discard = Atm128SpiP$Spi$read();
return Atm128SpiP$sendNextPart();
}
else {
Atm128SpiP$zeroTask$postTask();
return SUCCESS;
}
}
#line 164
static error_t Atm128SpiP$sendNextPart(void)
#line 164
{
uint16_t end;
uint16_t tmpPos;
uint8_t *tx;
uint8_t *rx;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 170
{
tx = Atm128SpiP$txBuffer;
rx = Atm128SpiP$rxBuffer;
tmpPos = Atm128SpiP$pos;
end = Atm128SpiP$pos + Atm128SpiP$SPI_ATOMIC_SIZE;
end = end > Atm128SpiP$len ? Atm128SpiP$len : end;
}
#line 176
__nesc_atomic_end(__nesc_atomic); }
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);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 193
{
if (tx != (void *)0) {
Atm128SpiP$Spi$write(tx[tmpPos]);
}
else {
#line 197
Atm128SpiP$Spi$write(0);
}
Atm128SpiP$pos = tmpPos;
}
#line 200
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 432 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static uint8_t LinkEstimatorP$LinkEstimator$getLinkQuality(am_addr_t neighbor)
#line 432
{
uint8_t idx;
#line 434
idx = LinkEstimatorP$findIdx(neighbor);
if (idx == LinkEstimatorP$INVALID_RVAL) {
return LinkEstimatorP$INFINITY;
}
else
#line 437
{
return LinkEstimatorP$NeighborTable[idx].eetx;
}
#line 439
;
}
#line 166
static uint8_t LinkEstimatorP$findIdx(am_addr_t ll_addr)
#line 166
{
uint8_t i;
#line 168
for (i = 0; i < 10; i++) {
if (LinkEstimatorP$NeighborTable[i].flags & VALID_ENTRY) {
if (LinkEstimatorP$NeighborTable[i].ll_addr == ll_addr) {
return i;
}
}
}
return LinkEstimatorP$INVALID_RVAL;
}
# 168 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$chooseAdvertiseTime(void)
#line 168
{
/*CtpP.Router*/CtpRoutingEngineP$0$t = /*CtpP.Router*/CtpRoutingEngineP$0$currentInterval;
/*CtpP.Router*/CtpRoutingEngineP$0$t *= 512;
/*CtpP.Router*/CtpRoutingEngineP$0$t += /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand32() % /*CtpP.Router*/CtpRoutingEngineP$0$t;
/*CtpP.Router*/CtpRoutingEngineP$0$tHasPassed = FALSE;
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$stop();
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(/*CtpP.Router*/CtpRoutingEngineP$0$t);
}
# 58 "/opt/tinyos-2.x/tos/system/RandomMlcgP.nc"
static uint32_t RandomMlcgP$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 )RandomMlcgP$seed;
q = tmpseed;
q = q >> 1;
p = tmpseed >> 32;
mlcg = p + q;
if (mlcg & 0x80000000) {
mlcg = mlcg & 0x7FFFFFFF;
mlcg++;
}
RandomMlcgP$seed = mlcg;
}
#line 73
__nesc_atomic_end(__nesc_atomic); }
return mlcg;
}
# 132 "/opt/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 135
timer->t0 = t0;
timer->dt = dt;
timer->isoneshot = isoneshot;
timer->isrunning = TRUE;
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask();
}
# 151 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static uint32_t /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$get(void)
#line 151
{
uint32_t now;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
uint8_t now8 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get();
if (/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$getInterruptFlag().bits.ocf0) {
now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$get() + 1 + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get();
}
else {
now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base + now8;
}
}
#line 169
__nesc_atomic_end(__nesc_atomic); }
#line 169
return now;
}
# 494 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static error_t LinkEstimatorP$LinkEstimator$pinNeighbor(am_addr_t neighbor)
#line 494
{
uint8_t nidx = LinkEstimatorP$findIdx(neighbor);
#line 496
if (nidx == LinkEstimatorP$INVALID_RVAL) {
return FAIL;
}
LinkEstimatorP$NeighborTable[nidx].flags |= PINNED_ENTRY;
return SUCCESS;
}
# 839 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpCongestion$isCongested(void)
#line 839
{
bool congested = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$size() > /*CtpP.Forwarder*/CtpForwardingEngineP$0$congestionThreshold ?
TRUE : FALSE;
#line 844
return congested || /*CtpP.Forwarder*/CtpForwardingEngineP$0$clientCongested ? TRUE : FALSE;
}
# 726 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static void *LinkEstimatorP$Packet$getPayload(message_t *msg, uint8_t *len)
#line 726
{
uint8_t *payload = LinkEstimatorP$SubPacket$getPayload(msg, len);
linkest_header_t *hdr;
#line 729
hdr = LinkEstimatorP$getHeader(msg);
if (len != (void *)0) {
*len = *len - sizeof(linkest_header_t ) - sizeof(linkest_footer_t ) * (NUM_ENTRIES_FLAG & __nesc_ntoh_uint8((unsigned char *)&hdr->flags));
}
return payload + sizeof(linkest_header_t );
}
#line 396
static void LinkEstimatorP$print_packet(message_t *msg, uint8_t len)
#line 396
{
uint8_t i;
uint8_t *b;
b = (uint8_t *)msg->data;
for (i = 0; i < len; i++)
;
;
}
# 207 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$default$sendDone(uint8_t id, message_t *msg, error_t err)
#line 207
{
}
# 89 "/opt/tinyos-2.x/tos/interfaces/Send.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$sendDone(uint8_t arg_0x7e48a1e0, message_t *arg_0x7eb54010, error_t arg_0x7eb54198){
#line 89
switch (arg_0x7e48a1e0) {
#line 89
case 0U:
#line 89
/*CtpP.AMSenderC.AMQueueEntryP*/AMQueueEntryP$1$Send$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
case 1U:
#line 89
/*CtpP.SendControl.AMQueueEntryP*/AMQueueEntryP$2$Send$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
case 2U:
#line 89
/*DisseminationEngineP.DisseminationSendC.AMQueueEntryP*/AMQueueEntryP$3$Send$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
case 3U:
#line 89
/*DisseminationEngineP.DisseminationProbeSendC.AMQueueEntryP*/AMQueueEntryP$4$Send$sendDone(arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
default:
#line 89
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Send$default$sendDone(arg_0x7e48a1e0, arg_0x7eb54010, arg_0x7eb54198);
#line 89
break;
#line 89
}
#line 89
}
#line 89
# 541 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubSend$sendDone(message_t *msg, error_t error)
#line 541
{
fe_queue_entry_t *qe = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$head();
#line 543
;
if (qe == (void *)0 || qe->msg != msg) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendDoneBug();
return;
}
else {
#line 549
if (error != SUCCESS) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_SENDDONE_FAIL,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(SENDDONE_FAIL_WINDOW, SENDDONE_FAIL_OFFSET);
}
else {
#line 558
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$ackPending && !/*CtpP.Forwarder*/CtpForwardingEngineP$0$PacketAcknowledgements$wasAcked(msg)) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txNoAck(/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpInfo$recomputeRoutes();
if (-- qe->retries) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_SENDDONE_WAITACK,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(SENDDONE_NOACK_WINDOW, SENDDONE_NOACK_OFFSET);
}
else
#line 569
{
if (qe->client < /*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[qe->client] = qe;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$sendDone(qe->client, msg, FAIL);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_SENDDONE_FAIL_ACK_SEND,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
}
else
#line 578
{
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$put(qe->msg) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_MSGPOOL_ERR);
}
#line 581
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$put(qe) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_QEPOOL_ERR);
}
#line 583
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_SENDDONE_FAIL_ACK_FWD,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
}
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = FALSE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(SENDDONE_OK_WINDOW, SENDDONE_OK_OFFSET);
}
}
else {
#line 593
if (qe->client < /*CtpP.Forwarder*/CtpForwardingEngineP$0$CLIENT_COUNT) {
ctp_data_header_t *hdr;
uint8_t client = qe->client;
#line 596
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_SENT_MSG,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txAck(/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$clientPtrs[client] = qe;
hdr = /*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(qe->msg);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue();
/*CtpP.Forwarder*/CtpForwardingEngineP$0$Send$sendDone(client, msg, SUCCESS);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = FALSE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(SENDDONE_OK_WINDOW, SENDDONE_OK_OFFSET);
}
else {
#line 610
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$size() < /*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$maxSize()) {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEventMsg(NET_C_FE_FWD_MSG,
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getSequenceNumber(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(msg),
/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$LinkEstimator$txAck(/*CtpP.Forwarder*/CtpForwardingEngineP$0$AMPacket$destination(msg));
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SentCache$insert(qe->msg);
/*CtpP.Forwarder*/CtpForwardingEngineP$0$SendQueue$dequeue();
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$MessagePool$put(qe->msg) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_MSGPOOL_ERR);
}
#line 622
if (/*CtpP.Forwarder*/CtpForwardingEngineP$0$QEntryPool$put(qe) != SUCCESS) {
/*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionDebug$logEvent(NET_C_FE_PUT_QEPOOL_ERR);
}
#line 624
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sending = FALSE;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(SENDDONE_OK_WINDOW, SENDDONE_OK_OFFSET);
}
else {
;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$sendDoneBug();
}
}
}
}
}
}
#line 881
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CollectionPacket$getOrigin(message_t *msg)
#line 881
{
#line 881
return __nesc_ntoh_uint16((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->origin);
}
#line 958
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$startRetxmitTimer(uint16_t mask, uint16_t offset)
#line 958
{
uint16_t r = /*CtpP.Forwarder*/CtpForwardingEngineP$0$Random$rand16();
#line 960
r &= mask;
r += offset;
/*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$startOneShot(r);
;
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/Timer.nc"
static void /*CtpP.Forwarder*/CtpForwardingEngineP$0$RetxmitTimer$startOneShot(uint32_t arg_0x7eb11338){
#line 62
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$Timer$startOneShot(5U, arg_0x7eb11338);
#line 62
}
#line 62
# 244 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static void LinkEstimatorP$updateDEETX(neighbor_table_entry_t *ne)
#line 244
{
uint16_t estETX;
if (ne->data_success == 0) {
estETX = (ne->data_total - 1) * 10;
}
else
#line 252
{
estETX = 10 * ne->data_total / ne->data_success - 10;
ne->data_success = 0;
ne->data_total = 0;
}
LinkEstimatorP$updateEETX(ne, estETX);
}
#line 238
static void LinkEstimatorP$updateEETX(neighbor_table_entry_t *ne, uint16_t newEst)
#line 238
{
ne->eetx = (LinkEstimatorP$ALPHA * ne->eetx + (10 - LinkEstimatorP$ALPHA) * newEst) / 10;
}
# 271 "OctopusC.nc"
static void OctopusC$CollectSend$sendDone(message_t *msg, error_t error)
#line 271
{
if (error != SUCCESS) {
OctopusC$reportProblem();
}
#line 274
OctopusC$sendBusy = FALSE;
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, NO_REPLY);
OctopusC$reportSent();
}
# 48 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128GeneralIOPinP.nc"
static 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 *)59U ^= 1 << 2;
#line 48
__nesc_atomic_end(__nesc_atomic); }
}
#line 48
static void /*HplAtm128GeneralIOC.PortA.Bit1*/HplAtm128GeneralIOPinP$1$IO$toggle(void)
#line 48
{
#line 48
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 48
* (volatile uint8_t *)59U ^= 1 << 1;
#line 48
__nesc_atomic_end(__nesc_atomic); }
}
# 100 "/opt/tinyos-2.x/tos/system/PoolP.nc"
static error_t /*CtpP.MessagePoolP.PoolP*/PoolP$0$Pool$put(/*CtpP.MessagePoolP.PoolP*/PoolP$0$pool_t *newVal)
#line 100
{
if (/*CtpP.MessagePoolP.PoolP*/PoolP$0$free >= 12) {
return FAIL;
}
else {
uint8_t emptyIndex = /*CtpP.MessagePoolP.PoolP*/PoolP$0$index + /*CtpP.MessagePoolP.PoolP*/PoolP$0$free;
#line 106
if (emptyIndex >= 12) {
emptyIndex -= 12;
}
/*CtpP.MessagePoolP.PoolP*/PoolP$0$queue[emptyIndex] = newVal;
/*CtpP.MessagePoolP.PoolP*/PoolP$0$free++;
return SUCCESS;
}
}
#line 100
static error_t /*CtpP.QEntryPoolP.PoolP*/PoolP$1$Pool$put(/*CtpP.QEntryPoolP.PoolP*/PoolP$1$pool_t *newVal)
#line 100
{
if (/*CtpP.QEntryPoolP.PoolP*/PoolP$1$free >= 12) {
return FAIL;
}
else {
uint8_t emptyIndex = /*CtpP.QEntryPoolP.PoolP*/PoolP$1$index + /*CtpP.QEntryPoolP.PoolP*/PoolP$1$free;
#line 106
if (emptyIndex >= 12) {
emptyIndex -= 12;
}
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$queue[emptyIndex] = newVal;
/*CtpP.QEntryPoolP.PoolP*/PoolP$1$free++;
return SUCCESS;
}
}
# 85 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static /*CtpP.SendQueueP*/QueueC$0$queue_t /*CtpP.SendQueueP*/QueueC$0$Queue$dequeue(void)
#line 85
{
/*CtpP.SendQueueP*/QueueC$0$queue_t t = /*CtpP.SendQueueP*/QueueC$0$Queue$head();
#line 87
;
if (!/*CtpP.SendQueueP*/QueueC$0$Queue$empty()) {
/*CtpP.SendQueueP*/QueueC$0$head++;
/*CtpP.SendQueueP*/QueueC$0$head %= 13;
/*CtpP.SendQueueP*/QueueC$0$size--;
/*CtpP.SendQueueP*/QueueC$0$printQueue();
}
return t;
}
# 516 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static error_t LinkEstimatorP$LinkEstimator$txAck(am_addr_t neighbor)
#line 516
{
neighbor_table_entry_t *ne;
uint8_t nidx = LinkEstimatorP$findIdx(neighbor);
#line 519
if (nidx == LinkEstimatorP$INVALID_RVAL) {
return FAIL;
}
ne = &LinkEstimatorP$NeighborTable[nidx];
ne->data_success++;
ne->data_total++;
if (ne->data_total >= LinkEstimatorP$DLQ_PKT_WINDOW) {
LinkEstimatorP$updateDEETX(ne);
}
return SUCCESS;
}
# 84 "/opt/tinyos-2.x/tos/lib/net/ctp/LruCtpMsgCacheP.nc"
static uint8_t /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$lookup(message_t *m)
#line 84
{
uint8_t i;
uint8_t idx;
#line 87
for (i = 0; i < /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$count; i++) {
idx = (i + /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$first) % 4;
if (
#line 89
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getOrigin(m) == /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[idx].origin &&
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getSequenceNumber(m) == /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[idx].seqno &&
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getThl(m) == /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[idx].thl &&
/*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$CtpPacket$getType(m) == /*CtpP.SentCacheP.CacheP*/LruCtpMsgCacheP$0$cache[idx].type) {
break;
}
}
return i;
}
# 892 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static am_addr_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getOrigin(message_t *msg)
#line 892
{
#line 892
return __nesc_ntoh_uint16((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->origin);
}
#line 894
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getSequenceNumber(message_t *msg)
#line 894
{
#line 894
return __nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->originSeqNo);
}
#line 895
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getThl(message_t *msg)
#line 895
{
#line 895
return __nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->thl);
}
#line 891
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$getType(message_t *msg)
#line 891
{
#line 891
return __nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->type);
}
# 166 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static void /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$tryToSend(void)
#line 166
{
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$nextPacket();
if (/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current < 4) {
error_t nextErr;
message_t *nextMsg = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$queue[/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$current].msg;
am_id_t nextId = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$type(nextMsg);
am_addr_t nextDest = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMPacket$destination(nextMsg);
uint8_t len = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$Packet$payloadLength(nextMsg);
#line 174
nextErr = /*AMQueueP.AMQueueImplP*/AMQueueImplP$1$AMSend$send(nextId, nextDest, nextMsg, len);
if (nextErr != SUCCESS) {
/*AMQueueP.AMQueueImplP*/AMQueueImplP$1$errorTask$postTask();
}
}
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$payloadLength(message_t *arg_0x7e7c7ee0){
#line 67
unsigned char result;
#line 67
#line 67
result = CC2420ActiveMessageP$Packet$payloadLength(arg_0x7e7c7ee0);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 660 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static uint8_t /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(am_addr_t neighbor)
#line 660
{
uint8_t i;
#line 662
if (neighbor == INVALID_ADDR) {
return /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive;
}
#line 664
for (i = 0; i < /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive; i++) {
if (/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[i].neighbor == neighbor) {
break;
}
}
#line 668
return i;
}
# 370 "OctopusC.nc"
static message_t *OctopusC$CollectReceive$receive(message_t *msg, void *payload, uint8_t len)
#line 370
{
octopus_collected_msg_t *collectedMsg = payload;
if (len == sizeof(octopus_collected_msg_t ) && !OctopusC$fwdBusy) {
octopus_collected_msg_t *fwdCollectedMsg = OctopusC$SerialSend$getPayload(&OctopusC$fwdMsg);
*fwdCollectedMsg = *collectedMsg;
if (OctopusC$SerialSend$send(AM_BROADCAST_ADDR, &OctopusC$fwdMsg, sizeof (*collectedMsg)) == SUCCESS) {
OctopusC$fwdBusy = TRUE;
}
#line 381
OctopusC$reportReceived();
}
return msg;
}
# 123 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static void */*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$getPayload(message_t *msg, uint8_t *len)
#line 123
{
if (len != (void *)0) {
*len = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$Packet$payloadLength(msg);
}
return msg->data;
}
# 45 "/opt/tinyos-2.x/tos/system/AMQueueEntryP.nc"
static error_t /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMSend$send(am_addr_t dest,
message_t *msg,
uint8_t len)
#line 47
{
/*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setDestination(msg, dest);
/*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$AMPacket$setType(msg, 147);
return /*OctopusAppC.SerialCollectSender.AMQueueEntryP*/AMQueueEntryP$0$Send$send(msg, len);
}
# 158 "/opt/tinyos-2.x/tos/lib/serial/SerialActiveMessageP.nc"
static am_id_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$type(message_t *amsg)
#line 158
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(amsg);
#line 160
return __nesc_ntoh_uint8((unsigned char *)&header->type);
}
#line 134
static am_addr_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMPacket$destination(message_t *amsg)
#line 134
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(amsg);
#line 136
return __nesc_ntoh_uint16((unsigned char *)&header->dest);
}
#line 53
static error_t /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$AMSend$send(am_id_t id, am_addr_t dest,
message_t *msg,
uint8_t len)
#line 55
{
serial_header_t *header = /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$getHeader(msg);
#line 57
__nesc_hton_uint16((unsigned char *)&header->dest, dest);
__nesc_hton_uint8((unsigned char *)&header->type, id);
__nesc_hton_uint8((unsigned char *)&header->length, len);
return /*SerialActiveMessageC.AM*/SerialActiveMessageP$0$SubSend$send(msg, len);
}
# 502 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static void SerialP$MaybeScheduleTx(void)
#line 502
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 503
{
if (SerialP$txPending == 0) {
if (SerialP$RunTx$postTask() == SUCCESS) {
SerialP$txPending = 1;
}
}
}
#line 509
__nesc_atomic_end(__nesc_atomic); }
}
# 873 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static void */*CtpP.Forwarder*/CtpForwardingEngineP$0$Packet$getPayload(message_t *msg, uint8_t *len)
#line 873
{
uint8_t *payload = /*CtpP.Forwarder*/CtpForwardingEngineP$0$SubPacket$getPayload(msg, len);
#line 875
if (len != (void *)0) {
*len -= sizeof(ctp_data_header_t );
}
return payload + sizeof(ctp_data_header_t );
}
# 543 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static error_t /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$getEtx(uint16_t *etx)
#line 543
{
if (etx == (void *)0) {
return FAIL;
}
#line 546
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == INVALID_ADDR) {
return FAIL;
}
#line 548
*etx = /*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.etx;
return SUCCESS;
}
# 99 "/opt/tinyos-2.x/tos/lib/net/DisseminatorP.nc"
static void /*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationCache$storeData(void *data, uint8_t size,
uint32_t newSeqno)
#line 100
{
memcpy(&/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$valueCache, data, size < sizeof(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t ) ? size : sizeof(/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$t ));
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$seqno = newSeqno;
/*OctopusAppC.DisseminatorC.DisseminatorP*/DisseminatorP$0$DisseminationValue$changed();
}
# 138 "OctopusC.nc"
static void OctopusC$processRequest(octopus_sent_msg_t *newRequest)
#line 138
{
unsigned char *__nesc_temp43;
unsigned char *__nesc_temp42;
#line 139
if (__nesc_ntoh_uint16((unsigned char *)&newRequest->targetId) == TOS_NODE_ID || __nesc_ntoh_uint16((unsigned char *)&newRequest->targetId) == 0xFFFF) {
switch (__nesc_ntoh_uint8((unsigned char *)&newRequest->request)) {
case SET_MODE_AUTO_REQUEST:
OctopusC$modeAuto = TRUE;
OctopusC$Timer$stop();
OctopusC$Timer$startPeriodic(OctopusC$samplingPeriod);
break;
case SET_MODE_QUERY_REQUEST:
OctopusC$modeAuto = FALSE;
OctopusC$Timer$stop();
break;
case SET_PERIOD_REQUEST:
OctopusC$samplingPeriod = __nesc_ntoh_uint16((unsigned char *)&newRequest->parameters);
OctopusC$Timer$stop();
if (OctopusC$sleeping == FALSE) {
OctopusC$Timer$startPeriodic(OctopusC$samplingPeriod);
}
#line 155
break;
case SET_THRESHOLD_REQUEST:
OctopusC$threshold = __nesc_ntoh_uint16((unsigned char *)&newRequest->parameters);
break;
case GET_STATUS_REQUEST:
if (OctopusC$modeAuto) {
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, BATTERY_AND_MODE_REPLY | MODE_AUTO);
}
else {
#line 163
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, BATTERY_AND_MODE_REPLY | MODE_QUERY);
}
#line 164
if (OctopusC$sleeping) {
(__nesc_temp42 = (unsigned char *)&OctopusC$localCollectedMsg.reply, __nesc_hton_uint8(__nesc_temp42, __nesc_ntoh_uint8(__nesc_temp42) | SLEEPING));
}
else {
#line 167
(__nesc_temp43 = (unsigned char *)&OctopusC$localCollectedMsg.reply, __nesc_hton_uint8(__nesc_temp43, __nesc_ntoh_uint8(__nesc_temp43) | AWAKE));
}
#line 168
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, OctopusC$battery);
OctopusC$fillPacket();
if (!OctopusC$root) {
#line 170
OctopusC$collectSendTask$postTask();
}
else {
#line 170
OctopusC$serialSendTask$postTask();
}
#line 171
break;
case GET_PERIOD_REQUEST:
if (OctopusC$sleeping == FALSE) {
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, PERIOD_REPLY);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, OctopusC$samplingPeriod);
OctopusC$fillPacket();
if (!OctopusC$root) {
#line 177
OctopusC$collectSendTask$postTask();
}
else {
#line 177
OctopusC$serialSendTask$postTask();
}
}
#line 179
break;
case GET_THRESHOLD_REQUEST:
if (OctopusC$sleeping == FALSE) {
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, THRESHOLD_REPLY);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, OctopusC$threshold);
OctopusC$fillPacket();
if (!OctopusC$root) {
#line 185
OctopusC$collectSendTask$postTask();
}
else {
#line 185
OctopusC$serialSendTask$postTask();
}
}
#line 187
break;
case GET_READING_REQUEST:
OctopusC$Read$read();
break;
case SLEEP_REQUEST:
if (!OctopusC$root) {
OctopusC$sleeping = TRUE;
OctopusC$setLocalDutyCycle();
OctopusC$Timer$stop();
}
break;
case WAKE_UP_REQUEST:
if (!OctopusC$root) {
OctopusC$sleeping = FALSE;
OctopusC$setLocalDutyCycle();
if (OctopusC$modeAuto) {
OctopusC$Timer$startPeriodic(OctopusC$samplingPeriod);
}
}
#line 205
break;
case GET_SLEEP_DUTY_CYCLE_REQUEST:
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, SLEEP_DUTY_CYCLE_REPLY);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, OctopusC$sleepDutyCycle);
OctopusC$fillPacket();
if (!OctopusC$root) {
#line 210
OctopusC$collectSendTask$postTask();
}
else {
#line 210
OctopusC$serialSendTask$postTask();
}
#line 211
break;
case SET_SLEEP_DUTY_CYCLE_REQUEST:
OctopusC$sleepDutyCycle = __nesc_ntoh_uint16((unsigned char *)&newRequest->parameters);
OctopusC$setLocalDutyCycle();
break;
case SET_AWAKE_DUTY_CYCLE_REQUEST:
OctopusC$awakeDutyCycle = __nesc_ntoh_uint16((unsigned char *)&newRequest->parameters);
OctopusC$setLocalDutyCycle();
break;
case GET_AWAKE_DUTY_CYCLE_REQUEST:
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, AWAKE_DUTY_CYCLE_REPLY);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.reading, OctopusC$awakeDutyCycle);
OctopusC$fillPacket();
if (!OctopusC$root) {
#line 224
OctopusC$collectSendTask$postTask();
}
else {
#line 224
OctopusC$serialSendTask$postTask();
}
#line 225
break;
}
}
}
# 142 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
static 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);
}
# 295 "OctopusC.nc"
static void OctopusC$fillPacket(void)
#line 295
{
uint16_t tmp;
OctopusC$CollectInfo$getEtx(&tmp);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.quality, tmp);
OctopusC$CollectInfo$getParent(&tmp);
__nesc_hton_uint16((unsigned char *)&OctopusC$localCollectedMsg.parentId, tmp);
}
#line 394
static void OctopusC$setLocalDutyCycle(void)
#line 394
{
if (OctopusC$sleeping) {
OctopusC$LowPowerListening$setLocalDutyCycle(OctopusC$sleepDutyCycle);
}
else {
#line 398
OctopusC$LowPowerListening$setLocalDutyCycle(OctopusC$awakeDutyCycle);
}
}
# 122 "/opt/tinyos-2.x/tos/lib/net/TrickleTimerImplP.nc"
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$TrickleTimer$reset(uint8_t id)
#line 122
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period = 1;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].count = 0;
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time != 0) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 127
{
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$set(id);
}
#line 129
__nesc_atomic_end(__nesc_atomic); }
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].remainder = 0;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(id);
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer();
}
else
#line 134
{
;
}
}
#line 246
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$generateTime(uint8_t id)
#line 246
{
uint32_t time;
uint16_t rval;
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time != 0) {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period *= 2;
if (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period > 1024) {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period = 1024;
}
}
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].remainder;
time = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period;
time = time << (10 - 1);
rval = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Random$rand16() % (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period << (10 - 1));
time += rval;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].remainder = (/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].period << 10) - time;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[id].time += time;
;
}
#line 203
static void /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$adjustTimer(void)
#line 203
{
uint8_t i;
uint32_t lowest = 0;
bool set = FALSE;
uint32_t elapsed = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$getNow() - /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$gett0();
for (i = 0; i < 1U; i++) {
uint32_t time = /*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$trickles[i].time;
#line 216
if (time != 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 217
{
if (!/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$get(i)) {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Changed$clear(i);
time -= elapsed;
}
}
#line 222
__nesc_atomic_end(__nesc_atomic); }
if (!set) {
lowest = time;
set = TRUE;
}
else {
#line 227
if (time < lowest) {
lowest = time;
}
}
}
}
#line 232
if (set) {
uint32_t timerVal = lowest;
#line 234
timerVal = timerVal;
;
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$startOneShot(timerVal);
}
else {
/*DisseminationTimerP.TrickleTimerMilliC.TrickleTimerImplP*/TrickleTimerImplP$0$Timer$stop();
}
}
# 122 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ActiveMessageP.nc"
static am_addr_t CC2420ActiveMessageP$AMPacket$source(message_t *amsg)
#line 122
{
cc2420_header_t *header = CC2420ActiveMessageP$CC2420Packet$getHeader(amsg);
#line 124
return __nesc_ntoh_leuint16((unsigned char *)&header->src);
}
# 382 "/opt/tinyos-2.x/tos/lib/net/le/LinkEstimatorP.nc"
static void LinkEstimatorP$print_neighbor_table(void)
#line 382
{
uint8_t i;
neighbor_table_entry_t *ne;
#line 385
for (i = 0; i < 10; i++) {
ne = &LinkEstimatorP$NeighborTable[i];
if (ne->flags & VALID_ENTRY) {
;
}
}
}
#line 347
static void LinkEstimatorP$updateNeighborEntryIdx(uint8_t idx, uint8_t seq)
#line 347
{
uint8_t packetGap;
if (LinkEstimatorP$NeighborTable[idx].flags & INIT_ENTRY) {
;
LinkEstimatorP$NeighborTable[idx].lastseq = seq;
LinkEstimatorP$NeighborTable[idx].flags &= ~INIT_ENTRY;
}
packetGap = seq - LinkEstimatorP$NeighborTable[idx].lastseq;
;
LinkEstimatorP$NeighborTable[idx].lastseq = seq;
LinkEstimatorP$NeighborTable[idx].rcvcnt++;
LinkEstimatorP$NeighborTable[idx].inage = LinkEstimatorP$MAX_AGE;
if (packetGap > 0) {
LinkEstimatorP$NeighborTable[idx].failcnt += packetGap - 1;
}
if (packetGap > LinkEstimatorP$MAX_PKT_GAP) {
LinkEstimatorP$NeighborTable[idx].failcnt = 0;
LinkEstimatorP$NeighborTable[idx].rcvcnt = 1;
LinkEstimatorP$NeighborTable[idx].outage = 0;
LinkEstimatorP$NeighborTable[idx].outquality = 0;
LinkEstimatorP$NeighborTable[idx].inquality = 0;
}
if (LinkEstimatorP$NeighborTable[idx].rcvcnt >= LinkEstimatorP$BLQ_PKT_WINDOW) {
LinkEstimatorP$updateNeighborTableEst(LinkEstimatorP$NeighborTable[idx].ll_addr);
}
}
#line 179
static uint8_t LinkEstimatorP$findEmptyNeighborIdx(void)
#line 179
{
uint8_t i;
#line 181
for (i = 0; i < 10; i++) {
if (LinkEstimatorP$NeighborTable[i].flags & VALID_ENTRY) {
}
else
#line 183
{
return i;
}
}
return LinkEstimatorP$INVALID_RVAL;
}
#line 150
static void LinkEstimatorP$initNeighborIdx(uint8_t i, am_addr_t ll_addr)
#line 150
{
neighbor_table_entry_t *ne;
#line 152
ne = &LinkEstimatorP$NeighborTable[i];
ne->ll_addr = ll_addr;
ne->lastseq = 0;
ne->rcvcnt = 0;
ne->failcnt = 0;
ne->flags = INIT_ENTRY | VALID_ENTRY;
ne->inage = LinkEstimatorP$MAX_AGE;
ne->outage = LinkEstimatorP$MAX_AGE;
ne->inquality = 0;
ne->outquality = 0;
ne->eetx = 0;
}
#line 192
static uint8_t LinkEstimatorP$findWorstNeighborIdx(uint8_t thresholdEETX)
#line 192
{
uint8_t i;
#line 193
uint8_t worstNeighborIdx;
uint16_t worstEETX;
#line 194
uint16_t thisEETX;
worstNeighborIdx = LinkEstimatorP$INVALID_RVAL;
worstEETX = 0;
for (i = 0; i < 10; i++) {
if (!(LinkEstimatorP$NeighborTable[i].flags & VALID_ENTRY)) {
;
continue;
}
if (!(LinkEstimatorP$NeighborTable[i].flags & MATURE_ENTRY)) {
;
continue;
}
if (LinkEstimatorP$NeighborTable[i].flags & PINNED_ENTRY) {
;
continue;
}
thisEETX = LinkEstimatorP$NeighborTable[i].eetx;
if (thisEETX >= worstEETX) {
worstNeighborIdx = i;
worstEETX = thisEETX;
}
}
if (worstEETX >= thresholdEETX) {
return worstNeighborIdx;
}
else
#line 219
{
return LinkEstimatorP$INVALID_RVAL;
}
}
# 514 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$LinkEstimator$evicted(am_addr_t neighbor)
#line 514
{
/*CtpP.Router*/CtpRoutingEngineP$0$routingTableEvict(neighbor);
;
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == neighbor) {
routeInfoInit(&/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo);
/*CtpP.Router*/CtpRoutingEngineP$0$justEvicted = TRUE;
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
}
}
# 67 "/opt/tinyos-2.x/tos/interfaces/Packet.nc"
static uint8_t LinkEstimatorP$SubPacket$payloadLength(message_t *arg_0x7e7c7ee0){
#line 67
unsigned char result;
#line 67
#line 67
result = CC2420ActiveMessageP$Packet$payloadLength(arg_0x7e7c7ee0);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 748 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static bool /*CtpP.Router*/CtpRoutingEngineP$0$CtpRoutingPacket$getOption(message_t *msg, ctp_options_t opt)
#line 748
{
return (__nesc_ntoh_uint8((unsigned char *)&/*CtpP.Router*/CtpRoutingEngineP$0$getHeader(msg)->options) & opt) == opt ? TRUE : FALSE;
}
#line 577
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$setNeighborCongested(am_addr_t n, bool congested)
#line 577
{
uint8_t idx;
#line 579
if (/*CtpP.Router*/CtpRoutingEngineP$0$ECNOff) {
return;
}
#line 581
idx = /*CtpP.Router*/CtpRoutingEngineP$0$routingTableFind(n);
if (idx < /*CtpP.Router*/CtpRoutingEngineP$0$routingTableActive) {
/*CtpP.Router*/CtpRoutingEngineP$0$routingTable[idx].info.congested = congested;
}
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.congested && !congested) {
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
}
else {
#line 587
if (/*CtpP.Router*/CtpRoutingEngineP$0$routeInfo.parent == n && congested) {
/*CtpP.Router*/CtpRoutingEngineP$0$updateRouteTask$postTask();
}
}
}
# 97 "/opt/tinyos-2.x/tos/system/QueueC.nc"
static error_t /*CtpP.SendQueueP*/QueueC$0$Queue$enqueue(/*CtpP.SendQueueP*/QueueC$0$queue_t newVal)
#line 97
{
if (/*CtpP.SendQueueP*/QueueC$0$Queue$size() < /*CtpP.SendQueueP*/QueueC$0$Queue$maxSize()) {
;
/*CtpP.SendQueueP*/QueueC$0$queue[/*CtpP.SendQueueP*/QueueC$0$tail] = newVal;
/*CtpP.SendQueueP*/QueueC$0$tail++;
/*CtpP.SendQueueP*/QueueC$0$tail %= 13;
/*CtpP.SendQueueP*/QueueC$0$size++;
/*CtpP.SendQueueP*/QueueC$0$printQueue();
return SUCCESS;
}
else {
return FAIL;
}
}
# 568 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc"
static void /*CtpP.Router*/CtpRoutingEngineP$0$CtpInfo$triggerImmediateRouteUpdate(void)
#line 568
{
uint16_t beaconDelay = /*CtpP.Router*/CtpRoutingEngineP$0$Random$rand16();
#line 571
beaconDelay &= 0x7;
beaconDelay += 4;
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$stop();
/*CtpP.Router*/CtpRoutingEngineP$0$BeaconTimer$startOneShot(beaconDelay);
}
# 901 "/opt/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc"
static bool /*CtpP.Forwarder*/CtpForwardingEngineP$0$CtpPacket$option(message_t *msg, ctp_options_t opt)
#line 901
{
return (__nesc_ntoh_uint8((unsigned char *)&/*CtpP.Forwarder*/CtpForwardingEngineP$0$getHeader(msg)->options) & opt) == opt ? TRUE : FALSE;
}
# 349 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static void CC2420ReceiveP$waitForNextPacket(void)
#line 349
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 350
{
if (CC2420ReceiveP$m_state == CC2420ReceiveP$S_STOPPED) {
{
#line 352
__nesc_atomic_end(__nesc_atomic);
#line 352
return;
}
}
if ((CC2420ReceiveP$m_missed_packets && CC2420ReceiveP$FIFO$get()) || !CC2420ReceiveP$FIFOP$get()) {
if (CC2420ReceiveP$m_missed_packets) {
CC2420ReceiveP$m_missed_packets--;
}
CC2420ReceiveP$beginReceive();
}
else {
CC2420ReceiveP$m_state = CC2420ReceiveP$S_STARTED;
CC2420ReceiveP$m_missed_packets = 0;
}
}
#line 368
__nesc_atomic_end(__nesc_atomic); }
}
#line 309
static void CC2420ReceiveP$beginReceive(void)
#line 309
{
CC2420ReceiveP$m_state = CC2420ReceiveP$S_RX_HEADER;
if (CC2420ReceiveP$SpiResource$immediateRequest() == SUCCESS) {
CC2420ReceiveP$receive();
}
else
#line 314
{
CC2420ReceiveP$SpiResource$request();
}
}
#line 339
static void CC2420ReceiveP$receive(void)
#line 339
{
CC2420ReceiveP$CSN$clr();
CC2420ReceiveP$RXFIFO$beginRead((uint8_t *)CC2420ReceiveP$CC2420Packet$getHeader(CC2420ReceiveP$m_p_rx_buf), 1);
}
# 592 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static void CC2420TransmitP$attemptSend(void)
#line 592
{
uint8_t status;
bool congestion = TRUE;
CC2420TransmitP$continuousModulation = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 605
{
if (CC2420TransmitP$m_state == CC2420TransmitP$S_TX_CANCEL) {
CC2420TransmitP$SFLUSHTX$strobe();
CC2420TransmitP$releaseSpiResource();
CC2420TransmitP$CSN$set();
if (CC2420TransmitP$signalSendDone) {
CC2420TransmitP$signalDone(ECANCEL);
}
else
#line 612
{
CC2420TransmitP$m_state = CC2420TransmitP$S_STARTED;
}
{
#line 615
__nesc_atomic_end(__nesc_atomic);
#line 615
return;
}
}
CC2420TransmitP$CSN$clr();
if (CC2420TransmitP$continuousModulation) {
#line 635
if (CC2420TransmitP$totalCcaChecks < 20) {
if (CC2420TransmitP$CCA$get()) {
CC2420TransmitP$totalCcaChecks++;
}
else
#line 639
{
CC2420TransmitP$totalCcaChecks = 0;
}
CC2420TransmitP$CSN$set();
CC2420TransmitP$releaseSpiResource();
CC2420TransmitP$RadioBackoff$requestInitialBackoff(CC2420TransmitP$m_msg);
CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$myInitialBackoff);
{
#line 648
__nesc_atomic_end(__nesc_atomic);
#line 648
return;
}
}
CC2420TransmitP$MDMCTRL1$write(2 << CC2420_MDMCTRL1_TX_MODE);
}
else
#line 652
{
CC2420TransmitP$MDMCTRL1$write(0 << CC2420_MDMCTRL1_TX_MODE);
}
status = CC2420TransmitP$m_cca ? CC2420TransmitP$STXONCCA$strobe() : CC2420TransmitP$STXON$strobe();
if (!(status & CC2420_STATUS_TX_ACTIVE)) {
status = CC2420TransmitP$SNOP$strobe();
if (status & CC2420_STATUS_TX_ACTIVE) {
congestion = FALSE;
if (CC2420TransmitP$continuousModulation) {
CC2420TransmitP$startLplTimer$postTask();
}
}
}
CC2420TransmitP$m_state = congestion ? CC2420TransmitP$S_SAMPLE_CCA : CC2420TransmitP$S_SFD;
CC2420TransmitP$CSN$set();
}
#line 670
__nesc_atomic_end(__nesc_atomic); }
if (congestion) {
CC2420TransmitP$totalCcaChecks = 0;
CC2420TransmitP$releaseSpiResource();
CC2420TransmitP$congestionBackoff();
}
else
#line 676
{
CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$CC2420_ABORT_PERIOD);
}
}
# 264 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static cc2420_status_t CC2420SpiImplP$Strobe$strobe(uint8_t addr)
#line 264
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 265
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 267
0;
{
#line 267
__nesc_atomic_end(__nesc_atomic);
#line 267
return __nesc_temp;
}
}
}
}
#line 271
__nesc_atomic_end(__nesc_atomic); }
#line 271
return CC2420SpiImplP$SpiByte$write(addr);
}
#line 94
static error_t CC2420SpiImplP$Resource$release(uint8_t id)
#line 94
{
uint8_t i;
#line 96
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 96
{
if (CC2420SpiImplP$m_holder != id) {
{
unsigned char __nesc_temp =
#line 98
FAIL;
{
#line 98
__nesc_atomic_end(__nesc_atomic);
#line 98
return __nesc_temp;
}
}
}
#line 101
CC2420SpiImplP$m_holder = CC2420SpiImplP$NO_HOLDER;
CC2420SpiImplP$SpiResource$release();
if (!CC2420SpiImplP$m_requests) {
CC2420SpiImplP$m_resource_busy = FALSE;
}
else
#line 105
{
for (i = CC2420SpiImplP$m_holder + 1; ; i++) {
if (i >= CC2420SpiImplP$RESOURCE_COUNT) {
i = 0;
}
if (CC2420SpiImplP$m_requests & (1 << i)) {
CC2420SpiImplP$m_holder = i;
CC2420SpiImplP$m_requests &= ~(1 << i);
CC2420SpiImplP$SpiResource$request();
{
unsigned char __nesc_temp =
#line 115
SUCCESS;
{
#line 115
__nesc_atomic_end(__nesc_atomic);
#line 115
return __nesc_temp;
}
}
}
}
}
#line 119
{
unsigned char __nesc_temp =
#line 119
SUCCESS;
{
#line 119
__nesc_atomic_end(__nesc_atomic);
#line 119
return __nesc_temp;
}
}
}
#line 122
__nesc_atomic_end(__nesc_atomic); }
}
# 754 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static void CC2420TransmitP$signalDone(error_t err)
#line 754
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 755
CC2420TransmitP$m_state = CC2420TransmitP$S_STARTED;
#line 755
__nesc_atomic_end(__nesc_atomic); }
CC2420TransmitP$Send$sendDone(CC2420TransmitP$m_msg, err);
}
# 213 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420CsmaP.nc"
static void CC2420CsmaP$SubBackoff$requestInitialBackoff(message_t *msg)
#line 213
{
CC2420CsmaP$SubBackoff$setInitialBackoff(CC2420CsmaP$Random$rand16()
% (0x1F * CC2420_BACKOFF_PERIOD) + CC2420_MIN_BACKOFF);
CC2420CsmaP$RadioBackoff$requestInitialBackoff(__nesc_ntoh_leuint8((unsigned char *)&((cc2420_header_t *)(msg->data -
sizeof(cc2420_header_t )))->type), msg);
}
# 136 "/opt/tinyos-2.x/tos/lib/timer/TransformAlarmC.nc"
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Alarm$startAt(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type t0, /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type dt)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 = t0;
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt = dt;
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$set_alarm();
}
#line 143
__nesc_atomic_end(__nesc_atomic); }
}
#line 96
static void /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$set_alarm(void)
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type now = /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$Counter$get();
#line 98
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type expires;
#line 98
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type remaining;
expires = /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 + /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt;
remaining = (/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$to_size_type )(expires - now);
if (/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 <= now)
{
if (expires >= /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 &&
expires <= now) {
remaining = 0;
}
}
else {
if (expires >= /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 ||
expires <= now) {
remaining = 0;
}
}
#line 121
if (remaining > /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$MAX_DELAY)
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 = now + /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$MAX_DELAY;
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt = remaining - /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$MAX_DELAY;
remaining = /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$MAX_DELAY;
}
else
{
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_t0 += /*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt;
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$m_dt = 0;
}
/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$AlarmFrom$startAt((/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_size_type )now << 0,
(/*AlarmMultiplexC.Alarm.Alarm32khz32C.Transform32*/TransformAlarmC$0$from_size_type )remaining << 0);
}
# 69 "/opt/tinyos-2.x/tos/lib/timer/TransformCounterC.nc"
static /*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type /*Counter32khz32C.Transform32*/TransformCounterC$1$Counter$get(void)
{
/*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type rv = 0;
#line 72
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
/*Counter32khz32C.Transform32*/TransformCounterC$1$upper_count_type high = /*Counter32khz32C.Transform32*/TransformCounterC$1$m_upper;
/*Counter32khz32C.Transform32*/TransformCounterC$1$from_size_type low = /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$get();
#line 76
if (/*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$isOverflowPending())
{
high++;
low = /*Counter32khz32C.Transform32*/TransformCounterC$1$CounterFrom$get();
}
{
/*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type high_to = high;
/*Counter32khz32C.Transform32*/TransformCounterC$1$to_size_type low_to = low >> /*Counter32khz32C.Transform32*/TransformCounterC$1$LOW_SHIFT_RIGHT;
#line 90
rv = (high_to << /*Counter32khz32C.Transform32*/TransformCounterC$1$HIGH_SHIFT_LEFT) | low_to;
}
}
#line 92
__nesc_atomic_end(__nesc_atomic); }
return rv;
}
# 685 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc"
static void CC2420TransmitP$congestionBackoff(void)
#line 685
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 686
{
if (__nesc_ntoh_uint16((unsigned char *)&CC2420TransmitP$CC2420Packet$getMetadata(CC2420TransmitP$m_msg)->rxInterval) > 0) {
CC2420TransmitP$RadioBackoff$requestLplBackoff(CC2420TransmitP$m_msg);
CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$myLplBackoff);
}
else {
CC2420TransmitP$RadioBackoff$requestCongestionBackoff(CC2420TransmitP$m_msg);
CC2420TransmitP$BackoffTimer$start(CC2420TransmitP$myCongestionBackoff);
}
}
#line 695
__nesc_atomic_end(__nesc_atomic); }
}
# 210 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420SpiImplP.nc"
static cc2420_status_t CC2420SpiImplP$Ram$write(uint16_t addr, uint8_t offset,
uint8_t *data,
uint8_t len)
#line 212
{
cc2420_status_t status = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 216
{
if (!CC2420SpiImplP$m_resource_busy) {
{
unsigned char __nesc_temp =
#line 218
status;
{
#line 218
__nesc_atomic_end(__nesc_atomic);
#line 218
return __nesc_temp;
}
}
}
}
#line 222
__nesc_atomic_end(__nesc_atomic); }
#line 222
addr += offset;
CC2420SpiImplP$SpiByte$write(addr | 0x80);
CC2420SpiImplP$SpiByte$write((addr >> 1) & 0xc0);
for (; len; len--)
status = CC2420SpiImplP$SpiByte$write(* data++);
return status;
}
#line 202
static void CC2420SpiImplP$SpiPacket$sendDone(uint8_t *tx_buf, uint8_t *rx_buf,
uint16_t len, error_t error)
#line 203
{
if (CC2420SpiImplP$m_addr & 0x40) {
CC2420SpiImplP$Fifo$readDone(CC2420SpiImplP$m_addr & ~0x40, rx_buf, len, error);
}
else {
#line 207
CC2420SpiImplP$Fifo$writeDone(CC2420SpiImplP$m_addr, tx_buf, len, error);
}
}
# 322 "/opt/tinyos-2.x/tos/chips/cc2420/CC2420ReceiveP.nc"
static void CC2420ReceiveP$flush(void)
#line 322
{
CC2420ReceiveP$reset_state();
CC2420ReceiveP$CSN$set();
CC2420ReceiveP$CSN$clr();
CC2420ReceiveP$SFLUSHRX$strobe();
CC2420ReceiveP$SFLUSHRX$strobe();
CC2420ReceiveP$CSN$set();
CC2420ReceiveP$SpiResource$release();
CC2420ReceiveP$waitForNextPacket();
}
#line 374
static void CC2420ReceiveP$reset_state(void)
#line 374
{
CC2420ReceiveP$m_bytes_left = CC2420ReceiveP$RXFIFO_SIZE;
CC2420ReceiveP$m_timestamp_head = 0;
CC2420ReceiveP$m_timestamp_size = 0;
CC2420ReceiveP$m_missed_packets = 0;
}
# 42 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128GpioCaptureC.nc"
static error_t /*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$enableCapture(uint8_t mode)
#line 42
{
/* atomic removed: atomic calls only */
#line 43
{
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$stop();
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$reset();
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$setEdge(mode);
/*HplCC2420InterruptsC.CaptureSFDC*/Atm128GpioCaptureC$0$Atm128Capture$start();
}
return SUCCESS;
}
# 76 "OctopusC.nc"
static void OctopusC$fatalProblem(void)
#line 76
{
OctopusC$Leds$led0On();
OctopusC$Leds$led1On();
OctopusC$Leds$led2On();
OctopusC$Timer$stop();
}
#line 279
static void OctopusC$SerialSend$sendDone(message_t *msg, error_t error)
#line 279
{
if (error != SUCCESS) {
OctopusC$reportProblem();
}
#line 282
if (msg == &OctopusC$fwdMsg) {
OctopusC$fwdBusy = FALSE;
}
else {
#line 285
OctopusC$uartBusy = FALSE;
}
#line 286
__nesc_hton_uint8((unsigned char *)&OctopusC$localCollectedMsg.reply, NO_REPLY);
OctopusC$reportSent();
}
# 155 "/opt/tinyos-2.x/tos/system/AMQueueImplP.nc"
static void /*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$sendDone(uint8_t last, message_t *msg, error_t err)
#line 155
{
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$queue[last].msg = (void *)0;
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$tryToSend();
/*SerialAMQueueP.AMQueueImplP*/AMQueueImplP$0$Send$sendDone(last, msg, err);
}
# 347 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static void SerialP$testOff(void)
#line 347
{
bool turnOff = FALSE;
#line 349
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 349
{
if (SerialP$txState == SerialP$TXSTATE_INACTIVE &&
SerialP$rxState == SerialP$RXSTATE_INACTIVE) {
turnOff = TRUE;
}
}
#line 354
__nesc_atomic_end(__nesc_atomic); }
if (turnOff) {
SerialP$stopDoneTask$postTask();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 357
SerialP$offPending = FALSE;
#line 357
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 360
SerialP$offPending = TRUE;
#line 360
__nesc_atomic_end(__nesc_atomic); }
}
}
# 86 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static error_t HdlcTranslateC$SerialFrameComm$putDelimiter(void)
#line 86
{
HdlcTranslateC$state.sendEscape = 0;
HdlcTranslateC$m_data = HDLC_FLAG_BYTE;
return HdlcTranslateC$UartStream$send(&HdlcTranslateC$m_data, 1);
}
# 123 "/opt/tinyos-2.x/tos/chips/atm128/Atm128UartP.nc"
static error_t /*Atm128Uart0C.UartP*/Atm128UartP$0$UartStream$send(uint8_t *buf, uint16_t len)
#line 123
{
if (len == 0) {
return FAIL;
}
else {
#line 127
if (/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf) {
return EBUSY;
}
}
#line 130
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_buf = buf;
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_len = len;
/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_pos = 0;
/*Atm128Uart0C.UartP*/Atm128UartP$0$HplUart$tx(buf[/*Atm128Uart0C.UartP*/Atm128UartP$0$m_tx_pos++]);
return SUCCESS;
}
# 167 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
static void HplAtm128UartP$HplUart0$tx(uint8_t data)
#line 167
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 168
{
* (volatile uint8_t *)(0x0C + 0x20) = data;
* (volatile uint8_t *)(0x0B + 0x20) |= 1 << 6;
}
#line 171
__nesc_atomic_end(__nesc_atomic); }
}
# 62 "/opt/tinyos-2.x/tos/lib/timer/VirtualizeTimerC.nc"
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);
}
}
}
/*HilTimerMilliC.VirtualizeTimerC*/VirtualizeTimerC$0$updateFromTimer$postTask();
}
# 202 "/opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc"
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$startAt(uint32_t nt0, uint32_t ndt)
#line 202
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$set = TRUE;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$t0 = nt0;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$dt = ndt;
}
#line 208
__nesc_atomic_end(__nesc_atomic); }
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt();
}
#line 90
static void /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setInterrupt(void)
#line 90
{
bool fired = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
uint8_t interrupt_in = 1 + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Compare$get() - /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Timer$get();
uint8_t newOcr0;
if (interrupt_in < /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MINDT || /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$TimerCtrl$getInterruptFlag().bits.ocf0) {
{
#line 102
__nesc_atomic_end(__nesc_atomic);
#line 102
return;
}
}
if (!/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$set) {
newOcr0 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MAXT;
}
else {
uint32_t now = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Counter$get();
if ((uint32_t )(now - /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$t0) >= /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$dt)
{
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$set = FALSE;
fired = TRUE;
newOcr0 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MAXT;
}
else
{
uint32_t alarm_in = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$t0 + /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$dt - /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$base;
if (alarm_in > /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MAXT) {
newOcr0 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MAXT;
}
else {
#line 126
if ((uint8_t )alarm_in < /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MINDT) {
newOcr0 = /*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$MINDT;
}
else {
#line 129
newOcr0 = alarm_in;
}
}
}
}
#line 132
newOcr0--;
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$setOcr0(newOcr0);
}
#line 134
__nesc_atomic_end(__nesc_atomic); }
if (fired) {
/*AlarmCounterMilliP.Atm128AlarmAsyncC.Atm128AlarmAsyncP*/Atm128AlarmAsyncP$0$Alarm$fired();
}
}
# 178 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc"
__attribute((signal)) void __vector_15(void)
#line 178
{
HplAtm128Timer0AsyncP$stabiliseTimer0();
HplAtm128Timer0AsyncP$Compare$fired();
}
__attribute((signal)) void __vector_16(void)
#line 184
{
HplAtm128Timer0AsyncP$stabiliseTimer0();
HplAtm128Timer0AsyncP$Timer$overflow();
}
# 174 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
__attribute((signal)) void __vector_18(void)
#line 174
{
if ((* (volatile uint8_t *)(0x0B + 0x20) & (1 << 7)) != 0) {
HplAtm128UartP$HplUart0$rxDone(* (volatile uint8_t *)(0x0C + 0x20));
}
}
# 402 "/opt/tinyos-2.x/tos/lib/serial/SerialP.nc"
static void SerialP$rx_state_machine(bool isDelimeter, uint8_t data)
#line 402
{
switch (SerialP$rxState) {
case SerialP$RXSTATE_NOSYNC:
if (isDelimeter) {
SerialP$rxInit();
SerialP$rxState = SerialP$RXSTATE_PROTO;
}
break;
case SerialP$RXSTATE_PROTO:
if (!isDelimeter) {
SerialP$rxCRC = crcByte(SerialP$rxCRC, data);
SerialP$rxState = SerialP$RXSTATE_TOKEN;
SerialP$rxProto = data;
if (!SerialP$valid_rx_proto(SerialP$rxProto)) {
goto nosync;
}
if (SerialP$rxProto != SERIAL_PROTO_PACKET_ACK) {
goto nosync;
}
if (SerialP$ReceiveBytePacket$startPacket() != SUCCESS) {
goto nosync;
}
}
break;
case SerialP$RXSTATE_TOKEN:
if (isDelimeter) {
goto nosync;
}
else {
SerialP$rxSeqno = data;
SerialP$rxCRC = crcByte(SerialP$rxCRC, SerialP$rxSeqno);
SerialP$rxState = SerialP$RXSTATE_INFO;
}
break;
case SerialP$RXSTATE_INFO:
if (SerialP$rxByteCnt < SerialP$SERIAL_MTU) {
if (isDelimeter) {
if (SerialP$rxByteCnt >= 2) {
if (SerialP$rx_current_crc() == SerialP$rxCRC) {
SerialP$ReceiveBytePacket$endPacket(SUCCESS);
SerialP$ack_queue_push(SerialP$rxSeqno);
goto nosync;
}
else {
goto nosync;
}
}
else {
goto nosync;
}
}
else {
if (SerialP$rxByteCnt >= 2) {
SerialP$ReceiveBytePacket$byteReceived(SerialP$rx_buffer_top());
SerialP$rxCRC = crcByte(SerialP$rxCRC, SerialP$rx_buffer_pop());
}
SerialP$rx_buffer_push(data);
SerialP$rxByteCnt++;
}
}
else
{
goto nosync;
}
break;
default:
goto nosync;
}
goto done;
nosync:
SerialP$rxInit();
SerialP$SerialFrameComm$resetReceive();
SerialP$ReceiveBytePacket$endPacket(FAIL);
if (SerialP$offPending) {
SerialP$rxState = SerialP$RXSTATE_INACTIVE;
SerialP$testOff();
}
else {
if (isDelimeter) {
SerialP$rxState = SerialP$RXSTATE_PROTO;
}
}
done: ;
}
# 81 "/opt/tinyos-2.x/tos/chips/atm128/crc.h"
static __attribute((noinline)) uint16_t crcByte(uint16_t oldCrc, uint8_t byte)
{
uint16_t *table = crcTable;
uint16_t newCrc;
__asm ("eor %1,%B3\n"
"\tlsl %1\n"
"\tadc %B2, __zero_reg__\n"
"\tadd %A2, %1\n"
"\tadc %B2, __zero_reg__\n"
"\tlpm\n"
"\tmov %B0, %A3\n"
"\tmov %A0, r0\n"
"\tadiw r30,1\n"
"\tlpm\n"
"\teor %B0, r0" :
"=r"(newCrc), "+r"(byte), "+z"(table) : "r"(oldCrc));
return newCrc;
}
# 290 "/opt/tinyos-2.x/tos/lib/serial/SerialDispatcherP.nc"
static void /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$ReceiveBytePacket$endPacket(error_t result)
#line 290
{
uint8_t postsignalreceive = FALSE;
/* atomic removed: atomic calls only */
#line 292
{
if (!/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskPending && result == SUCCESS) {
postsignalreceive = TRUE;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskPending = TRUE;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskType = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvType;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskWhich = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.which;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskBuf = (message_t *)/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBuffer;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTaskSize = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$recvIndex;
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveBufferSwap();
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveState.state = /*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$RECV_STATE_IDLE;
}
}
if (postsignalreceive) {
/*SerialDispatcherC.SerialDispatcherP*/SerialDispatcherP$0$receiveTask$postTask();
}
}
# 180 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
__attribute((interrupt)) void __vector_20(void)
#line 180
{
HplAtm128UartP$HplUart0$txDone();
}
# 92 "/opt/tinyos-2.x/tos/lib/serial/HdlcTranslateC.nc"
static error_t HdlcTranslateC$SerialFrameComm$putData(uint8_t data)
#line 92
{
if (data == HDLC_CTLESC_BYTE || data == HDLC_FLAG_BYTE) {
HdlcTranslateC$state.sendEscape = 1;
HdlcTranslateC$txTemp = data ^ 0x20;
HdlcTranslateC$m_data = HDLC_CTLESC_BYTE;
}
else {
HdlcTranslateC$m_data = data;
}
return HdlcTranslateC$UartStream$send(&HdlcTranslateC$m_data, 1);
}
# 271 "/opt/tinyos-2.x/tos/chips/atm128/HplAtm128UartP.nc"
__attribute((signal)) void __vector_30(void)
#line 271
{
if ((* (volatile uint8_t *)0x9B & (1 << 7)) != 0) {
HplAtm128UartP$HplUart1$rxDone(* (volatile uint8_t *)0x9C);
}
}
#line 276
__attribute((interrupt)) void __vector_32(void)
#line 276
{
HplAtm128UartP$HplUart1$txDone();
}
# 189 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer3P.nc"
__attribute((interrupt)) void __vector_26(void)
#line 189
{
HplAtm128Timer3P$CompareA$fired();
}
__attribute((interrupt)) void __vector_27(void)
#line 193
{
HplAtm128Timer3P$CompareB$fired();
}
__attribute((interrupt)) void __vector_28(void)
#line 197
{
HplAtm128Timer3P$CompareC$fired();
}
__attribute((interrupt)) void __vector_25(void)
#line 201
{
HplAtm128Timer3P$Capture$captured(HplAtm128Timer3P$Timer$get());
}
__attribute((interrupt)) void __vector_29(void)
#line 205
{
HplAtm128Timer3P$Timer$overflow();
}
# 195 "/opt/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer1P.nc"
__attribute((interrupt)) void __vector_12(void)
#line 195
{
HplAtm128Timer1P$CompareA$fired();
}
__attribute((interrupt)) void __vector_13(void)
#line 199
{
HplAtm128Timer1P$CompareB$fired();
}
__attribute((interrupt)) void __vector_24(void)
#line 203
{
HplAtm128Timer1P$CompareC$fired();
}
__attribute((interrupt)) void __vector_11(void)
#line 207
{
HplAtm128Timer1P$Capture$captured(HplAtm128Timer1P$Timer$get());
}
__attribute((interrupt)) void __vector_14(void)
#line 211
{
HplAtm128Timer1P$Timer$overflow();
}
# 46 "/opt/tinyos-2.x/tos/chips/atm128/pins/HplAtm128InterruptSigP.nc"
__attribute((signal)) void __vector_1(void)
#line 46
{
HplAtm128InterruptSigP$IntSig0$fired();
}
__attribute((signal)) void __vector_2(void)
#line 51
{
HplAtm128InterruptSigP$IntSig1$fired();
}
__attribute((signal)) void __vector_3(void)
#line 56
{
HplAtm128InterruptSigP$IntSig2$fired();
}
__attribute((signal)) void __vector_4(void)
#line 61
{
HplAtm128InterruptSigP$IntSig3$fired();
}
__attribute((signal)) void __vector_5(void)
#line 66
{
HplAtm128InterruptSigP$IntSig4$fired();
}
__attribute((signal)) void __vector_6(void)
#line 71
{
HplAtm128InterruptSigP$IntSig5$fired();
}
__attribute((signal)) void __vector_7(void)
#line 76
{
HplAtm128InterruptSigP$IntSig6$fired();
}
__attribute((signal)) void __vector_8(void)
#line 81
{
HplAtm128InterruptSigP$IntSig7$fired();
}
# 103 "/opt/tinyos-2.x/tos/chips/atm128/spi/HplAtm128SpiP.nc"
__attribute((signal)) void __vector_17(void)
#line 103
{
HplAtm128SpiP$SPI$dataReady(HplAtm128SpiP$SPI$read());
}
|
tinyos-io/tinyos-3.x-contrib | tinymulle/tos/platforms/mulle/softwarei2c/MulleI2C.h | /**
* @author <NAME>
*/
#ifndef __MULLEI2C_H__
#define __MULLEI2C_H__
#define UQ_MULLE_SOFTI2CMASTER "SoftI2CMasterC.SoftI2CPacket"
#endif // __MULLEI2C_H__
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/lib/tossim/sim_noise.c | /*
* "Copyright (c) 2006 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* Implementation of all of the Hash-Based Learning primitives and utility
* functions.
*
* @author <NAME>
* @date Oct 13 2006
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <time.h>
#include "randomlib.h"
#include "hashtable.h"
#include "sim_noise.h"
uint32_t FreqKeyNum = 0;
sim_noise_node_t noiseData[TOSSIM_MAX_NODES];
static unsigned int sim_noise_hash(void *key);
static int sim_noise_eq(void *key1, void *key2);
void makeNoiseModel(uint16_t node_id);
void makePmfDistr(uint16_t node_id);
uint8_t search_bin_num(char noise);
void sim_noise_init()__attribute__ ((C, spontaneous))
{
int j;
//printf("Starting\n");
for (j=0; j< TOSSIM_MAX_NODES; j++) {
noiseData[j].noiseTable = create_hashtable(NOISE_HASHTABLE_SIZE, sim_noise_hash, sim_noise_eq);
noiseData[j].noiseGenTime = 0;
noiseData[j].noiseTrace = (char*)(malloc(sizeof(char) * NOISE_MIN_TRACE));
noiseData[j].noiseTraceLen = NOISE_MIN_TRACE;
noiseData[j].noiseTraceIndex = 0;
}
//printf("Done with sim_noise_init()\n");
}
void sim_noise_create_model(uint16_t node_id)__attribute__ ((C, spontaneous)) {
makeNoiseModel(node_id);
makePmfDistr(node_id);
}
char sim_real_noise(uint16_t node_id, uint32_t cur_t) {
if (cur_t > noiseData[node_id].noiseTraceLen) {
dbg("Noise", "Asked for noise element %u when there are only %u.\n", cur_t, noiseData[node_id].noiseTraceIndex);
return 0;
}
return noiseData[node_id].noiseTrace[cur_t];
}
void sim_noise_trace_add(uint16_t node_id, char noiseVal)__attribute__ ((C, spontaneous)) {
// Need to double size of trace arra
if (noiseData[node_id].noiseTraceIndex ==
noiseData[node_id].noiseTraceLen) {
char* data = (char*)(malloc(sizeof(char) * noiseData[node_id].noiseTraceLen * 2));
memcpy(data, noiseData[node_id].noiseTrace, noiseData[node_id].noiseTraceLen);
free(noiseData[node_id].noiseTrace);
noiseData[node_id].noiseTraceLen *= 2;
noiseData[node_id].noiseTrace = data;
}
noiseData[node_id].noiseTrace[noiseData[node_id].noiseTraceIndex] = noiseVal;
noiseData[node_id].noiseTraceIndex++;
dbg("Insert", "Adding noise value %i for %i of %i\n", (int)noiseData[node_id].noiseTraceIndex, (int)node_id, (int)noiseVal);
}
uint8_t search_bin_num(char noise)__attribute__ ((C, spontaneous))
{
uint8_t bin;
if (noise > NOISE_MAX || noise < NOISE_MIN) {
noise = NOISE_MIN;
}
bin = (noise-NOISE_MIN)/NOISE_QUANTIZE_INTERVAL + 1;
return bin;
}
char search_noise_from_bin_num(int i)__attribute__ ((C, spontaneous))
{
char noise;
noise = NOISE_MIN + (i-1)*NOISE_QUANTIZE_INTERVAL;
return noise;
}
static unsigned int sim_noise_hash(void *key) {
char *pt = (char *)key;
unsigned int hashVal = 0;
int i;
for (i=0; i< NOISE_HISTORY; i++) {
hashVal = pt[i] + (hashVal << 6) + (hashVal << 16) - hashVal;
}
return hashVal;
}
static int sim_noise_eq(void *key1, void *key2) {
return (memcmp((void *)key1, (void *)key2, NOISE_HISTORY) == 0);
}
void sim_noise_add(uint16_t node_id, char noise)__attribute__ ((C, spontaneous))
{
int i;
struct hashtable *pnoiseTable = noiseData[node_id].noiseTable;
char *key = noiseData[node_id].key;
sim_noise_hash_t *noise_hash;
noise_hash = (sim_noise_hash_t *)hashtable_search(pnoiseTable, key);
dbg("Insert", "Adding noise value %hhi\n", noise);
if (noise_hash == NULL) {
noise_hash = (sim_noise_hash_t *)malloc(sizeof(sim_noise_hash_t));
memcpy((void *)(noise_hash->key), (void *)key, NOISE_HISTORY);
noise_hash->numElements = 0;
noise_hash->size = NOISE_DEFAULT_ELEMENT_SIZE;
noise_hash->elements = (char *)malloc(sizeof(char)*noise_hash->size);
memset((void *)noise_hash->elements, 0, sizeof(char)*noise_hash->size);
noise_hash->flag = 0;
for(i=0; i<NOISE_BIN_SIZE; i++) {
noise_hash->dist[i] = 0;
}
hashtable_insert(pnoiseTable, key, noise_hash);
dbg("Insert", "Inserting %p into table %p with key ", noise_hash, pnoiseTable);
{
int ctr;
for(ctr = 0; ctr < NOISE_HISTORY; ctr++)
dbg_clear("Insert", "%0.3hhi ", key[ctr]);
}
dbg_clear("Insert", "\n");
}
if (noise_hash->numElements == noise_hash->size)
{
char *newElements;
int newSize = (noise_hash->size)*2;
newElements = (char *)malloc(sizeof(char)*newSize);
memcpy(newElements, noise_hash->elements, noise_hash->size);
free(noise_hash->elements);
noise_hash->elements = newElements;
noise_hash->size = newSize;
}
noise_hash->elements[noise_hash->numElements] = noise;
noise_hash->numElements++;
}
void sim_noise_dist(uint16_t node_id)__attribute__ ((C, spontaneous))
{
int i;
uint8_t bin;
float cmf = 0;
struct hashtable *pnoiseTable = noiseData[node_id].noiseTable;
char *key = noiseData[node_id].key;
char *freqKey = noiseData[node_id].freqKey;
sim_noise_hash_t *noise_hash;
noise_hash = (sim_noise_hash_t *)hashtable_search(pnoiseTable, key);
if (noise_hash->flag == 1)
return;
for (i=0; i < NOISE_BIN_SIZE; i++) {
noise_hash->dist[i] = 0.0;
}
for (i=0; i< noise_hash->numElements; i++)
{
float val;
bin = search_bin_num(noise_hash->elements[i]) - 1;
val = noise_hash->dist[bin];
val += (float)1.0;
noise_hash->dist[bin] = val;
}
for (i=0; i < NOISE_BIN_SIZE ; i++)
{
noise_hash->dist[i] = (noise_hash->dist[i])/(noise_hash->numElements);
cmf += noise_hash->dist[i];
noise_hash->dist[i] = cmf;
}
noise_hash->flag = 1;
//Find the most frequent key and store it in noiseData[node_id].freqKey[].
if (noise_hash->numElements > FreqKeyNum)
{
int j;
FreqKeyNum = noise_hash->numElements;
memcpy((void *)freqKey, (void *)key, NOISE_HISTORY);
dbg("HashZeroDebug", "Setting most frequent key (%i): ", (int) FreqKeyNum);
for (j = 0; j < NOISE_HISTORY; j++) {
dbg_clear("HashZeroDebug", "[%hhu] ", key[j]);
}
dbg_clear("HashZeroDebug", "\n");
}
}
void arrangeKey(uint16_t node_id)__attribute__ ((C, spontaneous))
{
char *pKey = noiseData[node_id].key;
memcpy(pKey, pKey+1, NOISE_HISTORY-1);
}
/*
* After makeNoiseModel() is done, make PMF distribution for each bin.
*/
void makePmfDistr(uint16_t node_id)__attribute__ ((C, spontaneous))
{
int i;
char *pKey = noiseData[node_id].key;
char *fKey = noiseData[node_id].freqKey;
FreqKeyNum = 0;
for(i=0; i<NOISE_HISTORY; i++) {
pKey[i] = search_bin_num(noiseData[node_id].noiseTrace[i]);
}
sim_noise_dist(node_id);
arrangeKey(node_id);
for(i = NOISE_HISTORY; i < noiseData[node_id].noiseTraceIndex; i++) {
if (i == NOISE_HISTORY) {
//printf("Inserting first element.\n");
}
pKey[NOISE_HISTORY-1] = search_bin_num(noiseData[node_id].noiseTrace[i]);
sim_noise_dist(node_id);
arrangeKey(node_id);
}
dbg_clear("HASH", "FreqKey = ");
for (i=0; i< NOISE_HISTORY ; i++)
{
dbg_clear("HASH", "%d,", fKey[i]);
}
dbg_clear("HASH", "\n");
}
int dummy;
void sim_noise_alarm() {
dummy = 5;
}
char sim_noise_gen(uint16_t node_id)__attribute__ ((C, spontaneous))
{
int i;
int noiseIndex = 0;
char noise;
struct hashtable *pnoiseTable = noiseData[node_id].noiseTable;
char *pKey = noiseData[node_id].key;
char *fKey = noiseData[node_id].freqKey;
double ranNum = RandomUniform();
sim_noise_hash_t *noise_hash;
noise_hash = (sim_noise_hash_t *)hashtable_search(pnoiseTable, pKey);
if (noise_hash == NULL) {
sim_noise_alarm();
noise = 0;
dbg_clear("HASH", "(N)Noise\n");
dbg("HashZeroDebug", "Defaulting to common hash.\n");
memcpy((void *)pKey, (void *)fKey, NOISE_HISTORY);
noise_hash = (sim_noise_hash_t *)hashtable_search(pnoiseTable, pKey);
}
dbg_clear("HASH", "Key = ");
for (i=0; i< NOISE_HISTORY ; i++) {
dbg_clear("HASH", "%d,", pKey[i]);
}
dbg_clear("HASH", "\n");
dbg("HASH", "Printing Key\n");
dbg("HASH", "noise_hash->numElements=%d\n", noise_hash->numElements);
if (noise_hash->numElements == 1) {
noise = noise_hash->elements[0];
dbg_clear("HASH", "(E)Noise = %d\n", noise);
return noise;
}
for (i = 0; i < NOISE_BIN_SIZE - 1; i++) {
dbg("HASH", "IN:for i=%d\n", i);
if (i == 0) {
if (ranNum <= noise_hash->dist[i]) {
noiseIndex = i;
dbg_clear("HASH", "Selected Bin = %d -> ", i+1);
break;
}
}
else if ( (noise_hash->dist[i-1] < ranNum) &&
(ranNum <= noise_hash->dist[i]) ) {
noiseIndex = i;
dbg_clear("HASH", "Selected Bin = %d -> ", i+1);
break;
}
}
dbg("HASH", "OUT:for i=%d\n", i);
noise = search_noise_from_bin_num(i+1);
dbg_clear("HASH", "(B)Noise = %d\n", noise);
return noise;
}
char sim_noise_generate(uint16_t node_id, uint32_t cur_t)__attribute__ ((C, spontaneous)) {
uint32_t i;
uint32_t prev_t;
uint32_t delta_t;
char *noiseG;
char noise;
prev_t = noiseData[node_id].noiseGenTime;
if (noiseData[node_id].generated == 0) {
dbgerror("TOSSIM", "Tried to generate noise from an uninitialized radio model of node %hu.\n", node_id);
return 127;
}
if ( (0<= cur_t) && (cur_t < NOISE_HISTORY) ) {
noiseData[node_id].noiseGenTime = cur_t;
noiseData[node_id].key[cur_t] = search_bin_num(noiseData[node_id].noiseTrace[cur_t]);
noiseData[node_id].lastNoiseVal = noiseData[node_id].noiseTrace[cur_t];
return noiseData[node_id].noiseTrace[cur_t];
}
if (prev_t == 0)
delta_t = cur_t - (NOISE_HISTORY-1);
else
delta_t = cur_t - prev_t;
dbg_clear("HASH", "delta_t = %d\n", delta_t);
if (delta_t == 0)
noise = noiseData[node_id].lastNoiseVal;
else {
noiseG = (char *)malloc(sizeof(char)*delta_t);
for(i=0; i< delta_t; i++) {
noiseG[i] = sim_noise_gen(node_id);
arrangeKey(node_id);
noiseData[node_id].key[NOISE_HISTORY-1] = search_bin_num(noiseG[i]);
}
noise = noiseG[delta_t-1];
noiseData[node_id].lastNoiseVal = noise;
free(noiseG);
}
noiseData[node_id].noiseGenTime = cur_t;
if (noise == 0) {
dbg("HashZeroDebug", "Generated noise of zero.\n");
}
return noise;
}
/*
* When initialization process is going on, make noise model by putting
* experimental noise values.
*/
void makeNoiseModel(uint16_t node_id)__attribute__ ((C, spontaneous)) {
int i;
for(i=0; i<NOISE_HISTORY; i++) {
noiseData[node_id].key[i] = search_bin_num(noiseData[node_id].noiseTrace[i]);
dbg("Insert", "Setting history %i to be %i\n", (int)i, (int)noiseData[node_id].key[i]);
}
sim_noise_add(node_id, noiseData[node_id].noiseTrace[NOISE_HISTORY]);
arrangeKey(node_id);
for(i = NOISE_HISTORY; i < noiseData[node_id].noiseTraceIndex; i++) {
noiseData[node_id].key[NOISE_HISTORY-1] = search_bin_num(noiseData[node_id].noiseTrace[i]);
sim_noise_add(node_id, noiseData[node_id].noiseTrace[i+1]);
arrangeKey(node_id);
}
noiseData[node_id].generated = 1;
}
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/daq/kernel-driver/pci.c | <reponame>tinyos-io/tinyos-3.x-contrib
/* PCI series device driver.
Author: <NAME>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* File level history (record changes for this file here.)
v 0.8.1 8 Jul 2003 by <NAME>
Fixed a bug about _find_minor().
v 0.8.0 11 Mar 2003 by <NAME>
Gives support to PCI-TMC12.
Gives sub-verdor sub-device IDs.
v 0.7.0 7 Jan 2003 by <NAME>
Adds the io range information for devinfo.
v 0.6.0 11 Nov 2002 by <NAME>
Uses slab.h in place of malloc.h.
Complies to the kernel module license check.
v 0.5.3 25 Jul 2002 by <NAME>
_pio_cardname() ==> _pci_cardname()
v 0.5.2 25 Jul 2002 by <NAME>
Just refines some codes and messages.
v 0.5.1 16 May 2002 by <NAME>
Corrects the PCI-P16R16(series) service module name with "ixpcip16x16"
v 0.5.0 28 Dec 2001 by <NAME>
Gives support to Kernel 2.4.
v 0.4.0 1 Nov 2001 by <NAME>ai
Uses module_init() and module_exit() in place of init_module() and
cleanup_module() for Kernel 2.4
v 0.3.0 31 Oct 2001 by <NAME>
Renames module_register_chrdev module_unregister_chrdev to
devfs_register_chrdev and devfs_unregister_chrdev for Kernel 2.4.
v 0.2.0 29 Oct 2001 by <NAME>
Updates modules _find_dev() and _add_dev() for Kernel 2.4 compatibility.
v 0.1.0 25 Oct 2001 by <NAME>
Re-filenames to _pci.c (from pdaq.c.)
Changes all of "pdaq" to "ixpci."
v 0.0.0 10 Apr 2001 by <NAME>
Create. */
/* *INDENT-OFF* */
#define IXPCI_RESERVED 0 /* 1 do compilation with reserved codes */
/* Mandatory */
#include <linux/kernel.h> /* ta, kernel work */
#include <linux/module.h> /* is a module */
#include <linux/version.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/init.h>
/* Deal with CONFIG_MODVERSIONS that is defined in
/usr/include/linux/config.h (config.h is included by module.h) */
#ifdef CONFIG_MODVERSIONS
# define MODVERSIONS
# include <linux/modversions.h>
#endif
/* using I/O ports */
#include <asm/io.h>
#include <linux/ioport.h>
/* need kmalloc */
#include <linux/slab.h>
#include <linux/proc_fs.h>
/* Local matter */
#include "ixpci_kernel.h"
#define MODULE_NAME "ixpci"
#ifdef MODULE_LICENSE
MODULE_AUTHOR("<NAME> <<EMAIL>>");
MODULE_DESCRIPTION("ICPDAS PCI-series driver, common Interface");
MODULE_LICENSE(ICPDAS_LICENSE);
#endif
unsigned int ixpci_major;
/* IXPCI global major number, auto-asign */
ixpci_kernel_t *ixpci_dev;
/* pointer to the found PCI cards' list */
EXPORT_SYMBOL(ixpci_dev);
EXPORT_SYMBOL(ixpci_major);
EXPORT_SYMBOL(ixpci_copy_devinfo);
struct ixpci_carddef ixpci_card[] = {
/* composed_id present module name */
{PCI_1800, 0, "ixpci1800", "PCI-1800/1802/1602"},
{PCI_1602_A, 0, "ixpci1602", "PCI-1602 (new id)"},
{PCI_1202, 0, "ixpci1202", "PCI-1202"},
{PCI_1002, 0, "ixpci1002", "PCI-1002"},
{PCI_P16R16, 0, "ixpcip16x16", "PCI-P16C16/P16R16/P16POR16"},
{PCI_P8R8, 0, "ixpcip8r8", "PCI-P8R8"},
{PCI_TMC12, 0, "ixpcitmc12", "PCI-TMC12"},
{0, 0, "", "UNKNOW"},
};
static void *ixpci_cardname(__u64 id, int add_present)
{
/* Get card name by id
*
* Arguments:
* id card id (see ixpci.h)
* new flag for a new card just be found
* Returned:
* Pointer to the name string that coresponds the given id.
* If there is no card name has been found, return 0. */
int i = 0;
while (ixpci_card[i].id) {
if (ixpci_card[i].id == id) {
if (add_present)
++(ixpci_card[i].present);
/* yeh, present, check in */
return ixpci_card[i].name;
}
++i;
}
return 0;
}
void *ixpci_pci_cardname(__u64 id)
{
return ixpci_cardname(id, 0);
}
static void ixpci_del_dev(void)
{
/* Release memory from card list
*
* Arguments: none
*
* Returned: void */
ixpci_kernel_t *dev, *prev;
dev = ixpci_dev;
while (dev) {
pci_dev_put(dev->sdev);
prev = dev;
dev = dev->next;
kfree(prev);
}
}
static ixpci_kernel_t *ixpci_add_dev(unsigned int no, __u64 id, char *name,
struct pci_dev *sdev)
{
/* Add the found card to list
*
* Arguments:
* no device number in list
* id card id (see ixpci.h)
* name card name
* sdev pointer to the device information from system
*
* Returned: The added device */
ixpci_kernel_t *dev, *prev, *prev_f;
if (ixpci_dev) { /* ixpci device list is already followed */
if (ixpci_dev->id == id)
prev_f = ixpci_dev;
else
prev_f = 0;
prev = ixpci_dev;
dev = prev->next;
while (dev) { /* seek the tail of list */
if (dev->id == id) { /* last device in family */
prev_f = dev;
}
prev = dev;
dev = dev->next;
}
dev = prev->next = kmalloc(sizeof(*dev), GFP_KERNEL);
memset(dev, 0, sizeof(*dev));
dev->prev = prev; /* member the previous address */
if (prev_f) {
dev->prev_f = prev_f; /* member the previous family
device */
prev_f->next_f = dev; /* member the next family device */
}
} else { /* ixpci device list is empty, initiate */
ixpci_dev = kmalloc(sizeof(*ixpci_dev), GFP_KERNEL);
memset(ixpci_dev, 0, sizeof(*ixpci_dev));
dev = ixpci_dev;
}
dev->no = no;
dev->id = id;
strncpy(dev->name, name, CNL);
dev->sdev = sdev;
return dev;
}
static int ixpci_find_dev(void)
{
/* Find all devices (cards) in this system.
*
* Arguments: none
*
* Returned: The number of found devices */
unsigned int i = 0;
unsigned int dev_no = 0;
unsigned int j;
__u64 id;
unsigned int vid, did, svid, sdid;
char *name;
struct pci_dev *sdev;
ixpci_kernel_t *dev;
dev = NULL;
sdev = NULL;
for (; (id = ixpci_card[i].id) != 0; ++i) {
vid = IXPCI_VENDOR(id);
did = IXPCI_DEVICE(id);
svid = IXPCI_SUBVENDOR(id);
sdid = IXPCI_SUBDEVICE(id);
while ((sdev =
pci_get_subsys(vid, did, PCI_ANY_ID, PCI_ANY_ID, sdev))) {
/* Remember to return the device, when we discover that we cannot use it */
if (svid && svid != sdev->subsystem_vendor) {
pci_dev_put(sdev);
continue;
}
if (sdid && sdid != sdev->subsystem_device) {
pci_dev_put(sdev);
continue;
}
++(ixpci_card[i].present);
name = ixpci_card[i].name;
dev = ixpci_add_dev(dev_no++, id, name, sdev);
if (dev_no == 1)
KMSG("NO PCI_ID____________ IRQ BASE______ NAME...\n");
/* " 01 0x1234567812345678 10 0x0000a400 PCI-1800\n" */
KMSG("%2d 0x%04x%04x%04x%04x %3d 0x%08lx %s\n", dev_no, vid, did, svid, sdid, sdev->irq,
pci_resource_start(dev->sdev, 0), name);
for (j = 1; (j < PBAN) && (pci_resource_start(dev->sdev, j) != 0); ++j)
KMSG(" 0x%08lx\n", pci_resource_start(dev->sdev, j));
}
}
return dev_no;
}
void ixpci_copy_devinfo(ixpci_devinfo_t * dst, ixpci_kernel_t * src)
{
int i;
dst->no = src->no;
dst->id = src->id;
for (i = 0; i < PBAN; i++) {
dst->base[i] = pci_resource_start(src->sdev, i);
dst->range[i] = pci_resource_len(src->sdev, i);
}
strncpy(dst->name, src->name, CNL);
}
static ixpci_kernel_t *ixpci_find_minor(int minor)
{
ixpci_kernel_t *dp;
for (dp = ixpci_dev; dp && dp->no != minor; dp = dp->next);
return dp;
}
static int ixpci_ioctl(struct inode *inode,
struct file *file,
unsigned int ioctl_num, unsigned long ioctl_param)
{
/* This function is called whenever a process tries to do and IO
* control on IXPCI device file
*
* Arguments: read <linux/fs.h> for (*ioctl) of struct file_operations
*
* Returned: error code */
ixpci_kernel_t *dp;
dp = ixpci_find_minor(iminor(inode));
if (!dp || !dp->fops || !dp->fops->ioctl) return -EINVAL;
return (dp->fops->ioctl) (inode, file, ioctl_num, ioctl_param);
}
static int ixpci_release(struct inode *inode, struct file *file)
{
/* This function is called whenever a process attempts to closes the
* device file. It doesn't have a return value in kernel version 2.0.x
* because it can't fail (you must always be able to close a device).
* In version 2.2.x it is allowed to fail.
*
* Arguments: read <linux/fs.h> for (*release) of struct file_operations
*
* Returned: version dependence */
ixpci_kernel_t *dp;
dp = ixpci_find_minor(iminor(inode));
if (!dp || !dp->fops || !dp->fops->release) {
return -EINVAL;
} else {
return (dp->fops->release) (inode, file);
}
}
static int ixpci_open(struct inode *inode, struct file *file)
{
/* This function is called whenever a process attempts to open the
* device file
*
* Arguments: read <linux/fs.h> for (*open) of struct file_operations
*
* Returned: error code */
ixpci_kernel_t *dp;
dp = ixpci_find_minor(iminor(inode));
if (!dp || !dp->fops || !dp->fops->open) return -EINVAL;
return (dp->fops->open) (inode, file);
}
/* device file operaitons information */
static struct file_operations fops = {
open: ixpci_open,
release: ixpci_release,
ioctl: ixpci_ioctl,
};
void ixpci_cleanup(void)
{
/* cleanup this module */
int unr;
/* remove /proc/ixpci */
ixpci_proc_exit();
/* remove device file operations */
unr = unregister_chrdev(ixpci_major, DEVICE_NAME);
if (unr < 0)
KMSG("%s devfs(module)_unregister_chrdev() error: %d\n",
MODULE_NAME, unr);
ixpci_del_dev(); /* release allocated memory */
KMSG("%s has been removed\n", MODULE_NAME);
}
int ixpci_init(void)
{
/* initialize this module
*
* Arguments:
*
* Returned: error code, 0 ok */
unsigned found;
char *comp;
int err;
found = ixpci_find_dev();
if (found < 0) {
KMSG("_find_dev() failed!\n");
return found;
}
if (found == 0) {
KMSG("No device (card) found.\n");
return -ENODEV;
}
if (found == 1)
comp = "";
else
comp = "s";
KMSG("Total %d device%s (card%s) found.\n", found, comp, comp);
/* register device file operations */
ixpci_major = register_chrdev(DEVICE_MAJOR, DEVICE_NAME, &fops);
if (ixpci_major < 0) {
KMSG("Registration of character device failed: %d\n", ixpci_major);
ixpci_del_dev(); /* release allocated memory */
return err;
}
KMSG("Using major number %d.\n", ixpci_major);
/* setup proc entry */
if ((err = ixpci_proc_init())) {
KMSG("%s/%s/%s %d failed!\n", proc_root.name, ORGANIZATION,
DEVICE_NAME, err);
ixpci_del_dev();
return err;
}
return 0;
}
module_init(ixpci_init);
module_exit(ixpci_cleanup);
|
tinyos-io/tinyos-3.x-contrib | timetossim/tinyos-2.x/tools/cgram/examples/check_time3b.c | typedef struct Event_Data{
sim_event_t * tevent;
struct Event_Data * next;
}Event_Data;
typedef struct Event_List{
struct Event_Data *first;
}Event_List;
sim_time_t nodeTime;
bool noNode;
inline int adjust_queue(long long increase){
bool a = 1;
bool b = 0;
int prior=0;
Event_List list;
Event_Data *curr;
Event_Data *prev;
long long increment=0;
list.first = (void *)0;
nodeTime=0;
noNode =1;
if(!sim_queue_is_empty () ){
if( sim_time() <= sim_queue_peek_time()){
//printf("Event Queue Unchanged\n");
return 0;
}
}
//printf("{ reading the queue\n");
while(!sim_queue_is_empty () ) {
sim_event_t * event = sim_queue_pop();
if (current_node != event->mote){
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
}
else{
noNode = 0;
if( sim_time() <= event->time){
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
nodeTime = event->time;
break;
}
else{
if((currentPriority < event->priority) && (!isAtomic)){
//printf("Event Preempted\n");
prior = currentPriority;
sim_queue_insert(event);
sim_run_next_event();
currentPriority = prior;
//printf("Return from Preemption\n");
}
else{
//printf("Event Delayed and Queue Rescheduled\n");
event->time = sim_time() + (++increment);
//printf("%lld\n",event->time);
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
}
}
}
if( sim_time() <= sim_queue_peek_time()){
break;
}
}
curr = list.first;
//printf("writing the queue\n");
increment=0;
while(curr != (void *)0 ) {
if(curr->tevent->mote == sim_node())
curr->tevent->time = sim_time() + (++increment);
sim_queue_insert(curr->tevent ) ;
prev = curr;
curr= curr->next;
free(prev);
}
//printf("writing done }\n");
return 0;
}
inline int check_time(sim_time_t avr_time){
//printf("%lld",sim_time());
sim_time_t temp=((sim_time_t)avr_time * sim_ticks_per_sec());
temp /= 7372800ULL;
sim_set_time(sim_time()+temp);
//printf(" %lld\n",sim_time());
if (firstCall){
firstCall = 0;
adjust_queue(temp);
}
else{
if(noNode) return 0;
if((nodeTime != 0) && (nodeTime < sim_time())){
adjust_queue(temp);
}
if(nodeTime == 0){
adjust_queue(temp);
}
}
return 0;
}
inline int adjust_queue_sch(long long increase){
bool a = 1;
bool b = 0;
int prior=0;
Event_List list;
Event_Data *curr;
Event_Data *prev;
long long increment=0;
list.first = (void *)0;
if(!sim_queue_is_empty () ){
if( sim_time() <= sim_queue_peek_time()){
//printf("Event Queue Unchanged\n");
return 0;
}
}
//printf("{ reading the queue\n");
while(!sim_queue_is_empty () ) {
sim_event_t * event = sim_queue_pop();
if (current_node != event->mote){
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
}
else{
if( sim_time() <= event->time){
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
break;
}
else{
event->time = sim_time() + (++increment);
if(a){
list.first = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
list.first->tevent = event;
curr=list.first;
curr->next=(void *)0;
a = 0;
}
else{
curr->next = ( Event_Data * ) malloc ( sizeof ( Event_Data ) ) ;
curr->next->tevent = event;
curr = curr->next;
curr->next=(void *)0;
}
}
}
if( sim_time() <= sim_queue_peek_time()){
break;
}
}
curr = list.first;
//printf("writing the queue\n");
increment=0;
while(curr != (void *)0 ) {
if(curr->tevent->mote == sim_node())
curr->tevent->time = sim_time() + (++increment);
sim_queue_insert(curr->tevent ) ;
prev = curr;
curr= curr->next;
free(prev);
}
//printf("writing done }\n");
return 0;
}
inline int check_time_sch(sim_time_t avr_time){
//printf("%lld",sim_time());
sim_time_t temp=((sim_time_t)avr_time * sim_ticks_per_sec());
temp /= 7372800ULL;
sim_set_time(sim_time()+temp);
//printf(" %lld\n",sim_time());
adjust_queue_sch(temp);
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | ecosensory/tos/sensorboards/a2d12ch/a2d12ch.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
/* Copyright (c) 2007, Ecosensory Austin Texas All rights reserved.
* This code funded by TX State San Marcos University. BSD license full text at:
* http://tinyos.cvs.sourceforge.net/tinyos/tinyos-2.x-contrib/ecosensory/license.txt
* by <NAME> <<EMAIL>>
* Rev 1.0 14 Dec 2007
*/
// A2d12ch.h
//#ifndef A2D12CH_H
//#define A2D12CH_H
#define BUFFER_SIZE 6 //reconciled with other uses of a2d12ch
#define JIFFIES 0
//default config data
//
#define CONFIG_VREF REFVOLT_LEVEL_2_5, SHT_SOURCE_ACLK, SHT_CLOCK_DIV_1, SAMPLE_HOLD_4_CYCLES, SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1
#define CHANNEL1 INPUT_CHANNEL_A0, REFERENCE_VREFplus_AVss
#define CHANNEL2 INPUT_CHANNEL_A1, REFERENCE_VREFplus_AVss
#define CHANNEL3 INPUT_CHANNEL_A2, REFERENCE_VREFplus_AVss
#define CHANNEL4 INPUT_CHANNEL_A3, REFERENCE_VREFplus_AVss
#define CHANNEL5 INPUT_CHANNEL_A4, REFERENCE_VREFplus_AVss
#define CHANNEL6 INPUT_CHANNEL_A5, REFERENCE_VREFplus_AVss
#define CHANNEL7 INPUT_CHANNEL_A6, REFERENCE_VREFplus_AVss
#define CHANNEL8 INPUT_CHANNEL_A7, REFERENCE_VREFplus_AVss
|
tinyos-io/tinyos-3.x-contrib | diku/mcs51/tos/chips/cip51/uart/serial.h | <filename>diku/mcs51/tos/chips/cip51/uart/serial.h
/*
* Copyright (c) 2008 Polaric
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of Polaric nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL POLARIC OR ITS CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
* This file defines the allowed serial settings
*
* @author <NAME> <<EMAIL>>
*
*/
#ifndef _H_SERIAL_H
#define _H_SERIAL_H
/**
* The enums are defined as multiples of 75 since Keil can't handle
* large constant enums
*/
typedef enum {
B75=1u,
B150=2U,
B300=4U,
B600=8U,
B1200=16U,
B1800=24U,
B2400=32U,
B4800=64U,
B9600=128U,
B19200=256U,
B38400=512U,
B57600=768U,
B76800=1024U,
B115200=1536U,
B230400=3072U,
B460800=6144U,
B576000=7680U,
B921600=12288U,
B1152000=15360U,
B3000000=40000U,
} ser_rate_t;
typedef enum {
par_none = 0,
// par_bit_1 = 1,
} ser_parity_t;
typedef enum {
/* CS5 = 5, */
/* CS6 = 6, */
/* CS7 = 7, */
CS8 = 8
} ser_data_bits_t;
typedef enum {
stop_bit_1 = 1,
// stop_bit_2 = 2
} ser_stop_bits_t;
#endif //_H_SERIAL_H
|
tinyos-io/tinyos-3.x-contrib | usc/bcp/src/Bcp.h | #ifndef BCP_H
#define BCP_H
#include "AM.h"
#include <message.h>
/**
* PKT_NORMAL: Indicates that a BCP packet contains source-originated data.
* PKT_NULL: Indicates that a BCP packet was dropped, and a subsequent virtual
* packet was eventually forwarded.
*/
enum{
PKT_NORMAL = 1,
PKT_NULL = 2
};
/*
* The number of times the ForwardingEngine will try to
* transmit a packet before giving up if the link layer
* supports acknowledgments. If the link layer does
* not support acknowledgments it sends the packet once.
*/
enum {
BEACON_TIME = 5000, // Milliseconds
FAST_BEACON_TIME = 35, // Milliseconds
LOG_UPDATE_TIME = 1000, // Milliseconds
REROUTE_TIME = 50, // Milliseconds
MAX_RETX_ATTEMPTS = 5, // Maximum retransmit count per link
ROUTING_TABLE_SIZE = 0x30, // Max Neighbor Count
FORWARDING_QUEUE_SIZE = 12, // Maximum forwarding queue size
SNOOP_QUEUE_SIZE = 0x5, // Maximum snoop queue size
MAX_FWD_DLY = 40, // Milliseconds of delay to forward per delay packet
FWD_DLY_PKT_COUNT = 20, // Number of estimated packet xmission times to wait between delayPackets
LINK_EST_ALPHA = 9, // Decay parameter. 9 = 90% weight of previous rate Estimation
LINK_LOSS_ALPHA = 90, // Decay parameter. 90 = 90% weight of previous link loss Estimate
LINK_LOSS_V = 2, // V Value used to weight link losses in Lyapunov Calculation
PER_HOP_MAC_DLY = 10 // Typical per-hop MAC delay of successful transmission on Tmote Sky
};
enum {
// AM types:
AM_BCP_BEACON = 0x90,
AM_BCP_DATA = 0x91,
AM_BCP_DELAY = 0x92
};
/*
* The network header that the ForwardingEngine introduces.
*/
typedef nx_struct {
nx_uint32_t bcpDelay; // Delay experienced by this packet
nx_uint16_t bcpBackpressure; // Node backpressure measurement for neighbors
nx_uint16_t nhBackpressure; // Next hop Backpressure, used by STLE, overheard by neighbors
nx_uint16_t txCount; // Total transmission count experienced by the packet
nx_uint16_t hdrChecksum; // Checksum over origin, hopCount, and originSeqNo
nx_am_addr_t origin;
nx_uint8_t hopCount; // End-to-end hop count experienced by the packet
nx_uint8_t originSeqNo;
nx_uint8_t pktType; // PKT_NORMAL | PKT_NULL
nx_uint8_t nodeTxCount; // Incremented every tx by this node, to determine bursts for STLE
nx_am_addr_t burstNotifyAddr; // In the event of a burst link available detect, set neighbor addr, else set self addr
} bcp_data_header_t;
/*
* The network header that the Beacons use.
*/
typedef nx_struct {
nx_uint16_t bcpBackpressure;
} bcp_beacon_header_t;
/*
* The network header that delay packets use.
*/
typedef nx_struct {
nx_uint32_t bcpTransferDelay;
nx_uint32_t bcpBackpressure;
nx_uint8_t delaySeqNo;
nx_uint8_t avgHopCount; // Exponental moving average of hop count seen by this node
} bcp_delay_header_t;
/*
* Defines used to determine the source of packets within
* the forwarding queue.
*/
enum {
LOCAL_SEND = 0x1,
FORWARD = 0x2,
};
/*
* An element in the ForwardingEngine send queue.
* The client field keeps track of which send client
* submitted the packet or if the packet is being forwarded
* from another node (client == 255). Retries keeps track
* of how many times the packet has been transmitted.
*/
typedef struct {
uint32_t bcpArrivalDelay;
uint32_t arrivalTime;
uint32_t firstTxTime;
uint32_t lastTxTime;
uint8_t source;
message_t * ONE_NOK msg;
uint8_t txCount;
} fe_queue_entry_t;
/**
* This structure is used by the routing engine to store
* the routing table.
*/
typedef struct {
uint16_t backpressure;
uint16_t linkPacketTxTime; // Exponential moving average in 100US units
uint16_t linkETX; // Exponential moving average of ETX (in 100ths of expected transmissions)
uint8_t lastTxNoStreakID; // Used to detect bursts of 3 successful receptions from a neighbor
uint8_t txNoStreakCount; // Used to detect bursts of 3 successful receptions from a neighbor
am_addr_t neighbor;
bool isBurstyNow; // Indicates whether the neighbor has notified of current "goodness" of link
} routing_table_entry;
/**
* This structure is used to track the last
* <source, packetID, hopCount> triplet received
* from a given neighbor.
*/
typedef struct{
am_addr_t neighbor;
am_addr_t origin;
uint8_t originSeqNo;
uint8_t hopCount;
} latestForwarded_table_entry;
#endif /* BCP_H */
|
tinyos-io/tinyos-3.x-contrib | uob/apps/UDPServices/MoteIdDb.h | <filename>uob/apps/UDPServices/MoteIdDb.h
#ifndef _MOTEIDDB_H_
#define _MOTEIDDB_H_
enum {
MOTE_NO = 25, // modify, when adding new motes in the array
ID_SIZE = 6, // 48 bits
USB_ID_SIZE = 9, // 8 chars + \0
};
struct id_addr_usbid {
uint8_t id[ID_SIZE];
ieee154_saddr_t addr;
char usbid[USB_ID_SIZE];
};
struct id_addr_usbid id_db[MOTE_NO] = {
{{0xfa, 0x49, 0x57, 0xc, 0x0, 0x0}, 0x01, "M49UH01F"}, // 1-1
{{0x3c, 0x57, 0x57, 0xc, 0x0, 0x0}, 0x02, "M49UH01H"}, // 1-2
{{0x5e, 0xf5, 0x59, 0xc, 0x0, 0x0}, 0x03, "M49UH01P"}, // 1-3
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x04, "M49UH01N"}, // 1-4
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x05, "XXXXXXXX"}, // 2-1
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x06, "XXXXXXXX"}, // 2-2
{{0x37, 0xf6, 0x59, 0xc, 0x0, 0x0}, 0x07, "M49UH01X"}, // 2-3
{{0xe1, 0x64, 0x5a, 0xc, 0x0, 0x0}, 0x08, "M49UH01U"}, // 2-4
{{0x46, 0xd, 0x6e, 0x11, 0x0, 0x0}, 0x09, "XBQD778C"}, // 3-1
{{0xba, 0x7d, 0x6b, 0x11, 0x0, 0x0}, 0x0a, "XBQD777U"}, // 3-2
{{0x19, 0xef, 0x6d, 0x11, 0x0, 0x0}, 0x0b, "XBQD0AW8"}, // 3-3
{{0x7e, 0xf0, 0x6d, 0x11, 0x0, 0x0}, 0x0c, "XBQD788D"}, // 3-4
{{0x18, 0xf4, 0x6d, 0x11, 0x0, 0x0}, 0x0d, "XBQD788X"}, // 3-5
{{0xd7, 0xc0, 0x67, 0x11, 0x0, 0x0}, 0x0e, "XBQZ75I8"}, // 4-1
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x0f, "XBQZ70H0"}, // 4-2
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x10, "XBQZ6ZP5"}, // 4-3
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x11, "XBQZ75VV"}, // 4-4
{{0xb5, 0x80, 0x68, 0x11, 0x0, 0x0}, 0x12, "XBQZ71JP"}, // 4-5
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x13, "XBQZ765W"}, // 4-6
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x14, "XBQZ71V3"}, // 4-7
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x15, "XBQZ762D"}, // 4-8
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x16, "XBQZ75VB"}, // 4-9
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x17, "XBQZ71JC"}, // 4-10
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x18, "XBRALXAX"}, // 5-1
{{0xb7, 0x8a, 0xe6, 0x12, 0x0, 0x0}, 0x19, "XBRALMBK"}, // 5-2
{{0x25, 0x3d, 0xe6, 0x12, 0x0, 0x0}, 0x1a, "XBRAIJ75"}, // 5-3
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x1b, "XBRALKED"}, // 5-4
{{0x89, 0x9d, 0xe6, 0x12, 0x0, 0x0}, 0x1c, "XBRAHZIZ"}, // 5-5
{{0x8d, 0x65, 0xe6, 0x12, 0x0, 0x0}, 0x1d, "XBRAIIYF"}, // 6-1
{{0x36, 0xbb, 0xe6, 0x12, 0x0, 0x0}, 0x1e, "XBRAHYAZ"}, // 6-2
{{0xc3, 0x88, 0xe6, 0x12, 0x0, 0x0}, 0x1f, "XBRAHY77"}, // 6-3 // USUALLY USED AS SNIFFER
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x20, "XBRAI271"}, // 6-4
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x21, "XBRAIG80"}, // 6-5
{{0x7e, 0xe1, 0x60, 0x13, 0x0, 0x0}, 0x22, "XBSANW9R"}, // 7-1
{{0x87, 0xdd, 0x60, 0x13, 0x0, 0x0}, 0x23, "XBSAHAIS"}, // 7-2
{{0x80, 0xb9, 0x60, 0x13, 0x0, 0x0}, 0x24, "XBOW0000"}, // 7-3
{{0x2c, 0xeb, 0x60, 0x13, 0x0, 0x0}, 0x25, "XBSAHB91"}, // 7-4
{{0x2c, 0xeb, 0x60, 0x13, 0x0, 0x0}, 0x26, "XBSAHB0W"}, // 7-5
{{0x7d, 0xbe, 0x60, 0x13, 0x0, 0x0}, 0x27, "XBSANW99"}, // 7-6
{{0xbf, 0xf0, 0x60, 0x13, 0x0, 0x0}, 0x28, "XBSANWCM"}, // 7-7
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x29, "XXXXXXXX"}, // 7-8
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x2a, "XXXXXXXX"}, // 7-9
//{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 0x2b, "XXXXXXXX"}, // 7-10
};
#endif
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/chips/atm128/timer/Atm128Timer.h | // $Id: Atm128Timer.h,v 1.1 2014/11/26 19:31:34 carbajor Exp $
/*
* Copyright (c) 2004-2005 Crossbow Technology, Inc. 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
/*
* This file contains the configuration constants for the Atmega128
* clocks and timers.
*
* @author <NAME>
* @author <NAME>
* @date September 21 2005
*/
#ifndef _H_Atm128Timer_h
#define _H_Atm128Timer_h
//====================== 8 bit Timers ==================================
// Timer0 and Timer2 are 8-bit timers.
/* 8-bit Timer0 clock source select bits CS02, CS01, CS0 (page 103,
ATmega128L data sheet Rev. 2467M-AVR-11/04 */
enum {
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 {
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,
};
/* Common scales across both 8-bit and 16-bit clocks. */
enum {
AVR_CLOCK_OFF = 0,
AVR_CLOCK_ON = 1,
AVR_CLOCK_DIVIDE_8 = 2,
};
/* 8-bit Waveform Generation Modes */
enum {
ATM128_WAVE8_NORMAL = 0,
ATM128_WAVE8_PWM,
ATM128_WAVE8_CTC,
ATM128_WAVE8_PWM_FAST,
};
/* 8-bit Timer compare settings */
enum {
ATM128_COMPARE_OFF = 0, //!< compare disconnected
ATM128_COMPARE_TOGGLE, //!< toggle on match (PWM reserved
ATM128_COMPARE_CLEAR, //!< clear on match (PWM downcount)
ATM128_COMPARE_SET, //!< set on match (PWN upcount)
};
/* 8-bit Timer Control Register */
typedef union
{
uint8_t flat;
struct {
uint8_t cs : 3; //!< Clock Source Select
uint8_t wgm1 : 1; //!< Waveform generation mode (high bit)
uint8_t com : 2; //!< Compare Match Output
uint8_t wgm0 : 1; //!< Waveform generation mode (low bit)
uint8_t foc : 1; //!< Force Output Compare
} bits;
} Atm128TimerControl_t;
typedef Atm128TimerControl_t Atm128_TCCR0_t; //!< Timer0 Control Register
typedef uint8_t Atm128_TCNT0_t; //!< Timer0 Control Register
typedef uint8_t Atm128_OCR0_t; //!< Timer0 Output Compare Register
typedef Atm128TimerControl_t Atm128_TCCR2_t; //!< Timer2 Control Register
typedef uint8_t Atm128_TCNT2_t; //!< Timer2 Control Register
typedef uint8_t Atm128_OCR2_t; //!< Timer2 Output Compare Register
// Timer2 shares compare lines with Timer1C
/* Asynchronous Status Register -- Timer0 */
typedef union
{
uint8_t flat;
struct {
uint8_t tcr0ub : 1; //!< Timer0 Control Resgister Update Busy
uint8_t ocr0ub : 1; //!< Timer0 Output Compare Register Update Busy
uint8_t tcn0ub : 1; //!< Timer0 Update Busy
uint8_t as0 : 1; //!< Asynchronous Timer/Counter (off=CPU,on=32KHz osc)
uint8_t rsvd : 4; //!< Reserved
} bits;
} Atm128Assr_t;
/* Timer/Counter Interrupt Mask Register */
typedef union
{
uint8_t flat;
struct {
uint8_t toie0 : 1; //!< Timer0 Overflow Interrupt Enable
uint8_t ocie0 : 1; //!< Timer0 Output Compare Interrupt Enable
uint8_t toie1 : 1; //!< Timer1 Overflow Interrupt Enable
uint8_t ocie1b: 1; //!< Timer1 Output Compare B Interrupt Enable
uint8_t ocie1a: 1; //!< Timer1 Output Compare A Interrupt Enable
uint8_t ticie1: 1; //!< Timer1 Input Capture Enable
uint8_t toie2 : 1; //!< Timer2 Overflow Interrupt Enable
uint8_t ocie2 : 1; //!< Timer2 Output Compare Interrupt Enable
} bits;
} Atm128_TIMSK_t;
// + Note: Contains some 16-bit Timer flags
/* Timer/Counter Interrupt Flag Register */
typedef union
{
uint8_t flat;
struct {
uint8_t tov0 : 1; //!< Timer0 Overflow Flag
uint8_t ocf0 : 1; //!< Timer0 Output Compare Flag
uint8_t tov1 : 1; //!< Timer1 Overflow Flag
uint8_t ocf1b : 1; //!< Timer1 Output Compare B Flag
uint8_t ocf1a : 1; //!< Timer1 Output Compare A Flag
uint8_t icf1 : 1; //!< Timer1 Input Capture Flag
uint8_t tov2 : 1; //!< Timer2 Overflow Flag
uint8_t ocf2 : 1; //!< Timer2 Output Compare Flag
} bits;
} Atm128_TIFR_t;
// + Note: Contains some 16-bit Timer flags
/* Timer/Counter Interrupt Flag Register */
typedef union
{
uint8_t flat;
struct {
uint8_t psr321 : 1; //!< Prescaler Reset Timer1,2,3
uint8_t psr0 : 1; //!< Prescaler Reset Timer0
uint8_t pud : 1; //!<
uint8_t acme : 1; //!<
uint8_t rsvd : 3; //!< Reserved
uint8_t tsm : 1; //!< Timer/Counter Synchronization Mode
} bits;
} Atm128_SFIOR_t;
//====================== 16 bit Timers ==================================
// Timer1 and Timer3 are both 16-bit, and have three compare channels: (A,B,C)
enum {
ATM128_TIMER_COMPARE_NORMAL = 0,
ATM128_TIMER_COMPARE_TOGGLE,
ATM128_TIMER_COMPARE_CLEAR,
ATM128_TIMER_COMPARE_SET
};
/* Timer/Counter Control Register A Type */
typedef union
{
uint8_t flat;
struct {
uint8_t wgm10 : 2; //!< Waveform generation mode
uint8_t comC : 2; //!< Compare Match Output C
uint8_t comB : 2; //!< Compare Match Output B
uint8_t comA : 2; //!< Compare Match Output A
} bits;
} Atm128TimerCtrlCompare_t;
/* Timer1 Compare Control Register A */
typedef Atm128TimerCtrlCompare_t Atm128_TCCR1A_t;
/* Timer3 Compare Control Register A */
typedef Atm128TimerCtrlCompare_t Atm128_TCCR3A_t;
/* 16-bit Waveform Generation Modes */
enum {
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,
};
/* Timer/Counter Control Register B Type */
typedef union
{
uint8_t flat;
struct {
uint8_t cs : 3; //!< Clock Source Select
uint8_t wgm32 : 2; //!< Waveform generation mode
uint8_t rsvd : 1; //!< Reserved
uint8_t ices1 : 1; //!< Input Capture Edge Select (1=rising, 0=falling)
uint8_t icnc1 : 1; //!< Input Capture Noise Canceler
} bits;
} Atm128TimerCtrlCapture_t;
/* Timer1 Control Register B */
typedef Atm128TimerCtrlCapture_t Atm128_TCCR1B_t;
/* Timer3 Control Register B */
typedef Atm128TimerCtrlCapture_t Atm128_TCCR3B_t;
/* Timer/Counter Control Register C Type */
typedef union
{
uint8_t flat;
struct {
uint8_t rsvd : 5; //!< Reserved
uint8_t focC : 1; //!< Force Output Compare Channel C
uint8_t focB : 1; //!< Force Output Compare Channel B
uint8_t focA : 1; //!< Force Output Compare Channel A
} bits;
} Atm128TimerCtrlClock_t;
/* Timer1 Control Register B */
typedef Atm128TimerCtrlClock_t Atm128_TCCR1C_t;
/* Timer3 Control Register B */
typedef Atm128TimerCtrlClock_t Atm128_TCCR3C_t;
// Read/Write these 16-bit Timer registers according to p.112:
// Access as bytes. Read low before high. Write high before low.
typedef uint8_t Atm128_TCNT1H_t; //!< Timer1 Register
typedef uint8_t Atm128_TCNT1L_t; //!< Timer1 Register
typedef uint8_t Atm128_TCNT3H_t; //!< Timer3 Register
typedef uint8_t Atm128_TCNT3L_t; //!< Timer3 Register
/* Contains value to continuously compare with Timer1 */
typedef uint8_t Atm128_OCR1AH_t; //!< Output Compare Register 1A
typedef uint8_t Atm128_OCR1AL_t; //!< Output Compare Register 1A
typedef uint8_t Atm128_OCR1BH_t; //!< Output Compare Register 1B
typedef uint8_t Atm128_OCR1BL_t; //!< Output Compare Register 1B
typedef uint8_t Atm128_OCR1CH_t; //!< Output Compare Register 1C
typedef uint8_t Atm128_OCR1CL_t; //!< Output Compare Register 1C
/* Contains value to continuously compare with Timer3 */
typedef uint8_t Atm128_OCR3AH_t; //!< Output Compare Register 3A
typedef uint8_t Atm128_OCR3AL_t; //!< Output Compare Register 3A
typedef uint8_t Atm128_OCR3BH_t; //!< Output Compare Register 3B
typedef uint8_t Atm128_OCR3BL_t; //!< Output Compare Register 3B
typedef uint8_t Atm128_OCR3CH_t; //!< Output Compare Register 3C
typedef uint8_t Atm128_OCR3CL_t; //!< Output Compare Register 3C
/* Contains counter value when event occurs on ICPn pin. */
typedef uint8_t Atm128_ICR1H_t; //!< Input Capture Register 1
typedef uint8_t Atm128_ICR1L_t; //!< Input Capture Register 1
typedef uint8_t Atm128_ICR3H_t; //!< Input Capture Register 3
typedef uint8_t Atm128_ICR3L_t; //!< Input Capture Register 3
/* Extended Timer/Counter Interrupt Mask Register */
typedef union
{
uint8_t flat;
struct {
uint8_t ocie1c: 1; //!< Timer1 Output Compare C Interrupt Enable
uint8_t ocie3c: 1; //!< Timer3 Output Compare C Interrupt Enable
uint8_t toie3 : 1; //!< Timer3 Overflow Interrupt Enable
uint8_t ocie3b: 1; //!< Timer3 Output Compare B Interrupt Enable
uint8_t ocie3a: 1; //!< Timer3 Output Compare A Interrupt Enable
uint8_t ticie3: 1; //!< Timer3 Input Capture Interrupt Enable
uint8_t rsvd : 2; //!< Timer2 Output Compare Interrupt Enable
} bits;
} Atm128_ETIMSK_t;
/* Extended Timer/Counter Interrupt Flag Register */
typedef union
{
uint8_t flat;
struct {
uint8_t ocf1c : 1; //!< Timer1 Output Compare C Flag
uint8_t ocf3c : 1; //!< Timer3 Output Compare C Flag
uint8_t tov3 : 1; //!< Timer/Counter Overflow Flag
uint8_t ocf3b : 1; //!< Timer3 Output Compare B Flag
uint8_t ocf3a : 1; //!< Timer3 Output Compare A Flag
uint8_t icf3 : 1; //!< Timer3 Input Capture Flag
uint8_t rsvd : 2; //!< Reserved
} bits;
} Atm128_ETIFR_t;
/* Resource strings for timer 1 and 3 compare registers */
#define UQ_TIMER1_COMPARE "atm128.timer1"
#define UQ_TIMER3_COMPARE "atm128.timer3"
#endif //_H_Atm128Timer_h
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/chips/atm128/i2c/Atm128I2C.h | // $Id: Atm128I2C.h,v 1.1 2014/11/26 19:31:33 carbajor Exp $
/*
* Copyright (c) 2004-2005 Crossbow Technology, Inc. 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
// @author <NAME> <<EMAIL>>
#ifndef _H_Atm128I2C_h
#define _H_Atm128I2C_h
#define ATM128_I2C_SLA_WRITE 0x00
#define ATM128_I2C_SLA_READ 0x01
#define UQ_ATM128_I2CMASTER "Atm128I2CMasterC.I2CPacket"
enum {
ATM128_I2C_BUSERROR = 0x00,
ATM128_I2C_START = 0x08,
ATM128_I2C_RSTART = 0x10,
ATM128_I2C_MW_SLA_ACK = 0x18,
ATM128_I2C_MW_SLA_NACK = 0x20,
ATM128_I2C_MW_DATA_ACK = 0x28,
ATM128_I2C_MW_DATA_NACK = 0x30,
ATM128_I2C_M_ARB_LOST = 0x38,
ATM128_I2C_MR_SLA_ACK = 0x40,
ATM128_I2C_MR_SLA_NACK = 0x48,
ATM128_I2C_MR_DATA_ACK = 0x50,
ATM128_I2C_MR_DATA_NACK = 0x58
};
#endif // _H_Atm128I2C_h
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinynode_2/DS2751.h | <gh_stars>1-10
//This code is a modified version of code from the Heliomote project
#ifndef DS2751_H_
#define DS2751_H_
#endif
|
tinyos-io/tinyos-3.x-contrib | intelmote2/tools/platforms/intelmote2/jflashmm/src/Global_Variables.h | /******************************************************************************
**
** COPYRIGHT (C) 2000, 2001, 2002 Intel Corporation.
**
** The information in this file is furnished for informational use
** only, is subject to change without notice, and should not be construed as
** a commitment by Intel Corporation. Intel Corporation assumes no
** responsibility or liability for any errors or inaccuracies that may appear
** in this document or any software that may be provided in association with
** this document.
**
** FILENAME: Global_Variables.h
**
** PURPOSE: declares all global varibales used by the Jflash software
**
** LAST MODIFIED: $Modtime: 2/27/03 11:26a $
******************************************************************************/
/*
*******************************************************************************
Globals
*******************************************************************************
*/
int lpt_address; // Global variable assigned to parallel port address
int lpt_ECR; // global for LPT extended control register
int lpt_CTL; // global for the LPT control port
int lpt_STAT; // global for LPT status register
DWORD MILLISECOND_COUNT = 0; // global to keep an approx loop count for a ms
int block_number = 0; // Global variable for determining the block number
char filename[MAX_IN_LENGTH] = "download.bin"; // Global variable for storing the file name
char data_filename[MAX_IN_LENGTH] = "DBPXA250"; // Global variable for the platform data file
char flash_data_filename[MAX_IN_LENGTH] = "Flash_18_2_32.dat"; // Global variable for the flash data file
char AppHome[_MAX_PATH]; // Global variable with application home
char PathInformation[4][_MAX_PATH]; // Global variable with the path information
char VERSION_LOCK[11] = "VL00000001";
char FLASH_VERSION_LOCK[11] = "VLF0000001";
CABLE_TYPES CableType = Insight_Jtag; // Global variable for specifying the Cable type
DWORD ChipSelect0 = 0; // Global variable for chip select 0
DWORD ChipSelect1 = 0; // Global variable for chip select 1
DWORD ChipSelect2 = 0; // Global variable for chip select 2
DWORD ChipSelect3 = 0; // Global variable for chip select 3
DWORD ChipSelect4 = 0; // Global variable for chip select 4
DWORD ChipSelect5 = 0; // Global variable for chip select 5
DWORD OutputEnable = 0; // Global variable for output enable
DWORD WriteEnable = 0; // Global variable for write enable
DWORD MdUpperControl = 0; // Global variable for MD upper control
DWORD MdLowerControl = 0; // Global variable for MD lower control
DWORD ReadWriteMode = 0; // Global variable for Read Write access mode
DWORD IR_Idcode = 0; // Global variable for the IDCODE instruction of the IR
DWORD IR_Bypass = 0; // Global variable for the BYPASS instruction of the IR
DWORD IR_Extest = 0; // Global variable for the EXTEST instruction of the IR
DWORD ChainLength = 0; // Global variable for the chain length of the selected platform
DWORD UnlockFlashCtrl1 = 0; // unlock flash control pin 1
DWORD UnlockFlashCtrl1Lev = 0; // unlock flash control pin 1 level for unlock
DWORD LockFlashCtrl1Lev = 0; // lock1 flash level
DWORD UnlockFlashCtrl2 = 0; // unlock flash control pin 2
DWORD UnlockFlashCtrl2Lev = 0; // unlock flash control pin 2 level for unlock
DWORD LockFlashCtrl2Lev = 0; // lock2 flash level
DWORD UnlockFlashCtrl3 = 0; // unlock flash control pin 3
DWORD UnlockFlashCtrl3Lev = 0; // unlock flash control pin 3 level for unlock
DWORD LockFlashCtrl3Lev = 0; // lock3 flash level
DWORD UnlockFlashCtrl4 = 0; // unlock flash control pin 4
DWORD UnlockFlashCtrl4Lev = 0; // unlock flash control pin 4 level for unlock
DWORD LockFlashCtrl4Lev = 0; // lock4 flash level
DWORD CSR_LADDR[6]; // array of chip select region low addresses
DWORD CSR_HADDR[6]; // array of chip select regions high addresses
DWORD CSR1 = 6; // the chip select for region 1. 6 is illegal and is here to flag an error if not defined.
DWORD CSR2 = 6; // the chip select for region 2
DWORD CSR3 = 6; // the chip select for region 3
DWORD CSR4 = 6; // the chip select for region 4
DWORD CSR5 = 6; // the chip select for region 5
DWORD CSR6 = 6; // the chip select for region 6
// some flash related globals
DWORD BlockEraseTime = 10;
DWORD FlashBufferSize = 32;
DWORD FlashDeviceSize = 0;
bool REGION_STATUS[10]; // array of region status
DWORD REGION_NUM_BLOCKS[10]; // number of blocks in the region
DWORD REGION_BLOCKSIZE[10]; // The size of the blocks in that region
DWORD REGION_START_ADDR[10]; // The start address of the region
DWORD REGION_END_ADDR[10]; // the end address of the region
DWORD BLOCK_ADDRESS[512]; // up to 512 unique block addresses
int ADDR_MULT = 4; // addressing multiplier or divider for flash
int WorkBufSize = 0; // Global variable for setting the work buffer size
int IrLength = 0; // Global variable for setting the correct IR length
// Chain device data
bool DEVICESTATUS[5]; // enabled or disabled
DWORD DEVICEIRLENGTH[5]; // length of IR to set bypass
bool DEVICETYPE[5]; // true if controller
bool DEVICEISLAST[5];
int DEVICE_CONTROLLER = 0; // which device is the controller
int DEVICES_BEFORE = 0;
int DEVICES_AFTER = 0;
int DEVICES_IN_CHAIN = 0;
#define MAX_HANDLER_SIZE 0x200
bool PlatformIs16bit = false; // Global variable for diferentiating between 16bit and 32bit platforms
bool PlatformIsBulverdeOrDimebox = true; // Global variable to determine if the selected platform is bulverde or dimebox
bool PlatformIsBulverdeDimeboxShortChain = false; // Global variable for determining whether it's a short chain or not
bool PlatformIsBulverdeDimeboxLongChain = true; // Global variable for determining whether it's a long chain or not
bool Debug_Mode = false;
bool UsageShown = false;
bool AskQuestions = true;
unsigned long gpdr[4] = {0x40e0000c,0x40e00010,0x40e00014,0x40e0010c};
unsigned long gpsr[4] = {0x40e00018,0x40e0001c,0x40e00020,0x40e00118};
unsigned long gpcr[4] = {0x40e00024,0x40e00028,0x40e0002c,0x40e00124};
// Globals for flash commands and query codes. Assumes 32 bit as default
DWORD F_READ_ARRAY = 0x00FF00FFL;
DWORD F_READ_IDCODES = 0x00900090L;
DWORD F_READ_QUERY = 0x00980098L;
DWORD F_READ_STATUS = 0x00700070L;
DWORD F_CLEAR_STATUS = 0x00500050L;
DWORD F_WRITE_BUFFER = 0x00E800E8L;
DWORD F_WORDBYTE_PROG = 0x00400040L;
DWORD F_BLOCK_ERASE = 0x00200020L;
DWORD F_BLOCK_ERASE_2ND = 0x00D000D0L;
DWORD F_BLK_ERASE_PS = 0x00B000B0L;
DWORD F_BLK_ERASE_PR = 0x00D000D0L;
DWORD F_CONFIGURATION = 0x00B800B8L;
DWORD F_SET_READ_CFG_REG = 0x00600060L;
DWORD F_SET_READ_CFG_REG_2ND = 0x00030003L;
DWORD F_SET_BLOCK_LOCK = 0x00600060L;
DWORD F_SET_BLOCK_LOCK_2ND = 0x00010001L;
DWORD F_CLEAR_BLOCK_LOCK = 0x00600060L;
DWORD F_CLEAR_BLOCK_LOCK_2ND =0x00D000D0L;
DWORD F_PROTECTION = 0x00C000C0L;
DWORD F_ATTR_Q = 0x00510051L;
DWORD F_ATTR_R = 0x00520052L;
DWORD F_ATTR_Y = 0x00590059L;
DWORD F_BLOCK_LOCKED = 0x00010001L;
DWORD F_STATUS_READY = 0x00800080L;
FILE *in_file;
FILE *data_file_pointer;
FILE *flash_file_pointer;
int out_dat[MAX_DR_SIZE];
bool UNLOCKBLOCK = false;
bool HASLOCKCONTROLS = false; // Is there external locking for the flash?
unsigned long MAX_DATA = 230;
unsigned long MAX_FLASH_DATA = 60;
char WORDARRAY[230][132]; // the capture of all strings from the data file
char FLASHWORDARRAY[60][132]; // the capture of all strings from the data file
DWORD addr_order[27];
DWORD input_dat_order[33];
DWORD dat_order[33];
DWORD pin[1000]; // max JTAG boundary length of 1000 bits
// The following hardcoded values need to be moved to the data files.
// hardcode here for now
// bulverde only:
DWORD IR_DCSR = 0x9;
DWORD IR_DBGrx = 0x2;
DWORD IR_DBGtx = 0x10;
DWORD IR_LDIC = 0x7;
// Position of data in the platform data file
#define p_processor 0
#define p_devsys 1
#define p_dataver 2
#define p_verlock 3
#define p_blength 4
#define p_irlength 5
#define p_extest 6
#define p_idcode 7
#define p_bypass 8
#define p_cs0 9
#define p_cs1 10
#define p_cs2 11
#define p_cs3 12
#define p_cs4 13
#define p_cs5 14
#define p_nOE_OUT 15
#define p_nWE_OUT 16
#define p_mdupper_ctrl 17
#define p_mdlower_ctrl 18
#define p_RD_nWR_OUT 19
#define p_cp1 20
#define p_a0 21
#define p_a1 22
#define p_a2 23
#define p_a3 24
#define p_a4 25
#define p_a5 26
#define p_a6 27
#define p_a7 28
#define p_a8 29
#define p_a9 30
#define p_a10 31
#define p_a11 32
#define p_a12 33
#define p_a13 34
#define p_a14 35
#define p_a15 36
#define p_a16 37
#define p_a17 38
#define p_a18 39
#define p_a19 40
#define p_a20 41
#define p_a21 42
#define p_a22 43
#define p_a23 44
#define p_a24 45
#define p_a25 46
#define p_d0in 47
#define p_d1in 48
#define p_d2in 49
#define p_d3in 50
#define p_d4in 51
#define p_d5in 52
#define p_d6in 53
#define p_d7in 54
#define p_d8in 55
#define p_d9in 56
#define p_d10in 57
#define p_d11in 58
#define p_d12in 59
#define p_d13in 60
#define p_d14in 61
#define p_d15in 62
#define p_d16in 63
#define p_d17in 64
#define p_d18in 65
#define p_d19in 66
#define p_d20in 67
#define p_d21in 68
#define p_d22in 69
#define p_d23in 70
#define p_d24in 71
#define p_d25in 72
#define p_d26in 73
#define p_d27in 74
#define p_d28in 75
#define p_d29in 76
#define p_d30in 77
#define p_d31in 78
#define p_d0out 79
#define p_d1out 80
#define p_d2out 81
#define p_d3out 82
#define p_d4out 83
#define p_d5out 84
#define p_d6out 85
#define p_d7out 86
#define p_d8out 87
#define p_d9out 88
#define p_d10out 89
#define p_d11out 90
#define p_d12out 91
#define p_d13out 92
#define p_d14out 93
#define p_d15out 94
#define p_d16out 95
#define p_d17out 96
#define p_d18out 97
#define p_d19out 98
#define p_d20out 99
#define p_d21out 100
#define p_d22out 101
#define p_d23out 102
#define p_d24out 103
#define p_d25out 104
#define p_d26out 105
#define p_d27out 106
#define p_d28out 107
#define p_d29out 108
#define p_d30out 109
#define p_d31out 110
#define p_cp2 111
#define p_datawidth 112
#define p_m_reg1_low 113
#define p_m_reg1_high 114
#define p_m_reg1_cs 115
#define p_m_reg2_low 116
#define p_m_reg2_high 117
#define p_m_reg2_cs 118
#define p_m_reg3_low 119
#define p_m_reg3_high 120
#define p_m_reg3_cs 121
#define p_m_reg4_low 122
#define p_m_reg4_high 123
#define p_m_reg4_cs 124
#define p_m_reg5_low 125
#define p_m_reg5_high 126
#define p_m_reg5_cs 127
#define p_m_reg6_low 128
#define p_m_reg6_high 129
#define p_m_reg6_cs 130
#define p_proc_id 131
#define p_proc_mfg 132
#define p_proc_std 133
#define p_CID0 134
#define p_CID1 135
#define p_CID2 136
#define p_CID3 137
#define p_CID4 138
#define p_CID5 139
#define p_CID6 140
#define p_CID7 141
#define p_CID8 142
#define p_CID9 143
#define p_CID10 144
#define p_CID11 145
#define p_CID12 146
#define p_CID13 147
#define p_CID14 148
#define p_CID15 149
#define p_nh1 150
#define p_nh2 151
#define p_nh3 152
#define p_nh4 153
#define p_nh5 154
#define p_nh6 155
#define p_nh7 156
#define p_nh8 157
#define p_nh9 158
#define p_nh10 159
#define p_nh11 160
#define p_nh12 161
#define p_nh13 162
#define p_nh14 163
#define p_nh15 164
#define p_nh16 165
#define p_nh17 166
#define p_nh18 167
#define p_nh19 168
#define p_nh20 169
#define p_nh21 170
#define p_nh22 171
#define p_nh23 172
#define p_nh24 173
#define p_nh25 174
#define p_nh26 175
#define p_nh27 176
#define p_nh28 177
#define p_nh29 178
#define p_nh30 179
#define p_nh31 180
#define p_nh32 181
#define p_nh33 182
#define p_nh34 183
#define p_nh35 184
#define p_nh36 185
#define p_nh37 186
#define p_nh38 187
#define p_nh39 188
#define p_nh40 189
#define p_nh41 190
#define p_nh42 191
#define p_nh43 192
#define p_nh44 193
#define p_nh45 194
#define p_nh46 195
#define p_nh47 196
#define p_dev1_stat 197
#define p_dev1_bits 198
#define p_dev1_type 199
#define p_dev1_islast 200
#define p_dev2_stat 201
#define p_dev2_bits 202
#define p_dev2_type 203
#define p_dev2_islast 204
#define p_dev3_stat 205
#define p_dev3_bits 206
#define p_dev3_type 207
#define p_dev3_islast 208
#define p_dev4_stat 209
#define p_dev4_bits 210
#define p_dev4_type 211
#define p_dev4_islast 212
#define p_dev5_stat 213
#define p_dev5_bits 214
#define p_dev5_type 215
#define p_dev5_islast 216
#define p_unlctl1 217
#define p_unlctl1_lev 218
#define p_unlctl2 219
#define p_unlctl2_lev 220
#define p_unlctl3 221
#define p_unlctl3_lev 222
#define p_unlctl4 223
#define p_unlctl4_lev 224
#define p_cp3 225
#define p_fdevsacross 226
#define p_nsdcas 227
#define P_progmode 228
// position of data in the flash data file
#define pf_type 0
#define pf_dataver 1
#define pf_verlock 2
#define pf_ertime 3
#define pf_bufsize 4
#define pf_reg0status 5
#define pf_reg0number 6
#define pf_reg0blsize 7
#define pf_reg0start 8
#define pf_reg0end 9
#define pf_reg1status 10
#define pf_reg1number 11
#define pf_reg1blsize 12
#define pf_reg1start 13
#define pf_reg1end 14
#define pf_reg2status 15
#define pf_reg2number 16
#define pf_reg2blsize 17
#define pf_reg2start 18
#define pf_reg2end 19
#define pf_reg3status 20
#define pf_reg3number 21
#define pf_reg3blsize 22
#define pf_reg3start 23
#define pf_reg3end 24
#define pf_reg4status 25
#define pf_reg4number 26
#define pf_reg4blsize 27
#define pf_reg4start 28
#define pf_reg4end 29
#define pf_reg5status 30
#define pf_reg5number 31
#define pf_reg5blsize 32
#define pf_reg5start 33
#define pf_reg5end 34
#define pf_reg6status 35
#define pf_reg6number 36
#define pf_reg6blsize 37
#define pf_reg6start 38
#define pf_reg6end 39
#define pf_reg7status 40
#define pf_reg7number 41
#define pf_reg7blsize 42
#define pf_reg7start 43
#define pf_reg7end 44
#define pf_reg8status 45
#define pf_reg8number 46
#define pf_reg8blsize 47
#define pf_reg8start 48
#define pf_reg8end 49
#define pf_reg9status 50
#define pf_reg9number 51
#define pf_reg9blsize 52
#define pf_reg9start 53
#define pf_reg9end 54
#define pf_cp1 55
|
tinyos-io/tinyos-3.x-contrib | eon/apps/eserver/impl/stargate/mTypes.h | <gh_stars>1-10
#ifndef _MTYPES_H_
#define _MTYPES_H_
int suffixT(char *val, char *suffix) {
int len = strlen(val);
int s_len = strlen(suffix);
int i;
for (i=0;i<s_len;i++) {
if (val[len-i]!=suffix[s_len-i])
return 0;
}
return 1;
}
bool
TestVideo (char *value)
{
if(suffixT(value,".mp4")||suffixT(value,".mpeg")||suffixT(value,".mov"))
{ return TRUE; }
return FALSE;
}
bool
TestAudio (char *value)
{
if(suffixT(value,".mp3")||suffixT(value,".wav"))
{ return TRUE; }
return FALSE;
}
bool
TestImage (char *value)
{
if(suffixT(value,".png")||suffixT(value,".gif")||suffixT(value,".jpg"))
{ return TRUE; }
return FALSE;
}
bool
TestText (char *value)
{
return TRUE;
}
#endif // _MTYPES_H_
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/telos/fluxconst.h | <gh_stars>1-10
#ifndef FLUXCONST_H_INCLUDED
#define FLUXCONST_H_INCLUDED
//define error codes
#define ERR_OK 0
#define ERR_NOMEMORY 1
#define ERR_FREEMEM 2
#define ERR_QUEUE 3
#define ERR_USR 10
#endif
|
tinyos-io/tinyos-3.x-contrib | cedt/tos/chips/cc1000/sim/CC1000Const.h | <gh_stars>0
// $Id: CC1000Const.h,v 1.4 2007/09/05 06:11:10 venkatesh2012 Exp $
/* -*- Mode: C; c-basic-indent: 2; indent-tabs-mode: nil -*- */
/* tab:4
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
* this license. If you do not agree to this license, do not download,
* install, copy or use the software.
*
* Intel Open Source License
*
* Copyright (c) 2002 Intel Corporation
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/
/*
* Constants for CC1000 radio
*
* @author <NAME>
*/
/*
* Added constants required for CC1000 radio Simulation for TOSSIM
*
* @author <NAME>
* @author <NAME>
*
*/
#ifndef CC1000CONST_H
#define CC1000CONST_H
#include <CC1000Msg.h>
#include <atm128const.h>
//CC1000 Reg Array
#define CC1K_MAX_REGS 0x47
uint8_t CC1KRegFile[TOSSIM_MAX_NODES][CC1K_MAX_REGS];
//CC1000 Reg Access
#define CC1K_REG_ACCESS(x) CC1KRegFile[sim_node()][x]
// Bit operators using bit number
#define CC1K_SET_BIT(reg, bit) ((CC1K_REG_ACCESS(reg)) |= _BV(bit))
#define CC1K_CLR_BIT(reg, bit) ((CC1K_REG_ACCESS(reg)) &= ~_BV(bit))
#define CC1K_READ_BIT(reg, bit) (((CC1K_REG_ACCESS(reg)) & _BV(bit)) != 0)
//Tx power mode values
float CC1K_RADIO_PowerMode[256] = {0.0,
-20.000000,
-18.000000,
-15.000000,
-12.000000,
-10.000000,
-8.000000,
-7.000000,
-6.000000,
-5.000000,
-4.000000,
-3.000000,
-2.000000,
-1.495854,
-1.000000,
0.000000,
1.061160,
2.041808,
2.944313,
3.771047,
4.524382,
5.206689,
5.820338,
6.367701,
6.851149,
7.273054,
7.635786,
7.941716,
8.193216,
8.392658,
8.542411,
8.644848,
8.702340,
8.717257,
8.691971,
8.628853,
8.530275,
8.398607,
8.236220,
8.045486,
7.828777,
7.588462,
7.326914,
7.046503,
6.749601,
6.438579,
6.115807,
5.783658,
5.444503,
5.100712,
4.754657,
4.408709,
4.065238,
3.726618,
3.395217,
3.073409,
2.763563,
2.468051,
2.189244,
1.929514,
1.691232,
1.476768,
1.288494,
1.128781,
1.000000,
0.903771,
0.838702,
0.802653,
0.793480,
0.809042,
0.847196,
0.905799,
0.982711,
1.075787,
1.182887,
1.301867,
1.430586,
1.566901,
1.708669,
1.853750,
2.000000,
2.145582,
2.289879,
2.432577,
2.573365,
2.711930,
2.847958,
2.981139,
3.111158,
3.237703,
3.360462,
3.479123,
3.593372,
3.702896,
3.807384,
3.906523,
4.000000,
4.087632,
4.169752,
4.246823,
4.319310,
4.387673,
4.452377,
4.513885,
4.572659,
4.629162,
4.683858,
4.737209,
4.789678,
4.841729,
4.893824,
4.946427,
5.000000,
5.054917,
5.111192,
5.168752,
5.227522,
5.287427,
5.348392,
5.410344,
5.473208,
5.536909,
5.601373,
5.666525,
5.732290,
5.798595,
5.865365,
5.932525,
6.000000,
6.067701,
6.135479,
6.203168,
6.270603,
6.337620,
6.404053,
6.469738,
6.534509,
6.598202,
6.660651,
6.721692,
6.781160,
6.838890,
6.894716,
6.948475,
7.000000,
7.049167,
7.096009,
7.140599,
7.183010,
7.223316,
7.261588,
7.297900,
7.332325,
7.364936,
7.395806,
7.425009,
7.452616,
7.478701,
7.503337,
7.526597,
7.548554,
7.569281,
7.588851,
7.607337,
7.624812,
7.641349,
7.657021,
7.671901,
7.686062,
7.699577,
7.712518,
7.724960,
7.736975,
7.748635,
7.760015,
7.771186,
7.782222,
7.793197,
7.804182,
7.815251,
7.826477,
7.837933,
7.849692,
7.861827,
7.874410,
7.887516,
7.901216,
7.915585,
7.930694,
7.946617,
7.963427,
7.981197,
8.000000,
8.019891,
8.040854,
8.062855,
8.085860,
8.109835,
8.134746,
8.160560,
8.187243,
8.214760,
8.243078,
8.272162,
8.301980,
8.332496,
8.363677,
8.395490,
8.427899,
8.460872,
8.494374,
8.528372,
8.562831,
8.597718,
8.632999,
8.668639,
8.704606,
8.740864,
8.777381,
8.814121,
8.851052,
8.888139,
8.925349,
8.962647,
9.000000,
9.037373,
9.074734,
9.112047,
9.149279,
9.186396,
9.223365,
9.260150,
9.296719,
9.333037,
9.369071,
9.404786,
9.440149,
9.475126,
9.509683,
9.543785,
9.577400,
9.610492,
9.643029,
9.674976,
9.706300,
9.736966,
9.766940,
9.796189,
9.824679,
9.852376,
9.879245,
9.905254,
9.930368,
9.954553,
9.977775,
10.000000 };
/* used to get the kbps from baud rate,
assumed to be manchester encoding hence x*2
*/
uint32_t CC1K_RADIO_BAUDRATE[6]= {
600*2, // 0.6 kbps
1200*2, //
2400*2,
4800*2,
9600*2,
19200*2,//19.2 kbps
};
//Macro which returns 0 if the node is in RX state else 1 if TX state
//checks for the DDRB which is connected to the radio to know the
//status of the radio
#define CC1K_RADIO_STATE (READ_BIT(ATM128_DDRB,2) && READ_BIT(ATM128_DDRB,3))?(1):(0)
//Macros which informs the status of the radio
#define CC1K_RADIO_CORE_ON ((CC1K_REG_ACCESS(CC1K_MAIN) & (1 << CC1K_CORE_PD))?(0):(1))
#define CC1K_RADIO_BIAS_ON ((CC1K_REG_ACCESS(CC1K_MAIN) & (1 << CC1K_BIAS_PD))?(0):(1))
#define CC1K_RADIO_OFF (((CC1K_REG_ACCESS(CC1K_MAIN) & (1 << CC1K_RX_PD | \
1 << CC1K_TX_PD | \
1 << CC1K_FS_PD | \
1 << CC1K_CORE_PD | \
1 << CC1K_BIAS_PD | \
1 << CC1K_RESET_N))?(0):(1))
//Macro to find the radio ticks based on Buadrate settings and
//the XLAT freq settings , for mica2 its 14 Mhz
#define CC1K_RADIO_TICKS 14745600/(6000*(uint32_t)pow(2,(CC1K_REG_ACCESS(CC1K_MODEM0) >> CC1K_BAUDRATE & 0X7)))
//SPI event handler for all the nodes
sim_event_t* spi_event_t[TOSSIM_MAX_NODES];
bool spi_event_flags[TOSSIM_MAX_NODES];
#define spi_event spi_event_t[sim_node()]
#define spi_flag spi_event_flags[sim_node()]
/* Constants defined for CC1K */
/* Register addresses */
enum {
CC1K_MAIN = 0x00,
CC1K_FREQ_2A = 0x01,
CC1K_FREQ_1A = 0x02,
CC1K_FREQ_0A = 0x03,
CC1K_FREQ_2B = 0x04,
CC1K_FREQ_1B = 0x05,
CC1K_FREQ_0B = 0x06,
CC1K_FSEP1 = 0x07,
CC1K_FSEP0 = 0x08,
CC1K_CURRENT = 0x09,
CC1K_FRONT_END = 0x0A, //10
CC1K_PA_POW = 0x0B, //11
CC1K_PLL = 0x0C, //12
CC1K_LOCK = 0x0D, //13
CC1K_CAL = 0x0E, //14
CC1K_MODEM2 = 0x0F, //15
CC1K_MODEM1 = 0x10, //16
CC1K_MODEM0 = 0x11, //17
CC1K_MATCH = 0x12, //18
CC1K_FSCTRL = 0x13, //19
CC1K_FSHAPE7 = 0x14, //20
CC1K_FSHAPE6 = 0x15, //21
CC1K_FSHAPE5 = 0x16, //22
CC1K_FSHAPE4 = 0x17, //23
CC1K_FSHAPE3 = 0x18, //24
CC1K_FSHAPE2 = 0x19, //25
CC1K_FSHAPE1 = 0x1A, //26
CC1K_FSDELAY = 0x1B, //27
CC1K_PRESCALER = 0x1C, //28
CC1K_TEST6 = 0x40, //64
CC1K_TEST5 = 0x41, //66
CC1K_TEST4 = 0x42, //67
CC1K_TEST3 = 0x43, //68
CC1K_TEST2 = 0x44, //69
CC1K_TEST1 = 0x45, //70
CC1K_TEST0 = 0x46, //71
// MAIN Register Bit Posititions
CC1K_RXTX = 7,
CC1K_F_REG = 6,
CC1K_RX_PD = 5,
CC1K_TX_PD = 4,
CC1K_FS_PD = 3,
CC1K_CORE_PD = 2,
CC1K_BIAS_PD = 1,
CC1K_RESET_N = 0,
// CURRENT Register Bit Positions
CC1K_VCO_CURRENT = 4,
CC1K_LO_DRIVE = 2,
CC1K_PA_DRIVE = 0,
// FRONT_END Register Bit Positions
CC1K_BUF_CURRENT = 5,
CC1K_LNA_CURRENT = 3,
CC1K_IF_RSSI = 1,
CC1K_XOSC_BYPASS = 0,
// PA_POW Register Bit Positions
CC1K_PA_HIGHPOWER = 4,
CC1K_PA_LOWPOWER = 0,
// PLL Register Bit Positions
CC1K_EXT_FILTER = 7,
CC1K_REFDIV = 3,
CC1K_ALARM_DISABLE = 2,
CC1K_ALARM_H = 1,
CC1K_ALARM_L = 0,
// LOCK Register Bit Positions
CC1K_LOCK_SELECT = 4,
CC1K_PLL_LOCK_ACCURACY = 3,
CC1K_PLL_LOCK_LENGTH = 2,
CC1K_LOCK_INSTANT = 1,
CC1K_LOCK_CONTINUOUS = 0,
// CAL Register Bit Positions
CC1K_CAL_START = 7,
CC1K_CAL_DUAL = 6,
CC1K_CAL_WAIT = 5,
CC1K_CAL_CURRENT = 4,
CC1K_CAL_COMPLETE = 3,
CC1K_CAL_ITERATE = 0,
// MODEM2 Register Bit Positions
CC1K_PEAKDETECT = 7,
CC1K_PEAK_LEVEL_OFFSET = 0,
// MODEM1 Register Bit Positions
CC1K_MLIMIT = 5,
CC1K_LOCK_AVG_IN = 4,
CC1K_LOCK_AVG_MODE = 3,
CC1K_SETTLING = 1,
CC1K_MODEM_RESET_N = 0,
// MODEM0 Register Bit Positions
CC1K_BAUDRATE = 4,
CC1K_DATA_FORMAT = 2,
CC1K_XOSC_FREQ = 0,
// MATCH Register Bit Positions
CC1K_RX_MATCH = 4,
CC1K_TX_MATCH = 0,
// FSCTLR Register Bit Positions
CC1K_DITHER1 = 3,
CC1K_DITHER0 = 2,
CC1K_SHAPE = 1,
CC1K_FS_RESET_N = 0,
// PRESCALER Register Bit Positions
CC1K_PRE_SWING = 6,
CC1K_PRE_CURRENT = 4,
CC1K_IF_INPUT = 3,
CC1K_IF_FRONT = 2,
// TEST6 Register Bit Positions
CC1K_LOOPFILTER_TP1 = 7,
CC1K_LOOPFILTER_TP2 = 6,
CC1K_CHP_OVERRIDE = 5,
CC1K_CHP_CO = 0,
// TEST5 Register Bit Positions
CC1K_CHP_DISABLE = 5,
CC1K_VCO_OVERRIDE = 4,
CC1K_VCO_AO = 0,
// TEST3 Register Bit Positions
CC1K_BREAK_LOOP = 4,
CC1K_CAL_DAC_OPEN = 0,
/*
* CC1K Register Parameters Table
*
* This table follows the same format order as the CC1K register
* set EXCEPT for the last entry in the table which is the
* CURRENT register value for TX mode.
*
* NOTE: To save RAM space, this table resides in program memory (flash).
* This has two important implications:
* 1) You can't write to it (duh!)
* 2) You must read it using the PRG_RDB(addr) macro. IT CANNOT BE ACCESSED AS AN ORDINARY C ARRAY.
*
* Add/remove individual entries below to suit your RF tastes.
*
*/
CC1K_433_002_MHZ = 0x00,
CC1K_915_998_MHZ = 0x01,
CC1K_434_845_MHZ = 0x02,
CC1K_914_077_MHZ = 0x03,
CC1K_315_178_MHZ = 0x04,
//#define CC1K_SquelchInit 0x02F8 // 0.90V using the bandgap reference
CC1K_SquelchInit = 0x120,
CC1K_SquelchTableSize = 9,
CC1K_MaxRSSISamples = 5,
CC1K_Settling = 1,
CC1K_ValidPrecursor = 2,
CC1K_SquelchIntervalFast = 128,
CC1K_SquelchIntervalSlow = 2560,
CC1K_SquelchCount = 30,
CC1K_SquelchBuffer = 12,
CC1K_LPL_STATES = 9,
CC1K_LPL_PACKET_TIME = 16,
CC1K_LPL_CHECK_TIME = 16, /* In tenth's of milliseconds, this should
be an approximation of the on-time for
a LPL check rather than the total check
time. */
CC1K_LPL_MIN_INTERVAL = 5, /* In milliseconds, the minimum interval
between low-power-listening checks */
CC1K_LPL_MAX_INTERVAL = 10000 /* In milliseconds, the maximum interval
between low-power-listening checks.
Arbitrary value, but must be at
most 32767 because of the way
sleep interval is stored in outgoing
messages */
};
#ifdef CC1K_DEFAULT_FREQ
#define CC1K_DEF_PRESET (CC1K_DEFAULT_FREQ)
#endif
#ifdef CC1K_MANUAL_FREQ
#define CC1K_DEF_FREQ (CC1K_MANUAL_FREQ)
#endif
#ifndef CC1K_DEF_PRESET
#define CC1K_DEF_PRESET (CC1K_434_845_MHZ)
#endif
static const_uint8_t CC1K_Params[6][20] = {
// (0) 433.002 MHz channel, 19.2 Kbps data, Manchester Encoding, High Side LO
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x58,0x00,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x57,0xf6,0x85, //XBOW
// FSEP1, FSEP0 0x07-0x08
0X03,0x55,
// CURRENT RX MODE VALUE 0x09 also see below
4 << CC1K_VCO_CURRENT | 1 << CC1K_LO_DRIVE,
// FRONT_END 0x0a
1 << CC1K_IF_RSSI,
// PA_POW 0x0b
0x0 << CC1K_PA_HIGHPOWER | 0xf << CC1K_PA_LOWPOWER,
// PLL 0x0c
12 << CC1K_REFDIV,
// LOCK 0x0d
0xe << CC1K_LOCK_SELECT,
// CAL 0x0e
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
// MODEM2 0x0f
0 << CC1K_PEAKDETECT | 28 << CC1K_PEAK_LEVEL_OFFSET,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N,
// MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 1 << CC1K_XOSC_FREQ,
// MATCH 0x12
0x7 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
8 << CC1K_VCO_CURRENT | 1 << CC1K_PA_DRIVE,
},
// 1 915.9988 MHz channel, 19.2 Kbps data, Manchester Encoding, High Side LO
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x7c,0x00,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x7b,0xf9,0xae,
// FSEP1, FSEP0 0x07-0x8
0x02,0x38,
// CURRENT RX MODE VALUE 0x09 also see below
8 << CC1K_VCO_CURRENT | 3 << CC1K_LO_DRIVE,
//0x8C,
// FRONT_END 0x0a
1 << CC1K_BUF_CURRENT | 2 << CC1K_LNA_CURRENT | 1 << CC1K_IF_RSSI,
//0x32,
// PA_POW 0x0b
0x8 << CC1K_PA_HIGHPOWER | 0x0 << CC1K_PA_LOWPOWER,
//0xff,
// PLL 0xc
8 << CC1K_REFDIV,
//0x40,
// LOCK 0xd
0x1 << CC1K_LOCK_SELECT,
//0x10,
// CAL 0xe
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
//0x26,
// MODEM2 0xf
1 << CC1K_PEAKDETECT | 33 << CC1K_PEAK_LEVEL_OFFSET,
//0xA1,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N,
//0x6f,
// MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 1 << CC1K_XOSC_FREQ,
//0x55,
// MATCH 0x12
0x1 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
15 << CC1K_VCO_CURRENT | 3 << CC1K_PA_DRIVE,
},
// 2 434.845200 MHz channel, 19.2 Kbps data, Manchester Encoding, High Side LO
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x51,0x00,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x50,0xf7,0x4F, //XBOW
// FSEP1, FSEP0 0x07-0x08
0X03,0x0E,
// CURRENT RX MODE VALUE 0x09 also see below
4 << CC1K_VCO_CURRENT | 1 << CC1K_LO_DRIVE,
// FRONT_END 0x0a
1 << CC1K_IF_RSSI,
// PA_POW 0x0b
0x0 << CC1K_PA_HIGHPOWER | 0xf << CC1K_PA_LOWPOWER,
// PLL 0x0c
11 << CC1K_REFDIV,
// LOCK 0x0d
0xe << CC1K_LOCK_SELECT,
// CAL 0x0e
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
// MODEM2 0x0f
1 << CC1K_PEAKDETECT | 33 << CC1K_PEAK_LEVEL_OFFSET,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N,
// MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 1 << CC1K_XOSC_FREQ,
// MATCH 0x12
0x7 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
8 << CC1K_VCO_CURRENT | 1 << CC1K_PA_DRIVE,
},
// 3 914.077 MHz channel, 19.2 Kbps data, Manchester Encoding, High Side LO
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x5c,0xe0,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x5c,0xdb,0x42,
// FSEP1, FSEP0 0x07-0x8
0x01,0xAA,
// CURRENT RX MODE VALUE 0x09 also see below
8 << CC1K_VCO_CURRENT | 3 << CC1K_LO_DRIVE,
//0x8C,
// FRONT_END 0x0a
1 << CC1K_BUF_CURRENT | 2 << CC1K_LNA_CURRENT | 1 << CC1K_IF_RSSI,
//0x32,
// PA_POW 0x0b
0x8 << CC1K_PA_HIGHPOWER | 0x0 << CC1K_PA_LOWPOWER,
//0xff,
// PLL 0xc
6 << CC1K_REFDIV,
//0x40,
// LOCK 0xd
0x1 << CC1K_LOCK_SELECT,
//0x10,
// CAL 0xe
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
//0x26,
// MODEM2 0xf
1 << CC1K_PEAKDETECT | 33 << CC1K_PEAK_LEVEL_OFFSET,
//0xA1,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N,
//0x6f,
// MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 1 << CC1K_XOSC_FREQ,
//0x55,
// MATCH 0x12
0x1 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
15 << CC1K_VCO_CURRENT | 3 << CC1K_PA_DRIVE,
},
// 4 315.178985 MHz channel, 38.4 Kbps data, Manchester Encoding, High Side LO
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x45,0x60,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x45,0x55,0xBB,
// FSEP1, FSEP0 0x07-0x08
0X03,0x9C,
// CURRENT RX MODE VALUE 0x09 also see below
8 << CC1K_VCO_CURRENT | 0 << CC1K_LO_DRIVE,
// FRONT_END 0x0a
1 << CC1K_IF_RSSI,
// PA_POW 0x0b
0x0 << CC1K_PA_HIGHPOWER | 0xf << CC1K_PA_LOWPOWER,
// PLL 0x0c
13 << CC1K_REFDIV,
// LOCK 0x0d
0xe << CC1K_LOCK_SELECT,
// CAL 0x0e
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
// MODEM2 0x0f
1 << CC1K_PEAKDETECT | 33 << CC1K_PEAK_LEVEL_OFFSET,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N,
// MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 0 << CC1K_XOSC_FREQ,
// MATCH 0x12
0x7 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
8 << CC1K_VCO_CURRENT | 1 << CC1K_PA_DRIVE,
},
// 5 Spare
{ // MAIN 0x00
0x31,
// FREQ2A,FREQ1A,FREQ0A 0x01-0x03
0x58,0x00,0x00,
// FREQ2B,FREQ1B,FREQ0B 0x04-0x06
0x57,0xf6,0x85, //XBOW
// FSEP1, FSEP0 0x07-0x08
0X03,0x55,
// CURRENT RX MODE VALUE 0x09 also see below
8 << CC1K_VCO_CURRENT | 4 << CC1K_LO_DRIVE,
// FRONT_END 0x0a
1 << CC1K_IF_RSSI,
// PA_POW 0x0b
0x0 << CC1K_PA_HIGHPOWER | 0xf << CC1K_PA_LOWPOWER,
// PLL 0x0c
12 << CC1K_REFDIV,
// LOCK 0x0d
0xe << CC1K_LOCK_SELECT,
// CAL 0x0e
1 << CC1K_CAL_WAIT | 6 << CC1K_CAL_ITERATE,
// MODEM2 0x0f
1 << CC1K_PEAKDETECT | 33 << CC1K_PEAK_LEVEL_OFFSET,
// MODEM1 0x10
3 << CC1K_MLIMIT | 1 << CC1K_LOCK_AVG_MODE | CC1K_Settling << CC1K_SETTLING | 1 << CC1K_MODEM_RESET_N, // MODEM0 0x11
5 << CC1K_BAUDRATE | 1 << CC1K_DATA_FORMAT | 1 << CC1K_XOSC_FREQ,
// MATCH 0x12
0x7 << CC1K_RX_MATCH | 0x0 << CC1K_TX_MATCH,
// tx current (extra)
8 << CC1K_VCO_CURRENT | 1 << CC1K_PA_DRIVE,
},
};
#define UQ_CC1000_RSSI "CC1000RssiP.Rssi"
#endif /* CC1000CONST_H */
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/include/string.h | <reponame>tinyos-io/tinyos-3.x-contrib
/** Dummy header to avoid inclusion of the standard library header **/
#ifndef _STDIO_H_
#define _STDIO_H_
#endif
|
tinyos-io/tinyos-3.x-contrib | wsu/tools/simx/simx/python/simx/test/probe/ProbeTest/ProbeTest.h | #ifndef PROBE_TEST_H
#define PROBE_TEST_H
#define NREADINGS 10
typedef nx_struct nx_varied_struct {
nx_int8_t int8;
nx_uint8_t uint8;
nx_int16_t int16;
nx_uint16_t uint16;
nx_int32_t int32;
nx_uint32_t uint32;
} nx_varied_struct_t;
typedef nx_union nx_varied_union {
nx_int8_t int8;
nx_uint8_t uint8;
nx_int16_t int16;
nx_uint16_t uint16;
nx_int32_t int32;
nx_uint32_t uint32;
} nx_varied_union_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | wsu/telosw/ccxx00/spi/InterruptState.h | <filename>wsu/telosw/ccxx00/spi/InterruptState.h
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Definition of the states our interrupt SFD pin can be in.
* When we're transmitting, interrupts on that line belong to the Transmit
* component. When we're not transmitting, all interrupts on that line
* belong to the receive component.
*
* Tranmit uses the interrupt to know when its transmission is done to switch
* back into RX mode. Receive uses the interrupt to know when a packet
* has been received. Both components can use the line for timestamping.
*
* @author <NAME>
*/
#ifndef INTERRUPTSTATE_H
#define INTERRUPTSTATE_H
enum {
S_INTERRUPT_RX, // default state
S_INTERRUPT_TX,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | ecosensory/tos/platforms/ecosens1/hardware.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>ecosensory/tos/platforms/ecosens1/hardware.h
#ifndef _H_hardware_h
#define _H_hardware_h
#include "msp430hardware.h"
//#include "MSP430ADC12.h"
//#include "CC2420Const.h"
//#include "AM.h"
// LEDs
TOSH_ASSIGN_PIN(RED_LED, 5, 4);
TOSH_ASSIGN_PIN(GREEN_LED, 5, 5);
TOSH_ASSIGN_PIN(BLUE_LED, 5, 6);
// CC2420 RADIO #defines
TOSH_ASSIGN_PIN(RADIO_CSN, 4, 2);
TOSH_ASSIGN_PIN(RADIO_VREF, 4, 5);
TOSH_ASSIGN_PIN(RADIO_RESET, 4, 6);
TOSH_ASSIGN_PIN(RADIO_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(RADIO_SFD, 4, 1);
TOSH_ASSIGN_PIN(RADIO_GIO0, 1, 3);
TOSH_ASSIGN_PIN(RADIO_FIFO, 1, 3);
TOSH_ASSIGN_PIN(RADIO_GIO1, 1, 4);
TOSH_ASSIGN_PIN(RADIO_CCA, 1, 4);
TOSH_ASSIGN_PIN(CC_FIFOP, 1, 0);
TOSH_ASSIGN_PIN(CC_FIFO, 1, 3);
TOSH_ASSIGN_PIN(CC_SFD, 4, 1);
TOSH_ASSIGN_PIN(CC_VREN, 4, 5);
TOSH_ASSIGN_PIN(CC_RSTN, 4, 6);
// UART pins
TOSH_ASSIGN_PIN(SOMI0, 3, 2);
TOSH_ASSIGN_PIN(SIMO0, 3, 1);
TOSH_ASSIGN_PIN(UCLK0, 3, 3);
TOSH_ASSIGN_PIN(UTXD0, 3, 4); // FFC 11 UART0TX
TOSH_ASSIGN_PIN(URXD0, 3, 5); // FFC 12 UART0RX
TOSH_ASSIGN_PIN(UTXD1, 3, 6);
TOSH_ASSIGN_PIN(URXD1, 3, 7);
TOSH_ASSIGN_PIN(UCLK1, 5, 3);
TOSH_ASSIGN_PIN(SOMI1, 5, 2);
TOSH_ASSIGN_PIN(SIMO1, 5, 1);
// ADC
TOSH_ASSIGN_PIN(ADC0, 6, 0); // FFC 9
TOSH_ASSIGN_PIN(ADC1, 6, 1); // FFC 8
TOSH_ASSIGN_PIN(ADC2, 6, 2); // FFC 6
TOSH_ASSIGN_PIN(ADC3, 6, 3); // FFC 4
TOSH_ASSIGN_PIN(ADC4, 6, 4); // FFC 2
TOSH_ASSIGN_PIN(ADC5, 6, 5); // FFC 1
// HUMIDITY
TOSH_ASSIGN_PIN(HUM_SDA, 1, 5);
TOSH_ASSIGN_PIN(HUM_SCL, 1, 6);
TOSH_ASSIGN_PIN(HUM_PWR, 1, 7); // FFC 13
// GIO pins
TOSH_ASSIGN_PIN(GIO0, 2, 0); //
TOSH_ASSIGN_PIN(GIO1, 2, 1); //
TOSH_ASSIGN_PIN(GIO2, 2, 3); //
TOSH_ASSIGN_PIN(GIO3, 2, 6); //
// 1-Wire
TOSH_ASSIGN_PIN(ONEWIRE, 2, 4);
// FLASH
TOSH_ASSIGN_PIN(FLASH_PWR, 4, 3);
TOSH_ASSIGN_PIN(FLASH_CS, 4, 4);
TOSH_ASSIGN_PIN(FLASH_HOLD, 4, 7);
// PROGRAMMING PINS (tri-state)
//TOSH_ASSIGN_PIN(TCK, );
TOSH_ASSIGN_PIN(PROG_RX, 1, 1);
TOSH_ASSIGN_PIN(PROG_TX, 2, 2);
// need to undef atomic inside header files or nesC ignores the directive
#undef atomic
#endif // _H_hardware_h
|
tinyos-io/tinyos-3.x-contrib | eon/apps/server-e/impl/stargate/mTypes.h | #ifndef _MTYPES_H_
#define _MTYPES_H_
bool
TestVideo (uint8_t value)
{
return (value == 4);
}
bool
TestAudio (uint8_t value)
{
return (value == 3);
}
bool
TestImage (uint8_t value)
{
return (value == 2);
}
bool
TestText (uint8_t value)
{
return (value == 1);
}
#endif // _MTYPES_H_
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinyos2/stats.h | #ifndef STATS_H_INCLUDED
#define STATS_H_INCLUDED
bool wakeWaiting;
uint32_t wakeStart;
#endif
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/lib/tossim/sim_binary.h | /*
* "Copyright (c) 2005 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* The C functions representing the TOSSIM binary interference
* model.
*
* @author <NAME>
* @date Nov 22 2005
*/
// $Id: sim_binary.h,v 1.1 2014/11/26 19:31:35 carbajor Exp $
#ifndef SIM_BINARY_H_INCLUDED
#define SIM_BINARY_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct link {
int mote;
double loss;
struct link* next;
} link_t;
void sim_binary_add(int src, int dest, double packetLoss);
double sim_binary_loss(int src, int dest);
bool sim_binary_connected(int src, int dest);
void sim_binary_remove(int src, int dest);
link_t* sim_binary_first(int src);
link_t* sim_binary_next(link_t* link);
#ifdef __cplusplus
}
#endif
#endif // SIM_BINARY_H_INCLUDED
|
tinyos-io/tinyos-3.x-contrib | intelmote2/tools/platforms/intelmote2/jflashmm/src/jtag.h | <reponame>tinyos-io/tinyos-3.x-contrib
/******************************************************************************
**
** COPYRIGHT (C) 2000, 2001, 2002 Intel Corporation.
**
** The information in this file is furnished for informational use
** only, is subject to change without notice, and should not be construed as
** a commitment by Intel Corporation. Intel Corporation assumes no
** responsibility or liability for any errors or inaccuracies that may appear
** in this document or any software that may be provided in association with
** this document.
**
** FILENAME: cotullajtag.h
**
** PURPOSE: pin defines for the Cotulla Boundary Scan Chain
**
** LAST MODIFIED: $Modtime: 11/18/02 1:26p $
******************************************************************************/
#define MAX_DR_SIZE 1000
#define MAX_CHAIN_LENGTH 1000
#define PZ_IRLENGTH 4
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/chips/atm128/Atm128Uart.h | // $Id: Atm128Uart.h,v 1.1 2014/11/26 19:31:33 carbajor Exp $
/*
* Copyright (c) 2004-2005 Crossbow Technology, Inc. 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
// @author <NAME> <<EMAIL>>
#ifndef _H_Atm128Uart_h
#define _H_Atm128Uart_h
//====================== UART Bus ==================================
typedef uint8_t Atm128_UDR0_t; //!< USART0 I/O Data Register
typedef uint8_t Atm128_UDR1_t; //!< USART1 I/O Data Register
/* UART Status Register */
typedef union {
struct Atm128_UCSRA_t {
uint8_t mpcm : 1; //!< UART Multiprocessor Communication Mode
uint8_t u2x : 1; //!< UART Double Transmission Speed
uint8_t upe : 1; //!< UART Parity Error
uint8_t dor : 1; //!< UART Data Overrun
uint8_t fe : 1; //!< UART Frame Error
uint8_t udre : 1; //!< USART Data Register Empty
uint8_t txc : 1; //!< USART Transfer Complete
uint8_t rxc : 1; //!< USART Receive Complete
} bits;
uint8_t flat;
} Atm128UartStatus_t;
typedef Atm128UartStatus_t Atm128_UCSR0A_t; //!< UART 0 Status Register
typedef Atm128UartStatus_t Atm128_UCSR1A_t; //!< UART 1 Status Register
/* UART Control Register */
typedef union {
struct Atm128_UCSRB_t {
uint8_t txb8 : 1; //!< UART Transmit Data Bit 8
uint8_t rxb8 : 1; //!< UART Receive Data Bit 8
uint8_t ucsz2 : 1; //!< UART Character Size (Bit 2)
uint8_t txen : 1; //!< UART Transmitter Enable
uint8_t rxen : 1; //!< UART Receiver Enable
uint8_t udrie : 1; //!< USART Data Register Enable
uint8_t txcie : 1; //!< UART TX Complete Interrupt Enable
uint8_t rxcie : 1; //!< UART RX Complete Interrupt Enable
} bits;
uint8_t flat;
} Atm128UartControl_t;
typedef Atm128UartControl_t Atm128_UCSR0B_t; //!< UART 0 Control Register
typedef Atm128UartControl_t Atm128_UCSR1B_t; //!< UART 1 Control Register
enum {
ATM128_UART_DATA_SIZE_5_BITS = 0,
ATM128_UART_DATA_SIZE_6_BITS = 1,
ATM128_UART_DATA_SIZE_7_BITS = 2,
ATM128_UART_DATA_SIZE_8_BITS = 3,
};
/* UART Control Register */
typedef union {
uint8_t flat;
struct Atm128_UCSRC_t {
uint8_t ucpol : 1; //!< UART Clock Polarity
uint8_t ucsz : 2; //!< UART Character Size (Bits 0 and 1)
uint8_t usbs : 1; //!< UART Stop Bit Select
uint8_t upm : 2; //!< UART Parity Mode
uint8_t umsel : 1; //!< USART Mode Select
uint8_t rsvd : 1; //!< Reserved
} bits;
} Atm128UartMode_t;
typedef Atm128UartMode_t Atm128_UCSR0C_t; //!< UART 0 Mode Register
typedef Atm128UartMode_t Atm128_UCSR1C_t; //!< UART 1 Mode Register
/*
* ATmega1128 UART baud register settings:
* ATM128_<baudRate>_BAUD_<cpuSpeed>
*/
enum {
ATM128_19200_BAUD_4MHZ = 12,
ATM128_38400_BAUD_4MHZ = 6,
ATM128_57600_BAUD_4MHZ = 3,
ATM128_19200_BAUD_4MHZ_2X = 25,
ATM128_38400_BAUD_4MHZ_2X = 12,
ATM128_57600_BAUD_4MHZ_2X = 8,
ATM128_19200_BAUD_7MHZ = 23,
ATM128_38400_BAUD_7MHZ = 11,
ATM128_57600_BAUD_7MHZ = 7,
ATM128_19200_BAUD_7MHZ_2X = 47,
ATM128_38400_BAUD_7MHZ_2X = 23,
ATM128_57600_BAUD_7MHZ_2X = 15,
ATM128_19200_BAUD_8MHZ = 25,
ATM128_38400_BAUD_8MHZ = 12,
ATM128_57600_BAUD_8MHZ = 8,
ATM128_19200_BAUD_8MHZ_2X = 51,
ATM128_38400_BAUD_8MHZ_2X = 34,
ATM128_57600_BAUD_8MHZ_2X = 11,
};
typedef uint8_t Atm128_UBRR0L_t; //!< UART 0 Baud Register (Low)
typedef uint8_t Atm128_UBRR0H_t; //!< UART 0 Baud Register (High)
typedef uint8_t Atm128_UBRR1L_t; //!< UART 1 Baud Register (Low)
typedef uint8_t Atm128_UBRR1H_t; //!< UART 1 Baud Register (High)
#endif //_H_Atm128UART_h
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/util/collect/sfsource.h | #ifndef SFSOURCE_H
#define SFSOURCE_H
int open_sf_source(const char *host, int port);
/* Returns: file descriptor for serial forwarder at host:port, or
-1 for failure
(see init_sf_source for description of platform handling)
*/
int init_sf_source(int fd);
/* Effects: Checks that fd is following the serial forwarder protocol.
Use this if you obtain your file descriptor from some other source
than open_sf_source (e.g., you're a server)
Sends 'platform' for protocol version '!', and sets 'platform' to
the received platform value.
Modifies: platform
Returns: 0 if it is, -1 otherwise
*/
void *read_sf_packet(int fd, int *len);
/* Effects: reads packet from serial forwarder on file descriptor fd
Returns: the packet read (in newly allocated memory), and *len is
set to the packet length
*/
int write_sf_packet(int fd, const void *packet, int len);
/* Effects: writes len byte packet to serial forwarder on file descriptor
fd
Returns: 0 if packet successfully written, -1 otherwise
*/
#endif
|
tinyos-io/tinyos-3.x-contrib | gems/wmtp/tinyos/tos/lib/net/wmtp/WmtpMsgs.h | /*
* WMTP - Wireless Modular Transport Protocol
*
* Copyright (c) 2008 <NAME> and IT - Instituto de Telecomunicacoes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Address:
* Instituto Superior Tecnico - Taguspark Campus
* Av. Prof. Dr. <NAME>, 2744-016 Porto Salvo
*
* E-Mail:
* <EMAIL>
*/
/**
* WMTP Protocol.
*
* This component implements the WMTP transport protocol.
*
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>> (port to TinyOS 2.x)
**/
#ifndef __WMTPMSGS_H__
#define __WMTPMSGS_H__
// WMTP AM Message types.
enum {
AM_WMTPMSG = 7,
};
// Local part types.
enum {
WMTP_LOCALPART_CONGCTRL = 0,
WMTP_LOCALPART_FAIRNESS = 1,
WMTP_LOCALPART_WMTPRELIABILITY = 2,
WMTP_LOCALPART_SRCROUTEDCONN = 3,
WMTP_LOCALPART_CONN = 255,
};
// Connection part types.
enum {
WMTP_CONNPART_WMTPRELIABILITY = 0,
WMTP_CONNPART_CONFIG = 252,
WMTP_CONNPART_CLOSE = 253,
WMTP_CONNPART_DATA = 254,
WMTP_CONNPART_LAST = 255,
};
// Configuration part types.
enum {
WMTP_CONFPART_QUEUEAVAILABILITYSHAPER = 0,
WMTP_CONFPART_THROTTLING = 1,
WMTP_CONFPART_FLOWCTRL = 2,
WMTP_CONFPART_CONGCTRL = 3,
WMTP_CONFPART_FAIRNESS = 4,
WMTP_CONFPART_WMTPRELIABILITY = 5,
WMTP_CONFPART_LAST = 255,
};
// Service types.
enum {
WMTP_SERVICETYPE_PACKETSINK = 0,
WMTP_SERVICETYPE_SINKID = 1,
};
enum {
WMTP_FEATURECONFIG_MAXSIZE = 9,
};
// WmtpSinkIDServiceSpecificationData.
typedef struct WmtpSinkIDServiceSpecificationData {
uint8_t Reserved:1;
uint8_t SinkID:7;
} __attribute__ ((packed)) WmtpSinkIDServiceSpecificationData_t;
// WmtpServiceSpecificationData.
typedef struct WmtpServiceSpecificationData {
uint8_t Type;
char Data[0];
} __attribute__ ((packed)) WmtpServiceSpecificationData_t;
// WMTP AM Message structures.
// WmtpFlowCtrlConfigurationPart.
typedef struct WmtpFlowCtrlConfigurationPart {
uint16_t Period;
} __attribute__ ((packed)) WmtpFlowCtrlConfigurationPart_t;
// WmtpFairnessConfigurationPart.
typedef struct WmtpFairnessConfigurationPart {
uint8_t Reserved:1;
uint8_t SinkID:7;
uint8_t Weight;
} __attribute__ ((packed)) WmtpFairnessConfigurationPart_t;
// WmtpConfigurationPart.
typedef struct WmtpConfigurationPart {
uint8_t Type;
char Data[0];
} __attribute__ ((packed)) WmtpConfigurationPart_t;
// WmtpDataConnectionPart.
typedef struct WmtpDataConnectionPart {
uint8_t PayloadSize;
char PayloadData[0];
} __attribute__ ((packed)) WmtpDataConnectionPart_t;
// WmtpReliabilityConnectionPart.
typedef struct WmtpReliabilityConnectionPart {
uint16_t OrigAddr;
uint16_t PacketID:15;
} __attribute__ ((packed)) WmtpReliabilityConnectionPart_t;
// WmtpTagRouterData.
typedef struct WmtpTagRouterData {
uint8_t Tag;
} __attribute__ ((packed)) WmtpTagRouterData_t;
// WmtpConnectionPart.
typedef struct WmtpConnectionPart {
uint8_t Type;
char Data[0];
} __attribute__ ((packed)) WmtpConnectionPart_t;
// WmtpConnectionLocalPart.
typedef struct WmtpConnectionLocalPart {
uint8_t RouterType;
char RouterData[0];
WmtpConnectionPart_t ConnectionParts[0];
} __attribute__ ((packed)) WmtpConnectionLocalPart_t;
// WmtpCongCtrlLocalPart.
typedef struct WmtpCongCtrlLocalPart {
uint8_t Reserved:7;
uint8_t CNBit:1;
} __attribute__ ((packed)) WmtpCongCtrlLocalPart_t;
// WmtpFairnessLocalPart.
typedef struct WmtpFairnessLocalPart {
uint8_t LastSink:1;
uint8_t SinkID:7;
// This period is calculated by multiplying the nodes outgoing period
// for this sink, multiplied by the total weight of all connections
// going to said sink. It is similar to the throughput per unit weight.
uint16_t NormalizedPeriod;
// The address of the node that originated the constraint.
uint16_t LimitingNode;
} __attribute__ ((packed)) WmtpFairnessLocalPart_t;
// WmtpReliabilityLocalPart.
typedef struct WmtpReliabilityLocalPart {
uint16_t OrigAddr;
uint8_t LastPacket:1;
uint16_t PacketID:15;
} __attribute__ ((packed)) WmtpReliabilityLocalPart_t;
// WmtpSrcRoutedConnLocalPart.
typedef struct WmtpSrcRoutedConnLocalPart {
uint16_t NextHop;
uint8_t NextTag;
uint16_t QoSMaxDelay;
uint16_t QoSMaxPeriod;
uint16_t QoSPreferredPeriod;
uint16_t QoSAccumulatedDelay;
uint8_t NumHops;
uint16_t Hops[0];
char ConfigurationData[0];
char ServiceSpecificationData[0];
} __attribute__ ((packed)) WmtpSrcRoutedConnLocalPart_t;
// WmtpLocalPart.
typedef struct WmtpLocalPart {
uint8_t Type;
char Data[0];
} __attribute__ ((packed)) WmtpLocalPart_t;
// WmtpMsg.
typedef struct WmtpMsg {
uint16_t SrcAddr;
WmtpLocalPart_t LocalParts[0];
} __attribute__ ((packed)) WmtpMsg_t;
#endif // #define __WMTPMSGS_H__
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/chips/mc13192/mc13192Msg.h | #ifndef MC13192_MSG_H
#define MC13192_MSG_H
#include "AM.h"
typedef nx_struct MC13192Header {
nx_am_addr_t dest;
nx_am_addr_t source;
nx_uint8_t length;
nx_am_group_t group;
nx_am_id_t type;
} mc13192_header_t;
typedef nx_struct MC13192Footer {
nx_uint8_t foo; // We always send an uneven number of bytes
} mc13192_footer_t;
typedef nx_struct MC13192Metadata {
nx_uint8_t lqi;
nx_uint8_t receivedBytes;
} mc13192_metadata_t;
#endif |
tinyos-io/tinyos-3.x-contrib | ethz/snpk/tos/lib/cc2420PacketLogger/packetlogger.h | <reponame>tinyos-io/tinyos-3.x-contrib<filename>ethz/snpk/tos/lib/cc2420PacketLogger/packetlogger.h
#ifndef PACKETLOGGER_H
#define PACKETLOGGER_H
typedef nx_struct {
nx_uint16_t logId;
nx_uint8_t type;
nx_uint32_t time;
nx_uint16_t count;
nx_am_addr_t source;
nx_uint8_t dsn;
nx_bool ack;
} packet_logger_event_t;
enum {
PL_TYPE_WAKEUP=1,
PL_TYPE_RX=2,
PL_TYPE_TX=3,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | tub/apps/PacketSniffer_802_15_4/wiresharkPlugins/t2sf/packet-t2sf.c | <gh_stars>0
/* packet-t2sf.c
* Routines for TinyOs2 Serial Active Message
* Copyright 2007, <NAME> <<EMAIL>>
*
* $Id: packet-t2sf.c,v 1.2 2008/05/13 00:10:30 vlahan Exp $
*
* Wireshark - Network traffic analyzer
* By <NAME> <<EMAIL>>
* Copyright 1998 <NAME>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include "packet-t2sf.h"
/* Forward declaration we need below */
void proto_reg_handoff_t2sf(void);
static void dissect_t2sf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* for subdissectors */
static dissector_table_t t2sf_type_dissector_table;
static heur_dissector_list_t heur_subdissector_list;
static dissector_handle_t data_handle;
/* Initialize the protocol and registered fields */
static int proto_t2sf = -1;
static int hf_t2sf_length = -1;
static int hf_t2sf_type = -1;
static int hf_t2sf_data = -1;
/* Global preferences */
static guint global_tcp_port_t2sf = T2_SF_STANDARD_TCP_PORT;
static guint tcp_port_t2sf = T2_SF_STANDARD_TCP_PORT;
/* Initialize the subtree pointers */
static gint ett_t2sf = -1;
/* description for packet dispatch type */
static const value_string vals_t2sf_type[] = {
{ 0x0, "TOS Active Message" },
{ 0x1, "CC1000 Packet" },
{ 0x2, "802.15.4 Packet" },
{ 0xff, "Unknown Packet" },
{ 0x0, NULL }
};
/* Returns the length of a serial forwareder packet */
static guint8 get_t2sf_pdu_len(packet_info *pinfo, tvbuff_t *tvb, guint offset) {
return tvb_get_guint8(tvb, offset) + 1;
}
// Reassemble tcp payload and call generic dissection
static void dissect_t2sf_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, T2_SF_LENGTH_NUM_BYTES, get_t2sf_pdu_len, dissect_t2sf);
}
/* Code to actually dissect the packets */
static void dissect_t2sf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tvbuff_t *next_tvb;
int available_length;
guint8 sf_payload_length = 0;
guint8 sf_type;
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *t2sf_tree;
/* check if this is sf packet is really sane. If length is incorrect this might be another packet */
if (tvb_get_guint8(tvb, 0)+1 != tvb_length(tvb)) {
call_dissector(data_handle, tvb, pinfo, tree);
return;
}
sf_payload_length = tvb_get_guint8(tvb, T2_SF_HEADER_LENGTH_OFFSET)+1;
sf_type = tvb_get_guint8(tvb, T2_SF_HEADER_TYPE_OFFSET);
/* Make entries in Protocol column and Info column on summary display */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "T2 SF");
if (check_col(pinfo->cinfo, COL_INFO))
col_set_str(pinfo->cinfo, COL_INFO, "TinyOS 2 SerialForwarder Packet");
if (tree) {
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_t2sf, tvb, 0, -1, FALSE);
t2sf_tree = proto_item_add_subtree(ti, ett_t2sf);
/* add items to the subtree */
proto_tree_add_item(t2sf_tree, hf_t2sf_length, tvb, T2_SF_HEADER_LENGTH_OFFSET, T2_SF_LENGTH_NUM_BYTES, FALSE);
proto_tree_add_item(t2sf_tree, hf_t2sf_type, tvb, T2_SF_HEADER_TYPE_OFFSET, T2_SF_TYPE_NUM_BYTES, FALSE);
/*
if (sf_length > 0) {
proto_tree_add_item(t2sf_tree, hf_t2sf_data, tvb, SERIAL_AM_DATA_OFFSET, serial_am_payload_length, FALSE);
}
*/
}
/* Calculate the available data in the packet,
set this to -1 to use all the data in the tv_buffer */
available_length = tvb_length(tvb) - T2_SF_HEADER_LEN;
/* Create the tvbuffer for the next dissector */
next_tvb = tvb_new_subset(tvb, T2_SF_HEADER_LEN, MIN(available_length, sf_payload_length), sf_payload_length);
/* check if message has type field */
if (dissector_try_port(t2sf_type_dissector_table, sf_type, next_tvb, pinfo, tree)) {
return;
}
/* try "heuristics */
if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree)) {
return;
}
/* call the next dissector */
call_dissector(data_handle, next_tvb, pinfo, tree);
return;
}
/* Register the protocol with Wireshark */
void proto_register_t2sf(void)
{
module_t *t2sf_module;
/* TinyOs2 Serial Active Message Header */
static hf_register_info hf[] = {
{ &hf_t2sf_length, { "Length", "t2sf.length", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } },
{ &hf_t2sf_type, { "Type", "t2sf.type", FT_UINT8, BASE_DEC, VALS(vals_t2sf_type), 0x0, "", HFILL } },
{ &hf_t2sf_data, { "Payload_Data", "t2sf.payload_data", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL } }
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_t2sf
};
/* Register the protocol name and description */
proto_t2sf = proto_register_protocol("TinyOS2 SerialForwarder Protocol", "T2 SF", "t2sf");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_t2sf, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Register preferences module (See Section 2.6 for more on preferences) */
t2sf_module = prefs_register_protocol(proto_t2sf, proto_reg_handoff_t2sf);
/* subdissector code */
t2sf_type_dissector_table = register_dissector_table("t2sf.type", "T2 SF type", FT_UINT8, BASE_HEX);
//register_heur_dissector_list("t2sf", &heur_subdissector_list);
/* Register prefs */
prefs_register_uint_preference(t2sf_module, "tcp_port",
"TCP Port",
"The TCP port on which "
"SerialForwarder "
"sends the packets",
10, &global_tcp_port_t2sf);
}
/* If this dissector uses sub-dissector registration add a registration routine.
This exact format is required because a script is used to find these routines
and create the code that calls these routines.
This function is also called by preferences whenever "Apply" is pressed
(see prefs_register_protocol above) so it should accommodate being called
more than once.
*/
void proto_reg_handoff_t2sf(void)
{
static dissector_handle_t t2sf_handle;
static dissector_handle_t t2sf_tcp_handle;
static gboolean inited = FALSE;
if (!inited) {
t2sf_handle = create_dissector_handle(dissect_t2sf, proto_t2sf);
t2sf_tcp_handle = create_dissector_handle(dissect_t2sf_tcp, proto_t2sf);
/* for dissection based upon tcp */
dissector_add("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
inited = TRUE;
} else {
dissector_delete("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
}
tcp_port_t2sf = global_tcp_port_t2sf;
dissector_add("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
data_handle = find_dissector("data");
}
|
tinyos-io/tinyos-3.x-contrib | berkeley/hotmac/tos/chips/cc2420_hotmac/hotmac.h | <gh_stars>1-10
/*
* "Copyright (c) 2010 The Regents of the University of California.
* All rights reserved."
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
*/
/*
* @author <NAME> <<EMAIL>>
*/
#ifndef HOTMAC_H
#define HOTMAC_H
#include <Ieee154.h>
typedef enum {
S_IDLE = 0,
S_RECEIVE,
S_TRANSMIT,
S_OFF,
} hotmac_state_t;
nx_struct hotmac_beacon {
nx_uint16_t period; /* how often our receive checks are */
nx_uint16_t cwl; /* the number of contention slots */
nx_uint8_t channel; /* what channel to switch the data transmission to */
};
struct hotmac_rx_stats {
uint16_t probe_rx;
uint16_t probe_tx;
uint16_t data_rx;
};
struct hotmac_tx_stats {
uint16_t data_tx;
};
struct hotmac_neigh_entry {
ieee154_saddr_t neigh;
uint16_t phase;
uint16_t period;
uint8_t lsn;
// bit fields
uint8_t valid:1;
uint8_t pinned:1; /* possible to evict */
uint8_t lru:4;
};
enum {
// this is how long between probes -- basically determines the
// latency and duty cycle. This is probably what you're looking for :)
// jiffies
HOTMAC_DEFAULT_CHECK_PERIOD = 128L << 5,
// the 6lowpan network id used for Hotmac probe messages. If you
// are using iframes (CC2420_DEF_IFRAMES), this will be a reserved AM
// type instead.
// really, we should use a new MAC frame type; however on the cc2420
// accepting reserved frame types disables address recognition, which we need.
HOTMAC_6LOWPAN_NETWORK = 0xff,
// shortest amount to wait after receiving an ACK to a probe before
// transmitting another probe.
// has to be long enough so that any packets sent in response to
// this probe have enough time to finish transmission, about 4ms for
// a 127 byte packet.
// this also determines the window you have to get out a second
// packet, for the streaming optimization
// jiffies
HOTMAC_POSTPROBE_WAIT = 20 << 5,
// the length of a SIFS contention slot, in jiffies.
// this is about 1ms.
HOTMAC_CWIN_SIZE = 0x1F,
HOTMAC_NEIGHBORTABLE_SZ = 4,
// how long to wait for a beacon each time we wake up. this is
// probably also the largest time you want to go between polling the
// channel.
// jiffies
// we jitter the period a little bit to prevent synchronization.
HOTMAC_SEND_TIMEOUT = HOTMAC_DEFAULT_CHECK_PERIOD + (HOTMAC_DEFAULT_CHECK_PERIOD / 20) + 35, //500
// (HOTMAC_DEFAULT_CHECK_PERIOD * 5) / 2,
// (HOTMAC_DEFAULT_CHECK_PERIOD >> 5) + 35,
// how long to wake up before a beacon is scheduled, to turn on the
// radio and load the packet. actual time on a telosb seems to be around 144 jiffies
// jiffies
HOTMAC_WAKEUP_LOAD_TIME = 160, // 45 << 5,
// once awake to send a beacon, if we have to wait more then this
// amount assume we missed the slot we were going for.
// jiffies
HOTMAC_WAKEUP_TOO_LONG = HOTMAC_WAKEUP_LOAD_TIME,
// we'll wake up extra early just to
// make sure we don't miss it due to getting delayed by other tasks,
// drift, or loading the FIFO.
// jiffies
HOTMAC_GUARD_TIME = 30, //100
// now set per-packet through packetlink
// HOTMAC_DELIVERY_ATTEMPTS = 0,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | ethz/nodule/tos/platforms/atevk1101/hardware.h | /* $Id: hardware.h,v 1.2 2008/02/17 16:36:27 yuecelm Exp $ */
/* author: <NAME> <<EMAIL>> */
#ifndef HARDWARE_H
#define HARDWARE_H
#include "at32uc3b.h"
/* No operation */
inline void nop()
{
asm volatile ("nop");
}
/* Enables interrupts. */
inline void __nesc_enable_interrupt()
{
avr32_clr_global_interrupt_mask();
}
/* Disables interrupts. */
inline void __nesc_disable_interrupt()
{
avr32_set_global_interrupt_mask();
}
typedef uint8_t __nesc_atomic_t;
inline __nesc_atomic_t __nesc_atomic_start(void) @spontaneous()
{
return 0;
}
inline void __nesc_atomic_end(__nesc_atomic_t x) @spontaneous()
{
}
#endif
|
tinyos-io/tinyos-3.x-contrib | ethz/tinynode184/tos/chips/msp430/timer/Msp430DcoSpec.h | <filename>ethz/tinynode184/tos/chips/msp430/timer/Msp430DcoSpec.h
/* -*- mode:c++; indent-tabs-mode: nil -*-
* Copyright (c) 2007, Technische Universitaet Berlin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the Technische Universitaet Berlin nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES {} LOSS OF USE, DATA,
* OR PROFITS {} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Specify the target cpu clock speed of your platform by overriding this file.
*
* Be aware that tinyos relies on binary 4MHz, that is 4096 binary kHz. Some
* platforms have an external high frequency oscilator to generate the SMCLK
* (e.g. eyesIFX, and possibly future ZigBee compliant nodes). These
* oscillators provide metric frequencies, but may not run in power down
* modes. Here, we need to switch the SMCLK source, which is easier if
* the external and thd DCO source frequency are the same.
*
* @author: <NAME> (<EMAIL>)
*/
#ifndef MS430DCOSPEC_H
#define MS430DCOSPEC_H
#define TARGET_DCO_KHZ 12288 // the target DCO clock rate in binary kHz
#define ACLK_KHZ 32 // the ACLK rate in binary kHz
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/stargatehelper/DS2751.h | <reponame>tinyos-io/tinyos-3.x-contrib
//This code is a modified version of code from the Heliomote project
#ifndef DS2751_H_
#define DS2751_H_
unsigned char
ds2751_init (void)
{
unsigned char presence;
//TOSH_SEL_ADC2_IOFUNC ();
TOSH_MAKE_ADC5_OUTPUT ();
//TOSH_SEL_GIO1_IOFUNC ();
//TOSH_MAKE_GIO1_OUTPUT ();
TOSH_CLR_ADC5_PIN ();
TOSH_uwait (300); // Keep low for about 600 us
//TOSH_SET_GIO1_PIN();
//TOSH_uwait(100);
//TOSH_CLR_GIO1_PIN();
TOSH_MAKE_ADC5_INPUT (); // Set pin as input
TOSH_uwait (40); // Wait for presence pulse
presence = TOSH_READ_ADC5_PIN (); // Read the bit on pin for presence
TOSH_uwait (250); // Wait for end of timeslot
return !presence; // 1 = presence, 0 = no presence
}
int
ds2751_readBit ()
// It reads one bit from the one-wire interface */
{
int result;
TOSH_MAKE_ADC5_OUTPUT (); // Set pin as output
TOSH_CLR_ADC5_PIN (); // Set the line low
TOSH_uwait (1); // Hold the line low for at least one us
TOSH_MAKE_ADC5_INPUT (); // Set pin as input
TOSH_uwait (7); // Wait 14 us before reading bit value
result = TOSH_READ_ADC5_PIN (); // Store bit value
TOSH_uwait (50);
return result;
}
void
ds2751_writeBit (int bit)
// It writes out a bit
{
if (bit)
{
TOSH_MAKE_ADC5_OUTPUT (); // Set pin as output
TOSH_CLR_ADC5_PIN (); // Set the line low
TOSH_uwait (4); // Hold line low for 2 us
TOSH_MAKE_ADC5_INPUT (); // Set pin as input
TOSH_uwait (50); // Write slot is at least 60 us
}
else
{
TOSH_MAKE_ADC5_OUTPUT (); // Set pin as output
TOSH_CLR_ADC5_PIN (); // Set the line low
TOSH_uwait (50); // Hold line low for at least 60 us
TOSH_MAKE_ADC5_INPUT (); // Release the line
TOSH_uwait (8);
}
}
void
ds2751_writeByte (int hexNum)
// It sends one byte via the one-wire that corresponds to the
// binary representation of hexNum. The variable next is used
// when the number is broken down into its binary code and it
// holds the current value of the variable. curBit holds the
// value of the bit to be written to the line.
{
int i;
for (i = 0; i < 8; i++) // Convert to binary code
{
ds2751_writeBit (hexNum & 0x01);
// shift the data byte for the next bit
hexNum >>= 1;
}
}
int
ds2751_readByte ()
// It reads a byte from the one-wire and stores it in the array byteArray,
// which will contain the information of the one byte read
{
int loop, result = 0;
for (loop = 0; loop < 8; loop++)
{
// shift the result to get it ready for the next bit
result >>= 1;
// if result is one, then set MS bit
if (ds2751_readBit ())
result |= 0x80;
}
return result;
}
void
ds2751_skipROM ()
// Skip ROM command, when only one DS2438 is being used on the line
{
ds2751_writeByte (0xcc); // Request skip ROM to be executed
}
uint8_t
ds2751_readAddr (uint8_t addr, int8_t *error)
{
uint8_t data;
uint8_t p;
p = ds2751_init ();
if (p)
{
ds2751_skipROM ();
ds2751_writeByte (0x69);
ds2751_writeByte (addr);
data = ds2751_readByte ();
}
else
{
data = 0xeb;
}
if (error != NULL)
{
*error = !p;
}
return data;
}
uint8_t
ds2751_readAddrRange (uint8_t addr, int bytes, uint8_t* buffer)
{
uint8_t p;
int i;
p = ds2751_init ();
if (p)
{
ds2751_skipROM ();
ds2751_writeByte (0x69);
ds2751_writeByte (addr);
for (i=0; i < bytes; i++)
{
*(buffer+i) = ds2751_readByte();
}
}
return p;
}
uint8_t
ds2751_writeAddr (uint8_t addr, uint8_t val)
{
uint8_t error = 0;
error = !ds2751_init ();
ds2751_skipROM ();
ds2751_writeByte (0x6C);
ds2751_writeByte (addr);
ds2751_writeByte (val);
return error;
}
uint8_t
ds2751_refresh ()
{
uint8_t error;
error = !(ds2751_init ());
ds2751_skipROM ();
ds2751_writeByte (0x63);
return error;
}
uint8_t
ds2751_copyAddr(uint8_t addr)
{
uint8_t error;
error = !ds2751_init();
ds2751_skipROM();
ds2751_writeByte(0x48);
ds2751_writeByte(addr);
//TOSH_uwait(3000);
return error;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/msp430/timerdefs.h | <filename>eon/eon/src/runtime/msp430/timerdefs.h
#ifndef TIMERDEFS
#define TIMERDEFS
//defines the timer interval for the msp430s SysTime module.
enum
{
TIMERRES = (uint32_t)32768L
};
#endif
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/chips/atm128/spi/Atm128Spi.h | // $Id: Atm128Spi.h,v 1.1 2014/11/26 19:31:34 carbajor Exp $
/*
* Copyright (c) 2004-2005 Crossbow Technology, Inc. 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL 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 NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
// @author <NAME> <<EMAIL>>
#ifndef _H_Atm128SPI_h
#define _H_Atm128SPI_h
//====================== SPI Bus ==================================
enum {
ATM128_SPI_CLK_DIVIDE_4 = 0,
ATM128_SPI_CLK_DIVIDE_16 = 1,
ATM128_SPI_CLK_DIVIDE_64 = 2,
ATM128_SPI_CLK_DIVIDE_128 = 3,
};
/* SPI Control Register */
typedef struct {
uint8_t spie : 1; //!< SPI Interrupt Enable
uint8_t spe : 1; //!< SPI Enable
uint8_t dord : 1; //!< SPI Data Order
uint8_t mstr : 1; //!< SPI Master/Slave Select
uint8_t cpol : 1; //!< SPI Clock Polarity
uint8_t cpha : 1; //!< SPI Clock Phase
uint8_t spr : 2; //!< SPI Clock Rate
} Atm128SPIControl_s;
typedef union {
uint8_t flat;
Atm128SPIControl_s bits;
} Atm128SPIControl_t;
typedef Atm128SPIControl_t Atm128_SPCR_t; //!< SPI Control Register
/* SPI Status Register */
typedef struct {
uint8_t spif : 1; //!< SPI Interrupt Flag
uint8_t wcol : 1; //!< SPI Write COLision flag
uint8_t rsvd : 5; //!< Reserved
uint8_t spi2x : 1; //!< Whether we are in double speed
} Atm128SPIStatus_s;
typedef union {
uint8_t flat;
Atm128SPIStatus_s bits;
} Atm128SPIStatus_t;
typedef Atm128SPIStatus_t Atm128_SPSR_t; //!< SPI Status Register
typedef uint8_t Atm128_SPDR_t; //!< SPI Data Register
#endif //_H_Atm128SPI_h
|
tinyos-io/tinyos-3.x-contrib | eon/apps/blink/impl/tinyos/uservariables.h | #ifndef USERVARIABLES_H_
#define USERVARIABLES_H_
#endif
|
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/camera_cmd/camera_cmd_test.c | <filename>intelmote2/support/sdk/c/camera_cmd/camera_cmd_test.c<gh_stars>1-10
#include <time.h>
#include "camera_cmd.h"
#include <stdbool.h>
void callback(int percentage, char* filename, bool updated){
//((part_idx*100)/max_row)
printf("\b\b\b\b\b%4d%%",percentage);
fflush(stdout);
}
int main(int argc, char **argv)
{
if (argc != 5)
{
fprintf(stderr,
"Usage(1): %s <ip_port> <mote_id> <img_type> <progressive_download>\n \t (img_type 0 - bw_raw, 1 - col_raw 2 - bw_jpg, 3 - col_jpg, 4 - ctp_info)\n",
argv[0]);
exit(2);
}
int port = atoi(argv[1]);
printf("connecting to serialforwarder: localhost:%d\n",port);
comm_init("localhost", port);
int node_id = atoi(argv[2]);
int cmd_id = atoi(argv[3]);
bool is_progressive = (atoi(argv[4])==0)?false:true;
char filename[1024];
int ret=0;
sprintf(filename,"/var/www/sensornet/stargate/tmp/test%d",(int)time(NULL));
if (cmd_id==2)
printf("sending bw_jpg request to node %d: ",node_id);
else if (cmd_id==3)
printf("sending col_jpg request to node %d: ",node_id);
else if (cmd_id==4)
printf("sending ctp_info request to node %d: ",node_id);
if (cmd_id==4) {
printf("%d\n",send_CTP_info_cmd(node_id));
//const unsigned char *packet;
//packet = receive_ctp_info_packet();
receive_ctp_info_packets();
} else {
printf("%d\n",send_img_cmd(node_id, cmd_id));
printf("jpg: 0%%");
ret = receive_img(node_id, is_progressive, filename, &callback);
printf("\n");
if (ret==-1)
printf("no pkts received!\n");
else
printf("written to %s!\n", filename);
}
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | csau/misc/tos/lib/tossim/sim/CC2420.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef __CC2420_H__
#define __CC2420_H__
#include "Ieee154.h"
#ifndef CC2420_DEF_CHANNEL
#define CC2420_DEF_CHANNEL 26
#endif
/**
* Ideally, your receive history size should be equal to the number of
* RF neighbors your node will have
*/
#ifndef RECEIVE_HISTORY_SIZE
#define RECEIVE_HISTORY_SIZE 4
#endif
#define MAX_LPL_CCA_CHECKS 7
#define LPL_CCA_DELAY 1
enum {
DELAY_AFTER_CCA = 1,
};
typedef nx_uint32_t timesync_radio_t;
enum cc2420_enums {
CC2420_TIME_ACK_TURNAROUND = 7, // jiffies
CC2420_TIME_VREN = 20, // jiffies
CC2420_TIME_SYMBOL = 2, // 2 symbols / jiffy
CC2420_BACKOFF_PERIOD = ( 20 / CC2420_TIME_SYMBOL ), // symbols
CC2420_MIN_BACKOFF = ( 20 / CC2420_TIME_SYMBOL ), // platform specific?
CC2420_ACK_WAIT_DELAY = 256, // jiffies
};
#endif
|
tinyos-io/tinyos-3.x-contrib | csau/misc/tos/lib/tossim/sim/TossimRadioMsg.h | <filename>csau/misc/tos/lib/tossim/sim/TossimRadioMsg.h
#ifndef TOSSIM_RADIO_MSG_H
#define TOSSIM_RADIO_MSG_H
#include "AM.h"
typedef nx_struct tossim_header {
nx_am_addr_t dest;
nx_am_addr_t src;
nx_uint8_t length;
nx_am_group_t group;
nx_am_id_t type;
nx_uint8_t dsn;
} tossim_header_t;
typedef nx_struct tossim_footer {
nxle_uint16_t crc;
} tossim_footer_t;
typedef nx_struct tossim_metadata {
nx_int8_t strength;
nx_uint8_t ack;
nx_uint16_t time;
#ifdef LOW_POWER_LISTENING
nx_uint16_t rxInterval;
#endif
#ifdef PACKET_LINK
nx_uint16_t maxRetries;
nx_uint16_t retryDelay;
#endif
} tossim_metadata_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/mcs51/tos/platforms/c8051F340TB/platform_message.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
#ifndef PLATFORM_MESSAGE_H
#define PLATFORM_MESSAGE_H
typedef union message_header {
uint8_t serial;
// serial_header_t serial;
} message_header_t;
typedef union TOSRadioFooter {
uint8_t serial;
} message_footer_t;
typedef union TOSRadioMetadata {
uint8_t serial;
} message_metadata_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/chips/hcs08/timer/Hcs08Timer.h | /* Copyright (c) 2007, <NAME> <<EMAIL>>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the University of Copenhagen nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
@author <NAME> <<EMAIL>>
*/
#ifndef _H_Hsc08Timer_h
#define _H_Hsc08Timer_h
enum {
//Bits in the TPMxSC register
HSC08TIMER_TOF = 0x80,
HSC08TIMER_TOIE = 0x40,
HSC08TIMER_CPWMS = 0x20,
HSC08TIMER_CLKSB = 0x10,
HSC08TIMER_CLKSA = 0x8,
HSC08TIMER_PS2 = 0x4,
HSC08TIMER_PS1 = 0x2,
HSC08TIMER_PS0 = 0x1,
//Clock source
HSC08TIMER_CLK_OFF = 0,
HSC08TIMER_CLK_BUS = 1,
HSC08TIMER_CLK_FIX = 2,
HSC08TIMER_CLK_EXT = 3,
//Clock prescaler
HSC08TIMER__CLOCKDIV_1 = 0,
HSC08TIMER__CLOCKDIV_2 = 1,
HSC08TIMER__CLOCKDIV_4 = 2,
HSC08TIMER__CLOCKDIV_8 = 3,
HSC08TIMER__CLOCKDIV_16 = 4,
HSC08TIMER__CLOCKDIV_32 = 5,
HSC08TIMER__CLOCKDIV_64 = 6,
HSC08TIMER__CLOCKDIV_128 = 7,
//Bits in the TPMxCnSC register
HSC08TIMER_CHnF = 0x80,
HSC08TIMER_CHnIE = 0x40,
HSC08TIMER_MSnB = 0x20,
HSC08TIMER_MSnA = 0x10,
HSC08TIMER_ELSnB = 0x8,
HSC08TIMER_ELSnA = 0x4,
//Timer channel mode
HSC08TIMER_M_CAP = 0,
HSC08TIMER_M_COM = 1,
HSC08TIMER_M_PWM = 2,
//Timer pin settings
HSC08TIMER_P_OFF = 0,
//Capture mode
HSC08TIMER_P_RISE = 1,
HSC08TIMER_P_FALL = 2,
HSC08TIMER_P_BOTH = 3,
//Compare mode
HSC08TIMER_P_TOGGLE = 1,
HSC08TIMER_P_CLEAR = 2,
HSC08TIMER_P_SET = 3,
//PWM mode
HSC08TIMER_P_HIGH = 2,
HSC08TIMER_P_LOW = 1,
};
#endif//_H_Hsc08Timer_h |
tinyos-io/tinyos-3.x-contrib | intelmote2/support/sdk/c/compress/ycc2rgb.h | <filename>intelmote2/support/sdk/c/compress/ycc2rgb.h
/**************** YCbCr -> RGB conversion: most common case **************/
/*
* YCbCr is defined per CCIR 601-1, except that Cb and Cr are
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
* The conversion equations to be implemented are therefore
* R = Y + 1.40200 * Cr
* G = Y - 0.34414 * Cb - 0.71414 * Cr
* B = Y + 1.77200 * Cb
* where Cb and Cr represent the incoming values less CENTERJSAMPLE.
* (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
*
*/
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
#define SCALEBITS 16 /* speediest right-shift on some machines */
#define ONE_HALF ((int32_t) 1 << (SCALEBITS-1))
#define FIX(x) ((int32_t) ((x) * (1L<<SCALEBITS) + 0.5))
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
#define CR_R_OFF 0 /* offset to R => Y section */
#define CB_B_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
#define CR_G_OFF (2*(MAXJSAMPLE+1)) /* etc. */
#define CB_G_OFF (3*(MAXJSAMPLE+1))
#define YCC_RGB_TABLE_SIZE (4*(MAXJSAMPLE+1))
/*
* Initialize tables for YCC->RGB colorspace conversion.
*/
void ycc_rgb_init (int32_t *ycc_rgb_tab)
{
int32_t i,x;
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
ycc_rgb_tab[i+CR_R_OFF] = RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
ycc_rgb_tab[i+CB_B_OFF] = RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
ycc_rgb_tab[i+CR_G_OFF] = (- FIX(0.71414)) * x;
ycc_rgb_tab[i+CB_G_OFF] = (- FIX(0.34414)) * x + ONE_HALF;
}
}
/*
* Convert some rows of samples to the output colorspace.
*
*/
static inline uint8_t range_limit(int32_t val)
{
if (val>255)
return 255;
if (val<0)
return 0;
return val;
}
void ycc_rgb_convert (uint8_t *input_buf, uint8_t *output_buf, int32_t *ctab,
uint16_t width, uint16_t height)
{
int32_t y, cb, cr, i, j;
for (i=0; i<width; i+=3)
for (j=0; j<height; j++)
{
y = input_buf[i+j*width+0];
cb = input_buf[i+j*width+1];
cr = input_buf[i+j*width+2];
output_buf[i+j*width+0] = range_limit(y+ctab[cr+CR_R_OFF]);
output_buf[i+j*width+1] =
range_limit(y+((int) RIGHT_SHIFT(ctab[cb+CB_G_OFF] + ctab[cr+CR_G_OFF],SCALEBITS)));
output_buf[i+j*width+2] = range_limit(y+ctab[cb+CB_B_OFF]);
}
}
|
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/driver/driver_debug.c | <gh_stars>1-10
/* LIBUSB-WIN32, Generic Windows USB Library
* Copyright (c) 2002-2005 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "libusb_driver.h"
#include <stdio.h>
#include <stdarg.h>
int debug_level = LIBUSB_DEBUG_MSG;
void DEBUG_PRINT_NL()
{
#ifdef DBG
if(debug_level >= LIBUSB_DEBUG_MSG)
DbgPrint(("\n"));
#endif
}
void DEBUG_SET_LEVEL(int level)
{
#ifdef DBG
debug_level = level;
#endif
}
void DEBUG_MESSAGE(const char *format, ...)
{
#ifdef DBG
char tmp[256];
if(debug_level >= LIBUSB_DEBUG_MSG)
{
va_list args;
va_start(args, format);
_vsnprintf(tmp, sizeof(tmp) - 1, format, args);
va_end(args);
DbgPrint("LIBUSB-DRIVER - %s", tmp);
}
#endif
}
void DEBUG_ERROR(const char *format, ...)
{
#ifdef DBG
char tmp[256];
if(debug_level >= LIBUSB_DEBUG_ERR)
{
va_list args;
va_start(args, format);
_vsnprintf(tmp, sizeof(tmp) - 1, format, args);
va_end(args);
DbgPrint("LIBUSB-DRIVER - %s", tmp);
}
#endif
}
|
tinyos-io/tinyos-3.x-contrib | diku/mcs51/tos/chips/mcs51/string.h | /**
* Prototypes for Keil built-in functions, that differ from glibc
*
* @author <NAME> <<EMAIL>>
*/
#ifndef STRING_H
#define STRING_H
extern int strlen (char *);
extern void *memcpy (void *s1, void *s2, int n);
extern char memcmp (void *s1, void *s2, int n);
extern void *memset (void *s, char val, int n);
#endif //STRING_H
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/platforms/dig528/hardware.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef __HARDWARE_H__
#define __HARDWARE_H__
/* Include our CPU definitions */
#include <hcs08hardware.h>
// The baudrate to be used by the serial ports
enum {
PLATFORM_BAUDRATE = 38400,
PLATFORM_BYTETIME = 208
};
#endif // _H_hardware_h
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/daq/daq_lib.h | <filename>diku/common/tools/daq/daq_lib.h
/**
* The headerfile for the daq library
*/
#ifndef DAQ_LIB_H
#define DAQ_LIB_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h>
typedef int daq_card_t;
/**
* daq_open opens the daq device pointed to by dev_file, and resets
* the card.
*
* @param dev_file A string containing the device file to open.
* @param daq Points to an instance of daq_card_t. Will be filled, if
* the function is successful
* @return 0, upon success. != 0 if failed.
*/
daq_card_t daq_open(const char* dev_file, daq_card_t *daq);
/**
* daq_close closes a daq device, previously opened by daq_open.
*
* @param daq The device to close
* @return 0 if successful, != 0 otherwise
*/
int daq_close(const daq_card_t *daq);
/**
* daq_reset resets the open card pointed to by daq_card_t
*
* @param daq The card to reset
* @return 0 if successful, != otherwise
*/
int daq_reset(const daq_card_t* daq);
typedef enum {
DG_1000,
DG_100,
DG_10,
DG_1,
} daq_gain_t;
typedef enum {
DR_BIPOL5V,
DR_BIPOL10V,
DR_UNIPOL5V, /* Does not seem to work correctly */
DR_UNIPOL10V,
} daq_range_t;
/**
* daq_config_channel configures the channel that the daq-card should
* use. It also makes sure to wait until the channel is setteled, so
* that it can be put to use, immediately after the function returns.
*
* @param daq The card to set the channel for
* @param channel The channel to use
* @param gain The gain to use for the channel
* @param range The range to use
* @return 0 if OK.
*/
int daq_config_channel(const daq_card_t *daq, int channel, daq_gain_t gain,
daq_range_t range);
/**
* daq_config_channel_nowait does the same as daq_config_channel, only
* it does not wait for the channel to settle.
*
* @param daq The card to set the channel for
* @param channel The channel to use
* @param gain The gain to use for the channel
* @param range The range to use
* @return 0 if OK.
*/
int daq_config_channel_nowait(const daq_card_t *daq, int channel,
daq_gain_t gain, daq_range_t range);
/**
* daq_settle_time calculates the settle time for a given channel
* configuration.
*
* @param gain The gain used.
* @param range The range used.
* @return If > 0, the number of usecs to wait, before the channel is
* setteled. <= 0 if error.
*/
int daq_settle_time(daq_gain_t gain, daq_range_t range);
/**
* daq_wait_usec stalls the program for at least usec usecs :-)
*
* @param daq The card to wait for?
* @param usec The number of usecs to wait
* @return 0 if OK.
*/
int daq_wait_usec(const daq_card_t *daq, unsigned int usec);
/**
* daq_get_sample retrieves a sample from the board. The channel, gain
* and range must be configured in advance by a call to daq_config_channel*.
*
* @param daq The card to obtain a sample from
* @param sample Upon return this will contain the value read from the card.
* @return 0 if OK.
*/
int daq_get_sample(const daq_card_t *daq, uint16_t *sample);
/**
* daq_clear_scan clears the internal list of channels to scan.
*
* @param daq The card to clear the channel list for.
* @return 0 if OK.
*/
int daq_clear_scan(const daq_card_t *daq);
/**
* daq_add_scan adds a new channel/gain/range pair to the list of
* channels to scan.
*
* @param daq The card that should have a new channel to scan
* @param channel The channel that should be added to the list (The
* same channel can be added multible times.
* @param gain The gain for the specific channel
* @param range The range for the channel
* @return 0 if OK.
*/
int daq_add_scan(const daq_card_t *daq, int channel, daq_gain_t gain, daq_range_t range);
int daq_start_scan(const daq_card_t *daq, int sample_rate);
int daq_stop_scan(const daq_card_t *daq);
int daq_get_scan_sample(const daq_card_t *daq, uint16_t *sample);
double daq_convert_result(const daq_card_t *daq, uint16_t sample,
daq_gain_t gain, daq_range_t range);
#ifdef __cplusplus
}
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/lib/tossim/sim_packet.c | <reponame>tinyos-io/tinyos-3.x-contrib
/*
* "Copyright (c) 2005 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
*
* TOSSIM packet abstract data type, so C++ code can call into nesC
* code that does the native-to-network type translation.
*
* @author <NAME>
* @date Jan 2 2006
*/
// $Id: sim_packet.c,v 1.1 2014/11/26 19:31:36 carbajor Exp $
#include <sim_packet.h>
#include <message.h>
// NOTE: This function is defined in lib/tossim/ActiveMessageC. It
// has to be predeclared here because it is defined within that component.
void active_message_deliver(int node, message_t* m, sim_time_t t);
static tossim_header_t* getHeader(message_t* msg) {
return (tossim_header_t*)(msg->data - sizeof(tossim_header_t));
}
void sim_packet_set_source(sim_packet_t* msg, uint16_t src)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->src = src;
}
uint16_t sim_packet_source(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
return hdr->src;
}
void sim_packet_set_destination(sim_packet_t* msg, uint16_t dest)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->dest = dest;
}
uint16_t sim_packet_destination(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
return hdr->dest;
}
void sim_packet_set_length(sim_packet_t* msg, uint8_t length)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->length = length;
}
uint16_t sim_packet_length(sim_packet_t* msg)__attribute__ ((C, spontaneous)) {
tossim_header_t* hdr = getHeader((message_t*)msg);
return hdr->length;
}
void sim_packet_set_type(sim_packet_t* msg, uint8_t type) __attribute__ ((C, spontaneous)){
tossim_header_t* hdr = getHeader((message_t*)msg);
hdr->type = type;
}
uint8_t sim_packet_type(sim_packet_t* msg) __attribute__ ((C, spontaneous)){
tossim_header_t* hdr = getHeader((message_t*)msg);
return hdr->type;
}
uint8_t* sim_packet_data(sim_packet_t* p) __attribute__ ((C, spontaneous)){
message_t* msg = (message_t*)p;
return (uint8_t*)&msg->data;
}
void sim_packet_set_strength(sim_packet_t* p, uint16_t str) __attribute__ ((C, spontaneous)){
message_t* msg = (message_t*)p;
tossim_metadata_t* md = (tossim_metadata_t*)(&msg->metadata);
md->strength = str;
}
void sim_packet_deliver(int node, sim_packet_t* msg, sim_time_t t) __attribute__ ((C, spontaneous)){
if (t < sim_time()) {
t = sim_time();
}
dbg("Packet", "sim_packet.c: Delivering packet %p to %i at %llu\n", msg, node, t);
active_message_deliver(node, (message_t*)msg, t);
}
uint8_t sim_packet_max_length(sim_packet_t* msg) __attribute__ ((C, spontaneous)){
return TOSH_DATA_LENGTH;
}
sim_packet_t* sim_packet_allocate () __attribute__ ((C, spontaneous)){
return (sim_packet_t*)malloc(sizeof(message_t));
}
void sim_packet_free(sim_packet_t* p) __attribute__ ((C, spontaneous)) {
printf("sim_packet.c: Freeing packet %p\n", p);
free(p);
}
|
tinyos-io/tinyos-3.x-contrib | tinymulle/tos/platforms/mulle/softwarespi/Mulle_RF230Spi.h | <gh_stars>1-10
/**
* @author <NAME>
*/
#ifndef __MULLE_RF230SPI_H__
#define __MULLE_RF230SPI_H__
#define UQ_MULLE_SOFTSPIRF230 "SoftSPIRF230C.SoftSPIPacket"
#endif // __MULLE_RF230SPI_H__
|
tinyos-io/tinyos-3.x-contrib | diku/common/lib/compression/simple.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
#include "../../tools/compression/simple/simple_comp.c"
|
tinyos-io/tinyos-3.x-contrib | wsnlab/apps/SecureBaseStation/secure_key.h | #ifndef SECURE_KEY_H
#define SECURE_KEY_H
#define DEFAULT_KEY_USED // Defined only in this generic 'secure_key.h'
#define KEY_SIZE 16
#define KEY {<KEY>}
#define MIC_LENGTH 4
#endif |
tinyos-io/tinyos-3.x-contrib | osu/platforms/psi/chips/msp430/adc12/Msp430Adc12.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>0
/*
* Copyright (c) 2006, Technische Universitaet Berlin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the Technische Universitaet Berlin nor the names
* of its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* - Revision -------------------------------------------------------------
* $Revision: 1.1 $
* $Date: 2007/10/29 21:55:22 $
* @author: <NAME> <<EMAIL>>
* ========================================================================
*/
#ifndef MSP430ADC12_H
#define MSP430ADC12_H
#include "Msp430RefVoltGenerator.h"
#define P6PIN_AUTO_CONFIGURE
#define REF_VOLT_AUTO_CONFIGURE
#define CHECK_ARGS
/*
* The msp430adc12_channel_config_t includes all relevant flags to configure
* the ADC12 for single channel conversions. They are contained in the following
* MSP430 registers: ADC12CTL0, ADC12CTL1, ADC12MCTLx and TACTL of TimerA (if
* applicable) and named according to section "17.3 ADC12 Registers" of the
* "MSP430x1xx Family User's Guide".
*
* **********************************
*
* .inch: ADC12 input channel (ADC12MCTLx register). An (external) input
* channel maps to one of msp430's A0-A7 pins (see device specific data sheet).
*
* .sref: reference voltage (ADC12MCTLx register). If REFERENCE_VREFplus_AVss
* or REFERENCE_VREFplus_VREFnegterm is chosen AND the client wires to the
* Msp430Adc12ClientAutoRVGC or Msp430Adc12ClientAutoDMA_RVGC component then
* the reference voltage generator has automatically been enabled to the
* voltage level defined by the "ref2_5v" flag (see below) when the
* Resource.granted() event is signalled to the client. Otherwise this flag is
* ignored.
*
* .ref2_5v: Reference generator voltage level (ADC12CTL0 register). See "sref"
* flag.
*
* .adc12ssel: ADC12 clock source select for the sample-hold-time (ADC12CTL1
* register). In combination the "adc12ssel", "adc12div" and "sht" define the
* sample-hold-time: "adc12ssel" defines the clock source, "adc12div" defines
* the ADC12 clock divider and "sht" define the time expressed in jiffies.
* (the sample-hold-time depends on the resistence of the attached sensor, and
* is calculated using to the formula in section 17.2.4 of the user guide)
*
* .adc12div: ADC12 clock divider (ADC12CTL1 register). See "adc12ssel".
*
* .sht: Sample-and-hold time (ADC12CTL1 register). See "adc12ssel".
*
* .sampcon_ssel: Clock source for the sampling period (TASSEL for TimerA).
* When an ADC client specifies a non-zero "jiffies" parameter (passed in the
* relevant Msp430Adc12SingleChannel interface commands), the ADC
* implementation will automatically configure TimerA to be sourced from
* "sampcon_ssel" with an input divider of "sampcon_id". During the sampling
* process TimerA will then be used to trigger a conversion every "jiffies"
* clock ticks.
*
* .sampcon_id: Input divider for "sampcon_ssel" (IDx in TACTL register,
* TimerA). See "sampcon_ssel".
*
*
* **********************************
*
* EXAMPLE: Assuming that SMCLK runs at 1 MHz the following code snippet
* performs 2000 ADC conversions on channel A2 with a sampling period of 4000 Hz.
* The sampling period is defined by the combination of SAMPCON_SOURCE_SMCLK,
* SAMPCON_CLOCK_DIV_1 and a "jiffies" parameter of (1000000 / 4000) = 250.
#define NUM_SAMPLES 2000
uint16_t buffer[NUM_SAMPLES];
msp430adc12_channel_config_t config = {
INPUT_CHANNEL_A2, REFERENCE_VREFplus_AVss, REFVOLT_LEVEL_NONE,
SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1, SAMPLE_HOLD_64_CYCLES,
SAMPCON_SOURCE_SMCLK, SAMPCON_CLOCK_DIV_1
};
event void Boot.booted()
{
call Resource.request();
}
event void Resource.granted()
{
error_t result;
result = call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 250);
if (result == SUCCESS)
call SingleChannel.getData();
}
async event uint16_t* SingleChannel.multipleDataReady(uint16_t *buf, uint16_t length)
{
// buffer contains conversion results
}
*/
typedef struct {
unsigned int inch: 4; // input channel
unsigned int sref: 3; // reference voltage
unsigned int ref2_5v: 1; // reference voltage level
unsigned int adc12ssel: 2; // clock source sample-hold-time
unsigned int adc12div: 3; // clock divider sample-hold-time
unsigned int sht: 4; // sample-hold-time
unsigned int sampcon_ssel: 2; // clock source sampcon signal
unsigned int sampcon_id: 2; // clock divider sampcon
unsigned int : 0; // align to a word boundary
} msp430adc12_channel_config_t;
enum inch_enum
{
// see device specific data sheet which pin Ax is mapped to
INPUT_CHANNEL_A0 = 0, // input channel A0
INPUT_CHANNEL_A1 = 1, // input channel A1
INPUT_CHANNEL_A2 = 2, // input channel A2
INPUT_CHANNEL_A3 = 3, // input channel A3
INPUT_CHANNEL_A4 = 4, // input channel A4
INPUT_CHANNEL_A5 = 5, // input channel A5
INPUT_CHANNEL_A6 = 6, // input channel A6
INPUT_CHANNEL_A7 = 7, // input channel A7
EXTERNAL_REF_VOLTAGE_CHANNEL = 8, // VeREF+ (input channel 8)
REF_VOLTAGE_NEG_TERMINAL_CHANNEL = 9, // VREF-/VeREF- (input channel 9)
TEMPERATURE_DIODE_CHANNEL = 10, // Temperature diode (input channel 10)
SUPPLY_VOLTAGE_HALF_CHANNEL = 11, // (AVcc-AVss)/2 (input channel 11-15)
INPUT_CHANNEL_NONE = 12 // illegal (identifies invalid settings)
};
enum sref_enum
{
REFERENCE_AVcc_AVss = 0, // VR+ = AVcc and VR-= AVss
REFERENCE_VREFplus_AVss = 1, // VR+ = VREF+ and VR-= AVss
REFERENCE_VeREFplus_AVss = 2, // VR+ = VeREF+ and VR-= AVss
REFERENCE_AVcc_VREFnegterm = 4, // VR+ = AVcc and VR-= VREF-/VeREF-
REFERENCE_VREFplus_VREFnegterm = 5, // VR+ = VREF+ and VR-= VREF-/VeREF-
REFERENCE_VeREFplus_VREFnegterm = 6 // VR+ = VeREF+ and VR-= VREF-/VeREF-
};
enum ref2_5v_enum
{
REFVOLT_LEVEL_1_5 = 0, // reference voltage of 1.5 V
REFVOLT_LEVEL_2_5 = 1, // reference voltage of 2.5 V
REFVOLT_LEVEL_NONE = 0, // if e.g. AVcc is chosen
};
enum adc12ssel_enum
{
SHT_SOURCE_ADC12OSC = 0, // ADC12OSC
SHT_SOURCE_ACLK = 1, // ACLK
SHT_SOURCE_MCLK = 2, // MCLK
SHT_SOURCE_SMCLK = 3 // SMCLK
};
enum adc12div_enum
{
SHT_CLOCK_DIV_1 = 0, // ADC12 clock divider of 1
SHT_CLOCK_DIV_2 = 1, // ADC12 clock divider of 2
SHT_CLOCK_DIV_3 = 2, // ADC12 clock divider of 3
SHT_CLOCK_DIV_4 = 3, // ADC12 clock divider of 4
SHT_CLOCK_DIV_5 = 4, // ADC12 clock divider of 5
SHT_CLOCK_DIV_6 = 5, // ADC12 clock divider of 6
SHT_CLOCK_DIV_7 = 6, // ADC12 clock divider of 7
SHT_CLOCK_DIV_8 = 7, // ADC12 clock divider of 8
};
enum sht_enum
{
SAMPLE_HOLD_4_CYCLES = 0, // sampling duration is 4 clock cycles
SAMPLE_HOLD_8_CYCLES = 1, // ...
SAMPLE_HOLD_16_CYCLES = 2,
SAMPLE_HOLD_32_CYCLES = 3,
SAMPLE_HOLD_64_CYCLES = 4,
SAMPLE_HOLD_96_CYCLES = 5,
SAMPLE_HOLD_123_CYCLES = 6,
SAMPLE_HOLD_192_CYCLES = 7,
SAMPLE_HOLD_256_CYCLES = 8,
SAMPLE_HOLD_384_CYCLES = 9,
SAMPLE_HOLD_512_CYCLES = 10,
SAMPLE_HOLD_768_CYCLES = 11,
SAMPLE_HOLD_1024_CYCLES = 12
};
enum sampcon_ssel_enum
{
SAMPCON_SOURCE_TACLK = 0, // Timer A clock source is (external) TACLK
SAMPCON_SOURCE_ACLK = 1, // Timer A clock source ACLK
SAMPCON_SOURCE_SMCLK = 2, // Timer A clock source SMCLK
SAMPCON_SOURCE_INCLK = 3, // Timer A clock source is (external) INCLK
};
enum sampcon_id_enum
{
SAMPCON_CLOCK_DIV_1 = 0, // SAMPCON clock divider of 1
SAMPCON_CLOCK_DIV_2 = 1, // SAMPCON clock divider of 2
SAMPCON_CLOCK_DIV_3 = 2, // SAMPCON clock divider of 3
SAMPCON_CLOCK_DIV_4 = 3, // SAMPCON clock divider of 4
};
// The unique string for allocating ADC resource interfaces
#define MSP430ADC12_RESOURCE "Msp430Adc12C.Resource"
// The unique string for accessing HAL2
#define ADCC_SERVICE "AdcC.Service"
// The unique string for accessing HAL2 via ReadStream
#define ADCC_READ_STREAM_SERVICE "AdcC.ReadStream.Client"
typedef struct
{
volatile unsigned
inch: 4, // input channel
sref: 3, // reference voltage
eos: 1; // end of sequence flag
} __attribute__ ((packed)) adc12memctl_t;
/* Test for GCC bug (bitfield access) - only version 3.2.3 is known to be stable */
// check: is this relevant anymore ?
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__)
#if GCC_VERSION == 332
#error "The msp430-gcc version (3.3.2) contains a bug which results in false accessing \
of bitfields in structs and makes MSP430ADC12M.nc fail ! Use version 3.2.3 instead."
#elif GCC_VERSION != 323
#warning "This version of msp430-gcc might contain a bug which results in false accessing \
of bitfields in structs (MSP430ADC12M.nc would fail). Use version 3.2.3 instead."
#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/tos/lib/Nmea/NmeaGga.h | /*
* Copyright (c) 2008 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* RINCON RESEARCH OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* TODO:Add documentation here.
*
* @author <NAME>
*/
#ifndef NMEA_GGA_H
#define NMEA_GGA_H
#include "NmeaTimestamp.h"
#include "NmeaCoordinates.h"
enum nmea_fix_types_enum {
FIX_INVALID = 0,
FIX_GPS = 1,
FIX_DGPS = 2,
FIX_PPS = 3,
FIX_RTK = 4,//Real Time Kinematic
FIX_FLOAT_RTK = 5,//Float RTK
FIX_ESTIMATED = 6,//estimated (dead reckoning) (2.3 feature)
FIX_MANUAL = 7,//Manual input mode
FIX_SIMULATION = 8//Simulation mode
};
enum nmea_gga_fields_enum {
GGA_TIME = 0,
GGA_LATITUDE = 1,
GGA_LONGITUDE = 3,
GGA_FIX_QUALITY = 5,
GGA_NUM_SATELLITES = 6,
GGA_HORZ_DIL = 7,//Horizontal dilution of position
GGA_ALTITUDE = 8,
GGA_GEOID_HEIGHT = 10,
GGA_DGPS_LAST_UPDATE = 12,//time in seconds since last DGPS udpate
GGA_DGPS_ID = 13,//DGPS station ID number
GGA_FIELD_COUNT = 14
};
enum nmea_gga_min_field_len_enum {//minumum length required for current processing of data
GGA_TIM_ML = 6,//Time:HHMMSS (H=hour, M=minute, S=second)
GGA_LAT_ML = 9,//Latitude:DDMM.FF,C (D=degree, M=minute, F=fraction of minute, C=Cardinal direction)
GGA_LON_ML = 10,//Longitude:DDDMM.FF (D=degree, M=minute, F=fraction of minute, C=Cardinal direction)
GGA_FQ_ML = 1,//Fix Quality
GGA_SAT_ML = 2,//Number of sattelites
GGA_HD_ML = 7,//Horizontal dilution of position
GGA_ALT_ML = 1,//Altitude
GGA_GH_ML = 10,//Geiod Height
GGA_DGPSLU_ML = 12,//time in seconds since last DGPS udpate
GGA_DGPSID_ML = 13,//DGPS station ID number
};
typedef struct nmea_gga_msg {
nmea_timestamp_t time;
nmea_latitude_t latitude;
nmea_longitude_t longitude;
uint8_t fixQuality;//one of the FIX_* enums
uint8_t numSatellites;//0-12 for the current gps chip
//horizontal dilution of position
uint16_t altitude;//in meters to one decimal place (divide by 10 to get actual value)
uint16_t geoidHeight;//Height of geoid (mean sea level) above WGS84 ellipsoid
//time in seconds since last DGPS update
//DGPS station ID number
//checksum
} nmea_gga_msg_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | ethz/tinynode184/tos/chips/sx1211/LowPowerListening/SX1211LowPowerListening.h | <reponame>tinyos-io/tinyos-3.x-contrib<gh_stars>1-10
/* Copyright (c) 2007 Shockfish SA
* 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 (updated) modification history and the author appear in
* all copies of this source code.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
* OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @author <NAME>
*
*/
#ifndef SX1211LOWPOWERLISTENING_H
#define SX1211LOWPOWERLISTENING_H
/**
* Amount of time, in milliseconds, to keep the radio on after
* a successful receive addressed to this node
*/
#ifndef DELAY_AFTER_RECEIVE
#define DELAY_AFTER_RECEIVE 20
#endif
/**
* Value used to indicate the message being sent should be transmitted
* one time
*/
#ifndef ONE_MESSAGE
#define ONE_MESSAGE 0
#endif
#ifndef DEFAULT_DUTY_PERIOD
#define DEFAULT_DUTY_PERIOD 1000
#endif
enum {
IDLE = 0,
RX = 1,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/apps/turtle_snapper/impl/mica2dot/uservariables.h | <filename>eon/apps/turtle_snapper/impl/mica2dot/uservariables.h
#ifndef USERVARIABLES_H_
#define USERVARIABLES_H_
#define NUM_TURTLES 15
/**************************************************************************************************
// GLOBAL SINGLE STREAM VARIABLES
**************************************************************************************************/
// should always be accessed atomically;
enum
{
LBFLOW_RECEIVING = 0,
LBFLOW_IDLE = 1
};
//uint8_t listen_beacon_flow_state;
uint16_t g_addr;
//this should indicate whether or not we are in a connection event.
bool g_connected = FALSE;
bool g_active = FALSE;
enum
{
CONNECTION_EVENT_TIMEOUT = 15
};
char __connection_turtle_map[NUM_TURTLES]; //maps turtle index to an actual turtle address
char connARR[NUM_TURTLES];
void clearConnnectionInformation()
{
int i;
for (i = 0; i < NUM_TURTLES; i++)
{
connARR[i] = 0;
__connection_turtle_map[i] = -1;
}
}
uint16_t getTurtleVersionIdx (uint16_t turtle_addr)
{
int i;
// Go through the index map
for (i = 0; i < NUM_TURTLES; i++)
{
if (turtle_addr == __connection_turtle_map[i])
{
return i;
}
}
// It's not in the table... look for a free slot
for (i = 0; i < NUM_TURTLES; i++)
{
if (__connection_turtle_map[i] == -1)
{
__connection_turtle_map[i] = turtle_addr;
return i;
}
}
}
#endif
|
tinyos-io/tinyos-3.x-contrib | tinymulle/tos/platforms/mulle/chips/rf230/RadioConfig.h | /*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: <NAME>
*/
#ifndef __RADIOCONFIG_H__
#define __RADIOCONFIG_H__
//#include <MicaTimer.h>
#include <RF230DriverLayer.h>
enum
{
/**
* This is the value of the TRX_CTRL_0 register
* which configures the output pin currents and the CLKM clock
*/
RF230_TRX_CTRL_0_VALUE = 0,
/**
* This is the default value of the CCA_MODE field in the PHY_CC_CCA register
* which is used to configure the default mode of the clear channel assesment
*/
RF230_CCA_MODE_VALUE = RF230_CCA_MODE_3,
/**
* This is the value of the CCA_THRES register that controls the
* energy levels used for clear channel assesment
*/
RF230_CCA_THRES_VALUE = 0xC7,
};
#ifndef RF230_SLOW_SPI
#define RF230_SLOW_SPI 1
#endif
/* This is the default value of the TX_PWR field of the PHY_TX_PWR register. 0-15*/
#ifndef RF230_DEF_RFPOWER
#define RF230_DEF_RFPOWER 0
#endif
/* This is the default value of the CHANNEL field of the PHY_CC_CCA register. 11-26*/
#ifndef RF230_DEF_CHANNEL
#define RF230_DEF_CHANNEL 11
#endif
/*
* This is the command used to calculate the CRC for the RF230 chip.
* TODO: Check why the default crcByte implementation is in a different endianness
*/
inline uint16_t RF230_CRCBYTE_COMMAND(uint16_t crc, uint8_t data)
{
uint8_t lo8 = crc & 0x00FF;
uint8_t hi8 = (crc >> 8) & 0x00FF;
data ^= lo8; //lo8 (crc);
data ^= data << 4;
return ((((uint16_t)data << 8) | hi8 /*hi8 (crc)*/) ^ (uint8_t)(data >> 4)
^ ((uint16_t)data << 3));
}
/**
* This is the timer type of the radio alarm interface
*/
typedef TMicro TRadio;
/**
* The number of alarm ticks per one second
*/
#ifdef ENABLE_STOP_MODE
#define RADIO_ALARM_SEC 10000000UL/8UL
#else
#define RADIO_ALARM_SEC 1000000UL
#endif
#define RADIO_ALARM_MICROSEC RADIO_ALARM_SEC/1000000UL
/**
* The base two logarithm of the number of radio alarm ticks per one millisecond
*/
#define RADIO_ALARM_MILLI_EXP 10
#endif//__RADIOCONFIG_H__
|
tinyos-io/tinyos-3.x-contrib | tcd/powertossim-z/tinyos_files/tinyos-2.0.2/tos/lib/tossim/sim_event_queue.c | <gh_stars>0
// $Id: sim_event_queue.c,v 1.1 2014/11/26 19:31:35 carbajor Exp $
/* tab:4
* "Copyright (c) 2005 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/**
* The simple TOSSIM wrapper around the underlying heap.
*
* @author <NAME>
* @date November 22 2005
*/
#include <heap.h>
#include <sim_event_queue.h>
static heap_t eventHeap;
void sim_queue_init() __attribute__ ((C, spontaneous)) {
init_heap(&eventHeap);
}
void sim_queue_insert(sim_event_t* event) __attribute__ ((C, spontaneous)) {
dbg("Queue", "Inserting 0x%p\n", event);
heap_insert(&eventHeap, event, event->time);
}
sim_event_t* sim_queue_pop() __attribute__ ((C, spontaneous)) {
long long int key;
return (sim_event_t*)(heap_pop_min_data(&eventHeap, &key));
}
bool sim_queue_is_empty() __attribute__ ((C, spontaneous)) {
return heap_is_empty(&eventHeap);
}
long long int sim_queue_peek_time() __attribute__ ((C, spontaneous)) {
if (heap_is_empty(&eventHeap)) {
return -1;
}
else {
return heap_get_min_key(&eventHeap);
}
}
void sim_queue_cleanup_none(sim_event_t* event) __attribute__ ((C, spontaneous)) {
dbg("Queue", "cleanup_none: 0x%p\n", event);
// Do nothing. Useful for statically allocated events.
}
void sim_queue_cleanup_event(sim_event_t* event) __attribute__ ((C, spontaneous)) {
dbg("Queue", "cleanup_event: 0x%p\n", event);
free(event);
}
void sim_queue_cleanup_data(sim_event_t* event) __attribute__ ((C, spontaneous)) {
dbg("Queue", "cleanup_data: 0x%p\n", event);
free (event->data);
event->data = NULL;
}
void sim_queue_cleanup_total(sim_event_t* event) __attribute__ ((C, spontaneous)) {
dbg("Queue", "cleanup_total: 0x%p\n", event);
free (event->data);
event->data = NULL;
free (event);
}
sim_event_t* sim_queue_allocate_event() {
sim_event_t* evt = (sim_event_t*)malloc(sizeof(sim_event_t));
memset(evt, 0, sizeof(sim_event_t));
evt->mote = sim_node();
return evt;
}
|
tinyos-io/tinyos-3.x-contrib | eon/apps/server-e/impl/telos/usermarshal.h | <reponame>tinyos-io/tinyos-3.x-contrib
#ifndef USERMARSHAL_H_INCLUDED
#define USERMARSHAL_H_INCLUDED
#define TYPE_START 0
#define TYPE_END 1
#define TYPE_UINT8 2
#define TYPE_UINT16 3
#define TYPE_UINT32 4
#define TYPE_INT8 5
#define TYPE_INT16 6
#define TYPE_INT32 7
#define MARSH_OK 0
#define MARSH_ERR 1
#define MARSH_FULL 2
#define MARSH_WAIT 3
#define MARSH_TYPE 4
#define MARSH_DONE 5
//prototypes for built in types
uint8_t encode_int32_t (uint16_t connid, int32_t data);
uint8_t encode_uint32_t (uint16_t connid, uint32_t data);
uint8_t encode_int16_t (uint16_t connid, int16_t data);
uint8_t encode_uint16_t (uint16_t connid, uint16_t data);
uint8_t encode_int8_t (uint16_t connid, int8_t data);
uint8_t encode_uint8_t (uint16_t connid, uint8_t data);
uint8_t encode_bool (uint16_t connid, bool data);
uint8_t encode_RequestMsg (uint16_t connid, RequestMsg data);
/******************************
*Encode functions for user defined types
**********************************/
uint8_t
encode_RequestMsg (uint16_t connid, RequestMsg msg)
{
result_t result;
int i=0;
result = encode_uint16_t (connid, msg.src);
if (result != MARSH_OK)
return result;
result = encode_uint16_t (connid, msg.suid);
if (result != MARSH_OK)
return result;
for (i = 0; i < URL_LENGTH; i++)
{
result = encode_uint8_t (connid, msg.url[i]);
if (result != MARSH_OK)
return result;
}
return MARSH_OK;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | eon/tos/platforms/turtlenet/sim/platform_hardware.h | <gh_stars>1-10
#ifndef HARDWARE_H
#define HARDWARE_H
/*#include <atm128hardware.h>
#include <Atm128Adc.h>
// A/D constants (channels, etc)
enum {
CHANNEL_RSSI = ATM128_ADC_SNGL_ADC0,
CHANNEL_THERMISTOR = ATM128_ADC_SNGL_ADC1, // normally unpopulated
CHANNEL_BATTERY = ATM128_ADC_SNGL_ADC7,
CHANNEL_BANDGAP = 30,
CHANNEL_GND = 31,
// ATM128_ADC_PRESCALE = ATM128_ADC_PRESCALE_64, // normal mica2 prescaler value
ATM128_TIMER0_TICKSPPS = 32768,
};
*/
#endif //HARDWARE_H
|
tinyos-io/tinyos-3.x-contrib | berkeley/apps/AIIT_tutorials/5_Smooth/PrintReadingArr.h |
#ifndef PRINT_READING_ARR_H
#define PRINT_READING_ARR_H
#include "message.h"
enum {
AM_PRINT_READING_ARR_MSG = 0x0C,
MAX_READINGS = 5,
SMOOTH_FACTOR = 3,
DENOMINATOR = 10,
};
typedef nx_struct print_reading_arr_msg {
nx_uint16_t nodeid;
nx_uint16_t min;
nx_uint16_t max;
nx_uint16_t mean;
nx_uint16_t raw_reading[MAX_READINGS];
nx_uint16_t smooth_reading[MAX_READINGS];
} print_reading_arr_msg_t;
#endif
|
tinyos-io/tinyos-3.x-contrib | ucc/PLScheduler/tos/lib/PreemptivePriorityScheduler/TaskPriority.h | /*
* "Copyright (c) 2007 The Regents of the University College Cork
* 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 COLLEGE CORK 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
* COLLEGE CORK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY COLLEGE CORK 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 COLLEGE CORK HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
#ifndef TASKPRIORITY_H_
#define TASKPRIORITY_H_
/*calculate the Number of tasks for each priority queue*/
enum
{
NUM_VERYLOW_TASKS = uniqueCount("TaskPriority<TASKVERYLOW>"),
NUM_LOW_TASKS = uniqueCount("TaskPriority<TASKLOW>"),
NUM_HIGH_TASKS = uniqueCount("TaskPriority<TASKHIGH>"),
NUM_BASIC_TASKS = uniqueCount("TinySchedulerC.TaskBasic"),
NUM_VERYHIGH_TASKS = uniqueCount("TaskPriority<TASKVERYHIGH>"),
NO_TASK = 255,
};
/*calculates the Index of each priority at compile time. If there are no tasks for a priority queue
* than that queue is ignored and the index of the higher queues are decremented*/
enum{
VERYLOW=(NUM_VERYLOW_TASKS>0)?0:NO_TASK,
LOW=(NUM_LOW_TASKS>0)?(1-(VERYLOW==NO_TASK)?1:0):NO_TASK,
BASIC=(NUM_BASIC_TASKS>0)?(2-(((VERYLOW==NO_TASK)?1:0) + ((LOW==NO_TASK)?1:0))):NO_TASK,
HIGH=(NUM_HIGH_TASKS>0)?(3- (((VERYLOW==NO_TASK)?1:0) + ((LOW==NO_TASK)?1:0) + ((BASIC==NO_TASK)?1:0))):NO_TASK,
VERYHIGH=(NUM_VERYHIGH_TASKS>0)?(4-(((VERYLOW==NO_TASK)?1:0) + ((HIGH==NO_TASK)?1:0) + ((LOW==NO_TASK)?1:0) + ((BASIC==NO_TASK)?1:0))):NO_TASK,
NUM_PRIORITIES=(5-(((VERYLOW==NO_TASK)?1:0) + ((HIGH==NO_TASK)?1:0) + ((LOW==NO_TASK)?1:0) + ((BASIC==NO_TASK)?1:0) + ((VERYHIGH==NO_TASK)?1:0))),
MAX_NON_PREEMPTIVE=(3-(((HIGH==NO_TASK)?1:0) + ((LOW==NO_TASK)?1:0) + ((BASIC==NO_TASK)?1:0))),
HIGHER_PREEMPTIVE_INDEX=(MAX_NON_PREEMPTIVE+1),
LOWER_PREEMPTIVE_INDEX=1,
HIGH_MASK = (HIGH==NO_TASK)?0:((0|1)<<1),
BASIC_MASK = (BASIC==NO_TASK)?HIGH_MASK:((HIGH_MASK|1)<<1),
MASK = (LOW==NO_TASK)?BASIC_MASK:((BASIC_MASK|1)<<1),
};
enum{
VERYLOWCASE=(VERYLOW!=NO_TASK)?VERYLOW:NO_TASK,
LOWCASE=(LOW!=NO_TASK)?LOW:NO_TASK-1,
BASICCASE=(BASIC!=NO_TASK)?BASIC:NO_TASK-2,
HIGHCASE=(HIGH!=NO_TASK)?HIGH:NO_TASK-3,
VERYHIGHCASE=(VERYHIGH!=NO_TASK)?VERYHIGH:NO_TASK-4,
};
// (HIGH==NO_TASK)?NO_TASK-4:HIGH:
/** context structure definition */
typedef struct context_s {
/** Stack pointer */
uint16_t *sp;
/** Pointer to stack memory for de-allocating */
uint16_t *stack;
} context_t;
enum{
BASE_CONTEXT=0,
PREEMPTING_CONTEXT=1,
HIGHER_PREEMPT_CONTEXT=2,
NUM_CONTEXTS=3,
};
#endif /*TASKPRIORITY_H_*/
|
tinyos-io/tinyos-3.x-contrib | nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/usbi.h | <filename>nxtmote/misc/src/libusb-win32/libusb-win32-src-0.1.12.1/src/usbi.h
#ifndef _USBI_H_
#define _USBI_H_
#include "usb.h"
#include "error.h"
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
//rup: This resulted in a build error due to multiple definitions in (my) Cygwin
//typedef unsigned long uint32_t;
extern int usb_debug;
/* Some quick and generic macros for the simple kind of lists we use */
#define LIST_ADD(begin, ent) \
do { \
if (begin) { \
ent->next = begin; \
ent->next->prev = ent; \
} else \
ent->next = NULL; \
ent->prev = NULL; \
begin = ent; \
} while(0)
#define LIST_DEL(begin, ent) \
do { \
if (ent->prev) \
ent->prev->next = ent->next; \
else \
begin = ent->next; \
if (ent->next) \
ent->next->prev = ent->prev; \
ent->prev = NULL; \
ent->next = NULL; \
} while (0)
#define DESC_HEADER_LENGTH 2
#define DEVICE_DESC_LENGTH 18
#define CONFIG_DESC_LENGTH 9
#define INTERFACE_DESC_LENGTH 9
#define ENDPOINT_DESC_LENGTH 7
#define ENDPOINT_AUDIO_DESC_LENGTH 9
struct usb_dev_handle {
int fd;
struct usb_bus *bus;
struct usb_device *device;
int config;
int interface;
int altsetting;
/* Added by RMT so implementations can store other per-open-device data */
void *impl_info;
};
/* descriptors.c */
int usb_parse_descriptor(unsigned char *source, char *description, void *dest);
int usb_parse_configuration(struct usb_config_descriptor *config,
unsigned char *buffer);
void usb_fetch_and_parse_descriptors(usb_dev_handle *udev);
void usb_destroy_configuration(struct usb_device *dev);
/* OS specific routines */
int usb_os_find_busses(struct usb_bus **busses);
int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices);
int usb_os_determine_children(struct usb_bus *bus);
void usb_os_init(void);
int usb_os_open(usb_dev_handle *dev);
int usb_os_close(usb_dev_handle *dev);
void usb_free_dev(struct usb_device *dev);
void usb_free_bus(struct usb_bus *bus);
#endif /* _USBI_H_ */
|
tinyos-io/tinyos-3.x-contrib | antlab-polimi/sensors/cameraComm/radio_Backup.h | /*
* Copyright (c) 2006 Stanford University.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Stanford University nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD
* UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @author <NAME> (<EMAIL>)
*/
/*
* Modified by: <NAME>
* contact: <EMAIL>
*/
// NOTE: please "includes AM;" before including this file
#ifndef _BIGMSG_H_
#define _BIGMSG_H_
#define VIDEO_HEADER_LENGTH 3
#define PHOTO_HEADER_LENGTH 2
#define BIGMSG_DATA_SHIFT 6
#define PHOTO_DATA_LENGTH 40//(1<<BIGMSG_DATA_SHIFT)
#define VIDEO_DATA_LENGTH 40
#define DEST 5
#define MAX_RTX 5
enum
{
AM_RADIO_IMGSTAT=127,
AM_RADIO_PHOTO=128,
AM_RADIO_VIDEO=129,
AM_RADIO_CMD=120,
AM_RADIO_TIME_TEST=130,
AM_RADIO_PKT_TEST=131,
AM_TIME_TEST_MSG=113,
AM_PHOTO=110,
AM_IMGSTAT=5,
AM_BIGMSG_FRAME_PART=0x6E,
AM_BIGMSG_FRAME_REQUEST=0x6F,
AM_VIDEO_FRAME_PART=0x70,
};
typedef nx_struct radio_command_part{
nx_uint8_t type;
nx_uint8_t part_id;
} radio_command_t;
typedef nx_struct pkt_test_msg{
nx_uint32_t rcv_inter_pkts;
nx_uint32_t rcv_bs_pkts;
nx_uint32_t rtx_camera_count;
nx_uint32_t rtx_inter_count;
nx_uint32_t frame_num;
} pkt_test_msg_t;
typedef nx_struct time_test_msg{
nx_uint32_t acquire;
nx_uint32_t process;
nx_uint32_t sending;
nx_uint32_t send_size;
nx_uint32_t id;
nx_uint32_t acq_period;
nx_uint32_t pause_time;
} time_test_msg_t;
typedef nx_struct photo_frame_part{
nx_uint16_t part_id;
nx_uint8_t buf[PHOTO_DATA_LENGTH];
} photo_frame_part_t;
typedef nx_struct video_frame_part{
nx_uint8_t frame_id;
nx_uint16_t part_id;
nx_uint8_t buf[VIDEO_DATA_LENGTH];
} video_frame_part_t;
typedef nx_struct photo_frame_request{
nx_uint16_t part_id;
nx_uint16_t send_next_n_parts;
} photo_frame_request_t;
typedef nx_struct video_frame_request{
nx_uint8_t frame_id;
nx_uint8_t part_id;
nx_uint8_t send_next_n_parts;
} video_frame_request_t;
typedef nx_struct imgstat_request{
nx_uint8_t type;
nx_uint16_t width;
nx_uint16_t height;
nx_uint32_t data_size;
nx_uint32_t timeAcq;
nx_uint32_t timeProc;
nx_uint32_t tmp1;
nx_uint32_t tmp2;
nx_uint32_t tmp3;
nx_uint32_t tmp4;
} imgstat_request_t;
#endif //_BIGMSG_H_
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/compression/huffman/huffman_comp.c | <gh_stars>1-10
/**************************************************************************
*
* huffman_comp.c
*
* A simple static huffman compressor.
*
* This file is licensed under the GNU GPL.
*
* (C) 2005, <NAME> <<EMAIL>>
*
*/
#ifndef __AVR_ATmega128__
#define prog_uint8_t uint8_t
#define read_byte(x, y) (x[y])
#else
#include <avr/pgmspace.h>
#define read_byte(x, y) pgm_read_byte_near((x) + (y))
#endif
#ifndef __MSP430__
#include <inttypes.h>
#endif
#include <string.h>
#include CODESET
#include "../compressor.h"
#include "../buffer.h"
//#define PAGES_IN_A_ROW 32
void new_buffer(int16_t *vals)
{
int i;
reset_buffer();
for (i = 0; i < 3; i++) {
write_bits((vals[i] >> 8) & 0x0F, 4);
write_bits(vals[i] & 0xFF, 8);
}
}
inline uint16_t min(uint16_t a, uint16_t b)
{
return a < b ? a : b;
}
uint16_t data_offset;
uint8_t read_count; /* What we have left to read of the current data */
uint16_t buffer;
#ifdef USE_TWO_ARRAYS
uint8_t data_in_first_array;
#endif
inline void increment_data(uint16_t inc)
{
data_offset += inc;
#ifdef USE_TWO_ARRAYS
if (data_in_first_array && data_offset > NEW_ARRAY_POINT - 1) {
data_offset -= NEW_ARRAY_POINT;
data_in_first_array = 0;
}
#endif
}
static void new_bit_position(uint32_t bit_to_read)
{
uint16_t byte = bit_to_read / (uint32_t)8;
read_count = (8 - (bit_to_read % 8));
data_offset = 0;
#ifdef USE_TWO_ARRAYS
data_in_first_array = 1;
#endif
increment_data(byte);
#ifdef USE_TWO_ARRAYS
buffer = read_byte((data_in_first_array
? huffman_code : huffman_code2),
data_offset);
#else
buffer = read_byte(huffman_code, data_offset);
#endif
increment_data(1);
buffer &= (1 << read_count) - 1;
}
static void new_position(uint16_t where)
{
uint32_t bit_to_read = (LENGTH_BITS + VALUE_BITS) * (uint32_t)where;
new_bit_position(bit_to_read);
}
static void advance_bits(uint8_t len)
{
uint32_t bit_to_read;
#ifdef USE_TWO_ARRAYS
if (data_in_first_array) {
bit_to_read = (uint32_t)data_offset * 8;
} else {
bit_to_read = (NEW_ARRAY_POINT + (uint32_t)data_offset) * 8;
}
#else
bit_to_read = (uint32_t)data_offset * 8;
#endif
bit_to_read -= read_count;
bit_to_read += len;
new_bit_position(bit_to_read);
}
static uint8_t read_bits(uint8_t len)
{
uint8_t res;
// Fill the buffer
if (read_count < len) {
buffer <<= 8;
#ifdef USE_TWO_ARRAYS
buffer |= read_byte((data_in_first_array
? huffman_code : huffman_code2),
data_offset);
#else
buffer |= read_byte(huffman_code, data_offset);
#endif
increment_data(1);
read_count += 8;
}
res = (buffer >> (read_count - len)) & ((1 << len) - 1);
read_count -= len;
buffer &= (1 << read_count) - 1;
return res;
}
void real_write_bits(uint8_t value, uint8_t len)
{
uint16_t left = bits_left();
if (left <= len) {
write_bits(value >> (len - left), left);
handle_full_buffer(get_buffer());
reset_buffer();
len -= left;
}
if (len > 0)
write_bits(value, len);
}
void write_code(uint16_t where)
{
uint8_t code_length;
new_position(where);
// Read the length
code_length = read_bits(LENGTH_BITS) + 1;
advance_bits(VALUE_BITS - code_length);
while (code_length != 0) {
uint8_t to_write = min(8, code_length);
real_write_bits(read_bits(to_write), to_write);
code_length -= to_write;
}
}
static int first = 1;
void compress_sample(int16_t digi_x, int16_t digi_y, int16_t digi_z,
uint16_t ana_x, uint16_t ana_y)
{
static uint16_t last_vals[3];
int16_t vals[3];
int i;
vals[0] = digi_x;
vals[1] = digi_y;
vals[2] = digi_z;
if (first) {
/* Initialize */
first = 0;
#ifdef HUFFMAN_DIFFERENCE
new_buffer(vals);
memcpy(last_vals, vals, sizeof(uint16_t) * 3);
return;
#else
reset_buffer();
#endif
}
/* Find the codes for each axis */
for (i = 0; i < 3; i++) {
uint16_t tmp;
#ifdef HUFFMAN_DIFFERENCE
# ifdef HUFFMAN_WHOLE_SYMBOLS
tmp = ((vals[i] + 2048) - (last_vals[i] + 2048) + 4096) & 0xFFF;
# else
tmp = (vals[i] + 2048) - (last_vals[i] + 2048) + 4096;
# endif
#else
# ifdef HUFFMAN_WHOLE_SYMBOLS
tmp = vals[i] + 2048;
# else
tmp = vals[i];
# endif
#endif
#ifdef HUFFMAN_WHOLE_SYMBOLS
write_code(tmp);
#else
write_code(tmp & 0xFF);
write_code((tmp >> 8) & 0xFF);
#endif
}
memcpy(last_vals, vals, sizeof(uint16_t) * 3);
}
void flush()
{
uint8_t *tmp = get_unwritten();
memset(tmp, 0, MEMBUFSIZE - (tmp - get_buffer()));
handle_full_buffer(get_buffer());
first = 1;
}
|
tinyos-io/tinyos-3.x-contrib | intelmote2/libs/BigMsg/BigMsg.h | /*
* Copyright (c) 2006 Stanford University.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Stanford University nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD
* UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @author <NAME> (<EMAIL>)
*/
// NOTE: please "includes AM;" before including this file
#ifndef _BIGMSG_H_
#define _BIGMSG_H_
#define BIGMSG_HEADER_LENGTH 2
#define BIGMSG_DATA_SHIFT 6
#define BIGMSG_DATA_LENGTH (1<<BIGMSG_DATA_SHIFT)
#define TOSH_DATA_LENGTH (BIGMSG_HEADER_LENGTH+BIGMSG_DATA_LENGTH)
enum
{
AM_BIGMSG_FRAME_PART=0x6E,
AM_BIGMSG_FRAME_REQUEST=0x6F,
};
typedef nx_struct bigmsg_frame_part{
//nx_uint16_t source;
nx_uint16_t part_id;
nx_uint8_t buf[BIGMSG_DATA_LENGTH];
} bigmsg_frame_part_t;
typedef nx_struct bigmsg_frame_request{
nx_uint16_t part_id;
nx_uint16_t send_next_n_parts;
} bigmsg_frame_request_t;
#endif //_BIGMSG_H_
|
tinyos-io/tinyos-3.x-contrib | wsu/tools/XMonitor/oasis/apps/OasisApp/build/imote2/app.c | <reponame>tinyos-io/tinyos-3.x-contrib<filename>wsu/tools/XMonitor/oasis/apps/OasisApp/build/imote2/app.c
#define nx_struct struct
#define nx_union union
#define dbg(mode, format, ...) ((void)0)
#define dbg_clear(mode, format, ...) ((void)0)
#define dbg_active(mode) 0
# 4 "/opt/tinyos-1.x/tos/platform/pxa27x/inttypes.h"
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
# 385 "/usr/lib/ncc/nesc_nx.h"
typedef struct { char data[1]; } __attribute__((packed)) nx_int8_t;typedef int8_t __nesc_nxbase_nx_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_int16_t;typedef int16_t __nesc_nxbase_nx_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_int32_t;typedef int32_t __nesc_nxbase_nx_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_int64_t;typedef int64_t __nesc_nxbase_nx_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nx_uint8_t;typedef uint8_t __nesc_nxbase_nx_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nx_uint16_t;typedef uint16_t __nesc_nxbase_nx_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nx_uint32_t;typedef uint32_t __nesc_nxbase_nx_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nx_uint64_t;typedef uint64_t __nesc_nxbase_nx_uint64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_int8_t;typedef int8_t __nesc_nxbase_nxle_int8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_int16_t;typedef int16_t __nesc_nxbase_nxle_int16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_int32_t;typedef int32_t __nesc_nxbase_nxle_int32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_int64_t;typedef int64_t __nesc_nxbase_nxle_int64_t ;
typedef struct { char data[1]; } __attribute__((packed)) nxle_uint8_t;typedef uint8_t __nesc_nxbase_nxle_uint8_t ;
typedef struct { char data[2]; } __attribute__((packed)) nxle_uint16_t;typedef uint16_t __nesc_nxbase_nxle_uint16_t ;
typedef struct { char data[4]; } __attribute__((packed)) nxle_uint32_t;typedef uint32_t __nesc_nxbase_nxle_uint32_t ;
typedef struct { char data[8]; } __attribute__((packed)) nxle_uint64_t;typedef uint64_t __nesc_nxbase_nxle_uint64_t ;
# 12 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/_types.h"
typedef long _off_t;
__extension__
#line 13
typedef long long _off64_t;
typedef int _ssize_t;
# 354 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stddef.h" 3
typedef unsigned int wint_t;
# 33 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/_types.h"
#line 25
typedef struct __nesc_unnamed4242 {
int __count;
union __nesc_unnamed4243 {
wint_t __wch;
unsigned char __wchb[4];
} __value;
} _mbstate_t;
typedef int _flock_t;
# 19 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/reent.h"
typedef unsigned long __ULong;
# 40 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/reent.h" 3
struct _Bigint {
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm {
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
struct _on_exit_args {
void *_fnargs[32];
__ULong _fntypes;
};
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void );
struct _on_exit_args _on_exit_args;
};
struct __sbuf {
unsigned char *_base;
int _size;
};
typedef long _fpos_t;
#line 160
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void *_cookie;
int (*_read)(void *_cookie, char *_buf, int _n);
int (*_write)(void *_cookie, const char *_buf, int _n);
_fpos_t (*_seek)(void *_cookie, _fpos_t _offset, int _whence);
int (*_close)(void *_cookie);
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
int _offset;
struct _reent *_data;
_flock_t _lock;
};
#line 253
typedef struct __sFILE __FILE;
struct _glue {
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
#line 284
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
#line 533
struct _reent {
int _errno;
__FILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _current_category;
const char *_current_locale;
int __sdidinit;
void (*__cleanup)(struct _reent *);
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union __nesc_unnamed4244 {
struct __nesc_unnamed4245 {
unsigned int _unused_rand;
char *_strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[24];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
} _reent;
struct __nesc_unnamed4246 {
unsigned char *_nextf[30];
unsigned int _nmalloc[30];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**_sig_func)(int );
struct _glue __sglue;
__FILE __sf[3];
};
#line 730
struct _reent;
# 213 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stddef.h" 3
typedef long unsigned int size_t;
# 25 "/usr/local/wasabi/usr/local/xscale-elf/include/string.h"
void *memmove(void *, const void *, size_t );
char *strcat(char *, const char *);
char *strcpy(char *, const char *);
size_t strlen(const char *);
int strncmp(const char *, const char *, size_t );
char *strncpy(char *, const char *, size_t );
# 325 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stddef.h" 3
typedef int wchar_t;
# 28 "/usr/local/wasabi/usr/local/xscale-elf/include/stdlib.h"
#line 24
typedef struct __nesc_unnamed4247 {
int quot;
int rem;
} div_t;
#line 30
typedef struct __nesc_unnamed4248 {
long quot;
long rem;
} ldiv_t;
# 17 "/usr/local/wasabi/usr/local/xscale-elf/include/math.h"
union __dmath {
__ULong i[2];
double d;
};
union __dmath;
#line 72
typedef float float_t;
typedef double double_t;
#line 292
struct exception {
int type;
char *name;
double arg1;
double arg2;
double retval;
int err;
};
#line 347
enum __fdlibm_version {
__fdlibm_ieee = -1,
__fdlibm_svid,
__fdlibm_xopen,
__fdlibm_posix
};
enum __fdlibm_version;
# 151 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stddef.h" 3
typedef long int ptrdiff_t;
# 91 "/opt/tinyos-1.x/tos/system/tos.h"
typedef unsigned char bool;
enum __nesc_unnamed4249 {
FALSE = 0,
TRUE = 1
};
uint16_t TOS_LOCAL_ADDRESS = 1;
enum __nesc_unnamed4250 {
FAIL = 0,
SUCCESS = 1
};
static inline uint8_t rcombine(uint8_t r1, uint8_t r2);
typedef uint8_t result_t ;
static inline result_t rcombine(result_t r1, result_t r2);
#line 140
enum __nesc_unnamed4251 {
NULL = 0x0
};
# 11 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/utils.h"
void *safe_malloc(size_t size);
void *safe_calloc(size_t nelem, size_t elsize);
void *safe_realloc(void *ptr, size_t size);
void safe_free(void *ptr);
# 11 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/systemUtil.h"
void printFatalErrorMsg(const char *msg, uint32_t numArgs, ...);
void printFatalErrorMsgHex(const char *msg, uint32_t numArgs, ...);
void resetNode(void);
struct mallinfo {
int arena;
int ordblks;
int smblks;
int hblks;
int hblkhd;
int usmblks;
int fsmblks;
int uordblks;
int fordblks;
int keepcost;
};
struct mallinfo mallinfo(void) ;
# 8 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/assert.h"
extern void printAssertMsg(const char *file, uint32_t line, char *condition) ;
# 104 "/opt/tinyos-1.x/tos/platform/pxa27x/pxa27xhardware.h"
static inline void TOSH_wait(void);
#line 125
static __inline void TOSH_uwait(uint16_t usec);
#line 140
static __inline uint32_t _pxa27x_clzui(uint32_t i);
typedef uint32_t __nesc_atomic_t;
__inline __nesc_atomic_t __nesc_atomic_start(void ) ;
#line 181
__inline void __nesc_atomic_end(__nesc_atomic_t oldState) ;
#line 215
static __inline void __nesc_enable_interrupt(void);
#line 230
static __inline void __nesc_atomic_sleep(void);
# 58 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Const.h"
enum __nesc_unnamed4252 {
CC2420_TIME_BIT = 4,
CC2420_TIME_BYTE = CC2420_TIME_BIT << 3,
CC2420_TIME_SYMBOL = 16
};
uint8_t CC2420_CHANNEL = 26;
uint8_t CC2420_RFPOWER = 2;
enum __nesc_unnamed4253 {
CC2420_MIN_CHANNEL = 11,
CC2420_MAX_CHANNEL = 26
};
#line 261
enum __nesc_unnamed4254 {
CP_MAIN = 0,
CP_MDMCTRL0,
CP_MDMCTRL1,
CP_RSSI,
CP_SYNCWORD,
CP_TXCTRL,
CP_RXCTRL0,
CP_RXCTRL1,
CP_FSCTRL,
CP_SECCTRL0,
CP_SECCTRL1,
CP_BATTMON,
CP_IOCFG0,
CP_IOCFG1
};
# 46 "/opt/tinyos-1.x/tos/platform/imote2/AM.h"
enum __nesc_unnamed4255 {
TOS_BCAST_ADDR = 0xffff,
TOS_UART_ADDR = 0x007e
};
enum __nesc_unnamed4256 {
TOS_DEFAULT_AM_GROUP = 0x7D
};
uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP;
#line 101
#line 71
typedef struct TOS_Msg {
uint8_t length;
uint8_t fcfhi;
uint8_t fcflo;
uint8_t dsn;
uint16_t destpan;
uint16_t addr;
uint8_t type;
uint8_t group;
int8_t data[74];
uint8_t strength;
uint8_t lqi;
bool crc;
bool ack;
uint16_t time;
uint32_t time32Low __attribute((aligned(32))) ;
uint32_t time32High;
} __attribute((aligned(32))) __attribute((packed)) TOS_Msg;
enum __nesc_unnamed4257 {
MSG_HEADER_SIZE = (size_t )& ((struct TOS_Msg *)0)->data - 1,
MSG_FOOTER_SIZE = 2,
MSG_DATA_SIZE = (size_t )& ((struct TOS_Msg *)0)->strength + sizeof(uint16_t ),
DATA_LENGTH = 74,
LENGTH_BYTE_NUMBER = (size_t )& ((struct TOS_Msg *)0)->length + 1
};
typedef TOS_Msg *TOS_MsgPtr;
# 83 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
enum __nesc_unnamed4258 {
TOSH_period16 = 0x00,
TOSH_period32 = 0x01,
TOSH_period64 = 0x02,
TOSH_period128 = 0x03,
TOSH_period256 = 0x04,
TOSH_period512 = 0x05,
TOSH_period1024 = 0x06,
TOSH_period2048 = 0x07
};
const uint8_t TOSH_IRP_TABLE[40] = { 0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0x02,
0x03,
0x04,
0x00,
0x08,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0x07,
0xFF,
0x06,
0xFF,
0x05,
0x01,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0x09,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF };
static __inline void TOSH_SET_RED_LED_PIN(void);
#line 141
static __inline void TOSH_CLR_RED_LED_PIN(void);
static __inline void TOSH_SET_GREEN_LED_PIN(void);
#line 142
static __inline void TOSH_CLR_GREEN_LED_PIN(void);
static __inline void TOSH_SET_YELLOW_LED_PIN(void);
#line 143
static __inline void TOSH_CLR_YELLOW_LED_PIN(void);
#line 181
static __inline void TOSH_SET_CC_VREN_PIN(void);
#line 181
static __inline void TOSH_CLR_CC_VREN_PIN(void);
#line 181
static __inline void TOSH_MAKE_CC_VREN_OUTPUT(void);
static __inline void TOSH_SET_CC_RSTN_PIN(void);
#line 182
static __inline void TOSH_CLR_CC_RSTN_PIN(void);
#line 182
static __inline void TOSH_MAKE_CC_RSTN_OUTPUT(void);
static __inline char TOSH_READ_CC_FIFO_PIN(void);
#line 183
static __inline void TOSH_MAKE_CC_FIFO_INPUT(void);
static __inline char TOSH_READ_RADIO_CCA_PIN(void);
#line 184
static __inline void TOSH_MAKE_RADIO_CCA_INPUT(void);
static __inline char TOSH_READ_CC_FIFOP_PIN(void);
#line 185
static __inline void TOSH_MAKE_CC_FIFOP_INPUT(void);
static __inline char TOSH_READ_CC_SFD_PIN(void);
#line 186
static __inline void TOSH_MAKE_CC_SFD_INPUT(void);
static __inline void TOSH_SET_CC_CSN_PIN(void);
#line 187
static __inline void TOSH_CLR_CC_CSN_PIN(void);
#line 187
static __inline void TOSH_MAKE_CC_CSN_OUTPUT(void);
static inline void TOSH_SET_PIN_DIRECTIONS(void );
# 75 "/home/xu/oasis/system/dbg_modes.h"
typedef long long TOS_dbg_mode;
enum __nesc_unnamed4259 {
DBG_ALL = ~0ULL,
DBG_BOOT = 1ULL << 0,
DBG_CLOCK = 1ULL << 1,
DBG_TASK = 1ULL << 2,
DBG_SCHED = 1ULL << 3,
DBG_SENSOR = 1ULL << 4,
DBG_LED = 1ULL << 5,
DBG_CRYPTO = 1ULL << 6,
DBG_ROUTE = 1ULL << 7,
DBG_AM = 1ULL << 8,
DBG_CRC = 1ULL << 9,
DBG_PACKET = 1ULL << 10,
DBG_ENCODE = 1ULL << 11,
DBG_RADIO = 1ULL << 12,
DBG_LOG = 1ULL << 13,
DBG_ADC = 1ULL << 14,
DBG_I2C = 1ULL << 15,
DBG_UART = 1ULL << 16,
DBG_PROG = 1ULL << 17,
DBG_SOUNDER = 1ULL << 18,
DBG_TIME = 1ULL << 19,
DBG_POWER = 1ULL << 20,
DBG_SIM = 1ULL << 21,
DBG_QUEUE = 1ULL << 22,
DBG_SIMRADIO = 1ULL << 23,
DBG_HARD = 1ULL << 24,
DBG_MEM = 1ULL << 25,
DBG_USR1 = 1ULL << 27,
DBG_USR2 = 1ULL << 28,
DBG_USR3 = 1ULL << 29,
DBG_TEMP = 1ULL << 30,
DBG_ERROR = 1ULL << 31,
DBG_NONE = 0,
DBG_DEFAULT = DBG_ALL,
DBG_ERR = 1ULL << 63,
DBG_UTIL = 1ULL << 62,
DBG_NETWORKCOMM = 1ULL << 61,
DBG_GENERICCOMMPRO = 1ULL << 61,
DBG_ROUTEMANAGE = 1ULL << 60,
DBG_SINKCAST = 1ULL << 59,
DBG_BROADCAST = 1ULL << 58,
DBG_TRANSPORTRDT = 1ULL << 57,
DBG_CAS = 1ULL << 56,
DBG_TMAC = 1ULL << 55,
DBG_TOPO = 1ULL << 54,
DBG_SNMS = 1ULL << 53,
DBG_SENSING = 1ULL << 52,
DBG_MULTIHOPENGINE = 1ULL << 51,
DBG_RDT = 1ULL << 50,
DBG_NEIGHBORMGMT = 1ULL << 49,
DBG_WF = 1ULL << 48,
DBG_DV = 1ULL << 47,
DBG_TSYNC = 1ULL << 46,
DBG_APP = 1ULL << 32,
DBG_MIDWARE = 1ULL << 36
};
# 61 "/opt/tinyos-1.x/tos/platform/imote2/sched.c"
#line 56
typedef struct __nesc_unnamed4260 {
void (*tp)(void);
void *postingFunction;
uint32_t timestamp;
uint32_t executeTime;
} TOSH_sched_entry_T;
enum __nesc_unnamed4261 {
TOSH_MAX_TASKS = 1 << 8,
TOSH_TASK_BITMASK = TOSH_MAX_TASKS - 1
};
uint32_t sys_task_bitmask;
uint32_t sys_max_tasks;
volatile TOSH_sched_entry_T TOSH_queue[TOSH_MAX_TASKS];
uint8_t TOSH_sched_full;
volatile uint8_t TOSH_sched_free;
static inline void TOSH_sched_init(void );
#line 105
bool TOS_post(void (*tp)(void));
#line 119
bool TOS_post(void (*tp)(void)) ;
#line 164
static inline bool TOSH_run_next_task(void);
#line 192
static inline void TOSH_run_task(void);
# 149 "/opt/tinyos-1.x/tos/system/tos.h"
static void *nmemcpy(void *to, const void *from, size_t n);
static inline void *nmemset(void *to, int val, size_t n);
# 28 "/opt/tinyos-1.x/tos/system/Ident.h"
enum __nesc_unnamed4262 {
IDENT_MAX_PROGRAM_NAME_LENGTH = 16
};
#line 33
typedef struct __nesc_unnamed4263 {
uint32_t unix_time;
uint32_t user_hash;
char program_name[IDENT_MAX_PROGRAM_NAME_LENGTH];
} Ident_t;
#line 52
static const Ident_t G_Ident = {
.unix_time = 0x4a17227cL,
.user_hash = 0x4c6e9f74L,
.program_name = "OasisApp" };
# 48 "/home/xu/oasis/system/OasisType.h"
typedef uint16_t address_t;
#line 83
enum TosType {
AM_NETWORKMSG = 129,
AM_ROUTEBEACONMSG = 130,
AM_NEIGHBORBEACONMSG = 131,
AM_CASCTRLMSG = 132,
AM_CASCADESMSG = 133
};
#line 107
#line 94
typedef struct NetworkMsg {
address_t linksource;
uint8_t type;
uint8_t ttl : 5, qos : 3;
union {
struct {
address_t dest;
address_t source;
} __attribute((packed)) ;
uint32_t crc;
} __attribute((packed)) ;
uint16_t seqno;
uint8_t data[0];
} __attribute((packed)) NetworkMsg;
enum NetType {
NW_DATA = 1,
NW_SNMS = 2,
NW_RPCR = 3,
NW_RPCC = 4,
NW_RDTACK = 5
};
#line 121
typedef enum __nesc_unnamed4264 {
ADDR_SINK = 0xfd,
ADDR_MCAST = 0xfe,
ADDR_BCAST = 0xff
} OasisAddr_t;
#line 158
#line 153
typedef struct ApplicationMsg {
uint8_t type;
uint8_t length;
uint16_t seqno;
uint8_t data[0];
} __attribute((packed)) ApplicationMsg;
enum AppType {
TYPE_DATA_SEISMIC = 0,
TYPE_DATA_INFRASONIC = 1,
TYPE_DATA_LIGHTNING = 2,
TYPE_DATA_RSAM1 = 3,
TYPE_DATA_RVOL = 4,
TYPE_DATA_TEMP = 5,
TYPE_DATA_ACCELX = 6,
TYPE_DATA_ACCELY = 7,
TYPE_DATA_MAGX = 8,
TYPE_DATA_MAGY = 9,
TYPE_DATA_MIC = 10,
TYPE_DATA_RSAM2 = 17,
TYPE_DATA_COMPRESS = 18,
TYPE_DATA_TREMOR = 19,
TYPE_DATA_LQI = 20,
TYPE_DATA_GPS = 28,
TYPE_SNMS_EVENT = 11,
TYPE_SNMS_RPCCOMMAND = 12,
TYPE_SNMS_RPCRESPONSE = 13,
TYPE_SNMS_CODE = 14
};
enum EventType {
EVENT_TYPE_ALL = 0,
EVENT_TYPE_SNMS = 1,
EVENT_TYPE_SENSING = 2,
EVENT_TYPE_MIDDLEWARE = 3,
EVENT_TYPE_ROUTING = 4,
EVENT_TYPE_MAC = 5,
EVENT_TYPE_DATAMANAGE = 6,
EVENT_TYPE_SEISMICEVENT = 7
};
enum TypeRange {
EVENT_TYPE_VALUE_MIN = 0,
EVENT_TYPE_VALUE_MAX = 5
};
enum EventLevel {
EVENT_LEVEL_URGENT = 0,
EVENT_LEVEL_HIGH = 1,
EVENT_LEVEL_MEDIUM = 2,
EVENT_LEVEL_LOW = 3
};
enum LevelRange {
EVENT_LEVEL_VALUE_MIN = 0,
EVENT_LEVEL_VALUE_MAX = 3
};
enum EventSendFailType {
BUFFER_FAIL = 2,
FILTER_FAIL = 3
};
# 65 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHop.h"
enum __nesc_unnamed4265 {
AM_BEACONMSG = 250
};
#line 69
typedef struct BeaconMsg {
uint16_t parent;
uint16_t parent_dup;
uint16_t cost;
uint16_t hopcount;
} __attribute((packed)) BeaconMsg;
# 14 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/MMU.h"
void initMMU(void);
void initSyncFlash(void);
void enableICache(void);
void enableDCache(void);
#line 50
void invalidateDCache(uint8_t *address, int32_t numbytes);
# 8 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/queue.h"
enum __nesc_unnamed4266 {
defaultQueueSize = 256
};
#line 12
typedef struct __nesc_unnamed4267 {
uint32_t entries[256];
uint16_t head, tail;
uint16_t size;
} queue_t;
#line 18
typedef struct __nesc_unnamed4268 {
void *entries[256];
uint16_t head, tail;
uint16_t size;
} ptrqueue_t;
#line 44
int popqueue(queue_t *queue, uint32_t *val);
void *popptrqueue(ptrqueue_t *queue, int *status);
#line 57
void *peekptrqueue(ptrqueue_t *queue, int *status);
void initqueue(queue_t *queue, uint32_t size);
void initptrqueue(ptrqueue_t *queue, uint32_t size);
# 43 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stdarg.h"
typedef __builtin_va_list __gnuc_va_list;
# 24 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/types.h"
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
__extension__
#line 39
typedef long long __int64_t;
__extension__
#line 40
typedef unsigned long long __uint64_t;
# 36 "/usr/local/wasabi/usr/local/xscale-elf/include/machine/types.h" 3
typedef long int __off_t;
typedef int __pid_t;
__extension__
#line 39
typedef long long int __loff_t;
# 78 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/types.h"
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long clock_t;
typedef long time_t;
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
typedef long daddr_t;
typedef char *caddr_t;
# 121 "/usr/local/wasabi/usr/local/xscale-elf/include/sys/types.h" 3
typedef unsigned short ino_t;
#line 155
typedef short dev_t;
typedef long off_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef int pid_t;
typedef long key_t;
typedef _ssize_t ssize_t;
#line 184
typedef unsigned int mode_t __attribute((__mode__(__SI__))) ;
typedef unsigned short nlink_t;
#line 211
typedef long fd_mask;
#line 219
typedef struct _types_fd_set {
fd_mask fds_bits[(64 + (sizeof(fd_mask ) * 8 - 1)) / (sizeof(fd_mask ) * 8)];
} _types_fd_set;
# 50 "/usr/local/wasabi/usr/local/xscale-elf/include/stdio.h"
typedef __FILE FILE;
# 59 "/usr/local/wasabi/usr/local/xscale-elf/include/stdio.h" 3
typedef _fpos_t fpos_t;
# 172 "/usr/local/wasabi/usr/local/xscale-elf/include/stdio.h"
int fclose(FILE *);
int sscanf(const char *, const char *, ...);
#line 217
int sprintf(char *, const char *, ...);
#line 236
int vsnprintf(char *, size_t , const char *, __gnuc_va_list );
# 8 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/trace.h"
void trace(long long mode, const char *format, ...);
unsigned char trace_active(long long mode);
void trace_unset(void);
void trace_set(long long mode);
# 6 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/frequency.h"
uint32_t getSystemFrequency(void);
uint32_t getSystemBusFrequency(void);
# 3 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_types.h"
enum __nesc_unnamed4269 {
BLUSH_SUCCESS_DONE = 0,
BLUSH_SUCCESS_NOT_DONE,
BLUSH_FAIL
};
typedef uint8_t BluSH_result_t;
#line 11
typedef struct __BluSHdata_t {
uint8_t *src;
uint32_t len;
uint8_t state;
} BluSHdata_t;
typedef BluSHdata_t *BluSHdata;
# 3 "/opt/tinyos-1.x/tos/platform/imote2/BluSH.h"
enum __nesc_unnamed4270 {
BLUSH_APP_COUNT = 13U
};
# 40 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/bufferManagement.h"
#line 37
typedef enum __nesc_unnamed4271 {
originSendData = 0,
originSendDataAlloc
} sendOrigin_t;
#line 42
typedef struct bufferInfo_t {
uint8_t *pBuf;
uint32_t numBytes;
sendOrigin_t origin;
} bufferInfo_t;
#line 48
typedef struct timestampedBufferInfo_t {
uint8_t *pBuf;
uint64_t timestamp;
uint32_t numBytes;
sendOrigin_t origin;
} timestampedBufferInfo_t;
#line 55
typedef struct bufferInfoInfo_t {
bufferInfo_t BI;
char inuse;
} bufferInfoInfo_t;
#line 60
typedef struct timestampedBufferInfoInfo_t {
timestampedBufferInfo_t BI;
char inuse;
} timestampedBufferInfoInfo_t;
#line 65
typedef struct buffer_t {
uint8_t *buf;
char inuse;
} buffer_t;
#line 81
#line 77
typedef struct bufferSet_t {
uint32_t numBuffers;
uint32_t bufferSize;
buffer_t *pB;
} bufferSet_t;
#line 83
typedef struct bufferInfoSet_t {
uint32_t numBuffers;
bufferInfoInfo_t *pBII;
} bufferInfoSet_t;
#line 88
typedef struct timestampedBufferInfoSet_t {
uint32_t numBuffers;
timestampedBufferInfoInfo_t *pBII;
} timestampedBufferInfoSet_t;
int initBufferSet(bufferSet_t *pBS, buffer_t *pB, uint8_t **buffers, uint32_t numBuffers, uint32_t bufferSize);
uint8_t *getNextBuffer(bufferSet_t *pBS);
int returnBuffer(bufferSet_t *pBS, uint8_t *buf);
int initBufferInfoSet(bufferInfoSet_t *pBIS,
bufferInfoInfo_t *pBII,
uint32_t numBIIs);
bufferInfo_t *getNextBufferInfo(bufferInfoSet_t *pBII);
int returnBufferInfo(bufferInfoSet_t *pBII, bufferInfo_t *pBI);
# 7 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.h"
#line 4
typedef struct __nesc_unnamed4272 {
uint8_t *RxBuffer;
uint8_t *TxBuffer;
} BulkTxRxBuffer_t;
# 10 "/opt/tinyos-1.x/tos/platform/pxa27x/DMA.h"
#line 4
typedef enum __nesc_unnamed4273 {
DMA_ENDINTEN = 1,
DMA_STARTINTEN = 2,
DMA_EORINTEN = 4,
DMA_STOPINTEN = 8
} DMAInterruptEnable_t;
#line 12
typedef enum __nesc_unnamed4274 {
DMA_8ByteBurst = 1,
DMA_16ByteBurst,
DMA_32ByteBurst
} DMAMaxBurstSize_t;
#line 19
typedef enum __nesc_unnamed4275 {
DMA_NonPeripheralWidth = 0,
DMA_1ByteWidth,
DMA_2ByteWidth,
DMA_4ByteWidth
} DMATransferWidth_t;
#line 27
typedef enum __nesc_unnamed4276 {
DMA_Priority1 = 1,
DMA_Priority2 = 2,
DMA_Priority3 = 4,
DMA_Priority4 = 8
} DMAPriority_t;
#line 107
#line 35
typedef enum __nesc_unnamed4277 {
DMAID_DREQ0 = 0,
DMAID_DREQ1,
DMAID_I2S_RX,
DMAID_I2S_TX,
DMAID_BTUART_RX,
DMAID_BTUART_TX,
DMAID_FFUART_RX,
DMAID_FFUART_TX,
DMAID_AC97_MIC,
DMAID_AC97_MODEMRX,
DMAID_AC97_MODEMTX,
DMAID_AC97_AUDIORX,
DMAID_AC97_AUDIOTX,
DMAID_SSP1_RX,
DMAID_SSP1_TX,
DMAID_SSP2_RX,
DMAID_SSP2_TX,
DMAID_ICP_RX,
DMAID_ICP_TX,
DMAID_STUART_RX,
DMAID_STUART_TX,
DMAID_MMC_RX,
DMAID_MMC_TX,
DMAID_USB_END0 = 24,
DMAID_USB_ENDA,
DMAID_USB_ENDB,
DMAID_USB_ENDC,
DMAID_USB_ENDD,
DMAID_USB_ENDE,
DMAID_USB_ENDF,
DMAID_USB_ENDG,
DMAID_USB_ENDH,
DMAID_USB_ENDI,
DMAID_USB_ENDJ,
DMAID_USB_ENDK,
DMAID_USB_ENDL,
DMAID_USB_ENDM,
DMAID_USB_ENDN,
DMAID_USB_ENDP,
DMAID_USB_ENDQ,
DMAID_USB_ENDR,
DMAID_USB_ENDS,
DMAID_USB_ENDT,
DMAID_USB_ENDU,
DMAID_USB_ENDV,
DMAID_USB_ENDW,
DMAID_USB_ENDX,
DMAID_MSL_RX1,
DMAID_MSL_TX1,
DMAID_MSL_RX2,
DMAID_MSL_TX2,
DMAID_MSL_RX3,
DMAID_MSL_TX3,
DMAID_MSL_RX4,
DMAID_MSL_TX4,
DMAID_MSL_RX5,
DMAID_MSL_TX5,
DMAID_MSL_RX6,
DMAID_MSL_TX6,
DMAID_MSL_RX7,
DMAID_MSL_TX7,
DMAID_USIM_RX,
DMAID_USIM_TX,
DMAID_MEMSTICK_RX,
DMAID_MEMSTICK_TX,
DMAID_SSP3_RX,
DMAID_SSP3_TX,
DMAID_CIF_RX0,
DMAID_CIF_RX1,
DMAID_DREQ2
} DMAPeripheralID_t;
# 6 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/profile.h"
#line 4
typedef struct __nesc_unnamed4278 {
unsigned long IC_access, IC_miss, DC_access, DC_miss, cycles;
} profileInfo_t;
#line 8
typedef enum __nesc_unnamed4279 {
profilePrintAll = 0,
profilePrintCycles
}
profilePrintInfo_t;
# 39 "/opt/tinyos-1.x/tos/interfaces/Timer.h"
enum __nesc_unnamed4280 {
TIMER_REPEAT = 0,
TIMER_ONE_SHOT = 1,
NUM_TIMERS = 27U
};
# 34 "/opt/tinyos-1.x/tos/interfaces/Clock.h"
enum __nesc_unnamed4281 {
TOS_I1024PS = 0, TOS_S1024PS = 3,
TOS_I512PS = 1, TOS_S512PS = 3,
TOS_I256PS = 3, TOS_S256PS = 3,
TOS_I128PS = 7, TOS_S128PS = 3,
TOS_I64PS = 15, TOS_S64PS = 3,
TOS_I32PS = 31, TOS_S32PS = 3,
TOS_I16PS = 63, TOS_S16PS = 3,
TOS_I8PS = 127, TOS_S8PS = 3,
TOS_I4PS = 255, TOS_S4PS = 3,
TOS_I2PS = 15, TOS_S2PS = 7,
TOS_I1PS = 31, TOS_S1PS = 7,
TOS_I0PS = 0, TOS_S0PS = 0
};
enum __nesc_unnamed4282 {
DEFAULT_SCALE = 3, DEFAULT_INTERVAL = 255
};
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline int is_host_lsb(void);
static __inline uint16_t toLSB16(uint16_t a);
static __inline uint16_t fromLSB16(uint16_t a);
# 105 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 59 "/home/xu/oasis/lib/SNMS/Event.h"
#line 54
typedef struct EventMsg {
uint8_t type;
uint8_t level;
uint8_t length;
uint8_t data[0];
} __attribute((packed)) EventMsg;
uint8_t gTempEventBuf[80];
uint8_t gTempScratch[16];
static uint8_t *eventprintf(const uint8_t *format, ...);
# 39 "/home/xu/oasis/lib/Rpc/Rpc.h"
struct __nesc_attr_rpc {
};
enum rpcMsgs {
AM_RPCCOMMANDMSG = 211,
AM_RPCRESPONSEMSG = 212
};
enum rpcErrorCodes {
RPC_SUCCESS = 0,
RPC_GARBAGE_ARGS = 1,
RPC_RESPONSE_TOO_LARGE = 2,
RPC_PROCEDURE_UNAVAIL = 3,
RPC_SYSTEM_ERR = 4,
RPC_WRONG_XML_FILE = 5
};
#line 72
#line 59
typedef struct RpcCommandMsg {
uint8_t transactionID;
uint8_t commandID;
uint8_t responseDesired;
uint8_t dataLength;
uint16_t address;
uint16_t returnAddress;
uint32_t unix_time;
uint32_t user_hash;
uint8_t data[0];
} __attribute((packed)) RpcCommandMsg;
#line 74
typedef struct RpcResponseMsg {
uint8_t transactionID;
uint8_t commandID;
uint16_t sourceAddress;
uint8_t errorCode;
uint8_t dataLength;
uint8_t data[0];
} __attribute((packed)) RpcResponseMsg;
# 31 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
enum __nesc_unnamed4283 {
MAX_BUFFER_SIZE = 56,
#line 44
MEM_QUEUE_SIZE = 200,
NUM_STATUS = 6
};
#line 48
typedef enum __nesc_unnamed4284 {
FREEMEM = 0,
FILLING = 1,
FILLED = 2,
MEMPROCESSING = 3,
MEMPENDING = 4,
MEMCOMPRESSING = 5
} MemStatus_t;
#line 70
#line 58
typedef struct SensorBlkMgmt_t {
uint32_t time;
uint16_t taskCode;
uint16_t interval;
uint8_t compressnum;
int16_t next;
int16_t prev;
uint8_t size;
uint8_t priority;
uint8_t status;
uint8_t type;
uint8_t buffer[MAX_BUFFER_SIZE];
} SensorBlkMgmt_t;
typedef SensorBlkMgmt_t *SenBlkPtr;
#line 74
typedef struct MemQueue_t {
int16_t size;
int16_t total;
int16_t head[NUM_STATUS];
int16_t tail[NUM_STATUS];
SensorBlkMgmt_t element[MEM_QUEUE_SIZE];
} MemQueue_t;
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2);
static inline result_t initSenorMem(MemQueue_t *queue, uint16_t size);
#line 125
static SenBlkPtr headMemElement(MemQueue_t *queue, MemStatus_t status);
#line 147
static SenBlkPtr getMemElementByIndex(MemQueue_t *queue, int16_t ind);
#line 161
static inline SenBlkPtr allocSensorMem(MemQueue_t *bufQueue);
#line 194
static inline result_t freeSensorMem(MemQueue_t *queue, SenBlkPtr obj);
#line 247
static result_t changeMemStatus(MemQueue_t *queue, SenBlkPtr obj, MemStatus_t status1, MemStatus_t status2);
#line 263
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2);
# 33 "/home/xu/oasis/lib/SmartSensing/Sensing.h"
enum SamplingRate {
SEISMIC_RATE = 100,
INFRASONIC_RATE = 50,
LIGHTNING_RATE = 1,
RVOL_RATE = 1,
LQI_RATE = 1,
LQI_SAMPLE_INTERVAL = 300
};
enum SamplingPriority {
SEISMIC_DATA_PRIORITY = 0x2,
INFRASONIC_DATA_PRIORITY = 0x1,
LIGHTNING_DATA_PRIORITY = 0x6,
LQI_DATA_PRIORITY = 0x6,
RVOL_DATA_PRIORITY = 0x1,
GPS_DATA_PRIORITY = 0x3,
RSAM1_DATA_PRIORITY = 0x7,
RSAM2_DATA_PRIORITY = 0x6
};
enum SensorConfig {
MAX_SENSOR_NUM = 16,
MAX_FLASH_NUM = 16,
MAX_SAMPLING_RATE = 1000UL,
MAX_DATA_WIDTH = 2,
MAX_SENSING_QUEUE_SIZE = 15,
MAX_RSAM_WIN_SIZE = 60,
MAX_STA_PERIOD = 2,
MAX_LTA_PERIOD = 30,
TASK_MASK = 0x000f,
TASK_CODE_SIZE = 4,
TSTAMPOFFSET = 4,
ONE_MS = 1000UL,
BATCH_TIMER_INTERVAL = 500UL,
ERASE_TIMER_INTERVAL = 60000UL,
VOL_TIMER_INTERVAL = 60000UL
};
enum Special_Sensor {
GPS_CLIENT_ID = 0,
RSAM1_CLIENT_ID = 1,
RSAM2_CLIENT_ID = 2,
COMPRESS_CLIENT_ID = 7,
GPS_BLK_NUM = 8,
RSAM_BLK_NUM = 8
};
#line 115
#line 105
typedef struct SensorClient {
SenBlkPtr curBlkPtr;
uint16_t samplingRate;
uint16_t timerCount;
uint8_t channel;
uint8_t type;
uint8_t dataPriority;
uint8_t nodePriority;
uint8_t maxBlkNum;
uint8_t curBlkNum;
} SensorClient_t;
enum sensing_flash {
BLANK = 0x2fff,
WRITTEN = 0x4fff,
IDLE = 0xffff,
BASE_ADDR = 0x1A00000,
NUM_BYTES = 5 * sizeof(SensorClient_t )
};
#line 126
typedef struct TimeStamp {
uint32_t minute : 6,
second : 6,
millisec : 10,
interval : 10;
} __attribute((packed)) TimeStamp_t;
#line 133
typedef struct FlashClient {
uint16_t FlashFlag;
uint32_t ProgID;
uint16_t RFChannel;
SensorClient_t FlashSensor[MAX_SENSOR_NUM];
} __attribute((packed)) FlashClient_t;
SensorClient_t sensor[MAX_SENSOR_NUM];
FlashClient_t FlashCliUnit;
uint8_t sensor_num = 0;
# 37 "/opt/tinyos-1.x/tos/platform/imote2/Flash.h"
enum __nesc_unnamed4285 {
NOTHING_TO_ERASE = 3
};
# 6 "/opt/tinyos-1.x/contrib/nucleus/tos/lib/Nucleus/Ident.h"
enum __nesc_unnamed4286 {
ATTR_AMAddress = 1,
ATTR_AMGroup = 2,
ATTR_HardwareID = 3,
ATTR_ProgramName = 4,
ATTR_ProgramCompilerID = 5,
ATTR_ProgramCompileTime = 6
};
enum __nesc_unnamed4287 {
HARDWARE_ID_LEN = 8
};
#line 19
typedef struct hardwareID {
char hardwareID[HARDWARE_ID_LEN];
} hardwareID_t;
#line 24
typedef struct programName {
char programName[IDENT_MAX_PROGRAM_NAME_LENGTH];
} programName_t;
# 27 "/home/xu/oasis/lib/SmartSensing/Compress.h"
const uint8_t biasscalebits = 8;
const uint16_t biasscalealmosthalf = (1 << (8 - 1)) - 1;
const uint8_t muexponent = 15;
const uint16_t halfmu = (1 << (15 - 1)) - 1;
const uint8_t capexponent = 2;
const uint8_t biasquantbits = 10;
const uint8_t weightquantbits = 10;
const float weightinitfactor[5] = { 1.5, -1.25, 0.75, -0.5, 0.5 };
static int biasestimate_r;
float weight_r[3];
int weightquant[3];
int weightquantcost;
uint16_t codeoverheadbits = 0;
const int32_t meancutoff[17] = { 0, 0, 1, 2, 5, 11, 23, 46, 92, 184, 369, 738, 1477, 2954, 5909, 11818, 23637 };
const int maxsample_r = ((1 << 16) - 1) << 14;
const int minsample_r = -(1 << 16) << 14;
static int16_t packetbytepointer = 0;
static int16_t packetbitpointer = 0;
FILE *output_compress = (void *)0;
static uint8_t *thepacket;
static uint16_t packetfoldedsamples[128];
static int16_t packetdebiasedsamples[128];
static int16_t packetdebiasedscaled[128];
static int packetcount = 0;
uint8_t *Init_packet;
static inline int biasquantencode_r(int thebiasestimate_r);
static inline int quantize(int number_r, int resolutionbits);
static inline int reconquantized_r(int quantizedvalue, int resolutionbits);
static void writesignmagnitude(int thevalue, int numbits);
static inline void weightquantencode(void );
static uint16_t foldsample(int thesamplevalue, int32_t theprediction);
static void writebit(int32_t bitvalue);
static inline void encodevalue(uint16_t thevalue, int32_t thecodeparameter);
static inline int32_t codechoice(int32_t foldedsum, int32_t numfoldedvals);
static void writeunsignedint(uint16_t thevalue, uint16_t numbits);
static long predictdebiasedsample_r(int numpacketsamples);
static void encodepacket(int32_t numpacketsamples, int32_t codingparameter, SenBlkPtr outPtr);
static int startnewpacket(void );
static inline void sendpacket(void );
static uint16_t compress(uint16_t *source, uint8_t size, SenBlkPtr outPtr, uint8_t *compress_done);
#line 328
static int startnewpacket(void );
#line 351
static inline int biasquantencode_r(int thebiasestimate_r);
#line 368
static inline int quantize(int number_r, int resolutionbits);
#line 381
static void writesignmagnitude(int thevalue, int numbits);
#line 403
static void writeunsignedint(uint16_t thevalue, uint16_t numbits);
static inline void weightquantencode(void );
#line 515
static void writebit(int32_t bitvalue);
#line 544
static long predictdebiasedsample_r(int numpacketsamples);
#line 574
static inline int32_t codechoice(int32_t foldedsum, int32_t numfoldedvals);
#line 598
static void encodepacket(int32_t numpacketsamples, int32_t codingparameter, SenBlkPtr outPtr);
#line 636
static inline void encodevalue(uint16_t thevalue, int32_t thecodeparameter);
#line 659
static inline void sendpacket(void );
#line 671
static uint16_t foldsample(int thesamplevalue, int32_t theprediction);
#line 713
static inline int reconquantized_r(int quantizedvalue, int resolutionbits);
# 12 "/home/xu/oasis/lib/SmartSensing/ProcessTasks.h"
enum TASK_LIST {
RSAM_FUNC = 1,
PRIORITIZE_FUNC = 2,
THRESHOLD_FUNC = 3,
COMPRESS_FUNC = 4
};
typedef result_t (*ProcessFunc)(SenBlkPtr inPtr, SenBlkPtr outPtr);
static result_t RsamFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
static result_t PrioritizeFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
static result_t ThresholdFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
static result_t CompressFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
static inline void StaLtaFunc2(uint32_t rsamvalue, uint32_t curTime);
ProcessFunc processFunc[16] = {
(void *)0,
RsamFunc,
PrioritizeFunc,
ThresholdFunc,
CompressFunc };
static uint32_t start_point = 0;
static uint32_t end_point = 0;
static uint32_t delay_end = 0xffffffff;
int32_t sta_period = 0;
int32_t lta_period = 0;
uint8_t eventPrio = 5;
uint16_t restartRSAM;
uint16_t eventPri;
static bool event_trigger = FALSE;
bool event_onset = FALSE;
static result_t RsamFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
#line 144
static inline void StaLtaFunc2(uint32_t rsamvalue, uint32_t curTime);
#line 220
static result_t PrioritizeFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
#line 253
static result_t ThresholdFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
#line 273
static result_t CompressFunc(SenBlkPtr inPtr, SenBlkPtr outPtr);
# 3 "/home/xu/oasis/system/platform/imote2/ADC/sensorboard.h"
enum SamplingChannel {
TOSH_ACTUAL_SEISMIC_PORT = 0,
TOSH_ACTUAL_INFRASONIC_PORT = 4,
TOSH_ACTUAL_LIGHTNING_PORT = 1,
TOSH_ACTUAL_RVOL_PORT = 15
};
# 35 "/opt/tinyos-1.x/tos/interfaces/ADC.h"
enum __nesc_unnamed4288 {
TOS_ADCSample3750ns = 0,
TOS_ADCSample7500ns = 1,
TOS_ADCSample15us = 2,
TOS_ADCSample30us = 3,
TOS_ADCSample60us = 4,
TOS_ADCSample120us = 5,
TOS_ADCSample240us = 6,
TOS_ADCSample480us = 7
};
# 35 "/home/xu/oasis/system/RTClock.h"
#line 28
typedef struct RTClock {
uint16_t millisecond;
uint8_t hour;
uint8_t minute;
uint8_t second;
uint8_t packed;
} RTClock_t;
#line 37
typedef struct SyncUser {
uint32_t fireCount;
uint32_t syncInterval;
uint8_t type;
uint8_t id;
} SyncUser_t;
enum __nesc_unnamed4289 {
MAX_NUM_CLIENT = 12,
GPS_SYNC = 0,
FTSP_SYNC = 1,
UC_FIRE_INTERVAL = 1000UL,
DAY_END = 86400000UL,
HOUR_END = 3600000UL,
DEFAULT_SYNC_MODE = 1
};
# 4 "/home/xu/oasis/system/platform/imote2/ADC/gps.h"
enum GPSInfo {
RAW_SIZE = 600UL,
NMEA_SIZE = 38,
RAW_HEAD = 0xb5,
NMEA_HEAD = 0x24,
SYNC_INTERVAL = 20,
MAX_ENTRIES = 6
};
enum RTC_NMEA {
H1 = 7,
H2 = 8,
M1 = 9,
M2 = 10,
S1 = 11,
S2 = 12,
MS1 = 14,
MS2 = 15,
ACIIOFFSET = 0x30
};
#line 26
typedef struct TableItem {
uint32_t localTime;
int32_t timeOffset;
uint16_t state;
} TimeTable;
enum __nesc_unnamed4290 {
ENTRY_EMPTY = 0,
ENTRY_FULL = 1
};
static __inline uint8_t tr_time(uint8_t *source);
# 36 "/home/xu/oasis/system/platform/imote2/UART/pxa27x_serial.h"
typedef uint8_t uart_status_t;
#line 38
typedef enum __nesc_unnamed4291 {
EVEN,
ODD,
NONE
} uart_parity_t;
# 31 "/home/xu/oasis/system/queue.h"
enum __nesc_unnamed4292 {
MAX_QUEUE_SIZE = 40,
NUM_OBJSTATUS = 3
};
typedef TOS_Msg object_type;
#line 51
typedef enum __nesc_unnamed4293 {
FREE = 0,
PENDING = 1,
PROCESSING = 2
} ObjStatus_t;
#line 68
#line 57
typedef struct Element_t {
int16_t next;
int16_t prev;
uint8_t status;
uint8_t retry;
uint8_t priority;
uint8_t dummy;
object_type *obj;
}
Element_t;
#line 70
typedef struct Queue_t {
int16_t size;
int16_t total;
int16_t head[NUM_OBJSTATUS];
int16_t tail[NUM_OBJSTATUS];
Element_t element[MAX_QUEUE_SIZE];
}
Queue_t;
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t staus2);
static result_t initQueue(Queue_t *queue, uint16_t size);
#line 146
static result_t insertElement(Queue_t *queue, object_type *obj);
#line 307
static result_t removeElement(Queue_t *queue, object_type *obj);
#line 368
static object_type *headElement(Queue_t *queue, ObjStatus_t status);
#line 387
static inline uint8_t getRetryCount(object_type **object);
static inline bool incRetryCount(object_type **object);
#line 468
static inline object_type **findObject(Queue_t *queue, object_type *obj);
#line 496
static result_t changeElementStatus(Queue_t *queue, object_type *obj, ObjStatus_t status1, ObjStatus_t status2);
#line 559
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t status2);
# 31 "/home/xu/oasis/system/buffer.h"
enum __nesc_unnamed4294 {
FREEBUF = PENDING,
BUSYBUF = PROCESSING
};
static result_t initBufferPool(Queue_t *bufQueue, uint16_t size, TOS_Msg *bufPool);
#line 66
static TOS_MsgPtr allocBuffer(Queue_t *bufQueue);
#line 86
static result_t freeBuffer(Queue_t *bufQueue, TOS_MsgPtr buf);
# 33 "/home/xu/oasis/lib/RamSymbols/RamSymbols.h"
enum __nesc_unnamed4295 {
MAX_RAM_SYMBOL_SIZE = 74 - (size_t )& ((NetworkMsg *)0)->data -
(size_t )& ((ApplicationMsg *)0)->data - (size_t )& ((RpcCommandMsg *)0)->data - sizeof(uint32_t ) - sizeof(uint8_t ) - sizeof(bool ),
AM_RAMSYMBOL_T = 134
};
#line 53
#line 42
typedef struct ramSymbol_t {
uint32_t memAddress;
uint8_t length;
bool dereference;
uint8_t data[MAX_RAM_SYMBOL_SIZE];
} __attribute((packed)) ramSymbol_t;
# 4 "/home/xu/oasis/lib/GenericCommPro/QosRexmit.h"
enum __nesc_unnamed4296 {
QOS_LEVEL = 7
};
static inline uint8_t qosRexmit(uint8_t qos);
# 50 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
enum __nesc_unnamed4297 {
COMM_SEND_QUEUE_SIZE = 15,
COMM_RECV_QUEUE_SIZE = 15
};
enum __nesc_unnamed4298 {
RADIO = 1,
UART = 2,
COMM_WDT_UPDATE_PERIOD = 10,
COMM_WDT_UPDATE_UNIT = 1024 * 60
};
# 61 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncMsg.h"
#line 25
typedef struct TimeSyncMsg {
uint16_t nodeID;
uint16_t rootID;
uint16_t seqNum;
#line 47
uint8_t hasGPS;
uint8_t wroteStamp;
uint32_t sendingTime;
uint32_t arrivalTime;
} __attribute((packed)) TimeSyncMsg;
enum __nesc_unnamed4299 {
AM_TIMESYNCMSG = 0xAA,
TIMESYNCMSG_LEN = sizeof(TimeSyncMsg ) - sizeof(uint32_t ),
TS_TIMER_MODE = 0,
TS_USER_MODE = 1,
TIMESYNC_LENGTH_SENDFIELDS = 5
};
# 42 "/opt/tinyos-1.x/tos/system/crc.h"
static uint16_t crcByte(uint16_t crc, uint8_t b);
# 37 "/opt/tinyos-1.x/tos/platform/imote2/UART.h"
enum __nesc_unnamed4300 {
UART_BAUD_300 = 1,
UART_BAUD_1200 = 2,
UART_BAUD_2400 = 3,
UART_BAUD_4800 = 4,
UART_BAUD_9600 = 5,
UART_BAUD_19200 = 6,
UART_BAUD_38400 = 7,
UART_BAUD_57600 = 8,
UART_BAUD_115200 = 9,
UART_BAUD_230400 = 10,
UART_BAUD_460800 = 11,
UART_BAUD_921600 = 12
};
# 18 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmt.h"
#line 5
typedef struct NBRTableEntry {
uint16_t id;
uint16_t parentCost;
uint16_t linkEst;
uint16_t linkEstCandidate;
uint8_t flags;
uint8_t relation;
uint8_t liveliness;
uint8_t childLiveliness;
uint16_t priorHop;
uint8_t lqiRaw;
uint8_t rssiRaw;
uint8_t lastHeard;
} NBRTableEntry;
enum __nesc_unnamed4301 {
NBRFLAG_VALID = 0x01,
NBRFLAG_NEW = 0x02,
NBRFLAG_JUST_UPDATED = 0x04
};
enum relation {
NBR_DIRECT_CHILD = 0x01,
NBR_CHILD = 0x02,
NBR_PARENT = 0x04,
NBR_NEIGHBOR = 0x08
};
enum __nesc_unnamed4302 {
LIVELINESS = 8,
CHILD_LIVELINESS = 8,
ROUTE_INVALID = 0xff,
ADDRESS_INVALID = 0xffff
};
# 34 "/home/xu/oasis/system/TinyDWFQ.h"
enum __nesc_unnamed4303 {
NUM_VIRTUAL_QUEUES = 8,
NUM_HEAD_TAIL_POINTERS = 4,
TINYDWFQ_SIZE = 40,
MAX_ELEMENT_PER_VIRTUALQUEUE = 5,
NUM_OBJSTATUS_TINYDWFQ = 4,
DQ_WEIGHTS = 4
};
enum __nesc_unnamed4304 {
VQ_HEAD = 0,
VQ_TAIL = 1,
VQ_FREE_HEAD = 2,
VQ_FREE_TAIL = 3
};
#line 52
typedef enum __nesc_unnamed4305 {
FREE_TINYDWFQ = 0,
PENDING_TINYDWFQ = 1,
PROCESSING_TINYDWFQ = 2,
NOT_ACKED_TINYDWFQ = 3
} ObjStatusTINYDWFQ_t;
enum DequeueWeights {
DQ_LOW = 0,
DQ_MEDIUM = 1,
DQ_HIGH = 2,
DQ_URGENT = 3
};
enum VirtualQueueSizes {
MAX_VQ_0 = 0,
MAX_VQ_1 = 24,
MAX_VQ_2 = 5,
MAX_VQ_3 = 0,
MAX_VQ_4 = 0,
MAX_VQ_5 = 0,
MAX_VQ_6 = 8,
MAX_VQ_7 = 3
};
enum VirtualQueueHeadAndTail {
VQ_0_FREE_HEAD = -1,
VQ_0_FREE_TAIL = -1,
VQ_1_FREE_HEAD = 0,
VQ_1_FREE_TAIL = 23,
VQ_2_FREE_HEAD = 24,
VQ_2_FREE_TAIL = 28,
VQ_3_FREE_HEAD = -1,
VQ_3_FREE_TAIL = -1,
VQ_4_FREE_HEAD = -1,
VQ_4_FREE_TAIL = -1,
VQ_5_FREE_HEAD = -1,
VQ_5_FREE_TAIL = -1,
VQ_6_FREE_HEAD = 29,
VQ_6_FREE_TAIL = 36,
VQ_7_FREE_HEAD = 37,
VQ_7_FREE_TAIL = 39
};
#line 117
#line 104
typedef struct Element_TinyDWFQ_t {
int16_t next;
int16_t prev;
uint8_t status;
uint8_t retry;
uint8_t priority;
uint8_t dummy;
uint8_t vqIndex;
int8_t qos;
object_type *obj;
}
Element_TinyDWFQ_t;
#line 140
#line 120
typedef struct TinyDWFQ_t {
int16_t size;
int16_t total;
int16_t head[NUM_OBJSTATUS_TINYDWFQ];
int16_t tail[NUM_OBJSTATUS_TINYDWFQ];
Element_TinyDWFQ_t element[TINYDWFQ_SIZE];
int16_t virtualQueues[NUM_VIRTUAL_QUEUES][NUM_HEAD_TAIL_POINTERS];
int16_t numOfElements_VQ[NUM_VIRTUAL_QUEUES];
int16_t numOfElements_VQ_Processing[NUM_VIRTUAL_QUEUES];
int8_t numOfElements_pending;
int8_t numOfElements_processing;
int8_t numOfElements_notAcked;
int8_t maxNumOfElementPerVQ[NUM_VIRTUAL_QUEUES];
}
TinyDWFQ_t;
typedef TinyDWFQ_t *TinyDWFQPtr;
#line 154
uint8_t virtualQueueDequeueWieghts[NUM_VIRTUAL_QUEUES][DQ_WEIGHTS];
static inline void initializeVirtualQueue(TinyDWFQPtr queue);
static inline uint8_t getNumberOfElementsToBeDqueued(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t freeSpace);
static uint8_t setAndGetDequeueWeight(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t dqPriority, uint8_t freeSpace);
static inline result_t init_TinyDWFQ(TinyDWFQPtr queue, uint8_t size);
#line 228
static inline void initializeVirtualQueue(TinyDWFQPtr queue);
#line 281
static inline result_t insertElement_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg);
#line 365
static inline void markElementAsPendingByQOS_TinyDWFQ(TinyDWFQPtr queue, uint8_t numOfElementsToMark);
#line 495
static inline uint8_t getNumberOfElementsToBeDqueued(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t freeSpace);
#line 520
static uint8_t setAndGetDequeueWeight(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t dqPriority, uint8_t freeSpace);
#line 698
static inline result_t markElementAsNotACKed_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg);
#line 767
static result_t removeElement_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg, ObjStatusTINYDWFQ_t status);
#line 841
static inline result_t isElementInACKList_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg);
#line 859
static result_t isListEmpty_TinyDWFQ(TinyDWFQPtr queue, ObjStatus_t status);
#line 879
static inline object_type *getheadElement_TinyDWFQ(TinyDWFQPtr queue, ObjStatus_t status);
#line 962
static inline object_type *findMessageToReplace(TinyDWFQPtr queue, int8_t newMsgQOS);
# 33 "/home/xu/oasis/lib/Cascades/Cascades.h"
enum CascadesEnum {
MAX_CAS_BUF = 1,
DEFAULT_DTCOUNT = 4,
MAX_CAS_RETRY_COUNT = 6,
MAX_CAS_PACKETS = 64,
CAS_SEND_QUEUE_SIZE = 3,
INVALID_INDEX = 100,
MIN_INTERVAL = 50,
MAX_NUM_CHILDREN = 16
};
#line 52
typedef struct CasCtrlMsg {
address_t linkSource;
address_t parent;
uint16_t dataSeq;
uint8_t type;
uint8_t dummy;
uint8_t data[0];
} __attribute((packed)) CasCtrlMsg;
#line 61
typedef struct childrenList {
address_t childID;
uint8_t status;
uint8_t dummy;
} __attribute((packed)) childrenList_t;
#line 69
typedef struct CascadesBuffer {
TOS_Msg tmsg;
childrenList_t childrenList[MAX_NUM_CHILDREN];
uint8_t countDT;
uint8_t retry;
uint8_t signalDone;
uint8_t dummy;
} __attribute((packed)) CascadesBuffer;
enum CascadesType {
TYPE_CASCADES_NODATA = 17,
TYPE_CASCADES_ACK = 18,
TYPE_CASCADES_REQ = 19,
TYPE_CASCADES_CMAU = 20
};
# 78 "/opt/tinyos-1.x/tos/interfaces/Pot.nc"
static result_t PotM$Pot$init(uint8_t arg_0x40426ac0);
# 74 "/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"
static result_t HPLPotC$Pot$finalise(void);
#line 59
static result_t HPLPotC$Pot$decrease(void);
static result_t HPLPotC$Pot$increase(void);
# 80 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLInitM.nc"
static result_t HPLInitM$init(void);
# 54 "/opt/tinyos-1.x/tos/platform/imote2/DVFS.nc"
static result_t DVFSM$DVFS$SwitchCoreFreq(uint32_t arg_0x4044bac0, uint32_t arg_0x4044bc58);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t DVFSM$GetFreq$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t DVFSM$GetFreq$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t DVFSM$SwitchFreq$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t DVFSM$SwitchFreq$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 47 "/opt/tinyos-1.x/tos/platform/imote2/SendDataAlloc.nc"
static result_t BufferedSTUARTM$SendDataAlloc$default$sendDone(uint8_t *arg_0x404dd010, uint32_t arg_0x404dd1a8, result_t arg_0x404dd338);
# 63 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkReceiveDone(uint8_t *arg_0x404f3720, uint16_t arg_0x404f38b8);
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkTransmitDone(uint8_t *arg_0x404ff190, uint16_t arg_0x404ff328);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t BufferedSTUARTM$StdControl$init(void);
static result_t BufferedSTUARTM$StdControl$start(void);
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static void STUARTM$TxDMAChannel$stopInterrupt(uint16_t arg_0x4054a8e0);
static void STUARTM$TxDMAChannel$startInterrupt(void);
#line 86
static result_t STUARTM$TxDMAChannel$requestChannelDone(void);
#line 249
static void STUARTM$TxDMAChannel$eorInterrupt(uint16_t arg_0x4054a280);
#line 236
static void STUARTM$TxDMAChannel$endInterrupt(uint16_t arg_0x4054cc28);
#line 260
static void STUARTM$RxDMAChannel$stopInterrupt(uint16_t arg_0x4054a8e0);
static void STUARTM$RxDMAChannel$startInterrupt(void);
#line 86
static result_t STUARTM$RxDMAChannel$requestChannelDone(void);
#line 249
static void STUARTM$RxDMAChannel$eorInterrupt(uint16_t arg_0x4054a280);
#line 236
static void STUARTM$RxDMAChannel$endInterrupt(uint16_t arg_0x4054cc28);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void STUARTM$UARTInterrupt$fired(void);
# 35 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
static result_t STUARTM$BulkTxRx$BulkTransmit(uint8_t *arg_0x404f4600, uint16_t arg_0x404f4798);
#line 27
static result_t STUARTM$BulkTxRx$BulkReceive(uint8_t *arg_0x40501dd8, uint16_t arg_0x404f4010);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XDMAM$Interrupt$fired(void);
# 143 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetAddrIncrement(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 143 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
bool arg_0x4053f608);
#line 161
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetFlowControl(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 161 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
bool arg_0x4054e188);
#line 260
static void PXA27XDMAM$PXA27XDMAChannel$default$stopInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054a8e0);
#line 123
static result_t PXA27XDMAM$PXA27XDMAChannel$setTargetAddr(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 123 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint32_t arg_0x4053aaa8);
#line 268
static void PXA27XDMAM$PXA27XDMAChannel$default$startInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790);
# 182 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferLength(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 182 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054ed20);
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferWidth(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 192 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
DMATransferWidth_t arg_0x4054d358);
#line 86
static result_t PXA27XDMAM$PXA27XDMAChannel$default$requestChannelDone(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790);
# 113 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static result_t PXA27XDMAM$PXA27XDMAChannel$setSourceAddr(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 113 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint32_t arg_0x4053a528);
#line 172
static result_t PXA27XDMAM$PXA27XDMAChannel$setMaxBurstSize(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 172 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
DMAMaxBurstSize_t arg_0x4054e720);
#line 249
static void PXA27XDMAM$PXA27XDMAChannel$default$eorInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 249 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054a280);
#line 152
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceFlowControl(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 152 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
bool arg_0x4053fbd8);
#line 204
static result_t PXA27XDMAM$PXA27XDMAChannel$run(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 204 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
DMAInterruptEnable_t arg_0x4054d948);
#line 77
static result_t PXA27XDMAM$PXA27XDMAChannel$requestChannel(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 77 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
DMAPeripheralID_t arg_0x405402f8,
DMAPriority_t arg_0x405404a0, bool arg_0x40540630);
#line 236
static void PXA27XDMAM$PXA27XDMAChannel$default$endInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 236 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054cc28);
#line 133
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceAddrIncrement(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 133 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
bool arg_0x4053f030);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PXA27XDMAM$StdControl$init(void);
static result_t PXA27XDMAM$StdControl$start(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XFiq$default$fired(
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405de5d0);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XIrq$default$fired(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405ecc80);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XIrq$disable(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405ecc80);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XIrq$enable(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405ecc80);
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static result_t PXA27XInterruptM$PXA27XIrq$allocate(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405ecc80);
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/UID.nc"
static uint32_t UIDC$UID$getUID(void);
# 35 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLUSBClientGPIO.nc"
static result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$checkConnection(void);
#line 19
static result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$init(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XGPIOIntM$GPIOIrq0$fired(void);
#line 48
static void PXA27XGPIOIntM$GPIOIrq$fired(void);
#line 48
static void PXA27XGPIOIntM$GPIOIrq1$fired(void);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$clear(
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
uint8_t arg_0x40643bb0);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$default$fired(
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
uint8_t arg_0x40643bb0);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$disable(
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
uint8_t arg_0x40643bb0);
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$enable(
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
uint8_t arg_0x40643bb0,
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
uint8_t arg_0x406321d8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PXA27XGPIOIntM$StdControl$init(void);
static result_t PXA27XGPIOIntM$StdControl$start(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr PXA27XUSBClientM$ReceiveMsg$default$receive(TOS_MsgPtr arg_0x40620878);
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
static result_t PXA27XUSBClientM$SendJTPacket$send(
# 24 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
uint8_t arg_0x4065c5b8,
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
uint8_t *arg_0x406141a8, uint32_t arg_0x40614340, uint8_t arg_0x406144c8);
static result_t PXA27XUSBClientM$SendJTPacket$default$sendDone(
# 24 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
uint8_t arg_0x4065c5b8,
# 28 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
uint8_t *arg_0x40614b20, uint8_t arg_0x40614ca8, result_t arg_0x40614e38);
# 62 "/opt/tinyos-1.x/tos/interfaces/SendVarLenPacket.nc"
static result_t PXA27XUSBClientM$SendVarLenPacket$default$sendDone(uint8_t *arg_0x406168e8, result_t arg_0x40616a78);
# 10 "/opt/tinyos-1.x/tos/platform/pxa27x/ReceiveBData.nc"
static result_t PXA27XUSBClientM$ReceiveBData$default$receive(uint8_t *arg_0x40621118, uint8_t arg_0x406212a8,
uint32_t arg_0x40621448, uint32_t arg_0x406215d8, uint8_t arg_0x40621760);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XUSBClientM$USBAttached$fired(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XUSBClientM$USBInterrupt$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PXA27XUSBClientM$Control$init(void);
static result_t PXA27XUSBClientM$Control$start(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t PXA27XUSBClientM$BareSendMsg$default$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 28 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
static result_t BluSHM$USBSend$sendDone(uint8_t *arg_0x40614b20, uint8_t arg_0x40614ca8, result_t arg_0x40614e38);
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
static result_t BluSHM$UartReceive$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t BluSHM$BluSH_AppI$default$callApp(
# 33 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
uint8_t arg_0x40784798,
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t BluSHM$BluSH_AppI$default$getName(
# 33 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
uint8_t arg_0x40784798,
# 8 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
static result_t BluSHM$USBReceive$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0);
# 62 "/opt/tinyos-1.x/tos/platform/imote2/SendData.nc"
static result_t BluSHM$UartSend$sendDone(uint8_t *arg_0x404e11a8, uint32_t arg_0x404e1340, result_t arg_0x404e14d0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t BluSHM$StdControl$init(void);
static result_t BluSHM$StdControl$start(void);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t PMICM$BatteryVoltage$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$BatteryVoltage$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PMICM$PI2CInterrupt$fired(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t PMICM$batteryMonitorTimer$fired(void);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t PMICM$ChargingStatus$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$ChargingStatus$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PMICM$PMICInterrupt$fired(void);
# 51 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
static result_t PMICM$PMIC$setCoreVoltage(uint8_t arg_0x404bd718);
static result_t PMICM$PMIC$shutDownLDOs(void);
static result_t PMICM$PMIC$enableCharging(bool arg_0x404bc398);
#line 54
static result_t PMICM$PMIC$getBatteryVoltage(uint8_t *arg_0x404bdee0);
static result_t PMICM$PMIC$chargingStatus(uint8_t *arg_0x404bc850, uint8_t *arg_0x404bc9f8, uint8_t *arg_0x404bcba0, uint8_t *arg_0x404bcd50);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t PMICM$chargeMonitorTimer$fired(void);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t PMICM$SetCoreVoltage$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$SetCoreVoltage$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t PMICM$ManualCharging$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$ManualCharging$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t PMICM$ReadPMIC$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$ReadPMIC$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t PMICM$WritePMIC$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t PMICM$WritePMIC$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PMICM$StdControl$init(void);
static result_t PMICM$StdControl$start(void);
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdog.nc"
static void PXA27XWatchdogM$PXA27XWatchdog$init(void);
#line 70
static void PXA27XWatchdogM$PXA27XWatchdog$feedWDT(uint32_t arg_0x408a78a8);
#line 61
static void PXA27XWatchdogM$PXA27XWatchdog$enableWDT(uint32_t arg_0x408a7340);
# 46 "/opt/tinyos-1.x/tos/interfaces/Reset.nc"
static void PXA27XWatchdogM$Reset$reset(void);
# 56 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t NoLeds$Leds$init(void);
#line 106
static result_t NoLeds$Leds$greenToggle(void);
#line 131
static result_t NoLeds$Leds$yellowToggle(void);
#line 81
static result_t NoLeds$Leds$redToggle(void);
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static result_t TimerM$Clock$fire(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimerM$StdControl$init(void);
static result_t TimerM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$default$fired(
# 50 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
uint8_t arg_0x408cf2b8);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$start(
# 50 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
uint8_t arg_0x408cf2b8,
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t TimerM$Timer$stop(
# 50 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
uint8_t arg_0x408cf2b8);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XClockM$OSTIrq$fired(void);
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static void PXA27XClockM$Clock$setInterval(uint32_t arg_0x408ca068);
#line 153
static uint32_t PXA27XClockM$Clock$readCounter(void);
#line 96
static result_t PXA27XClockM$Clock$setRate(uint32_t arg_0x408c5460, uint32_t arg_0x408c55f0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PXA27XClockM$StdControl$init(void);
static result_t PXA27XClockM$StdControl$start(void);
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
static uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SettingsM$StackCheckTimer$fired(void);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t SettingsM$TestTaskQueue$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t SettingsM$TestTaskQueue$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t SettingsM$GoToSleep$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t SettingsM$GoToSleep$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t SettingsM$GetResetCause$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t SettingsM$GetResetCause$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
static BluSH_result_t SettingsM$ResetNode$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t SettingsM$ResetNode$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SettingsM$StdControl$init(void);
static result_t SettingsM$StdControl$start(void);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t SettingsM$NodeID$callApp(char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t SettingsM$NodeID$getName(char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 64 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420ControlM$SplitControl$init(void);
#line 77
static result_t CC2420ControlM$SplitControl$start(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420ControlM$CCA$fired(void);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t arg_0x40954010, uint8_t arg_0x40954198, uint8_t *arg_0x40954340);
# 120 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static result_t CC2420ControlM$CC2420Control$VREFOn(void);
#line 185
static uint8_t CC2420ControlM$CC2420Control$GetRFPower(void);
#line 206
static result_t CC2420ControlM$CC2420Control$enableAddrDecode(void);
#line 178
static result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t arg_0x4095df20);
#line 192
static result_t CC2420ControlM$CC2420Control$enableAutoAck(void);
#line 84
static result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t arg_0x40940010);
#line 163
static result_t CC2420ControlM$CC2420Control$RxMode(void);
#line 94
static result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t arg_0x409405f8);
#line 220
static result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t arg_0x4095b8e8);
#line 106
static uint8_t CC2420ControlM$CC2420Control$GetPreset(void);
#line 134
static result_t CC2420ControlM$CC2420Control$OscillatorOn(void);
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XPowerModes.nc"
static void PXA27XPowerModesM$PXA27XPowerModes$SwitchMode(uint8_t arg_0x40997ab8);
# 56 "/opt/tinyos-1.x/tos/platform/pxa27x/Sleep.nc"
static result_t SleepM$Sleep$goToDeepSleep(uint32_t arg_0x4090f8e0);
# 53 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$eraseFlash(void) ;
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
static result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t arg_0x4099f010, uint8_t arg_0x4099f1a0);
static uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t arg_0x4099f638);
#line 31
static result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t arg_0x409a04c8, uint8_t arg_0x409a0650);
#line 49
static uint8_t SmartSensingM$SensingConfig$getEventPriority(uint8_t arg_0x409be4b0);
#line 27
static result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t arg_0x409a19e0, uint16_t arg_0x409a1b78);
static uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t arg_0x409a0ae8);
#line 29
static uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t arg_0x409a0030);
#line 47
static result_t SmartSensingM$SensingConfig$setEventPriority(uint8_t arg_0x409bfe20, uint8_t arg_0x409be010);
#line 43
static result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t arg_0x409bf348, uint16_t arg_0x409bf4d8);
#line 39
static result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t arg_0x4099fad8);
static uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t arg_0x409bf980);
#line 41
static uint8_t SmartSensingM$SensingConfig$getNodePriority(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$SensingTimer$fired(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 46 "/home/xu/oasis/interfaces/GenericSensing.nc"
static result_t SmartSensingM$GPSSensing$dataReady(uint8_t *arg_0x40ac8268, uint16_t arg_0x40ac83f8);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$initTimer$fired(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t SmartSensingM$ADC$dataReady(
# 65 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint8_t arg_0x40aa9310,
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
uint16_t arg_0x40aa6cc0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SmartSensingM$StdControl$init(void);
static result_t SmartSensingM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$WatchTimer$fired(void);
# 122 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t LedsC$Leds$yellowOff(void);
#line 114
static result_t LedsC$Leds$yellowOn(void);
#line 97
static result_t LedsC$Leds$greenOff(void);
#line 72
static result_t LedsC$Leds$redOff(void);
#line 106
static result_t LedsC$Leds$greenToggle(void);
#line 131
static result_t LedsC$Leds$yellowToggle(void);
#line 81
static result_t LedsC$Leds$redToggle(void);
#line 64
static result_t LedsC$Leds$redOn(void);
#line 89
static result_t LedsC$Leds$greenOn(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t RandomLFSR$Random$rand(void);
#line 57
static result_t RandomLFSR$Random$init(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$WatchTimer$fired(void);
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
static bool RealTimeM$RealTime$isSync(void);
#line 40
static result_t RealTimeM$RealTime$setTimeCount(uint32_t arg_0x40abf6d8, uint8_t arg_0x40abf860);
static result_t RealTimeM$RealTime$changeMode(uint8_t arg_0x40abd648);
static uint8_t RealTimeM$RealTime$getMode(void);
#line 39
static uint32_t RealTimeM$RealTime$getTimeCount(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t RealTimeM$LocalTime$read(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t RealTimeM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static result_t RealTimeM$Clock$fire(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RealTimeM$StdControl$init(void);
static result_t RealTimeM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$default$fired(
# 31 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
uint8_t arg_0x40b740d0);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$start(
# 31 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
uint8_t arg_0x40b740d0,
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t RealTimeM$Timer$stop(
# 31 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
uint8_t arg_0x40b740d0);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void RTCClockM$OSTIrq$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RTCClockM$StdControl$init(void);
static result_t RTCClockM$StdControl$start(void);
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static void RTCClockM$MicroClock$setInterval(uint32_t arg_0x408ca068);
# 89 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialPacket.nc"
static uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$receiveDone(uint8_t *arg_0x40bf31a8, uint16_t arg_0x40bf3338, uart_status_t arg_0x40bf34c8);
#line 62
static uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$sendDone(uint8_t *arg_0x40bcce68, uint16_t arg_0x40bcb010, uart_status_t arg_0x40bcb1a0);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t GPSSensorM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 7 "/home/xu/oasis/interfaces/GPSGlobalTime.nc"
static uint32_t GPSSensorM$GPSGlobalTime$getLocalTime(void);
#line 6
static uint32_t GPSSensorM$GPSGlobalTime$getGlobalTime(void);
static uint32_t GPSSensorM$GPSGlobalTime$local2Global(uint32_t arg_0x40b6e770);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GPSSensorM$CheckTimer$fired(void);
# 79 "/home/xu/oasis/system/platform/imote2/UART/UartStream.nc"
static void GPSSensorM$GPSUartStream$receivedByte(uint8_t arg_0x40bd1c28);
#line 99
static void GPSSensorM$GPSUartStream$receiveDone(uint8_t *arg_0x40bcf920, uint16_t arg_0x40bcfab0, result_t arg_0x40bcfc40);
#line 57
static void GPSSensorM$GPSUartStream$sendDone(uint8_t *arg_0x40bd2b58, uint16_t arg_0x40bd2ce8, result_t arg_0x40bd2e78);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void GPSSensorM$GPSInterrupt$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GPSSensorM$StdControl$init(void);
static result_t GPSSensorM$StdControl$start(void);
# 49 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialPacket.nc"
static result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$send(uint8_t *arg_0x40bcc6c8, uint16_t arg_0x40bcc858);
#line 75
static result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$receive(uint8_t *arg_0x40bcb810, uint16_t arg_0x40bcb9a0, uint16_t arg_0x40bcbb30);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HalPXA27xBTUARTP$SerialControl$init(void);
static result_t HalPXA27xBTUARTP$SerialControl$start(void);
# 81 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
static void HalPXA27xBTUARTP$UART$interruptUART(void);
# 51 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialCntl.nc"
static result_t HalPXA27xBTUARTP$HalPXA27xSerialCntl$configPort(uint32_t arg_0x40bf1510,
uint8_t arg_0x40bf16b0,
uart_parity_t arg_0x40bf1850,
uint8_t arg_0x40bf19f0,
bool arg_0x40bf1b90);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HplPXA27xBTUARTP$UControl$init(void);
# 44 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
static void HplPXA27xBTUARTP$UART$setDLL(uint32_t arg_0x40c21928);
#line 60
static void HplPXA27xBTUARTP$UART$setMCR(uint32_t arg_0x40c49068);
#line 53
static uint32_t HplPXA27xBTUARTP$UART$getIIR(void);
#line 47
static void HplPXA27xBTUARTP$UART$setDLH(uint32_t arg_0x40c20100);
#line 42
static void HplPXA27xBTUARTP$UART$setTHR(uint32_t arg_0x40c21480);
#line 63
static uint32_t HplPXA27xBTUARTP$UART$getLSR(void);
#line 55
static void HplPXA27xBTUARTP$UART$setFCR(uint32_t arg_0x40c4a3d0);
#line 51
static uint32_t HplPXA27xBTUARTP$UART$getIER(void);
#line 41
static uint32_t HplPXA27xBTUARTP$UART$getRBR(void);
#line 57
static void HplPXA27xBTUARTP$UART$setLCR(uint32_t arg_0x40c4a878);
#line 50
static void HplPXA27xBTUARTP$UART$setIER(uint32_t arg_0x40c208c8);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void HplPXA27xBTUARTP$UARTIrq$fired(void);
# 51 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static result_t SNMSM$ledsOn(uint8_t arg_0x40ca8400) ;
static void SNMSM$restart(void) ;
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SNMSM$SNMSTimer$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$StdControl$init(void);
static result_t SNMSM$StdControl$start(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t EventReportM$EventReport$default$eventSendDone(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x40d0b508,
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
#line 37
static uint8_t EventReportM$EventReport$eventSend(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x40d0b508,
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
static uint8_t EventReportM$EventConfig$getReportLevel(uint8_t arg_0x40cae5d0);
#line 38
static result_t EventReportM$EventConfig$setReportLevel(uint8_t arg_0x40cb1e50, uint8_t arg_0x40cae010);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t EventReportM$StdControl$init(void);
static result_t EventReportM$StdControl$start(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr arg_0x409b8068, void *arg_0x409b8208, uint16_t arg_0x409b83a0);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RpcM$StdControl$init(void);
static result_t RpcM$StdControl$start(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(
# 71 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40d923e0,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40620878);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$ActivityTimer$fired(void);
# 79 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static uint8_t GenericCommProM$getRFPower(void) ;
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t GenericCommProM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 81 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$initRFChannel(uint8_t arg_0x40d8e8c8);
#line 76
static result_t GenericCommProM$setRFChannel(uint8_t arg_0x40d8f528) ;
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr arg_0x40620878);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$Control$init(void);
static result_t GenericCommProM$Control$start(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 77 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static uint8_t GenericCommProM$getRFChannel(void) ;
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t GenericCommProM$SendMsg$send(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40d90c78,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
static result_t GenericCommProM$SendMsg$default$sendDone(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40d90c78,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$MonitorTimer$fired(void);
# 78 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$setRFPower(uint8_t arg_0x40d8fef0) ;
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr arg_0x40620878);
# 71 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteSelect.nc"
static result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr arg_0x40df7270, uint8_t arg_0x40df73f8, uint8_t arg_0x40df7580);
#line 86
static result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr arg_0x40df7b90, uint8_t arg_0x40df7d18);
# 2 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
static result_t MultiHopLQI$RouteRpcCtrl$setSink(bool arg_0x40d34010);
static result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void);
#line 3
static result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t arg_0x40d344b8);
static uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void);
#line 5
static result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x40d34c68);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopLQI$Timer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t arg_0x40df3928, uint16_t arg_0x40df3ac0, bool arg_0x40df3c50);
#line 2
static result_t MultiHopLQI$MultihopCtrl$switchParent(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopLQI$StdControl$init(void);
static result_t MultiHopLQI$StdControl$start(void);
# 116 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
static bool MultiHopLQI$RouteControl$isSink(void);
#line 109
static result_t MultiHopLQI$RouteControl$releaseParent(void);
#line 84
static uint16_t MultiHopLQI$RouteControl$getQuality(void);
#line 107
static result_t MultiHopLQI$RouteControl$setParent(uint16_t arg_0x40ad7a78);
#line 49
static uint16_t MultiHopLQI$RouteControl$getParent(void);
#line 94
static result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t arg_0x40ad7108);
# 33 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static ramSymbol_t RamSymbolsM$peek(unsigned int arg_0x40e675f8, uint8_t arg_0x40e67780, bool arg_0x40e67910) ;
#line 32
static unsigned int RamSymbolsM$poke(ramSymbol_t *arg_0x40e67010) ;
# 48 "/opt/tinyos-1.x/tos/interfaces/WDT.nc"
static void WDTM$WDT$reset(void);
#line 45
static result_t WDTM$WDT$start(int32_t arg_0x40cb0b70);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t WDTM$StdControl$init(void);
static result_t WDTM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t WDTM$Timer$fired(void);
# 44 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLWatchdogM.nc"
static void HPLWatchdogM$reset(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HPLWatchdogM$StdControl$init(void);
static result_t HPLWatchdogM$StdControl$start(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 36 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
static uint32_t TimeSyncM$GlobalTime$getLocalTime(void);
static result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b6cdd8);
#line 60
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *arg_0x40b6b3d0);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t TimeSyncM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
static void TimeSyncM$TimeSyncNotify$default$msg_received(void);
static void TimeSyncM$TimeSyncNotify$default$msg_sent(void);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimeSyncM$StdControl$init(void);
static result_t TimeSyncM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimeSyncM$Timer$fired(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$SplitControl$default$initDone(void);
#line 64
static result_t CC2420RadioM$SplitControl$init(void);
#line 85
static result_t CC2420RadioM$SplitControl$default$startDone(void);
#line 77
static result_t CC2420RadioM$SplitControl$start(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420RadioM$FIFOP$fired(void);
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t CC2420RadioM$BackoffTimerJiffy$fired(void);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t CC2420RadioM$Send$send(TOS_MsgPtr arg_0x40615d50);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
static void CC2420RadioM$MacControl$enableAck(void);
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t CC2420RadioM$SFD$captured(uint16_t arg_0x40f18368);
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t arg_0x40f1cc58, uint8_t *arg_0x40f1ce00);
#line 39
static result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t arg_0x40f1c4e8, uint8_t *arg_0x40f1c690);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420RadioM$StdControl$init(void);
static result_t CC2420RadioM$StdControl$start(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
static int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr arg_0x40f2a8f0);
static int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr arg_0x40f2adb0);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$CC2420SplitControl$initDone(void);
#line 85
static result_t CC2420RadioM$CC2420SplitControl$startDone(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$FIFOP_GPIOInt$fired(void);
# 60 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t HPLCC2420M$CaptureSFD$disable(void);
#line 43
static result_t HPLCC2420M$CaptureSFD$enableCapture(bool arg_0x40f1fd70);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t arg_0x40956010);
#line 54
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t arg_0x40957918, uint16_t arg_0x40957aa8);
#line 47
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t arg_0x40957408);
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static void HPLCC2420M$TxDMAChannel$stopInterrupt(uint16_t arg_0x4054a8e0);
static void HPLCC2420M$TxDMAChannel$startInterrupt(void);
#line 86
static result_t HPLCC2420M$TxDMAChannel$requestChannelDone(void);
#line 249
static void HPLCC2420M$TxDMAChannel$eorInterrupt(uint16_t arg_0x4054a280);
#line 236
static void HPLCC2420M$TxDMAChannel$endInterrupt(uint16_t arg_0x4054cc28);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$CCA_GPIOInt$fired(void);
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static void HPLCC2420M$RxDMAChannel$stopInterrupt(uint16_t arg_0x4054a8e0);
static void HPLCC2420M$RxDMAChannel$startInterrupt(void);
#line 86
static result_t HPLCC2420M$RxDMAChannel$requestChannelDone(void);
#line 249
static void HPLCC2420M$RxDMAChannel$eorInterrupt(uint16_t arg_0x4054a280);
#line 236
static void HPLCC2420M$RxDMAChannel$endInterrupt(uint16_t arg_0x4054cc28);
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t arg_0x40f1dd70, uint8_t *arg_0x40f1df18);
#line 19
static result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t arg_0x40f1d558, uint8_t *arg_0x40f1d700);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t arg_0x40955710, uint8_t arg_0x40955898, uint8_t *arg_0x40955a40);
# 59 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420M$InterruptFIFOP$disable(void);
#line 43
static result_t HPLCC2420M$InterruptFIFOP$startWait(bool arg_0x40959bc8);
#line 59
static result_t HPLCC2420M$InterruptCCA$disable(void);
#line 43
static result_t HPLCC2420M$InterruptCCA$startWait(bool arg_0x40959bc8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HPLCC2420M$StdControl$init(void);
static result_t HPLCC2420M$StdControl$start(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$FIFO_GPIOInt$fired(void);
#line 48
static void HPLCC2420M$SFD_GPIOInt$fired(void);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420M$InterruptFIFO$default$fired(void);
static result_t HPLCC2420M$InterruptFIFO$disable(void);
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t arg_0x40f16428);
static bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void);
#line 8
static result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void TimerJiffyAsyncM$OSTIrq$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t TimerJiffyAsyncM$StdControl$init(void);
static result_t TimerJiffyAsyncM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t FlashManagerM$EraseTimer$fired(void);
#line 73
static result_t FlashManagerM$WritingTimer$fired(void);
#line 73
static result_t FlashManagerM$EraseCheckTimer$fired(void);
# 29 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
static result_t FlashManagerM$FlashManager$init(void);
#line 53
static result_t FlashManagerM$FlashManager$read(uint32_t arg_0x40adc9a0, uint8_t *arg_0x40adcb48, uint16_t arg_0x40adcce0);
#line 33
static result_t FlashManagerM$FlashManager$write(uint32_t arg_0x40ab7c08, void *arg_0x40ab7da8, uint16_t arg_0x40adc010);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FlashManagerM$StdControl$init(void);
static result_t FlashManagerM$StdControl$start(void);
# 52 "/home/xu/oasis/lib/SmartSensing/Flash.nc"
static result_t FlashM$Flash$read(uint32_t arg_0x40ad0120, uint8_t *arg_0x40ad02c8, uint32_t arg_0x40ad0460);
#line 28
static result_t FlashM$Flash$erase(uint32_t arg_0x40ad11d8);
#line 19
static result_t FlashM$Flash$write(uint32_t arg_0x40ad3868, uint8_t *arg_0x40ad3a10, uint32_t arg_0x40ad3ba8);
#line 54
static void FlashM$Flash$setFlashPartitionState(uint32_t arg_0x40ad0ad8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FlashM$StdControl$init(void);
static result_t FlashM$StdControl$start(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t FramerM$ByteComm$txDone(void);
#line 75
static result_t FramerM$ByteComm$txByteReady(bool arg_0x410a3b30);
#line 66
static result_t FramerM$ByteComm$rxByteReady(uint8_t arg_0x410a3200, bool arg_0x410a3388, uint16_t arg_0x410a3520);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t FramerM$BareSendMsg$send(TOS_MsgPtr arg_0x40615d50);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FramerM$StdControl$init(void);
static result_t FramerM$StdControl$start(void);
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x410a6cf8);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x410a64c8, uint8_t arg_0x410a6650);
# 97 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
static result_t UARTM$HPLUART$get(uint8_t arg_0x41111e58);
static result_t UARTM$HPLUART$putDone(void);
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t UARTM$ByteComm$txByte(uint8_t arg_0x410abc98);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t UARTM$Control$init(void);
static result_t UARTM$Control$start(void);
# 63 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
static result_t HPLFFUARTM$UART$init(void);
#line 89
static result_t HPLFFUARTM$UART$put(uint8_t arg_0x411118c0);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void HPLFFUARTM$Interrupt$fired(void);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658);
#line 33
static void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t arg_0x40954010, uint8_t arg_0x40954198, uint8_t *arg_0x40954340);
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
static result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40e93010, uint32_t *arg_0x40e931c8);
# 29 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
static result_t DataMgmtM$DataMgmt$freeBlk(void *arg_0x40abbc80);
#line 28
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t arg_0x40abb7b8);
static result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t arg_0x40abac20);
#line 30
static result_t DataMgmtM$DataMgmt$saveBlk(void *arg_0x40aba140, uint8_t arg_0x40aba2d0);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t DataMgmtM$BatchTimer$fired(void);
#line 73
static result_t DataMgmtM$SysCheckTimer$fired(void);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t DataMgmtM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t DataMgmtM$StdControl$init(void);
static result_t DataMgmtM$StdControl$start(void);
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
static result_t ADCM$ADCControl$bindPort(uint8_t arg_0x40aa4340, uint8_t arg_0x40aa44c8);
#line 50
static result_t ADCM$ADCControl$init(void);
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static result_t ADCM$Clock$fire(void);
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t ADCM$ADC$getData(
# 34 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
uint8_t arg_0x411da910);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t ADCM$StdControl$init(void);
static result_t ADCM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t ADCM$Timer$fired(void);
# 16 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static uint8_t NeighborMgmtM$writeNbrLinkInfo(uint8_t *arg_0x412129e8, uint8_t arg_0x41212b70);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t arg_0x40e1ddf0, uint16_t arg_0x40e1c010, bool arg_0x40e1c1a0);
#line 6
static bool NeighborMgmtM$NeighborCtrl$clearParent(bool arg_0x40e1d950);
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t arg_0x40e1bc70, uint16_t arg_0x40e1be00);
#line 4
static bool NeighborMgmtM$NeighborCtrl$changeParent(uint16_t *arg_0x40e1fc48, uint16_t *arg_0x40e1fdf8, uint16_t *arg_0x40e1d010);
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t arg_0x40e1d4c0);
# 2 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static uint16_t NeighborMgmtM$CascadeControl$getParent(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t NeighborMgmtM$StdControl$init(void);
static result_t NeighborMgmtM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t NeighborMgmtM$Timer$fired(void);
#line 73
static result_t MultiHopEngineM$RouteStatusTimer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Intercept$default$intercept(
# 22 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x41310200,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
#line 86
static result_t MultiHopEngineM$Snoop$default$intercept(
# 23 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413107e0,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t MultiHopEngineM$Send$send(
# 20 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413114b8,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
#line 106
static void *MultiHopEngineM$Send$getBuffer(
# 20 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413114b8,
# 106 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38);
#line 119
static result_t MultiHopEngineM$Send$default$sendDone(
# 20 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413114b8,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t MultiHopEngineM$EventReport$eventSendDone(TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopEngineM$MultihopCtrl$readyToSend(void);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopEngineM$StdControl$init(void);
static result_t MultiHopEngineM$StdControl$start(void);
# 84 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
static uint16_t MultiHopEngineM$RouteControl$getQuality(void);
#line 49
static uint16_t MultiHopEngineM$RouteControl$getParent(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopEngineM$MonitorTimer$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(
# 39 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x41368228,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40620878);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesRouterM$SubSend$sendDone(
# 40 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x413687d8,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$DTTimer$fired(void);
#line 73
static result_t CascadesRouterM$RTTimer$fired(void);
#line 73
static result_t CascadesRouterM$DelayTimer$fired(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr CascadesRouterM$Receive$default$receive(
# 36 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x41369c38,
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
TOS_MsgPtr arg_0x409b8068, void *arg_0x409b8208, uint16_t arg_0x409b83a0);
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static result_t CascadesRouterM$CascadeControl$addDirectChild(address_t arg_0x4121abb0);
static result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t arg_0x41218088);
static result_t CascadesRouterM$CascadeControl$parentChanged(address_t arg_0x41218530);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ResetTimer$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesRouterM$StdControl$init(void);
static result_t CascadesRouterM$StdControl$start(void);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ACKTimer$fired(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t CascadesEngineM$SendMsg$default$send(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x414016a8,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
static result_t CascadesEngineM$SendMsg$sendDone(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x414016a8,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesEngineM$MySend$send(
# 36 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x41402e60,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesEngineM$StdControl$init(void);
# 47 "/opt/tinyos-1.x/tos/system/RealMain.nc"
static result_t RealMain$hardwareInit(void);
# 78 "/opt/tinyos-1.x/tos/interfaces/Pot.nc"
static result_t RealMain$Pot$init(uint8_t arg_0x40426ac0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RealMain$StdControl$init(void);
static result_t RealMain$StdControl$start(void);
# 54 "/opt/tinyos-1.x/tos/system/RealMain.nc"
int main(void) ;
# 74 "/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"
static result_t PotM$HPLPot$finalise(void);
#line 59
static result_t PotM$HPLPot$decrease(void);
static result_t PotM$HPLPot$increase(void);
# 91 "/opt/tinyos-1.x/tos/system/PotM.nc"
uint8_t PotM$potSetting;
static inline void PotM$setPot(uint8_t value);
#line 106
static inline result_t PotM$Pot$init(uint8_t initialSetting);
# 79 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPotC.nc"
static inline result_t HPLPotC$Pot$decrease(void);
static inline result_t HPLPotC$Pot$increase(void);
static inline result_t HPLPotC$Pot$finalise(void);
# 54 "/opt/tinyos-1.x/tos/platform/imote2/DVFS.nc"
static result_t HPLInitM$DVFS$SwitchCoreFreq(uint32_t arg_0x4044bac0, uint32_t arg_0x4044bc58);
# 87 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLInitM.nc"
queue_t paramtaskQueue ;
static inline result_t HPLInitM$init(void);
# 51 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
static result_t DVFSM$PMIC$setCoreVoltage(uint8_t arg_0x404bd718);
# 58 "/opt/tinyos-1.x/tos/platform/imote2/DVFSM.nc"
static result_t DVFSM$DVFS$SwitchCoreFreq(uint32_t coreFreq, uint32_t sysBusFreq);
#line 176
static inline BluSH_result_t DVFSM$SwitchFreq$getName(char *buff, uint8_t len);
static inline BluSH_result_t DVFSM$SwitchFreq$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 206
static inline BluSH_result_t DVFSM$GetFreq$getName(char *buff, uint8_t len);
static inline BluSH_result_t DVFSM$GetFreq$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
# 47 "/opt/tinyos-1.x/tos/platform/imote2/SendDataAlloc.nc"
static result_t BufferedSTUARTM$SendDataAlloc$sendDone(uint8_t *arg_0x404dd010, uint32_t arg_0x404dd1a8, result_t arg_0x404dd338);
# 35 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
static result_t BufferedSTUARTM$BulkTxRx$BulkTransmit(uint8_t *arg_0x404f4600, uint16_t arg_0x404f4798);
#line 27
static result_t BufferedSTUARTM$BulkTxRx$BulkReceive(uint8_t *arg_0x40501dd8, uint16_t arg_0x404f4010);
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
static result_t BufferedSTUARTM$ReceiveData$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0);
# 62 "/opt/tinyos-1.x/tos/platform/imote2/SendData.nc"
static result_t BufferedSTUARTM$SendData$sendDone(uint8_t *arg_0x404e11a8, uint32_t arg_0x404e1340, result_t arg_0x404e14d0);
# 23 "/opt/tinyos-1.x/tos/platform/imote2/BufferedSTUARTM.nc"
ptrqueue_t outgoingQueue ;
# 4 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/paramtask.h"
unsigned char TOS_parampost(void (*tp)(void), uint32_t arg) ;
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
#line 6
typedef enum BufferedSTUARTM$__nesc_unnamed4306 {
BufferedSTUARTM$originSendData = 0,
BufferedSTUARTM$originSendDataAlloc
} BufferedSTUARTM$sendOrigin_t;
bufferInfoSet_t BufferedSTUARTM$receiveBufferInfoSet;
#line 11
bufferInfoInfo_t BufferedSTUARTM$receiveBufferInfoInfo[30];
#line 11
bufferSet_t BufferedSTUARTM$receiveBufferSet;
#line 11
buffer_t BufferedSTUARTM$receiveBufferStructs[30];
#line 11
uint8_t BufferedSTUARTM$receiveBuffers[30][((10 + 31) >> 5) << 5] __attribute((aligned(32))) ;
bool BufferedSTUARTM$gTxActive = FALSE;
static inline void BufferedSTUARTM$transmitDone(uint32_t arg);
static inline void BufferedSTUARTM$_transmitDoneveneer(void);
static inline void BufferedSTUARTM$receiveDone(uint32_t arg);
static inline void BufferedSTUARTM$_receiveDoneveneer(void);
static inline result_t BufferedSTUARTM$StdControl$init(void);
static inline result_t BufferedSTUARTM$StdControl$start(void);
#line 122
static inline result_t BufferedSTUARTM$SendDataAlloc$default$sendDone(uint8_t *data, uint32_t numBytes, result_t success);
#line 192
static inline void BufferedSTUARTM$transmitDone(uint32_t arg);
#line 224
static inline void BufferedSTUARTM$receiveDone(uint32_t arg);
#line 260
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkReceiveDone(uint8_t *RxBuffer,
uint16_t NumBytes);
#line 285
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkTransmitDone(uint8_t *TxBuffer, uint16_t NumBytes);
# 143 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static result_t STUARTM$TxDMAChannel$enableTargetAddrIncrement(bool arg_0x4053f608);
#line 161
static result_t STUARTM$TxDMAChannel$enableTargetFlowControl(bool arg_0x4054e188);
#line 123
static result_t STUARTM$TxDMAChannel$setTargetAddr(uint32_t arg_0x4053aaa8);
#line 182
static result_t STUARTM$TxDMAChannel$setTransferLength(uint16_t arg_0x4054ed20);
static result_t STUARTM$TxDMAChannel$setTransferWidth(DMATransferWidth_t arg_0x4054d358);
#line 113
static result_t STUARTM$TxDMAChannel$setSourceAddr(uint32_t arg_0x4053a528);
#line 172
static result_t STUARTM$TxDMAChannel$setMaxBurstSize(DMAMaxBurstSize_t arg_0x4054e720);
#line 152
static result_t STUARTM$TxDMAChannel$enableSourceFlowControl(bool arg_0x4053fbd8);
#line 204
static result_t STUARTM$TxDMAChannel$run(DMAInterruptEnable_t arg_0x4054d948);
#line 77
static result_t STUARTM$TxDMAChannel$requestChannel(DMAPeripheralID_t arg_0x405402f8,
DMAPriority_t arg_0x405404a0, bool arg_0x40540630);
#line 133
static result_t STUARTM$TxDMAChannel$enableSourceAddrIncrement(bool arg_0x4053f030);
static result_t STUARTM$RxDMAChannel$enableTargetAddrIncrement(bool arg_0x4053f608);
#line 161
static result_t STUARTM$RxDMAChannel$enableTargetFlowControl(bool arg_0x4054e188);
#line 123
static result_t STUARTM$RxDMAChannel$setTargetAddr(uint32_t arg_0x4053aaa8);
#line 182
static result_t STUARTM$RxDMAChannel$setTransferLength(uint16_t arg_0x4054ed20);
static result_t STUARTM$RxDMAChannel$setTransferWidth(DMATransferWidth_t arg_0x4054d358);
#line 113
static result_t STUARTM$RxDMAChannel$setSourceAddr(uint32_t arg_0x4053a528);
#line 172
static result_t STUARTM$RxDMAChannel$setMaxBurstSize(DMAMaxBurstSize_t arg_0x4054e720);
#line 152
static result_t STUARTM$RxDMAChannel$enableSourceFlowControl(bool arg_0x4053fbd8);
#line 204
static result_t STUARTM$RxDMAChannel$run(DMAInterruptEnable_t arg_0x4054d948);
#line 77
static result_t STUARTM$RxDMAChannel$requestChannel(DMAPeripheralID_t arg_0x405402f8,
DMAPriority_t arg_0x405404a0, bool arg_0x40540630);
#line 133
static result_t STUARTM$RxDMAChannel$enableSourceAddrIncrement(bool arg_0x4053f030);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void STUARTM$UARTInterrupt$disable(void);
#line 45
static result_t STUARTM$UARTInterrupt$allocate(void);
# 63 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
static uint8_t *STUARTM$BulkTxRx$BulkReceiveDone(uint8_t *arg_0x404f3720, uint16_t arg_0x404f38b8);
static uint8_t *STUARTM$BulkTxRx$BulkTransmitDone(uint8_t *arg_0x404ff190, uint16_t arg_0x404ff328);
# 41 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
bool STUARTM$gTxPortInUse = FALSE;
bool STUARTM$gRxPortInUse = FALSE;
bool STUARTM$gPortInitialized = FALSE;
uint16_t STUARTM$gNumRxFifoOverruns;
uint8_t *STUARTM$gRxBuffer;
uint16_t STUARTM$gRxNumBytes;
#line 48
uint16_t STUARTM$gRxBufferPos;
uint8_t *STUARTM$gTxBuffer;
uint16_t STUARTM$gTxNumBytes;
#line 51
uint16_t STUARTM$gTxBufferPos;
static void STUARTM$initPort(void);
#line 76
static void STUARTM$configPort(void);
#line 114
static inline result_t STUARTM$openTxPort(bool bTxDMAIntEnable);
#line 146
static inline result_t STUARTM$openRxPort(bool bRxDMAIntEnable);
#line 177
static result_t STUARTM$closeTxPort(void);
#line 199
static result_t STUARTM$closeRxPort(void);
#line 217
static inline void STUARTM$configureRxDMA(uint8_t *RxBuffer, uint16_t NumBytes, bool bEnableTargetAddrIncrement);
#line 240
static inline result_t STUARTM$BulkTxRx$BulkReceive(uint8_t *RxBuffer, uint16_t NumBytes);
#line 269
static inline result_t STUARTM$RxDMAChannel$requestChannelDone(void);
static void STUARTM$handleRxDMADone(uint16_t numBytesSent);
#line 296
static inline void STUARTM$RxDMAChannel$startInterrupt(void);
static inline void STUARTM$RxDMAChannel$stopInterrupt(uint16_t numbBytesSent);
static inline void STUARTM$RxDMAChannel$eorInterrupt(uint16_t numBytesSent);
static inline void STUARTM$RxDMAChannel$endInterrupt(uint16_t numBytesSent);
static inline void STUARTM$configureTxDMA(uint8_t *TxBuffer, uint16_t NumBytes);
#line 335
static inline result_t STUARTM$BulkTxRx$BulkTransmit(uint8_t *TxBuffer, uint16_t NumBytes);
#line 368
static inline result_t STUARTM$TxDMAChannel$requestChannelDone(void);
static inline void STUARTM$TxDMAChannel$startInterrupt(void);
static inline void STUARTM$TxDMAChannel$stopInterrupt(uint16_t numBytesLeft);
static inline void STUARTM$TxDMAChannel$eorInterrupt(uint16_t numBytesLeft);
static inline void STUARTM$TxDMAChannel$endInterrupt(uint16_t numBytesSent);
#line 414
static inline void STUARTM$printUARTError(void);
static inline void STUARTM$UARTInterrupt$fired(void);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XDMAM$Interrupt$enable(void);
#line 45
static result_t PXA27XDMAM$Interrupt$allocate(void);
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static void PXA27XDMAM$PXA27XDMAChannel$stopInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054a8e0);
static void PXA27XDMAM$PXA27XDMAChannel$startInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790);
# 86 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static result_t PXA27XDMAM$PXA27XDMAChannel$requestChannelDone(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790);
# 249 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
static void PXA27XDMAM$PXA27XDMAChannel$eorInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 249 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054a280);
#line 236
static void PXA27XDMAM$PXA27XDMAChannel$endInterrupt(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
uint8_t arg_0x40593790,
# 236 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
uint16_t arg_0x4054cc28);
# 4 "/opt/tinyos-1.x/tos/platform/pxa27x/lib/paramtask.h"
unsigned char TOS_parampost(void (*tp)(void), uint32_t arg) ;
# 87 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
#line 82
typedef struct PXA27XDMAM$__nesc_unnamed4307 {
uint32_t DDADR;
uint32_t DSADR;
uint32_t DTADR;
uint32_t DCMD;
} PXA27XDMAM$DMADescriptor_t;
#line 89
typedef struct PXA27XDMAM$__nesc_unnamed4308 {
bool channelValid;
uint8_t realChannel;
DMAPeripheralID_t peripheralID;
uint16_t length;
} PXA27XDMAM$DMAChannelInfo_t;
#line 96
typedef struct PXA27XDMAM$__nesc_unnamed4309 {
uint8_t virtualChannel;
bool inUse;
bool permanent;
} PXA27XDMAM$ChannelMapItem_t;
PXA27XDMAM$DMADescriptor_t PXA27XDMAM$mDescriptorArray[4U];
PXA27XDMAM$DMAChannelInfo_t PXA27XDMAM$mChannelArray[4U];
PXA27XDMAM$ChannelMapItem_t PXA27XDMAM$mPriorityMap[32];
bool PXA27XDMAM$gInitialized = FALSE;
static inline result_t PXA27XDMAM$StdControl$init(void);
#line 129
static inline result_t PXA27XDMAM$StdControl$start(void);
#line 142
static inline void PXA27XDMAM$postRequestChannelDone(uint32_t arg);
static inline void PXA27XDMAM$_postRequestChannelDoneveneer(void);
static result_t PXA27XDMAM$PXA27XDMAChannel$requestChannel(uint8_t channel, DMAPeripheralID_t peripheralID,
DMAPriority_t priority,
bool permanent);
#line 245
static inline result_t PXA27XDMAM$PXA27XDMAChannel$default$requestChannelDone(uint8_t channel);
static result_t PXA27XDMAM$PXA27XDMAChannel$setSourceAddr(uint8_t channel, uint32_t val);
static result_t PXA27XDMAM$PXA27XDMAChannel$setTargetAddr(uint8_t channel, uint32_t val);
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceAddrIncrement(uint8_t channel, bool enable);
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetAddrIncrement(uint8_t channel, bool enable);
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceFlowControl(uint8_t channel, bool enable);
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetFlowControl(uint8_t channel, bool enable);
static result_t PXA27XDMAM$PXA27XDMAChannel$setMaxBurstSize(uint8_t channel, DMAMaxBurstSize_t size);
#line 302
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferLength(uint8_t channel, uint16_t length);
#line 316
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferWidth(uint8_t channel, DMATransferWidth_t width);
#line 346
static result_t PXA27XDMAM$PXA27XDMAChannel$run(uint8_t channel, DMAInterruptEnable_t interruptEn);
#line 392
static inline void PXA27XDMAM$PXA27XDMAChannel$default$stopInterrupt(uint8_t channel, uint16_t numBytesSent);
static inline void PXA27XDMAM$PXA27XDMAChannel$default$startInterrupt(uint8_t channel);
static inline void PXA27XDMAM$PXA27XDMAChannel$default$eorInterrupt(uint8_t channel, uint16_t numBytesSent);
static inline void PXA27XDMAM$PXA27XDMAChannel$default$endInterrupt(uint8_t channel, uint16_t numByteSent);
volatile uint32_t globalDMAVirtualChannelHandled ;
static inline void PXA27XDMAM$Interrupt$fired(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XFiq$fired(
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405de5d0);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XInterruptM$PXA27XIrq$fired(
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
uint8_t arg_0x405ecc80);
#line 75
void hplarmv_dabort(void) __attribute((interrupt("ABORT"))) ;
#line 116
void hplarmv_pabort(void) __attribute((interrupt("ABORT"))) ;
#line 143
extern volatile uint32_t globalDMAVirtualChannelHandled ;
void hplarmv_irq(void) __attribute((interrupt("IRQ"))) ;
#line 204
void hplarmv_fiq(void) __attribute((interrupt("FIQ"))) ;
#line 221
static uint8_t PXA27XInterruptM$usedPriorities = 0;
static result_t PXA27XInterruptM$allocate(uint8_t id, bool level, uint8_t priority);
#line 294
static void PXA27XInterruptM$enable(uint8_t id);
#line 306
static void PXA27XInterruptM$disable(uint8_t id);
#line 320
static inline result_t PXA27XInterruptM$PXA27XIrq$allocate(uint8_t id);
static inline void PXA27XInterruptM$PXA27XIrq$enable(uint8_t id);
static inline void PXA27XInterruptM$PXA27XIrq$disable(uint8_t id);
#line 354
static inline void PXA27XInterruptM$PXA27XIrq$default$fired(uint8_t id);
static inline void PXA27XInterruptM$PXA27XFiq$default$fired(uint8_t id);
# 11 "/opt/tinyos-1.x/tos/platform/imote2/UIDC.nc"
static inline uint32_t UIDC$UID$getUID(void);
# 14 "/opt/tinyos-1.x/tos/platform/imote2/HPLUSBClientGPIOM.nc"
static inline result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$init(void);
#line 27
static inline result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$checkConnection(void);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XGPIOIntM$GPIOIrq0$enable(void);
#line 45
static result_t PXA27XGPIOIntM$GPIOIrq0$allocate(void);
static void PXA27XGPIOIntM$GPIOIrq$enable(void);
#line 45
static result_t PXA27XGPIOIntM$GPIOIrq$allocate(void);
static void PXA27XGPIOIntM$GPIOIrq1$enable(void);
#line 45
static result_t PXA27XGPIOIntM$GPIOIrq1$allocate(void);
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$fired(
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
uint8_t arg_0x40643bb0);
bool PXA27XGPIOIntM$gfInitialized = FALSE;
static result_t PXA27XGPIOIntM$StdControl$init(void);
#line 75
static result_t PXA27XGPIOIntM$StdControl$start(void);
#line 88
static void PXA27XGPIOIntM$PXA27XGPIOInt$enable(uint8_t pin, uint8_t mode);
#line 112
static void PXA27XGPIOIntM$PXA27XGPIOInt$disable(uint8_t pin);
static void PXA27XGPIOIntM$PXA27XGPIOInt$clear(uint8_t pin);
static void PXA27XGPIOIntM$PXA27XGPIOInt$default$fired(uint8_t pin);
static inline void PXA27XGPIOIntM$GPIOIrq$fired(void);
#line 179
static inline void PXA27XGPIOIntM$GPIOIrq0$fired(void);
static inline void PXA27XGPIOIntM$GPIOIrq1$fired(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr PXA27XUSBClientM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 28 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
static result_t PXA27XUSBClientM$SendJTPacket$sendDone(
# 24 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
uint8_t arg_0x4065c5b8,
# 28 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
uint8_t *arg_0x40614b20, uint8_t arg_0x40614ca8, result_t arg_0x40614e38);
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/UID.nc"
static uint32_t PXA27XUSBClientM$UID$getUID(void);
# 62 "/opt/tinyos-1.x/tos/interfaces/SendVarLenPacket.nc"
static result_t PXA27XUSBClientM$SendVarLenPacket$sendDone(uint8_t *arg_0x406168e8, result_t arg_0x40616a78);
# 10 "/opt/tinyos-1.x/tos/platform/pxa27x/ReceiveBData.nc"
static result_t PXA27XUSBClientM$ReceiveBData$receive(uint8_t *arg_0x40621118, uint8_t arg_0x406212a8,
uint32_t arg_0x40621448, uint32_t arg_0x406215d8, uint8_t arg_0x40621760);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XUSBClientM$USBAttached$clear(void);
#line 45
static void PXA27XUSBClientM$USBAttached$enable(uint8_t arg_0x406321d8);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XUSBClientM$USBInterrupt$enable(void);
#line 45
static result_t PXA27XUSBClientM$USBInterrupt$allocate(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t PXA27XUSBClientM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
static result_t PXA27XUSBClientM$ReceiveData$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0);
# 35 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLUSBClientGPIO.nc"
static result_t PXA27XUSBClientM$HPLUSBClientGPIO$checkConnection(void);
#line 19
static result_t PXA27XUSBClientM$HPLUSBClientGPIO$init(void);
# 14 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.h"
typedef struct PXA27XUSBClientM$DynQueue_T *PXA27XUSBClientM$DynQueue;
static PXA27XUSBClientM$DynQueue PXA27XUSBClientM$DynQueue_new(void);
static inline int PXA27XUSBClientM$DynQueue_getLength(PXA27XUSBClientM$DynQueue oDynQueue);
static void *PXA27XUSBClientM$DynQueue_dequeue(PXA27XUSBClientM$DynQueue oDynQueue);
static int PXA27XUSBClientM$DynQueue_enqueue(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem);
static void *PXA27XUSBClientM$DynQueue_peek(PXA27XUSBClientM$DynQueue oDynQueue);
static void PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem);
# 15 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
struct PXA27XUSBClientM$DynQueue_T {
int iLength;
int iPhysLength;
int index;
const void **ppvQueue;
};
static PXA27XUSBClientM$DynQueue PXA27XUSBClientM$DynQueue_new(void);
#line 65
static inline int PXA27XUSBClientM$DynQueue_getLength(PXA27XUSBClientM$DynQueue oDynQueue);
#line 78
static void *PXA27XUSBClientM$DynQueue_peek(PXA27XUSBClientM$DynQueue oDynQueue);
#line 90
static void PXA27XUSBClientM$DynQueue_shiftgrow(PXA27XUSBClientM$DynQueue oDynQueue);
#line 114
inline static void PXA27XUSBClientM$DynQueue_shiftshrink(PXA27XUSBClientM$DynQueue oDynQueue);
#line 135
static int PXA27XUSBClientM$DynQueue_enqueue(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem);
#line 153
static void *PXA27XUSBClientM$DynQueue_dequeue(PXA27XUSBClientM$DynQueue oDynQueue);
#line 176
static void PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem);
# 24 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBdata.c"
#line 10
typedef struct PXA27XUSBClientM$__USBdata {
volatile unsigned long *endpointDR;
uint32_t fifosize;
uint8_t *src;
uint32_t len;
uint32_t tlen;
uint32_t index;
uint32_t pindex;
uint32_t n;
uint16_t status;
uint8_t type;
uint8_t source;
uint8_t *param;
uint8_t channel;
} PXA27XUSBClientM$USBdata_t;
typedef PXA27XUSBClientM$USBdata_t *PXA27XUSBClientM$USBdata;
union PXA27XUSBClientM$string_or_langid {
uint16_t wLANGID;
char *bString;
};
#line 32
typedef struct PXA27XUSBClientM$__hid {
uint16_t bcdHID;
uint16_t wDescriptorLength;
uint8_t bCountryCode;
uint8_t bNumDescriptors;
uint8_t bDescriptorType;
} PXA27XUSBClientM$USBhid;
#line 40
typedef struct PXA27XUSBClientM$__hidreport {
uint16_t wLength;
uint8_t *bString;
} PXA27XUSBClientM$USBhidReport;
#line 45
typedef struct PXA27XUSBClientM$__string {
uint8_t bLength;
union PXA27XUSBClientM$string_or_langid uMisc;
} PXA27XUSBClientM$__string_t;
typedef PXA27XUSBClientM$__string_t *PXA27XUSBClientM$USBstring;
#line 51
typedef struct PXA27XUSBClientM$__endpoint {
uint8_t bEndpointAddress;
uint8_t bmAttributes;
uint16_t wMaxPacketSize;
uint8_t bInterval;
} PXA27XUSBClientM$__endpoint_t;
typedef PXA27XUSBClientM$__endpoint_t *PXA27XUSBClientM$USBendpoint;
#line 59
typedef struct PXA27XUSBClientM$__interface {
uint8_t bInterfaceID;
uint8_t bAlternateSetting;
uint8_t bNumEndpoints;
uint8_t bInterfaceClass;
uint8_t bInterfaceSubclass;
uint8_t bInterfaceProtocol;
uint8_t iInterface;
PXA27XUSBClientM$USBendpoint *oEndpoints;
} PXA27XUSBClientM$__interface_t;
typedef PXA27XUSBClientM$__interface_t *PXA27XUSBClientM$USBinterface;
#line 71
typedef struct PXA27XUSBClientM$__configuration {
uint16_t wTotalLength;
uint8_t bNumInterfaces;
uint8_t bConfigurationID;
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t MaxPower;
PXA27XUSBClientM$USBinterface *oInterfaces;
} PXA27XUSBClientM$__configuration_t;
typedef PXA27XUSBClientM$__configuration_t *PXA27XUSBClientM$USBconfiguration;
#line 96
#line 82
typedef struct PXA27XUSBClientM$__device {
uint16_t bcdUSB;
uint8_t bDeviceClass;
uint8_t bDeviceSubclass;
uint8_t bDeviceProtocol;
uint8_t bMaxPacketSize0;
uint16_t idVendor;
uint16_t idProduct;
uint16_t bcdDevice;
uint8_t iManufacturer;
uint8_t iProduct;
uint8_t iSerialNumber;
uint8_t bNumConfigurations;
PXA27XUSBClientM$USBconfiguration *oConfigurations;
} PXA27XUSBClientM$USBdevice;
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$writeStringDescriptor(void);
static inline void PXA27XUSBClientM$writeHidDescriptor(void);
static inline void PXA27XUSBClientM$writeHidReportDescriptor(void);
static inline void PXA27XUSBClientM$writeEndpointDescriptor(PXA27XUSBClientM$USBendpoint *endpoints, uint8_t config, uint8_t inter, uint8_t i);
static inline uint16_t PXA27XUSBClientM$writeInterfaceDescriptor(PXA27XUSBClientM$USBinterface *interfaces, uint8_t config, uint8_t i);
static inline void PXA27XUSBClientM$writeConfigurationDescriptor(PXA27XUSBClientM$USBconfiguration *configs, uint8_t i);
static inline void PXA27XUSBClientM$writeDeviceDescriptor(void);
#line 68
static inline void PXA27XUSBClientM$sendStringDescriptor(uint8_t id, uint16_t wLength);
static inline void PXA27XUSBClientM$sendDeviceDescriptor(uint16_t wLength);
static inline void PXA27XUSBClientM$sendConfigDescriptor(uint8_t id, uint16_t wLength);
static inline void PXA27XUSBClientM$sendHidReportDescriptor(uint16_t wLength);
static inline void PXA27XUSBClientM$sendReport(uint8_t *data, uint32_t datalen, uint8_t type, uint8_t source, uint8_t channel);
static void PXA27XUSBClientM$sendIn(void);
static void PXA27XUSBClientM$sendControlIn(void);
static void PXA27XUSBClientM$clearIn(void);
static void PXA27XUSBClientM$clearUSBdata(PXA27XUSBClientM$USBdata Stream, uint8_t isConst);
static void PXA27XUSBClientM$processOut(void);
static inline void PXA27XUSBClientM$retrieveOut(void);
static void PXA27XUSBClientM$clearOut(void);
static void PXA27XUSBClientM$handleControlSetup(void);
static void PXA27XUSBClientM$isAttached(void);
static PXA27XUSBClientM$USBdevice PXA27XUSBClientM$Device;
static PXA27XUSBClientM$USBhid PXA27XUSBClientM$Hid;
static PXA27XUSBClientM$USBhidReport PXA27XUSBClientM$HidReport;
static PXA27XUSBClientM$USBstring PXA27XUSBClientM$Strings[3 + 1];
static PXA27XUSBClientM$DynQueue PXA27XUSBClientM$InQueue;
#line 141
static PXA27XUSBClientM$DynQueue PXA27XUSBClientM$OutQueue;
static PXA27XUSBClientM$USBdata_t PXA27XUSBClientM$OutStream[4];
static PXA27XUSBClientM$USBdata PXA27XUSBClientM$InState = (void *)0;
static uint32_t PXA27XUSBClientM$state = 0;
static uint8_t PXA27XUSBClientM$init = 0;
#line 151
static uint8_t PXA27XUSBClientM$InTask = 0;
static inline result_t PXA27XUSBClientM$Control$init(void);
#line 200
static inline result_t PXA27XUSBClientM$Control$start(void);
#line 221
static inline void PXA27XUSBClientM$USBAttached$fired(void);
static inline void PXA27XUSBClientM$USBInterrupt$fired(void);
#line 389
static inline result_t PXA27XUSBClientM$SendJTPacket$send(uint8_t channel, uint8_t *data, uint32_t numBytes, uint8_t type);
#line 407
static inline result_t PXA27XUSBClientM$SendVarLenPacket$default$sendDone(uint8_t *packet, result_t success);
static inline result_t PXA27XUSBClientM$SendJTPacket$default$sendDone(uint8_t channel, uint8_t *packet, uint8_t type,
result_t success);
static inline result_t PXA27XUSBClientM$BareSendMsg$default$sendDone(TOS_MsgPtr msg, result_t success);
static inline result_t PXA27XUSBClientM$ReceiveBData$default$receive(uint8_t *buffer, uint8_t numBytesRead, uint32_t i, uint32_t n, uint8_t type);
static inline TOS_MsgPtr PXA27XUSBClientM$ReceiveMsg$default$receive(TOS_MsgPtr m);
static void PXA27XUSBClientM$handleControlSetup(void);
#line 522
static inline void PXA27XUSBClientM$sendReport(uint8_t *data, uint32_t datalen, uint8_t type, uint8_t source, uint8_t channel);
#line 583
static inline void PXA27XUSBClientM$retrieveOut(void);
#line 618
static void PXA27XUSBClientM$processOut(void);
#line 833
static void PXA27XUSBClientM$sendIn(void);
#line 947
static void PXA27XUSBClientM$sendControlIn(void);
#line 993
static void PXA27XUSBClientM$isAttached(void);
#line 1024
static inline void PXA27XUSBClientM$sendDeviceDescriptor(uint16_t wLength);
#line 1063
static inline void PXA27XUSBClientM$sendConfigDescriptor(uint8_t id, uint16_t wLength);
#line 1119
static inline void PXA27XUSBClientM$sendStringDescriptor(uint8_t id, uint16_t wLength);
#line 1181
static inline void PXA27XUSBClientM$sendHidReportDescriptor(uint16_t wLength);
#line 1217
static inline void PXA27XUSBClientM$writeHidDescriptor(void);
static inline void PXA27XUSBClientM$writeHidReportDescriptor(void);
#line 1244
static inline void PXA27XUSBClientM$writeStringDescriptor(void);
#line 1267
static inline void PXA27XUSBClientM$writeEndpointDescriptor(PXA27XUSBClientM$USBendpoint *endpoints, uint8_t config, uint8_t inter, uint8_t i);
#line 1300
static inline uint16_t PXA27XUSBClientM$writeInterfaceDescriptor(PXA27XUSBClientM$USBinterface *interfaces, uint8_t config, uint8_t i);
#line 1346
static inline void PXA27XUSBClientM$writeConfigurationDescriptor(PXA27XUSBClientM$USBconfiguration *configs, uint8_t i);
#line 1376
static inline void PXA27XUSBClientM$writeDeviceDescriptor(void);
#line 1417
static void PXA27XUSBClientM$clearIn(void);
#line 1432
static void PXA27XUSBClientM$clearUSBdata(PXA27XUSBClientM$USBdata Stream, uint8_t isConst);
static void PXA27XUSBClientM$clearOut(void);
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
static result_t BluSHM$USBSend$send(uint8_t *arg_0x406141a8, uint32_t arg_0x40614340, uint8_t arg_0x406144c8);
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t BluSHM$BluSH_AppI$callApp(
# 33 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
uint8_t arg_0x40784798,
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
char *arg_0x404b5888, uint8_t arg_0x404b5a10,
char *arg_0x404b5bc0, uint8_t arg_0x404b5d48);
#line 8
static BluSH_result_t BluSHM$BluSH_AppI$getName(
# 33 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
uint8_t arg_0x40784798,
# 8 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
char *arg_0x404b5250, uint8_t arg_0x404b53d8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t BluSHM$UartControl$init(void);
static result_t BluSHM$UartControl$start(void);
# 5 "/opt/tinyos-1.x/tos/platform/imote2/cmdlinetools.c"
static inline void BluSHM$killWhiteSpace(char *str);
static inline void BluSHM$killWhiteSpace(char *str);
#line 80
static inline uint16_t BluSHM$firstSpace(char *str, uint16_t start);
# 105 "/usr/local/wasabi/usr/local/lib/gcc-lib/xscale-elf/Wasabi-3.3.1/include/stdarg.h" 3
typedef __gnuc_va_list BluSHM$va_list;
# 14 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.h"
typedef struct BluSHM$DynQueue_T *BluSHM$DynQueue;
static BluSHM$DynQueue BluSHM$DynQueue_new(void);
static inline int BluSHM$DynQueue_getLength(BluSHM$DynQueue oDynQueue);
static void *BluSHM$DynQueue_dequeue(BluSHM$DynQueue oDynQueue);
static int BluSHM$DynQueue_enqueue(BluSHM$DynQueue oDynQueue, const void *pvItem);
static void *BluSHM$DynQueue_peek(BluSHM$DynQueue oDynQueue);
# 15 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
struct BluSHM$DynQueue_T {
int iLength;
int iPhysLength;
int index;
const void **ppvQueue;
};
static BluSHM$DynQueue BluSHM$DynQueue_new(void);
#line 65
static inline int BluSHM$DynQueue_getLength(BluSHM$DynQueue oDynQueue);
#line 78
static void *BluSHM$DynQueue_peek(BluSHM$DynQueue oDynQueue);
#line 90
inline static void BluSHM$DynQueue_shiftgrow(BluSHM$DynQueue oDynQueue);
#line 114
inline static void BluSHM$DynQueue_shiftshrink(BluSHM$DynQueue oDynQueue);
#line 135
static int BluSHM$DynQueue_enqueue(BluSHM$DynQueue oDynQueue, const void *pvItem);
#line 153
static void *BluSHM$DynQueue_dequeue(BluSHM$DynQueue oDynQueue);
# 55 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static void generalSend(uint8_t *buf, uint32_t buflen) ;
static void BluSHM$processIn(void);
static inline void BluSHM$clearIn(void);
static inline void BluSHM$clearBluSHdata(BluSHdata data);
char BluSHM$blush_prompt[32];
char BluSHM$blush_history[4][80];
char BluSHM$blush_cur_line[80];
uint8_t BluSHM$InTaskCount = 0;
BluSHM$DynQueue BluSHM$InQueue;
BluSHM$DynQueue BluSHM$OutQueue;
long long BluSHM$trace_modes;
void trace(long long mode, const char *format, ...) ;
#line 90
unsigned char trace_active(long long mode) ;
void trace_unset(void) ;
void trace_set(long long mode) ;
static void generalSend(uint8_t *buf, uint32_t buflen) ;
#line 136
static void BluSHM$processIn(void);
#line 233
static inline result_t BluSHM$StdControl$init(void);
#line 257
static inline result_t BluSHM$StdControl$start(void);
#line 275
static BluSH_result_t BluSHM$BluSH_AppI$default$getName(uint8_t id, char *buff, uint8_t len);
static inline BluSH_result_t BluSHM$BluSH_AppI$default$callApp(uint8_t id, char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static void BluSHM$queueInput(uint8_t *buff, uint32_t numBytesRead);
#line 450
static inline result_t BluSHM$UartReceive$receive(uint8_t *buff, uint32_t numBytesRead);
static inline result_t BluSHM$USBReceive$receive(uint8_t *buff, uint32_t numBytesRead);
static inline result_t BluSHM$UartSend$sendDone(uint8_t *packet, uint32_t numBytes, result_t success);
static inline result_t BluSHM$USBSend$sendDone(uint8_t *packet, uint8_t type, result_t success);
#line 493
static inline void BluSHM$clearIn(void);
static inline void BluSHM$clearBluSHdata(BluSHdata data);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PMICM$PI2CInterrupt$enable(void);
#line 45
static result_t PMICM$PI2CInterrupt$allocate(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t PMICM$batteryMonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t PMICM$GPIOIRQControl$init(void);
static result_t PMICM$GPIOIRQControl$start(void);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PMICM$PMICInterrupt$clear(void);
#line 45
static void PMICM$PMICInterrupt$enable(uint8_t arg_0x406321d8);
# 56 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t PMICM$Leds$init(void);
#line 106
static result_t PMICM$Leds$greenToggle(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t PMICM$chargeMonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t PMICM$chargeMonitorTimer$stop(void);
# 46 "/opt/tinyos-1.x/tos/interfaces/Reset.nc"
static void PMICM$Reset$reset(void);
# 97 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
bool PMICM$gotReset = FALSE;
static __inline void PMICM$TOSH_CLR_PMIC_TXON_PIN(void);
#line 99
static __inline void PMICM$TOSH_MAKE_PMIC_TXON_OUTPUT(void);
static result_t PMICM$readPMIC(uint8_t address, uint8_t *value, uint8_t numBytes);
static result_t PMICM$writePMIC(uint8_t address, uint8_t value);
static result_t PMICM$getPMICADCVal(uint8_t channel, uint8_t *val);
bool PMICM$accessingPMIC = FALSE;
static bool PMICM$getPI2CBus(void);
#line 119
static inline void PMICM$returnPI2CBus(void);
static inline bool PMICM$isChargerEnabled(void);
static inline uint8_t PMICM$getChargerVoltage(void);
static inline uint8_t PMICM$getBatteryVoltage(void);
static result_t PMICM$StdControl$init(void);
#line 167
static void PMICM$smartChargeEnable(void);
#line 194
static inline void PMICM$printReadPMICBusError(void);
static inline void PMICM$printReadPMICAddresError(void);
static inline void PMICM$printReadPMICSlaveAddresError(void);
static inline void PMICM$printReadPMICReadByteError(void);
static result_t PMICM$readPMIC(uint8_t address, uint8_t *value, uint8_t numBytes);
#line 301
static inline void PMICM$printWritePMICSlaveAddressError(void);
static inline void PMICM$printWritePMICRegisterAddressError(void);
static inline void PMICM$printWritePMICWriteError(void);
static result_t PMICM$writePMIC(uint8_t address, uint8_t value);
#line 362
static inline void PMICM$startLDOs(void);
#line 402
static inline result_t PMICM$StdControl$start(void);
#line 459
static inline void PMICM$PI2CInterrupt$fired(void);
#line 474
static inline void PMICM$handlePMICIrq(void);
#line 516
static inline void PMICM$PMICInterrupt$fired(void);
#line 538
static result_t PMICM$PMIC$setCoreVoltage(uint8_t trimValue);
#line 609
static inline result_t PMICM$PMIC$shutDownLDOs(void);
#line 637
static result_t PMICM$getPMICADCVal(uint8_t channel, uint8_t *val);
#line 652
static inline result_t PMICM$PMIC$getBatteryVoltage(uint8_t *val);
static result_t PMICM$PMIC$chargingStatus(uint8_t *vBat, uint8_t *vChg,
uint8_t *iChg, uint8_t *chargeControl);
#line 672
static result_t PMICM$PMIC$enableCharging(bool enable);
#line 716
static inline result_t PMICM$batteryMonitorTimer$fired(void);
#line 733
static inline result_t PMICM$chargeMonitorTimer$fired(void);
#line 751
static inline BluSH_result_t PMICM$BatteryVoltage$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$BatteryVoltage$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static inline BluSH_result_t PMICM$ChargingStatus$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$ChargingStatus$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static inline BluSH_result_t PMICM$ManualCharging$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$ManualCharging$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static inline BluSH_result_t PMICM$ReadPMIC$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$ReadPMIC$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 821
static inline BluSH_result_t PMICM$WritePMIC$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$WritePMIC$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 843
static inline BluSH_result_t PMICM$SetCoreVoltage$getName(char *buff, uint8_t len);
static inline BluSH_result_t PMICM$SetCoreVoltage$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
# 53 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdogM.nc"
bool PXA27XWatchdogM$resetMoteRequest;
static inline void PXA27XWatchdogM$PXA27XWatchdog$init(void);
static inline void PXA27XWatchdogM$PXA27XWatchdog$enableWDT(uint32_t interval);
static inline void PXA27XWatchdogM$PXA27XWatchdog$feedWDT(uint32_t interval);
static inline void PXA27XWatchdogM$Reset$reset(void);
# 51 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$init(void);
#line 63
static inline result_t NoLeds$Leds$redToggle(void);
#line 75
static inline result_t NoLeds$Leds$greenToggle(void);
#line 87
static inline result_t NoLeds$Leds$yellowToggle(void);
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static void TimerM$Clock$setInterval(uint32_t arg_0x408ca068);
#line 153
static uint32_t TimerM$Clock$readCounter(void);
#line 96
static result_t TimerM$Clock$setRate(uint32_t arg_0x408c5460, uint32_t arg_0x408c55f0);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimerM$Timer$fired(
# 50 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
uint8_t arg_0x408cf2b8);
uint32_t TimerM$mState;
uint32_t TimerM$mCurrentInterval;
int8_t TimerM$queue_head;
int8_t TimerM$queue_tail;
uint8_t TimerM$queue_size;
uint8_t TimerM$queue[NUM_TIMERS];
#line 69
struct TimerM$timer_s {
uint8_t type;
int32_t ticks;
int32_t ticksLeft;
} TimerM$mTimerList[NUM_TIMERS];
static result_t TimerM$StdControl$init(void);
static inline result_t TimerM$StdControl$start(void);
#line 98
static result_t TimerM$Timer$start(uint8_t id, char type,
uint32_t interval);
#line 171
static result_t TimerM$Timer$stop(uint8_t id);
#line 192
static inline result_t TimerM$Timer$default$fired(uint8_t id);
static inline void TimerM$enqueue(uint8_t value);
static inline uint8_t TimerM$dequeue(void);
#line 219
static inline void TimerM$signalOneTimer(void);
static inline result_t TimerM$Clock$fire(void);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void PXA27XClockM$OSTIrq$enable(void);
#line 45
static result_t PXA27XClockM$OSTIrq$allocate(void);
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static result_t PXA27XClockM$Clock$fire(void);
# 81 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
uint8_t PXA27XClockM$gmInterval;
static inline void PXA27XClockM$OSTIrq$fired(void);
#line 109
static inline result_t PXA27XClockM$StdControl$init(void);
#line 124
static inline result_t PXA27XClockM$StdControl$start(void);
#line 167
static inline result_t PXA27XClockM$Clock$setRate(uint32_t interval, uint32_t scale);
#line 208
static void PXA27XClockM$Clock$setInterval(uint32_t value);
#line 245
static inline uint32_t PXA27XClockM$Clock$readCounter(void);
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPowerManagementM.nc"
static inline uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SettingsM$StackCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 56 "/opt/tinyos-1.x/tos/platform/pxa27x/Sleep.nc"
static result_t SettingsM$Sleep$goToDeepSleep(uint32_t arg_0x4090f8e0);
# 46 "/opt/tinyos-1.x/tos/interfaces/Reset.nc"
static void SettingsM$Reset$reset(void);
# 83 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
uint32_t SettingsM$ResetCause;
static inline result_t SettingsM$StdControl$init(void);
static inline result_t SettingsM$StdControl$start(void);
#line 119
static inline void SettingsM$testQueue(void);
static inline void SettingsM$doReset(void);
static inline BluSH_result_t SettingsM$NodeID$getName(char *buff, uint8_t len);
static inline BluSH_result_t SettingsM$NodeID$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static inline BluSH_result_t SettingsM$TestTaskQueue$getName(char *buff, uint8_t len);
static inline BluSH_result_t SettingsM$TestTaskQueue$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 202
static inline BluSH_result_t SettingsM$GoToSleep$getName(char *buff, uint8_t len);
static inline BluSH_result_t SettingsM$GoToSleep$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 222
static inline BluSH_result_t SettingsM$ResetNode$getName(char *buff, uint8_t len);
static inline BluSH_result_t SettingsM$ResetNode$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
static inline BluSH_result_t SettingsM$GetResetCause$getName(char *buff, uint8_t len);
static inline BluSH_result_t SettingsM$GetResetCause$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen);
#line 260
static inline result_t SettingsM$StackCheckTimer$fired(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420ControlM$SplitControl$initDone(void);
#line 85
static result_t CC2420ControlM$SplitControl$startDone(void);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t CC2420ControlM$HPLChipcon$read(uint8_t arg_0x40956010);
#line 54
static uint8_t CC2420ControlM$HPLChipcon$write(uint8_t arg_0x40957918, uint16_t arg_0x40957aa8);
#line 47
static uint8_t CC2420ControlM$HPLChipcon$cmd(uint8_t arg_0x40957408);
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420ControlM$CCA$startWait(bool arg_0x40959bc8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420ControlM$HPLChipconControl$init(void);
static result_t CC2420ControlM$HPLChipconControl$start(void);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t CC2420ControlM$HPLChipconRAM$write(uint16_t arg_0x40955710, uint8_t arg_0x40955898, uint8_t *arg_0x40955a40);
# 63 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
enum CC2420ControlM$__nesc_unnamed4310 {
CC2420ControlM$IDLE_STATE = 0,
CC2420ControlM$INIT_STATE,
CC2420ControlM$INIT_STATE_DONE,
CC2420ControlM$START_STATE,
CC2420ControlM$START_STATE_DONE,
CC2420ControlM$STOP_STATE
};
uint8_t CC2420ControlM$state = 0;
uint16_t CC2420ControlM$gCurrentParameters[14];
static inline bool CC2420ControlM$SetRegs(void);
#line 108
static inline void CC2420ControlM$taskInitDone(void);
static inline void CC2420ControlM$PostOscillatorOn(void);
#line 129
static inline result_t CC2420ControlM$SplitControl$init(void);
#line 227
static inline result_t CC2420ControlM$SplitControl$start(void);
#line 264
static result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t chnl);
#line 286
static inline result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t DesiredFreq);
#line 310
static inline uint8_t CC2420ControlM$CC2420Control$GetPreset(void);
#line 343
static inline result_t CC2420ControlM$CC2420Control$RxMode(void);
static inline result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t power);
static inline uint8_t CC2420ControlM$CC2420Control$GetRFPower(void);
static inline result_t CC2420ControlM$CC2420Control$OscillatorOn(void);
#line 400
static inline result_t CC2420ControlM$CC2420Control$VREFOn(void);
#line 412
static inline result_t CC2420ControlM$CC2420Control$enableAutoAck(void);
static inline result_t CC2420ControlM$CC2420Control$enableAddrDecode(void);
static inline result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t addr);
static inline result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t addr, uint8_t length, uint8_t *buffer);
static inline result_t CC2420ControlM$CCA$fired(void);
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XPowerModesM.nc"
static inline void PXA27XPowerModesM$DisablePeripherals(void);
#line 90
static inline void PXA27XPowerModesM$EnterDeepSleep(void);
#line 141
static inline void PXA27XPowerModesM$PXA27XPowerModes$SwitchMode(uint8_t targetMode);
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XPowerModes.nc"
static void SleepM$PXA27XPowerModes$SwitchMode(uint8_t arg_0x40997ab8);
# 52 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
static result_t SleepM$PMIC$shutDownLDOs(void);
# 54 "/opt/tinyos-1.x/tos/platform/pxa27x/SleepM.nc"
static inline result_t SleepM$Sleep$goToDeepSleep(uint32_t sleepTime);
# 28 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
static void *SmartSensingM$DataMgmt$allocBlk(uint8_t arg_0x40abb7b8);
static result_t SmartSensingM$DataMgmt$saveBlk(void *arg_0x40aba140, uint8_t arg_0x40aba2d0);
# 90 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static uint8_t SmartSensingM$writeNbrLinkInfo(uint8_t *arg_0x40adacb0, uint8_t arg_0x40adae38);
# 39 "/home/xu/oasis/interfaces/RealTime.nc"
static uint32_t SmartSensingM$RealTime$getTimeCount(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t SmartSensingM$LocalTime$read(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t SmartSensingM$Random$rand(void);
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
static result_t SmartSensingM$ADCControl$bindPort(uint8_t arg_0x40aa4340, uint8_t arg_0x40aa44c8);
#line 50
static result_t SmartSensingM$ADCControl$init(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$SensingTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t SmartSensingM$SensingTimer$stop(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t SmartSensingM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SmartSensingM$SubControl$init(void);
static result_t SmartSensingM$SubControl$start(void);
#line 63
static result_t SmartSensingM$TimerControl$init(void);
static result_t SmartSensingM$TimerControl$start(void);
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t SmartSensingM$Leds$yellowToggle(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$initTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t SmartSensingM$initTimer$stop(void);
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t SmartSensingM$ADC$getData(
# 65 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint8_t arg_0x40aa9310);
# 29 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
static result_t SmartSensingM$FlashManager$init(void);
static result_t SmartSensingM$FlashManager$write(uint32_t arg_0x40ab7c08, void *arg_0x40ab7da8, uint16_t arg_0x40adc010);
# 84 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
static uint16_t SmartSensingM$RouteControl$getQuality(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SmartSensingM$WatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t SmartSensingM$WatchTimer$stop(void);
# 96 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
uint16_t SmartSensingM$timerInterval;
uint16_t SmartSensingM$defaultCode;
bool SmartSensingM$initedClock;
uint16_t SmartSensingM$LQIFactor;
bool SmartSensingM$realTimeFired;
uint8_t SmartSensingM$global = 0;
SenBlkPtr SmartSensingM$sensingCurBlk;
static inline void SmartSensingM$initDefault(void);
static inline void SmartSensingM$trySample(void);
static void SmartSensingM$saveData(uint8_t type, uint16_t data);
static uint16_t SmartSensingM$calFireInterval(void);
static void SmartSensingM$updateMaxBlkNum(void);
static void SmartSensingM$setrate(void);
static void SmartSensingM$upFlashClient(void);
static inline result_t SmartSensingM$oversample(uint16_t *data, uint8_t client);
static inline void SmartSensingM$initDefault(void);
#line 247
static inline void SmartSensingM$eraseFlash(void);
static inline result_t SmartSensingM$initTimer$fired(void);
#line 276
static inline result_t SmartSensingM$StdControl$init(void);
#line 289
static inline result_t SmartSensingM$StdControl$start(void);
#line 324
static inline uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t type);
#line 346
static inline result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t type, uint16_t rate);
#line 380
static inline uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t type);
#line 400
static inline result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t type, uint8_t channel);
#line 440
static inline uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t type);
#line 457
static inline uint8_t SmartSensingM$SensingConfig$getEventPriority(uint8_t type);
#line 475
static inline result_t SmartSensingM$SensingConfig$setEventPriority(uint8_t type, uint8_t priority);
#line 500
static inline result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t type, uint8_t priority);
#line 527
static inline uint8_t SmartSensingM$SensingConfig$getNodePriority(void);
#line 546
static inline result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t priority);
#line 572
static inline uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t type);
#line 584
static inline result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t type, uint16_t code);
#line 610
static inline result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t SmartSensingM$WatchTimer$fired(void);
#line 643
static inline result_t SmartSensingM$SensingTimer$fired(void);
#line 674
static inline result_t SmartSensingM$ADC$dataReady(uint8_t client, uint16_t data);
#line 695
static inline result_t SmartSensingM$GPSSensing$dataReady(uint8_t *data, uint16_t size);
#line 731
static inline result_t SmartSensingM$oversample(uint16_t *data, uint8_t client);
#line 754
static void SmartSensingM$upFlashClient(void);
#line 775
static void SmartSensingM$saveData(uint8_t client, uint16_t data);
#line 840
static void SmartSensingM$setrate(void);
#line 862
static void SmartSensingM$updateMaxBlkNum(void);
#line 888
static __inline uint16_t SmartSensingM$GCD(uint16_t a, uint16_t b);
#line 906
static uint16_t SmartSensingM$calFireInterval(void);
#line 935
static inline bool SmartSensingM$needSample(uint8_t client);
#line 983
static inline void SmartSensingM$trySample(void);
# 50 "/opt/tinyos-1.x/tos/system/LedsC.nc"
uint8_t LedsC$ledsOn;
enum LedsC$__nesc_unnamed4311 {
LedsC$RED_BIT = 1,
LedsC$GREEN_BIT = 2,
LedsC$YELLOW_BIT = 4
};
#line 72
static result_t LedsC$Leds$redOn(void);
static inline result_t LedsC$Leds$redOff(void);
static result_t LedsC$Leds$redToggle(void);
static inline result_t LedsC$Leds$greenOn(void);
static inline result_t LedsC$Leds$greenOff(void);
static result_t LedsC$Leds$greenToggle(void);
static inline result_t LedsC$Leds$yellowOn(void);
static inline result_t LedsC$Leds$yellowOff(void);
static result_t LedsC$Leds$yellowToggle(void);
# 54 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
uint16_t RandomLFSR$shiftReg;
uint16_t RandomLFSR$initSeed;
uint16_t RandomLFSR$mask;
static inline result_t RandomLFSR$Random$init(void);
static uint16_t RandomLFSR$Random$rand(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$WatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 43 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
static result_t RealTimeM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b6cdd8);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t RealTimeM$ClockControl$init(void);
static result_t RealTimeM$ClockControl$start(void);
# 6 "/home/xu/oasis/interfaces/GPSGlobalTime.nc"
static uint32_t RealTimeM$GPSGlobalTime$getGlobalTime(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t RealTimeM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static void RealTimeM$Clock$setInterval(uint32_t arg_0x408ca068);
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t RealTimeM$Timer$fired(
# 31 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
uint8_t arg_0x40b740d0);
#line 51
SyncUser_t RealTimeM$clientList[MAX_NUM_CLIENT];
uint32_t RealTimeM$mState;
uint32_t RealTimeM$localTime;
uint32_t RealTimeM$uc_fire_point;
uint32_t RealTimeM$uc_fire_interval;
int32_t RealTimeM$adjustInterval;
uint32_t RealTimeM$adjustCounter;
int8_t RealTimeM$queue_head;
int8_t RealTimeM$queue_tail;
uint8_t RealTimeM$queue_size;
uint8_t RealTimeM$queue[30];
uint8_t RealTimeM$syncMode;
bool RealTimeM$taskBusy;
bool RealTimeM$is_synced;
uint32_t RealTimeM$localTime_t;
bool RealTimeM$init_sync;
bool RealTimeM$timerBusy;
uint32_t RealTimeM$timerCount;
uint32_t RealTimeM$globaltime_t;
uint32_t RealTimeM$globaltime_tHist;
bool RealTimeM$realTimeFired;
static void RealTimeM$signalOneTimer(void);
static inline void RealTimeM$updateTimer(void);
static inline void RealTimeM$enqueue(uint8_t value);
static inline uint8_t RealTimeM$dequeue(void);
static inline result_t RealTimeM$StdControl$init(void);
#line 120
static inline result_t RealTimeM$StdControl$start(void);
#line 182
static uint32_t RealTimeM$RealTime$getTimeCount(void);
#line 251
static inline bool RealTimeM$RealTime$isSync(void);
static inline result_t RealTimeM$RealTime$changeMode(uint8_t modeValue);
#line 276
static inline uint8_t RealTimeM$RealTime$getMode(void);
static result_t RealTimeM$RealTime$setTimeCount(uint32_t newCount, uint8_t userMode);
#line 392
static result_t RealTimeM$Timer$start(uint8_t id, char type, uint32_t interval);
#line 415
static result_t RealTimeM$Timer$stop(uint8_t id);
#line 429
static inline void RealTimeM$enqueue(uint8_t value);
#line 441
static inline uint8_t RealTimeM$dequeue(void);
#line 457
static inline result_t RealTimeM$WatchTimer$fired(void);
#line 475
static void RealTimeM$signalOneTimer(void);
#line 489
static inline void RealTimeM$updateTimer(void);
#line 613
static uint32_t RealTimeM$LocalTime$read(void);
#line 634
static inline result_t RealTimeM$Clock$fire(void);
#line 653
static inline result_t RealTimeM$Timer$default$fired(uint8_t id);
#line 666
static inline result_t RealTimeM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void RTCClockM$OSTIrq$enable(void);
#line 45
static result_t RTCClockM$OSTIrq$allocate(void);
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
static result_t RTCClockM$MicroClock$fire(void);
# 28 "/home/xu/oasis/system/platform/imote2/RTC/RTCClockM.nc"
uint8_t RTCClockM$gmInterval;
static inline void RTCClockM$OSTIrq$fired(void);
static inline result_t RTCClockM$StdControl$init(void);
static result_t RTCClockM$StdControl$start(void);
#line 77
static void RTCClockM$MicroClock$setInterval(uint32_t value);
# 40 "/home/xu/oasis/interfaces/RealTime.nc"
static result_t GPSSensorM$RealTime$setTimeCount(uint32_t arg_0x40abf6d8, uint8_t arg_0x40abf860);
static result_t GPSSensorM$RealTime$changeMode(uint8_t arg_0x40abd648);
static uint8_t GPSSensorM$RealTime$getMode(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t GPSSensorM$LocalTime$read(void);
# 46 "/home/xu/oasis/interfaces/GenericSensing.nc"
static result_t GPSSensorM$GenericSensing$dataReady(uint8_t *arg_0x40ac8268, uint16_t arg_0x40ac83f8);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t GPSSensorM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GPSSensorM$GPSSerialControl$init(void);
static result_t GPSSensorM$GPSSerialControl$start(void);
#line 63
static result_t GPSSensorM$GPIOControl$init(void);
static result_t GPSSensorM$GPIOControl$start(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GPSSensorM$CheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void GPSSensorM$GPSInterrupt$clear(void);
#line 45
static void GPSSensorM$GPSInterrupt$enable(uint8_t arg_0x406321d8);
# 57 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
uint32_t GPSSensorM$pps_arrive_point[SYNC_INTERVAL];
uint32_t GPSSensorM$timeCount;
uint32_t GPSSensorM$gLocalTime;
uint16_t GPSSensorM$dataCount;
uint16_t GPSSensorM$rawCount;
uint16_t GPSSensorM$raw_payload_length;
uint8_t *GPSSensorM$RAWData;
uint8_t *GPSSensorM$NMEAData;
uint8_t GPSSensorM$AllData[RAW_SIZE + NMEA_SIZE];
uint8_t GPSSensorM$ppsIndex;
uint8_t GPSSensorM$last_pps_index;
bool GPSSensorM$samplingReady;
bool GPSSensorM$samplingStart;
bool GPSSensorM$initialized = FALSE;
bool GPSSensorM$started = FALSE;
bool GPSSensorM$checkTimerOn;
bool GPSSensorM$alreadySetTime;
bool GPSSensorM$hasGPS;
float GPSSensorM$skew;
uint32_t GPSSensorM$localAverage;
int32_t GPSSensorM$offsetAverage;
TimeTable GPSSensorM$table[MAX_ENTRIES];
uint16_t GPSSensorM$tableEntries;
uint16_t GPSSensorM$numEntries;
uint16_t GPSSensorM$adjustTime;
static inline void GPSSensorM$gpsTask(void);
static void GPSSensorM$selfCheckTask(void);
static void GPSSensorM$clearTable(void);
static inline void GPSSensorM$initialize(void);
#line 143
static inline result_t GPSSensorM$StdControl$init(void);
static inline result_t GPSSensorM$StdControl$start(void);
#line 170
static uint32_t GPSSensorM$GPSGlobalTime$getGlobalTime(void);
static inline uint32_t GPSSensorM$GPSGlobalTime$getLocalTime(void);
static uint32_t GPSSensorM$GPSGlobalTime$local2Global(uint32_t time);
#line 221
static inline void GPSSensorM$gpsTask(void);
static inline void GPSSensorM$GPSUartStream$sendDone(uint8_t *buf,
uint16_t len, result_t error);
#line 245
static inline void GPSSensorM$GPSUartStream$receivedByte(uint8_t data);
#line 404
static inline void GPSSensorM$GPSUartStream$receiveDone(uint8_t *buf,
uint16_t len, result_t error);
static inline uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$sendDone(uint8_t *buf,
uint16_t len,
uart_status_t status);
static inline uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$receiveDone(uint8_t *buf,
uint16_t len,
uart_status_t status);
#line 476
static inline void GPSSensorM$debugDevTask(void);
#line 540
static void GPSSensorM$clearTable(void);
static inline void GPSSensorM$addNewEntry(void);
#line 623
static inline void GPSSensorM$changeModeTask(void);
#line 639
static void GPSSensorM$selfCheckTask(void);
static inline result_t GPSSensorM$CheckTimer$fired(void);
#line 680
static inline void GPSSensorM$GPSInterrupt$fired(void);
#line 751
static inline result_t GPSSensorM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
# 89 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialPacket.nc"
static uint8_t *HalPXA27xBTUARTP$HalPXA27xSerialPacket$receiveDone(uint8_t *arg_0x40bf31a8, uint16_t arg_0x40bf3338, uart_status_t arg_0x40bf34c8);
#line 62
static uint8_t *HalPXA27xBTUARTP$HalPXA27xSerialPacket$sendDone(uint8_t *arg_0x40bcce68, uint16_t arg_0x40bcb010, uart_status_t arg_0x40bcb1a0);
# 44 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
static void HalPXA27xBTUARTP$UART$setDLL(uint32_t arg_0x40c21928);
#line 60
static void HalPXA27xBTUARTP$UART$setMCR(uint32_t arg_0x40c49068);
#line 53
static uint32_t HalPXA27xBTUARTP$UART$getIIR(void);
#line 47
static void HalPXA27xBTUARTP$UART$setDLH(uint32_t arg_0x40c20100);
#line 42
static void HalPXA27xBTUARTP$UART$setTHR(uint32_t arg_0x40c21480);
#line 63
static uint32_t HalPXA27xBTUARTP$UART$getLSR(void);
#line 55
static void HalPXA27xBTUARTP$UART$setFCR(uint32_t arg_0x40c4a3d0);
#line 51
static uint32_t HalPXA27xBTUARTP$UART$getIER(void);
#line 41
static uint32_t HalPXA27xBTUARTP$UART$getRBR(void);
#line 57
static void HalPXA27xBTUARTP$UART$setLCR(uint32_t arg_0x40c4a878);
#line 50
static void HalPXA27xBTUARTP$UART$setIER(uint32_t arg_0x40c208c8);
# 79 "/home/xu/oasis/system/platform/imote2/UART/UartStream.nc"
static void HalPXA27xBTUARTP$UartStream$receivedByte(uint8_t arg_0x40bd1c28);
#line 99
static void HalPXA27xBTUARTP$UartStream$receiveDone(uint8_t *arg_0x40bcf920, uint16_t arg_0x40bcfab0, result_t arg_0x40bcfc40);
#line 57
static void HalPXA27xBTUARTP$UartStream$sendDone(uint8_t *arg_0x40bd2b58, uint16_t arg_0x40bd2ce8, result_t arg_0x40bd2e78);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HalPXA27xBTUARTP$ChanControl$init(void);
# 102 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
uint8_t *HalPXA27xBTUARTP$txCurrentBuf;
#line 102
uint8_t *HalPXA27xBTUARTP$rxCurrentBuf;
uint32_t HalPXA27xBTUARTP$txCurrentLen;
#line 104
uint32_t HalPXA27xBTUARTP$rxCurrentLen;
#line 104
uint32_t HalPXA27xBTUARTP$rxCurrentIdx;
uint32_t HalPXA27xBTUARTP$gulFCRShadow;
uint32_t HalPXA27xBTUARTP$defaultRate = 9600;
bool HalPXA27xBTUARTP$gbUsingUartStreamSendIF = FALSE;
bool HalPXA27xBTUARTP$gbUsingUartStreamRcvIF = FALSE;
bool HalPXA27xBTUARTP$gbRcvByteEvtEnabled = TRUE;
static inline result_t HalPXA27xBTUARTP$SerialControl$init(void);
#line 147
static inline result_t HalPXA27xBTUARTP$SerialControl$start(void);
#line 228
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$send(uint8_t *buf, uint16_t len);
#line 287
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$receive(uint8_t *buf, uint16_t len, uint16_t timeout);
#line 339
static inline void HalPXA27xBTUARTP$DispatchStreamRcvSignal(void);
#line 356
static inline void HalPXA27xBTUARTP$DispatchStreamSendSignal(void);
#line 395
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialCntl$configPort(uint32_t baudrate,
uint8_t databits,
uart_parity_t parity,
uint8_t stopbits,
bool flow_cntl);
#line 460
static inline void HalPXA27xBTUARTP$UART$interruptUART(void);
# 81 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
static void HplPXA27xBTUARTP$UART$interruptUART(void);
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void HplPXA27xBTUARTP$UARTIrq$enable(void);
#line 45
static result_t HplPXA27xBTUARTP$UARTIrq$allocate(void);
# 57 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
bool HplPXA27xBTUARTP$m_fInit = FALSE;
uint32_t HplPXA27xBTUARTP$base_addr = 0x40200000;
static inline result_t HplPXA27xBTUARTP$UControl$init(void);
#line 94
static inline uint32_t HplPXA27xBTUARTP$UART$getRBR(void);
static inline void HplPXA27xBTUARTP$UART$setTHR(uint32_t val);
static inline void HplPXA27xBTUARTP$UART$setDLL(uint32_t val);
#line 109
static inline void HplPXA27xBTUARTP$UART$setDLH(uint32_t val);
#line 121
static inline void HplPXA27xBTUARTP$UART$setIER(uint32_t val);
static inline uint32_t HplPXA27xBTUARTP$UART$getIER(void);
static inline uint32_t HplPXA27xBTUARTP$UART$getIIR(void);
static inline void HplPXA27xBTUARTP$UART$setFCR(uint32_t val);
static inline void HplPXA27xBTUARTP$UART$setLCR(uint32_t val);
static inline void HplPXA27xBTUARTP$UART$setMCR(uint32_t val);
static inline uint32_t HplPXA27xBTUARTP$UART$getLSR(void);
#line 141
static inline void HplPXA27xBTUARTP$UARTIrq$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$EReportControl$init(void);
static result_t SNMSM$EReportControl$start(void);
#line 63
static result_t SNMSM$WDTControl$init(void);
static result_t SNMSM$WDTControl$start(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/WDT.nc"
static void SNMSM$WWDT$reset(void);
#line 45
static result_t SNMSM$WWDT$start(int32_t arg_0x40cb0b70);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t SNMSM$Leds$greenToggle(void);
#line 131
static result_t SNMSM$Leds$yellowToggle(void);
#line 81
static result_t SNMSM$Leds$redToggle(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t SNMSM$SNMSTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t SNMSM$SNMSTimer$stop(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t SNMSM$RPCControl$init(void);
static result_t SNMSM$RPCControl$start(void);
# 96 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
uint16_t SNMSM$rstdelayCount;
bool SNMSM$toBeRestart;
static inline result_t SNMSM$StdControl$init(void);
#line 122
static inline result_t SNMSM$StdControl$start(void);
#line 169
static inline result_t SNMSM$ledsOn(uint8_t ledColorParam);
#line 187
static inline result_t SNMSM$SNMSTimer$fired(void);
#line 280
static inline void SNMSM$restart(void);
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static result_t EventReportM$EventReport$eventSendDone(
# 56 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
uint8_t arg_0x40d0b508,
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t EventReportM$EventSend$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
#line 106
static void *EventReportM$EventSend$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38);
# 86 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
bool EventReportM$gfSendBusy;
bool EventReportM$taskBusy;
uint8_t EventReportM$gLevelMode[6];
uint8_t EventReportM$seqno;
Queue_t EventReportM$sendQueue;
Queue_t EventReportM$buffQueue;
TOS_Msg EventReportM$eventBuffer[3];
static inline void EventReportM$initialize(void);
static void EventReportM$tryNextSend(void);
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level);
static inline void EventReportM$sendEvent(void);
static inline void EventReportM$initialize(void);
#line 145
static inline result_t EventReportM$StdControl$init(void);
static inline result_t EventReportM$StdControl$start(void);
static inline result_t EventReportM$EventConfig$setReportLevel(uint8_t type, uint8_t level);
#line 175
static inline uint8_t EventReportM$EventConfig$getReportLevel(uint8_t type);
#line 187
static uint8_t EventReportM$EventReport$eventSend(uint8_t eventType, uint8_t type,
uint8_t level,
uint8_t *content);
#line 244
static inline result_t EventReportM$EventReport$default$eventSendDone(uint8_t eventType, TOS_MsgPtr pMsg, result_t success);
#line 263
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr pMsg, result_t success);
#line 298
static void EventReportM$tryNextSend(void);
#line 312
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level);
static inline void EventReportM$sendEvent(void);
# 42 "build/imote2/RpcM.nc"
static void RpcM$SNMSM_restart(void);
#line 39
static ramSymbol_t RpcM$RamSymbolsM_peek(unsigned int arg_0x40d33b48, uint8_t arg_0x40d33cd0, bool arg_0x40d33e60);
# 2 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setSink(bool arg_0x40d34010);
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent(void);
#line 3
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setParent(uint16_t arg_0x40d344b8);
static uint16_t RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval(void);
#line 5
static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x40d34c68);
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
static result_t RpcM$SmartSensingM_SensingConfig$setDataPriority(uint8_t arg_0x4099f010, uint8_t arg_0x4099f1a0);
static uint8_t RpcM$SmartSensingM_SensingConfig$getDataPriority(uint8_t arg_0x4099f638);
#line 31
static result_t RpcM$SmartSensingM_SensingConfig$setADCChannel(uint8_t arg_0x409a04c8, uint8_t arg_0x409a0650);
#line 49
static uint8_t RpcM$SmartSensingM_SensingConfig$getEventPriority(uint8_t arg_0x409be4b0);
#line 27
static result_t RpcM$SmartSensingM_SensingConfig$setSamplingRate(uint8_t arg_0x409a19e0, uint16_t arg_0x409a1b78);
static uint8_t RpcM$SmartSensingM_SensingConfig$getADCChannel(uint8_t arg_0x409a0ae8);
#line 29
static uint16_t RpcM$SmartSensingM_SensingConfig$getSamplingRate(uint8_t arg_0x409a0030);
#line 47
static result_t RpcM$SmartSensingM_SensingConfig$setEventPriority(uint8_t arg_0x409bfe20, uint8_t arg_0x409be010);
#line 43
static result_t RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(uint8_t arg_0x409bf348, uint16_t arg_0x409bf4d8);
#line 39
static result_t RpcM$SmartSensingM_SensingConfig$setNodePriority(uint8_t arg_0x4099fad8);
static uint16_t RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(uint8_t arg_0x409bf980);
#line 41
static uint8_t RpcM$SmartSensingM_SensingConfig$getNodePriority(void);
# 40 "build/imote2/RpcM.nc"
static unsigned int RpcM$RamSymbolsM_poke(ramSymbol_t *arg_0x40d36380);
#line 34
static uint8_t RpcM$GenericCommProM_getRFChannel(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t RpcM$ResponseSend$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
#line 106
static void *RpcM$ResponseSend$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38);
# 36 "build/imote2/RpcM.nc"
static result_t RpcM$GenericCommProM_setRFChannel(uint8_t arg_0x40d3d970);
static result_t RpcM$SNMSM_ledsOn(uint8_t arg_0x40d36820);
static void RpcM$SmartSensingM_eraseFlash(void);
#line 35
static uint8_t RpcM$GenericCommProM_getRFPower(void);
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
static uint8_t RpcM$EventReportM_EventConfig$getReportLevel(uint8_t arg_0x40cae5d0);
#line 38
static result_t RpcM$EventReportM_EventConfig$setReportLevel(uint8_t arg_0x40cb1e50, uint8_t arg_0x40cae010);
# 37 "build/imote2/RpcM.nc"
static result_t RpcM$GenericCommProM_setRFPower(uint8_t arg_0x40d3de18);
#line 50
TOS_Msg RpcM$cmdStore;
TOS_Msg RpcM$sendMsgBuf;
TOS_MsgPtr RpcM$sendMsgPtr;
uint16_t RpcM$cmdStoreLength;
bool RpcM$processingCommand;
bool RpcM$taskBusy;
uint8_t RpcM$seqno;
uint16_t RpcM$debugSequenceNo;
static const uint8_t RpcM$args_sizes[28] = {
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
0,
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
0,
0,
sizeof(uint16_t ),
sizeof(uint16_t ),
sizeof(bool ),
sizeof(unsigned int ) + sizeof(uint8_t ) + sizeof(bool ),
sizeof(ramSymbol_t ),
sizeof(uint8_t ),
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
0,
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ) + sizeof(uint16_t ),
sizeof(uint8_t ) + sizeof(uint16_t ),
0 };
static const uint8_t RpcM$return_sizes[28] = {
sizeof(uint8_t ),
sizeof(result_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(uint16_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(ramSymbol_t ),
sizeof(unsigned int ),
sizeof(result_t ),
sizeof(void ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint8_t ),
sizeof(uint16_t ),
sizeof(uint16_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(result_t ),
sizeof(void ) };
static inline result_t RpcM$StdControl$init(void);
#line 142
static inline result_t RpcM$StdControl$start(void);
static void RpcM$tryNextSend(void);
static inline void RpcM$sendResponse(void);
static inline void RpcM$processCommand(void);
#line 647
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr pMsg, void *payload, uint16_t payloadLength);
#line 743
static void RpcM$tryNextSend(void);
static inline void RpcM$sendResponse(void);
#line 795
static inline result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr pMsg, result_t success);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr GenericCommProM$ReceiveMsg$receive(
# 71 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40d923e0,
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
TOS_MsgPtr arg_0x40620878);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$ActivityTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t GenericCommProM$Intercept$intercept(TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$UARTSend$send(TOS_MsgPtr arg_0x40615d50);
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
static uint8_t GenericCommProM$PowerManagement$adjustPower(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t GenericCommProM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$RadioControl$init(void);
static result_t GenericCommProM$RadioControl$start(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
static void GenericCommProM$MacControl$enableAck(void);
# 111 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static void GenericCommProM$restart(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t GenericCommProM$TimerControl$init(void);
static result_t GenericCommProM$TimerControl$start(void);
#line 63
static result_t GenericCommProM$UARTControl$init(void);
static result_t GenericCommProM$UARTControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t GenericCommProM$Leds$greenToggle(void);
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t GenericCommProM$RadioSend$send(TOS_MsgPtr arg_0x40615d50);
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t GenericCommProM$SendMsg$sendDone(
# 70 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
uint8_t arg_0x40d90c78,
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0);
# 33 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
static result_t GenericCommProM$FlashManager$write(uint32_t arg_0x40ab7c08, void *arg_0x40ab7da8, uint16_t arg_0x40adc010);
# 185 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static uint8_t GenericCommProM$CC2420Control$GetRFPower(void);
#line 178
static result_t GenericCommProM$CC2420Control$SetRFPower(uint8_t arg_0x4095df20);
#line 84
static result_t GenericCommProM$CC2420Control$TunePreset(uint8_t arg_0x40940010);
#line 106
static uint8_t GenericCommProM$CC2420Control$GetPreset(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t GenericCommProM$MonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 120 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
bool GenericCommProM$sendTaskBusy;
bool GenericCommProM$recvTaskBusy;
#line 123
typedef struct GenericCommProM$backupHeader {
uint8_t valid;
uint8_t length;
uint8_t type;
uint8_t group;
TOS_MsgPtr msgPtr;
address_t addr;
} GenericCommProM$backupHeader;
Queue_t GenericCommProM$sendQueue;
GenericCommProM$backupHeader GenericCommProM$bkHeader[COMM_SEND_QUEUE_SIZE];
TOS_Msg GenericCommProM$swapBuf;
TOS_MsgPtr GenericCommProM$swapMsgPtr;
bool GenericCommProM$state;
bool GenericCommProM$radioRecvActive;
bool GenericCommProM$radioSendActive;
uint8_t GenericCommProM$wdtTimerCnt;
uint16_t GenericCommProM$lastCount;
uint16_t GenericCommProM$counter;
uint8_t GenericCommProM$UARTOrRadio;
bool GenericCommProM$toSend;
static inline void GenericCommProM$sendTask(void);
static result_t GenericCommProM$tryNextSend(void);
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg);
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len);
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success);
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg);
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void);
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg);
static result_t GenericCommProM$freeBkHeader(uint8_t ind);
static inline bool GenericCommProM$Control$init(void);
#line 251
static inline bool GenericCommProM$Control$start(void);
#line 296
static result_t GenericCommProM$SendMsg$send(uint8_t id, uint16_t addr, uint8_t len, TOS_MsgPtr msg);
#line 333
static inline result_t GenericCommProM$ActivityTimer$fired(void);
static inline result_t GenericCommProM$MonitorTimer$fired(void);
#line 361
static inline result_t GenericCommProM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t GenericCommProM$SendMsg$default$sendDone(uint8_t id, TOS_MsgPtr msg, result_t success);
static inline result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr msg, result_t success);
static inline TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(uint8_t id, TOS_MsgPtr msg);
static inline TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr packet);
static inline result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr msg, result_t status);
static inline TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr msg);
static inline void GenericCommProM$sendFunc(void);
#line 463
static inline void GenericCommProM$sendTask(void);
#line 504
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg);
static result_t GenericCommProM$tryNextSend(void);
#line 536
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len);
#line 576
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success);
#line 650
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg);
#line 698
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void);
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg);
#line 722
static result_t GenericCommProM$freeBkHeader(uint8_t ind);
#line 737
static inline result_t GenericCommProM$initRFChannel(uint8_t channel);
static inline result_t GenericCommProM$setRFChannel(uint8_t channel);
static inline result_t GenericCommProM$setRFPower(uint8_t level);
static inline uint8_t GenericCommProM$getRFChannel(void);
static inline uint8_t GenericCommProM$getRFPower(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopLQI$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t MultiHopLQI$Random$rand(void);
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopLQI$MultihopCtrl$readyToSend(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t MultiHopLQI$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
static bool MultiHopLQI$NeighborCtrl$addChild(uint16_t arg_0x40e1ddf0, uint16_t arg_0x40e1c010, bool arg_0x40e1c1a0);
static bool MultiHopLQI$NeighborCtrl$setCost(uint16_t arg_0x40e1bc70, uint16_t arg_0x40e1be00);
#line 4
static bool MultiHopLQI$NeighborCtrl$changeParent(uint16_t *arg_0x40e1fc48, uint16_t *arg_0x40e1fdf8, uint16_t *arg_0x40e1d010);
static bool MultiHopLQI$NeighborCtrl$setParent(uint16_t arg_0x40e1d4c0);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopLQI$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
# 91 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
enum MultiHopLQI$__nesc_unnamed4312 {
MultiHopLQI$TOS_BASE_ADDRESS = 0,
MultiHopLQI$BASE_STATION_ADDRESS = 0,
MultiHopLQI$BEACON_PERIOD = 10,
MultiHopLQI$BEACON_TIMEOUT = 6
};
enum MultiHopLQI$__nesc_unnamed4313 {
MultiHopLQI$ROUTE_INVALID = 0xff
};
TOS_Msg MultiHopLQI$msgBuf;
bool MultiHopLQI$msgBufBusy;
bool MultiHopLQI$fixedParent = FALSE;
bool MultiHopLQI$receivedBeacon = FALSE;
uint16_t MultiHopLQI$gbCurrentParent;
uint16_t MultiHopLQI$gbCurrentParentCost;
uint16_t MultiHopLQI$gbCurrentLinkEst;
uint8_t MultiHopLQI$gbCurrentHopCount;
uint16_t MultiHopLQI$gbCurrentCost;
uint8_t MultiHopLQI$gLastHeard;
int16_t MultiHopLQI$gCurrentSeqNo;
uint16_t MultiHopLQI$gUpdateInterval;
uint8_t MultiHopLQI$gRecentIndex;
uint16_t MultiHopLQI$gRecentPacketSender[45];
int16_t MultiHopLQI$gRecentPacketSeqNo[45];
uint8_t MultiHopLQI$gRecentOriginIndex;
uint16_t MultiHopLQI$gRecentOriginPacketSender[45];
int16_t MultiHopLQI$gRecentOriginPacketSeqNo[45];
uint8_t MultiHopLQI$gRecentOriginPacketTTL[45];
bool MultiHopLQI$localBeSink;
uint16_t MultiHopLQI$gbLinkQuality;
static uint16_t MultiHopLQI$adjustLQI(uint8_t val);
static void MultiHopLQI$SendRouteTask(void);
#line 190
static inline void MultiHopLQI$TimerTask(void);
#line 225
static inline result_t MultiHopLQI$StdControl$init(void);
#line 270
static inline result_t MultiHopLQI$StdControl$start(void);
#line 286
static inline result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr Msg, uint8_t id,
uint8_t resend);
#line 347
static inline result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr Msg, uint8_t id);
#line 360
static inline uint16_t MultiHopLQI$RouteControl$getParent(void);
static inline uint16_t MultiHopLQI$RouteControl$getQuality(void);
#line 382
static inline result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t Interval);
static inline result_t MultiHopLQI$RouteControl$setParent(uint16_t parentAddr);
static inline result_t MultiHopLQI$RouteControl$releaseParent(void);
#line 426
static inline bool MultiHopLQI$RouteControl$isSink(void);
static inline result_t MultiHopLQI$Timer$fired(void);
#line 441
static inline TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr Msg);
#line 535
static inline result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t MultiHopLQI$MultihopCtrl$switchParent(void);
#line 570
static inline result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect);
static inline result_t MultiHopLQI$RouteRpcCtrl$setSink(bool enable);
#line 614
static inline result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t parentAddr);
static inline result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void);
static inline result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t seconds);
static inline uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void);
# 39 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
ramSymbol_t RamSymbolsM$symbol;
static inline unsigned int RamSymbolsM$poke(ramSymbol_t *p_symbol);
#line 53
static inline ramSymbol_t RamSymbolsM$peek(unsigned int memAddress, uint8_t length, bool dereference);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t WDTM$TimerControl$init(void);
static result_t WDTM$TimerControl$start(void);
# 50 "/opt/tinyos-1.x/tos/system/WDTM.nc"
static void WDTM$reset(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t WDTM$WDTControl$init(void);
static result_t WDTM$WDTControl$start(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t WDTM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 57 "/opt/tinyos-1.x/tos/system/WDTM.nc"
int32_t WDTM$increment;
int32_t WDTM$remaining;
enum WDTM$__nesc_unnamed4314 {
WDTM$WDT_LATENCY = 500
};
static inline result_t WDTM$StdControl$init(void);
static inline result_t WDTM$StdControl$start(void);
#line 87
static inline result_t WDTM$Timer$fired(void);
#line 99
static inline result_t WDTM$WDT$start(int32_t interval);
static inline void WDTM$WDT$reset(void);
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdog.nc"
static void HPLWatchdogM$PXA27XWatchdog$init(void);
#line 70
static void HPLWatchdogM$PXA27XWatchdog$feedWDT(uint32_t arg_0x408a78a8);
#line 61
static void HPLWatchdogM$PXA27XWatchdog$enableWDT(uint32_t arg_0x408a7340);
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLWatchdogM.nc"
static inline result_t HPLWatchdogM$StdControl$init(void);
static inline result_t HPLWatchdogM$StdControl$start(void);
static inline void HPLWatchdogM$reset(void);
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
static bool TimeSyncM$RealTime$isSync(void);
#line 40
static result_t TimeSyncM$RealTime$setTimeCount(uint32_t arg_0x40abf6d8, uint8_t arg_0x40abf860);
static uint8_t TimeSyncM$RealTime$getMode(void);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t TimeSyncM$LocalTime$read(void);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t TimeSyncM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 6 "/home/xu/oasis/interfaces/GPSGlobalTime.nc"
static uint32_t TimeSyncM$GPSGlobalTime$getGlobalTime(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t TimeSyncM$Leds$greenToggle(void);
#line 131
static result_t TimeSyncM$Leds$yellowToggle(void);
#line 81
static result_t TimeSyncM$Leds$redToggle(void);
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
static void TimeSyncM$TimeSyncNotify$msg_received(void);
static void TimeSyncM$TimeSyncNotify$msg_sent(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t TimeSyncM$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
static result_t TimeSyncM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40e93010, uint32_t *arg_0x40e931c8);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t TimeSyncM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 77 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
enum TimeSyncM$__nesc_unnamed4315 {
TimeSyncM$MAX_ENTRIES = 8,
TimeSyncM$BEACON_RATE = 5,
TimeSyncM$ROOT_TIMEOUT = 6,
TimeSyncM$IGNORE_ROOT_MSG = 4,
TimeSyncM$ENTRY_VALID_LIMIT = 4,
TimeSyncM$ENTRY_SEND_LIMIT = 4,
TimeSyncM$ENTRY_THROWOUT_LIMIT = 100
};
#line 151
#line 146
typedef struct TimeSyncM$TableItem {
uint16_t state;
uint32_t localTime;
int32_t timeOffset;
} TimeSyncM$TableItem;
enum TimeSyncM$__nesc_unnamed4316 {
TimeSyncM$ENTRY_EMPTY = 0,
TimeSyncM$ENTRY_FULL = 1
};
enum TimeSyncM$__nesc_unnamed4317 {
TimeSyncM$ERROR_TIMES = 3,
TimeSyncM$GPS_VALID = 3
};
TimeSyncM$TableItem TimeSyncM$table[TimeSyncM$MAX_ENTRIES];
uint16_t TimeSyncM$tableEntries;
enum TimeSyncM$__nesc_unnamed4318 {
TimeSyncM$STATE_IDLE = 0x00,
TimeSyncM$STATE_PROCESSING = 0x01,
TimeSyncM$STATE_SENDING = 0x02,
TimeSyncM$STATE_INIT = 0x04
};
uint16_t TimeSyncM$state;
#line 172
uint16_t TimeSyncM$mode;
uint16_t TimeSyncM$alreadySetTime;
uint16_t TimeSyncM$errTimes;
uint16_t TimeSyncM$hasGPSValid;
#line 187
float TimeSyncM$skew;
uint32_t TimeSyncM$localAverage;
int32_t TimeSyncM$offsetAverage;
uint16_t TimeSyncM$numEntries;
uint16_t TimeSyncM$missedSendStamps;
#line 192
uint16_t TimeSyncM$missedReceiveStamps;
TOS_Msg TimeSyncM$processedMsgBuffer;
TOS_MsgPtr TimeSyncM$processedMsg;
TOS_Msg TimeSyncM$outgoingMsgBuffer;
uint16_t TimeSyncM$heartBeats;
uint16_t TimeSyncM$rootid;
static inline uint32_t TimeSyncM$GlobalTime$getLocalTime(void);
static result_t TimeSyncM$is_synced(void);
static inline result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *time);
#line 231
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *time);
#line 250
static inline void TimeSyncM$calculateConversion(void);
#line 311
static void TimeSyncM$clearTable(void);
static inline void TimeSyncM$addNewEntry(TimeSyncMsg *msg);
#line 438
static inline result_t TimeSyncM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline void TimeSyncM$processMsg(void);
#line 538
static inline TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr p);
#line 600
static void TimeSyncM$adjustRootID(void);
#line 653
static void TimeSyncM$sendMsg(void);
#line 722
static inline result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr ptr, result_t success);
#line 747
static inline void TimeSyncM$timeSyncMsgSend(void);
#line 782
static inline result_t TimeSyncM$Timer$fired(void);
#line 835
static inline result_t TimeSyncM$StdControl$init(void);
#line 868
static inline result_t TimeSyncM$StdControl$start(void);
#line 902
static inline void TimeSyncM$TimeSyncNotify$default$msg_received(void);
static inline void TimeSyncM$TimeSyncNotify$default$msg_sent(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$SplitControl$initDone(void);
#line 85
static result_t CC2420RadioM$SplitControl$startDone(void);
# 59 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t CC2420RadioM$FIFOP$disable(void);
#line 43
static result_t CC2420RadioM$FIFOP$startWait(bool arg_0x40959bc8);
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t CC2420RadioM$BackoffTimerJiffy$setOneShot(uint32_t arg_0x40f16428);
static bool CC2420RadioM$BackoffTimerJiffy$isSet(void);
#line 8
static result_t CC2420RadioM$BackoffTimerJiffy$stop(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t CC2420RadioM$Send$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t CC2420RadioM$Random$rand(void);
#line 57
static result_t CC2420RadioM$Random$init(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CC2420RadioM$TimerControl$init(void);
static result_t CC2420RadioM$TimerControl$start(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr CC2420RadioM$Receive$receive(TOS_MsgPtr arg_0x40620878);
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
static uint16_t CC2420RadioM$HPLChipcon$read(uint8_t arg_0x40956010);
#line 47
static uint8_t CC2420RadioM$HPLChipcon$cmd(uint8_t arg_0x40957408);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void CC2420RadioM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658);
# 60 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t CC2420RadioM$SFD$disable(void);
#line 43
static result_t CC2420RadioM$SFD$enableCapture(bool arg_0x40f1fd70);
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
static void CC2420RadioM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658);
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t CC2420RadioM$HPLChipconFIFO$writeTXFIFO(uint8_t arg_0x40f1dd70, uint8_t *arg_0x40f1df18);
#line 19
static result_t CC2420RadioM$HPLChipconFIFO$readRXFIFO(uint8_t arg_0x40f1d558, uint8_t *arg_0x40f1d700);
# 206 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
static result_t CC2420RadioM$CC2420Control$enableAddrDecode(void);
#line 192
static result_t CC2420RadioM$CC2420Control$enableAutoAck(void);
#line 163
static result_t CC2420RadioM$CC2420Control$RxMode(void);
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
static int16_t CC2420RadioM$MacBackoff$initialBackoff(TOS_MsgPtr arg_0x40f2a8f0);
static int16_t CC2420RadioM$MacBackoff$congestionBackoff(TOS_MsgPtr arg_0x40f2adb0);
# 64 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
static result_t CC2420RadioM$CC2420SplitControl$init(void);
#line 77
static result_t CC2420RadioM$CC2420SplitControl$start(void);
# 76 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
enum CC2420RadioM$__nesc_unnamed4319 {
CC2420RadioM$DISABLED_STATE = 0,
CC2420RadioM$DISABLED_STATE_STARTTASK,
CC2420RadioM$IDLE_STATE,
CC2420RadioM$TX_STATE,
CC2420RadioM$TX_WAIT,
CC2420RadioM$PRE_TX_STATE,
CC2420RadioM$POST_TX_STATE,
CC2420RadioM$POST_TX_ACK_STATE,
CC2420RadioM$RX_STATE,
CC2420RadioM$POWER_DOWN_STATE,
CC2420RadioM$WARMUP_STATE,
CC2420RadioM$TIMER_INITIAL = 0,
CC2420RadioM$TIMER_BACKOFF,
CC2420RadioM$TIMER_ACK
};
uint8_t CC2420RadioM$countRetry;
uint8_t CC2420RadioM$stateRadio;
uint8_t CC2420RadioM$stateTimer;
uint8_t CC2420RadioM$currentDSN;
bool CC2420RadioM$bAckEnable;
bool CC2420RadioM$bPacketReceiving;
uint8_t CC2420RadioM$txlength;
TOS_MsgPtr CC2420RadioM$txbufptr;
TOS_MsgPtr CC2420RadioM$rxbufptr;
TOS_Msg CC2420RadioM$RxBuf;
volatile uint16_t CC2420RadioM$LocalAddr;
static void CC2420RadioM$sendFailed(void);
static void CC2420RadioM$flushRXFIFO(void);
static __inline result_t CC2420RadioM$setInitialTimer(uint16_t jiffy);
static __inline result_t CC2420RadioM$setBackoffTimer(uint16_t jiffy);
static __inline result_t CC2420RadioM$setAckTimer(uint16_t jiffy);
static inline void CC2420RadioM$PacketRcvd(void);
#line 168
static void CC2420RadioM$PacketSent(void);
#line 186
static inline result_t CC2420RadioM$StdControl$init(void);
static inline result_t CC2420RadioM$SplitControl$init(void);
#line 208
static inline result_t CC2420RadioM$CC2420SplitControl$initDone(void);
static inline result_t CC2420RadioM$SplitControl$default$initDone(void);
#line 239
static inline void CC2420RadioM$startRadio(void);
#line 253
static inline result_t CC2420RadioM$StdControl$start(void);
#line 277
static inline result_t CC2420RadioM$SplitControl$start(void);
#line 294
static inline result_t CC2420RadioM$CC2420SplitControl$startDone(void);
#line 312
static inline result_t CC2420RadioM$SplitControl$default$startDone(void);
static inline void CC2420RadioM$sendPacket(void);
#line 344
static inline result_t CC2420RadioM$SFD$captured(uint16_t time);
#line 393
static void CC2420RadioM$startSend(void);
#line 410
static void CC2420RadioM$tryToSend(void);
#line 449
static inline result_t CC2420RadioM$BackoffTimerJiffy$fired(void);
#line 491
static inline result_t CC2420RadioM$Send$send(TOS_MsgPtr pMsg);
#line 534
static void CC2420RadioM$delayedRXFIFO(void);
static inline void CC2420RadioM$delayedRXFIFOtask(void);
static void CC2420RadioM$delayedRXFIFO(void);
#line 591
static inline result_t CC2420RadioM$FIFOP$fired(void);
#line 628
static inline result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t length, uint8_t *data);
#line 721
static inline result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t length, uint8_t *data);
static inline void CC2420RadioM$MacControl$enableAck(void);
#line 744
static inline int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr m);
static inline int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr m);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$FIFOP_GPIOInt$clear(void);
#line 46
static void HPLCC2420M$FIFOP_GPIOInt$disable(void);
#line 45
static void HPLCC2420M$FIFOP_GPIOInt$enable(uint8_t arg_0x406321d8);
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
static result_t HPLCC2420M$CaptureSFD$captured(uint16_t arg_0x40f18368);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t HPLCC2420M$GPIOControl$init(void);
static result_t HPLCC2420M$GPIOControl$start(void);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$CCA_GPIOInt$clear(void);
#line 46
static void HPLCC2420M$CCA_GPIOInt$disable(void);
#line 45
static void HPLCC2420M$CCA_GPIOInt$enable(uint8_t arg_0x406321d8);
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
static result_t HPLCC2420M$HPLCC2420FIFO$TXFIFODone(uint8_t arg_0x40f1cc58, uint8_t *arg_0x40f1ce00);
#line 39
static result_t HPLCC2420M$HPLCC2420FIFO$RXFIFODone(uint8_t arg_0x40f1c4e8, uint8_t *arg_0x40f1c690);
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t HPLCC2420M$HPLCC2420RAM$writeDone(uint16_t arg_0x40954010, uint8_t arg_0x40954198, uint8_t *arg_0x40954340);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420M$InterruptFIFOP$fired(void);
#line 51
static result_t HPLCC2420M$InterruptCCA$fired(void);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void HPLCC2420M$FIFO_GPIOInt$clear(void);
#line 46
static void HPLCC2420M$FIFO_GPIOInt$disable(void);
static void HPLCC2420M$SFD_GPIOInt$clear(void);
#line 46
static void HPLCC2420M$SFD_GPIOInt$disable(void);
#line 45
static void HPLCC2420M$SFD_GPIOInt$enable(uint8_t arg_0x406321d8);
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
static result_t HPLCC2420M$InterruptFIFO$fired(void);
# 74 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
uint8_t HPLCC2420M$gbDMAChannelInitDone;
bool HPLCC2420M$gbIgnoreTxDMA;
bool HPLCC2420M$gRadioOpInProgress;
uint8_t *HPLCC2420M$rxbuf;
uint8_t *HPLCC2420M$txbuf;
uint8_t *HPLCC2420M$txrambuf;
uint8_t HPLCC2420M$txlen;
uint8_t HPLCC2420M$rxlen;
uint8_t HPLCC2420M$txramlen;
uint16_t HPLCC2420M$txramaddr;
static inline result_t HPLCC2420M$StdControl$init(void);
#line 136
static inline result_t HPLCC2420M$StdControl$start(void);
#line 166
static result_t HPLCC2420M$getSSPPort(void);
#line 180
static result_t HPLCC2420M$releaseSSPPort(void);
#line 198
static inline void HPLCC2420M$HPLCC2420CmdReleaseError(void);
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t addr);
#line 237
static inline void HPLCC2420M$HPLCC2420WriteContentionError(void);
static inline void HPLCC2420M$HPLCC2420WriteError(void);
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t addr, uint16_t data);
#line 282
static inline void HPLCC2420M$HPLCC2420ReadContentionError(void);
static inline void HPLCC2420M$HPLCC2420ReadReleaseError(void);
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t addr);
#line 422
static inline void HPLCC2420M$signalRAMWr(void);
#line 435
static inline void HPLCC2420M$HPLCC2420RAMWriteContentionError(void);
static inline void HPLCC2420M$HPLCC2420RamWriteReleaseError(void);
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t addr, uint8_t length, uint8_t *buffer);
#line 494
static void HPLCC2420M$signalRXFIFO(void);
static inline void HPLCC2420M$HPLCC2420FIFOReadRxFifoContentionError(void);
static inline void HPLCC2420M$HPLCC2420FifoReadRxFifoReleaseError(void);
#line 520
static inline result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t length, uint8_t *data);
#line 665
static void HPLCC2420M$signalTXFIFO(void);
static inline void HPLCC2420M$HPLCC2420FifoWriteTxFifoContentioError(void);
static inline void HPLCC2420M$HPLCC2420FifoWriteTxFifoReleaseError(void);
#line 689
static inline result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t length, uint8_t *data);
#line 777
static result_t HPLCC2420M$InterruptFIFOP$startWait(bool low_to_high);
#line 807
static inline result_t HPLCC2420M$InterruptCCA$startWait(bool low_to_high);
#line 822
static result_t HPLCC2420M$CaptureSFD$enableCapture(bool low_to_high);
#line 841
static inline result_t HPLCC2420M$InterruptFIFOP$disable(void);
static inline result_t HPLCC2420M$InterruptFIFO$disable(void);
static inline result_t HPLCC2420M$InterruptCCA$disable(void);
static inline result_t HPLCC2420M$CaptureSFD$disable(void);
static inline void HPLCC2420M$FIFOP_GPIOInt$fired(void);
static inline void HPLCC2420M$FIFO_GPIOInt$fired(void);
static inline void HPLCC2420M$CCA_GPIOInt$fired(void);
static inline void HPLCC2420M$SFD_GPIOInt$fired(void);
static inline result_t HPLCC2420M$RxDMAChannel$requestChannelDone(void);
static inline void HPLCC2420M$RxDMAChannel$startInterrupt(void);
static inline void HPLCC2420M$RxDMAChannel$stopInterrupt(uint16_t numbBytesSent);
static inline void HPLCC2420M$RxDMAChannel$eorInterrupt(uint16_t numBytesSent);
static inline void HPLCC2420M$HPLCC2420RxDMAEndInterruptReleaseError(void);
static inline void HPLCC2420M$RxDMAChannel$endInterrupt(uint16_t numBytesSent);
#line 944
static inline result_t HPLCC2420M$TxDMAChannel$requestChannelDone(void);
static inline void HPLCC2420M$TxDMAChannel$startInterrupt(void);
static inline void HPLCC2420M$TxDMAChannel$stopInterrupt(uint16_t numbBytesSent);
static inline void HPLCC2420M$TxDMAChannel$eorInterrupt(uint16_t numBytesSent);
static inline void HPLCC2420M$HPLCC2420TxDmaEndInterrupt(void);
static inline void HPLCC2420M$TxDMAChannel$endInterrupt(uint16_t numBytesSent);
#line 989
static inline result_t HPLCC2420M$InterruptFIFO$default$fired(void);
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$fired(void);
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static result_t TimerJiffyAsyncM$OSTIrq$allocate(void);
# 17 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
uint32_t TimerJiffyAsyncM$jiffy;
bool TimerJiffyAsyncM$bSet;
static void TimerJiffyAsyncM$StartTimer(uint32_t interval);
static inline result_t TimerJiffyAsyncM$StdControl$init(void);
static inline result_t TimerJiffyAsyncM$StdControl$start(void);
#line 58
static inline void TimerJiffyAsyncM$OSTIrq$fired(void);
#line 81
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t _jiffy);
#line 98
static inline bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void);
static inline result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void);
# 52 "/home/xu/oasis/lib/SmartSensing/Flash.nc"
static result_t FlashManagerM$Flash$read(uint32_t arg_0x40ad0120, uint8_t *arg_0x40ad02c8, uint32_t arg_0x40ad0460);
#line 28
static result_t FlashManagerM$Flash$erase(uint32_t arg_0x40ad11d8);
#line 19
static result_t FlashManagerM$Flash$write(uint32_t arg_0x40ad3868, uint8_t *arg_0x40ad3a10, uint32_t arg_0x40ad3ba8);
#line 54
static void FlashManagerM$Flash$setFlashPartitionState(uint32_t arg_0x40ad0ad8);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t FlashManagerM$EraseTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 62 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static result_t FlashManagerM$initRFChannel(uint8_t arg_0x41041bc8);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t FlashManagerM$WritingTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t FlashManagerM$WritingTimer$stop(void);
#line 59
static result_t FlashManagerM$EraseCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 69 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
bool FlashManagerM$writeTaskBusy;
bool FlashManagerM$alreadyStart;
uint16_t FlashManagerM$eraseTimerCount;
Queue_t FlashManagerM$flashQueue;
uint16_t FlashManagerM$FlashFlag;
uint32_t FlashManagerM$ProgID;
uint16_t FlashManagerM$RFChannel;
FlashClient_t FlashManagerM$buffer_fw;
SensorClient_t FlashManagerM$sensor_I[MAX_SENSOR_NUM];
uint16_t FlashManagerM$numToWrite;
static void FlashManagerM$writeTask(void);
static inline void FlashManagerM$eraseTask(void);
extern uint8_t __Flash_Erase(uint32_t addr) __attribute((noinline)) ;
extern uint8_t __GetEraseStatus(uint32_t addr) __attribute((noinline)) ;
extern uint8_t __EraseFlashSpin(uint32_t addr) __attribute((noinline)) ;
static inline void FlashManagerM$initialize(void);
#line 115
static inline result_t FlashManagerM$StdControl$init(void);
static inline result_t FlashManagerM$StdControl$start(void);
#line 146
static inline result_t FlashManagerM$FlashManager$init(void);
#line 215
static void FlashManagerM$writeTask(void);
#line 244
static inline void FlashManagerM$eraseTask(void);
#line 285
static result_t FlashManagerM$FlashManager$write(uint32_t addr, void *data, uint16_t numBytes);
#line 321
static result_t FlashManagerM$FlashManager$read(uint32_t addr, uint8_t *data, uint16_t numBytes);
#line 353
static inline result_t FlashManagerM$EraseTimer$fired(void);
static inline result_t FlashManagerM$WritingTimer$fired(void);
#line 373
static inline result_t FlashManagerM$EraseCheckTimer$fired(void);
# 26 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static uint16_t FlashM$unlock(uint32_t addr);
static uint16_t FlashM$writeHelper(uint32_t addr, uint8_t *data, uint32_t numBytes,
uint8_t prebyte, uint8_t postbyte);
static void FlashM$writeExitHelper(uint32_t addr, uint32_t numBytes);
uint8_t FlashM$FlashPartitionState[16];
uint8_t FlashM$init = 0;
#line 36
uint8_t FlashM$programBufferSupported = 2;
extern uint8_t __Flash_Erase(uint32_t addr) __attribute((noinline)) ;
extern uint8_t __GetEraseStatus(uint32_t addr) __attribute((noinline)) ;
extern uint8_t __EraseFlashSpin(uint32_t addr) __attribute((noinline)) ;
extern uint8_t __Flash_Program_Word(uint32_t addr, uint16_t word) __attribute((noinline)) ;
extern uint8_t __Flash_Program_Buffer(uint32_t addr, uint16_t *data, uint8_t datalen) __attribute((noinline)) ;
static inline result_t FlashM$StdControl$init(void);
#line 74
static inline result_t FlashM$StdControl$start(void);
static uint16_t FlashM$writeHelper(uint32_t addr, uint8_t *data, uint32_t numBytes,
uint8_t prebyte, uint8_t postbyte);
#line 165
static void FlashM$writeExitHelper(uint32_t addr, uint32_t numBytes);
static result_t FlashM$Flash$write(uint32_t addr, uint8_t *data, uint32_t numBytes);
#line 326
static inline void FlashM$Flash$setFlashPartitionState(uint32_t addr);
static inline result_t FlashM$Flash$erase(uint32_t addr);
#line 399
static inline result_t FlashM$Flash$read(uint32_t addr, uint8_t *data, uint32_t numBytes);
#line 430
static uint16_t FlashM$unlock(uint32_t addr) __attribute((noinline)) ;
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878);
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t FramerM$ByteComm$txByte(uint8_t arg_0x410abc98);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t FramerM$ByteControl$init(void);
static result_t FramerM$ByteControl$start(void);
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
static result_t FramerM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8);
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static TOS_MsgPtr FramerM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x410a64c8, uint8_t arg_0x410a6650);
# 82 "/opt/tinyos-1.x/tos/system/FramerM.nc"
enum FramerM$__nesc_unnamed4320 {
FramerM$HDLC_QUEUESIZE = 2,
FramerM$HDLC_MTU = sizeof(TOS_Msg ),
FramerM$HDLC_FLAG_BYTE = 0x7e,
FramerM$HDLC_CTLESC_BYTE = 0x7d,
FramerM$PROTO_ACK = 64,
FramerM$PROTO_PACKET_ACK = 65,
FramerM$PROTO_PACKET_NOACK = 66,
FramerM$PROTO_UNKNOWN = 255
};
enum FramerM$__nesc_unnamed4321 {
FramerM$RXSTATE_NOSYNC,
FramerM$RXSTATE_PROTO,
FramerM$RXSTATE_TOKEN,
FramerM$RXSTATE_INFO,
FramerM$RXSTATE_ESC
};
enum FramerM$__nesc_unnamed4322 {
FramerM$TXSTATE_IDLE,
FramerM$TXSTATE_PROTO,
FramerM$TXSTATE_INFO,
FramerM$TXSTATE_ESC,
FramerM$TXSTATE_FCS1,
FramerM$TXSTATE_FCS2,
FramerM$TXSTATE_ENDFLAG,
FramerM$TXSTATE_FINISH,
FramerM$TXSTATE_ERROR
};
enum FramerM$__nesc_unnamed4323 {
FramerM$FLAGS_TOKENPEND = 0x2,
FramerM$FLAGS_DATAPEND = 0x4,
FramerM$FLAGS_UNKNOWN = 0x8
};
TOS_Msg FramerM$gMsgRcvBuf[FramerM$HDLC_QUEUESIZE];
#line 121
typedef struct FramerM$_MsgRcvEntry {
uint8_t Proto;
uint8_t Token;
uint16_t Length;
TOS_MsgPtr pMsg;
} FramerM$MsgRcvEntry_t;
FramerM$MsgRcvEntry_t FramerM$gMsgRcvTbl[FramerM$HDLC_QUEUESIZE];
uint8_t *FramerM$gpRxBuf;
uint8_t *FramerM$gpTxBuf;
uint8_t FramerM$gFlags;
uint8_t FramerM$gTxState;
uint8_t FramerM$gPrevTxState;
uint16_t FramerM$gTxProto;
uint16_t FramerM$gTxByteCnt;
uint16_t FramerM$gTxLength;
uint16_t FramerM$gTxRunningCRC;
uint8_t FramerM$gRxState;
uint8_t FramerM$gRxHeadIndex;
uint8_t FramerM$gRxTailIndex;
uint16_t FramerM$gRxByteCnt;
uint16_t FramerM$gRxRunningCRC;
TOS_MsgPtr FramerM$gpTxMsg;
uint8_t FramerM$gTxTokenBuf;
uint8_t FramerM$gTxUnknownBuf;
uint8_t FramerM$gTxEscByte;
static void FramerM$PacketSent(void);
static result_t FramerM$StartTx(void);
#line 202
static inline void FramerM$PacketUnknown(void);
static inline void FramerM$PacketRcvd(void);
#line 246
static void FramerM$PacketSent(void);
#line 268
static void FramerM$HDLCInitialize(void);
#line 292
static inline result_t FramerM$StdControl$init(void);
static inline result_t FramerM$StdControl$start(void);
static inline result_t FramerM$BareSendMsg$send(TOS_MsgPtr pMsg);
#line 329
static inline result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t Token);
#line 349
static inline result_t FramerM$ByteComm$rxByteReady(uint8_t data, bool error, uint16_t strength);
#line 470
static result_t FramerM$TxArbitraryByte(uint8_t inByte);
#line 483
static inline result_t FramerM$ByteComm$txByteReady(bool LastByteSuccess);
#line 553
static inline result_t FramerM$ByteComm$txDone(void);
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
static TOS_MsgPtr FramerAckM$ReceiveCombined$receive(TOS_MsgPtr arg_0x40620878);
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
static result_t FramerAckM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x410a6cf8);
# 72 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
uint8_t FramerAckM$gTokenBuf;
static inline void FramerAckM$SendAckTask(void);
static inline TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr Msg, uint8_t token);
#line 91
static inline TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr Msg);
# 63 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
static result_t UARTM$HPLUART$init(void);
#line 89
static result_t UARTM$HPLUART$put(uint8_t arg_0x411118c0);
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
static result_t UARTM$ByteComm$txDone(void);
#line 75
static result_t UARTM$ByteComm$txByteReady(bool arg_0x410a3b30);
#line 66
static result_t UARTM$ByteComm$rxByteReady(uint8_t arg_0x410a3200, bool arg_0x410a3388, uint16_t arg_0x410a3520);
# 58 "/opt/tinyos-1.x/tos/system/UARTM.nc"
bool UARTM$state;
static inline result_t UARTM$Control$init(void);
static inline result_t UARTM$Control$start(void);
static inline result_t UARTM$HPLUART$get(uint8_t data);
static inline result_t UARTM$HPLUART$putDone(void);
#line 110
static result_t UARTM$ByteComm$txByte(uint8_t data);
# 97 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
static result_t HPLFFUARTM$UART$get(uint8_t arg_0x41111e58);
static result_t HPLFFUARTM$UART$putDone(void);
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
static void HPLFFUARTM$Interrupt$disable(void);
#line 46
static void HPLFFUARTM$Interrupt$enable(void);
#line 45
static result_t HPLFFUARTM$Interrupt$allocate(void);
# 62 "/opt/tinyos-1.x/tos/platform/imote2/HPLFFUARTM.nc"
uint8_t HPLFFUARTM$baudrate = UART_BAUD_115200;
static inline void HPLFFUARTM$Interrupt$fired(void);
#line 90
static inline void HPLFFUARTM$setBaudRate(uint8_t rate);
#line 148
static inline result_t HPLFFUARTM$UART$init(void);
#line 214
static inline result_t HPLFFUARTM$UART$put(uint8_t data);
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
static uint32_t ClockTimeStampingM$LocalTime$read(void);
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
static result_t ClockTimeStampingM$HPLCC2420RAM$write(uint16_t arg_0x40955710, uint8_t arg_0x40955898, uint8_t *arg_0x40955a40);
# 26 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
uint32_t ClockTimeStampingM$rcv_time;
TOS_MsgPtr ClockTimeStampingM$rcv_message;
enum ClockTimeStampingM$__nesc_unnamed4324 {
ClockTimeStampingM$TX_FIFO_MSG_START = 10,
ClockTimeStampingM$SEND_TIME_CORRECTION = 0
};
#line 58
static inline void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff);
#line 123
static inline void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff);
#line 138
static inline result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr ourMessage,
uint32_t *timeStamp);
#line 165
static inline result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t addr,
uint8_t length,
uint8_t *buffer);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t DataMgmtM$BatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
#line 59
static result_t DataMgmtM$SysCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t DataMgmtM$SysCheckTimer$stop(void);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t DataMgmtM$Send$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
#line 106
static void *DataMgmtM$Send$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t DataMgmtM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 61 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void DataMgmtM$restart(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t DataMgmtM$SubControl$init(void);
static result_t DataMgmtM$SubControl$start(void);
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t DataMgmtM$Leds$greenToggle(void);
#line 131
static result_t DataMgmtM$Leds$yellowToggle(void);
# 68 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
uint16_t DataMgmtM$seqno;
bool DataMgmtM$sendTaskBusy;
bool DataMgmtM$presendTaskBusy;
bool DataMgmtM$processTaskBusy;
uint8_t DataMgmtM$sysCheckCount;
uint8_t DataMgmtM$sendDoneFailCheckCount;
uint16_t DataMgmtM$sendQueueLen;
uint16_t DataMgmtM$sendDoneR_num;
uint16_t DataMgmtM$send_num;
uint16_t DataMgmtM$Msg_length;
uint16_t DataMgmtM$sendCalled;
uint16_t DataMgmtM$presendTaskCount;
uint16_t DataMgmtM$trynextSendCount;
uint16_t DataMgmtM$processTaskCount;
uint16_t DataMgmtM$batchTimerCount;
uint16_t DataMgmtM$allocbuffercount;
uint16_t DataMgmtM$f_allocbuffercount;
uint16_t DataMgmtM$freebuffercount;
uint16_t DataMgmtM$nothingtosend;
TOS_MsgPtr DataMgmtM$headSendQueue;
TOS_Msg DataMgmtM$buffMsg[MAX_SENSING_QUEUE_SIZE];
Queue_t DataMgmtM$buffQueue;
Queue_t DataMgmtM$sendQueue;
MemQueue_t DataMgmtM$sensorMem;
uint16_t DataMgmtM$processloopCount;
uint16_t DataMgmtM$GlobaltaskCode;
static result_t DataMgmtM$tryNextSend(void);
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr );
static void DataMgmtM$presendTask(void);
static void DataMgmtM$processTask(void);
static inline void DataMgmtM$sendTask(void);
static inline void DataMgmtM$initialize(void);
#line 157
static inline result_t DataMgmtM$StdControl$init(void);
#line 169
static inline result_t DataMgmtM$StdControl$start(void);
#line 190
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t client);
#line 227
static result_t DataMgmtM$DataMgmt$freeBlk(void *obj);
#line 262
static inline result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t type);
#line 305
static result_t DataMgmtM$DataMgmt$saveBlk(void *obj, uint8_t mediumType);
#line 329
static inline result_t DataMgmtM$BatchTimer$fired(void);
#line 352
static inline result_t DataMgmtM$SysCheckTimer$fired(void);
#line 379
static inline result_t DataMgmtM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
#line 398
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr pMsg, result_t success);
#line 425
static inline void DataMgmtM$sendTask(void);
#line 472
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr msg);
#line 488
static result_t DataMgmtM$tryNextSend(void);
#line 508
static void DataMgmtM$presendTask(void);
#line 601
static void DataMgmtM$processTask(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t ADCM$ClockControl$init(void);
static result_t ADCM$ClockControl$start(void);
# 54 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
static result_t ADCM$PMIC$getBatteryVoltage(uint8_t *arg_0x404bdee0);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t ADCM$InternalControl$init(void);
static result_t ADCM$InternalControl$start(void);
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
static result_t ADCM$ADC$dataReady(
# 34 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
uint8_t arg_0x411da910,
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
uint16_t arg_0x40aa6cc0);
# 54 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
#line 50
struct ADCM$reading {
uint16_t data;
uint8_t id;
} ADCM$reading[40];
uint8_t ADCM$dataindex = 0;
uint8_t ADCM$channel[MAX_SENSOR_NUM];
bool ADCM$taskBusy;
bool ADCM$initialized = FALSE;
int8_t ADCM$queue_head;
int8_t ADCM$queue_tail;
uint8_t ADCM$queue_size;
uint8_t ADCM$queue[40];
uint16_t ADCM$time_flag;
static inline uint16_t ADCM$readADC(uint8_t addr);
static inline result_t ADCM$StdControl$init(void);
static inline result_t ADCM$StdControl$start(void);
#line 90
static result_t ADCM$ADCControl$init(void);
#line 121
static result_t ADCM$ADCControl$bindPort(uint8_t port, uint8_t adcPort);
static inline void ADCM$enqueue(uint8_t value);
static inline uint8_t ADCM$dequeue(void);
#line 159
static void ADCM$signalOneSensor(void);
static result_t ADCM$ADC$getData(uint8_t client);
#line 190
static inline uint16_t ADCM$readADC(uint8_t actrualPort);
#line 240
static inline result_t ADCM$Clock$fire(void);
static inline result_t ADCM$Timer$fired(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t NeighborMgmtM$Random$rand(void);
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static result_t NeighborMgmtM$CascadeControl$addDirectChild(address_t arg_0x4121abb0);
static result_t NeighborMgmtM$CascadeControl$deleteDirectChild(address_t arg_0x41218088);
static result_t NeighborMgmtM$CascadeControl$parentChanged(address_t arg_0x41218530);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t NeighborMgmtM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 22 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
NBRTableEntry NeighborMgmtM$NeighborTbl[16];
bool NeighborMgmtM$initTime;
bool NeighborMgmtM$processTaskBusy;
uint8_t NeighborMgmtM$lqiBuf;
uint8_t NeighborMgmtM$rssiBuf;
uint16_t NeighborMgmtM$linkaddrBuf;
NetworkMsg *NeighborMgmtM$nwMsg;
uint8_t NeighborMgmtM$ticks;
static void NeighborMgmtM$initialize(void);
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id);
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void);
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id);
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id);
static inline void NeighborMgmtM$timerTask(void);
static inline void NeighborMgmtM$updateTable(void);
static inline void NeighborMgmtM$processSnoopMsg(void);
static inline result_t NeighborMgmtM$StdControl$init(void);
static inline result_t NeighborMgmtM$StdControl$start(void);
static void NeighborMgmtM$initialize(void);
static inline result_t NeighborMgmtM$Timer$fired(void);
static inline void NeighborMgmtM$processSnoopMsg(void);
#line 105
static inline result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr msg, void *payload, uint16_t payloadLen);
#line 121
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id);
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id);
#line 149
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id);
#line 165
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void);
#line 183
static inline void NeighborMgmtM$timerTask(void);
static inline void NeighborMgmtM$updateTable(void);
#line 232
static uint16_t NeighborMgmtM$adjustLQI(uint8_t val);
static inline bool NeighborMgmtM$NeighborCtrl$changeParent(uint16_t *newParent, uint16_t *parentCost, uint16_t *linkEst);
#line 270
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t parent);
#line 286
static bool NeighborMgmtM$NeighborCtrl$clearParent(bool reset);
#line 302
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect);
#line 384
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t addr, uint16_t parentCost);
#line 410
static uint16_t NeighborMgmtM$CascadeControl$getParent(void);
#line 444
static inline uint8_t NeighborMgmtM$writeNbrLinkInfo(uint8_t *start, uint8_t maxlen);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopEngineM$RouteStatusTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 71 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteSelect.nc"
static result_t MultiHopEngineM$RouteSelect$selectRoute(TOS_MsgPtr arg_0x40df7270, uint8_t arg_0x40df73f8, uint8_t arg_0x40df7580);
#line 86
static result_t MultiHopEngineM$RouteSelect$initializeFields(TOS_MsgPtr arg_0x40df7b90, uint8_t arg_0x40df7d18);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Intercept$intercept(
# 22 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x41310200,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
# 116 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
static bool MultiHopEngineM$RouteSelectCntl$isSink(void);
#line 84
static uint16_t MultiHopEngineM$RouteSelectCntl$getQuality(void);
#line 49
static uint16_t MultiHopEngineM$RouteSelectCntl$getParent(void);
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
static result_t MultiHopEngineM$Snoop$intercept(
# 23 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413107e0,
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t MultiHopEngineM$Send$sendDone(
# 20 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
uint8_t arg_0x413114b8,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
static uint8_t MultiHopEngineM$EventReport$eventSend(uint8_t arg_0x409b7ab0,
uint8_t arg_0x409b7c48,
uint8_t *arg_0x409b7e00);
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
static result_t MultiHopEngineM$MultihopCtrl$addChild(uint16_t arg_0x40df3928, uint16_t arg_0x40df3ac0, bool arg_0x40df3c50);
#line 2
static result_t MultiHopEngineM$MultihopCtrl$switchParent(void);
# 42 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static void MultiHopEngineM$restart(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t MultiHopEngineM$SubControl$init(void);
static result_t MultiHopEngineM$SubControl$start(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
static result_t MultiHopEngineM$Leds$redToggle(void);
#line 64
static result_t MultiHopEngineM$Leds$redOn(void);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t MultiHopEngineM$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t MultiHopEngineM$MonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 57 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
#line 50
typedef struct MultiHopEngineM$SendQueueEntryInfo {
uint8_t valid;
uint8_t AMID;
uint8_t resend;
uint16_t length;
TOS_MsgPtr msgPtr;
TOS_MsgPtr originalTOSPtr;
} MultiHopEngineM$SendQueueEntryInfo;
enum MultiHopEngineM$__nesc_unnamed4325 {
MultiHopEngineM$NETWORKMSG_HEADER_LENGTH = 10,
MultiHopEngineM$SUCCESSIVE_TRANSMITE_FAILURE_THRESHOLD = 15,
MultiHopEngineM$ROUTE_STATUS_CHECK_PERIOD = 10 * 1024,
MultiHopEngineM$WDT_UPDATE_PERIOD = 10,
MultiHopEngineM$WDT_UPDATE_UNIT = 1024 * 60
};
bool MultiHopEngineM$sendTaskBusy;
TinyDWFQ_t MultiHopEngineM$sendQueue;
Queue_t MultiHopEngineM$buffQueue;
TOS_Msg MultiHopEngineM$poolBuffer[40];
MultiHopEngineM$SendQueueEntryInfo MultiHopEngineM$queueEntryInfo[40];
bool MultiHopEngineM$messageIsRetransmission;
uint16_t MultiHopEngineM$numberOfSendFailures;
uint16_t MultiHopEngineM$numberOfSendSuccesses;
bool MultiHopEngineM$useMhopPriority;
uint8_t MultiHopEngineM$numOfPktProcessing;
uint16_t MultiHopEngineM$numOfSuccessiveFailures;
bool MultiHopEngineM$beRadioActive;
uint8_t MultiHopEngineM$wdtTimerCnt;
bool MultiHopEngineM$beParentActive;
uint16_t MultiHopEngineM$localSendFail;
uint16_t MultiHopEngineM$numLocalPendingPkt;
uint16_t MultiHopEngineM$falseType;
static inline void MultiHopEngineM$initialize(void);
#line 111
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void);
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind);
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg);
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr);
static result_t MultiHopEngineM$tryNextSend(void);
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable);
static inline result_t MultiHopEngineM$StdControl$init(void);
static inline result_t MultiHopEngineM$StdControl$start(void);
#line 154
static result_t MultiHopEngineM$Send$send(uint8_t AMID, TOS_MsgPtr msg, uint16_t length);
#line 181
static void *MultiHopEngineM$Send$getBuffer(uint8_t AMID, TOS_MsgPtr msg, uint16_t *length);
#line 193
static inline void MultiHopEngineM$sendTask(void);
#line 266
static inline result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr msg, result_t success);
#line 349
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr);
#line 422
static result_t MultiHopEngineM$tryNextSend(void);
#line 441
static inline TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr msg);
#line 501
static inline result_t MultiHopEngineM$MonitorTimer$fired(void);
#line 518
static inline result_t MultiHopEngineM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success);
static inline result_t MultiHopEngineM$RouteStatusTimer$fired(void);
#line 543
static inline result_t MultiHopEngineM$MultihopCtrl$readyToSend(void);
#line 555
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable);
#line 582
static inline uint16_t MultiHopEngineM$RouteControl$getParent(void);
static inline uint16_t MultiHopEngineM$RouteControl$getQuality(void);
#line 633
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void);
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg);
#line 657
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind);
#line 672
static inline result_t MultiHopEngineM$Send$default$sendDone(uint8_t AMID, TOS_MsgPtr pMsg,
result_t success);
static inline result_t MultiHopEngineM$Intercept$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen);
static inline result_t MultiHopEngineM$Snoop$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen);
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesRouterM$SubSend$send(
# 40 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x413687d8,
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$DTTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
#line 59
static result_t CascadesRouterM$RTTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t CascadesRouterM$RTTimer$stop(void);
#line 59
static result_t CascadesRouterM$DelayTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t CascadesRouterM$DelayTimer$stop(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
static uint16_t CascadesRouterM$Random$rand(void);
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
static result_t CascadesRouterM$SubControl$init(void);
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
static TOS_MsgPtr CascadesRouterM$Receive$receive(
# 36 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint8_t arg_0x41369c38,
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
TOS_MsgPtr arg_0x409b8068, void *arg_0x409b8208, uint16_t arg_0x409b83a0);
# 2 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
static uint16_t CascadesRouterM$CascadeControl$getParent(void);
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
static result_t CascadesRouterM$ResetTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
static result_t CascadesRouterM$ResetTimer$stop(void);
#line 59
static result_t CascadesRouterM$ACKTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10);
# 57 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
uint16_t CascadesRouterM$RTwait;
uint16_t CascadesRouterM$highestSeq;
uint16_t CascadesRouterM$expectingSeq;
uint8_t CascadesRouterM$headIndex;
uint8_t CascadesRouterM$resetCount;
uint16_t CascadesRouterM$nextSignalSeq;
bool CascadesRouterM$inData[MAX_CAS_PACKETS];
bool CascadesRouterM$activeRT;
bool CascadesRouterM$DataTimerOn;
bool CascadesRouterM$DataProcessBusy;
bool CascadesRouterM$RequestProcessBusy;
bool CascadesRouterM$CMAuProcessBusy;
bool CascadesRouterM$sigRcvTaskBusy;
bool CascadesRouterM$delayTimerBusy;
bool CascadesRouterM$ctrlMsgBusy;
bool CascadesRouterM$inited;
TOS_Msg CascadesRouterM$RecvDataMsg;
TOS_Msg CascadesRouterM$RecvRequestMsg;
TOS_Msg CascadesRouterM$RecvCMAuMsg;
TOS_Msg CascadesRouterM$SendCtrlMsg;
CascadesBuffer CascadesRouterM$myBuffer[MAX_CAS_BUF];
static inline void CascadesRouterM$processData(void);
static inline void CascadesRouterM$processRequest(void);
static inline void CascadesRouterM$processCMAu(void);
static void CascadesRouterM$sigRcvTask(void);
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq);
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex);
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr);
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr);
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type);
static void CascadesRouterM$initialize(void);
static inline NetworkMsg *CascadesRouterM$getCasData(TOS_MsgPtr tmPtr);
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq);
#line 148
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex);
#line 167
static void CascadesRouterM$delFromChildrenList(address_t nodeID);
#line 188
static void CascadesRouterM$addToChildrenList(address_t nodeID);
#line 228
static void CascadesRouterM$clearChildrenListStatus(uint8_t myindex);
#line 241
static inline void CascadesRouterM$updateInData(void);
#line 254
static bool CascadesRouterM$getCMAu(uint8_t myindex);
#line 278
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr);
#line 305
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr);
#line 323
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type);
#line 347
static void CascadesRouterM$initialize(void);
#line 374
static inline result_t CascadesRouterM$StdControl$init(void);
static inline result_t CascadesRouterM$StdControl$start(void);
static inline result_t CascadesRouterM$CascadeControl$addDirectChild(address_t childID);
static inline result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t childID);
#line 407
static result_t CascadesRouterM$CascadeControl$parentChanged(address_t newParent);
#line 437
static inline result_t CascadesRouterM$DTTimer$fired(void);
#line 501
static inline result_t CascadesRouterM$RTTimer$fired(void);
#line 536
static inline result_t CascadesRouterM$ResetTimer$fired(void);
#line 556
static inline result_t CascadesRouterM$DelayTimer$fired(void);
static inline result_t CascadesRouterM$ACKTimer$fired(void);
static void CascadesRouterM$sigRcvTask(void);
#line 614
static inline uint32_t CascadesRouterM$crcByte(uint32_t crc, uint8_t b);
#line 627
static inline uint32_t CascadesRouterM$calculateCRC(uint8_t *start, uint8_t length);
#line 640
static inline void CascadesRouterM$processData(void);
#line 818
static inline void CascadesRouterM$processCMAu(void);
#line 859
static inline void CascadesRouterM$processRequest(void);
#line 900
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr);
#line 932
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr);
#line 960
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(uint8_t type, TOS_MsgPtr tmsg);
#line 1009
static inline result_t CascadesRouterM$SubSend$sendDone(uint8_t type, TOS_MsgPtr msg, result_t status);
static inline TOS_MsgPtr CascadesRouterM$Receive$default$receive(uint8_t type, TOS_MsgPtr pMsg,
void *payload, uint16_t payloadLen);
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
static result_t CascadesEngineM$SendMsg$send(
# 39 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x414016a8,
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0);
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
static result_t CascadesEngineM$MySend$sendDone(
# 36 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
uint8_t arg_0x41402e60,
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8);
# 45 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
bool CascadesEngineM$sendTaskBusy;
Queue_t CascadesEngineM$sendQueue;
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, uint8_t len);
static result_t CascadesEngineM$tryNextSend(void);
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg);
static inline void CascadesEngineM$sendTask(void);
static inline result_t CascadesEngineM$StdControl$init(void);
#line 68
static result_t CascadesEngineM$MySend$send(uint8_t type, TOS_MsgPtr msg, uint16_t len);
#line 82
static result_t CascadesEngineM$SendMsg$sendDone(uint8_t type, TOS_MsgPtr msg, result_t success);
#line 94
static inline result_t CascadesEngineM$SendMsg$default$send(uint8_t type, uint16_t dest, uint8_t length, TOS_MsgPtr pMsg);
static inline void CascadesEngineM$sendTask(void);
#line 122
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg);
static result_t CascadesEngineM$tryNextSend(void);
#line 146
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t type, uint8_t len);
# 54 "/opt/tinyos-1.x/tos/platform/imote2/DVFS.nc"
inline static result_t HPLInitM$DVFS$SwitchCoreFreq(uint32_t arg_0x4044bac0, uint32_t arg_0x4044bc58){
#line 54
unsigned char result;
#line 54
#line 54
result = DVFSM$DVFS$SwitchCoreFreq(arg_0x4044bac0, arg_0x4044bc58);
#line 54
#line 54
return result;
#line 54
}
#line 54
# 184 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_MAKE_RADIO_CCA_INPUT(void)
#line 184
{
#line 184
{
#line 184
* (volatile uint32_t *)(0x40E0000C + (116 < 96 ? ((116 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (116 < 96 ? ((116 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (116 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (116 < 96 ? ((116 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (116 & 0x1f));
#line 184
* (volatile uint32_t *)(0x40E00054 + ((116 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((116 & 0x7f) >> 4) * 4) & ~(3 << (116 & 0xf) * 2)) | (0 << (116 & 0xf) * 2);
}
#line 184
;
#line 184
* (volatile uint32_t *)(0x40E0000C + (116 < 96 ? ((116 & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (116 & 0x1f));
}
#line 186
static __inline void TOSH_MAKE_CC_SFD_INPUT(void)
#line 186
{
#line 186
{
#line 186
* (volatile uint32_t *)(0x40E0000C + (16 < 96 ? ((16 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (16 < 96 ? ((16 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (16 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (16 < 96 ? ((16 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (16 & 0x1f));
#line 186
* (volatile uint32_t *)(0x40E00054 + ((16 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((16 & 0x7f) >> 4) * 4) & ~(3 << (16 & 0xf) * 2)) | (0 << (16 & 0xf) * 2);
}
#line 186
;
#line 186
* (volatile uint32_t *)(0x40E0000C + (16 < 96 ? ((16 & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (16 & 0x1f));
}
#line 183
static __inline void TOSH_MAKE_CC_FIFO_INPUT(void)
#line 183
{
#line 183
{
#line 183
* (volatile uint32_t *)(0x40E0000C + (114 < 96 ? ((114 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (114 < 96 ? ((114 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (114 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (114 < 96 ? ((114 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (114 & 0x1f));
#line 183
* (volatile uint32_t *)(0x40E00054 + ((114 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((114 & 0x7f) >> 4) * 4) & ~(3 << (114 & 0xf) * 2)) | (0 << (114 & 0xf) * 2);
}
#line 183
;
#line 183
* (volatile uint32_t *)(0x40E0000C + (114 < 96 ? ((114 & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (114 & 0x1f));
}
#line 185
static __inline void TOSH_MAKE_CC_FIFOP_INPUT(void)
#line 185
{
#line 185
{
#line 185
* (volatile uint32_t *)(0x40E0000C + (0 < 96 ? ((0 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (0 < 96 ? ((0 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (0 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (0 < 96 ? ((0 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (0 & 0x1f));
#line 185
* (volatile uint32_t *)(0x40E00054 + ((0 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((0 & 0x7f) >> 4) * 4) & ~(3 << (0 & 0xf) * 2)) | (0 << (0 & 0xf) * 2);
}
#line 185
;
#line 185
* (volatile uint32_t *)(0x40E0000C + (0 < 96 ? ((0 & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (0 & 0x1f));
}
#line 187
static __inline void TOSH_MAKE_CC_CSN_OUTPUT(void)
#line 187
{
#line 187
{
#line 187
* (volatile uint32_t *)(0x40E0000C + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (39 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (39 & 0x1f));
#line 187
* (volatile uint32_t *)(0x40E00054 + ((39 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((39 & 0x7f) >> 4) * 4) & ~(3 << (39 & 0xf) * 2)) | (0 << (39 & 0xf) * 2);
}
#line 187
;
#line 187
* (volatile uint32_t *)(0x40E0000C + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (39 & 0x1f);
}
#line 187
static __inline void TOSH_SET_CC_CSN_PIN(void)
#line 187
{
#line 187
* (volatile uint32_t *)(0x40E00018 + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (39 & 0x1f);
}
#line 181
static __inline void TOSH_MAKE_CC_VREN_OUTPUT(void)
#line 181
{
#line 181
{
#line 181
* (volatile uint32_t *)(0x40E0000C + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (115 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (115 & 0x1f));
#line 181
* (volatile uint32_t *)(0x40E00054 + ((115 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((115 & 0x7f) >> 4) * 4) & ~(3 << (115 & 0xf) * 2)) | (0 << (115 & 0xf) * 2);
}
#line 181
;
#line 181
* (volatile uint32_t *)(0x40E0000C + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (115 & 0x1f);
}
#line 181
static __inline void TOSH_CLR_CC_VREN_PIN(void)
#line 181
{
#line 181
* (volatile uint32_t *)(0x40E00024 + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (115 & 0x1f);
}
#line 182
static __inline void TOSH_MAKE_CC_RSTN_OUTPUT(void)
#line 182
{
#line 182
{
#line 182
* (volatile uint32_t *)(0x40E0000C + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (22 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (22 & 0x1f));
#line 182
* (volatile uint32_t *)(0x40E00054 + ((22 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((22 & 0x7f) >> 4) * 4) & ~(3 << (22 & 0xf) * 2)) | (0 << (22 & 0xf) * 2);
}
#line 182
;
#line 182
* (volatile uint32_t *)(0x40E0000C + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (22 & 0x1f);
}
#line 182
static __inline void TOSH_CLR_CC_RSTN_PIN(void)
#line 182
{
#line 182
* (volatile uint32_t *)(0x40E00024 + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (22 & 0x1f);
}
static inline void TOSH_SET_PIN_DIRECTIONS(void )
{
* (volatile uint32_t *)0x40F00004 = (1 << 5) | (1 << 4);
TOSH_CLR_CC_RSTN_PIN();
TOSH_MAKE_CC_RSTN_OUTPUT();
TOSH_CLR_CC_VREN_PIN();
TOSH_MAKE_CC_VREN_OUTPUT();
TOSH_SET_CC_CSN_PIN();
TOSH_MAKE_CC_CSN_OUTPUT();
TOSH_MAKE_CC_FIFOP_INPUT();
TOSH_MAKE_CC_FIFO_INPUT();
TOSH_MAKE_CC_SFD_INPUT();
TOSH_MAKE_RADIO_CCA_INPUT();
}
# 89 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLInitM.nc"
static inline result_t HPLInitM$init(void)
#line 89
{
* (volatile uint32_t *)0x41300004 = (((1 << 22) | (1 << 20)) | (1 << 15)) | (1 << 9);
* (volatile uint32_t *)0x41300008 = 1 << 1;
while ((* (volatile uint32_t *)0x41300008 & 1) == 0) ;
TOSH_SET_PIN_DIRECTIONS();
initqueue(¶mtaskQueue, defaultQueueSize);
* (volatile uint32_t *)0x48000064 = (1 & 0x3) << 12;
* (volatile uint32_t *)0x48000008 = ((* (volatile uint32_t *)0x48000008 | (1 << 3)) | (1 << 15)) | 2;
* (volatile uint32_t *)0x4800000C = * (volatile uint32_t *)0x4800000C | (1 << 3);
* (volatile uint32_t *)0x48000010 = * (volatile uint32_t *)0x48000010 | (1 << 3);
* (volatile uint32_t *)0x48000014 = 0;
#line 120
* (volatile uint32_t *)0x48000000 = 0x0B002BCC;
initMMU();
enableICache();
initSyncFlash();
enableDCache();
#line 142
HPLInitM$DVFS$SwitchCoreFreq(13, 13);
return SUCCESS;
}
# 47 "/opt/tinyos-1.x/tos/system/RealMain.nc"
inline static result_t RealMain$hardwareInit(void){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLInitM$init();
#line 47
#line 47
return result;
#line 47
}
#line 47
# 51 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
inline static result_t DVFSM$PMIC$setCoreVoltage(uint8_t arg_0x404bd718){
#line 51
unsigned char result;
#line 51
#line 51
result = PMICM$PMIC$setCoreVoltage(arg_0x404bd718);
#line 51
#line 51
return result;
#line 51
}
#line 51
# 99 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static __inline void PMICM$TOSH_MAKE_PMIC_TXON_OUTPUT(void)
#line 99
{
#line 99
{
#line 99
* (volatile uint32_t *)(0x40E0000C + (108 < 96 ? ((108 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (108 < 96 ? ((108 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (108 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (108 < 96 ? ((108 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (108 & 0x1f));
#line 99
* (volatile uint32_t *)(0x40E00054 + ((108 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((108 & 0x7f) >> 4) * 4) & ~(3 << (108 & 0xf) * 2)) | (0 << (108 & 0xf) * 2);
}
#line 99
;
#line 99
* (volatile uint32_t *)(0x40E0000C + (108 < 96 ? ((108 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (108 & 0x1f);
}
#line 99
static __inline void PMICM$TOSH_CLR_PMIC_TXON_PIN(void)
#line 99
{
#line 99
* (volatile uint32_t *)(0x40E00024 + (108 < 96 ? ((108 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (108 & 0x1f);
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t PMICM$GPIOIRQControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = PXA27XGPIOIntM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 320 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static inline result_t PXA27XInterruptM$PXA27XIrq$allocate(uint8_t id)
{
return PXA27XInterruptM$allocate(id, FALSE, TOSH_IRP_TABLE[id]);
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t PXA27XGPIOIntM$GPIOIrq0$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(8);
#line 45
#line 45
return result;
#line 45
}
#line 45
inline static result_t PXA27XGPIOIntM$GPIOIrq1$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(9);
#line 45
#line 45
return result;
#line 45
}
#line 45
inline static result_t PXA27XGPIOIntM$GPIOIrq$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(10);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 51 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$init(void)
#line 51
{
return SUCCESS;
}
# 56 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t PMICM$Leds$init(void){
#line 56
unsigned char result;
#line 56
#line 56
result = NoLeds$Leds$init();
#line 56
#line 56
return result;
#line 56
}
#line 56
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t PMICM$PI2CInterrupt$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(6);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 65 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static inline int PXA27XUSBClientM$DynQueue_getLength(PXA27XUSBClientM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return 0;
}
#line 73
return oDynQueue->iLength;
}
# 522 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$sendReport(uint8_t *data, uint32_t datalen, uint8_t type, uint8_t source, uint8_t channel)
#line 522
{
PXA27XUSBClientM$USBdata InStream;
uint8_t statetemp;
#line 524
uint8_t InTaskTemp;
PXA27XUSBClientM$DynQueue QueueTemp;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 527
statetemp = PXA27XUSBClientM$state;
#line 527
__nesc_atomic_end(__nesc_atomic); }
if (statetemp != 3) {
return;
}
if ((* (volatile uint32_t *)0x40600104 & (1 << (1 & 0x1f))) != 0) {
* (volatile uint32_t *)0x40600104 |= 1 << (1 & 0x1f);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 539
{
InStream = (PXA27XUSBClientM$USBdata )safe_malloc(sizeof(PXA27XUSBClientM$USBdata_t ));
InStream->channel = channel;
InStream->endpointDR = (volatile unsigned long *const )0x40600304;
InStream->fifosize = PXA27XUSBClientM$Device.oConfigurations[1]->oInterfaces[0]->oEndpoints[0]->wMaxPacketSize;
InStream->pindex = InStream->index = 0;
InStream->type = type;
InStream->source = source;
InStream->len = datalen;
InStream->src = data;
InStream->param = (uint8_t *)1;
}
#line 551
__nesc_atomic_end(__nesc_atomic); }
if (datalen <= 15871) {
InStream->type |= 0 << 2;
InStream->n = (uint8_t )(datalen / 62);
InStream->tlen = InStream->n * InStream->fifosize + 3 +
datalen % 62;
}
else {
#line 559
if (datalen <= 3997695) {
InStream->type |= 1 << 2;
InStream->n = (uint16_t )(datalen / 61);
InStream->tlen = InStream->n * InStream->fifosize + 4 +
datalen % 61;
}
else {
#line 565
if (datalen <= 0xFFFFFFFF) {
InStream->type |= 2 << 2;
InStream->n = datalen / 61;
InStream->tlen = InStream->n * InStream->fifosize + 6 +
datalen % 59;
}
else {
}
}
}
#line 574
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 574
InTaskTemp = PXA27XUSBClientM$InTask;
#line 574
__nesc_atomic_end(__nesc_atomic); }
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 575
QueueTemp = PXA27XUSBClientM$InQueue;
#line 575
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$DynQueue_enqueue(QueueTemp, InStream);
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) == 1 && InTaskTemp == 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 578
PXA27XUSBClientM$InTask = 1;
#line 578
__nesc_atomic_end(__nesc_atomic); }
TOS_post(PXA27XUSBClientM$sendIn);
}
}
#line 389
static inline result_t PXA27XUSBClientM$SendJTPacket$send(uint8_t channel, uint8_t *data, uint32_t numBytes, uint8_t type)
#line 389
{
uint8_t statetemp;
#line 391
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 391
statetemp = PXA27XUSBClientM$state;
#line 391
__nesc_atomic_end(__nesc_atomic); }
if (statetemp != 3) {
return FAIL;
}
#line 394
PXA27XUSBClientM$sendReport(data, numBytes, type, 1, channel);
return SUCCESS;
}
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
inline static result_t BluSHM$USBSend$send(uint8_t *arg_0x406141a8, uint32_t arg_0x40614340, uint8_t arg_0x406144c8){
#line 20
unsigned char result;
#line 20
#line 20
result = PXA27XUSBClientM$SendJTPacket$send(0U, arg_0x406141a8, arg_0x40614340, arg_0x406144c8);
#line 20
#line 20
return result;
#line 20
}
#line 20
# 90 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
inline static void BluSHM$DynQueue_shiftgrow(BluSHM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return;
}
if (oDynQueue->index > 2 && oDynQueue->index > oDynQueue->iPhysLength / 8) {
memmove((void *)oDynQueue->ppvQueue, (void *)(oDynQueue->ppvQueue + oDynQueue->index), sizeof(void *) * oDynQueue->iLength);
oDynQueue->index = 0;
}
else {
oDynQueue->iPhysLength *= 2;
oDynQueue->ppvQueue = (const void **)safe_realloc(oDynQueue->ppvQueue,
sizeof(void *) * oDynQueue->iPhysLength);
}
}
# 301 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$printWritePMICSlaveAddressError(void)
#line 301
{
trace(DBG_USR1, "FATAL ERROR: writePMIC() Unable to write slave address\r\n");
}
#line 119
static inline void PMICM$returnPI2CBus(void)
#line 119
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 120
{
PMICM$accessingPMIC = FALSE;
}
#line 122
__nesc_atomic_end(__nesc_atomic); }
}
#line 305
static inline void PMICM$printWritePMICRegisterAddressError(void)
#line 305
{
trace(DBG_USR1, "FATAL ERROR: writePMIC() Unable to write target register address\r\n");
}
static inline void PMICM$printWritePMICWriteError(void)
#line 309
{
trace(DBG_USR1, "FATAL ERROR: writePMIC() Unable to write value\r\n");
}
# 101 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPotC.nc"
static inline result_t HPLPotC$Pot$finalise(void)
#line 101
{
return SUCCESS;
}
# 74 "/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"
inline static result_t PotM$HPLPot$finalise(void){
#line 74
unsigned char result;
#line 74
#line 74
result = HPLPotC$Pot$finalise();
#line 74
#line 74
return result;
#line 74
}
#line 74
# 90 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPotC.nc"
static inline result_t HPLPotC$Pot$increase(void)
#line 90
{
return SUCCESS;
}
# 67 "/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"
inline static result_t PotM$HPLPot$increase(void){
#line 67
unsigned char result;
#line 67
#line 67
result = HPLPotC$Pot$increase();
#line 67
#line 67
return result;
#line 67
}
#line 67
# 79 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPotC.nc"
static inline result_t HPLPotC$Pot$decrease(void)
#line 79
{
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/HPLPot.nc"
inline static result_t PotM$HPLPot$decrease(void){
#line 59
unsigned char result;
#line 59
#line 59
result = HPLPotC$Pot$decrease();
#line 59
#line 59
return result;
#line 59
}
#line 59
# 93 "/opt/tinyos-1.x/tos/system/PotM.nc"
static inline void PotM$setPot(uint8_t value)
#line 93
{
uint8_t i;
#line 95
for (i = 0; i < 151; i++)
PotM$HPLPot$decrease();
for (i = 0; i < value; i++)
PotM$HPLPot$increase();
PotM$HPLPot$finalise();
PotM$potSetting = value;
}
static inline result_t PotM$Pot$init(uint8_t initialSetting)
#line 106
{
PotM$setPot(initialSetting);
return SUCCESS;
}
# 78 "/opt/tinyos-1.x/tos/interfaces/Pot.nc"
inline static result_t RealMain$Pot$init(uint8_t arg_0x40426ac0){
#line 78
unsigned char result;
#line 78
#line 78
result = PotM$Pot$init(arg_0x40426ac0);
#line 78
#line 78
return result;
#line 78
}
#line 78
# 88 "/opt/tinyos-1.x/tos/platform/imote2/sched.c"
static inline void TOSH_sched_init(void )
{
int i;
#line 91
sys_task_bitmask = TOSH_TASK_BITMASK;
sys_max_tasks = TOSH_MAX_TASKS;
TOSH_sched_free = 0;
TOSH_sched_full = 0;
for (i = 0; i < TOSH_MAX_TASKS; i++)
TOSH_queue[i].tp = NULL;
}
# 120 "/opt/tinyos-1.x/tos/system/tos.h"
static inline result_t rcombine(result_t r1, result_t r2)
{
return r1 == FAIL ? FAIL : r2;
}
# 44 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline result_t NeighborMgmtM$StdControl$init(void)
#line 44
{
NeighborMgmtM$initialize();
return SUCCESS;
}
# 54 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline result_t CascadesEngineM$StdControl$init(void)
#line 54
{
initQueue(&CascadesEngineM$sendQueue, CAS_SEND_QUEUE_SIZE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 56
CascadesEngineM$sendTaskBusy = FALSE;
#line 56
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CascadesRouterM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = CascadesEngineM$StdControl$init();
#line 63
result = rcombine(result, NeighborMgmtM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 374 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$StdControl$init(void)
#line 374
{
CascadesRouterM$initialize();
CascadesRouterM$SubControl$init();
;
return SUCCESS;
}
# 114 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$initialize(void)
#line 114
{
int l;
#line 116
EventReportM$seqno = 0;
EventReportM$gfSendBusy = FALSE;
EventReportM$taskBusy = FALSE;
for (l = 0; l < 6; l++)
EventReportM$gLevelMode[l] = EVENT_LEVEL_URGENT;
initQueue(&EventReportM$sendQueue, 3);
initBufferPool(&EventReportM$buffQueue, 3, &EventReportM$eventBuffer[0]);
}
#line 145
static inline result_t EventReportM$StdControl$init(void)
#line 145
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 146
EventReportM$initialize();
#line 146
__nesc_atomic_end(__nesc_atomic); }
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$EReportControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = EventReportM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 55 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdogM.nc"
static inline void PXA27XWatchdogM$PXA27XWatchdog$init(void)
#line 55
{
PXA27XWatchdogM$resetMoteRequest = FALSE;
}
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdog.nc"
inline static void HPLWatchdogM$PXA27XWatchdog$init(void){
#line 52
PXA27XWatchdogM$PXA27XWatchdog$init();
#line 52
}
#line 52
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLWatchdogM.nc"
static inline result_t HPLWatchdogM$StdControl$init(void)
#line 52
{
HPLWatchdogM$PXA27XWatchdog$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t WDTM$WDTControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = HPLWatchdogM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static result_t WDTM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 66 "/opt/tinyos-1.x/tos/system/WDTM.nc"
static inline result_t WDTM$StdControl$init(void)
#line 66
{
result_t ok1 = WDTM$TimerControl$init();
result_t ok2 = WDTM$WDTControl$init();
#line 69
WDTM$increment = 0;
#line 69
WDTM$remaining = 1;
return rcombine(ok1, ok2);
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$WDTControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = WDTM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 129 "build/imote2/RpcM.nc"
static inline result_t RpcM$StdControl$init(void)
#line 129
{
RpcM$sendMsgPtr = &RpcM$sendMsgBuf;
RpcM$processingCommand = FALSE;
RpcM$seqno = 0;
RpcM$taskBusy = FALSE;
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$RPCControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RpcM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 99 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$StdControl$init(void)
#line 99
{
SNMSM$RPCControl$init();
SNMSM$WDTControl$init();
SNMSM$EReportControl$init();
SNMSM$rstdelayCount = 0;
SNMSM$toBeRestart = FALSE;
return SUCCESS;
}
# 835 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$StdControl$init(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 837
{
TimeSyncM$skew = 0.0;
TimeSyncM$localAverage = 0;
TimeSyncM$offsetAverage = 0;
}
#line 841
__nesc_atomic_end(__nesc_atomic); }
#line 841
;
TimeSyncM$clearTable();
(
(TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = 0xFFFF;
TimeSyncM$rootid = 0xFFFF;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$processedMsg = &TimeSyncM$processedMsgBuffer;
TimeSyncM$state = TimeSyncM$STATE_INIT;
TimeSyncM$alreadySetTime = 0;
TimeSyncM$errTimes = 0;
TimeSyncM$hasGPSValid = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 863
TimeSyncM$missedSendStamps = TimeSyncM$missedReceiveStamps = 0;
#line 863
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 212 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$default$initDone(void)
#line 212
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$SplitControl$initDone(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$SplitControl$default$initDone();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 208 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$CC2420SplitControl$initDone(void)
#line 208
{
return CC2420RadioM$SplitControl$initDone();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420ControlM$SplitControl$initDone(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$CC2420SplitControl$initDone();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 108 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline void CC2420ControlM$taskInitDone(void)
#line 108
{
CC2420ControlM$SplitControl$initDone();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t HPLCC2420M$GPIOControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = PXA27XGPIOIntM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 96 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$StdControl$init(void)
#line 96
{
{
#line 98
* (volatile uint32_t *)(0x40E0000C + (34 < 96 ? ((34 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (34 < 96 ? ((34 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (34 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (34 < 96 ? ((34 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (34 & 0x1f));
#line 98
* (volatile uint32_t *)(0x40E00054 + ((34 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((34 & 0x7f) >> 4) * 4) & ~(3 << (34 & 0xf) * 2)) | (3 << (34 & 0xf) * 2);
}
#line 98
;
{
#line 99
* (volatile uint32_t *)(0x40E0000C + (35 < 96 ? ((35 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (35 < 96 ? ((35 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (35 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (35 < 96 ? ((35 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (35 & 0x1f));
#line 99
* (volatile uint32_t *)(0x40E00054 + ((35 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((35 & 0x7f) >> 4) * 4) & ~(3 << (35 & 0xf) * 2)) | (3 << (35 & 0xf) * 2);
}
#line 99
;
{
#line 100
* (volatile uint32_t *)(0x40E0000C + (41 < 96 ? ((41 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (41 < 96 ? ((41 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (41 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (41 < 96 ? ((41 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (41 & 0x1f));
#line 100
* (volatile uint32_t *)(0x40E00054 + ((41 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((41 & 0x7f) >> 4) * 4) & ~(3 << (41 & 0xf) * 2)) | (3 << (41 & 0xf) * 2);
}
#line 100
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 103
{
HPLCC2420M$gbDMAChannelInitDone = 0;
HPLCC2420M$gRadioOpInProgress = FALSE;
}
#line 110
__nesc_atomic_end(__nesc_atomic); }
#line 131
HPLCC2420M$GPIOControl$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420ControlM$HPLChipconControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = HPLCC2420M$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 129 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$SplitControl$init(void)
#line 129
{
uint8_t _state = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 133
{
if (CC2420ControlM$state == CC2420ControlM$IDLE_STATE) {
CC2420ControlM$state = CC2420ControlM$INIT_STATE;
_state = TRUE;
}
}
#line 138
__nesc_atomic_end(__nesc_atomic); }
if (!_state) {
return FAIL;
}
CC2420ControlM$HPLChipconControl$init();
CC2420ControlM$gCurrentParameters[CP_MAIN] = 0xf800;
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] = ((((0 << 11) | (
2 << 8)) | (3 << 6)) | (
1 << 5)) | (2 << 0);
CC2420ControlM$gCurrentParameters[CP_MDMCTRL1] = 20 << 6;
CC2420ControlM$gCurrentParameters[CP_RSSI] = 0xE080;
CC2420ControlM$gCurrentParameters[CP_SYNCWORD] = 0xA70F;
CC2420ControlM$gCurrentParameters[CP_TXCTRL] = ((((1 << 14) | (
1 << 13)) | (3 << 6)) | (
1 << 5)) | (CC2420_RFPOWER << 0);
CC2420ControlM$gCurrentParameters[CP_RXCTRL0] = (((((1 << 12) | (
2 << 8)) | (3 << 6)) | (
2 << 4)) | (1 << 2)) | (
1 << 0);
CC2420ControlM$gCurrentParameters[CP_RXCTRL1] = (((((1 << 11) | (
1 << 9)) | (1 << 6)) | (
1 << 4)) | (1 << 2)) | (
2 << 0);
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (1 << 14) | ((
357 + 5 * (CC2420_CHANNEL - 11)) << 0);
CC2420ControlM$gCurrentParameters[CP_SECCTRL0] = (((1 << 8) | (
1 << 7)) | (1 << 6)) | (
1 << 2);
CC2420ControlM$gCurrentParameters[CP_SECCTRL1] = 0;
CC2420ControlM$gCurrentParameters[CP_BATTMON] = 0;
CC2420ControlM$gCurrentParameters[CP_IOCFG0] = (127 << 0) | (
1 << 9);
CC2420ControlM$gCurrentParameters[CP_IOCFG1] = 0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 185
CC2420ControlM$state = CC2420ControlM$INIT_STATE_DONE;
#line 185
__nesc_atomic_end(__nesc_atomic); }
TOS_post(CC2420ControlM$taskInitDone);
return SUCCESS;
}
# 64 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$CC2420SplitControl$init(void){
#line 64
unsigned char result;
#line 64
#line 64
result = CC2420ControlM$SplitControl$init();
#line 64
#line 64
return result;
#line 64
}
#line 64
# 59 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
static inline result_t RandomLFSR$Random$init(void)
#line 59
{
{
}
#line 60
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 61
{
RandomLFSR$shiftReg = 119 * 119 * (TOS_LOCAL_ADDRESS + 1);
RandomLFSR$initSeed = RandomLFSR$shiftReg;
RandomLFSR$mask = 137 * 29 * (TOS_LOCAL_ADDRESS + 1);
}
#line 65
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 57 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static result_t CC2420RadioM$Random$init(void){
#line 57
unsigned char result;
#line 57
#line 57
result = RandomLFSR$Random$init();
#line 57
#line 57
return result;
#line 57
}
#line 57
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t TimerJiffyAsyncM$OSTIrq$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(7);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 31 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$StdControl$init(void)
{
TimerJiffyAsyncM$OSTIrq$allocate();
* (volatile uint32_t *)0x40A000C8 = ((1 << 7) | (1 << 3)) | (0x4 & 0x7);
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420RadioM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerJiffyAsyncM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 191 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$init(void)
#line 191
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 193
{
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE;
CC2420RadioM$currentDSN = 0;
CC2420RadioM$bAckEnable = FALSE;
CC2420RadioM$bPacketReceiving = FALSE;
CC2420RadioM$rxbufptr = &CC2420RadioM$RxBuf;
CC2420RadioM$rxbufptr->length = 0;
}
#line 200
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$TimerControl$init();
CC2420RadioM$Random$init();
CC2420RadioM$LocalAddr = TOS_LOCAL_ADDRESS;
return CC2420RadioM$CC2420SplitControl$init();
}
#line 186
static inline result_t CC2420RadioM$StdControl$init(void)
#line 186
{
return CC2420RadioM$SplitControl$init();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$RadioControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = CC2420RadioM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 60 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$Control$init(void)
#line 60
{
{
}
#line 61
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 62
{
UARTM$state = FALSE;
}
#line 64
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t FramerM$ByteControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = UARTM$Control$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 292 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$StdControl$init(void)
#line 292
{
FramerM$HDLCInitialize();
return FramerM$ByteControl$init();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$UARTControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = FramerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static result_t GenericCommProM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 176 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline bool GenericCommProM$Control$init(void)
#line 176
{
bool ok = SUCCESS;
bool status = SUCCESS;
uint8_t ind;
;
ok = GenericCommProM$TimerControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = GenericCommProM$UARTControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = GenericCommProM$RadioControl$init();
status = status && ok;
if (ok != SUCCESS) {
;
}
ok = initQueue(&GenericCommProM$sendQueue, COMM_SEND_QUEUE_SIZE);
status = status && ok;
if (ok != SUCCESS) {
;
}
#line 219
GenericCommProM$state = FALSE;
GenericCommProM$sendTaskBusy = FALSE;
GenericCommProM$recvTaskBusy = FALSE;
GenericCommProM$swapMsgPtr = &GenericCommProM$swapBuf;
GenericCommProM$lastCount = 0;
GenericCommProM$counter = 0;
GenericCommProM$radioRecvActive = FALSE;
GenericCommProM$radioSendActive = FALSE;
GenericCommProM$wdtTimerCnt = 0;
GenericCommProM$toSend = TRUE;
for (ind = 0; ind < COMM_SEND_QUEUE_SIZE; ind++) {
GenericCommProM$bkHeader[ind].valid = FALSE;
GenericCommProM$bkHeader[ind].length = 0;
GenericCommProM$bkHeader[ind].type = 0;
GenericCommProM$bkHeader[ind].group = 0;
GenericCommProM$bkHeader[ind].msgPtr = 0;
GenericCommProM$bkHeader[ind].addr = 0;
}
if (status == SUCCESS) {
;
}
else {
;
}
return status;
}
# 225 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$StdControl$init(void)
#line 225
{
int n;
MultiHopLQI$gRecentIndex = 0;
for (n = 0; n < 45; n++) {
MultiHopLQI$gRecentPacketSender[n] = TOS_BCAST_ADDR;
MultiHopLQI$gRecentPacketSeqNo[n] = 0;
}
MultiHopLQI$gRecentOriginIndex = 0;
for (n = 0; n < 45; n++) {
MultiHopLQI$gRecentOriginPacketSender[n] = TOS_BCAST_ADDR;
MultiHopLQI$gRecentOriginPacketSeqNo[n] = 0;
MultiHopLQI$gRecentOriginPacketTTL[n] = 31;
}
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$gCurrentSeqNo = 0;
MultiHopLQI$gUpdateInterval = MultiHopLQI$BEACON_PERIOD;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 250
MultiHopLQI$msgBufBusy = FALSE;
#line 250
__nesc_atomic_end(__nesc_atomic); }
MultiHopLQI$localBeSink = FALSE;
if (TOS_LOCAL_ADDRESS == MultiHopLQI$BASE_STATION_ADDRESS) {
MultiHopLQI$gbCurrentParent = TOS_UART_ADDR;
MultiHopLQI$gbCurrentParentCost = 0;
MultiHopLQI$gbCurrentLinkEst = 0;
MultiHopLQI$gbLinkQuality = 110;
MultiHopLQI$gbCurrentHopCount = 0;
MultiHopLQI$gbCurrentCost = 0;
MultiHopLQI$localBeSink = TRUE;
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MultiHopEngineM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = MultiHopLQI$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 85 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline void MultiHopEngineM$initialize(void)
{
uint8_t ind;
#line 88
MultiHopEngineM$sendTaskBusy = FALSE;
MultiHopEngineM$numberOfSendSuccesses = 0;
MultiHopEngineM$numberOfSendFailures = 0;
MultiHopEngineM$numOfSuccessiveFailures = 0;
MultiHopEngineM$messageIsRetransmission = FALSE;
MultiHopEngineM$useMhopPriority = 1;
MultiHopEngineM$numOfPktProcessing = 0;
MultiHopEngineM$beRadioActive = FALSE;
MultiHopEngineM$beParentActive = FALSE;
MultiHopEngineM$wdtTimerCnt = 0;
MultiHopEngineM$localSendFail = 0;
MultiHopEngineM$numLocalPendingPkt = 0;
MultiHopEngineM$falseType = 0;
for (ind = 0; ind < 40; ind++) {
MultiHopEngineM$queueEntryInfo[ind].valid = FALSE;
MultiHopEngineM$queueEntryInfo[ind].AMID = 0;
MultiHopEngineM$queueEntryInfo[ind].resend = FALSE;
MultiHopEngineM$queueEntryInfo[ind].length = 0;
MultiHopEngineM$queueEntryInfo[ind].originalTOSPtr = (void *)0;
MultiHopEngineM$queueEntryInfo[ind].msgPtr = (void *)0;
}
}
# 228 "/home/xu/oasis/system/TinyDWFQ.h"
static inline void initializeVirtualQueue(TinyDWFQPtr queue)
{
uint8_t i;
#line 231
for (i = 0; i < NUM_VIRTUAL_QUEUES; i++)
{
queue->virtualQueues[i][VQ_TAIL] = queue->virtualQueues[i][VQ_HEAD] = -1;
queue->numOfElements_VQ[i] = 0;
queue->numOfElements_VQ_Processing[i] = 0;
switch (i)
{
case 0: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_0_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_0_FREE_TAIL;
queue->element[VQ_0_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_0;
break;
case 1: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_1_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_1_FREE_TAIL;
queue->element[VQ_1_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_1;
break;
case 2: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_2_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_2_FREE_TAIL;
queue->element[VQ_2_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_2;
break;
case 3: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_3_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_3_FREE_TAIL;
queue->element[VQ_3_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_3;
break;
case 4: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_4_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_4_FREE_TAIL;
queue->element[VQ_4_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_4;
break;
case 5: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_5_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_5_FREE_TAIL;
queue->element[VQ_5_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_5;
break;
case 6: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_6_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_6_FREE_TAIL;
queue->element[VQ_6_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_6;
break;
case 7: queue->virtualQueues[i][VQ_FREE_HEAD] = VQ_7_FREE_HEAD;
queue->virtualQueues[i][VQ_FREE_TAIL] = VQ_7_FREE_TAIL;
queue->element[VQ_7_FREE_TAIL].next = -1;
queue->maxNumOfElementPerVQ[i] = MAX_VQ_7;
break;
}
}
}
#line 165
static inline result_t init_TinyDWFQ(TinyDWFQPtr queue, uint8_t size)
{
int8_t i;
#line 167
int8_t vqIndex;
if (size > TINYDWFQ_SIZE || size <= 0)
{
;
return FAIL;
}
queue->size = size;
queue->total = 0;
queue->head[FREE_TINYDWFQ] = 0;
queue->tail[FREE_TINYDWFQ] = queue->size - 1;
queue->head[PENDING_TINYDWFQ] = queue->tail[PENDING_TINYDWFQ] = -1;
queue->head[PROCESSING_TINYDWFQ] = queue->tail[PROCESSING_TINYDWFQ] = -1;
queue->head[NOT_ACKED_TINYDWFQ] = queue->tail[NOT_ACKED_TINYDWFQ] = -1;
queue->numOfElements_pending = 0;
queue->numOfElements_processing = 0;
queue->numOfElements_notAcked = 0;
vqIndex = 1;
for (i = 0; i < size; i++)
{
queue->element[i].status = FREE_TINYDWFQ;
queue->element[i].obj = (void *)0;
queue->element[i].retry = 0;
queue->element[i].priority = 0;
queue->element[i].qos = -1;
if (VQ_0_FREE_HEAD <= i && i <= VQ_0_FREE_TAIL) {
queue->element[i].vqIndex = 0;
}
else {
#line 201
if (VQ_1_FREE_HEAD <= i && i <= VQ_1_FREE_TAIL) {
queue->element[i].vqIndex = 1;
}
else {
#line 203
if (VQ_2_FREE_HEAD <= i && i <= VQ_2_FREE_TAIL) {
queue->element[i].vqIndex = 2;
}
else {
#line 205
if (VQ_3_FREE_HEAD <= i && i <= VQ_3_FREE_TAIL) {
queue->element[i].vqIndex = 3;
}
else {
#line 207
if (VQ_4_FREE_HEAD <= i && i <= VQ_4_FREE_TAIL) {
queue->element[i].vqIndex = 4;
}
else {
#line 209
if (VQ_5_FREE_HEAD <= i && i <= VQ_5_FREE_TAIL) {
queue->element[i].vqIndex = 5;
}
else {
#line 211
if (VQ_6_FREE_HEAD <= i && i <= VQ_6_FREE_TAIL) {
queue->element[i].vqIndex = 6;
}
else {
#line 213
if (VQ_7_FREE_HEAD <= i && i <= VQ_7_FREE_TAIL) {
queue->element[i].vqIndex = 7;
}
}
}
}
}
}
}
}
#line 216
queue->element[i].prev = i - 1;
if (i == size - 1) {
queue->element[i].next = -1;
}
else {
#line 220
queue->element[i].next = i + 1;
}
}
initializeVirtualQueue(queue);
return SUCCESS;
}
# 121 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$StdControl$init(void)
{
init_TinyDWFQ(&MultiHopEngineM$sendQueue, 40);
initBufferPool(&MultiHopEngineM$buffQueue, 40, &MultiHopEngineM$poolBuffer[0]);
MultiHopEngineM$initialize();
return MultiHopEngineM$SubControl$init();
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t RTCClockM$OSTIrq$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(7);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 39 "/home/xu/oasis/system/platform/imote2/RTC/RTCClockM.nc"
static inline result_t RTCClockM$StdControl$init(void)
#line 39
{
RTCClockM$OSTIrq$allocate();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t RealTimeM$ClockControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RTCClockM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 95 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$StdControl$init(void)
#line 95
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 96
{
RealTimeM$localTime = 0;
RealTimeM$mState = 0;
RealTimeM$queue_head = RealTimeM$queue_tail = -1;
RealTimeM$queue_size = 0;
RealTimeM$uc_fire_interval = UC_FIRE_INTERVAL;
RealTimeM$uc_fire_point = RealTimeM$uc_fire_interval;
RealTimeM$adjustInterval = 0;
RealTimeM$adjustCounter = 0;
RealTimeM$taskBusy = FALSE;
RealTimeM$syncMode = DEFAULT_SYNC_MODE;
RealTimeM$is_synced = FALSE;
RealTimeM$init_sync = FALSE;
RealTimeM$timerCount = 0;
RealTimeM$localTime_t = 0;
RealTimeM$globaltime_t = 0;
RealTimeM$globaltime_tHist = 0;
RealTimeM$timerBusy = FALSE;
RealTimeM$realTimeFired = TRUE;
}
#line 115
__nesc_atomic_end(__nesc_atomic); }
RealTimeM$ClockControl$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$TimerControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RealTimeM$StdControl$init();
#line 63
result = rcombine(result, TimerM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static result_t GPSSensorM$GPIOControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = PXA27XGPIOIntM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 124 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setFCR(uint32_t val)
#line 124
{
#line 124
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x08) = val;
}
# 55 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setFCR(uint32_t arg_0x40c4a3d0){
#line 55
HplPXA27xBTUARTP$UART$setFCR(arg_0x40c4a3d0);
#line 55
}
#line 55
# 127 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setMCR(uint32_t val)
#line 127
{
#line 127
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x10) = val;
}
# 60 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setMCR(uint32_t arg_0x40c49068){
#line 60
HplPXA27xBTUARTP$UART$setMCR(arg_0x40c49068);
#line 60
}
#line 60
# 125 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setLCR(uint32_t val)
#line 125
{
#line 125
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) = val;
}
# 57 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setLCR(uint32_t arg_0x40c4a878){
#line 57
HplPXA27xBTUARTP$UART$setLCR(arg_0x40c4a878);
#line 57
}
#line 57
# 109 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setDLH(uint32_t val)
#line 109
{
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) |= 1 << 7;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x04) = val;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) &= ~(1 << 7);
}
# 47 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setDLH(uint32_t arg_0x40c20100){
#line 47
HplPXA27xBTUARTP$UART$setDLH(arg_0x40c20100);
#line 47
}
#line 47
# 97 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setDLL(uint32_t val)
#line 97
{
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) |= 1 << 7;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0) = val;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) &= ~(1 << 7);
}
# 44 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setDLL(uint32_t arg_0x40c21928){
#line 44
HplPXA27xBTUARTP$UART$setDLL(arg_0x40c21928);
#line 44
}
#line 44
# 395 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialCntl$configPort(uint32_t baudrate,
uint8_t databits,
uart_parity_t parity,
uint8_t stopbits,
bool flow_cntl)
#line 399
{
uint32_t uiDivisor;
uint32_t valLCR = 0;
uint32_t valMCR = 1 << 3;
uiDivisor = 921600 / baudrate;
if (uiDivisor & 0xFFFF0000 || uiDivisor == 0) {
return SUCCESS;
}
if (databits > 8 || databits < 5) {
return SUCCESS;
}
valLCR |= (databits - 5) & 0x3;
switch (parity) {
case EVEN:
valLCR |= 1 << 4;
case ODD:
valLCR |= 1 << 3;
break;
case NONE:
break;
default:
return SUCCESS;
break;
}
if (stopbits > 2 || stopbits < 1) {
return SUCCESS;
}
else {
#line 433
if (stopbits == 2) {
valLCR |= 1 << 2;
}
}
if (flow_cntl) {
valMCR |= 1 << 5;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 441
{
HalPXA27xBTUARTP$UART$setDLL(uiDivisor & 0xFF);
HalPXA27xBTUARTP$UART$setDLH((uiDivisor >> 8) & 0xFF);
HalPXA27xBTUARTP$UART$setLCR(valLCR);
HalPXA27xBTUARTP$UART$setMCR(valMCR);
}
#line 446
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 325 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static inline void PXA27XInterruptM$PXA27XIrq$enable(uint8_t id)
{
PXA27XInterruptM$enable(id);
return;
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void HplPXA27xBTUARTP$UARTIrq$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(21);
#line 46
}
#line 46
#line 45
inline static result_t HplPXA27xBTUARTP$UARTIrq$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(21);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 61 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline result_t HplPXA27xBTUARTP$UControl$init(void)
#line 61
{
bool isInited;
/* atomic removed: atomic calls only */
#line 64
{
isInited = HplPXA27xBTUARTP$m_fInit;
HplPXA27xBTUARTP$m_fInit = TRUE;
}
if (!isInited) {
* (volatile uint32_t *)0x41300004 |= 1 << 7;
HplPXA27xBTUARTP$UARTIrq$allocate();
HplPXA27xBTUARTP$UARTIrq$enable();
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) |= 1 << 7;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0) = 0x60;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x04) = 0x00;
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x0C) &= ~(1 << 7);
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t HalPXA27xBTUARTP$ChanControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = HplPXA27xBTUARTP$UControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 116 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline result_t HalPXA27xBTUARTP$SerialControl$init(void)
#line 116
{
result_t error = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 120
{
{
#line 122
* (volatile uint32_t *)(0x40E0000C + (42 < 96 ? ((42 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (42 < 96 ? ((42 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (42 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (42 < 96 ? ((42 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (42 & 0x1f));
#line 122
* (volatile uint32_t *)(0x40E00054 + ((42 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((42 & 0x7f) >> 4) * 4) & ~(3 << (42 & 0xf) * 2)) | (1 << (42 & 0xf) * 2);
}
#line 122
;
{
#line 123
* (volatile uint32_t *)(0x40E0000C + (43 < 96 ? ((43 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (43 < 96 ? ((43 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (43 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (43 < 96 ? ((43 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (43 & 0x1f));
#line 123
* (volatile uint32_t *)(0x40E00054 + ((43 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((43 & 0x7f) >> 4) * 4) & ~(3 << (43 & 0xf) * 2)) | (2 << (43 & 0xf) * 2);
}
#line 123
;
HalPXA27xBTUARTP$ChanControl$init();
HalPXA27xBTUARTP$txCurrentBuf = HalPXA27xBTUARTP$rxCurrentBuf = (void *)0;
HalPXA27xBTUARTP$gbUsingUartStreamSendIF = FALSE;
HalPXA27xBTUARTP$gbUsingUartStreamRcvIF = FALSE;
HalPXA27xBTUARTP$gbRcvByteEvtEnabled = TRUE;
HalPXA27xBTUARTP$gulFCRShadow = (((1 << 0) | (1 << 1)) | (1 << 2)) | ((0 & 0x3) << 6);
}
#line 132
__nesc_atomic_end(__nesc_atomic); }
error = HalPXA27xBTUARTP$HalPXA27xSerialCntl$configPort(HalPXA27xBTUARTP$defaultRate, 8, NONE, 1, FALSE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 143
{
#line 143
HalPXA27xBTUARTP$UART$setFCR(HalPXA27xBTUARTP$gulFCRShadow);
}
#line 144
__nesc_atomic_end(__nesc_atomic); }
#line 144
return error;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GPSSensorM$GPSSerialControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = HalPXA27xBTUARTP$SerialControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 118 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$initialize(void)
#line 118
{
GPSSensorM$dataCount = 0;
GPSSensorM$rawCount = 0;
GPSSensorM$timeCount = 0;
GPSSensorM$ppsIndex = 0;
GPSSensorM$last_pps_index = 0;
GPSSensorM$gLocalTime = 0;
GPSSensorM$checkTimerOn = FALSE;
GPSSensorM$alreadySetTime = FALSE;
GPSSensorM$hasGPS = FALSE;
GPSSensorM$NMEAData = (void *)0;
GPSSensorM$RAWData = (void *)0;
GPSSensorM$skew = 0.0;
GPSSensorM$localAverage = 0;
GPSSensorM$offsetAverage = 0;
GPSSensorM$tableEntries = 0;
GPSSensorM$numEntries = 0;
GPSSensorM$adjustTime = 0;
GPSSensorM$samplingReady = FALSE;
GPSSensorM$samplingStart = FALSE;
}
static inline result_t GPSSensorM$StdControl$init(void)
#line 143
{
if (GPSSensorM$initialized != TRUE) {
GPSSensorM$initialize();
GPSSensorM$clearTable();
GPSSensorM$GPSSerialControl$init();
GPSSensorM$GPIOControl$init();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 149
GPSSensorM$initialized = TRUE;
#line 149
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t ADCM$ClockControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = RTCClockM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static result_t ADCM$InternalControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 70 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline result_t ADCM$StdControl$init(void)
#line 70
{
ADCM$InternalControl$init();
ADCM$ADCControl$init();
ADCM$ClockControl$init();
ADCM$time_flag = 0;
return SUCCESS;
}
# 99 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static inline void FlashManagerM$initialize(void)
#line 99
{
FlashManagerM$eraseTimerCount = 0;
FlashManagerM$FlashFlag = 0;
FlashManagerM$ProgID = 0;
FlashManagerM$RFChannel = 0;
FlashManagerM$numToWrite = 0;
FlashManagerM$alreadyStart = FALSE;
FlashManagerM$writeTaskBusy = FALSE;
}
static inline result_t FlashManagerM$StdControl$init(void)
#line 115
{
initQueue(&FlashManagerM$flashQueue, MAX_FLASH_NUM);
FlashManagerM$initialize();
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t DataMgmtM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = TimerM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 122 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline void DataMgmtM$initialize(void)
#line 122
{
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$processTaskBusy = FALSE;
DataMgmtM$presendTaskBusy = FALSE;
DataMgmtM$sysCheckCount = 0;
DataMgmtM$seqno = 0;
DataMgmtM$sendDoneFailCheckCount = 0;
DataMgmtM$sendQueueLen = 0;
DataMgmtM$Msg_length = 0;
DataMgmtM$sendDoneR_num = 0;
DataMgmtM$send_num = 0;
DataMgmtM$processloopCount = 0;
DataMgmtM$GlobaltaskCode = 0;
DataMgmtM$headSendQueue = (void *)0;
DataMgmtM$presendTaskCount = 0;
DataMgmtM$processTaskCount = 0;
DataMgmtM$trynextSendCount = 0;
DataMgmtM$allocbuffercount = 0;
DataMgmtM$f_allocbuffercount = 0;
DataMgmtM$freebuffercount = 0;
DataMgmtM$nothingtosend = 0;
DataMgmtM$batchTimerCount = 0;
start_point = 0;
end_point = 0;
sta_period = MAX_STA_PERIOD;
lta_period = MAX_LTA_PERIOD;
}
# 90 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static inline result_t initSenorMem(MemQueue_t *queue, uint16_t size)
#line 90
{
int16_t i;
#line 92
if (size > MEM_QUEUE_SIZE || size <= 0) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 96
{
queue->size = size;
queue->total = 0;
queue->head[FREEMEM] = 0;
queue->tail[FREEMEM] = size - 1;
for (i = 1; i < NUM_STATUS; i++) {
queue->head[i] = queue->tail[i] = -1;
}
for (i = 0; i < size; i++) {
queue->element[i].time = 0;
queue->element[i].interval = 0;
queue->element[i].next = i + 1;
queue->element[i].prev = i - 1;
queue->element[i].size = 0;
queue->element[i].priority = 0;
queue->element[i].status = FREEMEM;
}
queue->element[i].next = -1;
}
#line 115
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 157 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$StdControl$init(void)
#line 157
{
initBufferPool(&DataMgmtM$buffQueue, MAX_SENSING_QUEUE_SIZE, DataMgmtM$buffMsg);
initQueue(&DataMgmtM$sendQueue, MAX_SENSING_QUEUE_SIZE);
initSenorMem(&DataMgmtM$sensorMem, MEM_QUEUE_SIZE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 161
DataMgmtM$initialize();
#line 161
__nesc_atomic_end(__nesc_atomic); }
DataMgmtM$SubControl$init();
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$SubControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = DataMgmtM$StdControl$init();
#line 63
result = rcombine(result, FlashManagerM$StdControl$init());
#line 63
result = rcombine(result, ADCM$StdControl$init());
#line 63
result = rcombine(result, GPSSensorM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 50 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
inline static result_t SmartSensingM$ADCControl$init(void){
#line 50
unsigned char result;
#line 50
#line 50
result = ADCM$ADCControl$init();
#line 50
#line 50
return result;
#line 50
}
#line 50
# 276 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$StdControl$init(void)
#line 276
{
SmartSensingM$ADCControl$init();
SmartSensingM$SubControl$init();
SmartSensingM$TimerControl$init();
return SUCCESS;
}
# 85 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline result_t SettingsM$StdControl$init(void)
#line 85
{
return SUCCESS;
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t PXA27XClockM$OSTIrq$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(7);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 109 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static inline result_t PXA27XClockM$StdControl$init(void)
#line 109
{
PXA27XClockM$OSTIrq$allocate();
return SUCCESS;
}
# 29 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static inline result_t BufferedSTUARTM$StdControl$init(void)
#line 29
{
initptrqueue(&outgoingQueue, defaultQueueSize);
do {
#line 32
initBufferInfoSet(&BufferedSTUARTM$receiveBufferInfoSet, BufferedSTUARTM$receiveBufferInfoInfo, 30);
#line 32
initBufferSet(&BufferedSTUARTM$receiveBufferSet, BufferedSTUARTM$receiveBufferStructs, (uint8_t **)BufferedSTUARTM$receiveBuffers, 30, ((10 + 31) >> 5) << 5);
}
while (
#line 32
0);
BufferedSTUARTM$gTxActive = FALSE;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t BluSHM$UartControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = BufferedSTUARTM$StdControl$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 233 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$StdControl$init(void)
#line 233
{
uint16_t i;
for (i = 0; i < 4; i++)
BluSHM$blush_history[i][0] = '\0';
trace_set(((DBG_USR1 | DBG_USR2) | DBG_USR3) | DBG_TEMP);
BluSHM$UartControl$init();
strncpy(BluSHM$blush_prompt, "BluSH>", 32);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 250
{
BluSHM$InQueue = BluSHM$DynQueue_new();
BluSHM$OutQueue = BluSHM$DynQueue_new();
}
#line 253
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t PXA27XDMAM$Interrupt$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(25);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 113 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline result_t PXA27XDMAM$StdControl$init(void)
#line 113
{
int i;
#line 116
if (PXA27XDMAM$gInitialized == FALSE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 117
{
for (i = 0; i < 4U; i++) {
PXA27XDMAM$mChannelArray[i].channelValid = FALSE;
}
}
#line 121
__nesc_atomic_end(__nesc_atomic); }
PXA27XDMAM$Interrupt$allocate();
PXA27XDMAM$gInitialized = TRUE;
}
return SUCCESS;
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static result_t PXA27XUSBClientM$USBInterrupt$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(11);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void PXA27XUSBClientM$USBAttached$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(13, arg_0x406321d8);
#line 45
}
#line 45
# 14 "/opt/tinyos-1.x/tos/platform/imote2/HPLUSBClientGPIOM.nc"
static inline result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$init(void)
#line 14
{
* (volatile uint32_t *)(0x40E0000C + (13 < 96 ? ((13 & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (13 & 0x1f));
* (volatile uint32_t *)(0x40E0000C + (88 < 96 ? ((88 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (88 & 0x1f);
* (volatile uint32_t *)(0x40E00018 + (88 < 96 ? ((88 & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (88 & 0x1f);
return SUCCESS;
}
# 19 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLUSBClientGPIO.nc"
inline static result_t PXA27XUSBClientM$HPLUSBClientGPIO$init(void){
#line 19
unsigned char result;
#line 19
#line 19
result = HPLUSBClientGPIOM$HPLUSBClientGPIO$init();
#line 19
#line 19
return result;
#line 19
}
#line 19
# 1227 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$writeHidReportDescriptor(void)
#line 1227
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1228
{
PXA27XUSBClientM$HidReport.wLength = PXA27XUSBClientM$Hid.wDescriptorLength;
PXA27XUSBClientM$HidReport.bString = (uint8_t *)safe_malloc(PXA27XUSBClientM$HidReport.wLength);
* (uint32_t *)PXA27XUSBClientM$HidReport.bString = ((0x06 | (0xA0 << 8)) | (0xFF << 16)) | (0x09 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 4) = ((0xA5 | (0xA1 << 8)) | (0x01 << 16)) | (0x09 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 8) = ((0xA6 | (0x09 << 8)) | (0xA7 << 16)) | (0x15 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 12) = ((0x80 | (0x25 << 8)) | (0x7F << 16)) | (0x75 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 16) = ((0x08 | (0x95 << 8)) | (0x40 << 16)) | (0x81 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 20) = ((0x02 | (0x09 << 8)) | (0xA9 << 16)) | (0x15 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 24) = ((0x80 | (0x25 << 8)) | (0x7F << 16)) | (0x75 << 24);
* (uint32_t *)(PXA27XUSBClientM$HidReport.bString + 28) = ((0x08 | (0x95 << 8)) | (0x40 << 16)) | (0x91 << 24);
* (uint8_t *)(PXA27XUSBClientM$HidReport.bString + 32) = 0x02;
* (uint8_t *)(PXA27XUSBClientM$HidReport.bString + 33) = 0xC0;
}
#line 1241
__nesc_atomic_end(__nesc_atomic); }
}
#line 1217
static inline void PXA27XUSBClientM$writeHidDescriptor(void)
#line 1217
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1218
{
PXA27XUSBClientM$Hid.bcdHID = 0x0110;
PXA27XUSBClientM$Hid.bCountryCode = 0;
PXA27XUSBClientM$Hid.bNumDescriptors = 1;
PXA27XUSBClientM$Hid.bDescriptorType = 0x22;
PXA27XUSBClientM$Hid.wDescriptorLength = 0x22;
}
#line 1224
__nesc_atomic_end(__nesc_atomic); }
}
# 11 "/opt/tinyos-1.x/tos/platform/imote2/UIDC.nc"
static inline uint32_t UIDC$UID$getUID(void)
#line 11
{
return * (uint32_t *)0x01FE0000;
}
# 20 "/opt/tinyos-1.x/tos/platform/pxa27x/UID.nc"
inline static uint32_t PXA27XUSBClientM$UID$getUID(void){
#line 20
unsigned int result;
#line 20
#line 20
result = UIDC$UID$getUID();
#line 20
#line 20
return result;
#line 20
}
#line 20
# 1244 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$writeStringDescriptor(void)
#line 1244
{
uint8_t i;
char *buf = (char *)safe_malloc(80);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1248
{
for (i = 0; i < 3 + 1; i++)
PXA27XUSBClientM$Strings[i] = (PXA27XUSBClientM$USBstring )safe_malloc(sizeof(PXA27XUSBClientM$__string_t ));
PXA27XUSBClientM$Strings[0]->bLength = 4;
PXA27XUSBClientM$Strings[0]->uMisc.wLANGID = 0x0409;
PXA27XUSBClientM$Strings[1]->uMisc.bString = "SNO";
PXA27XUSBClientM$Strings[2]->uMisc.bString = "Intel Mote 2 Embedded Device";
sprintf(buf, "%x", PXA27XUSBClientM$UID$getUID());
safe_realloc(buf, strlen(buf) + 1);
PXA27XUSBClientM$Strings[3]->uMisc.bString = buf;
for (i = 1; i < 3 + 1; i++)
PXA27XUSBClientM$Strings[i]->bLength = 2 + 2 * strlen(PXA27XUSBClientM$Strings[i]->uMisc.bString);
}
#line 1264
__nesc_atomic_end(__nesc_atomic); }
}
static inline void PXA27XUSBClientM$writeEndpointDescriptor(PXA27XUSBClientM$USBendpoint *endpoints, uint8_t config, uint8_t inter, uint8_t i)
#line 1267
{
PXA27XUSBClientM$USBendpoint End;
#line 1269
End = (PXA27XUSBClientM$USBendpoint )safe_malloc(sizeof(PXA27XUSBClientM$__endpoint_t ));
endpoints[i] = End;
End->bEndpointAddress = i + 1;
switch (config) {
case 1:
switch (inter) {
case 0:
switch (i) {
case 0:
End->bEndpointAddress |= 1 << (7 & 0x1f);
End->bmAttributes = 0x3;
End->wMaxPacketSize = 0x40;
End->bInterval = 0x01;
* (volatile uint32_t *)0x40600404 |= (((((1 << 25) | ((End->bEndpointAddress & 0xF) << 15)) | ((End->bmAttributes & 0x3) << 13)) | (((End->bEndpointAddress & (1 << (7 & 0x1f))) != 0) << 12)) | (End->wMaxPacketSize << 2)) | 1;
break;
case 1:
End->bmAttributes = 0x3;
End->wMaxPacketSize = 0x40;
End->bInterval = 0x01;
* (volatile uint32_t *)0x40600408 |= (((((1 << 25) | ((End->bEndpointAddress & 0xF) << 15)) | ((End->bmAttributes & 0x3) << 13)) | (((End->bEndpointAddress & (1 << (7 & 0x1f))) != 0) << 12)) | (End->wMaxPacketSize << 2)) | 1;
break;
}
break;
}
break;
}
}
static inline uint16_t PXA27XUSBClientM$writeInterfaceDescriptor(PXA27XUSBClientM$USBinterface *interfaces, uint8_t config, uint8_t i)
#line 1300
{
uint8_t j;
uint16_t length;
PXA27XUSBClientM$USBinterface Inter;
#line 1304
Inter = (PXA27XUSBClientM$USBinterface )safe_malloc(sizeof(PXA27XUSBClientM$__interface_t ));
interfaces[i] = Inter;
length = 9;
Inter->bInterfaceID = i;
switch (config) {
case 0:
switch (i) {
case 0:
Inter->bAlternateSetting = 0;
Inter->bNumEndpoints = 0;
Inter->bInterfaceClass = 0;
Inter->bInterfaceSubclass = 0;
Inter->bInterfaceProtocol = 0;
Inter->iInterface = 0;
break;
}
break;
case 1:
switch (i) {
case 0:
Inter->bAlternateSetting = 0;
Inter->bNumEndpoints = 2;
Inter->bInterfaceClass = 0x03;
Inter->bInterfaceSubclass = 0x00;
Inter->bInterfaceProtocol = 0x00;
Inter->iInterface = 0;
length += 0x09;
break;
}
}
if (Inter->bNumEndpoints > 0) {
Inter->oEndpoints = (PXA27XUSBClientM$USBendpoint *)safe_malloc(sizeof(PXA27XUSBClientM$__endpoint_t ) * Inter->bNumEndpoints);
length += Inter->bNumEndpoints * 7;
for (j = 0; j < Inter->bNumEndpoints; j++)
PXA27XUSBClientM$writeEndpointDescriptor(Inter->oEndpoints, config, i, j);
}
return length;
}
static inline void PXA27XUSBClientM$writeConfigurationDescriptor(PXA27XUSBClientM$USBconfiguration *configs, uint8_t i)
#line 1346
{
uint8_t j;
PXA27XUSBClientM$USBconfiguration Config;
#line 1349
Config = (PXA27XUSBClientM$USBconfiguration )safe_malloc(sizeof(PXA27XUSBClientM$__configuration_t ));
configs[i] = Config;
Config->wTotalLength = 9;
Config->bConfigurationID = i;
switch (i) {
case 0:
Config->bNumInterfaces = 1;
Config->iConfiguration = 0;
Config->bmAttributes = 0x80;
Config->MaxPower = 125;
break;
case 1:
Config->bNumInterfaces = 1;
Config->iConfiguration = 0;
Config->bmAttributes = 0x80;
Config->MaxPower = 125;
}
Config->oInterfaces = (PXA27XUSBClientM$USBinterface *)safe_malloc(sizeof(PXA27XUSBClientM$__interface_t ) * Config->bNumInterfaces);
for (j = 0; j < Config->bNumInterfaces; j++)
Config->wTotalLength += PXA27XUSBClientM$writeInterfaceDescriptor(Config->oInterfaces, i, j);
}
static inline void PXA27XUSBClientM$writeDeviceDescriptor(void)
#line 1376
{
uint8_t i;
#line 1378
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1378
{
PXA27XUSBClientM$Device.bcdUSB = 0x0110;
PXA27XUSBClientM$Device.bDeviceClass = PXA27XUSBClientM$Device.bDeviceSubclass = PXA27XUSBClientM$Device.bDeviceProtocol = 0;
PXA27XUSBClientM$Device.bMaxPacketSize0 = 16;
PXA27XUSBClientM$Device.idVendor = 0x042b;
PXA27XUSBClientM$Device.idProduct = 0x1337;
PXA27XUSBClientM$Device.bcdDevice = 0x0312;
PXA27XUSBClientM$Device.iManufacturer = 1;
PXA27XUSBClientM$Device.iProduct = 2;
PXA27XUSBClientM$Device.iSerialNumber = 3;
PXA27XUSBClientM$Device.bNumConfigurations = 2;
PXA27XUSBClientM$Device.oConfigurations = (PXA27XUSBClientM$USBconfiguration *)safe_malloc(sizeof(PXA27XUSBClientM$__configuration_t ) * PXA27XUSBClientM$Device.bNumConfigurations);
}
#line 1390
__nesc_atomic_end(__nesc_atomic); }
for (i = 0; i < PXA27XUSBClientM$Device.bNumConfigurations; i++)
PXA27XUSBClientM$writeConfigurationDescriptor(PXA27XUSBClientM$Device.oConfigurations, i);
}
#line 156
static inline result_t PXA27XUSBClientM$Control$init(void)
#line 156
{
uint8_t i;
PXA27XUSBClientM$DynQueue QueueTemp;
#line 159
if (PXA27XUSBClientM$init == 0) {
PXA27XUSBClientM$writeDeviceDescriptor();
PXA27XUSBClientM$writeStringDescriptor();
PXA27XUSBClientM$writeHidDescriptor();
PXA27XUSBClientM$writeHidReportDescriptor();
QueueTemp = PXA27XUSBClientM$DynQueue_new();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 166
PXA27XUSBClientM$InQueue = QueueTemp;
#line 166
__nesc_atomic_end(__nesc_atomic); }
QueueTemp = PXA27XUSBClientM$DynQueue_new();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 168
PXA27XUSBClientM$OutQueue = QueueTemp;
#line 168
__nesc_atomic_end(__nesc_atomic); }
}
PXA27XUSBClientM$HPLUSBClientGPIO$init();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 173
{
* (volatile uint32_t *)0x41300004 |= 1 << 11;
* (volatile uint32_t *)0x40600008 |= 1 << (27 & 0x1f);
* (volatile uint32_t *)0x40600008 |= 1 << (31 & 0x1f);
* (volatile uint32_t *)0x40600004 |= 1 << (0 & 0x1f);
* (volatile uint32_t *)0x40600004 |= 1 << (2 & 0x1f);
* (volatile uint32_t *)0x40600004 |= 1 << (4 & 0x1f);
for (i = 0; i < 4; i++) {
PXA27XUSBClientM$OutStream[i].endpointDR = (volatile unsigned long *const )0x40600308;
PXA27XUSBClientM$OutStream[i].fifosize = PXA27XUSBClientM$Device.oConfigurations[1]->oInterfaces[
0]->oEndpoints[1]->wMaxPacketSize;
PXA27XUSBClientM$OutStream[i].len = PXA27XUSBClientM$OutStream[i].index = PXA27XUSBClientM$OutStream[i].status =
PXA27XUSBClientM$OutStream[i].type = 0;
}
PXA27XUSBClientM$state = 0;
}
#line 190
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$USBAttached$enable(3);
PXA27XUSBClientM$USBInterrupt$allocate();
PXA27XUSBClientM$isAttached();
return SUCCESS;
}
# 47 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static inline result_t FlashM$StdControl$init(void)
#line 47
{
int i = 0;
#line 49
if (FlashM$init != 0) {
return SUCCESS;
}
#line 51
FlashM$init = 1;
for (i = 0; i < 16; i++)
FlashM$FlashPartitionState[i] = 0;
__asm volatile (
".equ FLASH_READARRAY,(0x00FF); .equ FLASH_CFIQUERY,(0x0098); .equ FLASH_READSTATUS,(0x0070); .equ FLASH_CLEARSTATUS,(0x0050); .equ FLASH_PROGRAMWORD,(0x0040); .equ FLASH_PROGRAMBUFFER,(0x00E8); .equ FLASH_ERASEBLOCK,(0x0020); .equ FLASH_DLOCKBLOCK,(0x0060); .equ FLASH_PROGRAMBUFFERCONF,(0x00D0); .equ FLASH_LOCKCONF,(0x0001); .equ FLASH_UNLOCKCONF,(0x00D0); .equ FLASH_ERASECONF,(0x00D0); .equ FLASH_OP_NOT_SUPPORTED,(0x10);");
#line 70
;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t RealMain$StdControl$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = FlashM$StdControl$init();
#line 63
result = rcombine(result, PXA27XUSBClientM$Control$init());
#line 63
result = rcombine(result, PXA27XGPIOIntM$StdControl$init());
#line 63
result = rcombine(result, PXA27XDMAM$StdControl$init());
#line 63
result = rcombine(result, BluSHM$StdControl$init());
#line 63
result = rcombine(result, PXA27XClockM$StdControl$init());
#line 63
result = rcombine(result, PMICM$StdControl$init());
#line 63
result = rcombine(result, SettingsM$StdControl$init());
#line 63
result = rcombine(result, SmartSensingM$StdControl$init());
#line 63
result = rcombine(result, MultiHopEngineM$StdControl$init());
#line 63
result = rcombine(result, GenericCommProM$Control$init());
#line 63
result = rcombine(result, TimeSyncM$StdControl$init());
#line 63
result = rcombine(result, SNMSM$StdControl$init());
#line 63
result = rcombine(result, CascadesRouterM$StdControl$init());
#line 63
result = rcombine(result, NeighborMgmtM$StdControl$init());
#line 63
#line 63
return result;
#line 63
}
#line 63
# 27 "/opt/tinyos-1.x/tos/platform/imote2/HPLUSBClientGPIOM.nc"
static inline result_t HPLUSBClientGPIOM$HPLUSBClientGPIO$checkConnection(void)
#line 27
{
if ((* (volatile uint32_t *)(0x40E00000 + (13 < 96 ? ((13 & 0x7f) >> 5) * 4 : 0x100)) & (1 << (13 & 0x1f))) != 0) {
return SUCCESS;
}
else {
#line 31
return FAIL;
}
}
# 35 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLUSBClientGPIO.nc"
inline static result_t PXA27XUSBClientM$HPLUSBClientGPIO$checkConnection(void){
#line 35
unsigned char result;
#line 35
#line 35
result = HPLUSBClientGPIOM$HPLUSBClientGPIO$checkConnection();
#line 35
#line 35
return result;
#line 35
}
#line 35
# 114 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
inline static void PXA27XUSBClientM$DynQueue_shiftshrink(PXA27XUSBClientM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return;
}
if (oDynQueue->index > 0) {
memmove((void *)oDynQueue->ppvQueue, (void *)(oDynQueue->ppvQueue + oDynQueue->index), sizeof(void *) * oDynQueue->iLength);
oDynQueue->index = 0;
}
oDynQueue->iPhysLength /= 2;
oDynQueue->ppvQueue = (const void **)safe_realloc(oDynQueue->ppvQueue,
sizeof(void *) * oDynQueue->iPhysLength);
}
# 167 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static inline result_t PXA27XClockM$Clock$setRate(uint32_t interval, uint32_t scale)
#line 167
{
PXA27XClockM$Clock$setInterval(interval);
#line 205
return SUCCESS;
}
# 96 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static result_t TimerM$Clock$setRate(uint32_t arg_0x408c5460, uint32_t arg_0x408c55f0){
#line 96
unsigned char result;
#line 96
#line 96
result = PXA27XClockM$Clock$setRate(arg_0x408c5460, arg_0x408c55f0);
#line 96
#line 96
return result;
#line 96
}
#line 96
# 159 "/opt/tinyos-1.x/tos/system/tos.h"
static inline void *nmemset(void *to, int val, size_t n)
{
char *cto = to;
while (n--) * cto++ = val;
return to;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t NeighborMgmtM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(18U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t NeighborMgmtM$Random$rand(void){
#line 63
unsigned short result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 49 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline result_t NeighborMgmtM$StdControl$start(void)
#line 49
{
uint16_t randomTime = NeighborMgmtM$Random$rand();
return NeighborMgmtM$Timer$start(TIMER_ONE_SHOT, (randomTime & 0xfff) + 1024);
}
# 381 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$StdControl$start(void)
#line 381
{
return SUCCESS;
}
# 151 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$StdControl$start(void)
#line 151
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$EReportControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = EventReportM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 59 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdogM.nc"
static inline void PXA27XWatchdogM$PXA27XWatchdog$enableWDT(uint32_t interval)
#line 59
{
* (volatile uint32_t *)0x40A0000C = * (volatile uint32_t *)0x40A00010 + interval;
* (volatile uint32_t *)0x40A00018 = 1;
}
# 61 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdog.nc"
inline static void HPLWatchdogM$PXA27XWatchdog$enableWDT(uint32_t arg_0x408a7340){
#line 61
PXA27XWatchdogM$PXA27XWatchdog$enableWDT(arg_0x408a7340);
#line 61
}
#line 61
# 57 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLWatchdogM.nc"
static inline result_t HPLWatchdogM$StdControl$start(void)
#line 57
{
HPLWatchdogM$PXA27XWatchdog$enableWDT(3250000);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t WDTM$WDTControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = HPLWatchdogM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t WDTM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(8U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 86 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static inline result_t TimerM$StdControl$start(void)
#line 86
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t WDTM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 73 "/opt/tinyos-1.x/tos/system/WDTM.nc"
static inline result_t WDTM$StdControl$start(void)
#line 73
{
result_t ok1 = WDTM$TimerControl$start();
result_t ok2 = WDTM$Timer$start(TIMER_REPEAT, WDTM$WDT_LATENCY);
#line 76
if (rcombine(ok1, ok2) == SUCCESS) {
return WDTM$WDTControl$start();
}
return FAIL;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$WDTControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = WDTM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 99 "/opt/tinyos-1.x/tos/system/WDTM.nc"
static inline result_t WDTM$WDT$start(int32_t interval)
#line 99
{
if (WDTM$increment == 0) {
WDTM$increment = interval;
WDTM$remaining = WDTM$increment;
return SUCCESS;
}
return FAIL;
}
# 45 "/opt/tinyos-1.x/tos/interfaces/WDT.nc"
inline static result_t SNMSM$WWDT$start(int32_t arg_0x40cb0b70){
#line 45
unsigned char result;
#line 45
#line 45
result = WDTM$WDT$start(arg_0x40cb0b70);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SNMSM$SNMSTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(7U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 142 "build/imote2/RpcM.nc"
static inline result_t RpcM$StdControl$start(void)
#line 142
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SNMSM$RPCControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RpcM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 122 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$StdControl$start(void)
#line 122
{
SNMSM$RPCControl$start();
SNMSM$SNMSTimer$start(TIMER_REPEAT, 100);
SNMSM$WWDT$start(1000);
SNMSM$WDTControl$start();
SNMSM$EReportControl$start();
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t TimeSyncM$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(9U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 868 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$StdControl$start(void)
#line 868
{
TimeSyncM$mode = TS_TIMER_MODE;
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->nodeID = TOS_LOCAL_ADDRESS;
TimeSyncM$Timer$start(TIMER_REPEAT, (uint32_t )1000 * TimeSyncM$BEACON_RATE);
return SUCCESS;
}
# 54 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420ControlM$HPLChipcon$write(uint8_t arg_0x40957918, uint16_t arg_0x40957aa8){
#line 54
unsigned char result;
#line 54
#line 54
result = HPLCC2420M$HPLCC2420$write(arg_0x40957918, arg_0x40957aa8);
#line 54
#line 54
return result;
#line 54
}
#line 54
# 412 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$enableAutoAck(void)
#line 412
{
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] |= 1 << 4;
return CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
}
# 192 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$enableAutoAck(void){
#line 192
unsigned char result;
#line 192
#line 192
result = CC2420ControlM$CC2420Control$enableAutoAck();
#line 192
#line 192
return result;
#line 192
}
#line 192
# 422 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$enableAddrDecode(void)
#line 422
{
CC2420ControlM$gCurrentParameters[CP_MDMCTRL0] |= 1 << 11;
return CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
}
# 206 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$enableAddrDecode(void){
#line 206
unsigned char result;
#line 206
#line 206
result = CC2420ControlM$CC2420Control$enableAddrDecode();
#line 206
#line 206
return result;
#line 206
}
#line 206
# 727 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$MacControl$enableAck(void)
#line 727
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 728
CC2420RadioM$bAckEnable = TRUE;
#line 728
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$CC2420Control$enableAddrDecode();
CC2420RadioM$CC2420Control$enableAutoAck();
}
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacControl.nc"
inline static void GenericCommProM$MacControl$enableAck(void){
#line 74
CC2420RadioM$MacControl$enableAck();
#line 74
}
#line 74
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLPowerManagementM.nc"
static inline uint8_t HPLPowerManagementM$PowerManagement$adjustPower(void)
#line 51
{
return 0;
}
# 41 "/opt/tinyos-1.x/tos/interfaces/PowerManagement.nc"
inline static uint8_t GenericCommProM$PowerManagement$adjustPower(void){
#line 41
unsigned char result;
#line 41
#line 41
result = HPLPowerManagementM$PowerManagement$adjustPower();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t GenericCommProM$MonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(11U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t GenericCommProM$ActivityTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(10U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420ControlM$HPLChipcon$cmd(uint8_t arg_0x40957408){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420$cmd(arg_0x40957408);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$CCA_GPIOInt$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(116, arg_0x406321d8);
#line 45
}
#line 45
inline static void HPLCC2420M$CCA_GPIOInt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(116);
#line 47
}
#line 47
#line 46
inline static void HPLCC2420M$CCA_GPIOInt$disable(void){
#line 46
PXA27XGPIOIntM$PXA27XGPIOInt$disable(116);
#line 46
}
#line 46
# 807 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$InterruptCCA$startWait(bool low_to_high)
#line 807
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 809
{
HPLCC2420M$CCA_GPIOInt$disable();
HPLCC2420M$CCA_GPIOInt$clear();
if (low_to_high) {
HPLCC2420M$CCA_GPIOInt$enable(1);
}
else {
HPLCC2420M$CCA_GPIOInt$enable(2);
}
}
#line 818
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420ControlM$CCA$startWait(bool arg_0x40959bc8){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420M$InterruptCCA$startWait(arg_0x40959bc8);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 368 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$OscillatorOn(void)
#line 368
{
uint16_t i;
uint8_t status;
i = 0;
#line 384
CC2420ControlM$HPLChipcon$write(0x1D, 24);
CC2420ControlM$CCA$startWait(TRUE);
status = CC2420ControlM$HPLChipcon$cmd(0x01);
return SUCCESS;
}
# 104 "/opt/tinyos-1.x/tos/platform/pxa27x/pxa27xhardware.h"
static inline void TOSH_wait(void)
{
__asm volatile ("nop");
__asm volatile ("nop");}
# 182 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_SET_CC_RSTN_PIN(void)
#line 182
{
#line 182
* (volatile uint32_t *)(0x40E00018 + (22 < 96 ? ((22 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (22 & 0x1f);
}
# 125 "/opt/tinyos-1.x/tos/platform/pxa27x/pxa27xhardware.h"
static __inline void TOSH_uwait(uint16_t usec)
{
uint32_t start;
#line 127
uint32_t mark = usec;
start = * (volatile uint32_t *)0x40A00010;
mark <<= 2;
mark *= 13;
mark >>= 2;
while (* (volatile uint32_t *)0x40A00010 - start < mark) ;
}
# 181 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_SET_CC_VREN_PIN(void)
#line 181
{
#line 181
* (volatile uint32_t *)(0x40E00018 + (115 < 96 ? ((115 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (115 & 0x1f);
}
# 400 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$VREFOn(void)
#line 400
{
TOSH_SET_CC_VREN_PIN();
TOSH_uwait(600);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t HPLCC2420M$GPIOControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = PXA27XGPIOIntM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 136 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$StdControl$start(void)
#line 136
{
* (volatile uint32_t *)0x41300004 |= 1 << 4;
* (volatile uint32_t *)0x41900004 = ((1 << 22) | ((8 & 0xF) << 10)) | ((8 & 0xF) << 6);
* (volatile uint32_t *)0x41900028 = 96 * 8;
* (volatile uint32_t *)0x41900000 = ((((1 & 0xFFF) << 8) | ((0 & 0x3) << 4)) | ((0x7 & 0xF) << 0)) | (1 << 7);
HPLCC2420M$GPIOControl$start();
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420ControlM$HPLChipconControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = HPLCC2420M$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 227 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$SplitControl$start(void)
#line 227
{
result_t status;
uint8_t _state = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 231
{
if (CC2420ControlM$state == CC2420ControlM$INIT_STATE_DONE) {
CC2420ControlM$state = CC2420ControlM$START_STATE;
_state = TRUE;
}
}
#line 236
__nesc_atomic_end(__nesc_atomic); }
if (!_state) {
return FAIL;
}
CC2420ControlM$HPLChipconControl$start();
CC2420ControlM$CC2420Control$VREFOn();
TOSH_CLR_CC_RSTN_PIN();
TOSH_wait();
TOSH_SET_CC_RSTN_PIN();
TOSH_wait();
status = CC2420ControlM$CC2420Control$OscillatorOn();
return status;
}
# 77 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$CC2420SplitControl$start(void){
#line 77
unsigned char result;
#line 77
#line 77
result = CC2420ControlM$SplitControl$start();
#line 77
#line 77
return result;
#line 77
}
#line 77
# 39 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$StdControl$start(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 41
TimerJiffyAsyncM$bSet = FALSE;
#line 41
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t CC2420RadioM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerJiffyAsyncM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 277 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$start(void)
#line 277
{
uint8_t chkstateRadio;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 280
chkstateRadio = CC2420RadioM$stateRadio;
#line 280
__nesc_atomic_end(__nesc_atomic); }
if (chkstateRadio == CC2420RadioM$DISABLED_STATE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 283
{
CC2420RadioM$stateRadio = CC2420RadioM$WARMUP_STATE;
CC2420RadioM$countRetry = 0;
CC2420RadioM$rxbufptr->length = 0;
}
#line 287
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$TimerControl$start();
return CC2420RadioM$CC2420SplitControl$start();
}
return FAIL;
}
#line 239
static inline void CC2420RadioM$startRadio(void)
#line 239
{
result_t success = FAIL;
#line 241
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 241
{
if (CC2420RadioM$stateRadio == CC2420RadioM$DISABLED_STATE_STARTTASK) {
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE;
success = SUCCESS;
}
}
#line 246
__nesc_atomic_end(__nesc_atomic); }
if (success == SUCCESS) {
CC2420RadioM$SplitControl$start();
}
}
static inline result_t CC2420RadioM$StdControl$start(void)
#line 253
{
result_t success = FAIL;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 263
{
if (CC2420RadioM$stateRadio == CC2420RadioM$DISABLED_STATE) {
if (TOS_post(CC2420RadioM$startRadio)) {
success = SUCCESS;
CC2420RadioM$stateRadio = CC2420RadioM$DISABLED_STATE_STARTTASK;
}
}
}
#line 271
__nesc_atomic_end(__nesc_atomic); }
return success;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$RadioControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = CC2420RadioM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void HPLFFUARTM$Interrupt$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(22);
#line 46
}
#line 46
#line 45
inline static result_t HPLFFUARTM$Interrupt$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(22);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 90 "/opt/tinyos-1.x/tos/platform/imote2/HPLFFUARTM.nc"
static inline void HPLFFUARTM$setBaudRate(uint8_t rate)
#line 90
{
switch (rate) {
case UART_BAUD_300:
* (volatile uint32_t *)0x40100000 = 0x0;
* (volatile uint32_t *)0x40100004 = 0xC;
break;
case UART_BAUD_1200:
* (volatile uint32_t *)0x40100000 = 0x0;
* (volatile uint32_t *)0x40100004 = 0x3;
break;
case UART_BAUD_2400:
* (volatile uint32_t *)0x40100000 = 0x80;
* (volatile uint32_t *)0x40100004 = 0x1;
break;
case UART_BAUD_4800:
* (volatile uint32_t *)0x40100000 = 0xC0;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_9600:
* (volatile uint32_t *)0x40100000 = 0x60;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_19200:
* (volatile uint32_t *)0x40100000 = 0x30;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_38400:
* (volatile uint32_t *)0x40100000 = 0x18;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_57600:
* (volatile uint32_t *)0x40100000 = 0x10;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_115200:
* (volatile uint32_t *)0x40100000 = 0x8;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_230400:
* (volatile uint32_t *)0x40100000 = 0x4;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_460800:
* (volatile uint32_t *)0x40100000 = 0x2;
* (volatile uint32_t *)0x40100004 = 0;
break;
case UART_BAUD_921600:
* (volatile uint32_t *)0x40100000 = 0x1;
* (volatile uint32_t *)0x40100004 = 0;
break;
default:
* (volatile uint32_t *)0x40100000 = 0x8;
* (volatile uint32_t *)0x40100004 = 0;
break;
}
}
# 331 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static inline void PXA27XInterruptM$PXA27XIrq$disable(uint8_t id)
{
PXA27XInterruptM$disable(id);
return;
}
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void HPLFFUARTM$Interrupt$disable(void){
#line 47
PXA27XInterruptM$PXA27XIrq$disable(22);
#line 47
}
#line 47
# 148 "/opt/tinyos-1.x/tos/platform/imote2/HPLFFUARTM.nc"
static inline result_t HPLFFUARTM$UART$init(void)
#line 148
{
{
#line 159
* (volatile uint32_t *)(0x40E0000C + (96 < 96 ? ((96 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (96 < 96 ? ((96 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (96 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (96 < 96 ? ((96 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (96 & 0x1f));
#line 159
* (volatile uint32_t *)(0x40E00054 + ((96 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((96 & 0x7f) >> 4) * 4) & ~(3 << (96 & 0xf) * 2)) | (3 << (96 & 0xf) * 2);
}
#line 159
;
{
#line 160
* (volatile uint32_t *)(0x40E0000C + (99 < 96 ? ((99 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (99 < 96 ? ((99 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (99 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (99 < 96 ? ((99 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (99 & 0x1f));
#line 160
* (volatile uint32_t *)(0x40E00054 + ((99 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((99 & 0x7f) >> 4) * 4) & ~(3 << (99 & 0xf) * 2)) | (3 << (99 & 0xf) * 2);
}
#line 160
;
HPLFFUARTM$Interrupt$disable();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 163
{
* (volatile uint32_t *)0x4010000C |= 1 << 7;
HPLFFUARTM$setBaudRate(HPLFFUARTM$baudrate);
* (volatile uint32_t *)0x4010000C &= ~(1 << 7);
}
#line 174
__nesc_atomic_end(__nesc_atomic); }
* (volatile uint32_t *)0x4010000C |= 0x3;
* (volatile uint32_t *)0x40100010 &= ~(1 << 4);
* (volatile uint32_t *)0x40100010 |= 1 << 3;
* (volatile uint32_t *)0x40100004 |= 1 << 0;
* (volatile uint32_t *)0x40100004 |= 1 << 1;
* (volatile uint32_t *)0x40100004 |= 1 << 6;
* (volatile uint32_t *)0x40100008 = 1 << 0;
HPLFFUARTM$Interrupt$allocate();
HPLFFUARTM$Interrupt$enable();
* (volatile uint32_t *)0x41300004 |= 1 << 6;
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
inline static result_t UARTM$HPLUART$init(void){
#line 63
unsigned char result;
#line 63
#line 63
result = HPLFFUARTM$UART$init();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 68 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$Control$start(void)
#line 68
{
return UARTM$HPLUART$init();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t FramerM$ByteControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = UARTM$Control$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 297 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$StdControl$start(void)
#line 297
{
FramerM$HDLCInitialize();
return FramerM$ByteControl$start();
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GenericCommProM$UARTControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = FramerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
inline static result_t GenericCommProM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 251 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline bool GenericCommProM$Control$start(void)
#line 251
{
bool ok = SUCCESS;
ok = GenericCommProM$TimerControl$start() && ok;
ok = GenericCommProM$UARTControl$start() && ok;
ok = GenericCommProM$RadioControl$start() && ok;
ok = GenericCommProM$ActivityTimer$start(TIMER_REPEAT, 1000) && ok;
ok = GenericCommProM$MonitorTimer$start(TIMER_REPEAT, COMM_WDT_UPDATE_UNIT) && ok;
if (SUCCESS != GenericCommProM$PowerManagement$adjustPower()) {
;
}
GenericCommProM$MacControl$enableAck();
return ok;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t MultiHopLQI$Random$rand(void){
#line 63
unsigned short result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t MultiHopLQI$Timer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(21U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 270 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$StdControl$start(void)
#line 270
{
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$Timer$start(TIMER_ONE_SHOT,
MultiHopLQI$Random$rand() % 1024 * 3 + 3);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t MultiHopEngineM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = MultiHopLQI$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t MultiHopEngineM$RouteStatusTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(20U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t MultiHopEngineM$MonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(19U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 129 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$StdControl$start(void)
{
MultiHopEngineM$MonitorTimer$start(TIMER_ONE_SHOT, MultiHopEngineM$WDT_UPDATE_UNIT);
MultiHopEngineM$RouteStatusTimer$start(TIMER_REPEAT, MultiHopEngineM$ROUTE_STATUS_CHECK_PERIOD);
return MultiHopEngineM$SubControl$start();
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$initTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(4U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t SmartSensingM$SensingTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = RealTimeM$Timer$start(0U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t RealTimeM$WatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(5U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static void RealTimeM$Clock$setInterval(uint32_t arg_0x408ca068){
#line 105
RTCClockM$MicroClock$setInterval(arg_0x408ca068);
#line 105
}
#line 105
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t RealTimeM$ClockControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RTCClockM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 120 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$StdControl$start(void)
#line 120
{
RealTimeM$ClockControl$start();
RealTimeM$Clock$setInterval(RealTimeM$uc_fire_point);
RealTimeM$WatchTimer$start(TIMER_REPEAT, 1024);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$TimerControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RealTimeM$StdControl$start();
#line 70
result = rcombine(result, TimerM$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void GPSSensorM$GPSInterrupt$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(93, arg_0x406321d8);
#line 45
}
#line 45
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GPSSensorM$GPIOControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = PXA27XGPIOIntM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 121 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setIER(uint32_t val)
#line 121
{
#line 121
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x04) = val;
}
# 50 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setIER(uint32_t arg_0x40c208c8){
#line 50
HplPXA27xBTUARTP$UART$setIER(arg_0x40c208c8);
#line 50
}
#line 50
# 147 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline result_t HalPXA27xBTUARTP$SerialControl$start(void)
#line 147
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 148
{
HalPXA27xBTUARTP$UART$setIER((1 << 6) | (1 << 0));
}
#line 151
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t GPSSensorM$GPSSerialControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = HalPXA27xBTUARTP$SerialControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 153 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline result_t GPSSensorM$StdControl$start(void)
#line 153
{
if (GPSSensorM$started != TRUE) {
GPSSensorM$GPSSerialControl$start();
GPSSensorM$GPIOControl$start();
GPSSensorM$GPSInterrupt$enable(1);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 158
GPSSensorM$started = TRUE;
#line 158
__nesc_atomic_end(__nesc_atomic); }
TOS_post(GPSSensorM$selfCheckTask);
}
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t ADCM$ClockControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = RTCClockM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
inline static result_t ADCM$InternalControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 78 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline result_t ADCM$StdControl$start(void)
#line 78
{
ADCM$InternalControl$start();
ADCM$ClockControl$start();
return SUCCESS;
}
# 126 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static inline result_t FlashManagerM$StdControl$start(void)
#line 126
{
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t DataMgmtM$BatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(15U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t DataMgmtM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = TimerM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 169 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$StdControl$start(void)
#line 169
{
DataMgmtM$SubControl$start();
DataMgmtM$BatchTimer$start(TIMER_ONE_SHOT, BATCH_TIMER_INTERVAL);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t SmartSensingM$SubControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = DataMgmtM$StdControl$start();
#line 70
result = rcombine(result, FlashManagerM$StdControl$start());
#line 70
result = rcombine(result, ADCM$StdControl$start());
#line 70
result = rcombine(result, GPSSensorM$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 28 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
inline static void *SmartSensingM$DataMgmt$allocBlk(uint8_t arg_0x40abb7b8){
#line 28
void *result;
#line 28
#line 28
result = DataMgmtM$DataMgmt$allocBlk(arg_0x40abb7b8);
#line 28
#line 28
return result;
#line 28
}
#line 28
# 89 "/opt/tinyos-1.x/tos/interfaces/ADCControl.nc"
inline static result_t SmartSensingM$ADCControl$bindPort(uint8_t arg_0x40aa4340, uint8_t arg_0x40aa44c8){
#line 89
unsigned char result;
#line 89
#line 89
result = ADCM$ADCControl$bindPort(arg_0x40aa4340, arg_0x40aa44c8);
#line 89
#line 89
return result;
#line 89
}
#line 89
# 128 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline void SmartSensingM$initDefault(void)
#line 128
{
SmartSensingM$initedClock = FALSE;
SmartSensingM$defaultCode = (PRIORITIZE_FUNC << TASK_CODE_SIZE) | RSAM_FUNC;
restartRSAM = 1;
SmartSensingM$LQIFactor = 0;
sensor_num = 0;
SmartSensingM$sensingCurBlk = (void *)0;
if ((void *)0 != (sensor[GPS_CLIENT_ID].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(GPS_CLIENT_ID))) {
sensor[GPS_CLIENT_ID].samplingRate = 0;
sensor[GPS_CLIENT_ID].timerCount = 0;
sensor[GPS_CLIENT_ID].type = TYPE_DATA_GPS;
sensor[GPS_CLIENT_ID].maxBlkNum = GPS_BLK_NUM;
sensor[GPS_CLIENT_ID].dataPriority = GPS_DATA_PRIORITY;
++sensor_num;
}
if ((void *)0 != (sensor[RSAM1_CLIENT_ID].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(RSAM1_CLIENT_ID))) {
sensor[RSAM1_CLIENT_ID].samplingRate = 0;
sensor[RSAM1_CLIENT_ID].timerCount = 0;
sensor[RSAM1_CLIENT_ID].type = TYPE_DATA_RSAM1;
sensor[RSAM1_CLIENT_ID].maxBlkNum = RSAM_BLK_NUM;
sensor[RSAM1_CLIENT_ID].dataPriority = RSAM1_DATA_PRIORITY;
++sensor_num;
}
if ((void *)0 != (sensor[RSAM2_CLIENT_ID].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(RSAM2_CLIENT_ID))) {
sensor[RSAM2_CLIENT_ID].samplingRate = 0;
sensor[RSAM2_CLIENT_ID].timerCount = 0;
sensor[RSAM2_CLIENT_ID].type = TYPE_DATA_RSAM2;
sensor[RSAM2_CLIENT_ID].maxBlkNum = RSAM_BLK_NUM;
sensor[RSAM2_CLIENT_ID].dataPriority = RSAM2_DATA_PRIORITY;
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / SEISMIC_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_SEISMIC;
sensor[sensor_num].channel = TOSH_ACTUAL_SEISMIC_PORT;
sensor[sensor_num].dataPriority = SEISMIC_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_SEISMIC_PORT);
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / INFRASONIC_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_INFRASONIC;
sensor[sensor_num].channel = TOSH_ACTUAL_INFRASONIC_PORT;
sensor[sensor_num].dataPriority = INFRASONIC_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_INFRASONIC_PORT);
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / LIGHTNING_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_LIGHTNING;
sensor[sensor_num].channel = TOSH_ACTUAL_LIGHTNING_PORT;
sensor[sensor_num].dataPriority = LIGHTNING_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_LIGHTNING_PORT);
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / RVOL_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_RVOL;
sensor[sensor_num].channel = TOSH_ACTUAL_RVOL_PORT;
sensor[sensor_num].dataPriority = RVOL_DATA_PRIORITY;
SmartSensingM$ADCControl$bindPort(sensor_num, TOSH_ACTUAL_RVOL_PORT);
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / LQI_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_LQI;
sensor[sensor_num].dataPriority = LQI_DATA_PRIORITY;
++sensor_num;
}
if ((void *)0 != (sensor[sensor_num].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(sensor_num))) {
sensor[sensor_num].samplingRate = 1000UL / SEISMIC_RATE;
sensor[sensor_num].timerCount = 0;
sensor[sensor_num].type = TYPE_DATA_COMPRESS;
sensor[sensor_num].dataPriority = SEISMIC_DATA_PRIORITY;
}
SmartSensingM$updateMaxBlkNum();
SmartSensingM$timerInterval = SmartSensingM$calFireInterval();
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t SmartSensingM$Random$rand(void){
#line 63
unsigned short result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 289 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$StdControl$start(void)
#line 289
{
uint16_t randomtimer;
#line 291
randomtimer = (SmartSensingM$Random$rand() & 0xff) + 0xf;
SmartSensingM$initDefault();
;
SmartSensingM$SubControl$start();
SmartSensingM$TimerControl$start();
SmartSensingM$SensingTimer$start(TIMER_ONE_SHOT, randomtimer);
SmartSensingM$initTimer$start(TIMER_ONE_SHOT, 1024 * 25);
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SettingsM$StackCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(2U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 89 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline result_t SettingsM$StdControl$start(void)
#line 89
{
SettingsM$StackCheckTimer$start(TIMER_REPEAT, 5000);
SettingsM$ResetCause = * (volatile uint32_t *)0x40F00030;
* (volatile uint32_t *)0x40F00030 = 0xf;
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t PMICM$batteryMonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(1U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 362 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$startLDOs(void)
#line 362
{
uint8_t oldVal;
#line 363
uint8_t newVal;
PMICM$readPMIC(0x17, &oldVal, 1);
newVal = (oldVal | 0x2) | 0x4;
PMICM$writePMIC(0x17, newVal);
PMICM$readPMIC(0x98, &oldVal, 1);
newVal = (oldVal | 0x4) | 0x8;
PMICM$writePMIC(0x98, newVal);
PMICM$readPMIC(0x97, &oldVal, 1);
newVal = oldVal | 0x20;
PMICM$writePMIC(0x97, newVal);
PMICM$readPMIC(0x97, &oldVal, 1);
newVal = oldVal & ~0x1;
PMICM$writePMIC(0x97, newVal);
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void PMICM$PMICInterrupt$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(1, arg_0x406321d8);
#line 45
}
#line 45
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PMICM$PI2CInterrupt$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(6);
#line 46
}
#line 46
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t PMICM$GPIOIRQControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = PXA27XGPIOIntM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 402 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline result_t PMICM$StdControl$start(void)
#line 402
{
uint8_t val[3];
uint8_t mask;
static bool start = 0;
if (start == 0) {
PMICM$GPIOIRQControl$start();
PMICM$PI2CInterrupt$enable();
PMICM$PMICInterrupt$enable(2);
PMICM$writePMIC(0x08, (
0x80 | 0x8) | 0x4);
mask = (1 | (1 << 2)) | (1 << 7);
PMICM$writePMIC(0x05, ~mask);
mask = 1 | (1 << 1);
PMICM$writePMIC(0x06, ~mask);
PMICM$writePMIC(0x07, 0xFF);
PMICM$readPMIC(0x01, val, 3);
PMICM$startLDOs();
PMICM$PMIC$enableCharging(TRUE);
PMICM$batteryMonitorTimer$start(TIMER_REPEAT, 60 * 5 * 1000);
start = 1;
}
return SUCCESS;
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XClockM$OSTIrq$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(7);
#line 46
}
#line 46
# 124 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static inline result_t PXA27XClockM$StdControl$start(void)
#line 124
{
* (volatile uint32_t *)0x40A000C4 = (1 << 7) | (0x2 & 0x7);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 128
{
* (volatile uint32_t *)0x40A0001C |= 1 << 5;
* (volatile uint32_t *)0x40A00044 = 0x1;
}
#line 131
__nesc_atomic_end(__nesc_atomic); }
PXA27XClockM$OSTIrq$enable();
#line 152
return SUCCESS;
}
# 77 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t STUARTM$RxDMAChannel$requestChannel(DMAPeripheralID_t arg_0x405402f8, DMAPriority_t arg_0x405404a0, bool arg_0x40540630){
#line 77
unsigned char result;
#line 77
#line 77
result = PXA27XDMAM$PXA27XDMAChannel$requestChannel(0U, arg_0x405402f8, arg_0x405404a0, arg_0x40540630);
#line 77
#line 77
return result;
#line 77
}
#line 77
#line 192
inline static result_t STUARTM$RxDMAChannel$setTransferWidth(DMATransferWidth_t arg_0x4054d358){
#line 192
unsigned char result;
#line 192
#line 192
result = PXA27XDMAM$PXA27XDMAChannel$setTransferWidth(0U, arg_0x4054d358);
#line 192
#line 192
return result;
#line 192
}
#line 192
#line 172
inline static result_t STUARTM$RxDMAChannel$setMaxBurstSize(DMAMaxBurstSize_t arg_0x4054e720){
#line 172
unsigned char result;
#line 172
#line 172
result = PXA27XDMAM$PXA27XDMAChannel$setMaxBurstSize(0U, arg_0x4054e720);
#line 172
#line 172
return result;
#line 172
}
#line 172
inline static result_t STUARTM$RxDMAChannel$setTransferLength(uint16_t arg_0x4054ed20){
#line 182
unsigned char result;
#line 182
#line 182
result = PXA27XDMAM$PXA27XDMAChannel$setTransferLength(0U, arg_0x4054ed20);
#line 182
#line 182
return result;
#line 182
}
#line 182
#line 161
inline static result_t STUARTM$RxDMAChannel$enableTargetFlowControl(bool arg_0x4054e188){
#line 161
unsigned char result;
#line 161
#line 161
result = PXA27XDMAM$PXA27XDMAChannel$enableTargetFlowControl(0U, arg_0x4054e188);
#line 161
#line 161
return result;
#line 161
}
#line 161
#line 152
inline static result_t STUARTM$RxDMAChannel$enableSourceFlowControl(bool arg_0x4053fbd8){
#line 152
unsigned char result;
#line 152
#line 152
result = PXA27XDMAM$PXA27XDMAChannel$enableSourceFlowControl(0U, arg_0x4053fbd8);
#line 152
#line 152
return result;
#line 152
}
#line 152
#line 143
inline static result_t STUARTM$RxDMAChannel$enableTargetAddrIncrement(bool arg_0x4053f608){
#line 143
unsigned char result;
#line 143
#line 143
result = PXA27XDMAM$PXA27XDMAChannel$enableTargetAddrIncrement(0U, arg_0x4053f608);
#line 143
#line 143
return result;
#line 143
}
#line 143
#line 133
inline static result_t STUARTM$RxDMAChannel$enableSourceAddrIncrement(bool arg_0x4053f030){
#line 133
unsigned char result;
#line 133
#line 133
result = PXA27XDMAM$PXA27XDMAChannel$enableSourceAddrIncrement(0U, arg_0x4053f030);
#line 133
#line 133
return result;
#line 133
}
#line 133
#line 123
inline static result_t STUARTM$RxDMAChannel$setTargetAddr(uint32_t arg_0x4053aaa8){
#line 123
unsigned char result;
#line 123
#line 123
result = PXA27XDMAM$PXA27XDMAChannel$setTargetAddr(0U, arg_0x4053aaa8);
#line 123
#line 123
return result;
#line 123
}
#line 123
#line 113
inline static result_t STUARTM$RxDMAChannel$setSourceAddr(uint32_t arg_0x4053a528){
#line 113
unsigned char result;
#line 113
#line 113
result = PXA27XDMAM$PXA27XDMAChannel$setSourceAddr(0U, arg_0x4053a528);
#line 113
#line 113
return result;
#line 113
}
#line 113
# 217 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$configureRxDMA(uint8_t *RxBuffer, uint16_t NumBytes, bool bEnableTargetAddrIncrement)
#line 217
{
STUARTM$RxDMAChannel$setSourceAddr(0x40700000);
STUARTM$RxDMAChannel$setTargetAddr((uint32_t )RxBuffer);
STUARTM$RxDMAChannel$enableSourceAddrIncrement(FALSE);
STUARTM$RxDMAChannel$enableTargetAddrIncrement(bEnableTargetAddrIncrement);
STUARTM$RxDMAChannel$enableSourceFlowControl(TRUE);
STUARTM$RxDMAChannel$enableTargetFlowControl(FALSE);
STUARTM$RxDMAChannel$setTransferLength(NumBytes);
STUARTM$RxDMAChannel$setMaxBurstSize(DMA_8ByteBurst);
STUARTM$RxDMAChannel$setTransferWidth(DMA_4ByteWidth);
}
#line 146
static inline result_t STUARTM$openRxPort(bool bRxDMAIntEnable)
#line 146
{
result_t status = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 150
{
if (STUARTM$gRxPortInUse == TRUE) {
status = FAIL;
}
else {
STUARTM$gRxPortInUse = TRUE;
}
}
#line 157
__nesc_atomic_end(__nesc_atomic); }
if (status == FAIL) {
return FAIL;
}
if (STUARTM$gPortInitialized == FALSE) {
STUARTM$initPort();
STUARTM$gPortInitialized = TRUE;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 167
{
if (STUARTM$gTxPortInUse == FALSE) {
STUARTM$configPort();
}
}
#line 172
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void STUARTM$UARTInterrupt$disable(void){
#line 47
PXA27XInterruptM$PXA27XIrq$disable(20);
#line 47
}
#line 47
# 240 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline result_t STUARTM$BulkTxRx$BulkReceive(uint8_t *RxBuffer, uint16_t NumBytes)
#line 240
{
if (!RxBuffer || !NumBytes) {
return FAIL;
}
STUARTM$UARTInterrupt$disable();
if (STUARTM$openRxPort(TRUE) == FAIL) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 253
{
STUARTM$gRxBuffer = RxBuffer;
STUARTM$gRxNumBytes = NumBytes;
STUARTM$gNumRxFifoOverruns = 0;
STUARTM$gRxBufferPos = 0;
}
#line 258
__nesc_atomic_end(__nesc_atomic); }
STUARTM$configureRxDMA(RxBuffer, NumBytes, TRUE);
STUARTM$RxDMAChannel$requestChannel(DMAID_STUART_RX, DMA_Priority4, FALSE);
return SUCCESS;
}
# 27 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
inline static result_t BufferedSTUARTM$BulkTxRx$BulkReceive(uint8_t *arg_0x40501dd8, uint16_t arg_0x404f4010){
#line 27
unsigned char result;
#line 27
#line 27
result = STUARTM$BulkTxRx$BulkReceive(arg_0x40501dd8, arg_0x404f4010);
#line 27
#line 27
return result;
#line 27
}
#line 27
# 39 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static inline result_t BufferedSTUARTM$StdControl$start(void)
#line 39
{
uint8_t *rxBuffer = getNextBuffer(&BufferedSTUARTM$receiveBufferSet);
BufferedSTUARTM$BulkTxRx$BulkReceive(rxBuffer, 10);
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t BluSHM$UartControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = BufferedSTUARTM$StdControl$start();
#line 70
#line 70
return result;
#line 70
}
#line 70
# 257 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$StdControl$start(void)
{
BluSHM$UartControl$start();
generalSend("\r\n", 2);
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
return SUCCESS;
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XDMAM$Interrupt$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(25);
#line 46
}
#line 46
# 129 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline result_t PXA27XDMAM$StdControl$start(void)
#line 129
{
PXA27XDMAM$Interrupt$enable();
return SUCCESS;
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XUSBClientM$USBInterrupt$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(11);
#line 46
}
#line 46
# 200 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline result_t PXA27XUSBClientM$Control$start(void)
#line 200
{
PXA27XUSBClientM$USBInterrupt$enable();
return SUCCESS;
}
# 74 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static inline result_t FlashM$StdControl$start(void)
#line 74
{
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/StdControl.nc"
inline static result_t RealMain$StdControl$start(void){
#line 70
unsigned char result;
#line 70
#line 70
result = FlashM$StdControl$start();
#line 70
result = rcombine(result, PXA27XUSBClientM$Control$start());
#line 70
result = rcombine(result, PXA27XGPIOIntM$StdControl$start());
#line 70
result = rcombine(result, PXA27XDMAM$StdControl$start());
#line 70
result = rcombine(result, BluSHM$StdControl$start());
#line 70
result = rcombine(result, PXA27XClockM$StdControl$start());
#line 70
result = rcombine(result, PMICM$StdControl$start());
#line 70
result = rcombine(result, SettingsM$StdControl$start());
#line 70
result = rcombine(result, SmartSensingM$StdControl$start());
#line 70
result = rcombine(result, MultiHopEngineM$StdControl$start());
#line 70
result = rcombine(result, GenericCommProM$Control$start());
#line 70
result = rcombine(result, TimeSyncM$StdControl$start());
#line 70
result = rcombine(result, SNMSM$StdControl$start());
#line 70
result = rcombine(result, CascadesRouterM$StdControl$start());
#line 70
result = rcombine(result, NeighborMgmtM$StdControl$start());
#line 70
#line 70
return result;
#line 70
}
#line 70
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XGPIOIntM$GPIOIrq0$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(8);
#line 46
}
#line 46
inline static void PXA27XGPIOIntM$GPIOIrq1$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(9);
#line 46
}
#line 46
inline static void PXA27XGPIOIntM$GPIOIrq$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(10);
#line 46
}
#line 46
#line 45
inline static result_t STUARTM$UARTInterrupt$allocate(void){
#line 45
unsigned char result;
#line 45
#line 45
result = PXA27XInterruptM$PXA27XIrq$allocate(20);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 204 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t STUARTM$TxDMAChannel$run(DMAInterruptEnable_t arg_0x4054d948){
#line 204
unsigned char result;
#line 204
#line 204
result = PXA27XDMAM$PXA27XDMAChannel$run(1U, arg_0x4054d948);
#line 204
#line 204
return result;
#line 204
}
#line 204
# 368 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline result_t STUARTM$TxDMAChannel$requestChannelDone(void)
#line 368
{
STUARTM$TxDMAChannel$run(TRUE);
return SUCCESS;
}
# 204 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t STUARTM$RxDMAChannel$run(DMAInterruptEnable_t arg_0x4054d948){
#line 204
unsigned char result;
#line 204
#line 204
result = PXA27XDMAM$PXA27XDMAChannel$run(0U, arg_0x4054d948);
#line 204
#line 204
return result;
#line 204
}
#line 204
# 269 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline result_t STUARTM$RxDMAChannel$requestChannelDone(void)
#line 269
{
STUARTM$RxDMAChannel$run(DMA_ENDINTEN | DMA_EORINTEN);
return SUCCESS;
}
# 944 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$TxDMAChannel$requestChannelDone(void)
#line 944
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 945
{
#line 945
HPLCC2420M$gbDMAChannelInitDone -= 1;
}
#line 946
__nesc_atomic_end(__nesc_atomic); }
#line 946
return SUCCESS;
}
#line 908
static inline result_t HPLCC2420M$RxDMAChannel$requestChannelDone(void)
#line 908
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 909
{
#line 909
HPLCC2420M$gbDMAChannelInitDone -= 1;
}
#line 910
__nesc_atomic_end(__nesc_atomic); }
#line 910
return SUCCESS;
}
# 245 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline result_t PXA27XDMAM$PXA27XDMAChannel$default$requestChannelDone(uint8_t channel)
#line 245
{
return FAIL;
}
# 86 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t PXA27XDMAM$PXA27XDMAChannel$requestChannelDone(uint8_t arg_0x40593790){
#line 86
unsigned char result;
#line 86
#line 86
switch (arg_0x40593790) {
#line 86
case 0U:
#line 86
result = STUARTM$RxDMAChannel$requestChannelDone();
#line 86
break;
#line 86
case 1U:
#line 86
result = STUARTM$TxDMAChannel$requestChannelDone();
#line 86
break;
#line 86
case 2U:
#line 86
result = HPLCC2420M$RxDMAChannel$requestChannelDone();
#line 86
break;
#line 86
case 3U:
#line 86
result = HPLCC2420M$TxDMAChannel$requestChannelDone();
#line 86
break;
#line 86
default:
#line 86
result = PXA27XDMAM$PXA27XDMAChannel$default$requestChannelDone(arg_0x40593790);
#line 86
break;
#line 86
}
#line 86
#line 86
return result;
#line 86
}
#line 86
# 142 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$postRequestChannelDone(uint32_t arg)
#line 142
{
uint8_t channel = (uint8_t )arg;
#line 144
PXA27XDMAM$PXA27XDMAChannel$requestChannelDone(channel);
}
#line 146
static inline void PXA27XDMAM$_postRequestChannelDoneveneer(void)
#line 146
{
#line 146
uint32_t argument;
#line 146
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 146
{
#line 146
popqueue(¶mtaskQueue, &argument);
}
#line 147
__nesc_atomic_end(__nesc_atomic); }
#line 146
PXA27XDMAM$postRequestChannelDone(argument);
}
# 194 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$printReadPMICBusError(void)
#line 194
{
trace(DBG_USR1, "FATAL ERROR: readPMIC() Unable to obtain bus\r\n");
}
static inline void PMICM$printReadPMICAddresError(void)
#line 198
{
trace(DBG_USR1, "FATAL ERROR: readPMIC() Unable to send address\r\n");
}
static inline void PMICM$printReadPMICSlaveAddresError(void)
#line 202
{
trace(DBG_USR1, "FATAL ERROR: readPMIC() unable to write slave address\r\n");
}
static inline void PMICM$printReadPMICReadByteError(void)
#line 206
{
trace(DBG_USR1, "FATAL ERROR: readPMIC() Unable to read byte from PMIC\r\n");
}
#line 133
static inline uint8_t PMICM$getChargerVoltage(void)
#line 133
{
uint8_t chargerVoltage;
#line 135
PMICM$getPMICADCVal(2, &chargerVoltage);
return chargerVoltage;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t PMICM$chargeMonitorTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(0U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 245 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static inline uint32_t PXA27XClockM$Clock$readCounter(void)
#line 245
{
return * (volatile uint32_t *)0x40A00044;
}
# 153 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static uint32_t TimerM$Clock$readCounter(void){
#line 153
unsigned int result;
#line 153
#line 153
result = PXA27XClockM$Clock$readCounter();
#line 153
#line 153
return result;
#line 153
}
#line 153
# 262 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$DataMgmt$freeBlkByType(uint8_t type)
#line 262
{
result_t result = FAIL;
SenBlkPtr p = headMemElement(&DataMgmtM$sensorMem, MEMPENDING);
int16_t nextInd = -1;
#line 266
while (p != (void *)0) {
if (p->type == type) {
result = DataMgmtM$DataMgmt$freeBlk((void *)p);
break;
}
else {
nextInd = p->next;
p = getMemElementByIndex(&DataMgmtM$sensorMem, nextInd);
}
}
if (result != TRUE) {
p = headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING);
while (p != (void *)0) {
if (p->type == type) {
result = DataMgmtM$DataMgmt$freeBlk((void *)p);
break;
}
else {
nextInd = p->next;
p = getMemElementByIndex(&DataMgmtM$sensorMem, nextInd);
}
}
}
return result;
}
# 194 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static inline result_t freeSensorMem(MemQueue_t *queue, SenBlkPtr obj)
#line 194
{
int16_t ind;
#line 196
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total <= 0) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 206
ind = queue->head[obj->status];
#line 206
__nesc_atomic_end(__nesc_atomic); }
while (ind != -1) {
if (queue->element[ind].status != FREEMEM && &queue->element[ind] == obj) {
_private_changeMemStatusByIndex(queue, ind, queue->element[ind].status, FREEMEM);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 210
{
queue->element[ind].time = 0;
queue->element[ind].interval = 0;
queue->element[ind].size = 0;
queue->element[ind].priority = 0;
queue->total = queue->total - 1;
}
#line 216
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 220
ind = queue->element[ind].next;
#line 220
__nesc_atomic_end(__nesc_atomic); }
}
}
return FAIL;
}
#line 161
static inline SenBlkPtr allocSensorMem(MemQueue_t *bufQueue)
#line 161
{
int16_t head;
#line 163
if (bufQueue->size <= 0) {
;
return (void *)0;
}
if (bufQueue->total >= bufQueue->size) {
;
return (void *)0;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 171
head = bufQueue->head[FREEMEM];
#line 171
__nesc_atomic_end(__nesc_atomic); }
if (-1 != head) {
if (FAIL == _private_changeMemStatusByIndex(bufQueue, head, FREEMEM, FILLING)) {
;
return (void *)0;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 178
bufQueue->total++;
#line 178
__nesc_atomic_end(__nesc_atomic); }
return &bufQueue->element[head];
}
}
else
#line 181
{
;
return (void *)0;
}
}
# 87 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$yellowToggle(void)
#line 87
{
return SUCCESS;
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t DataMgmtM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = NoLeds$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 888 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static __inline uint16_t SmartSensingM$GCD(uint16_t a, uint16_t b)
#line 888
{
while (1) {
a = a % b;
if (a == 0) {
return b;
}
b = b % a;
if (b == 0) {
return a;
}
}
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void RTCClockM$OSTIrq$enable(void){
#line 46
PXA27XInterruptM$PXA27XIrq$enable(7);
#line 46
}
#line 46
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t GPSSensorM$CheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(6U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 237 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$HPLCC2420WriteContentionError(void)
#line 237
{
trace(DBG_USR1, "ERROR: HPLCC2420.write has attempted to access the radio during an existing radio operation\r\n");
}
static inline void HPLCC2420M$HPLCC2420WriteError(void)
#line 241
{
trace(DBG_USR1, "ERROR: HPLCC2420.write failed while attempting to release the SSP port\r\n");
}
#line 198
static inline void HPLCC2420M$HPLCC2420CmdReleaseError(void)
#line 198
{
trace(DBG_USR1, "ERROR: HPLCC2420.cmd failed while attempting to release the SSP port\r\n");
}
# 181 "/opt/tinyos-1.x/tos/platform/pxa27x/pxa27xhardware.h"
__inline void __nesc_atomic_end(__nesc_atomic_t oldState)
{
uint32_t statusReg = 0;
oldState &= 0x000000C0;
#line 202
__asm volatile (
"mrs %0,CPSR\n\t"
"bic %0, %1, %2\n\t"
"orr %0, %1, %3\n\t"
"msr CPSR_c, %1" :
"=r"(statusReg) :
"0"(statusReg), "i"(0x000000C0), "r"(oldState));
return;
}
static __inline void __nesc_enable_interrupt(void)
#line 215
{
uint32_t statusReg = 0;
__asm volatile (
"mrs %0,CPSR\n\t"
"bic %0,%1,#0x80\n\t"
"msr CPSR_c, %1" :
"=r"(statusReg) :
"0"(statusReg));
return;
}
static __inline void __nesc_atomic_sleep(void)
{
__nesc_enable_interrupt();
return;
}
#line 156
__inline __nesc_atomic_t __nesc_atomic_start(void )
{
uint32_t result = 0;
uint32_t temp = 0;
__asm volatile (
"mrs %0,CPSR\n\t"
"orr %1,%2,%4\n\t"
"msr CPSR_cf,%3" :
"=r"(result), "=r"(temp) :
"0"(result), "1"(temp), "i"(0x000000C0));
#line 178
return result;
}
# 164 "/opt/tinyos-1.x/tos/platform/imote2/sched.c"
static inline bool TOSH_run_next_task(void)
{
__nesc_atomic_t fInterruptFlags;
uint8_t old_full;
void (*func)(void );
fInterruptFlags = __nesc_atomic_start();
old_full = TOSH_sched_full;
func = TOSH_queue[old_full].tp;
if (func == NULL)
{
__nesc_atomic_sleep();
return 0;
}
TOSH_queue[old_full].tp = NULL;
TOSH_sched_full = (old_full + 1) & TOSH_TASK_BITMASK;
TOSH_queue[old_full].executeTime = * (volatile uint32_t *)0x40A00010;
__nesc_atomic_end(fInterruptFlags);
func();
TOSH_queue[old_full].executeTime = * (volatile uint32_t *)0x40A00010 - TOSH_queue[old_full].executeTime;
return 1;
}
static inline void TOSH_run_task(void)
#line 192
{
for (; ; )
TOSH_run_next_task();
}
# 414 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$printUARTError(void)
#line 414
{
trace(DBG_USR1, "UART ERROR\r\n");
}
# 63 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
inline static uint8_t *STUARTM$BulkTxRx$BulkReceiveDone(uint8_t *arg_0x404f3720, uint16_t arg_0x404f38b8){
#line 63
unsigned char *result;
#line 63
#line 63
result = BufferedSTUARTM$BulkTxRx$BulkReceiveDone(arg_0x404f3720, arg_0x404f38b8);
#line 63
#line 63
return result;
#line 63
}
#line 63
inline static uint8_t *STUARTM$BulkTxRx$BulkTransmitDone(uint8_t *arg_0x404ff190, uint16_t arg_0x404ff328){
#line 71
unsigned char *result;
#line 71
#line 71
result = BufferedSTUARTM$BulkTxRx$BulkTransmitDone(arg_0x404ff190, arg_0x404ff328);
#line 71
#line 71
return result;
#line 71
}
#line 71
# 418 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$UARTInterrupt$fired(void)
#line 418
{
uint8_t error;
#line 419
uint8_t intSource = * (volatile uint32_t *)0x40700008;
#line 420
intSource = (intSource >> 1) & 0x3;
switch (intSource) {
case 0:
break;
case 1:
if (STUARTM$gTxBuffer) {
if (STUARTM$gTxBufferPos < STUARTM$gTxNumBytes) {
* (volatile uint32_t *)0x40700000 = STUARTM$gTxBuffer[STUARTM$gTxBufferPos];
STUARTM$gTxBufferPos++;
}
else {
STUARTM$gTxBuffer = STUARTM$BulkTxRx$BulkTransmitDone(STUARTM$gTxBuffer,
STUARTM$gTxNumBytes);
if (STUARTM$gTxBuffer) {
* (volatile uint32_t *)0x40700000 = STUARTM$gTxBuffer[0];
STUARTM$gTxBufferPos = 1;
}
else {
STUARTM$gTxBufferPos = 0;
STUARTM$closeTxPort();
}
}
}
break;
case 2:
if (STUARTM$gRxBuffer) {
while (* (volatile uint32_t *)0x40700014 & (1 << 0)) {
STUARTM$gRxBuffer[STUARTM$gRxBufferPos] = * (volatile uint32_t *)0x40700000;
STUARTM$gRxBufferPos++;
if (STUARTM$gRxBufferPos == STUARTM$gRxNumBytes) {
STUARTM$gRxBuffer = STUARTM$BulkTxRx$BulkReceiveDone(STUARTM$gRxBuffer,
STUARTM$gRxNumBytes);
STUARTM$gRxBufferPos = 0;
if (STUARTM$gRxBuffer == (void *)0) {
STUARTM$closeRxPort();
}
}
}
}
break;
case 3:
error = * (volatile uint32_t *)0x40700014;
TOS_post(STUARTM$printUARTError);
break;
}
return;
}
# 182 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t STUARTM$TxDMAChannel$setTransferLength(uint16_t arg_0x4054ed20){
#line 182
unsigned char result;
#line 182
#line 182
result = PXA27XDMAM$PXA27XDMAChannel$setTransferLength(1U, arg_0x4054ed20);
#line 182
#line 182
return result;
#line 182
}
#line 182
#line 113
inline static result_t STUARTM$TxDMAChannel$setSourceAddr(uint32_t arg_0x4053a528){
#line 113
unsigned char result;
#line 113
#line 113
result = PXA27XDMAM$PXA27XDMAChannel$setSourceAddr(1U, arg_0x4053a528);
#line 113
#line 113
return result;
#line 113
}
#line 113
# 390 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$TxDMAChannel$endInterrupt(uint16_t numBytesSent)
#line 390
{
STUARTM$gTxBuffer = STUARTM$BulkTxRx$BulkTransmitDone(STUARTM$gTxBuffer,
STUARTM$gTxNumBytes);
if (STUARTM$gTxBuffer) {
STUARTM$TxDMAChannel$setSourceAddr((uint32_t )STUARTM$gTxBuffer);
STUARTM$TxDMAChannel$setTransferLength(STUARTM$gTxNumBytes);
STUARTM$TxDMAChannel$run(TRUE);
}
else {
STUARTM$closeTxPort();
}
return;
}
#line 315
static inline void STUARTM$RxDMAChannel$endInterrupt(uint16_t numBytesSent)
#line 315
{
STUARTM$handleRxDMADone(numBytesSent);
return;
}
# 961 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$HPLCC2420TxDmaEndInterrupt(void)
#line 961
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.writeTXFIFO DMA version failed while attempting to release the SSP port\r\n");
}
#line 964
static inline void HPLCC2420M$TxDMAChannel$endInterrupt(uint16_t numBytesSent)
#line 964
{
uint8_t tmp;
#line 965
uint8_t localIgnoreTxDMA;
#line 966
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 966
{
localIgnoreTxDMA = HPLCC2420M$gbIgnoreTxDMA;
}
#line 968
__nesc_atomic_end(__nesc_atomic); }
if (localIgnoreTxDMA == FALSE) {
* (volatile uint32_t *)0x41900004 &= ~(1 << 21);
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) {
tmp = * (volatile uint32_t *)0x41900010;
}
{
#line 975
TOSH_uwait(1);
#line 975
TOSH_SET_CC_CSN_PIN();
}
#line 975
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420TxDmaEndInterrupt);
}
TOS_post(HPLCC2420M$signalTXFIFO);
}
return;
}
#line 925
static inline void HPLCC2420M$HPLCC2420RxDMAEndInterruptReleaseError(void)
#line 925
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.readRXFIFO DMA version failed while attempting to release the SSP port\r\n");
}
static inline void HPLCC2420M$RxDMAChannel$endInterrupt(uint16_t numBytesSent)
#line 929
{
{
#line 931
TOSH_uwait(1);
#line 931
TOSH_SET_CC_CSN_PIN();
}
#line 931
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420RxDMAEndInterruptReleaseError);
}
* (volatile uint32_t *)0x41900004 &= ~(1 << 20);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 937
{
invalidateDCache(HPLCC2420M$rxbuf, HPLCC2420M$rxlen);
}
#line 939
__nesc_atomic_end(__nesc_atomic); }
TOS_post(HPLCC2420M$signalRXFIFO);
return;
}
# 404 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$PXA27XDMAChannel$default$endInterrupt(uint8_t channel, uint16_t numByteSent)
#line 404
{
return;
}
# 236 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static void PXA27XDMAM$PXA27XDMAChannel$endInterrupt(uint8_t arg_0x40593790, uint16_t arg_0x4054cc28){
#line 236
switch (arg_0x40593790) {
#line 236
case 0U:
#line 236
STUARTM$RxDMAChannel$endInterrupt(arg_0x4054cc28);
#line 236
break;
#line 236
case 1U:
#line 236
STUARTM$TxDMAChannel$endInterrupt(arg_0x4054cc28);
#line 236
break;
#line 236
case 2U:
#line 236
HPLCC2420M$RxDMAChannel$endInterrupt(arg_0x4054cc28);
#line 236
break;
#line 236
case 3U:
#line 236
HPLCC2420M$TxDMAChannel$endInterrupt(arg_0x4054cc28);
#line 236
break;
#line 236
default:
#line 236
PXA27XDMAM$PXA27XDMAChannel$default$endInterrupt(arg_0x40593790, arg_0x4054cc28);
#line 236
break;
#line 236
}
#line 236
}
#line 236
# 385 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$TxDMAChannel$eorInterrupt(uint16_t numBytesLeft)
#line 385
{
return;
}
#line 310
static inline void STUARTM$RxDMAChannel$eorInterrupt(uint16_t numBytesSent)
#line 310
{
STUARTM$handleRxDMADone(numBytesSent);
}
# 957 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$TxDMAChannel$eorInterrupt(uint16_t numBytesSent)
#line 957
{
return;
}
#line 921
static inline void HPLCC2420M$RxDMAChannel$eorInterrupt(uint16_t numBytesSent)
#line 921
{
return;
}
# 400 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$PXA27XDMAChannel$default$eorInterrupt(uint8_t channel, uint16_t numBytesSent)
#line 400
{
return;
}
# 249 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static void PXA27XDMAM$PXA27XDMAChannel$eorInterrupt(uint8_t arg_0x40593790, uint16_t arg_0x4054a280){
#line 249
switch (arg_0x40593790) {
#line 249
case 0U:
#line 249
STUARTM$RxDMAChannel$eorInterrupt(arg_0x4054a280);
#line 249
break;
#line 249
case 1U:
#line 249
STUARTM$TxDMAChannel$eorInterrupt(arg_0x4054a280);
#line 249
break;
#line 249
case 2U:
#line 249
HPLCC2420M$RxDMAChannel$eorInterrupt(arg_0x4054a280);
#line 249
break;
#line 249
case 3U:
#line 249
HPLCC2420M$TxDMAChannel$eorInterrupt(arg_0x4054a280);
#line 249
break;
#line 249
default:
#line 249
PXA27XDMAM$PXA27XDMAChannel$default$eorInterrupt(arg_0x40593790, arg_0x4054a280);
#line 249
break;
#line 249
}
#line 249
}
#line 249
# 380 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$TxDMAChannel$stopInterrupt(uint16_t numBytesLeft)
#line 380
{
return;
}
#line 299
static inline void STUARTM$RxDMAChannel$stopInterrupt(uint16_t numbBytesSent)
#line 299
{
}
# 953 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$TxDMAChannel$stopInterrupt(uint16_t numbBytesSent)
#line 953
{
return;
}
#line 917
static inline void HPLCC2420M$RxDMAChannel$stopInterrupt(uint16_t numbBytesSent)
#line 917
{
return;
}
# 392 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$PXA27XDMAChannel$default$stopInterrupt(uint8_t channel, uint16_t numBytesSent)
#line 392
{
return;
}
# 260 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static void PXA27XDMAM$PXA27XDMAChannel$stopInterrupt(uint8_t arg_0x40593790, uint16_t arg_0x4054a8e0){
#line 260
switch (arg_0x40593790) {
#line 260
case 0U:
#line 260
STUARTM$RxDMAChannel$stopInterrupt(arg_0x4054a8e0);
#line 260
break;
#line 260
case 1U:
#line 260
STUARTM$TxDMAChannel$stopInterrupt(arg_0x4054a8e0);
#line 260
break;
#line 260
case 2U:
#line 260
HPLCC2420M$RxDMAChannel$stopInterrupt(arg_0x4054a8e0);
#line 260
break;
#line 260
case 3U:
#line 260
HPLCC2420M$TxDMAChannel$stopInterrupt(arg_0x4054a8e0);
#line 260
break;
#line 260
default:
#line 260
PXA27XDMAM$PXA27XDMAChannel$default$stopInterrupt(arg_0x40593790, arg_0x4054a8e0);
#line 260
break;
#line 260
}
#line 260
}
#line 260
# 375 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$TxDMAChannel$startInterrupt(void)
#line 375
{
return;
}
#line 296
static inline void STUARTM$RxDMAChannel$startInterrupt(void)
#line 296
{
}
# 949 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$TxDMAChannel$startInterrupt(void)
#line 949
{
return;
}
#line 913
static inline void HPLCC2420M$RxDMAChannel$startInterrupt(void)
#line 913
{
return;
}
# 396 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$PXA27XDMAChannel$default$startInterrupt(uint8_t channel)
#line 396
{
return;
}
# 268 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static void PXA27XDMAM$PXA27XDMAChannel$startInterrupt(uint8_t arg_0x40593790){
#line 268
switch (arg_0x40593790) {
#line 268
case 0U:
#line 268
STUARTM$RxDMAChannel$startInterrupt();
#line 268
break;
#line 268
case 1U:
#line 268
STUARTM$TxDMAChannel$startInterrupt();
#line 268
break;
#line 268
case 2U:
#line 268
HPLCC2420M$RxDMAChannel$startInterrupt();
#line 268
break;
#line 268
case 3U:
#line 268
HPLCC2420M$TxDMAChannel$startInterrupt();
#line 268
break;
#line 268
default:
#line 268
PXA27XDMAM$PXA27XDMAChannel$default$startInterrupt(arg_0x40593790);
#line 268
break;
#line 268
}
#line 268
}
#line 268
# 140 "/opt/tinyos-1.x/tos/platform/pxa27x/pxa27xhardware.h"
static __inline uint32_t _pxa27x_clzui(uint32_t i)
#line 140
{
uint32_t count;
#line 142
__asm volatile ("clz %0,%1" :
"=r"(count) :
"r"(i));
return count;
}
# 411 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static inline void PXA27XDMAM$Interrupt$fired(void)
{
uint32_t IntReg;
uint32_t realChannel;
#line 414
uint32_t virtualChannel;
#line 414
uint32_t status;
#line 414
uint32_t update;
#line 414
uint32_t dcmd;
uint16_t currentLength;
IntReg = * (volatile uint32_t *)0x400000F0;
realChannel = 31 - _pxa27x_clzui(IntReg);
virtualChannel = PXA27XDMAM$mPriorityMap[realChannel].virtualChannel;
currentLength = PXA27XDMAM$mChannelArray[virtualChannel].length;
status = * (volatile uint32_t *)(0x40000000 + realChannel * 4);
dcmd = * (volatile uint32_t *)(0x4000020C + realChannel * 16);
update = (status & 0xFFA00000) | (1 << 22);
if (status & 1) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update | 1;
}
if (status & (1 << 1)) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update | (1 << 1);
if (dcmd & (1 << 22)) {
PXA27XDMAM$PXA27XDMAChannel$startInterrupt(virtualChannel);
}
}
if (status & ((1 << 3) | (1 << 29))) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update & (1 << 29);
PXA27XDMAM$PXA27XDMAChannel$stopInterrupt(virtualChannel, currentLength - (* (volatile uint32_t *)(0x4000020C + realChannel * 16) & 0x1FFF));
}
if (status & ((1 << 4) | (1 << 23))) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update | (1 << 4);
}
if (status & (1 << 9)) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update | (1 << 9);
if (status & (1 << 28)) {
PXA27XDMAM$PXA27XDMAChannel$eorInterrupt(virtualChannel, currentLength - (* (volatile uint32_t *)(0x4000020C + realChannel * 16) & 0x1FFF));
}
}
if (status & (1 << 2)) {
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = update | (1 << 2);
if (dcmd & (1 << 21)) {
PXA27XDMAM$PXA27XDMAChannel$endInterrupt(virtualChannel, currentLength);
}
}
globalDMAVirtualChannelHandled = virtualChannel;
return;
}
# 137 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static inline void PXA27XGPIOIntM$GPIOIrq$fired(void)
{
uint32_t DetectReg;
uint8_t pin;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 144
DetectReg = * (volatile uint32_t *)0x40E00048 & ~((1 << 1) | (1 << 0));
#line 144
__nesc_atomic_end(__nesc_atomic); }
while (DetectReg) {
pin = 31 - _pxa27x_clzui(DetectReg);
PXA27XGPIOIntM$PXA27XGPIOInt$fired(pin);
DetectReg &= ~(1 << pin);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 152
DetectReg = * (volatile uint32_t *)0x40E0004C;
#line 152
__nesc_atomic_end(__nesc_atomic); }
while (DetectReg) {
pin = 31 - _pxa27x_clzui(DetectReg);
PXA27XGPIOIntM$PXA27XGPIOInt$fired(pin + 32);
DetectReg &= ~(1 << pin);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 160
DetectReg = * (volatile uint32_t *)0x40E00050;
#line 160
__nesc_atomic_end(__nesc_atomic); }
while (DetectReg) {
pin = 31 - _pxa27x_clzui(DetectReg);
PXA27XGPIOIntM$PXA27XGPIOInt$fired(pin + 64);
DetectReg &= ~(1 << pin);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 168
DetectReg = * (volatile uint32_t *)0x40E00148;
#line 168
__nesc_atomic_end(__nesc_atomic); }
while (DetectReg) {
pin = 31 - _pxa27x_clzui(DetectReg);
PXA27XGPIOIntM$PXA27XGPIOInt$fired(pin + 96);
DetectReg &= ~(1 << pin);
}
return;
}
static inline void PXA27XGPIOIntM$GPIOIrq1$fired(void)
{
PXA27XGPIOIntM$PXA27XGPIOInt$fired(1);
}
#line 179
static inline void PXA27XGPIOIntM$GPIOIrq0$fired(void)
{
PXA27XGPIOIntM$PXA27XGPIOInt$fired(0);
}
# 583 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$retrieveOut(void)
#line 583
{
uint16_t i = 0;
uint8_t *buff;
uint32_t temp;
uint8_t bufflen;
for (i = 0; i < 4; i++)
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 590
PXA27XUSBClientM$OutStream[i].endpointDR = (volatile unsigned long *const )0x40600308;
#line 590
__nesc_atomic_end(__nesc_atomic); }
bufflen = PXA27XUSBClientM$Device.oConfigurations[1]->oInterfaces[0]->oEndpoints[1]->wMaxPacketSize;
buff = (uint8_t *)safe_malloc(bufflen);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 595
{
for (i = 0; (* (volatile uint32_t *)(PXA27XUSBClientM$OutStream[0].endpointDR - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600200) & 0x1FF) > 0 && i < bufflen; i += 4) {
temp = * (volatile uint32_t *)PXA27XUSBClientM$OutStream[0].endpointDR;
* (uint32_t *)(buff + i) = temp;
}
}
#line 600
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$DynQueue_enqueue(PXA27XUSBClientM$OutQueue, buff);
#line 615
TOS_post(PXA27XUSBClientM$processOut);
}
#line 416
static inline result_t PXA27XUSBClientM$BareSendMsg$default$sendDone(TOS_MsgPtr msg, result_t success)
#line 416
{
return SUCCESS;
}
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t PXA27XUSBClientM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8){
#line 67
unsigned char result;
#line 67
#line 67
result = PXA27XUSBClientM$BareSendMsg$default$sendDone(arg_0x4061e348, arg_0x4061e4d8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 469 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$USBSend$sendDone(uint8_t *packet, uint8_t type, result_t success)
{
BluSHdata temp;
#line 472
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 472
{
temp = (BluSHdata )BluSHM$DynQueue_peek(BluSHM$OutQueue);
}
#line 474
__nesc_atomic_end(__nesc_atomic); }
if (temp->src == packet) {
safe_free(packet);
safe_free(temp);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 478
{
BluSHM$DynQueue_dequeue(BluSHM$OutQueue);
}
#line 480
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 411 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline result_t PXA27XUSBClientM$SendJTPacket$default$sendDone(uint8_t channel, uint8_t *packet, uint8_t type,
result_t success)
#line 412
{
return SUCCESS;
}
# 28 "/opt/tinyos-1.x/tos/platform/pxa27x/SendJTPacket.nc"
inline static result_t PXA27XUSBClientM$SendJTPacket$sendDone(uint8_t arg_0x4065c5b8, uint8_t *arg_0x40614b20, uint8_t arg_0x40614ca8, result_t arg_0x40614e38){
#line 28
unsigned char result;
#line 28
#line 28
switch (arg_0x4065c5b8) {
#line 28
case 0U:
#line 28
result = BluSHM$USBSend$sendDone(arg_0x40614b20, arg_0x40614ca8, arg_0x40614e38);
#line 28
break;
#line 28
default:
#line 28
result = PXA27XUSBClientM$SendJTPacket$default$sendDone(arg_0x4065c5b8, arg_0x40614b20, arg_0x40614ca8, arg_0x40614e38);
#line 28
break;
#line 28
}
#line 28
#line 28
return result;
#line 28
}
#line 28
# 407 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline result_t PXA27XUSBClientM$SendVarLenPacket$default$sendDone(uint8_t *packet, result_t success)
#line 407
{
return SUCCESS;
}
# 62 "/opt/tinyos-1.x/tos/interfaces/SendVarLenPacket.nc"
inline static result_t PXA27XUSBClientM$SendVarLenPacket$sendDone(uint8_t *arg_0x406168e8, result_t arg_0x40616a78){
#line 62
unsigned char result;
#line 62
#line 62
result = PXA27XUSBClientM$SendVarLenPacket$default$sendDone(arg_0x406168e8, arg_0x40616a78);
#line 62
#line 62
return result;
#line 62
}
#line 62
# 227 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$USBInterrupt$fired(void)
#line 227
{
uint32_t statusreg;
uint8_t statetemp;
PXA27XUSBClientM$DynQueue QueueTemp;
PXA27XUSBClientM$USBdata InStateTemp;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 233
statetemp = PXA27XUSBClientM$state;
#line 233
__nesc_atomic_end(__nesc_atomic); }
switch (statetemp) {
case 1:
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 240
{
if ((* (volatile uint32_t *)0x40600010 & (1 << (27 & 0x1f))) != 0) {
PXA27XUSBClientM$state = 2;
* (volatile uint32_t *)0x40600010 = 1 << (27 & 0x1f);
}
if ((* (volatile uint32_t *)0x4060000C & (1 << (0 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (0 & 0x1f);
}
#line 248
if ((* (volatile uint32_t *)0x4060000C & (1 << (2 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (2 & 0x1f);
}
#line 250
if ((* (volatile uint32_t *)0x4060000C & (1 << (4 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (4 & 0x1f);
}
#line 252
if ((* (volatile uint32_t *)0x40600010 & (1 << (31 & 0x1f))) != 0) {
* (volatile uint32_t *)0x40600010 = 1 << (31 & 0x1f);
}
}
#line 255
__nesc_atomic_end(__nesc_atomic); }
#line 255
break;
case 2:
case 3:
if ((* (volatile uint32_t *)0x40600010 & (1 << (27 & 0x1f))) != 0) {
PXA27XUSBClientM$clearIn();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 260
{
PXA27XUSBClientM$state = 2;
* (volatile uint32_t *)0x40600010 = 1 << (27 & 0x1f);
}
#line 263
__nesc_atomic_end(__nesc_atomic); }
}
if ((* (volatile uint32_t *)0x40600010 & (1 << (31 & 0x1f))) != 0) {
PXA27XUSBClientM$handleControlSetup();
* (volatile uint32_t *)0x40600010 = 1 << (31 & 0x1f);
}
else {
#line 270
if ((* (volatile uint32_t *)0x4060000C & (1 << (0 & 0x1f))) != 0) {
{
statusreg = * (volatile uint32_t *)0x40600100;
* (volatile uint32_t *)0x4060000C = 1 << (0 & 0x1f);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 275
InStateTemp = PXA27XUSBClientM$InState;
#line 275
__nesc_atomic_end(__nesc_atomic); }
if ((statusreg & (1 << (7 & 0x1f))) != 0) {
PXA27XUSBClientM$handleControlSetup();
}
else {
#line 279
if (InStateTemp != (void *)0 && InStateTemp->endpointDR == (volatile unsigned long *const )0x40600300 &&
InStateTemp->index != 0)
{
if (!((InStateTemp->status & (1 << (1 & 0x1f))) != 0)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 286
QueueTemp = PXA27XUSBClientM$InQueue;
#line 286
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$clearUSBdata((PXA27XUSBClientM$USBdata )PXA27XUSBClientM$DynQueue_dequeue(QueueTemp), 0);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 288
PXA27XUSBClientM$InState = (void *)0;
#line 288
__nesc_atomic_end(__nesc_atomic); }
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) > 0) {
PXA27XUSBClientM$sendControlIn();
}
else {
#line 292
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 292
PXA27XUSBClientM$InTask = 0;
#line 292
__nesc_atomic_end(__nesc_atomic); }
}
}
else
#line 294
{
PXA27XUSBClientM$sendControlIn();
}
}
else
{
}
}
}
}
if ((* (volatile uint32_t *)0x4060000C & (1 << (2 & 0x1f))) != 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 311
statetemp = PXA27XUSBClientM$state;
#line 311
__nesc_atomic_end(__nesc_atomic); }
* (volatile uint32_t *)0x4060000C = 1 << (2 & 0x1f);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 313
InStateTemp = PXA27XUSBClientM$InState;
#line 313
__nesc_atomic_end(__nesc_atomic); }
if (statetemp != 3) {
* (volatile uint32_t *)0x40600108 |= 1 << (1 & 0x1f);
}
else {
#line 317
if (
#line 316
InStateTemp != (void *)0 && InStateTemp->endpointDR == (volatile unsigned long *const )0x40600304 &&
InStateTemp->index != 0 && statetemp == 3)
{
if (!((InStateTemp->status & (1 << (1 & 0x1f))) != 0)) {
if (InStateTemp->source == 0) {
PXA27XUSBClientM$SendVarLenPacket$sendDone(InStateTemp->src, SUCCESS);
}
else {
#line 327
if (InStateTemp->source == 1) {
PXA27XUSBClientM$SendJTPacket$sendDone(InStateTemp->channel, InStateTemp->src,
InStateTemp->type, SUCCESS);
}
else {
#line 330
if (InStateTemp->source == 2) {
PXA27XUSBClientM$BareSendMsg$sendDone((TOS_MsgPtr )InStateTemp->src,
SUCCESS);
}
}
}
#line 333
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 333
QueueTemp = PXA27XUSBClientM$InQueue;
#line 333
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$clearUSBdata((PXA27XUSBClientM$USBdata )PXA27XUSBClientM$DynQueue_dequeue(QueueTemp), 1);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 335
PXA27XUSBClientM$InState = (void *)0;
#line 335
__nesc_atomic_end(__nesc_atomic); }
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) > 0) {
TOS_post(PXA27XUSBClientM$sendIn);
}
else {
#line 339
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 339
PXA27XUSBClientM$InTask = 0;
#line 339
__nesc_atomic_end(__nesc_atomic); }
}
}
else {
TOS_post(PXA27XUSBClientM$sendIn);
}
}
}
}
#line 350
if ((* (volatile uint32_t *)0x4060000C & (1 << (4 & 0x1f))) != 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 355
statetemp = PXA27XUSBClientM$state;
#line 355
__nesc_atomic_end(__nesc_atomic); }
* (volatile uint32_t *)0x4060000C = 1 << (4 & 0x1f);
if (statetemp == 3) {
PXA27XUSBClientM$retrieveOut();
}
else
#line 359
{
* (volatile uint32_t *)0x40600108 = 1 << (1 & 0x1f);
}
}
break;
default:
if ((* (volatile uint32_t *)0x4060000C & (1 << (0 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (0 & 0x1f);
}
#line 368
if ((* (volatile uint32_t *)0x4060000C & (1 << (2 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (2 & 0x1f);
}
#line 370
if ((* (volatile uint32_t *)0x4060000C & (1 << (4 & 0x1f))) != 0) {
* (volatile uint32_t *)0x4060000C = 1 << (4 & 0x1f);
}
#line 372
if ((* (volatile uint32_t *)0x40600010 & (1 << (31 & 0x1f))) != 0) {
* (volatile uint32_t *)0x40600010 = 1 << (31 & 0x1f);
}
#line 374
if ((* (volatile uint32_t *)0x40600010 & (1 << (27 & 0x1f))) != 0) {
* (volatile uint32_t *)0x40600010 = 1 << (27 & 0x1f);
}
#line 376
break;
}
}
# 459 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$PI2CInterrupt$fired(void)
#line 459
{
uint32_t status;
#line 460
uint32_t update = 0;
#line 461
status = * (volatile uint32_t *)0x40F00198;
if (status & (1 << 6)) {
update |= 1 << 6;
}
if (status & (1 << 10)) {
update |= 1 << 10;
}
* (volatile uint32_t *)0x40F00198 = update;
}
# 105 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static void TimerM$Clock$setInterval(uint32_t arg_0x408ca068){
#line 105
PXA27XClockM$Clock$setInterval(arg_0x408ca068);
#line 105
}
#line 105
# 196 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static inline void TimerM$enqueue(uint8_t value)
#line 196
{
if (TimerM$queue_tail == NUM_TIMERS - 1) {
TimerM$queue_tail = -1;
}
#line 199
TimerM$queue_tail++;
TimerM$queue_size++;
TimerM$queue[(uint8_t )TimerM$queue_tail] = value;
}
# 139 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline uint8_t PMICM$getBatteryVoltage(void)
#line 139
{
uint8_t batteryVoltage;
#line 141
PMICM$getPMICADCVal(0, &batteryVoltage);
return batteryVoltage;
}
#line 716
static inline result_t PMICM$batteryMonitorTimer$fired(void)
#line 716
{
uint8_t vBat;
vBat = PMICM$getBatteryVoltage();
trace(DBG_USR1, "Battery Status: Current Battery Voltage is %.3fV\r\n", vBat * .01035 + 2.65);
if (vBat * .01035 + 2.65 < 3.4) {
PMICM$smartChargeEnable();
}
if (vBat * .01035 + 2.65 < 3.3) {
trace(DBG_USR1, "Battery voltage is below minimum of %f....turning off mote\r\n", 3.3);
}
return SUCCESS;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t PMICM$chargeMonitorTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(0U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 733 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline result_t PMICM$chargeMonitorTimer$fired(void)
#line 733
{
uint8_t vBat;
#line 734
uint8_t vChg;
#line 734
uint8_t iChg;
#line 734
uint8_t chargeControl;
#line 735
PMICM$PMIC$chargingStatus(&vBat, &vChg, &iChg, &chargeControl);
trace(DBG_USR1, "Charging Status: vBat = %.3fV %vChg = %.3fV iChg = %.3fA chargeControl =%#x\r\n",
vBat * .01035 + 2.65,
vChg * 6 * .01035,
iChg * .01035 / 1.656,
chargeControl);
if (vBat * .01035 + 2.65 > 4.0) {
trace(DBG_USR1, "Charging Status: Battery is charged...Battery Voltage is %.3fV\r\n", vBat * .01035 + 2.65);
PMICM$PMIC$enableCharging(FALSE);
PMICM$chargeMonitorTimer$stop();
}
return SUCCESS;
}
# 260 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline result_t SettingsM$StackCheckTimer$fired(void)
#line 260
{
extern uint32_t _SVC_MODE_STACK;
#line 267
extern uint32_t _IRQ_MODE_STACK;
#line 267
extern uint32_t _FIQ_MODE_STACK;
#line 267
extern uint32_t _UND_MODE_STACK;
#line 267
extern uint32_t _ABT_MODE_STACK;
#line 268
(void )(_SVC_MODE_STACK == 0xDEADBEEF || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc", (int )268, "_SVC_MODE_STACK == 0xDEADBEEF"), 0));
(void )(_IRQ_MODE_STACK == 0xDEADBEEF || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc", (int )269, "_IRQ_MODE_STACK == 0xDEADBEEF"), 0));
(void )(_FIQ_MODE_STACK == 0xDEADBEEF || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc", (int )270, "_FIQ_MODE_STACK == 0xDEADBEEF"), 0));
(void )(_UND_MODE_STACK == 0xDEADBEEF || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc", (int )271, "_UND_MODE_STACK == 0xDEADBEEF"), 0));
(void )(_ABT_MODE_STACK == 0xDEADBEEF || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc", (int )272, "_ABT_MODE_STACK == 0xDEADBEEF"), 0));
#line 307
return SUCCESS;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$initTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(4U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 84 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t GenericCommProM$CC2420Control$TunePreset(uint8_t arg_0x40940010){
#line 84
unsigned char result;
#line 84
#line 84
result = CC2420ControlM$CC2420Control$TunePreset(arg_0x40940010);
#line 84
#line 84
return result;
#line 84
}
#line 84
# 737 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$initRFChannel(uint8_t channel)
#line 737
{
if (channel >= 11 && channel <= 26) {
return GenericCommProM$CC2420Control$TunePreset(channel);
}
else {
return FAIL;
}
}
# 62 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
inline static result_t FlashManagerM$initRFChannel(uint8_t arg_0x41041bc8){
#line 62
unsigned char result;
#line 62
#line 62
result = GenericCommProM$initRFChannel(arg_0x41041bc8);
#line 62
#line 62
return result;
#line 62
}
#line 62
#line 146
static inline result_t FlashManagerM$FlashManager$init(void)
#line 146
{
uint8_t i;
uint8_t j;
uint32_t destAddr = 0;
uint32_t length = 0;
static uint16_t addrindex = 0;
uint32_t temp = 0;
if (addrindex == 0) {
destAddr = BASE_ADDR + 2 * addrindex;
FlashManagerM$FlashManager$read(destAddr, (void *)&FlashManagerM$FlashFlag, 2);
;
if (1 != FlashManagerM$FlashFlag) {
addrindex = 0;
return FAIL;
}
else
#line 162
{
addrindex++;
}
}
if (addrindex == 1) {
destAddr = BASE_ADDR + 2 * addrindex;
FlashManagerM$FlashManager$read(destAddr, (void *)&FlashManagerM$ProgID, 4);
;
if (FlashManagerM$ProgID == G_Ident.unix_time) {
;
addrindex++;
}
else
#line 175
{
addrindex = 0;
return FAIL;
}
}
if (addrindex == 2) {
destAddr = BASE_ADDR + 3 * addrindex;
FlashManagerM$FlashManager$read(destAddr, (void *)&FlashManagerM$RFChannel, 2);
;
FlashManagerM$buffer_fw.RFChannel = FlashManagerM$RFChannel;
FlashManagerM$initRFChannel((uint8_t )FlashManagerM$RFChannel);
addrindex++;
}
if (addrindex > 2) {
length = 5 * sizeof(SensorClient_t );
destAddr = BASE_ADDR + 8;
if (FlashManagerM$FlashManager$read(destAddr, (void *)FlashManagerM$sensor_I, length)) {
if (0xFFFF != FlashManagerM$sensor_I[0].samplingRate && FlashManagerM$sensor_I[0].samplingRate > 0) {
for (i = 3; i < 7; i++) {
j = i - 3;
sensor[i].samplingRate = FlashManagerM$sensor_I[j].samplingRate;
sensor[i].channel = FlashManagerM$sensor_I[j].channel;
sensor[i].type = FlashManagerM$sensor_I[j].type;
}
;
}
else {
return FAIL;
}
}
addrindex = 0;
}
return SUCCESS;
}
# 29 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
inline static result_t SmartSensingM$FlashManager$init(void){
#line 29
unsigned char result;
#line 29
#line 29
result = FlashManagerM$FlashManager$init();
#line 29
#line 29
return result;
#line 29
}
#line 29
# 253 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$initTimer$fired(void)
#line 253
{
;
if (SmartSensingM$FlashManager$init() == SUCCESS) {
SmartSensingM$updateMaxBlkNum();
SmartSensingM$setrate();
;
SmartSensingM$initTimer$stop();
}
else
#line 261
{
;
}
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$SensingTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = RealTimeM$Timer$stop(0U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t SmartSensingM$LocalTime$read(void){
#line 27
unsigned int result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 39 "/home/xu/oasis/interfaces/RealTime.nc"
inline static uint32_t SmartSensingM$RealTime$getTimeCount(void){
#line 39
unsigned int result;
#line 39
#line 39
result = RealTimeM$RealTime$getTimeCount();
#line 39
#line 39
return result;
#line 39
}
#line 39
# 616 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$WatchTimer$fired(void)
#line 616
{
uint32_t temptimeW = 0;
uint32_t templocaltime = 0;
if (!SmartSensingM$realTimeFired) {
temptimeW = SmartSensingM$RealTime$getTimeCount();
templocaltime = SmartSensingM$LocalTime$read();
SmartSensingM$SensingTimer$stop();
SmartSensingM$SensingTimer$start(TIMER_REPEAT, SmartSensingM$timerInterval);
}
SmartSensingM$realTimeFired = FALSE;
}
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t RealTimeM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 457 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$WatchTimer$fired(void)
#line 457
{
uint16_t i = 0;
#line 459
if (!RealTimeM$realTimeFired) {
for (i = 0; i < MAX_NUM_CLIENT; i++) {
RealTimeM$EventReport$eventSend(EVENT_TYPE_DATAMANAGE,
EVENT_LEVEL_URGENT,
eventprintf("RTC STOP at firecount[%i] %i of globaltime %i g_H %i.\n", i, RealTimeM$clientList[i].fireCount, RealTimeM$globaltime_t, RealTimeM$globaltime_tHist));
}
}
RealTimeM$realTimeFired = FALSE;
}
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t GPSSensorM$LocalTime$read(void){
#line 27
unsigned int result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t GPSSensorM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 262 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$RealTime$changeMode(uint8_t modeValue)
#line 262
{
RealTimeM$syncMode = modeValue;
RealTimeM$is_synced = FALSE;
return SUCCESS;
}
# 43 "/home/xu/oasis/interfaces/RealTime.nc"
inline static result_t GPSSensorM$RealTime$changeMode(uint8_t arg_0x40abd648){
#line 43
unsigned char result;
#line 43
#line 43
result = RealTimeM$RealTime$changeMode(arg_0x40abd648);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 623 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$changeModeTask(void)
#line 623
{
GPSSensorM$RealTime$changeMode(FTSP_SYNC);
GPSSensorM$EventReport$eventSend(EVENT_TYPE_SENSING, EVENT_LEVEL_URGENT,
eventprintf("Node %i to FTSP at LTime %i pps_index %i \n", TOS_LOCAL_ADDRESS, GPSSensorM$LocalTime$read(), GPSSensorM$ppsIndex));
}
# 276 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline uint8_t RealTimeM$RealTime$getMode(void)
#line 276
{
return RealTimeM$syncMode;
}
# 44 "/home/xu/oasis/interfaces/RealTime.nc"
inline static uint8_t GPSSensorM$RealTime$getMode(void){
#line 44
unsigned char result;
#line 44
#line 44
result = RealTimeM$RealTime$getMode();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 648 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline result_t GPSSensorM$CheckTimer$fired(void)
#line 648
{
if (GPSSensorM$last_pps_index == GPSSensorM$ppsIndex && GPSSensorM$checkTimerOn == TRUE) {
if (GPSSensorM$RealTime$getMode() == GPS_SYNC) {
TOS_post(GPSSensorM$changeModeTask);
}
GPSSensorM$hasGPS = FALSE;
GPSSensorM$alreadySetTime = FALSE;
}
GPSSensorM$checkTimerOn = FALSE;
TOS_post(GPSSensorM$selfCheckTask);
return SUCCESS;
}
# 108 "/opt/tinyos-1.x/tos/system/WDTM.nc"
static inline void WDTM$WDT$reset(void)
#line 108
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 109
{
WDTM$remaining = WDTM$increment;
}
#line 111
__nesc_atomic_end(__nesc_atomic); }
}
# 48 "/opt/tinyos-1.x/tos/interfaces/WDT.nc"
inline static void SNMSM$WWDT$reset(void){
#line 48
WDTM$WDT$reset();
#line 48
}
#line 48
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SNMSM$SNMSTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(7U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 187 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$SNMSTimer$fired(void)
#line 187
{
if (SNMSM$toBeRestart) {
SNMSM$rstdelayCount++;
if (SNMSM$rstdelayCount >= 50) {
SNMSM$SNMSTimer$stop();
}
}
#line 193
SNMSM$WWDT$reset();
return SUCCESS;
}
# 65 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdogM.nc"
static inline void PXA27XWatchdogM$PXA27XWatchdog$feedWDT(uint32_t interval)
#line 65
{
if (!PXA27XWatchdogM$resetMoteRequest) {
* (volatile uint32_t *)0x40A0000C = * (volatile uint32_t *)0x40A00010 + interval;
}
}
# 70 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdog.nc"
inline static void HPLWatchdogM$PXA27XWatchdog$feedWDT(uint32_t arg_0x408a78a8){
#line 70
PXA27XWatchdogM$PXA27XWatchdog$feedWDT(arg_0x408a78a8);
#line 70
}
#line 70
# 67 "/opt/tinyos-1.x/tos/platform/pxa27x/HPLWatchdogM.nc"
static inline void HPLWatchdogM$reset(void)
#line 67
{
HPLWatchdogM$PXA27XWatchdog$feedWDT(3250000);
}
# 50 "/opt/tinyos-1.x/tos/system/WDTM.nc"
inline static void WDTM$reset(void){
#line 50
HPLWatchdogM$reset();
#line 50
}
#line 50
#line 87
static inline result_t WDTM$Timer$fired(void)
#line 87
{
if (WDTM$increment != 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 89
{
WDTM$remaining = WDTM$remaining - WDTM$WDT_LATENCY;
}
#line 91
__nesc_atomic_end(__nesc_atomic); }
}
if (WDTM$remaining > 0) {
WDTM$reset();
}
#line 95
return SUCCESS;
}
# 747 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$timeSyncMsgSend(void)
#line 747
{
if (TimeSyncM$mode != TS_USER_MODE) {
TimeSyncM$adjustRootID();
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != 0xFFFF && (TimeSyncM$state & TimeSyncM$STATE_SENDING) == 0) {
TimeSyncM$state |= TimeSyncM$STATE_SENDING;
TOS_post(TimeSyncM$sendMsg);
}
}
else
{
if ((TimeSyncM$state & TimeSyncM$STATE_SENDING) == 0) {
TimeSyncM$state |= TimeSyncM$STATE_SENDING;
TOS_post(TimeSyncM$sendMsg);
}
}
}
# 251 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline bool RealTimeM$RealTime$isSync(void)
#line 251
{
return RealTimeM$is_synced;
}
# 42 "/home/xu/oasis/interfaces/RealTime.nc"
inline static bool TimeSyncM$RealTime$isSync(void){
#line 42
unsigned char result;
#line 42
#line 42
result = RealTimeM$RealTime$isSync();
#line 42
#line 42
return result;
#line 42
}
#line 42
inline static uint8_t TimeSyncM$RealTime$getMode(void){
#line 44
unsigned char result;
#line 44
#line 44
result = RealTimeM$RealTime$getMode();
#line 44
#line 44
return result;
#line 44
}
#line 44
# 782 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$Timer$fired(void)
#line 782
{
if (TimeSyncM$RealTime$getMode() == GPS_SYNC) {
if (TimeSyncM$RealTime$isSync()) {
TimeSyncM$mode = TS_USER_MODE;
}
}
else {
#line 796
TimeSyncM$mode = TS_TIMER_MODE;
}
TimeSyncM$timeSyncMsgSend();
return SUCCESS;
}
# 280 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline void SNMSM$restart(void)
#line 280
{
SNMSM$rstdelayCount = 0;
SNMSM$toBeRestart = TRUE;
}
# 111 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
inline static void GenericCommProM$restart(void){
#line 111
SNMSM$restart();
#line 111
}
#line 111
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t GenericCommProM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 341 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$MonitorTimer$fired(void)
#line 341
{
if (GenericCommProM$wdtTimerCnt++ < COMM_WDT_UPDATE_PERIOD) {
return SUCCESS;
}
GenericCommProM$wdtTimerCnt = 0;
if (!GenericCommProM$radioRecvActive) {
GenericCommProM$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Comm: Restart For No Recv"));
GenericCommProM$restart();
}
else {
#line 350
if (!GenericCommProM$radioSendActive) {
GenericCommProM$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Comm: Restart For No Send"));
GenericCommProM$restart();
}
else
#line 354
{
GenericCommProM$radioRecvActive = FALSE;
GenericCommProM$radioSendActive = FALSE;
}
}
#line 358
return SUCCESS;
}
#line 333
static inline result_t GenericCommProM$ActivityTimer$fired(void)
#line 333
{
GenericCommProM$lastCount = GenericCommProM$counter;
GenericCommProM$counter = 0;
GenericCommProM$tryNextSend();
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t FlashManagerM$WritingTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(13U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 326 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static inline void FlashM$Flash$setFlashPartitionState(uint32_t addr)
{
addr = addr / 0x20000 * 0x20000;
FlashM$FlashPartitionState[addr / 0x200000] = 0;
}
# 54 "/home/xu/oasis/lib/SmartSensing/Flash.nc"
inline static void FlashManagerM$Flash$setFlashPartitionState(uint32_t arg_0x40ad0ad8){
#line 54
FlashM$Flash$setFlashPartitionState(arg_0x40ad0ad8);
#line 54
}
#line 54
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t FlashManagerM$EraseCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(14U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 373 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static inline result_t FlashManagerM$EraseCheckTimer$fired(void)
#line 373
{
uint16_t status = 0xFFFF;
status = __GetEraseStatus(BASE_ADDR);
if (!(status & 0x80)) {
FlashManagerM$EraseCheckTimer$start(TIMER_ONE_SHOT, 200);
}
else
#line 379
{
status = __EraseFlashSpin(BASE_ADDR);
FlashManagerM$Flash$setFlashPartitionState(BASE_ADDR);
if (status != 0x80) {
;
}
else
#line 384
{
;
FlashManagerM$WritingTimer$start(TIMER_ONE_SHOT, 1024 * 5);
}
}
return SUCCESS;
}
#line 361
static inline result_t FlashManagerM$WritingTimer$fired(void)
#line 361
{
;
if (TRUE != FlashManagerM$writeTaskBusy) {
TOS_post(FlashManagerM$writeTask);
}
else
#line 365
{
FlashManagerM$WritingTimer$start(TIMER_ONE_SHOT, 1024 * 60);
;
}
return SUCCESS;
}
# 332 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static inline result_t FlashM$Flash$erase(uint32_t addr)
{
uint16_t status;
#line 334
uint16_t i;
uint32_t j;
if (addr > 0x02000000) {
return FAIL;
}
#line 339
if (addr < 0x00200000) {
return FAIL;
}
addr = addr / 0x20000 * 0x20000;
for (i = 0; i < 16; i++)
if (
#line 345
i != addr / 0x200000 &&
FlashM$FlashPartitionState[i] != 0 &&
FlashM$FlashPartitionState[i] != 3)
{
trace(DBG_USR1, "Flash partition not read active and inactive\n");
return FAIL;
}
if (FlashM$FlashPartitionState[addr / 0x200000] != 0)
{
trace(DBG_USR1, "Flash Partition not read read inactive %x\n", addr);
return FAIL;
}
FlashM$FlashPartitionState[addr / 0x200000] = 2;
for (j = 0; j < 0x20000; j++) {
uint32_t tempCheck = * (uint32_t *)(addr + j);
#line 361
if (tempCheck != 0xFFFFFFFF) {
break;
}
#line 363
if (j == 0x20000 - 1) {
FlashM$FlashPartitionState[addr / 0x200000] = 0;
return SUCCESS;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 368
{
FlashM$unlock(addr);
;
status = __Flash_Erase(addr);
;
;
}
#line 375
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 28 "/home/xu/oasis/lib/SmartSensing/Flash.nc"
inline static result_t FlashManagerM$Flash$erase(uint32_t arg_0x40ad11d8){
#line 28
unsigned char result;
#line 28
#line 28
result = FlashM$Flash$erase(arg_0x40ad11d8);
#line 28
#line 28
return result;
#line 28
}
#line 28
#line 19
inline static result_t FlashManagerM$Flash$write(uint32_t arg_0x40ad3868, uint8_t *arg_0x40ad3a10, uint32_t arg_0x40ad3ba8){
#line 19
unsigned char result;
#line 19
#line 19
result = FlashM$Flash$write(arg_0x40ad3868, arg_0x40ad3a10, arg_0x40ad3ba8);
#line 19
#line 19
return result;
#line 19
}
#line 19
# 244 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static inline void FlashManagerM$eraseTask(void)
#line 244
{
result_t result;
FlashManagerM$Flash$write(BASE_ADDR, (void *)&FlashManagerM$buffer_fw, 2);
result = FlashManagerM$Flash$erase(BASE_ADDR);
if (result != SUCCESS) {
;
}
else {
FlashManagerM$EraseCheckTimer$start(TIMER_ONE_SHOT, 2000);
;
}
}
#line 353
static inline result_t FlashManagerM$EraseTimer$fired(void)
#line 353
{
;
FlashManagerM$alreadyStart = FALSE;
TOS_post(FlashManagerM$eraseTask);
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t DataMgmtM$SysCheckTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(16U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t DataMgmtM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SENSING, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 61 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
inline static void DataMgmtM$restart(void){
#line 61
SNMSM$restart();
#line 61
}
#line 61
#line 352
static inline result_t DataMgmtM$SysCheckTimer$fired(void)
#line 352
{
if (DataMgmtM$sysCheckCount == 6) {
DataMgmtM$restart();
DataMgmtM$sysCheckCount = 0;
}
else {
if (DataMgmtM$sysCheckCount == 5) {
DataMgmtM$EventReport$eventSend(EVENT_TYPE_SENSING, EVENT_LEVEL_URGENT,
eventprintf("Node %i failed to send packet for 5 minutes\n", TOS_LOCAL_ADDRESS));
}
++DataMgmtM$sysCheckCount;
DataMgmtM$SysCheckTimer$start(TIMER_ONE_SHOT, 60000UL);
}
return SUCCESS;
}
#line 329
static inline result_t DataMgmtM$BatchTimer$fired(void)
#line 329
{
DataMgmtM$batchTimerCount++;
DataMgmtM$BatchTimer$start(TIMER_ONE_SHOT, BATCH_TIMER_INTERVAL);
if (DataMgmtM$processTaskBusy != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 334
DataMgmtM$processTaskBusy = TRUE;
#line 334
__nesc_atomic_end(__nesc_atomic); }
if ((void *)0 != headMemElement(&DataMgmtM$sensorMem, FILLED) || (void *)0 != headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 337
DataMgmtM$processTaskBusy = TOS_post(DataMgmtM$processTask);
#line 337
__nesc_atomic_end(__nesc_atomic); }
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 341
DataMgmtM$processTaskBusy = FALSE;
#line 341
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
# 246 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline result_t ADCM$Timer$fired(void)
#line 246
{
return SUCCESS;
}
# 394 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$CascadeControl$deleteDirectChild(address_t childID)
#line 394
{
CascadesRouterM$delFromChildrenList(childID);
return SUCCESS;
}
# 4 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$deleteDirectChild(address_t arg_0x41218088){
#line 4
unsigned char result;
#line 4
#line 4
result = CascadesRouterM$CascadeControl$deleteDirectChild(arg_0x41218088);
#line 4
#line 4
return result;
#line 4
}
#line 4
# 187 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline void NeighborMgmtM$updateTable(void)
#line 187
{
NBRTableEntry *pNbr;
uint8_t childLiveOrigin = 0;
uint8_t i = 0;
#line 191
for (i = 0; i < 16; i++) {
pNbr = &NeighborMgmtM$NeighborTbl[i];
if (pNbr->flags & NBRFLAG_VALID) {
NeighborMgmtM$ticks++;
if (NeighborMgmtM$ticks >= 10) {
NeighborMgmtM$ticks = 0;
pNbr->linkEst = pNbr->linkEstCandidate;
pNbr->linkEstCandidate = 0;
pNbr->flags |= NBRFLAG_JUST_UPDATED;
}
if (pNbr->liveliness > 0) {
pNbr->liveliness--;
}
childLiveOrigin = pNbr->childLiveliness;
if (pNbr->childLiveliness > 0) {
pNbr->childLiveliness--;
}
if (pNbr->childLiveliness == 0 && childLiveOrigin - pNbr->childLiveliness == 1) {
if (pNbr->relation & NBR_DIRECT_CHILD) {
NeighborMgmtM$CascadeControl$deleteDirectChild(pNbr->id);
}
pNbr->relation &= ~(NBR_CHILD | NBR_DIRECT_CHILD);
}
}
}
}
#line 183
static inline void NeighborMgmtM$timerTask(void)
#line 183
{
NeighborMgmtM$updateTable();
}
#line 69
static inline result_t NeighborMgmtM$Timer$fired(void)
#line 69
{
if (NeighborMgmtM$initTime) {
NeighborMgmtM$initTime = FALSE;
return NeighborMgmtM$Timer$start(TIMER_REPEAT, 1024);
}
else {
return TOS_post(NeighborMgmtM$timerTask);
}
}
# 543 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$MultihopCtrl$readyToSend(void)
{
MultiHopEngineM$tryNextSend();
return SUCCESS;
}
# 6 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopLQI$MultihopCtrl$readyToSend(void){
#line 6
unsigned char result;
#line 6
#line 6
result = MultiHopEngineM$MultihopCtrl$readyToSend();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 5 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$setParent(uint16_t arg_0x40e1d4c0){
#line 5
unsigned char result;
#line 5
#line 5
result = NeighborMgmtM$NeighborCtrl$setParent(arg_0x40e1d4c0);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t MultiHopLQI$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 190 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline void MultiHopLQI$TimerTask(void)
#line 190
{
uint8_t val;
#line 192
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 192
val = ++MultiHopLQI$gLastHeard;
#line 192
__nesc_atomic_end(__nesc_atomic); }
if (!MultiHopLQI$localBeSink && val > MultiHopLQI$BEACON_TIMEOUT) {
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Engine:from %i timeout val:%i", MultiHopLQI$gbCurrentParent, val));
MultiHopLQI$receivedBeacon = FALSE;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$fixedParent = FALSE;
if (!MultiHopLQI$localBeSink) {
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
}
}
if (MultiHopLQI$localBeSink) {
MultiHopLQI$NeighborCtrl$setParent(TOS_UART_ADDR);
}
TOS_post(MultiHopLQI$SendRouteTask);
}
#line 429
static inline result_t MultiHopLQI$Timer$fired(void)
#line 429
{
TOS_post(MultiHopLQI$TimerTask);
MultiHopLQI$MultihopCtrl$readyToSend();
if (MultiHopLQI$localBeSink) {
MultiHopLQI$Timer$start(TIMER_ONE_SHOT, 1024 * MultiHopLQI$gUpdateInterval + 1);
}
else {
#line 437
MultiHopLQI$Timer$start(TIMER_ONE_SHOT, 1024 * MultiHopLQI$gUpdateInterval + 1);
}
#line 438
return SUCCESS;
}
# 5 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$parentChanged(address_t arg_0x41218530){
#line 5
unsigned char result;
#line 5
#line 5
result = CascadesRouterM$CascadeControl$parentChanged(arg_0x41218530);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 238 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline bool NeighborMgmtM$NeighborCtrl$changeParent(uint16_t *newParent, uint16_t *parentCost, uint16_t *linkEst)
#line 238
{
uint32_t totalCost = 0xffff;
uint32_t tempCost = 0x7fff;
uint8_t bestLinkEntry = 16;
uint8_t ind = 0;
#line 243
for (ind = 0; ind < 16; ind++) {
if (NeighborMgmtM$NeighborTbl[ind].flags & NBRFLAG_VALID) {
if (NeighborMgmtM$NeighborTbl[ind].relation & (NBR_CHILD | NBR_PARENT) || NeighborMgmtM$NeighborTbl[ind].liveliness == 0) {
continue;
}
tempCost = (uint32_t )NeighborMgmtM$adjustLQI(NeighborMgmtM$NeighborTbl[ind].linkEst) + (uint32_t )NeighborMgmtM$NeighborTbl[ind].parentCost;
if (tempCost < totalCost) {
bestLinkEntry = ind;
totalCost = tempCost;
}
}
}
if (bestLinkEntry == 16 || totalCost == 0xffff) {
return FALSE;
}
else {
NeighborMgmtM$NeighborCtrl$clearParent(TRUE);
*newParent = NeighborMgmtM$NeighborTbl[bestLinkEntry].id;
*parentCost = NeighborMgmtM$NeighborTbl[bestLinkEntry].parentCost;
*linkEst = NeighborMgmtM$adjustLQI(NeighborMgmtM$NeighborTbl[bestLinkEntry].linkEst);
;
NeighborMgmtM$NeighborTbl[bestLinkEntry].relation = NBR_PARENT;
NeighborMgmtM$CascadeControl$parentChanged(*newParent);
return TRUE;
}
}
# 4 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$changeParent(uint16_t *arg_0x40e1fc48, uint16_t *arg_0x40e1fdf8, uint16_t *arg_0x40e1d010){
#line 4
unsigned char result;
#line 4
#line 4
result = NeighborMgmtM$NeighborCtrl$changeParent(arg_0x40e1fc48, arg_0x40e1fdf8, arg_0x40e1d010);
#line 4
#line 4
return result;
#line 4
}
#line 4
# 547 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$MultihopCtrl$switchParent(void)
#line 547
{
if (MultiHopLQI$NeighborCtrl$changeParent(&MultiHopLQI$gbCurrentParent, &MultiHopLQI$gbCurrentCost, &MultiHopLQI$gbCurrentLinkEst)) {
return SUCCESS;
}
else
#line 551
{
#line 564
return FAIL;
}
}
# 2 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopEngineM$MultihopCtrl$switchParent(void){
#line 2
unsigned char result;
#line 2
#line 2
result = MultiHopLQI$MultihopCtrl$switchParent();
#line 2
#line 2
return result;
#line 2
}
#line 2
# 360 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteControl$getParent(void)
#line 360
{
return MultiHopLQI$gbCurrentParent;
}
# 49 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
inline static uint16_t MultiHopEngineM$RouteSelectCntl$getParent(void){
#line 49
unsigned short result;
#line 49
#line 49
result = MultiHopLQI$RouteControl$getParent();
#line 49
#line 49
return result;
#line 49
}
#line 49
# 582 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline uint16_t MultiHopEngineM$RouteControl$getParent(void)
#line 582
{
return MultiHopEngineM$RouteSelectCntl$getParent();
}
#line 523
static inline result_t MultiHopEngineM$RouteStatusTimer$fired(void)
#line 523
{
if (!MultiHopEngineM$beParentActive) {
;
if (MultiHopEngineM$RouteControl$getParent() != TOS_BCAST_ADDR) {
MultiHopEngineM$MultihopCtrl$switchParent();
MultiHopEngineM$numOfSuccessiveFailures = 0;
}
}
MultiHopEngineM$beParentActive = FALSE;
return SUCCESS;
}
#line 42
inline static void MultiHopEngineM$restart(void){
#line 42
SNMSM$restart();
#line 42
}
#line 42
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t MultiHopEngineM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SNMS, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 501 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$MonitorTimer$fired(void)
#line 501
{
if (MultiHopEngineM$wdtTimerCnt++ < MultiHopEngineM$WDT_UPDATE_PERIOD) {
MultiHopEngineM$MonitorTimer$start(TIMER_ONE_SHOT, MultiHopEngineM$WDT_UPDATE_UNIT);
return SUCCESS;
}
MultiHopEngineM$wdtTimerCnt = 0;
if (!MultiHopEngineM$beRadioActive) {
MultiHopEngineM$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Engine:RST Inactive"));
MultiHopEngineM$restart();
}
else
#line 511
{
MultiHopEngineM$beRadioActive = FALSE;
MultiHopEngineM$MonitorTimer$start(TIMER_ONE_SHOT, MultiHopEngineM$WDT_UPDATE_UNIT);
}
return SUCCESS;
}
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t CascadesRouterM$SubSend$send(uint8_t arg_0x413687d8, TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0){
#line 83
unsigned char result;
#line 83
#line 83
result = CascadesEngineM$MySend$send(arg_0x413687d8, arg_0x409bc330, arg_0x409bc4c0);
#line 83
#line 83
return result;
#line 83
}
#line 83
# 564 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$ACKTimer$fired(void)
#line 564
{
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, &CascadesRouterM$SendCtrlMsg, CascadesRouterM$SendCtrlMsg.length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 566
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 566
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
#line 556
static inline result_t CascadesRouterM$DelayTimer$fired(void)
#line 556
{
if (CascadesRouterM$sigRcvTaskBusy != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 558
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
#line 558
__nesc_atomic_end(__nesc_atomic); }
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 560
CascadesRouterM$delayTimerBusy = FALSE;
#line 560
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ResetTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(24U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 536 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$ResetTimer$fired(void)
#line 536
{
++CascadesRouterM$resetCount;
if (CascadesRouterM$resetCount == 10) {
CascadesRouterM$initialize();
}
else {
CascadesRouterM$ResetTimer$start(TIMER_ONE_SHOT, 60000UL);
}
return SUCCESS;
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t CascadesRouterM$Random$rand(void){
#line 63
unsigned short result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$DTTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(23U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 119 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline NetworkMsg *CascadesRouterM$getCasData(TOS_MsgPtr tmPtr)
#line 119
{
return (NetworkMsg *)tmPtr->data;
}
#line 305
static inline void CascadesRouterM$produceDataMsg(TOS_MsgPtr tmPtr)
#line 305
{
NetworkMsg *nwMsg = (NetworkMsg *)tmPtr->data;
#line 307
nwMsg->linksource = TOS_LOCAL_ADDRESS;
}
#line 437
static inline result_t CascadesRouterM$DTTimer$fired(void)
#line 437
{
TOS_MsgPtr tempPtr = (void *)0;
int8_t i = 0;
uint8_t stopCount = 0;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[i].countDT != 0) {
if (CascadesRouterM$getCMAu(i) == TRUE) {
CascadesRouterM$clearChildrenListStatus(i);
stopCount++;
}
else {
CascadesRouterM$myBuffer[i].countDT--;
if (CascadesRouterM$myBuffer[i].countDT == 0) {
CascadesRouterM$myBuffer[i].countDT = DEFAULT_DTCOUNT;
++ CascadesRouterM$myBuffer[i].retry;
tempPtr = & CascadesRouterM$myBuffer[i].tmsg;
CascadesRouterM$produceDataMsg(tempPtr);
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCADESMSG, tempPtr, tempPtr->length)) {
}
if (CascadesRouterM$myBuffer[i].retry >= MAX_CAS_RETRY_COUNT) {
CascadesRouterM$clearChildrenListStatus(i);
stopCount = MAX_CAS_BUF;
break;
}
else {
if (CascadesRouterM$myBuffer[i].retry > 2) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 466
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 466
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$produceCtrlMsg(&CascadesRouterM$SendCtrlMsg, CascadesRouterM$getCasData(tempPtr)->seqno, TYPE_CASCADES_CMAU);
tempPtr = &CascadesRouterM$SendCtrlMsg;
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 471
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 471
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
}
}
}
else
{
stopCount++;
}
}
if (stopCount != MAX_CAS_BUF) {
CascadesRouterM$DTTimer$start(TIMER_ONE_SHOT, MIN_INTERVAL + (CascadesRouterM$Random$rand() & 0xf));
}
else {
CascadesRouterM$DataTimerOn = FALSE;
}
return SUCCESS;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$RTTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(22U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 501 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$RTTimer$fired(void)
#line 501
{
TOS_MsgPtr tempPtr = (void *)0;
#line 503
if (CascadesRouterM$expectingSeq >= CascadesRouterM$highestSeq) {
CascadesRouterM$RTTimer$stop();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 505
CascadesRouterM$activeRT = FALSE;
#line 505
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
if (CascadesRouterM$expectingSeq - CascadesRouterM$highestSeq < 10) {
CascadesRouterM$RTTimer$stop();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 511
CascadesRouterM$activeRT = FALSE;
#line 511
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
}
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 516
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 516
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_REQ);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 522
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 522
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
# 192 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static inline result_t TimerM$Timer$default$fired(uint8_t id)
#line 192
{
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t TimerM$Timer$fired(uint8_t arg_0x408cf2b8){
#line 73
unsigned char result;
#line 73
#line 73
switch (arg_0x408cf2b8) {
#line 73
case 0U:
#line 73
result = PMICM$chargeMonitorTimer$fired();
#line 73
break;
#line 73
case 1U:
#line 73
result = PMICM$batteryMonitorTimer$fired();
#line 73
break;
#line 73
case 2U:
#line 73
result = SettingsM$StackCheckTimer$fired();
#line 73
break;
#line 73
case 3U:
#line 73
result = SmartSensingM$WatchTimer$fired();
#line 73
break;
#line 73
case 4U:
#line 73
result = SmartSensingM$initTimer$fired();
#line 73
break;
#line 73
case 5U:
#line 73
result = RealTimeM$WatchTimer$fired();
#line 73
break;
#line 73
case 6U:
#line 73
result = GPSSensorM$CheckTimer$fired();
#line 73
break;
#line 73
case 7U:
#line 73
result = SNMSM$SNMSTimer$fired();
#line 73
break;
#line 73
case 8U:
#line 73
result = WDTM$Timer$fired();
#line 73
break;
#line 73
case 9U:
#line 73
result = TimeSyncM$Timer$fired();
#line 73
break;
#line 73
case 10U:
#line 73
result = GenericCommProM$ActivityTimer$fired();
#line 73
break;
#line 73
case 11U:
#line 73
result = GenericCommProM$MonitorTimer$fired();
#line 73
break;
#line 73
case 12U:
#line 73
result = FlashManagerM$EraseTimer$fired();
#line 73
break;
#line 73
case 13U:
#line 73
result = FlashManagerM$WritingTimer$fired();
#line 73
break;
#line 73
case 14U:
#line 73
result = FlashManagerM$EraseCheckTimer$fired();
#line 73
break;
#line 73
case 15U:
#line 73
result = DataMgmtM$BatchTimer$fired();
#line 73
break;
#line 73
case 16U:
#line 73
result = DataMgmtM$SysCheckTimer$fired();
#line 73
break;
#line 73
case 17U:
#line 73
result = ADCM$Timer$fired();
#line 73
break;
#line 73
case 18U:
#line 73
result = NeighborMgmtM$Timer$fired();
#line 73
break;
#line 73
case 19U:
#line 73
result = MultiHopEngineM$MonitorTimer$fired();
#line 73
break;
#line 73
case 20U:
#line 73
result = MultiHopEngineM$RouteStatusTimer$fired();
#line 73
break;
#line 73
case 21U:
#line 73
result = MultiHopLQI$Timer$fired();
#line 73
break;
#line 73
case 22U:
#line 73
result = CascadesRouterM$RTTimer$fired();
#line 73
break;
#line 73
case 23U:
#line 73
result = CascadesRouterM$DTTimer$fired();
#line 73
break;
#line 73
case 24U:
#line 73
result = CascadesRouterM$ResetTimer$fired();
#line 73
break;
#line 73
case 25U:
#line 73
result = CascadesRouterM$DelayTimer$fired();
#line 73
break;
#line 73
case 26U:
#line 73
result = CascadesRouterM$ACKTimer$fired();
#line 73
break;
#line 73
default:
#line 73
result = TimerM$Timer$default$fired(arg_0x408cf2b8);
#line 73
break;
#line 73
}
#line 73
#line 73
return result;
#line 73
}
#line 73
# 204 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static inline uint8_t TimerM$dequeue(void)
#line 204
{
uint8_t ret;
#line 206
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 206
{
if (TimerM$queue_size == 0) {
ret = NUM_TIMERS;
}
else {
#line 210
if (TimerM$queue_head == NUM_TIMERS - 1) {
TimerM$queue_head = -1;
}
}
#line 212
TimerM$queue_head++;
TimerM$queue_size--;
ret = TimerM$queue[(uint8_t )TimerM$queue_head];
}
#line 215
__nesc_atomic_end(__nesc_atomic); }
return ret;
}
static inline void TimerM$signalOneTimer(void)
#line 219
{
uint8_t itimer = TimerM$dequeue();
#line 221
if (itimer < NUM_TIMERS) {
TimerM$Timer$fired(itimer);
}
}
#line 225
static inline result_t TimerM$Clock$fire(void)
#line 225
{
uint32_t newInterval = ~ (uint32_t )0;
uint32_t i;
if (TimerM$mState) {
for (i = 0; i < NUM_TIMERS; i++) {
if (TimerM$mState & (0x1L << i)) {
TimerM$mTimerList[i].ticksLeft -= TimerM$mCurrentInterval;
if (TimerM$mTimerList[i].ticksLeft <= 0) {
if (TOS_post(TimerM$signalOneTimer)) {
if (TimerM$mTimerList[i].type == TIMER_REPEAT) {
TimerM$mTimerList[i].ticksLeft = TimerM$mTimerList[i].ticks;
}
else {
TimerM$mState &= ~(0x1L << i);
}
TimerM$enqueue(i);
}
else {
printFatalErrorMsg("TimerM found Task queue full", 0);
return FAIL;
}
}
if (TimerM$mTimerList[i].ticksLeft < newInterval && TimerM$mTimerList[i].ticksLeft != 0) {
newInterval = TimerM$mTimerList[i].ticksLeft;
}
}
}
}
if (newInterval != ~ (uint32_t )0) {
TimerM$mCurrentInterval = newInterval;
TimerM$Clock$setInterval(TimerM$mCurrentInterval);
}
else {
TimerM$mCurrentInterval = 0;
}
return SUCCESS;
}
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static result_t PXA27XClockM$Clock$fire(void){
#line 180
unsigned char result;
#line 180
#line 180
result = TimerM$Clock$fire();
#line 180
#line 180
return result;
#line 180
}
#line 180
# 84 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static inline void PXA27XClockM$OSTIrq$fired(void)
#line 84
{
if (* (volatile uint32_t *)0x40A00014 & (1 << 5)) {
* (volatile uint32_t *)0x40A00014 = 1 << 5;
PXA27XClockM$Clock$fire();
}
}
# 429 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline void RealTimeM$enqueue(uint8_t value)
#line 429
{
if (RealTimeM$queue_tail == 30 - 1) {
RealTimeM$queue_tail = -1;
}
RealTimeM$queue_tail++;
RealTimeM$queue_size++;
RealTimeM$queue[(uint8_t )RealTimeM$queue_tail] = value;
}
# 6 "/home/xu/oasis/interfaces/GPSGlobalTime.nc"
inline static uint32_t RealTimeM$GPSGlobalTime$getGlobalTime(void){
#line 6
unsigned int result;
#line 6
#line 6
result = GPSSensorM$GPSGlobalTime$getGlobalTime();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t TimeSyncM$LocalTime$read(void){
#line 27
unsigned int result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 204 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline uint32_t TimeSyncM$GlobalTime$getLocalTime(void)
{
return TimeSyncM$LocalTime$read();
}
static inline result_t TimeSyncM$GlobalTime$getGlobalTime(uint32_t *time)
{
*time = TimeSyncM$GlobalTime$getLocalTime();
return TimeSyncM$GlobalTime$local2Global(time);
}
# 43 "/home/xu/oasis/lib/FTSP/TimeSync/GlobalTime.nc"
inline static result_t RealTimeM$GlobalTime$getGlobalTime(uint32_t *arg_0x40b6cdd8){
#line 43
unsigned char result;
#line 43
#line 43
result = TimeSyncM$GlobalTime$getGlobalTime(arg_0x40b6cdd8);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 489 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline void RealTimeM$updateTimer(void)
#line 489
{
int32_t i = 0;
if (RealTimeM$syncMode == FTSP_SYNC) {
RealTimeM$GlobalTime$getGlobalTime(&RealTimeM$globaltime_t);
RealTimeM$globaltime_t = RealTimeM$globaltime_t % DAY_END;
}
if (RealTimeM$syncMode == GPS_SYNC) {
RealTimeM$globaltime_t = RealTimeM$GPSGlobalTime$getGlobalTime();
RealTimeM$globaltime_t = RealTimeM$globaltime_t % DAY_END;
}
if (RealTimeM$mState) {
while (i < MAX_NUM_CLIENT) {
if (RealTimeM$mState & (0x1L << i)) {
if (RealTimeM$clientList[i].fireCount >= DAY_END) {
RealTimeM$clientList[i].fireCount -= DAY_END;
}
if (RealTimeM$clientList[i].fireCount <= RealTimeM$globaltime_t && RealTimeM$globaltime_t - RealTimeM$clientList[i].fireCount < DAY_END >> 1) {
if (RealTimeM$clientList[i].type == TIMER_REPEAT) {
while (RealTimeM$clientList[i].fireCount <= RealTimeM$globaltime_t) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 520
RealTimeM$clientList[i].fireCount += RealTimeM$clientList[i].syncInterval;
#line 520
__nesc_atomic_end(__nesc_atomic); }
}
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 527
RealTimeM$mState &= ~(0x1L << i);
#line 527
__nesc_atomic_end(__nesc_atomic); }
}
if (TRUE != RealTimeM$taskBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 531
RealTimeM$taskBusy = TOS_post(RealTimeM$signalOneTimer);
#line 531
__nesc_atomic_end(__nesc_atomic); }
}
RealTimeM$enqueue(i);
RealTimeM$realTimeFired = TRUE;
}
else {
#line 535
if (RealTimeM$globaltime_t <= RealTimeM$clientList[i].fireCount && RealTimeM$globaltime_t < RealTimeM$globaltime_tHist) {
while (RealTimeM$clientList[i].fireCount - DAY_END < RealTimeM$globaltime_t) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 537
RealTimeM$clientList[i].fireCount += RealTimeM$clientList[i].syncInterval;
#line 537
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
#line 541
++i;
}
}
RealTimeM$globaltime_tHist = RealTimeM$globaltime_t;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 545
RealTimeM$timerBusy = FALSE;
#line 545
__nesc_atomic_end(__nesc_atomic); }
}
#line 634
static inline result_t RealTimeM$Clock$fire(void)
#line 634
{
uint32_t globaltime = 0;
int32_t i = 0;
++RealTimeM$localTime;
if (RealTimeM$localTime >= DAY_END) {
RealTimeM$localTime -= DAY_END;
}
if (RealTimeM$timerBusy == FALSE) {
if (TOS_post(RealTimeM$updateTimer) == SUCCESS) {
RealTimeM$timerBusy = TRUE;
}
}
return SUCCESS;
}
# 240 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline result_t ADCM$Clock$fire(void)
#line 240
{
return SUCCESS;
}
# 180 "/opt/tinyos-1.x/tos/platform/pxa27x/Clock.nc"
inline static result_t RTCClockM$MicroClock$fire(void){
#line 180
unsigned char result;
#line 180
#line 180
result = ADCM$Clock$fire();
#line 180
result = rcombine(result, RealTimeM$Clock$fire());
#line 180
#line 180
return result;
#line 180
}
#line 180
# 32 "/home/xu/oasis/system/platform/imote2/RTC/RTCClockM.nc"
static inline void RTCClockM$OSTIrq$fired(void)
#line 32
{
if (* (volatile uint32_t *)0x40A00014 & (1 << 10)) {
RTCClockM$MicroClock$fire();
* (volatile uint32_t *)0x40A00014 = 1 << 10;
}
}
# 129 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline uint32_t HplPXA27xBTUARTP$UART$getLSR(void)
#line 129
{
#line 129
return * (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x14);
}
# 63 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static uint32_t HalPXA27xBTUARTP$UART$getLSR(void){
#line 63
unsigned int result;
#line 63
#line 63
result = HplPXA27xBTUARTP$UART$getLSR();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 39 "/home/xu/oasis/system/platform/imote2/ADC/gps.h"
static __inline uint8_t tr_time(uint8_t *source)
#line 39
{
#line 39
return (*source - ACIIOFFSET) * 10 + *(source + 1) - ACIIOFFSET;
}
# 30 "/home/xu/oasis/lib/SmartSensing/DataMgmt.nc"
inline static result_t SmartSensingM$DataMgmt$saveBlk(void *arg_0x40aba140, uint8_t arg_0x40aba2d0){
#line 30
unsigned char result;
#line 30
#line 30
result = DataMgmtM$DataMgmt$saveBlk(arg_0x40aba140, arg_0x40aba2d0);
#line 30
#line 30
return result;
#line 30
}
#line 30
# 695 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$GPSSensing$dataReady(uint8_t *data, uint16_t size)
#line 695
{
uint8_t *dst = (void *)0;
int16_t length = size;
uint16_t leftLength = 0;
SenBlkPtr p = sensor[GPS_CLIENT_ID].curBlkPtr;
uint32_t temptime = SmartSensingM$RealTime$getTimeCount();
#line 701
while (length > 0) {
if ((void *)0 != p) {
p->time = temptime;
p->interval = 0;
p->type = sensor[GPS_CLIENT_ID].type;
p->priority = sensor[GPS_CLIENT_ID].dataPriority + sensor[GPS_CLIENT_ID].nodePriority;
p->size = 0;
p->taskCode = SmartSensingM$defaultCode;
dst = p->buffer;
if (length < MAX_BUFFER_SIZE) {
leftLength = length;
}
else {
leftLength = MAX_BUFFER_SIZE;
}
while (p->size < leftLength) {
* dst++ = * data++;
p->size++;
}
SmartSensingM$DataMgmt$saveBlk((void *)p, 0);
length -= MAX_BUFFER_SIZE;
}
p = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(GPS_CLIENT_ID);
SmartSensingM$sensingCurBlk = p;
}
sensor[GPS_CLIENT_ID].curBlkPtr = p;
return SUCCESS;
}
# 46 "/home/xu/oasis/interfaces/GenericSensing.nc"
inline static result_t GPSSensorM$GenericSensing$dataReady(uint8_t *arg_0x40ac8268, uint16_t arg_0x40ac83f8){
#line 46
unsigned char result;
#line 46
#line 46
result = SmartSensingM$GPSSensing$dataReady(arg_0x40ac8268, arg_0x40ac83f8);
#line 46
#line 46
return result;
#line 46
}
#line 46
# 221 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$gpsTask(void)
#line 221
{
if (GPSSensorM$rawCount != 0) {
GPSSensorM$GenericSensing$dataReady(GPSSensorM$RAWData, GPSSensorM$rawCount);
}
}
#line 245
static inline void GPSSensorM$GPSUartStream$receivedByte(uint8_t data)
#line 245
{
uint16_t *lengthPtr;
if (GPSSensorM$dataCount < RAW_SIZE + NMEA_SIZE) {
if (GPSSensorM$dataCount == 0 && data != 0xb5) {
#line 254
return;
}
GPSSensorM$AllData[GPSSensorM$dataCount] = data;
GPSSensorM$dataCount++;
if (
#line 263
GPSSensorM$dataCount >= 8
&& GPSSensorM$AllData[0] == 0xb5 && GPSSensorM$AllData[1] == 0x62
&& GPSSensorM$AllData[2] == 0x02 && GPSSensorM$AllData[3] == 0x10) {
GPSSensorM$RAWData = GPSSensorM$AllData;
lengthPtr = (uint16_t *)(GPSSensorM$RAWData + 4);
GPSSensorM$raw_payload_length = *lengthPtr;
if (GPSSensorM$dataCount == GPSSensorM$raw_payload_length + 8) {
GPSSensorM$rawCount = GPSSensorM$dataCount;
TOS_post(GPSSensorM$gpsTask);
GPSSensorM$NMEAData = GPSSensorM$AllData + GPSSensorM$dataCount;
}
else {
if (
#line 283
GPSSensorM$NMEAData != (void *)0 && GPSSensorM$dataCount == NMEA_SIZE + GPSSensorM$raw_payload_length + 8
&& GPSSensorM$NMEAData[NMEA_SIZE - 2] == 0x0D && GPSSensorM$NMEAData[NMEA_SIZE - 1] == 0x0A
&& GPSSensorM$NMEAData[0] == 0x24 && GPSSensorM$NMEAData[1] == 0x47
&& GPSSensorM$NMEAData[2] == 0x50 && GPSSensorM$NMEAData[3] == 0x5a) {
GPSSensorM$timeCount = (uint32_t )tr_time(GPSSensorM$NMEAData + H1) * 3600UL + (uint32_t )tr_time(GPSSensorM$NMEAData + M1) * 60UL + (uint32_t )tr_time(GPSSensorM$NMEAData + S1) + 1;
GPSSensorM$timeCount = GPSSensorM$timeCount * 1000UL % DAY_END;
GPSSensorM$samplingReady = TRUE;
GPSSensorM$dataCount = 0;
GPSSensorM$NMEAData = (void *)0;
}
}
}
}
else
{
;
GPSSensorM$dataCount = 0;
GPSSensorM$NMEAData = (void *)0;
}
return;
}
# 79 "/home/xu/oasis/system/platform/imote2/UART/UartStream.nc"
inline static void HalPXA27xBTUARTP$UartStream$receivedByte(uint8_t arg_0x40bd1c28){
#line 79
GPSSensorM$GPSUartStream$receivedByte(arg_0x40bd1c28);
#line 79
}
#line 79
# 122 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline uint32_t HplPXA27xBTUARTP$UART$getIER(void)
#line 122
{
#line 122
return * (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x04);
}
# 51 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static uint32_t HalPXA27xBTUARTP$UART$getIER(void){
#line 51
unsigned int result;
#line 51
#line 51
result = HplPXA27xBTUARTP$UART$getIER();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 287 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$receive(uint8_t *buf, uint16_t len, uint16_t timeout)
#line 287
{
uint32_t rxAddr;
uint32_t DMAFlags;
result_t error = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 292
{
if (HalPXA27xBTUARTP$rxCurrentBuf == (void *)0) {
HalPXA27xBTUARTP$rxCurrentBuf = buf;
HalPXA27xBTUARTP$rxCurrentLen = len;
HalPXA27xBTUARTP$rxCurrentIdx = 0;
}
else {
error = FAIL;
}
}
#line 301
__nesc_atomic_end(__nesc_atomic); }
if (!error) {
return error;
}
if (len < 8) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 307
{
HalPXA27xBTUARTP$gulFCRShadow = (HalPXA27xBTUARTP$gulFCRShadow & ~((3 & 0x3) << 6)) | ((0 & 0x3) << 6);
HalPXA27xBTUARTP$UART$setFCR(HalPXA27xBTUARTP$gulFCRShadow);
HalPXA27xBTUARTP$UART$setIER(HalPXA27xBTUARTP$UART$getIER() | (1 << 0));
}
#line 312
__nesc_atomic_end(__nesc_atomic); }
}
else {
}
#line 336
return error;
}
# 423 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$receiveDone(uint8_t *buf,
uint16_t len,
uart_status_t status)
#line 425
{
return (void *)0;
}
# 89 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialPacket.nc"
inline static uint8_t *HalPXA27xBTUARTP$HalPXA27xSerialPacket$receiveDone(uint8_t *arg_0x40bf31a8, uint16_t arg_0x40bf3338, uart_status_t arg_0x40bf34c8){
#line 89
unsigned char *result;
#line 89
#line 89
result = GPSSensorM$GPSHalPXA27xSerialPacket$receiveDone(arg_0x40bf31a8, arg_0x40bf3338, arg_0x40bf34c8);
#line 89
#line 89
return result;
#line 89
}
#line 89
# 404 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$GPSUartStream$receiveDone(uint8_t *buf,
uint16_t len, result_t error)
#line 405
{
return;
}
# 99 "/home/xu/oasis/system/platform/imote2/UART/UartStream.nc"
inline static void HalPXA27xBTUARTP$UartStream$receiveDone(uint8_t *arg_0x40bcf920, uint16_t arg_0x40bcfab0, result_t arg_0x40bcfc40){
#line 99
GPSSensorM$GPSUartStream$receiveDone(arg_0x40bcf920, arg_0x40bcfab0, arg_0x40bcfc40);
#line 99
}
#line 99
# 339 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline void HalPXA27xBTUARTP$DispatchStreamRcvSignal(void)
#line 339
{
uint8_t *pBuf = HalPXA27xBTUARTP$rxCurrentBuf;
uint16_t len = HalPXA27xBTUARTP$rxCurrentLen;
#line 342
HalPXA27xBTUARTP$rxCurrentBuf = (void *)0;
if (HalPXA27xBTUARTP$gbUsingUartStreamRcvIF) {
HalPXA27xBTUARTP$gbUsingUartStreamRcvIF = FALSE;
HalPXA27xBTUARTP$UartStream$receiveDone(pBuf, len, SUCCESS);
}
else {
pBuf = HalPXA27xBTUARTP$HalPXA27xSerialPacket$receiveDone(pBuf, len, SUCCESS);
if (pBuf) {
#line 350
HalPXA27xBTUARTP$HalPXA27xSerialPacket$receive(pBuf, len, 0);
}
}
#line 352
return;
}
# 94 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline uint32_t HplPXA27xBTUARTP$UART$getRBR(void)
#line 94
{
#line 94
return * (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0);
}
# 41 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static uint32_t HalPXA27xBTUARTP$UART$getRBR(void){
#line 41
unsigned int result;
#line 41
#line 41
result = HplPXA27xBTUARTP$UART$getRBR();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 95 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UART$setTHR(uint32_t val)
#line 95
{
#line 95
* (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0) = val;
}
# 42 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HalPXA27xBTUARTP$UART$setTHR(uint32_t arg_0x40c21480){
#line 42
HplPXA27xBTUARTP$UART$setTHR(arg_0x40c21480);
#line 42
}
#line 42
# 228 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline result_t HalPXA27xBTUARTP$HalPXA27xSerialPacket$send(uint8_t *buf, uint16_t len)
#line 228
{
uint32_t txAddr;
uint32_t DMAFlags;
result_t error = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 233
{
if (HalPXA27xBTUARTP$txCurrentBuf == (void *)0) {
HalPXA27xBTUARTP$txCurrentBuf = buf;
HalPXA27xBTUARTP$txCurrentLen = len;
}
else {
error = FAIL;
}
}
#line 241
__nesc_atomic_end(__nesc_atomic); }
if (!error) {
return error;
}
if (len < 8) {
uint16_t i;
#line 249
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
HalPXA27xBTUARTP$gulFCRShadow |= 1 << 3;
HalPXA27xBTUARTP$UART$setFCR(HalPXA27xBTUARTP$gulFCRShadow);
}
#line 258
__nesc_atomic_end(__nesc_atomic); }
for (i = 0; i < len; i++) {
HalPXA27xBTUARTP$UART$setTHR(buf[i]);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 262
HalPXA27xBTUARTP$UART$setIER(HalPXA27xBTUARTP$UART$getIER() | (1 << 1));
#line 262
__nesc_atomic_end(__nesc_atomic); }
}
else {
}
#line 284
return error;
}
# 413 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline uint8_t *GPSSensorM$GPSHalPXA27xSerialPacket$sendDone(uint8_t *buf,
uint16_t len,
uart_status_t status)
#line 415
{
return (void *)0;
}
# 62 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xSerialPacket.nc"
inline static uint8_t *HalPXA27xBTUARTP$HalPXA27xSerialPacket$sendDone(uint8_t *arg_0x40bcce68, uint16_t arg_0x40bcb010, uart_status_t arg_0x40bcb1a0){
#line 62
unsigned char *result;
#line 62
#line 62
result = GPSSensorM$GPSHalPXA27xSerialPacket$sendDone(arg_0x40bcce68, arg_0x40bcb010, arg_0x40bcb1a0);
#line 62
#line 62
return result;
#line 62
}
#line 62
# 231 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$GPSUartStream$sendDone(uint8_t *buf,
uint16_t len, result_t error)
#line 232
{
return;
}
# 57 "/home/xu/oasis/system/platform/imote2/UART/UartStream.nc"
inline static void HalPXA27xBTUARTP$UartStream$sendDone(uint8_t *arg_0x40bd2b58, uint16_t arg_0x40bd2ce8, result_t arg_0x40bd2e78){
#line 57
GPSSensorM$GPSUartStream$sendDone(arg_0x40bd2b58, arg_0x40bd2ce8, arg_0x40bd2e78);
#line 57
}
#line 57
# 356 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline void HalPXA27xBTUARTP$DispatchStreamSendSignal(void)
#line 356
{
uint8_t *pBuf = HalPXA27xBTUARTP$txCurrentBuf;
uint16_t len = HalPXA27xBTUARTP$txCurrentLen;
#line 359
HalPXA27xBTUARTP$txCurrentBuf = (void *)0;
if (HalPXA27xBTUARTP$gbUsingUartStreamSendIF) {
HalPXA27xBTUARTP$gbUsingUartStreamSendIF = FALSE;
HalPXA27xBTUARTP$UartStream$sendDone(pBuf, len, SUCCESS);
}
else {
pBuf = HalPXA27xBTUARTP$HalPXA27xSerialPacket$sendDone(pBuf, len, SUCCESS);
if (pBuf) {
#line 367
HalPXA27xBTUARTP$HalPXA27xSerialPacket$send(pBuf, len);
}
}
#line 369
return;
}
# 123 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline uint32_t HplPXA27xBTUARTP$UART$getIIR(void)
#line 123
{
#line 123
return * (volatile uint32_t *)((uint32_t )HplPXA27xBTUARTP$base_addr + (uint32_t )0x08);
}
# 53 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static uint32_t HalPXA27xBTUARTP$UART$getIIR(void){
#line 53
unsigned int result;
#line 53
#line 53
result = HplPXA27xBTUARTP$UART$getIIR();
#line 53
#line 53
return result;
#line 53
}
#line 53
# 460 "/home/xu/oasis/system/platform/imote2/UART/HalPXA27xBTUARTP.nc"
static inline void HalPXA27xBTUARTP$UART$interruptUART(void)
#line 460
{
uint8_t error;
#line 461
uint8_t intSource;
uint8_t ucByte;
intSource = HalPXA27xBTUARTP$UART$getIIR();
intSource &= 0x3 << 1;
intSource = intSource >> 1;
switch (intSource) {
case 0:
break;
case 1:
HalPXA27xBTUARTP$UART$setIER(HalPXA27xBTUARTP$UART$getIER() & ~(1 << 1));
HalPXA27xBTUARTP$DispatchStreamSendSignal();
break;
case 2:
while (HalPXA27xBTUARTP$UART$getLSR() & (1 << 0))
{
ucByte = HalPXA27xBTUARTP$UART$getRBR();
if (HalPXA27xBTUARTP$rxCurrentBuf != (void *)0) {
HalPXA27xBTUARTP$rxCurrentBuf[HalPXA27xBTUARTP$rxCurrentIdx] = ucByte;
HalPXA27xBTUARTP$rxCurrentIdx++;
if (HalPXA27xBTUARTP$rxCurrentIdx >= HalPXA27xBTUARTP$rxCurrentLen) {
HalPXA27xBTUARTP$DispatchStreamRcvSignal();
}
}
else {
#line 487
if (HalPXA27xBTUARTP$gbRcvByteEvtEnabled) {
HalPXA27xBTUARTP$UartStream$receivedByte(ucByte);
}
}
}
#line 491
break;
case 3:
error = HalPXA27xBTUARTP$UART$getLSR();
break;
default:
break;
}
return;
}
# 81 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xUART.nc"
inline static void HplPXA27xBTUARTP$UART$interruptUART(void){
#line 81
HalPXA27xBTUARTP$UART$interruptUART();
#line 81
}
#line 81
# 141 "/home/xu/oasis/system/platform/imote2/UART/HplPXA27xBTUARTP.nc"
static inline void HplPXA27xBTUARTP$UARTIrq$fired(void)
#line 141
{
HplPXA27xBTUARTP$UART$interruptUART();
}
# 449 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$BackoffTimerJiffy$fired(void)
#line 449
{
uint8_t currentstate;
#line 451
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 451
currentstate = CC2420RadioM$stateRadio;
#line 451
__nesc_atomic_end(__nesc_atomic); }
switch (CC2420RadioM$stateTimer) {
case CC2420RadioM$TIMER_INITIAL:
if (!TOS_post(CC2420RadioM$startSend)) {
CC2420RadioM$sendFailed();
}
break;
case CC2420RadioM$TIMER_BACKOFF:
CC2420RadioM$tryToSend();
break;
case CC2420RadioM$TIMER_ACK:
if (currentstate == CC2420RadioM$POST_TX_STATE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 469
{
CC2420RadioM$txbufptr->ack = 0;
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_ACK_STATE;
}
#line 472
__nesc_atomic_end(__nesc_atomic); }
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
}
#line 476
break;
}
return SUCCESS;
}
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t TimerJiffyAsyncM$TimerJiffyAsync$fired(void){
#line 12
unsigned char result;
#line 12
#line 12
result = CC2420RadioM$BackoffTimerJiffy$fired();
#line 12
#line 12
return result;
#line 12
}
#line 12
# 58 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static inline void TimerJiffyAsyncM$OSTIrq$fired(void)
#line 58
{
uint32_t localjiffy;
#line 60
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 60
localjiffy = TimerJiffyAsyncM$jiffy;
#line 60
__nesc_atomic_end(__nesc_atomic); }
if (* (volatile uint32_t *)0x40A00014 & (1 << 6)) {
* (volatile uint32_t *)0x40A00014 = 1 << 6;
if (localjiffy < (1 << 27) - 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 65
{
* (volatile uint32_t *)0x40A0001C &= ~(1 << 6);
}
#line 67
__nesc_atomic_end(__nesc_atomic); }
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 68
TimerJiffyAsyncM$bSet = FALSE;
#line 68
__nesc_atomic_end(__nesc_atomic); }
TimerJiffyAsyncM$TimerJiffyAsync$fired();
}
else {
localjiffy = localjiffy - ((1 << 27) - 1);
TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(localjiffy);
}
}
return;
}
# 202 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline void FramerM$PacketUnknown(void)
#line 202
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 203
{
FramerM$gFlags |= FramerM$FLAGS_UNKNOWN;
}
#line 205
__nesc_atomic_end(__nesc_atomic); }
FramerM$StartTx();
}
# 382 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$UARTReceive$receive(TOS_MsgPtr packet)
#line 382
{
packet->group = TOS_AM_GROUP;
return GenericCommProM$received(packet);
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr FramerAckM$ReceiveCombined$receive(TOS_MsgPtr arg_0x40620878){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = GenericCommProM$UARTReceive$receive(arg_0x40620878);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 91 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
static inline TOS_MsgPtr FramerAckM$ReceiveMsg$receive(TOS_MsgPtr Msg)
#line 91
{
TOS_MsgPtr pBuf;
pBuf = FramerAckM$ReceiveCombined$receive(Msg);
return pBuf;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr FramerM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = FramerAckM$ReceiveMsg$receive(arg_0x40620878);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 329 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$TokenReceiveMsg$ReflectToken(uint8_t Token)
#line 329
{
result_t Result = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
{
if (!(FramerM$gFlags & FramerM$FLAGS_TOKENPEND)) {
FramerM$gFlags |= FramerM$FLAGS_TOKENPEND;
FramerM$gTxTokenBuf = Token;
}
else {
Result = FAIL;
}
}
#line 340
__nesc_atomic_end(__nesc_atomic); }
if (Result == SUCCESS) {
Result = FramerM$StartTx();
}
return Result;
}
# 88 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
inline static result_t FramerAckM$TokenReceiveMsg$ReflectToken(uint8_t arg_0x410a6cf8){
#line 88
unsigned char result;
#line 88
#line 88
result = FramerM$TokenReceiveMsg$ReflectToken(arg_0x410a6cf8);
#line 88
#line 88
return result;
#line 88
}
#line 88
# 74 "/opt/tinyos-1.x/tos/system/FramerAckM.nc"
static inline void FramerAckM$SendAckTask(void)
#line 74
{
FramerAckM$TokenReceiveMsg$ReflectToken(FramerAckM$gTokenBuf);
}
static inline TOS_MsgPtr FramerAckM$TokenReceiveMsg$receive(TOS_MsgPtr Msg, uint8_t token)
#line 79
{
TOS_MsgPtr pBuf;
FramerAckM$gTokenBuf = token;
TOS_post(FramerAckM$SendAckTask);
pBuf = FramerAckM$ReceiveCombined$receive(Msg);
return pBuf;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/TokenReceiveMsg.nc"
inline static TOS_MsgPtr FramerM$TokenReceiveMsg$receive(TOS_MsgPtr arg_0x410a64c8, uint8_t arg_0x410a6650){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = FramerAckM$TokenReceiveMsg$receive(arg_0x410a64c8, arg_0x410a6650);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 210 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline void FramerM$PacketRcvd(void)
#line 210
{
FramerM$MsgRcvEntry_t *pRcv = &FramerM$gMsgRcvTbl[FramerM$gRxTailIndex];
TOS_MsgPtr pBuf = pRcv->pMsg;
if (pRcv->Length >= (size_t )& ((TOS_Msg *)0)->data) {
switch (pRcv->Proto) {
case FramerM$PROTO_ACK:
break;
case FramerM$PROTO_PACKET_ACK:
pBuf->crc = 1;
pBuf = FramerM$TokenReceiveMsg$receive(pBuf, pRcv->Token);
break;
case FramerM$PROTO_PACKET_NOACK:
pBuf->crc = 1;
pBuf = FramerM$ReceiveMsg$receive(pBuf);
break;
default:
FramerM$gTxUnknownBuf = pRcv->Proto;
TOS_post(FramerM$PacketUnknown);
break;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 235
{
if (pBuf) {
pRcv->pMsg = pBuf;
}
pRcv->Length = 0;
pRcv->Token = 0;
FramerM$gRxTailIndex++;
FramerM$gRxTailIndex %= FramerM$HDLC_QUEUESIZE;
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
}
#line 349
static inline result_t FramerM$ByteComm$rxByteReady(uint8_t data, bool error, uint16_t strength)
#line 349
{
switch (FramerM$gRxState) {
case FramerM$RXSTATE_NOSYNC:
if (data == FramerM$HDLC_FLAG_BYTE && FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gRxState = FramerM$RXSTATE_PROTO;
}
break;
case FramerM$RXSTATE_PROTO:
if (data == FramerM$HDLC_FLAG_BYTE) {
break;
}
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Proto = data;
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, data);
switch (data) {
case FramerM$PROTO_PACKET_ACK:
FramerM$gRxState = FramerM$RXSTATE_TOKEN;
break;
case FramerM$PROTO_PACKET_NOACK:
FramerM$gRxState = FramerM$RXSTATE_INFO;
break;
default:
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
break;
}
break;
case FramerM$RXSTATE_TOKEN:
if (data == FramerM$HDLC_FLAG_BYTE) {
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
#line 385
if (data == FramerM$HDLC_CTLESC_BYTE) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0x20;
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token ^= data;
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token);
FramerM$gRxState = FramerM$RXSTATE_INFO;
}
}
#line 393
break;
case FramerM$RXSTATE_INFO:
if (FramerM$gRxByteCnt > FramerM$HDLC_MTU) {
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
#line 403
if (data == FramerM$HDLC_CTLESC_BYTE) {
FramerM$gRxState = FramerM$RXSTATE_ESC;
}
else {
#line 406
if (data == FramerM$HDLC_FLAG_BYTE) {
if (FramerM$gRxByteCnt >= 2) {
uint16_t usRcvdCRC = FramerM$gpRxBuf[FramerM$gRxByteCnt - 1] & 0xff;
#line 409
usRcvdCRC = (usRcvdCRC << 8) | (FramerM$gpRxBuf[FramerM$gRxByteCnt - 2] & 0xff);
if (usRcvdCRC == FramerM$gRxRunningCRC) {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = FramerM$gRxByteCnt - 2;
TOS_post(FramerM$PacketRcvd);
FramerM$gRxHeadIndex++;
#line 413
FramerM$gRxHeadIndex %= FramerM$HDLC_QUEUESIZE;
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
}
if (FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length == 0) {
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gRxState = FramerM$RXSTATE_PROTO;
}
else {
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
}
else {
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
}
else {
FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
if (FramerM$gRxByteCnt >= 2) {
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
}
FramerM$gRxByteCnt++;
}
}
}
#line 441
break;
case FramerM$RXSTATE_ESC:
if (data == FramerM$HDLC_FLAG_BYTE) {
FramerM$gRxByteCnt = FramerM$gRxRunningCRC = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Length = 0;
FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].Token = 0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
}
else {
data = data ^ 0x20;
FramerM$gpRxBuf[FramerM$gRxByteCnt] = data;
if (FramerM$gRxByteCnt >= 2) {
FramerM$gRxRunningCRC = crcByte(FramerM$gRxRunningCRC, FramerM$gpRxBuf[FramerM$gRxByteCnt - 2]);
}
FramerM$gRxByteCnt++;
FramerM$gRxState = FramerM$RXSTATE_INFO;
}
break;
default:
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
break;
}
return SUCCESS;
}
# 66 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$rxByteReady(uint8_t arg_0x410a3200, bool arg_0x410a3388, uint16_t arg_0x410a3520){
#line 66
unsigned char result;
#line 66
#line 66
result = FramerM$ByteComm$rxByteReady(arg_0x410a3200, arg_0x410a3388, arg_0x410a3520);
#line 66
#line 66
return result;
#line 66
}
#line 66
# 77 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$HPLUART$get(uint8_t data)
#line 77
{
UARTM$ByteComm$rxByteReady(data, FALSE, 0);
{
}
#line 83
;
return SUCCESS;
}
# 97 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
inline static result_t HPLFFUARTM$UART$get(uint8_t arg_0x41111e58){
#line 97
unsigned char result;
#line 97
#line 97
result = UARTM$HPLUART$get(arg_0x41111e58);
#line 97
#line 97
return result;
#line 97
}
#line 97
# 55 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t FramerM$ByteComm$txByte(uint8_t arg_0x410abc98){
#line 55
unsigned char result;
#line 55
#line 55
result = UARTM$ByteComm$txByte(arg_0x410abc98);
#line 55
#line 55
return result;
#line 55
}
#line 55
# 483 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$ByteComm$txByteReady(bool LastByteSuccess)
#line 483
{
result_t TxResult = SUCCESS;
uint8_t nextByte;
if (LastByteSuccess != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 488
FramerM$gTxState = FramerM$TXSTATE_ERROR;
#line 488
__nesc_atomic_end(__nesc_atomic); }
TOS_post(FramerM$PacketSent);
return SUCCESS;
}
switch (FramerM$gTxState) {
case FramerM$TXSTATE_PROTO:
FramerM$gTxState = FramerM$TXSTATE_INFO;
FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, (uint8_t )(FramerM$gTxProto & 0x0FF));
TxResult = FramerM$ByteComm$txByte((uint8_t )(FramerM$gTxProto & 0x0FF));
break;
case FramerM$TXSTATE_INFO:
nextByte = FramerM$gpTxBuf[FramerM$gTxByteCnt];
FramerM$gTxRunningCRC = crcByte(FramerM$gTxRunningCRC, nextByte);
FramerM$gTxByteCnt++;
if (FramerM$gTxByteCnt >= FramerM$gTxLength) {
FramerM$gTxState = FramerM$TXSTATE_FCS1;
}
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_ESC:
TxResult = FramerM$ByteComm$txByte(FramerM$gTxEscByte ^ 0x20);
FramerM$gTxState = FramerM$gPrevTxState;
break;
case FramerM$TXSTATE_FCS1:
nextByte = (uint8_t )(FramerM$gTxRunningCRC & 0xff);
FramerM$gTxState = FramerM$TXSTATE_FCS2;
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_FCS2:
nextByte = (uint8_t )((FramerM$gTxRunningCRC >> 8) & 0xff);
FramerM$gTxState = FramerM$TXSTATE_ENDFLAG;
TxResult = FramerM$TxArbitraryByte(nextByte);
break;
case FramerM$TXSTATE_ENDFLAG:
FramerM$gTxState = FramerM$TXSTATE_FINISH;
TxResult = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
break;
case FramerM$TXSTATE_FINISH:
case FramerM$TXSTATE_ERROR:
default:
break;
}
if (TxResult != SUCCESS) {
FramerM$gTxState = FramerM$TXSTATE_ERROR;
TOS_post(FramerM$PacketSent);
}
return SUCCESS;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$txByteReady(bool arg_0x410a3b30){
#line 75
unsigned char result;
#line 75
#line 75
result = FramerM$ByteComm$txByteReady(arg_0x410a3b30);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 553 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$ByteComm$txDone(void)
#line 553
{
if (FramerM$gTxState == FramerM$TXSTATE_FINISH) {
FramerM$gTxState = FramerM$TXSTATE_IDLE;
TOS_post(FramerM$PacketSent);
}
return SUCCESS;
}
# 83 "/opt/tinyos-1.x/tos/interfaces/ByteComm.nc"
inline static result_t UARTM$ByteComm$txDone(void){
#line 83
unsigned char result;
#line 83
#line 83
result = FramerM$ByteComm$txDone();
#line 83
#line 83
return result;
#line 83
}
#line 83
# 87 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static inline result_t UARTM$HPLUART$putDone(void)
#line 87
{
bool oldState;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 90
{
{
}
#line 91
;
oldState = UARTM$state;
UARTM$state = FALSE;
}
#line 94
__nesc_atomic_end(__nesc_atomic); }
if (oldState) {
UARTM$ByteComm$txDone();
UARTM$ByteComm$txByteReady(TRUE);
}
return SUCCESS;
}
# 105 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
inline static result_t HPLFFUARTM$UART$putDone(void){
#line 105
unsigned char result;
#line 105
#line 105
result = UARTM$HPLUART$putDone();
#line 105
#line 105
return result;
#line 105
}
#line 105
# 64 "/opt/tinyos-1.x/tos/platform/imote2/HPLFFUARTM.nc"
static inline void HPLFFUARTM$Interrupt$fired(void)
#line 64
{
uint8_t error;
#line 65
uint8_t intSource = * (volatile uint32_t *)0x40100008;
#line 66
intSource = (intSource >> 1) & 0x3;
switch (intSource) {
case 0:
break;
case 1:
HPLFFUARTM$UART$putDone();
break;
case 2:
while (* (volatile uint32_t *)0x40100014 & (1 << 0)) {
HPLFFUARTM$UART$get(* (volatile uint32_t *)0x40100000);
}
break;
case 3:
error = * (volatile uint32_t *)0x40100014;
trace(DBG_USR1, "UART Error %d\r\n", error);
break;
}
return;
}
# 354 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static inline void PXA27XInterruptM$PXA27XIrq$default$fired(uint8_t id)
{
return;
}
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XInterruptM$PXA27XIrq$fired(uint8_t arg_0x405ecc80){
#line 48
switch (arg_0x405ecc80) {
#line 48
case 6:
#line 48
PMICM$PI2CInterrupt$fired();
#line 48
break;
#line 48
case 7:
#line 48
TimerJiffyAsyncM$OSTIrq$fired();
#line 48
RTCClockM$OSTIrq$fired();
#line 48
PXA27XClockM$OSTIrq$fired();
#line 48
break;
#line 48
case 8:
#line 48
PXA27XGPIOIntM$GPIOIrq0$fired();
#line 48
break;
#line 48
case 9:
#line 48
PXA27XGPIOIntM$GPIOIrq1$fired();
#line 48
break;
#line 48
case 10:
#line 48
PXA27XGPIOIntM$GPIOIrq$fired();
#line 48
break;
#line 48
case 11:
#line 48
PXA27XUSBClientM$USBInterrupt$fired();
#line 48
break;
#line 48
case 20:
#line 48
STUARTM$UARTInterrupt$fired();
#line 48
break;
#line 48
case 21:
#line 48
HplPXA27xBTUARTP$UARTIrq$fired();
#line 48
break;
#line 48
case 22:
#line 48
HPLFFUARTM$Interrupt$fired();
#line 48
break;
#line 48
case 25:
#line 48
PXA27XDMAM$Interrupt$fired();
#line 48
break;
#line 48
default:
#line 48
PXA27XInterruptM$PXA27XIrq$default$fired(arg_0x405ecc80);
#line 48
break;
#line 48
}
#line 48
}
#line 48
# 371 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$UARTSend$sendDone(TOS_MsgPtr msg, result_t success)
#line 371
{
GenericCommProM$state = FALSE;
return GenericCommProM$reportSendDone(msg, success);
}
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t FramerM$BareSendMsg$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8){
#line 67
unsigned char result;
#line 67
#line 67
result = GenericCommProM$UARTSend$sendDone(arg_0x4061e348, arg_0x4061e4d8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 468 "/home/xu/oasis/system/queue.h"
static inline object_type **findObject(Queue_t *queue, object_type *obj)
#line 468
{
int16_t ind;
#line 470
if (queue->size <= 0) {
;
return (void *)0;
}
if (queue->total <= 0) {
;
return (void *)0;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
;
return & (&queue->element[ind])->obj;
}
}
;
return (void *)0;
}
#line 397
static inline bool incRetryCount(object_type **object)
#line 397
{
Element_t *el;
#line 399
if (object == (void *)0) {
return FAIL;
}
else
#line 401
{
el = (Element_t *)((char *)object - (unsigned long )& ((Element_t *)0)->obj);
el->retry++;
return SUCCESS;
}
}
#line 387
static inline uint8_t getRetryCount(object_type **object)
#line 387
{
Element_t *el;
#line 389
if (object == (void *)0) {
return 0xff;
}
else
#line 391
{
el = (Element_t *)((char *)object - (unsigned long )& ((Element_t *)0)->obj);
return el->retry;
}
}
# 8 "/home/xu/oasis/lib/GenericCommPro/QosRexmit.h"
static inline uint8_t qosRexmit(uint8_t qos)
#line 8
{
switch (qos) {
case 1: return 2;
case 2: return 2;
case 3: return 3;
case 4: return 4;
case 5: return 5;
case 6: return 6;
case 7: return 7;
default: return 1;
}
}
# 63 "/opt/tinyos-1.x/tos/interfaces/Random.nc"
inline static uint16_t CC2420RadioM$Random$rand(void){
#line 63
unsigned short result;
#line 63
#line 63
result = RandomLFSR$Random$rand();
#line 63
#line 63
return result;
#line 63
}
#line 63
# 744 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline int16_t CC2420RadioM$MacBackoff$default$initialBackoff(TOS_MsgPtr m)
#line 744
{
return (CC2420RadioM$Random$rand() & 0xF) + 1;
}
# 74 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
inline static int16_t CC2420RadioM$MacBackoff$initialBackoff(TOS_MsgPtr arg_0x40f2a8f0){
#line 74
short result;
#line 74
#line 74
result = CC2420RadioM$MacBackoff$default$initialBackoff(arg_0x40f2a8f0);
#line 74
#line 74
return result;
#line 74
}
#line 74
# 6 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t CC2420RadioM$BackoffTimerJiffy$setOneShot(uint32_t arg_0x40f16428){
#line 6
unsigned char result;
#line 6
#line 6
result = TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(arg_0x40f16428);
#line 6
#line 6
return result;
#line 6
}
#line 6
# 128 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setInitialTimer(uint16_t jiffy)
#line 128
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_INITIAL;
if (jiffy == 0) {
return CC2420RadioM$BackoffTimerJiffy$setOneShot(2);
}
#line 133
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 12 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline int is_host_lsb(void)
{
const uint8_t n[2] = { 1, 0 };
#line 15
return * (uint16_t *)n == 1;
}
static __inline uint16_t toLSB16(uint16_t a)
{
return is_host_lsb() ? a : (a << 8) | (a >> 8);
}
# 491 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$Send$send(TOS_MsgPtr pMsg)
#line 491
{
uint8_t currentstate;
#line 493
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 493
currentstate = CC2420RadioM$stateRadio;
#line 493
__nesc_atomic_end(__nesc_atomic); }
if (currentstate == CC2420RadioM$IDLE_STATE) {
pMsg->fcflo = 0x08;
if (CC2420RadioM$bAckEnable) {
pMsg->fcfhi = 0x21;
}
else {
#line 501
pMsg->fcfhi = 0x01;
}
pMsg->destpan = TOS_BCAST_ADDR;
pMsg->addr = toLSB16(pMsg->addr);
pMsg->length = pMsg->length + MSG_HEADER_SIZE + MSG_FOOTER_SIZE;
pMsg->dsn = ++CC2420RadioM$currentDSN;
pMsg->time = 0;
CC2420RadioM$txlength = pMsg->length - MSG_FOOTER_SIZE;
CC2420RadioM$txbufptr = pMsg;
CC2420RadioM$countRetry = 8;
if (CC2420RadioM$setInitialTimer(CC2420RadioM$MacBackoff$initialBackoff(CC2420RadioM$txbufptr) * 10)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 518
CC2420RadioM$stateRadio = CC2420RadioM$PRE_TX_STATE;
#line 518
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
}
return FAIL;
}
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t GenericCommProM$RadioSend$send(TOS_MsgPtr arg_0x40615d50){
#line 58
unsigned char result;
#line 58
#line 58
result = CC2420RadioM$Send$send(arg_0x40615d50);
#line 58
#line 58
return result;
#line 58
}
#line 58
# 307 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static inline result_t FramerM$BareSendMsg$send(TOS_MsgPtr pMsg)
#line 307
{
result_t Result = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 310
{
if (!(FramerM$gFlags & FramerM$FLAGS_DATAPEND)) {
FramerM$gFlags |= FramerM$FLAGS_DATAPEND;
FramerM$gpTxMsg = pMsg;
}
else
{
Result = FAIL;
}
}
#line 320
__nesc_atomic_end(__nesc_atomic); }
if (Result == SUCCESS) {
Result = FramerM$StartTx();
}
return Result;
}
# 58 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t GenericCommProM$UARTSend$send(TOS_MsgPtr arg_0x40615d50){
#line 58
unsigned char result;
#line 58
#line 58
result = FramerM$BareSendMsg$send(arg_0x40615d50);
#line 58
#line 58
return result;
#line 58
}
#line 58
# 405 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline void GenericCommProM$sendFunc(void)
#line 405
{
result_t ok;
TOS_MsgPtr m;
#line 407
TOS_MsgPtr m2;
uint8_t ind;
m = headElement(&GenericCommProM$sendQueue, PENDING);
if (m == (void *)0) {
GenericCommProM$sendTaskBusy = FALSE;
return;
}
m2 = m;
if (m2->addr == TOS_UART_ADDR) {
if (GenericCommProM$state) {
GenericCommProM$sendTaskBusy = FALSE;
return;
}
GenericCommProM$state = TRUE;
GenericCommProM$UARTOrRadio = UART;
ok = GenericCommProM$UARTSend$send(m2);
}
else
{
GenericCommProM$UARTOrRadio = RADIO;
ok = GenericCommProM$RadioSend$send(m2);
}
GenericCommProM$sendTaskBusy = FALSE;
if (ok == SUCCESS) {
changeElementStatus(&GenericCommProM$sendQueue, m, PENDING, PROCESSING);
;
if (GenericCommProM$UARTOrRadio == RADIO) {
GenericCommProM$tryNextSend();
}
}
else {
ind = GenericCommProM$findBkHeaderEntry(m);
if (ind < COMM_SEND_QUEUE_SIZE) {
m->addr = GenericCommProM$bkHeader[ind].addr;
m->group = GenericCommProM$bkHeader[ind].group;
m->type = GenericCommProM$bkHeader[ind].type;
m->length = GenericCommProM$bkHeader[ind].length;
}
else
#line 449
{
;
}
if (GenericCommProM$UARTOrRadio == UART) {
GenericCommProM$state = FALSE;
}
if (headElement(&GenericCommProM$sendQueue, PROCESSING) == (void *)0) {
GenericCommProM$tryNextSend();
}
}
return;
}
static inline void GenericCommProM$sendTask(void)
#line 463
{
GenericCommProM$sendFunc();
}
# 214 "/opt/tinyos-1.x/tos/platform/imote2/HPLFFUARTM.nc"
static inline result_t HPLFFUARTM$UART$put(uint8_t data)
#line 214
{
* (volatile uint32_t *)0x40100000 = data;
return SUCCESS;
}
# 89 "/opt/tinyos-1.x/tos/platform/imote2/HPLUART.nc"
inline static result_t UARTM$HPLUART$put(uint8_t arg_0x411118c0){
#line 89
unsigned char result;
#line 89
#line 89
result = HPLFFUARTM$UART$put(arg_0x411118c0);
#line 89
#line 89
return result;
#line 89
}
#line 89
# 535 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$SendMsg$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 535
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 536
MultiHopLQI$msgBufBusy = FALSE;
#line 536
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 795 "build/imote2/RpcM.nc"
static inline result_t RpcM$ResponseSend$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 795
{
;
return SUCCESS;
}
# 672 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Send$default$sendDone(uint8_t AMID, TOS_MsgPtr pMsg,
result_t success)
#line 673
{
MultiHopEngineM$falseType++;
return SUCCESS;
}
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t MultiHopEngineM$Send$sendDone(uint8_t arg_0x413114b8, TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8){
#line 119
unsigned char result;
#line 119
#line 119
switch (arg_0x413114b8) {
#line 119
case NW_DATA:
#line 119
result = DataMgmtM$Send$sendDone(arg_0x409ba768, arg_0x409ba8f8);
#line 119
break;
#line 119
case NW_SNMS:
#line 119
result = EventReportM$EventSend$sendDone(arg_0x409ba768, arg_0x409ba8f8);
#line 119
break;
#line 119
case NW_RPCR:
#line 119
result = RpcM$ResponseSend$sendDone(arg_0x409ba768, arg_0x409ba8f8);
#line 119
break;
#line 119
default:
#line 119
result = MultiHopEngineM$Send$default$sendDone(arg_0x413114b8, arg_0x409ba768, arg_0x409ba8f8);
#line 119
break;
#line 119
}
#line 119
#line 119
return result;
#line 119
}
#line 119
# 426 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline bool MultiHopLQI$RouteControl$isSink(void)
#line 426
{
return MultiHopLQI$localBeSink;
}
# 116 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
inline static bool MultiHopEngineM$RouteSelectCntl$isSink(void){
#line 116
unsigned char result;
#line 116
#line 116
result = MultiHopLQI$RouteControl$isSink();
#line 116
#line 116
return result;
#line 116
}
#line 116
# 841 "/home/xu/oasis/system/TinyDWFQ.h"
static inline result_t isElementInACKList_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg)
{
int8_t ind;
#line 844
ind = queue->head[NOT_ACKED_TINYDWFQ];
while (ind != -1)
{
if (queue->element[ind].obj == msg)
{
return SUCCESS;
}
else
{
ind = queue->element[ind].next;
}
}
return FAIL;
}
# 81 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t MultiHopEngineM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = LedsC$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 266 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$SendMsg$sendDone(TOS_MsgPtr msg, result_t success)
{
uint8_t infoIn = 0;
TOS_MsgPtr *mPPtr = (void *)0;
#line 270
MultiHopEngineM$Leds$redToggle();
if (isElementInACKList_TinyDWFQ(&MultiHopEngineM$sendQueue, msg) == FAIL)
{
;
return SUCCESS;
}
if ((infoIn = MultiHopEngineM$findInfoEntry(msg)) == 40)
{
;
}
if (MultiHopEngineM$RouteSelectCntl$isSink() || msg->addr != TOS_UART_ADDR) {
MultiHopEngineM$beRadioActive = TRUE;
}
if (
#line 284
success != SUCCESS &&
msg->addr != TOS_BCAST_ADDR &&
msg->addr != TOS_UART_ADDR)
{
;
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != (void *)0) {
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, FAIL);
}
#line 291
MultiHopEngineM$numLocalPendingPkt--;
MultiHopEngineM$numberOfSendFailures++;
MultiHopEngineM$numOfSuccessiveFailures++;
}
else
{
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != (void *)0)
{
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, SUCCESS);
MultiHopEngineM$numLocalPendingPkt--;
}
MultiHopEngineM$numberOfSendSuccesses++;
if (msg->addr != TOS_BCAST_ADDR)
{
MultiHopEngineM$numOfSuccessiveFailures = 0;
MultiHopEngineM$beParentActive = TRUE;
}
}
if (SUCCESS != removeElement_TinyDWFQ(&MultiHopEngineM$sendQueue, msg, NOT_ACKED_TINYDWFQ))
{
;
}
else
{
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 319
MultiHopEngineM$numOfPktProcessing--;
#line 319
__nesc_atomic_end(__nesc_atomic); }
freeBuffer(&MultiHopEngineM$buffQueue, msg);
MultiHopEngineM$freeInfoEntry(infoIn);
MultiHopEngineM$tryNextSend();
return SUCCESS;
}
# 903 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$TimeSyncNotify$default$msg_sent(void)
#line 903
{
}
# 26 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
inline static void TimeSyncM$TimeSyncNotify$msg_sent(void){
#line 26
TimeSyncM$TimeSyncNotify$default$msg_sent();
#line 26
}
#line 26
# 63 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$redToggle(void)
#line 63
{
return SUCCESS;
}
# 81 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = NoLeds$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 722 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$SendMsg$sendDone(TOS_MsgPtr ptr, result_t success)
{
if (ptr != &TimeSyncM$outgoingMsgBuffer) {
return SUCCESS;
}
if (success) {
++TimeSyncM$heartBeats;
TimeSyncM$Leds$redToggle();
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS) {
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
}
}
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
return SUCCESS;
}
# 366 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$SendMsg$default$sendDone(uint8_t id, TOS_MsgPtr msg, result_t success)
#line 366
{
return SUCCESS;
}
# 49 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t GenericCommProM$SendMsg$sendDone(uint8_t arg_0x40d90c78, TOS_MsgPtr arg_0x40d90650, result_t arg_0x40d907e0){
#line 49
unsigned char result;
#line 49
#line 49
switch (arg_0x40d90c78) {
#line 49
case AM_NETWORKMSG:
#line 49
result = MultiHopEngineM$SendMsg$sendDone(arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
case AM_CASCTRLMSG:
#line 49
result = CascadesEngineM$SendMsg$sendDone(AM_CASCTRLMSG, arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
case AM_CASCADESMSG:
#line 49
result = CascadesEngineM$SendMsg$sendDone(AM_CASCADESMSG, arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
case AM_TIMESYNCMSG:
#line 49
result = TimeSyncM$SendMsg$sendDone(arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
case AM_BEACONMSG:
#line 49
result = MultiHopLQI$SendMsg$sendDone(arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
default:
#line 49
result = GenericCommProM$SendMsg$default$sendDone(arg_0x40d90c78, arg_0x40d90650, arg_0x40d907e0);
#line 49
break;
#line 49
}
#line 49
#line 49
return result;
#line 49
}
#line 49
# 141 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_SET_RED_LED_PIN(void)
#line 141
{
#line 141
* (volatile uint32_t *)(0x40E00018 + (103 < 96 ? ((103 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (103 & 0x1f);
}
# 81 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$redOff(void)
#line 81
{
{
}
#line 82
;
/* atomic removed: atomic calls only */
#line 83
{
TOSH_SET_RED_LED_PIN();
LedsC$ledsOn &= ~LedsC$RED_BIT;
}
return SUCCESS;
}
# 141 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_CLR_RED_LED_PIN(void)
#line 141
{
#line 141
* (volatile uint32_t *)(0x40E00024 + (103 < 96 ? ((103 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (103 & 0x1f);
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t DataMgmtM$SysCheckTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(16U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 75 "/opt/tinyos-1.x/tos/system/NoLeds.nc"
static inline result_t NoLeds$Leds$greenToggle(void)
#line 75
{
return SUCCESS;
}
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t DataMgmtM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t DataMgmtM$Send$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_DATA, arg_0x409bc330, arg_0x409bc4c0);
#line 83
#line 83
return result;
#line 83
}
#line 83
#line 106
inline static void *DataMgmtM$Send$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_DATA, arg_0x409bcb88, arg_0x409bcd38);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 425 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline void DataMgmtM$sendTask(void)
#line 425
{
TOS_MsgPtr msg = (void *)0;
ApplicationMsg *pApp = (void *)0;
uint16_t length = 0;
if ((void *)0 == (msg = headElement(&DataMgmtM$sendQueue, PENDING))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 431
DataMgmtM$sendTaskBusy = FALSE;
#line 431
__nesc_atomic_end(__nesc_atomic); }
;
return;
}
DataMgmtM$headSendQueue = headElement(&DataMgmtM$sendQueue, PENDING);
pApp = (ApplicationMsg *)DataMgmtM$Send$getBuffer(msg, &length);
length = (size_t )& ((ApplicationMsg *)0)->data + pApp->length;
DataMgmtM$Msg_length = length;
DataMgmtM$sendCalled++;
DataMgmtM$sendQueueLen = (&DataMgmtM$sendQueue)->total;
if (SUCCESS == DataMgmtM$Send$send(msg, length)) {
DataMgmtM$send_num++;
if (SUCCESS != changeElementStatus(&DataMgmtM$sendQueue, msg, PENDING, PROCESSING)) {
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 448
{
;
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$tryNextSend();
}
#line 453
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 458
{
DataMgmtM$sendTaskBusy = FALSE;
DataMgmtM$sendQueueLen = (&DataMgmtM$sendQueue)->total;
}
#line 461
__nesc_atomic_end(__nesc_atomic); }
;
return;
}
}
# 347 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteSelect$initializeFields(TOS_MsgPtr Msg, uint8_t id)
#line 347
{
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
#line 349
pNWMsg->type = id;
pNWMsg->linksource = pNWMsg->source = TOS_LOCAL_ADDRESS;
pNWMsg->seqno = MultiHopLQI$gCurrentSeqNo++;
pNWMsg->ttl = 31;
return SUCCESS;
}
# 86 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteSelect.nc"
inline static result_t MultiHopEngineM$RouteSelect$initializeFields(TOS_MsgPtr arg_0x40df7b90, uint8_t arg_0x40df7d18){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopLQI$RouteSelect$initializeFields(arg_0x40df7b90, arg_0x40df7d18);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 633 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline uint8_t MultiHopEngineM$allocateInfoEntry(void)
#line 633
{
uint8_t i = 0;
#line 635
for (i = 0; i < 40; i++) {
if (MultiHopEngineM$queueEntryInfo[i].valid == FALSE) {
return i;
}
}
#line 639
if (i == 40) {
;
}
#line 641
return i;
}
# 281 "/home/xu/oasis/system/TinyDWFQ.h"
static inline result_t insertElement_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg)
{
result_t retVal;
int8_t ind;
int8_t i;
NetworkMsg *netMsg = (NetworkMsg *)msg->data;
int8_t vqIndex;
int8_t nextFreeHead = -1;
#line 290
vqIndex = netMsg->qos;
if (queue->size <= 0)
{
retVal = FAIL;
}
else {
#line 297
if (queue->total >= queue->size)
{
retVal = FAIL;
}
}
ind = -1;
if (queue->numOfElements_VQ[vqIndex] == queue->maxNumOfElementPerVQ[vqIndex])
{
i = vqIndex - 1;
while (i >= 0)
{
if (queue->numOfElements_VQ[i] == queue->maxNumOfElementPerVQ[i]) {
i--;
}
else {
ind = queue->virtualQueues[i][VQ_FREE_HEAD];
nextFreeHead = queue->element[ind].next;
vqIndex = i;
break;
}
}
}
else
{
ind = queue->virtualQueues[vqIndex][VQ_FREE_HEAD];
nextFreeHead = queue->element[ind].next;
}
if (ind != -1 && msg != 0)
{
if (nextFreeHead != -1) {
queue->virtualQueues[vqIndex][VQ_FREE_HEAD] = nextFreeHead;
}
else {
#line 332
queue->virtualQueues[vqIndex][VQ_FREE_HEAD] = queue->virtualQueues[vqIndex][VQ_FREE_TAIL] = -1;
}
if (queue->virtualQueues[vqIndex][VQ_HEAD] == -1) {
queue->virtualQueues[vqIndex][VQ_HEAD] = queue->virtualQueues[vqIndex][VQ_TAIL] = ind;
}
else {
queue->element[queue->virtualQueues[vqIndex][VQ_TAIL]].next = ind;
queue->virtualQueues[vqIndex][VQ_TAIL] = ind;
}
queue->numOfElements_VQ[vqIndex]++;
queue->numOfElements_VQ_Processing[vqIndex]++;
queue->element[ind].next = -1;
queue->element[ind].obj = msg;
queue->element[ind].qos = netMsg->qos;
queue->element[ind].status = PROCESSING_TINYDWFQ;
queue->numOfElements_processing++;
queue->total++;
retVal = SUCCESS;
}
else
{
retVal = FAIL;
}
return retVal;
}
#line 495
static inline uint8_t getNumberOfElementsToBeDqueued(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t freeSpace)
{
int16_t congestionUQ = 0;
congestionUQ = queue->total * 100 / TINYDWFQ_SIZE;
if (0 <= congestionUQ && congestionUQ <= 40)
{
congestionUQ = setAndGetDequeueWeight(queue, virtualQueueIndex, DQ_LOW, freeSpace);
}
else {
#line 505
if (41 <= congestionUQ && congestionUQ <= 75)
{
congestionUQ = setAndGetDequeueWeight(queue, virtualQueueIndex, DQ_MEDIUM, freeSpace);
}
else {
#line 509
if (76 <= congestionUQ && congestionUQ <= 90)
{
congestionUQ = setAndGetDequeueWeight(queue, virtualQueueIndex, DQ_HIGH, freeSpace);
}
else {
#line 513
if (91 <= congestionUQ && congestionUQ <= 100)
{
congestionUQ = setAndGetDequeueWeight(queue, virtualQueueIndex, DQ_URGENT, freeSpace);
}
}
}
}
#line 517
return congestionUQ;
}
#line 365
static inline void markElementAsPendingByQOS_TinyDWFQ(TinyDWFQPtr queue, uint8_t numOfElementsToMark)
{
int8_t vqIndex;
int8_t ind;
#line 368
int8_t nextVQhead = -1;
int8_t numElementsTobeDQed;
if (queue->numOfElements_processing > 0)
{
if (queue->numOfElements_processing <= numOfElementsToMark)
{
vqIndex = NUM_VIRTUAL_QUEUES;
while (numOfElementsToMark > 0 && vqIndex != 0 && queue->numOfElements_processing)
{
while (numOfElementsToMark > 0 && queue->numOfElements_VQ_Processing[vqIndex - 1] > 0 && queue->numOfElements_processing)
{
ind = queue->virtualQueues[vqIndex - 1][VQ_HEAD];
if (queue->numOfElements_VQ_Processing[vqIndex - 1] != 0 && ind != -1 && queue->element[ind].obj)
{
nextVQhead = queue->element[ind].next;
queue->element[ind].next = -1;
queue->element[ind].status = PENDING_TINYDWFQ;
if (queue->head[PENDING_TINYDWFQ] == -1)
{
queue->head[PENDING_TINYDWFQ] = queue->tail[PENDING_TINYDWFQ] = ind;
}
else
{
queue->element[queue->tail[PENDING_TINYDWFQ]].next = ind;
queue->tail[PENDING_TINYDWFQ] = ind;
}
queue->numOfElements_pending++;
if (nextVQhead == -1)
{
queue->virtualQueues[vqIndex - 1][VQ_HEAD] = queue->virtualQueues[vqIndex - 1][VQ_TAIL] = -1;
}
else
{
queue->virtualQueues[vqIndex - 1][VQ_HEAD] = nextVQhead;
}
queue->numOfElements_processing--;
queue->numOfElements_VQ_Processing[vqIndex - 1]--;
numOfElementsToMark--;
}
}
vqIndex--;
}
}
else
{
vqIndex = NUM_VIRTUAL_QUEUES;
while (numOfElementsToMark > 0 && vqIndex != 0)
{
if (numOfElementsToMark > 0 && queue->numOfElements_VQ_Processing[vqIndex - 1] != 0)
{
numElementsTobeDQed = getNumberOfElementsToBeDqueued(queue, vqIndex - 1, numOfElementsToMark);
if (numElementsTobeDQed == 0)
{
numElementsTobeDQed = 1;
}
while (numElementsTobeDQed > 0)
{
ind = queue->virtualQueues[vqIndex - 1][VQ_HEAD];
if (queue->numOfElements_VQ_Processing[vqIndex - 1] != 0 && ind != -1 && queue->element[ind].obj != (void *)0) {
#line 442
;
}
#line 443
{
nextVQhead = queue->element[ind].next;
queue->element[ind].next = -1;
queue->element[ind].status = PENDING_TINYDWFQ;
if (queue->head[PENDING_TINYDWFQ] == -1)
{
queue->head[PENDING_TINYDWFQ] = queue->tail[PENDING_TINYDWFQ] = ind;
}
else
{
queue->element[queue->tail[PENDING_TINYDWFQ]].next = ind;
queue->tail[PENDING_TINYDWFQ] = ind;
}
queue->numOfElements_pending++;
if (nextVQhead == -1)
{
queue->virtualQueues[vqIndex - 1][VQ_HEAD] = queue->virtualQueues[vqIndex - 1][VQ_TAIL] = -1;
}
else
{
queue->virtualQueues[vqIndex - 1][VQ_HEAD] = nextVQhead;
}
queue->numOfElements_processing--;
queue->numOfElements_VQ_Processing[vqIndex - 1]--;
numElementsTobeDQed--;
numOfElementsToMark--;
}
}
}
else
{
vqIndex--;
}
}
}
}
}
#line 962
static inline object_type *findMessageToReplace(TinyDWFQPtr queue, int8_t newMsgQOS)
{
int16_t ind;
ind = queue->head[PENDING_TINYDWFQ];
while (ind != -1)
{
if (queue->element[ind].qos < newMsgQOS)
{
return queue->element[ind].obj;
}
else {
ind = queue->element[ind].next;
}
}
#line 976
return (void *)0;
}
#line 698
static inline result_t markElementAsNotACKed_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg)
{
int8_t ind;
#line 700
int8_t prevIndex;
int8_t nextHead;
#line 702
ind = queue->head[PENDING_TINYDWFQ];
prevIndex = ind;
while (ind != -1)
{
if (queue->element[ind].obj == msg)
{
nextHead = queue->element[ind].next;
queue->element[ind].status = NOT_ACKED_TINYDWFQ;
queue->element[ind].next = -1;
queue->numOfElements_pending--;
if (queue->head[NOT_ACKED_TINYDWFQ] == -1)
{
queue->head[NOT_ACKED_TINYDWFQ] = queue->tail[NOT_ACKED_TINYDWFQ] = ind;
}
else
{
queue->element[queue->tail[NOT_ACKED_TINYDWFQ]].next = ind;
queue->tail[NOT_ACKED_TINYDWFQ] = ind;
}
queue->numOfElements_notAcked++;
if (ind == queue->head[PENDING_TINYDWFQ])
{
if (nextHead == -1)
{
queue->head[PENDING_TINYDWFQ] = queue->tail[PENDING_TINYDWFQ] = -1;
}
else
{
queue->head[PENDING_TINYDWFQ] = nextHead;
}
}
else {
#line 744
if (ind == queue->tail[PENDING_TINYDWFQ])
{
queue->tail[PENDING_TINYDWFQ] = prevIndex;
queue->element[prevIndex].next = -1;
}
else
{
queue->element[prevIndex].next = nextHead;
}
}
#line 755
return SUCCESS;
}
else
{
prevIndex = ind;
ind = queue->element[ind].next;
}
}
return FAIL;
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t MultiHopEngineM$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_NETWORKMSG, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 64 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t MultiHopEngineM$Leds$redOn(void){
#line 64
unsigned char result;
#line 64
#line 64
result = LedsC$Leds$redOn();
#line 64
#line 64
return result;
#line 64
}
#line 64
# 286 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteSelect$selectRoute(TOS_MsgPtr Msg, uint8_t id,
uint8_t resend)
#line 287
{
int i;
int8_t ttlDiff = 0;
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
if (pNWMsg->source != TOS_LOCAL_ADDRESS && resend == 0) {
for (i = 0; i < 45; i++) {
if (
#line 295
MultiHopLQI$gRecentOriginPacketSender[i] == pNWMsg->source &&
MultiHopLQI$gRecentOriginPacketSeqNo[i] == pNWMsg->seqno &&
!MultiHopLQI$localBeSink) {
ttlDiff = MultiHopLQI$gRecentOriginPacketTTL[i] >= pNWMsg->ttl ? MultiHopLQI$gRecentOriginPacketTTL[i] - pNWMsg->ttl : pNWMsg->ttl - MultiHopLQI$gRecentOriginPacketTTL[i];
if (ttlDiff >= 2) {
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Engine:Loop ttl:%i", pNWMsg->ttl));
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$fixedParent = FALSE;
}
;
return FAIL;
}
}
MultiHopLQI$gRecentOriginPacketSender[MultiHopLQI$gRecentOriginIndex] = pNWMsg->source;
MultiHopLQI$gRecentOriginPacketSeqNo[MultiHopLQI$gRecentOriginIndex] = pNWMsg->seqno;
MultiHopLQI$gRecentOriginPacketTTL[MultiHopLQI$gRecentOriginIndex] = pNWMsg->ttl;
MultiHopLQI$gRecentOriginIndex = (MultiHopLQI$gRecentOriginIndex + 1) % 45;
}
pNWMsg->linksource = TOS_LOCAL_ADDRESS;
Msg->addr = MultiHopLQI$gbCurrentParent;
if (pNWMsg->source == TOS_LOCAL_ADDRESS) {
pNWMsg->dest = MultiHopLQI$gbCurrentParent;
}
if (pNWMsg->source != TOS_LOCAL_ADDRESS && resend == 0) {
pNWMsg->ttl -= 1;
;
}
if (pNWMsg->ttl <= 0) {
;
return FALSE;
}
pNWMsg->linksource = TOS_LOCAL_ADDRESS;
return SUCCESS;
}
# 71 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteSelect.nc"
inline static result_t MultiHopEngineM$RouteSelect$selectRoute(TOS_MsgPtr arg_0x40df7270, uint8_t arg_0x40df73f8, uint8_t arg_0x40df7580){
#line 71
unsigned char result;
#line 71
#line 71
result = MultiHopLQI$RouteSelect$selectRoute(arg_0x40df7270, arg_0x40df73f8, arg_0x40df7580);
#line 71
#line 71
return result;
#line 71
}
#line 71
# 879 "/home/xu/oasis/system/TinyDWFQ.h"
static inline object_type *getheadElement_TinyDWFQ(TinyDWFQPtr queue, ObjStatus_t status)
{
if (queue->head[status] == -1) {
return (void *)0;
}
else {
#line 884
return queue->element[queue->head[status]].obj;
}
}
# 193 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline void MultiHopEngineM$sendTask(void)
{
TOS_MsgPtr msgPtr = getheadElement_TinyDWFQ(&MultiHopEngineM$sendQueue, PENDING_TINYDWFQ);
uint8_t infoIn = 0;
#line 197
MultiHopEngineM$sendTaskBusy = FALSE;
if (msgPtr == (void *)0)
{
return;
}
MultiHopEngineM$messageIsRetransmission = MultiHopEngineM$queueEntryInfo[infoIn].resend;
infoIn = MultiHopEngineM$findInfoEntry(msgPtr);
if (infoIn == 40)
{
;
}
if (MultiHopEngineM$queueEntryInfo[infoIn].valid == FALSE)
{
goto out;
}
if (MultiHopEngineM$RouteSelect$selectRoute(msgPtr, MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$messageIsRetransmission) != SUCCESS)
{
;
if (MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr != (void *)0)
{
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoIn].AMID, MultiHopEngineM$queueEntryInfo[infoIn].originalTOSPtr, FAIL);
MultiHopEngineM$numLocalPendingPkt--;
;
}
out:
removeElement_TinyDWFQ(&MultiHopEngineM$sendQueue, msgPtr, PENDING_TINYDWFQ);
freeBuffer(&MultiHopEngineM$buffQueue, msgPtr);
MultiHopEngineM$freeInfoEntry(infoIn);
MultiHopEngineM$numberOfSendFailures++;
MultiHopEngineM$numOfSuccessiveFailures++;
MultiHopEngineM$tryNextSend();
return;
}
else
{
if (msgPtr->addr == TOS_BCAST_ADDR)
{
;
MultiHopEngineM$Leds$redOn();
return;
}
if (MultiHopEngineM$SendMsg$send(msgPtr->addr, MultiHopEngineM$queueEntryInfo[infoIn].length, msgPtr) == SUCCESS)
{
if (SUCCESS != markElementAsNotACKed_TinyDWFQ(&MultiHopEngineM$sendQueue, msgPtr))
{
;
}
MultiHopEngineM$numOfPktProcessing++;
;
MultiHopEngineM$tryNextSend();
return;
}
else
{
MultiHopEngineM$queueEntryInfo[infoIn].resend = TRUE;
if (!isListEmpty_TinyDWFQ(&MultiHopEngineM$sendQueue, NOT_ACKED_TINYDWFQ))
{
MultiHopEngineM$tryNextSend();
}
}
}
}
# 312 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$assignPriority(TOS_MsgPtr msg, uint8_t level)
#line 312
{
NetworkMsg *NMsg = (NetworkMsg *)msg->data;
#line 314
NMsg->qos = 7;
}
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t EventReportM$EventSend$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_SNMS, arg_0x409bc330, arg_0x409bc4c0);
#line 83
#line 83
return result;
#line 83
}
#line 83
#line 106
inline static void *EventReportM$EventSend$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_SNMS, arg_0x409bcb88, arg_0x409bcd38);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 317 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline void EventReportM$sendEvent(void)
#line 317
{
TOS_MsgPtr msgPtr;
ApplicationMsg *pApp;
uint16_t maxLen;
uint8_t length;
EventMsg *pEvent;
msgPtr = headElement(&EventReportM$sendQueue, PENDING);
if (msgPtr == (void *)0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 326
{
EventReportM$taskBusy = FALSE;
}
#line 328
__nesc_atomic_end(__nesc_atomic); }
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
EventReportM$gfSendBusy = TRUE;
#line 332
__nesc_atomic_end(__nesc_atomic); }
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(msgPtr, &maxLen);
length = pApp->length + (size_t )& ((ApplicationMsg *)0)->data;
pEvent = (EventMsg *)pApp->data;
if (SUCCESS != EventReportM$EventSend$send(msgPtr, length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 345
EventReportM$gfSendBusy = FALSE;
#line 345
__nesc_atomic_end(__nesc_atomic); }
if (headElement(&EventReportM$sendQueue, PROCESSING) == (void *)0) {
EventReportM$tryNextSend();
}
}
else
{
;
if (SUCCESS != changeElementStatus(&EventReportM$sendQueue, msgPtr, PENDING, PROCESSING)) {
;
}
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 364
{
EventReportM$taskBusy = FALSE;
EventReportM$tryNextSend();
}
#line 367
__nesc_atomic_end(__nesc_atomic); }
}
return;
}
# 121 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline uint8_t NeighborMgmtM$findEntry(uint16_t id)
#line 121
{
uint8_t i = 0;
#line 123
for (i = 0; i < 16; i++) {
if (NeighborMgmtM$NeighborTbl[i].flags & NBRFLAG_VALID && NeighborMgmtM$NeighborTbl[i].id == id) {
return i;
}
}
return ROUTE_INVALID;
}
#line 165
static inline uint8_t NeighborMgmtM$findEntryToBeReplaced(void)
#line 165
{
uint8_t i = 0;
uint8_t minLinkEst = -1;
uint8_t minLinkEstIndex = ROUTE_INVALID;
#line 169
for (i = 0; i < 16; i++) {
if ((NeighborMgmtM$NeighborTbl[i].flags & NBRFLAG_VALID) == 0) {
return i;
}
if (NeighborMgmtM$NeighborTbl[i].relation & NBR_PARENT) {
continue;
}
#line 175
if (minLinkEst > NeighborMgmtM$NeighborTbl[i].linkEst) {
minLinkEst = NeighborMgmtM$NeighborTbl[i].linkEst;
minLinkEstIndex = i;
}
}
return minLinkEstIndex;
}
#line 131
static inline void NeighborMgmtM$newEntry(uint8_t indes, uint16_t id)
#line 131
{
NeighborMgmtM$NeighborTbl[indes].id = id;
NeighborMgmtM$NeighborTbl[indes].flags = NBRFLAG_VALID | NBRFLAG_NEW;
NeighborMgmtM$NeighborTbl[indes].liveliness = 0;
NeighborMgmtM$NeighborTbl[indes].childLiveliness = 0;
NeighborMgmtM$NeighborTbl[indes].linkEst = 0;
NeighborMgmtM$NeighborTbl[indes].linkEstCandidate = 0;
NeighborMgmtM$NeighborTbl[indes].parentCost = 0x7fff;
NeighborMgmtM$NeighborTbl[indes].relation = 0;
}
# 122 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline result_t CascadesEngineM$insertAndStartSend(TOS_MsgPtr msg)
#line 122
{
result_t result;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 125
{
result = insertElement(&CascadesEngineM$sendQueue, msg);
CascadesEngineM$tryNextSend();
}
#line 128
__nesc_atomic_end(__nesc_atomic); }
return result;
}
#line 94
static inline result_t CascadesEngineM$SendMsg$default$send(uint8_t type, uint16_t dest, uint8_t length, TOS_MsgPtr pMsg)
#line 94
{
return FAIL;
}
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t CascadesEngineM$SendMsg$send(uint8_t arg_0x414016a8, uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0){
#line 48
unsigned char result;
#line 48
#line 48
switch (arg_0x414016a8) {
#line 48
case AM_CASCTRLMSG:
#line 48
result = GenericCommProM$SendMsg$send(AM_CASCTRLMSG, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
break;
#line 48
case AM_CASCADESMSG:
#line 48
result = GenericCommProM$SendMsg$send(AM_CASCADESMSG, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
break;
#line 48
default:
#line 48
result = CascadesEngineM$SendMsg$default$send(arg_0x414016a8, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
break;
#line 48
}
#line 48
#line 48
return result;
#line 48
}
#line 48
# 99 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline void CascadesEngineM$sendTask(void)
#line 99
{
TOS_MsgPtr msg;
#line 101
msg = headElement(&CascadesEngineM$sendQueue, PENDING);
if (msg == (void *)0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 103
CascadesEngineM$sendTaskBusy = FALSE;
#line 103
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (SUCCESS == CascadesEngineM$SendMsg$send(msg->type, msg->addr, msg->length, msg)) {
if (SUCCESS != changeElementStatus(&CascadesEngineM$sendQueue, msg, PENDING, PROCESSING)) {
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 111
{
CascadesEngineM$sendTaskBusy = FALSE;
CascadesEngineM$tryNextSend();
}
#line 114
__nesc_atomic_end(__nesc_atomic); }
}
else
#line 115
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 116
CascadesEngineM$sendTaskBusy = FALSE;
#line 116
__nesc_atomic_end(__nesc_atomic); }
CascadesEngineM$SendMsg$sendDone(msg->type, msg, FAIL);
}
return;
}
# 536 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$updateProtocolField(TOS_MsgPtr msg, uint8_t id, address_t addr, uint8_t len)
#line 536
{
if (len > 74) {
;
return FAIL;
}
msg->type = id;
msg->addr = addr;
msg->group = TOS_AM_GROUP;
msg->length = len;
return SUCCESS;
}
#line 504
static inline result_t GenericCommProM$insertAndStartSend(TOS_MsgPtr msg)
#line 504
{
result_t result;
#line 506
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 506
{
result = insertElement(&GenericCommProM$sendQueue, msg);
GenericCommProM$tryNextSend();
}
#line 509
__nesc_atomic_end(__nesc_atomic); }
return result;
}
#line 698
static inline uint8_t GenericCommProM$allocateBkHeaderEntry(void)
#line 698
{
uint8_t i = 0;
#line 700
for (i = 0; i < COMM_SEND_QUEUE_SIZE; i++) {
if (GenericCommProM$bkHeader[i].valid == FALSE) {
return i;
}
}
#line 704
if (i == COMM_SEND_QUEUE_SIZE) {
;
}
#line 706
return i;
}
# 1009 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$SubSend$sendDone(uint8_t type, TOS_MsgPtr msg, result_t status)
#line 1009
{
if (type == AM_CASCTRLMSG) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1011
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 1011
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 119 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t CascadesEngineM$MySend$sendDone(uint8_t arg_0x41402e60, TOS_MsgPtr arg_0x409ba768, result_t arg_0x409ba8f8){
#line 119
unsigned char result;
#line 119
#line 119
result = CascadesRouterM$SubSend$sendDone(arg_0x41402e60, arg_0x409ba768, arg_0x409ba8f8);
#line 119
#line 119
return result;
#line 119
}
#line 119
# 146 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static inline void CascadesEngineM$updateProtocolField(TOS_MsgPtr msg, uint8_t type, uint8_t len)
#line 146
{
msg->type = type;
msg->length = len;
}
# 610 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 610
{
return SUCCESS;
}
# 666 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 666
{
return SUCCESS;
}
# 751 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline result_t GPSSensorM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 751
{
return SUCCESS;
}
# 438 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline result_t TimeSyncM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 438
{
return SUCCESS;
}
# 361 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 361
{
return SUCCESS;
}
# 379 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 379
{
return SUCCESS;
}
# 541 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 541
{
return SUCCESS;
}
# 518 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$EventReport$eventSendDone(TOS_MsgPtr pMsg, result_t success)
#line 518
{
return SUCCESS;
}
# 244 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$EventReport$default$eventSendDone(uint8_t eventType, TOS_MsgPtr pMsg, result_t success)
#line 244
{
return SUCCESS;
}
# 47 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static result_t EventReportM$EventReport$eventSendDone(uint8_t arg_0x40d0b508, TOS_MsgPtr arg_0x409b64e0, result_t arg_0x409b6670){
#line 47
unsigned char result;
#line 47
#line 47
switch (arg_0x40d0b508) {
#line 47
case EVENT_TYPE_SNMS:
#line 47
result = MultiHopEngineM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670);
#line 47
result = rcombine(result, MultiHopLQI$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
result = rcombine(result, MultiHopLQI$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
result = rcombine(result, GenericCommProM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
result = rcombine(result, GPSSensorM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
result = rcombine(result, RealTimeM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
break;
#line 47
case EVENT_TYPE_SENSING:
#line 47
result = DataMgmtM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670);
#line 47
result = rcombine(result, TimeSyncM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
result = rcombine(result, SmartSensingM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670));
#line 47
break;
#line 47
case EVENT_TYPE_DATAMANAGE:
#line 47
result = SmartSensingM$EventReport$eventSendDone(arg_0x409b64e0, arg_0x409b6670);
#line 47
break;
#line 47
default:
#line 47
result = EventReportM$EventReport$default$eventSendDone(arg_0x40d0b508, arg_0x409b64e0, arg_0x409b6670);
#line 47
break;
#line 47
}
#line 47
#line 47
return result;
#line 47
}
#line 47
# 79 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline void NeighborMgmtM$processSnoopMsg(void)
#line 79
{
uint8_t iNbr;
#line 81
iNbr = NeighborMgmtM$findPreparedIndex(NeighborMgmtM$linkaddrBuf);
if (NeighborMgmtM$NeighborTbl[iNbr].flags & NBRFLAG_NEW) {
NeighborMgmtM$NeighborTbl[iNbr].linkEst = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].flags ^= NBRFLAG_NEW;
}
else {
if (NeighborMgmtM$NeighborTbl[iNbr].flags & NBRFLAG_JUST_UPDATED) {
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].flags ^= NBRFLAG_JUST_UPDATED;
}
else {
NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate = NeighborMgmtM$NeighborTbl[iNbr].linkEstCandidate * 0.75 + NeighborMgmtM$lqiBuf * 0.25;
}
}
NeighborMgmtM$NeighborTbl[iNbr].lqiRaw = NeighborMgmtM$lqiBuf;
NeighborMgmtM$NeighborTbl[iNbr].rssiRaw = NeighborMgmtM$rssiBuf;
NeighborMgmtM$NeighborTbl[iNbr].lastHeard = TRUE;
NeighborMgmtM$NeighborTbl[iNbr].liveliness = LIVELINESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 103
NeighborMgmtM$processTaskBusy = FALSE;
#line 103
__nesc_atomic_end(__nesc_atomic); }
}
#line 105
static inline result_t NeighborMgmtM$Snoop$intercept(TOS_MsgPtr msg, void *payload, uint16_t payloadLen)
#line 105
{
if (!NeighborMgmtM$processTaskBusy) {
NeighborMgmtM$lqiBuf = msg->lqi;
NeighborMgmtM$rssiBuf = msg->strength;
NeighborMgmtM$nwMsg = (NetworkMsg *)msg->data;
NeighborMgmtM$linkaddrBuf = NeighborMgmtM$nwMsg->linksource;
if (TOS_post(NeighborMgmtM$processSnoopMsg) == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 115
NeighborMgmtM$processTaskBusy = TRUE;
#line 115
__nesc_atomic_end(__nesc_atomic); }
}
}
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t GenericCommProM$Intercept$intercept(TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990){
#line 86
unsigned char result;
#line 86
#line 86
result = NeighborMgmtM$Snoop$intercept(arg_0x40d8d658, arg_0x40d8d7f8, arg_0x40d8d990);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 15 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$setCost(uint16_t arg_0x40e1bc70, uint16_t arg_0x40e1be00){
#line 15
unsigned char result;
#line 15
#line 15
result = NeighborMgmtM$NeighborCtrl$setCost(arg_0x40e1bc70, arg_0x40e1be00);
#line 15
#line 15
return result;
#line 15
}
#line 15
# 441 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline TOS_MsgPtr MultiHopLQI$ReceiveMsg$receive(TOS_MsgPtr Msg)
#line 441
{
NetworkMsg *pNWMsg = (NetworkMsg *)&Msg->data[0];
BeaconMsg *pRP = (BeaconMsg *)&pNWMsg->data[0];
uint16_t oldParent = 0;
#line 446
MultiHopLQI$receivedBeacon = TRUE;
if (pNWMsg->linksource != pNWMsg->source ||
pRP->parent != pRP->parent_dup) {
return Msg;
}
if (MultiHopLQI$localBeSink) {
#line 452
return Msg;
}
if (pNWMsg->linksource == MultiHopLQI$gbCurrentParent) {
if (pRP->parent != TOS_LOCAL_ADDRESS) {
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParentCost = pRP->cost;
MultiHopLQI$gbCurrentLinkEst = MultiHopLQI$adjustLQI(Msg->lqi);
MultiHopLQI$gbLinkQuality = Msg->lqi;
MultiHopLQI$gbCurrentHopCount = pRP->hopcount + 1;
if (pRP->parent == TOS_BCAST_ADDR) {
goto invalidate;
}
else {
#line 469
MultiHopLQI$NeighborCtrl$setCost(pNWMsg->source, pRP->cost);
}
}
else
#line 471
{
if (!MultiHopLQI$localBeSink) {
invalidate:
;
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Engine:loop p:%i", MultiHopLQI$gbCurrentParent));
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
TOS_post(MultiHopLQI$SendRouteTask);
}
}
}
else
#line 492
{
MultiHopLQI$NeighborCtrl$setCost(pNWMsg->source, pRP->cost);
if (MultiHopLQI$fixedParent) {
#line 502
return Msg;
}
if (
#line 505
(uint32_t )pRP->cost + (uint32_t )MultiHopLQI$adjustLQI(Msg->lqi)
<
(uint32_t )MultiHopLQI$gbCurrentParentCost + (uint32_t )MultiHopLQI$gbCurrentLinkEst - ((
(uint32_t )MultiHopLQI$gbCurrentParentCost + (uint32_t )MultiHopLQI$gbCurrentLinkEst) >> 2)
&&
pRP->parent != TOS_LOCAL_ADDRESS) {
oldParent = MultiHopLQI$gbCurrentParent;
MultiHopLQI$gLastHeard = 0;
MultiHopLQI$gbCurrentParent = pNWMsg->linksource;
MultiHopLQI$gbCurrentParentCost = pRP->cost;
MultiHopLQI$gbCurrentLinkEst = MultiHopLQI$adjustLQI(Msg->lqi);
MultiHopLQI$gbLinkQuality = Msg->lqi;
MultiHopLQI$gbCurrentHopCount = pRP->hopcount + 1;
MultiHopLQI$NeighborCtrl$setParent(MultiHopLQI$gbCurrentParent);
if (oldParent == TOS_BCAST_ADDR) {
MultiHopLQI$MultihopCtrl$readyToSend();
TOS_post(MultiHopLQI$SendRouteTask);
}
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_MEDIUM,
eventprintf("parent:%i", MultiHopLQI$gbCurrentParent));
}
}
return Msg;
}
# 678 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Intercept$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen)
#line 680
{
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t MultiHopEngineM$Intercept$intercept(uint8_t arg_0x41310200, TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopEngineM$Intercept$default$intercept(arg_0x41310200, arg_0x40d8d658, arg_0x40d8d7f8, arg_0x40d8d990);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 555 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$checkForDuplicates(TOS_MsgPtr msg, bool disable)
{
TOS_MsgPtr oldMsg;
NetworkMsg *checkingMsg;
NetworkMsg *passedMsg = (NetworkMsg *)msg->data;
uint16_t ind;
TinyDWFQ_t *queue = &MultiHopEngineM$sendQueue;
#line 562
for (ind = 0; ind < queue->size; ind++)
{
if (queue->element[ind].obj != (void *)0)
{
oldMsg = queue->element[ind].obj;
checkingMsg = (NetworkMsg *)oldMsg->data;
if (checkingMsg->source == passedMsg->source &&
checkingMsg->seqno == passedMsg->seqno)
{
if (disable == TRUE)
{
}
return FAIL;
}
}
}
return SUCCESS;
}
# 7 "/home/xu/oasis/interfaces/NeighborCtrl.nc"
inline static bool MultiHopLQI$NeighborCtrl$addChild(uint16_t arg_0x40e1ddf0, uint16_t arg_0x40e1c010, bool arg_0x40e1c1a0){
#line 7
unsigned char result;
#line 7
#line 7
result = NeighborMgmtM$NeighborCtrl$addChild(arg_0x40e1ddf0, arg_0x40e1c010, arg_0x40e1c1a0);
#line 7
#line 7
return result;
#line 7
}
#line 7
# 570 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$MultihopCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect)
#line 570
{
return MultiHopLQI$NeighborCtrl$addChild(childAddr, priorHop, isDirect);
}
# 4 "/home/xu/oasis/interfaces/MultihopCtrl.nc"
inline static result_t MultiHopEngineM$MultihopCtrl$addChild(uint16_t arg_0x40df3928, uint16_t arg_0x40df3ac0, bool arg_0x40df3c50){
#line 4
unsigned char result;
#line 4
#line 4
result = MultiHopLQI$MultihopCtrl$addChild(arg_0x40df3928, arg_0x40df3ac0, arg_0x40df3c50);
#line 4
#line 4
return result;
#line 4
}
#line 4
# 684 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline result_t MultiHopEngineM$Snoop$default$intercept(uint8_t AMID, TOS_MsgPtr pMsg,
void *payload,
uint16_t payloadLen)
#line 686
{
return SUCCESS;
}
# 86 "/opt/tinyos-1.x/tos/interfaces/Intercept.nc"
inline static result_t MultiHopEngineM$Snoop$intercept(uint8_t arg_0x413107e0, TOS_MsgPtr arg_0x40d8d658, void *arg_0x40d8d7f8, uint16_t arg_0x40d8d990){
#line 86
unsigned char result;
#line 86
#line 86
result = MultiHopEngineM$Snoop$default$intercept(arg_0x413107e0, arg_0x40d8d658, arg_0x40d8d7f8, arg_0x40d8d990);
#line 86
#line 86
return result;
#line 86
}
#line 86
# 441 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline TOS_MsgPtr MultiHopEngineM$ReceiveMsg$receive(TOS_MsgPtr msg)
{
NetworkMsg *multiHopMsg = (NetworkMsg *)msg->data;
uint16_t correctedLength = msg->length - (size_t )& ((NetworkMsg *)0)->data;
uint8_t AMID = msg->type;
if (msg->length < MultiHopEngineM$NETWORKMSG_HEADER_LENGTH ||
msg->length > 74) {
return msg;
}
if (msg->addr != TOS_LOCAL_ADDRESS)
{
MultiHopEngineM$Snoop$intercept(AMID, msg,
&multiHopMsg->data[0],
correctedLength);
}
else
{
if (multiHopMsg->source == multiHopMsg->linksource) {
MultiHopEngineM$MultihopCtrl$addChild(multiHopMsg->source, multiHopMsg->linksource, TRUE);
}
else {
#line 465
MultiHopEngineM$MultihopCtrl$addChild(multiHopMsg->source, multiHopMsg->linksource, FALSE);
}
if (MultiHopEngineM$checkForDuplicates(msg, FALSE) == SUCCESS)
{
if (MultiHopEngineM$Intercept$intercept(AMID, msg, &multiHopMsg->data[0], correctedLength) == SUCCESS)
{
if (MultiHopEngineM$insertAndStartSend(msg, AMID, msg->length, (void *)0) != SUCCESS)
{
MultiHopEngineM$numberOfSendFailures++;
;
}
else
{
;
}
}
else
{
;
}
}
else
{
;
}
}
return msg;
}
# 902 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$TimeSyncNotify$default$msg_received(void)
#line 902
{
}
# 20 "/home/xu/oasis/interfaces/TimeSyncNotify.nc"
inline static void TimeSyncM$TimeSyncNotify$msg_received(void){
#line 20
TimeSyncM$TimeSyncNotify$default$msg_received();
#line 20
}
#line 20
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t TimeSyncM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SENSING, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 40 "/home/xu/oasis/interfaces/RealTime.nc"
inline static result_t TimeSyncM$RealTime$setTimeCount(uint32_t arg_0x40abf6d8, uint8_t arg_0x40abf860){
#line 40
unsigned char result;
#line 40
#line 40
result = RealTimeM$RealTime$setTimeCount(arg_0x40abf6d8, arg_0x40abf860);
#line 40
#line 40
return result;
#line 40
}
#line 40
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 250 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$calculateConversion(void)
{
float newSkew = TimeSyncM$skew;
uint32_t newLocalAverage;
int32_t newOffsetAverage;
int64_t localSum;
int64_t offsetSum;
int8_t i;
for (i = 0; i < TimeSyncM$MAX_ENTRIES && TimeSyncM$table[i].state != TimeSyncM$ENTRY_FULL; ++i)
;
if (i >= TimeSyncM$MAX_ENTRIES) {
return;
}
newLocalAverage = TimeSyncM$table[i].localTime;
newOffsetAverage = TimeSyncM$table[i].timeOffset;
localSum = 0;
offsetSum = 0;
while (++i < TimeSyncM$MAX_ENTRIES) {
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_FULL) {
localSum += (int32_t )(TimeSyncM$table[i].localTime - newLocalAverage) / TimeSyncM$tableEntries;
offsetSum += (int32_t )(TimeSyncM$table[i].timeOffset - newOffsetAverage) / TimeSyncM$tableEntries;
}
}
newLocalAverage += localSum;
newOffsetAverage += offsetSum;
localSum = offsetSum = 0;
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_FULL) {
int32_t a = TimeSyncM$table[i].localTime - newLocalAverage;
int32_t b = TimeSyncM$table[i].timeOffset - newOffsetAverage;
localSum += (int64_t )a * a;
offsetSum += (int64_t )a * b;
}
}
if (localSum != 0) {
newSkew = (float )offsetSum / (float )localSum;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
TimeSyncM$skew = newSkew;
TimeSyncM$offsetAverage = newOffsetAverage;
TimeSyncM$localAverage = newLocalAverage;
TimeSyncM$numEntries = TimeSyncM$tableEntries;
}
#line 304
__nesc_atomic_end(__nesc_atomic); }
TimeSyncM$Leds$greenToggle();
}
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t TimeSyncM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = NoLeds$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 320 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline void TimeSyncM$addNewEntry(TimeSyncMsg *msg)
{
int8_t i;
#line 322
int8_t freeItem = -1;
#line 322
int8_t oldestItem = 0;
uint32_t age;
#line 323
uint32_t oldestTime = 0;
int32_t timeError;
int32_t ErrTS;
TimeSyncM$tableEntries = 0;
ErrTS = msg->arrivalTime;
TimeSyncM$GlobalTime$local2Global(&ErrTS);
timeError = msg->arrivalTime;
TimeSyncM$GlobalTime$local2Global(&timeError);
timeError -= msg->sendingTime;
if (TimeSyncM$is_synced() && (timeError > TimeSyncM$ENTRY_THROWOUT_LIMIT || timeError < -TimeSyncM$ENTRY_THROWOUT_LIMIT)) {
TimeSyncM$errTimes += 1;
if (TimeSyncM$errTimes >= TimeSyncM$ERROR_TIMES) {
TimeSyncM$clearTable();
TimeSyncM$EventReport$eventSend(EVENT_TYPE_SENSING, EVENT_LEVEL_URGENT,
eventprintf("Node %i received 3 cont bad time message %i.\n", TOS_LOCAL_ADDRESS, ErrTS));
}
else {
return;
}
}
if (msg->sendingTime - msg->arrivalTime > DAY_END >> 1 && msg->sendingTime - msg->arrivalTime < -(DAY_END >> 1)) {
return;
}
TimeSyncM$errTimes = 0;
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
++TimeSyncM$tableEntries;
age = msg->arrivalTime - TimeSyncM$table[i].localTime;
if (age >= 0x7FFFFFFFL) {
TimeSyncM$table[i].state = TimeSyncM$ENTRY_EMPTY;
}
if (TimeSyncM$table[i].state == TimeSyncM$ENTRY_EMPTY) {
--TimeSyncM$tableEntries;
freeItem = i;
}
if (age >= oldestTime) {
oldestTime = age;
oldestItem = i;
}
}
if (freeItem < 0) {
freeItem = oldestItem;
}
else {
++TimeSyncM$tableEntries;
}
TimeSyncM$table[freeItem].state = TimeSyncM$ENTRY_FULL;
TimeSyncM$table[freeItem].localTime = msg->arrivalTime;
TimeSyncM$table[freeItem].timeOffset = msg->sendingTime - msg->arrivalTime;
TimeSyncM$Leds$yellowToggle();
}
#line 442
static inline void TimeSyncM$processMsg(void)
{
TimeSyncMsg *msg = (TimeSyncMsg *)TimeSyncM$processedMsg->data;
uint32_t globalSettime = 0;
#line 460
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS == msg->hasGPS) {
if (msg->rootID < ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && ~(TimeSyncM$heartBeats < TimeSyncM$IGNORE_ROOT_MSG && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS)) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = msg->rootID;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
TimeSyncM$rootid = msg->rootID;
}
else {
#line 466
if (msg->rootID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && (int8_t )(msg->seqNum - ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum) > 0 && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != 0xffff) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
}
else {
if (msg->rootID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID && (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff || ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS)) {
if (TimeSyncM$alreadySetTime == 0) {
if (TimeSyncM$RealTime$setTimeCount(1, FTSP_SYNC) == SUCCESS) {
TimeSyncM$alreadySetTime = 1;
}
}
goto exit;
}
else {
goto exit;
}
}
}
}
else {
#line 485
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS != TRUE && msg->hasGPS == TRUE) {
if (msg->rootID == TOS_LOCAL_ADDRESS) {
goto exit;
}
TimeSyncM$hasGPSValid++;
if (TimeSyncM$hasGPSValid >= TimeSyncM$GPS_VALID) {
TimeSyncM$hasGPSValid = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = msg->rootID;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = msg->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = msg->rootID;
}
else {
goto exit;
}
}
else {
#line 502
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS == TRUE && msg->hasGPS != TRUE) {
if (msg->nodeID == ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
}
goto exit;
}
}
}
TimeSyncM$addNewEntry(msg);
TimeSyncM$calculateConversion();
if (TimeSyncM$numEntries > 0) {
if (TimeSyncM$alreadySetTime == 0) {
if (TimeSyncM$RealTime$setTimeCount(0, FTSP_SYNC) == SUCCESS) {
TimeSyncM$alreadySetTime = 1;
TimeSyncM$clearTable();
TimeSyncM$GlobalTime$getGlobalTime(&globalSettime);
TimeSyncM$EventReport$eventSend(EVENT_TYPE_SENSING, EVENT_LEVEL_URGENT,
eventprintf("Node %i reset the timecount in RTC at %i.\n", TOS_LOCAL_ADDRESS, globalSettime));
TimeSyncM$skew = 0.0;
TimeSyncM$offsetAverage = 0;
TimeSyncM$localAverage = 0;
}
}
}
TimeSyncM$TimeSyncNotify$msg_received();
exit:
TimeSyncM$state &= ~TimeSyncM$STATE_PROCESSING;
}
# 138 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline result_t ClockTimeStampingM$TimeStamping$getStamp(TOS_MsgPtr ourMessage,
uint32_t *timeStamp)
#line 139
{
TimeSyncMsg *newMessage = (TimeSyncMsg *)ourMessage->data;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 144
{
if (ourMessage == ClockTimeStampingM$rcv_message) {
newMessage->arrivalTime = ClockTimeStampingM$rcv_time;
{
unsigned char __nesc_temp =
#line 150
SUCCESS;
{
#line 150
__nesc_atomic_end(__nesc_atomic);
#line 150
return __nesc_temp;
}
}
}
else
#line 151
{
{
unsigned char __nesc_temp =
#line 152
FAIL;
{
#line 152
__nesc_atomic_end(__nesc_atomic);
#line 152
return __nesc_temp;
}
}
}
}
#line 156
__nesc_atomic_end(__nesc_atomic); }
}
# 39 "/home/xu/oasis/interfaces/TimeStamping.nc"
inline static result_t TimeSyncM$TimeStamping$getStamp(TOS_MsgPtr arg_0x40e93010, uint32_t *arg_0x40e931c8){
#line 39
unsigned char result;
#line 39
#line 39
result = ClockTimeStampingM$TimeStamping$getStamp(arg_0x40e93010, arg_0x40e931c8);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 538 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static inline TOS_MsgPtr TimeSyncM$ReceiveMsg$receive(TOS_MsgPtr p)
#line 538
{
TOS_MsgPtr old;
TimeSyncMsg *newMessage = (TimeSyncMsg *)p->data;
#line 555
if (TimeSyncM$mode == TS_USER_MODE) {
return p;
}
if (
#line 564
TimeSyncM$TimeStamping$getStamp(p,
& newMessage->arrivalTime) != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 566
TimeSyncM$missedReceiveStamps++;
#line 566
__nesc_atomic_end(__nesc_atomic); }
return p;
}
if (newMessage->wroteStamp != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 578
TimeSyncM$missedSendStamps++;
#line 578
__nesc_atomic_end(__nesc_atomic); }
return p;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 583
{
if (TimeSyncM$state & TimeSyncM$STATE_PROCESSING) {
{
struct TOS_Msg *__nesc_temp =
#line 585
p;
{
#line 585
__nesc_atomic_end(__nesc_atomic);
#line 585
return __nesc_temp;
}
}
}
else
#line 586
{
TimeSyncM$state |= TimeSyncM$STATE_PROCESSING;
}
}
#line 589
__nesc_atomic_end(__nesc_atomic); }
old = TimeSyncM$processedMsg;
TimeSyncM$processedMsg = p;
TOS_post(TimeSyncM$processMsg);
return old;
}
# 377 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$ReceiveMsg$default$receive(uint8_t id, TOS_MsgPtr msg)
#line 377
{
return msg;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr GenericCommProM$ReceiveMsg$receive(uint8_t arg_0x40d923e0, TOS_MsgPtr arg_0x40620878){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
switch (arg_0x40d923e0) {
#line 75
case AM_NETWORKMSG:
#line 75
result = MultiHopEngineM$ReceiveMsg$receive(arg_0x40620878);
#line 75
break;
#line 75
case AM_CASCTRLMSG:
#line 75
result = CascadesRouterM$ReceiveMsg$receive(AM_CASCTRLMSG, arg_0x40620878);
#line 75
break;
#line 75
case AM_CASCADESMSG:
#line 75
result = CascadesRouterM$ReceiveMsg$receive(AM_CASCADESMSG, arg_0x40620878);
#line 75
break;
#line 75
case AM_TIMESYNCMSG:
#line 75
result = TimeSyncM$ReceiveMsg$receive(arg_0x40620878);
#line 75
break;
#line 75
case AM_BEACONMSG:
#line 75
result = MultiHopLQI$ReceiveMsg$receive(arg_0x40620878);
#line 75
break;
#line 75
default:
#line 75
result = GenericCommProM$ReceiveMsg$default$receive(arg_0x40d923e0, arg_0x40620878);
#line 75
break;
#line 75
}
#line 75
#line 75
return result;
#line 75
}
#line 75
# 389 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$CascadeControl$addDirectChild(address_t childID)
#line 389
{
CascadesRouterM$addToChildrenList(childID);
return SUCCESS;
}
# 3 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static result_t NeighborMgmtM$CascadeControl$addDirectChild(address_t arg_0x4121abb0){
#line 3
unsigned char result;
#line 3
#line 3
result = CascadesRouterM$CascadeControl$addDirectChild(arg_0x4121abb0);
#line 3
#line 3
return result;
#line 3
}
#line 3
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t MultiHopLQI$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_BEACONMSG, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 2 "/home/xu/oasis/lib/NeighborMgmt/CascadeControl.nc"
inline static uint16_t CascadesRouterM$CascadeControl$getParent(void){
#line 2
unsigned short result;
#line 2
#line 2
result = NeighborMgmtM$CascadeControl$getParent();
#line 2
#line 2
return result;
#line 2
}
#line 2
# 932 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$processNoData(TOS_MsgPtr tmPtr)
#line 932
{
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
uint16_t seq = CCMsg->dataSeq;
if (CCMsg->linkSource != CascadesRouterM$CascadeControl$getParent()) {
return;
}
if (seq > CascadesRouterM$expectingSeq) {
CascadesRouterM$expectingSeq = seq;
}
else {
if (seq < 10 && CascadesRouterM$expectingSeq > 65530UL) {
CascadesRouterM$expectingSeq = seq;
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 950
CascadesRouterM$activeRT = FALSE;
#line 950
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$RTTimer$stop();
return;
}
#line 900
static inline void CascadesRouterM$processACK(TOS_MsgPtr tmPtr)
#line 900
{
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
address_t linkSource = CCMsg->linkSource;
uint8_t localIndex = 0;
#line 904
if (CCMsg->parent != TOS_LOCAL_ADDRESS) {
CascadesRouterM$delFromChildrenList(linkSource);
}
else {
CascadesRouterM$addToChildrenList(linkSource);
localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq);
if (localIndex != INVALID_INDEX) {
CascadesRouterM$addChildACK(linkSource, localIndex);
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
}
else {
}
}
else
{
}
}
return;
}
#line 859
static inline void CascadesRouterM$processRequest(void)
#line 859
{
TOS_MsgPtr tempPtr = (void *)0;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)CascadesRouterM$RecvRequestMsg.data;
address_t linkSource = CCMsg->linkSource;
uint8_t localIndex = 0;
if (CCMsg->parent != TOS_LOCAL_ADDRESS) {
CascadesRouterM$delFromChildrenList(linkSource);
}
else {
CascadesRouterM$addToChildrenList(linkSource);
localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq);
if (INVALID_INDEX == localIndex) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 874
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 874
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_NODATA);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 879
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 879
__nesc_atomic_end(__nesc_atomic); }
}
}
}
if (CascadesRouterM$inited == TRUE) {
tempPtr = & CascadesRouterM$myBuffer[0].tmsg;
CascadesRouterM$produceDataMsg(tempPtr);
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCADESMSG, tempPtr, tempPtr->length)) {
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 891
CascadesRouterM$RequestProcessBusy = FALSE;
#line 891
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ACKTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(26U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 818 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$processCMAu(void)
#line 818
{
TOS_MsgPtr tempPtr = (void *)0;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)CascadesRouterM$RecvCMAuMsg.data;
uint8_t i = 0;
uint8_t localIndex = 0;
uint16_t *dst;
#line 824
if (INVALID_INDEX != (localIndex = CascadesRouterM$findMsgIndex(CCMsg->dataSeq))) {
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
dst = (uint16_t *)CCMsg->data;
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (TOS_LOCAL_ADDRESS == *dst) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 833
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 833
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CCMsg->dataSeq, TYPE_CASCADES_ACK);
tempPtr->addr = CCMsg->linkSource;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 838
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 838
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
}
++dst;
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 847
CascadesRouterM$CMAuProcessBusy = FALSE;
#line 847
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$ResetTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(24U);
#line 68
#line 68
return result;
#line 68
}
#line 68
#line 59
inline static result_t CascadesRouterM$DelayTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(25U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 1020 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline TOS_MsgPtr CascadesRouterM$Receive$default$receive(uint8_t type, TOS_MsgPtr pMsg,
void *payload, uint16_t payloadLen)
#line 1021
{
return pMsg;
}
# 81 "/opt/tinyos-1.x/tos/interfaces/Receive.nc"
inline static TOS_MsgPtr CascadesRouterM$Receive$receive(uint8_t arg_0x41369c38, TOS_MsgPtr arg_0x409b8068, void *arg_0x409b8208, uint16_t arg_0x409b83a0){
#line 81
struct TOS_Msg *result;
#line 81
#line 81
switch (arg_0x41369c38) {
#line 81
case NW_RPCC:
#line 81
result = RpcM$CommandReceive$receive(arg_0x409b8068, arg_0x409b8208, arg_0x409b83a0);
#line 81
break;
#line 81
default:
#line 81
result = CascadesRouterM$Receive$default$receive(arg_0x41369c38, arg_0x409b8068, arg_0x409b8208, arg_0x409b83a0);
#line 81
break;
#line 81
}
#line 81
#line 81
return result;
#line 81
}
#line 81
# 241 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline void CascadesRouterM$updateInData(void)
#line 241
{
CascadesRouterM$inData[(CascadesRouterM$highestSeq + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
CascadesRouterM$inData[(CascadesRouterM$highestSeq + 1 + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
CascadesRouterM$inData[(CascadesRouterM$highestSeq + 2 + (MAX_CAS_PACKETS >> 2)) % MAX_CAS_PACKETS] = FALSE;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t CascadesRouterM$RTTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(22U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
inline static result_t CascadesRouterM$DelayTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(25U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 278 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static inline result_t CascadesRouterM$addIntoBuffer(TOS_MsgPtr tmPtr)
#line 278
{
uint8_t i;
uint8_t j;
#line 281
for (i = 0; i < MAX_CAS_BUF; i++) {
if (CascadesRouterM$myBuffer[i].countDT == 0 && CascadesRouterM$myBuffer[i].signalDone == 1) {
nmemcpy((void *)& CascadesRouterM$myBuffer[i].tmsg, (void *)tmPtr, sizeof(TOS_Msg ));
CascadesRouterM$myBuffer[i].countDT = 1;
CascadesRouterM$myBuffer[i].retry = 0;
CascadesRouterM$myBuffer[i].signalDone = 0;
CascadesRouterM$inData[CascadesRouterM$getCasData(& CascadesRouterM$myBuffer[i].tmsg)->seqno % MAX_CAS_PACKETS] = TRUE;
CascadesRouterM$headIndex = i;
for (j = 0; j < MAX_NUM_CHILDREN; j++) {
CascadesRouterM$myBuffer[i].childrenList[j].status = 0;
}
return SUCCESS;
}
}
return FAIL;
}
#line 614
static inline uint32_t CascadesRouterM$crcByte(uint32_t crc, uint8_t b)
#line 614
{
uint8_t i = 8;
#line 616
crc ^= (uint32_t )b << 24UL;
do {
if ((crc & 0x80000000) != 0) {
crc = (crc << 1UL) ^ 0x04C11DB7;
}
else {
#line 621
crc = crc << 1UL;
}
}
while (
#line 623
--i != 0);
return crc;
}
static inline uint32_t CascadesRouterM$calculateCRC(uint8_t *start, uint8_t length)
#line 627
{
uint8_t i = 0;
uint32_t crc = 0xffffffff;
#line 630
for (i = 0; i < length; i++) {
crc = CascadesRouterM$crcByte(crc, *(start + i));
}
return crc;
}
static inline void CascadesRouterM$processData(void)
#line 640
{
TOS_MsgPtr tempPtr = (void *)0;
NetworkMsg *nwMsg = (NetworkMsg *)(&CascadesRouterM$RecvDataMsg)->data;
ApplicationMsg *appMsg = (ApplicationMsg *)nwMsg->data;
uint16_t seq = nwMsg->seqno;
uint8_t localIndex = 0;
if (CascadesRouterM$inData[seq % MAX_CAS_PACKETS] != TRUE) {
if (nwMsg->crc != CascadesRouterM$calculateCRC((uint8_t *)& nwMsg->seqno, appMsg->length + 6)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 649
CascadesRouterM$DataProcessBusy = FALSE;
#line 649
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (TRUE != CascadesRouterM$addIntoBuffer(&CascadesRouterM$RecvDataMsg)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 654
CascadesRouterM$DataProcessBusy = FALSE;
#line 654
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 659
localIndex = CascadesRouterM$headIndex;
#line 659
__nesc_atomic_end(__nesc_atomic); }
}
if (CascadesRouterM$delayTimerBusy == TRUE) {
if (CascadesRouterM$DelayTimer$stop()) {
CascadesRouterM$delayTimerBusy = FALSE;
}
}
if (seq > CascadesRouterM$highestSeq) {
if (CascadesRouterM$highestSeq < 10 && seq > 65530UL && CascadesRouterM$inited == TRUE) {
}
else
{
CascadesRouterM$highestSeq = seq;
}
}
else
{
if (seq < 10 && CascadesRouterM$highestSeq > 65530UL && CascadesRouterM$inited == TRUE) {
CascadesRouterM$highestSeq = seq;
}
else {
}
}
while (CascadesRouterM$inData[CascadesRouterM$expectingSeq % MAX_CAS_PACKETS]) {
++CascadesRouterM$expectingSeq;
}
if ((uint16_t )(CascadesRouterM$expectingSeq - CascadesRouterM$highestSeq) != 1) {
if (CascadesRouterM$inited != TRUE) {
CascadesRouterM$expectingSeq = seq + 1;
CascadesRouterM$nextSignalSeq = seq;
}
else
{
if (TRUE != CascadesRouterM$activeRT) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 705
CascadesRouterM$activeRT = TRUE;
#line 705
__nesc_atomic_end(__nesc_atomic); }
if (SUCCESS != CascadesRouterM$RTTimer$start(TIMER_REPEAT, CascadesRouterM$RTwait)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 707
CascadesRouterM$activeRT = FALSE;
#line 707
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
CascadesRouterM$updateInData();
if (CascadesRouterM$getCMAu(localIndex) != TRUE) {
if (TRUE != CascadesRouterM$DataTimerOn) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 719
CascadesRouterM$DataTimerOn = TRUE;
#line 719
__nesc_atomic_end(__nesc_atomic); }
if (SUCCESS != CascadesRouterM$DTTimer$start(TIMER_ONE_SHOT, MIN_INTERVAL + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 721
CascadesRouterM$DataTimerOn = FALSE;
#line 721
__nesc_atomic_end(__nesc_atomic); }
}
}
if (nwMsg->linksource == TOS_UART_ADDR && TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 725
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 725
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = TOS_UART_ADDR;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 730
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 730
__nesc_atomic_end(__nesc_atomic); }
}
}
}
else
{
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 740
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 740
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = CascadesRouterM$CascadeControl$getParent();
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 745
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 745
__nesc_atomic_end(__nesc_atomic); }
}
}
}
if (seq == CascadesRouterM$nextSignalSeq) {
if (CascadesRouterM$Receive$receive(nwMsg->type, &CascadesRouterM$RecvDataMsg, nwMsg->data,
CascadesRouterM$RecvDataMsg.length - (size_t )& ((NetworkMsg *)0)->data)) {
CascadesRouterM$nextSignalSeq++;
CascadesRouterM$myBuffer[localIndex].signalDone = 1;
if (CascadesRouterM$nextSignalSeq != CascadesRouterM$expectingSeq) {
if (CascadesRouterM$sigRcvTaskBusy != TRUE) {
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
}
}
}
else {
if (CascadesRouterM$delayTimerBusy != TRUE) {
CascadesRouterM$delayTimerBusy = CascadesRouterM$DelayTimer$start(TIMER_ONE_SHOT, 100UL);
}
}
}
else
{
if (CascadesRouterM$delayTimerBusy != TRUE) {
CascadesRouterM$delayTimerBusy = CascadesRouterM$DelayTimer$start(TIMER_ONE_SHOT, 200UL);
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 776
CascadesRouterM$resetCount = 0;
#line 776
__nesc_atomic_end(__nesc_atomic); }
CascadesRouterM$ResetTimer$stop();
CascadesRouterM$ResetTimer$start(TIMER_ONE_SHOT, 60000UL);
CascadesRouterM$inited = TRUE;
}
else
{
localIndex = CascadesRouterM$findMsgIndex(seq);
if (localIndex != INVALID_INDEX) {
CascadesRouterM$addChildACK(nwMsg->linksource, localIndex);
if (CascadesRouterM$getCMAu(localIndex) == TRUE) {
if (CascadesRouterM$myBuffer[localIndex].countDT != 0) {
CascadesRouterM$clearChildrenListStatus(localIndex);
}
if (nwMsg->linksource == TOS_UART_ADDR) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 793
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 793
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, seq, TYPE_CASCADES_ACK);
tempPtr->addr = TOS_UART_ADDR;
if (!CascadesRouterM$ACKTimer$start(TIMER_ONE_SHOT, 0xa + (CascadesRouterM$Random$rand() & 0xf))) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 798
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 798
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
}
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 805
CascadesRouterM$DataProcessBusy = FALSE;
#line 805
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 247 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline void SmartSensingM$eraseFlash(void)
#line 247
{
}
# 44 "build/imote2/RpcM.nc"
inline static void RpcM$SmartSensingM_eraseFlash(void){
#line 44
SmartSensingM$eraseFlash();
#line 44
}
#line 44
# 584 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setTaskSchedulingCode(uint8_t type, uint16_t code)
#line 584
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 585
SmartSensingM$defaultCode = code;
#line 585
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 43 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(uint8_t arg_0x409bf348, uint16_t arg_0x409bf4d8){
#line 43
unsigned char result;
#line 43
#line 43
result = SmartSensingM$SensingConfig$setTaskSchedulingCode(arg_0x409bf348, arg_0x409bf4d8);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 33 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
inline static result_t SmartSensingM$FlashManager$write(uint32_t arg_0x40ab7c08, void *arg_0x40ab7da8, uint16_t arg_0x40adc010){
#line 33
unsigned char result;
#line 33
#line 33
result = FlashManagerM$FlashManager$write(arg_0x40ab7c08, arg_0x40ab7da8, arg_0x40adc010);
#line 33
#line 33
return result;
#line 33
}
#line 33
# 346 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setSamplingRate(uint8_t type, uint16_t rate)
#line 346
{
int8_t client;
uint16_t oldrate;
uint32_t addr;
if (rate > MAX_SAMPLING_RATE) {
return FAIL;
}
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
oldrate = sensor[client].samplingRate;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 358
sensor[client].samplingRate = rate == 0 ? 0 : 1000UL / rate;
#line 358
__nesc_atomic_end(__nesc_atomic); }
if (oldrate != sensor[client].samplingRate) {
SmartSensingM$updateMaxBlkNum();
SmartSensingM$setrate();
SmartSensingM$upFlashClient();
SmartSensingM$FlashManager$write(0, (void *)&FlashCliUnit, 8 + NUM_BYTES);
}
return SUCCESS;
}
}
return FAIL;
}
# 27 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setSamplingRate(uint8_t arg_0x409a19e0, uint16_t arg_0x409a1b78){
#line 27
unsigned char result;
#line 27
#line 27
result = SmartSensingM$SensingConfig$setSamplingRate(arg_0x409a19e0, arg_0x409a1b78);
#line 27
#line 27
return result;
#line 27
}
#line 27
# 546 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setNodePriority(uint8_t priority)
#line 546
{
int8_t client;
uint32_t addr;
if (priority < 8) {
for (client = sensor_num - 1; client >= 0; client--) {
sensor[client].nodePriority = priority;
}
return SUCCESS;
}
return FAIL;
}
# 39 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setNodePriority(uint8_t arg_0x4099fad8){
#line 39
unsigned char result;
#line 39
#line 39
result = SmartSensingM$SensingConfig$setNodePriority(arg_0x4099fad8);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 475 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setEventPriority(uint8_t type, uint8_t priority)
#line 475
{
int8_t client;
if (priority < 8) {
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
eventPrio = priority;
return SUCCESS;
}
}
}
return FAIL;
}
# 47 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setEventPriority(uint8_t arg_0x409bfe20, uint8_t arg_0x409be010){
#line 47
unsigned char result;
#line 47
#line 47
result = SmartSensingM$SensingConfig$setEventPriority(arg_0x409bfe20, arg_0x409be010);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 500 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setDataPriority(uint8_t type, uint8_t priority)
#line 500
{
int8_t client;
uint32_t addr;
if (priority < 8) {
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
sensor[client].dataPriority = priority;
return SUCCESS;
}
}
}
return FAIL;
}
# 35 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setDataPriority(uint8_t arg_0x4099f010, uint8_t arg_0x4099f1a0){
#line 35
unsigned char result;
#line 35
#line 35
result = SmartSensingM$SensingConfig$setDataPriority(arg_0x4099f010, arg_0x4099f1a0);
#line 35
#line 35
return result;
#line 35
}
#line 35
# 400 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingConfig$setADCChannel(uint8_t type, uint8_t channel)
#line 400
{
int8_t client;
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
sensor[client].channel = channel;
SmartSensingM$ADCControl$bindPort(client, channel);
SmartSensingM$upFlashClient();
SmartSensingM$FlashManager$write(0, (void *)&FlashCliUnit, 128);
return SUCCESS;
}
}
if (sensor_num < MAX_SENSOR_NUM) {
sensor[sensor_num].type = type;
sensor[sensor_num].channel = channel;
SmartSensingM$ADCControl$bindPort(sensor_num, channel);
SmartSensingM$upFlashClient();
SmartSensingM$FlashManager$write(0, (void *)&FlashCliUnit, 128);
++sensor_num;
return SUCCESS;
}
else {
return FAIL;
}
}
# 31 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static result_t RpcM$SmartSensingM_SensingConfig$setADCChannel(uint8_t arg_0x409a04c8, uint8_t arg_0x409a0650){
#line 31
unsigned char result;
#line 31
#line 31
result = SmartSensingM$SensingConfig$setADCChannel(arg_0x409a04c8, arg_0x409a0650);
#line 31
#line 31
return result;
#line 31
}
#line 31
# 572 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint16_t SmartSensingM$SensingConfig$getTaskSchedulingCode(uint8_t type)
#line 572
{
return SmartSensingM$defaultCode;
}
# 45 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint16_t RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(uint8_t arg_0x409bf980){
#line 45
unsigned short result;
#line 45
#line 45
result = SmartSensingM$SensingConfig$getTaskSchedulingCode(arg_0x409bf980);
#line 45
#line 45
return result;
#line 45
}
#line 45
# 324 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint16_t SmartSensingM$SensingConfig$getSamplingRate(uint8_t type)
#line 324
{
int8_t client;
#line 326
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
if (sensor[client].samplingRate != 0) {
return 1000UL / sensor[client].samplingRate;
}
else {
return 0;
}
}
}
return 0;
}
# 29 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint16_t RpcM$SmartSensingM_SensingConfig$getSamplingRate(uint8_t arg_0x409a0030){
#line 29
unsigned short result;
#line 29
#line 29
result = SmartSensingM$SensingConfig$getSamplingRate(arg_0x409a0030);
#line 29
#line 29
return result;
#line 29
}
#line 29
# 527 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getNodePriority(void)
#line 527
{
return sensor[0].nodePriority;
}
# 41 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getNodePriority(void){
#line 41
unsigned char result;
#line 41
#line 41
result = SmartSensingM$SensingConfig$getNodePriority();
#line 41
#line 41
return result;
#line 41
}
#line 41
# 457 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getEventPriority(uint8_t type)
#line 457
{
int8_t client;
#line 459
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
return eventPrio;
}
}
return -1;
}
# 49 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getEventPriority(uint8_t arg_0x409be4b0){
#line 49
unsigned char result;
#line 49
#line 49
result = SmartSensingM$SensingConfig$getEventPriority(arg_0x409be4b0);
#line 49
#line 49
return result;
#line 49
}
#line 49
# 440 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getDataPriority(uint8_t type)
#line 440
{
int8_t client;
#line 442
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
return sensor[client].dataPriority;
}
}
return -1;
}
# 37 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getDataPriority(uint8_t arg_0x4099f638){
#line 37
unsigned char result;
#line 37
#line 37
result = SmartSensingM$SensingConfig$getDataPriority(arg_0x4099f638);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 380 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline uint8_t SmartSensingM$SensingConfig$getADCChannel(uint8_t type)
#line 380
{
int8_t client;
#line 382
for (client = sensor_num - 1; client >= 0; client--) {
if (sensor[client].type == type) {
return sensor[client].channel;
}
}
return -1;
}
# 33 "/home/xu/oasis/interfaces/SensingConfig.nc"
inline static uint8_t RpcM$SmartSensingM_SensingConfig$getADCChannel(uint8_t arg_0x409a0ae8){
#line 33
unsigned char result;
#line 33
#line 33
result = SmartSensingM$SensingConfig$getADCChannel(arg_0x409a0ae8);
#line 33
#line 33
return result;
#line 33
}
#line 33
# 42 "build/imote2/RpcM.nc"
inline static void RpcM$SNMSM_restart(void){
#line 42
SNMSM$restart();
#line 42
}
#line 42
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t SNMSM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = LedsC$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
#line 106
inline static result_t SNMSM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = LedsC$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
#line 81
inline static result_t SNMSM$Leds$redToggle(void){
#line 81
unsigned char result;
#line 81
#line 81
result = LedsC$Leds$redToggle();
#line 81
#line 81
return result;
#line 81
}
#line 81
# 169 "/home/xu/oasis/lib/SNMS/SNMSM.nc"
static inline result_t SNMSM$ledsOn(uint8_t ledColorParam)
#line 169
{
switch (ledColorParam)
{
case 0:
SNMSM$Leds$redToggle();
break;
case 1:
SNMSM$Leds$greenToggle();
break;
case 2:
SNMSM$Leds$yellowToggle();
break;
}
return SUCCESS;
}
# 41 "build/imote2/RpcM.nc"
inline static result_t RpcM$SNMSM_ledsOn(uint8_t arg_0x40d36820){
#line 41
unsigned char result;
#line 41
#line 41
result = SNMSM$ledsOn(arg_0x40d36820);
#line 41
#line 41
return result;
#line 41
}
#line 41
# 41 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static inline unsigned int RamSymbolsM$poke(ramSymbol_t *p_symbol)
#line 41
{
if (p_symbol->length <= MAX_RAM_SYMBOL_SIZE) {
if (p_symbol->dereference == TRUE) {
nmemcpy(* (void **)p_symbol->memAddress, (void *)p_symbol->data, p_symbol->length);
}
else {
nmemcpy((void *)p_symbol->memAddress, (void *)p_symbol->data, p_symbol->length);
}
}
return p_symbol->memAddress;
}
# 40 "build/imote2/RpcM.nc"
inline static unsigned int RpcM$RamSymbolsM_poke(ramSymbol_t *arg_0x40d36380){
#line 40
unsigned int result;
#line 40
#line 40
result = RamSymbolsM$poke(arg_0x40d36380);
#line 40
#line 40
return result;
#line 40
}
#line 40
# 53 "/home/xu/oasis/lib/RamSymbols/RamSymbolsM.nc"
static inline ramSymbol_t RamSymbolsM$peek(unsigned int memAddress, uint8_t length, bool dereference)
#line 53
{
RamSymbolsM$symbol.memAddress = memAddress;
RamSymbolsM$symbol.length = length;
RamSymbolsM$symbol.dereference = dereference;
if (RamSymbolsM$symbol.length <= MAX_RAM_SYMBOL_SIZE) {
if (RamSymbolsM$symbol.dereference == TRUE) {
nmemcpy((void *)RamSymbolsM$symbol.data, * (void **)RamSymbolsM$symbol.memAddress, RamSymbolsM$symbol.length);
}
else {
nmemcpy((void *)RamSymbolsM$symbol.data, (void *)RamSymbolsM$symbol.memAddress, RamSymbolsM$symbol.length);
}
}
return RamSymbolsM$symbol;
}
# 39 "build/imote2/RpcM.nc"
inline static ramSymbol_t RpcM$RamSymbolsM_peek(unsigned int arg_0x40d33b48, uint8_t arg_0x40d33cd0, bool arg_0x40d33e60){
#line 39
struct ramSymbol_t result;
#line 39
#line 39
result = RamSymbolsM$peek(arg_0x40d33b48, arg_0x40d33cd0, arg_0x40d33e60);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 580 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteRpcCtrl$setSink(bool enable)
#line 580
{
if (enable) {
if (MultiHopLQI$localBeSink) {
#line 582
return SUCCESS;
}
#line 583
MultiHopLQI$localBeSink = TRUE;
MultiHopLQI$gbCurrentParent = TOS_UART_ADDR;
MultiHopLQI$gbCurrentParentCost = 0;
MultiHopLQI$gbCurrentLinkEst = 0;
MultiHopLQI$gbLinkQuality = 110;
MultiHopLQI$gbCurrentHopCount = 0;
MultiHopLQI$gbCurrentCost = 0;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_UART_ADDR);
}
else
{
if (!MultiHopLQI$localBeSink) {
#line 597
return SUCCESS;
}
#line 598
MultiHopLQI$localBeSink = FALSE;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
MultiHopLQI$gbCurrentCost = 0xfffe;
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$NeighborCtrl$setParent(TOS_BCAST_ADDR);
}
TOS_post(MultiHopLQI$SendRouteTask);
return SUCCESS;
}
# 2 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setSink(bool arg_0x40d34010){
#line 2
unsigned char result;
#line 2
#line 2
result = MultiHopLQI$RouteRpcCtrl$setSink(arg_0x40d34010);
#line 2
#line 2
return result;
#line 2
}
#line 2
# 392 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$setParent(uint16_t parentAddr)
#line 392
{
MultiHopLQI$fixedParent = TRUE;
MultiHopLQI$gbCurrentParent = parentAddr;
MultiHopLQI$NeighborCtrl$setParent(MultiHopLQI$gbCurrentParent);
return SUCCESS;
}
#line 614
static inline result_t MultiHopLQI$RouteRpcCtrl$setParent(uint16_t parentAddr)
#line 614
{
if (parentAddr == TOS_LOCAL_ADDRESS || MultiHopLQI$localBeSink) {
return FAIL;
}
#line 617
return MultiHopLQI$RouteControl$setParent(parentAddr);
}
# 3 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setParent(uint16_t arg_0x40d344b8){
#line 3
unsigned char result;
#line 3
#line 3
result = MultiHopLQI$RouteRpcCtrl$setParent(arg_0x40d344b8);
#line 3
#line 3
return result;
#line 3
}
#line 3
# 382 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$setUpdateInterval(uint16_t Interval)
#line 382
{
MultiHopLQI$gUpdateInterval = Interval;
return SUCCESS;
}
#line 626
static inline result_t MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(uint16_t seconds)
#line 626
{
if (seconds <= 0 || seconds >= 60) {
return FAIL;
}
#line 629
return MultiHopLQI$RouteControl$setUpdateInterval(seconds);
}
# 5 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(uint16_t arg_0x40d34c68){
#line 5
unsigned char result;
#line 5
#line 5
result = MultiHopLQI$RouteRpcCtrl$setBeaconUpdateInterval(arg_0x40d34c68);
#line 5
#line 5
return result;
#line 5
}
#line 5
# 403 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline result_t MultiHopLQI$RouteControl$releaseParent(void)
#line 403
{
if (!MultiHopLQI$fixedParent) {
#line 404
return FAIL;
}
#line 405
MultiHopLQI$fixedParent = FALSE;
MultiHopLQI$gbCurrentParentCost = 0x7fff;
MultiHopLQI$gbCurrentLinkEst = 0x7fff;
MultiHopLQI$gbLinkQuality = 0;
MultiHopLQI$gbCurrentParent = TOS_BCAST_ADDR;
MultiHopLQI$gbCurrentHopCount = MultiHopLQI$ROUTE_INVALID;
return SUCCESS;
}
#line 620
static inline result_t MultiHopLQI$RouteRpcCtrl$releaseParent(void)
#line 620
{
if (MultiHopLQI$localBeSink) {
return FAIL;
}
#line 623
return MultiHopLQI$RouteControl$releaseParent();
}
# 4 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
inline static result_t RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent(void){
#line 4
unsigned char result;
#line 4
#line 4
result = MultiHopLQI$RouteRpcCtrl$releaseParent();
#line 4
#line 4
return result;
#line 4
}
#line 4
# 632 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval(void)
#line 632
{
return MultiHopLQI$gUpdateInterval;
}
# 6 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteRpcCtrl.nc"
inline static uint16_t RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval(void){
#line 6
unsigned short result;
#line 6
#line 6
result = MultiHopLQI$RouteRpcCtrl$getBeaconUpdateInterval();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 354 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$SetRFPower(uint8_t power)
#line 354
{
CC2420ControlM$gCurrentParameters[CP_TXCTRL] = (CC2420ControlM$gCurrentParameters[CP_TXCTRL] & ~(0x1F << 0)) | (power << 0);
CC2420ControlM$HPLChipcon$write(0x15, CC2420ControlM$gCurrentParameters[CP_TXCTRL]);
return SUCCESS;
}
# 178 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t GenericCommProM$CC2420Control$SetRFPower(uint8_t arg_0x4095df20){
#line 178
unsigned char result;
#line 178
#line 178
result = CC2420ControlM$CC2420Control$SetRFPower(arg_0x4095df20);
#line 178
#line 178
return result;
#line 178
}
#line 178
# 756 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$setRFPower(uint8_t level)
#line 756
{
if (level >= 1 && level <= 31) {
return GenericCommProM$CC2420Control$SetRFPower(level);
}
else {
#line 760
return FAIL;
}
}
# 37 "build/imote2/RpcM.nc"
inline static result_t RpcM$GenericCommProM_setRFPower(uint8_t arg_0x40d3de18){
#line 37
unsigned char result;
#line 37
#line 37
result = GenericCommProM$setRFPower(arg_0x40d3de18);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 33 "/home/xu/oasis/lib/SmartSensing/FlashManager.nc"
inline static result_t GenericCommProM$FlashManager$write(uint32_t arg_0x40ab7c08, void *arg_0x40ab7da8, uint16_t arg_0x40adc010){
#line 33
unsigned char result;
#line 33
#line 33
result = FlashManagerM$FlashManager$write(arg_0x40ab7c08, arg_0x40ab7da8, arg_0x40adc010);
#line 33
#line 33
return result;
#line 33
}
#line 33
# 747 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$setRFChannel(uint8_t channel)
#line 747
{
if (channel >= 11 && channel <= 26) {
GenericCommProM$FlashManager$write(0, (void *)&channel, 1);
return GenericCommProM$CC2420Control$TunePreset(channel);
}
else {
return FAIL;
}
}
# 36 "build/imote2/RpcM.nc"
inline static result_t RpcM$GenericCommProM_setRFChannel(uint8_t arg_0x40d3d970){
#line 36
unsigned char result;
#line 36
#line 36
result = GenericCommProM$setRFChannel(arg_0x40d3d970);
#line 36
#line 36
return result;
#line 36
}
#line 36
# 364 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline uint8_t CC2420ControlM$CC2420Control$GetRFPower(void)
#line 364
{
return CC2420ControlM$gCurrentParameters[CP_TXCTRL] & (0x1F << 0);
}
# 185 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static uint8_t GenericCommProM$CC2420Control$GetRFPower(void){
#line 185
unsigned char result;
#line 185
#line 185
result = CC2420ControlM$CC2420Control$GetRFPower();
#line 185
#line 185
return result;
#line 185
}
#line 185
# 767 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline uint8_t GenericCommProM$getRFPower(void)
#line 767
{
return GenericCommProM$CC2420Control$GetRFPower();
}
# 35 "build/imote2/RpcM.nc"
inline static uint8_t RpcM$GenericCommProM_getRFPower(void){
#line 35
unsigned char result;
#line 35
#line 35
result = GenericCommProM$getRFPower();
#line 35
#line 35
return result;
#line 35
}
#line 35
# 310 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline uint8_t CC2420ControlM$CC2420Control$GetPreset(void)
#line 310
{
uint16_t _freq = CC2420ControlM$gCurrentParameters[CP_FSCTRL] & (0x1FF << 0);
#line 312
_freq = (_freq - 357) / 5;
_freq = _freq + 11;
return _freq;
}
# 106 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static uint8_t GenericCommProM$CC2420Control$GetPreset(void){
#line 106
unsigned char result;
#line 106
#line 106
result = CC2420ControlM$CC2420Control$GetPreset();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 763 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline uint8_t GenericCommProM$getRFChannel(void)
#line 763
{
return GenericCommProM$CC2420Control$GetPreset();
}
# 34 "build/imote2/RpcM.nc"
inline static uint8_t RpcM$GenericCommProM_getRFChannel(void){
#line 34
unsigned char result;
#line 34
#line 34
result = GenericCommProM$getRFChannel();
#line 34
#line 34
return result;
#line 34
}
#line 34
# 161 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline result_t EventReportM$EventConfig$setReportLevel(uint8_t type, uint8_t level)
#line 161
{
int s;
#line 163
if (EVENT_TYPE_VALUE_MAX < type || EVENT_LEVEL_VALUE_MAX < level) {
return FALSE;
}
#line 165
if (type != EVENT_TYPE_ALL) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 166
EventReportM$gLevelMode[type] = level;
#line 166
__nesc_atomic_end(__nesc_atomic); }
}
else {
for (s = 0; s < 6; s++)
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 170
EventReportM$gLevelMode[s] = level;
#line 170
__nesc_atomic_end(__nesc_atomic); }
}
return SUCCESS;
}
# 38 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
inline static result_t RpcM$EventReportM_EventConfig$setReportLevel(uint8_t arg_0x40cb1e50, uint8_t arg_0x40cae010){
#line 38
unsigned char result;
#line 38
#line 38
result = EventReportM$EventConfig$setReportLevel(arg_0x40cb1e50, arg_0x40cae010);
#line 38
#line 38
return result;
#line 38
}
#line 38
# 175 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static inline uint8_t EventReportM$EventConfig$getReportLevel(uint8_t type)
#line 175
{
uint8_t level;
#line 177
if (EVENT_TYPE_VALUE_MAX < type) {
return FALSE;
}
#line 179
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 179
level = EventReportM$gLevelMode[type];
#line 179
__nesc_atomic_end(__nesc_atomic); }
return level;
}
# 47 "/home/xu/oasis/lib/SNMS/EventConfig.nc"
inline static uint8_t RpcM$EventReportM_EventConfig$getReportLevel(uint8_t arg_0x40cae5d0){
#line 47
unsigned char result;
#line 47
#line 47
result = EventReportM$EventConfig$getReportLevel(arg_0x40cae5d0);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 106 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static void *RpcM$ResponseSend$getBuffer(TOS_MsgPtr arg_0x409bcb88, uint16_t *arg_0x409bcd38){
#line 106
void *result;
#line 106
#line 106
result = MultiHopEngineM$Send$getBuffer(NW_RPCR, arg_0x409bcb88, arg_0x409bcd38);
#line 106
#line 106
return result;
#line 106
}
#line 106
# 152 "build/imote2/RpcM.nc"
static inline void RpcM$processCommand(void)
#line 152
{
ApplicationMsg *RecvMsg = (ApplicationMsg *)RpcM$cmdStore.data;
RpcCommandMsg *msg = (RpcCommandMsg *)RecvMsg->data;
uint8_t *byteSrc = msg->data;
uint16_t maxLength;
uint16_t id = msg->commandID;
NetworkMsg *NMsg = (NetworkMsg *)RpcM$sendMsgPtr->data;
ApplicationMsg *AppMsg = (ApplicationMsg *)RpcM$ResponseSend$getBuffer(RpcM$sendMsgPtr, &maxLength);
RpcResponseMsg *responseMsg = (RpcResponseMsg *)AppMsg->data;
#line 165
NMsg->qos = 7;
{
}
#line 166
;
responseMsg->transactionID = msg->transactionID;
responseMsg->commandID = msg->commandID;
responseMsg->sourceAddress = TOS_LOCAL_ADDRESS;
responseMsg->errorCode = RPC_SUCCESS;
responseMsg->dataLength = 0;
if (msg->unix_time != G_Ident.unix_time || msg->user_hash != G_Ident.user_hash) {
responseMsg->errorCode = RPC_WRONG_XML_FILE;
}
else {
#line 182
if (id < 28 && msg->dataLength != RpcM$args_sizes[id]) {
responseMsg->errorCode = RPC_GARBAGE_ARGS;
{
}
#line 184
;
}
else {
#line 185
if (id < 28 && RpcM$return_sizes[id] + sizeof(RpcResponseMsg ) > maxLength) {
responseMsg->errorCode = RPC_RESPONSE_TOO_LARGE;
{
}
#line 187
;
}
else
#line 188
{
switch (id) {
case 0: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 197
{
}
#line 197
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$EventReportM_EventConfig$getReportLevel(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 201
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 203
;
{
}
#line 204
;
}
#line 205
break;
case 1: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_level;
#line 212
{
}
#line 212
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_level, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$EventReportM_EventConfig$setReportLevel(RPC_type, RPC_level);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 218
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 220
;
{
}
#line 221
;
}
#line 222
break;
case 2: {
uint8_t RPC_returnVal;
#line 227
{
}
#line 227
;
RPC_returnVal = RpcM$GenericCommProM_getRFChannel();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 230
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 232
;
{
}
#line 233
;
}
#line 234
break;
case 3: {
uint8_t RPC_returnVal;
#line 239
{
}
#line 239
;
RPC_returnVal = RpcM$GenericCommProM_getRFPower();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 242
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 244
;
{
}
#line 245
;
}
#line 246
break;
case 4: {
result_t RPC_returnVal;
uint8_t RPC_channel;
#line 252
{
}
#line 252
;
nmemcpy(&RPC_channel, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$GenericCommProM_setRFChannel(RPC_channel);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 256
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 258
;
{
}
#line 259
;
}
#line 260
break;
case 5: {
result_t RPC_returnVal;
uint8_t RPC_level;
#line 266
{
}
#line 266
;
nmemcpy(&RPC_level, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$GenericCommProM_setRFPower(RPC_level);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 270
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 272
;
{
}
#line 273
;
}
#line 274
break;
case 6: {
uint16_t RPC_returnVal;
#line 279
{
}
#line 279
;
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$getBeaconUpdateInterval();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 282
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 284
;
{
}
#line 285
;
}
#line 286
break;
case 7: {
result_t RPC_returnVal;
#line 291
{
}
#line 291
;
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$releaseParent();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 294
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 296
;
{
}
#line 297
;
}
#line 298
break;
case 8: {
result_t RPC_returnVal;
uint16_t RPC_seconds;
#line 304
{
}
#line 304
;
nmemcpy(&RPC_seconds, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setBeaconUpdateInterval(RPC_seconds);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 308
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 310
;
{
}
#line 311
;
}
#line 312
break;
case 9: {
result_t RPC_returnVal;
uint16_t RPC_parentAddr;
#line 318
{
}
#line 318
;
nmemcpy(&RPC_parentAddr, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setParent(RPC_parentAddr);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 322
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 324
;
{
}
#line 325
;
}
#line 326
break;
case 10: {
result_t RPC_returnVal;
bool RPC_enable;
#line 332
{
}
#line 332
;
nmemcpy(&RPC_enable, byteSrc, sizeof(bool ));
RPC_returnVal = RpcM$MultiHopLQI_RouteRpcCtrl$setSink(RPC_enable);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 336
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 338
;
{
}
#line 339
;
}
#line 340
break;
case 11: {
ramSymbol_t RPC_returnVal;
unsigned int RPC_memAddress;
uint8_t RPC_length;
bool RPC_dereference;
#line 348
{
}
#line 348
;
nmemcpy(&RPC_memAddress, byteSrc, sizeof(unsigned int ));
byteSrc += sizeof(unsigned int );
nmemcpy(&RPC_length, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_dereference, byteSrc, sizeof(bool ));
RPC_returnVal = RpcM$RamSymbolsM_peek(RPC_memAddress, RPC_length, RPC_dereference);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(ramSymbol_t ));
{
}
#line 356
;
responseMsg->dataLength = sizeof(ramSymbol_t );
{
}
#line 358
;
{
}
#line 359
;
}
#line 360
break;
case 12: {
unsigned int RPC_returnVal;
ramSymbol_t RPC_symbol;
#line 366
{
}
#line 366
;
nmemcpy(&RPC_symbol, byteSrc, sizeof(ramSymbol_t ));
RPC_returnVal = RpcM$RamSymbolsM_poke(&RPC_symbol);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(unsigned int ));
{
}
#line 370
;
responseMsg->dataLength = sizeof(unsigned int );
{
}
#line 372
;
{
}
#line 373
;
}
#line 374
break;
case 13: {
result_t RPC_returnVal;
uint8_t RPC_ledColorParam;
#line 380
{
}
#line 380
;
nmemcpy(&RPC_ledColorParam, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SNMSM_ledsOn(RPC_ledColorParam);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 384
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 386
;
{
}
#line 387
;
}
#line 388
break;
case 14: {
{
}
#line 392
;
RpcM$SNMSM_restart();
{
}
#line 394
;
{
}
#line 395
;
}
#line 396
break;
case 15: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 402
{
}
#line 402
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getADCChannel(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 406
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 408
;
{
}
#line 409
;
}
#line 410
break;
case 16: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 416
{
}
#line 416
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getDataPriority(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 420
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 422
;
{
}
#line 423
;
}
#line 424
break;
case 17: {
uint8_t RPC_returnVal;
uint8_t RPC_type;
#line 430
{
}
#line 430
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getEventPriority(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 434
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 436
;
{
}
#line 437
;
}
#line 438
break;
case 18: {
uint8_t RPC_returnVal;
#line 443
{
}
#line 443
;
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getNodePriority();
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint8_t ));
{
}
#line 446
;
responseMsg->dataLength = sizeof(uint8_t );
{
}
#line 448
;
{
}
#line 449
;
}
#line 450
break;
case 19: {
uint16_t RPC_returnVal;
uint8_t RPC_type;
#line 456
{
}
#line 456
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getSamplingRate(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 460
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 462
;
{
}
#line 463
;
}
#line 464
break;
case 20: {
uint16_t RPC_returnVal;
uint8_t RPC_type;
#line 470
{
}
#line 470
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$getTaskSchedulingCode(RPC_type);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(uint16_t ));
{
}
#line 474
;
responseMsg->dataLength = sizeof(uint16_t );
{
}
#line 476
;
{
}
#line 477
;
}
#line 478
break;
case 21: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_channel;
#line 485
{
}
#line 485
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_channel, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setADCChannel(RPC_type, RPC_channel);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 491
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 493
;
{
}
#line 494
;
}
#line 495
break;
case 22: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_priority;
#line 502
{
}
#line 502
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_priority, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setDataPriority(RPC_type, RPC_priority);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 508
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 510
;
{
}
#line 511
;
}
#line 512
break;
case 23: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint8_t RPC_priority;
#line 519
{
}
#line 519
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_priority, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setEventPriority(RPC_type, RPC_priority);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 525
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 527
;
{
}
#line 528
;
}
#line 529
break;
case 24: {
result_t RPC_returnVal;
uint8_t RPC_priority;
#line 535
{
}
#line 535
;
nmemcpy(&RPC_priority, byteSrc, sizeof(uint8_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setNodePriority(RPC_priority);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 539
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 541
;
{
}
#line 542
;
}
#line 543
break;
case 25: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint16_t RPC_samplingRate;
#line 550
{
}
#line 550
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_samplingRate, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setSamplingRate(RPC_type, RPC_samplingRate);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 556
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 558
;
{
}
#line 559
;
}
#line 560
break;
case 26: {
result_t RPC_returnVal;
uint8_t RPC_type;
uint16_t RPC_code;
#line 567
{
}
#line 567
;
nmemcpy(&RPC_type, byteSrc, sizeof(uint8_t ));
byteSrc += sizeof(uint8_t );
nmemcpy(&RPC_code, byteSrc, sizeof(uint16_t ));
RPC_returnVal = RpcM$SmartSensingM_SensingConfig$setTaskSchedulingCode(RPC_type, RPC_code);
nmemcpy(&responseMsg->data[0], &RPC_returnVal, sizeof(result_t ));
{
}
#line 573
;
responseMsg->dataLength = sizeof(result_t );
{
}
#line 575
;
{
}
#line 576
;
}
#line 577
break;
case 27: {
{
}
#line 581
;
RpcM$SmartSensingM_eraseFlash();
{
}
#line 583
;
{
}
#line 584
;
}
#line 585
break;
default:
{
}
#line 588
;
responseMsg->errorCode = RPC_PROCEDURE_UNAVAIL;
}
}
}
}
#line 593
{
}
#line 593
;
{
}
#line 594
;
AppMsg->type = TYPE_SNMS_RPCRESPONSE;
AppMsg->length = responseMsg->dataLength + (size_t )& ((RpcResponseMsg *)0)->data;
AppMsg->seqno = RpcM$seqno++;
;
if (msg->responseDesired == 0) {
{
}
#line 606
;
RpcM$processingCommand = FALSE;
}
else {
RpcM$processingCommand = FALSE;
RpcM$tryNextSend();
}
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t FlashManagerM$EraseTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(12U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 142 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_SET_GREEN_LED_PIN(void)
#line 142
{
#line 142
* (volatile uint32_t *)(0x40E00018 + (104 < 96 ? ((104 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (104 & 0x1f);
}
# 110 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$greenOff(void)
#line 110
{
{
}
#line 111
;
/* atomic removed: atomic calls only */
#line 112
{
TOSH_SET_GREEN_LED_PIN();
LedsC$ledsOn &= ~LedsC$GREEN_BIT;
}
return SUCCESS;
}
# 142 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_CLR_GREEN_LED_PIN(void)
#line 142
{
#line 142
* (volatile uint32_t *)(0x40E00024 + (104 < 96 ? ((104 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (104 & 0x1f);
}
# 101 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$greenOn(void)
#line 101
{
{
}
#line 102
;
/* atomic removed: atomic calls only */
#line 103
{
TOSH_CLR_GREEN_LED_PIN();
LedsC$ledsOn |= LedsC$GREEN_BIT;
}
return SUCCESS;
}
# 143 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_SET_YELLOW_LED_PIN(void)
#line 143
{
#line 143
* (volatile uint32_t *)(0x40E00018 + (105 < 96 ? ((105 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (105 & 0x1f);
}
# 139 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$yellowOff(void)
#line 139
{
{
}
#line 140
;
/* atomic removed: atomic calls only */
#line 141
{
TOSH_SET_YELLOW_LED_PIN();
LedsC$ledsOn &= ~LedsC$YELLOW_BIT;
}
return SUCCESS;
}
# 143 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_CLR_YELLOW_LED_PIN(void)
#line 143
{
#line 143
* (volatile uint32_t *)(0x40E00024 + (105 < 96 ? ((105 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (105 & 0x1f);
}
# 130 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static inline result_t LedsC$Leds$yellowOn(void)
#line 130
{
{
}
#line 131
;
/* atomic removed: atomic calls only */
#line 132
{
TOSH_CLR_YELLOW_LED_PIN();
LedsC$ledsOn |= LedsC$YELLOW_BIT;
}
return SUCCESS;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$WatchTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(3U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 83 "/opt/tinyos-1.x/tos/interfaces/Send.nc"
inline static result_t RpcM$ResponseSend$send(TOS_MsgPtr arg_0x409bc330, uint16_t arg_0x409bc4c0){
#line 83
unsigned char result;
#line 83
#line 83
result = MultiHopEngineM$Send$send(NW_RPCR, arg_0x409bc330, arg_0x409bc4c0);
#line 83
#line 83
return result;
#line 83
}
#line 83
# 750 "build/imote2/RpcM.nc"
static inline void RpcM$sendResponse(void)
#line 750
{
uint16_t maxLength;
ApplicationMsg *AppMsg = (ApplicationMsg *)RpcM$ResponseSend$getBuffer(RpcM$sendMsgPtr, &maxLength);
RpcResponseMsg *responseMsg = (RpcResponseMsg *)AppMsg->data;
if (RpcM$ResponseSend$send(RpcM$sendMsgPtr,
responseMsg->dataLength + (size_t )& ((RpcResponseMsg *)0)->data + (size_t )& ((ApplicationMsg *)0)->data)) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 765
RpcM$taskBusy = FALSE;
#line 765
__nesc_atomic_end(__nesc_atomic); }
}
else
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 769
RpcM$taskBusy = FALSE;
#line 769
__nesc_atomic_end(__nesc_atomic); }
;
RpcM$tryNextSend();
}
}
# 393 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline result_t GenericCommProM$RadioSend$sendDone(TOS_MsgPtr msg, result_t status)
#line 393
{
GenericCommProM$radioSendActive = TRUE;
return GenericCommProM$reportSendDone(msg, status);
}
# 67 "/opt/tinyos-1.x/tos/interfaces/BareSendMsg.nc"
inline static result_t CC2420RadioM$Send$sendDone(TOS_MsgPtr arg_0x4061e348, result_t arg_0x4061e4d8){
#line 67
unsigned char result;
#line 67
#line 67
result = GenericCommProM$RadioSend$sendDone(arg_0x4061e348, arg_0x4061e4d8);
#line 67
#line 67
return result;
#line 67
}
#line 67
# 677 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$HPLCC2420FifoWriteTxFifoReleaseError(void)
#line 677
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.writeTXFIFO failed while attempting to release the SSP port\r\n");
}
# 187 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline void TOSH_CLR_CC_CSN_PIN(void)
#line 187
{
#line 187
* (volatile uint32_t *)(0x40E00024 + (39 < 96 ? ((39 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (39 & 0x1f);
}
# 674 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$HPLCC2420FifoWriteTxFifoContentioError(void)
#line 674
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.writeTXFIFO has attempted to access the radio during an existing radio operation\r\n");
}
#line 689
static inline result_t HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(uint8_t length, uint8_t *data)
#line 689
{
uint8_t OkToUse;
#line 691
if (HPLCC2420M$getSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420FifoWriteTxFifoContentioError);
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 702
{
HPLCC2420M$txbuf = data;
HPLCC2420M$txlen = length;
OkToUse = HPLCC2420M$gbDMAChannelInitDone;
}
#line 706
__nesc_atomic_end(__nesc_atomic); }
#line 732
{
int i;
uint8_t tmp;
{
#line 737
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 737
;
{
#line 739
TOSH_CLR_CC_CSN_PIN();
#line 739
TOSH_uwait(1);
}
#line 739
;
* (volatile uint32_t *)0x41900010 = 0x3E;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
while (length > 16) {
for (i = 0; i < 16; i++) {
* (volatile uint32_t *)0x41900010 = * data++;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
length -= 16;
}
for (i = 0; i < length; i++) {
* (volatile uint32_t *)0x41900010 = * data++;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
for (i = 0; i < 16; i++) {
tmp = * (volatile uint32_t *)0x41900010;
}
TOS_post(HPLCC2420M$signalTXFIFO);
{
#line 761
TOSH_uwait(1);
#line 761
TOSH_SET_CC_CSN_PIN();
}
#line 761
;
{
#line 762
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 762
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420FifoWriteTxFifoReleaseError);
return 0;
}
return SUCCESS;
}
}
# 29 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t CC2420RadioM$HPLChipconFIFO$writeTXFIFO(uint8_t arg_0x40f1dd70, uint8_t *arg_0x40f1df18){
#line 29
unsigned char result;
#line 29
#line 29
result = HPLCC2420M$HPLCC2420FIFO$writeTXFIFO(arg_0x40f1dd70, arg_0x40f1df18);
#line 29
#line 29
return result;
#line 29
}
#line 29
# 721 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$HPLChipconFIFO$TXFIFODone(uint8_t length, uint8_t *data)
#line 721
{
CC2420RadioM$tryToSend();
return SUCCESS;
}
# 50 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t HPLCC2420M$HPLCC2420FIFO$TXFIFODone(uint8_t arg_0x40f1cc58, uint8_t *arg_0x40f1ce00){
#line 50
unsigned char result;
#line 50
#line 50
result = CC2420RadioM$HPLChipconFIFO$TXFIFODone(arg_0x40f1cc58, arg_0x40f1ce00);
#line 50
#line 50
return result;
#line 50
}
#line 50
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint16_t CC2420RadioM$HPLChipcon$read(uint8_t arg_0x40956010){
#line 61
unsigned short result;
#line 61
#line 61
result = HPLCC2420M$HPLCC2420$read(arg_0x40956010);
#line 61
#line 61
return result;
#line 61
}
#line 61
# 282 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$HPLCC2420ReadContentionError(void)
#line 282
{
trace(DBG_USR1, "ERROR: HPLCC2420.read has attempted to access the radio during an existing radio operation\r\n");
}
static inline void HPLCC2420M$HPLCC2420ReadReleaseError(void)
#line 286
{
trace(DBG_USR1, "ERROR: HPLCC2420.read failed while attempting to release the SSP port\r\n");
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$FIFOP_GPIOInt$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(0, arg_0x406321d8);
#line 45
}
#line 45
# 184 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline char TOSH_READ_RADIO_CCA_PIN(void)
#line 184
{
#line 184
return (* (volatile uint32_t *)(0x40E00000 + (116 < 96 ? ((116 & 0x7f) >> 5) * 4 : 0x100)) & (1 << (116 & 0x1f))) != 0;
}
# 751 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline int16_t CC2420RadioM$MacBackoff$default$congestionBackoff(TOS_MsgPtr m)
#line 751
{
return (CC2420RadioM$Random$rand() & 0x3F) + 1;
}
# 75 "/opt/tinyos-1.x/tos/lib/CC2420Radio/MacBackoff.nc"
inline static int16_t CC2420RadioM$MacBackoff$congestionBackoff(TOS_MsgPtr arg_0x40f2adb0){
#line 75
short result;
#line 75
#line 75
result = CC2420RadioM$MacBackoff$default$congestionBackoff(arg_0x40f2adb0);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 136 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setBackoffTimer(uint16_t jiffy)
#line 136
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_BACKOFF;
if (jiffy == 0) {
return CC2420RadioM$BackoffTimerJiffy$setOneShot(2);
}
#line 141
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
inline static result_t CC2420RadioM$SFD$enableCapture(bool arg_0x40f1fd70){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420M$CaptureSFD$enableCapture(arg_0x40f1fd70);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint8_t CC2420RadioM$HPLChipcon$cmd(uint8_t arg_0x40957408){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420$cmd(arg_0x40957408);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 321 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$sendPacket(void)
#line 321
{
uint8_t status;
CC2420RadioM$HPLChipcon$cmd(0x05);
status = CC2420RadioM$HPLChipcon$cmd(0x00);
if ((status >> 3) & 0x01) {
CC2420RadioM$SFD$enableCapture(TRUE);
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 332
CC2420RadioM$stateRadio = CC2420RadioM$PRE_TX_STATE;
#line 332
__nesc_atomic_end(__nesc_atomic); }
if (!CC2420RadioM$setBackoffTimer(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10)) {
CC2420RadioM$sendFailed();
}
}
}
# 45 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$SFD_GPIOInt$enable(uint8_t arg_0x406321d8){
#line 45
PXA27XGPIOIntM$PXA27XGPIOInt$enable(16, arg_0x406321d8);
#line 45
}
#line 45
# 180 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline uint32_t GPSSensorM$GPSGlobalTime$getLocalTime(void)
#line 180
{
uint32_t localtime;
#line 182
localtime = GPSSensorM$LocalTime$read();
return localtime;
}
# 441 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline uint8_t RealTimeM$dequeue(void)
#line 441
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 442
{
if (RealTimeM$queue_size == 0) {
{
unsigned char __nesc_temp =
#line 444
30;
{
#line 444
__nesc_atomic_end(__nesc_atomic);
#line 444
return __nesc_temp;
}
}
}
else
#line 446
{
if (RealTimeM$queue_head == 30 - 1) {
RealTimeM$queue_head = -1;
}
RealTimeM$queue_head++;
RealTimeM$queue_size--;
{
unsigned char __nesc_temp =
#line 452
RealTimeM$queue[(uint8_t )RealTimeM$queue_head];
{
#line 452
__nesc_atomic_end(__nesc_atomic);
#line 452
return __nesc_temp;
}
}
}
}
#line 456
__nesc_atomic_end(__nesc_atomic); }
}
# 52 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
inline static result_t SmartSensingM$ADC$getData(uint8_t arg_0x40aa9310){
#line 52
unsigned char result;
#line 52
#line 52
result = ADCM$ADC$getData(arg_0x40aa9310);
#line 52
#line 52
return result;
#line 52
}
#line 52
# 935 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline bool SmartSensingM$needSample(uint8_t client)
#line 935
{
SenBlkPtr p = (void *)0;
#line 937
if (0 != sensor[client].samplingRate) {
sensor[client].timerCount += SmartSensingM$timerInterval;
if (sensor[client].timerCount >= sensor[client].samplingRate) {
sensor[client].timerCount = 0;
}
else {
return FALSE;
}
}
else {
return FALSE;
}
if ((void *)0 != (p = sensor[client].curBlkPtr)) {
if (0 == p->time) {
p->time = SmartSensingM$RealTime$getTimeCount();
p->interval = sensor[client].samplingRate;
p->type = sensor[client].type;
}
return TRUE;
}
else {
if ((void *)0 != (sensor[client].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(client))) {
p = sensor[client].curBlkPtr;
p->time = SmartSensingM$RealTime$getTimeCount();
p->interval = sensor[client].samplingRate;
p->type = sensor[client].type;
return TRUE;
}
else {
;
return FALSE;
}
}
}
static inline void SmartSensingM$trySample(void)
#line 983
{
uint8_t client;
#line 985
for (client = 0; client < sensor_num; client++) {
if (FALSE != SmartSensingM$needSample(client)) {
if (sensor[client].type == TYPE_DATA_LQI) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 988
SmartSensingM$saveData(client, 0);
#line 988
__nesc_atomic_end(__nesc_atomic); }
}
else
#line 989
{
SmartSensingM$ADC$getData((uint8_t )client);
}
}
}
return;
}
# 59 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t SmartSensingM$WatchTimer$start(char arg_0x40818878, uint32_t arg_0x40818a10){
#line 59
unsigned char result;
#line 59
#line 59
result = TimerM$Timer$start(3U, arg_0x40818878, arg_0x40818a10);
#line 59
#line 59
return result;
#line 59
}
#line 59
# 643 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$SensingTimer$fired(void)
#line 643
{
SmartSensingM$global++;
if (TRUE != SmartSensingM$initedClock) {
SmartSensingM$initedClock = TRUE;
SmartSensingM$SensingTimer$start(TIMER_REPEAT, SmartSensingM$timerInterval);
SmartSensingM$WatchTimer$start(TIMER_REPEAT, 1024);
}
else {
if (SmartSensingM$global % 200 == 0) {
;
}
SmartSensingM$realTimeFired = TRUE;
SmartSensingM$trySample();
}
return SUCCESS;
}
# 653 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static inline result_t RealTimeM$Timer$default$fired(uint8_t id)
#line 653
{
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t RealTimeM$Timer$fired(uint8_t arg_0x40b740d0){
#line 73
unsigned char result;
#line 73
#line 73
switch (arg_0x40b740d0) {
#line 73
case 0U:
#line 73
result = SmartSensingM$SensingTimer$fired();
#line 73
break;
#line 73
default:
#line 73
result = RealTimeM$Timer$default$fired(arg_0x40b740d0);
#line 73
break;
#line 73
}
#line 73
#line 73
return result;
#line 73
}
#line 73
# 444 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static inline uint8_t NeighborMgmtM$writeNbrLinkInfo(uint8_t *start, uint8_t maxlen)
#line 444
{
uint8_t i = 0;
uint8_t *wpos = start;
uint8_t count = 0;
#line 448
for (i = 0; i < 16; i++) {
if (NeighborMgmtM$NeighborTbl[i].flags & NBRFLAG_VALID && NeighborMgmtM$NeighborTbl[i].lastHeard == TRUE) {
*wpos = (uint8_t )NeighborMgmtM$NeighborTbl[i].id;
wpos++;
*wpos = NeighborMgmtM$NeighborTbl[i].lqiRaw;
wpos++;
*wpos = NeighborMgmtM$NeighborTbl[i].rssiRaw;
wpos++;
count += 1;
NeighborMgmtM$NeighborTbl[i].lastHeard = 0;
if (count * 3 >= maxlen) {
break;
}
}
}
#line 462
return count * 3;
}
# 90 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
inline static uint8_t SmartSensingM$writeNbrLinkInfo(uint8_t *arg_0x40adacb0, uint8_t arg_0x40adae38){
#line 90
unsigned char result;
#line 90
#line 90
result = NeighborMgmtM$writeNbrLinkInfo(arg_0x40adacb0, arg_0x40adae38);
#line 90
#line 90
return result;
#line 90
}
#line 90
# 364 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static inline uint16_t MultiHopLQI$RouteControl$getQuality(void)
#line 364
{
return MultiHopLQI$gbLinkQuality;
}
# 84 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
inline static uint16_t MultiHopEngineM$RouteSelectCntl$getQuality(void){
#line 84
unsigned short result;
#line 84
#line 84
result = MultiHopLQI$RouteControl$getQuality();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 586 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static inline uint16_t MultiHopEngineM$RouteControl$getQuality(void)
#line 586
{
return MultiHopEngineM$RouteSelectCntl$getQuality();
}
# 84 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/RouteControl.nc"
inline static uint16_t SmartSensingM$RouteControl$getQuality(void){
#line 84
unsigned short result;
#line 84
#line 84
result = MultiHopEngineM$RouteControl$getQuality();
#line 84
#line 84
return result;
#line 84
}
#line 84
# 131 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t SmartSensingM$Leds$yellowToggle(void){
#line 131
unsigned char result;
#line 131
#line 131
result = LedsC$Leds$yellowToggle();
#line 131
#line 131
return result;
#line 131
}
#line 131
# 37 "/home/xu/oasis/lib/SNMS/EventReport.nc"
inline static uint8_t SmartSensingM$EventReport$eventSend(uint8_t arg_0x409b7ab0, uint8_t arg_0x409b7c48, uint8_t *arg_0x409b7e00){
#line 37
unsigned char result;
#line 37
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_SENSING, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
result = EventReportM$EventReport$eventSend(EVENT_TYPE_DATAMANAGE, arg_0x409b7ab0, arg_0x409b7c48, arg_0x409b7e00);
#line 37
#line 37
return result;
#line 37
}
#line 37
# 652 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline result_t PMICM$PMIC$getBatteryVoltage(uint8_t *val)
#line 652
{
return PMICM$getPMICADCVal(0, val);
}
# 54 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
inline static result_t ADCM$PMIC$getBatteryVoltage(uint8_t *arg_0x404bdee0){
#line 54
unsigned char result;
#line 54
#line 54
result = PMICM$PMIC$getBatteryVoltage(arg_0x404bdee0);
#line 54
#line 54
return result;
#line 54
}
#line 54
# 190 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline uint16_t ADCM$readADC(uint8_t actrualPort)
#line 190
{
static uint16_t data = 0;
uint8_t addr;
uint8_t tmp;
uint16_t t = 0;
uint16_t i = 0;
if (actrualPort != TOSH_ACTUAL_RVOL_PORT) {
addr = (actrualPort << 4) | 0x86;
{
#line 205
while (* (volatile uint32_t *)0x41000008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41000010;
}
#line 205
;
{
#line 207
* (volatile uint32_t *)(0x40E00024 + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (24 & 0x1f);
#line 207
TOSH_uwait(1);
}
#line 207
;
* (volatile uint32_t *)0x41000010 = addr;
while (* (volatile uint32_t *)0x41000008 & (1 << 4)) ;
* (volatile uint32_t *)0x41000010 = 0xffff;
{
#line 211
TOSH_uwait(1);
#line 211
* (volatile uint32_t *)(0x40E00018 + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (24 & 0x1f);
}
#line 211
;
{
#line 218
* (volatile uint32_t *)(0x40E00024 + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (24 & 0x1f);
#line 218
TOSH_uwait(1);
}
#line 218
;
data = * (volatile uint32_t *)0x41000010;
{
#line 220
TOSH_uwait(1);
#line 220
* (volatile uint32_t *)(0x40E00018 + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) = 1 << (24 & 0x1f);
}
#line 220
;
{
#line 222
while (* (volatile uint32_t *)0x41000008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41000010;
}
#line 222
;
}
else {
ADCM$PMIC$getBatteryVoltage(&tmp);
data = tmp;
}
return data;
}
#line 143
static inline uint8_t ADCM$dequeue(void)
#line 143
{
if (ADCM$queue_size == 0) {
return 40;
}
else {
if (ADCM$queue_head == 40 - 1) {
ADCM$queue_head = -1;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 151
{
ADCM$queue_head++;
ADCM$queue_size--;
}
#line 154
__nesc_atomic_end(__nesc_atomic); }
return ADCM$queue[(uint8_t )ADCM$queue_head];
}
}
# 731 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static inline result_t SmartSensingM$oversample(uint16_t *data, uint8_t client)
#line 731
{
static uint8_t count[MAX_SENSOR_NUM];
static uint32_t value[MAX_SENSOR_NUM];
#line 734
if (sensor[client].type == TYPE_DATA_SEISMIC || sensor[client].type == TYPE_DATA_INFRASONIC) {
++count[client];
value[client] += *data;
if (count[client] >= 4) {
value[client] = value[client] >> 2;
*data = value[client];
count[client] = 0;
value[client] = 0;
return SUCCESS;
}
else {
SmartSensingM$ADC$getData((uint8_t )client);
return FAIL;
}
}
else {
return SUCCESS;
}
}
#line 674
static inline result_t SmartSensingM$ADC$dataReady(uint8_t client, uint16_t data)
#line 674
{
if (SmartSensingM$oversample(&data, client) != SUCCESS) {
return SUCCESS;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 680
SmartSensingM$saveData(client, data);
#line 680
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 70 "/opt/tinyos-1.x/tos/interfaces/ADC.nc"
inline static result_t ADCM$ADC$dataReady(uint8_t arg_0x411da910, uint16_t arg_0x40aa6cc0){
#line 70
unsigned char result;
#line 70
#line 70
result = SmartSensingM$ADC$dataReady(arg_0x411da910, arg_0x40aa6cc0);
#line 70
#line 70
return result;
#line 70
}
#line 70
# 132 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static inline void ADCM$enqueue(uint8_t value)
#line 132
{
if (ADCM$queue_tail == 40 - 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 134
ADCM$queue_tail = -1;
#line 134
__nesc_atomic_end(__nesc_atomic); }
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 136
{
ADCM$queue_tail++;
ADCM$queue_size++;
ADCM$queue[(uint8_t )ADCM$queue_tail] = value;
}
#line 140
__nesc_atomic_end(__nesc_atomic); }
}
# 472 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static inline result_t DataMgmtM$insertAndStartSend(TOS_MsgPtr msg)
#line 472
{
result_t result = FALSE;
#line 474
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 474
{
result = insertElement(&DataMgmtM$sendQueue, msg);
DataMgmtM$tryNextSend();
}
#line 477
__nesc_atomic_end(__nesc_atomic); }
return result;
}
# 68 "/opt/tinyos-1.x/tos/interfaces/Timer.nc"
inline static result_t FlashManagerM$WritingTimer$stop(void){
#line 68
unsigned char result;
#line 68
#line 68
result = TimerM$Timer$stop(13U);
#line 68
#line 68
return result;
#line 68
}
#line 68
# 6 "/home/xu/oasis/interfaces/GPSGlobalTime.nc"
inline static uint32_t TimeSyncM$GPSGlobalTime$getGlobalTime(void){
#line 6
unsigned int result;
#line 6
#line 6
result = GPSSensorM$GPSGlobalTime$getGlobalTime();
#line 6
#line 6
return result;
#line 6
}
#line 6
# 48 "/opt/tinyos-1.x/tos/interfaces/SendMsg.nc"
inline static result_t TimeSyncM$SendMsg$send(uint16_t arg_0x40d93e70, uint8_t arg_0x40d90010, TOS_MsgPtr arg_0x40d901a0){
#line 48
unsigned char result;
#line 48
#line 48
result = GenericCommProM$SendMsg$send(AM_TIMESYNCMSG, arg_0x40d93e70, arg_0x40d90010, arg_0x40d901a0);
#line 48
#line 48
return result;
#line 48
}
#line 48
# 399 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static inline result_t FlashM$Flash$read(uint32_t addr, uint8_t *data, uint32_t numBytes)
{
uint32_t curPtr = 0;
uint32_t address = addr;
uint32_t tmpdata = 0;
while (curPtr < numBytes)
{
if (address % 2)
{
address = address - 1;
tmpdata = * (uint32_t *)address;
tmpdata = (tmpdata >> 8) & 0xFFFF;
nmemcpy(data + curPtr, &tmpdata, 1);
curPtr = curPtr + 1;
}
else
{
tmpdata = * (uint32_t *)address;
nmemcpy(data + curPtr, &tmpdata, numBytes - curPtr >= 2 ? 2 : 1);
curPtr = curPtr + 2;
}
address += 2;
}
return SUCCESS;
}
# 52 "/home/xu/oasis/lib/SmartSensing/Flash.nc"
inline static result_t FlashManagerM$Flash$read(uint32_t arg_0x40ad0120, uint8_t *arg_0x40ad02c8, uint32_t arg_0x40ad0460){
#line 52
unsigned char result;
#line 52
#line 52
result = FlashM$Flash$read(arg_0x40ad0120, arg_0x40ad02c8, arg_0x40ad0460);
#line 52
#line 52
return result;
#line 52
}
#line 52
# 125 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline bool PMICM$isChargerEnabled(void)
#line 125
{
uint8_t chargerState;
PMICM$readPMIC(0x28, &chargerState, 1);
return chargerState > 0 ? TRUE : FALSE;
}
# 1024 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$sendDeviceDescriptor(uint16_t wLength)
#line 1024
{
PXA27XUSBClientM$USBdata InStream;
uint8_t InTaskTemp;
PXA27XUSBClientM$DynQueue QueueTemp;
if (wLength == 0) {
return;
}
#line 1034
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1034
{
InStream = (PXA27XUSBClientM$USBdata )safe_malloc(sizeof(PXA27XUSBClientM$USBdata_t ));
InStream->endpointDR = (volatile unsigned long *const )0x40600300;
InStream->fifosize = 16;
InStream->src = (uint8_t *)safe_malloc(0x12);
InStream->len = wLength < 0x12 ? wLength : 0x12;
InStream->index = 0;
InStream->param = 0;
* (uint32_t *)InStream->src = (0x12 | (0x01 << 8)) | (PXA27XUSBClientM$Device.bcdUSB << 16);
* (uint32_t *)(InStream->src + 4) = ((PXA27XUSBClientM$Device.bDeviceClass | (PXA27XUSBClientM$Device.bDeviceSubclass << 8)) | (PXA27XUSBClientM$Device.bDeviceProtocol << 16)) | (PXA27XUSBClientM$Device.bMaxPacketSize0 << 24);
* (uint32_t *)(InStream->src + 8) = PXA27XUSBClientM$Device.idVendor | (PXA27XUSBClientM$Device.idProduct << 16);
* (uint32_t *)(InStream->src + 12) = (PXA27XUSBClientM$Device.bcdDevice | (PXA27XUSBClientM$Device.iManufacturer << 16)) | (PXA27XUSBClientM$Device.iProduct << 24);
*(InStream->src + 16) = PXA27XUSBClientM$Device.iSerialNumber;
*(InStream->src + 17) = PXA27XUSBClientM$Device.bNumConfigurations;
InTaskTemp = PXA27XUSBClientM$InTask;
QueueTemp = PXA27XUSBClientM$InQueue;
PXA27XUSBClientM$DynQueue_enqueue(QueueTemp, InStream);
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) == 1 && InTaskTemp == 0) {
PXA27XUSBClientM$InTask = 1;
PXA27XUSBClientM$sendControlIn();
}
}
#line 1060
__nesc_atomic_end(__nesc_atomic); }
}
static inline void PXA27XUSBClientM$sendConfigDescriptor(uint8_t id, uint16_t wLength)
#line 1063
{
PXA27XUSBClientM$USBconfiguration Config;
PXA27XUSBClientM$USBinterface Inter;
PXA27XUSBClientM$USBendpoint EndpointIn;
#line 1066
PXA27XUSBClientM$USBendpoint EndpointOut;
PXA27XUSBClientM$USBdata InStream;
uint8_t InTaskTemp;
PXA27XUSBClientM$DynQueue QueueTemp;
if (wLength == 0) {
return;
}
#line 1077
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1077
{
Config = PXA27XUSBClientM$Device.oConfigurations[1];
Inter = Config->oInterfaces[0];
EndpointIn = Inter->oEndpoints[0];
EndpointOut = Inter->oEndpoints[1];
InStream = (PXA27XUSBClientM$USBdata )safe_malloc(sizeof(PXA27XUSBClientM$USBdata_t ));
InStream->endpointDR = (volatile unsigned long *const )0x40600300;
InStream->fifosize = 16;
InStream->src = (uint8_t *)safe_malloc(Config->wTotalLength);
InStream->len = wLength < Config->wTotalLength ? wLength : Config->wTotalLength;
InStream->index = 0;
InStream->param = 0;
* (uint32_t *)InStream->src = (0x09 | (0x02 << 8)) | (Config->wTotalLength << 16);
* (uint32_t *)(InStream->src + 4) = ((Config->bNumInterfaces | (Config->bConfigurationID << 8)) | (Config->iConfiguration << 16)) | (Config->bmAttributes << 24);
* (uint32_t *)(InStream->src + 8) = ((Config->MaxPower | (0x09 << 8)) | (0x04 << 16)) | (Inter->bInterfaceID << 24);
* (uint32_t *)(InStream->src + 12) = ((Inter->bAlternateSetting | (Inter->bNumEndpoints << 8)) | (Inter->bInterfaceClass << 16)) | (Inter->bInterfaceSubclass << 24);
* (uint32_t *)(InStream->src + 16) = ((Inter->bInterfaceProtocol | (Inter->iInterface << 8)) | (0x09 << 16)) | (0x21 << 24);
* (uint32_t *)(InStream->src + 20) = (PXA27XUSBClientM$Hid.bcdHID | (PXA27XUSBClientM$Hid.bCountryCode << 16)) | (PXA27XUSBClientM$Hid.bNumDescriptors << 24);
* (uint32_t *)(InStream->src + 24) = (0x22 | (PXA27XUSBClientM$Hid.wDescriptorLength << 8)) | (0x07 << 24);
* (uint32_t *)(InStream->src + 28) = ((0x05 | (EndpointIn->bEndpointAddress << 8)) | (EndpointIn->bmAttributes << 16)) | (EndpointIn->wMaxPacketSize << 24);
* (uint32_t *)(InStream->src + 32) = ((((EndpointIn->wMaxPacketSize >> 8) & 0xFF) | (EndpointIn->bInterval << 8)) | (0x07 << 16)) | (0x05 << 24);
* (uint32_t *)(InStream->src + 36) = (EndpointOut->bEndpointAddress | (EndpointOut->bmAttributes << 8)) | (EndpointOut->wMaxPacketSize << 16);
* (uint8_t *)(InStream->src + 40) = EndpointOut->bInterval;
InTaskTemp = PXA27XUSBClientM$InTask;
QueueTemp = PXA27XUSBClientM$InQueue;
PXA27XUSBClientM$DynQueue_enqueue(QueueTemp, InStream);
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) == 1 && InTaskTemp == 0) {
PXA27XUSBClientM$InTask = 1;
PXA27XUSBClientM$sendControlIn();
}
}
#line 1116
__nesc_atomic_end(__nesc_atomic); }
}
static inline void PXA27XUSBClientM$sendStringDescriptor(uint8_t id, uint16_t wLength)
#line 1119
{
PXA27XUSBClientM$USBstring str;
uint8_t count = 0;
#line 1121
uint8_t InTaskTemp;
uint8_t *src = (void *)0;
PXA27XUSBClientM$USBdata InStream = (void *)0;
PXA27XUSBClientM$DynQueue QueueTemp;
str = PXA27XUSBClientM$Strings[id];
if (wLength == 0) {
return;
}
#line 1133
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1133
{
InStream = (PXA27XUSBClientM$USBdata )safe_malloc(sizeof(PXA27XUSBClientM$USBdata_t ));
InStream->endpointDR = (volatile unsigned long *const )0x40600300;
InStream->fifosize = 16;
InStream->src = (uint8_t *)safe_malloc(str->bLength);
InStream->param = 0;
InStream->len = wLength < str->bLength ? wLength : str->bLength;
InStream->index = 0;
if (id == 0) {
* (uint32_t *)InStream->src = (str->bLength | (0x03 << 8)) | (str->uMisc.wLANGID << 16);
}
else
#line 1151
{
src = str->uMisc.bString;
* (uint32_t *)InStream->src = (str->bLength | (0x03 << 8)) | (*src << 16);
src++;
for (count = 1; *src != '\0'; count++, src++) {
if (*(src + 1) == '\0') {
*(InStream->src + count * 4) = (uint8_t )*src;
*(InStream->src + count * 4 + 1) = (uint8_t )0;
}
else {
* (uint32_t *)(InStream->src + count * 4) = *src | (*(src + 1) << 16);
src++;
}
}
}
InTaskTemp = PXA27XUSBClientM$InTask;
QueueTemp = PXA27XUSBClientM$InQueue;
PXA27XUSBClientM$DynQueue_enqueue(QueueTemp, InStream);
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) == 1 && InTaskTemp == 0) {
PXA27XUSBClientM$InTask = 1;
PXA27XUSBClientM$sendControlIn();
}
}
#line 1178
__nesc_atomic_end(__nesc_atomic); }
}
static inline void PXA27XUSBClientM$sendHidReportDescriptor(uint16_t wLength)
#line 1181
{
PXA27XUSBClientM$USBdata InStream;
uint8_t InTaskTemp;
PXA27XUSBClientM$DynQueue QueueTemp;
if (wLength == 0) {
return;
}
#line 1193
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1193
{
InStream = (PXA27XUSBClientM$USBdata )safe_malloc(sizeof(PXA27XUSBClientM$USBdata_t ));
InStream->endpointDR = (volatile unsigned long *const )0x40600300;
InStream->fifosize = 16;
InStream->src = (uint8_t *)safe_malloc(PXA27XUSBClientM$HidReport.wLength);
InStream->len = wLength < PXA27XUSBClientM$HidReport.wLength ? wLength : PXA27XUSBClientM$HidReport.wLength;
InStream->index = 0;
InStream->param = 0;
nmemcpy(InStream->src, PXA27XUSBClientM$HidReport.bString, PXA27XUSBClientM$HidReport.wLength);
InTaskTemp = PXA27XUSBClientM$InTask;
QueueTemp = PXA27XUSBClientM$InQueue;
PXA27XUSBClientM$DynQueue_enqueue(QueueTemp, InStream);
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) == 1 && InTaskTemp == 0) {
PXA27XUSBClientM$InTask = 1;
PXA27XUSBClientM$sendControlIn();
}
PXA27XUSBClientM$state = 3;
}
#line 1214
__nesc_atomic_end(__nesc_atomic); }
}
# 114 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
inline static void BluSHM$DynQueue_shiftshrink(BluSHM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return;
}
if (oDynQueue->index > 0) {
memmove((void *)oDynQueue->ppvQueue, (void *)(oDynQueue->ppvQueue + oDynQueue->index), sizeof(void *) * oDynQueue->iLength);
oDynQueue->index = 0;
}
oDynQueue->iPhysLength /= 2;
oDynQueue->ppvQueue = (const void **)safe_realloc(oDynQueue->ppvQueue,
sizeof(void *) * oDynQueue->iPhysLength);
}
# 428 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline TOS_MsgPtr PXA27XUSBClientM$ReceiveMsg$default$receive(TOS_MsgPtr m)
#line 428
{
return (void *)0;
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr PXA27XUSBClientM$ReceiveMsg$receive(TOS_MsgPtr arg_0x40620878){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = PXA27XUSBClientM$ReceiveMsg$default$receive(arg_0x40620878);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 424 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline result_t PXA27XUSBClientM$ReceiveBData$default$receive(uint8_t *buffer, uint8_t numBytesRead, uint32_t i, uint32_t n, uint8_t type)
#line 424
{
return SUCCESS;
}
# 10 "/opt/tinyos-1.x/tos/platform/pxa27x/ReceiveBData.nc"
inline static result_t PXA27XUSBClientM$ReceiveBData$receive(uint8_t *arg_0x40621118, uint8_t arg_0x406212a8, uint32_t arg_0x40621448, uint32_t arg_0x406215d8, uint8_t arg_0x40621760){
#line 10
unsigned char result;
#line 10
#line 10
result = PXA27XUSBClientM$ReceiveBData$default$receive(arg_0x40621118, arg_0x406212a8, arg_0x40621448, arg_0x406215d8, arg_0x40621760);
#line 10
#line 10
return result;
#line 10
}
#line 10
# 456 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$USBReceive$receive(uint8_t *buff, uint32_t numBytesRead)
#line 456
{
BluSHM$queueInput(buff, numBytesRead);
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
inline static result_t PXA27XUSBClientM$ReceiveData$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0){
#line 73
unsigned char result;
#line 73
#line 73
result = BluSHM$USBReceive$receive(arg_0x404d6b18, arg_0x404d6cb0);
#line 73
#line 73
return result;
#line 73
}
#line 73
# 7 "/opt/tinyos-1.x/tos/platform/imote2/cmdlinetools.c"
static inline void BluSHM$killWhiteSpace(char *str)
{
uint16_t i;
#line 9
uint16_t j;
uint16_t startIdx;
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] != ' ')
{
break;
}
}
if (str[i] == '\0')
{
str[0] = '\0';
return;
}
startIdx = 0;
while (1)
{
j = startIdx;
while (str[i] != '\0')
{
str[j] = str[i];
i++;
j++;
}
str[j] = '\0';
for (; str[startIdx] != ' ' && str[startIdx] != '\0'; startIdx++)
{
}
for (j = startIdx; str[j] != '\0'; j++)
{
if (str[j] != ' ')
{
break;
}
}
if (str[j] == '\0')
{
str[startIdx] = '\0';
return;
}
str[startIdx] = ' ';
startIdx++;
i = j;
}
}
static inline uint16_t BluSHM$firstSpace(char *str, uint16_t start)
{
uint16_t i;
#line 83
for (i = start; str[i] != '\0'; i++)
{
if (str[i] == ' ')
{
return i;
}
}
return start;
}
# 127 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline BluSH_result_t SettingsM$NodeID$getName(char *buff, uint8_t len)
#line 127
{
const char name[7] = "NodeID";
#line 129
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 222
static inline BluSH_result_t SettingsM$ResetNode$getName(char *buff, uint8_t len)
#line 222
{
const char name[10] = "ResetNode";
#line 224
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 139
static inline BluSH_result_t SettingsM$TestTaskQueue$getName(char *buff, uint8_t len)
#line 139
{
const char name[14] = "TestTaskQueue";
#line 141
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 202
static inline BluSH_result_t SettingsM$GoToSleep$getName(char *buff, uint8_t len)
#line 202
{
const char name[10] = "GoToSleep";
#line 204
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 235
static inline BluSH_result_t SettingsM$GetResetCause$getName(char *buff, uint8_t len)
#line 235
{
const char name[14] = "GetResetCause";
#line 237
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
# 751 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline BluSH_result_t PMICM$BatteryVoltage$getName(char *buff, uint8_t len)
#line 751
{
const char name[15] = "BatteryVoltage";
#line 754
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 786
static inline BluSH_result_t PMICM$ManualCharging$getName(char *buff, uint8_t len)
#line 786
{
const char name[15] = "ManualCharging";
#line 789
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 770
static inline BluSH_result_t PMICM$ChargingStatus$getName(char *buff, uint8_t len)
#line 770
{
const char name[15] = "ChargingStatus";
#line 773
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 799
static inline BluSH_result_t PMICM$ReadPMIC$getName(char *buff, uint8_t len)
#line 799
{
const char name[9] = "ReadPMIC";
#line 802
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 821
static inline BluSH_result_t PMICM$WritePMIC$getName(char *buff, uint8_t len)
#line 821
{
const char name[10] = "WritePMIC";
#line 824
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 843
static inline BluSH_result_t PMICM$SetCoreVoltage$getName(char *buff, uint8_t len)
#line 843
{
const char name[15] = "SetCoreVoltage";
#line 846
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
# 176 "/opt/tinyos-1.x/tos/platform/imote2/DVFSM.nc"
static inline BluSH_result_t DVFSM$SwitchFreq$getName(char *buff, uint8_t len)
#line 176
{
const char name[11] = "SwitchFreq";
#line 178
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
#line 206
static inline BluSH_result_t DVFSM$GetFreq$getName(char *buff, uint8_t len)
#line 206
{
const char name[8] = "GetFreq";
#line 208
strcpy(buff, name);
return BLUSH_SUCCESS_DONE;
}
static inline BluSH_result_t DVFSM$GetFreq$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 213
{
sprintf(resBuff, "Current Core/Bus Frequency = [%d/%d]\r\n", getSystemFrequency(), getSystemBusFrequency());
return BLUSH_SUCCESS_DONE;
}
#line 182
static inline BluSH_result_t DVFSM$SwitchFreq$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 183
{
uint32_t target_freq;
uint32_t t_bus_freq;
if (strlen(cmdBuff) < 12) {
sprintf(resBuff, "SwitchFreq <Target Freq in MHz>\r\n");
}
else
#line 189
{
sscanf(cmdBuff, "SwitchFreq %d", &target_freq);
if (target_freq != 416) {
t_bus_freq = target_freq;
}
else
#line 193
{
t_bus_freq = target_freq / 2;
}
if (DVFSM$DVFS$SwitchCoreFreq(target_freq, t_bus_freq) == SUCCESS) {
sprintf(resBuff, "Switched to %3d [%3d] MHz successfully\r\n", target_freq, t_bus_freq);
}
else
#line 198
{
sprintf(resBuff, "Failed to switch to %3d MHz\r\n", target_freq);
}
}
return BLUSH_SUCCESS_DONE;
}
# 851 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline BluSH_result_t PMICM$SetCoreVoltage$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 852
{
uint32_t voltage;
uint32_t trim;
#line 855
if (strlen(cmdBuff) < strlen("SetCoreVoltage 222")) {
sprintf(resBuff, "Please enter the voltage in mV, range 850 - 1625 in 25mV steps\r\n");
}
else {
sscanf(cmdBuff, "SetCoreVoltage %d", &voltage);
if (voltage < 850 || voltage > 1625) {
trace(DBG_USR1, "Invalid voltage %d mV", voltage);
return BLUSH_SUCCESS_DONE;
}
trim = (uint8_t )((voltage - 850) / 25);
PMICM$PMIC$setCoreVoltage(trim);
trace(DBG_USR1, "Wrote voltage %d, trim %d\r\n", trim * 25 + 850, trim);
}
return BLUSH_SUCCESS_DONE;
}
#line 829
static inline BluSH_result_t PMICM$WritePMIC$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 830
{
uint32_t address;
#line 831
uint32_t data;
#line 832
if (strlen(cmdBuff) < strlen("WritePMIC 22 22")) {
sprintf(resBuff, "Please enter an address and a value to write\r\n");
}
else {
sscanf(cmdBuff, "WritePMIC %x %x", &address, &data);
PMICM$writePMIC(address, data);
trace(DBG_USR1, "Wrote %#x to PMIC address %#x\r\n", data, address);
}
return BLUSH_SUCCESS_DONE;
}
#line 807
static inline BluSH_result_t PMICM$ReadPMIC$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 808
{
uint32_t address;
uint8_t data;
#line 811
if (strlen(cmdBuff) < strlen("ReadPMIC 22")) {
sprintf(resBuff, "Please enter an address to read\r\n");
}
else {
sscanf(cmdBuff, "ReadPMIC %x", &address);
PMICM$readPMIC(address, &data, 1);
trace(DBG_USR1, "read %#x from PMIC address %#x\r\n", data, address);
}
return BLUSH_SUCCESS_DONE;
}
#line 777
static inline BluSH_result_t PMICM$ChargingStatus$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 778
{
uint8_t vBat;
#line 779
uint8_t vChg;
#line 779
uint8_t iChg;
#line 779
uint8_t chargeControl;
#line 780
PMICM$PMIC$chargingStatus(&vBat, &vChg, &iChg, &chargeControl);
trace(DBG_USR1, "vBat = %.3fV %vChg = %.3fV iChg = %.3fA chargeControl =%#x\r\n", vBat * .01035 + 2.65, vChg * 6 * .01035, iChg * .01035 / 1.656, chargeControl);
return BLUSH_SUCCESS_DONE;
}
static inline BluSH_result_t PMICM$ManualCharging$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 794
{
PMICM$smartChargeEnable();
return BLUSH_SUCCESS_DONE;
}
#line 758
static inline BluSH_result_t PMICM$BatteryVoltage$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 759
{
uint8_t val;
#line 761
if (PMICM$PMIC$getBatteryVoltage(&val)) {
trace(DBG_USR1, "Battery Voltage is %.3fV\r\n", val * .01035 + 2.65);
}
else {
trace(DBG_USR1, "Error: getBatteryVoltage failed\r\n");
}
return BLUSH_SUCCESS_DONE;
}
# 241 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline BluSH_result_t SettingsM$GetResetCause$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 242
{
uint8_t gpio_rst;
#line 243
uint8_t sleep_rst;
#line 243
uint8_t wdt_rst;
#line 243
uint8_t hw_rst;
#line 244
gpio_rst = (SettingsM$ResetCause & (1 << 3)) == 1 << 3;
sleep_rst = (SettingsM$ResetCause & (1 << 2)) == 1 << 2;
wdt_rst = (SettingsM$ResetCause & (1 << 1)) == 1 << 1;
hw_rst = (SettingsM$ResetCause & 1) == 1;
trace(DBG_USR1, "GPIO %d, Sleep %d, WDT %d, Power On %d\r\n",
gpio_rst, sleep_rst, wdt_rst, hw_rst);
return BLUSH_SUCCESS_DONE;
}
# 52 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XPowerModesM.nc"
static inline void PXA27XPowerModesM$DisablePeripherals(void)
#line 52
{
* (volatile uint32_t *)0x40700004 &= ~(1 << 6);
* (volatile uint32_t *)0x40200004 &= ~(1 << 6);
* (volatile uint32_t *)0x40100004 &= ~(1 << 6);
* (volatile uint32_t *)0x41000000 &= ~(1 << 7);
* (volatile uint32_t *)0x41700000 &= ~(1 << 7);
* (volatile uint32_t *)0x41900000 &= ~(1 << 7);
* (volatile uint32_t *)0x40600000 &= ~(1 << 0);
* (volatile uint32_t *)0x40301690 &= ~(1 << 6);
* (volatile uint32_t *)0x40F00190 &= ~(1 << 6);
* (volatile uint32_t *)0x40A000C0 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000C4 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000C8 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000CC &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000D0 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000D4 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000D8 &= ~(7 & 0x7);
* (volatile uint32_t *)0x40A000DC &= ~(7 & 0x7);
}
static inline void PXA27XPowerModesM$EnterDeepSleep(void)
#line 90
{
PXA27XPowerModesM$DisablePeripherals();
* (volatile uint32_t *)0x40F0000C = (1 << 31) | (1 << 1);
* (volatile uint32_t *)0x40F00010 |= 1 << 1;
* (volatile uint32_t *)0x40F00014 |= 1 << 1;
* (volatile uint32_t *)0x40F00034 &= ~((((1 << 11) | (1 << 10)) | (1 << 9)) | (1 << 8));
* (volatile uint32_t *)0x40F00034 &= ~((3 & 0x3) << 2);
* (volatile uint32_t *)0x41300008 |= 1 << 1;
* (volatile uint32_t *)0x40F0001C = * (volatile uint32_t *)0x40F0001C & ~(1 << 11);
* (volatile uint32_t *)0x40F0001C = * (volatile uint32_t *)0x40F0001C | 1;
while ((* (volatile uint32_t *)0x41300008 & 1) == 0) ;
* (volatile uint32_t *)0x40F0001C = * (volatile uint32_t *)0x40F0001C | (1 << 7);
__asm volatile (
"mcr p14, 0, %0, c7, c0, 0" : :
"r"(7));
while (1) ;
}
static inline void PXA27XPowerModesM$PXA27XPowerModes$SwitchMode(uint8_t targetMode)
#line 141
{
switch (targetMode) {
case 1:
PXA27XPowerModesM$EnterDeepSleep();
break;
default:
break;
}
}
# 51 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XPowerModes.nc"
inline static void SleepM$PXA27XPowerModes$SwitchMode(uint8_t arg_0x40997ab8){
#line 51
PXA27XPowerModesM$PXA27XPowerModes$SwitchMode(arg_0x40997ab8);
#line 51
}
#line 51
# 609 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline result_t PMICM$PMIC$shutDownLDOs(void)
#line 609
{
uint8_t oldVal;
#line 610
uint8_t newVal;
PMICM$readPMIC(0x17, &oldVal, 1);
newVal = (oldVal & ~0x8) & ~0x10;
newVal = (newVal & ~0x2) & ~0x4;
PMICM$writePMIC(0x17, newVal);
PMICM$readPMIC(0x97, &oldVal, 1);
newVal = ((((oldVal & ~0x2) & ~0x10) & ~0x20) &
~0x40) & ~0x80;
PMICM$writePMIC(0x97, newVal);
PMICM$readPMIC(0x98, &oldVal, 1);
newVal = (((((oldVal & ~0x1) & ~0x2) & ~0x4) &
~0x8) & ~0x20) & ~0x40;
PMICM$writePMIC(0x98, newVal);
return SUCCESS;
}
# 52 "/opt/tinyos-1.x/tos/platform/imote2/PMIC.nc"
inline static result_t SleepM$PMIC$shutDownLDOs(void){
#line 52
unsigned char result;
#line 52
#line 52
result = PMICM$PMIC$shutDownLDOs();
#line 52
#line 52
return result;
#line 52
}
#line 52
# 54 "/opt/tinyos-1.x/tos/platform/pxa27x/SleepM.nc"
static inline result_t SleepM$Sleep$goToDeepSleep(uint32_t sleepTime)
#line 54
{
* (volatile uint32_t *)0x40900008 |= 1 << 2;
* (volatile uint32_t *)0x40900004 = * (volatile uint32_t *)0x40900000 + sleepTime;
* (volatile uint32_t *)0x40900008 &= ~(1 << 15);
* (volatile uint32_t *)0x40900008 &= ~(1 << 12);
SleepM$PMIC$shutDownLDOs();
SleepM$PXA27XPowerModes$SwitchMode(1);
return SUCCESS;
}
# 56 "/opt/tinyos-1.x/tos/platform/pxa27x/Sleep.nc"
inline static result_t SettingsM$Sleep$goToDeepSleep(uint32_t arg_0x4090f8e0){
#line 56
unsigned char result;
#line 56
#line 56
result = SleepM$Sleep$goToDeepSleep(arg_0x4090f8e0);
#line 56
#line 56
return result;
#line 56
}
#line 56
# 208 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline BluSH_result_t SettingsM$GoToSleep$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 209
{
uint32_t sleep_time;
if (strlen(cmdBuff) < 11) {
sprintf(resBuff, "GoToSleep <Sleep time in seconds>\r\n");
}
else
#line 214
{
sscanf(cmdBuff, "GoToSleep %d", &sleep_time);
SettingsM$Sleep$goToDeepSleep(sleep_time);
}
return BLUSH_SUCCESS_DONE;
}
#line 119
static inline void SettingsM$testQueue(void)
#line 119
{
trace(DBG_USR1, "Task Executed\r\n");
}
#line 145
static inline BluSH_result_t SettingsM$TestTaskQueue$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 146
{
TOS_post(SettingsM$testQueue);
return BLUSH_SUCCESS_DONE;
}
# 71 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XWatchdogM.nc"
static inline void PXA27XWatchdogM$Reset$reset(void)
#line 71
{
PXA27XWatchdogM$resetMoteRequest = TRUE;
resetNode();
}
# 46 "/opt/tinyos-1.x/tos/interfaces/Reset.nc"
inline static void SettingsM$Reset$reset(void){
#line 46
PXA27XWatchdogM$Reset$reset();
#line 46
}
#line 46
# 123 "/opt/tinyos-1.x/tos/platform/imote2/SettingsM.nc"
static inline void SettingsM$doReset(void)
#line 123
{
SettingsM$Reset$reset();
}
#line 228
static inline BluSH_result_t SettingsM$ResetNode$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 229
{
trace(DBG_USR1, "Resetting\r\n");
TOS_post(SettingsM$doReset);
return BLUSH_SUCCESS_DONE;
}
#line 133
static inline BluSH_result_t SettingsM$NodeID$callApp(char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 134
{
trace(DBG_USR1, "0x%x\r\n", TOS_LOCAL_ADDRESS);
return BLUSH_SUCCESS_DONE;
}
# 280 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline BluSH_result_t BluSHM$BluSH_AppI$default$callApp(uint8_t id, char *cmdBuff, uint8_t cmdLen,
char *resBuff, uint8_t resLen)
#line 281
{
resBuff[0] = '\0';
return BLUSH_SUCCESS_DONE;
}
# 9 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
inline static BluSH_result_t BluSHM$BluSH_AppI$callApp(uint8_t arg_0x40784798, char *arg_0x404b5888, uint8_t arg_0x404b5a10, char *arg_0x404b5bc0, uint8_t arg_0x404b5d48){
#line 9
unsigned char result;
#line 9
#line 9
switch (arg_0x40784798) {
#line 9
case 0U:
#line 9
result = DVFSM$SwitchFreq$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 1U:
#line 9
result = DVFSM$GetFreq$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 2U:
#line 9
result = PMICM$BatteryVoltage$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 3U:
#line 9
result = PMICM$ManualCharging$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 4U:
#line 9
result = PMICM$ChargingStatus$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 5U:
#line 9
result = PMICM$ReadPMIC$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 6U:
#line 9
result = PMICM$WritePMIC$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 7U:
#line 9
result = PMICM$SetCoreVoltage$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 8U:
#line 9
result = SettingsM$NodeID$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 9U:
#line 9
result = SettingsM$ResetNode$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 10U:
#line 9
result = SettingsM$TestTaskQueue$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 11U:
#line 9
result = SettingsM$GoToSleep$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
case 12U:
#line 9
result = SettingsM$GetResetCause$callApp(arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
default:
#line 9
result = BluSHM$BluSH_AppI$default$callApp(arg_0x40784798, arg_0x404b5888, arg_0x404b5a10, arg_0x404b5bc0, arg_0x404b5d48);
#line 9
break;
#line 9
}
#line 9
#line 9
return result;
#line 9
}
#line 9
# 500 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline void BluSHM$clearBluSHdata(BluSHdata data)
#line 500
{
safe_free(data->src);
safe_free(data);
}
# 65 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static inline int BluSHM$DynQueue_getLength(BluSHM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return 0;
}
#line 73
return oDynQueue->iLength;
}
# 493 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline void BluSHM$clearIn(void)
#line 493
{
BluSHM$DynQueue QueueTemp;
#line 495
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 495
QueueTemp = BluSHM$InQueue;
#line 495
__nesc_atomic_end(__nesc_atomic); }
while (BluSHM$DynQueue_getLength(QueueTemp) > 0)
BluSHM$clearBluSHdata((BluSHdata )BluSHM$DynQueue_dequeue(QueueTemp));
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$FIFOP_GPIOInt$disable(void){
#line 46
PXA27XGPIOIntM$PXA27XGPIOInt$disable(0);
#line 46
}
#line 46
# 841 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$InterruptFIFOP$disable(void)
#line 841
{
HPLCC2420M$FIFOP_GPIOInt$disable();
return SUCCESS;
}
# 59 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420RadioM$FIFOP$disable(void){
#line 59
unsigned char result;
#line 59
#line 59
result = HPLCC2420M$InterruptFIFOP$disable();
#line 59
#line 59
return result;
#line 59
}
#line 59
# 536 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$delayedRXFIFOtask(void)
#line 536
{
CC2420RadioM$delayedRXFIFO();
}
# 183 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline char TOSH_READ_CC_FIFO_PIN(void)
#line 183
{
#line 183
return (* (volatile uint32_t *)(0x40E00000 + (114 < 96 ? ((114 & 0x7f) >> 5) * 4 : 0x100)) & (1 << (114 & 0x1f))) != 0;
}
# 105 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static inline result_t TimerJiffyAsyncM$TimerJiffyAsync$stop(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 107
{
TimerJiffyAsyncM$bSet = FALSE;
{
* (volatile uint32_t *)0x40A0001C &= ~(1 << 6);
}
}
#line 112
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 8 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static result_t CC2420RadioM$BackoffTimerJiffy$stop(void){
#line 8
unsigned char result;
#line 8
#line 8
result = TimerJiffyAsyncM$TimerJiffyAsync$stop();
#line 8
#line 8
return result;
#line 8
}
#line 8
# 98 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static inline bool TimerJiffyAsyncM$TimerJiffyAsync$isSet(void)
{
bool val;
#line 101
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 101
val = TimerJiffyAsyncM$bSet;
#line 101
__nesc_atomic_end(__nesc_atomic); }
return val;
}
# 10 "/opt/tinyos-1.x/tos/lib/CC2420Radio/TimerJiffyAsync.nc"
inline static bool CC2420RadioM$BackoffTimerJiffy$isSet(void){
#line 10
unsigned char result;
#line 10
#line 10
result = TimerJiffyAsyncM$TimerJiffyAsync$isSet();
#line 10
#line 10
return result;
#line 10
}
#line 10
# 591 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$FIFOP$fired(void)
#line 591
{
if (CC2420RadioM$bAckEnable && CC2420RadioM$stateRadio == CC2420RadioM$PRE_TX_STATE) {
if (CC2420RadioM$BackoffTimerJiffy$isSet()) {
CC2420RadioM$BackoffTimerJiffy$stop();
CC2420RadioM$BackoffTimerJiffy$setOneShot(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10 + 75);
}
}
if (!TOSH_READ_CC_FIFO_PIN()) {
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 611
{
if (TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$FIFOP$disable();
}
else {
CC2420RadioM$flushRXFIFO();
}
}
#line 618
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420M$InterruptFIFOP$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420RadioM$FIFOP$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$FIFOP_GPIOInt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(0);
#line 47
}
#line 47
# 865 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$FIFOP_GPIOInt$fired(void)
#line 865
{
result_t result;
#line 867
HPLCC2420M$FIFOP_GPIOInt$clear();
result = HPLCC2420M$InterruptFIFOP$fired();
if (FAIL == result) {
HPLCC2420M$InterruptFIFOP$disable();
}
return;
}
#line 506
static inline void HPLCC2420M$HPLCC2420FifoReadRxFifoReleaseError(void)
#line 506
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.readRXFIFO failed while attempting to release the SSP port\r\n");
}
#line 503
static inline void HPLCC2420M$HPLCC2420FIFOReadRxFifoContentionError(void)
#line 503
{
trace(DBG_USR1, "ERROR: HPLCC2420FIFO.readRXFIFO has attempted to access the radio during an existing radio operation\r\n");
}
#line 520
static inline result_t HPLCC2420M$HPLCC2420FIFO$readRXFIFO(uint8_t length, uint8_t *data)
#line 520
{
uint32_t temp32;
uint8_t status;
#line 522
uint8_t tmp;
#line 522
uint8_t OkToUse;
uint8_t pktlen;
result_t ret;
if (HPLCC2420M$getSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420FIFOReadRxFifoContentionError);
return 0;
}
{
#line 538
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 538
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 541
{
HPLCC2420M$rxbuf = data;
OkToUse = HPLCC2420M$gbDMAChannelInitDone;
}
#line 544
__nesc_atomic_end(__nesc_atomic); }
#line 565
{
#line 565
TOSH_CLR_CC_CSN_PIN();
#line 565
TOSH_uwait(1);
}
#line 565
;
* (volatile uint32_t *)0x41900010 = 0x3F | 0x40;
* (volatile uint32_t *)0x41900010 = 0;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
status = * (volatile uint32_t *)0x41900010;
pktlen = * (volatile uint32_t *)0x41900010;
data[0] = pktlen;
data++;
pktlen++;
if (pktlen > 0 && OkToUse == 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 584
{
HPLCC2420M$rxlen = pktlen < length ? pktlen : length;
}
#line 586
__nesc_atomic_end(__nesc_atomic); }
#line 615
{
int i;
#line 618
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 618
{
length = HPLCC2420M$rxlen;
}
#line 620
__nesc_atomic_end(__nesc_atomic); }
while (length > 16) {
for (i = 0; i < 16; i++) {
* (volatile uint32_t *)0x41900010 = 0;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
for (i = 0; i < 16; i++) {
temp32 = * (volatile uint32_t *)0x41900010;
* data++ = temp32;
}
length -= 16;
}
for (i = 0; i < length; i++) {
* (volatile uint32_t *)0x41900010 = 0;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
for (i = 0; i < length; i++) {
temp32 = * (volatile uint32_t *)0x41900010;
* data++ = temp32;
}
TOS_post(HPLCC2420M$signalRXFIFO);
{
#line 642
TOSH_uwait(1);
#line 642
TOSH_SET_CC_CSN_PIN();
}
#line 642
;
ret = SUCCESS;
}
}
else
{
{
#line 654
TOSH_uwait(1);
#line 654
TOSH_SET_CC_CSN_PIN();
}
#line 654
;
ret = FAIL;
}
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420FifoReadRxFifoReleaseError);
return 0;
}
return ret;
}
# 19 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t CC2420RadioM$HPLChipconFIFO$readRXFIFO(uint8_t arg_0x40f1d558, uint8_t *arg_0x40f1d700){
#line 19
unsigned char result;
#line 19
#line 19
result = HPLCC2420M$HPLCC2420FIFO$readRXFIFO(arg_0x40f1d558, arg_0x40f1d700);
#line 19
#line 19
return result;
#line 19
}
#line 19
# 185 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline char TOSH_READ_CC_FIFOP_PIN(void)
#line 185
{
#line 185
return (* (volatile uint32_t *)(0x40E00000 + (0 < 96 ? ((0 & 0x7f) >> 5) * 4 : 0x100)) & (1 << (0 & 0x1f))) != 0;
}
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t GenericCommProM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = LedsC$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 398 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static inline TOS_MsgPtr GenericCommProM$RadioReceive$receive(TOS_MsgPtr msg)
#line 398
{
GenericCommProM$radioRecvActive = TRUE;
GenericCommProM$Leds$greenToggle();
return GenericCommProM$received(msg);
}
# 75 "/opt/tinyos-1.x/tos/interfaces/ReceiveMsg.nc"
inline static TOS_MsgPtr CC2420RadioM$Receive$receive(TOS_MsgPtr arg_0x40620878){
#line 75
struct TOS_Msg *result;
#line 75
#line 75
result = GenericCommProM$RadioReceive$receive(arg_0x40620878);
#line 75
#line 75
return result;
#line 75
}
#line 75
# 153 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline void CC2420RadioM$PacketRcvd(void)
#line 153
{
TOS_MsgPtr pBuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 156
{
pBuf = CC2420RadioM$rxbufptr;
}
#line 158
__nesc_atomic_end(__nesc_atomic); }
pBuf = CC2420RadioM$Receive$receive((TOS_MsgPtr )pBuf);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 160
{
if (pBuf) {
#line 161
CC2420RadioM$rxbufptr = pBuf;
}
#line 162
CC2420RadioM$rxbufptr->length = 0;
CC2420RadioM$bPacketReceiving = FALSE;
}
#line 164
__nesc_atomic_end(__nesc_atomic); }
}
# 23 "/opt/tinyos-1.x/tos/lib/CC2420Radio/byteorder.h"
static __inline uint16_t fromLSB16(uint16_t a)
{
return is_host_lsb() ? a : (a << 8) | (a >> 8);
}
# 628 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$HPLChipconFIFO$RXFIFODone(uint8_t length, uint8_t *data)
#line 628
{
uint8_t currentstate;
#line 635
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 635
{
currentstate = CC2420RadioM$stateRadio;
}
#line 637
__nesc_atomic_end(__nesc_atomic); }
if (((
#line 641
!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN())
|| length == 0) || length > MSG_DATA_SIZE) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 644
CC2420RadioM$bPacketReceiving = FALSE;
#line 644
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr = (TOS_MsgPtr )data;
if (
#line 651
CC2420RadioM$bAckEnable && currentstate == CC2420RadioM$POST_TX_STATE && (
CC2420RadioM$rxbufptr->fcfhi & 0x07) == 0x02 &&
CC2420RadioM$rxbufptr->dsn == CC2420RadioM$currentDSN &&
data[length - 1] >> 7 == 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 655
{
CC2420RadioM$txbufptr->ack = 1;
CC2420RadioM$txbufptr->strength = data[length - 2];
CC2420RadioM$txbufptr->lqi = data[length - 1] & 0x7F;
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_ACK_STATE;
CC2420RadioM$bPacketReceiving = FALSE;
}
#line 662
__nesc_atomic_end(__nesc_atomic); }
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
#line 665
return SUCCESS;
}
if ((CC2420RadioM$rxbufptr->fcfhi & 0x07) != 0x01 ||
CC2420RadioM$rxbufptr->fcflo != 0x08) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 674
CC2420RadioM$bPacketReceiving = FALSE;
#line 674
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr->length = CC2420RadioM$rxbufptr->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
if (CC2420RadioM$rxbufptr->length > 74) {
CC2420RadioM$flushRXFIFO();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 682
CC2420RadioM$bPacketReceiving = FALSE;
#line 682
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
CC2420RadioM$rxbufptr->addr = fromLSB16(CC2420RadioM$rxbufptr->addr);
CC2420RadioM$rxbufptr->crc = data[length - 1] >> 7;
CC2420RadioM$rxbufptr->strength = data[length - 2];
CC2420RadioM$rxbufptr->lqi = data[length - 1] & 0x7F;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 696
{
if (!TOS_post(CC2420RadioM$PacketRcvd)) {
CC2420RadioM$bPacketReceiving = FALSE;
}
}
#line 700
__nesc_atomic_end(__nesc_atomic); }
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
if (!TOSH_READ_CC_FIFOP_PIN()) {
if (TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
return SUCCESS;
}
}
#line 711
CC2420RadioM$flushRXFIFO();
return SUCCESS;
}
# 39 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420FIFO.nc"
inline static result_t HPLCC2420M$HPLCC2420FIFO$RXFIFODone(uint8_t arg_0x40f1c4e8, uint8_t *arg_0x40f1c690){
#line 39
unsigned char result;
#line 39
#line 39
result = CC2420RadioM$HPLChipconFIFO$RXFIFODone(arg_0x40f1c4e8, arg_0x40f1c690);
#line 39
#line 39
return result;
#line 39
}
#line 39
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$FIFO_GPIOInt$disable(void){
#line 46
PXA27XGPIOIntM$PXA27XGPIOInt$disable(114);
#line 46
}
#line 46
# 847 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$InterruptFIFO$disable(void)
#line 847
{
HPLCC2420M$FIFO_GPIOInt$disable();
return SUCCESS;
}
#line 989
static inline result_t HPLCC2420M$InterruptFIFO$default$fired(void)
#line 989
{
return FAIL;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420M$InterruptFIFO$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = HPLCC2420M$InterruptFIFO$default$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$FIFO_GPIOInt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(114);
#line 47
}
#line 47
# 876 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$FIFO_GPIOInt$fired(void)
#line 876
{
result_t result;
#line 878
HPLCC2420M$FIFO_GPIOInt$clear();
result = HPLCC2420M$InterruptFIFO$fired();
if (FAIL == result) {
HPLCC2420M$InterruptFIFO$disable();
}
return;
}
#line 853
static inline result_t HPLCC2420M$InterruptCCA$disable(void)
#line 853
{
HPLCC2420M$CCA_GPIOInt$disable();
return SUCCESS;
}
# 312 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SplitControl$default$startDone(void)
#line 312
{
return SUCCESS;
}
# 85 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420RadioM$SplitControl$startDone(void){
#line 85
unsigned char result;
#line 85
#line 85
result = CC2420RadioM$SplitControl$default$startDone();
#line 85
#line 85
return result;
#line 85
}
#line 85
# 43 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t CC2420RadioM$FIFOP$startWait(bool arg_0x40959bc8){
#line 43
unsigned char result;
#line 43
#line 43
result = HPLCC2420M$InterruptFIFOP$startWait(arg_0x40959bc8);
#line 43
#line 43
return result;
#line 43
}
#line 43
# 343 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$RxMode(void)
#line 343
{
CC2420ControlM$HPLChipcon$cmd(0x03);
return SUCCESS;
}
# 163 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Control.nc"
inline static result_t CC2420RadioM$CC2420Control$RxMode(void){
#line 163
unsigned char result;
#line 163
#line 163
result = CC2420ControlM$CC2420Control$RxMode();
#line 163
#line 163
return result;
#line 163
}
#line 163
# 294 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$CC2420SplitControl$startDone(void)
#line 294
{
uint8_t chkstateRadio;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
chkstateRadio = CC2420RadioM$stateRadio;
#line 297
__nesc_atomic_end(__nesc_atomic); }
if (chkstateRadio == CC2420RadioM$WARMUP_STATE) {
CC2420RadioM$CC2420Control$RxMode();
CC2420RadioM$FIFOP$startWait(FALSE);
CC2420RadioM$SFD$enableCapture(TRUE);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 306
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
#line 306
__nesc_atomic_end(__nesc_atomic); }
}
CC2420RadioM$SplitControl$startDone();
return SUCCESS;
}
# 85 "/opt/tinyos-1.x/tos/interfaces/SplitControl.nc"
inline static result_t CC2420ControlM$SplitControl$startDone(void){
#line 85
unsigned char result;
#line 85
#line 85
result = CC2420RadioM$CC2420SplitControl$startDone();
#line 85
#line 85
return result;
#line 85
}
#line 85
# 286 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$TuneManual(uint16_t DesiredFreq)
#line 286
{
int fsctrl;
uint8_t status;
fsctrl = DesiredFreq - 2048;
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (CC2420ControlM$gCurrentParameters[CP_FSCTRL] & 0xfc00) | (fsctrl << 0);
status = CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
if (status & (1 << 6)) {
CC2420ControlM$HPLChipcon$cmd(0x03);
}
#line 297
return SUCCESS;
}
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t CC2420ControlM$HPLChipconRAM$write(uint16_t arg_0x40955710, uint8_t arg_0x40955898, uint8_t *arg_0x40955a40){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420RAM$write(arg_0x40955710, arg_0x40955898, arg_0x40955a40);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 432 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$CC2420Control$setShortAddress(uint16_t addr)
#line 432
{
addr = toLSB16(addr);
return CC2420ControlM$HPLChipconRAM$write(0x16A, 2, (uint8_t *)&addr);
}
# 61 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420.nc"
inline static uint16_t CC2420ControlM$HPLChipcon$read(uint8_t arg_0x40956010){
#line 61
unsigned short result;
#line 61
#line 61
result = HPLCC2420M$HPLCC2420$read(arg_0x40956010);
#line 61
#line 61
return result;
#line 61
}
#line 61
# 80 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline bool CC2420ControlM$SetRegs(void)
#line 80
{
uint16_t data;
CC2420ControlM$HPLChipcon$write(0x10, CC2420ControlM$gCurrentParameters[CP_MAIN]);
CC2420ControlM$HPLChipcon$write(0x11, CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]);
data = CC2420ControlM$HPLChipcon$read(0x11);
if (data != CC2420ControlM$gCurrentParameters[CP_MDMCTRL0]) {
#line 86
return FALSE;
}
CC2420ControlM$HPLChipcon$write(0x12, CC2420ControlM$gCurrentParameters[CP_MDMCTRL1]);
CC2420ControlM$HPLChipcon$write(0x13, CC2420ControlM$gCurrentParameters[CP_RSSI]);
CC2420ControlM$HPLChipcon$write(0x14, CC2420ControlM$gCurrentParameters[CP_SYNCWORD]);
CC2420ControlM$HPLChipcon$write(0x15, CC2420ControlM$gCurrentParameters[CP_TXCTRL]);
CC2420ControlM$HPLChipcon$write(0x16, CC2420ControlM$gCurrentParameters[CP_RXCTRL0]);
CC2420ControlM$HPLChipcon$write(0x17, CC2420ControlM$gCurrentParameters[CP_RXCTRL1]);
CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
CC2420ControlM$HPLChipcon$write(0x19, CC2420ControlM$gCurrentParameters[CP_SECCTRL0]);
CC2420ControlM$HPLChipcon$write(0x1A, CC2420ControlM$gCurrentParameters[CP_SECCTRL1]);
CC2420ControlM$HPLChipcon$write(0x1C, CC2420ControlM$gCurrentParameters[CP_IOCFG0]);
CC2420ControlM$HPLChipcon$write(0x1D, CC2420ControlM$gCurrentParameters[CP_IOCFG1]);
CC2420ControlM$HPLChipcon$cmd(0x09);
CC2420ControlM$HPLChipcon$cmd(0x08);
return TRUE;
}
static inline void CC2420ControlM$PostOscillatorOn(void)
#line 116
{
CC2420ControlM$SetRegs();
CC2420ControlM$CC2420Control$setShortAddress(TOS_LOCAL_ADDRESS);
CC2420ControlM$CC2420Control$TuneManual(((CC2420ControlM$gCurrentParameters[CP_FSCTRL] << 0) & 0x1FF) + 2048);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 121
CC2420ControlM$state = CC2420ControlM$START_STATE_DONE;
#line 121
__nesc_atomic_end(__nesc_atomic); }
CC2420ControlM$SplitControl$startDone();
}
#line 445
static inline result_t CC2420ControlM$CCA$fired(void)
#line 445
{
CC2420ControlM$HPLChipcon$write(0x1D, 0);
TOS_post(CC2420ControlM$PostOscillatorOn);
return FAIL;
}
# 51 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Interrupt.nc"
inline static result_t HPLCC2420M$InterruptCCA$fired(void){
#line 51
unsigned char result;
#line 51
#line 51
result = CC2420ControlM$CCA$fired();
#line 51
#line 51
return result;
#line 51
}
#line 51
# 887 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$CCA_GPIOInt$fired(void)
#line 887
{
result_t result;
#line 889
HPLCC2420M$CCA_GPIOInt$clear();
result = HPLCC2420M$InterruptCCA$fired();
if (FAIL == result) {
HPLCC2420M$InterruptCCA$disable();
}
return;
}
#line 435
static inline void HPLCC2420M$HPLCC2420RAMWriteContentionError(void)
#line 435
{
trace(DBG_USR1, "ERROR: HPLCC2420RAM.write has attempted to access the radio during an existing radio operation\r\n");
}
#line 438
static inline void HPLCC2420M$HPLCC2420RamWriteReleaseError(void)
#line 438
{
trace(DBG_USR1, "ERROR: HPLCC2420RAM.write failed while attempting to release the SSP port\r\n");
}
# 441 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static inline result_t CC2420ControlM$HPLChipconRAM$writeDone(uint16_t addr, uint8_t length, uint8_t *buffer)
#line 441
{
return SUCCESS;
}
# 165 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline result_t ClockTimeStampingM$HPLCC2420RAM$writeDone(uint16_t addr,
uint8_t length,
uint8_t *buffer)
#line 167
{
return SUCCESS;
}
# 49 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t HPLCC2420M$HPLCC2420RAM$writeDone(uint16_t arg_0x40954010, uint8_t arg_0x40954198, uint8_t *arg_0x40954340){
#line 49
unsigned char result;
#line 49
#line 49
result = ClockTimeStampingM$HPLCC2420RAM$writeDone(arg_0x40954010, arg_0x40954198, arg_0x40954340);
#line 49
result = rcombine(result, CC2420ControlM$HPLChipconRAM$writeDone(arg_0x40954010, arg_0x40954198, arg_0x40954340));
#line 49
#line 49
return result;
#line 49
}
#line 49
# 422 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$signalRAMWr(void)
#line 422
{
uint16_t ramaddr;
uint8_t ramlen;
uint8_t *rambuf;
#line 426
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 426
{
ramaddr = HPLCC2420M$txramaddr;
ramlen = HPLCC2420M$txramlen;
rambuf = HPLCC2420M$txrambuf;
}
#line 430
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$HPLCC2420RAM$writeDone(ramaddr, ramlen, rambuf);
}
# 46 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$SFD_GPIOInt$disable(void){
#line 46
PXA27XGPIOIntM$PXA27XGPIOInt$disable(16);
#line 46
}
#line 46
# 859 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline result_t HPLCC2420M$CaptureSFD$disable(void)
#line 859
{
HPLCC2420M$SFD_GPIOInt$disable();
return SUCCESS;
}
# 27 "/home/xu/oasis/lib/FTSP/TimeSync/LocalTime.nc"
inline static uint32_t ClockTimeStampingM$LocalTime$read(void){
#line 27
unsigned int result;
#line 27
#line 27
result = RealTimeM$LocalTime$read();
#line 27
#line 27
return result;
#line 27
}
#line 27
# 123 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline void ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff)
#line 125
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 126
{
ClockTimeStampingM$rcv_time = ClockTimeStampingM$LocalTime$read();
ClockTimeStampingM$rcv_message = msgBuff;
}
#line 129
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
inline static void CC2420RadioM$RadioReceiveCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658){
#line 33
ClockTimeStampingM$RadioReceiveCoordinator$startSymbol(arg_0x40f28340, arg_0x40f284c8, arg_0x40f28658);
#line 33
}
#line 33
# 144 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static __inline result_t CC2420RadioM$setAckTimer(uint16_t jiffy)
#line 144
{
CC2420RadioM$stateTimer = CC2420RadioM$TIMER_ACK;
return CC2420RadioM$BackoffTimerJiffy$setOneShot(jiffy);
}
# 60 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
inline static result_t CC2420RadioM$SFD$disable(void){
#line 60
unsigned char result;
#line 60
#line 60
result = HPLCC2420M$CaptureSFD$disable();
#line 60
#line 60
return result;
#line 60
}
#line 60
# 47 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420RAM.nc"
inline static result_t ClockTimeStampingM$HPLCC2420RAM$write(uint16_t arg_0x40955710, uint8_t arg_0x40955898, uint8_t *arg_0x40955a40){
#line 47
unsigned char result;
#line 47
#line 47
result = HPLCC2420M$HPLCC2420RAM$write(arg_0x40955710, arg_0x40955898, arg_0x40955a40);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 58 "/home/xu/oasis/lib/FTSP/TimeSync/ClockTimeStampingM.nc"
static inline void ClockTimeStampingM$RadioSendCoordinator$startSymbol(uint8_t bitsPerBlock,
uint8_t offset,
TOS_MsgPtr msgBuff)
#line 60
{
uint32_t send_time;
TimeSyncMsg *newMessage = (TimeSyncMsg *)msgBuff->data;
if (msgBuff->type != AM_TIMESYNCMSG) {
return;
}
if (newMessage->wroteStamp == SUCCESS) {
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 83
send_time = ClockTimeStampingM$LocalTime$read() - ClockTimeStampingM$SEND_TIME_CORRECTION;
#line 83
__nesc_atomic_end(__nesc_atomic); }
newMessage->sendingTime += send_time;
newMessage->wroteStamp = SUCCESS;
ClockTimeStampingM$HPLCC2420RAM$write(ClockTimeStampingM$TX_FIFO_MSG_START +
(size_t )& ((TimeSyncMsg *)0)->wroteStamp,
TIMESYNC_LENGTH_SENDFIELDS,
(void *)(msgBuff->data +
(size_t )& ((TimeSyncMsg *)0)->wroteStamp));
return;
}
# 33 "/opt/tinyos-1.x/tos/interfaces/RadioCoordinator.nc"
inline static void CC2420RadioM$RadioSendCoordinator$startSymbol(uint8_t arg_0x40f28340, uint8_t arg_0x40f284c8, TOS_MsgPtr arg_0x40f28658){
#line 33
ClockTimeStampingM$RadioSendCoordinator$startSymbol(arg_0x40f28340, arg_0x40f284c8, arg_0x40f28658);
#line 33
}
#line 33
# 186 "/opt/tinyos-1.x/tos/platform/imote2/hardware.h"
static __inline char TOSH_READ_CC_SFD_PIN(void)
#line 186
{
#line 186
return (* (volatile uint32_t *)(0x40E00000 + (16 < 96 ? ((16 & 0x7f) >> 5) * 4 : 0x100)) & (1 << (16 & 0x1f))) != 0;
}
# 344 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static inline result_t CC2420RadioM$SFD$captured(uint16_t time)
#line 344
{
switch (CC2420RadioM$stateRadio) {
case CC2420RadioM$TX_STATE:
CC2420RadioM$SFD$enableCapture(FALSE);
if (!TOSH_READ_CC_SFD_PIN()) {
CC2420RadioM$SFD$disable();
}
else {
CC2420RadioM$stateRadio = CC2420RadioM$TX_WAIT;
}
CC2420RadioM$txbufptr->time = time;
CC2420RadioM$RadioSendCoordinator$startSymbol(8, 0, CC2420RadioM$txbufptr);
if (CC2420RadioM$stateRadio == CC2420RadioM$TX_WAIT) {
break;
}
case CC2420RadioM$TX_WAIT:
CC2420RadioM$stateRadio = CC2420RadioM$POST_TX_STATE;
CC2420RadioM$SFD$disable();
CC2420RadioM$SFD$enableCapture(TRUE);
if (CC2420RadioM$bAckEnable && CC2420RadioM$txbufptr->addr != TOS_BCAST_ADDR) {
if (!CC2420RadioM$setAckTimer(75)) {
CC2420RadioM$sendFailed();
}
}
else {
if (!TOS_post(CC2420RadioM$PacketSent)) {
CC2420RadioM$sendFailed();
}
}
#line 381
break;
default:
CC2420RadioM$rxbufptr->time = time;
CC2420RadioM$RadioReceiveCoordinator$startSymbol(8, 0, CC2420RadioM$rxbufptr);
}
return SUCCESS;
}
# 53 "/opt/tinyos-1.x/tos/lib/CC2420Radio/HPLCC2420Capture.nc"
inline static result_t HPLCC2420M$CaptureSFD$captured(uint16_t arg_0x40f18368){
#line 53
unsigned char result;
#line 53
#line 53
result = CC2420RadioM$SFD$captured(arg_0x40f18368);
#line 53
#line 53
return result;
#line 53
}
#line 53
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void HPLCC2420M$SFD_GPIOInt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(16);
#line 47
}
#line 47
# 897 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static inline void HPLCC2420M$SFD_GPIOInt$fired(void)
#line 897
{
result_t result;
#line 899
HPLCC2420M$SFD_GPIOInt$clear();
result = HPLCC2420M$CaptureSFD$captured(0);
if (result == FAIL) {
HPLCC2420M$CaptureSFD$disable();
}
return;
}
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void GPSSensorM$GPSInterrupt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(93);
#line 47
}
#line 47
# 476 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$debugDevTask(void)
#line 476
{
float newSkew = GPSSensorM$skew;
uint32_t newLocalAverage;
int32_t newOffsetAverage;
int32_t localSum;
int32_t offsetSum;
int8_t i;
for (i = 0; i < MAX_ENTRIES && GPSSensorM$table[i].state != ENTRY_FULL; ++i)
;
if (i >= MAX_ENTRIES) {
return;
}
newLocalAverage = GPSSensorM$table[i].localTime;
newOffsetAverage = GPSSensorM$table[i].timeOffset;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 497
{
localSum = 0;
offsetSum = 0;
}
#line 500
__nesc_atomic_end(__nesc_atomic); }
while (++i < MAX_ENTRIES) {
if (GPSSensorM$table[i].state == ENTRY_FULL) {
localSum += (int32_t )(GPSSensorM$table[i].localTime - newLocalAverage) / GPSSensorM$tableEntries;
offsetSum += (int32_t )(GPSSensorM$table[i].timeOffset - newOffsetAverage) / GPSSensorM$tableEntries;
}
}
newLocalAverage += localSum;
newOffsetAverage += offsetSum;
localSum = offsetSum = 0;
for (i = 0; i < MAX_ENTRIES; ++i) {
if (GPSSensorM$table[i].state == ENTRY_FULL) {
int32_t a = GPSSensorM$table[i].localTime - newLocalAverage;
int32_t b = GPSSensorM$table[i].timeOffset - newOffsetAverage;
localSum += (int32_t )a * a;
offsetSum += (int32_t )a * b;
}
}
if (localSum != 0) {
newSkew = (float )offsetSum / (float )localSum;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
GPSSensorM$skew = newSkew;
GPSSensorM$offsetAverage = newOffsetAverage;
GPSSensorM$localAverage = newLocalAverage;
GPSSensorM$numEntries = GPSSensorM$tableEntries;
}
#line 531
__nesc_atomic_end(__nesc_atomic); }
}
#line 550
static inline void GPSSensorM$addNewEntry(void)
#line 550
{
int8_t i;
#line 551
int8_t freeItem = -1;
#line 551
int8_t oldestItem = 0;
uint32_t age;
#line 552
uint32_t oldestTime = 0;
int32_t timeError;
GPSSensorM$tableEntries = 0;
timeError = GPSSensorM$gLocalTime;
GPSSensorM$GPSGlobalTime$local2Global(&timeError);
timeError = GPSSensorM$timeCount - timeError % DAY_END;
if (timeError > 1000UL || timeError < -1000UL) {
return;
}
else {
#line 565
if (GPSSensorM$timeCount - GPSSensorM$gLocalTime > DAY_END >> 2 || GPSSensorM$timeCount - GPSSensorM$gLocalTime < -(DAY_END >> 2)) {
return;
}
}
for (i = 0; i < MAX_ENTRIES; ++i) {
++GPSSensorM$tableEntries;
age = GPSSensorM$gLocalTime - GPSSensorM$table[i].localTime;
if (age >= 0x7FFFFFFFUL) {
GPSSensorM$table[i].state = ENTRY_EMPTY;
}
if (GPSSensorM$table[i].state == ENTRY_EMPTY) {
--GPSSensorM$tableEntries;
freeItem = i;
}
if (age >= oldestTime) {
oldestTime = age;
oldestItem = i;
}
}
if (freeItem < 0) {
freeItem = oldestItem;
}
else {
#line 595
++GPSSensorM$tableEntries;
}
GPSSensorM$table[freeItem].state = ENTRY_FULL;
GPSSensorM$table[freeItem].localTime = GPSSensorM$gLocalTime;
timeError = GPSSensorM$timeCount - GPSSensorM$gLocalTime;
GPSSensorM$table[freeItem].timeOffset = timeError;
}
# 40 "/home/xu/oasis/interfaces/RealTime.nc"
inline static result_t GPSSensorM$RealTime$setTimeCount(uint32_t arg_0x40abf6d8, uint8_t arg_0x40abf860){
#line 40
unsigned char result;
#line 40
#line 40
result = RealTimeM$RealTime$setTimeCount(arg_0x40abf6d8, arg_0x40abf860);
#line 40
#line 40
return result;
#line 40
}
#line 40
# 680 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static inline void GPSSensorM$GPSInterrupt$fired(void)
#line 680
{
uint32_t timeTemp = 0;
timeTemp = GPSSensorM$LocalTime$read();
GPSSensorM$pps_arrive_point[GPSSensorM$ppsIndex] = timeTemp;
timeTemp = GPSSensorM$GPSGlobalTime$local2Global(timeTemp);
GPSSensorM$checkTimerOn = FALSE;
if (TRUE == GPSSensorM$samplingReady) {
GPSSensorM$hasGPS = TRUE;
if (GPSSensorM$RealTime$getMode() == FTSP_SYNC) {
GPSSensorM$RealTime$changeMode(GPS_SYNC);
GPSSensorM$alreadySetTime = FALSE;
}
GPSSensorM$gLocalTime = GPSSensorM$pps_arrive_point[GPSSensorM$ppsIndex];
if (GPSSensorM$alreadySetTime != TRUE) {
GPSSensorM$RealTime$setTimeCount(GPSSensorM$timeCount, GPS_SYNC);
GPSSensorM$alreadySetTime = TRUE;
GPSSensorM$gLocalTime = GPSSensorM$LocalTime$read();
GPSSensorM$clearTable();
}
GPSSensorM$samplingStart = FALSE;
GPSSensorM$samplingReady = FALSE;
GPSSensorM$addNewEntry();
TOS_post(GPSSensorM$debugDevTask);
}
else
#line 725
{
}
#line 738
GPSSensorM$GPSInterrupt$clear();
if (++GPSSensorM$ppsIndex == SYNC_INTERVAL) {
if (GPSSensorM$hasGPS == FALSE) {
GPSSensorM$alreadySetTime = FALSE;
}
GPSSensorM$ppsIndex = 0;
}
return;
}
# 46 "/opt/tinyos-1.x/tos/interfaces/Reset.nc"
inline static void PMICM$Reset$reset(void){
#line 46
PXA27XWatchdogM$Reset$reset();
#line 46
}
#line 46
# 474 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$handlePMICIrq(void)
#line 474
{
uint8_t events[3];
PMICM$readPMIC(0x01, events, 3);
if (events[0] & 0x1) {
if (PMICM$gotReset == TRUE) {
PMICM$Reset$reset();
}
else {
PMICM$gotReset = TRUE;
}
}
if (events[0] & 0x4) {
trace(DBG_USR1, "USB Cable Insertion/Removal event\r\n");
PMICM$smartChargeEnable();
}
if (events[0] & 0x80) {
trace(DBG_USR1, "Charger Status: Charger Over Current Error\r\n");
PMICM$PMIC$enableCharging(FALSE);
}
if (events[1] & 0x1) {
trace(DBG_USR1, "Charger Status: Total Charging Timeout Expired\r\n");
PMICM$PMIC$enableCharging(FALSE);
}
if (events[1] & 0x2) {
trace(DBG_USR1, "Charger Status: Total Constant Current Charging Timeout Expired\r\n");
PMICM$PMIC$enableCharging(FALSE);
}
}
# 106 "/opt/tinyos-1.x/tos/interfaces/Leds.nc"
inline static result_t PMICM$Leds$greenToggle(void){
#line 106
unsigned char result;
#line 106
#line 106
result = NoLeds$Leds$greenToggle();
#line 106
#line 106
return result;
#line 106
}
#line 106
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void PMICM$PMICInterrupt$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(1);
#line 47
}
#line 47
# 516 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static inline void PMICM$PMICInterrupt$fired(void)
#line 516
{
PMICM$PMICInterrupt$clear();
PMICM$Leds$greenToggle();
TOS_post(PMICM$handlePMICIrq);
}
# 47 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
inline static void PXA27XUSBClientM$USBAttached$clear(void){
#line 47
PXA27XGPIOIntM$PXA27XGPIOInt$clear(13);
#line 47
}
#line 47
# 221 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static inline void PXA27XUSBClientM$USBAttached$fired(void)
{
PXA27XUSBClientM$isAttached();
PXA27XUSBClientM$USBAttached$clear();
}
# 450 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$UartReceive$receive(uint8_t *buff, uint32_t numBytesRead)
#line 450
{
BluSHM$queueInput(buff, numBytesRead);
return SUCCESS;
}
# 73 "/opt/tinyos-1.x/tos/platform/imote2/ReceiveData.nc"
inline static result_t BufferedSTUARTM$ReceiveData$receive(uint8_t *arg_0x404d6b18, uint32_t arg_0x404d6cb0){
#line 73
unsigned char result;
#line 73
#line 73
result = BluSHM$UartReceive$receive(arg_0x404d6b18, arg_0x404d6cb0);
#line 73
#line 73
return result;
#line 73
}
#line 73
# 224 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static inline void BufferedSTUARTM$receiveDone(uint32_t arg)
#line 224
{
bufferInfo_t *pBI = (bufferInfo_t *)arg;
#line 226
if (pBI == (void *)0) {
return;
}
invalidateDCache(pBI->pBuf, pBI->numBytes);
BufferedSTUARTM$ReceiveData$receive(pBI->pBuf, pBI->numBytes);
returnBuffer(&BufferedSTUARTM$receiveBufferSet, pBI->pBuf);
returnBufferInfo(&BufferedSTUARTM$receiveBufferInfoSet, pBI);
}
#line 22
static inline void BufferedSTUARTM$_receiveDoneveneer(void)
#line 22
{
#line 22
uint32_t argument;
#line 22
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 22
{
#line 22
popqueue(¶mtaskQueue, &argument);
}
#line 23
__nesc_atomic_end(__nesc_atomic); }
#line 22
BufferedSTUARTM$receiveDone(argument);
}
# 77 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAChannel.nc"
inline static result_t STUARTM$TxDMAChannel$requestChannel(DMAPeripheralID_t arg_0x405402f8, DMAPriority_t arg_0x405404a0, bool arg_0x40540630){
#line 77
unsigned char result;
#line 77
#line 77
result = PXA27XDMAM$PXA27XDMAChannel$requestChannel(1U, arg_0x405402f8, arg_0x405404a0, arg_0x40540630);
#line 77
#line 77
return result;
#line 77
}
#line 77
#line 192
inline static result_t STUARTM$TxDMAChannel$setTransferWidth(DMATransferWidth_t arg_0x4054d358){
#line 192
unsigned char result;
#line 192
#line 192
result = PXA27XDMAM$PXA27XDMAChannel$setTransferWidth(1U, arg_0x4054d358);
#line 192
#line 192
return result;
#line 192
}
#line 192
#line 172
inline static result_t STUARTM$TxDMAChannel$setMaxBurstSize(DMAMaxBurstSize_t arg_0x4054e720){
#line 172
unsigned char result;
#line 172
#line 172
result = PXA27XDMAM$PXA27XDMAChannel$setMaxBurstSize(1U, arg_0x4054e720);
#line 172
#line 172
return result;
#line 172
}
#line 172
#line 161
inline static result_t STUARTM$TxDMAChannel$enableTargetFlowControl(bool arg_0x4054e188){
#line 161
unsigned char result;
#line 161
#line 161
result = PXA27XDMAM$PXA27XDMAChannel$enableTargetFlowControl(1U, arg_0x4054e188);
#line 161
#line 161
return result;
#line 161
}
#line 161
#line 152
inline static result_t STUARTM$TxDMAChannel$enableSourceFlowControl(bool arg_0x4053fbd8){
#line 152
unsigned char result;
#line 152
#line 152
result = PXA27XDMAM$PXA27XDMAChannel$enableSourceFlowControl(1U, arg_0x4053fbd8);
#line 152
#line 152
return result;
#line 152
}
#line 152
#line 143
inline static result_t STUARTM$TxDMAChannel$enableTargetAddrIncrement(bool arg_0x4053f608){
#line 143
unsigned char result;
#line 143
#line 143
result = PXA27XDMAM$PXA27XDMAChannel$enableTargetAddrIncrement(1U, arg_0x4053f608);
#line 143
#line 143
return result;
#line 143
}
#line 143
#line 133
inline static result_t STUARTM$TxDMAChannel$enableSourceAddrIncrement(bool arg_0x4053f030){
#line 133
unsigned char result;
#line 133
#line 133
result = PXA27XDMAM$PXA27XDMAChannel$enableSourceAddrIncrement(1U, arg_0x4053f030);
#line 133
#line 133
return result;
#line 133
}
#line 133
#line 123
inline static result_t STUARTM$TxDMAChannel$setTargetAddr(uint32_t arg_0x4053aaa8){
#line 123
unsigned char result;
#line 123
#line 123
result = PXA27XDMAM$PXA27XDMAChannel$setTargetAddr(1U, arg_0x4053aaa8);
#line 123
#line 123
return result;
#line 123
}
#line 123
# 322 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static inline void STUARTM$configureTxDMA(uint8_t *TxBuffer, uint16_t NumBytes)
#line 322
{
STUARTM$TxDMAChannel$setSourceAddr((uint32_t )TxBuffer);
STUARTM$TxDMAChannel$setTargetAddr(0x40700000);
STUARTM$TxDMAChannel$enableSourceAddrIncrement(TRUE);
STUARTM$TxDMAChannel$enableTargetAddrIncrement(FALSE);
STUARTM$TxDMAChannel$enableSourceFlowControl(FALSE);
STUARTM$TxDMAChannel$enableTargetFlowControl(TRUE);
STUARTM$TxDMAChannel$setTransferLength(NumBytes);
STUARTM$TxDMAChannel$setMaxBurstSize(DMA_8ByteBurst);
STUARTM$TxDMAChannel$setTransferWidth(DMA_4ByteWidth);
}
#line 114
static inline result_t STUARTM$openTxPort(bool bTxDMAIntEnable)
#line 114
{
result_t status = SUCCESS;
/* atomic removed: atomic calls only */
#line 118
{
if (STUARTM$gTxPortInUse == TRUE) {
status = FAIL;
}
else {
STUARTM$gTxPortInUse = TRUE;
}
}
if (status == FAIL) {
return FAIL;
}
if (STUARTM$gPortInitialized == FALSE) {
STUARTM$initPort();
STUARTM$gPortInitialized = TRUE;
}
/* atomic removed: atomic calls only */
{
if (STUARTM$gRxPortInUse == FALSE) {
STUARTM$configPort();
}
}
return SUCCESS;
}
#line 335
static inline result_t STUARTM$BulkTxRx$BulkTransmit(uint8_t *TxBuffer, uint16_t NumBytes)
#line 335
{
if (!TxBuffer || !NumBytes) {
return FAIL;
}
if (STUARTM$openTxPort(TRUE) == FAIL) {
return FAIL;
}
/* atomic removed: atomic calls only */
{
STUARTM$gTxBuffer = TxBuffer;
STUARTM$gTxNumBytes = NumBytes;
STUARTM$gTxBufferPos = 0;
}
STUARTM$configureTxDMA(TxBuffer, NumBytes);
STUARTM$TxDMAChannel$requestChannel(DMAID_STUART_TX, DMA_Priority4, FALSE);
return SUCCESS;
}
# 35 "/opt/tinyos-1.x/tos/platform/imote2/BulkTxRx.nc"
inline static result_t BufferedSTUARTM$BulkTxRx$BulkTransmit(uint8_t *arg_0x404f4600, uint16_t arg_0x404f4798){
#line 35
unsigned char result;
#line 35
#line 35
result = STUARTM$BulkTxRx$BulkTransmit(arg_0x404f4600, arg_0x404f4798);
#line 35
#line 35
return result;
#line 35
}
#line 35
# 462 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static inline result_t BluSHM$UartSend$sendDone(uint8_t *packet, uint32_t numBytes, result_t success)
{
return SUCCESS;
}
# 62 "/opt/tinyos-1.x/tos/platform/imote2/SendData.nc"
inline static result_t BufferedSTUARTM$SendData$sendDone(uint8_t *arg_0x404e11a8, uint32_t arg_0x404e1340, result_t arg_0x404e14d0){
#line 62
unsigned char result;
#line 62
#line 62
result = BluSHM$UartSend$sendDone(arg_0x404e11a8, arg_0x404e1340, arg_0x404e14d0);
#line 62
#line 62
return result;
#line 62
}
#line 62
# 122 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static inline result_t BufferedSTUARTM$SendDataAlloc$default$sendDone(uint8_t *data, uint32_t numBytes, result_t success)
#line 122
{
return success;
}
# 47 "/opt/tinyos-1.x/tos/platform/imote2/SendDataAlloc.nc"
inline static result_t BufferedSTUARTM$SendDataAlloc$sendDone(uint8_t *arg_0x404dd010, uint32_t arg_0x404dd1a8, result_t arg_0x404dd338){
#line 47
unsigned char result;
#line 47
#line 47
result = BufferedSTUARTM$SendDataAlloc$default$sendDone(arg_0x404dd010, arg_0x404dd1a8, arg_0x404dd338);
#line 47
#line 47
return result;
#line 47
}
#line 47
# 192 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static inline void BufferedSTUARTM$transmitDone(uint32_t arg)
#line 192
{
int status;
bufferInfo_t *pBI = (bufferInfo_t *)arg;
switch (pBI->origin) {
case BufferedSTUARTM$originSendDataAlloc:
BufferedSTUARTM$SendDataAlloc$sendDone(pBI->pBuf, pBI->numBytes, SUCCESS);
break;
case BufferedSTUARTM$originSendData:
BufferedSTUARTM$SendData$sendDone(pBI->pBuf, pBI->numBytes, SUCCESS);
safe_free(pBI->pBuf);
break;
default:
printFatalErrorMsg("BufferedUart.c found unknown interface origin = ", pBI->origin);
}
safe_free(pBI);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 211
{
pBI = peekptrqueue(&outgoingQueue, &status);
if (status == 1) {
BufferedSTUARTM$BulkTxRx$BulkTransmit(pBI->pBuf, pBI->numBytes);
}
else {
BufferedSTUARTM$gTxActive = FALSE;
}
}
#line 220
__nesc_atomic_end(__nesc_atomic); }
}
#line 19
static inline void BufferedSTUARTM$_transmitDoneveneer(void)
#line 19
{
#line 19
uint32_t argument;
#line 19
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 19
{
#line 19
popqueue(¶mtaskQueue, &argument);
}
#line 20
__nesc_atomic_end(__nesc_atomic); }
#line 19
BufferedSTUARTM$transmitDone(argument);
}
# 359 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static inline void PXA27XInterruptM$PXA27XFiq$default$fired(uint8_t id)
{
return;
}
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterrupt.nc"
inline static void PXA27XInterruptM$PXA27XFiq$fired(uint8_t arg_0x405de5d0){
#line 48
PXA27XInterruptM$PXA27XFiq$default$fired(arg_0x405de5d0);
#line 48
}
#line 48
# 144 "/home/xu/oasis/lib/SmartSensing/ProcessTasks.h"
static inline void StaLtaFunc2(uint32_t rsamvalue, uint32_t curTime)
#line 144
{
static uint32_t RSAMBuffer[MAX_RSAM_WIN_SIZE];
static uint32_t STA = 0;
static uint32_t LTA = 0;
static uint8_t curInd = 0;
static bool frozen_lta = FALSE;
int8_t staTailInd = 0;
int8_t ltaTailInd = 0;
int32_t delta = 0;
RSAMBuffer[curInd] = rsamvalue;
staTailInd = curInd - sta_period;
ltaTailInd = curInd - lta_period;
if (staTailInd < 0) {
staTailInd += MAX_RSAM_WIN_SIZE;
}
if (ltaTailInd < 0) {
ltaTailInd += MAX_RSAM_WIN_SIZE;
}
if (frozen_lta != TRUE) {
delta = (int32_t )(RSAMBuffer[curInd] - RSAMBuffer[ltaTailInd]) / lta_period;
if (delta < 0) {
if (LTA <= (uint32_t )-delta) {
LTA = 0;
}
else {
LTA += delta;
}
}
else {
LTA += delta;
}
}
delta = (int32_t )(RSAMBuffer[curInd] - RSAMBuffer[staTailInd]) / sta_period;
if (delta < 0) {
if (STA <= (uint32_t )-delta) {
STA = 0;
}
else {
STA += delta;
}
}
else {
STA += delta;
}
if (STA >> 1UL > LTA) {
if (TRUE != event_trigger) {
if (curTime > 2000UL) {
start_point = curTime - 2000UL;
}
end_point = curTime + ONE_MS;
event_trigger = TRUE;
event_onset = TRUE;
}
else {
end_point += ONE_MS;
}
}
else {
if (FALSE != event_trigger) {
end_point = curTime + 200UL;
event_trigger = FALSE;
frozen_lta = FALSE;
}
}
if (++curInd == MAX_RSAM_WIN_SIZE) {
curInd = 0;
}
}
# 713 "/home/xu/oasis/lib/SmartSensing/Compress.h"
static inline int reconquantized_r(int quantizedvalue, int resolutionbits)
#line 713
{
int reconvalue_r;
if (quantizedvalue) {
if (quantizedvalue < 0) {
reconvalue_r = -(-quantizedvalue << (14 + 16 - resolutionbits));
}
else {
#line 720
reconvalue_r = quantizedvalue << (14 + 16 - resolutionbits);
}
}
else {
#line 722
reconvalue_r = 0;
}
return reconvalue_r;
}
#line 368
static inline int quantize(int number_r, int resolutionbits)
#line 368
{
int nearhalf = (1 << (14 + 16 - resolutionbits - 1)) - 1;
int quantresult;
if (number_r < 0) {
quantresult = -((-number_r + nearhalf) >> (14 + 16 - resolutionbits));
}
else {
#line 375
quantresult = (number_r + nearhalf) >> (14 + 16 - resolutionbits);
}
return quantresult;
}
#line 351
static inline int biasquantencode_r(int thebiasestimate_r)
#line 351
{
int newbiasestimate_r;
int biasquantized;
biasquantized = quantize(thebiasestimate_r, biasquantbits);
writesignmagnitude(biasquantized, biasquantbits);
newbiasestimate_r = reconquantized_r(biasquantized, biasquantbits);
return newbiasestimate_r;
}
#line 412
static inline void weightquantencode(void )
#line 412
{
int i;
#line 413
int thismagnitude;
int weightqshift = 14 + capexponent - weightquantbits + 1;
int halfq;
int quantindex;
int NormalFlag;
#line 417
int lastsign;
halfq = (1 << (weightqshift - 1)) - 1;
for (i = 0; i < 3; i++) {
if (weight_r[i] < 0) {
thismagnitude = -weight_r[i];
quantindex = -((thismagnitude + halfq) >> weightqshift);
quantindex = (thismagnitude + halfq) >> weightqshift;
if (quantindex >= 1 << (weightquantbits - 1)) {
quantindex = (1 << (weightquantbits - 1)) - 1;
}
#line 430
quantindex = -quantindex;
}
else
#line 431
{
thismagnitude = weight_r[i];
quantindex = (thismagnitude + halfq) >> weightqshift;
if (quantindex >= 1 << (weightquantbits - 1)) {
quantindex = (1 << (weightquantbits - 1)) - 1;
}
}
weightquant[i] = quantindex;
if (quantindex > 0) {
weight_r[i] = quantindex << weightqshift;
}
else {
#line 447
if (quantindex < 0) {
weight_r[i] = -(-quantindex << weightqshift);
}
else {
weight_r[i] = 0;
}
}
}
#line 471
NormalFlag = TRUE;
lastsign = 1;
for (i = 0; i < 3; i++) {
if (lastsign * weightquant[i] < 0) {
NormalFlag = FALSE;
}
#line 476
lastsign = -lastsign;
}
lastsign = 1;
for (i = 1; i < 3; i++) {
if (lastsign * weightquant[i - 1] < -lastsign * weightquant[i]) {
NormalFlag = FALSE;
}
#line 482
lastsign = -lastsign;
}
if (NormalFlag) {
int magnitude;
#line 487
int magnitudebits;
writebit(0);
weightquantcost = 1;
lastsign = 1;
magnitudebits = weightquantbits - 1;
for (i = 0; i < 3; i++) {
magnitude = lastsign * weightquant[i];
writeunsignedint(magnitude, magnitudebits);
weightquantcost += magnitudebits;
lastsign = -lastsign;
magnitudebits = 0;
while (magnitude > 0) {
magnitude >>= 1;
magnitudebits++;
}
if (magnitudebits == 0) {
magnitudebits = 1;
}
}
}
else
#line 507
{
writebit(1);
for (i = 0; i < 3; i++)
writesignmagnitude(weightquant[i], weightquantbits);
weightquantcost = 1 + weightquantbits * 3;
}
}
#line 574
static inline int32_t codechoice(int32_t foldedsum, int32_t numfoldedvals)
#line 574
{
int32_t k;
#line 575
int32_t foldvalue;
if (foldedsum > numfoldedvals * meancutoff[16]) {
return -1;
}
foldvalue = (foldedsum << 7) + numfoldedvals * 49;
for (k = 0; numfoldedvals << (k + 8) <= foldvalue; k++)
;
if (k > 16 - 2) {
k = 16 - 2;
}
return k;
}
#line 636
static inline void encodevalue(uint16_t thevalue, int32_t thecodeparameter)
#line 636
{
int32_t i;
if (thecodeparameter == -1) {
for (i = 0; i < 16; i++)
writebit(thevalue & (1 << i));
}
else {
for (i = 0; i < thevalue >> thecodeparameter; i++) {
writebit(0);
}
writebit(1);
for (i = 0; i < thecodeparameter; i++) {
writebit(thevalue & (1 << i));
}
}
}
static inline void sendpacket(void )
#line 659
{
while (packetbytepointer < 56) {
writebit(0);
}
packetbitpointer = 0;
packetbytepointer = 0;
}
# 119 "/opt/tinyos-1.x/tos/platform/imote2/sched.c"
bool TOS_post(void (*tp)(void))
#line 119
{
__nesc_atomic_t fInterruptFlags;
uint8_t tmp;
fInterruptFlags = __nesc_atomic_start();
tmp = TOSH_sched_free;
if (TOSH_queue[tmp].tp == NULL) {
TOSH_sched_free = (tmp + 1) & TOSH_TASK_BITMASK;
TOSH_queue[tmp].tp = tp;
TOSH_queue[tmp].postingFunction = (void *)__builtin_return_address(0);
TOSH_queue[tmp].timestamp = * (volatile uint32_t *)0x40A00010;
__nesc_atomic_end(fInterruptFlags);
return TRUE;
}
else {
__nesc_atomic_end(fInterruptFlags);
printFatalErrorMsg("TaskQueue Full. Size = ", 1, TOSH_MAX_TASKS);
return FALSE;
}
}
# 54 "/opt/tinyos-1.x/tos/system/RealMain.nc"
int main(void)
#line 54
{
RealMain$hardwareInit();
RealMain$Pot$init(10);
TOSH_sched_init();
RealMain$StdControl$init();
RealMain$StdControl$start();
__nesc_enable_interrupt();
while (1) {
TOSH_run_task();
}
}
# 58 "/opt/tinyos-1.x/tos/platform/imote2/DVFSM.nc"
static result_t DVFSM$DVFS$SwitchCoreFreq(uint32_t coreFreq, uint32_t sysBusFreq)
#line 58
{
uint32_t clkcfg;
uint32_t cccr;
switch (coreFreq) {
case 13:
if (sysBusFreq != 13) {
return FAIL;
}
DVFSM$PMIC$setCoreVoltage(0x4);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 73
{
* (volatile uint32_t *)0x41300000 = (1 << 31) | (1 << 25);
__asm volatile (
"mcr p14,0,%0,c6,c0,0\n\t" : :
"r"(0x2));
while ((* (volatile uint32_t *)0x4130000C & (1 << 31)) == 0) ;
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
case 104:
if (sysBusFreq != 104) {
return FAIL;
}
DVFSM$PMIC$setCoreVoltage(0x4);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 91
{
* (volatile uint32_t *)0x41300000 = ((8 & 0x1F) | ((2 & 0xF) << 7)) | (1 << 25);
__asm volatile (
"mcr p14,0,%0,c6,c0,0\n\t" : :
"r"(0xb));
while ((* (volatile uint32_t *)0x4130000C & (1 << 29)) == 0) ;
}
#line 101
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
case 208:
switch (sysBusFreq) {
case 104:
clkcfg = 1 | (1 << 1);
cccr = 0;
if (DVFSM$PMIC$setCoreVoltage(0x8) != SUCCESS) {
return FAIL;
}
break;
case 208:
clkcfg = (1 | (1 << 3)) | (1 << 1);
cccr = 1 << 25;
if (DVFSM$PMIC$setCoreVoltage(0xE) != SUCCESS) {
return FAIL;
}
break;
default:
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 131
{
* (volatile uint32_t *)0x41300000 = ((16 & 0x1F) | ((2 & 0xF) << 7)) | cccr;
__asm volatile (
"mcr p14,0,%0,c6,c0,0\n\t" : :
"r"(clkcfg));
while ((* (volatile uint32_t *)0x4130000C & (1 << 29)) == 0) ;
}
#line 141
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
case 416:
if (sysBusFreq != 208) {
trace(DBG_TEMP, "Fail bus freq %d\r\n", sysBusFreq);
return FAIL;
}
if (DVFSM$PMIC$setCoreVoltage(0x14) != SUCCESS) {
return FAIL;
}
clkcfg = (1 | (1 << 3)) | (1 << 1);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 157
{
* (volatile uint32_t *)0x41300000 = ((16 & 0x1F) | ((4 & 0xF) << 7)) | (1 << 25);
__asm volatile (
"mcr p14,0,%0,c6,c0,0\n\t" : :
"r"(clkcfg));
while ((* (volatile uint32_t *)0x4130000C & (1 << 29)) == 0) ;
}
#line 167
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
default:
return FAIL;
}
}
# 538 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static result_t PMICM$PMIC$setCoreVoltage(uint8_t trimValue)
#line 538
{
PMICM$StdControl$init();
return PMICM$writePMIC(0x15, (trimValue & 0x1f) | 0x80);
}
#line 146
static result_t PMICM$StdControl$init(void)
#line 146
{
static bool init = 0;
if (init == 0) {
* (volatile uint32_t *)0x41300004 |= 1 << 15;
* (volatile uint32_t *)0x40F0001C |= 1 << 6;
* (volatile uint32_t *)0x40F00190 = (1 << 6) | (1 << 5);
PMICM$TOSH_MAKE_PMIC_TXON_OUTPUT();
PMICM$TOSH_CLR_PMIC_TXON_PIN();
PMICM$GPIOIRQControl$init();
init = 1;
PMICM$Leds$init();
return PMICM$PI2CInterrupt$allocate();
}
else {
return SUCCESS;
}
}
# 59 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static result_t PXA27XGPIOIntM$StdControl$init(void)
#line 59
{
bool isInited;
#line 61
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 61
{
isInited = PXA27XGPIOIntM$gfInitialized;
PXA27XGPIOIntM$gfInitialized = TRUE;
}
#line 64
__nesc_atomic_end(__nesc_atomic); }
if (!isInited) {
PXA27XGPIOIntM$GPIOIrq0$allocate();
PXA27XGPIOIntM$GPIOIrq1$allocate();
PXA27XGPIOIntM$GPIOIrq$allocate();
}
return SUCCESS;
}
# 226 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static result_t PXA27XInterruptM$allocate(uint8_t id, bool level, uint8_t priority)
{
uint32_t tmp;
result_t result = FAIL;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 231
{
uint8_t i;
#line 233
if (PXA27XInterruptM$usedPriorities == 0) {
uint8_t PriorityTable[40];
#line 234
uint8_t DuplicateTable[40];
#line 235
for (i = 0; i < 40; i++) {
DuplicateTable[i] = PriorityTable[i] = 0xFF;
}
for (i = 0; i < 40; i++)
if (TOSH_IRP_TABLE[i] != 0xff) {
if (PriorityTable[TOSH_IRP_TABLE[i]] != 0xFF) {
DuplicateTable[i] = PriorityTable[TOSH_IRP_TABLE[i]];
}
else {
#line 246
PriorityTable[TOSH_IRP_TABLE[i]] = i;
}
}
for (i = 0; i < 40; i++) {
if (PriorityTable[i] != 0xff) {
PriorityTable[PXA27XInterruptM$usedPriorities] = PriorityTable[i];
if (i != PXA27XInterruptM$usedPriorities) {
PriorityTable[i] = 0xFF;
}
#line 255
PXA27XInterruptM$usedPriorities++;
}
}
for (i = 0; i < 40; i++)
if (DuplicateTable[i] != 0xFF) {
uint8_t j;
#line 261
uint8_t ExtraTable[40];
#line 262
for (j = 0; DuplicateTable[i] != PriorityTable[j]; j++) ;
nmemcpy(ExtraTable + j + 1, PriorityTable + j, PXA27XInterruptM$usedPriorities - j);
nmemcpy(PriorityTable + j + 1, ExtraTable + j + 1,
PXA27XInterruptM$usedPriorities - j);
PriorityTable[j] = i;
PXA27XInterruptM$usedPriorities++;
}
for (i = 0; i < PXA27XInterruptM$usedPriorities; i++) {
* (volatile uint32_t *)(0x40D0001C + (i < 32 ? i * 4 : i * 4 + 20)) = (1 << 31) | PriorityTable[i];
tmp = * (volatile uint32_t *)(0x40D0001C + (i < 32 ? i * 4 : i * 4 + 20));
}
}
if (id < 34) {
if (priority == 0xff) {
priority = PXA27XInterruptM$usedPriorities;
PXA27XInterruptM$usedPriorities++;
* (volatile uint32_t *)(0x40D0001C + (priority < 32 ? priority * 4 : priority * 4 + 20)) = (1 << 31) | id;
tmp = * (volatile uint32_t *)(0x40D0001C + (priority < 32 ? priority * 4 : priority * 4 + 20));
}
if (level) {
* (volatile uint32_t *)(0x40D00008 + (id < 32 ? 0 : 0x9c)) |= 1 << id % 32;
tmp = * (volatile uint32_t *)(0x40D00008 + (id < 32 ? 0 : 0x9c));
}
result = SUCCESS;
}
}
#line 290
__nesc_atomic_end(__nesc_atomic); }
return result;
}
# 149 "/opt/tinyos-1.x/tos/system/tos.h"
static void *nmemcpy(void *to, const void *from, size_t n)
{
char *cto = to;
const char *cfrom = from;
while (n--) * cto++ = * cfrom++;
return to;
}
# 315 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static result_t PMICM$writePMIC(uint8_t address, uint8_t value)
#line 315
{
uint32_t loopCount;
if (PMICM$getPI2CBus() == FALSE) {
return FAIL;
}
* (volatile uint32_t *)0x40F00188 = 0x49 << 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 0;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printWritePMICSlaveAddressError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00188 = address;
* (volatile uint32_t *)0x40F00190 &= ~(1 << 0);
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printWritePMICRegisterAddressError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00188 = value;
* (volatile uint32_t *)0x40F00190 |= 1 << 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printWritePMICWriteError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00190 &= ~(1 << 1);
PMICM$returnPI2CBus();
return SUCCESS;
}
#line 107
static bool PMICM$getPI2CBus(void)
#line 107
{
if (PMICM$accessingPMIC == FALSE) {
PMICM$accessingPMIC = TRUE;
return TRUE;
}
else {
trace(DBG_USR1, "FATAL ERROR: Contention Error encountered while acquiring PI2C Bus\r\n");
return FALSE;
}
}
# 73 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
void trace(long long mode, const char *format, ...)
#line 73
{
if (trace_active(mode)) {
char buf[200 + 1];
uint16_t buflen = 0;
BluSHM$va_list args;
__builtin_va_start(args, format);
if (!(mode & (1ull << 21))) {
buflen = vsnprintf(buf, 200, format, args);
buflen = buflen >= 200 ? 200 : buflen;
buf[200] = 0;
generalSend(buf, buflen);
}
}
}
unsigned char trace_active(long long mode)
#line 90
{
unsigned char result;
#line 92
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 92
result = (BluSHM$trace_modes & mode) != 0;
#line 92
__nesc_atomic_end(__nesc_atomic); }
return result;
}
static void generalSend(uint8_t *buf, uint32_t buflen)
#line 105
{
BluSHM$DynQueue QueueTemp;
uint8_t *tempBuf;
BluSHdata temp;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 112
QueueTemp = BluSHM$OutQueue;
#line 112
__nesc_atomic_end(__nesc_atomic); }
temp = (BluSHdata )safe_malloc(sizeof(BluSHdata_t ));
tempBuf = (uint8_t *)safe_malloc(buflen);
nmemcpy(tempBuf, buf, buflen);
temp->src = tempBuf;
temp->len = buflen;
if (BluSHM$USBSend$send(tempBuf, buflen, 3) == SUCCESS) {
temp->state = 0;
BluSHM$DynQueue_enqueue(QueueTemp, temp);
}
else {
safe_free(tempBuf);
safe_free(temp);
}
}
# 135 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static int PXA27XUSBClientM$DynQueue_enqueue(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem)
{
if (oDynQueue == (void *)0) {
return 0;
}
if (oDynQueue->iLength + oDynQueue->index == oDynQueue->iPhysLength) {
PXA27XUSBClientM$DynQueue_shiftgrow(oDynQueue);
}
oDynQueue->ppvQueue[oDynQueue->index + oDynQueue->iLength] = pvItem;
oDynQueue->iLength++;
return oDynQueue->iLength;
}
#line 90
static void PXA27XUSBClientM$DynQueue_shiftgrow(PXA27XUSBClientM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0) {
return;
}
if (oDynQueue->index > 2 && oDynQueue->index > oDynQueue->iPhysLength / 8) {
memmove((void *)oDynQueue->ppvQueue, (void *)(oDynQueue->ppvQueue + oDynQueue->index), sizeof(void *) * oDynQueue->iLength);
oDynQueue->index = 0;
}
else {
oDynQueue->iPhysLength *= 2;
oDynQueue->ppvQueue = (const void **)safe_realloc(oDynQueue->ppvQueue,
sizeof(void *) * oDynQueue->iPhysLength);
}
}
# 833 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$sendIn(void)
#line 833
{
uint16_t i = 0;
uint8_t buf[64];
uint8_t valid;
PXA27XUSBClientM$DynQueue QueueTemp;
PXA27XUSBClientM$USBdata InStateTemp;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 843
QueueTemp = PXA27XUSBClientM$InQueue;
#line 843
__nesc_atomic_end(__nesc_atomic); }
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) <= 0) {
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 847
{
PXA27XUSBClientM$InState = (PXA27XUSBClientM$USBdata )PXA27XUSBClientM$DynQueue_peek(QueueTemp);
PXA27XUSBClientM$InState->status |= 1 << (1 & 0x1f);
InStateTemp = PXA27XUSBClientM$InState;
}
#line 851
__nesc_atomic_end(__nesc_atomic); }
if ((uint32_t )InStateTemp->param != 1) {
PXA27XUSBClientM$sendControlIn();
return;
}
if (InStateTemp->pindex <= InStateTemp->n) {
if (((InStateTemp->type >> 2) & 0x3) == 0) {
buf[0] = InStateTemp->type;
if (InStateTemp->pindex == 0) {
buf[0] |= 1 << (4 & 0x1f);
buf[1] = InStateTemp->n;
}
else {
buf[1] = InStateTemp->pindex;
}
if (InStateTemp->pindex == InStateTemp->n) {
valid = (uint8_t )(InStateTemp->len % 62);
buf[1 + 1] = valid;
}
else {
valid = (uint8_t )62;
}
#line 874
nmemcpy(buf + 1 + 1 + (InStateTemp->pindex == InStateTemp->n ? 1 : 0),
InStateTemp->src + InStateTemp->pindex * 62, valid);
}
else {
#line 877
if (((InStateTemp->type >> 2) & 0x3) ==
1) {
buf[0] = InStateTemp->type;
if (InStateTemp->pindex == 0) {
buf[0] |= 1 << (4 & 0x1f);
buf[1] = (uint8_t )(InStateTemp->n >> 8);
buf[1 + 1] = (uint8_t )InStateTemp->n;
}
else {
buf[1] = (uint8_t )(InStateTemp->pindex >> 8);
buf[1 + 1] = (uint8_t )InStateTemp->pindex;
}
if (InStateTemp->pindex == InStateTemp->n) {
valid = (uint8_t )(InStateTemp->len % 61);
buf[1 + 2] = valid;
}
else {
valid = (uint8_t )61;
}
#line 896
nmemcpy(buf + 1 + 2 + (InStateTemp->pindex == InStateTemp->n ? 1 : 0),
InStateTemp->src + InStateTemp->pindex * 61, valid);
}
else {
#line 899
if (((InStateTemp->type >> 2) & 0x3) ==
2) {
buf[0] = InStateTemp->type;
if (InStateTemp->pindex == 0) {
buf[0] |= 1 << (4 & 0x1f);
buf[1] = (uint8_t )(InStateTemp->n >> 24);
buf[1 + 1] = (uint8_t )(InStateTemp->n >> 16);
buf[1 + 2] = (uint8_t )(InStateTemp->n >> 8);
buf[1 + 3] = (uint8_t )InStateTemp->n;
}
else {
buf[1] = (uint8_t )(InStateTemp->pindex >> 24);
buf[1 + 1] = (uint8_t )(InStateTemp->pindex >> 16);
buf[1 + 2] = (uint8_t )(InStateTemp->pindex >> 8);
buf[1 + 3] = (uint8_t )InStateTemp->pindex;
}
if (InStateTemp->pindex == InStateTemp->n) {
valid = (uint8_t )(InStateTemp->len % 59);
buf[1 + 4] = valid;
}
else {
valid = (uint8_t )59;
}
#line 922
nmemcpy(buf + 1 + 4 + (InStateTemp->pindex ==
InStateTemp->n ? 1 : 0),
InStateTemp->src + InStateTemp->pindex *
59, valid);
}
}
}
}
#line 927
{
InStateTemp->pindex++;
if (InStateTemp->index < InStateTemp->tlen) {
while (i < InStateTemp->fifosize) {
* (volatile uint32_t *)InStateTemp->endpointDR = * (uint32_t *)(buf + i);
InStateTemp->index += 4;
i += 4;
}
}
if (InStateTemp->index >= InStateTemp->tlen && InStateTemp->index % InStateTemp->fifosize != 0) {
if (i < InStateTemp->fifosize) {
* (volatile uint32_t *)(InStateTemp->endpointDR - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |= 1 << ((InStateTemp->endpointDR == (volatile unsigned long *const )0x40600300 ? 1 : 7) & 0x1f);
}
#line 939
InStateTemp->status &= ~(1 << (1 & 0x1f));
}
else {
#line 941
if (InStateTemp->index >= InStateTemp->tlen && InStateTemp->index % InStateTemp->fifosize == 0) {
InStateTemp->index++;
}
}
}
}
# 78 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static void *PXA27XUSBClientM$DynQueue_peek(PXA27XUSBClientM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0 || oDynQueue->iLength <= 0) {
return (void *)0;
}
#line 85
return (void *)oDynQueue->ppvQueue[oDynQueue->index];
}
# 947 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$sendControlIn(void)
#line 947
{
uint16_t i = 0;
PXA27XUSBClientM$DynQueue QueueTemp;
PXA27XUSBClientM$USBdata InStateTemp;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 952
QueueTemp = PXA27XUSBClientM$InQueue;
#line 952
__nesc_atomic_end(__nesc_atomic); }
if (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) <= 0) {
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 956
PXA27XUSBClientM$InState = (PXA27XUSBClientM$USBdata )PXA27XUSBClientM$DynQueue_peek(QueueTemp);
#line 956
__nesc_atomic_end(__nesc_atomic); }
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 957
InStateTemp = PXA27XUSBClientM$InState;
#line 957
__nesc_atomic_end(__nesc_atomic); }
if ((uint32_t )InStateTemp->param != 0) {
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 961
PXA27XUSBClientM$InState->status |= 1 << (1 & 0x1f);
#line 961
__nesc_atomic_end(__nesc_atomic); }
{
while (InStateTemp->index < InStateTemp->len &&
i < InStateTemp->fifosize) {
if (InStateTemp->len - InStateTemp->index > 3 &&
InStateTemp->fifosize - i > 3) {
* (volatile uint32_t *)InStateTemp->endpointDR = * (uint32_t *)(InStateTemp->src +
InStateTemp->index);
InStateTemp->index += 4;
i += 4;
}
else {
* (volatile uint8_t *)InStateTemp->endpointDR = *(InStateTemp->src + InStateTemp->index);
InStateTemp->index++;
i++;
}
}
if (InStateTemp->index >= InStateTemp->len &&
InStateTemp->index % InStateTemp->fifosize != 0) {
if (i < InStateTemp->fifosize) {
* (volatile uint32_t *)(InStateTemp->endpointDR - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |=
1 << ((InStateTemp->endpointDR == (volatile unsigned long *const )0x40600300 ? 1 : 7) & 0x1f);
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 985
PXA27XUSBClientM$InState->status &= ~(1 << (1 & 0x1f));
#line 985
__nesc_atomic_end(__nesc_atomic); }
}
else {
#line 987
if (InStateTemp->index == InStateTemp->len &&
InStateTemp->index % InStateTemp->fifosize == 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 989
PXA27XUSBClientM$InState->index++;
#line 989
__nesc_atomic_end(__nesc_atomic); }
}
}
}
}
# 135 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static int BluSHM$DynQueue_enqueue(BluSHM$DynQueue oDynQueue, const void *pvItem)
{
if (oDynQueue == (void *)0) {
return 0;
}
if (oDynQueue->iLength + oDynQueue->index == oDynQueue->iPhysLength) {
BluSHM$DynQueue_shiftgrow(oDynQueue);
}
oDynQueue->ppvQueue[oDynQueue->index + oDynQueue->iLength] = pvItem;
oDynQueue->iLength++;
return oDynQueue->iLength;
}
#line 25
static PXA27XUSBClientM$DynQueue PXA27XUSBClientM$DynQueue_new(void)
{
PXA27XUSBClientM$DynQueue oDynQueue;
oDynQueue = (PXA27XUSBClientM$DynQueue )safe_malloc(sizeof(struct PXA27XUSBClientM$DynQueue_T ));
if (oDynQueue == (void *)0) {
return (void *)0;
}
oDynQueue->iLength = 0;
oDynQueue->iPhysLength = 2;
oDynQueue->ppvQueue =
(const void **)safe_calloc(oDynQueue->iPhysLength, sizeof(void *));
if (oDynQueue->ppvQueue == (void *)0) {
return (void *)0;
}
oDynQueue->index = 0;
return oDynQueue;
}
# 88 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$enable(uint8_t pin, uint8_t mode)
{
if (pin < 121) {
switch (mode) {
case 1:
* (volatile uint32_t *)(0x40E00030 + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (pin & 0x1f);
* (volatile uint32_t *)(0x40E0003C + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (pin & 0x1f));
break;
case 2:
* (volatile uint32_t *)(0x40E00030 + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (pin & 0x1f));
* (volatile uint32_t *)(0x40E0003C + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (pin & 0x1f);
break;
case 3:
* (volatile uint32_t *)(0x40E00030 + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (pin & 0x1f);
* (volatile uint32_t *)(0x40E0003C + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) |= 1 << (pin & 0x1f);
break;
default:
break;
}
}
return;
}
# 993 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$isAttached(void)
#line 993
{
uint8_t statetemp;
if (PXA27XUSBClientM$HPLUSBClientGPIO$checkConnection() == SUCCESS) {
* (volatile uint32_t *)0x40600000 |= 1 << (((1 << 0) - 1) & 0x1f);
}
if ((* (volatile uint32_t *)0x40600000 & (1 << (3 & 0x1f))) != 0) {
;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1010
statetemp = PXA27XUSBClientM$state;
#line 1010
__nesc_atomic_end(__nesc_atomic); }
if (statetemp == 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1012
PXA27XUSBClientM$state = 1;
#line 1012
__nesc_atomic_end(__nesc_atomic); }
}
else
#line 1013
{
* (volatile uint32_t *)0x40600000 &= ~(1 << ((1 << 0) & 0x1f));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1018
PXA27XUSBClientM$state = 0;
#line 1018
__nesc_atomic_end(__nesc_atomic); }
PXA27XUSBClientM$clearIn();
PXA27XUSBClientM$clearOut();
}
}
#line 1417
static void PXA27XUSBClientM$clearIn(void)
#line 1417
{
PXA27XUSBClientM$DynQueue QueueTemp;
#line 1419
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1419
QueueTemp = PXA27XUSBClientM$InQueue;
#line 1419
__nesc_atomic_end(__nesc_atomic); }
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1420
{
while (PXA27XUSBClientM$DynQueue_getLength(QueueTemp) > 0) {
uint8_t temp;
#line 1423
PXA27XUSBClientM$InState = (PXA27XUSBClientM$USBdata )PXA27XUSBClientM$DynQueue_dequeue(QueueTemp);
temp = (uint32_t )PXA27XUSBClientM$InState->param == 1;
PXA27XUSBClientM$clearUSBdata(PXA27XUSBClientM$InState, temp);
}
PXA27XUSBClientM$InState = (void *)0;
PXA27XUSBClientM$InTask = 0;
}
#line 1429
__nesc_atomic_end(__nesc_atomic); }
}
# 153 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static void *PXA27XUSBClientM$DynQueue_dequeue(PXA27XUSBClientM$DynQueue oDynQueue)
{
const void *pvItem;
if (oDynQueue == (void *)0 || oDynQueue->iLength <= 0) {
return (void *)0;
}
pvItem = oDynQueue->ppvQueue[oDynQueue->index];
oDynQueue->ppvQueue[oDynQueue->index] = (void *)0;
oDynQueue->iLength--;
oDynQueue->index++;
if (oDynQueue->iLength + 5 < oDynQueue->iPhysLength / 2) {
PXA27XUSBClientM$DynQueue_shiftshrink(oDynQueue);
}
#line 171
return (void *)pvItem;
}
# 1432 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$clearUSBdata(PXA27XUSBClientM$USBdata Stream, uint8_t isConst)
#line 1432
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1433
{
if (isConst == 0) {
safe_free(Stream->src);
}
#line 1436
Stream->src = (void *)0;
safe_free(Stream);
Stream = (void *)0;
}
#line 1439
__nesc_atomic_end(__nesc_atomic); }
}
static void PXA27XUSBClientM$clearOut(void)
#line 1442
{
uint8_t i;
#line 1444
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 1444
{
for (i = 0; i < 4; i++) {
safe_free(PXA27XUSBClientM$OutStream[i].src);
PXA27XUSBClientM$OutStream[i].endpointDR = (void *)0;
PXA27XUSBClientM$OutStream[i].src = (void *)0;
PXA27XUSBClientM$OutStream[i].status = 0;
PXA27XUSBClientM$OutStream[i].type = 0;
PXA27XUSBClientM$OutStream[i].index = 0;
PXA27XUSBClientM$OutStream[i].n = 0;
PXA27XUSBClientM$OutStream[i].len = 0;
}
}
#line 1455
__nesc_atomic_end(__nesc_atomic); }
}
# 100 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
void trace_set(long long mode)
#line 100
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 101
BluSHM$trace_modes = mode;
#line 101
__nesc_atomic_end(__nesc_atomic); }
}
# 25 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static BluSHM$DynQueue BluSHM$DynQueue_new(void)
{
BluSHM$DynQueue oDynQueue;
oDynQueue = (BluSHM$DynQueue )safe_malloc(sizeof(struct BluSHM$DynQueue_T ));
if (oDynQueue == (void *)0) {
return (void *)0;
}
oDynQueue->iLength = 0;
oDynQueue->iPhysLength = 2;
oDynQueue->ppvQueue =
(const void **)safe_calloc(oDynQueue->iPhysLength, sizeof(void *));
if (oDynQueue->ppvQueue == (void *)0) {
return (void *)0;
}
oDynQueue->index = 0;
return oDynQueue;
}
# 90 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static result_t ADCM$ADCControl$init(void)
#line 90
{
uint8_t i = 0;
#line 92
if (ADCM$initialized != TRUE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 93
{
{
#line 94
* (volatile uint32_t *)(0x40E0000C + (23 < 96 ? ((23 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (23 < 96 ? ((23 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (23 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (23 < 96 ? ((23 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (23 & 0x1f));
#line 94
* (volatile uint32_t *)(0x40E00054 + ((23 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((23 & 0x7f) >> 4) * 4) & ~(3 << (23 & 0xf) * 2)) | (2 << (23 & 0xf) * 2);
}
#line 94
;
{
#line 95
* (volatile uint32_t *)(0x40E0000C + (25 < 96 ? ((25 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (25 < 96 ? ((25 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (25 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (25 < 96 ? ((25 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (25 & 0x1f));
#line 95
* (volatile uint32_t *)(0x40E00054 + ((25 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((25 & 0x7f) >> 4) * 4) & ~(3 << (25 & 0xf) * 2)) | (2 << (25 & 0xf) * 2);
}
#line 95
;
{
#line 96
* (volatile uint32_t *)(0x40E0000C + (26 < 96 ? ((26 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (26 < 96 ? ((26 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (26 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (26 < 96 ? ((26 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (26 & 0x1f));
#line 96
* (volatile uint32_t *)(0x40E00054 + ((26 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((26 & 0x7f) >> 4) * 4) & ~(3 << (26 & 0xf) * 2)) | (1 << (26 & 0xf) * 2);
}
#line 96
;
{
#line 97
* (volatile uint32_t *)(0x40E0000C + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (24 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (24 < 96 ? ((24 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (24 & 0x1f));
#line 97
* (volatile uint32_t *)(0x40E00054 + ((24 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((24 & 0x7f) >> 4) * 4) & ~(3 << (24 & 0xf) * 2)) | (0 << (24 & 0xf) * 2);
}
#line 97
;
* (volatile uint32_t *)0x41300004 |= 1 << 23;
* (volatile uint32_t *)0x41000004 = ((7 & 0xF) << 10) | ((7 & 0xF) << 6);
* (volatile uint32_t *)0x41000028 = 96 * 8;
* (volatile uint32_t *)0x41000000 = ((((4 & 0xFFF) << 8) | ((2 & 0x3) << 4)) | ((0xff & 0xF) << 0)) | (1 << 7);
ADCM$initialized = TRUE;
ADCM$taskBusy = FALSE;
ADCM$queue_head = ADCM$queue_tail = -1;
ADCM$queue_size = 0;
}
#line 109
__nesc_atomic_end(__nesc_atomic); }
for (i = 0; i < MAX_SENSOR_NUM; i++) {
ADCM$channel[i] = 0xff;
}
}
return SUCCESS;
}
# 44 "/home/xu/oasis/system/buffer.h"
static result_t initBufferPool(Queue_t *bufQueue, uint16_t size, TOS_Msg *bufPool)
#line 44
{
result_t result;
int16_t ind;
if (SUCCESS != (result = initQueue(bufQueue, size))) {
return FAIL;
}
for (ind = 0; ind < size; ind++)
{
if (SUCCESS != insertElement(bufQueue, &bufPool[ind])) {
#line 53
return FAIL;
}
}
#line 55
;
return SUCCESS;
}
# 90 "/home/xu/oasis/system/queue.h"
static result_t initQueue(Queue_t *queue, uint16_t size)
#line 90
{
int16_t i;
if (size > MAX_QUEUE_SIZE || size <= 0) {
;
return FAIL;
}
queue->size = size;
queue->total = 0;
queue->head[FREE] = 0;
queue->tail[FREE] = size - 1;
queue->head[PENDING] = queue->tail[PENDING] = -1;
queue->head[PROCESSING] = queue->tail[PROCESSING] = -1;
for (i = 0; i < size; i++) {
queue->element[i].status = FREE;
queue->element[i].obj = (void *)0;
queue->element[i].prev = i - 1;
queue->element[i].retry = 0;
queue->element[i].priority = 0;
if (i < size - 1) {
queue->element[i].next = i + 1;
}
else {
#line 133
queue->element[i].next = -1;
}
}
return SUCCESS;
}
static result_t insertElement(Queue_t *queue, object_type *obj)
#line 146
{
int16_t ind;
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total >= queue->size) {
return FAIL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
;
return FAIL;
}
}
ind = queue->head[FREE];
queue->element[ind].obj = obj;
queue->element[ind].retry = 0;
_private_changeElementStatusByIndex(queue, ind, FREE, PENDING);
queue->total++;
;
return SUCCESS;
}
#line 559
static void _private_changeElementStatusByIndex(Queue_t *queue, int16_t ind, ObjStatus_t status1, ObjStatus_t status2)
#line 559
{
int16_t _prev;
#line 561
int16_t _next;
#line 561
int16_t tail2;
if (queue->element[ind].status != status1)
{
;
return;
}
if (queue->element[ind].status == status2) {
;
return;
}
_prev = queue->element[ind].prev;
_next = queue->element[ind].next;
if (_prev != -1) {
queue->element[_prev].next = _next;
}
else {
#line 580
queue->head[status1] = _next;
}
if (_next != -1) {
queue->element[_next].prev = _prev;
}
else {
#line 585
queue->tail[status1] = _prev;
}
tail2 = queue->tail[status2];
if (tail2 != -1) {
queue->element[tail2].next = ind;
}
else {
queue->head[status2] = ind;
}
queue->element[ind].status = status2;
queue->element[ind].prev = tail2;
queue->element[ind].next = -1;
queue->tail[status2] = ind;
return;
}
# 75 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static result_t TimerM$StdControl$init(void)
#line 75
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 76
{
TimerM$mState = 0;
TimerM$queue_head = TimerM$queue_tail = -1;
TimerM$queue_size = 0;
TimerM$mCurrentInterval = 0;
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return TimerM$Clock$setRate(0, 0);
}
# 208 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XClockM.nc"
static void PXA27XClockM$Clock$setInterval(uint32_t value)
#line 208
{
* (volatile uint32_t *)0x40A00084 = value;
* (volatile uint32_t *)0x40A00044 = 0x0;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 215
{
PXA27XClockM$gmInterval = value;
}
#line 217
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 540 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static void GPSSensorM$clearTable(void)
#line 540
{
int8_t i;
#line 542
for (i = 0; i < MAX_ENTRIES; ++i)
GPSSensorM$table[i].state = ENTRY_EMPTY;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 545
GPSSensorM$numEntries = 0;
#line 545
__nesc_atomic_end(__nesc_atomic); }
}
# 294 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static void PXA27XInterruptM$enable(uint8_t id)
{
uint32_t tmp;
#line 297
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
{
if (id < 34) {
* (volatile uint32_t *)(0x40D00004 + (id < 32 ? 0 : 0x9c)) |= 1 << id % 32;
tmp = * (volatile uint32_t *)(0x40D00004 + (id < 32 ? 0 : 0x9c));
}
}
#line 302
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 268 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static void FramerM$HDLCInitialize(void)
#line 268
{
int i;
#line 270
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 270
{
for (i = 0; i < FramerM$HDLC_QUEUESIZE; i++) {
FramerM$gMsgRcvTbl[i].pMsg = &FramerM$gMsgRcvBuf[i];
FramerM$gMsgRcvTbl[i].Length = 0;
FramerM$gMsgRcvTbl[i].Token = 0;
}
FramerM$gTxState = FramerM$TXSTATE_IDLE;
FramerM$gTxByteCnt = 0;
FramerM$gTxLength = 0;
FramerM$gTxRunningCRC = 0;
FramerM$gpTxMsg = (void *)0;
FramerM$gRxState = FramerM$RXSTATE_NOSYNC;
FramerM$gRxHeadIndex = 0;
FramerM$gRxTailIndex = 0;
FramerM$gRxByteCnt = 0;
FramerM$gRxRunningCRC = 0;
FramerM$gpRxBuf = (uint8_t *)FramerM$gMsgRcvTbl[FramerM$gRxHeadIndex].pMsg;
FramerM$gFlags = 0;
}
#line 289
__nesc_atomic_end(__nesc_atomic); }
}
# 311 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static void TimeSyncM$clearTable(void)
{
int8_t i;
#line 314
for (i = 0; i < TimeSyncM$MAX_ENTRIES; ++i) {
TimeSyncM$table[i].state = TimeSyncM$ENTRY_EMPTY;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 317
TimeSyncM$numEntries = 0;
#line 317
__nesc_atomic_end(__nesc_atomic); }
}
# 347 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$initialize(void)
#line 347
{
int8_t i;
#line 349
CascadesRouterM$highestSeq = 0;
CascadesRouterM$expectingSeq = 0;
CascadesRouterM$headIndex = 0;
CascadesRouterM$RTwait = (CascadesRouterM$Random$rand() & 0x64) + 0xcf;
CascadesRouterM$resetCount = 0;
CascadesRouterM$nextSignalSeq = CascadesRouterM$expectingSeq;
CascadesRouterM$activeRT = FALSE;
CascadesRouterM$DataTimerOn = FALSE;
CascadesRouterM$DataProcessBusy = FALSE;
CascadesRouterM$RequestProcessBusy = FALSE;
CascadesRouterM$ctrlMsgBusy = FALSE;
CascadesRouterM$CMAuProcessBusy = FALSE;
CascadesRouterM$sigRcvTaskBusy = FALSE;
CascadesRouterM$delayTimerBusy = FALSE;
CascadesRouterM$inited = FALSE;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
CascadesRouterM$myBuffer[i].signalDone = 1;
CascadesRouterM$clearChildrenListStatus(i);
}
for (i = MAX_CAS_PACKETS - 1; i >= 0; i--) {
CascadesRouterM$inData[i] = FALSE;
}
}
# 70 "/opt/tinyos-1.x/tos/system/RandomLFSR.nc"
static uint16_t RandomLFSR$Random$rand(void)
#line 70
{
bool endbit;
uint16_t tmpShiftReg;
#line 73
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 73
{
tmpShiftReg = RandomLFSR$shiftReg;
endbit = (tmpShiftReg & 0x8000) != 0;
tmpShiftReg <<= 1;
if (endbit) {
tmpShiftReg ^= 0x100b;
}
#line 79
tmpShiftReg++;
RandomLFSR$shiftReg = tmpShiftReg;
tmpShiftReg = tmpShiftReg ^ RandomLFSR$mask;
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return tmpShiftReg;
}
# 228 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$clearChildrenListStatus(uint8_t myindex)
#line 228
{
int8_t i;
#line 230
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
CascadesRouterM$myBuffer[myindex].childrenList[i].status = 0;
}
CascadesRouterM$myBuffer[myindex].countDT = 0;
CascadesRouterM$myBuffer[myindex].retry = 0;
}
# 59 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static void NeighborMgmtM$initialize(void)
#line 59
{
nmemset(NeighborMgmtM$NeighborTbl, 0, sizeof(NBRTableEntry ) * 16);
NeighborMgmtM$initTime = TRUE;
NeighborMgmtM$processTaskBusy = FALSE;
NeighborMgmtM$lqiBuf = 0;
NeighborMgmtM$rssiBuf = 0;
NeighborMgmtM$linkaddrBuf = 0;
NeighborMgmtM$ticks = 0;
}
# 75 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static result_t PXA27XGPIOIntM$StdControl$start(void)
#line 75
{
PXA27XGPIOIntM$GPIOIrq0$enable();
PXA27XGPIOIntM$GPIOIrq1$enable();
PXA27XGPIOIntM$GPIOIrq$enable();
return SUCCESS;
}
# 306 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
static void PXA27XInterruptM$disable(uint8_t id)
{
uint32_t tmp;
#line 309
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 309
{
if (id < 34) {
* (volatile uint32_t *)(0x40D00004 + (id < 32 ? 0 : 0x9c)) &= ~(1 << id % 32);
tmp = * (volatile uint32_t *)(0x40D00004 + (id < 32 ? 0 : 0x9c));
}
}
#line 314
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 55 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static void STUARTM$initPort(void)
#line 55
{
{
#line 58
* (volatile uint32_t *)(0x40E0000C + (46 < 96 ? ((46 & 0x7f) >> 5) * 4 : 0x100)) = 0 == 1 ? * (volatile uint32_t *)(0x40E0000C + (46 < 96 ? ((46 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (46 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (46 < 96 ? ((46 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (46 & 0x1f));
#line 58
* (volatile uint32_t *)(0x40E00054 + ((46 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((46 & 0x7f) >> 4) * 4) & ~(3 << (46 & 0xf) * 2)) | (2 << (46 & 0xf) * 2);
}
#line 58
;
{
#line 59
* (volatile uint32_t *)(0x40E0000C + (47 < 96 ? ((47 & 0x7f) >> 5) * 4 : 0x100)) = 1 == 1 ? * (volatile uint32_t *)(0x40E0000C + (47 < 96 ? ((47 & 0x7f) >> 5) * 4 : 0x100)) | (1 << (47 & 0x1f)) : * (volatile uint32_t *)(0x40E0000C + (47 < 96 ? ((47 & 0x7f) >> 5) * 4 : 0x100)) & ~(1 << (47 & 0x1f));
#line 59
* (volatile uint32_t *)(0x40E00054 + ((47 & 0x7f) >> 4) * 4) = (* (volatile uint32_t *)(0x40E00054 + ((47 & 0x7f) >> 4) * 4) & ~(3 << (47 & 0xf) * 2)) | (1 << (47 & 0xf) * 2);
}
#line 59
;
STUARTM$UARTInterrupt$allocate();
}
static void STUARTM$configPort(void)
#line 76
{
* (volatile uint32_t *)0x41300004 |= 1 << 5;
* (volatile uint32_t *)0x40700004 = 1 << 7;
* (volatile uint32_t *)0x40700004 |= 1 << 6;
* (volatile uint32_t *)0x4070000C |= 1 << 7;
* (volatile uint32_t *)0x40700000 = 8;
* (volatile uint32_t *)0x40700004 = 0;
* (volatile uint32_t *)0x4070000C &= ~(1 << 7);
* (volatile uint32_t *)0x4070000C |= 0x3;
* (volatile uint32_t *)0x40700008 = ((((((2 & 0x3) << 6) | (1 << 5)) | (1 << 4)) | (1 << 3)) | (1 << 2)) | (1 << 0);
* (volatile uint32_t *)0x40700010 &= ~(1 << 4);
* (volatile uint32_t *)0x40700010 |= 1 << 3;
}
# 249 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XDMAM.nc"
static result_t PXA27XDMAM$PXA27XDMAChannel$setSourceAddr(uint8_t channel, uint32_t val)
#line 249
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 250
{
PXA27XDMAM$mDescriptorArray[channel].DSADR = val;
}
#line 252
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t PXA27XDMAM$PXA27XDMAChannel$setTargetAddr(uint8_t channel, uint32_t val)
#line 256
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 257
{
PXA27XDMAM$mDescriptorArray[channel].DTADR = val;
}
#line 259
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceAddrIncrement(uint8_t channel, bool enable)
#line 263
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 264
{
PXA27XDMAM$mDescriptorArray[channel].DCMD = enable == TRUE ? PXA27XDMAM$mDescriptorArray[channel].DCMD | (1 << 31) : PXA27XDMAM$mDescriptorArray[channel].DCMD & ~(1 << 31);
}
#line 266
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 269
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetAddrIncrement(uint8_t channel, bool enable)
#line 269
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 270
{
PXA27XDMAM$mDescriptorArray[channel].DCMD = enable == TRUE ? PXA27XDMAM$mDescriptorArray[channel].DCMD | (1 << 30) : PXA27XDMAM$mDescriptorArray[channel].DCMD & ~(1 << 30);
}
#line 272
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t PXA27XDMAM$PXA27XDMAChannel$enableSourceFlowControl(uint8_t channel, bool enable)
#line 276
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 277
{
PXA27XDMAM$mDescriptorArray[channel].DCMD = enable == TRUE ? PXA27XDMAM$mDescriptorArray[channel].DCMD | (1 << 29) : PXA27XDMAM$mDescriptorArray[channel].DCMD & ~(1 << 29);
}
#line 279
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t PXA27XDMAM$PXA27XDMAChannel$enableTargetFlowControl(uint8_t channel, bool enable)
#line 283
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 284
{
PXA27XDMAM$mDescriptorArray[channel].DCMD = enable == TRUE ? PXA27XDMAM$mDescriptorArray[channel].DCMD | (1 << 28) : PXA27XDMAM$mDescriptorArray[channel].DCMD & ~(1 << 28);
}
#line 286
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 302
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferLength(uint8_t channel, uint16_t length)
#line 302
{
if (length > 8191) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 307
{
PXA27XDMAM$mChannelArray[channel].length = length;
PXA27XDMAM$mDescriptorArray[channel].DCMD &= ~(0x1FFF & 0x1FFF);
PXA27XDMAM$mDescriptorArray[channel].DCMD |= length & 0x1FFF;
}
#line 312
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 290
static result_t PXA27XDMAM$PXA27XDMAChannel$setMaxBurstSize(uint8_t channel, DMAMaxBurstSize_t size)
#line 290
{
if (size >= DMA_8ByteBurst && size <= DMA_32ByteBurst) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 292
{
PXA27XDMAM$mDescriptorArray[channel].DCMD &= ~((3 & 0x3) << 16);
PXA27XDMAM$mDescriptorArray[channel].DCMD |= (size & 0x3) << 16;
}
#line 296
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
return FAIL;
}
#line 316
static result_t PXA27XDMAM$PXA27XDMAChannel$setTransferWidth(uint8_t channel, DMATransferWidth_t width)
#line 316
{
if (width >= DMA_NonPeripheralWidth && width <= DMA_4ByteWidth) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 318
{
PXA27XDMAM$mDescriptorArray[channel].DCMD &= ~((3 & 0x3) << 14);
PXA27XDMAM$mDescriptorArray[channel].DCMD |= (width & 0x3) << 14;
}
#line 322
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
return FAIL;
}
#line 149
static result_t PXA27XDMAM$PXA27XDMAChannel$requestChannel(uint8_t channel, DMAPeripheralID_t peripheralID,
DMAPriority_t priority,
bool permanent)
#line 151
{
uint32_t i;
#line 155
uint32_t realChannel;
bool foundChannel = FALSE;
#line 157
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 157
{
if (PXA27XDMAM$mChannelArray[channel].channelValid == TRUE) {
foundChannel = TRUE;
}
if (foundChannel == FALSE && priority & DMA_Priority1) {
for (i = 0; i < 7; i++) {
realChannel = i < 4 ? i : i + 12;
if (PXA27XDMAM$mPriorityMap[realChannel].inUse == FALSE) {
PXA27XDMAM$mPriorityMap[realChannel].inUse = TRUE;
PXA27XDMAM$mPriorityMap[realChannel].virtualChannel = channel;
PXA27XDMAM$mPriorityMap[realChannel].permanent = permanent;
PXA27XDMAM$mChannelArray[channel].channelValid = TRUE;
PXA27XDMAM$mChannelArray[channel].realChannel = realChannel;
PXA27XDMAM$mChannelArray[channel].peripheralID = peripheralID;
foundChannel = TRUE;
break;
}
}
}
if (foundChannel == FALSE && priority & DMA_Priority2) {
for (i = 0; i < 7; i++) {
realChannel = i < 4 ? i + 4 : i + 16;
if (PXA27XDMAM$mPriorityMap[realChannel].inUse == FALSE) {
PXA27XDMAM$mPriorityMap[realChannel].inUse = TRUE;
PXA27XDMAM$mPriorityMap[realChannel].virtualChannel = channel;
PXA27XDMAM$mPriorityMap[realChannel].permanent = permanent;
PXA27XDMAM$mChannelArray[channel].channelValid = TRUE;
PXA27XDMAM$mChannelArray[channel].realChannel = realChannel;
PXA27XDMAM$mChannelArray[channel].peripheralID = peripheralID;
foundChannel = TRUE;
break;
}
}
}
if (foundChannel == FALSE && priority & DMA_Priority3) {
for (i = 0; i < 7; i++) {
realChannel = i < 4 ? i + 8 : i + 20;
if (PXA27XDMAM$mPriorityMap[realChannel].inUse == FALSE) {
PXA27XDMAM$mPriorityMap[realChannel].inUse = TRUE;
PXA27XDMAM$mPriorityMap[realChannel].virtualChannel = channel;
PXA27XDMAM$mPriorityMap[realChannel].permanent = permanent;
PXA27XDMAM$mChannelArray[channel].channelValid = TRUE;
PXA27XDMAM$mChannelArray[channel].realChannel = realChannel;
PXA27XDMAM$mChannelArray[channel].peripheralID = peripheralID;
foundChannel = TRUE;
break;
}
}
}
if (foundChannel == FALSE && priority & DMA_Priority4) {
for (i = 0; i < 7; i++) {
realChannel = i < 4 ? i + 12 : i + 24;
if (PXA27XDMAM$mPriorityMap[realChannel].inUse == FALSE) {
PXA27XDMAM$mPriorityMap[realChannel].inUse = TRUE;
PXA27XDMAM$mPriorityMap[realChannel].virtualChannel = channel;
PXA27XDMAM$mPriorityMap[realChannel].permanent = permanent;
PXA27XDMAM$mChannelArray[channel].channelValid = TRUE;
PXA27XDMAM$mChannelArray[channel].realChannel = realChannel;
PXA27XDMAM$mChannelArray[channel].peripheralID = peripheralID;
foundChannel = TRUE;
break;
}
}
}
}
#line 226
__nesc_atomic_end(__nesc_atomic); }
if (foundChannel == TRUE) {
TOS_parampost(PXA27XDMAM$_postRequestChannelDoneveneer, (uint32_t )channel);
}
return SUCCESS;
}
#line 346
static result_t PXA27XDMAM$PXA27XDMAChannel$run(uint8_t channel, DMAInterruptEnable_t interruptEn)
#line 346
{
uint8_t realChannel;
uint32_t width;
uint32_t DCSRinterrupts;
#line 349
uint32_t DCMDinterrupts;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 351
{
realChannel = PXA27XDMAM$mChannelArray[channel].realChannel;
width = (PXA27XDMAM$mDescriptorArray[channel].DCMD >> 14) & 0x3;
* (volatile uint32_t *)(0x40000100 + (PXA27XDMAM$mChannelArray[channel].peripheralID < 64 ? PXA27XDMAM$mChannelArray[channel].peripheralID * 4 : PXA27XDMAM$mChannelArray[channel].peripheralID * 4 + 3840)) = (realChannel & 0x1F) | (1 << 7);
if (width) {
* (volatile uint32_t *)0x400000A0 |= 1 << realChannel;
}
else {
* (volatile uint32_t *)0x400000A0 &= ~(1 << realChannel);
}
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = 1 << 30;
DCSRinterrupts = (interruptEn & DMA_EORINTEN ? (1 << 28) | (1 << 26) : 0) | (interruptEn & DMA_STOPINTEN ? 1 << 29 : 0);
DCMDinterrupts = (interruptEn & DMA_ENDINTEN ? 1 << 21 : 0) | (interruptEn & DMA_STARTINTEN ? 1 << 22 : 0);
* (volatile uint32_t *)(0x4000020C + realChannel * 16) = PXA27XDMAM$mDescriptorArray[channel].DCMD | DCMDinterrupts;
* (volatile uint32_t *)(0x40000204 + realChannel * 16) = PXA27XDMAM$mDescriptorArray[channel].DSADR;
* (volatile uint32_t *)(0x40000208 + realChannel * 16) = PXA27XDMAM$mDescriptorArray[channel].DTADR;
* (volatile uint32_t *)(0x40000000 + realChannel * 4) = ((1 << 31) | (1 << 30)) | DCSRinterrupts;
}
#line 375
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 210 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static result_t PMICM$readPMIC(uint8_t address, uint8_t *value, uint8_t numBytes)
#line 210
{
uint32_t loopCount;
if (PMICM$getPI2CBus() == FALSE) {
return FAIL;
}
if (numBytes > 0) {
* (volatile uint32_t *)0x40F00188 = 0x49 << 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 0;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printReadPMICBusError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00188 = address;
* (volatile uint32_t *)0x40F00190 &= ~(1 << 0);
* (volatile uint32_t *)0x40F00190 |= 1 << 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printReadPMICAddresError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00190 &= ~(1 << 1);
* (volatile uint32_t *)0x40F00188 = (0x49 << 1) | 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 0;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printReadPMICSlaveAddresError);
PMICM$returnPI2CBus();
return FAIL;
}
* (volatile uint32_t *)0x40F00190 &= ~(1 << 0);
while (numBytes > 1) {
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printReadPMICReadByteError);
PMICM$returnPI2CBus();
return FAIL;
}
*value = * (volatile uint32_t *)0x40F00188;
value++;
numBytes--;
}
* (volatile uint32_t *)0x40F00190 |= 1 << 1;
* (volatile uint32_t *)0x40F00190 |= 1 << 2;
* (volatile uint32_t *)0x40F00190 |= 1 << 3;
for (loopCount = 0; * (volatile uint32_t *)0x40F00190 & (1 << 3) && loopCount < 1000; loopCount++) ;
if (loopCount == 1000) {
TOS_post(PMICM$printReadPMICReadByteError);
PMICM$returnPI2CBus();
return FAIL;
}
*value = * (volatile uint32_t *)0x40F00188;
* (volatile uint32_t *)0x40F00190 &= ~(1 << 1);
* (volatile uint32_t *)0x40F00190 &= ~(1 << 2);
PMICM$returnPI2CBus();
return SUCCESS;
}
else {
PMICM$returnPI2CBus();
return FAIL;
}
}
#line 672
static result_t PMICM$PMIC$enableCharging(bool enable)
#line 672
{
uint8_t val;
if (enable) {
val = PMICM$getChargerVoltage();
if (val > 70) {
trace(DBG_USR1, "Enabling Charger...Charger Voltage is %.3fV\r\n", val * 6 * .01035);
PMICM$writePMIC(0x2A, 15);
PMICM$writePMIC(0x28, ((1 << 7) | ((1 & 0xF) << 3)) | (4 & 0x7));
PMICM$writePMIC(0x20, 0x80);
PMICM$writePMIC(0x30, 1 << 4);
PMICM$writePMIC(0x31, 0xE);
PMICM$chargeMonitorTimer$start(TIMER_REPEAT, 60 * 5 * 1000);
return SUCCESS;
}
else {
trace(DBG_USR1, "Charger Voltage is %.3fV...charger not enabled\r\n", val * 6 * .01035);
}
}
PMICM$PMIC$getBatteryVoltage(&val);
trace(DBG_USR1, "Disabling Charger...Battery Voltage is %.3fV\r\n", val * .01035 + 2.65);
PMICM$writePMIC(0x2A, 0x0);
PMICM$writePMIC(0x28, 0x0);
PMICM$writePMIC(0x20, 0x0);
PMICM$writePMIC(0x30, 0x0);
PMICM$writePMIC(0x31, 0x0);
PMICM$chargeMonitorTimer$stop();
return SUCCESS;
}
#line 637
static result_t PMICM$getPMICADCVal(uint8_t channel, uint8_t *val)
#line 637
{
uint8_t oldval;
result_t rval;
rval = PMICM$readPMIC(0x30, &oldval, 1);
rcombine(rval, PMICM$writePMIC(0x30, 1 << 4));
TOSH_uwait(20);
rcombine(rval, PMICM$writePMIC(0x30, ((channel & 0x7) | (1 << 3)) | (1 << 4)));
rcombine(rval, PMICM$readPMIC(0x40, val, 1));
rcombine(rval, PMICM$writePMIC(0x30, oldval));
return rval;
}
# 98 "/opt/tinyos-1.x/tos/platform/pxa27x/TimerM.nc"
static result_t TimerM$Timer$start(uint8_t id, char type,
uint32_t interval)
#line 99
{
uint32_t countRemaining;
#line 100
uint32_t currentCount;
if (id >= NUM_TIMERS) {
return FAIL;
}
if (type > TIMER_ONE_SHOT) {
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 111
{
TimerM$mTimerList[id].ticks = interval;
TimerM$mTimerList[id].ticksLeft = interval;
TimerM$mTimerList[id].type = type;
currentCount = TimerM$Clock$readCounter();
countRemaining = TimerM$mCurrentInterval - currentCount;
TimerM$mState |= 0x1L << id;
#line 140
if (TimerM$mCurrentInterval == 0) {
TimerM$mCurrentInterval = interval;
TimerM$Clock$setInterval(interval);
}
else {
if (interval < countRemaining) {
if (countRemaining - interval > 1) {
TimerM$mCurrentInterval = interval + currentCount;
TimerM$Clock$setInterval(TimerM$mCurrentInterval);
}
else {
}
}
else
{
TimerM$mTimerList[id].ticksLeft += currentCount;
}
}
}
#line 167
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
static result_t TimerM$Timer$stop(uint8_t id)
#line 171
{
result_t ret = FAIL;
#line 174
if (id >= NUM_TIMERS) {
#line 174
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 176
{
if (TimerM$mState & (0x1L << id)) {
TimerM$mState &= ~(0x1L << id);
if (!TimerM$mState) {
TimerM$mCurrentInterval = 0;
TimerM$Clock$setInterval(0);
}
ret = SUCCESS;
}
}
#line 187
__nesc_atomic_end(__nesc_atomic); }
return ret;
}
# 190 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void *DataMgmtM$DataMgmt$allocBlk(uint8_t client)
#line 190
{
SenBlkPtr p = (void *)0;
result_t result = SUCCESS;
if (sensor[client].maxBlkNum != 0) {
if (sensor[client].curBlkNum >= sensor[client].maxBlkNum) {
result = DataMgmtM$DataMgmt$freeBlkByType(sensor[client].type);
}
}
if (FAIL != result) {
p = allocSensorMem(&DataMgmtM$sensorMem);
if (p != (void *)0) {
sensor[client].curBlkNum++;
DataMgmtM$Leds$yellowToggle();
}
else
#line 206
{
}
}
return p;
}
# 125 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static SenBlkPtr headMemElement(MemQueue_t *queue, MemStatus_t status)
#line 125
{
int16_t ind;
#line 127
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 127
ind = queue->head[status];
#line 127
__nesc_atomic_end(__nesc_atomic); }
if (ind == -1) {
return (void *)0;
}
else {
return &queue->element[ind];
}
}
# 227 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$DataMgmt$freeBlk(void *obj)
#line 227
{
uint8_t i = 0;
result_t result = FAIL;
SenBlkPtr p = 0;
uint8_t type = 0;
if (obj == 0) {
return result;
}
p = (SenBlkPtr )obj;
type = p->type;
result = freeSensorMem(&DataMgmtM$sensorMem, p);
if (result != FAIL) {
for (i = 0; i <= sensor_num; i++) {
if (sensor[i].type == type) {
if (sensor[i].curBlkNum > 0) {
sensor[i].curBlkNum--;
}
}
}
}
else
#line 249
{
}
return result;
}
# 263 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static result_t _private_changeMemStatusByIndex(MemQueue_t *queue, int16_t ind, MemStatus_t status1, MemStatus_t status2)
#line 263
{
int16_t _prev;
#line 265
int16_t _next;
#line 265
int16_t tail2;
if (queue->element[ind].status != status1) {
;
return FAIL;
}
if (queue->element[ind].status == status2) {
;
return FAIL;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 282
{
_prev = queue->element[ind].prev;
_next = queue->element[ind].next;
}
#line 285
__nesc_atomic_end(__nesc_atomic); }
if (_prev != -1) {
queue->element[_prev].next = _next;
}
else {
#line 289
queue->head[status1] = _next;
}
if (_next != -1) {
queue->element[_next].prev = _prev;
}
else {
#line 294
queue->tail[status1] = _prev;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 297
tail2 = queue->tail[status2];
#line 297
__nesc_atomic_end(__nesc_atomic); }
if (tail2 != -1) {
queue->element[tail2].next = ind;
}
else {
queue->head[status2] = ind;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 305
{
queue->element[ind].status = status2;
queue->element[ind].prev = tail2;
queue->element[ind].next = -1;
queue->tail[status2] = ind;
}
#line 310
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 147
static SenBlkPtr getMemElementByIndex(MemQueue_t *queue, int16_t ind)
#line 147
{
if (ind >= queue->size || ind < 0) {
return (void *)0;
}
else {
return &queue->element[ind];
}
}
# 121 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static result_t ADCM$ADCControl$bindPort(uint8_t port, uint8_t adcPort)
#line 121
{
result_t result = FAIL;
#line 123
if (port < MAX_SENSOR_NUM) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 124
{
ADCM$channel[port] = adcPort;
result = SUCCESS;
}
#line 127
__nesc_atomic_end(__nesc_atomic); }
}
return result;
}
# 862 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$updateMaxBlkNum(void)
#line 862
{
uint8_t i;
uint16_t totalRate = 0;
uint16_t usedBlkNum = 0;
#line 866
for (i = 0; i < sensor_num; i++) {
if (sensor[i].samplingRate != 0) {
totalRate += 1000UL / sensor[i].samplingRate;
}
else {
usedBlkNum += sensor[i].maxBlkNum;
}
}
if (totalRate != 0) {
for (i = 0; i <= sensor_num; i++) {
if (sensor[i].samplingRate != 0) {
sensor[i].maxBlkNum = 1000UL / sensor[i].samplingRate * (MEM_QUEUE_SIZE - usedBlkNum) / totalRate + 2;
}
}
}
return;
}
#line 906
static uint16_t SmartSensingM$calFireInterval(void)
#line 906
{
uint8_t client = 0;
uint16_t gcd = 0;
uint16_t value1 = 0;
#line 910
while (client < sensor_num) {
value1 = sensor[client].samplingRate;
if (value1 != 0) {
if (gcd == 0) {
gcd = value1;
}
else {
gcd = SmartSensingM$GCD(gcd, value1);
}
}
client++;
}
return gcd;
}
# 44 "/home/xu/oasis/system/platform/imote2/RTC/RTCClockM.nc"
static result_t RTCClockM$StdControl$start(void)
#line 44
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 45
{
* (volatile uint32_t *)0x40A000D8 = (((1 << 7) | (1 << 3)) | (1 << 6)) | (0x4 & 0x7);
* (volatile uint32_t *)0x40A0001C |= 1 << 10;
* (volatile uint32_t *)0x40A00058 = 0x1;
* (volatile uint32_t *)0x40A00098 = 0xffffffff;
}
#line 51
__nesc_atomic_end(__nesc_atomic); }
RTCClockM$OSTIrq$enable();
return SUCCESS;
}
# 639 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static void GPSSensorM$selfCheckTask(void)
#line 639
{
if (GPSSensorM$checkTimerOn != TRUE) {
GPSSensorM$last_pps_index = GPSSensorM$ppsIndex;
GPSSensorM$checkTimerOn = GPSSensorM$CheckTimer$start(TIMER_ONE_SHOT, (uint16_t )(SYNC_INTERVAL >> 1) * 1000UL);
}
}
# 77 "/home/xu/oasis/system/platform/imote2/RTC/RTCClockM.nc"
static void RTCClockM$MicroClock$setInterval(uint32_t value)
#line 77
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 78
{
* (volatile uint32_t *)0x40A00098 = value;
* (volatile uint32_t *)0x40A00058 = 0x0;
RTCClockM$gmInterval = value;
}
#line 82
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 392 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static result_t RealTimeM$Timer$start(uint8_t id, char type, uint32_t interval)
#line 392
{
if (type > TIMER_ONE_SHOT) {
return FAIL;
}
if (interval > 0) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 397
{
RealTimeM$clientList[id].type = type;
RealTimeM$clientList[id].syncInterval = interval;
RealTimeM$clientList[id].fireCount = (RealTimeM$localTime + interval - RealTimeM$localTime % interval) % DAY_END;
RealTimeM$mState |= 0x1L << id;
}
#line 402
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
RealTimeM$Timer$stop(id);
return FAIL;
}
}
static result_t RealTimeM$Timer$stop(uint8_t id)
#line 415
{
if (RealTimeM$mState & (0x1L << id)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 417
RealTimeM$mState &= ~(0x1L << id);
#line 417
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
else {
return FAIL;
}
}
# 245 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static uint8_t HPLCC2420M$HPLCC2420$write(uint8_t addr, uint16_t data)
#line 245
{
uint8_t status = 0;
uint8_t tmp;
if (HPLCC2420M$getSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420WriteContentionError);
return 0;
}
{
#line 260
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 260
;
{
#line 262
TOSH_CLR_CC_CSN_PIN();
#line 262
TOSH_uwait(1);
}
#line 262
;
* (volatile uint32_t *)0x41900010 = addr;
* (volatile uint32_t *)0x41900010 = (data >> 8) & 0xFF;
* (volatile uint32_t *)0x41900010 = data & 0xFF;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
{
#line 270
TOSH_uwait(1);
#line 270
TOSH_SET_CC_CSN_PIN();
}
#line 270
;
status = * (volatile uint32_t *)0x41900010;
{
#line 273
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 273
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420WriteError);
return 0;
}
return status;
}
#line 166
static result_t HPLCC2420M$getSSPPort(void)
#line 166
{
result_t res;
#line 168
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 168
{
if (HPLCC2420M$gRadioOpInProgress) {
res = FAIL;
}
else {
res = SUCCESS;
HPLCC2420M$gRadioOpInProgress = TRUE;
}
}
#line 176
__nesc_atomic_end(__nesc_atomic); }
return res;
}
static result_t HPLCC2420M$releaseSSPPort(void)
#line 180
{
result_t res;
#line 182
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 182
{
if (HPLCC2420M$gRadioOpInProgress) {
res = SUCCESS;
HPLCC2420M$gRadioOpInProgress = FALSE;
}
else {
res = FAIL;
}
}
#line 190
__nesc_atomic_end(__nesc_atomic); }
return res;
}
# 112 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$disable(uint8_t pin)
{
if (pin < 121) {
* (volatile uint32_t *)(0x40E00030 + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (pin & 0x1f));
* (volatile uint32_t *)(0x40E0003C + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) &= ~(1 << (pin & 0x1f));
}
return;
}
static void PXA27XGPIOIntM$PXA27XGPIOInt$clear(uint8_t pin)
{
if (pin < 121) {
* (volatile uint32_t *)(0x40E00048 + (pin < 96 ? ((pin & 0x7f) >> 5) * 4 : 0x100)) = 1 << (pin & 0x1f);
}
return;
}
# 202 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static uint8_t HPLCC2420M$HPLCC2420$cmd(uint8_t addr)
#line 202
{
uint8_t status = 0;
uint8_t tmp;
if (HPLCC2420M$getSSPPort() == FAIL) {
return 0;
}
{
#line 213
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 213
;
{
#line 215
TOSH_CLR_CC_CSN_PIN();
#line 215
TOSH_uwait(1);
}
#line 215
;
* (volatile uint32_t *)0x41900010 = addr;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
{
#line 218
TOSH_uwait(1);
#line 218
TOSH_SET_CC_CSN_PIN();
}
#line 218
;
status = * (volatile uint32_t *)0x41900010;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420CmdReleaseError);
return 0;
}
return status;
}
# 75 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
__attribute((interrupt("ABORT"))) void hplarmv_dabort(void)
#line 75
{
uint32_t fault_status;
#line 77
uint32_t fault_address;
uint32_t oldsp;
__asm volatile (
" mrc p15,0,r1,C5,C0,0 \n"
" mov r2, %0 \n"
" str r1,[r2] \n" : :
"r"(&fault_status) :
"r1", "r2");
__asm volatile (
" mrc p15,0,r1,C6,C0,0 \n"
" mov r2, %0 \n"
" str r1,[r2] \n" : :
"r"(&fault_address) :
"r1", "r2");
__asm volatile (
"mov r0, #0xD3\n\t"
"msr CPSR_c, R0\n\t"
"mov r0 , %0\n\t"
"str sp, [r0]\n\t"
"mov r0, #0xD7\n\t"
"msr CPSR_c, R0\n\t" : :
"r"(&oldsp) :
"r0");
fault_status = ((fault_status & 0x400) >> 6) | (fault_status & 0xF);
printFatalErrorMsgHex("Data Abort Exception. [Fault Status, Fault Addr, SVC_SP] = ", 3, fault_status, fault_address, oldsp);
return;
}
__attribute((interrupt("ABORT"))) void hplarmv_pabort(void)
#line 116
{
uint32_t fault_status;
#line 118
uint32_t fault_address;
__asm volatile (
" mrc p15,0,r1,C5,C0,0 \n"
" mov r2, %0 \n"
" str r1,[r2] \n" : :
"r"(&fault_status) :
"r1", "r2");
__asm volatile (
" mrc p15,0,r1,C6,C0,0 \n"
" mov r2, %0 \n"
" str r1,[r2] \n" : :
"r"(&fault_address) :
"r1", "r2");
fault_status = ((fault_status & 0x400) >> 6) | (fault_status & 0xF);
printFatalErrorMsgHex("Prefetch Abort Exception. [Fault Status, Fault Addr] = ", 2, fault_status, fault_address);
return;
}
__attribute((interrupt("IRQ"))) void hplarmv_irq(void)
#line 146
{
uint32_t IRQPending;
IRQPending = * (volatile uint32_t *)0x40D00018;
IRQPending >>= 16;
while (IRQPending & (1 << 15)) {
uint8_t PeripheralID = IRQPending & 0x3f;
PXA27XInterruptM$PXA27XIrq$fired(PeripheralID);
#line 198
IRQPending = * (volatile uint32_t *)0x40D00018;
IRQPending >>= 16;
}
return;
}
# 246 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static void FramerM$PacketSent(void)
#line 246
{
result_t TxResult = SUCCESS;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 249
{
if (FramerM$gTxState == FramerM$TXSTATE_ERROR) {
TxResult = FAIL;
FramerM$gTxState = FramerM$TXSTATE_IDLE;
}
}
#line 254
__nesc_atomic_end(__nesc_atomic); }
if (FramerM$gTxProto == FramerM$PROTO_ACK) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 256
FramerM$gFlags ^= FramerM$FLAGS_TOKENPEND;
#line 256
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 259
FramerM$gFlags ^= FramerM$FLAGS_DATAPEND;
#line 259
__nesc_atomic_end(__nesc_atomic); }
FramerM$BareSendMsg$sendDone((TOS_MsgPtr )FramerM$gpTxMsg, TxResult);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 261
FramerM$gpTxMsg = (void *)0;
#line 261
__nesc_atomic_end(__nesc_atomic); }
}
FramerM$StartTx();
}
# 576 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$reportSendDone(TOS_MsgPtr msg, result_t success)
#line 576
{
result_t result;
TOS_MsgPtr *mPPtr = (void *)0;
uint8_t ind = 0;
uint8_t retry;
NetworkMsg *NMsg;
GenericCommProM$state = FALSE;
mPPtr = findObject(&GenericCommProM$sendQueue, msg);
if (mPPtr == (void *)0) {
;
return FAIL;
}
ind = GenericCommProM$findBkHeaderEntry(msg);
if (ind < COMM_SEND_QUEUE_SIZE) {
msg->addr = GenericCommProM$bkHeader[ind].addr;
msg->group = GenericCommProM$bkHeader[ind].group;
msg->type = GenericCommProM$bkHeader[ind].type;
msg->length = GenericCommProM$bkHeader[ind].length;
}
else
#line 601
{
;
}
result = SUCCESS;
if (success != SUCCESS || (
msg->ack != 1 && msg->addr != TOS_BCAST_ADDR
&& msg->addr != TOS_UART_ADDR)) {
incRetryCount(mPPtr);
retry = getRetryCount(mPPtr);
if (msg->type == AM_NETWORKMSG ? (NMsg = (NetworkMsg *)msg->data, retry >= qosRexmit(NMsg->qos)) :
retry >= 2) {
;
if (removeElement(&GenericCommProM$sendQueue, msg) != SUCCESS) {
;
}
if (GenericCommProM$freeBkHeader(ind) != SUCCESS) {
;
}
result = FAIL;
}
else {
changeElementStatus(&GenericCommProM$sendQueue, msg, PROCESSING, PENDING);
GenericCommProM$tryNextSend();
return SUCCESS;
}
}
else {
;
if (removeElement(&GenericCommProM$sendQueue, msg) != SUCCESS) {
;
}
if (GenericCommProM$freeBkHeader(ind) != SUCCESS) {
;
}
}
GenericCommProM$SendMsg$sendDone(msg->type, msg, result);
GenericCommProM$tryNextSend();
return SUCCESS;
}
#line 709
static uint8_t GenericCommProM$findBkHeaderEntry(TOS_MsgPtr pMsg)
#line 709
{
uint8_t i = 0;
#line 711
for (i = 0; i < COMM_SEND_QUEUE_SIZE; i++) {
if (GenericCommProM$bkHeader[i].valid == TRUE && GenericCommProM$bkHeader[i].msgPtr == pMsg) {
break;
}
}
if (i == COMM_SEND_QUEUE_SIZE) {
;
}
return i;
}
# 307 "/home/xu/oasis/system/queue.h"
static result_t removeElement(Queue_t *queue, object_type *obj)
#line 307
{
int16_t ind;
if (queue->size <= 0) {
;
return FAIL;
}
if (queue->total <= 0) {
;
return FAIL;
}
for (ind = 0; ind < queue->size; ind++) {
if (queue->element[ind].status != FREE && queue->element[ind].obj == obj) {
_private_changeElementStatusByIndex(queue, ind, queue->element[ind].status, FREE);
queue->element[ind].obj = (void *)0;
queue->element[ind].retry = 0;
queue->total = queue->total - 1;
;
break;
}
}
if (ind == queue->size) {
;
return FAIL;
}
;
return SUCCESS;
}
# 722 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$freeBkHeader(uint8_t ind)
#line 722
{
if (ind < COMM_SEND_QUEUE_SIZE) {
GenericCommProM$bkHeader[ind].valid = FALSE;
GenericCommProM$bkHeader[ind].length = 0;
GenericCommProM$bkHeader[ind].type = 0;
GenericCommProM$bkHeader[ind].group = 0;
GenericCommProM$bkHeader[ind].msgPtr = 0;
GenericCommProM$bkHeader[ind].addr = 0;
return SUCCESS;
}
;
return FALSE;
}
# 496 "/home/xu/oasis/system/queue.h"
static result_t changeElementStatus(Queue_t *queue, object_type *obj, ObjStatus_t status1, ObjStatus_t status2)
#line 496
{
int16_t ind;
ind = queue->head[status1];
while (ind != -1) {
if (queue->element[ind].obj == obj) {
_private_changeElementStatusByIndex(queue, ind, status1, status2);
break;
}
else
#line 506
{
ind = queue->element[ind].next;
}
}
if (ind == -1) {
;
return FAIL;
}
else {
;
return SUCCESS;
}
}
# 513 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$tryNextSend(void)
#line 513
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 514
{
if (!GenericCommProM$sendTaskBusy && headElement(&GenericCommProM$sendQueue, PENDING) != (void *)0) {
if (TOS_post(GenericCommProM$sendTask) != SUCCESS) {
GenericCommProM$sendTaskBusy = FALSE;
;
{
unsigned char __nesc_temp =
#line 523
FAIL;
{
#line 523
__nesc_atomic_end(__nesc_atomic);
#line 523
return __nesc_temp;
}
}
}
else
#line 525
{
GenericCommProM$sendTaskBusy = TRUE;
}
}
else {
;
}
}
#line 532
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 368 "/home/xu/oasis/system/queue.h"
static object_type *headElement(Queue_t *queue, ObjStatus_t status)
#line 368
{
if (queue->head[status] == -1) {
return (void *)0;
}
else {
#line 373
return queue->element[queue->head[status]].obj;
}
}
# 158 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static result_t FramerM$StartTx(void)
#line 158
{
result_t Result = SUCCESS;
bool fInitiate = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 162
{
if (FramerM$gTxState == FramerM$TXSTATE_IDLE) {
if (FramerM$gFlags & FramerM$FLAGS_TOKENPEND) {
FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxTokenBuf;
FramerM$gTxProto = FramerM$PROTO_ACK;
FramerM$gTxLength = sizeof FramerM$gTxTokenBuf;
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
else {
#line 171
if (FramerM$gFlags & FramerM$FLAGS_DATAPEND) {
FramerM$gpTxBuf = (uint8_t *)FramerM$gpTxMsg;
FramerM$gTxProto = FramerM$PROTO_PACKET_NOACK;
FramerM$gTxLength = FramerM$gpTxMsg->length + (MSG_DATA_SIZE - DATA_LENGTH - 2);
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
else {
#line 178
if (FramerM$gFlags & FramerM$FLAGS_UNKNOWN) {
FramerM$gpTxBuf = (uint8_t *)&FramerM$gTxUnknownBuf;
FramerM$gTxProto = FramerM$PROTO_UNKNOWN;
FramerM$gTxLength = sizeof FramerM$gTxUnknownBuf;
fInitiate = TRUE;
FramerM$gTxState = FramerM$TXSTATE_PROTO;
}
}
}
}
}
#line 188
__nesc_atomic_end(__nesc_atomic); }
#line 188
if (fInitiate) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 189
{
FramerM$gTxRunningCRC = 0;
#line 190
FramerM$gTxByteCnt = 0;
}
#line 191
__nesc_atomic_end(__nesc_atomic); }
Result = FramerM$ByteComm$txByte(FramerM$HDLC_FLAG_BYTE);
if (Result != SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 194
FramerM$gTxState = FramerM$TXSTATE_ERROR;
#line 194
__nesc_atomic_end(__nesc_atomic); }
TOS_post(FramerM$PacketSent);
}
}
return Result;
}
# 110 "/opt/tinyos-1.x/tos/system/UARTM.nc"
static result_t UARTM$ByteComm$txByte(uint8_t data)
#line 110
{
bool oldState;
{
}
#line 113
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 115
{
oldState = UARTM$state;
UARTM$state = TRUE;
}
#line 118
__nesc_atomic_end(__nesc_atomic); }
if (oldState) {
return FAIL;
}
UARTM$HPLUART$put(data);
return SUCCESS;
}
# 81 "/opt/tinyos-1.x/tos/platform/imote2/TimerJiffyAsyncM.nc"
static result_t TimerJiffyAsyncM$TimerJiffyAsync$setOneShot(uint32_t _jiffy)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 83
{
TimerJiffyAsyncM$jiffy = _jiffy;
TimerJiffyAsyncM$bSet = TRUE;
}
#line 86
__nesc_atomic_end(__nesc_atomic); }
if (_jiffy > (1 << 27) - 1) {
TimerJiffyAsyncM$StartTimer((1 << 27) - 1);
}
else {
TimerJiffyAsyncM$StartTimer(_jiffy);
}
return SUCCESS;
}
#line 20
static void TimerJiffyAsyncM$StartTimer(uint32_t interval)
#line 20
{
* (volatile uint32_t *)0x40A00088 = interval << 5;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 23
{
* (volatile uint32_t *)0x40A0001C |= 1 << 6;
}
#line 25
__nesc_atomic_end(__nesc_atomic); }
* (volatile uint32_t *)0x40A00048 = 0x0UL;
}
# 90 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static result_t LedsC$Leds$redToggle(void)
#line 90
{
result_t rval;
#line 92
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 92
{
if (LedsC$ledsOn & LedsC$RED_BIT) {
rval = LedsC$Leds$redOff();
}
else {
#line 96
rval = LedsC$Leds$redOn();
}
}
#line 98
__nesc_atomic_end(__nesc_atomic); }
#line 98
return rval;
}
#line 72
static result_t LedsC$Leds$redOn(void)
#line 72
{
{
}
#line 73
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 74
{
TOSH_CLR_RED_LED_PIN();
LedsC$ledsOn |= LedsC$RED_BIT;
}
#line 77
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 644 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static uint8_t MultiHopEngineM$findInfoEntry(TOS_MsgPtr pMsg)
#line 644
{
uint8_t i = 0;
#line 646
for (i = 0; i < 40; i++) {
if (MultiHopEngineM$queueEntryInfo[i].valid == TRUE && MultiHopEngineM$queueEntryInfo[i].msgPtr == pMsg) {
break;
}
}
if (i == 40) {
;
}
return i;
}
# 398 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$Send$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 398
{
DataMgmtM$sendDoneR_num++;
if (success == SUCCESS) {
DataMgmtM$SysCheckTimer$stop();
DataMgmtM$sysCheckCount = 0;
DataMgmtM$SysCheckTimer$start(TIMER_ONE_SHOT, 60000UL);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 404
DataMgmtM$sendDoneFailCheckCount = 0;
#line 404
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 408
DataMgmtM$sendDoneFailCheckCount++;
#line 408
__nesc_atomic_end(__nesc_atomic); }
}
removeElement(&DataMgmtM$sendQueue, pMsg);
freeBuffer(&DataMgmtM$buffQueue, pMsg);
DataMgmtM$freebuffercount++;
DataMgmtM$tryNextSend();
return SUCCESS;
}
# 86 "/home/xu/oasis/system/buffer.h"
static result_t freeBuffer(Queue_t *bufQueue, TOS_MsgPtr buf)
#line 86
{
if (FAIL == changeElementStatus(bufQueue, buf, BUSYBUF, FREEBUF)) {
;
return FAIL;
}
;
return SUCCESS;
}
# 488 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$tryNextSend(void)
#line 488
{
if (!DataMgmtM$sendTaskBusy && headElement(&DataMgmtM$sendQueue, PENDING) != (void *)0) {
DataMgmtM$Leds$greenToggle();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 492
DataMgmtM$sendTaskBusy = TOS_post(DataMgmtM$sendTask);
#line 492
__nesc_atomic_end(__nesc_atomic); }
DataMgmtM$trynextSendCount++;
}
return SUCCESS;
}
# 181 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static void *MultiHopEngineM$Send$getBuffer(uint8_t AMID, TOS_MsgPtr msg, uint16_t *length)
#line 181
{
NetworkMsg *NMsg = (NetworkMsg *)msg->data;
#line 183
*length = 74 - (size_t )& ((NetworkMsg *)0)->data;
return &NMsg->data[0];
}
#line 154
static result_t MultiHopEngineM$Send$send(uint8_t AMID, TOS_MsgPtr msg, uint16_t length)
#line 154
{
uint16_t correctedLength = (size_t )& ((NetworkMsg *)0)->data + length;
#line 156
if (correctedLength > 74) {
;
MultiHopEngineM$localSendFail++;
return FAIL;
}
;
MultiHopEngineM$RouteSelect$initializeFields(msg, AMID);
if (SUCCESS == MultiHopEngineM$insertAndStartSend(msg, AMID, correctedLength, msg)) {
MultiHopEngineM$numLocalPendingPkt++;
return SUCCESS;
}
else {
return FAIL;
}
}
#line 349
static result_t MultiHopEngineM$insertAndStartSend(TOS_MsgPtr msg,
uint16_t AMID,
uint16_t length,
TOS_MsgPtr originalTOSPtr)
{
result_t result = FALSE;
TOS_MsgPtr msgPtr;
uint8_t infoInd;
NetworkMsg *NMsg;
NetworkMsg *NMsgCome = (NetworkMsg *)msg->data;
#line 359
TryInsert:
if ((void *)0 != (msgPtr = allocBuffer(&MultiHopEngineM$buffQueue)))
{
if ((infoInd = MultiHopEngineM$allocateInfoEntry()) == 40)
{
;
}
MultiHopEngineM$queueEntryInfo[infoInd].valid = TRUE;
MultiHopEngineM$queueEntryInfo[infoInd].AMID = AMID;
MultiHopEngineM$queueEntryInfo[infoInd].resend = FALSE;
MultiHopEngineM$queueEntryInfo[infoInd].length = length;
MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr = originalTOSPtr;
MultiHopEngineM$queueEntryInfo[infoInd].msgPtr = msgPtr;
nmemcpy(msgPtr, msg, sizeof(TOS_Msg ));
result = insertElement_TinyDWFQ(&MultiHopEngineM$sendQueue, msgPtr);
if (!result)
{
freeBuffer(&MultiHopEngineM$buffQueue, msgPtr);
MultiHopEngineM$freeInfoEntry(infoInd);
}
markElementAsPendingByQOS_TinyDWFQ(&MultiHopEngineM$sendQueue, 8);
}
else
{
if (!MultiHopEngineM$useMhopPriority) {
result = FAIL;
}
else {
msgPtr = findMessageToReplace(&MultiHopEngineM$sendQueue, NMsgCome->qos);
if (msgPtr == (void *)0)
{
;
result = FAIL;
goto outInsert;
}
else
{
infoInd = MultiHopEngineM$findInfoEntry(msgPtr);
if (infoInd == 40)
{
;
}
if (MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr != (void *)0)
{
MultiHopEngineM$Send$sendDone(MultiHopEngineM$queueEntryInfo[infoInd].AMID, MultiHopEngineM$queueEntryInfo[infoInd].originalTOSPtr, FAIL);
}
if (SUCCESS != removeElement_TinyDWFQ(&MultiHopEngineM$sendQueue, msgPtr, PENDING_TINYDWFQ))
{
;
}
freeBuffer(&MultiHopEngineM$buffQueue, msgPtr);
MultiHopEngineM$freeInfoEntry(infoInd);
MultiHopEngineM$numberOfSendFailures++;
goto TryInsert;
}
}
}
outInsert:
MultiHopEngineM$tryNextSend();
return result;
}
# 66 "/home/xu/oasis/system/buffer.h"
static TOS_MsgPtr allocBuffer(Queue_t *bufQueue)
#line 66
{
TOS_MsgPtr head;
#line 68
if ((void *)0 != (head = headElement(bufQueue, FREEBUF))) {
if (FAIL == changeElementStatus(bufQueue, head, FREEBUF, BUSYBUF)) {
;
}
#line 71
;
return head;
}
else
#line 73
{
return (void *)0;
}
}
# 657 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static result_t MultiHopEngineM$freeInfoEntry(uint8_t ind)
#line 657
{
if (ind < 40) {
MultiHopEngineM$queueEntryInfo[ind].valid = FALSE;
MultiHopEngineM$queueEntryInfo[ind].AMID = 0;
MultiHopEngineM$queueEntryInfo[ind].length = 0;
MultiHopEngineM$queueEntryInfo[ind].originalTOSPtr = (void *)0;
MultiHopEngineM$queueEntryInfo[ind].msgPtr = (void *)0;
return SUCCESS;
}
else
#line 665
{
;
return FALSE;
}
}
# 520 "/home/xu/oasis/system/TinyDWFQ.h"
static uint8_t setAndGetDequeueWeight(TinyDWFQPtr queue, uint8_t virtualQueueIndex, uint8_t dqPriority, uint8_t freeSpace)
{
uint8_t dequeueWeight = 0;
if (virtualQueueIndex == 7)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[7][DQ_LOW] = 20 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[7][DQ_MEDIUM] = 30 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[7][DQ_HIGH] = 40 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[7][DQ_URGENT] = 50 * freeSpace / 100;
}
}
if (virtualQueueIndex == 6)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[6][DQ_LOW] = 20 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[6][DQ_MEDIUM] = 20 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[6][DQ_HIGH] = 20 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[6][DQ_URGENT] = 15 * freeSpace / 100;
}
}
if (virtualQueueIndex == 5)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[5][DQ_LOW] = 15 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[5][DQ_MEDIUM] = 15 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[5][DQ_HIGH] = 15 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[5][DQ_URGENT] = 10 * freeSpace / 100;
}
}
if (virtualQueueIndex == 4)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[4][DQ_LOW] = 15 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[4][DQ_MEDIUM] = 10 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[4][DQ_HIGH] = 10 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[4][DQ_URGENT] = 10 * freeSpace / 100;
}
}
if (virtualQueueIndex == 3)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[3][DQ_LOW] = 10 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[3][DQ_MEDIUM] = 10 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[3][DQ_HIGH] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[3][DQ_URGENT] = 5 * freeSpace / 100;
}
}
if (virtualQueueIndex == 2)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[2][DQ_LOW] = 10 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[2][DQ_MEDIUM] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[2][DQ_HIGH] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[2][DQ_URGENT] = 5 * freeSpace / 100;
}
}
if (virtualQueueIndex == 1)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[1][DQ_LOW] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[1][DQ_MEDIUM] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[1][DQ_HIGH] = 2.5 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[1][DQ_URGENT] = 2.5 * freeSpace / 100;
}
}
if (virtualQueueIndex == 0)
{
if (dqPriority == DQ_LOW)
{
virtualQueueDequeueWieghts[0][DQ_LOW] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_MEDIUM)
{
virtualQueueDequeueWieghts[0][DQ_MEDIUM] = 5 * freeSpace / 100;
}
if (dqPriority == DQ_HIGH)
{
virtualQueueDequeueWieghts[0][DQ_HIGH] = 2.5 * freeSpace / 100;
}
if (dqPriority == DQ_URGENT)
{
virtualQueueDequeueWieghts[0][DQ_URGENT] = 2.5 * freeSpace / 100;
}
}
dequeueWeight = virtualQueueDequeueWieghts[virtualQueueIndex][dqPriority];
return dequeueWeight;
}
#line 767
static result_t removeElement_TinyDWFQ(TinyDWFQPtr queue, TOS_MsgPtr msg, ObjStatusTINYDWFQ_t status)
{
int8_t ind;
#line 769
int8_t vqIndex;
#line 769
int8_t prevIndex;
int8_t nextHead;
#line 771
ind = queue->head[status];
prevIndex = ind;
while (ind != -1)
{
if (queue->element[ind].obj == msg)
{
nextHead = queue->element[ind].next;
vqIndex = queue->element[ind].vqIndex;
queue->element[ind].status = FREE_TINYDWFQ;
queue->element[ind].next = -1;
queue->element[ind].obj = (void *)0;
if (queue->virtualQueues[vqIndex][VQ_FREE_HEAD] == -1)
{
queue->virtualQueues[vqIndex][VQ_FREE_HEAD] = queue->virtualQueues[vqIndex][VQ_FREE_TAIL] = ind;
}
else
{
queue->element[queue->virtualQueues[vqIndex][VQ_FREE_TAIL]].next = ind;
queue->virtualQueues[vqIndex][VQ_FREE_TAIL] = ind;
}
queue->numOfElements_VQ[vqIndex]--;
queue->total--;
if (ind == queue->head[status])
{
if (nextHead == -1)
{
queue->head[status] = queue->tail[status] = -1;
}
else
{
queue->head[status] = nextHead;
}
}
else {
#line 813
if (ind == queue->tail[status])
{
queue->tail[status] = prevIndex;
queue->element[prevIndex].next = -1;
}
else
{
queue->element[prevIndex].next = nextHead;
}
}
if (status == PENDING_TINYDWFQ) {
queue->numOfElements_pending--;
}
else {
#line 828
queue->numOfElements_notAcked--;
}
return SUCCESS;
}
else
{
prevIndex = ind;
ind = queue->element[ind].next;
}
}
return FAIL;
}
# 422 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopEngineM.nc"
static result_t MultiHopEngineM$tryNextSend(void)
{
if (!MultiHopEngineM$sendTaskBusy && !isListEmpty_TinyDWFQ(&MultiHopEngineM$sendQueue, PENDING_TINYDWFQ) && MultiHopEngineM$numOfPktProcessing < 4)
{
if (SUCCESS != TOS_post(MultiHopEngineM$sendTask)) {
MultiHopEngineM$sendTaskBusy = FALSE;
}
else {
#line 430
MultiHopEngineM$sendTaskBusy = TRUE;
}
}
#line 432
return SUCCESS;
}
# 859 "/home/xu/oasis/system/TinyDWFQ.h"
static result_t isListEmpty_TinyDWFQ(TinyDWFQPtr queue, ObjStatus_t status)
{
result_t retVal;
#line 862
if (status == NOT_ACKED_TINYDWFQ)
{
if (queue->numOfElements_notAcked) {
retVal = FAIL;
}
else {
#line 867
retVal = SUCCESS;
}
}
else {
#line 869
if (status == PENDING_TINYDWFQ)
{
if (queue->numOfElements_pending) {
retVal = FAIL;
}
else {
#line 874
retVal = SUCCESS;
}
}
}
#line 876
return retVal;
}
# 187 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static uint8_t EventReportM$EventReport$eventSend(uint8_t eventType, uint8_t type,
uint8_t level,
uint8_t *content)
{
uint16_t len;
uint16_t maxLen;
result_t result = SUCCESS;
ApplicationMsg *pApp;
EventMsg *pEvent;
TOS_MsgPtr msgPtr;
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 200
{
if (EventReportM$gLevelMode[type] >= level) {
if ((void *)0 != (msgPtr = allocBuffer(&EventReportM$buffQueue))) {
EventReportM$assignPriority(msgPtr, level);
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(msgPtr, &maxLen);
maxLen = maxLen - (size_t )& ((ApplicationMsg *)0)->data - (size_t )& ((EventMsg *)0)->data;
pEvent = (EventMsg *)pApp->data;
len = strlen(content);
if (len > maxLen) {
len = maxLen;
}
pEvent->length = len;
pEvent->type = type;
pEvent->level = level;
nmemcpy(pEvent->data, content, pEvent->length);
pApp->type = TYPE_SNMS_EVENT;
pApp->length = (size_t )& ((EventMsg *)0)->data + len;
pApp->seqno = EventReportM$seqno++;
result = insertElement(&EventReportM$sendQueue, msgPtr);
EventReportM$tryNextSend();
{
unsigned char __nesc_temp =
#line 230
result;
{
#line 230
__nesc_atomic_end(__nesc_atomic);
#line 230
return __nesc_temp;
}
}
}
else
#line 232
{
{
unsigned char __nesc_temp =
#line 234
BUFFER_FAIL;
{
#line 234
__nesc_atomic_end(__nesc_atomic);
#line 234
return __nesc_temp;
}
}
}
}
else
#line 237
{
;
{
unsigned char __nesc_temp =
#line 239
FILTER_FAIL;
{
#line 239
__nesc_atomic_end(__nesc_atomic);
#line 239
return __nesc_temp;
}
}
}
}
#line 243
__nesc_atomic_end(__nesc_atomic); }
}
#line 298
static void EventReportM$tryNextSend(void)
#line 298
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 299
{
if (!EventReportM$taskBusy && headElement(&EventReportM$sendQueue, PENDING) != (void *)0) {
if (TOS_post(EventReportM$sendEvent) != SUCCESS) {
EventReportM$taskBusy = FALSE;
}
else {
EventReportM$taskBusy = TRUE;
}
}
}
#line 308
__nesc_atomic_end(__nesc_atomic); }
return;
}
# 66 "/home/xu/oasis/lib/SNMS/Event.h"
static uint8_t *eventprintf(const uint8_t *format, ...)
#line 66
{
uint8_t *buf = gTempEventBuf;
uint8_t format_flag;
uint16_t u_val = 0;
#line 70
uint16_t base;
uint8_t *ptr;
va_list ap;
nmemset(gTempEventBuf, 0, sizeof gTempEventBuf);
buf[0] = '\0';
__builtin_va_start(ap, format);
for (; ; ) {
while ((format_flag = * format++) != '%') {
if (!format_flag) {
__builtin_va_end(ap);
return gTempEventBuf;
}
*buf = format_flag;
#line 87
buf++;
#line 87
*buf = 0;
}
switch ((format_flag = * format++)) {
case 'c':
format_flag = (__builtin_va_arg(ap, int ));
default:
*buf = format_flag;
#line 94
buf++;
#line 94
*buf = 0;
continue;
case 'S':
case 's':
ptr = (__builtin_va_arg(ap, char *));
strcat(buf, ptr);
continue;
case 'o':
base = 8;
*buf = '0';
#line 103
buf++;
#line 103
*buf = 0;
goto CONVERSION_LOOP;
case 'i':
if ((int16_t )u_val < 0) {
u_val = -u_val;
*buf = '-';
#line 108
buf++;
#line 108
*buf = 0;
}
case 'u':
base = 10;
goto CONVERSION_LOOP;
case 'x':
base = 16;
CONVERSION_LOOP:
u_val = (__builtin_va_arg(ap, int ));
ptr = gTempScratch + 16;
* --ptr = 0;
do {
char ch = u_val % base + '0';
#line 123
if (ch > '9') {
ch += 'a' - '9' - 1;
}
#line 125
* --ptr = ch;
u_val /= base;
}
while (
#line 127
u_val);
strcat(buf, ptr);
buf += strlen(ptr);
}
}
}
# 270 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$setParent(uint16_t parent)
#line 270
{
uint8_t ind = 0;
#line 272
ind = NeighborMgmtM$findPreparedIndex(parent);
if (ind == ROUTE_INVALID) {
return FALSE;
}
else
#line 275
{
if (!(NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT)) {
NeighborMgmtM$NeighborCtrl$clearParent(FALSE);
NeighborMgmtM$NeighborTbl[ind].relation = NBR_PARENT;
NeighborMgmtM$CascadeControl$parentChanged(parent);
;
}
return TRUE;
}
}
#line 149
static uint8_t NeighborMgmtM$findPreparedIndex(uint16_t id)
#line 149
{
uint8_t indes = NeighborMgmtM$findEntry(id);
#line 151
if (indes == (uint8_t )ROUTE_INVALID) {
indes = NeighborMgmtM$findEntryToBeReplaced();
NeighborMgmtM$newEntry(indes, id);
}
return indes;
}
#line 286
static bool NeighborMgmtM$NeighborCtrl$clearParent(bool reset)
#line 286
{
uint8_t ind = 0;
#line 288
for (ind = 0; ind < 16; ind++) {
if (NeighborMgmtM$NeighborTbl[ind].flags & NBRFLAG_VALID) {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT) {
NeighborMgmtM$NeighborTbl[ind].relation ^= NBR_PARENT;
if (reset) {
NeighborMgmtM$NeighborTbl[ind].flags = 0;
}
return TRUE;
}
}
}
return FALSE;
}
# 407 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static result_t CascadesRouterM$CascadeControl$parentChanged(address_t newParent)
#line 407
{
TOS_MsgPtr tempPtr = (void *)0;
if (newParent == TOS_BCAST_ADDR || CascadesRouterM$inited != TRUE) {
return SUCCESS;
}
if (TRUE != CascadesRouterM$activeRT) {
if (TRUE != CascadesRouterM$ctrlMsgBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 415
CascadesRouterM$ctrlMsgBusy = TRUE;
#line 415
__nesc_atomic_end(__nesc_atomic); }
tempPtr = &CascadesRouterM$SendCtrlMsg;
CascadesRouterM$produceCtrlMsg(tempPtr, CascadesRouterM$expectingSeq, TYPE_CASCADES_REQ);
tempPtr->addr = TOS_BCAST_ADDR;
if (SUCCESS != CascadesRouterM$SubSend$send(AM_CASCTRLMSG, tempPtr, tempPtr->length)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 421
CascadesRouterM$ctrlMsgBusy = FALSE;
#line 421
__nesc_atomic_end(__nesc_atomic); }
}
}
}
return SUCCESS;
}
#line 323
static void CascadesRouterM$produceCtrlMsg(TOS_MsgPtr tmPtr, uint16_t seq, uint8_t type)
#line 323
{
uint8_t localIndex = 0;
int8_t i = 0;
CasCtrlMsg *CCMsg = (CasCtrlMsg *)tmPtr->data;
uint16_t *dst = (uint16_t *)CCMsg->data;
#line 328
CCMsg->dataSeq = seq;
CCMsg->linkSource = TOS_LOCAL_ADDRESS;
CCMsg->type = type;
CCMsg->parent = CascadesRouterM$CascadeControl$getParent();
if (type == TYPE_CASCADES_CMAU) {
if (INVALID_INDEX != (localIndex = CascadesRouterM$findMsgIndex(seq))) {
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (CascadesRouterM$myBuffer[localIndex].childrenList[i].childID != 0 && CascadesRouterM$myBuffer[localIndex].childrenList[i].status != 1) {
* dst++ = CascadesRouterM$myBuffer[localIndex].childrenList[i].childID;
}
}
}
tmPtr->length = sizeof(CasCtrlMsg ) + (MAX_NUM_CHILDREN << 1);
return;
}
tmPtr->length = sizeof(CasCtrlMsg );
return;
}
# 410 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static uint16_t NeighborMgmtM$CascadeControl$getParent(void)
#line 410
{
uint8_t ind = 0;
#line 412
for (ind = 0; ind < 16; ind++) {
if (NeighborMgmtM$NeighborTbl[ind].flags & NBRFLAG_VALID) {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_PARENT) {
return NeighborMgmtM$NeighborTbl[ind].id;
}
}
}
#line 418
return ADDRESS_INVALID;
}
# 130 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static uint8_t CascadesRouterM$findMsgIndex(uint16_t msgSeq)
#line 130
{
int8_t i;
#line 132
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
if (CascadesRouterM$getCasData(& CascadesRouterM$myBuffer[i].tmsg)->seqno == msgSeq) {
return i;
}
}
return INVALID_INDEX;
}
# 68 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static result_t CascadesEngineM$MySend$send(uint8_t type, TOS_MsgPtr msg, uint16_t len)
#line 68
{
if (SUCCESS == CascadesEngineM$insertAndStartSend(msg)) {
CascadesEngineM$updateProtocolField(msg, type, len);
return SUCCESS;
}
else {
return FAIL;
}
}
#line 132
static result_t CascadesEngineM$tryNextSend(void)
#line 132
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 133
{
if (!CascadesEngineM$sendTaskBusy && headElement(&CascadesEngineM$sendQueue, PENDING) != (void *)0) {
if (SUCCESS != TOS_post(CascadesEngineM$sendTask)) {
CascadesEngineM$sendTaskBusy = FALSE;
}
else {
CascadesEngineM$sendTaskBusy = TRUE;
}
}
}
#line 142
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 296 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static result_t GenericCommProM$SendMsg$send(uint8_t id, uint16_t addr, uint8_t len, TOS_MsgPtr msg)
#line 296
{
uint8_t ind = 0;
#line 300
if (len > DATA_LENGTH) {
;
return FAIL;
}
GenericCommProM$updateProtocolField(msg, id, addr, len);
if (GenericCommProM$insertAndStartSend(msg) == SUCCESS) {
;
ind = GenericCommProM$allocateBkHeaderEntry();
if (ind < COMM_SEND_QUEUE_SIZE) {
GenericCommProM$bkHeader[ind].valid = TRUE;
GenericCommProM$bkHeader[ind].length = len;
GenericCommProM$bkHeader[ind].type = id;
GenericCommProM$bkHeader[ind].group = msg->group;
GenericCommProM$bkHeader[ind].msgPtr = msg;
GenericCommProM$bkHeader[ind].addr = addr;
}
else {
;
}
return SUCCESS;
}
else {
;
return FAIL;
}
}
# 82 "/home/xu/oasis/lib/Cascades/CascadesEngineM.nc"
static result_t CascadesEngineM$SendMsg$sendDone(uint8_t type, TOS_MsgPtr msg, result_t success)
#line 82
{
if (SUCCESS != removeElement(&CascadesEngineM$sendQueue, msg)) {
}
CascadesEngineM$MySend$sendDone(type, msg, success);
CascadesEngineM$tryNextSend();
return SUCCESS;
}
# 263 "/home/xu/oasis/lib/SNMS/EventReportM.nc"
static result_t EventReportM$EventSend$sendDone(TOS_MsgPtr pMsg, result_t success)
#line 263
{
uint16_t maxLen;
ApplicationMsg *pApp;
EventMsg *pEvent;
#line 268
pApp = (ApplicationMsg *)EventReportM$EventSend$getBuffer(pMsg, &maxLen);
pEvent = (EventMsg *)pApp->data;
;
if (SUCCESS != removeElement(&EventReportM$sendQueue, pMsg)) {
;
}
EventReportM$EventReport$eventSendDone(pEvent->type, pMsg, success);
freeBuffer(&EventReportM$buffQueue, pMsg);
EventReportM$tryNextSend();
return SUCCESS;
}
# 42 "/opt/tinyos-1.x/tos/system/crc.h"
static uint16_t crcByte(uint16_t crc, uint8_t b)
{
uint8_t i;
crc = crc ^ (b << 8);
i = 8;
do
if (crc & 0x8000) {
crc = (crc << 1) ^ 0x1021;
}
else {
#line 52
crc = crc << 1;
}
while (
#line 53
--i);
return crc;
}
# 470 "/opt/tinyos-1.x/tos/system/FramerM.nc"
static result_t FramerM$TxArbitraryByte(uint8_t inByte)
#line 470
{
if (inByte == FramerM$HDLC_FLAG_BYTE || inByte == FramerM$HDLC_CTLESC_BYTE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 472
{
FramerM$gPrevTxState = FramerM$gTxState;
FramerM$gTxState = FramerM$TXSTATE_ESC;
FramerM$gTxEscByte = inByte;
}
#line 476
__nesc_atomic_end(__nesc_atomic); }
inByte = FramerM$HDLC_CTLESC_BYTE;
}
return FramerM$ByteComm$txByte(inByte);
}
# 650 "/home/xu/oasis/lib/GenericCommPro/GenericCommProM.nc"
static TOS_MsgPtr GenericCommProM$received(TOS_MsgPtr msg)
#line 650
{
uint16_t addr = TOS_LOCAL_ADDRESS;
#line 653
if (msg->crc == 1 && msg->group == TOS_AM_GROUP) {
GenericCommProM$Intercept$intercept(msg, msg->data, msg->length);
}
if (
#line 656
msg->crc == 1 &&
msg->group == TOS_AM_GROUP && (
msg->addr == TOS_BCAST_ADDR ||
msg->addr == addr)) {
uint8_t type = msg->type;
TOS_MsgPtr tmp;
#line 662
tmp = GenericCommProM$ReceiveMsg$receive(type, msg);
if (tmp) {
msg = tmp;
}
}
#line 666
return msg;
}
# 283 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static result_t RealTimeM$RealTime$setTimeCount(uint32_t newCount, uint8_t userMode)
#line 283
{
uint8_t i = 0;
uint32_t interval = 0;
uint32_t localcount = 0;
result_t result = FAIL;
uint32_t microcount = 0;
int32_t diff;
#line 342
if (RealTimeM$syncMode == FTSP_SYNC && userMode == FTSP_SYNC) {
RealTimeM$GlobalTime$getGlobalTime(&localcount);
if (localcount) {
if (RealTimeM$is_synced != TRUE) {
RealTimeM$localTime = localcount;
;
RealTimeM$is_synced = TRUE;
result = SUCCESS;
}
}
}
if (RealTimeM$syncMode == GPS_SYNC && userMode == GPS_SYNC) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 362
RealTimeM$localTime = newCount;
#line 362
__nesc_atomic_end(__nesc_atomic); }
RealTimeM$uc_fire_point = RealTimeM$uc_fire_interval;
RealTimeM$Clock$setInterval(RealTimeM$uc_fire_point);
RealTimeM$is_synced = TRUE;
result = SUCCESS;
}
if (RealTimeM$mState && RealTimeM$is_synced) {
for (i = 0; i < MAX_NUM_CLIENT; i++) {
if (RealTimeM$mState & (0x1L << i)) {
interval = RealTimeM$clientList[i].syncInterval;
if (interval != 0) {
RealTimeM$clientList[i].fireCount = (RealTimeM$localTime + interval - RealTimeM$localTime % interval) % DAY_END;
}
}
}
}
return result;
}
#line 613
static uint32_t RealTimeM$LocalTime$read(void)
#line 613
{
uint32_t time;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 616
time = RealTimeM$localTime;
#line 616
__nesc_atomic_end(__nesc_atomic); }
return time;
}
# 231 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static result_t TimeSyncM$GlobalTime$local2Global(uint32_t *time)
{
*time += TimeSyncM$offsetAverage + (int32_t )(TimeSyncM$skew * (int32_t )(*time - TimeSyncM$localAverage));
return TimeSyncM$is_synced();
}
#line 213
static result_t TimeSyncM$is_synced(void)
{
return TimeSyncM$numEntries >= TimeSyncM$ENTRY_VALID_LIMIT || ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS;
}
# 302 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$addChild(uint16_t childAddr, uint16_t priorHop, bool isDirect)
#line 302
{
uint8_t ind = 0;
#line 304
ind = NeighborMgmtM$findPreparedIndex(childAddr);
if (ind == ROUTE_INVALID) {
return FALSE;
}
else
#line 307
{
if (isDirect) {
if (!(NeighborMgmtM$NeighborTbl[ind].relation & NBR_DIRECT_CHILD)) {
NeighborMgmtM$NeighborTbl[ind].relation = NBR_DIRECT_CHILD | NBR_CHILD;
NeighborMgmtM$CascadeControl$addDirectChild(childAddr);
}
}
else {
if (NeighborMgmtM$NeighborTbl[ind].relation & NBR_DIRECT_CHILD) {
NeighborMgmtM$CascadeControl$deleteDirectChild(childAddr);
}
NeighborMgmtM$NeighborTbl[ind].relation = NBR_CHILD;
}
NeighborMgmtM$NeighborTbl[ind].priorHop = priorHop;
NeighborMgmtM$NeighborTbl[ind].childLiveliness = CHILD_LIVELINESS;
return TRUE;
}
}
# 188 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$addToChildrenList(address_t nodeID)
#line 188
{
int8_t i;
int8_t myIndex;
bool found;
int8_t first = 0;
#line 193
for (myIndex = MAX_CAS_BUF - 1; myIndex >= 0; myIndex--) {
found = FALSE;
for (i = 0; i < MAX_NUM_CHILDREN; i++) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
if (found != TRUE) {
found = TRUE;
}
else {
CascadesRouterM$myBuffer[myIndex].childrenList[i].childID = 0;
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 0;
}
}
else {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == 0) {
if (first == 0) {
first = i;
}
}
}
}
if (found != TRUE) {
CascadesRouterM$myBuffer[myIndex].childrenList[first].childID = nodeID;
CascadesRouterM$myBuffer[myIndex].childrenList[first].status = 0;
}
}
}
#line 167
static void CascadesRouterM$delFromChildrenList(address_t nodeID)
#line 167
{
int8_t i;
int8_t myIndex;
#line 170
for (myIndex = MAX_CAS_BUF - 1; myIndex >= 0; myIndex--) {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
CascadesRouterM$myBuffer[myIndex].childrenList[i].childID = 0;
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 0;
}
}
}
}
# 146 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static uint16_t MultiHopLQI$adjustLQI(uint8_t val)
#line 146
{
uint16_t result = 80 - (val - 50);
#line 148
result = (result * result >> 3) * result >> 3;
return result;
}
# 384 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static bool NeighborMgmtM$NeighborCtrl$setCost(uint16_t addr, uint16_t parentCost)
#line 384
{
uint8_t ind = 0;
#line 386
ind = NeighborMgmtM$findPreparedIndex(addr);
if (ind == ROUTE_INVALID) {
;
return FALSE;
}
else {
NeighborMgmtM$NeighborTbl[ind].parentCost = parentCost;
return TRUE;
}
}
# 152 "/home/xu/oasis/lib/MultiHopOasis-DWFQ/MultiHopLQI.nc"
static void MultiHopLQI$SendRouteTask(void)
#line 152
{
NetworkMsg *pNWMsg = (NetworkMsg *)&MultiHopLQI$msgBuf.data[0];
BeaconMsg *pRP = (BeaconMsg *)&pNWMsg->data[0];
uint8_t length = (size_t )& ((NetworkMsg *)0)->data + sizeof(BeaconMsg );
{
}
#line 157
;
if (MultiHopLQI$gbCurrentParent != TOS_BCAST_ADDR) {
{
}
#line 160
;
}
if (MultiHopLQI$msgBufBusy) {
;
if (MultiHopLQI$localBeSink) {
MultiHopLQI$EventReport$eventSend(EVENT_TYPE_SNMS,
EVENT_LEVEL_URGENT, eventprintf("Engine:from %i ROUTE BUSY", TOS_LOCAL_ADDRESS));
}
return;
}
{
}
#line 175
;
pRP->parent = MultiHopLQI$gbCurrentParent;
pRP->parent_dup = MultiHopLQI$gbCurrentParent;
pRP->cost = MultiHopLQI$gbCurrentParentCost + MultiHopLQI$gbCurrentLinkEst;
pNWMsg->linksource = pNWMsg->source = TOS_LOCAL_ADDRESS;
pRP->hopcount = MultiHopLQI$gbCurrentHopCount;
pNWMsg->seqno = MultiHopLQI$gCurrentSeqNo++;
if (MultiHopLQI$SendMsg$send(TOS_BCAST_ADDR, length, &MultiHopLQI$msgBuf) == SUCCESS) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 186
MultiHopLQI$msgBufBusy = TRUE;
#line 186
__nesc_atomic_end(__nesc_atomic); }
}
}
# 960 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static TOS_MsgPtr CascadesRouterM$ReceiveMsg$receive(uint8_t type, TOS_MsgPtr tmsg)
#line 960
{
CasCtrlMsg *CCMsg;
#line 962
if (type == AM_CASCTRLMSG) {
CCMsg = (CasCtrlMsg *)tmsg->data;
switch (CCMsg->type) {
case TYPE_CASCADES_NODATA: {
CascadesRouterM$processNoData(tmsg);
}
break;
case TYPE_CASCADES_ACK: {
CascadesRouterM$processACK(tmsg);
}
break;
case TYPE_CASCADES_REQ: {
if (CascadesRouterM$RequestProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvRequestMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 976
CascadesRouterM$RequestProcessBusy = TOS_post(CascadesRouterM$processRequest);
#line 976
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
case TYPE_CASCADES_CMAU: {
if (CascadesRouterM$CMAuProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvCMAuMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 983
CascadesRouterM$CMAuProcessBusy = TOS_post(CascadesRouterM$processCMAu);
#line 983
__nesc_atomic_end(__nesc_atomic); }
}
}
break;
default: {
;
}
#line 989
break;
}
}
else {
#line 992
if (type == AM_CASCADESMSG) {
if (CascadesRouterM$DataProcessBusy != TRUE) {
nmemcpy((void *)&CascadesRouterM$RecvDataMsg, (void *)tmsg, sizeof(TOS_Msg ));
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 995
CascadesRouterM$DataProcessBusy = TOS_post(CascadesRouterM$processData);
#line 995
__nesc_atomic_end(__nesc_atomic); }
}
}
else {
;
}
}
#line 1001
return tmsg;
}
#line 148
static void CascadesRouterM$addChildACK(address_t nodeID, uint8_t myIndex)
#line 148
{
int8_t i;
#line 150
if (myIndex < MAX_CAS_BUF) {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myIndex].childrenList[i].childID == nodeID) {
CascadesRouterM$myBuffer[myIndex].childrenList[i].status = 1;
}
}
}
}
#line 254
static bool CascadesRouterM$getCMAu(uint8_t myindex)
#line 254
{
int8_t i = 0;
#line 256
if (CascadesRouterM$myBuffer[myindex].countDT == 0) {
return TRUE;
}
else {
for (i = MAX_NUM_CHILDREN - 1; i >= 0; i--) {
if (CascadesRouterM$myBuffer[myindex].childrenList[i].childID != 0) {
if (CascadesRouterM$myBuffer[myindex].childrenList[i].status != 1) {
return FALSE;
}
}
}
}
return TRUE;
}
# 647 "build/imote2/RpcM.nc"
static TOS_MsgPtr RpcM$CommandReceive$receive(TOS_MsgPtr pMsg, void *payload, uint16_t payloadLength)
#line 647
{
NetworkMsg *nwMsg = (NetworkMsg *)pMsg->data;
ApplicationMsg *AMsg = (ApplicationMsg *)payload;
RpcCommandMsg *msg = (RpcCommandMsg *)AMsg->data;
RpcM$debugSequenceNo = nwMsg->seqno;
if (RpcM$processingCommand == FALSE) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 660
RpcM$processingCommand = TRUE;
#line 660
__nesc_atomic_end(__nesc_atomic); }
if (msg->address == TOS_LOCAL_ADDRESS || msg->address == TOS_BCAST_ADDR) {
nmemcpy(RpcM$cmdStore.data, payload, payloadLength);
RpcM$cmdStoreLength = payloadLength;
RpcM$debugSequenceNo = nwMsg->seqno;
if (SUCCESS != TOS_post(RpcM$processCommand)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 668
RpcM$processingCommand = FALSE;
#line 668
__nesc_atomic_end(__nesc_atomic); }
;
return (void *)0;
}
else {
;
}
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 678
RpcM$processingCommand = FALSE;
#line 678
__nesc_atomic_end(__nesc_atomic); }
;
}
}
else {
;
return (void *)0;
}
return pMsg;
}
# 285 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static result_t FlashManagerM$FlashManager$write(uint32_t addr, void *data, uint16_t numBytes)
#line 285
{
if (TRUE != FlashManagerM$writeTaskBusy) {
if (numBytes > 2) {
nmemcpy(&FlashManagerM$buffer_fw, (void *)data, numBytes);
FlashManagerM$numToWrite = numBytes;
FlashManagerM$buffer_fw.RFChannel = FlashManagerM$RFChannel;
;
}
else {
#line 293
if (numBytes == 1) {
FlashManagerM$RFChannel = FlashManagerM$buffer_fw.RFChannel;
nmemcpy(& FlashManagerM$buffer_fw.RFChannel, (void *)data, numBytes);
if (FlashManagerM$RFChannel == FlashManagerM$buffer_fw.RFChannel) {
return SUCCESS;
}
FlashManagerM$buffer_fw.FlashFlag = 1;
FlashManagerM$buffer_fw.ProgID = G_Ident.unix_time;
FlashManagerM$RFChannel = FlashManagerM$buffer_fw.RFChannel;
;
}
}
}
else
#line 304
{
;
}
if (TRUE != FlashManagerM$alreadyStart) {
FlashManagerM$EraseTimer$start(TIMER_ONE_SHOT, ERASE_TIMER_INTERVAL);
FlashManagerM$alreadyStart = TRUE;
}
return SUCCESS;
}
# 264 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420ControlM.nc"
static result_t CC2420ControlM$CC2420Control$TunePreset(uint8_t chnl)
#line 264
{
int fsctrl;
uint8_t status;
fsctrl = 357 + 5 * (chnl - 11);
CC2420ControlM$gCurrentParameters[CP_FSCTRL] = (CC2420ControlM$gCurrentParameters[CP_FSCTRL] & 0xfc00) | (fsctrl << 0);
status = CC2420ControlM$HPLChipcon$write(0x18, CC2420ControlM$gCurrentParameters[CP_FSCTRL]);
if (status & (1 << 6)) {
CC2420ControlM$HPLChipcon$cmd(0x03);
}
#line 275
return SUCCESS;
}
# 119 "/opt/tinyos-1.x/tos/system/LedsC.nc"
static result_t LedsC$Leds$greenToggle(void)
#line 119
{
result_t rval;
#line 121
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 121
{
if (LedsC$ledsOn & LedsC$GREEN_BIT) {
rval = LedsC$Leds$greenOff();
}
else {
#line 125
rval = LedsC$Leds$greenOn();
}
}
#line 127
__nesc_atomic_end(__nesc_atomic); }
#line 127
return rval;
}
#line 148
static result_t LedsC$Leds$yellowToggle(void)
#line 148
{
result_t rval;
#line 150
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 150
{
if (LedsC$ledsOn & LedsC$YELLOW_BIT) {
rval = LedsC$Leds$yellowOff();
}
else {
#line 154
rval = LedsC$Leds$yellowOn();
}
}
#line 156
__nesc_atomic_end(__nesc_atomic); }
#line 156
return rval;
}
# 754 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$upFlashClient(void)
#line 754
{
FlashCliUnit.RFChannel = 0;
FlashCliUnit.FlashFlag = 1;
FlashCliUnit.ProgID = G_Ident.unix_time;
nmemcpy((void *)& (&FlashCliUnit)->FlashSensor, (void *)(sensor + 3), 5 * sizeof(SensorClient_t ));
}
#line 840
static void SmartSensingM$setrate(void)
#line 840
{
uint16_t oldInterval = SmartSensingM$timerInterval;
#line 842
SmartSensingM$timerInterval = SmartSensingM$calFireInterval();
if (oldInterval != SmartSensingM$timerInterval) {
SmartSensingM$SensingTimer$start(TIMER_REPEAT, SmartSensingM$timerInterval);
}
if (0 != SmartSensingM$timerInterval) {
SmartSensingM$WatchTimer$start(TIMER_REPEAT, 1024);
}
else {
#line 849
SmartSensingM$WatchTimer$stop();
}
}
# 743 "build/imote2/RpcM.nc"
static void RpcM$tryNextSend(void)
#line 743
{
if (TRUE != RpcM$taskBusy) {
RpcM$taskBusy = TOS_post(RpcM$sendResponse);
}
return;
}
# 575 "/home/xu/oasis/lib/Cascades/CascadesRouterM.nc"
static void CascadesRouterM$sigRcvTask(void)
#line 575
{
TOS_MsgPtr tempPtr = (void *)0;
NetworkMsg *nwMsg = (void *)0;
int8_t i;
for (i = MAX_CAS_BUF - 1; i >= 0; i--) {
tempPtr = & CascadesRouterM$myBuffer[i].tmsg;
if (tempPtr != (void *)0) {
nwMsg = (NetworkMsg *)tempPtr->data;
if (nwMsg->seqno == CascadesRouterM$nextSignalSeq) {
if (CascadesRouterM$Receive$receive(nwMsg->type, tempPtr, nwMsg->data,
tempPtr->length - (size_t )& ((NetworkMsg *)0)->data)) {
CascadesRouterM$myBuffer[i].signalDone = 1;
break;
}
else {
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
return;
}
}
}
}
if (CascadesRouterM$nextSignalSeq != CascadesRouterM$highestSeq + 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 601
{
CascadesRouterM$inData[CascadesRouterM$nextSignalSeq % MAX_CAS_PACKETS] = TRUE;
++CascadesRouterM$nextSignalSeq;
CascadesRouterM$expectingSeq = CascadesRouterM$highestSeq + 1;
CascadesRouterM$sigRcvTaskBusy = TOS_post(CascadesRouterM$sigRcvTask);
}
#line 606
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 609
CascadesRouterM$sigRcvTaskBusy = FALSE;
#line 609
__nesc_atomic_end(__nesc_atomic); }
}
}
# 393 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$startSend(void)
#line 393
{
if (!CC2420RadioM$HPLChipcon$cmd(0x09)) {
CC2420RadioM$sendFailed();
return;
}
if (!CC2420RadioM$HPLChipconFIFO$writeTXFIFO(CC2420RadioM$txlength + 1, (uint8_t *)CC2420RadioM$txbufptr)) {
CC2420RadioM$sendFailed();
return;
}
}
#line 113
static void CC2420RadioM$sendFailed(void)
#line 113
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 114
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
#line 114
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$txbufptr->length = CC2420RadioM$txbufptr->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
CC2420RadioM$Send$sendDone(CC2420RadioM$txbufptr, FAIL);
}
# 665 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static void HPLCC2420M$signalTXFIFO(void)
#line 665
{
uint8_t len;
#line 666
uint8_t *buf;
#line 667
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 667
{
len = HPLCC2420M$txlen;
buf = HPLCC2420M$txbuf;
}
#line 670
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$HPLCC2420FIFO$TXFIFODone(len, buf);
}
# 410 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$tryToSend(void)
#line 410
{
uint8_t currentstate;
#line 412
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 412
currentstate = CC2420RadioM$stateRadio;
#line 412
__nesc_atomic_end(__nesc_atomic); }
if (currentstate == CC2420RadioM$PRE_TX_STATE) {
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
}
if (TOSH_READ_RADIO_CCA_PIN()) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 424
CC2420RadioM$stateRadio = CC2420RadioM$TX_STATE;
#line 424
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$sendPacket();
}
else {
if (CC2420RadioM$countRetry-- <= 0) {
CC2420RadioM$flushRXFIFO();
CC2420RadioM$countRetry = 8;
if (!TOS_post(CC2420RadioM$startSend)) {
CC2420RadioM$sendFailed();
}
#line 436
return;
}
if (!CC2420RadioM$setBackoffTimer(CC2420RadioM$MacBackoff$congestionBackoff(CC2420RadioM$txbufptr) * 10)) {
CC2420RadioM$sendFailed();
}
}
}
}
#line 119
static void CC2420RadioM$flushRXFIFO(void)
#line 119
{
CC2420RadioM$FIFOP$disable();
CC2420RadioM$HPLChipcon$read(0x3F);
CC2420RadioM$HPLChipcon$cmd(0x08);
CC2420RadioM$HPLChipcon$cmd(0x08);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 124
CC2420RadioM$bPacketReceiving = FALSE;
#line 124
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$FIFOP$startWait(FALSE);
}
# 295 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static uint16_t HPLCC2420M$HPLCC2420$read(uint8_t addr)
#line 295
{
uint16_t data = 0;
uint8_t tmp;
if (HPLCC2420M$getSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420ReadContentionError);
return 0;
}
{
#line 310
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 310
;
{
#line 312
TOSH_CLR_CC_CSN_PIN();
#line 312
TOSH_uwait(1);
}
#line 312
;
* (volatile uint32_t *)0x41900010 = addr | 0x40;
* (volatile uint32_t *)0x41900010 = 0;
* (volatile uint32_t *)0x41900010 = 0;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
{
#line 319
TOSH_uwait(1);
#line 319
TOSH_SET_CC_CSN_PIN();
}
#line 319
;
tmp = * (volatile uint32_t *)0x41900010;
data = * (volatile uint32_t *)0x41900010;
data = (data << 8) & 0xFF00;
data |= * (volatile uint32_t *)0x41900010;
{
#line 326
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 326
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420ReadReleaseError);
return 0;
}
return data;
}
#line 777
static result_t HPLCC2420M$InterruptFIFOP$startWait(bool low_to_high)
#line 777
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 779
{
HPLCC2420M$FIFOP_GPIOInt$disable();
HPLCC2420M$FIFOP_GPIOInt$clear();
if (low_to_high) {
HPLCC2420M$FIFOP_GPIOInt$enable(1);
}
else {
HPLCC2420M$FIFOP_GPIOInt$enable(2);
}
}
#line 788
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
#line 822
static result_t HPLCC2420M$CaptureSFD$enableCapture(bool low_to_high)
#line 822
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 824
{
HPLCC2420M$SFD_GPIOInt$enable(3);
}
#line 828
__nesc_atomic_end(__nesc_atomic); }
return SUCCESS;
}
# 168 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$PacketSent(void)
#line 168
{
TOS_MsgPtr pBuf;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 171
{
CC2420RadioM$stateRadio = CC2420RadioM$IDLE_STATE;
pBuf = CC2420RadioM$txbufptr;
pBuf->length = pBuf->length - MSG_HEADER_SIZE - MSG_FOOTER_SIZE;
}
#line 175
__nesc_atomic_end(__nesc_atomic); }
CC2420RadioM$Send$sendDone(pBuf, SUCCESS);
}
# 182 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static uint32_t RealTimeM$RealTime$getTimeCount(void)
#line 182
{
uint32_t temp;
if (RealTimeM$syncMode == FTSP_SYNC) {
RealTimeM$GlobalTime$getGlobalTime(&temp);
}
if (RealTimeM$syncMode == GPS_SYNC) {
temp = RealTimeM$GPSGlobalTime$getGlobalTime();
}
if (temp >= DAY_END) {
return temp - DAY_END;
}
return temp;
}
# 170 "/home/xu/oasis/system/platform/imote2/ADC/GPSSensorM.nc"
static uint32_t GPSSensorM$GPSGlobalTime$getGlobalTime(void)
#line 170
{
uint32_t time = 0;
#line 172
time = GPSSensorM$GPSGlobalTime$getLocalTime();
time = GPSSensorM$GPSGlobalTime$local2Global(time);
return time;
}
static uint32_t GPSSensorM$GPSGlobalTime$local2Global(uint32_t time)
#line 186
{
uint32_t temp = 0;
#line 188
temp = (uint32_t )(GPSSensorM$offsetAverage + (int32_t )(GPSSensorM$skew * (int32_t )(time - GPSSensorM$localAverage)));
temp += time;
return temp;
}
# 305 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static result_t DataMgmtM$DataMgmt$saveBlk(void *obj, uint8_t mediumType)
#line 305
{
result_t result = FAIL;
#line 307
if (obj != 0) {
result = changeMemStatus(&DataMgmtM$sensorMem, (SenBlkPtr )obj, ((SenBlkPtr )obj)->status, FILLED);
}
return result;
}
# 247 "/home/xu/oasis/lib/SmartSensing/SensorMem.h"
static result_t changeMemStatus(MemQueue_t *queue, SenBlkPtr obj, MemStatus_t status1, MemStatus_t status2)
#line 247
{
int16_t ind;
#line 249
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 249
ind = queue->head[status1];
#line 249
__nesc_atomic_end(__nesc_atomic); }
while (ind != -1) {
if (&queue->element[ind] == obj) {
_private_changeMemStatusByIndex(queue, ind, status1, status2);
return SUCCESS;
}
else
#line 254
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 255
ind = queue->element[ind].next;
#line 255
__nesc_atomic_end(__nesc_atomic); }
}
}
return FAIL;
}
# 475 "/home/xu/oasis/system/platform/imote2/RTC/RealTimeM.nc"
static void RealTimeM$signalOneTimer(void)
#line 475
{
uint8_t itimer;
#line 477
if ((itimer = RealTimeM$dequeue()) < 30) {
RealTimeM$Timer$fired(itimer);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 479
RealTimeM$taskBusy = TOS_post(RealTimeM$signalOneTimer);
#line 479
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 482
RealTimeM$taskBusy = FALSE;
#line 482
__nesc_atomic_end(__nesc_atomic); }
}
}
# 775 "/home/xu/oasis/lib/SmartSensing/SmartSensingM.nc"
static void SmartSensingM$saveData(uint8_t client, uint16_t data)
#line 775
{
SenBlkPtr p = sensor[client].curBlkPtr;
result_t result;
if ((void *)0 != p) {
if (p->type == TYPE_DATA_LQI) {
if (SmartSensingM$LQIFactor++ % LQI_SAMPLE_INTERVAL == 0) {
p->size = SmartSensingM$writeNbrLinkInfo(p->buffer, MAX_BUFFER_SIZE);
p->taskCode = 0;
p->priority = sensor[client].dataPriority + sensor[client].nodePriority;
SmartSensingM$DataMgmt$saveBlk((void *)p, 0);
sensor[client].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(client);
return;
}
else {
return;
}
}
p->priority = sensor[client].dataPriority + sensor[client].nodePriority;
if (p->priority == 0) {
return;
}
if (p->size < MAX_BUFFER_SIZE) {
* (uint16_t *)(p->buffer + p->size) = data;
p->size += MAX_DATA_WIDTH;
if (p->type == TYPE_DATA_RVOL) {
* (uint16_t *)(p->buffer + p->size) = SmartSensingM$RouteControl$getQuality();
p->size += MAX_DATA_WIDTH;
}
}
if (p->size >= MAX_BUFFER_SIZE) {
p->size = MAX_BUFFER_SIZE;
p->taskCode = SmartSensingM$defaultCode;
p->priority = sensor[client].dataPriority + sensor[client].nodePriority;
result = SmartSensingM$DataMgmt$saveBlk((void *)p, 0);
if (result == SUCCESS) {
SmartSensingM$Leds$yellowToggle();
}
else
#line 817
{
SmartSensingM$EventReport$eventSend(EVENT_TYPE_DATAMANAGE,
EVENT_LEVEL_URGENT, eventprintf("Smartsensing: Node %i Fail to save data.\n", TOS_LOCAL_ADDRESS));
}
sensor[client].curBlkPtr = (SenBlkPtr )SmartSensingM$DataMgmt$allocBlk(client);
}
}
else
{
;
return;
}
}
# 170 "/home/xu/oasis/system/platform/imote2/ADC/ADCM.nc"
static result_t ADCM$ADC$getData(uint8_t client)
#line 170
{
if (client >= MAX_SENSOR_NUM) {
return FAIL;
}
ADCM$reading[ADCM$dataindex].id = client;
ADCM$reading[ADCM$dataindex].data = ADCM$readADC(ADCM$channel[client]);
if (TRUE != ADCM$taskBusy) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 177
ADCM$taskBusy = TOS_post(ADCM$signalOneSensor);
#line 177
__nesc_atomic_end(__nesc_atomic); }
}
ADCM$enqueue(ADCM$dataindex);
if (++ADCM$dataindex >= 40) {
ADCM$dataindex = 0;
}
return SUCCESS;
}
#line 159
static void ADCM$signalOneSensor(void)
#line 159
{
uint8_t client;
#line 161
if ((client = ADCM$dequeue()) < 40) {
ADCM$ADC$dataReady(ADCM$reading[client].id, ADCM$reading[client].data);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 163
ADCM$taskBusy = TOS_post(ADCM$signalOneSensor);
#line 163
__nesc_atomic_end(__nesc_atomic); }
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 166
ADCM$taskBusy = FALSE;
#line 166
__nesc_atomic_end(__nesc_atomic); }
}
}
# 232 "/home/xu/oasis/lib/NeighborMgmt/NeighborMgmtM.nc"
static uint16_t NeighborMgmtM$adjustLQI(uint8_t val)
#line 232
{
uint16_t result = 80 - (val - 50);
#line 234
result = (result * result >> 3) * result >> 3;
return result;
}
# 601 "/home/xu/oasis/lib/SmartSensing/DataMgmtM.nc"
static void DataMgmtM$processTask(void)
#line 601
{
SenBlkPtr inPtr = (void *)0;
uint16_t taskCode = 0;
SenBlkPtr outPtr = (void *)0;
int16_t nextInd = -1;
DataMgmtM$processTaskCount++;
DataMgmtM$processloopCount = 0;
DataMgmtM$GlobaltaskCode = 0;
if ((void *)0 != (inPtr = headMemElement(&DataMgmtM$sensorMem, FILLED))) {
taskCode = inPtr->taskCode;
while (taskCode != 0) {
DataMgmtM$processloopCount++;
DataMgmtM$GlobaltaskCode = taskCode;
if ((taskCode & TASK_MASK) == RSAM_FUNC) {
if (inPtr->type == TYPE_DATA_SEISMIC) {
outPtr = sensor[RSAM1_CLIENT_ID].curBlkPtr;
}
else {
#line 626
if (inPtr->type == TYPE_DATA_INFRASONIC) {
outPtr = sensor[RSAM2_CLIENT_ID].curBlkPtr;
}
else {
taskCode = taskCode >> TASK_CODE_SIZE;
inPtr->taskCode = taskCode;
continue;
}
}
#line 634
if ((void *)0 != outPtr) {
if (outPtr->time == 0) {
outPtr->time = inPtr->time;
}
if (outPtr->size + MAX_DATA_WIDTH >= MAX_BUFFER_SIZE) {
DataMgmtM$DataMgmt$saveBlk((void *)outPtr, 0);
outPtr = (void *)0;
}
}
if ((void *)0 == outPtr) {
if (inPtr->type == TYPE_DATA_SEISMIC) {
sensor[RSAM1_CLIENT_ID].curBlkPtr = (SenBlkPtr )DataMgmtM$DataMgmt$allocBlk(RSAM1_CLIENT_ID);
outPtr = sensor[RSAM1_CLIENT_ID].curBlkPtr;
}
else {
sensor[RSAM2_CLIENT_ID].curBlkPtr = (SenBlkPtr )DataMgmtM$DataMgmt$allocBlk(RSAM2_CLIENT_ID);
outPtr = sensor[RSAM2_CLIENT_ID].curBlkPtr;
}
}
if ((void *)0 != outPtr) {
outPtr->interval = ONE_MS;
outPtr->taskCode = 0;
if (inPtr->type == TYPE_DATA_SEISMIC) {
outPtr->priority = RSAM1_DATA_PRIORITY;
outPtr->type = TYPE_DATA_RSAM1;
}
else {
outPtr->priority = RSAM2_DATA_PRIORITY;
outPtr->type = TYPE_DATA_RSAM2;
}
}
}
if ((taskCode & TASK_MASK) == COMPRESS_FUNC) {
if (inPtr->type != TYPE_DATA_SEISMIC) {
taskCode = taskCode >> TASK_CODE_SIZE;
inPtr->taskCode = taskCode;
break;
}
outPtr = headMemElement(&DataMgmtM$sensorMem, MEMCOMPRESSING);
if ((void *)0 != outPtr && outPtr->size >= MAX_BUFFER_SIZE) {
outPtr->size = MAX_BUFFER_SIZE;
outPtr->taskCode = 0;
outPtr->priority = inPtr->priority;
DataMgmtM$DataMgmt$saveBlk((void *)outPtr, 0);
outPtr = (void *)0;
}
if ((void *)0 == outPtr) {
if ((void *)0 != (outPtr = DataMgmtM$DataMgmt$allocBlk(COMPRESS_CLIENT_ID))) {
changeMemStatus(&DataMgmtM$sensorMem, outPtr, outPtr->status, MEMCOMPRESSING);
outPtr->time = inPtr->time;
outPtr->type = TYPE_DATA_COMPRESS;
outPtr->compressnum = 0;
outPtr->interval = inPtr->interval;
}
}
}
if (FAIL != processFunc[taskCode & TASK_MASK](inPtr, outPtr)) {
if ((taskCode & TASK_MASK) == COMPRESS_FUNC) {
DataMgmtM$DataMgmt$freeBlk((void *)inPtr);
break;
}
else {
taskCode = taskCode >> TASK_CODE_SIZE;
inPtr->taskCode = taskCode;
}
}
else
{
changeMemStatus(&DataMgmtM$sensorMem, inPtr, inPtr->status, MEMPROCESSING);
if ((taskCode & TASK_MASK) == COMPRESS_FUNC) {
if (outPtr->size >= MAX_BUFFER_SIZE) {
outPtr->size = MAX_BUFFER_SIZE;
outPtr->taskCode = 0;
outPtr->priority = inPtr->priority;
DataMgmtM$DataMgmt$saveBlk((void *)outPtr, 0);
outPtr = (void *)0;
}
else {
}
if ((void *)0 == outPtr) {
if ((void *)0 != (outPtr = DataMgmtM$DataMgmt$allocBlk(COMPRESS_CLIENT_ID))) {
changeMemStatus(&DataMgmtM$sensorMem, outPtr, outPtr->status, MEMCOMPRESSING);
outPtr->time = inPtr->time;
outPtr->type = TYPE_DATA_COMPRESS;
outPtr->compressnum = 0;
outPtr->interval = inPtr->interval;
}
}
}
break;
}
}
if (TRUE == event_onset) {
event_onset = FALSE;
}
DataMgmtM$processloopCount = 0;
if (taskCode == 0) {
changeMemStatus(&DataMgmtM$sensorMem, inPtr, inPtr->status, MEMPENDING);
}
}
if ((void *)0 != (inPtr = headMemElement(&DataMgmtM$sensorMem, MEMPROCESSING))) {
taskCode = inPtr->taskCode;
while (taskCode != 0) {
if (FAIL != processFunc[taskCode & TASK_MASK](inPtr, outPtr)) {
if ((taskCode & TASK_MASK) == COMPRESS_FUNC && inPtr->type == TYPE_DATA_SEISMIC) {
DataMgmtM$DataMgmt$freeBlk((void *)inPtr);
break;
}
else {
taskCode = taskCode >> TASK_CODE_SIZE;
inPtr->taskCode = taskCode;
}
}
else {
break;
}
}
if (taskCode == 0) {
changeMemStatus(&DataMgmtM$sensorMem, inPtr, inPtr->status, MEMPENDING);
}
}
if (TRUE != DataMgmtM$presendTaskBusy) {
if ((void *)0 != headMemElement(&DataMgmtM$sensorMem, MEMPENDING)) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 807
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 807
__nesc_atomic_end(__nesc_atomic); }
}
}
if ((void *)0 != headMemElement(&DataMgmtM$sensorMem, FILLED)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 813
DataMgmtM$processTaskBusy = TOS_post(DataMgmtM$processTask);
#line 813
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 817
DataMgmtM$processTaskBusy = FALSE;
#line 817
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
#line 508
static void DataMgmtM$presendTask(void)
#line 508
{
NetworkMsg *nwMsg = (void *)0;
ApplicationMsg *appMsg = (void *)0;
TOS_MsgPtr msg = (void *)0;
SenBlkPtr p = (void *)0;
TimeStamp_t *ts = (void *)0;
#line 515
DataMgmtM$presendTaskCount++;
if ((void *)0 != (p = headMemElement(&DataMgmtM$sensorMem, MEMPENDING))) {
if ((void *)0 != (msg = allocBuffer(&DataMgmtM$buffQueue))) {
DataMgmtM$allocbuffercount++;
nwMsg = (NetworkMsg *)msg->data;
nwMsg->qos = p->priority;
appMsg = (ApplicationMsg *)nwMsg->data;
appMsg->length = TSTAMPOFFSET + p->size;
appMsg->type = p->type;
appMsg->seqno = DataMgmtM$seqno;
if (nwMsg->qos == 0) {
DataMgmtM$DataMgmt$freeBlk((void *)p);
freeBuffer(&DataMgmtM$buffQueue, msg);
DataMgmtM$presendTaskBusy = FALSE;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 533
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 533
__nesc_atomic_end(__nesc_atomic); }
return;
}
ts = (TimeStamp_t *)appMsg->data;
ts->millisec = p->time % 1000UL;
ts->second = p->time / 1000UL % 60;
ts->minute = p->time / 60000UL % 60;
ts->interval = p->interval;
nmemcpy((void *)(appMsg->data + TSTAMPOFFSET), (void *)p->buffer, p->size);
if (SUCCESS != DataMgmtM$insertAndStartSend(msg)) {
;
DataMgmtM$freebuffercount++;
freeBuffer(&DataMgmtM$buffQueue, msg);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 551
DataMgmtM$presendTaskBusy = FALSE;
#line 551
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
if (p->type == TYPE_DATA_COMPRESS && p->compressnum > 0) {
DataMgmtM$seqno += p->compressnum - 1;
}
DataMgmtM$DataMgmt$freeBlk((void *)p);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 560
DataMgmtM$seqno++;
#line 560
__nesc_atomic_end(__nesc_atomic); }
}
}
else
{
DataMgmtM$f_allocbuffercount++;
DataMgmtM$tryNextSend();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 568
DataMgmtM$presendTaskBusy = FALSE;
#line 568
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
else {
DataMgmtM$nothingtosend++;
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 576
DataMgmtM$presendTaskBusy = FALSE;
#line 576
__nesc_atomic_end(__nesc_atomic); }
return;
}
if (headMemElement(&DataMgmtM$sensorMem, MEMPENDING) != (void *)0) {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 581
DataMgmtM$presendTaskBusy = TOS_post(DataMgmtM$presendTask);
#line 581
__nesc_atomic_end(__nesc_atomic); }
return;
}
else {
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 586
DataMgmtM$presendTaskBusy = FALSE;
#line 586
__nesc_atomic_end(__nesc_atomic); }
return;
}
}
# 173 "/home/xu/oasis/lib/SmartSensing/FlashM.nc"
static result_t FlashM$Flash$write(uint32_t addr, uint8_t *data, uint32_t numBytes)
#line 173
{
uint32_t i;
uint16_t status;
uint8_t blocklen;
uint32_t blockAddr = addr / 0x20000 * 0x20000;
if (addr + numBytes > 0x02000000) {
return FAIL;
}
#line 181
if (addr < 0x00200000) {
return FAIL;
}
for (i = 0; i < 16; i++)
if (
#line 186
i != addr / 0x200000 &&
FlashM$FlashPartitionState[i] != 0 &&
FlashM$FlashPartitionState[i] != 3) {
return FAIL;
}
for (i = addr / 0x200000;
i < (numBytes + addr) / 0x200000;
i++)
if (FlashM$FlashPartitionState[i] != 0) {
return FAIL;
}
for (i = addr / 0x200000;
i < (numBytes + addr) / 0x200000;
i++)
FlashM$FlashPartitionState[i] = 1;
for (blocklen = 0, i = blockAddr;
i < addr + numBytes;
i += 0x20000, blocklen++)
FlashM$unlock(i);
if (FlashM$programBufferSupported == 2) {
uint16_t testBuf[1];
if (addr % 2 == 0) {
testBuf[0] = data[0] | (* (uint8_t *)(addr + 1) << 8);
status = __Flash_Program_Buffer(addr, testBuf, 1 - 1);
}
else {
testBuf[0] = * (uint8_t *)(addr - 1) | (data[0] << 8);
status = __Flash_Program_Buffer(addr - 1, testBuf, 1 - 1);
}
if (status == 0x100) {
FlashM$programBufferSupported = 0;
}
else {
#line 225
FlashM$programBufferSupported = 1;
}
}
if (blocklen == 1) {
status = FlashM$writeHelper(addr, data, numBytes, 0xFF, 0xFF);
if (status == FAIL) {
trace(DBG_USR1, "Write helper failed... returning failed\n");
FlashM$writeExitHelper(addr, numBytes);
return FAIL;
}
}
else {
uint32_t bytesLeft = numBytes;
#line 238
status = FlashM$writeHelper(addr, data, blockAddr + 0x20000 - addr, 0xFF, 0xFF);
if (status == FAIL) {
trace(DBG_USR1, "**Flash.write1: FS ERROR **: Flash Write Failed with status == %d \r\n", status);
FlashM$writeExitHelper(addr, numBytes);
return FAIL;
}
bytesLeft = numBytes - (0x20000 - (addr - blockAddr));
for (i = 1; i < blocklen - 1; i++) {
status = FlashM$writeHelper(blockAddr + i * 0x20000, (uint8_t *)(data + numBytes - bytesLeft),
0x20000, 0xFF, 0xFF);
bytesLeft -= 0x20000;
if (status == FAIL) {
trace(DBG_USR1, "**Flash.write2: FS ERROR **: Flash Write Failed with status == %d \r\n", status);
FlashM$writeExitHelper(addr, numBytes);
return FAIL;
}
}
status = FlashM$writeHelper(blockAddr + i * 0x20000, data + (numBytes - bytesLeft), bytesLeft, 0xFF, 0xFF);
if (status == FAIL) {
trace(DBG_USR1, "** Flash.write3:FS ERROR **: Flash Write Failed with status == %d \r\n", status);
FlashM$writeExitHelper(addr, numBytes);
return FAIL;
}
}
FlashM$writeExitHelper(addr, numBytes);
return SUCCESS;
}
#line 430
static __attribute((noinline)) uint16_t FlashM$unlock(uint32_t addr)
#line 430
{
addr = addr / 0x20000 * 0x20000;
__asm volatile (
"ldr r1,=0x0060\n\t"
"ldr r2,=0x00FF\n\t"
"ldr r3,=0x00D0\n\t"
"ldr r4,=0x0050\n\t"
"b _goUnlockCacheLine\n\t"
".align 5\n\t"
"_goUnlockCacheLine:\n\t"
"strh r4,[%0]\n\t"
"strh r1,[%0]\n\t"
"strh r3,[%0]\n\t"
"strh r2,[%0]\n\t"
"ldrh r2,[%0]\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t" : :
"r"(addr) :
"r1", "r2", "r3", "r4", "memory");
return SUCCESS;
}
#line 82
static uint16_t FlashM$writeHelper(uint32_t addr, uint8_t *data, uint32_t numBytes,
uint8_t prebyte, uint8_t postbyte)
#line 83
{
uint32_t i = 0;
#line 84
uint32_t j = 0;
#line 84
uint32_t k = 0;
uint16_t status;
uint16_t buffer[32];
if (numBytes == 0) {
return FAIL;
}
if (addr % 2 == 1) {
status = __Flash_Program_Word(addr - 1, prebyte | (data[i] << 8));
i++;
if (status != 0x80)
{
trace(DBG_USR1, "** Write helper1:FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
if (addr % 2 == numBytes % 2) {
if (FlashM$programBufferSupported == 1) {
for (; i < numBytes; i = k) {
for (j = 0, k = i; k < numBytes &&
j < 32; j++, k += 2)
buffer[j] = data[k] | (data[k + 1] << 8);
status = __Flash_Program_Buffer(addr + i, buffer, j - 1);
if (status != 0x80)
{
trace(DBG_USR1, "** Write Helper 2: FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
}
else {
#line 118
for (; i < numBytes; i += 2) {
status = __Flash_Program_Word(addr + i, (data[i + 1] << 8) | data[i]);
if (status != 0x80)
{
trace(DBG_USR1, "** Write Helper 3: FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
}
}
else
#line 128
{
if (FlashM$programBufferSupported == 1) {
for (; i < numBytes - 1; i = k) {
for (j = 0, k = i; k < numBytes - 1 &&
j < 32; j++, k += 2)
buffer[j] = data[k] | (data[k + 1] << 8);
status = __Flash_Program_Buffer(addr + i, buffer, j - 1);
if (status != 0x80)
{
trace(DBG_USR1, "** Write Helper 4:FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
}
else {
#line 143
for (; i < numBytes - 1; i += 2) {
status = __Flash_Program_Word(addr + i, (data[i + 1] << 8) | data[i]);
if (status != 0x80)
{
trace(DBG_USR1, "** Write Helper 5:FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
}
status = __Flash_Program_Word(addr + i, data[i] | (postbyte << 8));
if (status != 0x80)
{
trace(DBG_USR1, "** Write Helper 5:FS ERROR **: Flash Write Failed with status == %d \r\n", status);
return FAIL;
}
}
if (addr >= 0x1e00000) {
trace(DBG_USR1, "Returning success from writehelper\n");
}
#line 162
return SUCCESS;
}
static void FlashM$writeExitHelper(uint32_t addr, uint32_t numBytes)
#line 165
{
uint32_t i = 0;
#line 167
for (i = addr / 0x200000;
i < (numBytes + addr) / 0x200000;
i++)
FlashM$FlashPartitionState[i] = 0;
}
# 215 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static void FlashManagerM$writeTask(void)
#line 215
{
static uint32_t Addr = BASE_ADDR;
static uint32_t destAddr = BASE_ADDR + 8 + NUM_BYTES;
static uint16_t i = 0;
FlashManagerM$writeTaskBusy = TRUE;
if (Addr == BASE_ADDR) {
FlashManagerM$Flash$write(Addr, (void *)&FlashManagerM$buffer_fw, 8);
;
Addr += 8;
FlashManagerM$WritingTimer$stop();
TOS_post(FlashManagerM$writeTask);
}
else {
#line 229
if (Addr < destAddr) {
;
FlashManagerM$Flash$write(Addr, (void *)((&FlashManagerM$buffer_fw)->FlashSensor + i), 16);
Addr += 16;
++i;
TOS_post(FlashManagerM$writeTask);
}
else
#line 235
{
;
i = 0;
Addr = BASE_ADDR;
}
}
#line 240
FlashManagerM$writeTaskBusy = FALSE;
}
# 600 "/home/xu/oasis/lib/FTSP/TimeSync/TimeSyncM.nc"
static void TimeSyncM$adjustRootID(void)
#line 600
{
if (TimeSyncM$RealTime$getMode() == GPS_SYNC) {
if (TimeSyncM$RealTime$isSync()) {
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
else {
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = TRUE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
}
else
{
}
}
else
{
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == 0xffff && ++TimeSyncM$heartBeats > TimeSyncM$ROOT_TIMEOUT) {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
TimeSyncM$heartBeats = 0;
}
else {
if (TimeSyncM$heartBeats > TimeSyncM$ROOT_TIMEOUT) {
TimeSyncM$heartBeats = 0;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID = TOS_LOCAL_ADDRESS;
++ ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->seqNum;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->hasGPS = FALSE;
TimeSyncM$rootid = ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID;
}
else {
}
}
}
}
static void TimeSyncM$sendMsg(void)
#line 653
{
uint32_t localTime;
#line 654
uint32_t globalTime_t;
localTime = TimeSyncM$GlobalTime$getLocalTime();
if (TimeSyncM$mode != TS_USER_MODE) {
TimeSyncM$GlobalTime$getGlobalTime(&globalTime_t);
}
else
#line 660
{
globalTime_t = TimeSyncM$GPSGlobalTime$getGlobalTime();
}
if (((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID == TOS_LOCAL_ADDRESS) {
if ((int32_t )(localTime - TimeSyncM$localAverage) >= 0x20000000) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 670
{
TimeSyncM$localAverage = localTime;
TimeSyncM$offsetAverage = globalTime_t - localTime;
}
#line 673
__nesc_atomic_end(__nesc_atomic); }
}
}
TimeSyncM$adjustRootID();
if (TimeSyncM$mode != TS_USER_MODE) {
if (TimeSyncM$numEntries < TimeSyncM$ENTRY_SEND_LIMIT && ((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->rootID != TOS_LOCAL_ADDRESS) {
++TimeSyncM$heartBeats;
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
}
else {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->sendingTime = globalTime_t - localTime;
(
(TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->wroteStamp = FAIL;
if (TimeSyncM$SendMsg$send(TOS_BCAST_ADDR, TIMESYNCMSG_LEN, &TimeSyncM$outgoingMsgBuffer) != SUCCESS) {
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
}
}
}
else {
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->sendingTime = globalTime_t - localTime;
((TimeSyncMsg *)TimeSyncM$outgoingMsgBuffer.data)->wroteStamp = FAIL;
if (TimeSyncM$SendMsg$send(TOS_BCAST_ADDR, TIMESYNCMSG_LEN, &TimeSyncM$outgoingMsgBuffer) != SUCCESS) {
TimeSyncM$state &= ~TimeSyncM$STATE_SENDING;
TimeSyncM$TimeSyncNotify$msg_sent();
}
}
}
# 321 "/home/xu/oasis/lib/SmartSensing/FlashManagerM.nc"
static result_t FlashManagerM$FlashManager$read(uint32_t addr, uint8_t *data, uint16_t numBytes)
#line 321
{
result_t result;
result = FlashManagerM$Flash$read(addr, (void *)data, numBytes);
if (result == SUCCESS) {
;
}
else {
;
}
return result;
}
# 657 "/opt/tinyos-1.x/tos/platform/imote2/PMICM.nc"
static result_t PMICM$PMIC$chargingStatus(uint8_t *vBat, uint8_t *vChg,
uint8_t *iChg, uint8_t *chargeControl)
#line 658
{
if (vBat && vChg && iChg && chargeControl) {
PMICM$readPMIC(0x41, vBat, 1);
PMICM$readPMIC(0x48, vChg, 1);
PMICM$readPMIC(0x46, iChg, 1);
PMICM$readPMIC(0x28, chargeControl, 1);
return SUCCESS;
}
else {
return FAIL;
}
}
#line 167
static void PMICM$smartChargeEnable(void)
#line 167
{
uint8_t val;
#line 169
if (PMICM$isChargerEnabled() == TRUE) {
val = PMICM$getChargerVoltage();
trace(DBG_USR1, "Charger Status: Charger Voltage is %.3fV\r\n", val * 6 * .01035);
if (val > 70) {
}
else
{
PMICM$PMIC$enableCharging(FALSE);
}
}
else {
if (PMICM$getChargerVoltage() > 70) {
PMICM$PMIC$enableCharging(TRUE);
}
else {
}
}
}
# 432 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$handleControlSetup(void)
#line 432
{
uint32_t data[2];
uint8_t statetemp;
PXA27XUSBClientM$clearIn();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 437
statetemp = PXA27XUSBClientM$state;
#line 437
__nesc_atomic_end(__nesc_atomic); }
{
data[0] = * (volatile uint32_t *)0x40600300;
data[1] = * (volatile uint32_t *)0x40600300;
* (volatile uint32_t *)0x40600100 |= 1 << (7 & 0x1f);
}
if (((((
#line 451
data[0] >> (0 & 0x03) * 8) & 0xFF) >> (6 & 0x1F)) & 0x01) == 0 && ((((
data[0] >> (0 & 0x03) * 8) & 0xFF) >> (5 & 0x1F)) & 0x01) == 0 && ((
data[0] >> (1 & 0x03) * 8) & 0xFF) == 0x06) {
switch ((data[0] >> (3 & 0x03) * 8) & 0xFF)
{
case 0x01:
PXA27XUSBClientM$sendDeviceDescriptor((data[1] >> 16) & 0xFFFF);
break;
case 0x02:
PXA27XUSBClientM$sendConfigDescriptor((data[0] >> (2 & 0x03) * 8) & 0xFF, (data[1] >> 16) & 0xFFFF);
break;
case 0x03:
PXA27XUSBClientM$sendStringDescriptor((data[0] >> (2 & 0x03) * 8) & 0xFF, (data[1] >> 16) & 0xFFFF);
break;
case 0x22:
PXA27XUSBClientM$sendHidReportDescriptor((data[1] >> 16) & 0xFFFF);
break;
default:
break;
}
}
else {
if (((((
#line 475
data[0] >> (0 & 0x03) * 8) & 0xFF) >> (6 & 0x1F)) & 0x01) == 0 && ((((
data[0] >> (0 & 0x03) * 8) & 0xFF) >> (5 & 0x1F)) & 0x01) == 0 && ((
data[0] >> (1 & 0x03) * 8) & 0xFF) == 0x09) {
* (volatile uint32_t *)0x40600000 |= 1 << (4 & 0x1f);
if ((* (volatile uint32_t *)0x40600000 & (1 << (3 & 0x1f))) != 0) {
;
}
}
else {
#line 489
if (((((data[0] >> (0 & 0x03) * 8) & 0xFF) >> (6 & 0x1F)) & 0x01) == 0 && ((((
data[0] >> (0 & 0x03) * 8) & 0xFF) >> (5 & 0x1F)) & 0x01) == 1) {
switch ((data[0] >> (1 & 0x03) * 8) & 0xFF) {
case 0x01:
break;
case 0x02:
break;
case 0x03:
break;
case 0x09:
break;
case 0x0A:
* (volatile uint32_t *)0x40600100 |= 1 << (5 & 0x1f);
break;
case 0x0B:
break;
}
}
else
{
}
}
}
}
# 78 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static void *BluSHM$DynQueue_peek(BluSHM$DynQueue oDynQueue)
{
if (oDynQueue == (void *)0 || oDynQueue->iLength <= 0) {
return (void *)0;
}
#line 85
return (void *)oDynQueue->ppvQueue[oDynQueue->index];
}
#line 153
static void *BluSHM$DynQueue_dequeue(BluSHM$DynQueue oDynQueue)
{
const void *pvItem;
if (oDynQueue == (void *)0 || oDynQueue->iLength <= 0) {
return (void *)0;
}
pvItem = oDynQueue->ppvQueue[oDynQueue->index];
oDynQueue->ppvQueue[oDynQueue->index] = (void *)0;
oDynQueue->iLength--;
oDynQueue->index++;
if (oDynQueue->iLength + 5 < oDynQueue->iPhysLength / 2) {
BluSHM$DynQueue_shiftshrink(oDynQueue);
}
#line 171
return (void *)pvItem;
}
# 618 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XUSBClientM.nc"
static void PXA27XUSBClientM$processOut(void)
#line 618
{
uint8_t *buff;
uint8_t type;
#line 620
uint8_t valid = 0;
PXA27XUSBClientM$USBdata OutStreamTemp;
#line 636
buff = (uint8_t *)PXA27XUSBClientM$DynQueue_dequeue(PXA27XUSBClientM$OutQueue);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 644
PXA27XUSBClientM$OutStream[0].endpointDR = (volatile unsigned long *const )0x40600308;
#line 644
__nesc_atomic_end(__nesc_atomic); }
type = *(buff + 0);
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 646
OutStreamTemp = &PXA27XUSBClientM$OutStream[type & 0x3];
#line 646
__nesc_atomic_end(__nesc_atomic); }
if ((type & (1 << (4 & 0x1f))) != 0) {
PXA27XUSBClientM$clearOut();
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 649
PXA27XUSBClientM$OutStream[type & 0x3].type = type;
#line 649
__nesc_atomic_end(__nesc_atomic); }
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 650
PXA27XUSBClientM$OutStream[0].endpointDR = (volatile unsigned long *const )0x40600308;
#line 650
__nesc_atomic_end(__nesc_atomic); }
switch ((OutStreamTemp->type >> 2) & 3) {
case 0:
OutStreamTemp->n = *(buff + 1);
if (OutStreamTemp->n == 0) {
valid = *(buff + 1 + 1);
OutStreamTemp->len = valid;
}
else {
valid = 62;
OutStreamTemp->len = (OutStreamTemp->n + 1) *
62 - 1;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 1 + (
OutStreamTemp->n == 0 ? 1 : 0), valid);
break;
case 1:
OutStreamTemp->n = (*(buff + 1) << 8) | *(buff + 1 + 1);
if (OutStreamTemp->n == 0) {
valid = *(buff + 1 + 2);
OutStreamTemp->len = valid;
}
else {
valid = 61;
OutStreamTemp->len = (OutStreamTemp->n + 1) *
61 - 1;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 2 + (
OutStreamTemp->n == 0 ? 1 : 0), valid);
break;
case 2:
OutStreamTemp->n = (((*(buff + 1) << 24) | (*(buff + 1 + 1) << 16)) | (*(buff + 1 + 2) << 8)) | *(buff + 1 + 3);
if (OutStreamTemp->n == 0) {
valid = *(buff + 1 + 4);
OutStreamTemp->len = valid;
}
else {
valid = 59;
OutStreamTemp->len = (OutStreamTemp->n + 1) *
59 - 1;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 4 + (
OutStreamTemp->n == 0 ? 1 : 0), valid);
}
}
else {
#line 717
if ((OutStreamTemp->type & (1 << (4 & 0x1f))) != 0) {
switch ((OutStreamTemp->type >> 2) & 3) {
case 0:
if (OutStreamTemp->index != *(buff + 1)) {
PXA27XUSBClientM$clearOut();
safe_free(buff);
buff = (void *)0;
* (volatile uint32_t *)((volatile unsigned long *const )0x40600308 - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |= 1 << (1 & 0x1f);
return;
}
if (OutStreamTemp->n == OutStreamTemp->index) {
valid = *(buff + 1 + 1);
}
else {
#line 732
valid = 62;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0 && valid != 0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 1 + (
OutStreamTemp->n == OutStreamTemp->index ? 1 : 0), valid);
break;
case 1:
if (OutStreamTemp->index != ((*(buff + 1) << 8) | *(buff + 1 + 1))) {
PXA27XUSBClientM$clearOut();
safe_free(buff);
buff = (void *)0;
* (volatile uint32_t *)((volatile unsigned long *const )0x40600308 - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |= 1 << (1 & 0x1f);
return;
}
if (OutStreamTemp->n == OutStreamTemp->index) {
valid = *(buff + 1 + 2);
}
else {
#line 757
valid = 61;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 2 + (
OutStreamTemp->n == OutStreamTemp->index ? 1 : 0), valid);
break;
case 2:
if (OutStreamTemp->index != ((((*(buff + 1) << 24) | (*(buff + 1 + 1) << 16)) | (*(buff + 1 + 2) << 8)) | *(buff + 1 + 3))) {
PXA27XUSBClientM$clearOut();
safe_free(buff);
buff = (void *)0;
* (volatile uint32_t *)((volatile unsigned long *const )0x40600308 - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |= 1 << (1 & 0x1f);
return;
}
if (OutStreamTemp->n == OutStreamTemp->index) {
valid = *(buff + 1 + 4);
}
else {
#line 781
valid = 59;
}
OutStreamTemp->src = (uint8_t *)safe_malloc(valid);
if (OutStreamTemp->src == (void *)0) {
PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$OutQueue, buff);
TOS_post(PXA27XUSBClientM$processOut);
return;
}
nmemcpy(OutStreamTemp->src, buff + 1 + 4 + (OutStreamTemp->n == OutStreamTemp->index ? 1 : 0), valid);
break;
}
}
else {
;
}
}
#line 796
if ((OutStreamTemp->type & 0x3) == 2) {
PXA27XUSBClientM$ReceiveMsg$receive((TOS_MsgPtr )OutStreamTemp->src);
}
else {
#line 798
if ((OutStreamTemp->type & 0x3) == 1) {
PXA27XUSBClientM$ReceiveBData$receive(OutStreamTemp->src, valid,
OutStreamTemp->index, OutStreamTemp->n, type);
}
else {
if (((
#line 806
OutStreamTemp->type & 0xE3) == 64 || (
OutStreamTemp->type & 0xE3) == 128) || (
OutStreamTemp->type & 0xE3) == 96)
{
* (volatile uint32_t *)0x40A0000C = * (volatile uint32_t *)0x40A00010 + 9000;
* (volatile uint32_t *)0x40A00018 = 1;
while (1) ;
}
else {
PXA27XUSBClientM$ReceiveData$receive(OutStreamTemp->src, valid);
}
}
}
#line 818
safe_free(OutStreamTemp->src);
OutStreamTemp->src = (void *)0;
OutStreamTemp->index++;
safe_free(buff);
buff = (void *)0;
* (volatile uint32_t *)((volatile unsigned long *const )0x40600308 - (volatile unsigned long *const )0x40600300 + (volatile unsigned long *const )0x40600100) |= 1 << (1 & 0x1f);
}
# 176 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27Xdynqueue.c"
static void PXA27XUSBClientM$DynQueue_push(PXA27XUSBClientM$DynQueue oDynQueue, const void *pvItem)
#line 176
{
if (oDynQueue == (void *)0) {
return;
}
if (oDynQueue->iLength == oDynQueue->iPhysLength) {
PXA27XUSBClientM$DynQueue_shiftgrow(oDynQueue);
}
if (oDynQueue->index > 0) {
oDynQueue->index--;
}
else {
#line 187
memmove((void *)(oDynQueue->ppvQueue + 1), (void *)oDynQueue->ppvQueue, sizeof(void *) * oDynQueue->iLength);
}
#line 188
oDynQueue->iLength++;
oDynQueue->ppvQueue[oDynQueue->index] = pvItem;
}
# 289 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
static void BluSHM$queueInput(uint8_t *buff, uint32_t numBytesRead)
#line 289
{
uint32_t i;
BluSHdata data;
char temp[80];
static uint8_t uSpecialChar = 0;
static uint16_t blush_cmdline_idx = 0;
static uint16_t blush_history_idx = 0;
for (i = 0; i < numBytesRead; i++)
switch (buff[i]) {
case 0x0a:
break;
case 0x0d:
blush_history_idx = 0;
generalSend("\r\n", 2);
BluSHM$blush_cur_line[blush_cmdline_idx] = '\0';
blush_cmdline_idx = 0;
if (BluSHM$blush_cur_line[0] != '\0') {
BluSHM$killWhiteSpace(BluSHM$blush_cur_line);
data = (BluSHdata )safe_malloc(sizeof(BluSHdata_t ));
data->len = strlen(BluSHM$blush_cur_line) + 1;
data->src = (uint8_t *)safe_malloc(data->len);
nmemcpy(data->src, BluSHM$blush_cur_line, data->len);
BluSHM$DynQueue_enqueue(BluSHM$InQueue, data);
if (BluSHM$InTaskCount < 5) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 315
BluSHM$InTaskCount++;
#line 315
__nesc_atomic_end(__nesc_atomic); }
TOS_post(BluSHM$processIn);
}
}
else {
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
#line 321
if (i + 1 < numBytesRead && buff[i + 1] == '\n') {
i++;
}
#line 323
BluSHM$blush_cur_line[0] = '\0';
break;
case 0x03:
blush_history_idx = 0;
blush_cmdline_idx = 0;
BluSHM$blush_cur_line[0] = '\0';
BluSHM$clearIn();
generalSend("\r\n", 2);
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
break;
case 0x09:
for (i = 0; i < BLUSH_APP_COUNT; i++) {
BluSHM$BluSH_AppI$getName(i, temp, 80);
if (strncmp(BluSHM$blush_cur_line, temp, strlen(BluSHM$blush_cur_line)) == 0) {
generalSend(temp + strlen(BluSHM$blush_cur_line),
strlen(temp) - strlen(BluSHM$blush_cur_line));
generalSend(" ", 1);
strcat(BluSHM$blush_cur_line, temp + strlen(BluSHM$blush_cur_line));
strcat(BluSHM$blush_cur_line, " ");
blush_cmdline_idx = strlen(temp) + 1;
break;
}
}
if (i >= BLUSH_APP_COUNT) {
generalSend("\a", 1);
}
break;
case '\b':
if (blush_cmdline_idx > 0) {
generalSend("\b \b", 3);
blush_cmdline_idx--;
BluSHM$blush_cur_line[blush_cmdline_idx] = '\0';
}
else {
generalSend("\a", 1);
}
#line 361
break;
default:
if (buff[i] == 0x1b || uSpecialChar != 0) {
static int special_i = 0;
switch (special_i) {
case 0:
uSpecialChar = 1;
special_i++;
continue;
case 1:
if (buff[i] != 0x5b) {
uSpecialChar = 0;
special_i = 0;
continue;
}
special_i++;
continue;
case 2:
uSpecialChar = buff[i];
special_i = 0;
if (uSpecialChar == 0x41) {
if (blush_history_idx < 4 - 1) {
if (blush_history_idx == 0) {
strcpy(BluSHM$blush_history[0], BluSHM$blush_cur_line);
}
#line 391
blush_history_idx++;
for (i = 0; i < blush_cmdline_idx; i++)
generalSend("\b \b", 3);
strcpy(BluSHM$blush_cur_line, BluSHM$blush_history[blush_history_idx]);
generalSend(BluSHM$blush_cur_line, strlen(BluSHM$blush_cur_line));
blush_cmdline_idx = strlen(BluSHM$blush_cur_line);
}
else {
generalSend("\a", 1);
}
uSpecialChar = 0;
continue;
}
else {
#line 408
if (uSpecialChar == 0x42) {
if (blush_history_idx > 0) {
for (i = 0; i < blush_cmdline_idx; i++) {
generalSend("\b \b", 3);
}
blush_history_idx--;
strcpy(BluSHM$blush_cur_line, BluSHM$blush_history[blush_history_idx]);
generalSend(BluSHM$blush_cur_line, strlen(BluSHM$blush_cur_line));
blush_cmdline_idx = strlen(BluSHM$blush_cur_line);
}
else {
generalSend("\a", 1);
}
uSpecialChar = 0;
continue;
}
else {
uSpecialChar = 0;
continue;
}
}
}
}
if (blush_cmdline_idx < 80 - 1) {
BluSHM$blush_cur_line[blush_cmdline_idx] = buff[i];
blush_cmdline_idx++;
BluSHM$blush_cur_line[blush_cmdline_idx] = '\0';
generalSend(buff + i, 1);
}
else {
generalSend("\a", 1);
}
#line 446
break;
}
}
#line 136
static void BluSHM$processIn(void)
#line 136
{
uint16_t hist_idx;
BluSHdata data;
if (BluSHM$DynQueue_getLength(BluSHM$InQueue) < 1) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 141
BluSHM$InTaskCount--;
#line 141
__nesc_atomic_end(__nesc_atomic); }
return;
}
data = (BluSHdata )BluSHM$DynQueue_dequeue(BluSHM$InQueue);
strcpy(BluSHM$blush_history[0], data->src);
if (0 == strncmp("help", data->src, strlen("help"))) {
generalSend("Blue Shell v1.1 (BluSH)\r\nhelp - Display this list\r\nls - Display all application commands\r\nhistory - Display the command history\r\nprompt - Allows you to change the prompt\r\n",
strlen("Blue Shell v1.1 (BluSH)\r\nhelp - Display this list\r\nls - Display all application commands\r\nhistory - Display the command history\r\nprompt - Allows you to change the prompt\r\n"));
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
else {
#line 160
if (0 == strncmp("history", data->src, strlen("history"))) {
for (hist_idx = 4 - 1; 1; hist_idx--) {
if (BluSHM$blush_history[hist_idx][0] != '\0') {
generalSend(BluSHM$blush_history[hist_idx], strlen(BluSHM$blush_history[hist_idx]));
generalSend("\r\n", strlen("\r\n"));
}
if (hist_idx == 0) {
break;
}
}
#line 169
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
else {
#line 171
if (0 == strncmp("prompt", data->src, strlen("prompt"))) {
uint8_t frstSpc = BluSHM$firstSpace(data->src, 0);
#line 173
if (frstSpc == 0) {
generalSend("prompt <new prompt string>\r\n", strlen("prompt <new prompt string>\r\n"));
}
else {
#line 176
strncpy(BluSHM$blush_prompt, data->src + frstSpc + 1, 32);
}
#line 177
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
else {
#line 179
if (0 == strncmp("ls", data->src, strlen("ls"))) {
unsigned int i;
char temp[80];
for (i = 0; i < BLUSH_APP_COUNT; i++) {
BluSHM$BluSH_AppI$getName(i, temp, 80);
generalSend(temp, strlen(temp));
generalSend("\r\n", 2);
}
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
else {
uint32_t j;
char retStr[50];
char temp[80];
#line 195
for (j = 0; j < BLUSH_APP_COUNT; j++) {
BluSHM$BluSH_AppI$getName(j, temp, 80);
if (strncmp(temp, data->src, strlen(temp)) == 0 && (
data->src[strlen(temp)] == ' ' || data->src[strlen(temp)] == '\0')) {
*retStr = 0;
BluSHM$BluSH_AppI$callApp(j, data->src, 80, retStr, 50);
retStr[50 - 1] = '\0';
generalSend(retStr, strlen(retStr));
break;
}
}
if (j == BLUSH_APP_COUNT) {
generalSend("Bad command\r\n", strlen("Bad command\r\n"));
}
generalSend(BluSHM$blush_prompt, strlen(BluSHM$blush_prompt));
}
}
}
}
#line 219
for (hist_idx = 4 - 1; hist_idx > 0; hist_idx--)
strcpy(BluSHM$blush_history[hist_idx], BluSHM$blush_history[hist_idx - 1]);
BluSHM$blush_history[0][0] = '\0';
if (BluSHM$InTaskCount <= 5 && BluSHM$DynQueue_getLength(BluSHM$InQueue) > 0) {
TOS_post(BluSHM$processIn);
}
else {
#line 226
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 226
BluSHM$InTaskCount--;
#line 226
__nesc_atomic_end(__nesc_atomic); }
}
safe_free(data->src);
safe_free(data);
}
#line 275
static BluSH_result_t BluSHM$BluSH_AppI$default$getName(uint8_t id, char *buff, uint8_t len)
#line 275
{
buff[0] = '\0';
return BLUSH_SUCCESS_DONE;
}
# 8 "/opt/tinyos-1.x/tos/platform/imote2/BluSH_AppI.nc"
static BluSH_result_t BluSHM$BluSH_AppI$getName(uint8_t arg_0x40784798, char *arg_0x404b5250, uint8_t arg_0x404b53d8){
#line 8
unsigned char result;
#line 8
#line 8
switch (arg_0x40784798) {
#line 8
case 0U:
#line 8
result = DVFSM$SwitchFreq$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 1U:
#line 8
result = DVFSM$GetFreq$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 2U:
#line 8
result = PMICM$BatteryVoltage$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 3U:
#line 8
result = PMICM$ManualCharging$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 4U:
#line 8
result = PMICM$ChargingStatus$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 5U:
#line 8
result = PMICM$ReadPMIC$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 6U:
#line 8
result = PMICM$WritePMIC$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 7U:
#line 8
result = PMICM$SetCoreVoltage$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 8U:
#line 8
result = SettingsM$NodeID$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 9U:
#line 8
result = SettingsM$ResetNode$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 10U:
#line 8
result = SettingsM$TestTaskQueue$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 11U:
#line 8
result = SettingsM$GoToSleep$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
case 12U:
#line 8
result = SettingsM$GetResetCause$getName(arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
default:
#line 8
result = BluSHM$BluSH_AppI$default$getName(arg_0x40784798, arg_0x404b5250, arg_0x404b53d8);
#line 8
break;
#line 8
}
#line 8
#line 8
return result;
#line 8
}
#line 8
# 131 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOIntM.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$default$fired(uint8_t pin)
{
return;
}
# 48 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XGPIOInt.nc"
static void PXA27XGPIOIntM$PXA27XGPIOInt$fired(uint8_t arg_0x40643bb0){
#line 48
switch (arg_0x40643bb0) {
#line 48
case 0:
#line 48
HPLCC2420M$FIFOP_GPIOInt$fired();
#line 48
break;
#line 48
case 1:
#line 48
PMICM$PMICInterrupt$fired();
#line 48
break;
#line 48
case 13:
#line 48
PXA27XUSBClientM$USBAttached$fired();
#line 48
break;
#line 48
case 16:
#line 48
HPLCC2420M$SFD_GPIOInt$fired();
#line 48
break;
#line 48
case 93:
#line 48
GPSSensorM$GPSInterrupt$fired();
#line 48
break;
#line 48
case 114:
#line 48
HPLCC2420M$FIFO_GPIOInt$fired();
#line 48
break;
#line 48
case 116:
#line 48
HPLCC2420M$CCA_GPIOInt$fired();
#line 48
break;
#line 48
default:
#line 48
PXA27XGPIOIntM$PXA27XGPIOInt$default$fired(arg_0x40643bb0);
#line 48
break;
#line 48
}
#line 48
}
#line 48
# 540 "/opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420RadioM.nc"
static void CC2420RadioM$delayedRXFIFO(void)
#line 540
{
uint8_t len = MSG_DATA_SIZE;
uint8_t _bPacketReceiving;
if (!TOSH_READ_CC_FIFO_PIN() && !TOSH_READ_CC_FIFOP_PIN()) {
CC2420RadioM$flushRXFIFO();
return;
}
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 549
{
_bPacketReceiving = CC2420RadioM$bPacketReceiving;
if (_bPacketReceiving) {
if (!TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$flushRXFIFO();
}
}
else
#line 555
{
CC2420RadioM$bPacketReceiving = TRUE;
}
}
#line 558
__nesc_atomic_end(__nesc_atomic); }
if (!_bPacketReceiving) {
if (!CC2420RadioM$HPLChipconFIFO$readRXFIFO(len, (uint8_t *)CC2420RadioM$rxbufptr)) {
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 566
CC2420RadioM$bPacketReceiving = FALSE;
#line 566
__nesc_atomic_end(__nesc_atomic); }
if (!TOS_post(CC2420RadioM$delayedRXFIFOtask)) {
CC2420RadioM$flushRXFIFO();
}
return;
}
}
CC2420RadioM$flushRXFIFO();
}
# 494 "/opt/tinyos-1.x/tos/platform/imote2/HPLCC2420M.nc"
static void HPLCC2420M$signalRXFIFO(void)
#line 494
{
uint8_t len;
#line 495
uint8_t *buf;
#line 496
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 496
{
len = HPLCC2420M$rxlen;
buf = HPLCC2420M$rxbuf;
}
#line 499
__nesc_atomic_end(__nesc_atomic); }
HPLCC2420M$HPLCC2420FIFO$RXFIFODone(len, buf);
}
#line 442
static result_t HPLCC2420M$HPLCC2420RAM$write(uint16_t addr, uint8_t length, uint8_t *buffer)
#line 442
{
uint8_t i = 0;
#line 443
uint8_t tmp;
if (HPLCC2420M$getSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420RAMWriteContentionError);
return 0;
}
{
#line 455
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 455
;
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 456
{
HPLCC2420M$txramaddr = addr;
HPLCC2420M$txramlen = length;
HPLCC2420M$txrambuf = buffer;
}
#line 460
__nesc_atomic_end(__nesc_atomic); }
{
#line 462
TOSH_CLR_CC_CSN_PIN();
#line 462
TOSH_uwait(1);
}
#line 462
;
* (volatile uint32_t *)0x41900010 = (addr & 0x7F) | 0x80;
* (volatile uint32_t *)0x41900010 = (addr >> 1) & 0xC0;
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
while (length > 16) {
for (i = 0; i < 16; i++) {
* (volatile uint32_t *)0x41900010 = * buffer++;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
length -= 16;
}
for (i = 0; i < length; i++) {
* (volatile uint32_t *)0x41900010 = * buffer++;
}
while (* (volatile uint32_t *)0x41900008 & (1 << 4)) ;
{
#line 482
TOSH_uwait(1);
#line 482
TOSH_SET_CC_CSN_PIN();
}
#line 482
;
{
#line 484
while (* (volatile uint32_t *)0x41900008 & (1 << 3)) tmp = * (volatile uint32_t *)0x41900010;
}
#line 484
;
if (HPLCC2420M$releaseSSPPort() == FAIL) {
TOS_post(HPLCC2420M$HPLCC2420RamWriteReleaseError);
return 0;
}
return TOS_post(HPLCC2420M$signalRAMWr);
}
# 276 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static void STUARTM$handleRxDMADone(uint16_t numBytesSent)
#line 276
{
STUARTM$gRxBuffer = STUARTM$BulkTxRx$BulkReceiveDone(STUARTM$gRxBuffer,
numBytesSent);
if (STUARTM$gRxBuffer) {
STUARTM$RxDMAChannel$setTargetAddr((uint32_t )STUARTM$gRxBuffer);
STUARTM$RxDMAChannel$setTransferLength(STUARTM$gRxNumBytes);
STUARTM$RxDMAChannel$run(DMA_ENDINTEN | DMA_EORINTEN);
}
else {
if (STUARTM$gNumRxFifoOverruns > 0) {
}
STUARTM$closeRxPort();
}
}
# 260 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkReceiveDone(uint8_t *RxBuffer,
uint16_t NumBytes)
#line 261
{
bufferInfo_t *pBI;
uint8_t *newBuffer;
pBI = getNextBufferInfo(&BufferedSTUARTM$receiveBufferInfoSet);
(void )(pBI || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c", (int )267, "pBI"), 0));
pBI->pBuf = RxBuffer;
pBI->numBytes = NumBytes;
TOS_parampost(BufferedSTUARTM$_receiveDoneveneer, (uint32_t )pBI);
newBuffer = getNextBuffer(&BufferedSTUARTM$receiveBufferSet);
(void )(newBuffer || (printAssertMsg("/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c", (int )276, "newBuffer"), 0));
return newBuffer;
}
# 199 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static result_t STUARTM$closeRxPort(void)
#line 199
{
STUARTM$gRxPortInUse = FALSE;
STUARTM$gRxBuffer = (void *)0;
STUARTM$gRxNumBytes = 0;
return SUCCESS;
}
# 285 "/opt/tinyos-1.x/tos/platform/imote2/BufferedUART.c"
static uint8_t *BufferedSTUARTM$BulkTxRx$BulkTransmitDone(uint8_t *TxBuffer, uint16_t NumBytes)
#line 285
{
bufferInfo_t *pBI;
int status;
#line 289
pBI = popptrqueue(&outgoingQueue, &status);
if (status == 1) {
if (pBI->pBuf == TxBuffer && pBI->numBytes == NumBytes) {
TOS_parampost(BufferedSTUARTM$_transmitDoneveneer, (uint32_t )pBI);
}
else {
printFatalErrorMsg("BufferedUART.c found unexpected buffer in queue", 0);
}
}
else {
printFatalErrorMsg("BufferedUART.c found tranmit queue empty after sending data", 0);
}
return (void *)0;
}
# 177 "/opt/tinyos-1.x/tos/platform/imote2/UART.c"
static result_t STUARTM$closeTxPort(void)
#line 177
{
STUARTM$gTxPortInUse = FALSE;
STUARTM$gTxBuffer = (void *)0;
STUARTM$gTxNumBytes = 0;
#line 196
return SUCCESS;
}
# 204 "/opt/tinyos-1.x/tos/platform/pxa27x/PXA27XInterruptM.nc"
__attribute((interrupt("FIQ"))) void hplarmv_fiq(void)
#line 204
{
uint32_t FIQPending;
FIQPending = * (volatile uint32_t *)0x40D00018;
FIQPending &= 0xFF;
while (FIQPending & (1 << 15)) {
uint8_t PeripheralID = FIQPending & 0x3f;
#line 213
PXA27XInterruptM$PXA27XFiq$fired(PeripheralID);
FIQPending = * (volatile uint32_t *)0x40D00018;
FIQPending &= 0xFF;
}
return;
}
# 96 "/opt/tinyos-1.x/tos/platform/imote2/BluSHM.nc"
void trace_unset(void)
#line 96
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
#line 97
BluSHM$trace_modes = 0;
#line 97
__nesc_atomic_end(__nesc_atomic); }
}
# 57 "/home/xu/oasis/lib/SmartSensing/ProcessTasks.h"
static result_t RsamFunc(SenBlkPtr inPtr, SenBlkPtr outPtr)
#line 57
{
uint16_t *srcStart;
uint16_t *srcEnd;
uint16_t *dst;
uint16_t interval;
int32_t temp = 0;
static uint32_t rsam1_amp = 0;
static uint32_t rsam1_count = 0;
static uint32_t rsam1_time = 0;
static uint32_t rsam2_amp = 0;
static uint32_t rsam2_count = 0;
static uint32_t rsam2_time = 0;
static uint32_t rsam1_avg = 0;
static uint32_t rsam2_avg = 0;
static uint32_t rsam1_rawamp = 0;
static uint32_t rsam2_rawamp = 0;
if ((void *)0 != inPtr && (void *)0 != outPtr) {
srcStart = (uint16_t *)inPtr->buffer;
srcEnd = (uint16_t *)(inPtr->buffer + inPtr->size);
dst = (uint16_t *)(outPtr->buffer + outPtr->size);
interval = inPtr->interval;
if (TYPE_DATA_RSAM1 == outPtr->type) {
while (srcStart < srcEnd) {
temp = *srcStart - rsam1_avg;
rsam1_rawamp += * srcStart++;
if (temp < 0) {
rsam1_amp -= temp;
}
else {
rsam1_amp += temp;
}
rsam1_time += interval;
++rsam1_count;
if (rsam1_time >= ONE_MS && rsam1_count != 0) {
rsam1_avg = rsam1_rawamp / rsam1_count;
if (restartRSAM == 1) {
*dst = 0;
restartRSAM = 0;
}
else {
*dst = rsam1_amp / rsam1_count;
}
outPtr->size += MAX_DATA_WIDTH;
StaLtaFunc2(*dst, inPtr->time);
++dst;
if (inPtr->time > 2000UL)
{
delay_end = inPtr->time - 2000UL;
}
else {
delay_end = 0xffffffff - inPtr->time;
}
rsam1_amp = rsam1_time = rsam1_count = rsam1_rawamp = 0;
}
}
}
else {
while (srcStart < srcEnd) {
temp = *srcStart - rsam2_avg;
rsam2_rawamp += * srcStart++;
if (temp < 0) {
rsam2_amp -= temp;
}
else {
rsam2_amp += temp;
}
rsam2_time += interval;
++rsam2_count;
if (rsam2_time >= ONE_MS && rsam2_count != 0) {
rsam2_avg = rsam2_rawamp / rsam2_count;
* dst++ = rsam2_amp / rsam2_count;
outPtr->size += MAX_DATA_WIDTH;
rsam2_amp = rsam2_time = rsam2_count = rsam2_rawamp = 0;
}
}
}
return SUCCESS;
}
else {
return FAIL;
}
}
#line 220
static result_t PrioritizeFunc(SenBlkPtr inPtr, SenBlkPtr outPtr)
#line 220
{
if ((void *)0 != inPtr) {
if (inPtr->type == TYPE_DATA_SEISMIC || inPtr->type == TYPE_DATA_INFRASONIC) {
if (delay_end > inPtr->time) {
if (
#line 224
start_point != end_point
&& inPtr->time >= start_point && inPtr->time <= end_point) {
if (inPtr->priority < 5) {
inPtr->priority = eventPrio;
}
else {
inPtr->priority = 7;
}
eventPri++;
;
}
return SUCCESS;
}
else {
return FAIL;
}
}
return SUCCESS;
}
return FAIL;
}
static result_t ThresholdFunc(SenBlkPtr inPtr, SenBlkPtr outPtr)
#line 253
{
uint16_t *srcStart;
uint16_t *srcEnd;
if ((void *)0 != inPtr) {
srcStart = (uint16_t *)inPtr->buffer;
srcEnd = (uint16_t *)(inPtr->buffer + inPtr->size);
while (srcStart < srcEnd) {
if (*srcStart > 60000UL) {
inPtr->priority += 1;
break;
}
++srcStart;
}
}
return SUCCESS;
}
static result_t CompressFunc(SenBlkPtr inPtr, SenBlkPtr outPtr)
#line 273
{
static SenBlkPtr lastInPtr = (void *)0;
static uint16_t lastLen = 0;
uint8_t compress_done = 0;
uint16_t processingLen = 0;
if (inPtr != (void *)0 && outPtr != (void *)0) {
if (inPtr == lastInPtr) {
processingLen = compress((uint16_t *)inPtr->buffer + lastLen, inPtr->size / 2 - lastLen, outPtr, &compress_done);
}
else
{
processingLen = compress((uint16_t *)inPtr->buffer, inPtr->size / 2, outPtr, &compress_done);
}
lastInPtr = inPtr;
if (processingLen + lastLen < inPtr->size / 2 && processingLen + lastLen > 0) {
lastLen += processingLen;
inPtr->time += inPtr->interval * lastLen;
return FAIL;
}
else {
#line 316
if (processingLen + lastLen >= inPtr->size / 2) {
lastLen = 0;
return SUCCESS;
}
else
#line 321
{
lastLen = 0;
return SUCCESS;
}
}
}
else {
return FAIL;
}
}
# 98 "/home/xu/oasis/lib/SmartSensing/Compress.h"
static uint16_t compress(uint16_t *source, uint8_t size, SenBlkPtr outPtr, uint8_t *compress_done)
#line 98
{
static uint32_t foldedtotal;
static int32_t codeparam;
static int32_t oldcodeparam;
static uint16_t packetsamplecount = 0;
static uint16_t compress_start = 0;
static int packetbitcost = 0;
static int thispacketoverhead;
static int uncodedcost = 0;
static int total_samplecount = 0;
static int32_t last_sample = 0;
int thisdebiasedsample = 0;
uint8_t samplecount = 0;
int32_t newsample = 0;
uint16_t foldedsample = 0;
int32_t i = 0;
int err_r;
uint16_t processingLen = 0;
long predicteddebiased_r;
long predictedsample_r;
int temp = 16 - 1;
#line 122
codeoverheadbits = 0;
while (temp > 0) {
temp >>= 1;
codeoverheadbits++;
}
if (compress_start == 0)
{
if (thepacket != outPtr->buffer) {
Init_packet = outPtr->buffer;
thepacket = outPtr->buffer;
}
thispacketoverhead = startnewpacket();
compress_start = 2;
}
if (compress_start == 1) {
if (thepacket != outPtr->buffer) {
Init_packet = outPtr->buffer;
thepacket = outPtr->buffer;
}
packetsamplecount = 0;
thispacketoverhead = startnewpacket();
predicteddebiased_r = predictdebiasedsample_r(0);
predictedsample_r = predicteddebiased_r + biasestimate_r;
if (predictedsample_r > maxsample_r) {
predictedsample_r = maxsample_r;
}
#line 155
if (predictedsample_r < minsample_r) {
predictedsample_r = minsample_r;
}
thisdebiasedsample = last_sample - ((biasestimate_r + ((1 << (14 - 1)) - 1)) >> 14);
packetdebiasedsamples[0] = thisdebiasedsample;
packetdebiasedscaled[0] = ((thisdebiasedsample << 14) + halfmu) >> muexponent;
foldedsample = foldsample(last_sample, predictedsample_r);
packetfoldedsamples[0] = foldedsample;
foldedtotal = foldedsample;
packetsamplecount += 1;
biasestimate_r -= (biasestimate_r - (last_sample << 14) + biasscalealmosthalf) >> biasscalebits;
compress_start = 2;
}
while (samplecount < size) {
total_samplecount++;
newsample = * source++;
++processingLen;
predicteddebiased_r = predictdebiasedsample_r(packetsamplecount);
predictedsample_r = predicteddebiased_r + biasestimate_r;
if (predictedsample_r > maxsample_r) {
predictedsample_r = maxsample_r;
}
#line 189
if (predictedsample_r < minsample_r) {
predictedsample_r = minsample_r;
}
thisdebiasedsample = newsample - ((biasestimate_r + ((1 << (14 - 1)) - 1)) >> 14);
packetdebiasedsamples[packetsamplecount] = thisdebiasedsample;
packetdebiasedscaled[packetsamplecount] = ((thisdebiasedsample << 14) + halfmu) >> muexponent;
foldedsample = foldsample(newsample, predictedsample_r);
packetfoldedsamples[packetsamplecount] = foldedsample;
foldedtotal += foldedsample;
++packetsamplecount;
oldcodeparam = codeparam;
uncodedcost = thispacketoverhead + packetsamplecount * 16;
if (uncodedcost < 56 * 8) {
packetbitcost = uncodedcost;
codeparam = -1;
}
else
#line 213
{
codeparam = codechoice(foldedtotal, packetsamplecount);
if (codeparam == -1) {
packetbitcost = uncodedcost;
}
else
#line 228
{
if (oldcodeparam == codeparam) {
packetbitcost += codeparam + (packetfoldedsamples[packetsamplecount - 1] >> codeparam) + 1;
}
else
#line 233
{
packetbitcost = thispacketoverhead;
for (i = 0; i < packetsamplecount; i++)
packetbitcost += codeparam + (packetfoldedsamples[i] >> codeparam) + 1;
if (packetbitcost > uncodedcost) {
packetbitcost = uncodedcost;
codeparam = -1;
}
}
}
}
if (packetbitcost < 56 * 8) {
if (packetsamplecount > 3) {
err_r = predicteddebiased_r - (thisdebiasedsample << 14);
if (err_r < 0) {
for (i = 0; i < 3; i++) {
weight_r[i] += packetdebiasedscaled[packetsamplecount - i - 2];
}
}
else {
for (i = 0; i < 3; i++) {
weight_r[i] -= packetdebiasedscaled[packetsamplecount - i - 2];
}
}
}
biasestimate_r -= (biasestimate_r - (newsample << 14) + biasscalealmosthalf) >> biasscalebits;
}
else
{
if (packetbitcost == 56 * 8) {
encodepacket(packetsamplecount, codeparam, outPtr);
*compress_done = 1;
compress_start = 0;
packetsamplecount = 0;
foldedtotal = 0;
fclose(output_compress);
packetcount++;
if (packetsamplecount % 28 != 0) {
outPtr->compressnum = packetsamplecount / 28 + 1;
}
else
#line 293
{
outPtr->compressnum = packetsamplecount / 28;
}
return processingLen;
}
else
#line 297
{
encodepacket(packetsamplecount - 1, oldcodeparam, outPtr);
*compress_done = 1;
compress_start = 1;
last_sample = newsample;
fclose(output_compress);
packetcount++;
if ((packetsamplecount - 1) % 28 != 0) {
outPtr->compressnum = (packetsamplecount - 1) / 28 + 1;
}
else
#line 312
{
outPtr->compressnum = (packetsamplecount - 1) / 28;
}
return processingLen - 1;
}
}
samplecount++;
}
*compress_done = 0;
return processingLen;
}
static int startnewpacket(void )
#line 328
{
int i = 0;
packetbitpointer = 0;
packetbytepointer = 0;
for (i = 0; i < 3; i++)
weight_r[i] = (1 << 14) * weightinitfactor[i];
biasestimate_r = biasquantencode_r(biasestimate_r);
weightquantencode();
return codeoverheadbits + 8 * packetbytepointer + packetbitpointer;
}
#line 381
static void writesignmagnitude(int thevalue, int numbits)
#line 381
{
int themagnitude;
if (thevalue < 0) {
themagnitude = -thevalue;
}
else {
#line 388
themagnitude = thevalue;
}
writeunsignedint(themagnitude, numbits - 1);
if (themagnitude) {
if (thevalue < 0) {
writebit(1);
}
else {
#line 398
writebit(0);
}
}
}
static void writeunsignedint(uint16_t thevalue, uint16_t numbits)
#line 403
{
int i;
for (i = 0; i < numbits; i++)
writebit(thevalue & (1 << i));
}
#line 515
static void writebit(int32_t bitvalue)
#line 515
{
if (packetbytepointer >= 56) {
;
return;
}
if (bitvalue) {
thepacket[packetbytepointer] |= 1 << packetbitpointer;
}
else {
#line 528
thepacket[packetbytepointer] &= ~(1 << packetbitpointer);
}
packetbitpointer++;
if (packetbitpointer == 8) {
packetbitpointer = 0;
packetbytepointer++;
}
}
static long predictdebiasedsample_r(int numpacketsamples)
#line 544
{
int predictedvalue_r = 0;
int i;
if (numpacketsamples >= 3) {
for (i = 0; i < 3; i++)
predictedvalue_r += weight_r[i] * packetdebiasedsamples[numpacketsamples - i - 1];
}
else {
#line 553
if (numpacketsamples > 0) {
for (i = 0; i < numpacketsamples; i++)
predictedvalue_r += weight_r[i] * packetdebiasedsamples[numpacketsamples - i - 1];
for (i = numpacketsamples; i < 3; i++)
predictedvalue_r += weight_r[i] * packetdebiasedsamples[0];
}
}
return predictedvalue_r;
}
#line 671
static uint16_t foldsample(int thesamplevalue, int32_t theprediction)
#line 671
{
uint16_t foldedvalue;
int roundprediction;
int delta;
#line 675
int theta;
roundprediction = (theprediction + ((1 << (14 - 1)) - 1)) >> 14;
delta = thesamplevalue - roundprediction;
theta = roundprediction - -(1 << 16) < (1 << 16) - 1 - roundprediction ? roundprediction - -(1 << 16) : (1 << 16) - 1 - roundprediction;
if (roundprediction << 14 > theprediction) {
if (delta >= 0 && delta <= theta) {
foldedvalue = delta << 1;
}
else {
#line 689
if (delta < 0 && delta >= -theta) {
foldedvalue = (-delta << 1) - 1;
}
else {
#line 692
if (delta < 0) {
foldedvalue = theta - delta;
}
else {
#line 695
foldedvalue = theta + delta;
}
}
}
}
else
#line 697
{
if (delta <= 0 && delta >= -theta) {
foldedvalue = -delta << 1;
}
else {
#line 701
if (delta > 0 && delta <= theta) {
foldedvalue = (delta << 1) - 1;
}
else {
#line 704
if (delta < 0) {
foldedvalue = theta - delta;
}
else {
#line 707
foldedvalue = theta + delta;
}
}
}
}
#line 709
return foldedvalue;
}
#line 598
static void encodepacket(int32_t numpacketsamples, int32_t codingparameter, SenBlkPtr outPtr)
#line 598
{
int32_t i;
if (codingparameter == -1) {
for (i = 0; i < codeoverheadbits; i++)
writebit(1);
}
else
#line 613
{
for (i = 0; i < codeoverheadbits; i++) {
writebit(codingparameter & (1 << i));
}
}
for (i = 0; i < numpacketsamples; i++) {
encodevalue(packetfoldedsamples[i], codingparameter);
}
outPtr->size = 56;
sendpacket();
}
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/stargatehelper/rt_structs.h | #ifndef RT_STRUCTS_H_INCLUDED
#define RT_STRUCTS_H_INCLUDED
#include "../nodes.h"
typedef struct rt_data
{
uint16_t sessionID;
uint32_t starttime;
uint16_t weight;
uint8_t minstate;
uint8_t wake;
uint32_t elapsed_us;
} rt_data;
typedef struct GenericNode
{
rt_data _pdata;
} GenericNode;
#define RTCLOCKINTERVAL (60L * 1024L)
#define EVALINTERVAL (60L*60L * 1024L)
//#define EVALINTERVAL (60L * 1024L)
//save runtime data every hour
//#define RT_SAVE_TIME (3L * 60L * 60L * 1024L)
#define RT_SAVE_TIME (60L * 1024L)
#define RT_RECOVER_TIME (15L * 1024L)
//typedef uint8_t request_t[50];
#define LOAD_WEIGHT (0.04)
enum {
BATTERY_CAPACITY = (200LL * 360LL * 37LL * 1000LL) //uJ
};
typedef struct __runtime_state
{
uint16_t save_flag;
double load_avg;
uint8_t srcprob[NUMSOURCES];
uint8_t prob[NUMPATHS];
int32_t pathenergy[NUMPATHS];
int64_t batt_reserve;
} __runtime_state_t;
__runtime_state_t __rtstate;
uint16_t *g_lastmem = (uint16_t*)3967;
uint16_t deadlocked_edge_id = 0xFFFF;
int16_t alloc_size = 0xFFFF;
uint16_t rt_clock = 0;
int save_state;
int save_retries;
void *queue_ptr = NULL;
#define MAX_SAVE_RET 10
#define SAVE_PAGE 510
//#ifdef RUNTIME_TEST
#include "AM.h"
TOS_Msg __rt_send_buf;
//#endif
#endif
|
tinyos-io/tinyos-3.x-contrib | stanford-lgl/tos/chips/ov7670/OV7670.h | /*
* Copyright (c) 2008 Stanford University. All rights reserved.
* This file may be distributed under the terms of the GNU General
* Public License, version 2.
*/
/**
* @brief Driver module for the OmniVision OV7670 Camera, inspired by V4L2
* linux driver for OV7670.
* @author <NAME> (<EMAIL>)
*/
#ifndef _OV7670_H
#define _OV7670_H
#include "OV.h"
#define VGA_WIDTH 640
#define VGA_HEIGHT 480
#define QVGA_WIDTH 320
#define QVGA_HEIGHT 240
#define CIF_WIDTH 352
#define CIF_HEIGHT 288
#define QCIF_WIDTH 176
#define QCIF_HEIGHT 144
#define ENABLE 1
#define DISABLE 0
/*
* The 7670 sits on i2c with ID 0x42
*/
#define OV7670_I2C_ADDR 0x42
#define REG_GAIN 0x00 /* Gain lower 8 bits (rest in vref) */
#define REG_BLUE 0x01 /* blue gain */
#define REG_RED 0x02 /* red gain */
#define REG_VREF 0x03 /* Pieces of GAIN, VSTART, VSTOP */
#define REG_COM1 0x04 /* Control 1 */
#define COM1_CCIR656 0x40 /* CCIR656 enable */
#define REG_BAVE 0x05 /* U/B Average level */
#define REG_GbAVE 0x06 /* Y/Gb Average level */
#define REG_AECHH 0x07 /* AEC MS 5 bits */
#define REG_RAVE 0x08 /* V/R Average level */
#define REG_COM2 0x09 /* Control 2 */
#define COM2_SSLEEP 0x10 /* Soft sleep mode */
#define REG_PID 0x0a /* Product ID MSB */
#define REG_VER 0x0b /* Product ID LSB */
#define REG_COM3 0x0c /* Control 3 */
#define COM3_SWAP 0x40 /* Byte swap */
#define COM3_SCALEEN 0x08 /* Enable scaling */
#define COM3_DCWEN 0x04 /* Enable downsamp/crop/window */
#define REG_COM4 0x0d /* Control 4 */
#define REG_COM5 0x0e /* All "reserved" */
#define REG_COM6 0x0f /* Control 6 */
#define REG_AECH 0x10 /* More bits of AEC value */
#define REG_CLKRC 0x11 /* Clocl control */
#define CLK_EXT 0x40 /* Use external clock directly */
#define CLK_SCALE 0x3f /* Mask for internal clock scale */
#define REG_COM7 0x12 /* Control 7 */
#define COM7_RESET 0x80 /* Register reset */
#define COM7_FMT_MASK 0x38
#define COM7_FMT_VGA 0x00
#define COM7_FMT_CIF 0x20 /* CIF format */
#define COM7_FMT_QVGA 0x10 /* QVGA format */
#define COM7_FMT_QCIF 0x08 /* QCIF format */
#define COM7_RGB 0x04 /* bits 0 and 2 - RGB format */
#define COM7_YUV 0x00 /* YUV */
#define COM7_BAYER 0x01 /* Bayer format */
#define COM7_PBAYER 0x05 /* "Processed bayer" */
#define REG_COM8 0x13 /* Control 8 */
#define COM8_FASTAEC 0x80 /* Enable fast AGC/AEC */
#define COM8_AECSTEP 0x40 /* Unlimited AEC step size */
#define COM8_BFILT 0x20 /* Band filter enable */
#define COM8_AGC 0x04 /* Auto gain enable */
#define COM8_AWB 0x02 /* White balance enable */
#define COM8_AEC 0x01 /* Auto exposure enable */
#define REG_COM9 0x14 /* Control 9 - gain ceiling */
#define REG_COM10 0x15 /* Control 10 */
#define COM10_HSYNC 0x40 /* HSYNC instead of HREF */
#define COM10_PCLK_HB 0x20 /* Suppress PCLK on horiz blank */
#define COM10_HREF_REV 0x08 /* Reverse HREF */
#define COM10_VS_LEAD 0x04 /* VSYNC on clock leading edge */
#define COM10_VS_NEG 0x02 /* VSYNC negative */
#define COM10_HS_NEG 0x01 /* HSYNC negative */
#define REG_HSTART 0x17 /* Horiz start high bits */
#define REG_HSTOP 0x18 /* Horiz stop high bits */
#define REG_VSTART 0x19 /* Vert start high bits */
#define REG_VSTOP 0x1a /* Vert stop high bits */
#define REG_PSHFT 0x1b /* Pixel delay after HREF */
#define REG_MIDH 0x1c /* Manuf. ID high */
#define REG_MIDL 0x1d /* Manuf. ID low */
#define REG_MVFP 0x1e /* Mirror / vflip */
#define MVFP_MIRROR 0x20 /* Mirror image */
#define MVFP_FLIP 0x10 /* Vertical flip */
#define REG_AEW 0x24 /* AGC upper limit */
#define REG_AEB 0x25 /* AGC lower limit */
#define REG_VPT 0x26 /* AGC/AEC fast mode op region */
#define REG_HSYST 0x30 /* HSYNC rising edge delay */
#define REG_HSYEN 0x31 /* HSYNC falling edge delay */
#define REG_HREF 0x32 /* HREF pieces */
#define REG_TSLB 0x3a /* lots of stuff */
#define TSLB_YLAST 0x04 /* UYVY or VYUY - see com13 */
#define REG_COM11 0x3b /* Control 11 */
#define COM11_NIGHT 0x80 /* NIght mode enable */
#define COM11_NMFR 0x60 /* Two bit NM frame rate */
#define COM11_HZAUTO 0x10 /* Auto detect 50/60 Hz */
#define COM11_50HZ 0x08 /* Manual 50Hz select */
#define COM11_EXP 0x02
#define REG_COM12 0x3c /* Control 12 */
#define COM12_HREF 0x80 /* HREF always */
#define REG_COM13 0x3d /* Control 13 */
#define COM13_GAMMA 0x80 /* Gamma enable */
#define COM13_UVSAT 0x40 /* UV saturation auto adjustment */
#define COM13_UVSWAP 0x01 /* V before U - w/TSLB */
#define REG_COM14 0x3e /* Control 14 */
#define COM14_DCWEN 0x10 /* DCW/PCLK-scale enable */
#define REG_EDGE 0x3f /* Edge enhancement factor */
#define REG_COM15 0x40 /* Control 15 */
#define COM15_R10F0 0x00 /* Data range 10 to F0 */
#define COM15_R01FE 0x80 /* 01 to FE */
#define COM15_R00FF 0xc0 /* 00 to FF */
#define COM15_RGB565 0x10 /* RGB565 output */
#define COM15_RGB555 0x30 /* RGB555 output */
#define REG_COM16 0x41 /* Control 16 */
#define COM16_AWBGAIN 0x08 /* AWB gain enable */
#define REG_COM17 0x42 /* Control 17 */
#define COM17_AECWIN 0xc0 /* AEC window - must match COM4 */
#define COM17_CBAR 0x08 /* DSP Color bar */
#define REG_RGB444 0x8c /* RGB 444 control */
#define R444_ENABLE 0x02 /* Turn on RGB444, overrides 5x5 */
#define R444_RGBX 0x01 /* Empty nibble at end */
#define OV_STAT_FLIP_BIT OV_STAT_FLIP
#define PWDN_INTERVAL 1024
#define RESET_INTERVAL 1024
#define CRYSTAL_INTERVAL 4096
#endif /* _OV7670_H */
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/compression/lz77/lz77.h | #define WINDOW_SIZE (1024 + 512)
#define LOOK_AHEAD_SIZE 32
#define LENGTH_BITS 5
#define OFFSET_BITS 11 /* If OFFSET_BITS is lower than 9, we need to
change the do_compress algorithm */
|
tinyos-io/tinyos-3.x-contrib | csau/ub/tos/lib/net/ub/UnifiedBroadcast.h | <filename>csau/ub/tos/lib/net/ub/UnifiedBroadcast.h
/**
* @author <NAME> <mth at cs dot au dot dk>
* @date June 6 2010
*/
#ifndef UNIFIEDBROADCAST_H
#define UNIFIEDBROADCAST_H
enum {
AM_UNIFIEDBROADCAST_MSG = 131,
};
typedef struct broadcast_data {
nx_uint8_t len; // length of id + data
nx_am_id_t id;
nx_uint8_t* data;
} broadcast_data_t;
//int broadcast_add(broadcast_data_t* data, void* buf, uint8_t len, uint8_t offset);
//int broadcast_extract(broadcast_data_t* data, void* buf, uint8_t len, uint8_t offset);
/*typedef struct broadcast_message {
nx_uint8_t data[TOSH_DATA_LENGTH];
} broadcast_message_t;*/
#endif
|
tinyos-io/tinyos-3.x-contrib | rincon/apps/BlackbookBridge/BFileDirBridge/BFileDir.h | <gh_stars>1-10
/*
* Copyright (c) 2005-2006 Rincon Research Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the Rincon Research Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE
*/
/**
* Automatically generated header file for BFileDir
*/
#ifndef BFILEDIR_H
#define BFILEDIR_H
typedef nx_struct BFileDirMsg {
nx_uint8_t bool0;
nx_uint8_t short0;
nx_uint8_t short1;
nx_uint16_t int0;
nx_uint32_t long0;
nx_uint8_t fileName[8]; // FILENAME_LENGTH
} BFileDirMsg;
enum {
CMD_GETTOTALFILES = 0,
REPLY_GETTOTALFILES = 1,
CMD_GETTOTALNODES = 2,
REPLY_GETTOTALNODES = 3,
CMD_GETFREESPACE = 4,
REPLY_GETFREESPACE = 5,
CMD_CHECKEXISTS = 6,
REPLY_CHECKEXISTS = 7,
CMD_READFIRST = 8,
REPLY_READFIRST = 9,
CMD_READNEXT = 10,
REPLY_READNEXT = 11,
CMD_GETRESERVEDLENGTH = 12,
REPLY_GETRESERVEDLENGTH = 13,
CMD_GETDATALENGTH = 14,
REPLY_GETDATALENGTH = 15,
CMD_CHECKCORRUPTION = 16,
REPLY_CHECKCORRUPTION = 17,
EVENT_CORRUPTIONCHECKDONE = 18,
EVENT_EXISTSCHECKDONE = 19,
EVENT_NEXTFILE = 20,
};
enum {
AM_BFILEDIRMSG = 0xB4,
};
#endif
|
tinyos-io/tinyos-3.x-contrib | vu/tos/platforms/telosa/TimeSyncMessageLayer.h | /*
* Copyright (c) 2010, Vanderbilt University
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Author: <NAME>
*/
#ifndef __TIMESYNCMESSAGELAYER_H__
#define __TIMESYNCMESSAGELAYER_H__
#include <AM.h>
// this is sent over the air
typedef nx_int32_t timesync_relative_t;
// this is stored in memory
typedef nx_uint32_t timesync_absolute_t;
typedef nx_struct timesync_footer_t
{
nx_union timestamp_t
{
timesync_relative_t relative;
timesync_absolute_t absolute;
} timestamp;
} timesync_footer_t;
#endif//__TIMESYNCMESSAGELAYER_H__
|
tinyos-io/tinyos-3.x-contrib | eon/eon/src/runtime/tinyos2/fluxenergypredictor.h | <filename>eon/eon/src/runtime/tinyos2/fluxenergypredictor.h
#ifndef FLUXENERGYPREDICTOR_H_INCLUDED
#define FLUXENERGYPREDICTOR_H_INCLUDED
#include "../nodes.h"
#define NUMTIMEFRAMES 8
const uint8_t ENERGY_TIMESCALES[NUMTIMEFRAMES] = {1,2,4,8,16,32,64,128};
int32_t predict_energy (uint8_t timeframe, uint8_t state)
{
int32_t src_energy;
int32_t consumption;
src_energy = predict_source(ENERGY_TIMESCALES[timeframe]);//predict source
consumption = predict_consumption(ENERGY_TIMESCALES[timeframe], state);
return src_energy - consumption;
}
#endif
|
tinyos-io/tinyos-3.x-contrib | diku/common/tools/daq/kernel-driver/proc.c | <reponame>tinyos-io/tinyos-3.x-contrib
/* Procfs interface for the PCI series device driver.
Author: <NAME>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* File level history (record changes for this file here.)
v 0.0.2 11 Sep 2002 by <NAME>
ixpci_cardname() ==> _pci_cardname()
v 0.0.1 28 Dec 2001 by <NAME>
Fixed a bug that forgot to increase the present counter when
a card had been found at kernel 2.4.
v 0.0.0 2 Nov 2001 by <NAME>
Support Kernel 2.4.
Separated from _pci.c.
Create. */
#include <linux/proc_fs.h>
#include <linux/init.h>
#include "ixpci_kernel.h"
extern unsigned int ixpci_major;
extern ixpci_kernel_t *ixpci_dev;
static int ixpci_get_info(char *buf, char **start, off_t offset, int buf_size)
{
/* read file /proc/ixpci
*
* Arguments: as /proc filesystem, read <linux/proc_fs.h>
*
* Returned: number of written bytes */
char *p, *q, *l;
unsigned int i, n, a, b, c, d;
ixpci_kernel_t *r;
char my_buf[128];
if (offset > 0)
return 0;
/* here, we assume the buf is always large
enough to hold all of our info data at
one fell swoop */
p = buf;
n = buf_size;
/* export major number */
sprintf(my_buf, "maj: %d\n", ixpci_major);
q = my_buf;
for (; n > 0 && *q != '\0'; --n) { /* export characters */
*p++ = *q++;
}
/* export module names */
i = 0;
l = "mod:";
for (; n > 0 && *l != '\0'; --n) {
*p++ = *l++;
}
while (ixpci_card[i].id) { /* scan card list */
if (ixpci_card[i].present) { /* find present card */
if (n > 0) {
*p++ = ' ';
--n;
}
q = ixpci_card[i].module;
for (; n > 0 && *q != '\0'; --n) { /* export card's module name */
*p++ = *q++;
}
}
++i;
}
if (n > 0) { /* separator */
*p++ = '\n';
--n;
}
/* export device characters */
r = ixpci_dev;
while (r) {
l = "dev: ";
for (; n > 0 && *l != '\0'; --n) { /* export card's module name */
*p++ = *l++;
}
a = (r->id >> 48) & 0xffff;
b = (r->id >> 32) & 0xffff;
c = (r->id >> 16) & 0xffff;
d = r->id & 0xffff;
sprintf(my_buf,
"ixpci%d %d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%04x%04x%04x%04x %s\n",
r->no, r->sdev->irq, pci_resource_start(r->sdev, 0),
pci_resource_start(r->sdev, 1), pci_resource_start(r->sdev, 2),
pci_resource_start(r->sdev, 3), pci_resource_start(r->sdev, 4),
pci_resource_start(r->sdev, 5), a, b, c, d,
(char *) ixpci_pci_cardname(r->id));
q = my_buf;
for (; n > 0 && *q != '\0'; --n) { /* export characters */
*p++ = *q++;
}
r = r->next;
}
return (p - buf - offset); /* bye bye */
}
static struct proc_dir_entry *ixpci_proc_dir;
void ixpci_proc_exit(void)
{
remove_proc_entry(DEVICE_NAME, ixpci_proc_dir);
}
int ixpci_proc_init(void)
{
ixpci_proc_dir = proc_mkdir(FAMILY, 0);
create_proc_info_entry(DEVICE_NAME, 0, ixpci_proc_dir, ixpci_get_info);
return 0;
}
|
tinyos-io/tinyos-3.x-contrib | berkeley/blip-2.0/support/sdk/c/blip/interface/tun_dev_darwin.c | <filename>berkeley/blip-2.0/support/sdk/c/blip/interface/tun_dev_darwin.c<gh_stars>1-10
/*
* "Copyright (c) 2008 The Regents of the University of California.
* All rights reserved."
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
*
* @author <NAME> <<EMAIL>>
*/
/* We're in macland here so we can do all the OSX-specific includes here */
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <arpa/inet.h>
#include <sys/sockio.h>
#include "lib6lowpan/lib6lowpan.h"
#include "lib6lowpan/blip-pc-includes.h"
#include "tun_ioctls_darwin.h"
#include "tun_dev.h"
#include "logging.h"
int tun_open(char *dev) {
int fd;
int yes = 1, flags;
if ((fd = open("/dev/tun0", O_RDWR)) < 0)
return -1;
if (dev) strncpy(dev, "tun0", IF_NAMESIZE);
/* this makes it so we have to prepend the address family to
packets we write. */
if (ioctl(fd, TUNSIFHEAD, &yes) < 0)
goto failed;
/* if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) */
/* goto failed; */
/* for some reason it defaults to nonblocking... */
flags = fcntl(fd, F_GETFL, 0);
flags &= ~O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
return fd;
failed:
log_fatal_perror("tun_open");
close(fd);
return -1;
}
int tun_setup(char *dev, ieee154_laddr_t link_address) {
char addr_buf[256], cmd_buf[1024];
struct in6_addr my_addr;
struct ifreq ifr;
int fd;
if ((fd = socket(PF_INET6, SOCK_DGRAM, 0)) < 0)
return -1;
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, dev, IF_NAMESIZE);
/* set the interface up */
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
log_fatal_perror("SIOCGIFFLAGS");
return -1;
}
ifr.ifr_flags |= IFF_UP | IFF_BROADCAST;
ifr.ifr_flags &= ~IFF_POINTOPOINT;
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
log_fatal_perror("SIOCSIFFLAGS");
return -1;
}
/* MTU */
ifr.ifr_mtu = 1280;
if (ioctl(fd, SIOCSIFMTU, &ifr) < 0) {
log_fatal_perror("SIOCSIFMTU");
return -1;
}
/* link-local address */
memset(my_addr.s6_addr, 0, 16);
my_addr.s6_addr[0] = 0xfe;
my_addr.s6_addr[1] = 0x80;
memcpy(&my_addr.s6_addr[8], link_address.data, 8);
/* add address alias */
inet_ntop(AF_INET6, &my_addr, addr_buf, 256);
snprintf(cmd_buf, 1024, "ifconfig %s inet6 %s/64", dev, addr_buf);
printf("%s\n", cmd_buf);
if (system(cmd_buf) != 0) {
fatal("could not set local address!\n");
return -1;
}
/* remove any existing addresses */
snprintf(cmd_buf, 1024,
"ifconfig %s inet6 `ifconfig %s | grep inet6 | cut -f2 | cut -f2 -d' ' | head -n1` -alias ",
dev, dev);
printf("%s\n", cmd_buf);
if (system(cmd_buf) != 0) {
}
/* not exactly sure why the last command doesn't take effect right away... */
sleep(1);
snprintf(cmd_buf, 1024, "route -q add -inet6 fe80::%%%s -prefixlen %i -interface %s > /dev/null",
dev, 64, dev);
printf("%s\n", cmd_buf);
if (system(cmd_buf) != 0) {
fatal("could not add route!\n");
return -1;
}
/* Global address */
/* memcpy(&my_addr, addr, sizeof(struct in6_addr)); */
/* inet_ntop(AF_INET6, &my_addr, addr_buf, 256); */
/* snprintf(cmd_buf, 1024, "ifconfig %s inet6 %s/%i", dev, addr_buf, pfxlen); */
/* if (system(cmd_buf) != 0) { */
/* fatal("could not set global address!\n"); */
/* return -1; */
/* } */
/* my_addr.__u6_addr.__u6_addr16[0] = htons(0xfe80); */
return 0;
}
int tun_close(int fd, char *dev)
{
return close(fd);
}
/* Read/write frames from TUN device */
int tun_write(int fd, struct ip6_packet *msg) {
uint8_t buf[INET_MTU + sizeof(struct tun_pi)], *packet;
struct tun_pi *pi = (struct tun_pi *)buf;
int length = sizeof(struct ip6_hdr) + sizeof(struct tun_pi);
packet = (uint8_t *)(pi + 1);
if (ntohs(msg->ip6_hdr.ip6_plen) + sizeof(struct ip6_hdr) >= INET_MTU)
return 1;
pi->af = htonl(AF_INET6);
memcpy(packet, &msg->ip6_hdr, sizeof(struct ip6_hdr));
packet += sizeof(struct ip6_hdr);
length += iov_read(msg->ip6_data, 0, iov_len(msg->ip6_data), packet);
debug("delivering packet\n");
print_buffer(buf, length);
return write(fd, buf, length);
}
int tun_read(int fd, char *buf, int len)
{
int out;
out = read(fd, buf, len);
if (out < 0)
log_fatal_perror("tun_read");
return out;
}
|
tinyos-io/tinyos-3.x-contrib | diku/freescale/tos/chips/hcs08/hcs08regs.h | //$Id: hcs08regs.h,v 1.3 2008/10/26 20:44:40 mleopold Exp $
//@author <NAME> <<EMAIL>>
// This file was automatically generated with the command:
// ./make_hcs08regs.pl hcs08regs.txt > hcs08regs.h
#ifndef _H_hcs08regs_h
#define _H_hcs08regs_h
#define HC08_REGISTER(type,addr) (*((type*)(addr)))
enum { PTAD_Addr = 0x00 };
typedef struct
{
uint8_t PTAD0 : 1;
uint8_t PTAD1 : 1;
uint8_t PTAD2 : 1;
uint8_t PTAD3 : 1;
uint8_t PTAD4 : 1;
uint8_t PTAD5 : 1;
uint8_t PTAD6 : 1;
uint8_t PTAD7 : 1;
} PTAD_t;
#define PTAD HC08_REGISTER(uint8_t,PTAD_Addr)
#define PTAD_Bits HC08_REGISTER(PTAD_t,PTAD_Addr)
#define PTAD_PTAD7 PTAD_Bits.PTAD7
#define PTAD_PTAD6 PTAD_Bits.PTAD6
#define PTAD_PTAD5 PTAD_Bits.PTAD5
#define PTAD_PTAD4 PTAD_Bits.PTAD4
#define PTAD_PTAD3 PTAD_Bits.PTAD3
#define PTAD_PTAD2 PTAD_Bits.PTAD2
#define PTAD_PTAD1 PTAD_Bits.PTAD1
#define PTAD_PTAD0 PTAD_Bits.PTAD0
enum { PTAPE_Addr = 0x01 };
typedef struct
{
uint8_t PTAPE0 : 1;
uint8_t PTAPE1 : 1;
uint8_t PTAPE2 : 1;
uint8_t PTAPE3 : 1;
uint8_t PTAPE4 : 1;
uint8_t PTAPE5 : 1;
uint8_t PTAPE6 : 1;
uint8_t PTAPE7 : 1;
} PTAPE_t;
#define PTAPE HC08_REGISTER(uint8_t,PTAPE_Addr)
#define PTAPE_Bits HC08_REGISTER(PTAPE_t,PTAPE_Addr)
#define PTAPE_PTAPE7 PTAPE_Bits.PTAPE7
#define PTAPE_PTAPE6 PTAPE_Bits.PTAPE6
#define PTAPE_PTAPE5 PTAPE_Bits.PTAPE5
#define PTAPE_PTAPE4 PTAPE_Bits.PTAPE4
#define PTAPE_PTAPE3 PTAPE_Bits.PTAPE3
#define PTAPE_PTAPE2 PTAPE_Bits.PTAPE2
#define PTAPE_PTAPE1 PTAPE_Bits.PTAPE1
#define PTAPE_PTAPE0 PTAPE_Bits.PTAPE0
enum { PTASE_Addr = 0x02 };
typedef struct
{
uint8_t PTASE0 : 1;
uint8_t PTASE1 : 1;
uint8_t PTASE2 : 1;
uint8_t PTASE3 : 1;
uint8_t PTASE4 : 1;
uint8_t PTASE5 : 1;
uint8_t PTASE6 : 1;
uint8_t PTASE7 : 1;
} PTASE_t;
#define PTASE HC08_REGISTER(uint8_t,PTASE_Addr)
#define PTASE_Bits HC08_REGISTER(PTASE_t,PTASE_Addr)
#define PTASE_PTASE7 PTASE_Bits.PTASE7
#define PTASE_PTASE6 PTASE_Bits.PTASE6
#define PTASE_PTASE5 PTASE_Bits.PTASE5
#define PTASE_PTASE4 PTASE_Bits.PTASE4
#define PTASE_PTASE3 PTASE_Bits.PTASE3
#define PTASE_PTASE2 PTASE_Bits.PTASE2
#define PTASE_PTASE1 PTASE_Bits.PTASE1
#define PTASE_PTASE0 PTASE_Bits.PTASE0
enum { PTADD_Addr = 0x03 };
typedef struct
{
uint8_t PTADD0 : 1;
uint8_t PTADD1 : 1;
uint8_t PTADD2 : 1;
uint8_t PTADD3 : 1;
uint8_t PTADD4 : 1;
uint8_t PTADD5 : 1;
uint8_t PTADD6 : 1;
uint8_t PTADD7 : 1;
} PTADD_t;
#define PTADD HC08_REGISTER(uint8_t,PTADD_Addr)
#define PTADD_Bits HC08_REGISTER(PTADD_t,PTADD_Addr)
#define PTADD_PTADD7 PTADD_Bits.PTADD7
#define PTADD_PTADD6 PTADD_Bits.PTADD6
#define PTADD_PTADD5 PTADD_Bits.PTADD5
#define PTADD_PTADD4 PTADD_Bits.PTADD4
#define PTADD_PTADD3 PTADD_Bits.PTADD3
#define PTADD_PTADD2 PTADD_Bits.PTADD2
#define PTADD_PTADD1 PTADD_Bits.PTADD1
#define PTADD_PTADD0 PTADD_Bits.PTADD0
enum { PTBD_Addr = 0x04 };
typedef struct
{
uint8_t PTBD0 : 1;
uint8_t PTBD1 : 1;
uint8_t PTBD2 : 1;
uint8_t PTBD3 : 1;
uint8_t PTBD4 : 1;
uint8_t PTBD5 : 1;
uint8_t PTBD6 : 1;
uint8_t PTBD7 : 1;
} PTBD_t;
#define PTBD HC08_REGISTER(uint8_t,PTBD_Addr)
#define PTBD_Bits HC08_REGISTER(PTBD_t,PTBD_Addr)
#define PTBD_PTBD7 PTBD_Bits.PTBD7
#define PTBD_PTBD6 PTBD_Bits.PTBD6
#define PTBD_PTBD5 PTBD_Bits.PTBD5
#define PTBD_PTBD4 PTBD_Bits.PTBD4
#define PTBD_PTBD3 PTBD_Bits.PTBD3
#define PTBD_PTBD2 PTBD_Bits.PTBD2
#define PTBD_PTBD1 PTBD_Bits.PTBD1
#define PTBD_PTBD0 PTBD_Bits.PTBD0
enum { PTBPE_Addr = 0x05 };
typedef struct
{
uint8_t PTBPE0 : 1;
uint8_t PTBPE1 : 1;
uint8_t PTBPE2 : 1;
uint8_t PTBPE3 : 1;
uint8_t PTBPE4 : 1;
uint8_t PTBPE5 : 1;
uint8_t PTBPE6 : 1;
uint8_t PTBPE7 : 1;
} PTBPE_t;
#define PTBPE HC08_REGISTER(uint8_t,PTBPE_Addr)
#define PTBPE_Bits HC08_REGISTER(PTBPE_t,PTBPE_Addr)
#define PTBPE_PTBPE7 PTBPE_Bits.PTBPE7
#define PTBPE_PTBPE6 PTBPE_Bits.PTBPE6
#define PTBPE_PTBPE5 PTBPE_Bits.PTBPE5
#define PTBPE_PTBPE4 PTBPE_Bits.PTBPE4
#define PTBPE_PTBPE3 PTBPE_Bits.PTBPE3
#define PTBPE_PTBPE2 PTBPE_Bits.PTBPE2
#define PTBPE_PTBPE1 PTBPE_Bits.PTBPE1
#define PTBPE_PTBPE0 PTBPE_Bits.PTBPE0
enum { PTBSE_Addr = 0x06 };
typedef struct
{
uint8_t PTBSE0 : 1;
uint8_t PTBSE1 : 1;
uint8_t PTBSE2 : 1;
uint8_t PTBSE3 : 1;
uint8_t PTBSE4 : 1;
uint8_t PTBSE5 : 1;
uint8_t PTBSE6 : 1;
uint8_t PTBSE7 : 1;
} PTBSE_t;
#define PTBSE HC08_REGISTER(uint8_t,PTBSE_Addr)
#define PTBSE_Bits HC08_REGISTER(PTBSE_t,PTBSE_Addr)
#define PTBSE_PTBSE7 PTBSE_Bits.PTBSE7
#define PTBSE_PTBSE6 PTBSE_Bits.PTBSE6
#define PTBSE_PTBSE5 PTBSE_Bits.PTBSE5
#define PTBSE_PTBSE4 PTBSE_Bits.PTBSE4
#define PTBSE_PTBSE3 PTBSE_Bits.PTBSE3
#define PTBSE_PTBSE2 PTBSE_Bits.PTBSE2
#define PTBSE_PTBSE1 PTBSE_Bits.PTBSE1
#define PTBSE_PTBSE0 PTBSE_Bits.PTBSE0
enum { PTBDD_Addr = 0x07 };
typedef struct
{
uint8_t PTBDD0 : 1;
uint8_t PTBDD1 : 1;
uint8_t PTBDD2 : 1;
uint8_t PTBDD3 : 1;
uint8_t PTBDD4 : 1;
uint8_t PTBDD5 : 1;
uint8_t PTBDD6 : 1;
uint8_t PTBDD7 : 1;
} PTBDD_t;
#define PTBDD HC08_REGISTER(uint8_t,PTBDD_Addr)
#define PTBDD_Bits HC08_REGISTER(PTBDD_t,PTBDD_Addr)
#define PTBDD_PTBDD7 PTBDD_Bits.PTBDD7
#define PTBDD_PTBDD6 PTBDD_Bits.PTBDD6
#define PTBDD_PTBDD5 PTBDD_Bits.PTBDD5
#define PTBDD_PTBDD4 PTBDD_Bits.PTBDD4
#define PTBDD_PTBDD3 PTBDD_Bits.PTBDD3
#define PTBDD_PTBDD2 PTBDD_Bits.PTBDD2
#define PTBDD_PTBDD1 PTBDD_Bits.PTBDD1
#define PTBDD_PTBDD0 PTBDD_Bits.PTBDD0
enum { PTCD_Addr = 0x08 };
typedef struct
{
uint8_t PTCD0 : 1;
uint8_t PTCD1 : 1;
uint8_t PTCD2 : 1;
uint8_t PTCD3 : 1;
uint8_t PTCD4 : 1;
uint8_t PTCD5 : 1;
uint8_t PTCD6 : 1;
uint8_t PTCD7 : 1;
} PTCD_t;
#define PTCD HC08_REGISTER(uint8_t,PTCD_Addr)
#define PTCD_Bits HC08_REGISTER(PTCD_t,PTCD_Addr)
#define PTCD_PTCD7 PTCD_Bits.PTCD7
#define PTCD_PTCD6 PTCD_Bits.PTCD6
#define PTCD_PTCD5 PTCD_Bits.PTCD5
#define PTCD_PTCD4 PTCD_Bits.PTCD4
#define PTCD_PTCD3 PTCD_Bits.PTCD3
#define PTCD_PTCD2 PTCD_Bits.PTCD2
#define PTCD_PTCD1 PTCD_Bits.PTCD1
#define PTCD_PTCD0 PTCD_Bits.PTCD0
enum { PTCPE_Addr = 0x09 };
typedef struct
{
uint8_t PTCPE0 : 1;
uint8_t PTCPE1 : 1;
uint8_t PTCPE2 : 1;
uint8_t PTCPE3 : 1;
uint8_t PTCPE4 : 1;
uint8_t PTCPE5 : 1;
uint8_t PTCPE6 : 1;
uint8_t PTCPE7 : 1;
} PTCPE_t;
#define PTCPE HC08_REGISTER(uint8_t,PTCPE_Addr)
#define PTCPE_Bits HC08_REGISTER(PTCPE_t,PTCPE_Addr)
#define PTCPE_PTCPE7 PTCPE_Bits.PTCPE7
#define PTCPE_PTCPE6 PTCPE_Bits.PTCPE6
#define PTCPE_PTCPE5 PTCPE_Bits.PTCPE5
#define PTCPE_PTCPE4 PTCPE_Bits.PTCPE4
#define PTCPE_PTCPE3 PTCPE_Bits.PTCPE3
#define PTCPE_PTCPE2 PTCPE_Bits.PTCPE2
#define PTCPE_PTCPE1 PTCPE_Bits.PTCPE1
#define PTCPE_PTCPE0 PTCPE_Bits.PTCPE0
enum { PTCSE_Addr = 0x0A };
typedef struct
{
uint8_t PTCSE0 : 1;
uint8_t PTCSE1 : 1;
uint8_t PTCSE2 : 1;
uint8_t PTCSE3 : 1;
uint8_t PTCSE4 : 1;
uint8_t PTCSE5 : 1;
uint8_t PTCSE6 : 1;
uint8_t PTCSE7 : 1;
} PTCSE_t;
#define PTCSE HC08_REGISTER(uint8_t,PTCSE_Addr)
#define PTCSE_Bits HC08_REGISTER(PTCSE_t,PTCSE_Addr)
#define PTCSE_PTCSE7 PTCSE_Bits.PTCSE7
#define PTCSE_PTCSE6 PTCSE_Bits.PTCSE6
#define PTCSE_PTCSE5 PTCSE_Bits.PTCSE5
#define PTCSE_PTCSE4 PTCSE_Bits.PTCSE4
#define PTCSE_PTCSE3 PTCSE_Bits.PTCSE3
#define PTCSE_PTCSE2 PTCSE_Bits.PTCSE2
#define PTCSE_PTCSE1 PTCSE_Bits.PTCSE1
#define PTCSE_PTCSE0 PTCSE_Bits.PTCSE0
enum { PTCDD_Addr = 0x0B };
typedef struct
{
uint8_t PTCDD0 : 1;
uint8_t PTCDD1 : 1;
uint8_t PTCDD2 : 1;
uint8_t PTCDD3 : 1;
uint8_t PTCDD4 : 1;
uint8_t PTCDD5 : 1;
uint8_t PTCDD6 : 1;
uint8_t PTCDD7 : 1;
} PTCDD_t;
#define PTCDD HC08_REGISTER(uint8_t,PTCDD_Addr)
#define PTCDD_Bits HC08_REGISTER(PTCDD_t,PTCDD_Addr)
#define PTCDD_PTCDD7 PTCDD_Bits.PTCDD7
#define PTCDD_PTCDD6 PTCDD_Bits.PTCDD6
#define PTCDD_PTCDD5 PTCDD_Bits.PTCDD5
#define PTCDD_PTCDD4 PTCDD_Bits.PTCDD4
#define PTCDD_PTCDD3 PTCDD_Bits.PTCDD3
#define PTCDD_PTCDD2 PTCDD_Bits.PTCDD2
#define PTCDD_PTCDD1 PTCDD_Bits.PTCDD1
#define PTCDD_PTCDD0 PTCDD_Bits.PTCDD0
enum { PTDD_Addr = 0x0C };
typedef struct
{
uint8_t PTDD0 : 1;
uint8_t PTDD1 : 1;
uint8_t PTDD2 : 1;
uint8_t PTDD3 : 1;
uint8_t PTDD4 : 1;
uint8_t PTDD5 : 1;
uint8_t PTDD6 : 1;
uint8_t PTDD7 : 1;
} PTDD_t;
#define PTDD HC08_REGISTER(uint8_t,PTDD_Addr)
#define PTDD_Bits HC08_REGISTER(PTDD_t,PTDD_Addr)
#define PTDD_PTDD7 PTDD_Bits.PTDD7
#define PTDD_PTDD6 PTDD_Bits.PTDD6
#define PTDD_PTDD5 PTDD_Bits.PTDD5
#define PTDD_PTDD4 PTDD_Bits.PTDD4
#define PTDD_PTDD3 PTDD_Bits.PTDD3
#define PTDD_PTDD2 PTDD_Bits.PTDD2
#define PTDD_PTDD1 PTDD_Bits.PTDD1
#define PTDD_PTDD0 PTDD_Bits.PTDD0
enum { PTDPE_Addr = 0x0D };
typedef struct
{
uint8_t PTDPE0 : 1;
uint8_t PTDPE1 : 1;
uint8_t PTDPE2 : 1;
uint8_t PTDPE3 : 1;
uint8_t PTDPE4 : 1;
uint8_t PTDPE5 : 1;
uint8_t PTDPE6 : 1;
uint8_t PTDPE7 : 1;
} PTDPE_t;
#define PTDPE HC08_REGISTER(uint8_t,PTDPE_Addr)
#define PTDPE_Bits HC08_REGISTER(PTDPE_t,PTDPE_Addr)
#define PTDPE_PTDPE7 PTDPE_Bits.PTDPE7
#define PTDPE_PTDPE6 PTDPE_Bits.PTDPE6
#define PTDPE_PTDPE5 PTDPE_Bits.PTDPE5
#define PTDPE_PTDPE4 PTDPE_Bits.PTDPE4
#define PTDPE_PTDPE3 PTDPE_Bits.PTDPE3
#define PTDPE_PTDPE2 PTDPE_Bits.PTDPE2
#define PTDPE_PTDPE1 PTDPE_Bits.PTDPE1
#define PTDPE_PTDPE0 PTDPE_Bits.PTDPE0
enum { PTDSE_Addr = 0x0E };
typedef struct
{
uint8_t PTDSE0 : 1;
uint8_t PTDSE1 : 1;
uint8_t PTDSE2 : 1;
uint8_t PTDSE3 : 1;
uint8_t PTDSE4 : 1;
uint8_t PTDSE5 : 1;
uint8_t PTDSE6 : 1;
uint8_t PTDSE7 : 1;
} PTDSE_t;
#define PTDSE HC08_REGISTER(uint8_t,PTDSE_Addr)
#define PTDSE_Bits HC08_REGISTER(PTDSE_t,PTDSE_Addr)
#define PTDSE_PTDSE7 PTDSE_Bits.PTDSE7
#define PTDSE_PTDSE6 PTDSE_Bits.PTDSE6
#define PTDSE_PTDSE5 PTDSE_Bits.PTDSE5
#define PTDSE_PTDSE4 PTDSE_Bits.PTDSE4
#define PTDSE_PTDSE3 PTDSE_Bits.PTDSE3
#define PTDSE_PTDSE2 PTDSE_Bits.PTDSE2
#define PTDSE_PTDSE1 PTDSE_Bits.PTDSE1
#define PTDSE_PTDSE0 PTDSE_Bits.PTDSE0
enum { PTDDD_Addr = 0x0F };
typedef struct
{
uint8_t PTDDD0 : 1;
uint8_t PTDDD1 : 1;
uint8_t PTDDD2 : 1;
uint8_t PTDDD3 : 1;
uint8_t PTDDD4 : 1;
uint8_t PTDDD5 : 1;
uint8_t PTDDD6 : 1;
uint8_t PTDDD7 : 1;
} PTDDD_t;
#define PTDDD HC08_REGISTER(uint8_t,PTDDD_Addr)
#define PTDDD_Bits HC08_REGISTER(PTDDD_t,PTDDD_Addr)
#define PTDDD_PTDDD7 PTDDD_Bits.PTDDD7
#define PTDDD_PTDDD6 PTDDD_Bits.PTDDD6
#define PTDDD_PTDDD5 PTDDD_Bits.PTDDD5
#define PTDDD_PTDDD4 PTDDD_Bits.PTDDD4
#define PTDDD_PTDDD3 PTDDD_Bits.PTDDD3
#define PTDDD_PTDDD2 PTDDD_Bits.PTDDD2
#define PTDDD_PTDDD1 PTDDD_Bits.PTDDD1
#define PTDDD_PTDDD0 PTDDD_Bits.PTDDD0
enum { PTED_Addr = 0x10 };
typedef struct
{
uint8_t PTED0 : 1;
uint8_t PTED1 : 1;
uint8_t PTED2 : 1;
uint8_t PTED3 : 1;
uint8_t PTED4 : 1;
uint8_t PTED5 : 1;
uint8_t PTED6 : 1;
uint8_t PTED7 : 1;
} PTED_t;
#define PTED HC08_REGISTER(uint8_t,PTED_Addr)
#define PTED_Bits HC08_REGISTER(PTED_t,PTED_Addr)
#define PTED_PTED7 PTED_Bits.PTED7
#define PTED_PTED6 PTED_Bits.PTED6
#define PTED_PTED5 PTED_Bits.PTED5
#define PTED_PTED4 PTED_Bits.PTED4
#define PTED_PTED3 PTED_Bits.PTED3
#define PTED_PTED2 PTED_Bits.PTED2
#define PTED_PTED1 PTED_Bits.PTED1
#define PTED_PTED0 PTED_Bits.PTED0
enum { PTEPE_Addr = 0x11 };
typedef struct
{
uint8_t PTEPE0 : 1;
uint8_t PTEPE1 : 1;
uint8_t PTEPE2 : 1;
uint8_t PTEPE3 : 1;
uint8_t PTEPE4 : 1;
uint8_t PTEPE5 : 1;
uint8_t PTEPE6 : 1;
uint8_t PTEPE7 : 1;
} PTEPE_t;
#define PTEPE HC08_REGISTER(uint8_t,PTEPE_Addr)
#define PTEPE_Bits HC08_REGISTER(PTEPE_t,PTEPE_Addr)
#define PTEPE_PTEPE7 PTEPE_Bits.PTEPE7
#define PTEPE_PTEPE6 PTEPE_Bits.PTEPE6
#define PTEPE_PTEPE5 PTEPE_Bits.PTEPE5
#define PTEPE_PTEPE4 PTEPE_Bits.PTEPE4
#define PTEPE_PTEPE3 PTEPE_Bits.PTEPE3
#define PTEPE_PTEPE2 PTEPE_Bits.PTEPE2
#define PTEPE_PTEPE1 PTEPE_Bits.PTEPE1
#define PTEPE_PTEPE0 PTEPE_Bits.PTEPE0
enum { PTESE_Addr = 0x12 };
typedef struct
{
uint8_t PTESE0 : 1;
uint8_t PTESE1 : 1;
uint8_t PTESE2 : 1;
uint8_t PTESE3 : 1;
uint8_t PTESE4 : 1;
uint8_t PTESE5 : 1;
uint8_t PTESE6 : 1;
uint8_t PTESE7 : 1;
} PTESE_t;
#define PTESE HC08_REGISTER(uint8_t,PTESE_Addr)
#define PTESE_Bits HC08_REGISTER(PTESE_t,PTESE_Addr)
#define PTESE_PTESE7 PTESE_Bits.PTESE7
#define PTESE_PTESE6 PTESE_Bits.PTESE6
#define PTESE_PTESE5 PTESE_Bits.PTESE5
#define PTESE_PTESE4 PTESE_Bits.PTESE4
#define PTESE_PTESE3 PTESE_Bits.PTESE3
#define PTESE_PTESE2 PTESE_Bits.PTESE2
#define PTESE_PTESE1 PTESE_Bits.PTESE1
#define PTESE_PTESE0 PTESE_Bits.PTESE0
enum { PTEDD_Addr = 0x13 };
typedef struct
{
uint8_t PTEDD0 : 1;
uint8_t PTEDD1 : 1;
uint8_t PTEDD2 : 1;
uint8_t PTEDD3 : 1;
uint8_t PTEDD4 : 1;
uint8_t PTEDD5 : 1;
uint8_t PTEDD6 : 1;
uint8_t PTEDD7 : 1;
} PTEDD_t;
#define PTEDD HC08_REGISTER(uint8_t,PTEDD_Addr)
#define PTEDD_Bits HC08_REGISTER(PTEDD_t,PTEDD_Addr)
#define PTEDD_PTEDD7 PTEDD_Bits.PTEDD7
#define PTEDD_PTEDD6 PTEDD_Bits.PTEDD6
#define PTEDD_PTEDD5 PTEDD_Bits.PTEDD5
#define PTEDD_PTEDD4 PTEDD_Bits.PTEDD4
#define PTEDD_PTEDD3 PTEDD_Bits.PTEDD3
#define PTEDD_PTEDD2 PTEDD_Bits.PTEDD2
#define PTEDD_PTEDD1 PTEDD_Bits.PTEDD1
#define PTEDD_PTEDD0 PTEDD_Bits.PTEDD0
enum { IRQSC_Addr = 0x14 };
typedef struct
{
uint8_t IRQMOD : 1;
uint8_t IRQIE : 1;
uint8_t IRQACK : 1;
uint8_t IRQF : 1;
uint8_t IRQPE : 1;
uint8_t IRQEDG : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} IRQSC_t;
#define IRQSC HC08_REGISTER(uint8_t,IRQSC_Addr)
#define IRQSC_Bits HC08_REGISTER(IRQSC_t,IRQSC_Addr)
#define IRQSC_IRQEDG IRQSC_Bits.IRQEDG
#define IRQSC_IRQPE IRQSC_Bits.IRQPE
#define IRQSC_IRQF IRQSC_Bits.IRQF
#define IRQSC_IRQACK IRQSC_Bits.IRQACK
#define IRQSC_IRQIE IRQSC_Bits.IRQIE
#define IRQSC_IRQMOD IRQSC_Bits.IRQMOD
enum { KBISC_Addr = 0x16 };
typedef struct
{
uint8_t KBIMOD : 1;
uint8_t KBIE : 1;
uint8_t KBACK : 1;
uint8_t KBF : 1;
uint8_t KBEDG4 : 1;
uint8_t KBEDG5 : 1;
uint8_t KBEDG6 : 1;
uint8_t KBEDG7 : 1;
} KBISC_t;
#define KBISC HC08_REGISTER(uint8_t,KBISC_Addr)
#define KBISC_Bits HC08_REGISTER(KBISC_t,KBISC_Addr)
#define KBISC_KBEDG7 KBISC_Bits.KBEDG7
#define KBISC_KBEDG6 KBISC_Bits.KBEDG6
#define KBISC_KBEDG5 KBISC_Bits.KBEDG5
#define KBISC_KBEDG4 KBISC_Bits.KBEDG4
#define KBISC_KBF KBISC_Bits.KBF
#define KBISC_KBACK KBISC_Bits.KBACK
#define KBISC_KBIE KBISC_Bits.KBIE
#define KBISC_KBIMOD KBISC_Bits.KBIMOD
enum { KBIPE_Addr = 0x17 };
typedef struct
{
uint8_t KBIPE0 : 1;
uint8_t KBIPE1 : 1;
uint8_t KBIPE2 : 1;
uint8_t KBIPE3 : 1;
uint8_t KBIPE4 : 1;
uint8_t KBIPE5 : 1;
uint8_t KBIPE6 : 1;
uint8_t KBIPE7 : 1;
} KBIPE_t;
#define KBIPE HC08_REGISTER(uint8_t,KBIPE_Addr)
#define KBIPE_Bits HC08_REGISTER(KBIPE_t,KBIPE_Addr)
#define KBIPE_KBIPE7 KBIPE_Bits.KBIPE7
#define KBIPE_KBIPE6 KBIPE_Bits.KBIPE6
#define KBIPE_KBIPE5 KBIPE_Bits.KBIPE5
#define KBIPE_KBIPE4 KBIPE_Bits.KBIPE4
#define KBIPE_KBIPE3 KBIPE_Bits.KBIPE3
#define KBIPE_KBIPE2 KBIPE_Bits.KBIPE2
#define KBIPE_KBIPE1 KBIPE_Bits.KBIPE1
#define KBIPE_KBIPE0 KBIPE_Bits.KBIPE0
enum { SCI1BDH_Addr = 0x18 };
typedef struct
{
uint8_t SBR8 : 1;
uint8_t SBR9 : 1;
uint8_t SBR10 : 1;
uint8_t SBR11 : 1;
uint8_t SBR12 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI1BDH_t;
#define SCI1BD HC08_REGISTER(uint16_t,SCI1BDH_Addr)
#define SCI1BDH HC08_REGISTER(uint8_t,SCI1BDH_Addr)
#define SCI1BDH_Bits HC08_REGISTER(SCI1BDH_t,SCI1BDH_Addr)
#define SCI1BDH_SBR12 SCI1BDH_Bits.SBR12
#define SCI1BDH_SBR11 SCI1BDH_Bits.SBR11
#define SCI1BDH_SBR10 SCI1BDH_Bits.SBR10
#define SCI1BDH_SBR9 SCI1BDH_Bits.SBR9
#define SCI1BDH_SBR8 SCI1BDH_Bits.SBR8
enum { SCI1BDL_Addr = 0x19 };
typedef struct
{
uint8_t SBR0 : 1;
uint8_t SBR1 : 1;
uint8_t SBR2 : 1;
uint8_t SBR3 : 1;
uint8_t SBR4 : 1;
uint8_t SBR5 : 1;
uint8_t SBR6 : 1;
uint8_t SBR7 : 1;
} SCI1BDL_t;
#define SCI1BDL HC08_REGISTER(uint8_t,SCI1BDL_Addr)
#define SCI1BDL_Bits HC08_REGISTER(SCI1BDL_t,SCI1BDL_Addr)
#define SCI1BDL_SBR7 SCI1BDL_Bits.SBR7
#define SCI1BDL_SBR6 SCI1BDL_Bits.SBR6
#define SCI1BDL_SBR5 SCI1BDL_Bits.SBR5
#define SCI1BDL_SBR4 SCI1BDL_Bits.SBR4
#define SCI1BDL_SBR3 SCI1BDL_Bits.SBR3
#define SCI1BDL_SBR2 SCI1BDL_Bits.SBR2
#define SCI1BDL_SBR1 SCI1BDL_Bits.SBR1
#define SCI1BDL_SBR0 SCI1BDL_Bits.SBR0
enum { SCI1C1_Addr = 0x1A };
typedef struct
{
uint8_t PT : 1;
uint8_t PE : 1;
uint8_t ILT : 1;
uint8_t WAKE : 1;
uint8_t M : 1;
uint8_t RSRC : 1;
uint8_t SCISWAI : 1;
uint8_t LOOPS : 1;
} SCI1C1_t;
#define SCI1C1 HC08_REGISTER(uint8_t,SCI1C1_Addr)
#define SCI1C1_Bits HC08_REGISTER(SCI1C1_t,SCI1C1_Addr)
#define SCI1C1_LOOPS SCI1C1_Bits.LOOPS
#define SCI1C1_SCISWAI SCI1C1_Bits.SCISWAI
#define SCI1C1_RSRC SCI1C1_Bits.RSRC
#define SCI1C1_M SCI1C1_Bits.M
#define SCI1C1_WAKE SCI1C1_Bits.WAKE
#define SCI1C1_ILT SCI1C1_Bits.ILT
#define SCI1C1_PE SCI1C1_Bits.PE
#define SCI1C1_PT SCI1C1_Bits.PT
enum { SCI1C2_Addr = 0x1B };
typedef struct
{
uint8_t SBK : 1;
uint8_t RWU : 1;
uint8_t RE : 1;
uint8_t TE : 1;
uint8_t ILIE : 1;
uint8_t RIE : 1;
uint8_t TCIE : 1;
uint8_t TIE : 1;
} SCI1C2_t;
#define SCI1C2 HC08_REGISTER(uint8_t,SCI1C2_Addr)
#define SCI1C2_Bits HC08_REGISTER(SCI1C2_t,SCI1C2_Addr)
#define SCI1C2_TIE SCI1C2_Bits.TIE
#define SCI1C2_TCIE SCI1C2_Bits.TCIE
#define SCI1C2_RIE SCI1C2_Bits.RIE
#define SCI1C2_ILIE SCI1C2_Bits.ILIE
#define SCI1C2_TE SCI1C2_Bits.TE
#define SCI1C2_RE SCI1C2_Bits.RE
#define SCI1C2_RWU SCI1C2_Bits.RWU
#define SCI1C2_SBK SCI1C2_Bits.SBK
enum { SCI1S1_Addr = 0x1C };
typedef struct
{
uint8_t PF : 1;
uint8_t FE : 1;
uint8_t NF : 1;
uint8_t OR : 1;
uint8_t IDLE : 1;
uint8_t RDRF : 1;
uint8_t TC : 1;
uint8_t TDRE : 1;
} SCI1S1_t;
#define SCI1S1 HC08_REGISTER(uint8_t,SCI1S1_Addr)
#define SCI1S1_Bits HC08_REGISTER(SCI1S1_t,SCI1S1_Addr)
#define SCI1S1_TDRE SCI1S1_Bits.TDRE
#define SCI1S1_TC SCI1S1_Bits.TC
#define SCI1S1_RDRF SCI1S1_Bits.RDRF
#define SCI1S1_IDLE SCI1S1_Bits.IDLE
#define SCI1S1_OR SCI1S1_Bits.OR
#define SCI1S1_NF SCI1S1_Bits.NF
#define SCI1S1_FE SCI1S1_Bits.FE
#define SCI1S1_PF SCI1S1_Bits.PF
enum { SCI1S2_Addr = 0x1D };
typedef struct
{
uint8_t RAF : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI1S2_t;
#define SCI1S2 HC08_REGISTER(uint8_t,SCI1S2_Addr)
#define SCI1S2_Bits HC08_REGISTER(SCI1S2_t,SCI1S2_Addr)
#define SCI1S2_RAF SCI1S2_Bits.RAF
enum { SCI1C3_Addr = 0x1E };
typedef struct
{
uint8_t PEIE : 1;
uint8_t FEIE : 1;
uint8_t NEIE : 1;
uint8_t ORIE : 1;
uint8_t bit4 : 1;
uint8_t TXDIR : 1;
uint8_t T8 : 1;
uint8_t R8 : 1;
} SCI1C3_t;
#define SCI1C3 HC08_REGISTER(uint8_t,SCI1C3_Addr)
#define SCI1C3_Bits HC08_REGISTER(SCI1C3_t,SCI1C3_Addr)
#define SCI1C3_R8 SCI1C3_Bits.R8
#define SCI1C3_T8 SCI1C3_Bits.T8
#define SCI1C3_TXDIR SCI1C3_Bits.TXDIR
#define SCI1C3_ORIE SCI1C3_Bits.ORIE
#define SCI1C3_NEIE SCI1C3_Bits.NEIE
#define SCI1C3_FEIE SCI1C3_Bits.FEIE
#define SCI1C3_PEIE SCI1C3_Bits.PEIE
enum { SCI1D_Addr = 0x1F };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI1D_t;
#define SCI1D HC08_REGISTER(uint8_t,SCI1D_Addr)
#define SCI1D_Bits HC08_REGISTER(SCI1D_t,SCI1D_Addr)
enum { SCI2BDH_Addr = 0x20 };
typedef struct
{
uint8_t SBR8 : 1;
uint8_t SBR9 : 1;
uint8_t SBR10 : 1;
uint8_t SBR11 : 1;
uint8_t SBR12 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI2BDH_t;
#define SCI2BD HC08_REGISTER(uint16_t,SCI2BDH_Addr)
#define SCI2BDH HC08_REGISTER(uint8_t,SCI2BDH_Addr)
#define SCI2BDH_Bits HC08_REGISTER(SCI2BDH_t,SCI2BDH_Addr)
#define SCI2BDH_SBR12 SCI2BDH_Bits.SBR12
#define SCI2BDH_SBR11 SCI2BDH_Bits.SBR11
#define SCI2BDH_SBR10 SCI2BDH_Bits.SBR10
#define SCI2BDH_SBR9 SCI2BDH_Bits.SBR9
#define SCI2BDH_SBR8 SCI2BDH_Bits.SBR8
enum { SCI2BDL_Addr = 0x21 };
typedef struct
{
uint8_t SBR0 : 1;
uint8_t SBR1 : 1;
uint8_t SBR2 : 1;
uint8_t SBR3 : 1;
uint8_t SBR4 : 1;
uint8_t SBR5 : 1;
uint8_t SBR6 : 1;
uint8_t SBR7 : 1;
} SCI2BDL_t;
#define SCI2BDL HC08_REGISTER(uint8_t,SCI2BDL_Addr)
#define SCI2BDL_Bits HC08_REGISTER(SCI2BDL_t,SCI2BDL_Addr)
#define SCI2BDL_SBR7 SCI2BDL_Bits.SBR7
#define SCI2BDL_SBR6 SCI2BDL_Bits.SBR6
#define SCI2BDL_SBR5 SCI2BDL_Bits.SBR5
#define SCI2BDL_SBR4 SCI2BDL_Bits.SBR4
#define SCI2BDL_SBR3 SCI2BDL_Bits.SBR3
#define SCI2BDL_SBR2 SCI2BDL_Bits.SBR2
#define SCI2BDL_SBR1 SCI2BDL_Bits.SBR1
#define SCI2BDL_SBR0 SCI2BDL_Bits.SBR0
enum { SCI2C1_Addr = 0x22 };
typedef struct
{
uint8_t PT : 1;
uint8_t PE : 1;
uint8_t ILT : 1;
uint8_t WAKE : 1;
uint8_t M : 1;
uint8_t RSRC : 1;
uint8_t SCISWAI : 1;
uint8_t LOOPS : 1;
} SCI2C1_t;
#define SCI2C1 HC08_REGISTER(uint8_t,SCI2C1_Addr)
#define SCI2C1_Bits HC08_REGISTER(SCI2C1_t,SCI2C1_Addr)
#define SCI2C1_LOOPS SCI2C1_Bits.LOOPS
#define SCI2C1_SCISWAI SCI2C1_Bits.SCISWAI
#define SCI2C1_RSRC SCI2C1_Bits.RSRC
#define SCI2C1_M SCI2C1_Bits.M
#define SCI2C1_WAKE SCI2C1_Bits.WAKE
#define SCI2C1_ILT SCI2C1_Bits.ILT
#define SCI2C1_PE SCI2C1_Bits.PE
#define SCI2C1_PT SCI2C1_Bits.PT
enum { SCI2C2_Addr = 0x23 };
typedef struct
{
uint8_t SBK : 1;
uint8_t RWU : 1;
uint8_t RE : 1;
uint8_t TE : 1;
uint8_t ILIE : 1;
uint8_t RIE : 1;
uint8_t TCIE : 1;
uint8_t TIE : 1;
} SCI2C2_t;
#define SCI2C2 HC08_REGISTER(uint8_t,SCI2C2_Addr)
#define SCI2C2_Bits HC08_REGISTER(SCI2C2_t,SCI2C2_Addr)
#define SCI2C2_TIE SCI2C2_Bits.TIE
#define SCI2C2_TCIE SCI2C2_Bits.TCIE
#define SCI2C2_RIE SCI2C2_Bits.RIE
#define SCI2C2_ILIE SCI2C2_Bits.ILIE
#define SCI2C2_TE SCI2C2_Bits.TE
#define SCI2C2_RE SCI2C2_Bits.RE
#define SCI2C2_RWU SCI2C2_Bits.RWU
#define SCI2C2_SBK SCI2C2_Bits.SBK
enum { SCI2S1_Addr = 0x24 };
typedef struct
{
uint8_t PF : 1;
uint8_t FE : 1;
uint8_t NF : 1;
uint8_t OR : 1;
uint8_t IDLE : 1;
uint8_t RDRF : 1;
uint8_t TC : 1;
uint8_t TDRE : 1;
} SCI2S1_t;
#define SCI2S1 HC08_REGISTER(uint8_t,SCI2S1_Addr)
#define SCI2S1_Bits HC08_REGISTER(SCI2S1_t,SCI2S1_Addr)
#define SCI2S1_TDRE SCI2S1_Bits.TDRE
#define SCI2S1_TC SCI2S1_Bits.TC
#define SCI2S1_RDRF SCI2S1_Bits.RDRF
#define SCI2S1_IDLE SCI2S1_Bits.IDLE
#define SCI2S1_OR SCI2S1_Bits.OR
#define SCI2S1_NF SCI2S1_Bits.NF
#define SCI2S1_FE SCI2S1_Bits.FE
#define SCI2S1_PF SCI2S1_Bits.PF
enum { SCI2S2_Addr = 0x25 };
typedef struct
{
uint8_t RAF : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI2S2_t;
#define SCI2S2 HC08_REGISTER(uint8_t,SCI2S2_Addr)
#define SCI2S2_Bits HC08_REGISTER(SCI2S2_t,SCI2S2_Addr)
#define SCI2S2_RAF SCI2S2_Bits.RAF
enum { SCI2C3_Addr = 0x26 };
typedef struct
{
uint8_t PEIE : 1;
uint8_t FEIE : 1;
uint8_t NEIE : 1;
uint8_t ORIE : 1;
uint8_t bit4 : 1;
uint8_t TXDIR : 1;
uint8_t T8 : 1;
uint8_t R8 : 1;
} SCI2C3_t;
#define SCI2C3 HC08_REGISTER(uint8_t,SCI2C3_Addr)
#define SCI2C3_Bits HC08_REGISTER(SCI2C3_t,SCI2C3_Addr)
#define SCI2C3_R8 SCI2C3_Bits.R8
#define SCI2C3_T8 SCI2C3_Bits.T8
#define SCI2C3_TXDIR SCI2C3_Bits.TXDIR
#define SCI2C3_ORIE SCI2C3_Bits.ORIE
#define SCI2C3_NEIE SCI2C3_Bits.NEIE
#define SCI2C3_FEIE SCI2C3_Bits.FEIE
#define SCI2C3_PEIE SCI2C3_Bits.PEIE
enum { SCI2D_Addr = 0x27 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SCI2D_t;
#define SCI2D HC08_REGISTER(uint8_t,SCI2D_Addr)
#define SCI2D_Bits HC08_REGISTER(SCI2D_t,SCI2D_Addr)
enum { SPIC1_Addr = 0x28 };
typedef struct
{
uint8_t LSBFE : 1;
uint8_t SSOE : 1;
uint8_t CPHA : 1;
uint8_t CPOL : 1;
uint8_t MSTR : 1;
uint8_t SPTIE : 1;
uint8_t SPE : 1;
uint8_t SPIE : 1;
} SPIC1_t;
#define SPIC1 HC08_REGISTER(uint8_t,SPIC1_Addr)
#define SPIC1_Bits HC08_REGISTER(SPIC1_t,SPIC1_Addr)
#define SPIC1_SPIE SPIC1_Bits.SPIE
#define SPIC1_SPE SPIC1_Bits.SPE
#define SPIC1_SPTIE SPIC1_Bits.SPTIE
#define SPIC1_MSTR SPIC1_Bits.MSTR
#define SPIC1_CPOL SPIC1_Bits.CPOL
#define SPIC1_CPHA SPIC1_Bits.CPHA
#define SPIC1_SSOE SPIC1_Bits.SSOE
#define SPIC1_LSBFE SPIC1_Bits.LSBFE
enum { SPIC2_Addr = 0x29 };
typedef struct
{
uint8_t SPC0 : 1;
uint8_t SPISWAI : 1;
uint8_t bit2 : 1;
uint8_t BIDIROE : 1;
uint8_t MODFEN : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SPIC2_t;
#define SPIC2 HC08_REGISTER(uint8_t,SPIC2_Addr)
#define SPIC2_Bits HC08_REGISTER(SPIC2_t,SPIC2_Addr)
#define SPIC2_MODFEN SPIC2_Bits.MODFEN
#define SPIC2_BIDIROE SPIC2_Bits.BIDIROE
#define SPIC2_SPISWAI SPIC2_Bits.SPISWAI
#define SPIC2_SPC0 SPIC2_Bits.SPC0
enum { SPIBR_Addr = 0x2A };
typedef struct
{
uint8_t SPR0 : 1;
uint8_t SPR1 : 1;
uint8_t SPR2 : 1;
uint8_t bit3 : 1;
uint8_t SPPR0 : 1;
uint8_t SPPR1 : 1;
uint8_t SPPR2 : 1;
uint8_t bit7 : 1;
} SPIBR_t;
#define SPIBR HC08_REGISTER(uint8_t,SPIBR_Addr)
#define SPIBR_Bits HC08_REGISTER(SPIBR_t,SPIBR_Addr)
#define SPIBR_SPPR2 SPIBR_Bits.SPPR2
#define SPIBR_SPPR1 SPIBR_Bits.SPPR1
#define SPIBR_SPPR0 SPIBR_Bits.SPPR0
#define SPIBR_SPR2 SPIBR_Bits.SPR2
#define SPIBR_SPR1 SPIBR_Bits.SPR1
#define SPIBR_SPR0 SPIBR_Bits.SPR0
enum { SPIS_Addr = 0x2B };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t MODF : 1;
uint8_t SPTEF : 1;
uint8_t bit6 : 1;
uint8_t SPRF : 1;
} SPIS_t;
#define SPIS HC08_REGISTER(uint8_t,SPIS_Addr)
#define SPIS_Bits HC08_REGISTER(SPIS_t,SPIS_Addr)
#define SPIS_SPRF SPIS_Bits.SPRF
#define SPIS_SPTEF SPIS_Bits.SPTEF
#define SPIS_MODF SPIS_Bits.MODF
enum { SPID_Addr = 0x2D };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SPID_t;
#define SPID HC08_REGISTER(uint8_t,SPID_Addr)
#define SPID_Bits HC08_REGISTER(SPID_t,SPID_Addr)
enum { TPM1SC_Addr = 0x30 };
typedef struct
{
uint8_t PS0 : 1;
uint8_t PS1 : 1;
uint8_t PS2 : 1;
uint8_t CLKSA : 1;
uint8_t CLKSB : 1;
uint8_t CPWMS : 1;
uint8_t TOIE : 1;
uint8_t TOF : 1;
} TPM1SC_t;
#define TPM1SC HC08_REGISTER(uint8_t,TPM1SC_Addr)
#define TPM1SC_Bits HC08_REGISTER(TPM1SC_t,TPM1SC_Addr)
#define TPM1SC_TOF TPM1SC_Bits.TOF
#define TPM1SC_TOIE TPM1SC_Bits.TOIE
#define TPM1SC_CPWMS TPM1SC_Bits.CPWMS
#define TPM1SC_CLKSB TPM1SC_Bits.CLKSB
#define TPM1SC_CLKSA TPM1SC_Bits.CLKSA
#define TPM1SC_PS2 TPM1SC_Bits.PS2
#define TPM1SC_PS1 TPM1SC_Bits.PS1
#define TPM1SC_PS0 TPM1SC_Bits.PS0
enum { TPM1CNTH_Addr = 0x31 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM1CNTH_t;
#define TPM1CNT HC08_REGISTER(uint16_t,TPM1CNTH_Addr)
#define TPM1CNTH HC08_REGISTER(uint8_t,TPM1CNTH_Addr)
#define TPM1CNTH_Bits HC08_REGISTER(TPM1CNTH_t,TPM1CNTH_Addr)
enum { TPM1CNTL_Addr = 0x32 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM1CNTL_t;
#define TPM1CNTL HC08_REGISTER(uint8_t,TPM1CNTL_Addr)
#define TPM1CNTL_Bits HC08_REGISTER(TPM1CNTL_t,TPM1CNTL_Addr)
enum { TPM1MODH_Addr = 0x33 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM1MODH_t;
#define TPM1MOD HC08_REGISTER(uint16_t,TPM1MODH_Addr)
#define TPM1MODH HC08_REGISTER(uint8_t,TPM1MODH_Addr)
#define TPM1MODH_Bits HC08_REGISTER(TPM1MODH_t,TPM1MODH_Addr)
enum { TPM1MODL_Addr = 0x34 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM1MODL_t;
#define TPM1MODL HC08_REGISTER(uint8_t,TPM1MODL_Addr)
#define TPM1MODL_Bits HC08_REGISTER(TPM1MODL_t,TPM1MODL_Addr)
enum { TPM1C0SC_Addr = 0x35 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS0A : 1;
uint8_t ELS0B : 1;
uint8_t MS0A : 1;
uint8_t MS0B : 1;
uint8_t CH0IE : 1;
uint8_t CH0F : 1;
} TPM1C0SC_t;
#define TPM1C0SC HC08_REGISTER(uint8_t,TPM1C0SC_Addr)
#define TPM1C0SC_Bits HC08_REGISTER(TPM1C0SC_t,TPM1C0SC_Addr)
#define TPM1C0SC_CH0F TPM1C0SC_Bits.CH0F
#define TPM1C0SC_CH0IE TPM1C0SC_Bits.CH0IE
#define TPM1C0SC_MS0B TPM1C0SC_Bits.MS0B
#define TPM1C0SC_MS0A TPM1C0SC_Bits.MS0A
#define TPM1C0SC_ELS0B TPM1C0SC_Bits.ELS0B
#define TPM1C0SC_ELS0A TPM1C0SC_Bits.ELS0A
enum { TPM1C0VH_Addr = 0x36 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM1C0VH_t;
#define TPM1C0V HC08_REGISTER(uint16_t,TPM1C0VH_Addr)
#define TPM1C0VH HC08_REGISTER(uint8_t,TPM1C0VH_Addr)
#define TPM1C0VH_Bits HC08_REGISTER(TPM1C0VH_t,TPM1C0VH_Addr)
enum { TPM1C0VL_Addr = 0x37 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM1C0VL_t;
#define TPM1C0VL HC08_REGISTER(uint8_t,TPM1C0VL_Addr)
#define TPM1C0VL_Bits HC08_REGISTER(TPM1C0VL_t,TPM1C0VL_Addr)
enum { TPM1C1SC_Addr = 0x38 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS1A : 1;
uint8_t ELS1B : 1;
uint8_t MS1A : 1;
uint8_t MS1B : 1;
uint8_t CH1IE : 1;
uint8_t CH1F : 1;
} TPM1C1SC_t;
#define TPM1C1SC HC08_REGISTER(uint8_t,TPM1C1SC_Addr)
#define TPM1C1SC_Bits HC08_REGISTER(TPM1C1SC_t,TPM1C1SC_Addr)
#define TPM1C1SC_CH1F TPM1C1SC_Bits.CH1F
#define TPM1C1SC_CH1IE TPM1C1SC_Bits.CH1IE
#define TPM1C1SC_MS1B TPM1C1SC_Bits.MS1B
#define TPM1C1SC_MS1A TPM1C1SC_Bits.MS1A
#define TPM1C1SC_ELS1B TPM1C1SC_Bits.ELS1B
#define TPM1C1SC_ELS1A TPM1C1SC_Bits.ELS1A
enum { TPM1C1VH_Addr = 0x39 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM1C1VH_t;
#define TPM1C1V HC08_REGISTER(uint16_t,TPM1C1VH_Addr)
#define TPM1C1VH HC08_REGISTER(uint8_t,TPM1C1VH_Addr)
#define TPM1C1VH_Bits HC08_REGISTER(TPM1C1VH_t,TPM1C1VH_Addr)
enum { TPM1C1VL_Addr = 0x3A };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM1C1VL_t;
#define TPM1C1VL HC08_REGISTER(uint8_t,TPM1C1VL_Addr)
#define TPM1C1VL_Bits HC08_REGISTER(TPM1C1VL_t,TPM1C1VL_Addr)
enum { TPM1C2SC_Addr = 0x3B };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS2A : 1;
uint8_t ELS2B : 1;
uint8_t MS2A : 1;
uint8_t MS2B : 1;
uint8_t CH2IE : 1;
uint8_t CH2F : 1;
} TPM1C2SC_t;
#define TPM1C2SC HC08_REGISTER(uint8_t,TPM1C2SC_Addr)
#define TPM1C2SC_Bits HC08_REGISTER(TPM1C2SC_t,TPM1C2SC_Addr)
#define TPM1C2SC_CH2F TPM1C2SC_Bits.CH2F
#define TPM1C2SC_CH2IE TPM1C2SC_Bits.CH2IE
#define TPM1C2SC_MS2B TPM1C2SC_Bits.MS2B
#define TPM1C2SC_MS2A TPM1C2SC_Bits.MS2A
#define TPM1C2SC_ELS2B TPM1C2SC_Bits.ELS2B
#define TPM1C2SC_ELS2A TPM1C2SC_Bits.ELS2A
enum { TPM1C2VH_Addr = 0x3C };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM1C2VH_t;
#define TPM1C2V HC08_REGISTER(uint16_t,TPM1C2VH_Addr)
#define TPM1C2VH HC08_REGISTER(uint8_t,TPM1C2VH_Addr)
#define TPM1C2VH_Bits HC08_REGISTER(TPM1C2VH_t,TPM1C2VH_Addr)
enum { TPM1C2VL_Addr = 0x3D };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM1C2VL_t;
#define TPM1C2VL HC08_REGISTER(uint8_t,TPM1C2VL_Addr)
#define TPM1C2VL_Bits HC08_REGISTER(TPM1C2VL_t,TPM1C2VL_Addr)
enum { PTFD_Addr = 0x40 };
typedef struct
{
uint8_t PTFD0 : 1;
uint8_t PTFD1 : 1;
uint8_t PTFD2 : 1;
uint8_t PTFD3 : 1;
uint8_t PTFD4 : 1;
uint8_t PTFD5 : 1;
uint8_t PTFD6 : 1;
uint8_t PTFD7 : 1;
} PTFD_t;
#define PTFD HC08_REGISTER(uint8_t,PTFD_Addr)
#define PTFD_Bits HC08_REGISTER(PTFD_t,PTFD_Addr)
#define PTFD_PTFD7 PTFD_Bits.PTFD7
#define PTFD_PTFD6 PTFD_Bits.PTFD6
#define PTFD_PTFD5 PTFD_Bits.PTFD5
#define PTFD_PTFD4 PTFD_Bits.PTFD4
#define PTFD_PTFD3 PTFD_Bits.PTFD3
#define PTFD_PTFD2 PTFD_Bits.PTFD2
#define PTFD_PTFD1 PTFD_Bits.PTFD1
#define PTFD_PTFD0 PTFD_Bits.PTFD0
enum { PTFPE_Addr = 0x41 };
typedef struct
{
uint8_t PTFPE0 : 1;
uint8_t PTFPE1 : 1;
uint8_t PTFPE2 : 1;
uint8_t PTFPE3 : 1;
uint8_t PTFPE4 : 1;
uint8_t PTFPE5 : 1;
uint8_t PTFPE6 : 1;
uint8_t PTFPE7 : 1;
} PTFPE_t;
#define PTFPE HC08_REGISTER(uint8_t,PTFPE_Addr)
#define PTFPE_Bits HC08_REGISTER(PTFPE_t,PTFPE_Addr)
#define PTFPE_PTFPE7 PTFPE_Bits.PTFPE7
#define PTFPE_PTFPE6 PTFPE_Bits.PTFPE6
#define PTFPE_PTFPE5 PTFPE_Bits.PTFPE5
#define PTFPE_PTFPE4 PTFPE_Bits.PTFPE4
#define PTFPE_PTFPE3 PTFPE_Bits.PTFPE3
#define PTFPE_PTFPE2 PTFPE_Bits.PTFPE2
#define PTFPE_PTFPE1 PTFPE_Bits.PTFPE1
#define PTFPE_PTFPE0 PTFPE_Bits.PTFPE0
enum { PTFSE_Addr = 0x42 };
typedef struct
{
uint8_t PTFSE0 : 1;
uint8_t PTFSE1 : 1;
uint8_t PTFSE2 : 1;
uint8_t PTFSE3 : 1;
uint8_t PTFSE4 : 1;
uint8_t PTFSE5 : 1;
uint8_t PTFSE6 : 1;
uint8_t PTFSE7 : 1;
} PTFSE_t;
#define PTFSE HC08_REGISTER(uint8_t,PTFSE_Addr)
#define PTFSE_Bits HC08_REGISTER(PTFSE_t,PTFSE_Addr)
#define PTFSE_PTFSE7 PTFSE_Bits.PTFSE7
#define PTFSE_PTFSE6 PTFSE_Bits.PTFSE6
#define PTFSE_PTFSE5 PTFSE_Bits.PTFSE5
#define PTFSE_PTFSE4 PTFSE_Bits.PTFSE4
#define PTFSE_PTFSE3 PTFSE_Bits.PTFSE3
#define PTFSE_PTFSE2 PTFSE_Bits.PTFSE2
#define PTFSE_PTFSE1 PTFSE_Bits.PTFSE1
#define PTFSE_PTFSE0 PTFSE_Bits.PTFSE0
enum { PTFDD_Addr = 0x43 };
typedef struct
{
uint8_t PTFDD0 : 1;
uint8_t PTFDD1 : 1;
uint8_t PTFDD2 : 1;
uint8_t PTFDD3 : 1;
uint8_t PTFDD4 : 1;
uint8_t PTFDD5 : 1;
uint8_t PTFDD6 : 1;
uint8_t PTFDD7 : 1;
} PTFDD_t;
#define PTFDD HC08_REGISTER(uint8_t,PTFDD_Addr)
#define PTFDD_Bits HC08_REGISTER(PTFDD_t,PTFDD_Addr)
#define PTFDD_PTFDD7 PTFDD_Bits.PTFDD7
#define PTFDD_PTFDD6 PTFDD_Bits.PTFDD6
#define PTFDD_PTFDD5 PTFDD_Bits.PTFDD5
#define PTFDD_PTFDD4 PTFDD_Bits.PTFDD4
#define PTFDD_PTFDD3 PTFDD_Bits.PTFDD3
#define PTFDD_PTFDD2 PTFDD_Bits.PTFDD2
#define PTFDD_PTFDD1 PTFDD_Bits.PTFDD1
#define PTFDD_PTFDD0 PTFDD_Bits.PTFDD0
enum { PTGD_Addr = 0x44 };
typedef struct
{
uint8_t PTGD0 : 1;
uint8_t PTGD1 : 1;
uint8_t PTGD2 : 1;
uint8_t PTGD3 : 1;
uint8_t PTGD4 : 1;
uint8_t PTGD5 : 1;
uint8_t PTGD6 : 1;
uint8_t PTGD7 : 1;
} PTGD_t;
#define PTGD HC08_REGISTER(uint8_t,PTGD_Addr)
#define PTGD_Bits HC08_REGISTER(PTGD_t,PTGD_Addr)
#define PTGD_PTGD7 PTGD_Bits.PTGD7
#define PTGD_PTGD6 PTGD_Bits.PTGD6
#define PTGD_PTGD5 PTGD_Bits.PTGD5
#define PTGD_PTGD4 PTGD_Bits.PTGD4
#define PTGD_PTGD3 PTGD_Bits.PTGD3
#define PTGD_PTGD2 PTGD_Bits.PTGD2
#define PTGD_PTGD1 PTGD_Bits.PTGD1
#define PTGD_PTGD0 PTGD_Bits.PTGD0
enum { PTGPE_Addr = 0x45 };
typedef struct
{
uint8_t PTGPE0 : 1;
uint8_t PTGPE1 : 1;
uint8_t PTGPE2 : 1;
uint8_t PTGPE3 : 1;
uint8_t PTGPE4 : 1;
uint8_t PTGPE5 : 1;
uint8_t PTGPE6 : 1;
uint8_t PTGPE7 : 1;
} PTGPE_t;
#define PTGPE HC08_REGISTER(uint8_t,PTGPE_Addr)
#define PTGPE_Bits HC08_REGISTER(PTGPE_t,PTGPE_Addr)
#define PTGPE_PTGPE7 PTGPE_Bits.PTGPE7
#define PTGPE_PTGPE6 PTGPE_Bits.PTGPE6
#define PTGPE_PTGPE5 PTGPE_Bits.PTGPE5
#define PTGPE_PTGPE4 PTGPE_Bits.PTGPE4
#define PTGPE_PTGPE3 PTGPE_Bits.PTGPE3
#define PTGPE_PTGPE2 PTGPE_Bits.PTGPE2
#define PTGPE_PTGPE1 PTGPE_Bits.PTGPE1
#define PTGPE_PTGPE0 PTGPE_Bits.PTGPE0
enum { PTGSE_Addr = 0x46 };
typedef struct
{
uint8_t PTGSE0 : 1;
uint8_t PTGSE1 : 1;
uint8_t PTGSE2 : 1;
uint8_t PTGSE3 : 1;
uint8_t PTGSE4 : 1;
uint8_t PTGSE5 : 1;
uint8_t PTGSE6 : 1;
uint8_t PTGSE7 : 1;
} PTGSE_t;
#define PTGSE HC08_REGISTER(uint8_t,PTGSE_Addr)
#define PTGSE_Bits HC08_REGISTER(PTGSE_t,PTGSE_Addr)
#define PTGSE_PTGSE7 PTGSE_Bits.PTGSE7
#define PTGSE_PTGSE6 PTGSE_Bits.PTGSE6
#define PTGSE_PTGSE5 PTGSE_Bits.PTGSE5
#define PTGSE_PTGSE4 PTGSE_Bits.PTGSE4
#define PTGSE_PTGSE3 PTGSE_Bits.PTGSE3
#define PTGSE_PTGSE2 PTGSE_Bits.PTGSE2
#define PTGSE_PTGSE1 PTGSE_Bits.PTGSE1
#define PTGSE_PTGSE0 PTGSE_Bits.PTGSE0
enum { PTGDD_Addr = 0x47 };
typedef struct
{
uint8_t PTGDD0 : 1;
uint8_t PTGDD1 : 1;
uint8_t PTGDD2 : 1;
uint8_t PTGDD3 : 1;
uint8_t PTGDD4 : 1;
uint8_t PTGDD5 : 1;
uint8_t PTGDD6 : 1;
uint8_t PTGDD7 : 1;
} PTGDD_t;
#define PTGDD HC08_REGISTER(uint8_t,PTGDD_Addr)
#define PTGDD_Bits HC08_REGISTER(PTGDD_t,PTGDD_Addr)
#define PTGDD_PTGDD7 PTGDD_Bits.PTGDD7
#define PTGDD_PTGDD6 PTGDD_Bits.PTGDD6
#define PTGDD_PTGDD5 PTGDD_Bits.PTGDD5
#define PTGDD_PTGDD4 PTGDD_Bits.PTGDD4
#define PTGDD_PTGDD3 PTGDD_Bits.PTGDD3
#define PTGDD_PTGDD2 PTGDD_Bits.PTGDD2
#define PTGDD_PTGDD1 PTGDD_Bits.PTGDD1
#define PTGDD_PTGDD0 PTGDD_Bits.PTGDD0
enum { ICGC1_Addr = 0x48 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t OSCSTEN : 1;
uint8_t CLKS : 2;
uint8_t REFS : 1;
uint8_t RANGE : 1;
uint8_t bit7 : 1;
} ICGC1_t;
#define ICGC1 HC08_REGISTER(uint8_t,ICGC1_Addr)
#define ICGC1_Bits HC08_REGISTER(ICGC1_t,ICGC1_Addr)
#define ICGC1_RANGE ICGC1_Bits.RANGE
#define ICGC1_REFS ICGC1_Bits.REFS
#define ICGC1_CLKS ICGC1_Bits.CLKS
#define ICGC1_OSCSTEN ICGC1_Bits.OSCSTEN
enum { ICGC2_Addr = 0x49 };
typedef struct
{
uint8_t RFD : 3;
uint8_t LOCRE : 1;
uint8_t MFD : 3;
uint8_t LOLRE : 1;
} ICGC2_t;
#define ICGC2 HC08_REGISTER(uint8_t,ICGC2_Addr)
#define ICGC2_Bits HC08_REGISTER(ICGC2_t,ICGC2_Addr)
#define ICGC2_LOLRE ICGC2_Bits.LOLRE
#define ICGC2_MFD ICGC2_Bits.MFD
#define ICGC2_LOCRE ICGC2_Bits.LOCRE
#define ICGC2_RFD ICGC2_Bits.RFD
enum { ICGS1_Addr = 0x4A };
typedef struct
{
uint8_t ICGIF : 1;
uint8_t ERCS : 1;
uint8_t LOCS : 1;
uint8_t LOCK : 1;
uint8_t LOLS : 1;
uint8_t REFST : 1;
uint8_t CLKST : 2;
} ICGS1_t;
#define ICGS1 HC08_REGISTER(uint8_t,ICGS1_Addr)
#define ICGS1_Bits HC08_REGISTER(ICGS1_t,ICGS1_Addr)
#define ICGS1_CLKST ICGS1_Bits.CLKST
#define ICGS1_REFST ICGS1_Bits.REFST
#define ICGS1_LOLS ICGS1_Bits.LOLS
#define ICGS1_LOCK ICGS1_Bits.LOCK
#define ICGS1_LOCS ICGS1_Bits.LOCS
#define ICGS1_ERCS ICGS1_Bits.ERCS
#define ICGS1_ICGIF ICGS1_Bits.ICGIF
enum { ICGS2_Addr = 0x4B };
typedef struct
{
uint8_t DCOS : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} ICGS2_t;
#define ICGS2 HC08_REGISTER(uint8_t,ICGS2_Addr)
#define ICGS2_Bits HC08_REGISTER(ICGS2_t,ICGS2_Addr)
#define ICGS2_DCOS ICGS2_Bits.DCOS
enum { ICGFLTU_Addr = 0x4C };
typedef struct
{
uint8_t FLT : 4;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} ICGFLTU_t;
#define ICGFLTU HC08_REGISTER(uint8_t,ICGFLTU_Addr)
#define ICGFLTU_Bits HC08_REGISTER(ICGFLTU_t,ICGFLTU_Addr)
#define ICGFLTU_FLT ICGFLTU_Bits.FLT
enum { ICGFLTL_Addr = 0x4D };
typedef struct
{
uint8_t FLT : 8;
} ICGFLTL_t;
#define ICGFLTL HC08_REGISTER(uint8_t,ICGFLTL_Addr)
#define ICGFLTL_Bits HC08_REGISTER(ICGFLTL_t,ICGFLTL_Addr)
#define ICGFLTL_FLT ICGFLTL_Bits.FLT
enum { ICGTRM_Addr = 0x4E };
typedef struct
{
uint8_t TRIM : 8;
} ICGTRM_t;
#define ICGTRM HC08_REGISTER(uint8_t,ICGTRM_Addr)
#define ICGTRM_Bits HC08_REGISTER(ICGTRM_t,ICGTRM_Addr)
#define ICGTRM_TRIM ICGTRM_Bits.TRIM
enum { ATDC_Addr = 0x50 };
typedef struct
{
uint8_t PRS : 4;
uint8_t SGN : 1;
uint8_t RES8 : 1;
uint8_t DJM : 1;
uint8_t ATDPU : 1;
} ATDC_t;
#define ATDC HC08_REGISTER(uint8_t,ATDC_Addr)
#define ATDC_Bits HC08_REGISTER(ATDC_t,ATDC_Addr)
#define ATDC_ATDPU ATDC_Bits.ATDPU
#define ATDC_DJM ATDC_Bits.DJM
#define ATDC_RES8 ATDC_Bits.RES8
#define ATDC_SGN ATDC_Bits.SGN
#define ATDC_PRS ATDC_Bits.PRS
enum { ATDSC_Addr = 0x51 };
typedef struct
{
uint8_t ATDCH : 5;
uint8_t ATDCO : 1;
uint8_t ATDIE : 1;
uint8_t CCF : 1;
} ATDSC_t;
#define ATDSC HC08_REGISTER(uint8_t,ATDSC_Addr)
#define ATDSC_Bits HC08_REGISTER(ATDSC_t,ATDSC_Addr)
#define ATDSC_CCF ATDSC_Bits.CCF
#define ATDSC_ATDIE ATDSC_Bits.ATDIE
#define ATDSC_ATDCO ATDSC_Bits.ATDCO
#define ATDSC_ATDCH ATDSC_Bits.ATDCH
enum { ATDRH_Addr = 0x52 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} ATDRH_t;
#define ATDR HC08_REGISTER(uint16_t,ATDRH_Addr)
#define ATDRH HC08_REGISTER(uint8_t,ATDRH_Addr)
#define ATDRH_Bits HC08_REGISTER(ATDRH_t,ATDRH_Addr)
enum { ATDRL_Addr = 0x53 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} ATDRL_t;
#define ATDRL HC08_REGISTER(uint8_t,ATDRL_Addr)
#define ATDRL_Bits HC08_REGISTER(ATDRL_t,ATDRL_Addr)
enum { ATDPE_Addr = 0x54 };
typedef struct
{
uint8_t ATDPE0 : 1;
uint8_t ATDPE1 : 1;
uint8_t ATDPE2 : 1;
uint8_t ATDPE3 : 1;
uint8_t ATDPE4 : 1;
uint8_t ATDPE5 : 1;
uint8_t ATDPE6 : 1;
uint8_t ATDPE7 : 1;
} ATDPE_t;
#define ATDPE HC08_REGISTER(uint8_t,ATDPE_Addr)
#define ATDPE_Bits HC08_REGISTER(ATDPE_t,ATDPE_Addr)
#define ATDPE_ATDPE7 ATDPE_Bits.ATDPE7
#define ATDPE_ATDPE6 ATDPE_Bits.ATDPE6
#define ATDPE_ATDPE5 ATDPE_Bits.ATDPE5
#define ATDPE_ATDPE4 ATDPE_Bits.ATDPE4
#define ATDPE_ATDPE3 ATDPE_Bits.ATDPE3
#define ATDPE_ATDPE2 ATDPE_Bits.ATDPE2
#define ATDPE_ATDPE1 ATDPE_Bits.ATDPE1
#define ATDPE_ATDPE0 ATDPE_Bits.ATDPE0
enum { IICA_Addr = 0x58 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t ADDR : 7;
} IICA_t;
#define IICA HC08_REGISTER(uint8_t,IICA_Addr)
#define IICA_Bits HC08_REGISTER(IICA_t,IICA_Addr)
#define IICA_ADDR IICA_Bits.ADDR
enum { IICF_Addr = 0x59 };
typedef struct
{
uint8_t ICR : 6;
uint8_t MULT : 2;
} IICF_t;
#define IICF HC08_REGISTER(uint8_t,IICF_Addr)
#define IICF_Bits HC08_REGISTER(IICF_t,IICF_Addr)
#define IICF_MULT IICF_Bits.MULT
#define IICF_ICR IICF_Bits.ICR
enum { IICC_Addr = 0x5A };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t RSTA : 1;
uint8_t TXAK : 1;
uint8_t TX : 1;
uint8_t MST : 1;
uint8_t IICIE : 1;
uint8_t IICEN : 1;
} IICC_t;
#define IICC HC08_REGISTER(uint8_t,IICC_Addr)
#define IICC_Bits HC08_REGISTER(IICC_t,IICC_Addr)
#define IICC_IICEN IICC_Bits.IICEN
#define IICC_IICIE IICC_Bits.IICIE
#define IICC_MST IICC_Bits.MST
#define IICC_TX IICC_Bits.TX
#define IICC_TXAK IICC_Bits.TXAK
#define IICC_RSTA IICC_Bits.RSTA
enum { IICS_Addr = 0x5B };
typedef struct
{
uint8_t RXAK : 1;
uint8_t IICIF : 1;
uint8_t SRW : 1;
uint8_t bit3 : 1;
uint8_t ARBL : 1;
uint8_t BUSY : 1;
uint8_t IAAS : 1;
uint8_t TCF : 1;
} IICS_t;
#define IICS HC08_REGISTER(uint8_t,IICS_Addr)
#define IICS_Bits HC08_REGISTER(IICS_t,IICS_Addr)
#define IICS_TCF IICS_Bits.TCF
#define IICS_IAAS IICS_Bits.IAAS
#define IICS_BUSY IICS_Bits.BUSY
#define IICS_ARBL IICS_Bits.ARBL
#define IICS_SRW IICS_Bits.SRW
#define IICS_IICIF IICS_Bits.IICIF
#define IICS_RXAK IICS_Bits.RXAK
enum { IICD_Addr = 0x5C };
typedef struct
{
uint8_t DATA : 8;
} IICD_t;
#define IICD HC08_REGISTER(uint8_t,IICD_Addr)
#define IICD_Bits HC08_REGISTER(IICD_t,IICD_Addr)
#define IICD_DATA IICD_Bits.DATA
enum { TPM2SC_Addr = 0x60 };
typedef struct
{
uint8_t PS0 : 1;
uint8_t PS1 : 1;
uint8_t PS2 : 1;
uint8_t CLKSA : 1;
uint8_t CLKSB : 1;
uint8_t CPWMS : 1;
uint8_t TOIE : 1;
uint8_t TOF : 1;
} TPM2SC_t;
#define TPM2SC HC08_REGISTER(uint8_t,TPM2SC_Addr)
#define TPM2SC_Bits HC08_REGISTER(TPM2SC_t,TPM2SC_Addr)
#define TPM2SC_TOF TPM2SC_Bits.TOF
#define TPM2SC_TOIE TPM2SC_Bits.TOIE
#define TPM2SC_CPWMS TPM2SC_Bits.CPWMS
#define TPM2SC_CLKSB TPM2SC_Bits.CLKSB
#define TPM2SC_CLKSA TPM2SC_Bits.CLKSA
#define TPM2SC_PS2 TPM2SC_Bits.PS2
#define TPM2SC_PS1 TPM2SC_Bits.PS1
#define TPM2SC_PS0 TPM2SC_Bits.PS0
enum { TPM2CNTH_Addr = 0x61 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2CNTH_t;
#define TPM2CNT HC08_REGISTER(uint16_t,TPM2CNTH_Addr)
#define TPM2CNTH HC08_REGISTER(uint8_t,TPM2CNTH_Addr)
#define TPM2CNTH_Bits HC08_REGISTER(TPM2CNTH_t,TPM2CNTH_Addr)
enum { TPM2CNTL_Addr = 0x62 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2CNTL_t;
#define TPM2CNTL HC08_REGISTER(uint8_t,TPM2CNTL_Addr)
#define TPM2CNTL_Bits HC08_REGISTER(TPM2CNTL_t,TPM2CNTL_Addr)
enum { TPM2MODH_Addr = 0x63 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2MODH_t;
#define TPM2MOD HC08_REGISTER(uint16_t,TPM2MODH_Addr)
#define TPM2MODH HC08_REGISTER(uint8_t,TPM2MODH_Addr)
#define TPM2MODH_Bits HC08_REGISTER(TPM2MODH_t,TPM2MODH_Addr)
enum { TPM2MODL_Addr = 0x64 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2MODL_t;
#define TPM2MODL HC08_REGISTER(uint8_t,TPM2MODL_Addr)
#define TPM2MODL_Bits HC08_REGISTER(TPM2MODL_t,TPM2MODL_Addr)
enum { TPM2C0SC_Addr = 0x65 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS0A : 1;
uint8_t ELS0B : 1;
uint8_t MS0A : 1;
uint8_t MS0B : 1;
uint8_t CH0IE : 1;
uint8_t CH0F : 1;
} TPM2C0SC_t;
#define TPM2C0SC HC08_REGISTER(uint8_t,TPM2C0SC_Addr)
#define TPM2C0SC_Bits HC08_REGISTER(TPM2C0SC_t,TPM2C0SC_Addr)
#define TPM2C0SC_CH0F TPM2C0SC_Bits.CH0F
#define TPM2C0SC_CH0IE TPM2C0SC_Bits.CH0IE
#define TPM2C0SC_MS0B TPM2C0SC_Bits.MS0B
#define TPM2C0SC_MS0A TPM2C0SC_Bits.MS0A
#define TPM2C0SC_ELS0B TPM2C0SC_Bits.ELS0B
#define TPM2C0SC_ELS0A TPM2C0SC_Bits.ELS0A
enum { TPM2C0VH_Addr = 0x66 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2C0VH_t;
#define TPM2C0V HC08_REGISTER(uint16_t,TPM2C0VH_Addr)
#define TPM2C0VH HC08_REGISTER(uint8_t,TPM2C0VH_Addr)
#define TPM2C0VH_Bits HC08_REGISTER(TPM2C0VH_t,TPM2C0VH_Addr)
enum { TPM2C0VL_Addr = 0x67 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2C0VL_t;
#define TPM2C0VL HC08_REGISTER(uint8_t,TPM2C0VL_Addr)
#define TPM2C0VL_Bits HC08_REGISTER(TPM2C0VL_t,TPM2C0VL_Addr)
enum { TPM2C1SC_Addr = 0x68 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS1A : 1;
uint8_t ELS1B : 1;
uint8_t MS1A : 1;
uint8_t MS1B : 1;
uint8_t CH1IE : 1;
uint8_t CH1F : 1;
} TPM2C1SC_t;
#define TPM2C1SC HC08_REGISTER(uint8_t,TPM2C1SC_Addr)
#define TPM2C1SC_Bits HC08_REGISTER(TPM2C1SC_t,TPM2C1SC_Addr)
#define TPM2C1SC_CH1F TPM2C1SC_Bits.CH1F
#define TPM2C1SC_CH1IE TPM2C1SC_Bits.CH1IE
#define TPM2C1SC_MS1B TPM2C1SC_Bits.MS1B
#define TPM2C1SC_MS1A TPM2C1SC_Bits.MS1A
#define TPM2C1SC_ELS1B TPM2C1SC_Bits.ELS1B
#define TPM2C1SC_ELS1A TPM2C1SC_Bits.ELS1A
enum { TPM2C1VH_Addr = 0x69 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2C1VH_t;
#define TPM2C1V HC08_REGISTER(uint16_t,TPM2C1VH_Addr)
#define TPM2C1VH HC08_REGISTER(uint8_t,TPM2C1VH_Addr)
#define TPM2C1VH_Bits HC08_REGISTER(TPM2C1VH_t,TPM2C1VH_Addr)
enum { TPM2C1VL_Addr = 0x6A };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2C1VL_t;
#define TPM2C1VL HC08_REGISTER(uint8_t,TPM2C1VL_Addr)
#define TPM2C1VL_Bits HC08_REGISTER(TPM2C1VL_t,TPM2C1VL_Addr)
enum { TPM2C2SC_Addr = 0x6B };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS2A : 1;
uint8_t ELS2B : 1;
uint8_t MS2A : 1;
uint8_t MS2B : 1;
uint8_t CH2IE : 1;
uint8_t CH2F : 1;
} TPM2C2SC_t;
#define TPM2C2SC HC08_REGISTER(uint8_t,TPM2C2SC_Addr)
#define TPM2C2SC_Bits HC08_REGISTER(TPM2C2SC_t,TPM2C2SC_Addr)
#define TPM2C2SC_CH2F TPM2C2SC_Bits.CH2F
#define TPM2C2SC_CH2IE TPM2C2SC_Bits.CH2IE
#define TPM2C2SC_MS2B TPM2C2SC_Bits.MS2B
#define TPM2C2SC_MS2A TPM2C2SC_Bits.MS2A
#define TPM2C2SC_ELS2B TPM2C2SC_Bits.ELS2B
#define TPM2C2SC_ELS2A TPM2C2SC_Bits.ELS2A
enum { TPM2C2VH_Addr = 0x6C };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2C2VH_t;
#define TPM2C2V HC08_REGISTER(uint16_t,TPM2C2VH_Addr)
#define TPM2C2VH HC08_REGISTER(uint8_t,TPM2C2VH_Addr)
#define TPM2C2VH_Bits HC08_REGISTER(TPM2C2VH_t,TPM2C2VH_Addr)
enum { TPM2C2VL_Addr = 0x6D };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2C2VL_t;
#define TPM2C2VL HC08_REGISTER(uint8_t,TPM2C2VL_Addr)
#define TPM2C2VL_Bits HC08_REGISTER(TPM2C2VL_t,TPM2C2VL_Addr)
enum { TPM2C3SC_Addr = 0x6E };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS3A : 1;
uint8_t ELS3B : 1;
uint8_t MS3A : 1;
uint8_t MS3B : 1;
uint8_t CH3IE : 1;
uint8_t CH3F : 1;
} TPM2C3SC_t;
#define TPM2C3SC HC08_REGISTER(uint8_t,TPM2C3SC_Addr)
#define TPM2C3SC_Bits HC08_REGISTER(TPM2C3SC_t,TPM2C3SC_Addr)
#define TPM2C3SC_CH3F TPM2C3SC_Bits.CH3F
#define TPM2C3SC_CH3IE TPM2C3SC_Bits.CH3IE
#define TPM2C3SC_MS3B TPM2C3SC_Bits.MS3B
#define TPM2C3SC_MS3A TPM2C3SC_Bits.MS3A
#define TPM2C3SC_ELS3B TPM2C3SC_Bits.ELS3B
#define TPM2C3SC_ELS3A TPM2C3SC_Bits.ELS3A
enum { TPM2C3VH_Addr = 0x6F };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2C3VH_t;
#define TPM2C3V HC08_REGISTER(uint16_t,TPM2C3VH_Addr)
#define TPM2C3VH HC08_REGISTER(uint8_t,TPM2C3VH_Addr)
#define TPM2C3VH_Bits HC08_REGISTER(TPM2C3VH_t,TPM2C3VH_Addr)
enum { TPM2C3VL_Addr = 0x70 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2C3VL_t;
#define TPM2C3VL HC08_REGISTER(uint8_t,TPM2C3VL_Addr)
#define TPM2C3VL_Bits HC08_REGISTER(TPM2C3VL_t,TPM2C3VL_Addr)
enum { TPM2C4SC_Addr = 0x71 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t ELS4A : 1;
uint8_t ELS4B : 1;
uint8_t MS4A : 1;
uint8_t MS4B : 1;
uint8_t CH4IE : 1;
uint8_t CH4F : 1;
} TPM2C4SC_t;
#define TPM2C4SC HC08_REGISTER(uint8_t,TPM2C4SC_Addr)
#define TPM2C4SC_Bits HC08_REGISTER(TPM2C4SC_t,TPM2C4SC_Addr)
#define TPM2C4SC_CH4F TPM2C4SC_Bits.CH4F
#define TPM2C4SC_CH4IE TPM2C4SC_Bits.CH4IE
#define TPM2C4SC_MS4B TPM2C4SC_Bits.MS4B
#define TPM2C4SC_MS4A TPM2C4SC_Bits.MS4A
#define TPM2C4SC_ELS4B TPM2C4SC_Bits.ELS4B
#define TPM2C4SC_ELS4A TPM2C4SC_Bits.ELS4A
enum { TPM2C4VH_Addr = 0x72 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} TPM2C4VH_t;
#define TPM2C4V HC08_REGISTER(uint16_t,TPM2C4VH_Addr)
#define TPM2C4VH HC08_REGISTER(uint8_t,TPM2C4VH_Addr)
#define TPM2C4VH_Bits HC08_REGISTER(TPM2C4VH_t,TPM2C4VH_Addr)
enum { TPM2C4VL_Addr = 0x73 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} TPM2C4VL_t;
#define TPM2C4VL HC08_REGISTER(uint8_t,TPM2C4VL_Addr)
#define TPM2C4VL_Bits HC08_REGISTER(TPM2C4VL_t,TPM2C4VL_Addr)
enum { SRS_Addr = 0x1800 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t LVD : 1;
uint8_t ICG : 1;
uint8_t bit3 : 1;
uint8_t ILOP : 1;
uint8_t COP : 1;
uint8_t PIN : 1;
uint8_t POR : 1;
} SRS_t;
#define SRS HC08_REGISTER(uint8_t,SRS_Addr)
#define SRS_Bits HC08_REGISTER(SRS_t,SRS_Addr)
#define SRS_POR SRS_Bits.POR
#define SRS_PIN SRS_Bits.PIN
#define SRS_COP SRS_Bits.COP
#define SRS_ILOP SRS_Bits.ILOP
#define SRS_ICG SRS_Bits.ICG
#define SRS_LVD SRS_Bits.LVD
enum { SBDFR_Addr = 0x1801 };
typedef struct
{
uint8_t BDFR : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} SBDFR_t;
#define SBDFR HC08_REGISTER(uint8_t,SBDFR_Addr)
#define SBDFR_Bits HC08_REGISTER(SBDFR_t,SBDFR_Addr)
#define SBDFR_BDFR SBDFR_Bits.BDFR
enum { SOPT_Addr = 0x1802 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t BKGDPE : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t STOPE : 1;
uint8_t COPT : 1;
uint8_t COPE : 1;
} SOPT_t;
#define SOPT HC08_REGISTER(uint8_t,SOPT_Addr)
#define SOPT_Bits HC08_REGISTER(SOPT_t,SOPT_Addr)
#define SOPT_COPE SOPT_Bits.COPE
#define SOPT_COPT SOPT_Bits.COPT
#define SOPT_STOPE SOPT_Bits.STOPE
#define SOPT_BKGDPE SOPT_Bits.BKGDPE
enum { SDIDH_Addr = 0x1806 };
typedef struct
{
uint8_t ID8 : 1;
uint8_t ID9 : 1;
uint8_t ID10 : 1;
uint8_t ID11 : 1;
uint8_t REV0 : 1;
uint8_t REV1 : 1;
uint8_t REV2 : 1;
uint8_t REV3 : 1;
} SDIDH_t;
#define SDID HC08_REGISTER(uint16_t,SDIDH_Addr)
#define SDIDH HC08_REGISTER(uint8_t,SDIDH_Addr)
#define SDIDH_Bits HC08_REGISTER(SDIDH_t,SDIDH_Addr)
#define SDIDH_REV3 SDIDH_Bits.REV3
#define SDIDH_REV2 SDIDH_Bits.REV2
#define SDIDH_REV1 SDIDH_Bits.REV1
#define SDIDH_REV0 SDIDH_Bits.REV0
#define SDIDH_ID11 SDIDH_Bits.ID11
#define SDIDH_ID10 SDIDH_Bits.ID10
#define SDIDH_ID9 SDIDH_Bits.ID9
#define SDIDH_ID8 SDIDH_Bits.ID8
enum { SDIDL_Addr = 0x1807 };
typedef struct
{
uint8_t ID0 : 1;
uint8_t ID1 : 1;
uint8_t ID2 : 1;
uint8_t ID3 : 1;
uint8_t ID4 : 1;
uint8_t ID5 : 1;
uint8_t ID6 : 1;
uint8_t ID7 : 1;
} SDIDL_t;
#define SDIDL HC08_REGISTER(uint8_t,SDIDL_Addr)
#define SDIDL_Bits HC08_REGISTER(SDIDL_t,SDIDL_Addr)
#define SDIDL_ID7 SDIDL_Bits.ID7
#define SDIDL_ID6 SDIDL_Bits.ID6
#define SDIDL_ID5 SDIDL_Bits.ID5
#define SDIDL_ID4 SDIDL_Bits.ID4
#define SDIDL_ID3 SDIDL_Bits.ID3
#define SDIDL_ID2 SDIDL_Bits.ID2
#define SDIDL_ID1 SDIDL_Bits.ID1
#define SDIDL_ID0 SDIDL_Bits.ID0
enum { SRTISC_Addr = 0x1808 };
typedef struct
{
uint8_t RTIS0 : 1;
uint8_t RTIS1 : 1;
uint8_t RTIS2 : 1;
uint8_t bit3 : 1;
uint8_t RTIE : 1;
uint8_t RTICLKS : 1;
uint8_t RTIACK : 1;
uint8_t RTIF : 1;
} SRTISC_t;
#define SRTISC HC08_REGISTER(uint8_t,SRTISC_Addr)
#define SRTISC_Bits HC08_REGISTER(SRTISC_t,SRTISC_Addr)
#define SRTISC_RTIF SRTISC_Bits.RTIF
#define SRTISC_RTIACK SRTISC_Bits.RTIACK
#define SRTISC_RTICLKS SRTISC_Bits.RTICLKS
#define SRTISC_RTIE SRTISC_Bits.RTIE
#define SRTISC_RTIS2 SRTISC_Bits.RTIS2
#define SRTISC_RTIS1 SRTISC_Bits.RTIS1
#define SRTISC_RTIS0 SRTISC_Bits.RTIS0
enum { SPMSC1_Addr = 0x1809 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t LVDE : 1;
uint8_t LVDSE : 1;
uint8_t LVDRE : 1;
uint8_t LVDIE : 1;
uint8_t LVDACK : 1;
uint8_t LVDF : 1;
} SPMSC1_t;
#define SPMSC1 HC08_REGISTER(uint8_t,SPMSC1_Addr)
#define SPMSC1_Bits HC08_REGISTER(SPMSC1_t,SPMSC1_Addr)
#define SPMSC1_LVDF SPMSC1_Bits.LVDF
#define SPMSC1_LVDACK SPMSC1_Bits.LVDACK
#define SPMSC1_LVDIE SPMSC1_Bits.LVDIE
#define SPMSC1_LVDRE SPMSC1_Bits.LVDRE
#define SPMSC1_LVDSE SPMSC1_Bits.LVDSE
#define SPMSC1_LVDE SPMSC1_Bits.LVDE
enum { SPMSC2_Addr = 0x180A };
typedef struct
{
uint8_t PPDC : 1;
uint8_t PDC : 1;
uint8_t PPDACK : 1;
uint8_t PPDF : 1;
uint8_t LVWV : 1;
uint8_t LVDV : 1;
uint8_t LVWACK : 1;
uint8_t LVWF : 1;
} SPMSC2_t;
#define SPMSC2 HC08_REGISTER(uint8_t,SPMSC2_Addr)
#define SPMSC2_Bits HC08_REGISTER(SPMSC2_t,SPMSC2_Addr)
#define SPMSC2_LVWF SPMSC2_Bits.LVWF
#define SPMSC2_LVWACK SPMSC2_Bits.LVWACK
#define SPMSC2_LVDV SPMSC2_Bits.LVDV
#define SPMSC2_LVWV SPMSC2_Bits.LVWV
#define SPMSC2_PPDF SPMSC2_Bits.PPDF
#define SPMSC2_PPDACK SPMSC2_Bits.PPDACK
#define SPMSC2_PDC SPMSC2_Bits.PDC
#define SPMSC2_PPDC SPMSC2_Bits.PPDC
enum { DBGCAH_Addr = 0x1810 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} DBGCAH_t;
#define DBGCA HC08_REGISTER(uint16_t,DBGCAH_Addr)
#define DBGCAH HC08_REGISTER(uint8_t,DBGCAH_Addr)
#define DBGCAH_Bits HC08_REGISTER(DBGCAH_t,DBGCAH_Addr)
enum { DBGCAL_Addr = 0x1811 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} DBGCAL_t;
#define DBGCAL HC08_REGISTER(uint8_t,DBGCAL_Addr)
#define DBGCAL_Bits HC08_REGISTER(DBGCAL_t,DBGCAL_Addr)
enum { DBGCBH_Addr = 0x1812 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} DBGCBH_t;
#define DBGCB HC08_REGISTER(uint16_t,DBGCBH_Addr)
#define DBGCBH HC08_REGISTER(uint8_t,DBGCBH_Addr)
#define DBGCBH_Bits HC08_REGISTER(DBGCBH_t,DBGCBH_Addr)
enum { DBGCBL_Addr = 0x1813 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} DBGCBL_t;
#define DBGCBL HC08_REGISTER(uint8_t,DBGCBL_Addr)
#define DBGCBL_Bits HC08_REGISTER(DBGCBL_t,DBGCBL_Addr)
enum { DBGFH_Addr = 0x1814 };
typedef struct
{
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} DBGFH_t;
#define DBGF HC08_REGISTER(uint16_t,DBGFH_Addr)
#define DBGFH HC08_REGISTER(uint8_t,DBGFH_Addr)
#define DBGFH_Bits HC08_REGISTER(DBGFH_t,DBGFH_Addr)
enum { DBGFL_Addr = 0x1815 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} DBGFL_t;
#define DBGFL HC08_REGISTER(uint8_t,DBGFL_Addr)
#define DBGFL_Bits HC08_REGISTER(DBGFL_t,DBGFL_Addr)
enum { DBGC_Addr = 0x1816 };
typedef struct
{
uint8_t RWBEN : 1;
uint8_t RWB : 1;
uint8_t RWAEN : 1;
uint8_t RWA : 1;
uint8_t BRKEN : 1;
uint8_t TAG : 1;
uint8_t ARM : 1;
uint8_t DBGEN : 1;
} DBGC_t;
#define DBGC HC08_REGISTER(uint8_t,DBGC_Addr)
#define DBGC_Bits HC08_REGISTER(DBGC_t,DBGC_Addr)
#define DBGC_DBGEN DBGC_Bits.DBGEN
#define DBGC_ARM DBGC_Bits.ARM
#define DBGC_TAG DBGC_Bits.TAG
#define DBGC_BRKEN DBGC_Bits.BRKEN
#define DBGC_RWA DBGC_Bits.RWA
#define DBGC_RWAEN DBGC_Bits.RWAEN
#define DBGC_RWB DBGC_Bits.RWB
#define DBGC_RWBEN DBGC_Bits.RWBEN
enum { DBGT_Addr = 0x1817 };
typedef struct
{
uint8_t TRG0 : 1;
uint8_t TRG1 : 1;
uint8_t TRG2 : 1;
uint8_t TRG3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t BEGIN : 1;
uint8_t TRGSEL : 1;
} DBGT_t;
#define DBGT HC08_REGISTER(uint8_t,DBGT_Addr)
#define DBGT_Bits HC08_REGISTER(DBGT_t,DBGT_Addr)
#define DBGT_TRGSEL DBGT_Bits.TRGSEL
#define DBGT_BEGIN DBGT_Bits.BEGIN
#define DBGT_TRG3 DBGT_Bits.TRG3
#define DBGT_TRG2 DBGT_Bits.TRG2
#define DBGT_TRG1 DBGT_Bits.TRG1
#define DBGT_TRG0 DBGT_Bits.TRG0
enum { DBGS_Addr = 0x1818 };
typedef struct
{
uint8_t CNT0 : 1;
uint8_t CNT1 : 1;
uint8_t CNT2 : 1;
uint8_t CNT3 : 1;
uint8_t bit4 : 1;
uint8_t ARMF : 1;
uint8_t BF : 1;
uint8_t AF : 1;
} DBGS_t;
#define DBGS HC08_REGISTER(uint8_t,DBGS_Addr)
#define DBGS_Bits HC08_REGISTER(DBGS_t,DBGS_Addr)
#define DBGS_AF DBGS_Bits.AF
#define DBGS_BF DBGS_Bits.BF
#define DBGS_ARMF DBGS_Bits.ARMF
#define DBGS_CNT3 DBGS_Bits.CNT3
#define DBGS_CNT2 DBGS_Bits.CNT2
#define DBGS_CNT1 DBGS_Bits.CNT1
#define DBGS_CNT0 DBGS_Bits.CNT0
enum { FCDIV_Addr = 0x1820 };
typedef struct
{
uint8_t DIV0 : 1;
uint8_t DIV1 : 1;
uint8_t DIV2 : 1;
uint8_t DIV3 : 1;
uint8_t DIV4 : 1;
uint8_t DIV5 : 1;
uint8_t PRDIV8 : 1;
uint8_t DIVLD : 1;
} FCDIV_t;
#define FCDIV HC08_REGISTER(uint8_t,FCDIV_Addr)
#define FCDIV_Bits HC08_REGISTER(FCDIV_t,FCDIV_Addr)
#define FCDIV_DIVLD FCDIV_Bits.DIVLD
#define FCDIV_PRDIV8 FCDIV_Bits.PRDIV8
#define FCDIV_DIV5 FCDIV_Bits.DIV5
#define FCDIV_DIV4 FCDIV_Bits.DIV4
#define FCDIV_DIV3 FCDIV_Bits.DIV3
#define FCDIV_DIV2 FCDIV_Bits.DIV2
#define FCDIV_DIV1 FCDIV_Bits.DIV1
#define FCDIV_DIV0 FCDIV_Bits.DIV0
enum { FOPT_Addr = 0x1821 };
typedef struct
{
uint8_t SEC00 : 1;
uint8_t SEC01 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t FNORED : 1;
uint8_t KEYEN : 1;
} FOPT_t;
#define FOPT HC08_REGISTER(uint8_t,FOPT_Addr)
#define FOPT_Bits HC08_REGISTER(FOPT_t,FOPT_Addr)
#define FOPT_KEYEN FOPT_Bits.KEYEN
#define FOPT_FNORED FOPT_Bits.FNORED
#define FOPT_SEC01 FOPT_Bits.SEC01
#define FOPT_SEC00 FOPT_Bits.SEC00
enum { FCNFG_Addr = 0x1823 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t KEYACC : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} FCNFG_t;
#define FCNFG HC08_REGISTER(uint8_t,FCNFG_Addr)
#define FCNFG_Bits HC08_REGISTER(FCNFG_t,FCNFG_Addr)
#define FCNFG_KEYACC FCNFG_Bits.KEYACC
enum { FPROT_Addr = 0x1824 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t FPS0 : 1;
uint8_t FPS1 : 1;
uint8_t FPS2 : 1;
uint8_t FPDIS : 1;
uint8_t FPOPEN : 1;
} FPROT_t;
#define FPROT HC08_REGISTER(uint8_t,FPROT_Addr)
#define FPROT_Bits HC08_REGISTER(FPROT_t,FPROT_Addr)
#define FPROT_FPOPEN FPROT_Bits.FPOPEN
#define FPROT_FPDIS FPROT_Bits.FPDIS
#define FPROT_FPS2 FPROT_Bits.FPS2
#define FPROT_FPS1 FPROT_Bits.FPS1
#define FPROT_FPS0 FPROT_Bits.FPS0
enum { FSTAT_Addr = 0x1825 };
typedef struct
{
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t FBLANK : 1;
uint8_t bit3 : 1;
uint8_t FACCERR : 1;
uint8_t FPVIOL : 1;
uint8_t FCCF : 1;
uint8_t FCBEF : 1;
} FSTAT_t;
#define FSTAT HC08_REGISTER(uint8_t,FSTAT_Addr)
#define FSTAT_Bits HC08_REGISTER(FSTAT_t,FSTAT_Addr)
#define FSTAT_FCBEF FSTAT_Bits.FCBEF
#define FSTAT_FCCF FSTAT_Bits.FCCF
#define FSTAT_FPVIOL FSTAT_Bits.FPVIOL
#define FSTAT_FACCERR FSTAT_Bits.FACCERR
#define FSTAT_FBLANK FSTAT_Bits.FBLANK
enum { FCMD_Addr = 0x1826 };
typedef struct
{
uint8_t FCMD0 : 1;
uint8_t FCMD1 : 1;
uint8_t FCMD2 : 1;
uint8_t FCMD3 : 1;
uint8_t FCMD4 : 1;
uint8_t FCMD5 : 1;
uint8_t FCMD6 : 1;
uint8_t FCMD7 : 1;
} FCMD_t;
#define FCMD HC08_REGISTER(uint8_t,FCMD_Addr)
#define FCMD_Bits HC08_REGISTER(FCMD_t,FCMD_Addr)
#define FCMD_FCMD7 FCMD_Bits.FCMD7
#define FCMD_FCMD6 FCMD_Bits.FCMD6
#define FCMD_FCMD5 FCMD_Bits.FCMD5
#define FCMD_FCMD4 FCMD_Bits.FCMD4
#define FCMD_FCMD3 FCMD_Bits.FCMD3
#define FCMD_FCMD2 FCMD_Bits.FCMD2
#define FCMD_FCMD1 FCMD_Bits.FCMD1
#define FCMD_FCMD0 FCMD_Bits.FCMD0
#endif//_H_hcs08regs_h
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.