The Pedigree Project  0.1
kernel/machine/hosted/SchedulerTimer.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 KERNEL_MACHINE_HOSTED_SCHEDULERTIMER_H
21 #define KERNEL_MACHINE_HOSTED_SCHEDULERTIMER_H
22 
23 #include "pedigree/kernel/machine/IrqManager.h"
24 #include "pedigree/kernel/machine/SchedulerTimer.h"
25 #include "pedigree/kernel/processor/IoPort.h"
26 #include "pedigree/kernel/processor/state.h"
27 
28 namespace __pedigree_hosted
29 {
30 #include <signal.h>
31 #include <time.h>
32 } // namespace __pedigree_hosted
33 
38 {
39  public:
41  inline static HostedSchedulerTimer &instance()
42  {
43  return m_Instance;
44  }
45 
46  //
47  // SchedulerTimer interface
48  //
49  virtual bool registerHandler(TimerHandler *handler);
50 
53  bool initialise() INITIALISATION_ONLY;
55  void uninitialise();
56 
57  protected:
61  inline virtual ~HostedSchedulerTimer()
62  {
63  }
64 
65  private:
71  HostedSchedulerTimer &operator=(const HostedSchedulerTimer &);
72 
73  //
74  // IrqHandler interface
75  //
76  virtual bool irq(irq_id_t number, InterruptState &state);
77 
78  irq_id_t m_IrqId;
79  __pedigree_hosted::timer_t m_Timer;
80 
83 
86 };
87 
90 #endif
static HostedSchedulerTimer m_Instance
static HostedSchedulerTimer & instance()