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

📄 crtcrpro.h

📁 此代码为WCE5.0下显示器的源代码
💻 H
字号:
//
// 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    CRTCPRO.H
*  ASIC           3D RAGE PRO/LT PRO WindowsNT
*
*  Description    Header files for the Crtcpro.c
*
*  (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
*
*
*
\*****************************************************************************/

#ifndef _CRTCRPRO_H_
#define _CRTCRPRO_H_

#include "rprocrtc.h"
#include "r3com.h"
#include "r3libver.h"

//#define BIOS_INFO_TABLE_OFFSET          0x0078
//#define BIOS_INFO_TABLE_SIGNATURE       0x54504C24 // for '$LPT'

#define TV_COP_MODE_OFFSET                  138
#define EDID_FEILD_OFFSET                   26
#define MOBILE_BIOS_FEATURES_FEILD_OFFSET   26
#define XL_EDID_FIELD_OFFSET                26
#define MOBILE_BIOS_FEATURES_FIELD_OFFSET   26
#define MOBILE_BIOS_SPREAD_SPECTRUM_OFFSET  28
#define CENTER_SPREAD                   0
#define DOWN_SPREAD                     1

#define R3GCOLIB                            "[ATI LIB=R3GCO.LIB," R3_LIB_VERSION "]"

#define BPP_16_555                      15
#define BPP_16_565                      16 

#define MAX_PLL_OUTPUT_FREQUENCY        23000 // LT-Pro spec. in 10KHz
#define MIN_PLL_OUTPUT_FREQUENCY        45    // LT-Pro spec. in 10KHz
#define PIXEL_CLOCK_TOLLERANCE          2000  // 20% * 100 for integer division precision
                                         
#define BIOS_LCD_ON                     0x00000001
#define BIOS_CRT_ON                     0x00000002
#define BIOS_TVO_ON                     0x00000004

#define NOT_STANDARD_MODE               1
#define STANDARD_MODE                   2
#define GAME_MODE                       3
#define NOT_SUPPORTED_MODE              4

#define CRT_INTERLACE_MODE              0x0200

#define MULTI_MEDIA_ATTRB_TABLE_SIZE    8
#define HARDWARE_INFO_TABLE_SIZE        10

#define RAGE_PRO_LCD_REGISTER_SET       0x00000001
#define RAGE_PRO_CRT_REGISTER_SET       0x00000002
#define RAGE_PRO_TVO_REGISTER_SET       0x00000004
#define RAGE_PRO_CRTC2_REGISTER_SET     0x00000008
#define RAGE_LTPRO_REGISTER_SET         0x00000010
#define RAGE_PRO_EXTERNAL_TVO           0x00000020
#define EXT_MOBILITY_REGISTER_SET       0x00000040
#define MOBILE_ENHANCED_ONE_CONTROLLER  0x00000080
#define MOBILE_ENHANCED_ONE_CONTROLLER_32bit  0x00000100

#define ENABLE_SPREAD_SPECTRUM_FEATURE  0x00000001

#define MEMORY_INTERFACE_64BIT          0x00000001
#define MEMORY_INTERFACE_32BIT          0x00000002

#define RAGEMOBILITY_MAX_ECP_CLOCK      11000 // in 10 KHz
#define LTPRO_MAX_ECP_CLOCK             10000 // in 10 KHz

#define LT_PRO_LCD_INDEX_MASK           0xFFFFFFF0
#define MOBILITY_XL_XC_LCD_INDEX_MASK   0xFFFFFFC0

#define PM_DYN_CLK_CNTL_YCLKSETDIVBY2            0x23
#define PM_DYN_CLK_CNTL_YCLKSETDIVBY2_MASK       0x77
#define PM_DYN_CLK_CNTL_YCLKSETDIVBY2_NOTMASK    0x88

#define XCLK_DIV1                       1
#define XCLK_DIV2                       2

#define RAGEPRO_CRTC_CAPS_BANDWIDTH_FIX     0x00000001
#define RAGEPRO_CRTC_CAPS_SDRAM_21          0x00000002
#define RAGEPRO_CRTC_CAPS_FIFOOFF_MINUS3    0x00000004

#define szRPROREGOPTIONLMGCO_SPECTRUMCONST    "RPRORegOptionLmGcoSpectrumConst"
#define szRPROREGOPTIONLMGCO_SPECTRUMCONST32  "RPRORegOptionLmGcoSpectrumConst32"
#define szRPROREGGCOOPTION                    "RPRORegGcoOption"

// Define macro to detect v-blank in progress.
#define IS_VERTICAL_BLANK(p) \
    (((MMREADULONG(p, CRTC_INT_CNTL) & CRTC_INT_CNTL_VBlank) == CRTC_INT_CNTL_VBlank) ? TRUE : FALSE)

#define IS_VERTICAL_BLANK2(p) \
    (((MMREADULONG(p, CRTC_INT_CNTL) & CRTC_INT_CNTL_VBlank2) == CRTC_INT_CNTL_VBlank2) ? TRUE : FALSE)

// Structures for functions supplied by CRTCRPRO.C.

#pragma pack(1)                         // BIOS data must use byte aligment

#define CRTC_TIMING_FLAGS_PANEL_MODE    0x1000 // If this bit is set in flags field then it means
                                               // resolution is panel specific e.g 1400x1050 etc.

typedef struct _BIOS_CRTC_TIMING        // Structures used for setting and querying CRTC timings.
{
    USHORT usReserved1;                 // Reserved
    USHORT usModeSelect;                // Resolution to use
    USHORT usFlags;                     // Flags to indicate various conditions
    USHORT usHorizontalTotalDisplay;    // Horizontal total and displayed values
    USHORT usHorizontalSyncStartWidth;  // Horizontal sync start and width
    USHORT usVerticalTotal;             // Vertical total
    USHORT usVerticalDisplay;           // Vertical displayed
    USHORT usVerticalSyncStart;         // Vertical sync start
    USHORT usVerticalSyncWidth;         // Vertical sync width
    USHORT usPixelClock;                // Pixel clock frequency to use
    USHORT usHorizontalOverscan;        // Horizontal overscan information
    USHORT usVerticalOverscan;          // Vertical overscan information
    USHORT usOverscan8B;                // 8bpp and blue overscan color
    USHORT usOverscanGR;                // Green and red overscan color
    USHORT usReserved2;                 // Reserved
} BIOS_CRTC_TIMING, *PBIOS_CRTC_TIMING;

typedef struct _BIOS_INFO_TABLE
{
    UCHAR   ucInfoTableSignature[4];
    UCHAR   ucInfoTableRevision;
    UCHAR   ucOffsetToBiosInfoTableSize;
    USHORT  usOffsetToCrtParameterTable;
    USHORT  usOffsetToCrtParameterTableSize;
    USHORT  usOffsetToLcdParameterTable;
    USHORT  usOffsetToTvParameterTable;
    USHORT  usRefDivider;
    USHORT  usMinFreq;
    USHORT  usMaxFreq;
    USHORT  usRefFreq;
    USHORT  usOffsetToHardwareInfoTable;
    USHORT  usOffsetToMultiMediaTable;
}BIOS_INFO_TABLE, FAR *LPBIOS_INFO_TABLE;

#pragma pack()

#pragma pack(1)

typedef struct _MODE_DATA
{
    BIOS_CRTC_TIMING BiosCrtcTiming;    // Timing data for BIOS set mode from table
    DEVMODE_INFO     DevModeInfo;       // Display mode information for a given mode
} MODE_DATA, FAR *LPMODE_DATA;

typedef struct _CAP_DATA                // Define CAP_DATA -- stores adapter specific
{                                       // max dot clock values for given resolution and pixel depth.
    ULONG ulHorizontalResolution;
    ULONG ulVerticalResolution;
    ULONG ulPixelDepth;
    ULONG ulMaxPixelClock;
} CAP_DATA, FAR *LPCAP_DATA;

typedef struct _GCO_PANEL_INFO
{
    USHORT  usHorizontalSize;		    // in pixels
    USHORT  usVerticalSize;		      // in lines
    USHORT  usFlatPanelType;
    UCHAR   ucPanelRefreshRateData;
    USHORT  usSupportedRefreshRate;
    //USHORT  ausModeTableOffset[MAX_NO_RESOLUTION_TIMING];

} GCO_PANEL_INFO, FAR* LPGCO_PANEL_INFO;

#define GCOREGOPTION_DISABLE_DYNAMIC_PM_SUPPORT       0x00000001L
#define GCOREGOPTION_DISABLE_CRTC2                    0x00000002L
#define GCOREGOPTION_SETGAMMACORRECTION_WAIT_VBLANK   0x00000004L // EPR45508
#define GCOREGOPTION_HSYNCSTART_ADJUSTMENT            0x00000008L

typedef struct _HW_RAGEPROCRTC_EXTENSION
{
    HW_ASIC_ID          HwAsicId;

    ULONG               ulBiosInfoTableSiganture;

    ULONG               ulLCDIndexRegisterMask; // For LT-Pro this is 0xFFFFFFF0
                                                // For Rage Mobility, XL and XC this 0xFFFFFFC0
                                                // as more index register are added

    ULONG               ulGCOSupportedRegSet;

    ULONG               ulBiosSupportedFeatures;  // This will have bit wise Bios supported 
                                                  // feature list.

    ULONG               ulRegGCOOption;       // Registry based registry option

    ULONG               ulMemoryInterface;    // 64 bit or 32 bit (For LT-Pro it is always 64 bit)

    DEVMODE_INFO        CurrentModeInfo[2];   // for LT pro we need two elements two save the info on per
                                              // per controller basis
    ULONG               ulCurrentDeviceMap[2];

    UCHAR               ucDspPrecision[2];

    ULONG               ulDspOnOff[2];

    ULONG               ulDspConfig[2];

    ULONG               ulHorRefreshRate[2];
    
    ULONG               ulDriverOptions;

    UCHAR               ucHFBOn;

    UCHAR               ucUseExtPLL4Primary;

    UCHAR               ucSpreadSpectrumEn;

    UCHAR               ucUseBiosPanelInfo; // This flag will be used to indicate whether
                                            // we use panel info table from bios or VESA drived
                                            // timing for XL.
                                            // we use panel info table from bios or VESA deived
                                            // timings.

    UCHAR               ucSpreadSpectrumType; // 0: center, 1: down spread
    UCHAR               ucSpreadSpectrumPercent;
    UCHAR               ucSpectrumConst;
    UCHAR               ucSpectrumConst32;
    LPVOID              lpLibVersionString;
 
    HDDL                hDDL;    

    BIOS_INFO_TABLE     BiosInfoTable;

    GCO_PANEL_INFO      LCDPanelInfo;

    LVDS_PANEL_INFO     sLVDSPanelInfo;

    DEVCLUT             aPalette[256];

    ULONG               ulCurrentBpp;
    LPMODE_DATA         lpCurrentMode;
    ULONG               ulRageProCrtcCaps;

} HW_RAGEPROCRTC_EXTENSION, FAR *LPHW_RAGEPROCRTC_EXTENSION;

#pragma pack()

extern MODE_DATA          Gco_ex_aModeData[];
extern MODE_DATA          Gco_ex_aHdtvModeData[];
extern MODE_DATA          Gco_ex_aGameModeData[];
extern TVO_MODE_TABLE     Gco_ntsc_aTvoModeTable[];
extern TVO_MODE_TABLE     Gco_pal_aTvoModeTable[];
extern DYNAMIC_PMMODE_TABLE  Gco_DynamicPmModeTable[];
extern CAP_DATA           Gco_ex_aCapData[];
extern CAP_DATA           Gco_ex_aCapDataPlus[];
extern CAP_DATA           Gco_ex_aCapDataPro[];

ULONG MM32_ReadUlong  (LPVOID lp, ULONG r);
VOID  MM32_WriteUlong (LPVOID lp, ULONG r, ULONG v);

BOOL bGetExpansionSetting(HGCO hGCO,
                          ULONG  ulController, 
                          ULONG  ulGetExpansionSetting);
VOID vInitializeBiosInfoStructureGTC(HGCO hGCO);

BOOL bGetPanelInformationTable(HGCO hGCO);

BOOL bIsBIOSSupportsPanelSpecificMode(HGCO hGCO, LPDEVMODE_INFO lpMI);

BOOL bDynamicPMModeSupported(HGCO              hGCO,
                             ULONG             ulController,
                             LPDEVMODE_INFO    lpMI);

VOID vProgramDynamicPMMode(HGCO              hGCO,
                           ULONG             ulController,
                           ULONG             ulDisplayType,
                           LPDEVMODE_INFO    lpMI);


#endif  // _CRTCRPRO_H_

⌨️ 快捷键说明

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