Updated CF bootup strategy.
--- a/canfestival/canfestival.py Mon Jun 18 19:34:41 2012 +0200
+++ b/canfestival/canfestival.py Tue Jun 19 10:11:43 2012 +0200
@@ -400,6 +400,8 @@
"slavebootup_register" : "",
"post_sync" : "",
"post_sync_register" : "",
+ "pre_op" : "",
+ "pre_op_register" : "",
}
for child in self.IECSortedChildren():
childlocstr = "_".join(map(str,child.GetCurrentLocation()))
@@ -425,10 +427,6 @@
format_dict["slavebootups"] += (
"static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n"%(nodename))
else:
- # for id in SlaveIDs:
- # format_dict["slavebootups"] += (
- # "int %s_slave_%d_booted = 0;\n"%(nodename, id))
- # define post_SlaveBootup lookup functions
format_dict["slavebootups"] += (
"static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n"%(nodename)+
" check_and_start_node(d, nodeId);\n"+
@@ -453,6 +451,12 @@
"}\n")
format_dict["post_sync_register"] += (
"%s_Data.post_sync = %s_post_sync;\n"%(nodename,nodename))
+ format_dict["pre_op"] += (
+ "static void %s_preOperational(CO_Data* d){\n "%(nodename)+
+ "".join([" if(check_and_start_node(d, %d)!=1) return;\n"%NdId for NdId in SlaveIDs])+
+ "}\n")
+ format_dict["pre_op_register"] += (
+ "%s_Data.preOperational = %s_pre_op;\n"%(nodename,nodename))
format_dict["nodes_init"] += 'NODE_SLAVE_INIT(%s, %s)\n '%(
nodename,
child_data.getNodeId())
--- a/canfestival/cf_runtime.c Mon Jun 18 19:34:41 2012 +0200
+++ b/canfestival/cf_runtime.c Tue Jun 19 10:11:43 2012 +0200
@@ -25,6 +25,10 @@
*/
%(post_sync)s
+/* Triggers DCF transission
+ */
+%(pre_op)s
+
#define NODE_FORCE_SYNC(nodename) \
/* Artificially force sync state to 1 so that it is not started */\
nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
@@ -49,6 +53,7 @@
{
%(slavebootup_register)s
%(post_sync_register)s
+ %(pre_op_register)s
%(nodes_init)s
}