ReactOS 0.4.15-dev-8428-g6910fa6
common.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
81. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
102. 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.
133. The name of the author may not be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef _COMMON_HPP_
29#define _COMMON_HPP_
30
31#include "stdunk.h"
32#include "portcls.h"
33#include "dmusicks.h"
34#include "ksdebug.h"
35#include "kcom.h"
36
37#include "interfaces.hpp"
38#include "debug.hpp"
39#include "cmireg.hpp"
40
41
44operator new(
45 size_t size,
46 POOL_TYPE pool_type,
47 ULONG tag);
48
49class CCMIAdapter : public ICMIAdapter,
50 public IAdapterPowerManagement,
51 public CUnknown
52{
53private:
58
60
61 bool queryChip();
62 void resetController();
63
64public:
68
70
72 STDMETHODIMP_(NTSTATUS) activateMPU(ULONG* MPUBase);
73 STDMETHODIMP_(NTSTATUS) loadSBMixerFromMemory();
74
76 STDMETHODIMP_(void) writeUInt8(UInt8 reg, UInt8 value);
77
78 STDMETHODIMP_(void) setUInt8Bit(UInt8 reg, UInt8 flag);
79 STDMETHODIMP_(void) clearUInt8Bit(UInt8 reg, UInt8 flag);
80
82 STDMETHODIMP_(void) writeUInt16(UInt8 reg, UInt16 value);
83
85 STDMETHODIMP_(void) writeUInt32(UInt8 reg, UInt32 value);
86
87 STDMETHODIMP_(void) setUInt32Bit(UInt8 reg, UInt32 flag);
88 STDMETHODIMP_(void) clearUInt32Bit(UInt8 reg, UInt32 flag);
89
91 STDMETHODIMP_(void) writeMixer(UInt8 index, UInt8 value);
92 STDMETHODIMP_(void) setMixerBit(UInt8 index, UInt8 flag);
93 STDMETHODIMP_(void) clearMixerBit(UInt8 index, UInt8 flag);
94
95 STDMETHODIMP_(void) resetMixer();
96
98
99 STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
100 {
101 return &cm;
102 };
103
104 STDMETHODIMP_(PINTERRUPTSYNC) getInterruptSync(void)
105 {
106 return InterruptSync;
107 };
108 STDMETHODIMP_(PDEVICE_OBJECT) getDeviceObject(void)
109 {
110 return DeviceObject;
111 };
112
114};
115
117
118#endif //_COMMON_HPP_
#define __cdecl
Definition: accygwin.h:79
LONG NTSTATUS
Definition: precomp.h:26
USHORT UInt16
Definition: chm_lib.c:102
DWORD UInt32
Definition: chm_lib.c:104
STDMETHODIMP_(UInt32) readUInt32(UInt8 reg)
STDMETHODIMP_(UInt16) readUInt16(UInt8 reg)
static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext)
Definition: common.cpp:436
UInt8 mixerCache[0xFF]
Definition: common.hpp:57
PINTERRUPTSYNC InterruptSync
Definition: common.hpp:55
friend NTSTATUS NewCCMIAdapter(PCMIADAPTER *OutCMIAdapter, PRESOURCELIST ResourceList)
STDMETHODIMP_(void) clearMixerBit(UInt8 index
STDMETHODIMP_(void) clearUInt32Bit(UInt8 reg
UInt8 flag
Definition: common.hpp:78
STDMETHODIMP_(PINTERRUPTSYNC) getInterruptSync(void)
Definition: common.hpp:104
bool queryChip()
Definition: common.cpp:158
STDMETHODIMP_(void) setMixerBit(UInt8 index
STDMETHODIMP_(void) writeMixer(UInt8 index
PDEVICE_OBJECT DeviceObject
Definition: common.hpp:54
DEFINE_STD_CONSTRUCTOR(CCMIAdapter)
PDEVICE_OBJECT aDeviceObject
Definition: common.hpp:71
STDMETHODIMP_(void) clearUInt8Bit(UInt8 reg
STDMETHODIMP_(void) writeUInt32(UInt8 reg
STDMETHODIMP_(NTSTATUS) loadSBMixerFromMemory()
STDMETHODIMP_(UInt8) readMixer(UInt8 index)
CMI8738Info cm
Definition: common.hpp:59
STDMETHODIMP_(NTSTATUS) activateMPU(ULONG *MPUBase)
void resetController()
Definition: common.cpp:228
STDMETHODIMP_(UInt8) readUInt8(UInt8 reg)
STDMETHODIMP_(void) writeUInt8(UInt8 reg
STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
Definition: common.hpp:99
~CCMIAdapter()
Definition: common.cpp:113
STDMETHODIMP_(PDEVICE_OBJECT) getDeviceObject(void)
Definition: common.hpp:108
DEVICE_POWER_STATE CurrentPowerState
Definition: common.hpp:56
IMP_IAdapterPowerManagement
Definition: common.hpp:69
STDMETHODIMP_(void) writeUInt16(UInt8 reg
STDMETHODIMP_(void) resetMixer()
NTSTATUS NewCMIAdapter(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
Definition: common.cpp:34
#define UInt8
Definition: interfaces.hpp:75
ICMIAdapter * PCMIADAPTER
Definition: interfaces.hpp:261
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
static int reg
Definition: i386-dis.c:1290
@ Unknown
Definition: i8042prt.h:114
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
IInterruptSync * PINTERRUPTSYNC
Definition: portcls.h:888
IResourceList * PRESOURCELIST
Definition: portcls.h:442
#define REFCLSID
Definition: guiddef.h:117
Definition: ecma_167.h:138
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
static int init
Definition: wintirpc.c:33