Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1085 pj 1
/*
2
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *               Gerardo Lamastra <gerardo@sssup.it>
6
 *
7
 * Authors     : Paolo Gai <pj@hartik.sssup.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://hartik.sssup.it
15
 */
16
 
17
/**
18
 ------------
19
 CVS :        $Id: initfile.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
20
 
21
 File:        $File$
22
 Revision:    $Revision: 1.1.1.1 $
23
 Last update: $Date: 2002-09-02 09:37:41 $
24
 ------------
25
 
26
 System initialization file
27
 
28
 h3pi.c
29
 
30
 This file is equal to hartik3.c plus the resources module...
31
 
32
**/
33
 
34
/*
35
 * Copyright (C) 2000 Paolo Gai
36
 *
37
 * This program is free software; you can redistribute it and/or modify
38
 * it under the terms of the GNU General Public License as published by
39
 * the Free Software Foundation; either version 2 of the License, or
40
 * (at your option) any later version.
41
 *
42
 * This program is distributed in the hope that it will be useful,
43
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
45
 * GNU General Public License for more details.
46
 *
47
 * You should have received a copy of the GNU General Public License
48
 * along with this program; if not, write to the Free Software
49
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
50
 *
51
 */
52
 
53
//#define PI
54
 
55
#include "kernel/kern.h"
56
#include "modules/edf.h"
57
#include "modules/cbs.h"
58
#include "modules/rr.h"
59
 
60
#ifndef PI
61
#include "modules/rrsoft.h"
62
#endif
63
 
64
#include "modules/dummy.h"
65
 
66
#include "modules/sem.h"
67
#include "modules/hartport.h"
68
#include "modules/cabs.h"
69
#include "modules/pi.h"
70
#include "modules/pc.h"
71
#include "modules/srp.h"
72
#include "modules/npp.h"
73
#include "modules/nop.h"
74
 
75
#include "drivers/keyb.h"
76
 
77
 
78
/*+ sysyem tick in us +*/
79
#define TICK 1000
80
 
81
/*+ RR tick in us +*/
82
#define RRTICK 10000
83
//#define RRTICK 3000
84
 
85
TIME __kernel_register_levels__(void *arg)
86
{
87
  struct multiboot_info *mb = (struct multiboot_info *)arg;
88
 
89
#ifdef PI
90
  EDF_register_level(EDF_ENABLE_ALL);
91
  CBS_register_level(CBS_ENABLE_ALL, 0);
92
#else
93
  RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
94
  RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); //cbs
95
#endif
96
 
97
  RR_register_level(RRTICK, RR_MAIN_YES, mb);
98
  dummy_register_level();
99
 
100
 
101
  SEM_register_module();
102
 
103
  CABS_register_module();
104
 
105
  PI_register_module();
106
  NOP_register_module();
107
 
108
  return TICK;
109
}
110
 
111
TASK __init__(void *arg)
112
{
113
  struct multiboot_info *mb = (struct multiboot_info *)arg;
114
 
115
  HARTPORT_init();
116
 
117
  kern_printf("TIME=%ld\n",sys_gettime(NULL));
118
  KEYB_init(NULL);
119
  kern_printf("TIME=%ld\n",sys_gettime(NULL));
120
//  KEYB_init(NULL);
121
 
122
  __call_main__(mb);
123
 
124
  return (void *)0;
125
}
126
 
127
 
128
#ifdef PI
129
void app_mutex_init(mutex_t *m)
130
{
131
  PI_mutexattr_t attr;
132
 
133
  PI_mutexattr_default(attr);
134
 
135
  mutex_init(m, &attr);
136
}
137
#else
138
void app_mutex_init(mutex_t *m)
139
{
140
  NOP_mutexattr_t attr;
141
 
142
  NOP_mutexattr_default(attr);
143
 
144
  mutex_init(m, &attr);
145
}
146
#endif