runtime/plc_common_main.c
changeset 49 45dc6a944ab6
child 54 ff82e7088ec5
equal deleted inserted replaced
48:6b30cfee163e 49:45dc6a944ab6
       
     1 /*
       
     2  * Functions and variables provied by generated C softPLC
       
     3  **/ 
       
     4 extern int common_ticktime__;
       
     5 
       
     6 /*
       
     7  * Functions and variables provied by plc.c
       
     8  **/ 
       
     9 void run(long int tv_sec, long int tv_nsec);
       
    10 
       
    11 #define maxval(a,b) ((a>b)?a:b)
       
    12 
       
    13 #include "iec_types.h"
       
    14 
       
    15 /*
       
    16  * Functions and variables provied by generated C softPLC
       
    17  **/ 
       
    18 void config_run__(int tick);
       
    19 void config_init__(void);
       
    20 
       
    21 /*
       
    22  *  Functions and variables to export to generated C softPLC
       
    23  **/
       
    24  
       
    25 IEC_TIME __CURRENT_TIME;
       
    26 
       
    27 static int tick = 0;
       
    28 
       
    29 %(calls_prototypes)s
       
    30 
       
    31 void __run()
       
    32 {
       
    33     %(retrive_calls)s
       
    34     config_run__(tick++);
       
    35     %(publish_calls)s
       
    36 }
       
    37 
       
    38 void __init()
       
    39 {
       
    40     config_init__();
       
    41     %(init_calls)s
       
    42 }
       
    43 
       
    44 void __cleanup()
       
    45 {
       
    46     %(cleanup_calls)s
       
    47 }
       
    48