AFCPU Class Reference

Base CPU class for AF. More...

#include <AFCPU.h>

Inheritance diagram for AFCPU:
AFUncopyable AFCPUHardware

List of all members.

Public Member Functions

 AFCPU (AFCore *core)
 Constructor for AFCPU.
virtual AF_STATUS Init ()=0
 Initializes the CPU.
virtual BOOL Deinit ()=0
 Deinitializes the CPU.
virtual AF_STATUS InitControlBus ()
 Initializes the control bus.
virtual HANDLE GetControlBus ()
 Method to get the handle to the control bus.
virtual DWORD ReadCodecRegister (UCHAR *regData, UCHAR *inData, DWORD inDataSize)
 Reads a codec register through control bus (hardware independent).
virtual DWORD WriteCodecRegister (UCHAR *outData, DWORD outDataSize)
 Writes a codec register through control bus (hardware independent).
virtual DWORD GetAudioDMAPageSize ()=0
 Retrieve the DMA page size.
virtual DWORD GetAudioDMABufferSize ()=0
 Retrieve the DMA buffer size.
virtual PBYTE * GetOutputDMABufferVirtual ()=0
 Method to get a pointer to a virtual output DMA buffer.
virtual PBYTE * GetInputDMABufferVirtual ()=0
 Method to get a pointer to a virtual input DMA buffer.
virtual BOOL InitInputDMA ()=0
 Initializes input DMA.
virtual BOOL InitOutputDMA ()=0
 Initializes output DMA.
virtual VOID StartInputDMA ()=0
 Starts the input DMA transfer (CPU <= codec).
virtual VOID StartOutputDMA ()=0
 Starts the output DMA transfer (CPU => codec).
virtual VOID StopInputDMA ()=0
 Stops the input DMA transfer.
virtual VOID StopOutputDMA ()=0
 Stops the output DMA transfer.
virtual VOID OutputDMAISR ()=0
 Provides the callback for the output DMA interrupt service routine.
virtual VOID InputDMAISR ()=0
 Provides the callback for the input DMA interrupt service routine.
virtual VOID OutputDMAThreadInterruptDoneCallback (DWORD outputTransferred, DWORD outputDMAStatus)=0
 Output DMA transfer done callback.
virtual VOID InputDMAThreadInterruptDoneCallback (DWORD inputTransferred, DWORD inputDMAStatus)=0
 Input DMA transfer done callback.
virtual AF_STATUS InitI2SBus (AFI2SBusCap *cap)=0
 Initializes the I2S bus.
virtual VOID StartOutputI2S ()=0
 Starts the output I2S transfer.
virtual VOID StopOutputI2S ()=0
 Stops the output I2S transfer.
virtual VOID StartInputI2S ()=0
 Starts the input I2S transfer.
virtual VOID StopInputI2S ()=0
 Stops the input I2S transfer.
virtual BOOL PowerUp ()=0
 CPU power up routine.
virtual BOOL PowerDown ()=0
 CPU power down routine.
virtual AFI2SBusCapsGetI2SBusCaps ()
 Method to get the CPU supported I2S bus capabilities.
virtual AFI2SBusCapGetCurrentI2SBusCap ()
 Method to get a current I2S bus configuration the CPU is working in.
virtual FLOAT GetSysClk ()
 Method to get the system clock frequency (in Hz) of the CPU.
virtual HANDLE GetOutputDMAInterruptHandle ()
virtual HANDLE GetInputDMAInterruptHandle ()
virtual ~AFCPU ()
 Empty destructor for AFCPU.

Protected Attributes

AFCorecore
HANDLE hControlBus
CFIo r2WireIO
CFIo w2WireIO
AFI2SBusCaps i2sBusCaps
AFI2SBusCapcurrentI2SBusCap
FLOAT sysClk
DWORD audioDMAPageSize
DWORD audioDMABufferSize
HANDLE outputDMAInterrupt
HANDLE inputDMAInterrupt

Detailed Description

Base CPU class for AF.

The purpose of the base CPU class is to provide the set of methods that should be implemented in every hardware-specific CPU driver for AF.

Definition at line 64 of file AFCPU.h.


Constructor & Destructor Documentation

AFCPU::AFCPU ( AFCore core  )  [inline]

Constructor for AFCPU.

Constructor for the CPU establishing a backwards link to the owning core.

Parameters:
core A pointer to the core (AFCore type)

Definition at line 78 of file AFCPU.h.

virtual AFCPU::~AFCPU (  )  [inline, virtual]

Empty destructor for AFCPU.

Destructor: ~AFCPU

Definition at line 486 of file AFCPU.h.


Member Function Documentation

virtual BOOL AFCPU::Deinit (  )  [pure virtual]

Deinitializes the CPU.

Typical actions performed include: unmapping the registers, releasing DMA channels, etc.

Return values:
TRUE Deinitialization succeeded.
FALSE Deinitialization failed.

