The Pedigree Project  0.1
Pit.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_X86_COMMON_PIT_H
21 #define KERNEL_MACHINE_X86_COMMON_PIT_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/machine/IrqHandler.h"
25 #include "pedigree/kernel/machine/SchedulerTimer.h"
26 #include "pedigree/kernel/machine/types.h"
27 #include "pedigree/kernel/processor/IoPort.h"
28 #include "pedigree/kernel/processor/state_forward.h"
29 
30 class TimerHandler;
31 
36 class Pit : public SchedulerTimer, private IrqHandler
37 {
38  public:
40  inline static Pit &instance()
41  {
42  return m_Instance;
43  }
44 
45  //
46  // SchedulerTimer interface
47  //
48  virtual bool registerHandler(TimerHandler *handler);
49 
54  void uninitialise();
55 
56  protected:
60  inline virtual ~Pit()
61  {
62  }
63 
64  private:
67  Pit(const Pit &);
70  Pit &operator=(const Pit &);
71 
72  //
73  // IrqHandler interface
74  //
75  virtual bool irq(irq_id_t number, InterruptState &state);
76 
80  irq_id_t m_IrqId;
83 
85  static Pit m_Instance;
86 };
87 
90 #endif
IoPort m_IoPort
Definition: Pit.h:78
irq_id_t m_IrqId
Definition: Pit.h:80
Definition: Pit.h:36
I/O port range.
Definition: IoPort.h:34
static Pit & instance()
Definition: Pit.h:40
void uninitialise()
Definition: Pit.cc:76
virtual bool irq(irq_id_t number, InterruptState &state)
Definition: Pit.cc:95
bool initialise() INITIALISATION_ONLY
Definition: Pit.cc:45
virtual ~Pit()
Definition: Pit.h:60
Pit & operator=(const Pit &)
TimerHandler * m_Handler
Definition: Pit.h:82
static Pit m_Instance
Definition: Pit.h:85
Pit() INITIALISATION_ONLY
Definition: Pit.cc:91