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#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
33
38class 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
56 void uninitialise();
57
58 protected:
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
80 irq_id_t m_IrqId;
83
86};
87
90#endif
I/O port range.
Definition IoPort.h:33
Definition Pit.h:38
virtual bool removeHandler(SchedulerTimerHandler *handler)
Definition Pit.cc:47
virtual bool registerHandler(SchedulerTimerHandler *handler)
Definition Pit.cc:43
bool initialise() INITIALISATION_ONLY
Definition Pit.cc:51
SchedulerTimerHandlerSlot m_Handler
Definition Pit.h:82
void uninitialise()
Definition Pit.cc:81
irq_id_t m_IrqId
Definition Pit.h:80
static Pit m_Instance
Definition Pit.h:85
IoPort m_IoPort
Definition Pit.h:78
static Pit & instance()
Definition Pit.h:41
Pit(const Pit &)
Pit & operator=(const Pit &)