2 Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 3. The name of the author may not be used to endorse or promote products
14 derived from this software without specific prior written permission.
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include "interfaces.hpp"
43 class CCMIAdapter : public ICMIAdapter,
44 public IAdapterPowerManagement
47 PDEVICE_OBJECT DeviceObject;
48 PINTERRUPTSYNC InterruptSync;
49 DEVICE_POWER_STATE CurrentPowerState;
50 UInt8 mixerCache[0xFF];
55 void resetController();
58 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
59 STDMETHODIMP_(ULONG) AddRef()
61 InterlockedIncrement(&m_Ref);
64 STDMETHODIMP_(ULONG) Release()
66 InterlockedDecrement(&m_Ref);
76 CCMIAdapter(IUnknown *OuterUnknown){}
79 IMP_IAdapterPowerManagement;
81 STDMETHODIMP_(NTSTATUS) init(PRESOURCELIST ResourceList, PDEVICE_OBJECT aDeviceObject);
82 STDMETHODIMP_(NTSTATUS) activateMPU(ULONG* MPUBase);
83 STDMETHODIMP_(NTSTATUS) loadSBMixerFromMemory();
85 STDMETHODIMP_(UInt8) readUInt8(UInt8 reg);
86 STDMETHODIMP_(void) writeUInt8(UInt8 reg, UInt8 value);
88 STDMETHODIMP_(void) setUInt8Bit(UInt8 reg, UInt8 flag);
89 STDMETHODIMP_(void) clearUInt8Bit(UInt8 reg, UInt8 flag);
91 STDMETHODIMP_(UInt16) readUInt16(UInt8 reg);
92 STDMETHODIMP_(void) writeUInt16(UInt8 reg, UInt16 value);
94 STDMETHODIMP_(UInt32) readUInt32(UInt8 reg);
95 STDMETHODIMP_(void) writeUInt32(UInt8 reg, UInt32 value);
97 STDMETHODIMP_(void) setUInt32Bit(UInt8 reg, UInt32 flag);
98 STDMETHODIMP_(void) clearUInt32Bit(UInt8 reg, UInt32 flag);
100 STDMETHODIMP_(UInt8) readMixer(UInt8 index);
101 STDMETHODIMP_(void) writeMixer(UInt8 index, UInt8 value);
102 STDMETHODIMP_(void) setMixerBit(UInt8 index, UInt8 flag);
103 STDMETHODIMP_(void) clearMixerBit(UInt8 index, UInt8 flag);
105 STDMETHODIMP_(void) resetMixer();
107 static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext);
109 STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
114 STDMETHODIMP_(PINTERRUPTSYNC) getInterruptSync(void)
116 return InterruptSync;
118 STDMETHODIMP_(PDEVICE_OBJECT) getDeviceObject(void)
123 friend NTSTATUS NewCCMIAdapter(PCMIADAPTER* OutCMIAdapter, PRESOURCELIST ResourceList);
129 NTSTATUS NewCMIAdapter(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType);
131 #endif //_COMMON_HPP_