ReactOS 0.4.16-dev-2293-g4d8327b
driver.h
Go to the documentation of this file.
1#if !defined(_SKLHDAUDBUS_H_)
2#define _SKLHDAUDBUS_H_
3
4#define POOL_ZERO_DOWN_LEVEL_SUPPORT
5
6#pragma warning(disable:4200) // suppress nameless struct/union warning
7#pragma warning(disable:4201) // suppress nameless struct/union warning
8#pragma warning(disable:4214) // suppress bit field types other than int warning
9#include <ntddk.h>
10#include <initguid.h>
11
12//SGPC (Win10 1809+ support)
13extern "C" {
14 #define __CPLUSPLUS
15
16 #include <windef.h>
17 #include <winerror.h>
18
19 #include <wingdi.h>
20 #include <d3dkmddi.h>
21 #include <d3dkmthk.h>
22}
23
24#include <wdm.h>
25#include <wdmguid.h>
26#include "wdf.h"
27#include <ntintsafe.h>
28#include <ntstrsafe.h>
29#include <hdaudio.h>
30#include <portcls.h>
31
32#include "hda_registers.h"
33#include "fdo.h"
34#include "buspdo.h"
35#include "hdac_controller.h"
36#include "hdac_stream.h"
37#include "hda_verbs.h"
38
39#ifdef __REACTOS__
40#define DRIVERNAME "hdaudbus.sys: "
41#else
42#define DRIVERNAME "sklhdaudbus.sys: "
43#endif
44#define SKLHDAUDBUS_POOL_TAG 'SADH'
45
46#define VEN_INTEL 0x8086
47#define VEN_ATI 0x1002
48#define VEN_AMD 0x1022
49#define VEN_NVIDIA 0x10DE
50#define VEN_VMWARE 0x15AD
51
52#include "regfuncs.h"
53
54#ifdef __REACTOS__
55#define MAXUINT64 ((UINT64)UINT64_MAX)
56#define MAXULONG64 ((ULONG64)ULONG64_MAX)
57#define MAXULONG32 ((ULONG32)ULONG_MAX)
58#endif
59
61 PFDO_CONTEXT fdoCtx,
62 UINT16 codecAddr,
65 PHDAUDIO_CODEC_TRANSFER CodecTransfer
66);
71
72#define IS_BXT(ven, dev) (ven == VEN_INTEL && dev == 0x5a98)
73
74static inline void mdelay(LONG msec) {
76 Interval.QuadPart = -10 * 1000 * (LONGLONG)msec;
78}
79
80static inline void udelay(LONG usec) {
82 Interval.QuadPart = -10 * (LONGLONG)usec;
84}
85
86//
87// Helper macros
88//
89
90#if DBG
91#define DEBUG_LEVEL_ERROR 1
92#define DEBUG_LEVEL_INFO 2
93#define DEBUG_LEVEL_VERBOSE 3
94
95#define DBG_INIT 1
96#define DBG_PNP 2
97#define DBG_IOCTL 4
98
99#define SklHdAudBusDebugLevel 100
100#define SklHdAudBusDebugCategories (DBG_INIT | DBG_PNP | DBG_IOCTL)
101
102#define SklHdAudBusPrint(dbglevel, dbgcategory, fmt, ...) { \
103 if (SklHdAudBusDebugLevel >= dbglevel && \
104 (SklHdAudBusDebugCategories & dbgcategory)) \
105 { \
106 DbgPrint(DRIVERNAME); \
107 DbgPrint(fmt, ##__VA_ARGS__); \
108 } \
109}
110#else
111#define SklHdAudBusPrint(dbglevel, fmt, ...) { \
112}
113#endif
114#endif
unsigned short UINT16
Definition: actypes.h:129
LONG NTSTATUS
Definition: precomp.h:26
#define FALSE
Definition: types.h:117
HDAUDIO_BUS_INTERFACE_BDL HDA_BusInterfaceBDL(PVOID Context)
Definition: hdaudio.cpp:1146
HDAUDIO_BUS_INTERFACE HDA_BusInterface(PVOID Context)
Definition: hdaudio.cpp:1119
static void udelay(LONG usec)
Definition: driver.h:80
HDAUDIO_BUS_INTERFACE_V2 HDA_BusInterfaceV2(PVOID Context)
Definition: hdaudio.cpp:1055
NTSTATUS HDA_WaitForTransfer(PFDO_CONTEXT fdoCtx, UINT16 codecAddr, _In_ ULONG Count, _Inout_updates_(Count) PHDAUDIO_CODEC_TRANSFER CodecTransfer)
Definition: hdaudio.cpp:3
static void mdelay(LONG msec)
Definition: driver.h:74
HDAUDIO_BUS_INTERFACE_V3 HDA_BusInterfaceV3(PVOID Context)
Definition: hdaudio.cpp:1086
#define KeDelayExecutionThread(mode, foo, t)
Definition: env_spec_w32.h:484
#define KernelMode
Definition: asm.h:38
DWORD Interval
Definition: netstat.c:30
#define _Inout_updates_(s)
Definition: no_sal2.h:182
#define _In_
Definition: no_sal2.h:158
int Count
Definition: noreturn.cpp:7
long LONG
Definition: pedump.c:60
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t ULONG
Definition: typedefs.h:59