Subversion Repositories shark

Rev

Rev 1090 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1091 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/* CVS :        $Id: bca.h,v 1.2 2002-10-01 10:33:51 pj Exp $ */
22
 
23
/*
24
 * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it>
25
 *
26
 * This program is free software; you can redistribute it and/or modify
27
 * it under the terms of the GNU General Public License as published by
28
 * the Free Software Foundation; either version 2 of the License, or
29
 * (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39
 *
40
 */
41
 
42
/****************************************************
43
 *                                                  *
44
 *  file:        bca.h                              *
45
 *  included by: bca.c & bca_lib di cui fa da header*
46
 *  data:        15/09/2002                         *
47
 *  creato da:   Fabio CALABRESE                    *
48
 *                                                  *
49
 ******************************************************
50
 *                                                    *
51
 *  descrizione: contiene la definizione di variabili *
52
 *               e strutture globali, con un corredo  *
53
 *               di macro e funzioni per la loro      *
54
 *               gestione, usate nel programma SHaRK  *
55
 *               "(B)ase(C)ontr(A)rea", il cui codice *
56
 *               e' scritto nel file bca.c;           *
57
 *               il file bca_lib.c contiene il corpo  *
58
 *               di tutte le funzioni qui dichiarate. *
59
 *                                                    *
60
 ******************************************************/
61
 
62
#ifndef __BCA_H__
63
#define __BCA_H__
64
//----------------BEGIN------------------
65
 
66
// *** Librerie S.Ha.R.K ***
67
// *** Librerie Standard C ***
68
// *** Librerie FAB ***
69
#include"fab_lib/fab_grx.h"
70
#include"fab_lib/fab_tool.h"
71
// *** Librerie BCA ***
72
 
73
 
74
// ---------------------------------
75
// *** Elementi Grafici Generici ***
76
// ---------------------------------
77
 
78
// IMMAGINI:
79
FAB_IMAGE* image_sfondo;
80
FAB_IMAGE* image_bca;
81
FAB_IMAGE* image_aereo[4];      // 1 aereo per ogni direzione(soft e hard)
82
FAB_IMAGE* image_esplo[5];      // 5 immagini in sequenza simulanti
83
FAB_IMAGE* image_cannone[2];    //  un esplosione
84
FAB_IMAGE* image_missile[2];
85
 
86
// BORDI:
87
FAB_BORDER* border_blu7;
88
FAB_BORDER* border_verde7;
89
FAB_BORDER* border_rosso7;
90
FAB_BORDER* border_bianco7;
91
FAB_BORDER* border_giallo7;
92
 
93
// FRAME:
94
FAB_FRAME* frame_bca;
95
FAB_FRAME* frame_misure_oriz;
96
FAB_FRAME* frame_misure_vert;
97
FAB_FRAME* frame_misure_vert;
98
FAB_FRAME* frame_titolo;
99
FAB_FRAME* frame_comandi;
100
FAB_FRAME* frame_control;
101
 
102
// BALLFRAME:
103
FAB_BALLFRAME* ballframe_radar;
104
FAB_BALLFRAME* ballframe_lucerossa[3];
105
 
106
// Base ContrAerea
107
#define BASE_L  1.0   // [Km]: lunghezza
108
#define BASE_H  2100  // [m]:  altezza max di visibilita'
109
 
110
// Finestra Virtuale sullo schermo
111
#define FIN_X_MIN  20      // [pixel]
112
#define FIN_X_MAX  520-1   // [pixel]
113
#define FIN_Y_MIN  20      // [pixel]
114
#define FIN_Y_MAX  520-1   // [pixel]
115
// Inoltre si possono usare le seguenti + comode define
116
// con gli stessi valori:
117
#define X0 FIN_X_MIN
118
#define X1 FIN_X_MAX
119
#define Y0 FIN_Y_MIN
120
#define Y1 FIN_Y_MAX
121
// NB: non e' necessaria la proporzionalita' tra finestra
122
//     reale(BASE_L*BASE_H) e virtuale((X1-X0)*(Y1-Y0))!
123
 
124
// Finestra Misure
125
#define FRAME_MISURE_LINE_COLOR FAB_green
126
#define FRAME_MISURE_BACK_COLOR FAB_black
127
#define FRAME_MISURE_ORIZ_LY    30
128
#define FRAME_MISURE_VERT_LX    52
129
 
130
// Finestra Titolo
131
#define FRAME_TITOLO_TEXT_COLOR1  FAB_yellow
132
#define FRAME_TITOLO_TEXT_COLOR2  FAB_white
133
#define FRAME_TITOLO_BACK_COLOR1  FAB_gray
134
#define FRAME_TITOLO_BACK_COLOR2  FAB_blue
135
 
136
// Finestra Comandi
137
#define FRAME_COMANDI_TEXT_COLOR1 FAB_yellow
138
#define FRAME_COMANDI_TEXT_COLOR2 FAB_white
139
#define FRAME_COMANDI_TEXT_COLOR3 FAB_red
140
#define FRAME_COMANDI_BACK_COLOR1 FAB_gray
141
#define FRAME_COMANDI_BACK_COLOR2 FAB_yellow
142
 
143
// Finestra Control
144
#define FRAME_CONTROL_TEXT_COLOR1 FAB_rgb( 50,255, 50)
145
#define FRAME_CONTROL_TEXT_COLOR2 FAB_rgb(150,255,150)
146
#define FRAME_CONTROL_BACK_COLOR  FAB_black
147
 
148
// ---------------------------------
149
// *** Elementi Task Dummy_radar ***
150
// ---------------------------------
151
#define    DUMMY_RADAR_GROUP  3
152
#define    DUMMY_RADAR_PERIOD 50000
153
#define    DUMMY_RADAR_WCET   400
154
#define    DUMMY_RADAR_MET    200
155
 
156
// ---------------------------------
157
// *** Elementi Task Control ***
158
// ---------------------------------
159
#define    CONTROL_PERIOD 50000
160
#define    CONTROL_WCET   400
161
#define    CONTROL_MET    300
162
 
163
// ---------------------------
164
// *** Elementi Task Esplo ***
165
// ---------------------------
166
#define    ESPLO_TRASPARENT_COL FAB_white
167
#define    ESPLO_LX             40
168
#define    ESPLO_LY             40
169
 
170
#define    ESPLO_PERIOD  80000
171
#define    ESPLO_WCET      300
172
#define    ESPLO_MET       100
173
 
174
// -----------------------------------
175
// *** Elementi Task Aereo_Creator ***
176
// -----------------------------------
177
#define    AEREO_CREATOR_PERIOD  200000
178
#define    AEREO_CREATOR_WCET       300
179
#define    AEREO_CREATOR_MET        100
180
 
181
// -----------------------------------
182
// *** Elementi Task Cannone_Creator ***
183
// -----------------------------------
184
#define    CANNONE_CREATOR_PERIOD 1000000
185
#define    CANNONE_CREATOR_WCET       150
186
#define    CANNONE_CREATOR_MET         50
187
 
188
// ---------------------------
189
// *** Elementi Task Aereo ***
190
// ---------------------------
191
#define    AEREO_N_MAX          10
192
#define    AEREO_N_MIN          1
193
 
194
#define    AEREO_TRASPARENT_COL FAB_white
195
#define    AEREO_BASE_COL       FAB_green
196
#define    AEREO_LX             32
197
#define    AEREO_LY             19
198
#define    AEREO_H_MIN  500    // [m]:    altezza min di volo
199
#define    AEREO_H_MAX  2000   // [m]:    altezza max di volo (<BASE_H)
200
#define    AEREO_L_MIN  0      // [km]:   posizione 0 nella base
201
#define    AEREO_L_MAX  BASE_L // [km]    posizione max nella base
202
#define    AEREO_V_MIN  300.0  // [Km/h]: velocit… min di volo
203
#define    AEREO_V_MAX  500.0  // [Km/h]: velocit… max di volo
204
#define    AEREO_X_MIN  X0 - AEREO_LX/2
205
#define    AEREO_X_MAX  X1 + AEREO_LX/2
206
 
207
#define    AEREO_PERIOD  30000
208
#define    AEREO_WCET     1250   //Verificato!
209
#define    AEREO_MET       800
210
 
211
struct { BYTE       status;  //[0=free/1=occupato]
212
         BYTE       killing; //richiesta uscita se Š 1 altrimenti 0
213
         PID        pid;
214
         COLOR      color;
215
         FAB_IMAGE* image;
216
         double     vel;     //[km/h]
217
         int        dir;     //[+1/-1]
218
         WORD       h;       //[m]
219
         double     l;       //[km]
220
         WORD       x, y;    //[pixel]
221
                         } aereo_table[AEREO_N_MAX];
222
 
223
int                        aereo_count;
224
 
225
// -----------------------------
226
// *** Elementi Task Cannone ***
227
// -----------------------------
228
#define    CANNONE_N_MAX          9
229
#define    CANNONE_N_MIN          1
230
 
231
#define    CANNONE_SENSIBILITA    200 //[m]
232
 
233
#define    CANNONE_TRASPARENT_COL FAB_white
234
#define    CANNONE_LX             33
235
#define    CANNONE_LY             15
236
 
237
#define    CANNONE_PERIOD 100000
238
#define    CANNONE_WCET     1000
239
#define    CANNONE_MET       100
240
 
241
struct { BYTE       status;  //[0=free/1=occupato]
242
         BYTE       killing; //richiesta uscita se Š 1 altrimenti 0
243
         PID        pid;
244
         BYTE       fire;
245
         WORD       x;
246
         double     missile_vel;
247
                         } cannone_table[CANNONE_N_MAX];
248
 
249
int                        cannone_count;
250
 
251
// -----------------------------
252
// *** Elementi Task Missile ***
253
// -----------------------------
254
#define    MISSILE_V_MIN            300.0  //[km/h]
255
#define    MISSILE_V_MAX            5000.0 //[km/h]
256
#define    MISSILE_ACC_MIN            100000.0    //[km/(h*h)]
257
#define    MISSILE_ACC_MAX          10000000.0    //[km/(h*h)]
258
#define    MISSILE_X_MAX            X1 + MISSILE_LX/2 //[pixel]
259
#define    MISSILE_X_MIN            X0 - MISSILE_LX/2 //[pixel]
260
#define    MISSILE_Y_MAX            Y1 + MISSILE_LY/2 //[pixel]
261
#define    MISSILE_Y_MIN            Y0 - MISSILE_LY/2 //[pixel]
262
 
263
#define    MISSILE_TRASPARENT_COL   FAB_white
264
 
265
#define    MISSILE_LX               7 //[pixel]
266
#define    MISSILE_LY               15 //[pixel]
267
 
268
#define    MISSILE_PERIOD  10000
269
#define    MISSILE_WCET      500
270
#define    MISSILE_MET       100
271
 
272
 
273
 
274
 
275
 
276
// MUTEX:
277
mutex_t grx_mutex; //per l'accesso alla grafica
278
int app_mutex_init(mutex_t *m);
279
 
280
 
281
 
282
// FUNZIONI GESTIONE RISORSE DI MEMORIA:
283
void kern_init_bca();
284
 
285
 
286
 
287
//------------------END------------------
288
#endif