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