I2SSlaveOnlyTranportInterface.cpp [plain text]
#include "I2SSlaveOnlyTranportInterface.h"
#include <IOKit/pwr_mgt/RootDomain.h>
#include <IOKit/IOTimerEventSource.h>
#include "AudioHardwareUtilities.h"
#include "PlatformInterface.h"
#define super I2STransportInterface
OSDefineMetaClassAndStructors ( I2SSlaveOnlyTransportInterface, I2STransportInterface );
#pragma mark #--------------------
#pragma mark # PUBLIC METHODS
#pragma mark #--------------------
bool I2SSlaveOnlyTransportInterface::init ( PlatformInterface * inPlatformInterface ) {
bool success;
IOReturn result = kIOReturnError;
debugIOLog (3, "+ I2SSlaveOnlyTransportInterface[%p]::init ( %d )", this, (unsigned int)inPlatformInterface );
success = super::init ( inPlatformInterface );
FailIf ( !success, Exit );
super::transportSetTransportInterfaceType ( kTransportInterfaceType_I2S_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 I2SSlaveOnlyTransportInterface::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 I2SSlaveOnlyTransportInterface::transportSetSampleRate ( UInt32 sampleRate ) {
return kIOReturnSuccess;
}
IOReturn I2SSlaveOnlyTransportInterface::transportSetSampleWidth ( UInt32 sampleWidth, UInt32 dmaWidth ) {
IOReturn result;
result = super::transportSetSampleWidth ( sampleWidth, dmaWidth );
return result;
}
IOReturn I2SSlaveOnlyTransportInterface::performTransportSleep ( void ) {
IOReturn result;
result = super::performTransportSleep ();
return result;
}
IOReturn I2SSlaveOnlyTransportInterface::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 I2SSlaveOnlyTransportInterface::transportBreakClockSelect ( UInt32 clockSource ) {
return kIOReturnSuccess;
}
IOReturn I2SSlaveOnlyTransportInterface::transportMakeClockSelect ( UInt32 clockSource ) {
return kIOReturnSuccess;
}
UInt32 I2SSlaveOnlyTransportInterface::transportGetSampleRate ( void ) {
UInt32 result;
result = super::transportGetSampleRate ();
if ( 0 == result ) { result = TransportInterface::transportGetSampleRate (); }
return result;
}