--- a/canfestival/canfestival.py Wed Jul 18 01:05:06 2012 +0200
+++ b/canfestival/canfestival.py Wed Jul 18 01:33:48 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"+
@@ -436,6 +434,12 @@
# register previously declared func as post_SlaveBootup callback for that node
format_dict["slavebootup_register"] += (
"%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n"%(nodename,nodename))
+ format_dict["pre_op"] += (
+ "static void %s_preOperational(CO_Data* d){\n "%(nodename)+
+ "".join([" masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n"%NdId for NdId in SlaveIDs])+
+ "}\n")
+ format_dict["pre_op_register"] += (
+ "%s_Data.preOperational = %s_preOperational;\n"%(nodename,nodename))
else:
# Slave node
align = child_data.getSync_Align()
--- a/canfestival/cf_runtime.c Wed Jul 18 01:05:06 2012 +0200
+++ b/canfestival/cf_runtime.c Wed Jul 18 01:33:48 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
}