⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crtcrpro.c

📁 此代码为WCE5.0下显示器的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*****************************************************************************\
*
*  Module Name    CRTCRPRO.C
*  ASIC           3D RAGE PRO/LT PRO WindowsNT
*
*  Description    Bios independant code for setting the mode and palette
*
*  (c) 1998 ATI Technologies Inc. (unpublished)
*
*  All rights reserved.  This notice is intended as a precaution against
*  inadvertent publication and does not imply publication or any waiver
*  of confidentiality.  The year included in the foregoing notice is the
*  year of creation of the work.
*
*  LOG OF CHANGES :
*
*  1.0  05/04/98    [SAH]    Initial revision
*
*
*
\*****************************************************************************/

#include "dal.h"
#include "crtcrpro.h"
#include "rprod.h"
#include "rprombw.h"

// Allow swapping.
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(PAGE_COM, RageProDisable)
#pragma alloc_text(PAGE_COM, RageProEnable)
#pragma alloc_text(PAGE_COM, RageProEnumerateStandardModes)
#pragma alloc_text(PAGE_COM, RageProGetGammaCorrection)
#pragma alloc_text(PAGE_COM, RageProGetTextCursorBlinkingAdjustment)
#pragma alloc_text(PAGE_COM, RageProGetOverlayGammaAdjustment)
#pragma alloc_text(PAGE_COM, RageProIsNonStandardModeSupported)
#pragma alloc_text(PAGE_COM, RageProPreModeChange)
#pragma alloc_text(PAGE_COM, RageProPostModeChange)
#pragma alloc_text(PAGE_COM, RageProSetGammaCorrection)
#pragma alloc_text(PAGE_COM, RageProSetMode)
#pragma alloc_text(PAGE_COM, RageProSetPalette)
#pragma alloc_text(PAGE_COM, RageProSetTextCursorBlinkingAdjustment)
#pragma alloc_text(PAGE_COM, RageProSetOverlayGammaAdjustment)
#pragma alloc_text(PAGE_COM, RageProAcceleratorToVgaMode)
#pragma alloc_text(PAGE_COM, GcoPLLWriteByte)
#pragma alloc_text(PAGE_COM, GcoPLLReadByte)
#pragma alloc_text(PAGE_COM, GcoPLLGetDividers)
#pragma alloc_text(PAGE_COM, GcoGetPixelDepthBits)
#pragma alloc_text(PAGE_COM, Minimum)
#pragma alloc_text(PAGE_COM, Maximum)
#pragma alloc_text(PAGE_COM, MinBitsRequired)
#pragma alloc_text(PAGE_COM, GetPostDivider)
#pragma alloc_text(PAGE_COM, GetPostDividerBitValue)
#pragma alloc_text(PAGE_COM, ProgramDspFIFO)
#pragma alloc_text(PAGE_COM, ProgramExtPLL)
#pragma alloc_text(PAGE_COM, ExtVxPLLWriteUpdate)
#pragma alloc_text(PAGE_COM, ExtVxPLLReadUpdateComplete)
#pragma alloc_text(PAGE_COM, ProgramRegPLL)
#pragma alloc_text(PAGE_COM, LoadCrtOnlyModeTableInfo)
#pragma alloc_text(PAGE_COM, TranslateLcdCenter2BiosCrtcTimings)
#pragma alloc_text(PAGE_COM, LcdExpBiosCrtcTimings)
#pragma alloc_text(PAGE_COM, TranslateTvoBiosCrtcTimings)
#pragma alloc_text(PAGE_COM, LoadLcdGeneralModeTableTimings)
#pragma alloc_text(PAGE_COM, LoadTvoGeneralModeTableTimings)
#pragma alloc_text(PAGE_COM, ProgramDacRegisters)
#pragma alloc_text(PAGE_COM, VClockValue)
#pragma alloc_text(PAGE_COM, XClockValueX1024)
#pragma alloc_text(PAGE_COM, GetPrimaryActualFifoSizeUsed)
#pragma alloc_text(PAGE_COM, DisplayFifoOnPoint)
#pragma alloc_text(PAGE_COM, GetPanelInformationTable)
#pragma alloc_text(PAGE_COM, TranslateLcdRefreshRate)
#pragma alloc_text(PAGE_COM, GetDefualtLcdRefreshRate)
#pragma alloc_text(PAGE_COM, RageProSetAdjustmentTimings)
#pragma alloc_text(PAGE_COM, RageProGetMultimediaTable)
#pragma alloc_text(PAGE_COM, RageProGetHardwareInfoTable)
#pragma alloc_text(PAGE_COM, InitializeBiosInfoStructure)
#pragma alloc_text(PAGE_COM, GetActualPixWidth)
#pragma alloc_text(PAGE_COM, ValidatePixelClock)
#pragma alloc_text(PAGE_COM, MM32_ReadUlong)
#pragma alloc_text(PAGE_COM, MM32_WriteUlong)
#pragma alloc_text(PAGE_COM, RageMobilityEnableOverlay)
#pragma alloc_text(PAGE_COM, RageProSetDFPSize)
#pragma alloc_text(PAGE_COM, LoadDFPModeTableInfo)
#pragma alloc_text(PAGE_COM, RageProGetCrtcLine)
#pragma alloc_text(PAGE_COM, RageProUpdateBIOSDisplayInfo)
#pragma alloc_text(PAGE_COM, vGetLCDGCORegFlag)
#pragma alloc_text(PAGE_COM, RageProGetCRC)
#pragma alloc_text(PAGE_COM, RageProGetHardwareData)

