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.

348 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation All Rights Reserved
  3. Module Name:
  4. mintopo.cpp
  5. Abstract:
  6. Implementation of topology miniport.
  7. --*/
  8. #include <msvad.h>
  9. #include <common.h>
  10. #include "ac3.h"
  11. #include "minwave.h"
  12. #include "mintopo.h"
  13. #include "toptable.h"
  14. /*********************************************************************
  15. * Topology/Wave bridge connection *
  16. * *
  17. * +------+ +------+ *
  18. * | Wave | | Topo | *
  19. * | | | | *
  20. * Capture <---|0 1|<===|4 1|<--- Synth *
  21. * | | | | *
  22. * Render --->|2 3|===>|0 | *
  23. * | | | | *
  24. * AC3 Render >|4 5| | | *
  25. * | | | 2|<--- Mic *
  26. * +------+ | | *
  27. * | 3|---> Line Out *
  28. * +------+ *
  29. *********************************************************************/
  30. PHYSICALCONNECTIONTABLE TopologyPhysicalConnections =
  31. {
  32. KSPIN_TOPO_WAVEOUT_SOURCE, // TopologyIn
  33. KSPIN_TOPO_WAVEIN_DEST, // TopologyOut
  34. KSPIN_WAVE_CAPTURE_SOURCE, // WaveIn
  35. KSPIN_WAVE_RENDER_SOURCE // WaveOut
  36. };
  37. #pragma code_seg("PAGE")
  38. //=============================================================================
  39. NTSTATUS
  40. CreateMiniportTopologyMSVAD
  41. (
  42. OUT PUNKNOWN * Unknown,
  43. IN REFCLSID,
  44. IN PUNKNOWN UnknownOuter OPTIONAL,
  45. IN POOL_TYPE PoolType
  46. )
  47. /*++
  48. Routine Description:
  49. Creates a new topology miniport.
  50. Arguments:
  51. Unknown -
  52. RefclsId -
  53. UnknownOuter -
  54. PoolType -
  55. Return Value:
  56. NT status code.
  57. --*/
  58. {
  59. PAGED_CODE();
  60. ASSERT(Unknown);
  61. STD_CREATE_BODY(CMiniportTopology, Unknown, UnknownOuter, PoolType);
  62. } // CreateMiniportTopologyMSVAD
  63. //=============================================================================
  64. CMiniportTopology::~CMiniportTopology
  65. (
  66. void
  67. )
  68. /*++
  69. Routine Description:
  70. Topology miniport destructor
  71. Arguments:
  72. Return Value:
  73. NT status code.
  74. --*/
  75. {
  76. PAGED_CODE();
  77. DPF_ENTER(("[CMiniportTopology::~CMiniportTopology]"));
  78. } // ~CMiniportTopology
  79. //=============================================================================
  80. NTSTATUS
  81. CMiniportTopology::DataRangeIntersection
  82. (
  83. IN ULONG PinId,
  84. IN PKSDATARANGE ClientDataRange,
  85. IN PKSDATARANGE MyDataRange,
  86. IN ULONG OutputBufferLength,
  87. OUT PVOID ResultantFormat OPTIONAL,
  88. OUT PULONG ResultantFormatLength
  89. )
  90. /*++
  91. Routine Description:
  92. The DataRangeIntersection function determines the highest quality
  93. intersection of two data ranges.
  94. Arguments:
  95. PinId - Pin for which data intersection is being determined.
  96. ClientDataRange - Pointer to KSDATARANGE structure which contains the data range
  97. submitted by client in the data range intersection property
  98. request.
  99. MyDataRange - Pin's data range to be compared with client's data range.
  100. OutputBufferLength - Size of the buffer pointed to by the resultant format
  101. parameter.
  102. ResultantFormat - Pointer to value where the resultant format should be
  103. returned.
  104. ResultantFormatLength - Actual length of the resultant format that is placed
  105. at ResultantFormat. This should be less than or equal
  106. to OutputBufferLength.
  107. Return Value:
  108. NT status code.
  109. --*/
  110. {
  111. PAGED_CODE();
  112. return
  113. CMiniportTopologyMSVAD::DataRangeIntersection
  114. (
  115. PinId,
  116. ClientDataRange,
  117. MyDataRange,
  118. OutputBufferLength,
  119. ResultantFormat,
  120. ResultantFormatLength
  121. );
  122. } // DataRangeIntersection
  123. //=============================================================================
  124. STDMETHODIMP
  125. CMiniportTopology::GetDescription
  126. (
  127. OUT PPCFILTER_DESCRIPTOR * OutFilterDescriptor
  128. )
  129. /*++
  130. Routine Description:
  131. The GetDescription function gets a pointer to a filter description.
  132. It provides a location to deposit a pointer in miniport's description
  133. structure. This is the placeholder for the FromNode or ToNode fields in
  134. connections which describe connections to the filter's pins.
  135. Arguments:
  136. OutFilterDescriptor - Pointer to the filter description.
  137. Return Value:
  138. NT status code.
  139. --*/
  140. {
  141. PAGED_CODE();
  142. return
  143. CMiniportTopologyMSVAD::GetDescription(OutFilterDescriptor);
  144. } // GetDescription
  145. //=============================================================================
  146. STDMETHODIMP
  147. CMiniportTopology::Init
  148. (
  149. IN PUNKNOWN UnknownAdapter,
  150. IN PRESOURCELIST ResourceList,
  151. IN PPORTTOPOLOGY Port_
  152. )
  153. /*++
  154. Routine Description:
  155. The Init function initializes the miniport. Callers of this function
  156. should run at IRQL PASSIVE_LEVEL
  157. Arguments:
  158. UnknownAdapter - A pointer to the Iuknown interface of the adapter object.
  159. ResourceList - Pointer to the resource list to be supplied to the miniport
  160. during initialization. The port driver is free to examine the
  161. contents of the ResourceList. The port driver will not be
  162. modify the ResourceList contents.
  163. Port - Pointer to the topology port object that is linked with this miniport.
  164. Return Value:
  165. NT status code.
  166. --*/
  167. {
  168. PAGED_CODE();
  169. ASSERT(UnknownAdapter);
  170. ASSERT(Port_);
  171. DPF_ENTER(("[CMiniportTopology::Init]"));
  172. NTSTATUS ntStatus;
  173. ntStatus =
  174. CMiniportTopologyMSVAD::Init
  175. (
  176. UnknownAdapter,
  177. Port_
  178. );
  179. if (NT_SUCCESS(ntStatus))
  180. {
  181. m_FilterDescriptor = &MiniportFilterDescriptor;
  182. }
  183. return ntStatus;
  184. } // Init
  185. //=============================================================================
  186. STDMETHODIMP
  187. CMiniportTopology::NonDelegatingQueryInterface
  188. (
  189. IN REFIID Interface,
  190. OUT PVOID * Object
  191. )
  192. /*++
  193. Routine Description:
  194. QueryInterface for MiniportTopology
  195. Arguments:
  196. Interface - GUID of the interface
  197. Object - interface object to be returned.
  198. Return Value:
  199. NT status code.
  200. --*/
  201. {
  202. PAGED_CODE();
  203. ASSERT(Object);
  204. if (IsEqualGUIDAligned(Interface, IID_IUnknown))
  205. {
  206. *Object = PVOID(PUNKNOWN(this));
  207. }
  208. else if (IsEqualGUIDAligned(Interface, IID_IMiniport))
  209. {
  210. *Object = PVOID(PMINIPORT(this));
  211. }
  212. else if (IsEqualGUIDAligned(Interface, IID_IMiniportTopology))
  213. {
  214. *Object = PVOID(PMINIPORTTOPOLOGY(this));
  215. }
  216. else
  217. {
  218. *Object = NULL;
  219. }
  220. if (*Object)
  221. {
  222. // We reference the interface for the caller.
  223. PUNKNOWN(*Object)->AddRef();
  224. return(STATUS_SUCCESS);
  225. }
  226. return(STATUS_INVALID_PARAMETER);
  227. } // NonDelegatingQueryInterface
  228. //=============================================================================
  229. NTSTATUS
  230. PropertyHandler_Topology
  231. (
  232. IN PPCPROPERTY_REQUEST PropertyRequest
  233. )
  234. /*++
  235. Routine Description:
  236. Redirects property request to miniport object
  237. Arguments:
  238. PropertyRequest -
  239. Return Value:
  240. NT status code.
  241. --*/
  242. {
  243. PAGED_CODE();
  244. ASSERT(PropertyRequest);
  245. DPF_ENTER(("[PropertyHandler_Topology]"));
  246. return ((PCMiniportTopology)
  247. (PropertyRequest->MajorTarget))->PropertyHandlerGeneric
  248. (
  249. PropertyRequest
  250. );
  251. } // PropertyHandler_Topology
  252. #pragma code_seg()