ReactOS  0.4.15-dev-4872-g8a3db97
CAC97MiniportWaveRTStream Class Reference

#include <rtstream.h>

Inheritance diagram for CAC97MiniportWaveRTStream:
Collaboration diagram for CAC97MiniportWaveRTStream:

Public Member Functions

 DECLARE_STD_UNKNOWN ()
 
 DEFINE_STD_CONSTRUCTOR (CAC97MiniportWaveRTStream)
 
 ~CAC97MiniportWaveRTStream ()
 
NTSTATUS Init (IN CAC97MiniportWaveRT *Miniport_, IN PPORTWAVERTSTREAM PortStream, IN ULONG Channel, IN BOOLEAN Capture, IN PKSDATAFORMAT DataFormat)
 
- Public Member Functions inherited from CMiniportStream
 ~CMiniportStream ()
 
void ResetDMA (void)
 
void PauseDMA (void)
 
void ResumeDMA (ULONG state=DMA_ENGINE_ON)
 
int GetBuffPos (DWORD *buffPos)
 
void WriteReg8 (ULONG addr, UCHAR data)
 
void WriteReg16 (ULONG addr, USHORT data)
 
void WriteReg32 (ULONG addr, ULONG data)
 
UCHAR ReadReg8 (ULONG addr)
 
USHORT ReadReg16 (ULONG addr)
 
ULONG ReadReg32 (ULONG addr)
 
 STDMETHODIMP_ (NTSTATUS) SetFormat(_In_ PKSDATAFORMAT Format)
 
void PowerChangeNotify (IN POWER_STATE NewState)
 
virtual void PowerChangeNotify_ (IN POWER_STATE NewState)
 
ULONG GetCurrentSampleRate (void)
 
NTSTATUS Init (IN CMiniport *Miniport_, IN PUNKNOWN PortStream, IN WavePins Pin_, IN BOOLEAN Capture_, IN PKSDATAFORMAT DataFormat_, OUT PSERVICEGROUP *ServiceGroup_)
 
virtual void InterruptServiceRoutine () PURE
 
virtual NTSTATUS Init_ () PURE
 
NTSTATUS NonDelegatingQueryInterface (_In_ REFIID Interface, _COM_Outptr_ PVOID *Object, _In_ REFIID iStream, _In_ PUNKNOWN stream)
 
NTSTATUS SetState (_In_ KSSTATE State)
 
NTSTATUS NormalizePhysicalPosition (_Inout_ PLONGLONG PhysicalPosition)
 
PVOID BDList_Alloc ()
 
void BDList_Free ()
 
void UpdateLviCyclic ()
 

Public Attributes

 IMP_IMiniportWaveRTStream
 
- Public Attributes inherited from CUnknown
union {
   IUnknown   IUnknown
 
   INonDelegatingUnknown   INonDelegatingUnknown
 
}; 
 
LONG m_ref_count
 
PUNKNOWN m_outer_unknown
 
- Public Attributes inherited from CMiniportStream
CMiniportMiniport
 
WavePins Pin
 
BOOL Capture
 
WORD NumberOfChannels
 
DEVICE_POWER_STATE m_PowerState
 
PPORTSTREAM_ PortStream
 
PKSDATAFORMAT_WAVEFORMATEX DataFormat
 
PSERVICEGROUP ServiceGroup
 
ULONG CurrentRate
 
ULONG DMAEngineState
 
ULONG m_ulBDAddr
 
PHYSICAL_ADDRESS BDList_PhysAddr
 
tBDEntryBDList
 
 IMP_IDrmAudioStream
 

Private Attributes

DEVICE_POWER_STATE m_PowerState
 
int mapEntries
 
tBDEntryBDList
 
PMDL BDListMdl
 

Friends

NTSTATUS CAC97MiniportWaveRT::InterruptServiceRoutine (IN PINTERRUPTSYNC InterruptSync, IN PVOID StaticContext)
 

Detailed Description

Definition at line 41 of file rtstream.h.

Constructor & Destructor Documentation

◆ ~CAC97MiniportWaveRTStream()

CAC97MiniportWaveRTStream::~CAC97MiniportWaveRTStream ( )

Definition at line 66 of file rtstream.cpp.

67 {
68  PAGED_CODE ();
69 
70 
71  DOUT (DBG_PRINT, ("[CAC97MiniportWaveRTStream::~CAC97MiniportWaveRTStream]"));
72 
73  //
74  // Delete the scatter gather list since it's not needed anymore
75  //
76  if (BDListMdl && BDList)
77  {
78  PortStream->UnmapAllocatedPages (BDList, BDListMdl);
79  PortStream->FreePagesFromMdl (BDListMdl);
80  BDListMdl = NULL;
81  BDList = NULL;
82  }
83  if (BDList)
84  {
86  }
87 
88  //
89  // Release the port stream.
90  //
91  if (PortStream)
92  {
93  PortStream->Release ();
94  PortStream = NULL;
95  }
96 }
#define DOUT(lvl, strings)
Definition: debug.h:82
#define NULL
Definition: types.h:112
PPORTSTREAM_ PortStream
Definition: stream.h:48
const int DBG_PRINT
Definition: debug.h:17
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PAGED_CODE()

