ReactOS  0.4.15-dev-3331-g8ebe441
MxTimer Class Reference

#include <mxtimer.h>

Collaboration diagram for MxTimer:

Public Member Functions

__inline MxTimer (VOID)
 
__inline ~MxTimer (VOID)
 
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize (__in_opt PVOID TimerContext, __in MdDeferredRoutine TimerCallback, __in LONG Period)
 
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS InitializeEx (__in_opt PVOID TimerContext, __in MdExtCallbackType TimerCallback, __in LONG Period, __in ULONG TolerableDelay, __in BOOLEAN UseHighResolutionTimer)
 
__inline VOID Start (__in LARGE_INTEGER DueTime, __in ULONG TolerableDelay=0)
 
__inline BOOLEAN StartWithReturn (__in LARGE_INTEGER DueTime, __in ULONG TolerableDelay=0)
 
_Must_inspect_result_ __inline BOOLEAN Stop (VOID)
 
__inline VOID FlushQueuedDpcs (VOID)
 

Private Attributes

MdTimer m_Timer
 

Detailed Description

Definition at line 27 of file mxtimer.h.

Constructor & Destructor Documentation

◆ MxTimer()

MxTimer::MxTimer ( VOID  )

Definition at line 83 of file mxtimerkm.h.

86 {
89  m_Timer.m_Period = 0;
91 }
PVOID m_TimerContext
Definition: mxtimerkm.h:77
PEX_TIMER m_KernelExTimer
Definition: mxtimerkm.h:68
MdDeferredRoutine m_TimerCallback
Definition: mxtimerkm.h:58
LONG m_Period
Definition: mxtimerkm.h:43
#define NULL
Definition: types.h:112
MdTimer m_Timer
Definition: mxtimer.h:33

◆ ~MxTimer()

MxTimer::~MxTimer ( VOID  )

Definition at line 93 of file mxtimerkm.h.

96 {
97  // __REACTOS__ Ex timers are not supported
98  // BOOLEAN wasCancelled;
99 
100  // if (m_Timer.m_IsExtTimer &&
101  // m_Timer.m_KernelExTimer) {
102  // wasCancelled = ExDeleteTimer(m_Timer.m_KernelExTimer,
103  // TRUE, // Cancel if pending. We don't expect
104  // // it to be pending though
105  // FALSE,// Wait
106  // NULL);
107  // //
108  // // Timer should not have been pending
109  // //
110  // ASSERT(wasCancelled == FALSE);
111  // m_Timer.m_KernelExTimer = NULL;
112  // }
113 }

Member Function Documentation

◆ FlushQueuedDpcs()

VOID MxTimer::FlushQueuedDpcs ( VOID  )

Definition at line 291 of file mxtimerkm.h.

294 {
296 }
static __inline VOID MxFlushQueuedDpcs()
Definition: mxgeneralkm.h:589

Referenced by FxTimer::Stop().

◆ Initialize()

_Must_inspect_result_ NTSTATUS MxTimer::Initialize ( __in_opt PVOID  TimerContext,
__in MdDeferredRoutine  TimerCallback,
__in LONG  Period 
)

Definition at line 119 of file mxtimerkm.h.

124 {
126  m_Timer.m_TimerCallback = TimerCallback;
128 
130  KeInitializeDpc(&(m_Timer.TimerDpc), // Timer DPC
131  m_Timer.m_TimerCallback, // DeferredRoutine
132  m_Timer.m_TimerContext); // DeferredContext
133 
135 
136  return STATUS_SUCCESS;
137 }
PVOID m_TimerContext
Definition: mxtimerkm.h:77
_In_ LARGE_INTEGER _In_ ULONG Period
Definition: kefuncs.h:1324
MdDeferredRoutine m_TimerCallback
Definition: mxtimerkm.h:58
#define FALSE
Definition: types.h:117
KTIMER KernelTimer
Definition: mxtimerkm.h:59
KDPC TimerDpc
Definition: mxtimerkm.h:60
LONG m_Period
Definition: mxtimerkm.h:43
BOOLEAN m_IsExtTimer
Definition: mxtimerkm.h:48
MdTimer m_Timer
Definition: mxtimer.h:33
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID TimerContext
Definition: zwfuncs.h:428
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
Definition: timerobj.c:244

Referenced by FxRequestBase::CreateTimer(), FxPowerIdleMachine::Init(), FxTimer::Initialize(), and FxWatchdog::StartTimer().

◆ InitializeEx()

_Must_inspect_result_ NTSTATUS MxTimer::InitializeEx ( __in_opt PVOID  TimerContext,
__in MdExtCallbackType  TimerCallback,
__in LONG  Period,
__in ULONG  TolerableDelay,
__in BOOLEAN  UseHighResolutionTimer 
)

Definition at line 141 of file mxtimerkm.h.