Implemented in AFCPUHardware.

virtual DWORD AFCPU::GetAudioDMABufferSize (  )  [pure virtual]

Retrieve the DMA buffer size.

Returns:
The DMA buffer size.

Implemented in AFCPUHardware.

virtual DWORD AFCPU::GetAudioDMAPageSize (  )  [pure virtual]

Retrieve the DMA page size.

Returns:
The DMA page size.

Implemented in AFCPUHardware.

virtual HANDLE AFCPU::GetControlBus (  )  [inline, virtual]

Method to get the handle to the control bus.

Returns:
Handle to the control bus.

Definition at line 133 of file AFCPU.h.

virtual AFI2SBusCap* AFCPU::GetCurrentI2SBusCap (  )  [inline, virtual]

Method to get a current I2S bus configuration the CPU is working in.

Returns:
Current I2S bus configuration (pointer to AFI2SBusCap).

Definition at line 447 of file AFCPU.h.

virtual AFI2SBusCaps* AFCPU::GetI2SBusCaps (  )  [inline, virtual]

Method to get the CPU supported I2S bus capabilities.

This method returns the CPU supported I2S bus capabilites as a pointer to AFI2SBusCaps structure (pointer to the array of the capabilities and the total count).

Returns:
CPU supported I2S bus capabilities (pointer to AFI2SBusCaps).

Definition at line 433 of file AFCPU.h.

virtual PBYTE* AFCPU::GetInputDMABufferVirtual (  )  [pure virtual]

Method to get a pointer to a virtual input DMA buffer.

Returns:
Pointer to virtual input DMA buffer (in bytes).

Implemented in AFCPUHardware.

virtual HANDLE AFCPU::GetInputDMAInterruptHandle (  )  [inline, virtual]

Definition at line 474 of file AFCPU.h.

virtual PBYTE* AFCPU::GetOutputDMABufferVirtual (  )  [pure virtual]

Method to get a pointer to a virtual output DMA buffer.

Returns:
Pointer to virtual output DMA buffer (in bytes).

Implemented in AFCPUHardware.

virtual HANDLE AFCPU::GetOutputDMAInterruptHandle (  )  [inline, virtual]

Definition at line 469 of file AFCPU.h.

virtual FLOAT AFCPU::GetSysClk (  )  [inline, virtual]

Method to get the system clock frequency (in Hz) of the CPU.

The value returned by this method is usually fed to a codec working in a slave mode to derive the other clocks required for I2S (BIT_CLK and LR_CLK).

Returns:
System clock frequency (in Hz).

Definition at line 464 of file AFCPU.h.

virtual AF_STATUS AFCPU::Init (  )  [pure virtual]

Initializes the CPU.

Typical actions performed include: mapping the registers, DMA buffers, etc.

Returns:
Initialization status (AF_STATUS).

Implemented in AFCPUHardware.

AF_STATUS AFCPU::InitControlBus (  )  [virtual]

Initializes the control bus.

Returns:
Control bus initialization status (AF_STATUS).

Definition at line 75 of file AFCPU.cpp.

virtual AF_STATUS AFCPU::InitI2SBus ( AFI2SBusCap cap  )  [pure virtual]

Initializes the I2S bus.

Every hardware specific implementation of AFCPU should override this method providing the initialization sequences for each of the I2S capabilities (AFI2SBusCap in AFI2SBus.h) they export as supported ones. This method will be called by the core after matching best supported I2S configurations between the CPU and the codec.

Parameters:
cap Pointer to the particular I2S configuration (AFI2SBusCap) to be initialized.
Returns:
Initialization status (AF_STATUS).

Implemented in AFCPUHardware.

virtual BOOL AFCPU::InitInputDMA (  )  [pure virtual]

Initializes input DMA.

Return values:
TRUE Initialization succeeded.
FALSE Intialization failed.

Implemented in AFCPUHardware.

virtual BOOL AFCPU::InitOutputDMA (  )  [pure virtual]

Initializes output DMA.

Return values:
TRUE Initialization succeeded.
FALSE Intialization failed.

Implemented in AFCPUHardware.

virtual VOID AFCPU::InputDMAISR (  )  [pure virtual]

Provides the callback for the input DMA interrupt service routine.

This method is called when the input DMA interrupt is fired, and provides CPU driver the opportunity to perform hardware specific actions like clear the interrupt pending bits, etc.

Implemented in AFCPUHardware.

virtual VOID AFCPU::InputDMAThreadInterruptDoneCallback ( DWORD  inputTransferred,
DWORD  inputDMAStatus 
) [pure virtual]

Input DMA transfer done callback.

This method allows the CPU to perform hardware-specific actions after a single input DMA transfer.

Parameters:
inputTransferred The number of bytes to be transferred.
inputDMAStatus A flag indicating which DMA buffer to enable.

Implemented in AFCPUHardware.

