firebug-cvs Mailing List for FireBug: wireless wildfire monitoring (Page 8)
Brought to you by:
doolin
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(36) |
Jun
(45) |
Jul
(108) |
Aug
(31) |
Sep
(2) |
Oct
(4) |
Nov
(113) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(63) |
Feb
(37) |
Mar
(24) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(71) |
Aug
(42) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(64) |
Jun
(71) |
Jul
(51) |
Aug
(89) |
Sep
(24) |
Oct
(1) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
|
Feb
|
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: Karthik D. <da...@us...> - 2005-07-25 22:19:49
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18008 Modified Files: Fireworks.h Added Files: README Log Message: README added --- NEW FILE: README --- <b>FIREWORKS: Framework to Collect RSSI/Connectivity measurements in a deployed wireless sensor network using motes</b> - Nodes in the network are labeled from 1-(numNodes-1) - The PC is connected to a TOSBase and runs the java app - The PC sends DataRequestMsgs to nodes in sequence - The DataRequestMsg has the following structure struct DataRequestMsg { uint16_t seqNo; uint16_t source; uint16_t numNodes; uint16_t numTrials; uint16_t numPowerLevels; uint16_t trialFrequency; } ; - Once the node receives a DataRequestMsg, it then pings (PingMsg) each node in the network 'DataRequestMsg->numTrials' times at 'DataRequestMsg->tFrequency' and varies 'DataRequestMsg->numPowerLevels' power levels - Each node that receives a PingMsg replies with a PingReplyMsg noting the RSSI value of the received msg. - Once all nodes have replied (or timed out), the node that was initially sent the DataRequestMsg replies with a DataMsg that contains an array of RSSI values. - The PC client then sends DataRequestMsg to the next node DEBUGGING The Leds for the Fireworks application blink in the following sequence. LED count sequence. 1 - Red 2 - Green 4 - Yellow enum { CLEAR = 0x0, \\ Begin application RCV_DR_MSG = 0x1, \\Received DataRequestMsg SND_P_MSG = 0x2, \\ Sent Ping Msg RCV_PR_MSG = 0x3, \\ Received PingReplyMsg RCV_P_MSG = 0x4, \\ Received Ping Msg SND_PR_MSG = 0x5, \\ Sent PingReplyMsg SND_D_MSG = 0x6, \\ Sent DataMsg ERROR = 0x7 \\ Error }; Index: Fireworks.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Fireworks.h 21 Jul 2005 06:04:47 -0000 1.3 --- Fireworks.h 25 Jul 2005 22:19:40 -0000 1.4 *************** *** 24,34 **** */ enum { ! CLEAR = 0x0, ! RCV_DR_MSG = 0x1, ! SND_P_MSG = 0x2, ! RCV_PR_MSG = 0x3, ! RCV_P_MSG = 0x4, ! SND_PR_MSG = 0x5, ! ERROR = 0x7 }; --- 24,35 ---- */ enum { ! CLEAR = 0x0, \\ Begin application ! RCV_DR_MSG = 0x1, \\Received DataRequestMsg ! SND_P_MSG = 0x2, \\ Sent Ping Msg ! RCV_PR_MSG = 0x3, \\ Received PingReplyMsg ! RCV_P_MSG = 0x4, \\ Received Ping Msg ! SND_PR_MSG = 0x5, \\ Sent PingReplyMsg ! SND_D_MSG = 0x6, \\ Sent DataMsg ! ERROR = 0x7 \\ Error }; |
From: Karthik D. <da...@us...> - 2005-07-25 22:08:25
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16159 Modified Files: FireworksC.nc FireworksM.nc Makefile Added Files: TODO Log Message: Working version of Fireworks tinyos code Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 21 Jul 2005 03:08:27 -0000 1.1 --- Makefile 25 Jul 2005 22:08:16 -0000 1.2 *************** *** 1,15 **** - CWD = $(shell pwd) - COMPONENT=FireworksC SENSORBOARD=micasb ! PFLAGS+=-DDELUGE_LEDS ! PFLAGS +=-I$(CWD) ! PLATFORMS=mica2 ! FIREBOARDROOT=/home/kar/firebug/fireboard ! ! include $(TOSROOT)/tools/make/Makerules ! ! ! ! ! --- 1,7 ---- SENSORBOARD=micasb ! COMPONENT=FireworksC ! PFLAGS +=-DDELUGE_LEDS ! PFLAGS += -I%T/lib/Deluge -I%T/interfaces -I%T/tos/lib/Commands -I%T/platform/mica2 ! include ../Makerules ! PLATFORMS = mica2 mica2dot telos telosb telosa Index: FireworksC.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksC.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FireworksC.nc 21 Jul 2005 06:04:47 -0000 1.2 --- FireworksC.nc 25 Jul 2005 22:08:16 -0000 1.3 *************** *** 13,36 **** implementation { components Main ! , GenericComm, , TimerC - , ADCC - , CC1000RadioC , DelugeC , FireworksM , LedsC; - Main.StdControl -> FireworksM.StdControl; Main.StdControl -> DelugeC; ! Main.StdControl -> GenericComm.Control; ! Main.StdControl -> TimerC.Control; ! Fireworks.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; ! Fireworks.ReceivePingMsg -> GenericComm.ReceiveMsg[AM_PINGMSG]; ! Fireworks.SendDataMsg -> GenericComm.SendMsg[AM_DATAMSG]; ! Fireworks.ReceiveDataRequestMsg -> GenericComm.ReceiveMsg[AM_DATAREQUESTMSG]; ! Fireworks.CC1000Control -> CC1000RadioC; ! Fireworks.Leds -> LedsC; ! Fireworks.Timer -> TimerC.Timer[unique("Timer")]; } --- 13,39 ---- implementation { components Main ! , GenericComm , TimerC , DelugeC + // , ADCC + , CC1000RadioC , FireworksM , LedsC; Main.StdControl -> FireworksM.StdControl; + Main.StdControl -> GenericComm.Control; Main.StdControl -> DelugeC; ! Main.StdControl -> TimerC; ! FireworksM.CommControl -> GenericComm; ! FireworksM.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; ! FireworksM.ReceivePingMsg -> GenericComm.ReceiveMsg[AM_PINGMSG]; ! FireworksM.SendPingReplyMsg -> GenericComm.SendMsg[AM_PINGREPLYMSG]; ! FireworksM.ReceivePingReplyMsg -> GenericComm.ReceiveMsg[AM_PINGREPLYMSG]; ! FireworksM.SendDataMsg -> GenericComm.SendMsg[AM_DATAMSG]; ! FireworksM.ReceiveDataMsg -> GenericComm.ReceiveMsg[AM_DATAMSG]; ! FireworksM.ReceiveDataRequestMsg -> GenericComm.ReceiveMsg[AM_DATAREQUESTMSG]; ! FireworksM.CC1000Control -> CC1000RadioC; ! FireworksM.Leds -> LedsC; ! FireworksM.Timer -> TimerC.Timer[unique("Timer")]; } --- NEW FILE: TODO --- - Implement ReceiveDataMsg.receive - Write README.txt Index: FireworksM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FireworksM.nc 21 Jul 2005 06:04:47 -0000 1.2 --- FireworksM.nc 25 Jul 2005 22:08:16 -0000 1.3 *************** *** 7,19 **** */ ! module FireworksM { ! provides interface StdControl; ! uses interface SendMsg as SendPingMsg; ! uses interface SendMsg as SendDataMsg; ! uses interface ReceiveMsg as ReceiveDataRequestMsg; ! uses Timer; ! uses CC1000Control; ! uses interface Leds; } --- 7,29 ---- */ ! includes Fireworks; ! module FireworksM { ! provides { ! interface StdControl; ! } ! uses { ! interface StdControl as CommControl; ! interface SendMsg as SendPingMsg; ! interface SendMsg as SendDataMsg; ! interface SendMsg as SendPingReplyMsg; ! interface ReceiveMsg as ReceiveDataRequestMsg; ! interface ReceiveMsg as ReceiveDataMsg; ! interface ReceiveMsg as ReceivePingMsg; ! interface ReceiveMsg as ReceivePingReplyMsg; ! interface Timer; ! interface Leds; ! interface CC1000Control; ! } } *************** *** 25,28 **** --- 35,39 ---- uint16_t tFrequency; uint16_t seqno; + uint16_t src; uint8_t sendBusy; uint8_t taskBusy; *************** *** 44,48 **** call Leds.redOff(); } ! if(seq&0x2) { call Leds.greenOn(); --- 55,59 ---- call Leds.redOff(); } ! if(seq&0x2) { call Leds.greenOn(); *************** *** 51,57 **** call Leds.greenOff(); } ! if(seq&0x4) { ! call Leds.yellowOn(); } else { --- 62,68 ---- call Leds.greenOff(); } ! if(seq&0x4) { ! call Leds.yellowOn(); } else { *************** *** 59,73 **** } } ! command result_t StdControl.init() { ! atomic { } ! return SUCCESS; } ! command result_t StdControl.start() { blink(CLEAR); ! seqno = 1; sendBusy = FALSE; --- 70,169 ---- } } + + void clearPacket() { + uint8_t i; + for(i=0; i< 29; i++) + msg.data[i]=0x0; + } + + task void sendPing() { + /* NOTE: Again, since tasks dont seem to allow parameters, + we use the global 'dest' as destination */ + clearPacket(); + pMsg = (PingMsg *) &(msg.data); + pMsg->source = TOS_LOCAL_ADDRESS; + pMsg->seqno = seqno++; + + if(!sendBusy) { + sendBusy = TRUE; + if(!call SendPingMsg.send(dest, sizeof(PingMsg), &msg)) { + sendBusy = FALSE; + blink(ERROR); + return; + } + else { + /* We have sent the msg. Set timer to fire after 3 seconds */ + blink(SND_P_MSG); + call Timer.start(TIMER_ONE_SHOT, 3072); + counter++; + return; + } + } + } + + task void sendPingReply() { + /* NOTE: Since tasks do not seem to allow parameters, we use + src and seqno as global variables. They should not be + used by anybody else */ ! prMsg = (PingReplyMsg *) &(msg.data); ! ! prMsg->source = src; ! prMsg->seqno = seqno; ! ! if(!sendBusy) { ! sendBusy = TRUE; ! if(!call SendPingReplyMsg.send(src, sizeof(PingReplyMsg), &msg)) { ! sendBusy = FALSE; ! blink(ERROR); ! return; ! } ! else { ! blink(SND_PR_MSG); ! } } ! return; ! } ! ! task void sendData() { ! } ! ! ! task void takeMeasurements() { ! uint16_t trial; ! /* The way we take measurements is that we ping the intended ! node and he replies (if he receives the packet) with the ! RSSI value. Once we send a ping, we start a timer. If the ! timer expires, we assume that the node is out of range/unreachable */ ! dest = 1; ! for(dest=1; dest <= nNodes; dest++) { ! counter = 0; ! taskBusy = FALSE; ! sendBusy = FALSE; ! if(dest != TOS_LOCAL_ADDRESS) { ! trial = 1; ! while(trial <= nTrials) { ! if(!taskBusy) { ! trial ++; ! taskBusy = TRUE; ! post sendPing(); ! } ! } ! } ! } ! ! post sendData(); ! } ! ! command result_t StdControl.init() { ! call Leds.init(); ! call CommControl.init(); ! return SUCCESS; } ! command result_t StdControl.start() { blink(CLEAR); ! seqno = 1; sendBusy = FALSE; *************** *** 75,84 **** counter = 0; dest = 0; ! // return call Clock.setRate(TOS_I16PS, TOSS16PS); return SUCCESS; } ! command result_t StdControl.stop() { call Timer.stop(); return SUCCESS; } --- 171,184 ---- counter = 0; dest = 0; ! ! call CommControl.start(); ! return SUCCESS; } ! command result_t StdControl.stop() { + call CommControl.stop(); call Timer.stop(); + return SUCCESS; } *************** *** 87,91 **** prMsg = (PingReplyMsg *) &(m->data); ! if(TOS_LOCAL_ADDRESS == prMsg->source && seqno == prMsg->seqno) { data[dest][counter] = prMsg->RSSI; --- 187,191 ---- prMsg = (PingReplyMsg *) &(m->data); ! if(TOS_LOCAL_ADDRESS == prMsg->source && seqno == prMsg->seqno) { data[dest][counter] = prMsg->RSSI; *************** *** 94,101 **** } ! ! return SUCCESS; } ! event TOS_MsgPtr ReceiveDataRequestMsg.receive(TOS_MsgPtr m) { drMsg = (DataRequestMsg *) (&(m->data)); --- 194,201 ---- } ! ! return m; } ! event TOS_MsgPtr ReceiveDataRequestMsg.receive(TOS_MsgPtr m) { drMsg = (DataRequestMsg *) (&(m->data)); *************** *** 111,222 **** post takeMeasurements(); } } ! ! event result_t ReceivePingMsg.receive(TOS_MsgPtr m) { ! uint16_t source; ! if(TOS_LOCAL_ADDRESS == m->addr) { blink(RCV_P_MSG); pMsg = (PingMsg *) &(m->data); ! while(taskBusy); ! taskBusy = TRUE; ! post sendPingReply(pMsg->source, pMsg->seqno); } ! return SUCCESS; } ! ! task void sendPingReply(uint16_t src, uint16_t sq) { ! prMsg = (PingReplyMsg *) &(msg.data); ! ! prMsg->source = src; ! prMsg->seqno = sq; ! ! if(!sendBusy) { ! sendBusy = TRUE; ! if(!call SendPingReply.send(src, &msg)) { ! sendBusy = FALSE; ! blink(ERROR); ! return; ! } ! else { ! blink(SND_PR_MSG); ! } ! } ! return; } ! ! task void takeMeasurements() { ! uint16_t trial; ! /* The way we take measurements is that we ping the intended ! node and he replies (if he receives the packet) with the ! RSSI value. Once we send a ping, we start a timer. If the ! timer expires, we assume that the node is out of range/unreachable */ ! dest = 1; ! for(dest=1; dest <= nNodes; dest++) { ! counter = 0; ! taskBusy = FALSE; ! sendBusy = FALSE; ! if(dest != TOS_LOCAL_ADDRESS) { ! trial = 1; ! while(trial <= nTrials) { ! if(!taskBusy) { ! trial ++; ! taskBusy = TRUE; ! post task sendPingMsg(dest); ! } ! } ! } ! } ! ! post sendData(); } - - task void sendPingMsg(uint16_t d) { - pMsg = (PingMsg *) &(msg.data); - pMsg->source = TOS_LOCAL_ADDRESS; - pMsg->seqno = seqno++; - - if(!sendBusy) { - sendBusy = TRUE; - if(!call SendPingMsg.send(d, sizeof(PingMsg), pMsg)) { - sendBusy = FALSE; - blink(ERROR); - return; - } - else { - /* We have sent the msg. Set timer to fire after 3 seconds */ - blink(SND_P_MSG); - Timer.start(TIMER_ONE_SHOT, 3072); - counter++; - return; - } - } - - event result_t Timer.fired() { - /* This means that we have to time out, redo state and declare - this packet to have been lost */ - data[dest][counter]=LOST; - taskBusy = FALSE; - sendBusy = FALSE; - return SUCCESS; - } - - event result_t_MsgPtr SendPingMsg.sendDone(TOSMsg_Ptr m) { - sendBusy = FALSE; - return SUCCESS; - } ! event result_t_MsgPtr SendPingReplyMsg.sendDone(TOSMsg_Ptr m) { ! sendBusy = FALSE; ! return SUCCESS; ! } ! ! event result_t_MsgPtr SendDataMsg.sendDone(TOSMsg_Ptr m) { ! sendBusy = FALSE; ! return SUCCESS; ! } } --- 211,259 ---- post takeMeasurements(); } + + return m; } ! ! event TOS_MsgPtr ReceiveDataMsg.receive(TOS_MsgPtr m) { ! return m; ! } ! ! event TOS_MsgPtr ReceivePingMsg.receive(TOS_MsgPtr m) { if(TOS_LOCAL_ADDRESS == m->addr) { blink(RCV_P_MSG); pMsg = (PingMsg *) &(m->data); ! while(taskBusy); ! taskBusy = TRUE; ! post sendPingReply(); } ! ! return m; ! } ! ! event result_t Timer.fired() { ! /* This means that we have to time out, redo state and declare ! this packet to have been lost */ ! data[dest][counter]=LOST; ! taskBusy = FALSE; ! sendBusy = FALSE; return SUCCESS; } ! ! event result_t SendPingMsg.sendDone(TOS_MsgPtr m, result_t s) { ! sendBusy = FALSE; ! return SUCCESS; } ! ! event result_t SendPingReplyMsg.sendDone(TOS_MsgPtr m, result_t s) { ! sendBusy = FALSE; ! return SUCCESS; } ! event result_t SendDataMsg.sendDone(TOS_MsgPtr m, result_t s) { ! sendBusy = FALSE; ! return SUCCESS; ! } } |
From: Karthik D. <da...@us...> - 2005-07-21 06:32:20
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23445 Modified Files: Fireworks.h FireworksC.nc FireworksM.nc Log Message: Almost finished the tinyos components for our fireworks! Things to be done are - - Complete SendDataMsg.send - Get paths set in makefile and compile - pad structures if need be to match TOS_Msg KAR. Index: FireworksC.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksC.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FireworksC.nc 21 Jul 2005 03:09:12 -0000 1.1 --- FireworksC.nc 21 Jul 2005 06:04:47 -0000 1.2 *************** *** 14,18 **** components Main , GenericComm, ! , ClockC , ADCC , CC1000RadioC --- 14,18 ---- components Main , GenericComm, ! , TimerC , ADCC , CC1000RadioC *************** *** 24,28 **** Main.StdControl -> FireworksM.StdControl; Main.StdControl -> DelugeC; ! Main.StdControl -> GenericComm.Control; Fireworks.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; --- 24,29 ---- Main.StdControl -> FireworksM.StdControl; Main.StdControl -> DelugeC; ! Main.StdControl -> GenericComm.Control; ! Main.StdControl -> TimerC.Control; Fireworks.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; *************** *** 32,35 **** Fireworks.CC1000Control -> CC1000RadioC; Fireworks.Leds -> LedsC; ! Fireworks.Clock -> ClockC; } --- 33,36 ---- Fireworks.CC1000Control -> CC1000RadioC; Fireworks.Leds -> LedsC; ! Fireworks.Timer -> TimerC.Timer[unique("Timer")]; } Index: Fireworks.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Fireworks.h 21 Jul 2005 03:08:27 -0000 1.2 --- Fireworks.h 21 Jul 2005 06:04:47 -0000 1.3 *************** *** 9,14 **** enum { AM_PINGMSG = 42, ! AM_DATAMSG = 43, ! AM_DATAREQUESTMSG = 44 }; --- 9,34 ---- enum { AM_PINGMSG = 42, ! AM_PINGREPLYMSG = 43, ! AM_DATAMSG = 44, ! AM_DATAREQUESTMSG = 45 ! }; ! ! enum { ! LOST = 0x00 ! }; ! ! /* LED count sequence. ! 1 - Red ! 2 - Green ! 4 - Yellow ! */ ! enum { ! CLEAR = 0x0, ! RCV_DR_MSG = 0x1, ! SND_P_MSG = 0x2, ! RCV_PR_MSG = 0x3, ! RCV_P_MSG = 0x4, ! SND_PR_MSG = 0x5, ! ERROR = 0x7 }; *************** *** 17,20 **** --- 37,41 ---- uint16_t source; uint16_t numNodes; + uint16_t numTrials; uint16_t numPowerLevels; uint16_t trialFrequency; *************** *** 32,33 **** --- 53,69 ---- typedef struct DataMsg DataMsg; + + struct PingMsg { + uint16_t source; + uint16_t seqno; + } ; + + typedef struct PingMsg PingMsg; + + struct PingReplyMsg { + uint16_t source; + uint16_t seqno; + uint16_t RSSI; + } ; + + typedef struct PingReplyMsg PingReplyMsg; Index: FireworksM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksM.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FireworksM.nc 21 Jul 2005 02:30:44 -0000 1.1 --- FireworksM.nc 21 Jul 2005 06:04:47 -0000 1.2 *************** *** 13,17 **** uses interface SendMsg as SendDataMsg; uses interface ReceiveMsg as ReceiveDataRequestMsg; ! uses Clock; uses CC1000Control; uses interface Leds; --- 13,17 ---- uses interface SendMsg as SendDataMsg; uses interface ReceiveMsg as ReceiveDataRequestMsg; ! uses Timer; uses CC1000Control; uses interface Leds; *************** *** 20,34 **** implementation { ! uint16_t numTrials; ! uint16_t numNodes; ! uint16_t numPowerLevels; ! uint16_t trialFrequency; TOS_Msg msg; PingMsg *pMsg; DataMsg *dMsg; DataRequestMsg *drMsg; ! comman result_t StdControl.init() { atomic { } --- 20,64 ---- implementation { ! uint16_t nTrials; ! uint16_t nNodes; ! uint16_t nPowerLevels; ! uint16_t tFrequency; ! uint16_t seqno; ! uint8_t sendBusy; ! uint8_t taskBusy; ! uint8_t data[100][100]; ! uint16_t counter; ! uint16_t dest; TOS_Msg msg; PingMsg *pMsg; + PingReplyMsg *prMsg; DataMsg *dMsg; DataRequestMsg *drMsg; ! void blink(uint8_t seq) { ! if(seq&0x1) { ! call Leds.redOn(); ! } ! else { ! call Leds.redOff(); ! } ! ! if(seq&0x2) { ! call Leds.greenOn(); ! } ! else { ! call Leds.greenOff(); ! } ! ! if(seq&0x4) { ! call Leds.yellowOn(); ! } ! else { ! call Leds.yellowOff(); ! } ! } ! ! command result_t StdControl.init() { atomic { } *************** *** 38,61 **** command result_t StdControl.start() { ! call.Leds.redOff(); ! call Leds.greenOff(); ! call Leds.yellowOff(); ! return call Clock.setRate(TOS_I16PS, TOSS16PS); } command result_t StdControl.stop() { return SUCCESS; } event TOS_MsgPtr ReceiveDataRequestMsg.receive(TOS_MsgPtr m) { - call Leds.redToggle(); drMsg = (DataRequestMsg *) (&(m->data)); ! if( ! ! async event result_t ADC.dataReady(uint16_t rssi) { return SUCCESS; } } --- 68,222 ---- command result_t StdControl.start() { ! blink(CLEAR); ! seqno = 1; ! sendBusy = FALSE; ! taskBusy = FALSE; ! counter = 0; ! dest = 0; ! // return call Clock.setRate(TOS_I16PS, TOSS16PS); ! return SUCCESS; } command result_t StdControl.stop() { + call Timer.stop(); + return SUCCESS; + } + + event TOS_MsgPtr ReceivePingReplyMsg.receive(TOS_MsgPtr m) { + + prMsg = (PingReplyMsg *) &(m->data); + + if(TOS_LOCAL_ADDRESS == prMsg->source && seqno == prMsg->seqno) { + data[dest][counter] = prMsg->RSSI; + blink(RCV_PR_MSG); + taskBusy = FALSE; + + } + return SUCCESS; } event TOS_MsgPtr ReceiveDataRequestMsg.receive(TOS_MsgPtr m) { drMsg = (DataRequestMsg *) (&(m->data)); ! /* I am being asked to take measurements */ ! if(TOS_LOCAL_ADDRESS == drMsg->source) { ! blink(RCV_DR_MSG); ! nTrials = drMsg->numTrials; ! nNodes = drMsg->numNodes; ! nPowerLevels = drMsg->numPowerLevels; ! tFrequency = drMsg->trialFrequency; ! ! post takeMeasurements(); ! } ! } ! ! event result_t ReceivePingMsg.receive(TOS_MsgPtr m) { ! uint16_t source; ! ! if(TOS_LOCAL_ADDRESS == m->addr) { ! blink(RCV_P_MSG); ! pMsg = (PingMsg *) &(m->data); ! ! while(taskBusy); ! ! taskBusy = TRUE; ! post sendPingReply(pMsg->source, pMsg->seqno); ! } ! return SUCCESS; } + + task void sendPingReply(uint16_t src, uint16_t sq) { + prMsg = (PingReplyMsg *) &(msg.data); + + prMsg->source = src; + prMsg->seqno = sq; + + if(!sendBusy) { + sendBusy = TRUE; + if(!call SendPingReply.send(src, &msg)) { + sendBusy = FALSE; + blink(ERROR); + return; + } + else { + blink(SND_PR_MSG); + } + } + return; + } + + task void takeMeasurements() { + uint16_t trial; + /* The way we take measurements is that we ping the intended + node and he replies (if he receives the packet) with the + RSSI value. Once we send a ping, we start a timer. If the + timer expires, we assume that the node is out of range/unreachable */ + dest = 1; + for(dest=1; dest <= nNodes; dest++) { + counter = 0; + taskBusy = FALSE; + sendBusy = FALSE; + if(dest != TOS_LOCAL_ADDRESS) { + trial = 1; + while(trial <= nTrials) { + if(!taskBusy) { + trial ++; + taskBusy = TRUE; + post task sendPingMsg(dest); + } + } + } + } + + post sendData(); + } + + task void sendPingMsg(uint16_t d) { + pMsg = (PingMsg *) &(msg.data); + pMsg->source = TOS_LOCAL_ADDRESS; + pMsg->seqno = seqno++; + + if(!sendBusy) { + sendBusy = TRUE; + if(!call SendPingMsg.send(d, sizeof(PingMsg), pMsg)) { + sendBusy = FALSE; + blink(ERROR); + return; + } + else { + /* We have sent the msg. Set timer to fire after 3 seconds */ + blink(SND_P_MSG); + Timer.start(TIMER_ONE_SHOT, 3072); + counter++; + return; + } + } + + event result_t Timer.fired() { + /* This means that we have to time out, redo state and declare + this packet to have been lost */ + data[dest][counter]=LOST; + taskBusy = FALSE; + sendBusy = FALSE; + return SUCCESS; + } + + event result_t_MsgPtr SendPingMsg.sendDone(TOSMsg_Ptr m) { + sendBusy = FALSE; + return SUCCESS; + } + + event result_t_MsgPtr SendPingReplyMsg.sendDone(TOSMsg_Ptr m) { + sendBusy = FALSE; + return SUCCESS; + } + + event result_t_MsgPtr SendDataMsg.sendDone(TOSMsg_Ptr m) { + sendBusy = FALSE; + return SUCCESS; + } } |
From: Karthik D. <da...@us...> - 2005-07-21 06:05:36
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23748 Removed Files: Fireworks.nc Log Message: removed file. CVS: ---------------------------------------------------------------------- --- Fireworks.nc DELETED --- |
From: Karthik D. <da...@us...> - 2005-07-21 03:09:57
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24805 Added Files: FireworksC.nc Log Message: Initial add of Fireworks Component. KAR. --- NEW FILE: FireworksC.nc --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * Date: 7/20/2005 * */ includes Fireworks; configuration FireworksC { } implementation { components Main , GenericComm, , ClockC , ADCC , CC1000RadioC , DelugeC , FireworksM , LedsC; Main.StdControl -> FireworksM.StdControl; Main.StdControl -> DelugeC; Main.StdControl -> GenericComm.Control; Fireworks.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; Fireworks.ReceivePingMsg -> GenericComm.ReceiveMsg[AM_PINGMSG]; Fireworks.SendDataMsg -> GenericComm.SendMsg[AM_DATAMSG]; Fireworks.ReceiveDataRequestMsg -> GenericComm.ReceiveMsg[AM_DATAREQUESTMSG]; Fireworks.CC1000Control -> CC1000RadioC; Fireworks.Leds -> LedsC; Fireworks.Clock -> ClockC; } |
From: Karthik D. <da...@us...> - 2005-07-21 03:09:08
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24670 Modified Files: Fireworks.h Fireworks.nc Added Files: Makefile Log Message: Initial add of Makefile KAR. Index: Fireworks.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Fireworks.h 21 Jul 2005 02:30:43 -0000 1.1 --- Fireworks.h 21 Jul 2005 03:08:27 -0000 1.2 *************** *** 11,15 **** AM_DATAMSG = 43, AM_DATAREQUESTMSG = 44 ! } struct DataRequestMsg { --- 11,15 ---- AM_DATAMSG = 43, AM_DATAREQUESTMSG = 44 ! }; struct DataRequestMsg { *************** *** 19,23 **** uint16_t numPowerLevels; uint16_t trialFrequency; ! } typedef struct DataRequestMsg DataRequestMsg; --- 19,23 ---- uint16_t numPowerLevels; uint16_t trialFrequency; ! } ; typedef struct DataRequestMsg DataRequestMsg; *************** *** 29,33 **** uint16_t numPowerLevels; uint16_t trialFrequency; ! } typedef struct DataMsg DataMsg; --- 29,33 ---- uint16_t numPowerLevels; uint16_t trialFrequency; ! } ; typedef struct DataMsg DataMsg; --- NEW FILE: Makefile --- CWD = $(shell pwd) COMPONENT=FireworksC SENSORBOARD=micasb PFLAGS+=-DDELUGE_LEDS PFLAGS +=-I$(CWD) PLATFORMS=mica2 FIREBOARDROOT=/home/kar/firebug/fireboard include $(TOSROOT)/tools/make/Makerules Index: Fireworks.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Fireworks.nc 21 Jul 2005 02:30:44 -0000 1.1 --- Fireworks.nc 21 Jul 2005 03:08:27 -0000 1.2 *************** *** 7,13 **** */ ! includes Fireworks.h; ! configuration Fireworks { components Main , GenericComm, --- 7,15 ---- */ ! includes Fireworks; ! configuration FireworksC { ! } ! implementation { components Main , GenericComm, |
From: Karthik D. <da...@us...> - 2005-07-21 02:33:11
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18155/Fireworks Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks added to the repository |
From: Karthik D. <da...@us...> - 2005-07-21 02:33:09
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18088/apps Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/apps added to the repository |
From: Karthik D. <da...@us...> - 2005-07-21 02:32:49
|
Update of /cvsroot/firebug/fireboard/beta/fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17999/fireworks Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks added to the repository |
From: Karthik D. <da...@us...> - 2005-07-21 02:32:49
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18347 Added Files: Fireworks.h Fireworks.nc FireworksM.nc Log Message: Initial commit of fireworks tinyos code. KAR. --- NEW FILE: Fireworks.h --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * Date: 7/20/2005 * */ enum { AM_PINGMSG = 42, AM_DATAMSG = 43, AM_DATAREQUESTMSG = 44 } struct DataRequestMsg { uint16_t seqNo; uint16_t source; uint16_t numNodes; uint16_t numPowerLevels; uint16_t trialFrequency; } typedef struct DataRequestMsg DataRequestMsg; struct DataMsg { uint16_t seqNo; uint16_t source; uint16_t numNodes; uint16_t numPowerLevels; uint16_t trialFrequency; } typedef struct DataMsg DataMsg; --- NEW FILE: Fireworks.nc --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * Date: 7/20/2005 * */ includes Fireworks.h; configuration Fireworks { components Main , GenericComm, , ClockC , ADCC , CC1000RadioC , DelugeC , FireworksM , LedsC; Main.StdControl -> FireworksM.StdControl; Main.StdControl -> DelugeC; Main.StdControl -> GenericComm.Control; Fireworks.SendPingMsg -> GenericComm.SendMsg[AM_PINGMSG]; Fireworks.ReceivePingMsg -> GenericComm.ReceiveMsg[AM_PINGMSG]; Fireworks.SendDataMsg -> GenericComm.SendMsg[AM_DATAMSG]; Fireworks.ReceiveDataRequestMsg -> GenericComm.ReceiveMsg[AM_DATAREQUESTMSG]; Fireworks.CC1000Control -> CC1000RadioC; Fireworks.Leds -> LedsC; Fireworks.Clock -> ClockC; } --- NEW FILE: FireworksM.nc --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * Date: 7/20/2005 * */ module FireworksM { provides interface StdControl; uses interface SendMsg as SendPingMsg; uses interface SendMsg as SendDataMsg; uses interface ReceiveMsg as ReceiveDataRequestMsg; uses Clock; uses CC1000Control; uses interface Leds; } implementation { uint16_t numTrials; uint16_t numNodes; uint16_t numPowerLevels; uint16_t trialFrequency; TOS_Msg msg; PingMsg *pMsg; DataMsg *dMsg; DataRequestMsg *drMsg; comman result_t StdControl.init() { atomic { } return SUCCESS; } command result_t StdControl.start() { call.Leds.redOff(); call Leds.greenOff(); call Leds.yellowOff(); return call Clock.setRate(TOS_I16PS, TOSS16PS); } command result_t StdControl.stop() { return SUCCESS; } event TOS_MsgPtr ReceiveDataRequestMsg.receive(TOS_MsgPtr m) { call Leds.redToggle(); drMsg = (DataRequestMsg *) (&(m->data)); if( async event result_t ADC.dataReady(uint16_t rssi) { return SUCCESS; } } |
From: David M. D. <do...@us...> - 2005-07-15 21:24:01
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7006 Modified Files: genc.pm Log Message: more mods to genc. Index: genc.pm =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/genc.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** genc.pm 28 Jun 2005 20:04:32 -0000 1.1 --- genc.pm 15 Jul 2005 21:23:52 -0000 1.2 *************** *** 32,36 **** --- 32,40 ---- true; + + sub gen() { + + my %struct_hash; my ($classname, @spec) = @_; *************** *** 103,110 **** --- 107,129 ---- + + print $medskip; + + &gen_struct(); print $medskip; + + + print "//Format string generated automatically,\n"; + $tmp = @format[$#format-1]; + $tmp =~ s/,//g; + $fmtstr = "@format[0..($#format-1)] $tmp"; + #print "Fmt: $fmtstr\n"; + print "static char formatstring[] = \"@format[0..($#format-1)] $tmp\";\n\n\n"; + &gen_get_set(); print $medskip; + &gen_insert_stmt(); + print $medskip; ## Default behavior is to return the input as output. *************** *** 140,148 **** print $medskip; - print "//Format string can be generated automatically,\n"; - print "//then the delimiters added later: @format\n"; - - print $medskip; - ## In the code for the xlisten boards, the conversions are --- 159,162 ---- *************** *** 155,159 **** print " * necessary for processing.\n"; print " */\n"; ! print "$java_classname * convert(char * data) {\n"; print " // Just to keep gcc happy.\n"; print " return ($java_classname*)data;\n"; --- 169,173 ---- print " * necessary for processing.\n"; print " */\n"; ! print "$java_classname *\n $java_classname\_convert(char * data) {\n"; print " // Just to keep gcc happy.\n"; print " return ($java_classname*)data;\n"; *************** *** 164,183 **** ## Start printing output functions. ! print "/** Print the bytes of the packet. */\n"; ! print "void $java_classname\_print\_raw (XbowSensorboardPacket *packet) {\n\n"; ! print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; ! print "}\n\n"; ! ! ! print "/** Print typed output. */\n"; ! print "void $java_classname\_print\_cooked (XbowSensorboardPacket *packet) {\n\n"; ! print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; ! print "}\n\n"; ! - print "/** Print cooked with tabs. */\n"; - print "void $java_classname\_print\_tabbed (XbowSensorboardPacket *packet) {\n\n"; - print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; - print "}\n\n"; --- 178,185 ---- ## Start printing output functions. ! &gen_byte_output(); ! &gen_cooked_output(); ! &gen_cooked_with_tabs(); *************** *** 213,221 **** } sub gen_struct() { ! print "struct _$java_classname {\n"; - ## todo move this to sub print_msg_struct(). for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; --- 215,355 ---- } + sub gen_cooked_with_tabs() { + + print "/** Print cooked with tabs. */\n"; + print "void $java_classname\_print\_tabbed (XbowSensorboardPacket *packet) {\n\n"; + print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; + print "}\n\n"; + } + + + sub gen_byte_output() { + + print "/** Print the bytes of the packet. */\n"; + print "void $java_classname\_print\_raw (XbowSensorboardPacket *packet) {\n\n"; + print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; + print "}\n\n"; + } + + + sub gen_cooked_output() { + + print "/** Print cooked output. */\n"; + print "void\n$java_classname\_print\_cooked (void * userdata) {\n\n"; + print "$I$java_classname * data = ($java_classname*)userdata;\n"; + + + for (@fields) { + ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; + ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); + if ($field =~ /(.*)\.([^.]*)$/) { + $struct = $1; + $member = $2; + #print STDERR $struct;#.", "$member."\n"; + } + ## Gets an array of format specifiers useful in *print* functions + ## in libc. the @format array can be passed + #push(@format, &formatstring($type, $bitlength, 0)); + $field =~ s/\./_/g; + print " printf(\"$field: ".&formatstring($type, $bitlength, 0)."\\n\",data->$field);\n"; + } + + + + print "}\n\n"; + + } + + + sub gen_insert_stmt() { + + $i = 0; + $numfields = $#fields; + + print "static char insert_stmt[] = \"INSERT into $java_classname (\"\n"; + + for (@fields) { + ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; + ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); + + # This is clunky but will work. A better way to do it would be to store + # the nested struct internally in the field array somehow. + # Maybe a perl guru can figure that out. + # What needs to be done is to find one of these, then + # store it until all the members written out, + # then print it. + if ($field =~ /(.*)\.([^.]*)$/) { + $struct = $1; + $member = $2; + #print STDERR $struct;#.", "$member."\n"; + } + + ## Gets an array of format specifiers useful in *print* functions + ## in libc. the @format array can be passed + push(@format, &formatstring($type, $bitlength, 0)); + $field =~ s/\./_/g; + + if ($i < $numfields) { + printf "\"$field,\"\n"; + } else { + printf "\"$field) values ($fmtstr)\";\n\n"; + } + + $i++; + } + # print ");"; + + &gen_struct_array(); + + print "#if 0\n"; + + print "void\n$java_classname\_pg\_log(void * userdata) {\n"; + print "char pg_command[255];\n"; + print "$java_classname * data = ($java_classname*)userdata;\n"; + print "sprintf(pg_command,formatstring,\n"; + # traverse struct here. + while ( ($key, $value) = each(%struct_hash) ) { + # @cc{Do some processing on @scalar{$key} and @scalar{$value}} + print "data->$key,\n" + } + print "}\n"; + print "#endif\n"; + } + + sub gen_struct() { ! print "struct _$java_classname {\n"; ! ! ## todo move this to sub print_msg_struct(). ! for (@fields) { ! ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ! ! ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); ! ! # This is clunky but will work. A better way to do it would be to store ! # the nested struct internally in the field array somehow. ! # Maybe a perl guru can figure that out. ! # What needs to be done is to find one of these, then ! # store it until all the members written out, ! # then print it. ! if ($field =~ /(.*)\.([^.]*)$/) { ! $struct = $1; ! $member = $2; ! #print STDERR $struct;#.", "$member."\n"; ! } ! ! ## Gets an array of format specifiers useful in *print* functions ! ## in libc. the @format array can be passed ! push(@format, &formatstring($type, $bitlength, 0)); ! $field =~ s/\./_/g; ! printf "$I$ctype $field;\n"; ! } ! print "};"; ! } ! ! ! sub gen_struct_array() { for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; *************** *** 239,247 **** push(@format, &formatstring($type, $bitlength, 0)); $field =~ s/\./_/g; ! printf "$I$ctype $field;\n"; } ! print "};"; } sub gen_get_set() { --- 373,382 ---- push(@format, &formatstring($type, $bitlength, 0)); $field =~ s/\./_/g; ! $struct_hash{$field} = $ctype; } ! } + sub gen_get_set() { *************** *** 272,277 **** ## the same as in nesc. Probably need to add a "bitfield" handler to ## do it right. ! sub cbasetype() ! { my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc; --- 407,412 ---- ## the same as in nesc. Probably need to add a "bitfield" handler to ## do it right. ! sub cbasetype() { ! my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc; *************** *** 320,333 **** if ($basetype eq "U") { $acc = "UIntElement"; ! if ($bitlength < 8) { $jtype = "byte"; $formatstring = "c";} ! elsif ($bitlength < 16) { $jtype = "short"; $formatstring = "i";} ! elsif ($bitlength < 32) { $jtype = "int"; $formatstring = "i";} ! else { $jtype = "long"; $formatstring = "%i"} } elsif ($basetype eq "I") { $acc = "SIntElement"; ! if ($bitlength <= 8) { $jtype = "byte"; $formatstring = "c";} ! elsif ($bitlength <= 16) { $jtype = "short"; $formatstring = "i";} ! elsif ($bitlength <= 32) { $jtype = "int"; $formatstring = "i";} else { $jtype = "long"; } } --- 455,468 ---- if ($basetype eq "U") { $acc = "UIntElement"; ! if ($bitlength < 8) { $jtype = "byte"; $formatstring = "%c,";} ! elsif ($bitlength < 16) { $jtype = "short"; $formatstring = "%i,";} ! elsif ($bitlength < 32) { $jtype = "int"; $formatstring = "%i,";} ! else { $jtype = "long"; $formatstring = "%i,"} } elsif ($basetype eq "I") { $acc = "SIntElement"; ! if ($bitlength <= 8) { $jtype = "byte"; $formatstring = "%c,";} ! elsif ($bitlength <= 16) { $jtype = "short"; $formatstring = "%i,";} ! elsif ($bitlength <= 32) { $jtype = "int"; $formatstring = "%i,";} else { $jtype = "long"; } } |
From: David M. D. <do...@us...> - 2005-07-15 17:34:47
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15813 Modified Files: sirftest.c Log Message: Started the test functions for sirf id 2 msg. Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sirftest.c 15 Jul 2005 16:23:37 -0000 1.2 --- sirftest.c 15 Jul 2005 17:34:36 -0000 1.3 *************** *** 4,10 **** --- 4,18 ---- #include "sirf.h" + static char sirf_id2[] = { + 0x02, + 0xff, 0xd6, 0xf7, 0x8c, + 0xff, 0xbe, 0x53, 0x6e}; + int main(int argc, char ** argv) { + int32_t xpos = 0; + int32_t ypos = 0; + uint8_t message_id; printf("sirf id 2,1: %d\n",sizeof(SiRF_ID2_1)); *************** *** 14,17 **** --- 22,52 ---- printf("sirf id 28,3: %d\n",sizeof(SiRF_ID28_3)); + printf("sirf_id2 string: %x\n",sirf_id2); + + message_id = sirf_id2[0]; + printf("message_id: %d\n", message_id); + + /** This works, needs to be moved to a macro. */ + xpos |= sirf_id2[1] & 0xFF; + xpos <<= 8; + xpos |= sirf_id2[2] & 0xFF; + xpos <<= 8; + xpos |= sirf_id2[3] & 0xFF; + xpos <<= 8; + xpos |= sirf_id2[4] & 0xFF; + + ypos |= sirf_id2[5] & 0xFF; + ypos <<= 8; + ypos |= sirf_id2[6] & 0xFF; + ypos <<= 8; + ypos |= sirf_id2[7] & 0xFF; + ypos <<= 8; + ypos |= sirf_id2[8] & 0xFF; + + + + printf("X Pos: %i\n", xpos); + printf("Y Pos: %i\n", ypos); + return 0; } |
From: David M. D. <do...@us...> - 2005-07-15 16:37:11
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3786 Modified Files: firebug-db-setup.sh firebug.sql Added Files: sirf_id28_1.pgsql sirf_id28_2.pgsql sirf_id28_3.pgsql sirf_id2_1.pgsql sirf_id2_2.pgsql Log Message: autogenerated sirf table postgres sql scripts work. --- NEW FILE: sirf_id28_3.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID28_3' * message type. */ CREATE TABLE SiRF_ID28_3 ( header_seqno smallint, header_am_type smallint, header_rsrvd1 smallint, header_rsrvd2 smallint, sync_flags smallint, cno1 smallint, cno2 smallint, cno3 smallint, cno4 smallint, cno5 smallint, cno6 smallint, cno7 smallint, cno8 smallint, cno9 smallint, cno10 smallint, delta_range_interval smallint, mean_delta_range_time smallint, extrapolation_time smallint, phase_error_count smallint, low_power_count smallint); --- NEW FILE: sirf_id28_2.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID28_2' * message type. */ CREATE TABLE SiRF_ID28_2 ( header_seqno smallint, header_am_type smallint, header_rsrvd1 smallint, header_rsrvd2 smallint, pseudo_range integer, carrier_freq integer, carrier_phase integer, time_in_track smallint); --- NEW FILE: sirf_id2_2.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID2_2' * message type. */ CREATE TABLE SiRF_ID2_2 ( header_seqno smallint, header_am_type smallint, header_rsrvd1 smallint, header_rsrvd2 smallint, gps_tow integer, sv_in_fix smallint, ch1 smallint, ch2 smallint, ch3 smallint, ch4 smallint, ch5 smallint, ch6 smallint, ch7 smallint, ch8 smallint, ch9 smallint, ch10 smallint, ch11 smallint, ch12 smallint); Index: firebug.sql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug.sql,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** firebug.sql 20 Jun 2005 17:58:43 -0000 1.5 --- firebug.sql 15 Jul 2005 16:37:01 -0000 1.6 *************** *** 59,61 **** select gga_l.nodeid, latitudedegree, latitudeminutes, longitudedegree, longitudeminute, temperature, humidity, pressure ! from gga_l, xbow_weather_l where gga_l.nodeid = xbow_weather_l.nodeid; \ No newline at end of file --- 59,62 ---- select gga_l.nodeid, latitudedegree, latitudeminutes, longitudedegree, longitudeminute, temperature, humidity, pressure ! from gga_l, xbow_weather_l where gga_l.nodeid = xbow_weather_l.nodeid; ! --- NEW FILE: sirf_id28_1.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID28_1' * message type. */ CREATE TABLE SiRF_ID28_1 ( header_seqno smallint, header_am_type smallint, header_rsrvd1 smallint, header_rsrvd2 smallint, channel smallint, time_tag integer, sat_id smallint, gps_sw_time integer); --- NEW FILE: sirf_id2_1.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID2_1' * message type. */ CREATE TABLE SiRF_ID2_1 ( header_seqno smallint, header_am_type smallint, header_rsrvd1 smallint, header_rsrvd2 smallint, xpos integer, ypos integer, zpos integer, xvel smallint, yvel smallint, zvel smallint, mode1 smallint, gps_week smallint); Index: firebug-db-setup.sh =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug-db-setup.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** firebug-db-setup.sh 19 Jun 2005 22:26:32 -0000 1.2 --- firebug-db-setup.sh 15 Jul 2005 16:37:01 -0000 1.3 *************** *** 48,51 **** --- 48,58 ---- psql --echo-queries --dbname firebug firebug < firebug.sql + psql --echo-queries --dbname firebug firebug < sirf_id2_1.pgsql + psql --echo-queries --dbname firebug firebug < sirf_id2_2.pgsql + psql --echo-queries --dbname firebug firebug < sirf_id28_1.pgsql + psql --echo-queries --dbname firebug firebug < sirf_id28_2.pgsql + psql --echo-queries --dbname firebug firebug < sirf_id28_3.pgsql + + #### The following are just examples of how to set up |
From: David M. D. <do...@us...> - 2005-07-14 16:51:06
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16894 Modified Files: fbpacket.c Added Files: genpgsql.pm Log Message: Added perl module for mig to generate postgres tables from structs defining tos msg am types. Index: fbpacket.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/fbpacket.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fbpacket.c 28 Jun 2005 20:03:48 -0000 1.1 --- fbpacket.c 14 Jul 2005 16:50:57 -0000 1.2 *************** *** 81,85 **** init_gga_data(&gga_data); // This is a royal pain in the ass because the packets ! // on the mote side are built using inheritance with // embedded headers, but on the processing side the data // is assumed to be aggregated. What a fuckin bitch for --- 81,85 ---- init_gga_data(&gga_data); // This is a royal pain in the ass because the packets ! // on the mote side are built using unions to for // embedded headers, but on the processing side the data // is assumed to be aggregated. What a fuckin bitch for --- NEW FILE: genpgsql.pm --- # This file is part of the nesC compiler. # Copyright (C) 2002 Intel Corporation # # The attached "nesC" software is provided to you under the terms and # conditions of the GNU General Public License Version 2 as published by the # Free Software Foundation. # # nesC 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 nesC; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ## TODO for autogenerating C code. ## ---------------------------------------------------------- ## Several things need to be done to make this viable for the ## kinds of messages we want to process. The first part is ## to get rid of the java type conversions, and preserve the ## structure as defined the tinyos header file. We can do this ## because nesc native types are identical to c native types. ## ## Parts of this code were written for the NSF_ITR funded ## firebug project. true; sub gen() { my ($classname, @spec) = @_; require migdecode; &decode(@spec); &usage("no classname name specified") if !defined($java_classname); $java_extends = "net.tinyos.message.Message" if !defined($java_extends); # See if name has a package specifier if ($java_classname =~ /(.*)\.([^.]*)$/) { $package = $1; $java_classname = $2; } $I = " "; $smallskip = "\n\n"; $medskip = "\n\n\n\n"; $bigskip = "\n\n\n\n\n\n"; print "/**\n"; print " * This class is automatically generated by mig. DO NOT EDIT THIS FILE.\n"; print " * This code provides postgres table to the '$java_classname'\n"; print " * message type.\n"; print " */\n\n"; &gen_sql_table(); print $medskip; } sub gen_sql_table() { print "CREATE TABLE $java_classname (\n"; # Get the size of the array. $numfields = $#fields; $i = 0; for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); # This is clunky but will work. A better way to do it would be to store # the nested struct internally in the field array somehow. # Maybe a perl guru can figure that out. # What needs to be done is to find one of these, then # store it until all the members written out, # then print it. if ($field =~ /(.*)\.([^.]*)$/) { $struct = $1; $member = $2; #print STDERR $struct;#.", "$member."\n"; } ## Gets an array of format specifiers useful in *print* functions ## in libc. the @format array can be passed push(@format, &formatstring($type, $bitlength, 0)); $field =~ s/\./_/g; printf "$I$field $ctype"; if ($i < $numfields) { print ",\n"; } $i++; } print ");"; } sub gen_struct() { print "struct _$java_classname {\n"; ## todo move this to sub print_msg_struct(). for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); # This is clunky but will work. A better way to do it would be to store # the nested struct internally in the field array somehow. # Maybe a perl guru can figure that out. # What needs to be done is to find one of these, then # store it until all the members written out, # then print it. if ($field =~ /(.*)\.([^.]*)$/) { $struct = $1; $member = $2; #print STDERR $struct;#.", "$member."\n"; } ## Gets an array of format specifiers useful in *print* functions ## in libc. the @format array can be passed push(@format, &formatstring($type, $bitlength, 0)); $field =~ s/\./_/g; printf "$I$field $ctype,\n"; } print "};"; } ## TODO Change all these back to the base types available in c, which are ## the same as in nesc. Probably need to add a "bitfield" handler to ## do it right. sub cbasetype() { my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc; # Pick the java type whose range is closest to the corresponding C type if ($basetype eq "U") { $acc = "UIntElement"; if ($bitlength < 8) { $jtype = "smallint"; } elsif ($bitlength < 16) { $jtype = "smallint"; } elsif ($bitlength < 32) { $jtype = "smallint"; } else { $jtype = "integer"; } } elsif ($basetype eq "I") { $acc = "SIntElement"; if ($bitlength <= 8) { $jtype = "smallint"; } elsif ($bitlength <= 16) { $jtype = "smallint"; } elsif ($bitlength <= 32) { $jtype = "integer"; } else { $jtype = "long"; } } elsif ($basetype eq "F" || $basetype eq "D" || $basetype eq "LD") { $acc = "FloatElement"; $jtype = "float"; } if ($arraydims > 0) { # For array types $arrayspec = ""; for ($i = 0; $i < $arraydims; $i++) { $arrayspec = "[]" . $arrayspec; } } return ($jtype, $acc, $arrayspec); } ## TODO Get rid of all the superfluous code, ## or move the functionality into cbasetype. sub formatstring() { my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc, $formatstring; # Pick the java type whose range is closest to the corresponding C type if ($basetype eq "U") { $acc = "UIntElement"; if ($bitlength < 8) { $jtype = "byte"; $formatstring = "c";} elsif ($bitlength < 16) { $jtype = "short"; $formatstring = "i";} elsif ($bitlength < 32) { $jtype = "int"; $formatstring = "i";} else { $jtype = "long"; $formatstring = "%i"} } elsif ($basetype eq "I") { $acc = "SIntElement"; if ($bitlength <= 8) { $jtype = "byte"; $formatstring = "c";} elsif ($bitlength <= 16) { $jtype = "short"; $formatstring = "i";} elsif ($bitlength <= 32) { $jtype = "int"; $formatstring = "i";} else { $jtype = "long"; } } elsif ($basetype eq "F" || $basetype eq "D" || $basetype eq "LD") { $acc = "FloatElement"; $jtype = "float"; $formatstring = "f"; } if ($arraydims > 0) { # For array types $arrayspec = ""; for ($i = 0; $i < $arraydims; $i++) { $arrayspec = "[]" . $arrayspec; } } #return ($jtype, $acc, $arrayspec, $formatstring); return ($formatstring); } sub printoffset() { my ($offset, $max, $bitsize, $aoffset, $inbits) = @_; print " int offset = $offset;\n"; for ($i = 1; $i <= @$max; $i++) { # check index bounds. 0-sized arrays don't get an upper-bound check # (they represent variable size arrays. Normally they should only # occur as the first-dimension of the last element of the structure) if ($$max[$i - 1] != 0) { print " if (index$i < 0 || index$i >= $$max[$i - 1]) throw new ArrayIndexOutOfBoundsException();\n"; } else { print " if (index$i < 0) throw new ArrayIndexOutOfBoundsException();\n"; } print " offset += $$aoffset[$i - 1] + index$i * $$bitsize[$i - 1];\n"; } if ($inbits) { print " return offset;\n"; } else { print " return (offset / 8);\n"; } } sub printarrayget() { my ($javafield, $javatype, $arrayspec, $bitlength, $amax, $abitsize) = @_; # Check whether array has known size for ($i = 0; $i < @$amax; $i++) { if ($$amax[$i] == 0) { print " throw new IllegalArgumentException(\"Cannot get field as array - unknown size\");\n"; return; } } print " $javatype$arrayspec tmp = new $javatype"; for ($i = 0; $i < @$amax; $i++) { print "[$$amax[$i]]"; } print ";\n"; $indent = " "; for ($i = 0; $i < @$amax; $i++) { print " $indent for (int index$i = 0; index$i < numElements_$javafield($i); index$i++) {\n"; $indent = $indent . " "; } $indent = $indent . " "; print " $indent tmp"; for ($i = 0; $i < @$amax; $i++) { print "[index$i]"; } print " = getElement_$javafield("; for ($i = 0; $i < @$amax; $i++) { print "index$i"; if ($i != @$amax-1) { print ","; } } print ");\n"; $indent = substr($indent, 0, length($indent)-2); for ($i = 0; $i < @$amax; $i++) { $indent = substr($indent, 0, length($indent)-2); print " $indent }\n"; } print " return tmp;\n"; } sub printarrayset() { my ($javafield, $javatype, $arrayspec, $bitlength, $amax, $abitsize) = @_; $indent = " "; $val = ""; for ($i = 0; $i < @$amax; $i++) { print " $indent for (int index$i = 0; index$i < value$val.length; index$i++) {\n"; $val = $val . "[index$i]"; $indent = $indent . " "; } $indent = $indent . " "; print " $indent setElement_$javafield("; for ($i = 0; $i < @$amax; $i++) { print "index$i"; if ($i != @$amax-1) { print ","; } } print ", value"; for ($i = 0; $i < @$amax; $i++) { print "[index$i]"; } print ");\n"; $indent = substr($indent, 0, length($indent)-2); for ($i = 0; $i < @$amax; $i++) { $indent = substr($indent, 0, length($indent)-2); print " $indent }\n"; } } |
From: David M. D. <do...@us...> - 2005-07-11 22:33:09
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28281 Added Files: .cvsignore Makefile sirf.h sirf_id2.c sirf_id28.c sirftest.c Log Message: Start of sirf parsing code. --- NEW FILE: .cvsignore --- *.o *.exe --- NEW FILE: sirf.h --- /** SiRF message processing. * * @author David M. Doolin */ #ifndef FB_SIRF_H #define FB_SIRF_H #endif /* FB_SIRF_H */ --- NEW FILE: sirftest.c --- #include "sirf.h" int main(int argc, char ** argv) { return 0; } --- NEW FILE: sirf_id2.c --- #include "sirf.h" --- NEW FILE: Makefile --- SRC = sirf_id2.c sirf_id28.c test: sirftest gcc -o sirftest sirftest.c $(SRC) clean: rm -rf *~ *.exe *.o --- NEW FILE: sirf_id28.c --- #include "sirf.h" |
From: Michael N. <mne...@us...> - 2005-07-04 03:28:34
|
Update of /cvsroot/firebug/fireboard/beta/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27692 Modified Files: Makelocal Log Message: Remove group and frequency setting. Suggest Environment variables. Index: Makelocal =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/Makelocal,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makelocal 19 Jun 2005 19:09:26 -0000 1.1 --- Makelocal 4 Jul 2005 03:28:24 -0000 1.2 *************** *** 1,6 **** ! DEFAULT_LOCAL_GROUP=0x7d ! CFLAGS += -DCC1K_DEFAULT_FREQ=CC1K_433_002_MHZ CFLAGS += -DRADIO_XMIT_POWER=0xFF --- 1,14 ---- + # The group and frequency are now expected as environment variables + # This allows different people to set them differently without changing + # the underlying source. The following is typical: + # + # export CFLAGS=-DCC1K_DEFAULT_FREQ=CC1K_915_998_MHZ + # export DEFAULT_LOCAL_GROUP=0x7d + # + # ! # DEFAULT_LOCAL_GROUP=0x7d ! # CFLAGS += -DCC1K_DEFAULT_FREQ=CC1K_433_002_MHZ CFLAGS += -DRADIO_XMIT_POWER=0xFF |
From: Michael N. <mne...@us...> - 2005-07-04 03:05:46
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16141 Modified Files: TaosPhotoM.nc Log Message: initiate packet write from a task instead of async routine Index: TaosPhotoM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/TaosPhotoM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TaosPhotoM.nc 24 May 2005 21:57:34 -0000 1.2 --- TaosPhotoM.nc 4 Jul 2005 03:05:37 -0000 1.3 *************** *** 181,184 **** --- 181,195 ---- return FAIL; } + + + // Handling the start of the write in this task has a disadvantage + // in the case that the writePacket fails. In that case code which + // calls I2CPacket.writePacket directly and used the status to return + // a result is better because it allows the caller to do error recovery. + task void readTaosADCdata() { + call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); + return; + } + /****************************************************************************** * Read Taos adc data *************** *** 186,214 **** * Cmd to read channel 1 + enable adc/power = 0x83 *****************************************************************************/ ! async command result_t ADC.getData[uint8_t id]() { ! ! ! uint8_t l_state; ! SODbg(DBG_USR2, "TaosPhoto:getData \n"); ! atomic l_state = state; ! if (l_state == IDLE){ ! if (id == 0){ ! atomic { ! tempvalue = 0x43; //read channel 0 ! state = READ_0; ! } ! return call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); ! } ! else if (id == 1){ ! atomic{ ! tempvalue = 0x83; //read channel 1 ! state = READ_1; ! } ! return call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); ! } ! } ! atomic state = IDLE; ! return FAIL; ! } /****************************************************************************** * I2C write packet complete --- 197,226 ---- * Cmd to read channel 1 + enable adc/power = 0x83 *****************************************************************************/ ! async command result_t ADC.getData[uint8_t id]() { ! uint8_t l_state; ! SODbg(DBG_USR2, "TaosPhoto:getData \n"); ! atomic l_state = state; ! if (l_state == IDLE){ ! if (id == 0){ ! atomic { ! tempvalue = 0x43; //read channel 0 ! state = READ_0; ! } ! post readTaosADCdata(); ! return SUCCESS; ! } ! else if (id == 1) { ! atomic{ ! tempvalue = 0x83; //read channel 1 ! state = READ_1; ! } ! post readTaosADCdata(); ! return SUCCESS; ! }; ! }; ! atomic state = IDLE; ! return FAIL; ! } ! /****************************************************************************** * I2C write packet complete |
From: Michael N. <mne...@us...> - 2005-07-04 02:55:52
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10819 Modified Files: IntersemaPressureM.nc Log Message: initiate lower controls from a task Index: IntersemaPressureM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/IntersemaPressureM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntersemaPressureM.nc 24 May 2005 21:57:34 -0000 1.2 --- IntersemaPressureM.nc 4 Jul 2005 02:55:43 -0000 1.3 *************** *** 270,273 **** --- 270,279 ---- + // Initiate temperature sample + task void lowerTemperatureStart() { + call LowerControl.start(); + call LowerTemp.getData(); + return; + } /****************************************************************************** *************** *** 280,285 **** { atomic state = BUSY; ! call LowerControl.start(); ! call LowerTemp.getData(); return SUCCESS; } --- 286,290 ---- { atomic state = BUSY; ! post lowerTemperatureStart(); return SUCCESS; } *************** *** 293,296 **** --- 298,308 ---- } + // Initiate pressure sample + task void lowerPressureStart() { + call LowerControl.start(); + call LowerPressure.getData(); + return; + } + async command result_t Pressure.getData() { char l_state; *************** *** 303,308 **** iostate = IOON; } ! call LowerControl.start(); ! call LowerPressure.getData(); return SUCCESS; } --- 315,319 ---- iostate = IOON; } ! post lowerPressureStart(); return SUCCESS; } |
From: Michael N. <mne...@us...> - 2005-07-04 02:34:22
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv968 Modified Files: SensirionHumidityM.nc Log Message: async calls to set switches moved to tasks Index: SensirionHumidityM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/SensirionHumidityM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SensirionHumidityM.nc 24 May 2005 21:57:34 -0000 1.2 --- SensirionHumidityM.nc 4 Jul 2005 02:34:14 -0000 1.3 *************** *** 186,190 **** if (l_state == OPENSCK) { //SCK line enabled atomic state = OPENDATA; ! return call SwitchI2W.set(MICAWB_HUMIDITY_DATA,1); } else if (l_state == OPENDATA) { //Data line enabled atomic state = TIMER; --- 186,190 ---- if (l_state == OPENSCK) { //SCK line enabled atomic state = OPENDATA; ! return call SwitchI2W.set(MICAWB_HUMIDITY_DATA,1); } else if (l_state == OPENDATA) { //Data line enabled atomic state = TIMER; *************** *** 194,198 **** } else if (l_state == CLOSESCK) { atomic state = CLOSEDATA; ! return call SwitchI2W.set(MICAWB_HUMIDITY_DATA,0); } else if (l_state == CLOSEDATA) { uint16_t l_result; --- 194,198 ---- } else if (l_state == CLOSESCK) { atomic state = CLOSEDATA; ! return call SwitchI2W.set(MICAWB_HUMIDITY_DATA,0); } else if (l_state == CLOSEDATA) { uint16_t l_result; *************** *** 248,251 **** --- 248,261 ---- } + task void setHumiditySCLKon() { + call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,1); + return; + } + + task void setHumiditySCLKoff() { + call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,0); + return; + } + async command result_t Humidity.getData() { char l_state; *************** *** 257,261 **** state = OPENSCK; } ! return call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,1); } atomic state = IDLE; --- 267,272 ---- state = OPENSCK; } ! post setHumiditySCLKon(); ! return SUCCESS; } atomic state = IDLE; *************** *** 272,276 **** state = OPENSCK; } ! return call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,1); } atomic state = IDLE; --- 283,288 ---- state = OPENSCK; } ! post setHumiditySCLKon(); ! return SUCCESS; } atomic state = IDLE; *************** *** 298,302 **** if (l_state == BUSY) { atomic state = CLOSESCK; ! return call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,0); } return SUCCESS; --- 310,315 ---- if (l_state == BUSY) { atomic state = CLOSESCK; ! post setHumiditySCLKoff(); ! return SUCCESS; } return SUCCESS; *************** *** 318,322 **** if (l_state == BUSY) { atomic state = CLOSESCK; ! return call SwitchI2W.set(MICAWB_HUMIDITY_SCLK,0); } return SUCCESS; --- 331,336 ---- if (l_state == BUSY) { atomic state = CLOSESCK; ! post setHumiditySCLKoff(); ! return SUCCESS; } return SUCCESS; |
From: Michael N. <mne...@us...> - 2005-07-03 11:50:41
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830 Modified Files: TempHumM.nc Log Message: processCommand now syncronous, comments added about issues Index: TempHumM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/TempHumM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TempHumM.nc 24 May 2005 21:57:34 -0000 1.2 --- TempHumM.nc 3 Jul 2005 11:50:29 -0000 1.3 *************** *** 61,65 **** /* * ! * Authors: Mohammad Rahmim, Joe Polastre * * $Id$ --- 61,65 ---- /* * ! * Authors: Mohammad Rahmim, Joe Polastre, Michael Newman * * $Id$ *************** *** 166,173 **** * -Enable SDA as interrupt, this line goes low when Sensirion completes measurement ******************************************************************************/ ! static inline char processCommand(int cmd) { int i; ! int CMD = cmd; cmd &= 0x1f; HUMIDITY_INT_DISABLE(); --- 166,195 ---- * -Enable SDA as interrupt, this line goes low when Sensirion completes measurement ******************************************************************************/ ! task void processCommand() { + int currentState; + int cmd; + int currentCMD; int i; ! ! atomic { ! currentState = state; ! } ! switch (currentState) { ! case TEMP_MEASUREMENT: ! cmd = TOSH_HUMIDTEMP_ADDR; ! break; ! case READY: ! cmd = TOSH_HUMIDITY_RESET; ! break; ! case HUM_MEASUREMENT: ! cmd = TOSH_HUMIDITY_ADDR; ! break; ! default: ! case POWER_OFF: ! return; ! ! }; ! currentCMD = cmd; cmd &= 0x1f; HUMIDITY_INT_DISABLE(); *************** *** 194,212 **** reset(); atomic errornum = 2; ! if ((CMD == TOSH_HUMIDITY_ADDR) && (humerror == TRUE)) post signalHumError(); ! else if ((CMD == TOSH_HUMIDTEMP_ADDR) && (temperror == TRUE)) post signalTempError(); ! return 0; } TOSH_wait_250ns(); HUMIDITY_CLEAR_CLOCK(); ! if((CMD == TOSH_HUMIDITY_ADDR) || (CMD == TOSH_HUMIDTEMP_ADDR) ){ ! if ((CMD == TOSH_HUMIDITY_ADDR) && (humerror == TRUE)) { SODbg(DBG_USR2, "TempHumM.processCommand: cmd complete, starting timer for measurement \n"); atomic timeout = 0; call Timer.start(TIMER_REPEAT, HUMIDITY_TIMEOUT_MS); } ! else if ((CMD == TOSH_HUMIDTEMP_ADDR) && (temperror == TRUE)) { atomic timeout = 0; call Timer.start(TIMER_REPEAT, HUMIDITY_TIMEOUT_MS); --- 216,234 ---- reset(); atomic errornum = 2; ! if ((currentCMD == TOSH_HUMIDITY_ADDR) && (humerror == TRUE)) post signalHumError(); ! else if ((currentCMD == TOSH_HUMIDTEMP_ADDR) && (temperror == TRUE)) post signalTempError(); ! return; } TOSH_wait_250ns(); HUMIDITY_CLEAR_CLOCK(); ! if((currentCMD == TOSH_HUMIDITY_ADDR) || (currentCMD == TOSH_HUMIDTEMP_ADDR) ){ ! if ((currentCMD == TOSH_HUMIDITY_ADDR) && (humerror == TRUE)) { SODbg(DBG_USR2, "TempHumM.processCommand: cmd complete, starting timer for measurement \n"); atomic timeout = 0; call Timer.start(TIMER_REPEAT, HUMIDITY_TIMEOUT_MS); } ! else if ((currentCMD == TOSH_HUMIDTEMP_ADDR) && (temperror == TRUE)) { atomic timeout = 0; call Timer.start(TIMER_REPEAT, HUMIDITY_TIMEOUT_MS); *************** *** 215,219 **** HumidityIntEnable(); } ! return 1; } --- 237,241 ---- HumidityIntEnable(); } ! return; } *************** *** 237,241 **** sbi(EICRA, ISC31); reset(); ! processCommand(TOSH_HUMIDITY_RESET); return SUCCESS; } --- 259,263 ---- sbi(EICRA, ISC31); reset(); ! post processCommand(); return SUCCESS; } *************** *** 356,364 **** async command result_t TempSensor.getData() { ! atomic{ ! if(state!= READY ) reset(); ! state=TEMP_MEASUREMENT; ! processCommand(TOSH_HUMIDTEMP_ADDR); ! } return SUCCESS; } --- 378,401 ---- async command result_t TempSensor.getData() { ! char oldState; ! atomic { ! oldState = state; ! if (state == READY) { ! state = TEMP_MEASUREMENT; ! }; ! }; ! if (oldState != READY) { ! // ??? the original code would call reset() at this point and ! // go forward. Now that processCommand() is a task and called ! // synchronously doing a reset at this point has the risk ! // that the processCommand task will be invoked many times ! // possibly inducing a stack or task queue overflow. This ! // code has the potential issue that it never does a reset ! // and locks up internally. ! SODbg(DBG_USR2, "TempHumM.getData: busy when trying to get temperature data \n"); ! return FAIL; ! }; ! SODbg(DBG_USR2, "TempHumM.getData: starting to get temperature data \n"); ! post processCommand(); return SUCCESS; } *************** *** 366,376 **** async command result_t HumSensor.getData() { ! atomic{ ! if(state!= READY ) reset(); ! SODbg(DBG_USR2, "TempHumM.getData: starting to get humidity data \n"); ! state=HUM_MEASUREMENT; ! processCommand(TOSH_HUMIDITY_ADDR); ! } ! return SUCCESS; } --- 403,427 ---- async command result_t HumSensor.getData() { ! char oldState; ! atomic { ! oldState = state; ! if (state == READY) { ! state = HUM_MEASUREMENT; ! }; ! }; ! if (oldState != READY) { ! // ??? the original code would call reset() at this point and ! // go forward. Now that processCommand() is a task and called ! // synchronously doing a reset at this point has the risk ! // that the processCommand task will be invoked many times ! // possibly inducing a stack or task queue overflow. This ! // code has the potential issue that it never does a reset ! // and locks up internally. ! SODbg(DBG_USR2, "TempHumM.getData: busy when trying to get humidity data \n"); ! return FAIL; ! }; ! SODbg(DBG_USR2, "TempHumM.getData: starting to get humidity data \n"); ! post processCommand(); ! return SUCCESS; } |
From: David M. D. <do...@us...> - 2005-06-28 20:04:40
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29067 Added Files: genc.pm Log Message: Added perl module for autogenning c code from tos structs. --- NEW FILE: genc.pm --- # This file is part of the nesC compiler. # Copyright (C) 2002 Intel Corporation # # The attached "nesC" software is provided to you under the terms and # conditions of the GNU General Public License Version 2 as published by the # Free Software Foundation. # # nesC 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 nesC; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ## TODO for autogenerating C code. ## ---------------------------------------------------------- ## Several things need to be done to make this viable for the ## kinds of messages we want to process. The first part is ## to get rid of the java type conversions, and preserve the ## structure as defined the tinyos header file. We can do this ## because nesc native types are identical to c native types. ## ## Parts of this code were written for the NSF_ITR funded ## firebug project. true; sub gen() { my ($classname, @spec) = @_; require migdecode; &decode(@spec); &usage("no classname name specified") if !defined($java_classname); $java_extends = "net.tinyos.message.Message" if !defined($java_extends); # See if name has a package specifier if ($java_classname =~ /(.*)\.([^.]*)$/) { $package = $1; $java_classname = $2; } $I = " "; $smallskip = "\n\n"; $medskip = "\n\n\n\n"; $bigskip = "\n\n\n\n\n\n"; print "/**\n"; print " * This class is automatically generated by mig. DO NOT EDIT THIS FILE.\n"; print " * This code implements C interface to the '$java_classname'\n"; print " * message type.\n"; print " */\n\n"; print "#include <stdio.h>\n"; print "#include <stdlib.h>\n"; print "#include <memory.h>\n"; print $medskip; print "/** Private header is programmer specified for handling\n"; print " * conversion functions, etc.\n */\n"; print "//#include \"$java_classname\_private.h\"\n"; print $medskip; print "/** These need to be moved to a header file. */\n"; print "typedef struct _$java_classname $java_classname;\n"; print "typedef struct _XbowSensorboardPacket XbowSensorboardPacket;\n"; print $smallskip; print "// This struct is defined to keep gcc happy while the module\n"; print "// is under development. At some point in the near future, a\n"; print "// a convention for passing arguments into the functions will\n"; print "// have to be defined.\n"; print "struct _XbowSensorboardPacket {\n"; print " unsigned char data[29];\n"; print "};\n"; print $medskip; # print "struct _$java_classname {\n"; # for (@fields) { # ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; # ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); # if ($field =~ /(.*)\.([^.]*)$/) { # $struct = $1; # $member = $2; # } # push(@format, &formatstring($type, $bitlength, 0)); # $field =~ s/\./_/g; # printf "$I$ctype $field;\n"; # } # print "};"; &gen_struct(); print $medskip; &gen_get_set(); print $medskip; ## Default behavior is to return the input as output. ## User is responsible for "cooking" the data. for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); $field =~ s/\./_/g; print "/** \@brief Default behavior is to return the input as output.\n"; print " * User is responsible for \"cooking\" the data.\n */\n"; print "static $ctype\n"; print "$field\_convert($ctype $field) {\n"; print " return $field;\n"; print "}\n\n"; } ## Function for cooking whole packet. Fields are ## by calling the individual "cook" functions for ## each member. print "void\n"; print "$java_classname\_cook\_packet($java_classname * userdata) {\n"; for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); $field =~ s/\./_/g; print " userdata->$field = $field\_convert(userdata->$field);\n"; } print "}\n\n"; print $medskip; print "//Format string can be generated automatically,\n"; print "//then the delimiters added later: @format\n"; print $medskip; ## In the code for the xlisten boards, the conversions are ## in the print statement. If the conversions were done ## before the print statement, then the conversion function ## becomes the only function needing to be stubbed. The ## runtime differences are neglible. print "/** User has to fill in any conversion code\n"; print " * necessary for processing.\n"; print " */\n"; print "$java_classname * convert(char * data) {\n"; print " // Just to keep gcc happy.\n"; print " return ($java_classname*)data;\n"; print "}\n"; print $medskip; ## Start printing output functions. print "/** Print the bytes of the packet. */\n"; print "void $java_classname\_print\_raw (XbowSensorboardPacket *packet) {\n\n"; print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; print "}\n\n"; print "/** Print typed output. */\n"; print "void $java_classname\_print\_cooked (XbowSensorboardPacket *packet) {\n\n"; print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; print "}\n\n"; print "/** Print cooked with tabs. */\n"; print "void $java_classname\_print\_tabbed (XbowSensorboardPacket *packet) {\n\n"; print "$I$java_classname * userdata = ($java_classname*)packet->data;\n"; print "}\n\n"; # print "package $package;\n\n" if $package; # print "public class $java_classname extends $java_extends {\n\n"; print "/** The default size of this message type in bytes. */\n"; print "static int DEFAULT_MESSAGE_SIZE = $size;\n\n"; print "/** The Active Message type associated with this message. */\n"; print "static int AM_TYPE = $amtype;\n\n"; print "/** If incomplete types are used, we need to provide a way\n"; print " * to manage memory.\n"; print " */\n"; print "$java_classname *\n"; print "$java_classname\_new() {\n"; print " $java_classname * userdata = ($java_classname*)malloc(sizeof($java_classname));\n"; print " memset((void*)userdata,0xda,sizeof($java_classname));\n"; print " return userdata;\n"; print "}\n"; print $medskip; print "void\n"; print "$java_classname\_delete($java_classname * userdata) {\n"; print " memset((void*)userdata,0xdd,sizeof($java_classname));\n"; print " free(userdata);\n"; print "}\n"; } sub gen_struct() { print "struct _$java_classname {\n"; ## todo move this to sub print_msg_struct(). for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); # This is clunky but will work. A better way to do it would be to store # the nested struct internally in the field array somehow. # Maybe a perl guru can figure that out. # What needs to be done is to find one of these, then # store it until all the members written out, # then print it. if ($field =~ /(.*)\.([^.]*)$/) { $struct = $1; $member = $2; #print STDERR $struct;#.", "$member."\n"; } ## Gets an array of format specifiers useful in *print* functions ## in libc. the @format array can be passed push(@format, &formatstring($type, $bitlength, 0)); $field =~ s/\./_/g; printf "$I$ctype $field;\n"; } print "};"; } sub gen_get_set() { ## The get/set code is more to investigate the mechanics of ## the autogeneration of structs. It's probably more useful ## use the defined type directly, at least for now. ## ## todo move this to sub_get_set_methods() for (@fields) { ($field, $type, $bitlength, $offset, $amax, $abitsize, $aoffset) = @{$_}; ($ctype, $java_access, $arrayspec) = &cbasetype($type, $bitlength, 0); $field =~ s/\./_/g; print "void\n"; print "$java_classname\_set\_$field($java_classname * userdata, $ctype $field) {\n"; print " userdata->$field = $field;\n"; print "}\n\n"; #### Get methods print "$ctype\n"; print "$java_classname\_get\_$field($java_classname * userdata) {\n"; print " return userdata->$field;\n"; print "}\n\n"; } } ## TODO Change all these back to the base types available in c, which are ## the same as in nesc. Probably need to add a "bitfield" handler to ## do it right. sub cbasetype() { my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc; # Pick the java type whose range is closest to the corresponding C type if ($basetype eq "U") { $acc = "UIntElement"; if ($bitlength < 8) { $jtype = "unsigned char"; } elsif ($bitlength < 16) { $jtype = "uint8_t"; } elsif ($bitlength < 32) { $jtype = "uint16_t"; } else { $jtype = "uint32_t"; } } elsif ($basetype eq "I") { $acc = "SIntElement"; if ($bitlength <= 8) { $jtype = "char"; } elsif ($bitlength <= 16) { $jtype = "short"; } elsif ($bitlength <= 32) { $jtype = "int"; } else { $jtype = "long"; } } elsif ($basetype eq "F" || $basetype eq "D" || $basetype eq "LD") { $acc = "FloatElement"; $jtype = "float"; } if ($arraydims > 0) { # For array types $arrayspec = ""; for ($i = 0; $i < $arraydims; $i++) { $arrayspec = "[]" . $arrayspec; } } return ($jtype, $acc, $arrayspec); } ## TODO Get rid of all the superfluous code, ## or move the functionality into cbasetype. sub formatstring() { my ($basetype, $bitlength, $arraydims) = @_; my $jtype, $acc, $formatstring; # Pick the java type whose range is closest to the corresponding C type if ($basetype eq "U") { $acc = "UIntElement"; if ($bitlength < 8) { $jtype = "byte"; $formatstring = "c";} elsif ($bitlength < 16) { $jtype = "short"; $formatstring = "i";} elsif ($bitlength < 32) { $jtype = "int"; $formatstring = "i";} else { $jtype = "long"; $formatstring = "%i"} } elsif ($basetype eq "I") { $acc = "SIntElement"; if ($bitlength <= 8) { $jtype = "byte"; $formatstring = "c";} elsif ($bitlength <= 16) { $jtype = "short"; $formatstring = "i";} elsif ($bitlength <= 32) { $jtype = "int"; $formatstring = "i";} else { $jtype = "long"; } } elsif ($basetype eq "F" || $basetype eq "D" || $basetype eq "LD") { $acc = "FloatElement"; $jtype = "float"; $formatstring = "f"; } if ($arraydims > 0) { # For array types $arrayspec = ""; for ($i = 0; $i < $arraydims; $i++) { $arrayspec = "[]" . $arrayspec; } } #return ($jtype, $acc, $arrayspec, $formatstring); return ($formatstring); } sub printoffset() { my ($offset, $max, $bitsize, $aoffset, $inbits) = @_; print " int offset = $offset;\n"; for ($i = 1; $i <= @$max; $i++) { # check index bounds. 0-sized arrays don't get an upper-bound check # (they represent variable size arrays. Normally they should only # occur as the first-dimension of the last element of the structure) if ($$max[$i - 1] != 0) { print " if (index$i < 0 || index$i >= $$max[$i - 1]) throw new ArrayIndexOutOfBoundsException();\n"; } else { print " if (index$i < 0) throw new ArrayIndexOutOfBoundsException();\n"; } print " offset += $$aoffset[$i - 1] + index$i * $$bitsize[$i - 1];\n"; } if ($inbits) { print " return offset;\n"; } else { print " return (offset / 8);\n"; } } sub printarrayget() { my ($javafield, $javatype, $arrayspec, $bitlength, $amax, $abitsize) = @_; # Check whether array has known size for ($i = 0; $i < @$amax; $i++) { if ($$amax[$i] == 0) { print " throw new IllegalArgumentException(\"Cannot get field as array - unknown size\");\n"; return; } } print " $javatype$arrayspec tmp = new $javatype"; for ($i = 0; $i < @$amax; $i++) { print "[$$amax[$i]]"; } print ";\n"; $indent = " "; for ($i = 0; $i < @$amax; $i++) { print " $indent for (int index$i = 0; index$i < numElements_$javafield($i); index$i++) {\n"; $indent = $indent . " "; } $indent = $indent . " "; print " $indent tmp"; for ($i = 0; $i < @$amax; $i++) { print "[index$i]"; } print " = getElement_$javafield("; for ($i = 0; $i < @$amax; $i++) { print "index$i"; if ($i != @$amax-1) { print ","; } } print ");\n"; $indent = substr($indent, 0, length($indent)-2); for ($i = 0; $i < @$amax; $i++) { $indent = substr($indent, 0, length($indent)-2); print " $indent }\n"; } print " return tmp;\n"; } sub printarrayset() { my ($javafield, $javatype, $arrayspec, $bitlength, $amax, $abitsize) = @_; $indent = " "; $val = ""; for ($i = 0; $i < @$amax; $i++) { print " $indent for (int index$i = 0; index$i < value$val.length; index$i++) {\n"; $val = $val . "[index$i]"; $indent = $indent . " "; } $indent = $indent . " "; print " $indent setElement_$javafield("; for ($i = 0; $i < @$amax; $i++) { print "index$i"; if ($i != @$amax-1) { print ","; } } print ", value"; for ($i = 0; $i < @$amax; $i++) { print "[index$i]"; } print ");\n"; $indent = substr($indent, 0, length($indent)-2); for ($i = 0; $i < @$amax; $i++) { $indent = substr($indent, 0, length($indent)-2); print " $indent }\n"; } } |
From: David M. D. <do...@us...> - 2005-06-28 20:03:57
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28569 Modified Files: Makefile xdb.c Added Files: fbpacket.c Log Message: Added code for performance testing of xlisten. Index: xdb.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xdb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** xdb.c 19 Jun 2005 23:03:53 -0000 1.7 --- xdb.c 28 Jun 2005 20:03:48 -0000 1.8 *************** *** 77,80 **** --- 77,81 ---- } + /** * Executes the given SQL command through the Postgres library (libpq) *************** *** 87,94 **** * */ ! int xdb_execute(char *command) ! { int errno = 0; ! printf("%s\n", command); PGconn *conn = xdb_connect(); --- 88,96 ---- * */ ! int ! xdb_execute(char *command) { ! int errno = 0; ! //printf("%s\n", command); PGconn *conn = xdb_connect(); *************** *** 177,180 **** --- 179,184 ---- + // FIXME: If db exists, make sure to set the + // default name to that db name. int xdb_db_exists(const char * dbname) { --- NEW FILE: fbpacket.c --- /** * $Id: fbpacket.c,v 1.1 2005/06/28 20:03:48 doolin Exp $ */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <time.h> #include <sys/times.h> #include "xdb.h" #include "xsensors.h" #include "boards/fireboard.h" #include "args.h" /* uint8_t hours; uint8_t minutes; uint8_t Lat_deg; uint8_t Long_deg; float dec_sec; float Lat_dec_min; float Long_dec_min; uint8_t NSEWind; uint8_t fixQuality; uint8_t num_sats; */ // This next block is required to get the program to // link, has no use in the program. const char *g_version = "$Id: fbpacket.c,v 1.1 2005/06/28 20:03:48 doolin Exp $"; int g_istream; //!< Handle of input stream int xmain_get_verbose(s_params * g_params) { //return !g_params->bits.mode_quiet; return 0; } // end useless block /* Function call adds 1 clock_t to each cycle * through the loop compared to setting the * values in the loop. */ void init_gga_data(GGA_Data * gga_data) { gga_data->hours = 1; gga_data->minutes = 1; gga_data->Lat_deg = 1; gga_data->Long_deg = 1; gga_data->dec_sec = 1; gga_data->Lat_dec_min = 1; gga_data->Long_dec_min = 1; gga_data->NSEWind = 1; gga_data->fixQuality = 1; gga_data->num_sats = 1; } /** Clocking code is shitty, should be abstracted * out into a set of small useful functions, or * use a more convenient libc API. */ int main(int argc, char **argv) { int i; //struct tms tms_start, tms_end; clock_t start, stop; GGA_Data gga_data = {0}; XbowSensorboardPacket packet = {0}; start = clock(); printf("start: %d\n",start); init_gga_data(&gga_data); // This is a royal pain in the ass because the packets // on the mote side are built using inheritance with // embedded headers, but on the processing side the data // is assumed to be aggregated. What a fuckin bitch for // writing test code. memcpy(packet.data,&gga_data,sizeof(packet.data)); for (i=0; i<100; i++) { fb_pg_log_gga_data(&packet); } stop = clock(); printf("stop: %d\n",stop); printf("clocks per sec: %d\n", CLOCKS_PER_SEC); printf("Elapsed time: %f\n", ((float)(stop - start)/CLOCKS_PER_SEC)); return 0; } Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 19 Jun 2005 22:28:33 -0000 1.8 --- Makefile 28 Jun 2005 20:03:48 -0000 1.9 *************** *** 9,13 **** # Main xlisten sources ! SRCS = xlisten.c xpacket.c xconvert.c xdb.c SRCS += xserial.c xsocket.c args.c --- 9,13 ---- # Main xlisten sources ! SRCS = xpacket.c xconvert.c xdb.c SRCS += xserial.c xsocket.c args.c *************** *** 19,22 **** --- 19,23 ---- + INCLUDES = -I../../../tos/sensorboards/mts400/GPS INCLUDES += -I../../../apps/XSensorMTS400 *************** *** 37,44 **** SRCS += timestamp/timestamp.c ! all: xlisten xlisten: $(SRCS) ! $(CC) $(CFLAGS) -o $@ $(SRCS) $(INCLUDES) $(LFLAGS) xlisten-arm: $(SRCS) --- 38,48 ---- SRCS += timestamp/timestamp.c ! all: xlisten fbpacket xlisten: $(SRCS) ! $(CC) $(CFLAGS) -o $@ xlisten.c $(SRCS) $(INCLUDES) $(LFLAGS) ! ! fbpacket: fbpacket.c ! $(CC) $(CFLAGS) -o $@ fbpacket.c $(SRCS) $(INCLUDES) $(LFLAGS) xlisten-arm: $(SRCS) *************** *** 46,48 **** clean: ! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe --- 50,52 ---- clean: ! rm -f *.o boards/*.o xlisten xlisten-arm xlisten.exe fbpacket.exe |
From: David M. D. <do...@us...> - 2005-06-28 20:03:57
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28569/boards Modified Files: fireboard.c pg_test.c Log Message: Added code for performance testing of xlisten. Index: pg_test.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/pg_test.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pg_test.c 19 Jun 2005 23:03:54 -0000 1.9 --- pg_test.c 28 Jun 2005 20:03:49 -0000 1.10 *************** *** 12,16 **** - // TODO: Change these to cooked values. // TODO: Remove the SQL command. const char *fb_pg_weather_schema = --- 12,15 ---- *************** *** 44,47 **** --- 43,47 ---- + static char pg_statement[512]; Index: fireboard.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/fireboard.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** fireboard.c 19 Jun 2005 22:28:33 -0000 1.13 --- fireboard.c 28 Jun 2005 20:03:49 -0000 1.14 *************** *** 788,792 **** ! /** This is xbow code. */ const char *fireboard_db_create_table = --- 788,792 ---- ! //#if 0 /** This is xbow code. */ const char *fireboard_db_create_table = *************** *** 806,810 **** "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " "INSERT INTO %s_L VALUES (NEW.*); )"; ! --- 806,810 ---- "DELETE FROM %s_L WHERE nodeid = NEW.nodeid; " "INSERT INTO %s_L VALUES (NEW.*); )"; ! //#endif *************** *** 969,996 **** } case AM_GGA_DATA:{ - #if 1 fb_pg_log_gga_data(packet); return; - #else - GGA_Data * data = (GGA_Data*)packet->data; - sprintf(command, - "INSERT into %s " - "(result_time,nodeid,parent,Hours,Minutes,seconds," - "Latitudedegree,Latitudeminutes,Longitudedegree,Longitudeminute," - "NSEWind)" - " values (now(),%u,%u,%u,%u,%f,%u,%f,%u,%f,%u)", - table, - packet->node_id, - packet->parent, - data->hours, - data->minutes, - data->dec_sec, - data->Lat_deg, - data->Lat_dec_min, - data->Long_deg, - data->Long_dec_min, - data->NSEWind); - break; - #endif } case 3: { --- 969,974 ---- |
From: David M. D. <do...@us...> - 2005-06-23 17:43:19
|
Update of /cvsroot/firebug/firebug/web/photos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27977/photos Log Message: Directory /cvsroot/firebug/firebug/web/photos added to the repository |
From: David M. D. <do...@us...> - 2005-06-20 21:55:04
|
Update of /cvsroot/firebug/firebug/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30111 Modified Files: google_rfs.xml index.php links.php Added Files: pictures.php Log Message: Added link to point pinole pictures. Index: google_rfs.xml =================================================================== RCS file: /cvsroot/firebug/firebug/web/google_rfs.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** google_rfs.xml 8 Jun 2005 22:29:42 -0000 1.5 --- google_rfs.xml 20 Jun 2005 21:54:55 -0000 1.6 *************** *** 42,46 **** </address> <image> ! http://libgmail.sourceforge.net/spider.png </image> </info> --- 42,46 ---- </address> <image> ! /firebug/gmaps/images/sitar.jpg </image> </info> *************** *** 51,57 **** <icon image="http://maps.google.com/mapfiles/marker.png" class="local"/> <info> ! <title xml:space="preserve">Dave and Karthik</title> <address> ! <line>Dave and Karthik</line> <line>Building 454, Room 124</line> </address> --- 51,57 ---- <icon image="http://maps.google.com/mapfiles/marker.png" class="local"/> <info> ! <title xml:space="preserve">Dave and Kar</title> <address> ! <line>Dave and Kar</line> <line>Building 454, Room 124</line> </address> *************** *** 78,81 **** </location> </overlay> ! </page> \ No newline at end of file --- 78,131 ---- </location> + + <location infoStyle="minipage.xsl" id="E"> + <point lat="37.784600" lng="-122.404000"/> + <icon image="http://localhost/firebug/images/sensor.png" class="local"/> + <info> + + <minipage> + <p style="font-size:small;font-family:sans-serif;">This image has nothing to do with this location, but it could:</p> + <div style="text-align:center;"><img src="http://libgmail.sourceforge.net/spider.png" width="80" height="80"/></div> + <p style="font-size:small;font-family:sans-serif;">Some reasons to display custom HTML on Google Maps: + <ul> + <li><img src="images/redled.gif"/>Fun</li> + <li>Boredom</li> + <li>Fame</li> + <li>Imagemania</li> + </ul></p> + </minipage> + + <title xml:space="preserve"> + <b>Metreon</b> a <b>Sony</b> Entertainment Center</title> + + <address> + <line>101 4th St</line> + <line>San Francisco, CA 94103</line> + </address> + + <phone>(415) 369-6030</phone> + <distance>1.0 mi NE</distance> + + <description> + + <references count="4"> + <reference> + <url>http://www.metreon.com/</url> + <domain>metreon.com</domain> + <title xml:space="preserve"> + <b>SONY</b> :: <b>METREON</b> //</title> + </reference> + </references> + + </description> + + + <url>http://local.google.com/local?q=sony+metreon&near=san+francisco&latlng=37775000,-122418333,18000299367088279420</url> + </info> + + </location> + + </overlay> ! </page> ! --- NEW FILE: pictures.php --- <html> <head> <link type="text/css" rel="stylesheet" href="firebug.css"> <link rel="SHORTCUT ICON" href="./images/favicon.ico"> <title> FireBug </title> </head> <body> <?php include("header.php"); ?> <h1>Digital photoes from Point Pinole</h1> <p> <center> <img src="./images/pinole/stage3_1_small.jpg" /> <br /> <img src="./images/pinole/stage3_2_small.jpg" /> <br /> <img src="./images/pinole/stage3_3_small.jpg" /> <br /> <img src="./images/pinole/stage3_4_small.jpg" /> <br /> <img src="./images/pinole/stage3_5_small.jpg" /> <br /> <img src="./images/pinole/stage3_6_small.jpg" /> <br /> </center> </p> </body> </html> Index: links.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/links.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** links.php 3 Aug 2004 01:35:41 -0000 1.2 --- links.php 20 Jun 2005 21:54:55 -0000 1.3 *************** *** 13,17 **** <center> <font color = "#0033CC"> ! |<a href="./index.php">Home</a>|<a href="./overview.php">Overview</a>|<a href="./architecture.php">System Architecture</a>|<a href="./mote.php">The Mote</a>|<a href="./gps.php">GPS</a>|<a href ="./monitoring.php">Deployment</a>|<a href="./people.php">People</a>|<a href="./publications.php">Publications</a>|<br /> </font> </center> --- 13,27 ---- <center> <font color = "#0033CC"> ! ! | <a href="./index.php">Home</a> ! | <a href="./overview.php">Overview</a> ! | <a href="./architecture.php">System Architecture</a> ! | <a href="./mote.php">The Mote</a> ! | <a href="./gps.php">GPS</a> ! | <a href="./pictures.php">Pictures</a> ! | <a href ="./monitoring.php">Deployment</a> ! | <a href="./people.php">People</a> ! | <a href="./publications.php">Publications</a> |<br /> ! </font> </center> Index: index.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/index.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.php 23 Aug 2004 05:44:05 -0000 1.6 --- index.php 20 Jun 2005 21:54:55 -0000 1.7 *************** *** 26,30 **** <center> ! <img src="images/forestfire_small.jpg"> </center> --- 26,30 ---- <center> ! <img src="images/pinole/stage3_2_small.jpg" width="300"> </center> |