Subversion Repositories shark

Rev

Rev 1090 | Rev 1117 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1091 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
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/* CVS :        $Id: initfile.c,v 1.2 2002-10-01 10:33:51 pj Exp $ */
22
 
23
/*
24
 * Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.it>
25
 *
26
 * This program is free software; you can redistribute it and/or modify
27
 * it under the terms of the GNU General Public License as published by
28
 * the Free Software Foundation; either version 2 of the License, or
29
 * (at your option) any later version.
30
 *
31
 * This program is distributed in the hope that it will be useful,
32
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 * GNU General Public License for more details.
35
 *
36
 * You should have received a copy of the GNU General Public License
37
 * along with this program; if not, write to the Free Software
38
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39
 *
40
 */
41
 
42
/****************************************************
43
 *                                                  *
44
 *  file:        initfile.h                         *
45
 *  data:        15/09/2002                         *
46
 *  creato da:   Fabio CALABRESE                    *
47
 *                                                  *
48
 ******************************************************
49
 *                                                    *
50
 *  descrizione: inizializza i moduli di scheduling e *
51
 *               di risorse per il programma SHaRK    *
52
 *               "(B)ase(C)ontr(A)rea", il cui task   *
53
 *               main e' nel file bca.c.              *
54
 *                                                    *
55
 ******************************************************/
56
 
57
#define PI
58
 
59
// *** Librerie S.Ha.R.K ***
60
#include "kernel/kern.h"
61
#include "modules/edf.h"
62
#include "modules/cbs.h"
63
#include "modules/rr.h"
64
#include "modules/dummy.h"
65
#include "modules/sem.h"
66
#include "modules/hartport.h"
67
#include "modules/cabs.h"
68
#include "drivers/keyb.h"
69
// *** Librerie Standard C ***
70
// *** Librerie FAB ***
71
// *** Librerie BCA ***
72
#include"bca.h"
73
 
74
/*+ system tick in us +*/
75
#define TICK 1000
76
 
77
/*+ RR tick in us +*/
78
#define RRTICK 10000
79
 
80
TIME __kernel_register_levels__(void *arg)
81
{
82
  struct multiboot_info *mb = (struct multiboot_info *)arg;
83
 
84
  EDF_register_level(EDF_ENABLE_ALL);
85
  CBS_register_level(CBS_ENABLE_ALL, 0);
86
  RR_register_level(RRTICK, RR_MAIN_YES, mb);
87
  dummy_register_level();
88
 
89
  SEM_register_module();
90
  CABS_register_module();
91
  PI_register_module();
92
  NOP_register_module();
93
 
94
  kern_init_bca();
95
 
96
  // periodic timer
97
  return TICK;
98
  // one-shot timer
99
  // return 0
100
}
101
 
102
TASK __init__(void *arg)
103
{
104
  struct multiboot_info *mb = (struct multiboot_info *)arg;
105
 
106
  KEYB_PARMS kparms = BASE_KEYB;
107
 
108
  HARTPORT_init();
109
 
110
  keyb_def_ctrlC(kparms, NULL);
111
  KEYB_init(&kparms);
112
 
113
  __call_main__(mb);
114
 
115
  return (void *)0;
116
}
117
 
118
#ifdef PI
119
int app_mutex_init(mutex_t *m)
120
{
121
  PI_mutexattr_t attr;
122
 
123
  PI_mutexattr_default(attr);
124
 
125
  return mutex_init(m, &attr);
126
}
127
#else
128
int app_mutex_init(mutex_t *m)
129
{
130
  NOP_mutexattr_t attr;
131
 
132
  NOP_mutexattr_default(attr);
133
 
134
  return mutex_init(m, &attr);
135
}
136
#endif
137