Subversion Repositories shark

Rev

Rev 1085 | Go to most recent revision | 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
 ------------
21
 CVS :        $Id: initfile.c,v 1.1.1.1 2002-09-02 09:37:41 pj Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1.1.1 $
25
 Last update: $Date: 2002-09-02 09:37:41 $
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
#define PI
49
 
50
#include "kernel/kern.h"
51
#include "modules/edf.h"
52
#include "modules/cbs.h"
53
#include "modules/rr.h"
54
 
55
#ifndef PI
56
#include "modules/rrsoft.h"
57
#endif
58
 
59
#include "modules/dummy.h"
60
 
61
#include "modules/sem.h"
62
#include "modules/hartport.h"
63
#include "modules/cabs.h"
64
#include "modules/pi.h"
65
#include "modules/pc.h"
66
#include "modules/srp.h"
67
#include "modules/npp.h"
68
#include "modules/nop.h"
69
 
70
#include "drivers/keyb.h"
71
 
72
 
73
/*+ sysyem tick in us +*/
74
#define TICK 0
75
 
76
/*+ RR tick in us +*/
77
//#define RRTICK 10000
78
#define RRTICK 2000
79
 
80
TIME __kernel_register_levels__(void *arg)
81
{
82
  struct multiboot_info *mb = (struct multiboot_info *)arg;
83
 
84
#ifdef PI
85
  EDF_register_level(EDF_ENABLE_ALL);
86
  CBS_register_level(CBS_ENABLE_ALL, 0);
87
#else
88
  RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
89
  RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT); //cbs
90
#endif
91
 
92
  RR_register_level(RRTICK, RR_MAIN_YES, mb);
93
  dummy_register_level();
94
 
95
 
96
  SEM_register_module();
97
 
98
  CABS_register_module();
99
 
100
  PI_register_module();
101
  NOP_register_module();
102
 
103
  return TICK;
104
}
105
 
106
TASK __init__(void *arg)
107
{
108
  struct multiboot_info *mb = (struct multiboot_info *)arg;
109
 
110
  HARTPORT_init();
111
 
112
  kern_printf("TIME=%d\n",sys_gettime(NULL));
113
  KEYB_init(NULL);
114
  kern_printf("TIME=%d\n",sys_gettime(NULL));
115
//  KEYB_init(NULL);
116
 
117
  __call_main__(mb);
118
 
119
  return (void *)0;
120
}
121
 
122
 
123
#ifdef PI
124
void app_mutex_init(mutex_t *m)
125
{
126
  PI_mutexattr_t attr;
127
 
128
  PI_mutexattr_default(attr);
129
 
130
  mutex_init(m, &attr);
131
}
132
#else
133
void app_mutex_init(mutex_t *m)
134
{
135
  NOP_mutexattr_t attr;
136
 
137
  NOP_mutexattr_default(attr);
138
 
139
  mutex_init(m, &attr);
140
}
141
#endif