[Tinyos-commits] CVS: tinyos-1.x/tools/scripts/codeGeneration
generateRpc.pl, 1.1, 1.2
Henri DF
henridf at users.sourceforge.net
Sun Jan 15 11:20:06 PST 2006
Update of /cvsroot/tinyos/tinyos-1.x/tools/scripts/codeGeneration
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27082
Modified Files:
generateRpc.pl
Log Message:
Changes to allow RpcM generation without Drip and/or Drain.
The non-inclusion of Drip/Drain is controlled by setting the
RPC_NO_DRIP and/or RPC_NO_DRAIN preprocessor variables.
Index: generateRpc.pl
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/scripts/codeGeneration/generateRpc.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** generateRpc.pl 23 Sep 2005 10:16:41 -0000 1.1
--- generateRpc.pl 15 Jan 2006 19:20:02 -0000 1.2
***************
*** 274,278 ****
##############################
! $includes->{'includes Drain;'}=1;
$includes->{'includes Rpc;'}=1;
--- 274,280 ----
##############################
! $includes->{'#ifndef RPC_NO_DRAIN
! includes Drain;
! #endif // !RPC_NO_DRAIN'}=1;
$includes->{'includes Rpc;'}=1;
***************
*** 336,346 ****
interface ReceiveMsg as CommandReceiveLocal;
! interface SendMsg as ResponseSendMsgDrain;
// interface SendMsg as ErrorSendMsgDrain;
- interface Send as DrainSend;
interface Receive as CommandReceiveDrip;
interface Drip as CommandDrip;
interface Dest;
/*** commands that are rpc-able ***/
--- 338,353 ----
interface ReceiveMsg as CommandReceiveLocal;
! interface SendMsg as ResponseSendMsg;
! #ifndef RPC_NO_DRAIN
! interface Send as DrainSend; // only used for the getBuffer(), when we are using Drain
! #endif // !RPC_NO_DRAIN
// interface SendMsg as ErrorSendMsgDrain;
+
+ #ifndef RPC_NO_DRIP
interface Receive as CommandReceiveDrip;
interface Drip as CommandDrip;
interface Dest;
+ #endif // !RPC_NO_DRIP
/*** commands that are rpc-able ***/
***************
*** 435,439 ****
--- 442,448 ----
command result_t StdControl.start() {
call SubControl.start();
+ #ifndef RPC_NO_DRIP
call CommandDrip.init();
+ #endif // !RPC_NO_DRIP
return SUCCESS;
}
***************
*** 448,452 ****
--- 457,466 ----
uint16_t maxLength;
uint16_t id = msg->commandID;
+ #ifdef RPC_NO_DRAIN
+ RpcResponseMsg *responseMsg = (RpcResponseMsg*)(responseMsgPtr->data);
+ maxLength = TOSH_DATA_LENGTH;
+ #else
RpcResponseMsg *responseMsg = (RpcResponseMsg*)call DrainSend.getBuffer(responseMsgPtr, &maxLength);
+ #endif // RPC_NO_DRAIN
dbg(DBG_USR2, "processing command id %d, transaction %d\\n", msg->commandID, msg->transactionID);
***************
*** 603,609 ****
processingCommand=FALSE;
}
! else if (call ResponseSendMsgDrain.send(msg->returnAddress,
! responseMsg->dataLength + sizeof(RpcResponseMsg),
! responseMsgPtr) ){
dbg(DBG_USR2, \"sending response\\n\");
sendingResponse=TRUE;
--- 617,623 ----
processingCommand=FALSE;
}
! else if (call ResponseSendMsg.send(msg->returnAddress,
! responseMsg->dataLength + sizeof(RpcResponseMsg),
! responseMsgPtr) ){
dbg(DBG_USR2, \"sending response\\n\");
sendingResponse=TRUE;
***************
*** 619,622 ****
--- 633,637 ----
}
+ #ifndef RPC_NO_DRIP
event TOS_MsgPtr CommandReceiveDrip.receive(TOS_MsgPtr pMsg, void* payload, uint16_t payloadLength) {
RpcCommandMsg* msg = (RpcCommandMsg*)payload;
***************
*** 647,653 ****
return pMsg;
}
event TOS_MsgPtr CommandReceiveLocal.receive(TOS_MsgPtr pMsg) {
! //store the drip message for later processing
dbg(DBG_USR2, \"received local command message, len=%s\\n\",pMsg->length);
memcpy(cmdStore.data, pMsg->data, pMsg->length);
--- 662,669 ----
return pMsg;
}
+ #endif // !RPC_NO_DRIP
event TOS_MsgPtr CommandReceiveLocal.receive(TOS_MsgPtr pMsg) {
! //store the message for later processing
dbg(DBG_USR2, \"received local command message, len=%s\\n\",pMsg->length);
memcpy(cmdStore.data, pMsg->data, pMsg->length);
***************
*** 662,665 ****
--- 678,682 ----
}
+ #ifndef RPC_NO_DRIP
event result_t CommandDrip.rebroadcastRequest(TOS_MsgPtr msg, void *payload) {
dbg(DBG_USR2, \"drip rebroadcast request\\n\");
***************
*** 668,677 ****
return SUCCESS;
}
event result_t DrainSend.sendDone(TOS_MsgPtr pMsg, result_t success) {
dbg(DBG_USR2, \"wtf!! drainSend send done\\n\");
return SUCCESS;
}
! event result_t ResponseSendMsgDrain.sendDone(TOS_MsgPtr pMsg, result_t success) {
if (success == SUCCESS) {
dbg(DBG_USR2, \"drain send done: SUCCESS\\n\");
--- 685,697 ----
return SUCCESS;
}
+ #endif // !RPC_NO_DRIP
+ #ifndef RPC_NO_DRAIN
event result_t DrainSend.sendDone(TOS_MsgPtr pMsg, result_t success) {
dbg(DBG_USR2, \"wtf!! drainSend send done\\n\");
return SUCCESS;
}
! #endif // !RPC_NO_DRAIN
! event result_t ResponseSendMsg.sendDone(TOS_MsgPtr pMsg, result_t success) {
if (success == SUCCESS) {
dbg(DBG_USR2, \"drain send done: SUCCESS\\n\");
***************
*** 736,746 ****
components
RpcM,
! GenericComm,
! DrainC,
! DestC,
DripC,
! $LedsC
! DripStateC;
";
--- 756,772 ----
components
+ $LedsC
RpcM,
! GenericComm;
! #ifndef RPC_NO_DRIP
! components
DripC,
! DripStateC,
! DestC;
! #endif // !RPC_NO_DRIP
! #ifndef RPC_NO_DRAIN
! components
! DrainC;
! #endif // !RPC_NO_DRAIN
";
***************
*** 791,800 ****
--- 817,831 ----
RpcM.SubControl -> GenericComm;
+ #ifndef RPC_NO_DRAIN
RpcM.SubControl -> DrainC;
+ #endif //!RPC_NO_DRAIN
+ #ifndef RPC_NO_DRIP
RpcM.SubControl -> DripC;
+ #endif // !RPC_NO_DRIP
//genericComm wiring
RpcM.CommandReceiveLocal -> GenericComm.ReceiveMsg[AM_RPCCOMMANDMSG];
+ #ifndef RPC_NO_DRIP
//drip wiring
RpcM.CommandReceiveDrip -> DripC.Receive[AM_RPCCOMMANDMSG];
***************
*** 802,810 ****
DripC.DripState[AM_RPCCOMMANDMSG] -> DripStateC.DripState[unique(\"DripState\")];
RpcM.Dest -> DestC;
//drain wiring
! RpcM.ResponseSendMsgDrain -> DrainC.SendMsg[AM_RPCRESPONSEMSG];
! // RpcM.ErrorSendMsgDrain -> DrainC.SendMsg[AM_RPCERRORMSG];
RpcM.DrainSend -> DrainC.Send[AM_RPCRESPONSEMSG];
}
--- 833,848 ----
DripC.DripState[AM_RPCCOMMANDMSG] -> DripStateC.DripState[unique(\"DripState\")];
RpcM.Dest -> DestC;
+ #endif // !RPC_NO_DRIP
//drain wiring
! #ifndef RPC_NO_DRAIN
! RpcM.ResponseSendMsg -> DrainC.SendMsg[AM_RPCRESPONSEMSG];
RpcM.DrainSend -> DrainC.Send[AM_RPCRESPONSEMSG];
+ #else
+ RpcM.ResponseSendMsg -> GenericComm.SendMsg[AM_RPCRESPONSEMSG];
+ #endif // !RPC_NO_DRAIN
+
+ // RpcM.ErrorSendMsgDrain -> DrainC.SendMsg[AM_RPCERRORMSG];
+
}
More information about the Tinyos-commits
mailing list