ReactOS  0.4.15-dev-5122-g72bdbdd
shared.h
Go to the documentation of this file.
1 /********************************************************************************
2 ** Copyright (c) 1998-2000 Microsoft Corporation. All Rights Reserved.
3 **
4 ** Portions Copyright (c) 1998-1999 Intel Corporation
5 **
6 ********************************************************************************/
7 
8 /* The file shared.h was reviewed by LCA in June 2011 and is acceptable for use by Microsoft. */
9 
10 #ifndef _SHARED_H_
11 #define _SHARED_H_
12 
13 #define PC_IMPLEMENTATION 1
14 
15 //
16 // Get the NTDDK headers instead of the WDM headers that portcls.h wants to include.
17 //
18 #define WIN9X_COMPAT_SPINLOCK
19 
20 #ifdef UNDER_NT
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24  #include <ntddk.h>
25 #ifdef __cplusplus
26 } // extern "C"
27 #endif
28 #endif
29 
30 #include <portcls.h>
31 #include <stdunk.h>
32 #include "ichreg.h"
33 #include "ac97reg.h"
34 #include "debug.h"
35 
36 #ifdef __REACTOS__
37 
38 PVOID
39 operator new (
40  size_t size,
41  POOL_TYPE pool_type,
42  ULONG tag);
43 
44 #define GZCALL NTAPI
45 #else
46 #define GZCALL
47 #endif
48 
49 /*****************************************************************************
50  * Structures and Typedefs
51  */
52 
53 const ULONG PoolTag = '79CA';
54 
55 // This enum defines all the possible pin configurations. It is pretty easy,
56 // cause a pin can be there or not, depending if the CoDec supports it (like
57 // Headphone output (PINC_HPOUT_PRESENT)) or if the OEM disabled the feature
58 // with a private inf file.
59 // Look at common.h file for the registry string names.
60 // ATTN: Don't change without changing the static struct in common.cpp too.
62 {
76  PINC_TOP_ELEMENT // number of PINC's
77 };
78 
79 // This enum defines the functional configuration, called nodes. Nodes are
80 // black boxes that implement a functionality like 3d (NODEC_3D_PRESENT).
81 // At startup, we probe the Codec for features (like the pins above) and
82 // initialize an array which holds the configuration.
84 {
103  NODEC_TOP_ELEMENT // number of NODES's
104 };
105 
106 //
107 // Pin Defininition goes here
108 // We define all the possible pins in the AC97 CoDec and some "virtual" pins
109 // that are used for the topology to connect special functionality like 3D.
110 //
112 {
113  // Source is something that goes into the AC97, dest goes out.
136  PIN_TOP_ELEMENT, // number of pins
138 };
139 
140 #if (DBG)
141 // In case we print some debug information about the pins, we use the names
142 // defined here.
143 const PCHAR TopoPinStrings[] =
144 {
145  "PIN_WAVEOUT_SOURCE",
146  "PIN_PCBEEP_SOURCE",
147  "PIN_PHONE_SOURCE",
148  "PIN_MIC_SOURCE",
149  "PIN_LINEIN_SOURCE",
150  "PIN_CD_SOURCE",
151  "PIN_VIDEO_SOURCE",
152  "PIN_AUX_SOURCE",
153  "PIN_VIRT_3D_CENTER_SOURCE",
154  "PIN_VIRT_3D_DEPTH_SOURCE",
155  "PIN_VIRT_3D_MIX_MONO_SOURCE",
156  "PIN_VIRT_TONE_MIX_SOURCE",
157  "PIN_VIRT_TONE_MIX_MONO_SOURCE",
158  "PIN_VIRT_SURROUND_SOURCE",
159  "PIN_VIRT_CENTER_SOURCE",
160  "PIN_VIRT_LFE_SOURCE",
161  "PIN_VIRT_FRONT_SOURCE",
162  "PIN_MASTEROUT_DEST",
163  "PIN_HPOUT_SOURCE",
164  "PIN_MONOOUT_DEST",
165  "PIN_WAVEIN_DEST",
166  "PIN_MICIN_DEST",
167  "TOP_ELEMENT", // should never dump this
168  "INVALID" // or this either
169 };
170 #endif
171 
172 
173 //
174 // Node Definition goes here.
175 // We define all the possible nodes here (nodes are black boxes that represent
176 // a functional block like bass volume) and some virtual nodes, mainly volume
177 // controls, that are used to represent special functionality in the topology
178 // like 3D controls (exposed as volumes) or to give the user volume controls
179 // for each possible record line. In that case, the volume is placed in front
180 // of the record selector (mux). The topology is not parsed correctly if there
181 // are no volume controls between the pins and a muxer. Also, these virtual
182 // controls only represent volumes and no mutes, cause mutes wouldn't be dis-
183 // played by sndvol32.
184 // ATTN: DON'T change without first looking at the table in ac97reg.h!!!
186 {
189  NODE_VIRT_WAVEOUT_3D_BYPASS, // exposed as AGC control
207  NODE_VIRT_3D_CENTER, // we have no 3D control type, so we
208  NODE_VIRT_3D_DEPTH, // expose 2 volume controls and 2 mute
209  NODE_VIRT_3D_ENABLE, // checkboxs (the other is bypass).
220  NODE_VIRT_MONOOUT_VOLUME1, // each mono out must have volume
223  NODE_VIRT_MASTER_INPUT_VOLUME1, // boy, each master input must have a
241  NODE_VIRT_MASTERMONO_VOLUME, // used for multichannel or headphone
243  NODE_TOP_ELEMENT, // number of nodes
245 };
246 
247 #if (DBG)
248 // In case we print some debug information about the nodes, we use names
249 // defined here.
250 const PCHAR NodeStrings[] =
251 {
252  "WAVEOUT_VOLUME",
253  "WAVEOUT_MUTE",
254  "WAVEOUT_3D_BYPASS",
255  "PCBEEP_VOLUME",
256  "PCBEEP_MUTE",
257  "PHONE_VOLUME",
258  "PHONE_MUTE",
259  "MIC_SELECT",
260  "MIC_BOOST",
261  "MIC_VOLUME",
262  "MIC_MUTE",
263  "LINEIN_VOLUME",
264  "LINEIN_MUTE",
265  "CD_VOLUME",
266  "CD_MUTE",
267  "VIDEO_VOLUME",
268  "VIDEO_MUTE",
269  "AUX_VOLUME",
270  "AUX_MUTE",
271  "MAIN_MIX",
272  "3D_CENTER",
273  "3D_DEPTH",
274  "3D_ENABLE",
275  "BEEP_MIX",
276  "BASS",
277  "TREBLE",
278  "LOUDNESS",
279  "SIMUL_STEREO",
280  "MASTER_VOLUME",
281  "MASTER_MUTE",
282  "HPOUT_VOLUME",
283  "HPOUT_MUTE",
284  "MONOOUT_SELECT",
285  "MONOOUT_VOLUME_3D_MIX",
286  "MONOOUT_VOLUME_MIC",
287  "WAVEIN_SELECT",
288  "MASTER_INPUT_VOLUME_MIC",
289  "MASTER_INPUT_VOLUME_CD",
290  "MASTER_INPUT_VOLUME_VIDEO",
291  "MASTER_INPUT_VOLUME_AUX",
292  "MASTER_INPUT_VOLUME_LINEIN",
293  "MASTER_INPUT_VOLUME_TONE_MIX",
294  "MASTER_INPUT_VOLUME_TONE_MIX_MONO",
295  "MASTER_INPUT_VOLUME_PHONE",
296  "MICIN_VOLUME",
297  "MICIN_MUTE",
298  "SURROUND_VOLUME",
299  "SURROUND_MUTE",
300  "CENTER_VOLUME",
301  "CENTER_MUTE",
302  "LFE_VOLUME",
303  "LFE_MUTE",
304  "FRONT_VOLUME",
305  "FRONT_MUTE",
306  "VIRT_MASTERMONO_VOLUME",
307  "VIRT_MASTERMONO_MUTE",
308  "TOP_ELEMENT", // should never dump this
309  "INVALID" // or this
310 };
311 #endif
312 
313 //
314 // The pins used for the wave miniport connection.
315 //
317 {
324 };
325 
326 //
327 // The nodes used for the wave miniport connection.
328 //
330 {
334 };
335 
336 /*****************************************************************************
337  * Function prototypes
338  */
339 
340 /*****************************************************************************
341  * NewAdapterCommon()
342  *****************************************************************************
343  * Create a new adapter common object.
344  */
346 (
347  OUT PUNKNOWN * Unknown,
348  IN REFCLSID,
349  IN PUNKNOWN UnknownOuter OPTIONAL,
351  __drv_reportError("Must succeed pool allocations are forbidden. "
352  "Allocation failures cause a system crash"))
354 );
355 
356 /*****************************************************************************
357  * Class definitions
358  */
359 
360 /*****************************************************************************
361  * IAC97MiniportTopology
362  *****************************************************************************
363  * Interface for topology miniport.
364  */
365 DECLARE_INTERFACE_(IAC97MiniportTopology,IMiniportTopology)
366 {
367  STDMETHOD_(NTSTATUS,GetPhysicalConnectionPins)
368  ( THIS_
369  OUT PULONG WaveOutSource,
370  OUT PULONG WaveInDest,
371  OUT PULONG MicInDest
372  ) PURE;
373  // Used for DRM:
374  STDMETHOD_(void, SetCopyProtectFlag)
375  ( THIS_
376  IN BOOL
377  ) PURE;
378 };
379 
380 typedef IAC97MiniportTopology *PAC97MINIPORTTOPOLOGY;
381 
382 /*****************************************************************************
383  * IAC97AdapterCommon
384  *****************************************************************************
385  * Interface for adapter common object.
386  */
387 DECLARE_INTERFACE_(IAC97AdapterCommon,IUnknown)
388 {
390  ( THIS_
393  ) PURE;
394  STDMETHOD_(BOOL,GetPinConfig)
395  ( THIS_
397  ) PURE;
398  STDMETHOD_(void,SetPinConfig)
399  ( THIS_
401  IN BOOL
402  ) PURE;
403  STDMETHOD_(BOOL,GetNodeConfig)
404  ( THIS_
406  ) PURE;
407  STDMETHOD_(void,SetNodeConfig)
408  ( THIS_
410  IN BOOL
411  ) PURE;
412  STDMETHOD_(AC97Register,GetNodeReg)
413  ( THIS_
414  IN TopoNodes
415  ) PURE;
416  STDMETHOD_(WORD,GetNodeMask)
417  ( THIS_
418  IN TopoNodes
419  ) PURE;
420  STDMETHOD_(NTSTATUS,ReadCodecRegister)
421  ( THIS_
423  _Out_ OUT PWORD wData
424  ) PURE;
425  STDMETHOD_(NTSTATUS,WriteCodecRegister)
426  ( THIS_
428  _In_ IN WORD wData,
429  _In_ IN WORD wMask
430  ) PURE;
431  STDMETHOD_(UCHAR,ReadBMControlRegister8)
432  ( THIS_
433  IN ULONG Offset
434  ) PURE;
435  STDMETHOD_(USHORT,ReadBMControlRegister16)
436  ( THIS_
437  IN ULONG Offset
438  ) PURE;
439  STDMETHOD_(ULONG,ReadBMControlRegister32)
440  ( THIS_
441  IN ULONG Offset
442  ) PURE;
443  STDMETHOD_(void,WriteBMControlRegister)
444  ( THIS_
445  IN ULONG Offset,
446  IN UCHAR Value
447  ) PURE;
448  STDMETHOD_(void,WriteBMControlRegister)
449  ( THIS_
450  IN ULONG Offset,
451  IN USHORT Value
452  ) PURE;
453  STDMETHOD_(void,WriteBMControlRegister)
454  ( THIS_
455  IN ULONG Offset,
456  IN ULONG Value
457  ) PURE;
458  STDMETHOD_(NTSTATUS, RestoreCodecRegisters)
459  ( THIS_
460  void
461  ) PURE;
462  STDMETHOD_(NTSTATUS, ProgramSampleRate)
463  ( THIS_
464  IN AC97Register Register,
465  IN DWORD dwSampleRate
466  ) PURE;
467  // Used for DRM:
468  STDMETHOD_(void, SetMiniportTopology)
469  ( THIS_
471  ) PURE;
472  STDMETHOD_(PAC97MINIPORTTOPOLOGY, GetMiniportTopology)
473  ( THIS_
474  void
475  ) PURE;
476  // These are used by the wave miniport.
477  STDMETHOD_(void, ReadChannelConfigDefault)
478  ( THIS_
479  PDWORD pwChannelConfig,
480  PWORD pwChannels
481  ) PURE;
482  STDMETHOD_(void, WriteChannelConfigDefault)
483  ( THIS_
484  DWORD dwChannelConfig
485  ) PURE;
486 };
487 
488 typedef IAC97AdapterCommon *PADAPTERCOMMON;
489 
490 /*****************************************************************************
491  * Guids for the Interfaces
492  *****************************************************************************
493  */
494 
495 // {77481FA0-1EF2-11d2-883A-0080C765647D}
496 DEFINE_GUID(IID_IAC97AdapterCommon,
497 0x77481fa0, 0x1ef2, 0x11d2, 0x88, 0x3a, 0x0, 0x80, 0xc7, 0x65, 0x64, 0x7d);
498 
499 // {245AE964-49C8-11d2-95D7-00C04FB925D3}
500 DEFINE_GUID(IID_IAC97MiniportTopology,
501 0x245ae964, 0x49c8, 0x11d2, 0x95, 0xd7, 0x0, 0xc0, 0x4f, 0xb9, 0x25, 0xd3);
502 
503 #endif //_SHARED_H_
504 
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:39
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define __drv_reportError(why)
Definition: driverspecs.h:319
#define _In_range_(lb, ub)
Definition: ms_sal.h:571
#define THIS_
Definition: basetyps.h:65
GLint x0
Definition: linetemp.h:95
#define _Out_
Definition: ms_sal.h:345
TopoPinConfig
Definition: shared.h:61
#define REFCLSID
Definition: guiddef.h:117
DECLARE_INTERFACE_(IAC97MiniportTopology, IMiniportTopology)
Definition: shared.h:365
LONG NTSTATUS
Definition: precomp.h:26
DEFINE_GUID(IID_IAC97AdapterCommon, 0x77481fa0, 0x1ef2, 0x11d2, 0x88, 0x3a, 0x0, 0x80, 0xc7, 0x65, 0x64, 0x7d)
IAC97AdapterCommon * PADAPTERCOMMON
Definition: shared.h:486
#define _When_(expr, annos)
Definition: ms_sal.h:254
#define BOOL
Definition: nt_native.h:43
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
unsigned int BOOL
Definition: ntddk_ex.h:94
IAC97MiniportTopology * PAC97MINIPORTTOPOLOGY
Definition: shared.h:378
NTSTATUS NewAdapterCommon(OUT PUNKNOWN *Unknown, IN REFCLSID, IN PUNKNOWN UnknownOuter OPTIONAL, _When_((PoolType &NonPagedPoolMustSucceed) !=0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash")) IN POOL_TYPE PoolType)
Definition: common.cpp:117
#define _In_
Definition: ms_sal.h:308
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
WORD * PWORD
Definition: pedump.c:67
TopoNodeConfig
Definition: shared.h:83
GLsizeiptr size
Definition: glext.h:5919
WaveNodes
Definition: shared.h:329
INT POOL_TYPE
Definition: typedefs.h:78
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
unsigned char UCHAR
Definition: xmlstorage.h:181
IResourceList * PRESOURCELIST
Definition: portcls.h:442
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
TopoNodes
Definition: shared.h:185
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
#define PURE
Definition: basetyps.h:64
TopoPins
Definition: shared.h:111
DWORD * PDWORD
Definition: pedump.c:68
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
unsigned int ULONG
Definition: retypes.h:1
WavePins
Definition: shared.h:316
AC97Register
Definition: ac97reg.h:16
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
char * tag
Definition: main.c:59