The Pedigree Project  0.1
include/pedigree/kernel/machine/Machine.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef MACHINE_MACHINE_H
21 #define MACHINE_MACHINE_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/processor/types.h"
25 
26 class IrqManager;
27 class Keyboard;
28 class SchedulerTimer;
29 class Serial;
30 class Timer;
31 class Vga;
32 
42 {
43  friend void system_reset();
44 
45  public:
46  static Machine &instance();
47 
51  virtual void initialise() = 0;
53  virtual void initialise2()
54  {
55  }
57  virtual void initialise3()
58  {
59  }
60  virtual void deinitialise()
61  {
62  m_bInitialised = false;
63  }
64  inline bool isInitialised()
65  {
66  return m_bInitialised;
67  }
68 
74  virtual void initialiseDeviceTree()
75  {
76  }
77 
81  virtual Serial *getSerial(size_t n) = 0;
82 
86  virtual size_t getNumSerial() = 0;
87 
91  virtual Vga *getVga(size_t n) = 0;
92 
96  virtual size_t getNumVga() = 0;
97 
98  virtual IrqManager *getIrqManager() = 0;
102  virtual SchedulerTimer *getSchedulerTimer() = 0;
103 
107  virtual Timer *getTimer() = 0;
108 
112  virtual Keyboard *getKeyboard() = 0;
113 
117  virtual void setKeyboard(Keyboard *kb) = 0;
118 
119 #ifdef MULTIPROCESSOR
120 
123  virtual void stopAllOtherProcessors() = 0;
124 #endif
125 
126  protected:
127  inline Machine() : m_bInitialised(false)
128  {
129  }
130  virtual ~Machine();
131 
132  bool m_bInitialised;
133 
134  private:
135  Machine(const Machine &);
136  Machine &operator=(const Machine &);
137 };
138 
139 #endif
virtual void initialise2()
Called after debugger startup.
virtual void initialise3()
Called after processor startup - for thread creation etc.