reactos/sdk/include/wdf/kmdf/1.17/wdftimer.h

269 lines
5.1 KiB
C

/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdftimer.h
Abstract:
This is the C header for driver framework TIMER object
Revision History:
--*/
//
// NOTE: This header is generated by stubwork. Please make any
// modifications to the corresponding template files
// (.x or .y) and use stubwork to regenerate the header
//
#ifndef _WDFTIMER_H_
#define _WDFTIMER_H_
#ifndef WDF_EXTERN_C
#ifdef __cplusplus
#define WDF_EXTERN_C extern "C"
#define WDF_EXTERN_C_START extern "C" {
#define WDF_EXTERN_C_END }
#else
#define WDF_EXTERN_C
#define WDF_EXTERN_C_START
#define WDF_EXTERN_C_END
#endif
#endif
WDF_EXTERN_C_START
#if (NTDDI_VERSION >= NTDDI_WIN2K)
#define TolerableDelayUnlimited ((ULONG)-1)
//
// This is the function that gets called back into the driver
// when the TIMER fires.
//
typedef
_Function_class_(EVT_WDF_TIMER)
_IRQL_requires_same_
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
STDCALL
EVT_WDF_TIMER(
_In_
WDFTIMER Timer
);
typedef EVT_WDF_TIMER *PFN_WDF_TIMER;
//
// Disable warning C4324: structure was padded due to DECLSPEC_ALIGN
// This padding is intentional and necessary.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4324)
#endif
typedef struct _WDF_TIMER_CONFIG {
ULONG Size;
PFN_WDF_TIMER EvtTimerFunc;
ULONG Period;
//
// If this is TRUE, the Timer will automatically serialize
// with the event callback handlers of its Parent Object.
//
// Parent Object's callback constraints should be compatible
// with the Timer DPC (DISPATCH_LEVEL), or the request will fail.
//
BOOLEAN AutomaticSerialization;
//
// Optional tolerance for the timer in milliseconds.
//
ULONG TolerableDelay;
//
// If this is TRUE, high resolution timers will be used. The default
// value is FALSE
//
DECLSPEC_ALIGN(8) BOOLEAN UseHighResolutionTimer;
} WDF_TIMER_CONFIG, *PWDF_TIMER_CONFIG;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
FORCEINLINE
VOID
WDF_TIMER_CONFIG_INIT(
_Out_ PWDF_TIMER_CONFIG Config,
_In_ PFN_WDF_TIMER EvtTimerFunc
)
{
RtlZeroMemory(Config, sizeof(WDF_TIMER_CONFIG));
Config->Size = sizeof(WDF_TIMER_CONFIG);
Config->EvtTimerFunc = EvtTimerFunc;
Config->Period = 0;
Config->AutomaticSerialization = TRUE;
Config->TolerableDelay = 0;
}
FORCEINLINE
VOID
WDF_TIMER_CONFIG_INIT_PERIODIC(
_Out_ PWDF_TIMER_CONFIG Config,
_In_ PFN_WDF_TIMER EvtTimerFunc,
_In_ LONG Period
)
{
RtlZeroMemory(Config, sizeof(WDF_TIMER_CONFIG));
Config->Size = sizeof(WDF_TIMER_CONFIG);
Config->EvtTimerFunc = EvtTimerFunc;
Config->Period = Period;
Config->AutomaticSerialization = TRUE;
Config->TolerableDelay = 0;
}
//
// WDF Function: WdfTimerCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(STDCALL *PFN_WDFTIMERCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDF_TIMER_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFTIMER* Timer
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
FORCEINLINE
NTSTATUS
WdfTimerCreate(
_In_
PWDF_TIMER_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFTIMER* Timer
)
{
return ((PFN_WDFTIMERCREATE) WdfFunctions[WdfTimerCreateTableIndex])(WdfDriverGlobals, Config, Attributes, Timer);
}
//
// WDF Function: WdfTimerStart
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(STDCALL *PFN_WDFTIMERSTART)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer,
_In_
LONGLONG DueTime
);
_IRQL_requires_max_(DISPATCH_LEVEL)
FORCEINLINE
BOOLEAN
WdfTimerStart(
_In_
WDFTIMER Timer,
_In_
LONGLONG DueTime
)
{
return ((PFN_WDFTIMERSTART) WdfFunctions[WdfTimerStartTableIndex])(WdfDriverGlobals, Timer, DueTime);
}
//
// WDF Function: WdfTimerStop
//
typedef
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(DISPATCH_LEVEL))
WDFAPI
BOOLEAN
(STDCALL *PFN_WDFTIMERSTOP)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer,
_In_
BOOLEAN Wait
);
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(DISPATCH_LEVEL))
FORCEINLINE
BOOLEAN
WdfTimerStop(
_In_
WDFTIMER Timer,
_In_
BOOLEAN Wait
)
{
return ((PFN_WDFTIMERSTOP) WdfFunctions[WdfTimerStopTableIndex])(WdfDriverGlobals, Timer, Wait);
}
//
// WDF Function: WdfTimerGetParentObject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFOBJECT
(STDCALL *PFN_WDFTIMERGETPARENTOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer
);
_IRQL_requires_max_(DISPATCH_LEVEL)
FORCEINLINE
WDFOBJECT
WdfTimerGetParentObject(
_In_
WDFTIMER Timer
)
{
return ((PFN_WDFTIMERGETPARENTOBJECT) WdfFunctions[WdfTimerGetParentObjectTableIndex])(WdfDriverGlobals, Timer);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFTIMER_H_