NMY start node on slavebootup
authorgreg
Thu, 29 May 2008 17:44:11 +0200
changeset 160 4b63934885e1
parent 159 1c5710e8c941
child 161 faad68924b53
NMY start node on slavebootup
plugins/canfestival/cf_runtime.c
--- a/plugins/canfestival/cf_runtime.c	Mon May 26 15:25:26 2008 +0200
+++ b/plugins/canfestival/cf_runtime.c	Thu May 29 17:44:11 2008 +0200
@@ -12,7 +12,7 @@
 extern int common_ticktime__;
 
 
-static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId)
+static void Master_post_SlaveBootup(CO_Data* d, UNS8 nodeId)
 {
     /* Put the master in operational mode */
     setState(d, Operational);
@@ -21,15 +21,6 @@
     masterSendNMTstateChange (d, 0, NMT_Start_Node);
 }
 
-#define NODE_DECLARE(nodename, nodeid)\
-void nodename##_preOperational()\
-{\
-    ConfigureSlaveNode(&nodename##_Data, nodeid);\
-}\
-
-%(nodes_declare)s
-
-
 #define NODE_INIT(nodename, nodeid) \
     /* Artificially force sync state to 1 so that it is not started */\
     nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
@@ -54,6 +45,7 @@
     if(init_level-- > 0)\
     {\
         EnterMutex();\
+        masterSendNMTstateChange(&nodename##_Data, 0, NMT_Reset_Node);\
         setState(&nodename##_Data, Stopped);\
         LeaveMutex();\
         canClose(&nodename##_Data);\
@@ -73,7 +65,7 @@
 }
 
 #define NODE_OPEN(nodename)\
-    nodename##_Data.preOperational = nodename##_preOperational;\
+    nodename##_Data.post_SlaveBootup = Master_post_SlaveBootup;\
     if(!canOpen(&nodename##Board,&nodename##_Data)){\
         printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\
         return -1;\