Member Function Documentation

◆ DECLARE_STD_UNKNOWN()

CAC97MiniportWaveRTStream::DECLARE_STD_UNKNOWN ( )

◆ DEFINE_STD_CONSTRUCTOR()

CAC97MiniportWaveRTStream::DEFINE_STD_CONSTRUCTOR ( CAC97MiniportWaveRTStream  )

◆ Init()

NTSTATUS CAC97MiniportWaveRTStream::Init ( IN CAC97MiniportWaveRT Miniport_,
IN PPORTWAVERTSTREAM  PortStream,
IN ULONG  Channel,
IN BOOLEAN  Capture,
IN PKSDATAFORMAT  DataFormat 
)

Definition at line 106 of file rtstream.cpp.

113 {
114  PAGED_CODE ();
115 
116  DOUT (DBG_PRINT, ("[CAC97MiniportWaveRTStream::Init]"));
117 
118  ASSERT (Miniport_);
119  ASSERT (PortStream_);
120  ASSERT (DataFormat_);
121 
122  //
123  // The rule here is that we return when we fail without a cleanup.
124  // The destructor will relase the allocated memory.
125  //
126 
127  //
128  // Allocate memory for the BDL.
129  // First try the least expensive way, which is to allocate it from the pool.
130  // If that fails (it's outside of the controller's address range which can
131  // happen on 64bit machines or PAE) then use portcls's AllocatePagesForMdl.
132  //
134  MAX_BDL_ENTRIES * sizeof (tBDEntry), PoolTag);
135  if (!BDList)
136  {
137  DOUT (DBG_ERROR, ("Failed to allocate the BD list!"));
139  }
140 
141  //
142  // Check to see if our HW can access it.
143  // If the HW cannot see the memory, free it and use AllocatePagesForMdl
144  // which allocates always complete pages, so we have to waste some memory.
145  //
146  if (MmGetPhysicalAddress (BDList).HighPart != 0)
147  {
148  PHYSICAL_ADDRESS high;
149 
150  high.HighPart = 0;
151  high.LowPart = MAXULONG;
152  ExFreePool (BDList);
153  BDListMdl = PortStream->AllocatePagesForMdl (high, PAGE_SIZE);
154  if (!BDListMdl)
155  {
156  DOUT (DBG_ERROR, ("Failed to allocate page for BD list!"));
158  }
159  BDList = (tBDEntry *)PortStream->MapAllocatedPages (BDListMdl, MmCached);
160  if (!BDList)
161  {
162  PortStream->FreePagesFromMdl (BDListMdl);
163  BDListMdl = NULL;
164  DOUT (DBG_ERROR, ("Failed to map the page for the BD list!"));
166  }
167  }
168 
169 
170  return CMiniportStream::Init(Miniport_,
171  Channel_,
172  Capture_,
173  DataFormat_,
174  NULL);
175 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define DOUT(lvl, strings)
Definition: debug.h:82
NTSTATUS Init(IN CMiniport *Miniport_, IN PUNKNOWN PortStream, IN WavePins Pin_, IN BOOLEAN Capture_, IN PKSDATAFORMAT DataFormat_, OUT PSERVICEGROUP *ServiceGroup_)
Definition: stream.cpp:65
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
const int DBG_ERROR
Definition: debug.h:19
const int MAX_BDL_ENTRIES
Definition: rtstream.h:24
ULONG LowPart
Definition: typedefs.h:106
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define MAXULONG
Definition: typedefs.h:251
#define NULL
Definition: types.h:112
PPORTSTREAM_ PortStream
Definition: stream.h:48
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
const int DBG_PRINT
Definition: debug.h:17
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PAGED_CODE()

Friends And Related Function Documentation

◆ CAC97MiniportWaveRT::InterruptServiceRoutine

NTSTATUS CAC97MiniportWaveRT::InterruptServiceRoutine ( IN PINTERRUPTSYNC  InterruptSync,
IN PVOID  StaticContext 
)
friend

Member Data Documentation

◆ BDList

tBDEntry* CAC97MiniportWaveRTStream::BDList
private

Definition at line 53 of file rtstream.h.

Referenced by Init(), STDMETHODIMP_(), and ~CAC97MiniportWaveRTStream().

◆ BDListMdl

PMDL CAC97MiniportWaveRTStream::BDListMdl
private

Definition at line 54 of file rtstream.h.

Referenced by Init(), and ~CAC97MiniportWaveRTStream().

◆ IMP_IMiniportWaveRTStream

CAC97MiniportWaveRTStream::IMP_IMiniportWaveRTStream

Definition at line 84 of file rtstream.h.

◆ m_PowerState

DEVICE_POWER_STATE CAC97MiniportWaveRTStream::m_PowerState
private

Definition at line 49 of file rtstream.h.

◆ mapEntries

int CAC97MiniportWaveRTStream::mapEntries
private

Definition at line 52 of file rtstream.h.


The documentation for this class was generated from the following files: