I2SOpaqueSlaveOnlyTransportInterface.cpp [plain text]
#include "I2SOpaqueSlaveOnlyTransportInterface.h"
#include <IOKit/pwr_mgt/RootDomain.h>
#include <IOKit/IOTimerEventSource.h>
#include "AudioHardwareUtilities.h"
#include "PlatformInterface.h"
#define super I2STransportInterface
OSDefineMetaClassAndStructors ( I2SOpaqueSlaveOnlyTransportInterface, I2STransportInterface );
#pragma mark #--------------------
#pragma mark # PUBLIC METHODS
#pragma mark #--------------------
bool I2SOpaqueSlaveOnlyTransportInterface::init ( PlatformInterface * inPlatformInterface ) {
bool success;
IOReturn result = kIOReturnError;
debugIOLog (3, "+ I2SOpaqueSlaveOnlyTransportInterface[%p]::init ( %d )", this, (unsigned int)inPlatformInterface );
success = super::init ( inPlatformInterface );
FailIf ( !success, Exit );
super::transportSetTransportInterfaceType ( kTransportInterfaceType_I2S_Opaque_Slave_Only );
result = super::transportSetSampleRate ( 44100 );
FailIf ( kIOReturnSuccess != result, Exit );
result = super::transportBreakClockSelect ( kTRANSPORT_SLAVE_CLOCK );
FailIf ( kIOReturnSuccess != result, Exit );
result = super::transportMakeClockSelect ( kTRANSPORT_SLAVE_CLOCK );
FailIf ( kIOReturnSuccess != result, Exit );
success = true;
Exit:
debugIOLog (3, "- I2STransportInterface[%p (%ld)]::init ( %d ) = %d", this, mInstanceIndex, (unsigned int)inPlatformInterface, (unsigned int)success );
return success;
}
void I2SOpaqueSlaveOnlyTransportInterface::free () {
IOReturn err;
err = super::transportBreakClockSelect ( kTRANSPORT_MASTER_CLOCK );
FailMessage ( kIOReturnSuccess != err );
err = super::transportMakeClockSelect ( kTRANSPORT_MASTER_CLOCK );
FailMessage ( kIOReturnSuccess != err );
super::free();
return;
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::transportSetSampleRate ( UInt32 sampleRate ) {
IOReturn result;
result = super::transportSetSampleRate ( sampleRate );
return result;
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::transportSetSampleWidth ( UInt32 sampleWidth, UInt32 dmaWidth ) {
IOReturn result;
result = super::transportSetSampleWidth ( sampleWidth, dmaWidth );
return result;
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::performTransportSleep ( void ) {
IOReturn result;
result = super::performTransportSleep ();
return result;
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::performTransportWake ( void ) {
IOReturn result;
result = super::performTransportWake ();
result = super::transportBreakClockSelect ( kTRANSPORT_SLAVE_CLOCK );
FailIf ( kIOReturnSuccess != result, Exit );
result = super::transportMakeClockSelect ( kTRANSPORT_SLAVE_CLOCK );
FailIf ( kIOReturnSuccess != result, Exit );
Exit:
return result;
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::transportBreakClockSelect ( UInt32 clockSource ) {
return super::transportBreakClockSelect ( clockSource );
}
IOReturn I2SOpaqueSlaveOnlyTransportInterface::transportMakeClockSelect ( UInt32 clockSource ) {
return super::transportMakeClockSelect ( clockSource );
}
UInt32 I2SOpaqueSlaveOnlyTransportInterface::transportGetSampleRate ( void ) {
UInt32 result;
result = super::transportGetSampleRate ();
if ( 0 == result ) { result = TransportInterface::transportGetSampleRate (); }
return result;
}