📄 wmchipdef.h
字号:
WM_REGVAL alcControlVal;
WM_REGTYPE alcNoiseGateReg;
WM_REGVAL alcNoiseGateVal;
} WM_MIC_CONTROL_DETAILS;
/*
* Stream to channel mappings
*/
typedef struct tagWM_STREAM_MAPPING
{
WM_STREAM_ID stream;
WMAUDIO_CHANNEL channel;
} WM_STREAM_MAPPING;
/*
* GPIO details
*/
typedef struct tagWM_GPIO_DETAILS
{
WM_GPIO_PIN gpioPin;
WM_GPIO_PIN gpioAltFunc;
WM_GPIO_PIN gpioVirtualFunc;
WM_USHORT gpioDirection;
}WM_GPIO_DETAILS;
/*
* Interface details.
*/
typedef struct tagWM_SAMPLE_RATE_PAIR
{
WM_SAMPLE_RATE dacRate;
WM_SAMPLE_RATE adcRate;
} WM_SAMPLE_RATE_PAIR;
typedef struct tagWM_INTERFACE_DETAILS
{
WM_AUDIO_INTERFACE audioIF;
const WM_SAMPLE_RATE_PAIR *pSupportedRates;
unsigned int nSupportedRates;
unsigned int flags;
} WM_INTERFACE_DETAILS;
/*
* Interface description flags.
*/
#define WM_IF_EXCLUSIVE_RATES 0x1 /* The rate pairs listed are the only valid ones */
#define WM_IF_RECORD 0x2 /* Supported for record */
#define WM_IF_PLAYBACK 0x4 /* Supported for playback */
#define WM_IF_DUPLEX (WM_IF_RECORD | WM_IF_PLAYBACK)
/*
* Functions which vary depending on the device - virtual functions
* in C++ terminology.
*
*/
typedef WMSTATUS (*InitPowerFn) ( WM_DEVICE_HANDLE hDevice,
WM_DRIVER_ID driverId );
typedef WMSTATUS (*SetPowerFn) ( WM_DEVICE_HANDLE hDevice,
WM_DRIVER_ID driverId,
WM_POWERFLAG powerSections );
typedef WM_POWERFLAG (*GetPowerFn) ( WM_DEVICE_HANDLE hDevice );
typedef WMSTATUS (*SetSampleRateFn) ( WM_DEVICE_HANDLE hDevice,
WM_STREAM_ID stream,
WM_SAMPLE_RATE sampleRate );
typedef WMSTATUS (*GetSampleRateFn) ( WM_DEVICE_HANDLE hDevice,
WM_STREAM_ID stream,
WM_SAMPLE_RATE *pSampleRate );
typedef WMSTATUS (*SetLineInRecPathsFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL lineInL,
WM_AUDIO_SIGNAL lineInR );
typedef WMSTATUS (*ClearLineInRecPathsFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL lineInL,
WM_AUDIO_SIGNAL lineInR );
typedef WMSTATUS (*SetMicRecPathsFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL micSignalL,
WM_AUDIO_SIGNAL micSignalR );
typedef WMSTATUS (*ClearMicRecPathsFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_SIGNAL micSignalL,
WM_AUDIO_SIGNAL micSignalR );
typedef WMSTATUS (*VoiceEnableFn) ( WM_DEVICE_HANDLE hDevice );
typedef WMSTATUS (*ReadCTCAuxADCFn) ( WM_DEVICE_HANDLE hDevice,
WM_REGVAL *pValue );
typedef WMSTATUS (*StreamFn) ( WM_DEVICE_HANDLE hDevice,
WM_STREAM_ID stream
);
typedef WMSTATUS (*ConfigureInterfaceFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_INTERFACE audioIF,
WM_BOOL isMaster,
WM_AUDIOIF_FORMAT format,
WM_AUDIOIF_WIDTH width,
WM_AUDIOIF_FLAGS flags
);
typedef WMSTATUS (*UnconfigureInterfaceFn) ( WM_DEVICE_HANDLE hDevice,
WM_AUDIO_INTERFACE audioIF
);
/*
* And a structure to hold them:
*
* fnPowerInit - initialise the device in a low power state.
* fnPowerUp - powers up the device sections.
* fnPowerDown - powers down the device sections.
* fnGetPower - returns the current power settings.
*
* fnConfigureInterface - sets up the interface for the given stream
* Not applicable to AC'97.
* fnUnconfigureInterface - clears down the interface for the given stream
* Not applicable to AC'97.
* fnEnableStream - sets things up so the given stream will work.
* fnDisableStream - cleans up the given stream.
* fnSetSampleRate - sets the sample rate for the given stream.
* fnGetSampleRate - interrogates the codec for the sample rate for
* the given stream if cached values not available.
* fnSetLineInRecPaths - sets up the Line In record paths.
* fnClearLineInRecPaths - clears down the Line In record paths.
* fnSetMicRecPaths - sets up the Mic record paths.
* fnClearMicRecPaths - clears down the Mic record paths.
* fnVoiceEnable - enable the Voice DAC.
*
* fnReadCTCAuxADC - reads the next AuxADC value in continuous mode.
*/
typedef struct tagchipVTable
{
/* Power Functions */
InitPowerFn fnPowerInit;
SetPowerFn fnPowerUp;
SetPowerFn fnPowerDown;
GetPowerFn fnGetPower;
#if WM_AUDIO
ConfigureInterfaceFn fnConfigureInterface;
UnconfigureInterfaceFn fnUnconfigureInterface;
StreamFn fnEnableStream;
StreamFn fnDisableStream;
SetSampleRateFn fnSetSampleRate;
GetSampleRateFn fnGetSampleRate;
SetLineInRecPathsFn fnSetLineInRecPaths;
ClearLineInRecPathsFn fnClearLineInRecPaths;
SetMicRecPathsFn fnSetMicRecPaths;
ClearMicRecPathsFn fnClearMicRecPaths;
# if WM_VOICE
VoiceEnableFn fnVoiceEnable;
# endif /* WM_VOICE */
#endif /* WM_AUDIO */
#if WM_AUXADC && WM_STREAM_AUXADC
ReadCTCAuxADCFn fnReadCTCAuxADC;
#endif /* WM_AUXADC && WM_STREAM_AUXADC */
} chipVTable;
/*
* And now the whole chip:
*
* deviceType - the ID of the device - e.g. 0x4C12 for WM9712.
* maxRegister - the highest-numbered register on the device.
* regOffset - the step between successive registers - e.g. 2 for AC'97.
* deviceName - descriptive text identifying the device.
* defaultPower - default power state after a reset.
*
* pShadowedRegisters - list of shadow registers.
* nShadowedRegisters - number of shadowed registers.
* resetReg - the ID of the reset register.
*
* regAddrShift - the ammount the register address is shifted for I2S
* regAddrMask - mask for the shifted register address.
* regDataMask - mask for the [remaining] data portion.
*
* pAuxADCDetails - structure describing the AUX ADC inputs available.
* adcCount - number of entries in the structure.
*
* pInterfaces - structures describing each interface (e.g. HiFi, Voice)
* nInterfaces - number of supported interfaces
*
* pRecSourceSignals - structure describing the signals which are record sources.
* recSouceSignalCount - number of record source signals.
* recSourceDetails - information about the record source register layout.
* pSignalDetails - information about the signals.
* signalCount - number of entries in the structure.
* pMicControlDetails - mic control information.
* micControlCount - number of entries in the structure.
*
* pStreamMappings - how the public streams map to internal streams.
* streamCount - number of entries in the structure.
*
* defADCRate - default ADC rate after reset.
* defHiFiDACRate - default HiFi DAC rate after reset.
* defVoiceDACRate - default Voice DAC rate after reset.
* defMonoDACRate - default Mono DAC rate after reset.
*
* pGPIODetails - information about GPIOs on this device.
* gpioCount - number of entries in the structure.
*
* vtable - virtual function table (see above).
*/
typedef struct tagWM_CHIPDEF
{
/* Indentifying information */
WM_CHIPTYPE deviceType;
int maxRegister;
unsigned short regOffset;
unsigned short pad0;
const char *deviceName;
WM_POWERFLAG defaultPower;
/* Registers */
#if WM_USE_SHADOW_REGISTERS
const WM_SHADOW_REGISTERS *pShadowedRegisters;
unsigned int nShadowedRegisters;
#endif /* WM_USE_SHADOW_REGISTERS */
WM_REGTYPE resetReg;
#if WM_I2S
unsigned short regAddrShift;
unsigned short regAddrMask;
unsigned short regDataMask;
#else
unsigned short pad1;
#endif /* WM_I2S */
/* Profiles */
const WM_PROFILE *profiles;
unsigned int nProfiles;
#if WM_AUXADC
/* Auxiliary ADCs */
const WM_AUXADC_DETAILS *pAuxADCDetails;
unsigned int adcCount;
#endif /* WM_AUXADC */
#if WM_AUDIO
/* Interfaces */
const WM_INTERFACE_DETAILS *pInterfaces;
unsigned int nInterfaces;
/* Signals */
const WM_RECSOURCE_SIGNALS *pRecSourceSignals;
unsigned int recSourceSignalCount;
WM_RECSOURCE_DETAILS recSourceDetails;
const WM_SIGNAL_DETAILS *pSignalDetails;
unsigned int signalCount;
const WM_MIC_CONTROL_DETAILS *pMicControlDetails;
unsigned int micControlCount;
/* Audio streams */
const WM_STREAM_MAPPING *pStreamMappings;
unsigned int streamCount;
/* Default sample rates */
WM_SAMPLE_RATE defADCRate;
WM_SAMPLE_RATE defHiFiDACRate;
WM_SAMPLE_RATE defVoiceDACRate;
WM_SAMPLE_RATE defMonoDACRate;
#endif /* WM_AUDIO */
/* GPIOs */
const WM_GPIO_DETAILS *pGPIODetails;
unsigned int gpioCount;
/* The device-specific functions */
chipVTable vtable;
} WM_CHIPDEF;
/*
* A macro for internal code to get a device name from a handle.
*/
#define WM_DEVICE_NAME( _hDevice ) WMGetChipDef( _hDevice )->deviceName
/*
* Global data.
*/
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* Function: WMGetChipDef
*
* Returns a pointer to the chipdef for the given device, or NULL if not
* supported.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: const WM_CHIPDEF *
* A pointer to the chipdef for the given device, or NULL if not
* supported.
*---------------------------------------------------------------------------*/
const WM_CHIPDEF *WMGetChipDef( WM_DEVICE_HANDLE hDevice );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WMCHIPDEF_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -