Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 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
 ------------
21
 CVS :        $Id: initg.c,v 1.1.1.1 2002-03-29 14:12:52 pj Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1.1.1 $
25
 Last update: $Date: 2002-03-29 14:12:52 $
26
 ------------
27
 
28
 System initialization file
29
 
30
 The tick is set to TICK ms.
31
 
32
 This file contains the 2 functions needed to initialize the system.
33
 
34
 These functions register the following levels:
35
 
36
 an EDF (Earliest Deadline First) level
37
 a RR (Round Robin) level
38
 a CBS (Costant Bandwidth Server) level
39
 a Dummy level
40
 
41
 It can accept these task models:
42
 
43
 HARD_TASK_MODEL (wcet+mit) at level 0
44
 NRT_TASK_MODEL  at level 1
45
 SOFT_TASK_MODEL (met, period) at level 2
46
 
47
 This file is similar to the configuration of Hartik 3.3.1
48
 
49
**/
50
 
51
/*
52
 * Copyright (C) 2000 Paolo Gai
53
 *
54
 * This program is free software; you can redistribute it and/or modify
55
 * it under the terms of the GNU General Public License as published by
56
 * the Free Software Foundation; either version 2 of the License, or
57
 * (at your option) any later version.
58
 *
59
 * This program is distributed in the hope that it will be useful,
60
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62
 * GNU General Public License for more details.
63
 *
64
 * You should have received a copy of the GNU General Public License
65
 * along with this program; if not, write to the Free Software
66
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
67
 *
68
 */
69
 
70
 
71
 
72
#include "kernel/kern.h"
73
 
74
#include "modules/edf.h"
75
#include "modules/rm.h"
76
 
77
#include "modules/cbs.h"
78
#include "modules/tbs.h"
79
#include "modules/ps.h"
80
#include "modules/ds.h"
81
 
82
#include "modules/rr.h"
83
#include "modules/rr2.h"
84
 
85
#include "modules/dummy.h"
86
 
87
#include "modules/sem.h"
88
#include "modules/hartport.h"
89
#include "modules/cabs.h"
90
 
91
#include "drivers/keyb.h"
92
 
93
 
94
/*+ sysyem tick in us +*/
95
#define TICK 300
96
 
97
/*+ RR tick in us +*/
98
#define RRTICK 10000
99
 
100
 
101
/* the mouse task use 160 us approx on my Celeron 366 */
102
#define NUM 200
103
#define DEN 64000
104
//#define DEN 8000
105
 
106
//#undef XXX
107
//#define XXX
108
 
109
int argc;
110
char *argv[100];
111
 
112
extern char *title;
113
 
114
TIME __kernel_register_levels__(void *arg)
115
{
116
  struct multiboot_info *mb = (struct multiboot_info *)arg;
117
 
118
  int conf;
119
 
120
  __compute_args__(mb,&argc, argv);
121
 
122
  if (argc < 2)
123
    conf = '0'; // default
124
  else
125
    conf = *argv[1];
126
 
127
  switch (conf) {
128
  case '1':
129
    RM_register_level(0);  // NO GUARANTEE!!!
130
    PS_register_level(PS_ENABLE_BACKGROUND, 0, NUM, DEN);
131
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
132
    title = "1 - RM  + PS (  bkg, U=1/16) + RR, no check Ulub < 0.69";
133
    break;
134
 
135
  case '2':
136
    RM_register_level(0);  // NO GUARANTEE!!!
137
    PS_register_level(0, 0, NUM, DEN);
138
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
139
    title = "2 - RM  + PS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n";
140
    break;
141
 
142
  case '3':
143
    EDF_register_level(2);
144
    PS_register_level(PS_ENABLE_ALL_EDF, 0, NUM, DEN);
145
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
146
    title = "3 - EDF + PS (  bkg, U=1/16) + RR";
147
    break;
148
 
149
  case '4':
150
    EDF_register_level(2);
151
    PS_register_level(PS_ENABLE_GUARANTEE_EDF, 0, NUM, DEN);
152
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
153
    title = "4 - EDF + PS (nobkg, U=1/16) + RR";
154
    break;
155
 
156
  case '5':
157
    EDF_register_level(2);
158
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
159
    TBS_register_level(TBS_ENABLE_ALL, 0, NUM, DEN);
160
    title = "5 - EDF + TBS(       U=1/16) + RR";
161
    break;
162
 
163
  case '6':
164
    RM_register_level(0);  // NO GUARANTEE!!!
165
    DS_register_level(DS_ENABLE_BACKGROUND, 0, NUM, DEN);
166
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
167
    title = "6 - RM  + DS (  bkg, U=1/16) + RR, no check Ulub < 0.69";
168
    break;
169
 
170
  case '7':
171
    RM_register_level(0);  // NO GUARANTEE!!!
172
    DS_register_level(0, 0, NUM, DEN);
173
    RR_register_level(RRTICK, RR_MAIN_YES, mb);
174
    title = "7 - RM  + DS (nobkg, U=1/16) + RR, no check Ulub < 0.69\n";
175
    break;
176
 
177
  default: // '0'
178
    EDF_register_level(2);
179
    RR2_register_level(RRTICK, RR2_MAIN_YES, mb);
180
    CBS_register_level(CBS_ENABLE_ALL, 0);
181
    title = "0 - EDF + CBS                + RR";
182
  }
183
 
184
  dummy_register_level();
185
 
186
  SEM_register_module();
187
 
188
  CABS_register_module();
189
 
190
  return TICK;
191
}
192
 
193
int main(int argc, char **argv);
194
 
195
TASK __init__(void *arg)
196
{
197
//  struct multiboot_info *mb = (struct multiboot_info *)arg;
198
 
199
  HARTPORT_init();
200
 
201
  KEYB_init(NULL);
202
 
203
  main(argc,argv);
204
 
205
  return (void *)0;
206
}
207