📄 ac97platform.c
字号:
/******************************************************************************
**
** 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: Ac97Platform.c
**
** PURPOSE: Platform-specific functions Driver for of the AC'97 device.
**
** Valid for : Subset of AC '97 Rev 2.1
** UCB1400 codec
**
** $Modtime: 7/17/03 1:01p $
******************************************************************************/
#include "string.h"
#include "systypes.h"
#include "dm_errors.h"
#include "XsDmaApi.h"
#include "Ac97MixerRegsApi.h"
#include "XsAc97CtrlApi.h"
#include "Ac97Api.h"
#include "Ac97.h"
#include "Ac97Ucb1400.h"
// Note: possible flaw in Ac97HWSetup(). See "@@@" marker.
// Set up any device-specific defaults for the primary Codec.
void Ac97SwSetDefaultsPrimaryCodec (Ac97ContextT* ctxP)
{
// Using the UCB1400. Set up its special defaults in a context struct
Ac97SwSetDefaultsUcb1400 (ctxP);
} // Ac97SwSetDefaultsPrimaryCodec()
/**************** Specific codec support utilities ******************/
void Ac97SwSetDefaultsUcb1400 (Ac97ContextT* ctxP)
{
ctxP->codecDeviceNameStrP = NameUcb1400P;
//@@@ ctxP->ApiServicesP = ; TBD
ctxP->mixerRegsDfltValsUsageP = &Ac97MixerRegInitUsageTblUCB1400;
ctxP->mixerRegsSpecialMasksP = &Ac97MixerRegsSpecialMasks1400;
// UCB1400 only supports simple audio in and out
ctxP->fifoProcessingInfoRecords
[XS_AC97CTRL_FIFO_AUDIO_IN ].isSupported = TRUE;
ctxP->fifoProcessingInfoRecords
[XS_AC97CTRL_FIFO_AUDIO_OUT].isSupported = TRUE;
} // Ac97SwSetDefaultsUcb1400 ()
UINT32 Ac97HWSetup (Ac97ContextT* ctxP)
{
// Assume basic codec readiness, else we wouldn't get here.
// Verify codec subsystem readiness
// Initialize all writeable registers to recorded "current values"
// Verify expected codec ID info (Currently, just record it.)
// Set state variable flag fields.
// Return timeout error if subsystem readiness fails
UINT32 status;
UINT32 errLoc = 0;
INT i;
// Ac97HwReconfigAudio() verifies subsystem readiness, inits
// audio regs and sets flags
status = Ac97HwReconfigAudio (ctxP);
// Ac97HwReconfigModem() verifies subsystem readiness, inits
// modem regs and sets flags
if (status)
{
errLoc = 1;
}
else
{
status = Ac97HwReconfigModem (ctxP);
if (status)
{
errLoc = 2;
}
else
{
for (i = 0; i < XS_AC97CTRL_FIFO_NUM ; i++)
{
// @@@ This looks like a hack, or the assumption is incorrect.
// Need to determine whether this actually belongs in SW init, or should
// determine the state from the codec and then record the real information
// If we got here, the default sample rate was requested and
// set in hardware.
// Set for all; if not supported FIFO, no one will care.
ctxP->fifoProcessingInfoRecords [i]
.variableRateEnabled = TRUE;
ctxP->fifoProcessingInfoRecords[i].rateRequested =
AC97_DEFAULT_SAMPLE_RATE;
ctxP->fifoProcessingInfoRecords[i].rateAchieved =
AC97_DEFAULT_SAMPLE_RATE;
}
}
}
if (!status)
{
status = Ac97GetVendorIDandRev
(ctxP, &ctxP->vendorIdString[0], &ctxP->vendorRevNumber);
if (status)
{
errLoc = 3;
}
}
if (status)
{
LOGERROR (ctxP->loggedError, ERR_L_AC97,
ERR_S_AC97_HWSETUP, status, errLoc, 0, 0)
}
return (status);
} // Ac97HWSetup ()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -