Rev 1655 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1655 | giacomo | 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 | * (see the web pages for full authors list) |
||
11 | * |
||
12 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
13 | * |
||
14 | * http://www.sssup.it |
||
15 | * http://retis.sssup.it |
||
16 | * http://shark.sssup.it |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | ------------ |
||
21 | CVS : $Id: demo.h,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $ |
||
22 | |||
23 | File: $File$ |
||
24 | Revision: $Revision: 1.1.1.1 $ |
||
25 | Last update: $Date: 2004-05-24 18:03:47 $ |
||
26 | ------------ |
||
27 | **/ |
||
28 | |||
29 | /* |
||
30 | * Copyright (C) 2000 Paolo Gai |
||
31 | * |
||
32 | * This program is free software; you can redistribute it and/or modify |
||
33 | * it under the terms of the GNU General Public License as published by |
||
34 | * the Free Software Foundation; either version 2 of the License, or |
||
35 | * (at your option) any later version. |
||
36 | * |
||
37 | * This program is distributed in the hope that it will be useful, |
||
38 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
39 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
40 | * GNU General Public License for more details. |
||
41 | * |
||
42 | * You should have received a copy of the GNU General Public License |
||
43 | * along with this program; if not, write to the Free Software |
||
44 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
45 | * |
||
46 | */ |
||
47 | |||
48 | |||
49 | #include <ll/ll.h> |
||
50 | #include <kernel/types.h> |
||
51 | #include <kernel/descr.h> |
||
52 | #include <math.h> |
||
53 | #include <drivers/glib.h> |
||
54 | #include <drivers/keyb.h> |
||
55 | |||
56 | #include <modules/hartport.h> |
||
57 | #include <modules/sem.h> |
||
58 | |||
59 | #define JET_ON |
||
60 | #define BALL_ON |
||
61 | |||
62 | /* |
||
63 | * |
||
64 | * WCET, Periods and Models |
||
65 | * |
||
66 | */ |
||
67 | |||
68 | |||
69 | /* define if you want NRT or SOFT... */ |
||
70 | #define TASK_TYPE SOFT |
||
71 | //#define TASK_TYPE NRT |
||
72 | |||
73 | #define WCET_JETCTRL 7500 |
||
74 | #define WCET_JETDUMMY 200 |
||
75 | #define WCET_JETSLIDE 2100 |
||
76 | |||
77 | #define PERIOD_JETCTRL 100000 |
||
78 | #define PERIOD_JETDUMMY 100000 |
||
79 | #define PERIOD_JETSLIDE 100000 |
||
80 | |||
81 | |||
82 | //#define WCET_BALL 100 |
||
83 | #define WCET_BALL 500 |
||
84 | |||
85 | #define PERIOD_BALL 25000 |
||
86 | |||
87 | #define WCET_SCHED 450 |
||
88 | |||
89 | #define PERIOD_SCHED 15000 |
||
90 | |||
91 | /* |
||
92 | * |
||
93 | * Global Stuffs |
||
94 | * |
||
95 | */ |
||
96 | |||
97 | /* graphic mutex... */ |
||
98 | extern mutex_t mutex; |
||
99 | |||
100 | /* sincronizzazione */ |
||
101 | //extern sem_t pmutex; |
||
102 | extern mutex_t palmutex; |
||
103 | |||
104 | /* useful colors... */ |
||
105 | extern int white; |
||
106 | extern int black; |
||
107 | extern int red; |
||
108 | extern int gray; |
||
109 | extern int green; |
||
110 | |||
111 | void init_jetcontrol(); |
||
112 | void init_ball(void); |
||
113 | void scenario_jetcontrol(); |
||
114 | void scenario_ball(); |
||
115 | char *itoa(int n, char *s); |
||
116 | int myrand(int x); |
||
117 | |||
118 | void initSched(void); |
||
119 | void setPalla (int); |
||
120 | void inizioPartita (void); |
||
121 | void collisioneRilevata(int); |
||
122 | int controlloBuche (float, float, int); |
||
123 | void hardSched (void); |
||
124 | void hardball (void); |
||
125 | |||
126 | /* |
||
127 | * |
||
128 | * JETCONTROL stuffs |
||
129 | * |
||
130 | */ |
||
131 | |||
132 | #define JET_NTASK 15 |
||
133 | #define JET_Y_NAME 170 |
||
134 | |||
135 | #define DUMMY_PID 1 |
||
136 | |||
137 | #define JET_DUMMY_WIDTH 210 |
||
138 | #define JET_DUMMY_HEIGHT 80 |
||
139 | |||
140 | /* the point (x, y) is the top left corner */ |
||
141 | #define JET_DUMMY_X 428 |
||
142 | #define JET_DUMMY_Y 65 |
||
143 | |||
144 | #define JET_SLIDE_WIDTH 50 |
||
145 | #define JET_SLIDE_X 576 |
||
146 | |||
147 | |||
148 | |||
149 | |||
150 | /* |
||
151 | * |
||
152 | * BALL stuffs |
||
153 | * |
||
154 | */ |
||
155 | |||
156 | // x and y corners are specified whithout consider a border of 3 pixels |
||
157 | #define BALL_YMAX 390 /* position of the ceil */ |
||
158 | #define BALL_Y 425 /* position of the floor */ |
||
159 | #define BALL_VELY .1 /* vertical ball velocity */ |
||
160 | #define BALL_HEIGHT 5 /* initial height of the ball */ |
||
161 | #define BALL_XMIN 65 /* min position X of the ball */ |
||
162 | #define BALL_XMAX 255 /* max position X of the ball */ |
||
163 | #define BALL_VELX 0. /* horizontal ball velocity */ |
||
164 | #define BALL_VYMIN 11. /* min ground speed */ |
||
165 | #define BALL_MAX_P 11 /* max number of balls */ |
||
166 | |||
167 | #define BALL_GROUP 2 /* task group of the balls */ |
||
168 | |||
169 | #define COLLISION 1 |
||
170 | #define NO_COLLISION 0 |