Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1664 | 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.1 2004-07-05 14:39:39 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/pi.h" |
||
66 | #include "modules/nop.h" |
||
67 | #include "modules/sem.h" |
||
68 | #include "modules/hartport.h" |
||
69 | #include "modules/cabs.h" |
||
70 | #include "drivers/keyb.h" |
||
71 | // *** Librerie Standard C *** |
||
72 | // *** Librerie FAB *** |
||
73 | // *** Librerie BCA *** |
||
74 | #include"Illa.h" |
||
75 | |||
76 | /*+ system tick in us +*/ |
||
77 | #define TICK 1000 |
||
78 | |||
79 | /*+ RR tick in us +*/ |
||
80 | #define RRTICK 10000 |
||
81 | |||
82 | TIME __kernel_register_levels__(void *arg) |
||
83 | { |
||
84 | struct multiboot_info *mb = (struct multiboot_info *)arg; |
||
85 | |||
86 | EDF_register_level(EDF_ENABLE_ALL); |
||
87 | CBS_register_level(CBS_ENABLE_ALL, 0); |
||
88 | RR_register_level(RRTICK, RR_MAIN_YES, mb); |
||
89 | dummy_register_level(); |
||
90 | |||
91 | SEM_register_module(); |
||
92 | CABS_register_module(); |
||
93 | PI_register_module(); |
||
94 | NOP_register_module(); |
||
95 | |||
96 | kern_init_bca(); |
||
97 | |||
98 | // periodic timer |
||
99 | return TICK; |
||
100 | // one-shot timer |
||
101 | // return 0 |
||
102 | } |
||
103 | |||
104 | TASK __init__(void *arg) |
||
105 | { |
||
106 | struct multiboot_info *mb = (struct multiboot_info *)arg; |
||
107 | |||
108 | KEYB_PARMS kparms = BASE_KEYB; |
||
109 | |||
110 | HARTPORT_init(); |
||
111 | |||
112 | keyb_def_ctrlC(kparms, NULL); |
||
113 | KEYB_init(&kparms); |
||
114 | |||
115 | __call_main__(mb); |
||
116 | |||
117 | return (void *)0; |
||
118 | } |
||
119 | |||
120 | #ifdef PI |
||
121 | int app_mutex_init(mutex_t *m) |
||
122 | { |
||
123 | PI_mutexattr_t attr; |
||
124 | |||
125 | PI_mutexattr_default(attr); |
||
126 | |||
127 | return mutex_init(m, &attr); |
||
128 | } |
||
129 | #else |
||
130 | int app_mutex_init(mutex_t *m) |
||
131 | { |
||
132 | NOP_mutexattr_t attr; |
||
133 | |||
134 | NOP_mutexattr_default(attr); |
||
135 | |||
136 | return mutex_init(m, &attr); |
||
137 | } |
||
138 | #endif |
||
139 |