The Pedigree Project
0.1
src
system
kernel
machine
mach_pc
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
#include "pedigree/kernel/compiler.h"
23
#include "pedigree/kernel/machine/SchedulerIrqHandler.h"
24
#include "pedigree/kernel/machine/SchedulerTimer.h"
25
#include "pedigree/kernel/machine/SchedulerTimerHandlerSlot.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
#include <config.h>
31
32
class
SchedulerTimerHandler
;
33
38
class
Pit
:
public
SchedulerTimer
,
private
SchedulerIrqHandler
{
39
public
:
41
inline
static
Pit
&
instance
() {
42
return
m_Instance
;
43
}
44
45
//
46
// SchedulerTimer interface
47
//
48
virtual
bool
registerHandler
(
SchedulerTimerHandler
* handler);
49
uint64_t nominalQuantumNs()
const override
;
50
virtual
bool
removeHandler
(
SchedulerTimerHandler
* handler);
51
54
bool
initialise
()
INITIALISATION_ONLY
;
56
void
uninitialise
();
57
58
protected:
60
Pit
()
INITIALISATION_ONLY
;
62
inline virtual ~
Pit
() {}
63
64
private
:
67
Pit
(
const
Pit
&);
70
Pit
&
operator=
(
const
Pit
&);
71
72
//
73
// SchedulerIrqHandler interface
74
//
75
virtual
void
schedulerIrq(irq_id_t number, InterruptState& state);
76
78
IoPort
m_IoPort
;
80
irq_id_t
m_IrqId
;
82
SchedulerTimerHandlerSlot
m_Handler
;
83
85
static
Pit
m_Instance
;
86
};
87
90
#endif
IoPort
I/O port range.
Definition
IoPort.h:33
Pit
Definition
Pit.h:38
Pit::removeHandler
virtual bool removeHandler(SchedulerTimerHandler *handler)
Definition
Pit.cc:47
Pit::registerHandler
virtual bool registerHandler(SchedulerTimerHandler *handler)
Definition
Pit.cc:43
Pit::initialise
bool initialise() INITIALISATION_ONLY
Definition
Pit.cc:51
Pit::m_Handler
SchedulerTimerHandlerSlot m_Handler
Definition
Pit.h:82
Pit::uninitialise
void uninitialise()
Definition
Pit.cc:81
Pit::m_IrqId
irq_id_t m_IrqId
Definition
Pit.h:80
Pit::m_Instance
static Pit m_Instance
Definition
Pit.h:85
Pit::m_IoPort
IoPort m_IoPort
Definition
Pit.h:78
Pit::instance
static Pit & instance()
Definition
Pit.h:41
Pit::Pit
Pit(const Pit &)
Pit::operator=
Pit & operator=(const Pit &)
SchedulerIrqHandler
Definition
SchedulerIrqHandler.h:25
SchedulerTimerHandlerSlot
Definition
SchedulerTimerHandlerSlot.h:29
SchedulerTimerHandler
Definition
SchedulerTimerHandler.h:37
SchedulerTimer
Definition
include/pedigree/kernel/machine/SchedulerTimer.h:30
INITIALISATION_ONLY
#define INITIALISATION_ONLY
Definition
system/include/pedigree/kernel/compiler.h:116
Generated on Sat Oct 3 2026 06:38:08 for The Pedigree Project by
1.9.8