virtual VOID AFCPU::OutputDMAISR (  )  [pure virtual]

Provides the callback for the output DMA interrupt service routine.

This method is called when the output DMA interrupt is fired, and provides CPU driver the opportunity to perform hardware specific actions like clear the interrupt pending bits, etc.

Implemented in AFCPUHardware.

virtual VOID AFCPU::OutputDMAThreadInterruptDoneCallback ( DWORD  outputTransferred,
DWORD  outputDMAStatus 
) [pure virtual]

Output DMA transfer done callback.

This method allows the CPU to perform hardware-specific actions after a single output DMA transfer.

Parameters:
outputTransferred The number of bytes to be transferred.
outputDMAStatus A flag indicating which DMA buffer to enable.

Implemented in AFCPUHardware.

virtual BOOL AFCPU::PowerDown (  )  [pure virtual]

CPU power down routine.

This routine is called from the higher layers of the driver (usually on power state changes, i.e. on device suspend).

Return values:
TRUE Powering down succeeded.
FALSE Powering down failed.

Implemented in AFCPUHardware.

virtual BOOL AFCPU::PowerUp (  )  [pure virtual]

CPU power up routine.

This routine is called from the higher layers of the driver (usually on power state changes, i.e. on device wake-up from suspend).

Return values:
TRUE Powering up succeeded.
FALSE Powering up failed.

Implemented in AFCPUHardware.

DWORD AFCPU::ReadCodecRegister ( UCHAR *  regData,
UCHAR *  inData,
DWORD  inDataSize 
) [virtual]

Reads a codec register through control bus (hardware independent).

This method depends on the Control Framework implementation to read/write data over control bus from/to the codec.

Parameters:
regData Pointer to the byte buffer with the data to be sent (size given in AFCodec::GetRegisterWidth()).
inData Pointer to the byte buffer for the received data.
inDataSize Received data buffer (inData) size in bytes.
Returns:
Number of bytes read (-1 on failure).

Definition at line 41 of file AFCPU.cpp.

virtual VOID AFCPU::StartInputDMA (  )  [pure virtual]

Starts the input DMA transfer (CPU <= codec).

Implemented in AFCPUHardware.

virtual VOID AFCPU::StartInputI2S (  )  [pure virtual]

Starts the input I2S transfer.

Implemented in AFCPUHardware.

virtual VOID AFCPU::StartOutputDMA (  )  [pure virtual]

Starts the output DMA transfer (CPU => codec).

Implemented in AFCPUHardware.

virtual VOID AFCPU::StartOutputI2S (  )  [pure virtual]

Starts the output I2S transfer.

Implemented in AFCPUHardware.

virtual VOID AFCPU::StopInputDMA (  )  [pure virtual]

Stops the input DMA transfer.

Implemented in AFCPUHardware.

virtual VOID AFCPU::StopInputI2S (  )  [pure virtual]

Stops the input I2S transfer.

Implemented in AFCPUHardware.

virtual VOID AFCPU::StopOutputDMA (  )  [pure virtual]

Stops the output DMA transfer.

Implemented in AFCPUHardware.

virtual VOID AFCPU::StopOutputI2S (  )  [pure virtual]

Stops the output I2S transfer.

Implemented in AFCPUHardware.

DWORD AFCPU::WriteCodecRegister ( UCHAR *  outData,
DWORD  outDataSize 
) [virtual]

Writes a codec register through control bus (hardware independent).

This method depends on the Control Framework implementation to write data over control bus to the codec.

Parameters:
outData Pointer to the byte buffer with the data to be sent.
outDataSize Output data buffer (outData) size in bytes.
Returns:
Number of bytes written (-1 on failure).

Definition at line 58 of file AFCPU.cpp.


Member Data Documentation

DWORD AFCPU::audioDMABufferSize [protected]

Definition at line 501 of file AFCPU.h.

DWORD AFCPU::audioDMAPageSize [protected]

Definition at line 500 of file AFCPU.h.

AFCore* AFCPU::core [protected]

Definition at line 488 of file AFCPU.h.

Definition at line 496 of file AFCPU.h.

HANDLE AFCPU::hControlBus [protected]

Definition at line 490 of file AFCPU.h.

Definition at line 495 of file AFCPU.h.

HANDLE AFCPU::inputDMAInterrupt [protected]

Definition at line 504 of file AFCPU.h.

HANDLE AFCPU::outputDMAInterrupt [protected]

Definition at line 503 of file AFCPU.h.

CFIo AFCPU::r2WireIO [protected]

Definition at line 492 of file AFCPU.h.

FLOAT AFCPU::sysClk [protected]

Definition at line 498 of file AFCPU.h.

CFIo AFCPU::w2WireIO [protected]

Definition at line 493 of file AFCPU.h.


The documentation for this class was generated from the following files:

Generated on Sun Sep 27 12:36:35 2009 for Audio Framework by  doxygen 1.6.1