[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestFtsp Makefile, 1.1, 1.2 TestFtspAppC.nc, 1.1, 1.2 TestFtspC.nc, 1.1, 1.2
David Gay
idgay at users.sourceforge.net
Wed Jul 2 10:44:59 PDT 2008
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestLpl Makefile, NONE, 1.1 README.txt, NONE, 1.1 TestLplAppC.nc, NONE, 1.1 TestLplC.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/safe/include annots_stage1.h, 1.10, 1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23877
Modified Files:
Makefile TestFtspAppC.nc TestFtspC.nc
Log Message:
reversing the C/AppC convention is confusing
Index: Makefile
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile 2 Jul 2008 17:42:42 -0000 1.1
--- Makefile 2 Jul 2008 17:44:57 -0000 1.2
***************
*** 8,12 ****
mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=TestFtspMsg TestFtsp.h test_ftsp_msg -o $@
! COMPONENT=TestFtspC
PFLAGS += -DTIMESYNC_RATE=3
--- 8,12 ----
mig java -target=$(PLATFORM) $(CFLAGS) -java-classname=TestFtspMsg TestFtsp.h test_ftsp_msg -o $@
! COMPONENT=TestFtspAppC
PFLAGS += -DTIMESYNC_RATE=3
Index: TestFtspAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp/TestFtspAppC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestFtspAppC.nc 2 Jul 2008 17:42:42 -0000 1.1
--- TestFtspAppC.nc 2 Jul 2008 17:44:57 -0000 1.2
***************
*** 26,87 ****
#include "RadioCountToLeds.h"
! module TestFtspAppC
! {
! uses
! {
! interface GlobalTime<TMilli>;
! interface TimeSyncInfo;
! interface Receive;
! interface AMSend;
! interface Packet;
! interface Leds;
! interface PacketTimeStamp<TMilli,uint32_t>;
! interface Boot;
! interface SplitControl as RadioControl;
! }
}
! implementation
! {
! message_t msg;
! bool locked = FALSE;
!
! event void Boot.booted() {
! call RadioControl.start();
! }
!
! event message_t* Receive.receive(message_t* msgPtr, void* payload, uint8_t len)
! {
! call Leds.led0Toggle();
! if (!locked && call PacketTimeStamp.isValid(msgPtr)) {
! radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(msgPtr, sizeof(radio_count_msg_t));
! test_ftsp_msg_t* report = (test_ftsp_msg_t*)call Packet.getPayload(&msg, sizeof(test_ftsp_msg_t));
! uint32_t rxTimestamp = call PacketTimeStamp.timestamp(msgPtr);
! report->src_addr = TOS_NODE_ID;
! report->counter = rcm->counter;
! report->local_rx_timestamp = rxTimestamp;
! report->is_synced = call GlobalTime.local2Global(&rxTimestamp);
! report->global_rx_timestamp = rxTimestamp;
! report->skew_times_1000000 = (uint32_t)call TimeSyncInfo.getSkew()*1000000UL;
! report->ftsp_root_addr = call TimeSyncInfo.getRootID();
! report->ftsp_seq = call TimeSyncInfo.getSeqNum();
! report->ftsp_table_entries = call TimeSyncInfo.getNumEntries();
! if (call AMSend.send(AM_BROADCAST_ADDR, &msg, sizeof(test_ftsp_msg_t)) == SUCCESS) {
! locked = TRUE;
! }
! }
! return msgPtr;
! }
! event void AMSend.sendDone(message_t* ptr, error_t success) {
! locked = FALSE;
! return;
! }
- event void RadioControl.startDone(error_t err) {}
- event void RadioControl.stopDone(error_t error){}
}
--- 26,53 ----
#include "RadioCountToLeds.h"
! configuration TestFtspAppC {
}
! implementation {
! components MainC, TimeSyncC;
! MainC.SoftwareInit -> TimeSyncC;
! TimeSyncC.Boot -> MainC;
! components TestFtspC as App;
! App.Boot -> MainC;
! components ActiveMessageC;
! App.RadioControl -> ActiveMessageC;
! App.Receive -> ActiveMessageC.Receive[AM_RADIO_COUNT_MSG];
! App.AMSend -> ActiveMessageC.AMSend[AM_TEST_FTSP_MSG];
! App.Packet -> ActiveMessageC;
! App.PacketTimeStamp -> ActiveMessageC;
! components LedsC;
! App.GlobalTime -> TimeSyncC;
! App.TimeSyncInfo -> TimeSyncC;
! App.Leds -> LedsC;
}
Index: TestFtspC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp/TestFtspC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestFtspC.nc 2 Jul 2008 17:42:42 -0000 1.1
--- TestFtspC.nc 2 Jul 2008 17:44:57 -0000 1.2
***************
*** 26,53 ****
#include "RadioCountToLeds.h"
! configuration TestFtspC {
}
! implementation {
! components MainC, TimeSyncC;
! MainC.SoftwareInit -> TimeSyncC;
! TimeSyncC.Boot -> MainC;
! components TestFtspAppC as App;
! App.Boot -> MainC;
! components ActiveMessageC;
! App.RadioControl -> ActiveMessageC;
! App.Receive -> ActiveMessageC.Receive[AM_RADIO_COUNT_MSG];
! App.AMSend -> ActiveMessageC.AMSend[AM_TEST_FTSP_MSG];
! App.Packet -> ActiveMessageC;
! App.PacketTimeStamp -> ActiveMessageC;
! components LedsC;
! App.GlobalTime -> TimeSyncC;
! App.TimeSyncInfo -> TimeSyncC;
! App.Leds -> LedsC;
}
--- 26,87 ----
#include "RadioCountToLeds.h"
! module TestFtspC
! {
! uses
! {
! interface GlobalTime<TMilli>;
! interface TimeSyncInfo;
! interface Receive;
! interface AMSend;
! interface Packet;
! interface Leds;
! interface PacketTimeStamp<TMilli,uint32_t>;
! interface Boot;
! interface SplitControl as RadioControl;
! }
}
! implementation
! {
! message_t msg;
! bool locked = FALSE;
! event void Boot.booted() {
! call RadioControl.start();
! }
! event message_t* Receive.receive(message_t* msgPtr, void* payload, uint8_t len)
! {
! call Leds.led0Toggle();
! if (!locked && call PacketTimeStamp.isValid(msgPtr)) {
! radio_count_msg_t* rcm = (radio_count_msg_t*)call Packet.getPayload(msgPtr, sizeof(radio_count_msg_t));
! test_ftsp_msg_t* report = (test_ftsp_msg_t*)call Packet.getPayload(&msg, sizeof(test_ftsp_msg_t));
! uint32_t rxTimestamp = call PacketTimeStamp.timestamp(msgPtr);
! report->src_addr = TOS_NODE_ID;
! report->counter = rcm->counter;
! report->local_rx_timestamp = rxTimestamp;
! report->is_synced = call GlobalTime.local2Global(&rxTimestamp);
! report->global_rx_timestamp = rxTimestamp;
! report->skew_times_1000000 = (uint32_t)call TimeSyncInfo.getSkew()*1000000UL;
! report->ftsp_root_addr = call TimeSyncInfo.getRootID();
! report->ftsp_seq = call TimeSyncInfo.getSeqNum();
! report->ftsp_table_entries = call TimeSyncInfo.getNumEntries();
! if (call AMSend.send(AM_BROADCAST_ADDR, &msg, sizeof(test_ftsp_msg_t)) == SUCCESS) {
! locked = TRUE;
! }
! }
+ return msgPtr;
+ }
+
+ event void AMSend.sendDone(message_t* ptr, error_t success) {
+ locked = FALSE;
+ return;
+ }
+
+ event void RadioControl.startDone(error_t err) {}
+ event void RadioControl.stopDone(error_t error){}
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestLpl Makefile, NONE, 1.1 README.txt, NONE, 1.1 TestLplAppC.nc, NONE, 1.1 TestLplC.nc, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/safe/include annots_stage1.h, 1.10, 1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list