my_types.h 7.67 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
/* Buildsupport is (c) 2008-2016 European Space Agency
Maxime Perrotin's avatar
Maxime Perrotin committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 * contact: maxime.perrotin@esa.int
 * License is LGPL, check LICENSE file */
/* Types used for description of the C AST of TASTE systems */
/* 1st version written by Maxime Perrotin/ESA 14/01/2008 */

#ifndef _MY_TYPES_H_
#define _MY_TYPES_H_

#include <stdint.h>
#include <stdbool.h>

#define PROCESSOR_NULL {NULL,NULL}

static const char do_not_modify_warning[] =
         "/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n";

/* Macro available to declare chained list in a standard format */
#define DECLARE_LIST(type) \
typedef struct t_##type##_list {\
        type *value;\
        struct t_##type##_list *next;\
} type##_list;

/* Generic type for a string and a list of strings */
typedef char String;
DECLARE_LIST (String)


/* Interface type : Provided (PI) or Required (RI) */
typedef enum {
    PI,
    RI
} IF_type;

/* Interface kind : immediate/synchronous (sync)
 * or deferred/asynchronous (async) */
typedef enum {
    synch,
    asynch,
    unknown
} IF_kind;

/* Parameter direction (in or out) */
typedef enum {
    param_in,
    param_out
} Param_kind;

/* Supported encoding rules: uPER, Native (no encoding), ACN (User-defined) */
typedef enum {
    uper,
    native,
    acn,
    default_encoding
} Encoding;

/* List of supported languages */
typedef enum {
    sdl,
    simulink,
    qgenc,
    qgenada,
    c,
    cpp,
    opengeode,
    ada,
    rhapsody,
    gui,
    scade,
    rtds,
    vhdl,
    system_c,
    blackbox_device,
    other
} Language;

/* Interface property */
typedef enum {
   cyclic,
   sporadic,
   variator,
   protected,
   unprotected,
   undefined
} RCM;

/* Basic ASN.1 type */
typedef enum {
Maxime Perrotin's avatar
Maxime Perrotin committed
90
91
92
93
94
95
96
97
98
    sequenceof,
    sequence,
    enumerated,
    set,
    setof,
    integer,
    boolean,
    real,
    choice,
Maxime Perrotin's avatar
Maxime Perrotin committed
99
100
101
102
103
104
105
106
    octetstring,
    string,
    unknown_type
} ASN1_basic_type;


/* Function nature: thread or shared resource */
typedef enum {
Maxime Perrotin's avatar
Maxime Perrotin committed
107
108
    thread_runtime,
    passive_runtime,
Maxime Perrotin's avatar
Maxime Perrotin committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    unknown_runtime
} Nature;

/* Type used to store a Protected Object name */
typedef char Protected_Object_Name;
DECLARE_LIST (Protected_Object_Name)

/* Type used to store a process port name */
typedef char Port;
DECLARE_LIST (Port)

/* Type used to store an ASN.1 module name */
typedef char ASN1_Module;
DECLARE_LIST (ASN1_Module)

/* Type used to store an ASN.1 filename */
typedef char ASN1_Filename;
DECLARE_LIST (ASN1_Filename)

/* Type used to store an ASN.1 Type name */
typedef char ASN1_Typename;

/* Type used to store an ASN.1 Type definition */
typedef struct t_asntype {
    ASN1_Typename       *name;
    ASN1_Module         *module;
    ASN1_Filename       *asn1_filename;
    ASN1_basic_type     basic_type;
} ASN1_Type;

DECLARE_LIST (ASN1_Type)

/* Type used to define a context parameter (functional state) */
typedef struct t_contextparam {
  char          *name;
  char          *fullNameWithCase;
  ASN1_Type     type;
  char          *value;
} Context_Parameter;

DECLARE_LIST (Context_Parameter)

Maxime Perrotin's avatar
Maxime Perrotin committed
151
/* 
Maxime Perrotin's avatar
Maxime Perrotin committed
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  Type used to define a parameter's attributes (name, type, encoding)
*/
typedef struct t_parameter {
  char                  *name;
  char                  *type;
  ASN1_Module           *asn1_module;
  ASN1_basic_type       basic_type;
  ASN1_Filename         *asn1_filename;
  Encoding              encoding;
  struct t_interface    *interface;
  Param_kind            param_direction;
} Parameter;

DECLARE_LIST (Parameter)
/*
   Type used in build_gui_glue to list the PI/RI of a FV
   (Internal to GUI glue from Cyril) - should use a standard type instead
*/
typedef struct T_name_list
{
  char          *name;
  struct        T_name_list *next;
} T_RI_PI_NAME_LIST;