#endif  // ALLOC_PRAGMA


//
// DESCRIPTION:
//  RageProDisable is used by DAL to notify the graphics controller
//  object that the display is no longer needed.
//
// PARAMETERS:
//  hGCO    Handle of the controller object structure, which uniquely
//          identifies the graphics controller object.
//
// RETURN VALUE:
//  None
//
VOID FAR RageProDisable(HGCO hGCO)
{
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProDisable: *** entry point ***"));


    // Clear ASIC ID information.
    lpHwCrtc->HwAsicId.ulChipFamily = 0;
    lpHwCrtc->HwAsicId.lpIO = NULL;
    lpHwCrtc->HwAsicId.lpMMR = NULL;
    lpHwCrtc->HwAsicId.ulReferenceFrequency = 0;

    lpHwCrtc->CurrentModeInfo[0].ulModeFlags = 0;
    lpHwCrtc->CurrentModeInfo[0].ulPelsWidth = 0;
    lpHwCrtc->CurrentModeInfo[0].ulPelsHeight = 0;
    lpHwCrtc->CurrentModeInfo[0].ulBitsPerPixel = 0;
    lpHwCrtc->CurrentModeInfo[0].ulDisplayFrequency = 0;

    lpHwCrtc->CurrentModeInfo[1].ulModeFlags = 0;
    lpHwCrtc->CurrentModeInfo[1].ulPelsWidth = 0;
    lpHwCrtc->CurrentModeInfo[1].ulPelsHeight = 0;
    lpHwCrtc->CurrentModeInfo[1].ulBitsPerPixel = 0;
    lpHwCrtc->CurrentModeInfo[1].ulDisplayFrequency = 0;

    lpHwCrtc->ucDspPrecision[0] = 0;
    lpHwCrtc->ucDspPrecision[1] = 0;

    lpHwCrtc->ulHorRefreshRate[0] = 0;
    lpHwCrtc->ulHorRefreshRate[1] = 0;

    lpHwCrtc->ulDspConfig[0] = 0;
    lpHwCrtc->ulDspConfig[1] = 0;

    lpHwCrtc->ulDspOnOff[0] = 0;
    lpHwCrtc->ulDspOnOff[1] = 0;

    lpHwCrtc->ulCurrentDeviceMap[0] =0;
    lpHwCrtc->ulCurrentDeviceMap[1] =0;

    lpHwCrtc->hDDL = NULL;
    lpHwCrtc->ucHFBOn = 0;
    lpHwCrtc->ucUseBiosPanelInfo = 0;

    // May need to store HW_DEVICE_EXTENSION in the hco if required for function calls
    // to the device dependant layer.
    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProDisable: *** exit ***"));
}   // RageProDisable()


