ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

common.hpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions
00007 are met:
00008 1. Redistributions of source code must retain the above copyright
00009    notice, this list of conditions and the following disclaimer.
00010 2. Redistributions in binary form must reproduce the above copyright
00011    notice, this list of conditions and the following disclaimer in the
00012    documentation and/or other materials provided with the distribution.
00013 3. The name of the author may not be used to endorse or promote products
00014    derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00017 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00018 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00019 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00021 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00022 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00023 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00025 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 */
00027 
00028 #ifndef _COMMON_HPP_
00029 #define _COMMON_HPP_
00030 
00031 #include "ntddk.h"
00032 #include "stdunk.h"
00033 #include "portcls.h"
00034 #include "dmusicks.h"
00035 #include "ksdebug.h"
00036 #include "kcom.h"
00037 #include "ksmedia.h"
00038 
00039 #include "interfaces.hpp"
00040 #include "debug.hpp"
00041 #include "cmireg.hpp"
00042 
00043 class CCMIAdapter : public ICMIAdapter,
00044                     public IAdapterPowerManagement
00045 {
00046 private:
00047     PDEVICE_OBJECT      DeviceObject;
00048     PINTERRUPTSYNC      InterruptSync;
00049     DEVICE_POWER_STATE  CurrentPowerState;
00050     UInt8               mixerCache[0xFF];
00051 
00052     CMI8738Info         cm;
00053 
00054     bool queryChip();
00055     void resetController();
00056 
00057 public:
00058     STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
00059     STDMETHODIMP_(ULONG) AddRef()
00060     {
00061         InterlockedIncrement(&m_Ref);
00062         return m_Ref;
00063     }
00064     STDMETHODIMP_(ULONG) Release()
00065     {
00066         InterlockedDecrement(&m_Ref);
00067 
00068         if (!m_Ref)
00069         {
00070             delete this;
00071             return 0;
00072         }
00073         return m_Ref;
00074     }
00075 
00076     CCMIAdapter(IUnknown *OuterUnknown){}
00077     ~CCMIAdapter();
00078 
00079     IMP_IAdapterPowerManagement;
00080 
00081     STDMETHODIMP_(NTSTATUS) init(PRESOURCELIST ResourceList, PDEVICE_OBJECT aDeviceObject);
00082     STDMETHODIMP_(NTSTATUS) activateMPU(ULONG* MPUBase);
00083     STDMETHODIMP_(NTSTATUS) loadSBMixerFromMemory();
00084 
00085     STDMETHODIMP_(UInt8)    readUInt8(UInt8 reg);
00086     STDMETHODIMP_(void)     writeUInt8(UInt8 reg, UInt8 value);
00087 
00088     STDMETHODIMP_(void)     setUInt8Bit(UInt8 reg, UInt8 flag);
00089     STDMETHODIMP_(void)     clearUInt8Bit(UInt8 reg, UInt8 flag);
00090 
00091     STDMETHODIMP_(UInt16)   readUInt16(UInt8 reg);
00092     STDMETHODIMP_(void)     writeUInt16(UInt8 reg, UInt16 value);
00093 
00094     STDMETHODIMP_(UInt32)   readUInt32(UInt8 reg);
00095     STDMETHODIMP_(void)     writeUInt32(UInt8 reg, UInt32 value);
00096 
00097     STDMETHODIMP_(void)     setUInt32Bit(UInt8 reg, UInt32 flag);
00098     STDMETHODIMP_(void)     clearUInt32Bit(UInt8 reg, UInt32 flag);
00099 
00100     STDMETHODIMP_(UInt8)    readMixer(UInt8 index);
00101     STDMETHODIMP_(void)     writeMixer(UInt8 index, UInt8 value);
00102     STDMETHODIMP_(void)     setMixerBit(UInt8 index, UInt8 flag);
00103     STDMETHODIMP_(void)     clearMixerBit(UInt8 index, UInt8 flag);
00104 
00105     STDMETHODIMP_(void)     resetMixer();
00106 
00107     static NTSTATUS NTAPI           InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext);
00108 
00109     STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
00110     {
00111         return &cm;
00112     };
00113 
00114     STDMETHODIMP_(PINTERRUPTSYNC) getInterruptSync(void)
00115     {
00116         return InterruptSync;
00117     };
00118     STDMETHODIMP_(PDEVICE_OBJECT) getDeviceObject(void)
00119     {
00120         return DeviceObject;
00121     };
00122 
00123     friend NTSTATUS NewCCMIAdapter(PCMIADAPTER* OutCMIAdapter, PRESOURCELIST ResourceList);
00124 
00125     LONG m_Ref;
00126 
00127 };
00128 
00129 NTSTATUS NewCMIAdapter(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType);
00130 
00131 #endif  //_COMMON_HPP_

Generated on Sun May 27 2012 04:28:38 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.