plugins/canfestival/cf_runtime.c
changeset 169 8e87b69286c0
parent 160 4b63934885e1
child 174 dc81d1d0f463
equal deleted inserted replaced
168:8a0727f5fd13 169:8e87b69286c0
     9 %(board_decls)s
     9 %(board_decls)s
    10 
    10 
    11 static int init_level=0;
    11 static int init_level=0;
    12 extern int common_ticktime__;
    12 extern int common_ticktime__;
    13 
    13 
    14 
       
    15 static void Master_post_SlaveBootup(CO_Data* d, UNS8 nodeId)
    14 static void Master_post_SlaveBootup(CO_Data* d, UNS8 nodeId)
    16 {
    15 {
    17     /* Put the master in operational mode */
    16     /* Put the master in operational mode */
    18     setState(d, Operational);
    17     setState(d, Operational);
    19       
    18       
    20     /* Ask slave node to go in operational mode */
    19     /* Ask slave node to go in operational mode */
    21     masterSendNMTstateChange (d, 0, NMT_Start_Node);
    20     masterSendNMTstateChange (d, 0, NMT_Start_Node);
    22 }
    21 }
       
    22 
       
    23 %(slavebootups)s
    23 
    24 
    24 #define NODE_INIT(nodename, nodeid) \
    25 #define NODE_INIT(nodename, nodeid) \
    25     /* Artificially force sync state to 1 so that it is not started */\
    26     /* Artificially force sync state to 1 so that it is not started */\
    26     nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
    27     nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
    27     /* Force sync period to common_ticktime__ so that other node can read it*/\
    28     /* Force sync period to common_ticktime__ so that other node can read it*/\
    63    		TimerCleanup();
    64    		TimerCleanup();
    64     #endif
    65     #endif
    65 }
    66 }
    66 
    67 
    67 #define NODE_OPEN(nodename)\
    68 #define NODE_OPEN(nodename)\
    68     nodename##_Data.post_SlaveBootup = Master_post_SlaveBootup;\
       
    69     if(!canOpen(&nodename##Board,&nodename##_Data)){\
    69     if(!canOpen(&nodename##Board,&nodename##_Data)){\
    70         printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\
    70         printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\
    71         return -1;\
    71         return -1;\
    72     }\
    72     }\
    73     init_level++;
    73     init_level++;