📄 aticonfg.cpp
字号:
//==========================================================================;
//
// ATIConfg.CPP
// WDM MiniDrivers development.
// ATIHwConfiguration class implementation.
// Copyright (c) 1996 - 1997 ATI Technologies Inc. All Rights Reserved.
//
// $Date: 10 Jun 1999 09:54:42 $
// $Revision: 1.21 $
// $Author: KLEBANOV $
//
//==========================================================================;
extern"C"
{
#include "conio.h"
#include "strmini.h"
#include "wdmdebug.h"
#include "ksmedia.h" //Paul
}
#include "aticonfg.h"
#include "wdmdrv.h"
#include "atigpio.h"
#include "mmconfig.h"
/*^^*
* CATIHwConfiguration()
* Purpose : CATIHwConfiguration Class constructor
* Determines I2CExpander address and all possible hardware IDs and addresses
*
* Inputs : PDEVICE_OBJECT pDeviceObject : pointer to the creator DeviceObject
* CI2CScript * pCScript : pointer to the I2CScript class object
* PUINT puiError : pointer to return Error code
*
* Outputs : none
* Author : IKLEBANOV
*^^*/
CATIHwConfiguration::CATIHwConfiguration( PPORT_CONFIGURATION_INFORMATION pConfigInfo, CI2CScript * pCScript, PUINT puiError)
{
ENSURE
{
m_VideoInStandardsSupported = 0;
m_CrystalIDInMMTable = 0xF; // invalid entry, needs to be set when set with the value from MMTable
m_gpioProviderInterface.gpioOpen = NULL;
m_gpioProviderInterface.gpioAccess = NULL;
m_pdoDriver = NULL;
m_usE2PROMValidation = ( USHORT)-1;
if( InitializeAttachGPIOProvider( &m_gpioProviderInterface, pConfigInfo->PhysicalDeviceObject))
// there was no error to get GPIOInterface from the MiniVDD
m_pdoDriver = pConfigInfo->RealPhysicalDeviceObject;
else
{
* puiError = WDMMINI_ERROR_NOGPIOPROVIDER;
FAIL;
}
if( !FindI2CExpanderAddress( pCScript))
{
* puiError = WDMMINI_NOHARDWARE;
FAIL;
}
if( !FindHardwareProperties( pConfigInfo->RealPhysicalDeviceObject, pCScript))
{
* puiError = WDMMINI_NOHARDWARE;
FAIL;
}
* puiError = WDMMINI_NOERROR;
OutputDebugTrace(( "CATIHwConfig:CATIHwConfiguration() exit\n"));
} END_ENSURE;
if( * puiError != WDMMINI_NOERROR)
OutputDebugError(( "CATIHwConfig:CATIHwConfiguration() uiError=%x\n", * puiError));
}
/*^^*
* FindHardwareProperties()
* Purpose : Determines hardware properties : I2C address and the type
*
* Inputs : PDEVICEOBJECT pDeviceObject: pointer to device object
* CI2CScript * pCScript : pointer to the I2CScript object
*
* Outputs : BOOL, TRUE if a valid ATI hardware Configuration was found
* Author : IKLEBANOV
*^^*/
BOOL CATIHwConfiguration::FindHardwareProperties( PDEVICE_OBJECT pDeviceObject, CI2CScript * pCScript)
{
UCHAR uchI2CValue;
UCHAR uchORMask = 0x00;
UCHAR uchANDMask = 0xFF;
BOOL bResult = TRUE;
I2CPacket i2cPacket;
m_VideoInStandardsSupported = 0; //Paul
m_uchTunerAddress = 0;
m_usTunerId = 0;
m_usTunerPowerConfiguration = ATI_TUNER_POWER_CONFIG_0;
m_uchDecoderAddress = 0;
m_usDecoderId = VIDEODECODER_TYPE_NOTINSTALLED;
m_usDecoderConfiguration = 0;
m_uchAudioAddress = 0;
m_uiAudioConfiguration = 0;
switch( m_uchI2CExpanderAddress)
{
case 0x70: // a standard external tuner board
m_uchTunerAddress = 0xC0;
m_uchDecoderAddress = 0x88;
// we need to determine actual Decoder ID, implement later
m_usDecoderId = VIDEODECODER_TYPE_BT829;
if( GetI2CExpanderConfiguration( pCScript, &uchI2CValue))
{
m_usTunerId = uchI2CValue & 0x0F;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_1;
if( uchI2CValue & 0x10)
{
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_4;
m_uchAudioAddress = 0x82;
}
else
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_3;
}
m_VideoInStandardsSupported = SetVidStdBasedOnI2CExpander( uchI2CValue ); //Paul
break;
case 0x78: // FM tuner
m_uchTunerAddress = 0xC0;
m_uchDecoderAddress = 0x88;
// we need to determine actual Decoder ID, implement later
m_usDecoderId = VIDEODECODER_TYPE_BT829;
if( GetI2CExpanderConfiguration( pCScript, &uchI2CValue))
{
m_usTunerId = uchI2CValue & 0x0F;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_1;
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_5;
}
m_VideoInStandardsSupported = SetVidStdBasedOnI2CExpander( uchI2CValue ); //Paul
break;
case 0x76: // AllInWonder, configuration is in the BIOS
{
CATIMultimediaTable CMultimediaInfo( pDeviceObject, &m_gpioProviderInterface, &bResult);
if( bResult)
{
// tuner and decoder Info is included
m_uchTunerAddress = 0xC6;
m_uchDecoderAddress = 0x8A;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_1;
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_1;
if( !CMultimediaInfo.GetTVTunerId( &m_usTunerId) ||
!CMultimediaInfo.GetVideoDecoderId( &m_usDecoderId))
bResult = FALSE;
else
m_VideoInStandardsSupported = SetVidStdBasedOnMMTable( &CMultimediaInfo ); //Paul
}
break;
}
case 0x7C:
ENSURE
{
i2cPacket.uchChipAddress = m_uchI2CExpanderAddress;
i2cPacket.cbReadCount = 1;
i2cPacket.cbWriteCount = 0;
i2cPacket.puchReadBuffer = &uchI2CValue;
i2cPacket.puchWriteBuffer = NULL;
i2cPacket.usFlags = 0;
pCScript->ExecuteI2CPacket( &i2cPacket);
if( i2cPacket.uchI2CResult != I2C_STATUS_NOERROR)
{
bResult = FALSE;
FAIL;
}
uchI2CValue |= 0x0F;
i2cPacket.uchChipAddress = m_uchI2CExpanderAddress;
i2cPacket.cbReadCount = 0;
i2cPacket.cbWriteCount = 1;
i2cPacket.puchReadBuffer = NULL;
i2cPacket.puchWriteBuffer = &uchI2CValue;
i2cPacket.usFlags = 0;
pCScript->ExecuteI2CPacket( &i2cPacket);
if (i2cPacket.uchI2CResult != I2C_STATUS_NOERROR)
{
bResult = FALSE;
FAIL;
}
// information should be correct now
if( GetI2CExpanderConfiguration( pCScript, &uchI2CValue))
{
m_usTunerId = uchI2CValue & 0x0F;
}
m_VideoInStandardsSupported = SetVidStdBasedOnI2CExpander( uchI2CValue ); //Paul
} END_ENSURE;
if (!bResult)
break;
// For IO Expander address == 0x7c there might be more information in the BIOS Table sto do not return
// or break at this point
case 0xFF: // AllInWonder PRO, configuration is in the BIOS
ENSURE
{
CATIMultimediaTable CMultimediaInfo( pDeviceObject, &m_gpioProviderInterface, &bResult);
USHORT nOEMId, nOEMRevision, nATIProductType;
BOOL bATIProduct;
if( !bResult)
FAIL;
// OEM Id information is included
if( !CMultimediaInfo.IsATIProduct( &bATIProduct))
{
bResult = FALSE;
FAIL;
}
m_uchDecoderAddress = 0x8A;
m_uchTunerAddress = 0xC6;
if( bATIProduct)
{
if( !CMultimediaInfo.GetATIProductId( &nATIProductType))
{
bResult = FALSE;
FAIL;
}
if( CMultimediaInfo.GetTVTunerId( &m_usTunerId) &&
CMultimediaInfo.GetVideoDecoderId( &m_usDecoderId))
{
switch( nATIProductType)
{
case ATI_PRODUCT_TYPE_AIW_PRO_NODVD:
case ATI_PRODUCT_TYPE_AIW_PRO_DVD:
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_2;
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_2;
m_usTunerPowerConfiguration = ATI_TUNER_POWER_CONFIG_1;
m_uchAudioAddress = 0xB4;
break;
case ATI_PRODUCT_TYPE_AIW_PLUS:
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_6;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_2;
m_uchAudioAddress = 0xB6;
break;
case ATI_PRODUCT_TYPE_AIW_PRO_R128_KITCHENER:
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_7;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_2;
m_uchAudioAddress = 0xB4;
break;
case ATI_PRODUCT_TYPE_AIW_PRO_R128_TORONTO:
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_8;
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_UNDEFINED;
m_uchAudioAddress = 0x80;
break;
default:
bResult = FALSE;
break;
}
}
else
bResult = FALSE;
}
else
{
// non ATI Product
if( !CMultimediaInfo.GetOEMId( &nOEMId) ||
!CMultimediaInfo.GetOEMRevisionId( &nOEMRevision))
{
bResult = FALSE;
FAIL;
}
m_uchDecoderAddress = 0x8A;
m_uchTunerAddress = 0xC6;
switch( nOEMId)
{
case OEM_ID_INTEL:
switch( nOEMRevision)
{
case INTEL_ANCHORAGE:
if( CMultimediaInfo.GetVideoDecoderId( &m_usDecoderId) &&
CMultimediaInfo.GetTVTunerId( &m_usTunerId))
{
m_uiAudioConfiguration = ATI_AUDIO_CONFIG_1;
switch( m_usDecoderId)
{
case VIDEODECODER_TYPE_BT829:
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_3;
break;
case VIDEODECODER_TYPE_BT829A:
m_usDecoderConfiguration = ATI_VIDEODECODER_CONFIG_2;
break;
default:
bResult = FALSE;
break;
}
}
else
bResult = FALSE;
break;
default:
bResult = FALSE;
break;
}
break;
case OEM_ID_APRICOT:
switch( nOEMRevision)
{
case REVISION1:
case REVISION2:
if( CMultimediaInfo.GetTVTunerId( &m_usTunerId))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -