#ifndef __APPLE_INTEL_AC97_CONTROLLER_H
#define __APPLE_INTEL_AC97_CONTROLLER_H
#include <IOKit/IOService.h>
#include "AC97Defines.h"
#include "AC97Codec.h"
class AppleIntelAC97Controller : public IOService
{
OSDeclareAbstractStructors( AppleIntelAC97Controller )
protected:
IOService * _provider; UInt32 _openMask; IOService * _codecs[kMaxCodecCount];
virtual IOReturn reserveACLink();
virtual void releaseACLink();
virtual void coldReset();
virtual void warmReset();
virtual bool configureProvider( IOService * provider ) = 0;
virtual UInt32 bmRead32( UInt16 offset,
DMAChannel channel = 0 ) const = 0;
virtual UInt16 bmRead16( UInt16 offset,
DMAChannel channel = 0 ) const = 0;
virtual UInt8 bmRead8( UInt16 offset,
DMAChannel channel = 0 ) const = 0;
virtual void bmWrite32( UInt16 offset,
UInt32 value,
DMAChannel channel = 0 ) = 0;
virtual void bmWrite16( UInt16 offset,
UInt16 value,
DMAChannel channel = 0 ) = 0;
virtual void bmWrite8( UInt16 offset,
UInt8 value,
DMAChannel channel = 0 ) = 0;
inline UInt32 getGlobalStatus() const
{ return bmRead32(kGlobalStatus); }
virtual UInt32 attachCodecs();
virtual void publishCodecs();
virtual AppleIntelAC97Codec * createCodec( CodecID codecID ) = 0;
virtual void free();
public:
virtual bool start( IOService * provider );
virtual const OSSymbol * getControllerFunction() const;
virtual bool handleOpen( IOService * client,
IOOptionBits options,
void * arg );
virtual void handleClose( IOService * client,
IOOptionBits options );
virtual bool handleIsOpen( const IOService * client ) const;
virtual IOReturn mixerRead16( CodecID codecID,
UInt8 offset,
UInt16 * value ) = 0;
virtual IOReturn mixerWrite16( CodecID codecID,
UInt8 offset,
UInt16 value ) = 0;
virtual IOReturn setDescriptorBaseAddress( DMAChannel channel,
IOPhysicalAddress base );
virtual void setLastValidIndex( DMAChannel channel, UInt8 index );
virtual UInt8 getCurrentIndexValue( DMAChannel channel ) const;
virtual UInt32 getCurrentBufferPosition( DMAChannel channel,
UInt8 * index ) const;
virtual IOReturn startDMAChannel( DMAChannel channel );
virtual void stopDMAChannel( DMAChannel channel );
virtual bool serviceChannelInterrupt( DMAChannel channel );
};
#endif