📄 ac97.h
字号:
/******************************************************************************
**
** COPYRIGHT (C) 2001 Intel Corporation.
**
** This file and the software in it is furnished under
** license and may only be used or copied in accordance with the terms of the
** license. The information in this file is furnished for informational use
** only, is subject to change without notice, and should not be construed as
** a commitment by Intel Corporation. Intel Corporation assumes no
** responsibility or liability for any errors or inaccuracies that may appear
** in this document or any software that may be provided in association with
** this document.
** Except as permitted by such license, no part of this document may be
** reproduced, stored in a retrieval system, or transmitted in any form or by
** any means without the express written consent of Intel Corporation.
**
** FILENAME: Ac97.h
**
** PURPOSE: Module private constants, structure and variable
** declarations for the AC'97 codec device driver.
**
** Valid for : Subset of AC '97 Rev 2.1
**
** $Modtime: 7/17/03 1:01p $
******************************************************************************/
#ifndef _AC97_H
#define _AC97_H
#ifdef _DEFINING_AC97
#define EXTRN
#else
#define EXTRN extern
#endif
// Error sub-location codes for ERR_L_AC97_CODEC location code
#define ERR_S_AC97_HWSETUP 0x01 // Ac97HwSetup
#define ERR_S_AC97_HWRCNFG_AUD 0x02 // Ac97HwReconfigAudio
#define ERR_S_AC97_GET_MR_VENDOR_ID 0x03 // Ac97GetVendorIDandRev
#define ERR_S_AC97_PWR_ON_AUD_SUB 0x04 // Ac97PowerOnAudioSubsystems
#define ERR_S_AC97_GET_ANY_MIX_REG 0x05 // Ac97GetAnyMixerRegister
#define ERR_S_AC97_SET_ANY_MIX_REG 0x06 // Ac97SetAnyMixerRegister
#define ERR_S_AC97_SET_REC_SEL 0x07 // Ac97SetRecordSelect
#define ERR_S_AC97_READ_BUF 0x08 // Ac97ReadBuf
#define ERR_S_AC97_WRITE_BUF 0x09 // Ac97WriteBuf
#define ERR_S_AC97_OPEN_FIFO 0x0A // Ac97OpenFifo...()
#define ERR_S_AC97_CLOSE_FIFO 0x0B // Ac97CloseFifo
#define ERR_S_AC97_START_FIFO 0x0C // Ac97StartFifo
#define ERR_S_AC97_STOP_FIFO 0x0D // Ac97StopFifo
// Only valid rate if var rate not
// enabled: 48000 = 0xBB80
// Samples per second
#define AC97_DEFAULT_SAMPLE_RATE 48000
// How many milliseconds to wait from
// cold reset and basic codec ready
// before declaring a timeout on the
// audio subsystem readiness.
#define AC97_AUD_RDY_FROM_COLD_TOUT_MS 700
#define AC97_FIFO_START_TOUT_50US 100 // Loop counter
#define AC97_FIFO_DMA_LP_CHAIN_DESC_NUM 3
// Standard mixer register init table definition is deferred
// Ac97MixerRegUsageTableT Ac97MixerRegInitUsageTblUCB1400 =
// The special masks table is a way of handling codec-specific values
// for various mixer registers.
// The standard "special masks" table, which should actually have only
// the default values found in the standard, is deferred.
/*----------------------------------------------------------------------
* Function typedefs
*/
/*----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
AC '97 menu miscellaneous variables
-------------------------------------------------------------------------*/
/*
*******************************************************************************
Function prototypes for non-API functions
*******************************************************************************
*/
UINT32 Ac97GetUsualMute (Ac97ContextT*, AC97MixerRegisterIdT, BOOL*);
UINT32 Ac97SetUsualMute (Ac97ContextT*, AC97MixerRegisterIdT, BOOL);
void Ac97SwSetDefaultsPrimaryCodec (Ac97ContextT*);
void Ac97DefaultDmaInterruptHandler (PVOID, UINT32 );
void Ac97FifoInterruptHandler (PVOID, UINT32);
void Ac97WriteFifoStatus (Ac97FifoProcessingInfoT*, UINT32, INT);
UINT32 Ac97SetUpDmaDescriptors (Ac97FifoProcessingInfoT*);
UINT32 Ac97SetUpDmaLoopDescriptors (Ac97FifoProcessingInfoT*);
UINT32 Ac97WaitForDmaStart (Ac97FifoProcessingInfoT* );
UINT32 Ac97FreeDmaLoopDescriptors (Ac97FifoProcessingInfoT* );
#undef EXTRN
#endif // _AC97_H
#if 0
// Note: AC Link time slots supported by target controller:
//
// SDATA_OUT SDATA_IN
//
// 0 0
// 1 1
// 2 2
// 3 3
// 4 4
// 5 5
// - 6
// - -
// 12 12
//
// ??? does this make sense?
static
UINT32 Ac97ResetRegistersAll (Ac97ContextT*);
// Universal access: "back door"
static
UINT32 Ac97GetAnyMixerRegister (Ac97ContextT* ctxP, AC97MixerRegisterIdT targetReg, PUINT16 curRegValueP);
static
UINT32 Ac97SetAnyMixerRegister (Ac97ContextT* ctxP, AC97MixerRegisterIdT targetReg, UINT16 newValueP);
// 0x00
static
UINT32 Ac97ResetRegistersAudio (Ac97ContextT* ctxP);
static
UINT32 Ac97GetCapabilities (Ac97ContextT* ctxP, PUINT16 capabilitiesP);
#define AC97_MAX_CAPABILITIES
// !!!@@@
UINT32 Ac97DecodeCapabilities (UINT16 capabilitiesList, char * capabilityStrings[16]);
// 0x02, 0x04 and 0x06 control output signal volumes
// 0x02: LINE_OUT master volume
static
UINT32 Ac97GetMasterVol (Ac97ContextT* ctxP, PUINT8 volLevelLeftP, PUINT8 volLevelRightP, BOOL* muteEnableP);
static
UINT32 Ac97SetMasterVol (Ac97ContextT* ctxP, UINT8 volLevelLeft, UINT8 volLevelRight, BOOL muteEnable);
// 0x04: HP_OUT volume
// !!! Not in UCB1400
//static
//UINT32 Ac97GetHeadphoneVol (Ac97ContextT* ctxP, PUINT8 volLevelLeftP, PUINT8 volLevelRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetHeadphoneVol (Ac97ContextT* ctxP, UINT8 volLevelLeft, UINT8 volLevelRight, BOOL muteEnable);
// 0x06: MONO_OUT volume, now optional
// !!! Not in UCB1400
//static
//UINT32 Ac97GetMasterVolMono (Ac97ContextT* ctxP, PUINT8 volLevelP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetMasterVolMono (Ac97ContextT* ctxP, UINT8 volLevel, BOOL muteEnable);
// 0x08: Treble and Bass tone control, optional
// !!! Proprietary in UCB1400: in Reg 0x6A, but can cover here. UCB1400 sets
// loudness ID bit (ID5) in Reg 0x00, but they really should set
// the Bass & Treble control bit (ID2) - even if the implementation
// is nonstandard.
//
// Unit for setting and reporting is 0.5 dB gain. For setting, no limit to
// range, but will be adjusted to fit current codec - as long as feature
// is supported. If an adjustment is made, the direction is not guaranteed.
//
static
UINT32 Ac97GetMasterTone (Ac97ContextT* ctxP, PINT curBaseGainHalfDbP, PINT curTrebleGainHalfDbP);
static
UINT32 Ac97SetMasterTone (Ac97ContextT* ctxP, INT newBaseGainHalfDb, INT newTrebleGainHalfDb);
// 0x0A: PC BEEP does not use any TS
// !!! Not in UCB1400
//static
//UINT32 Ac97GetPcBeepVol (Ac97ContextT* ctxP, PUINT8 volLevelP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetPcBeepVol (Ac97ContextT* ctxP, UINT8 volLevel, BOOL muteEnable);
// 0x0C: Phone is also a candidate for use of SDATA_IN TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetPhoneVol (Ac97ContextT* ctxP, PUINT8 gainP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetPhoneVol (Ac97ContextT* ctxP, UINT8 gain, BOOL muteEnable);
// 0x0E: Mic is also a candidate for use of SDATA_IN TS 3,4
// !!! Only Boost Enable in UCB1400
static
UINT32 Ac97GetMicVol (Ac97ContextT* ctxP, PUINT8 gainP, BOOL* enableBoostP, BOOL* muteEnableP);
static
UINT32 Ac97SetMicVol (Ac97ContextT* ctxP, UINT8 gain, int enableBoost, BOOL muteEnable);
// 0x10: Line In is also a candidate for use of SDATA_IN TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetLineInVol (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetLineInVol (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x12: CD is also a candidate for use of SDATA_IN TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetCdVol (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetCdVol (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x14: Video is also a candidate for use of SDATA_IN TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetVideoVol (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetVideoVol (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x16: Aux is also a candidate for use of SDATA_IN TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetAuxVol (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetAuxVol (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x18: PCM OUT uses SDATA_OUT TS 3,4
// !!! Not in UCB1400
//static
//UINT32 Ac97GetPcmOutVol (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetPcmOutVol (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x1A
static
UINT32 Ac97GetRecordSelect (Ac97ContextT* ctxP, PUINT8 srcLeftP, PUINT8 srcRightP);
static
UINT32 Ac97SetRecordSelect (Ac97ContextT* ctxP, UINT8 srcLeft, UINT8 srcRight);
// 0x1C: For the stereo input
static
UINT32 Ac97GetRecordGain (Ac97ContextT* ctxP, PUINT8 gainLeftP, PUINT8 gainRightP, BOOL* muteEnableP);
static
UINT32 Ac97SetRecordGain (Ac97ContextT* ctxP, UINT8 gainLeft, UINT8 gainRight, BOOL muteEnable);
// 0x1E: For optional special purpose correlated audio mic channel.
// !!! Not in UCB1400
//static
//UINT32 Ac97GetRecordGainMic (Ac97ContextT* ctxP, PUINT8 gainP, BOOL* muteEnableP);
//static
//UINT32 Ac97SetRecordGainMic (Ac97ContextT* ctxP, UINT8 gain, BOOL muteEnable);
// 0x20: The General Purpose register has a set of mode enable and signal path switches
// UCB1400 only has loopback enable: special mask value for it
// Only special purpose functions for GPR access?
static
UINT32 Ac97SetHWLoopAdcToDac (Ac97ContextT* ctxP, BOOL enableLoop);
// 0x22: Control 3D enhancement center and/or depth, optional
// !!! Not in UCB1400
//static
//UINT32 Ac97Get3DControl (Ac97ContextT* ctxP, PUINT8 centerP, PUINT8 depthP);
//static
//UINT32 Ac97Set3DControl (Ac97ContextT* ctxP, UINT8 center, UINT8 depth);
// 0x24: Reserved
--------==================-------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -