Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1138 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>
1569 tullio 10
 *   Tullio Facchinetti  <tullio.facchinetti@unipv.it>
1138 giacomo 11
 *   (see the web pages for full authors list)
12
 *
13
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
14
 *
15
 * http://www.sssup.it
16
 * http://retis.sssup.it
17
 * http://shark.sssup.it
18
 */
19
 
20
/*
21
 * Copyright (C) 2000 Paolo Gai
22
 *
23
 * This program is free software; you can redistribute it and/or modify
24
 * it under the terms of the GNU General Public License as published by
25
 * the Free Software Foundation; either version 2 of the License, or
26
 * (at your option) any later version.
27
 *
28
 * This program is distributed in the hope that it will be useful,
29
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31
 * GNU General Public License for more details.
32
 *
33
 * You should have received a copy of the GNU General Public License
34
 * along with this program; if not, write to the Free Software
35
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
36
 *
37
 */
38
 
39
/*
1569 tullio 40
 * CVS :        $Id: initfile.c,v 1.5 2006-03-09 14:17:03 tullio Exp $
1138 giacomo 41
 *
42
 * File:        $File$
1569 tullio 43
 * Revision:    $Revision: 1.5 $
44
 * Last update: $Date: 2006-03-09 14:17:03 $
1138 giacomo 45
 */
46
 
47
#include "kernel/kern.h"
1552 pj 48
#include "edf/edf/edf.h"
49
#include "rr/rr/rr.h"
50
#include "cbs/cbs/cbs.h"
51
#include "dummy/dummy/dummy.h"
1138 giacomo 52
 
1552 pj 53
#include "sem/sem/sem.h"
54
#include "hartport/hartport/hartport.h"
55
#include "cabs/cabs/cabs.h"
56
#include "pi/pi/pi.h"
57
#include "pc/pc/pc.h"
58
#include "srp/srp/srp.h"
59
#include "npp/npp/npp.h"
60
#include "nop/nop/nop.h"
61
#include "nopm/nopm/nopm.h"
1138 giacomo 62
 
63
#include "fs/bdevinit.h"
64
#include "fs/fsinit.h"
65
#include "fs/bdev.h"
66
 
67
#include "drivers/keyb.h"
68
 
69
/*+ sysyem tick in us +*/
70
#define TICK 1000
71
 
72
/*+ RR tick in us +*/
73
#define RRTICK 10000
74
 
75
dev_t root_device=-1;
76
dev_t temp_device=-1;
77
 
78
int __register_sub_init(void)
79
{
80
#if defined(EDFSCHED)
81
  extern void BD_EDF_register_module(void);
82
  BD_EDF_register_module();
83
#elif defined(PSCANSCHED)
84
  extern void BD_PSCAN_register_module(void);
85
  BD_PSCAN_register_module();  
86
#endif
87
  return 0;
88
}
89
 
90
int choose_root_callback(dev_t dev,u_int8_t fs)
91
{
92
  if (fs==FS_MSDOS) return dev;
93
  return -1;
94
}
95
 
96
int choose_temp_callback(__dev_t dev,__uint8_t fs)
97
{
98
  static int flag=0;
99
  if (fs==FS_MSDOS) {
100
    if (flag) return dev;
101
    flag=1;
102
  }
103
  return -1;
104
}
105
 
106
int __bdev_sub_init(void)
107
{
108
  BDEV_PARMS bdev=BASE_BDEV;
109
 
110
  bdev_def_showinfo(bdev,FALSE);
111
  bdev_init(&bdev);
112
 
113
  root_device=bdev_scan_devices(choose_root_callback);
114
  if (root_device<0) {
115
    cprintf("can't find root device to mount on /!!!\n");
1550 pj 116
    exit(1);
1138 giacomo 117
  }
118
 
119
  return 0;
120
 
121
}
122
 
123
int __fs_sub_init(void)
124
{
125
  extern int libc_initialize(void);
126
  FILESYSTEM_PARMS fs=BASE_FILESYSTEM;
127
 
128
  filesystem_def_rootdevice(fs,root_device);
129
  filesystem_def_fs(fs,FS_MSDOS);
130
  filesystem_def_showinfo(fs,FALSE);
131
  filesystem_init(&fs);
132
 
133
  libc_initialize();
134
 
135
  return 0;
136
}
137
 
138
TIME __kernel_register_levels__(void *arg)
139
{
140
  struct multiboot_info *mb = (struct multiboot_info *)arg;
141
  extern int __register_sub_init(void);
1569 tullio 142
  LEVEL EDF_level;
1138 giacomo 143
 
1569 tullio 144
  EDF_level = EDF_register_level(EDF_ENABLE_ALL);
1138 giacomo 145
  RR_register_level(RRTICK, RR_MAIN_YES, mb);
1569 tullio 146
  CBS_register_level(CBS_ENABLE_ALL, EDF_level);
1138 giacomo 147
  dummy_register_level();
148
 
149
  SEM_register_module();
150
 
151
  CABS_register_module();
152
 
153
  PI_register_module();
154
  PC_register_module();
155
  NPP_register_module();
156
  SRP_register_module();
157
  NOP_register_module();
158
  NOPM_register_module();
159
 
160
  __register_sub_init();
161
 
162
  return TICK;
163
}
164
 
165
TASK __init__(void *arg)
166
{
167
  struct multiboot_info *mb = (struct multiboot_info *)arg;
168
  KEYB_PARMS    keyb = BASE_KEYB;
169
  extern int __bdev_sub_init(void);
170
  extern int __fs_sub_init(void);
171
 
172
  HARTPORT_init();
173
 
174
  KEYB_init(&keyb);
175
 
176
  __bdev_sub_init();
177
  __fs_sub_init();
178
 
179
  __call_main__(mb);
180
 
181
  return (void *)0;
182
}
183