20 #include "SchedulerTimer.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/compiler.h" 23 #include "pedigree/kernel/machine/Machine.h" 28 #define ONE_SECOND 1000000000 33 bool HostedSchedulerTimer::registerHandler(
TimerHandler *handler)
35 if (
UNLIKELY(handler == 0 && m_Handler != 0))
45 ByteSet(&sv, 0,
sizeof(sv));
46 sv.sigev_notify = SIGEV_SIGNAL;
47 sv.sigev_signo = SIGUSR2;
48 sv.sigev_value.sival_ptr =
this;
49 int r = timer_create(CLOCK_REALTIME, &sv, &m_Timer);
56 struct itimerspec interval;
57 ByteSet(&interval, 0,
sizeof(interval));
58 interval.it_interval.tv_nsec = ONE_SECOND / HZ;
59 interval.it_value.tv_nsec = ONE_SECOND / HZ;
60 r = timer_settime(m_Timer, 0, &interval, 0);
63 timer_delete(m_Timer);
67 IrqManager &irqManager = *Machine::instance().getIrqManager();
71 timer_delete(m_Timer);
79 timer_delete(m_Timer);
84 IrqManager &irqManager = *Machine::instance().getIrqManager();
96 uint64_t opaque = state.getRegister(0);
97 if (opaque != reinterpret_cast<uint64_t>(
this))
HostedSchedulerTimer() INITIALISATION_ONLY
static HostedSchedulerTimer m_Instance
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)=0
virtual void timer(uint64_t delta, InterruptState &state)=0
virtual irq_id_t registerIsaIrqHandler(uint8_t irq, IrqHandler *handler, bool bEdge=false)=0
bool initialise() INITIALISATION_ONLY
virtual bool irq(irq_id_t number, InterruptState &state)