/*
   Type used to describe an interface (provided or required)
*/
typedef struct t_interface {
  char                  *name;
  Port                  *port_name;
  struct t_fv           *parent_fv;
  IF_type               direction;
  Parameter_list        *in;
  Parameter_list        *out;
  IF_kind               synchronism;
  RCM                   rcm;
  long long             period;
  uint64_t              wcet_low;
  char                  *wcet_low_unit;
  uint64_t              wcet_high;
  char                  *wcet_high_unit;
  char                  *distant_fv;
  struct t_qgen         *distant_qgen;
  struct t_FV_list      *calling_threads;
Maxime Perrotin's avatar
Maxime Perrotin committed
196
  char                  *distant_name;
Maxime Perrotin's avatar
Maxime Perrotin committed
197
  unsigned long long    queue_size;
Maxime Perrotin's avatar
Maxime Perrotin committed
198
  bool                  ignore_params;
Maxime Perrotin's avatar
Maxime Perrotin committed
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
} Interface;

DECLARE_LIST (Interface)

/*
 * Type used to store context-dependent parameters (eg. output directory)
*/
typedef struct t_context {
  char  *output;
  char  *ifview;
  char  *dataview;
  int   glue;
  bool  smp2;
  int   gw;
  int   keep_case;
  int   onlycv;
  int   aadlv2;
  int   debug;
  int   test;
  bool  future;
  char  *stacksize;
  int   polyorb_hi_c;
} Context;

/*
 * Type used to describe a function
*/
typedef struct t_fv {
  char                   *name;
  char                   *nameWithCase;
  struct                 t_system *system_ast;
  Nature                 runtime_nature;
  Language               language;
  char                   *zipfile;
  Interface_list         *interfaces;
  struct t_process       *process;
  struct t_FV_list       *calling_threads;
  int                    thread_id;
  Context_Parameter_list *context_parameters;
  bool                   artificial;
  char                   *original_name;
  bool                   timer;
  struct t_String_list   *timer_list;
} FV;

DECLARE_LIST(FV)

/*
 * Type used to define an APLC binding (needed to build concurrency view)
*/
typedef struct t_aplc_binding {
  FV    *fv;
} Aplc_binding;

DECLARE_LIST(Aplc_binding)

/* 
 * Type used to define a processor (used in deployment view)
 */
typedef struct t_processor {
   char *name;
   char *classifier;
   char *platform_name;
} Processor;

/*
 * Type used to define a bus (used in deployment view)
 */
typedef struct t_bus {
   char *name;
   char *classifier;
} Bus;

DECLARE_LIST(Bus)

/*
 * Type used to define a device (used in deployment view)
 */
typedef struct t_device {
   char                 *name;
   char                 *classifier;
   char                 *associated_processor;
   char                 *configuration;
   ASN1_Filename        *asn1_filename;
   ASN1_Typename        *asn1_typename;
   ASN1_Module          *asn1_modulename;
   char                 *accessed_bus;
   Port                 *access_port;
} Device;

DECLARE_LIST(Device)

/*
 * Type used to declare a connection between two functions
 * of the interface view, through a port
 */
typedef struct t_connection {
   char *src_system; 
   Port *src_port;
   char *bus;
   char *dst_system;
   Port *dst_port;
} Connection;

DECLARE_LIST(Connection)
/*
  Type used to define a PROCESS (Partition in deployment view)
*/
typedef struct t_process {
  char                  *name;
  char                  *identifier;
  char                  *processor_board_name;
  Processor             *cpu;
  Interface_list        *interfaces;
  Aplc_binding_list     *bindings;
  Device_list           *drivers;
  unsigned int          connections;
Maxime Perrotin's avatar
Maxime Perrotin committed
316
  bool                  coverage;
Maxime Perrotin's avatar
Maxime Perrotin committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
} Process;

DECLARE_LIST(Process)

typedef char Package;

DECLARE_LIST(Package)

/*
 Type used to store the entire system (root of the Interface & Deployment AST)
*/
typedef struct t_system
{
    char              *name;
    Context           *context;
    FV_list           *functions;
    Process_list      *processes;
    Bus_list          *buses;
    Package_list      *packages;
    Connection_list   *connections;
} System;

/*
 * Type used to store information about connected QGen subsystems
 */
typedef struct t_qgen {
   char                 *fv_name;
   Language             language;
   char                 *qgen_init;
} Distant_QGen;

#endif