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

📄 ltlcd.c

📁 此代码为WCE5.0下显示器的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            while((MMREADULONG(hGDORageLCD->lpMMR, LCD_INDEX)) & 0x800);
            GDOPLLWriteByte(hGDO, ucAddress, ucData, 0x8F);

            // Set up the delay as per Alex Miller
            DELAY_MILLISECONDS(1);

            if(hGDORageLCD->LcdGdoPanelInfo.usOffDelay)
            {
              DELAY_MILLISECONDS(hGDORageLCD->LcdGdoPanelInfo.usOffDelay);
            }
            else
            {
              DELAY_MILLISECONDS(RPROLCDGDO_DEFAULT_LCD_ON_OFF_DELAY);
            }
          }
          else
          {
            // set LCD_ON bit to 0 which turns off the LCD display.
            ulLCDGenCtrlData &= (~LCD_GEN_CTRL__LCD_ON);

            // Write out LCD GEN CTRL data to LCD data register.
            MMWRITEULONG(hGDORageLCD->lpMMR, LCD_DATA, ulLCDGenCtrlData);

            // We need this delay here for certain panels.
            if(hGDORageLCD->LcdGdoPanelInfo.usOffDelay)
            {
              DELAY_MILLISECONDS(hGDORageLCD->LcdGdoPanelInfo.usOffDelay);
            }
            else
            {
              DELAY_MILLISECONDS(RPROLCDGDO_DEFAULT_LCD_ON_OFF_DELAY);
            }
          }
        }

        break;
    }// end switch

} // end LCDSetDPMS

/******************************Public*Routine******************************\
* BOOL LCDIsDisplayPhysicallyConnected(HGDO hGDO)
*
*
* LCDIsDisplayPhysicallyConnected determines if the LCD display is
* physically connected to the graphics adapter hardware.
*
*
* DAL will call GDOIsDisplayPhysicallyConnected to test if the user has
* connected a LCD display. This call can occur when the display is active
* and should not produce any visual artifacts on the display. If a
* graphics display object cannot determine if the display is connected,
* or if it cannot determine if the display is connected, without
* producing visual display artifacts, this function should always return
* TRUE.
*
* This routine checks chip type to decide what method will be used to handle
* LCD detection.
*
\**************************************************************************/
BOOL FAR
LCDIsDisplayPhysicallyConnected(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCDIsDisplayPhysicallyConnected - Entry"));

    switch(hGDORageLCD->ulChipFamily)
    {
    case(FAMILY_LT_PRO):
        return LCDBIOSDetection(hGDO);

    case(FAMILY_RAGE_MOBILITY):
        return LCDBIOSDetection(hGDO);
//      return (LCDBIOSDetection(hGDO) & LCDAutoDetection(hGDO));

    case(FAMILY_RAGE_XL):
        return LCDAutoDetection(hGDO);

    default:
        return FALSE;
    }// end switch

} //End LCDIsDisplayPhysicallyConnected


/******************************Public*Routine******************************\
* BOOL LCDBIOSDetection(HGDO hGDO)
*
* This routine checks if bit 1 of SCRATCH_REG2 is set or not.
* If LCD bit (bit 0) is set means LCD panel is connected, otherwise
* no LCD panel is connected.
*
\**************************************************************************/
BOOL FAR
LCDBIOSDetection(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;
    ULONG            ulLCDScratch_data;
    VIDEO_X86_BIOS_ARGUMENTS  biosArguments;

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD detection through BIOS - Entry"));

    ZEROMEMORY(&biosArguments, sizeof(VIDEO_X86_BIOS_ARGUMENTS));

    // Call video BIOS to have latest lid info from system BIOS. 
    biosArguments.Eax = 0xA08F;         // Get system BIOS Info
    biosArguments.Ebx = 0x0700;         // Sub function 07 - Get Lid State
    // If this function is supported in system BIOS, VBIOS will update the 
    // lid state scratch register. 
    DDLBiosInt10(hGDORageLCD->hDDL, (PVIDEO_X86_BIOS_ARGUMENTS)&biosArguments);
    
    ulLCDScratch_data = MMREADULONG(hGDORageLCD->lpMMR, SCRATCH_REG2);


    // If LCD bit (bit 0) in SCRATCH_REG2 is set and LCD lid closed (bit 11) is not
    // set then it means LCD is connected.
    if ((ulLCDScratch_data & SCRATCH_REG2__LCD_CONNECTED_MASK) && !(ulLCDScratch_data & SCRATCH_REG2__LCD_LID_CLOSED_MASK))
    {
        DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is physically connected (BIOS)"));
        return (TRUE);
    }
    else
    {
        DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is not physically connected (BIOS)"));
        return (FALSE);
    }

} //End LCDBIOSDetection

/******************************Public*Routine******************************\
* BOOL LCDAutoDetection(HGDO hGDO)
*
\**************************************************************************/
BOOL FAR
LCDAutoDetection(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;
    //ULONG            ulLCDIndexData;
    UCHAR            aucEdidDataBuffer[80];   // EPR 35356

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD detection through hardware - Entry"));

    //
    //  For Rage XL, we assume panel is attached if bRageXLUseInfoTable
    //  is set to TRUE
    //
    if(hGDORageLCD->ulChipFamily == FAMILY_RAGE_XL)
    {
      if(hGDORageLCD->bRageXLUseInfoTable == TRUE)
      {
        return TRUE;
      }
    }

    // Fix EPR 34587, EPR 35356 .
    // Read partial EDID, and then check display type to find out if DFP Panel is attached.
    //
    if (!LCDDETQuery(hGDO, hGDORageLCD->hDDL, (LPUCHAR)aucEdidDataBuffer))
    {
        DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is not physically connected (hardware)"));
        return FALSE;
    }

    if( LCDEDIDCHECKDISPLAYTYPE(hGDO, hGDORageLCD->hDDL, (LPUCHAR)aucEdidDataBuffer)
        == HW_DISPLAY_TYPE_DFP)
        return TRUE;
    else
        return FALSE;

} //End LCDAutoDetection

/******************************Public*Routine******************************\
* BOOL LCDEDIDCHECKDISPLAYTYPE( HGDO hGDO, HDDL hDDL, LPUCHAR lpucQueryBuffer)
*
* This routine checks EDID to find out display type.
*       EDID 1.X - check byte 14h.
*       EDID 2.0 - check byte 4Fh.
*
\**************************************************************************/
ULONG FAR
LCDEDIDCHECKDISPLAYTYPE(
    HGDO hGDO,
    HDDL hDDL,
    LPUCHAR lpucQueryBuffer
    )
{
    UCHAR       ucDisplayType;

    // Check edid version.
    if (lpucQueryBuffer[0] == 0x00 &&
        lpucQueryBuffer[1] == 0xff &&
        lpucQueryBuffer[2] == 0xff &&
        lpucQueryBuffer[3] == 0xff &&
        lpucQueryBuffer[4] == 0xff &&
        lpucQueryBuffer[5] == 0xff &&
        lpucQueryBuffer[6] == 0xff &&
        lpucQueryBuffer[7] == 0x00)
    {
        // EDID 1.X, find out display type form byte 14h.
        ucDisplayType = lpucQueryBuffer[20];
        ucDisplayType >>= 7;

        // Bit 7, Analog = 0, Digital =1;
        if (ucDisplayType )
            return HW_DISPLAY_TYPE_DFP;
        else
            return HW_DISPLAY_TYPE_CRT;

    }
    else if (lpucQueryBuffer[0] == 0x20 )
    {
        // EDID 2.0, find out display type form byte 4Fh.
        ucDisplayType = lpucQueryBuffer[79];

        ucDisplayType >>= 4;

        // Bit 7-4, CRT = 0, LCD =1;
        if (ucDisplayType )
            return HW_DISPLAY_TYPE_DFP;
        else
            return HW_DISPLAY_TYPE_CRT;
    }
    else
    {
        // EDID data not valid.

        DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD  LCDEDIDCHECKDISPLAYTYPE returned FALSE"));
        return 0; //HW_DISPLAY_UNKNOWN;   // Task #6236 EPR #043881 Incorporate DAL Lib 56+ series  
    }
}

/******************************Public*Routine******************************\
* BOOL LCDIsDeviceHotPluggable(HGDO hGDO)
*
*
* LCDIsDeviceHotPluggable determines if the connected LCD display is
* hot pluggable by checking the MONDET signal.
*
*
* DAL will call GDOIsDeviceHotPluggable to test if the connected LCD
* is hot pluggable. This call should be use only when the LCD is connected.
*
* This routine checks chip type to decide what method will be used.
* Currently, we only do detection for family Rage XL chips.
*
\**************************************************************************/
BOOL FAR
LCDIsDeviceHotPluggable(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCDIsDeviceHotPluggable - Entry"));

    switch(hGDORageLCD->ulChipFamily)
    {
    case(FAMILY_RAGE_XL):
        return LCDHotPlugDetection(hGDO);

    case(FAMILY_LT_PRO):
    case(FAMILY_RAGE_MOBILITY):
    default:
        return FALSE;
    }// end switch

} //End LCDIsDeviceHotPluggable


/******************************Public*Routine******************************\
* BOOL LCDHotPlugDetection(HGDO hGDO)
*
* This routine use to determine which LCD is hot pluggable.
*
\**************************************************************************/
BOOL FAR
LCDHotPlugDetection(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;
    ULONG            ulLCDIndexData;
    UCHAR            aucEdidDataBuffer[80];     // EPR 35356

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD hot plug detection through hardware - Entry"));

    // Check MONDET_SENSE bit to find out if LCD Panel is attached.
    ulLCDIndexData = MMREADULONG(hGDORageLCD->lpMMR, LCD_INDEX);

    if (ulLCDIndexData & LCD_INDEX__MONDET_SENSE)
    {
        // Fix EPR 34587, EPR 35356.
        // Read partial EDID, and then check display type to find out if DFP Panel is attached.
        //
        if (!LCDDETQuery(hGDO, hGDORageLCD->hDDL, (LPUCHAR)aucEdidDataBuffer))
        {
            DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is not pluggable"));
            return FALSE;
        }

        if( LCDEDIDCHECKDISPLAYTYPE(hGDO, hGDORageLCD->hDDL, (LPUCHAR)aucEdidDataBuffer)
            == HW_DISPLAY_TYPE_DFP)
        {
            DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is hot pluggable"));
            return TRUE;
        }
        else
        {
            DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD is not hot pluggable"));
            return FALSE;
        }
    }
    else
        return FALSE;

} //End LCDHotPlugDetection

/******************************Public*Routine******************************\
* VOID LCDDetectionInit(HGDO hGDO)
*
* This routine set MONDET_EN bit to enable MONDET feature and reset
* MONDET_INT_EN bit to prevent interrupt generated from MONDET.
*
\**************************************************************************/
VOID FAR
LCDDetectionInit(
    HGDO hGDO
    )
{
    LPGDO_RAGE_LCD   hGDORageLCD;
    ULONG            ulLCDIndexData;

    hGDORageLCD = (LPGDO_RAGE_LCD)hGDO;

    DALDEBUG((DALDBG_NORMAL, "ATIRAGE.SYS! GDO-LCD: LCD detection initialization - Entry"));

   

⌨️ 快捷键说明

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