AppleOnboardAudio.h [plain text]
#ifndef __APPLEONBOARDAUDIO__
#define __APPLEONBOARDAUDIO__
#include <IOKit/IOInterruptEventSource.h> // from: Kernel.framework/Headers/IOKit/
#include <IOKit/IOUserClient.h> // from: Kernel.framework/Headers/IOKit/
#include <IOKit/IOSyncer.h> // from: Kernel.framework/Headers/IOKit/
#include "AudioHardwareCommon.h"
#include "AudioHardwareConstants.h"
#include "AppleDBDMAAudio.h"
#include "AudioHardwareObjectInterface.h"
#include "AppleOnboardAudioUserClient.h"
#include "PlatformInterface.h"
#include "TransportInterface.h"
enum invokeInternalFunctionSelectors {
kInvokeHeadphoneInterruptHandler,
kInvokeSpeakerInterruptHandler
};
#define kChangeHandlerDownDelayTime 3000000000ULL
#define kBatteryPowerDownDelayTime 30000000000ULL
#define kACPowerDownDelayTime 300000000000ULL
#define kiSubMaxVolume 60
#define kiSubVolumePercent 92
#define kRelockToExternalClockMaxNumPolls 4
#define kAOAPropertyHeadphoneExclusive 'hpex'
typedef struct {
UInt32 layoutID; UInt32 portID; UInt32 speakerID; } SpeakerIDStruct;
typedef SpeakerIDStruct * SpeakerIDStructPtr;
class IOAudioControl;
enum outputClipRoutineOptions {
kFloatToIntClip = (1 << 0), kPhaseInversionClip = (1 << 1), kStereoToLeftChanClip = (1 << 2), kStereoToRightChanClip = (1 << 3), kDelayLeftChan1SampleClip = (1 << 4), kDelayRightChan1SampleClip = (1 << 5) };
enum connectionPossibilities {
kMonoSpeaker = (1 << 0),
kStereoSpeaker = (1 << 1),
kInternalClock = (1 << 2),
kExternalClock = (1 << 3),
kMux = (1 << 4)
};
enum deviceConnections {
kInternalSpeakerOutput = 0,
kHeadphoneOutput = 1,
kLineOutOutput = 2,
kExternalSpeakerOutput = 3,
kDigitalOutOutput = 4,
kDigitalInInput = 5,
kLineInInput = 6,
kInternalMicInput = 7,
kExternalMicInput = 8
};
enum jackStates {
kRemoved = 0,
kInserted = 1,
kUnknown = 2
};
enum inputGainControls {
kNoInputGainControls = 0,
kStereoInputGainControls,
kMonoInputGainControl
};
typedef struct AOAStateUserClientStruct {
UInt32 ucPramData;
UInt32 ucPramVolume;
UInt32 ucPowerState;
UInt32 ucLayoutID;
UInt32 uc_fVersion; UInt32 uc_IOAudioEngineStatus_fCurrentLoopCount; UInt32 uc_IOAudioEngineStatus_fLastLoopTime_hi; UInt32 uc_IOAudioEngineStatus_fLastLoopTime_lo; UInt32 uc_IOAudioEngineStatus_fEraseHeadSampleFrame; UInt32 uc_IOAudioEngineState; UInt32 uc_IOAudioStreamFormatExtension_fVersion; UInt32 uc_IOAudioStreamFormatExtension_fFlags; UInt32 uc_IOAudioStreamFormatExtension_fFramesPerPacket; UInt32 uc_IOAudioStreamFormatExtension_fBytesPerPacket; UInt32 uc_IOAudioEngine_sampleOffset; UInt32 uc_mDoKPrintfPowerState;
UInt32 uc_sTotalNumAOAEnginesRunning;
UInt32 uc_numRunningAudioEngines;
UInt32 uc_currentAggressivenessLevel;
UInt32 ucReserved_19;
UInt32 ucReserved_20;
UInt32 ucReserved_21;
UInt32 ucReserved_22;
UInt32 ucReserved_23;
UInt32 ucReserved_24;
UInt32 ucReserved_25;
UInt32 ucReserved_26;
UInt32 ucReserved_27;
UInt32 ucReserved_28;
UInt32 ucReserved_29;
UInt32 ucReserved_30;
UInt32 ucReserved_31;
} AOAStateUserClientStruct, *AOAStateUserClientStructPtr;
#define kPluginPListInputLatency "InputLatency"
#define kPluginPListOutputLatency "OutputLatency"
#define kPluginPListAOAAttributes "AOAAttributes"
#define kPluginPListSoftwareInputGain "SoftwareInputGain"
#define kPluginPListNumHardwareEQBands "NumHardwareEQBands"
#define kMultipleDevices "MultipleDevices"
#define kI2SNode "i2sNode"
#define kSoundNodePath "soundNodePath"
#define kMatchProperty "matchProperty"
#define kSoundEntry "sound"
#define kLayoutID "layout-id"
#define kCompatible "compatible"
#define kLayouts "Layouts"
#define kLayoutIDInfoPlist "LayoutID"
#define kHardwareObjects "HardwareObjects"
#define kPlatformObject "PlatformObject"
#define kAmpRecoveryTime "AmpRecoveryTime"
#define kInputAutoSelect "InputAutoSelect"
#define kMicrosecsToSleep "microsecsToSleep"
#define kExternalClockSelect "ExternalClockSelect"
#define kExternalClockAutoSelect "ExternalClockAutoSelect"
#define kTransportObject "TransportObject"
#define kControls "Controls"
#define kFormats "Formats"
#define kPluginID "PluginID"
#define kSWInterrupts "SWInterrupts"
#define kClockLockIntMessage "ClockLock"
#define kClockUnLockIntMessage "ClockUnLock"
#define kDigitalInInsertIntMessage "DigitalInDetectInsert"
#define kDigitalInRemoveIntMessage "DigitalInDetectRemove"
#define kRemoteChildActiveMessage "RemoteChildActive"
#define kRemoteChildIdleMessage "RemoteChildIdle"
#define kRemoteChildSleepMessage "RemoteChildSleep"
#define kAOAPowerParentMessage "AOAPowerParent"
#define kRemoteActiveMessage "RemoteActive"
#define kRemoteIdleMessage "RemoteIdle"
#define kRemoteSleepMessage "RemoteSleep"
#define kSignalProcessing "SignalProcessing"
#define kSoftwareDSP "SoftwareDSP"
#define kMaxVolumeOffset "maxVolumeOffset"
#define kSpeakerID "SpeakerID"
#define kMicrophoneID "MicrophoneID"
#define kSiliconVersion "SiliconVersion"
#define kPluginRecoveryOrder "RecoveryOrder"
#define kClipRoutines "ClipRoutines"
#define kEncoding "Encoding"
#define kIsMixable "IsMixable"
#define kComboInObject "ComboIn"
#define kComboOutObject "ComboOut"
#define kUsesAOAPowerManagement "UsesAOAPowerManagement"
#define kSleepsLayoutIDAOAInstance "SleepsLayoutIDAOAInstance"
#define kUIMutesAmps "UIMutesAmps"
#define kMuteAmpWhenClockInterrupted "MuteAmpWhenClockInterrupted"
#define kInputsBitmap "InputsBitmap"
#define kOutputsBitmap "OutputsBitmap"
#define kSuppressBootChimeLevelCtrl "suppressBootChimeLevelControl"
#define kComboInNoIrq "ComboInNoIrq"
#define kComboOutNoIrq "ComboOutNoIrq"
#define kTransportIndex "TransportIndex"
#define kPlatformInterfaceSupport "PlatformInterfaceSupport"
#define kLeftVolControlString "Left"
#define kRightVolControlString "Right"
#define kMasterVolControlString "Master"
#define kMuteControlString "Mute"
#define kPlaythroughControlString "Playthrough"
#define kOutputsList "Outputs"
#define kHeadphones "Headphones"
#define kInternalSpeakers "IntSpeakers"
#define kExternalSpeakers "ExtSpeakers"
#define kLineOut "LineOut"
#define kDigitalOut "DigitalOut"
#define kInputsList "Inputs"
#define kInternalMic "InternalMic"
#define kExternalMic "ExternalMic"
#define kLineIn "LineIn"
#define kDigitalIn "DigitalIn"
#define kInputDataMux "InputDataMux"
#define kPluginPListMasterVol "master-vol"
#define kPluginPListLeftVol "left-vol"
#define kPluginPListRightVol "right-vol"
#define kPluginPListLeftGain "left-gain"
#define kPluginPListRightGain "right-gain"
#define kPluginPListMasterGain "master-gain"
#define kInternalClockString "InternalClock"
#define kExternalClockString "ExternalClock"
#define kFloatToIntClipString "FloatToInt"
#define kIntToFloatClipString "IntToFloat"
#define kPhaseInversionClipString "PhaseInversion"
#define kStereoToLeftChanClipString "StereoToLeft"
#define kStereoToRightChanClipString "StereoToRight"
#define kDelayLeftChan1SampleClipString "DelayLeft"
#define kDelayRightChan1SampleClipString "DelayRight"
#define kBalanceAdjustClipString "BalanceAdjust"
#define kCopyLeftToRight "LeftToRight"
#define kCopyRightToLeft "RightToLeft"
#define kLeftBalanceAdjust "LeftBalanceAdjust"
#define kRightBalanceAdjust "RightBalanceAdjust"
#define kNoEQID 0xFFFFFFFF
#define kDelayPollAfterWakeFromSleep 8
#define kPlatformDBDMANoIOString "DBDMA_NoIO"
#define kPlatformDBDMAMappedString "DBDMA_Mapped"
#define kPlatformDBDMAPlatformFunctionString "DBDMA_PlatformFunction"
#define kPlatformDBDMAPlatformFunctionK2String "DBDMA_PlatformFunctionK2"
#define kPlatformFCRNoIOString "FCR_NoIO"
#define kPlatformFCRMappedString "FCR_Mapped"
#define kPlatformFCRPlatformFunctionString "FCR_PlatformFunction"
#define kPlatformGPIONoIOString "GPIO_NoIO"
#define kPlatformGPIOMappedString "GPIO_Mapped"
#define kPlatformGPIOPlatformFunctionString "GPIO_PlatformFunction"
#define kPlatformI2CNoIOString "I2C_NoIO"
#define kPlatformI2CMappedString "I2C_Mapped"
#define kPlatformI2CPlatformFunctionString "I2C_PlatformFunction"
#define kPlatformI2SNoIOString "I2S_NoIO"
#define kPlatformI2SMappedString "I2S_Mapped"
#define kPlatformI2SPlatformFunctionString "I2S_PlatformFunction"
enum {
kClockSourceSelectionInternal = 'int ',
kClockSourceSelectionExternal = 'ext '
};
enum {
kLOG_ENTRY_TO_AOA_METHOD = 0,
kLOG_EXIT_FROM_AOA_METHOD
};
class AppleOnboardAudio : public IOAudioDevice
{
friend class PlatformInterface;
OSDeclareDefaultStructors(AppleOnboardAudio);
protected:
IOAudioToggleControl * mOutMuteControl;
IOAudioToggleControl * mPlaythruToggleControl;
IOAudioToggleControl * mHeadphoneConnected;
IOAudioToggleControl * mInputConnectionControl;
IOAudioToggleControl * mOutHeadLineDigExclusiveControl;
IOAudioLevelControl * mPRAMVolumeControl;
IOAudioLevelControl * mOutMasterVolumeControl;
IOAudioLevelControl * mOutLeftVolumeControl;
IOAudioLevelControl * mOutRightVolumeControl;
IOAudioLevelControl * mInLeftGainControl;
IOAudioLevelControl * mInRightGainControl;
IOAudioLevelControl * mInMasterGainControl;
IOAudioSelectorControl * mInputSelector;
IOAudioSelectorControl * mOutputSelector;
IOAudioSelectorControl * mExternalClockSelector;
IONotifier * mSysPowerDownNotifier;
OSArray * mPluginObjects;
PlatformInterface * mPlatformInterface;
TransportInterface * mTransportInterface;
AudioHardwareObjectInterface * mCurrentOutputPlugin;
AudioHardwareObjectInterface * mCurrentInputPlugin;
#ifdef THREAD_POWER_MANAGEMENT
thread_call_t mPowerThread;
#endif
thread_call_t mInitHardwareThread;
bool mTerminating;
bool mClockSelectInProcessSemaphore;
bool mSampleRateSelectInProcessSemaphore;
bool mPowerOrderHasBeenSet; OSString * mInternalSpeakerOutputString;
OSString * mExternalSpeakerOutputString;
OSString * mLineOutputString;
OSString * mDigitalOutputString;
OSString * mHeadphoneOutputString;
OSString * mInternalMicrophoneInputString;
OSString * mExternalMicrophoneInputString;
OSString * mLineInputString;
OSString * mDigitalInputString;
AppleDBDMAAudio * mDriverDMAEngine;
Boolean mVolMuteActive;
SInt32 mVolLeft;
SInt32 mVolRight;
SInt32 mGainLeft;
SInt32 mGainRight;
Boolean mUseMasterVolumeControl;
Boolean mUseInputGainControls;
Boolean mUsePlaythroughControl; UInt32 mLayoutID;
UInt32 mDetectCollection;
UInt32 mInternalSpeakerID;
UInt32 mInternalMicrophoneID;
UInt32 mSiliconVersion;
bool mCurrentPluginNeedsSoftwareInputGain;
bool mCurrentPluginNeedsSoftwareOutputVolume;
UInt32 mAmpRecoveryMuteDuration;
UInt32 mOutputLatency;
IOTimerEventSource * idleTimer;
IOTimerEventSource * pollTimer;
UInt32 mCurrentOutputSelection; Boolean mIsMute;
Boolean mAutoUpdatePRAM;
Boolean shuttingDown;
OSArray * AudioSoftDSPFeatures;
OSString * mCurrentProcessingOutputString;
OSString * mCurrentProcessingInputString;
sndHWDeviceSpec currentDevices;
bool fCPUNeedsPhaseInversion; bool mHasHardwareInputGain; bool mRangeInChanged;
bool mEncodedOutputFormat;
DualMonoModeType mInternalMicDualMonoMode;
UInt32 mProcessingParams[kMaxProcessingParamSize/sizeof(UInt32)];
bool disableLoadingEQFromFile;
SInt32 mCurrentClockSelector;
IOService * mProvider;
IOAudioSampleRate mTransportSampleRate;
IOSyncer * mSignal;
UInt32 mMatchingIndex;
static UInt32 sInstanceCount;
UInt32 mInstanceIndex;
bool mInputDSPMode;
OSArray * mAOAInstanceArray;
IONotifier * aoaNotifier;
UInt32 mCodecLockStatus;
UInt32 mDigitalInsertStatus;
bool mUIMutesAmps;
bool mAutoSelectInput;
bool mAutoSelectClock;
bool mDisableAutoSelectClock;
bool mMuteAmpWhenClockInterrupted;
bool mRelockToExternalClockInProgress; UInt32 mRelockToExternalClockPollCount;
bool mHasSPDIFControl; SInt32 mOutputSelectorLastValue;
public:
IOInterruptEventSource * mSoftwareInterruptHandler;
UInt16 mInterruptProduced[kNumberOfActionSelectors];
UInt16 mInterruptConsumed[kNumberOfActionSelectors];
static bool aoaPublished (AppleOnboardAudio * aoaObject, void * refCon, IOService * newService);
virtual bool aoaPublishedAction ( void * refCon, IOService * newService );
static void softwareInterruptHandler (OSObject *, IOInterruptEventSource *, int count);
virtual UInt32 getLayoutID ( void ) { return mLayoutID; }
virtual bool start (IOService * provider);
virtual bool init (OSDictionary * properties);
virtual void free ();
virtual void stop (IOService * provider);
virtual bool willTerminate ( IOService * provider, IOOptionBits options );
virtual bool handleOpen (IOService * forClient, IOOptionBits options, void * arg ) ;
virtual void handleClose (IOService * forClient, IOOptionBits options );
virtual bool initHardware (IOService * provider);
static void initHardwareThread (AppleOnboardAudio * aoa, void * provider);
static IOReturn initHardwareThreadAction (OSObject * owner, void * provider, void * arg2, void * arg3, void * arg4);
virtual IOReturn protectedInitHardware (IOService * provider);
virtual IOReturn createDefaultControls ();
virtual IOReturn createInputGainControls (void);
virtual IOReturn createOutputVolumeControls (void);
virtual UInt16 getTerminalTypeForCharCode (UInt32 outputSelection);
virtual UInt32 getCharCodeForString (OSString * inputString);
virtual IOReturn createInputSelectorControl (void);
virtual IOReturn createOutputSelectorControl (void);
void createPlayThruControl (void);
void removePlayThruControl (void);
virtual OSString * getStringForCharCode (UInt32 charCode);
virtual UInt32 getCharCodeForIntCode (UInt32 inCode);
virtual IORegistryEntry * FindEntryByNameAndProperty (const IORegistryEntry * start, const char * name, const char * key, UInt32 value);
static IOReturn outputControlChangeHandler (IOService *target, IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue);
static IOReturn inputControlChangeHandler (IOService *target, IOAudioControl *control, SInt32 oldValue, SInt32 newValue);
virtual IOReturn volumeMasterChange (SInt32 newValue);
virtual IOReturn volumeLeftChange (SInt32 newValue, bool ignoreMuteState = FALSE);
virtual IOReturn volumeRightChange (SInt32 newValue, bool ignoreMuteState = FALSE);
virtual IOReturn selectCodecOutputWithMuteState (SInt32 newValue);
virtual IOReturn gainLeftChanged (SInt32 newValue);
virtual IOReturn gainRightChanged (SInt32 newValue);
virtual IOReturn gainMasterChanged (SInt32 newValue);
virtual IOReturn passThruChanged (SInt32 newValue);
virtual IOReturn inputSelectorChanged (SInt32 newValue);
virtual IOReturn outputSelectorChanged (SInt32 newValue);
virtual IOReturn clockSelectorChanged (SInt32 newValue);
virtual IOReturn performPowerStateChange (IOAudioDevicePowerState oldPowerState, IOAudioDevicePowerState newPowerState, UInt32 * microsecondsUntilComplete);
static void performPowerStateChangeThread (AppleOnboardAudio * aoa, void * newPowerState);
static IOReturn performPowerStateChangeThreadAction (OSObject * owner, void * newPowerState, void * us, void * arg3, void * arg4);
virtual IOReturn performPowerStateAction ( OSObject * owner, void * newPowerState, void * arg2, void * arg3, void * arg4 );
virtual IOReturn performPowerStateChangeAction ( void * newPowerState );
virtual IOReturn performPowerStateChangeAction_requestActive ( bool allowDetectIRQDispatch );
virtual IOReturn performPowerStateChangeAction_requestIdle ( void );
virtual IOReturn performPowerStateChangeAction_requestSleep ( void );
virtual IOReturn doLocalChangeToActiveState ( bool allowDetectIRQDispatch, Boolean * wasPoweredDown ); virtual IOReturn doLocalChangeScheduleIdle ( Boolean wasPoweredDown );
virtual IOReturn newUserClient (task_t inOwningTask,
void * inSecurityID,
UInt32 inType,
IOUserClient ** outHandler);
virtual void registerPlugin (AudioHardwareObjectInterface * thePlugin);
static IOReturn registerPluginAction (OSObject * owner, void * arg1, void * arg2, void * arg3, void * arg4);
virtual void unRegisterPlugin (AudioHardwareObjectInterface *inPlugin);
virtual void interruptEventHandler (UInt32 statusSelector, UInt32 newValue);
static IOReturn interruptEventHandlerAction (OSObject * owner, void * arg1, void * arg2, void * arg3, void * arg4);
virtual void protectedInterruptEventHandler (UInt32 statusSelector, UInt32 newValue);
virtual bool executeProtectedInterruptEventHandlerWhenInactive ( UInt32 selector );
virtual void startDetectInterruptService ( void );
virtual void endDetectInterruptService ( void );
virtual bool broadcastSoftwareInterruptMessage ( UInt32 actionSelector );
virtual PlatformInterface * getPlatformInterfaceObject (void);
virtual IOReturn AdjustOutputVolumeControls (AudioHardwareObjectInterface * thePluginObject, UInt32 inSelection);
virtual IOReturn AdjustInputGainControls (AudioHardwareObjectInterface * thePluginObject);
virtual UInt32 getDeviceIndex () {return mInstanceIndex;}
UInt32 getAOAInstanceIndex () { return mInstanceIndex; }
virtual UInt32 getTransportIndex ( void ) { return mTransportInterfaceIndex; }
virtual IOReturn validateOutputFormatChangeRequest (const IOAudioStreamFormat * inFormat, const IOAudioSampleRate * inRate);
virtual IOReturn validateInputFormatChangeRequest (const IOAudioStreamFormat * inFormat, const IOAudioSampleRate * inRate);
virtual IOReturn formatChangeRequest (const IOAudioStreamFormat * inFormat, const IOAudioSampleRate * inRate);
virtual UInt32 getCurrentSampleFrame (void);
virtual void setCurrentSampleFrame (UInt32 value);
UInt32 getNumHardwareEQBandsForCurrentOutput ();
AudioHardwareObjectInterface * getCurrentOutputPlugin () { return mCurrentOutputPlugin; };
IOReturn getPlatformState ( UInt32 arg2, void * outState );
IOReturn getPluginState ( HardwarePluginType arg2, void * outState );
IOReturn getDMAStateAndFormat ( UInt32 arg2, void * outState );
IOReturn setDMAStateAndFormat ( UInt32 arg2, void * inState );
IOReturn getSoftwareProcessingState ( UInt32 arg2, void * outState );
IOReturn getAOAState ( UInt32 arg2, void * outState );
IOReturn getTransportInterfaceState ( UInt32 arg2, void * outState );
IOReturn getRealTimeCPUUsage ( UInt32 arg2, void * outState );
IOReturn setPlatformState ( UInt32 arg2, void * inState );
IOReturn setPluginState ( HardwarePluginType arg2, void * inState );
IOReturn setDMAState ( UInt32 arg2, void * inState );
IOReturn setSoftwareProcessingState ( UInt32 arg2, void * inState );
IOReturn setAOAState ( UInt32 arg2, void * inState );
IOReturn setTransportInterfaceState ( UInt32 arg2, void * inState );
virtual void setInputDataMuxForConnection ( char * connectionString );
AOAStateUserClientStruct mUCState;
virtual void notifyStreamFormatsPublished ( void );
bool getDoKPrintfPowerState () { return mDoKPrintfPowerState; }
UInt32 getDetectCollection () { return mDetectCollection; }
protected:
void audioEngineStopped ();
void audioEngineStarting ();
IOReturn configureDMAEngines(IOService *provider);
IOReturn parseAndActivateInit(IOService *provider);
IOReturn configureAudioDetects(IOService *provider);
IOReturn configureAudioOutputs(IOService *provider);
IOReturn configureAudioInputs(IOService *provider);
IOReturn configurePowerObject(IOService *provider);
IOReturn outputControlChangeHandlerAction ( IOService *target, IOAudioControl *volumeControl, SInt32 oldValue, SInt32 newValue ); IOReturn inputControlChangeHandlerAction ( IOService *target, IOAudioControl *control, SInt32 oldValue, SInt32 newValue );
AudioHardwareObjectInterface * getIndexedPluginObject (UInt32 index);
OSObject * getLayoutEntry (const char * entryID, AppleOnboardAudio * theAOA);
bool hasMasterVolumeControl (const char * outputEntry);
bool hasMasterVolumeControl (const UInt32 inCode);
bool hasLeftVolumeControl (const char * outputEntry);
bool hasLeftVolumeControl (const UInt32 inCode);
bool hasRightVolumeControl (const char * outputEntry);
bool hasRightVolumeControl (const UInt32 inCode);
void setUseInputGainControls (const char * outputEntry);
void setUsePlaythroughControl (const char * inputEntry);
OSArray * getControlsArray (const char * outputEntry);
AudioHardwareObjectInterface * getPluginObjectForConnection (const char * entry);
GpioAttributes getInputDataMuxForConnection (const char * entry);
void setSoftwareOutputDSP (const char * inSelectedOutput);
void setSoftwareInputDSP (const char * inSelectedInput);
UInt32 getMaxVolumeOffsetForOutput (const UInt32 inCode);
UInt32 getMaxVolumeOffsetForOutput (const char * inSelectedOutput);
UInt32 setClipRoutineForOutput (const char * inSelectedOutput);
UInt32 setClipRoutineForInput (const char * inSelectedInput);
static IOReturn sysPowerDownHandler (void * target, void * refCon, UInt32 messageType, IOService * provider, void * messageArgument, vm_size_t argSize);
virtual IOReturn sysPowerDownHandlerAction ( UInt32 messageType );
void setCurrentDevices(sndHWDeviceSpec devices);
IOReturn setAggressiveness(unsigned long type, unsigned long newLevel);
void createLeftVolumeControl (IOFixed mindBVol, IOFixed maxdBVol, SInt32 minVolume, SInt32 maxVolume);
void createRightVolumeControl (IOFixed mindBVol, IOFixed maxdBVol, SInt32 minVolume, SInt32 maxVolume);
void createMasterVolumeControl (IOFixed mindBVol, IOFixed maxdBVol, SInt32 minVolume, SInt32 maxVolume);
void createLeftGainControl (IOFixed mindBGain, IOFixed maxdBGain, SInt32 minGain, SInt32 maxGain);
void createRightGainControl (IOFixed mindBGain, IOFixed maxdBGain, SInt32 minGain, SInt32 maxGain);
void createMasterGainControl (IOFixed mindBGain, IOFixed maxdBGain, SInt32 minGain, SInt32 maxGain);
void cacheOutputVolumeLevels (AudioHardwareObjectInterface * thePluginObject);
void cacheInputGainLevels (AudioHardwareObjectInterface * thePluginObject);
void removeLeftVolumeControl ();
void removeRightVolumeControl ();
void removeMasterVolumeControl ();
void removeLeftGainControl ();
void removeRightGainControl ();
void removeMasterGainControl ();
void initializeDetectCollection ( void );
UInt32 getValueForDetectCollection ( UInt32 currentDetectCollection );
UInt32 parseOutputDetectCollection (void);
void updateAllDetectCollection (UInt32 statusSelector, UInt32 newValue);
UInt32 parseInputDetectCollection (void);
void selectOutputAmplifiers (const UInt32 inSelection, const bool inMuteState, const bool inUpdateAll = TRUE);
void muteAllAmps();
UInt32 getSelectorCodeForOutputEvent (UInt32 eventSelector);
char * getConnectionKeyFromCharCode (const SInt32 inSelection, const UInt32 inDirection);
AudioHardwareObjectInterface * getPluginObjectWithName (OSString * inName);
IOReturn callPluginsInReverseOrder (UInt32 inSelector, UInt32 newValue);
IOReturn callPluginsInOrder (UInt32 inSelector, UInt32 newValue);
AudioHardwareObjectInterface * findPluginForType ( HardwarePluginType pluginType );
void setPollTimer ();
static void pollTimerCallback ( OSObject *owner, IOTimerEventSource *device );
void runPollTasksEventHandler ( void );
static IOReturn runPolledTasks (OSObject * owner, void * arg1, void * arg2, void * arg3, void * arg4);
void protectedRunPolledTasks ( void );
bool isTargetForMessage ( UInt32 index, AppleOnboardAudio * theAOA );
virtual AppleOnboardAudio* findAOAInstanceWithLayoutID ( UInt32 layoutID ); UInt32 mUsesAOAPowerManagement; UInt32 mSleepsLayoutIDAOAInstance; bool mSpressBootChimeLevelControl;
UInt32 PRAMToVolumeValue (void);
UInt8 VolumeToPRAMValue (UInt32 leftVol, UInt32 rightVol);
void WritePRAMVol (UInt32 volLeft, UInt32 volRight);
UInt8 ReadPRAMVol (void);
void logPerformPowerStateChangeAction ( UInt32 mInstanceIndex, UInt32 newPowerState, UInt32 curPowerState, bool flag, IOReturn resultCode );
IOTimerEventSource * theTimerEvent;
UInt32 mTransportInterfaceIndex; bool mNeedsLockStatusUpdateToUnmute; UInt32 mDelayPollAfterWakeFromSleep; UInt32 mPlatformInterfaceSupport;
UInt32 mNumberOfAOAPowerParents;
bool mDoKPrintfPowerState; bool mAllowDetectIrqDispatchesOnWake;
bool mJoinAOAPMTree;
UInt32 mCurrentAggressivenessLevel;
UInt32 mMicrosecsToSleep;
static UInt32 sTotalNumAOAEnginesRunning; bool mRemoteDetectInterruptEnabled; bool mRemoteNonDetectInterruptEnabled;
};
class ConfigChangeHelper {
public:
ConfigChangeHelper (IOAudioEngine * inEngine, UInt32 inSleep = 0);
~ConfigChangeHelper ();
private:
IOAudioEngine* mDriverDMAEngine;
};
#endif