//
// DESCRIPTION:
//  RageProEnable determines if the graphics adapter is supported, and if
//  the graphics adapter抯 hardware has support for a controller
//  supported by the object. GCOEnable is the initial entry point
//  exported by the graphics controller object.  It fills a
//  HW_CONTROLLER_ENABLEDATA structure with information, and calling
//  addresses of functions supported by the graphics controller object.
//
// PARAMETERS:
//  hDDL            Points to the hardware device extension structure.
//                  This parameter is not used by the graphics controller
//                  object, but is provided as a handle uniquely identifying
//                  the graphics adapter for the device dependant layer.
//
//  hGCO            Handle of the controller object structure, which uniquely
//                  identifies the graphics controller object.
//
//  lpHwAsicID      Points to a hardware ASIC identifier structure which
//                  describes the graphics adapter. The graphics controller
//                  object uses the ASIC identifier to determine if it can
//                  support the graphics adapter hardware.  If the graphics
//                  controller object supports the graphics adapter hardware,
//                  the controller object uses DDLXxx functions to detect if
//                  a supported controller exists.
//
//  lpEnableData    Points to a structure to be filled with the capabilities
//                  and functions supported by the graphics controller object.
//
// RETURN VALUE:
//  The return value is TRUE if a controller is supported on this
//  graphics adapter, by the graphics controller object.  Otherwise
//  it is FALSE.
//
BOOL FAR RageProEnable(HDDL hDDL, HGCO hGCO, LPHW_ASIC_ID lpHwAsicID, LPHW_CONTROLLER_ENABLEDATA lpEnableData)
{
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;
    ULONG ulTemp;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProEnable: *** entry point ***"));

    DALASSERT(HW_CONTROLLER_EXTENSION_SIZE >= sizeof(HW_RAGEPROCRTC_EXTENSION),
              "Size of CRTC structure is too large!");

    if (lpEnableData->ulSize != sizeof(HW_CONTROLLER_ENABLEDATA))
    {
        DALASSERT(FALSE, "Hardware Enable Data structure mismatch w/ DAL!");
        return FALSE;
    }

    // Determine if the ASIC ID is supported by this controller object.
    if (FAMILY_VTB      != lpHwAsicID->ulChipFamily &&    // ATI-264VT3 family
        FAMILY_VTB_PLUS != lpHwAsicID->ulChipFamily &&    // ATI-264VT3 UMC family
        FAMILY_VTB_VT4  != lpHwAsicID->ulChipFamily &&    // ATI-264VT4 family
        FAMILY_GTB      != lpHwAsicID->ulChipFamily &&    // 3D RAGE II family
        FAMILY_LTG      != lpHwAsicID->ulChipFamily &&    // 3D RAGE LT-G family
        FAMILY_GTB_PLUS != lpHwAsicID->ulChipFamily &&    // 3D RAGE II+ family
        FAMILY_GTB_IIC  != lpHwAsicID->ulChipFamily &&    // 3D RAGE IIC family
        FAMILY_GTC      != lpHwAsicID->ulChipFamily &&    // 3D RAGE PRO family
        FAMILY_LT_PRO   != lpHwAsicID->ulChipFamily &&    // 3D RAGE LT PRO family

        FAMILY_RAGE_MOBILITY  != lpHwAsicID->ulChipFamily &&    // 3D RAGE MOBILITY family
        FAMILY_RAGE_XL        != lpHwAsicID->ulChipFamily &&    // 3D RAGE XL
        FAMILY_RAGE_XC        != lpHwAsicID->ulChipFamily )     // 3D RAGE XC
    {
        DALDEBUG((DALDBG_NORMAL, "ATIRAGE RageProEnable: ASIC ID not supported"));
        DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProEnable: *** exit ***"));
        return FALSE;
    }


    if (HW_CONTROLLER_EXTENSION_SIZE < sizeof(HW_RAGEPROCRTC_EXTENSION))
      return FALSE;

    // Zero initialize in case DAL does not pass the buffer already zero initialized.
    ZEROMEMORY((LPVOID) lpHwCrtc, sizeof(HW_RAGEPROCRTC_EXTENSION));

    // Save the ASIC ID information for future use in the GCO.
    lpHwCrtc->HwAsicId = *lpHwAsicID;
    lpHwCrtc->hDDL     = hDDL;

    // Fill in the ENABLEDATA for the RagePro controller.
    //
    lpHwCrtc->lpLibVersionString                     = (LPVOID)R3GCOLIB;
    lpEnableData->ulControllerVersion                = R3LIB_VERSION;

//    lpEnableData->ulControllerVersion                = CV_RAGEPRO_1;
    lpEnableData->ulNumberOfControllers              = 1;
    //lpEnableData->bEnabledAtBoot[0]                  = TRUE;
    lpEnableData->aControllerCaps[0]                 = 0;
    lpEnableData->ulFunctionHooks                    = GCO_HOOK_GAMMA_CORRECTION |
                                                       GCO_HOOK_GET_CONTROLLER_TIMINGS |
                                                       GCO_HOOK_GETEXPANSIONSETTING |
                                                       GCO_HOOK_GETMODETIMING;

    lpEnableData->pfnDisable                         = RageProDisable;
    lpEnableData->pfnEnable                          = RageProEnable;
    lpEnableData->pfnEnumerateStandardModes          = RageProEnumerateStandardModes;
    lpEnableData->pfnGetGammaCorrection              = RageProGetGammaCorrection;
    lpEnableData->pfnGetTextCursorBlinkingAdjustment = NULL;
    lpEnableData->pfnGetOverlayGammaAdjustment       = NULL;
    lpEnableData->pfnGetMultimediaTable              = NULL;
    lpEnableData->pfnGetHardwareInfoTable            = NULL;
    lpEnableData->pfnGetInfo                         = RageProGetInfo;
    lpEnableData->pfnIsNonStandardModeSupported      = RageProIsNonStandardModeSupported;
    lpEnableData->pfnSetAdjustmentTimings            = RageProSetAdjustmentTimings;
    lpEnableData->pfnPreModeChange                   = RageProPreModeChange;
    lpEnableData->pfnPostModeChange                  = RageProPostModeChange;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -