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

📄 lcdddc.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    LTDDC.H
*  Project        LT Rage Pro/ Rage Mobility/ Rage XC/ Rage XL
*
*  Description    Header file containing defines and prototype definitions
*                 for LTDDC.C.
*
*  (c) 1997 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.
*
*
\*****************************************************************************/


#ifndef _DDC_H_
#define _DDC_H_

#ifndef BOOLEAN
    typedef UCHAR BOOLEAN;
#endif  // BOOLEAN

#if TRUE  //(_WIN32_WINNT < 0x500)

//
// Define constants used by DDC2 I2C queries.
//

#define DDC2_I2C_MONITOR_ADDRESS_WRITE0 0xA0
#define DDC2_I2C_MONITOR_ADDRESS_WRITE2 0xA2
#define DDC2_I2C_MONITOR_ADDRESS_WRITE6 0xA6
#define DDC2_I2C_MONITOR_ADDRESS_READ   0xA1
#define DDC2_I2C_EDID_START_ADDRESS     0x00
#define DDC2_I2C_START_RETRIES          10          // Number of retries for I2C packet
#define DDC2_I2C_SCL_READ_RETRIES       10          // 10 * 5us
#define DDC2_I2C_DELAY()                DELAY_MICROSECONDS(5)

//
// Define structure passed as a context to DDC query callback function.
//

typedef struct _DDC2_QUERY_CONTEXT
{
    HGDO    hGDO;               // Points to graphics display structure
    HDDL    hDDL;               // Points to device extension
    LPUCHAR lpucQueryBuffer;    // Points to buffer where EDID is to be written
    ULONG   ulLength;           // Size if query buffer in bytes
} DDC2_QUERY_CONTEXT, FAR* LPDDC2_QUERY_CONTEXT;

#endif  // _WIN32_WINNT < 0x500

//
// Define EDID's fields sizes and offsets.
//

#define EDID_SIZE                       128
#define EDID_OFFSET_ESTABLISHED_1       35
#define EDID_OFFSET_ESTABLISHED_2       36
#define EDID_OFFSET_ESTABLISHED_3       37
#define EDID_OFFSET_STANDARD_FIRST      38
#define EDID_OFFSET_STANDARD_LAST       52
#define EDID_OFFSET_DETAILED_FIRST      54
#define EDID_OFFSET_DETAILED_LAST       108
//#define EDID_SIZE_STANDARD              sizeof (EDID_STANDARD_TIMING)
#define EDID_SIZE_DETAILED              sizeof (EDID_DETAILED_TIMING)

//
// Define bits used in EDID established timings.
//

#define EDID_ESTABLISHED_640_60         0x20
#define EDID_ESTABLISHED_640_72         0x08
#define EDID_ESTABLISHED_640_75         0x04
#define EDID_ESTABLISHED_800_56         0x02
#define EDID_ESTABLISHED_800_60         0x01
#define EDID_ESTABLISHED_800_72         0x80
#define EDID_ESTABLISHED_800_75         0x40
#define EDID_ESTABLISHED_1024_87I       0x10
#define EDID_ESTABLISHED_1024_60        0x08
#define EDID_ESTABLISHED_1024_70        0x04
#define EDID_ESTABLISHED_1024_75        0x02
#define EDID_ESTABLISHED_1280_75        0x01
#define EDID_ESTABLISHED_1152_75        0x80

//
// Define masks and values used in EDID standard timings.
//

#define EDID_STANDARD_ASPECT_MASK       0xC0
#define EDID_STANDARD_ASPECT_1_X_1      0x00
#define EDID_STANDARD_ASPECT_4_X_3      0x40
#define EDID_STANDARD_ASPECT_5_X_4      0x80
#define EDID_STANDARD_ASPECT_16_X_9     0xC0
#define EDID_STANDARD_REFRESH_MASK      0x3F

//
// Define values used in EDID unused standard timing fields.
//

#define EDID_STANDARD_UNUSED_1          0x00
#define EDID_STANDARD_UNUSED_2          0x01

//
// Define masks and values used in EDID detailed timings.
//

#define EDID_DETAILED_INTERLACED        0x80

#pragma pack(1)

//
// Define EDID standard timing structure.
//

/*typedef struct _EDID_STANDARD_TIMING
{
    UCHAR ucHorizontalActive;                       // (Horizontal Active pixels / 8) - 1
    UCHAR ucAspectAndRefreshRate;                   // Bits 6-7 = aspect ratio, bits 0-5 = refresh rate - 60
} EDID_STANDARD_TIMING, *PEDID_STANDARD_TIMING;
*/
//
// Define EDID detailed timing structure.
//

typedef struct _EDIT_DETAILED_TIMING
{
    USHORT usPixelClock;                            // Pixel clock in units of 10 kHz
    UCHAR ucHorizontalActiveLowByte;                // Low byte of Horizontal Active
    UCHAR ucHorizontalBlankLowByte;                 // Low byte of Horizontal Blank (total - active)
    UCHAR ucHorizontalHighNybbles;                  // High nybbles of above 2 values
    UCHAR ucVerticalActiveLowByte;                  // Low byte of Vertical Active
    UCHAR ucVerticalBlankLowByte;                   // Low byte of Vertical Blank (total - active)
    UCHAR ucVerticalHighNybbles;                    // High nybbles of above 2 values
    UCHAR ucHorizontalSyncOffsetLowByte;            // Low byte of horizontal sync offset
    UCHAR ucHorizontalSyncWidthLowByte;             // Low byte of horizontal sync width
    UCHAR ucVerticalSyncOffsetAndWidthLowNybbles;   // Low nybbles of above 2 values
    UCHAR ucSyncHighBits;                           // High bits of sync values
    UCHAR ucHorizontalSizeLowByte;                  // Low byte of horizontal size in mm
    UCHAR ucVerticalSizeLowByte;                    // Low byte of vertical size in mm
    UCHAR ucSizeHighNybbles;                        // High nybbles of above 2 values
    UCHAR ucHorizontalBorder;                       // Size of horizontal overscan
    UCHAR ucVerticalBorder;                         // Size of vertical overscan
    UCHAR ucFlags;                                  // Interlace and sync polarities
} EDID_DETAILED_TIMING, FAR* LPEDID_DETAILED_TIMING;

#pragma pack()

//
// Define macros to stall execution for given number of milli or micro seconds.
// Single call to VideoPortStallExecution() can be done for 100us max.
//

#if 0

#define DELAY_MILLISECONDS(n)                           \
{                                                       \
    ULONG ulCount;                                      \
    ULONG ulTotal = 10 * (n);                           \
                                                        \
    for (ulCount = 0; ulCount < ulTotal; ulCount++)     \
        STALLEXECUTION(100);                            \
}

#define DELAY_MICROSECONDS(n)                           \
{                                                       \
    ULONG ulCount = (n);                                \
                                                        \
    while (ulCount > 0)                                 \
    {                                                   \
        if (ulCount >= 100)                             \
        {                                               \
            STALLEXECUTION(100);                        \
            ulCount -= 100;                             \
        }                                               \
        else                                            \
        {                                               \
            STALLEXECUTION(ulCount);                    \
            ulCount = 0;                                \
        }                                               \
    }                                                   \
}

#endif

#define DELAY_MILLISECONDS(n)  STALLEXECUTION_MS(n);
#define DELAY_MICROSECONDS(n)  STALLEXECUTION(n);


//
// Macros used to detect a v-blank in progress.
//
//



// Prototypes for functions supplied by R128DDC.C.
//

BOOLEAN
LCDDDC2Query(
    HGDO hGDO,
    HDDL hDDL,
    LPUCHAR lpucQueryBuffer,
    ULONG ulBufferSize
    );

#if TRUE  //(_WIN32_WINNT < 0x500)

BOOLEAN
LCDDDC2QueryCallback(
    LPDDC2_QUERY_CONTEXT lpDdcQueryContext
    );

BOOLEAN
LCDDETQuery(
    HGDO hGDO,
    HDDL hDDL,
    LPUCHAR lpucQueryBuffer
    );

BOOLEAN
LCDDETQueryCallback(
    LPDDC2_QUERY_CONTEXT lpDdcQueryContext
    );

BOOLEAN
LCDDDC2_I2CStart(
    HGDO hGDO,
    HDDL hDDL
    );

BOOLEAN
LCDDDC2_I2CStop(
    HGDO hGDO,
    HDDL hDDL
    );

BOOLEAN
LCDDDC2_I2CWrite(
    HGDO hGDO,
    HDDL hDDL,
    UCHAR ucEdidWriteByte
    );

BOOLEAN
LCDDDC2_I2CWriteByte(
    HGDO hGDO,
    HDDL hDDL,
    UCHAR ucByte
    );

BOOLEAN
LCDDDC2_I2CRead(
    HGDO hGDO,
    HDDL hDDL,
    LPUCHAR lpucBuffer,
    ULONG ulLength,
    UCHAR ucEdidWriteByte
    );

UCHAR
LCDDDC2_I2CReadByte(
    HGDO hGDO,
    HDDL hDDL,
    LPUCHAR lpucByte,
    BOOLEAN bMore
    );

BOOLEAN
LCDDDC2_I2CWaitForClockLineHigh(
    HGDO hGDO,
    HDDL hDDL
    );

#endif  // _WIN32_WINNT < 0x500

VOID
LCDDDC2_I2CWriteClockLine(
    HGDO hGDO,
    HDDL hDDL,
    UCHAR ucData
    );

VOID
LCDDDC2_I2CWriteDataLine(
    HGDO hGDO,
    HDDL hDDL,
    UCHAR ucData
    );

BOOLEAN
LCDDDC2_I2CReadClockLine(
    HGDO hGDO,
    HDDL hDDL
    );

BOOLEAN
LCDDDC2_I2CReadDataLine(
    HGDO hGDO,
    HDDL hDDL
    );

VOID
LCDWaitForVerticalBlank(
    HGDO hGDO,
    HDDL hDDL
    );

VOID
LCD_DDC2_Select_SOFTWARE_I2C(
    HGDO hGDO
    );

VOID
LCD_DDC2_Restore_SOFTWARE_I2C(
    HGDO hGDO
    );
#endif  // _DDC_H_

⌨️ 快捷键说明

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