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.

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