Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

472 lines
13 KiB

  1. /********************************************************************************
  2. ** Copyright (c) 1998-2000 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** Portions Copyright (c) 1998-1999 Intel Corporation
  5. **
  6. ********************************************************************************/
  7. #ifndef _SHARED_H_
  8. #define _SHARED_H_
  9. #define PC_IMPLEMENTATION 1
  10. #include <portcls.h>
  11. #include <stdunk.h>
  12. #include "ichreg.h"
  13. #include "ac97reg.h"
  14. #include "debug.h"
  15. /*****************************************************************************
  16. * Structures and Typedefs
  17. */
  18. // This enum defines all the possible pin configurations. It is pretty easy,
  19. // cause a pin can be there or not, depending if the CoDec supports it (like
  20. // Headphone output (PINC_HPOUT_PRESENT)) or if the OEM disabled the feature
  21. // with a private inf file.
  22. // Look at common.h file for the registry string names.
  23. // ATTN: Don't change without changing the static struct in common.cpp too.
  24. enum TopoPinConfig
  25. {
  26. PINC_PCBEEP_PRESENT = 0,
  27. PINC_PHONE_PRESENT,
  28. PINC_MIC2_PRESENT,
  29. PINC_VIDEO_PRESENT,
  30. PINC_AUX_PRESENT,
  31. PINC_HPOUT_PRESENT,
  32. PINC_MONOOUT_PRESENT,
  33. PINC_MICIN_PRESENT,
  34. PINC_MIC_PRESENT,
  35. PINC_LINEIN_PRESENT,
  36. PINC_CD_PRESENT,
  37. PINC_SURROUND_PRESENT,
  38. PINC_CENTER_LFE_PRESENT,
  39. PINC_TOP_ELEMENT // number of PINC's
  40. };
  41. // This enum defines the functional configuration, called nodes. Nodes are
  42. // black boxes that implement a functionality like 3d (NODEC_3D_PRESENT).
  43. // At startup, we probe the Codec for features (like the pins above) and
  44. // initialize an array which holds the configuration.
  45. enum TopoNodeConfig
  46. {
  47. NODEC_3D_PRESENT = 0,
  48. NODEC_TONE_PRESENT,
  49. NODEC_LOUDNESS_PRESENT,
  50. NODEC_SIMUL_STEREO_PRESENT,
  51. NODEC_6BIT_MASTER_VOLUME,
  52. NODEC_6BIT_HPOUT_VOLUME,
  53. NODEC_6BIT_MONOOUT_VOLUME,
  54. NODEC_6BIT_SURROUND_VOLUME,
  55. NODEC_6BIT_CENTER_LFE_VOLUME,
  56. NODEC_3D_CENTER_ADJUSTABLE,
  57. NODEC_3D_DEPTH_ADJUSTABLE,
  58. NODEC_PCM_VARIABLERATE_SUPPORTED,
  59. NODEC_PCM_VSR_INDEPENDENT_RATES,
  60. NODEC_PCM_DOUBLERATE_SUPPORTED,
  61. NODEC_MIC_VARIABLERATE_SUPPORTED,
  62. NODEC_CENTER_DAC_PRESENT,
  63. NODEC_SURROUND_DAC_PRESENT,
  64. NODEC_LFE_DAC_PRESENT,
  65. NODEC_TOP_ELEMENT // number of NODES's
  66. };
  67. //
  68. // Pin Defininition goes here
  69. // We define all the possible pins in the AC97 CoDec and some "virtual" pins
  70. // that are used for the topology to connect special functionality like 3D.
  71. //
  72. enum TopoPins
  73. {
  74. // Source is something that goes into the AC97, dest goes out.
  75. PIN_WAVEOUT_SOURCE = 0,
  76. PIN_PCBEEP_SOURCE,
  77. PIN_PHONE_SOURCE,
  78. PIN_MIC_SOURCE,
  79. PIN_LINEIN_SOURCE,
  80. PIN_CD_SOURCE,
  81. PIN_VIDEO_SOURCE,
  82. PIN_AUX_SOURCE,
  83. PIN_VIRT_3D_CENTER_SOURCE,
  84. PIN_VIRT_3D_DEPTH_SOURCE,
  85. PIN_VIRT_3D_MIX_MONO_SOURCE,
  86. PIN_VIRT_TONE_MIX_SOURCE,
  87. PIN_VIRT_TONE_MIX_MONO_SOURCE,
  88. PIN_VIRT_SURROUND_SOURCE,
  89. PIN_VIRT_CENTER_SOURCE,
  90. PIN_VIRT_LFE_SOURCE,
  91. PIN_VIRT_FRONT_SOURCE,
  92. PIN_MASTEROUT_DEST,
  93. PIN_HPOUT_SOURCE,
  94. PIN_MONOOUT_DEST,
  95. PIN_WAVEIN_DEST,
  96. PIN_MICIN_DEST,
  97. PIN_TOP_ELEMENT, // number of pins
  98. PIN_INVALID
  99. };
  100. #if (DBG)
  101. // In case we print some debug information about the pins, we use the names
  102. // defined here.
  103. const PCHAR TopoPinStrings[] =
  104. {
  105. "PIN_WAVEOUT_SOURCE",
  106. "PIN_PCBEEP_SOURCE",
  107. "PIN_PHONE_SOURCE",
  108. "PIN_MIC_SOURCE",
  109. "PIN_LINEIN_SOURCE",
  110. "PIN_CD_SOURCE",
  111. "PIN_VIDEO_SOURCE",
  112. "PIN_AUX_SOURCE",
  113. "PIN_VIRT_3D_CENTER_SOURCE",
  114. "PIN_VIRT_3D_DEPTH_SOURCE",
  115. "PIN_VIRT_3D_MIX_MONO_SOURCE",
  116. "PIN_VIRT_TONE_MIX_SOURCE",
  117. "PIN_VIRT_TONE_MIX_MONO_SOURCE",
  118. "PIN_VIRT_SURROUND_SOURCE",
  119. "PIN_VIRT_CENTER_SOURCE",
  120. "PIN_VIRT_LFE_SOURCE",
  121. "PIN_VIRT_FRONT_SOURCE",
  122. "PIN_MASTEROUT_DEST",
  123. "PIN_HPOUT_SOURCE",
  124. "PIN_MONOOUT_DEST",
  125. "PIN_WAVEIN_DEST",
  126. "PIN_MICIN_DEST",
  127. "TOP_ELEMENT", // should never dump this
  128. "INVALID" // or this either
  129. };
  130. #endif
  131. //
  132. // Node Definition goes here.
  133. // We define all the possible nodes here (nodes are black boxes that represent
  134. // a functional block like bass volume) and some virtual nodes, mainly volume
  135. // controls, that are used to represent special functionality in the topology
  136. // like 3D controls (exposed as volumes) or to give the user volume controls
  137. // for each possible record line. In that case, the volume is placed in front
  138. // of the record selector (mux). The topology is not parsed correctly if there
  139. // are no volume controls between the pins and a muxer. Also, these virtual
  140. // controls only represent volumes and no mutes, cause mutes wouldn't be dis-
  141. // played by sndvol32.
  142. // ATTN: DON'T change without first looking at the table in ac97reg.h!!!
  143. enum TopoNodes
  144. {
  145. NODE_WAVEOUT_VOLUME = 0,
  146. NODE_WAVEOUT_MUTE,
  147. NODE_VIRT_WAVEOUT_3D_BYPASS, // exposed as AGC control
  148. NODE_PCBEEP_VOLUME,
  149. NODE_PCBEEP_MUTE,
  150. NODE_PHONE_VOLUME,
  151. NODE_PHONE_MUTE,
  152. NODE_MIC_SELECT,
  153. NODE_MIC_BOOST,
  154. NODE_MIC_VOLUME,
  155. NODE_MIC_MUTE,
  156. NODE_LINEIN_VOLUME,
  157. NODE_LINEIN_MUTE,
  158. NODE_CD_VOLUME,
  159. NODE_CD_MUTE,
  160. NODE_VIDEO_VOLUME,
  161. NODE_VIDEO_MUTE,
  162. NODE_AUX_VOLUME,
  163. NODE_AUX_MUTE,
  164. NODE_MAIN_MIX,
  165. NODE_VIRT_3D_CENTER, // we have no 3D control type, so we
  166. NODE_VIRT_3D_DEPTH, // expose 2 volume controls and 2 mute
  167. NODE_VIRT_3D_ENABLE, // checkboxs (the other is bypass).
  168. NODE_BEEP_MIX,
  169. NODE_BASS,
  170. NODE_TREBLE,
  171. NODE_LOUDNESS,
  172. NODE_SIMUL_STEREO,
  173. NODE_MASTEROUT_VOLUME,
  174. NODE_MASTEROUT_MUTE,
  175. NODE_HPOUT_VOLUME,
  176. NODE_HPOUT_MUTE,
  177. NODE_MONOOUT_SELECT,
  178. NODE_VIRT_MONOOUT_VOLUME1, // each mono out must have volume
  179. NODE_VIRT_MONOOUT_VOLUME2,
  180. NODE_WAVEIN_SELECT,
  181. NODE_VIRT_MASTER_INPUT_VOLUME1, // boy, each master input must have a
  182. NODE_VIRT_MASTER_INPUT_VOLUME2, // volume
  183. NODE_VIRT_MASTER_INPUT_VOLUME3,
  184. NODE_VIRT_MASTER_INPUT_VOLUME4,
  185. NODE_VIRT_MASTER_INPUT_VOLUME5,
  186. NODE_VIRT_MASTER_INPUT_VOLUME6,
  187. NODE_VIRT_MASTER_INPUT_VOLUME7,
  188. NODE_VIRT_MASTER_INPUT_VOLUME8,
  189. NODE_MICIN_VOLUME,
  190. NODE_MICIN_MUTE,
  191. NODE_SURROUND_VOLUME,
  192. NODE_SURROUND_MUTE,
  193. NODE_CENTER_VOLUME,
  194. NODE_CENTER_MUTE,
  195. NODE_LFE_VOLUME,
  196. NODE_LFE_MUTE,
  197. NODE_FRONT_VOLUME,
  198. NODE_FRONT_MUTE,
  199. NODE_VIRT_MASTERMONO_VOLUME, // used for multichannel or headphone
  200. NODE_VIRT_MASTERMONO_MUTE,
  201. NODE_TOP_ELEMENT, // number of nodes
  202. NODE_INVALID
  203. };
  204. #if (DBG)
  205. // In case we print some debug information about the nodes, we use names
  206. // defined here.
  207. const PCHAR NodeStrings[] =
  208. {
  209. "WAVEOUT_VOLUME",
  210. "WAVEOUT_MUTE",
  211. "WAVEOUT_3D_BYPASS",
  212. "PCBEEP_VOLUME",
  213. "PCBEEP_MUTE",
  214. "PHONE_VOLUME",
  215. "PHONE_MUTE",
  216. "MIC_SELECT",
  217. "MIC_BOOST",
  218. "MIC_VOLUME",
  219. "MIC_MUTE",
  220. "LINEIN_VOLUME",
  221. "LINEIN_MUTE",
  222. "CD_VOLUME",
  223. "CD_MUTE",
  224. "VIDEO_VOLUME",
  225. "VIDEO_MUTE",
  226. "AUX_VOLUME",
  227. "AUX_MUTE",
  228. "MAIN_MIX",
  229. "3D_CENTER",
  230. "3D_DEPTH",
  231. "3D_ENABLE",
  232. "BEEP_MIX",
  233. "BASS",
  234. "TREBLE",
  235. "LOUDNESS",
  236. "SIMUL_STEREO",
  237. "MASTER_VOLUME",
  238. "MASTER_MUTE",
  239. "HPOUT_VOLUME",
  240. "HPOUT_MUTE",
  241. "MONOOUT_SELECT",
  242. "MONOOUT_VOLUME_3D_MIX",
  243. "MONOOUT_VOLUME_MIC",
  244. "WAVEIN_SELECT",
  245. "MASTER_INPUT_VOLUME_MIC",
  246. "MASTER_INPUT_VOLUME_CD",
  247. "MASTER_INPUT_VOLUME_VIDEO",
  248. "MASTER_INPUT_VOLUME_AUX",
  249. "MASTER_INPUT_VOLUME_LINEIN",
  250. "MASTER_INPUT_VOLUME_TONE_MIX",
  251. "MASTER_INPUT_VOLUME_TONE_MIX_MONO",
  252. "MASTER_INPUT_VOLUME_PHONE",
  253. "MICIN_VOLUME",
  254. "MICIN_MUTE",
  255. "SURROUND_VOLUME",
  256. "SURROUND_MUTE",
  257. "CENTER_VOLUME",
  258. "CENTER_MUTE",
  259. "LFE_VOLUME",
  260. "LFE_MUTE",
  261. "FRONT_VOLUME",
  262. "FRONT_MUTE",
  263. "VIRT_MASTERMONO_VOLUME",
  264. "VIRT_MASTERMONO_MUTE",
  265. "TOP_ELEMENT", // should never dump this
  266. "INVALID" // or this
  267. };
  268. #endif
  269. //
  270. // The pins used for the wave miniport connection.
  271. //
  272. enum WavePins
  273. {
  274. PIN_WAVEOUT = 0,
  275. PIN_WAVEOUT_BRIDGE,
  276. PIN_WAVEIN,
  277. PIN_WAVEIN_BRIDGE,
  278. PIN_MICIN,
  279. PIN_MICIN_BRIDGE
  280. };
  281. //
  282. // The nodes used for the wave miniport connection.
  283. //
  284. enum WaveNodes
  285. {
  286. NODE_WAVEOUT_DAC,
  287. NODE_WAVEIN_ADC,
  288. NODE_MICIN_ADC
  289. };
  290. /*****************************************************************************
  291. * Function prototypes
  292. */
  293. class CMiniportWaveICH;
  294. /*****************************************************************************
  295. * NewAdapterCommon()
  296. *****************************************************************************
  297. * Create a new adapter common object.
  298. */
  299. NTSTATUS NewAdapterCommon
  300. (
  301. OUT PUNKNOWN * Unknown,
  302. IN REFCLSID,
  303. IN PUNKNOWN UnknownOuter OPTIONAL,
  304. IN POOL_TYPE PoolType
  305. );
  306. /*****************************************************************************
  307. * Class definitions
  308. */
  309. /*****************************************************************************
  310. * IMiniportTopologyICH
  311. *****************************************************************************
  312. * Interface for topology miniport.
  313. */
  314. DECLARE_INTERFACE_(IMiniportTopologyICH,IMiniportTopology)
  315. {
  316. STDMETHOD_(NTSTATUS,GetPhysicalConnectionPins)
  317. ( THIS_
  318. OUT PULONG WaveOutSource,
  319. OUT PULONG WaveInDest,
  320. OUT PULONG MicInDest
  321. ) PURE;
  322. // Used for DRM:
  323. STDMETHOD_(void, SetCopyProtectFlag)
  324. ( THIS_
  325. IN BOOL
  326. ) PURE;
  327. };
  328. typedef IMiniportTopologyICH *PMINIPORTTOPOLOGYICH;
  329. /*****************************************************************************
  330. * IAdapterCommon
  331. *****************************************************************************
  332. * Interface for adapter common object.
  333. */
  334. DECLARE_INTERFACE_(IAdapterCommon,IUnknown)
  335. {
  336. STDMETHOD_(NTSTATUS,Init)
  337. ( THIS_
  338. IN PRESOURCELIST ResourceList,
  339. IN PDEVICE_OBJECT DeviceObject
  340. ) PURE;
  341. STDMETHOD_(BOOL,GetPinConfig)
  342. ( THIS_
  343. IN TopoPinConfig
  344. ) PURE;
  345. STDMETHOD_(void,SetPinConfig)
  346. ( THIS_
  347. IN TopoPinConfig,
  348. IN BOOL
  349. ) PURE;
  350. STDMETHOD_(BOOL,GetNodeConfig)
  351. ( THIS_
  352. IN TopoNodeConfig
  353. ) PURE;
  354. STDMETHOD_(void,SetNodeConfig)
  355. ( THIS_
  356. IN TopoNodeConfig,
  357. IN BOOL
  358. ) PURE;
  359. STDMETHOD_(AC97Register,GetNodeReg)
  360. ( THIS_
  361. IN TopoNodes
  362. ) PURE;
  363. STDMETHOD_(WORD,GetNodeMask)
  364. ( THIS_
  365. IN TopoNodes
  366. ) PURE;
  367. STDMETHOD_(NTSTATUS,ReadCodecRegister)
  368. ( THIS_
  369. IN AC97Register Register,
  370. OUT PWORD wData
  371. ) PURE;
  372. STDMETHOD_(NTSTATUS,WriteCodecRegister)
  373. ( THIS_
  374. IN AC97Register Register,
  375. IN WORD wData,
  376. IN WORD wMask
  377. ) PURE;
  378. STDMETHOD_(UCHAR,ReadBMControlRegister8)
  379. ( THIS_
  380. IN ULONG Offset
  381. ) PURE;
  382. STDMETHOD_(USHORT,ReadBMControlRegister16)
  383. ( THIS_
  384. IN ULONG Offset
  385. ) PURE;
  386. STDMETHOD_(ULONG,ReadBMControlRegister32)
  387. ( THIS_
  388. IN ULONG Offset
  389. ) PURE;
  390. STDMETHOD_(void,WriteBMControlRegister)
  391. ( THIS_
  392. IN ULONG Offset,
  393. IN UCHAR Value
  394. ) PURE;
  395. STDMETHOD_(void,WriteBMControlRegister)
  396. ( THIS_
  397. IN ULONG Offset,
  398. IN USHORT Value
  399. ) PURE;
  400. STDMETHOD_(void,WriteBMControlRegister)
  401. ( THIS_
  402. IN ULONG Offset,
  403. IN ULONG Value
  404. ) PURE;
  405. STDMETHOD_(NTSTATUS, RestoreCodecRegisters)
  406. ( THIS_
  407. void
  408. ) PURE;
  409. STDMETHOD_(NTSTATUS, ProgramSampleRate)
  410. ( THIS_
  411. IN AC97Register Register,
  412. IN DWORD dwSampleRate
  413. ) PURE;
  414. // Used for DRM:
  415. STDMETHOD_(void, SetMiniportTopology)
  416. ( THIS_
  417. IN PMINIPORTTOPOLOGYICH
  418. ) PURE;
  419. STDMETHOD_(PMINIPORTTOPOLOGYICH, GetMiniportTopology)
  420. ( THIS_
  421. void
  422. ) PURE;
  423. // These are used by the wave miniport.
  424. STDMETHOD_(void, ReadChannelConfigDefault)
  425. ( THIS_
  426. PDWORD pwChannelConfig,
  427. PWORD pwChannels
  428. ) PURE;
  429. STDMETHOD_(void, WriteChannelConfigDefault)
  430. ( THIS_
  431. DWORD dwChannelConfig
  432. ) PURE;
  433. };
  434. typedef IAdapterCommon *PADAPTERCOMMON;
  435. /*****************************************************************************
  436. * Guids for the Interfaces
  437. *****************************************************************************
  438. */
  439. // {77481FA0-1EF2-11d2-883A-0080C765647D}
  440. DEFINE_GUID(IID_IAdapterCommon,
  441. 0x77481fa0, 0x1ef2, 0x11d2, 0x88, 0x3a, 0x0, 0x80, 0xc7, 0x65, 0x64, 0x7d);
  442. // {245AE964-49C8-11d2-95D7-00C04FB925D3}
  443. DEFINE_GUID(IID_IMiniportTopologyICH,
  444. 0x245ae964, 0x49c8, 0x11d2, 0x95, 0xd7, 0x0, 0xc0, 0x4f, 0xb9, 0x25, 0xd3);
  445. #endif //_SHARED_H_