plugins/canfestival/cf_runtime.c
changeset 59 b6ff896ff58b
parent 57 3b53f9a509d9
child 75 9ad18a387a96
equal deleted inserted replaced
58:c0741cc16c99 59:b6ff896ff58b
     8 
     8 
     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 
       
    14 
       
    15 static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId)
       
    16 {
       
    17     /* Put the master in operational mode */
       
    18     setState(d, Operational);
       
    19       
       
    20     /* Ask slave node to go in operational mode */
       
    21     masterSendNMTstateChange (d, 0, NMT_Start_Node);
       
    22 }
       
    23 
       
    24 #define NODE_DECLARE(nodename, nodeid)\
       
    25 void nodename##_preOperational()\
       
    26 {\
       
    27     ConfigureSlaveNode(&nodename##_Data, nodeid);\
       
    28 }\
       
    29 
       
    30 %(nodes_declare)s
       
    31 
    13 
    32 
    14 #define NODE_INIT(nodename, nodeid) \
    33 #define NODE_INIT(nodename, nodeid) \
    15     /* Artificially force sync state to 1 so that it is not started */\
    34     /* Artificially force sync state to 1 so that it is not started */\
    16     nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
    35     nodename##_Data.CurrentCommunicationState.csSYNC = -1;\
    17     /* Force sync period to common_ticktime__ so that other node can read it*/\
    36     /* Force sync period to common_ticktime__ so that other node can read it*/\
    45         StopTimerLoop();
    64         StopTimerLoop();
    46 
    65 
    47 }
    66 }
    48 
    67 
    49 #define NODE_OPEN(nodename)\
    68 #define NODE_OPEN(nodename)\
       
    69     nodename##_Data.preOperational = nodename##_preOperational;\
    50     if(!canOpen(&nodename##Board,&nodename##_Data)){\
    70     if(!canOpen(&nodename##Board,&nodename##_Data)){\
    51         printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\
    71         printf("Cannot open " #nodename " Board (%%s,%%s)\n",nodename##Board.busname, nodename##Board.baudrate);\
    52         return -1;\
    72         return -1;\
    53     }\
    73     }\
    54     init_level++;
    74     init_level++;