OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
src
main.cc
gehe zur Dokumentation dieser Datei
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Technische Informatik II *
3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* M A I N *
6
* *
7
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
9
/* INCLUDES */
10
11
#include "
machine/multiboot.h
"
12
#include "
machine/cpu.h
"
13
#include "
device/interruptmanager.h
"
14
#include "
device/keyboard.h
"
15
#include "
device/cgastr.h
"
16
#include "
device/watch.h
"
17
#include "
device/log.h
"
18
#include "
thread/organizer.h
"
19
#include "
locking/interruptLock.h
"
20
#include "
user/task1.h
"
21
#include "
user/task2.h
"
22
#include "
user/task3A.h
"
23
#include "
user/task3B.h
"
24
#include "
user/task4.h
"
25
#include "
user/task5.h
"
26
27
/* MACROS */
28
30
#define USE_TASK 50
31
32
/* GLOBAL OBJECTS */
33
35
CPU
cpu
;
37
InterruptLock
lock
;
39
Log
log
;
41
Organizer
scheduler
;
43
CGA_Stream
kout
;
45
InterruptManager
iManager
;
47
Keyboard
keyboard
;
49
Watch
watch
;
50
51
#if USE_TASK == 10
52
53
Task1
task1;
54
#elif USE_TASK == 20
55
56
Task2
task2;
57
#elif USE_TASK == 30
58
59
Task3A
task3a;
61
Task3B
task3b;
62
#elif USE_TASK == 40
63
64
Task4
task4;
65
#elif USE_TASK == 50
66
67
Task5
task5
;
68
#endif
69
70
/* METHODS */
78
bool
getSubTask
(
char
minSubTask,
char
maxSubTask){
79
kout <<
"Please choose subtask ["
<< minSubTask <<
", "
<< maxSubTask <<
"]"
<<
endl
;
80
Key
k;
81
do
{
82
k=keyboard.
key_hit
();
83
}
while
(!k.
valid
() || k.
ascii
()<minSubTask || k.
ascii
()>maxSubTask);
84
return
k.
ascii
();
85
}
86
87
extern
"C"
void
kernel
(uint32_t magic,
const
Multiboot_Info* info);
88
98
void
kernel
(uint32_t magic,
const
Multiboot_Info* info){
99
100
keyboard.
plugin
();
101
watch.
windup
(10000);
102
103
#if USE_TASK == 10
104
task1.
setup
(magic, info);
105
scheduler.
insert
(task1);
106
#elif USE_TASK == 20
107
scheduler.
insert
(task2);
108
cpu.
enable_int
();
109
#elif USE_TASK == 30
110
if
(
getSubTask
(
'A'
,
'B'
)==
'A'
){
111
scheduler.
insert
(task3a);
112
cpu.
enable_int
();
113
}
114
else
115
scheduler.
insert
(task3b);
116
#elif USE_TASK == 40
117
if
(
getSubTask
(
'A'
,
'B'
)==
'A'
)
118
task4.
enableCoop
();
119
scheduler.
insert
(task4);
120
cpu.
enable_int
();
121
#elif USE_TASK == 50
122
scheduler.
insert
(task5);
123
cpu.
enable_int
();
124
#endif
125
126
scheduler.
start
();
127
}
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2