Subversion Repositories shark

Rev

Rev 1536 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1085 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
 *   (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
 ------------
1575 tullio 21
 CVS :        $Id: demo.h,v 1.8 2006-06-27 09:27:15 tullio Exp $
1085 pj 22
 
23
 File:        $File$
1575 tullio 24
 Revision:    $Revision: 1.8 $
25
 Last update: $Date: 2006-06-27 09:27:15 $
1085 pj 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
 
1379 giacomo 54
#include <drivers/shark_linuxc26.h>
55
#include <drivers/shark_pci26.h>
56
#include <drivers/shark_input26.h>
57
#include <drivers/shark_keyb26.h>
58
#include <drivers/shark_fb26.h>
1085 pj 59
 
1379 giacomo 60
#define FRAME_BUFFER_DEVICE 0 
61
 
1158 pj 62
/* Subparts */
1085 pj 63
#define JET_ON
64
#define BALL_ON
65
 
1158 pj 66
 
67
/* CPU Speed Selection
68
   --------------------------------------------------------------------
1160 pj 69
   1700 - Pentium 4 1.7 GHz
1352 pj 70
   1300 - Centrino 1.3 GHz
1160 pj 71
   400  - Pentium 2 400 MHz
72
   133  - Pentium 1 133 MHz
1158 pj 73
*/
1379 giacomo 74
#define CPU 400
1158 pj 75
 
1085 pj 76
/*
77
 *
78
 * WCET, Periods and Models
79
 *
80
 */
81
 
1158 pj 82
#if CPU==133
83
#define WCET_JETCTRL     10000
84
#define WCET_JETDUMMY      300
85
#define WCET_JETSLIDE     2000
86
#define WCET_BALL          250
87
#define WCET_HARD_BALL    1000
1160 pj 88
#define BALL_DELAY       10000
1158 pj 89
#endif
1085 pj 90
 
1158 pj 91
#if CPU==400
1085 pj 92
#define WCET_JETCTRL      7500
1536 giacomo 93
#define WCET_JETDUMMY      400
1085 pj 94
#define WCET_JETSLIDE     2100
1536 giacomo 95
#define WCET_BALL          250
96
#define WCET_HARD_BALL     480
1160 pj 97
#define BALL_DELAY       10000
1158 pj 98
#endif
1085 pj 99
 
1352 pj 100
#if CPU==1300
101
#define WCET_JETCTRL      4500
1536 giacomo 102
#define WCET_JETDUMMY      200
1352 pj 103
#define WCET_JETSLIDE     1300
1536 giacomo 104
#define WCET_BALL          250
1352 pj 105
#define WCET_HARD_BALL     650
106
#define BALL_DELAY      100000
107
#endif
108
 
1160 pj 109
#if CPU==1700
110
#define WCET_JETCTRL      4500
111
#define WCET_JETDUMMY      100
112
#define WCET_JETSLIDE     1300
1536 giacomo 113
#define WCET_BALL          250
1160 pj 114
#define WCET_HARD_BALL     410
115
#define BALL_DELAY      100000
116
#endif
1158 pj 117
 
1085 pj 118
#define PERIOD_JETCTRL  100000
119
#define PERIOD_JETDUMMY 100000
120
#define PERIOD_JETSLIDE 100000
121
#define PERIOD_BALL      10000
122
 
123
/*
124
 *
125
 * Global Stuffs
126
 *
127
 */
128
 
1379 giacomo 129
extern PID shutdown_task_PID;
1085 pj 130
 
1380 giacomo 131
/* graphic mutex... */
132
extern mutex_t mutex;
133
 
1085 pj 134
/* useful colors... */
135
extern int white;
136
extern int black;
137
extern int red;
138
extern int gray;
139
 
140
void init_jetcontrol();
141
void init_ball(void);
142
void scenario_jetcontrol();
143
void scenario_ball();
144
char *itoa(int n, char *s);
145
int myrand(int x);
146
 
147
/*
148
 *
149
 * JETCONTROL stuffs
150
 *
151
 */
152
 
153
#define JET_NTASK   35
154
#define JET_Y_NAME 170
155
 
1575 tullio 156
/*
157
 *
158
 * ATTENTION: the following PID MUST match
159
 * with the one assigned by Shark to the
160
 * Dummy task during dummy module creation.
161
 *
162
 */
163
#define DUMMY_PID    2
1085 pj 164
 
165
#define JET_DUMMY_WIDTH    210
166
#define JET_DUMMY_HEIGHT    80
167
 
168
/* the point (x, y) is the top left corner */
169
#define JET_DUMMY_X        428
170
#define JET_DUMMY_Y        65
171
 
172
#define JET_SLIDE_WIDTH     50
173
#define JET_SLIDE_X        576
174
 
175
/*
176
 *
177
 * BALL stuffs
178
 *
179
 */
180
 
181
// x and y corners are specified whithout consider a border of 3 pixels
1160 pj 182
#define BALL_Y      450         /* position of the floor        */
183
#define BALL_HEIGHT 385         /* initial height of the ball   */
184
#define BALL_XMIN    10         /* min position X of the ball   */
185
#define BALL_XMAX   370         /* max position X of the ball   */
186
#define BALL_VELX     5.        /* horizontal ball velocity     */
187
#define BALL_VYMIN   11.        /* min ground speed             */
188
#define BALL_MAX_P   60         /* max number of balls          */
1085 pj 189
 
190
#define BALL_GROUP    2          /* task group of the balls */