Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1664 | pj | 1 | /*------------------------------- |
2 | ------------ |
||
3 | CVS : $Id: myinitfile3.c,v 1.1 2004-07-05 14:39:47 pj Exp $ |
||
4 | |||
5 | File: $File$ |
||
6 | Revision: $Revision: 1.1 $ |
||
7 | Last update: $Date: 2004-07-05 14:39:47 $ |
||
8 | ------------ |
||
9 | |||
10 | System initialization file |
||
11 | |||
12 | This file contains the 2 functions needed to initialize the system. |
||
13 | |||
14 | These functions register the following levels: |
||
15 | |||
16 | an EDF (Earliest Deadline First) level |
||
17 | a RR (Round Robin) level |
||
18 | a CBS (Costant Bandwidth Server) level |
||
19 | a Dummy level |
||
20 | |||
21 | It can accept these task models: |
||
22 | |||
23 | HARD_TASK_MODEL (wcet+mit) at level 0 |
||
24 | SOFT_TASK_MODEL (met, period) at level 1 |
||
25 | NRT_TASK_MODEL at level 2 |
||
26 | |||
27 | This file is similar to the configuration of kernel/init/hartik3.c |
||
28 | |||
29 | TICK is set to 0 (one-shot timer is used) |
||
30 | */ |
||
31 | |||
32 | /* |
||
33 | * Copyright (C) 2000 Paolo Gai |
||
34 | * |
||
35 | * This program is free software; you can redistribute it and/or modify |
||
36 | * it under the terms of the GNU General Public License as published by |
||
37 | * the Free Software Foundation; either version 2 of the License, or |
||
38 | * (at your option) any later version. |
||
39 | * |
||
40 | * This program is distributed in the hope that it will be useful, |
||
41 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
42 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
43 | * GNU General Public License for more details. |
||
44 | * |
||
45 | * You should have received a copy of the GNU General Public License |
||
46 | * along with this program; if not, write to the Free Software |
||
47 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
48 | * |
||
49 | */ |
||
50 | |||
51 | |||
52 | #include "kernel/kern.h" |
||
53 | #include "modules/edf.h" |
||
54 | #include "modules/cbs.h" |
||
55 | #include "modules/rr.h" |
||
56 | #include "modules/dummy.h" |
||
57 | |||
58 | #include "modules/sem.h" |
||
59 | #include "modules/hartport.h" |
||
60 | #include "modules/cabs.h" |
||
61 | #include "modules/pi.h" |
||
62 | #include "modules/pc.h" |
||
63 | #include "modules/nop.h" |
||
64 | |||
65 | |||
66 | #include "drivers/keyb.h" |
||
67 | |||
68 | |||
69 | /*+ sysyem tick in us +*/ |
||
70 | #define TICK 0 |
||
71 | |||
72 | /*+ RR tick in us +*/ |
||
73 | #define RRTICK 10000 |
||
74 | |||
75 | TIME __kernel_register_levels__(void *arg) |
||
76 | { |
||
77 | struct multiboot_info *mb = (struct multiboot_info *)arg; |
||
78 | |||
79 | EDF_register_level(EDF_ENABLE_ALL); |
||
80 | CBS_register_level(CBS_ENABLE_ALL, 0); |
||
81 | RR_register_level(RRTICK, RR_MAIN_YES, mb); |
||
82 | dummy_register_level(); |
||
83 | NOP_register_module(); |
||
84 | |||
85 | PC_register_module(); /*regirtering the priority ceilig module*/ |
||
86 | |||
87 | SEM_register_module(); /*registering semaphores is it required??*/ |
||
88 | |||
89 | CABS_register_module();/*ofcourse required to create cabs structure*/ |
||
90 | |||
91 | PI_register_module(); |
||
92 | |||
93 | return TICK; |
||
94 | } |
||
95 | |||
96 | TASK __init__(void *arg) |
||
97 | { |
||
98 | struct multiboot_info *mb = (struct multiboot_info *)arg; |
||
99 | |||
100 | KEYB_PARMS kparms = BASE_KEYB; |
||
101 | |||
102 | HARTPORT_init(); |
||
103 | |||
104 | keyb_def_ctrlC(kparms, NULL); |
||
105 | keyb_def_map(kparms,itaMap); |
||
106 | KEYB_init(&kparms); |
||
107 | |||
108 | __call_main__(mb); |
||
109 | |||
110 | return (void *)0; |
||
111 | } |
||
112 | /*-------------------------------- |
||
113 | for using priority ceiling |
||
114 | ---------------------------------*/ |
||
115 | /*void app_mutex_init(mutex_t *m) |
||
116 | { |
||
117 | PC_mutexattr_t attr; |
||
118 | PC_mutexattr_default(attr,1); |
||
119 | mutex_init(m, &attr); |
||
120 | }*/ |
||
121 | |||
122 | /*------------------------------------ |
||
123 | for using Priority inheritance |
||
124 | ---------------------------------------*/ |
||
125 | /*int app_mutex_init(mutex_t *m) |
||
126 | { |
||
127 | PI_mutexattr_t attr; |
||
128 | PI_mutexattr_default(attr); |
||
129 | return mutex_init(m,&attr); |
||
130 | }*/ |
||
131 | |||
132 | /*------------------------------------ |
||
133 | for using NOP protocol |
||
134 | ---------------------------------------*/ |
||
135 | |||
136 | int app_mutex_init(mutex_t *m) |
||
137 | { |
||
138 | NOP_mutexattr_t attr; |
||
139 | NOP_mutexattr_default(attr); |
||
140 | return mutex_init(m, &attr); |
||
141 | } |
||
142 | |||
143 | |||
144 | |||
145 |