171 {
172  // NTSTATUS status;
173  // ULONG attributes = 0;
174 
175  // m_Timer.m_TimerContext = TimerContext;
176  // m_Timer.m_ExTimerCallback = TimerCallback;
177  // m_Timer.m_Period = Period;
178 
179  // if (TolerableDelay != 0) {
180 
181  // attributes |= EX_TIMER_NO_WAKE;
182 
183  // } else if (UseHighResolutionTimer) {
184 
185  // attributes |= EX_TIMER_HIGH_RESOLUTION;
186  // }
187 
188  // m_Timer.m_KernelExTimer = ExAllocateTimer(m_Timer.m_ExTimerCallback,
189  // TimerContext,
190  // attributes);
191  // if (m_Timer.m_KernelExTimer) {
192 
193  // status = STATUS_SUCCESS;
194 
195  // } else {
196 
197  // status = STATUS_INSUFFICIENT_RESOURCES;
198  // }
199 
200  // m_Timer.m_IsExtTimer = TRUE;
201 
202  // return status;
203  return STATUS_NOT_IMPLEMENTED; // __REACTOS__ Ex timers are not supported
204 }
return STATUS_NOT_IMPLEMENTED

◆ Start()

VOID MxTimer::Start ( __in LARGE_INTEGER  DueTime,
__in ULONG  TolerableDelay = 0 
)

Definition at line 251 of file mxtimerkm.h.

255 {
256  if (m_Timer.m_IsExtTimer) {
257 
259 
260  } else {
261  KeSetCoalescableTimer(&(m_Timer.KernelTimer),
262  DueTime,
265  &(m_Timer.TimerDpc));
266  }
267 
268  return;
269 }
_In_ LARGE_INTEGER _In_ ULONG _In_ ULONG TolerableDelay
Definition: kefuncs.h:1324
KTIMER KernelTimer
Definition: mxtimerkm.h:59
KDPC TimerDpc
Definition: mxtimerkm.h:60
__inline BOOLEAN StartWithReturn(__in LARGE_INTEGER DueTime, __in ULONG TolerableDelay=0)
Definition: mxtimerkm.h:209
LONG m_Period
Definition: mxtimerkm.h:43
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:187
BOOLEAN m_IsExtTimer
Definition: mxtimerkm.h:48
MdTimer m_Timer
Definition: mxtimer.h:33

Referenced by FxWatchdog::StartTimer(), and FxRequestBase::StartTimer().

◆ StartWithReturn()

_Must_inspect_result_ BOOLEAN MxTimer::StartWithReturn ( __in LARGE_INTEGER  DueTime,
__in ULONG  TolerableDelay = 0 
)

Definition at line 209 of file mxtimerkm.h.

213 {
214  if (m_Timer.m_IsExtTimer) {
215  // __REACTOS__ Ex timers are not supported
216  // EXT_SET_PARAMETERS parameters;
217 
218  // ExInitializeSetTimerParameters(&parameters);
219 
220  // //
221  // // We get the delay in ms but the underlying API needs it in 100 ns
222  // // units. Convert tolerable delay from ms to 100 ns. However,
223  // // MAXULONG (TolerableDelayUnlimited) has a special meaning that the
224  // // system should never be woken up, so we assign the corresponding
225  // // special value for Ex timers
226  // //
227  // if (TolerableDelay == TolerableDelayUnlimited) {
228  // parameters.NoWakeTolerance = EX_TIMER_UNLIMITED_TOLERANCE;
229  // } else {
230  // parameters.NoWakeTolerance = ((LONGLONG) TolerableDelay) * 10 * 1000;
231  // }
232 
233  // return ExSetTimer(m_Timer.m_KernelExTimer,
234  // DueTime.QuadPart,
235  // (((LONGLONG) m_Timer.m_Period) * 10 * 1000),
236  // &parameters);
237  return FALSE;
238  } else {
239 
240  return KeSetCoalescableTimer(&(m_Timer.KernelTimer),
241  DueTime,
244  &(m_Timer.TimerDpc));
245  }
246 
247 }
_In_ LARGE_INTEGER _In_ ULONG _In_ ULONG TolerableDelay
Definition: kefuncs.h:1324
#define FALSE
Definition: types.h:117
KTIMER KernelTimer
Definition: mxtimerkm.h:59
KDPC TimerDpc
Definition: mxtimerkm.h:60
LONG m_Period
Definition: mxtimerkm.h:43
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:187
BOOLEAN m_IsExtTimer
Definition: mxtimerkm.h:48
MdTimer m_Timer
Definition: mxtimer.h:33

Referenced by Start(), and FxTimer::Start().

◆ Stop()

_Must_inspect_result_ BOOLEAN MxTimer::Stop ( VOID  )

Definition at line 273 of file mxtimerkm.h.

276 {
277  BOOLEAN bRetVal;
278 
279  if (m_Timer.m_IsExtTimer) {
280  bRetVal = FALSE;
281  // bRetVal = ExCancelTimer(m_Timer.m_KernelExTimer, NULL); // __REACTOS__ Ex timers are not supported
282 
283  } else {
284  bRetVal = KeCancelTimer(&(m_Timer.KernelTimer));
285  }
286 
287  return bRetVal;
288 }
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
KTIMER KernelTimer
Definition: mxtimerkm.h:59
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
BOOLEAN m_IsExtTimer
Definition: mxtimerkm.h:48
MdTimer m_Timer
Definition: mxtimer.h:33

Referenced by FxPowerIdleMachine::CancelIdleTimer(), FxWatchdog::CancelTimer(), FxRequestBase::CancelTimer(), and FxTimer::Stop().

Member Data Documentation

◆ m_Timer

MdTimer MxTimer::m_Timer
private

Definition at line 33 of file mxtimer.h.

Referenced by Initialize(), MxTimer(), Start(), StartWithReturn(), and Stop().


The documentation for this class was generated from the following files: