ReactOS  0.4.15-dev-1386-g5cb9f87
common.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
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.
15 
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.
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 
42 PVOID
43 __cdecl
44 operator new(
45  size_t size,
46  POOL_TYPE pool_type,
47  ULONG tag);
48 
49 class CCMIAdapter : public ICMIAdapter,
50  public IAdapterPowerManagement,
51  public CUnknown
52 {
53 private:
58 
60 
61  bool queryChip();
62  void resetController();
63 
64 public:
67  ~CCMIAdapter();
68 
70 
72  STDMETHODIMP_(NTSTATUS) activateMPU(ULONG* MPUBase);
73  STDMETHODIMP_(NTSTATUS) loadSBMixerFromMemory();
74 
75  STDMETHODIMP_(UInt8) readUInt8(UInt8 reg);
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 
81  STDMETHODIMP_(UInt16) readUInt16(UInt8 reg);
82  STDMETHODIMP_(void) writeUInt16(UInt8 reg, UInt16 value);
83 
84  STDMETHODIMP_(UInt32) readUInt32(UInt8 reg);
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 
90  STDMETHODIMP_(UInt8) readMixer(UInt8 index);
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_
PINTERRUPTSYNC InterruptSync
Definition: common.hpp:55
#define __cdecl
Definition: accygwin.h:79
~CCMIAdapter()
Definition: common.cpp:113
DWORD UInt32
Definition: chm_lib.c:104
#define REFCLSID
Definition: guiddef.h:117
ICMIAdapter * PCMIADAPTER
Definition: interfaces.hpp:260
LONG NTSTATUS
Definition: precomp.h:26
bool queryChip()
Definition: common.cpp:158
#define UInt8
Definition: interfaces.hpp:75
STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
Definition: common.hpp:99
STDMETHODIMP_(PDEVICE_OBJECT) getDeviceObject(void)
Definition: common.hpp:108
USHORT UInt16
Definition: chm_lib.c:102
void resetController()
Definition: common.cpp:228
STDMETHODIMP_(PINTERRUPTSYNC) getInterruptSync(void)
Definition: common.hpp:104
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
static int init
Definition: wintirpc.c:33
IMP_IAdapterPowerManagement
Definition: common.hpp:69
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
STDMETHODIMP_(void) writeUInt8(UInt8 reg
DEVICE_POWER_STATE CurrentPowerState
Definition: common.hpp:56
GLuint index
Definition: glext.h:6031
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
GLsizeiptr size
Definition: glext.h:5919
PDEVICE_OBJECT DeviceObject
Definition: common.hpp:54
INT POOL_TYPE
Definition: typedefs.h:78
CMI8738Info cm
Definition: common.hpp:59
static int reg
Definition: i386-dis.c:1283
static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext)
Definition: common.cpp:436
friend NTSTATUS NewCCMIAdapter(PCMIADAPTER *OutCMIAdapter, PRESOURCELIST ResourceList)
IResourceList * PRESOURCELIST
Definition: portcls.h:442
UInt8 flag
Definition: common.hpp:78
PDEVICE_OBJECT aDeviceObject
Definition: common.hpp:71
NTSTATUS NewCMIAdapter(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
Definition: common.cpp:34
IInterruptSync * PINTERRUPTSYNC
Definition: portcls.h:878
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
unsigned int ULONG
Definition: retypes.h:1
UInt8 mixerCache[0xFF]
Definition: common.hpp:57
DEFINE_STD_CONSTRUCTOR(CCMIAdapter)
char * tag
Definition: main.c:59