3 * Manes Initializer implementation
5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "services/server.h"
29 #include "services/tty_logger.h"
30 #include "services/early_logger.h"
31 #include "services/timer.h"
32 #include "services/unmangler.h"
33 #include "services/stats.h"
34 #include "services/interrupt_manager.h"
35 #include "services/kernel_state.h"
36 #include "services/asynch_tasks.h"
38 #include "resources/buffer.h"
39 #include "resources/isa.h"
40 #include "resources/pci.h"
41 #include "resources/keybscr.h"
42 #include "resources/fdc.h"
43 #include "resources/fat.h"
44 #include "resources/speaker.h"
45 #include "resources/foma.h"
46 #include "resources/uhci.h"
47 #include "resources/file.h"
48 #include "resources/unknown.h"
49 #include "resources/virtual_bus.h"
50 #include "resources/pio.h"
51 #include "resources/physmem.h"
52 #include "resources/ne2k.h"
53 #include "resources/usb.h"
54 #include "resources/rtl8139.h"
56 #include "modules/loader.h"
57 #include "modules/module.h"
59 #include "actors/roundrobin.h"
60 #include "actors/actor.h"
62 using namespace manes
;
64 p
<manei
> manei::instance
= p
<manei
>::invalid
;
66 p
<manei
> manei::get() {
67 if (!instance
.valid())
72 void manei::launch_manes() {
74 types
= new factory();
76 string
str_factory("factory");
77 type_name
factory_tname(str_factory
, 0);
79 delegate
<p
<implementation
> > create_deleg
;
82 type_name
bname(str
,0);
84 p
<type
> factory_type
= new type(type::factory
, bname
, factory_tname
, create_deleg
);
86 p
<component
> comp
= new component((component
*)this, factory_type
, types
.cast
<implementation
>());
88 comp
->get
<factory
>()->initialize();
89 comp
->get
<factory
>()->register_impl(factory_type
);
91 main
->initialize(comp
);
95 void manei::register_creators() {
97 services::server::register_type();
100 modules::loader::register_type();
103 actors::roundrobin::register_type();
108 resources::foma::register_type();
111 resources::physmem::register_type();
114 resources::isa::register_type();
117 resources::pci::register_type();
120 resources::virtual_bus::register_type();
123 void manei::register_builtin_types() {
124 /* ---- SERVICES ---- */
127 services::early_logger::register_type();
130 services::tty_logger::register_type();
133 services::timer::register_type();
136 services::unmangler::register_type();
139 services::stats::register_type();
141 /* interrupt_manager */
142 services::interrupt_manager::register_type();
145 services::kernel_state::register_type();
148 services::asynch_tasks::register_type();
150 /* ---- DEVICES ---- */
153 resources::keybscr::register_type();
156 resources::fdc::register_type();
159 resources::speaker::register_type();
162 resources::pio::register_type();
165 resources::ne2k::register_type();
168 resources::usb::register_type();
171 resources::uhci::register_type();
174 resources::unknown::register_type();
177 resources::rtl8139::register_type();
179 /* ---- OBJECTS ---- */
180 resources::buffer::register_type();
182 /* ---- FILE SYSTEMS ---- */
183 resources::fat::register_type();
185 resources::file::register_type();
187 /* ---- ACTORS ---- */
188 actors::actor::register_type();
190 /* ---- MODULES ---- */
191 modules::module::register_type();
194 void manei::animate_creators() {
196 main
->new_component((type_name
)"server")->get
<creator
>()->initialize();
198 kstate
= main
->new_component((type_name
)"kernel_state")->get
<services::kernel_state
>();
200 main
->new_component((type_name
)"physmem")->get
<creator
>()->initialize();
203 /* state()->set_memory_allocator(*/main
->new_component((type_name
)"foma")->get
<resources::memm
>()->initialize();/*);*/
206 main
->new_component((type_name
)"loader")->get
<creator
>()->initialize();
208 /* animate isa - main bus */
209 main
->new_component((type_name
)"isa")->get
<creator
>()->initialize();
212 main
->new_component((type_name
)"pci")->get
<creator
>()->initialize();
214 /* animate virtual_bus */
215 main
->new_component((type_name
)"virtual_bus")->get
<creator
>()->initialize();
217 /* animate fat - main fs (temp) */
218 main
->new_component((type_name
)"fat")->get
<creator
>()->initialize();
220 /* animate director */
221 main
->new_component((type_name
)"director")->get
<creator
>()->initialize();
224 p
<root
> manei::get_root() {
228 p
<services::kernel_state
> manei::state() {