usb: getting string descriptors, minor improvements
[quarnos.git] / manes / manei.cpp
blob64d840da2d292e0f84867cf7a8346d3c49df5c36
1 /* Quarn OS / Manes
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.
23 #include "cds/creator.h"
24 #include "manec.h"
25 #include "manei.h"
26 #include "cds/type.h"
28 #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/isa.h"
39 #include "resources/pci.h"
40 #include "resources/keybscr.h"
41 #include "resources/fdc.h"
42 #include "resources/fat.h"
43 #include "resources/speaker.h"
44 #include "resources/foma.h"
45 #include "resources/slob.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/usb_mass_storage.h"
51 #include "resources/pio.h"
52 #include "resources/physmem.h"
53 #include "resources/ne2k.h"
54 #include "resources/usb.h"
55 #include "resources/rtl8139.h"
57 #include "modules/loader.h"
58 #include "modules/module.h"
59 #include "modules/elf.h"
61 #include "actors/roundrobin.h"
62 #include "actors/actor.h"
64 using namespace manes;
65 using namespace manes::cds;
67 extern p<resources::memm> allocator;
69 p<manei> manei::instance = p<manei>::invalid;
71 p<manei> manei::get() {
72 if (!instance.valid())
73 instance = new manei;
74 return instance;
77 void manei::launch_manes() {
78 main = new root();
79 types = new factory(new type(component_name::from_path("/type,factory"), component_name::invalid, delegate<p<component> >()));
80 main->initialize(types);
84 void manei::register_creators() {
85 /* server */
86 services::server::register_type();
88 /* loader */
89 modules::loader::register_type();
91 /* director */
92 actors::roundrobin::register_type();
94 /* fat */
96 /* slob */
97 resources::slob::register_type();
99 /* foma */
100 resources::foma::register_type();
102 /* physmem */
103 resources::physmem::register_type();
105 /* isa-bus */
106 resources::isa::register_type();
108 /* pci-bus */
109 resources::pci::register_type();
111 /* virtual_bus */
112 resources::virtual_bus::register_type();
115 void manei::register_builtin_types() {
116 /* ---- SERVICES ---- */
118 /* early logger */
119 services::early_logger::register_type();
121 /* tty logger */
122 services::tty_logger::register_type();
124 /* timer */
125 services::timer::register_type();
127 /* unmangler */
128 services::unmangler::register_type();
130 /* stats */
131 services::stats::register_type();
133 /* interrupt_manager */
134 services::interrupt_manager::register_type();
136 /* kernel_state */
137 services::kernel_state::register_type();
139 /* asynch_tasks */
140 services::asynch_tasks::register_type();
142 /* ---- DEVICES ---- */
144 /* keybscr */
145 resources::keybscr::register_type();
147 /* fdc */
148 resources::fdc::register_type();
150 /* speaker */
151 resources::speaker::register_type();
153 /* pio */
154 resources::pio::register_type();
156 /* ne2k */
157 resources::ne2k::register_type();
159 /* usb */
160 resources::usb::register_type();
162 /* uhci */
163 resources::uhci::register_type();
165 /* unknown */
166 resources::unknown::register_type();
168 /* rtl8139 */
169 resources::rtl8139::register_type();
171 /* usb mass storage */
172 resources::usb_mass_storage::register_type();
174 /* ---- FILE SYSTEMS ---- */
175 resources::fat::register_type();
177 resources::file::register_type();
179 /* ---- ACTORS ---- */
180 actors::actor::register_type();
182 /* ---- MODULES ---- */
183 modules::module::register_type();
185 modules::elf::register_type();
188 void manei::animate_creators() {
189 /* animate server */
190 main->new_component(component_name::from_path("/type,server")).cast<creator>()->initialize();
192 kstate = main->new_component(component_name::from_path("/type,kernel_state")).cast<services::kernel_state>();
194 main->new_component(component_name::from_path("/type,physmem"));//.cast<resources::memm>()->initialize();
196 /* animate slob */
197 allocator = main->new_component(component_name::from_path("/type,foma")).cast<resources::memm>();
199 /* animate loader */
200 main->new_component(component_name::from_path("/type,loader")).cast<creator>()->initialize();
202 /* animate isa - main bus */
203 main->new_component(component_name::from_path("/type,isa")).cast<creator>()->initialize();
205 /* animate pci */
206 main->new_component(component_name::from_path("/type,pci")).cast<creator>()->initialize();
208 /* animate virtual_bus */
209 main->new_component(component_name::from_path("/type,virtual_bus")).cast<creator>()->initialize();
211 /* animate fat - main fs (temp) */
212 main->new_component(component_name::from_path("/type,fat")).cast<creator>()->initialize();
214 /* animate director */
215 main->new_component(component_name::from_path("/type,director")).cast<creator>()->initialize();
218 p<root> manei::get_root() {
219 return main;
222 p<services::kernel_state> manei::state() {
223 return kstate;