ReactOS  0.4.15-dev-1397-g19779b3
CCMIAdapter Class Reference

#include <common.hpp>

Inheritance diagram for CCMIAdapter:
Collaboration diagram for CCMIAdapter:

Public Member Functions

 DECLARE_STD_UNKNOWN ()
 
 DEFINE_STD_CONSTRUCTOR (CCMIAdapter)
 
 ~CCMIAdapter ()
 
 STDMETHODIMP_ (NTSTATUS) init(PRESOURCELIST ResourceList
 
 STDMETHODIMP_ (NTSTATUS) activateMPU(ULONG *MPUBase)
 
 STDMETHODIMP_ (NTSTATUS) loadSBMixerFromMemory()
 
 STDMETHODIMP_ (UInt8) readUInt8(UInt8 reg)
 
 STDMETHODIMP_ (void) writeUInt8(UInt8 reg
 
 STDMETHODIMP_ (void) setUInt8Bit(UInt8 reg
 
 STDMETHODIMP_ (void) clearUInt8Bit(UInt8 reg
 
 STDMETHODIMP_ (UInt16) readUInt16(UInt8 reg)
 
 STDMETHODIMP_ (void) writeUInt16(UInt8 reg
 
 STDMETHODIMP_ (UInt32) readUInt32(UInt8 reg)
 
 STDMETHODIMP_ (void) writeUInt32(UInt8 reg
 
 STDMETHODIMP_ (void) setUInt32Bit(UInt8 reg
 
 STDMETHODIMP_ (void) clearUInt32Bit(UInt8 reg
 
 STDMETHODIMP_ (UInt8) readMixer(UInt8 index)
 
 STDMETHODIMP_ (void) writeMixer(UInt8 index
 
 STDMETHODIMP_ (void) setMixerBit(UInt8 index
 
 STDMETHODIMP_ (void) clearMixerBit(UInt8 index
 
 STDMETHODIMP_ (void) resetMixer()
 
 STDMETHODIMP_ (PCMI8738Info) getCMI8738Info(void)
 
 STDMETHODIMP_ (PINTERRUPTSYNC) getInterruptSync(void)
 
 STDMETHODIMP_ (PDEVICE_OBJECT) getDeviceObject(void)
 

Static Public Member Functions

static NTSTATUS NTAPI InterruptServiceRoutine (PINTERRUPTSYNC InterruptSync, PVOID StaticContext)
 

Public Attributes

 IMP_IAdapterPowerManagement
 
PDEVICE_OBJECT aDeviceObject
 
UInt8 value
 
UInt8 flag
 
UInt16 value
 
UInt32 value
 
UInt32 flag
 
- Public Attributes inherited from CUnknown
union {
   IUnknown   IUnknown
 
   INonDelegatingUnknown   INonDelegatingUnknown
 
}; 
 
LONG m_ref_count
 
PUNKNOWN m_outer_unknown
 

Private Member Functions

bool queryChip ()
 
void resetController ()
 

Private Attributes

PDEVICE_OBJECT DeviceObject
 
PINTERRUPTSYNC InterruptSync
 
DEVICE_POWER_STATE CurrentPowerState
 
UInt8 mixerCache [0xFF]
 
CMI8738Info cm
 

Friends

NTSTATUS NewCCMIAdapter (PCMIADAPTER *OutCMIAdapter, PRESOURCELIST ResourceList)
 

Detailed Description

Definition at line 49 of file common.hpp.

Constructor & Destructor Documentation

◆ ~CCMIAdapter()

CCMIAdapter::~CCMIAdapter ( )

Definition at line 113 of file common.cpp.

114 {
115  PAGED_CODE ();
116  DBGPRINT(("CCMIAdapter[%p]::~CCMIAdapter()", this));
117 
118  if (InterruptSync) {
119  InterruptSync->Disconnect();
120  InterruptSync->Release();
122  }
123 }
PINTERRUPTSYNC InterruptSync
Definition: common.hpp:55
#define DBGPRINT(...)
Definition: pdo.c:21
#define NULL
Definition: types.h:112
#define PAGED_CODE()

Member Function Documentation

◆ DECLARE_STD_UNKNOWN()

CCMIAdapter::DECLARE_STD_UNKNOWN ( )

◆ DEFINE_STD_CONSTRUCTOR()

CCMIAdapter::DEFINE_STD_CONSTRUCTOR ( CCMIAdapter  )

◆ InterruptServiceRoutine()

NTSTATUS NTAPI CCMIAdapter::InterruptServiceRoutine ( PINTERRUPTSYNC  InterruptSync,
PVOID  StaticContext 
)
static

Definition at line 436 of file common.cpp.

437 {
440 
441  UInt32 status, mask = 0;
442 
443  CCMIAdapter *CMIAdapter = (CCMIAdapter *)DynamicContext;
444 
445  if (!(CMIAdapter->cm.WaveMiniport)) {
446  return STATUS_UNSUCCESSFUL;
447  }
448 
449  status = CMIAdapter->readUInt32(REG_INT_STAT);
450 
451  if ((!(status & INT_PENDING)) || (status == 0xFFFFFFFF)) {
452  return STATUS_UNSUCCESSFUL;
453  }
454 
455  if (status & INT_CH0) {
456  mask |= EN_CH0_INT;
457 #if OUT_CHANNEL == 0
458  CMIAdapter->cm.WaveMiniport->ServiceWaveISR(PCM_OUT_STREAM);
459 #endif
460 #if IN_CHANNEL == 0
461  CMIAdapter->cm.WaveMiniport->ServiceWaveISR(PCM_IN_STREAM);
462 #endif
463  }
464  if (status & INT_CH1) {
465  mask |= EN_CH1_INT;
466 #if OUT_CHANNEL == 1
467  CMIAdapter->cm.WaveMiniport->ServiceWaveISR(PCM_OUT_STREAM);
468 #endif
469 #if IN_CHANNEL == 1
470  CMIAdapter->cm.WaveMiniport->ServiceWaveISR(PCM_IN_STREAM);
471 #endif
472  }
473 #ifdef UART
474  if (status & INT_UART) {
475  // the UART miniport should catch / have caught the interrupt
476  return STATUS_UNSUCCESSFUL;
477  }
478 #endif
479 
480  CMIAdapter->clearUInt32Bit(REG_INTHLDCLR, mask);
481  CMIAdapter->setUInt32Bit(REG_INTHLDCLR, mask);
482 
483  return STATUS_SUCCESS;
484 }
PINTERRUPTSYNC InterruptSync
Definition: common.hpp:55
DWORD UInt32
Definition: chm_lib.c:104
PCMIWAVE WaveMiniport
Definition: interfaces.hpp:143
GLenum GLint GLuint mask
Definition: glext.h:6028
#define PCM_IN_STREAM
Definition: interfaces.hpp:63
#define INT_CH0
Definition: cmireg.hpp:91
#define PCM_OUT_STREAM
Definition: interfaces.hpp:62
#define ASSERT(a)
Definition: mode.c:45
CMI8738Info cm
Definition: common.hpp:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define REG_INTHLDCLR
Definition: cmireg.hpp:79
#define INT_PENDING
Definition: cmireg.hpp:96
#define INT_CH1
Definition: cmireg.hpp:92
#define EN_CH0_INT
Definition: cmireg.hpp:87
#define EN_CH1_INT
Definition: cmireg.hpp:88
#define STATUS_SUCCESS
Definition: shellext.h:65
#define REG_INT_STAT
Definition: cmireg.hpp:90
static SERVICE_STATUS status
Definition: service.c:31
IN PVOID DynamicContext
Definition: portcls.h:839
#define INT_UART
Definition: cmireg.hpp:95
Definition: ps.c:97

Referenced by STDMETHODIMP_().

◆ queryChip()

bool CCMIAdapter::queryChip ( )
private

Definition at line 158 of file common.cpp.

159 {
160  PAGED_CODE();
161  DBGPRINT(("CCMIAdapter[%p]::queryChip()", this));
162 
163  UInt32 version = readUInt32(REG_INTHLDCLR) & VERSION_MASK;
164  if (version == 0xFFFFFFFF) {
165  return false;
166  }
167  if (version) {
168  if (version & VERSION_68) {
169  cm.chipVersion = 68;
170  cm.maxChannels = 8;
171  cm.canAC3HW = true;
172  cm.hasDualDAC = true;
173  cm.canMultiChannel = true;
174  return true;
175  }
176  if (version & VERSION_55) {
177  cm.chipVersion = 55;
178  cm.maxChannels = 6;
179  cm.canAC3HW = true;
180  cm.hasDualDAC = true;
181  cm.canMultiChannel = true;
182  return true;
183  }
184  if (version & VERSION_39) {
185  cm.chipVersion = 39;
186  if (version & VERSION_39_6) {
187  cm.maxChannels = 6;
188  } else {
189  cm.maxChannels = 4;
190  }
191  cm.canAC3HW = true;
192  cm.hasDualDAC = true;
193  cm.canMultiChannel = true;
194  return true;
195  }
196  } else {
197  version = readUInt32(REG_CHFORMAT) & VERSION_37;
198  if (!version) {
199  cm.chipVersion = 33;
200  cm.maxChannels = 2;
201  if (cm.doAC3SW) {
202  cm.canAC3SW = true;
203  } else {
204  cm.canAC3HW = true;
205  }
206  cm.hasDualDAC = true;
207  return true;
208  } else {
209  cm.chipVersion = 37;
210  cm.maxChannels = 2;
211  cm.canAC3HW = true;
212  cm.hasDualDAC = 1;
213  return true;
214  }
215  }
216  return false;
217 }
#define DBGPRINT(...)
Definition: pdo.c:21
#define VERSION_39
Definition: cmireg.hpp:83
DWORD UInt32
Definition: chm_lib.c:104
#define REG_CHFORMAT
Definition: cmireg.hpp:60
static const WCHAR version[]
Definition: asmname.c:66
#define VERSION_MASK
Definition: cmireg.hpp:80
#define VERSION_68
Definition: cmireg.hpp:81
#define VERSION_37
Definition: cmireg.hpp:75
CMI8738Info cm
Definition: common.hpp:59
#define VERSION_39_6
Definition: cmireg.hpp:84
#define REG_INTHLDCLR
Definition: cmireg.hpp:79
UInt32 maxChannels
Definition: interfaces.hpp:136
#define VERSION_55
Definition: cmireg.hpp:82
#define PAGED_CODE()
bool canMultiChannel
Definition: interfaces.hpp:138

Referenced by STDMETHODIMP_().

◆ resetController()

void CCMIAdapter::resetController ( )
private

Definition at line 228 of file common.cpp.

229 {
230  PAGED_CODE();
231  DBGPRINT(("CCMIAdapter[%p]::resetController()", this));
232 
233  writeUInt32(REG_INTHLDCLR, 0);
234 
235 #if OUT_CHANNEL == 1
236  writeUInt32(REG_FUNCTRL0, ADC_CH0 | (RST_CH0 | RST_CH1));
237  writeUInt32(REG_FUNCTRL0, ADC_CH0 & ~(RST_CH0 | RST_CH1));
238 #else
239  writeUInt32(REG_FUNCTRL0, ADC_CH1 | (RST_CH0 | RST_CH1));
240  writeUInt32(REG_FUNCTRL0, ADC_CH1 & ~(RST_CH0 | RST_CH1));
241 #endif
243 
244  writeUInt32(REG_FUNCTRL0, 0);
245  writeUInt32(REG_FUNCTRL1, 0);
246 
247  writeUInt32(REG_CHFORMAT, 0);
248  writeUInt32(REG_MISCCTRL, EN_DBLDAC);
249 #if OUT_CHANNEL == 1
250  setUInt32Bit(REG_MISCCTRL, XCHG_DAC);
251 #endif
252 
253  setUInt32Bit(REG_FUNCTRL1, BREQ);
254 
255  writeMixer(0, 0);
256 
257  return;
258 }
#define REG_FUNCTRL1
Definition: cmireg.hpp:43
#define XCHG_DAC
Definition: cmireg.hpp:118
#define DBGPRINT(...)
Definition: pdo.c:21
#define EN_DBLDAC
Definition: cmireg.hpp:119
#define REG_CHFORMAT
Definition: cmireg.hpp:60
#define RST_CH0
Definition: cmireg.hpp:40
#define REG_MISCCTRL
Definition: cmireg.hpp:111
#define ADC_CH0
Definition: cmireg.hpp:34
#define REG_FUNCTRL0
Definition: cmireg.hpp:33
#define BREQ
Definition: cmireg.hpp:47
#define REG_INTHLDCLR
Definition: cmireg.hpp:79
static const WCHAR L[]
Definition: oid.c:1250
#define RST_CH1
Definition: cmireg.hpp:41
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:95
#define ADC_CH1
Definition: cmireg.hpp:35
#define PAGED_CODE()

Referenced by STDMETHODIMP_().

◆ STDMETHODIMP_() [1/21]

CCMIAdapter::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [2/21]

CCMIAdapter::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [3/21]

CCMIAdapter::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [4/21]

CCMIAdapter::STDMETHODIMP_ ( UInt8  )

◆ STDMETHODIMP_() [5/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [6/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [7/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [8/21]

CCMIAdapter::STDMETHODIMP_ ( UInt16  )

◆ STDMETHODIMP_() [9/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [10/21]

CCMIAdapter::STDMETHODIMP_ ( UInt32  )

◆ STDMETHODIMP_() [11/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [12/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [13/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [14/21]

CCMIAdapter::STDMETHODIMP_ ( UInt8  )

◆ STDMETHODIMP_() [15/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [16/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [17/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [18/21]

CCMIAdapter::STDMETHODIMP_ ( void  )

◆ STDMETHODIMP_() [19/21]

CCMIAdapter::STDMETHODIMP_ ( PCMI8738Info  )
inline

Definition at line 99 of file common.hpp.

100  {
101  return &cm;
102  };
CMI8738Info cm
Definition: common.hpp:59

◆ STDMETHODIMP_() [20/21]

CCMIAdapter::STDMETHODIMP_ ( PINTERRUPTSYNC  )
inline

Definition at line 104 of file common.hpp.

105  {
106  return InterruptSync;
107  };
PINTERRUPTSYNC InterruptSync
Definition: common.hpp:55

◆ STDMETHODIMP_() [21/21]

CCMIAdapter::STDMETHODIMP_ ( PDEVICE_OBJECT  )
inline

Definition at line 108 of file common.hpp.

109  {
110  return DeviceObject;
111  };
PDEVICE_OBJECT DeviceObject
Definition: common.hpp:54

Friends And Related Function Documentation

◆ NewCCMIAdapter

NTSTATUS NewCCMIAdapter ( PCMIADAPTER OutCMIAdapter,
PRESOURCELIST  ResourceList 
)
friend

Member Data Documentation

◆ aDeviceObject

PDEVICE_OBJECT CCMIAdapter::aDeviceObject

Definition at line 71 of file common.hpp.

Referenced by STDMETHODIMP_().

◆ cm

CMI8738Info CCMIAdapter::cm
private

Definition at line 59 of file common.hpp.

Referenced by InterruptServiceRoutine(), queryChip(), STDMETHODIMP_(), and STDMETHODIMP_().

◆ CurrentPowerState

DEVICE_POWER_STATE CCMIAdapter::CurrentPowerState
private

Definition at line 56 of file common.hpp.

Referenced by STDMETHODIMP_().

◆ DeviceObject

PDEVICE_OBJECT CCMIAdapter::DeviceObject
private

Definition at line 54 of file common.hpp.

Referenced by STDMETHODIMP_().

◆ flag [1/2]

UInt8 CCMIAdapter::flag

Definition at line 78 of file common.hpp.

◆ flag [2/2]

UInt32 CCMIAdapter::flag

Definition at line 87 of file common.hpp.

◆ IMP_IAdapterPowerManagement

CCMIAdapter::IMP_IAdapterPowerManagement

Definition at line 69 of file common.hpp.

◆ InterruptSync

PINTERRUPTSYNC CCMIAdapter::InterruptSync
private

Definition at line 55 of file common.hpp.

Referenced by InterruptServiceRoutine(), STDMETHODIMP_(), STDMETHODIMP_(), and ~CCMIAdapter().

◆ mixerCache

UInt8 CCMIAdapter::mixerCache[0xFF]
private

Definition at line 57 of file common.hpp.

Referenced by STDMETHODIMP_().

◆ value [1/3]

UInt8 CCMIAdapter::value

Definition at line 76 of file common.hpp.

◆ value [2/3]

UInt16 CCMIAdapter::value

Definition at line 82 of file common.hpp.

◆ value [3/3]

UInt32 CCMIAdapter::value

Definition at line 85 of file common.hpp.


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