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

📄 dalgdo.c

📁 此代码为WCE5.0下显示器的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            }
            
          }
          break;

        case GDO_HOOK_DOT_CRAWL_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetDotCrawlAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_FILTER_SVIDEO_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetFilterSVideoAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_FILTER_COMP_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetFilterCompAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_GAMMA_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetGammaAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_LUMA_FLICKER_REMOVAL_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetLumaFlickerAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_VIDEO_STANDARD_ADJUSTMENT:
          ulReturn = (*lpDisplay->lpHWED->pfnSetVideoStandardAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_VIDEO_SIGNAL_STANDARD_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetVideoSignalStandardAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_OVERSCAN_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetOverscanAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_MULTIMEDIAPASSTHRU_ADJUSTMENT:
          (*lpDisplay->lpHWED->pfnSetMultimediaPassThruAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_HORIZONTAL_SYNC:

          // This is one of the per mode adjustments so flag it as
          // dirty so that it is saved in the registry on a per mode
          // basis. This will be restored when the user sets this 
          // mode again
          lpDisplay->ulFlags |= GDO_SAVEPERMODEADJUSTMENTS;

          (*lpDisplay->lpHWED->pfnSetSyncHorizontalAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_VERTICAL_SYNC:

          // This is one of the per mode adjustments so flag it as
          // dirty so that it is saved in the registry on a per mode
          // basis. This will be restored when the user sets this 
          // mode again 
          lpDisplay->ulFlags |= GDO_SAVEPERMODEADJUSTMENTS;

          (*lpDisplay->lpHWED->pfnSetSyncVerticalAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_COMPOSITE_SYNC:
          (*lpDisplay->lpHWED->pfnSetSyncCompositeAdjustment)
                       (lpDisplay->hGDO, *lplValue);
          break;

        case GDO_HOOK_FRAMEMODULATION:
          (*lpDisplay->lpHWED->pfnSetFrameModulation)
                       (lpDisplay->hGDO, *lplValue);
          break;

      }
    }
  }

  if (lpDisplay->lpHWED->ulFunctionHooks2 & GDO_HOOK2_POSTADJUSTMENTCHANGE)
  {
    DALASSERT(lpDisplay->lpHWED->pfnPostAdjustmentChange != NULL, 
            "ulSetDisplayAdjustments - pfnPostAdjustmentChange is NULL!");

    (*lpDisplay->lpHWED->pfnPostAdjustmentChange)(lpDisplay->hGDO);
  }

  lpDisplay->ulFlags &= ~GDO_SETADJUSTMENTS;
  return ulReturn;
}



/****************************Private*Routine*******************************\
*
* BOOL bValidateDisplayAdjustments()
*
* Function validates if a set of display adjustments are valid for a
* specified display
*
* Notes: Function assumes the defaults for the current mode are stored in
*        the DAL's private structure for the GDO's and that this information
*        is re-queried on every SetMode call.
*
\**************************************************************************/

BOOL bValidateDisplayAdjustments(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay,
LPLONG lplAdjust)
{
  LPHW_ADJUSTMENT lpAdjustment;
  LONG            lTemp;
  ULONG           i;
  ULONG           ulIndex;
  ULONG           ulHook;
  BOOL            bRet;


  bRet = TRUE;

  for (ulIndex = 0, ulHook = 1;
       ulHook < GDO_ENDOF_ADJUSTMENTS;
       ulIndex ++, ulHook = (ulHook << 1), lplAdjust++)
  {
    // loop through each possible adjustment for the display, and
    // program out the adjustment state

    if (lpDisplay->lpHWED->ulFunctionHooks & ulHook)
    {
      // adjustment was hooked by the display, and the value of the
      // adjustment has changed

      lpAdjustment = (LPHW_ADJUSTMENT) &lpDisplay->aAdjustment[ulIndex];

      // Check if hook is for an adjustment that setsup a bit field.
      // If so don't apply the max, min, step limitaion, do the following :
      if ((ulHook & GDO_HOOK_VIDEO_STANDARD_ADJUSTMENT) ||
          (ulHook & GDO_HOOK_VIDEO_SIGNAL_STANDARD_ADJUSTMENT))
      {
        if (!(*lplAdjust & lpAdjustment->lMax)&&
           (lpDisplay->lpHWED->ulDisplayType != HW_DISPLAY_TYPE_CV)) //CV is different as TV.
        {
          // Adjustment set is not one of the supported
          // by the GDO. (In bit field defined adjustments
          // max is equivalent to capabilities)

          // By default atleast one bit must be set
          bRet = FALSE;
        }

        lTemp = (*lplAdjust);

        for (i = 0; i < 32; i++)
        {
          // Find the first set bit
          if (lTemp & 0x1)
          {
            lTemp = lTemp >> 1;
            // Shift the set bit, all the rest
            // of the bit should be 0 since
            // only one bit field adjustment is
            // allowed to be set at one time.

            if(lTemp)
            {
              bRet = FALSE;
              break;
            }
            else
            {
              break;
            }
          }

          lTemp = lTemp >> 1;
        }
      }
      else
      {
        if (*lplAdjust > lpAdjustment->lMax)
        {
          // adjustment is outside the valid range of adjustments for the
          // display so validation must fail.
          bRet = FALSE;
        }

        if (*lplAdjust < lpAdjustment->lMin)
        {
          // adjustment is outside the valid range of adjustments for the
          // display so validation must fail.
          bRet = FALSE;
        }

        if (lpAdjustment->lStep != 0)
        {
          if (*lplAdjust !=
              ((*lplAdjust / lpAdjustment->lStep) * lpAdjustment->lStep))
          {
            // adjustment is not aligned on a step boundary so fail.
            bRet = FALSE;
          }
        }
      }

    } else if (*lplAdjust != 0)
    {
      // adjustment was not hooked by the display so it must be zero!
      bRet = FALSE;
    }
  }

  return(bRet);
}


/****************************Private*Routine*******************************\
*
* BOOL bIsLidOpen()
*
* If the display hooked the function to determine if the display is open
* or closed, the display is queried.  Displays not supporting the function
* are Open by default
*
* Notes:
*
\**************************************************************************/

BOOL bIsLidOpen(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay)
{
  BOOL bRet;


  bRet = TRUE;

  if (lpDisplay->lpHWED->ulFunctionHooks & GDO_HOOK_LIDSTATE)
  {
    bRet = (*lpDisplay->lpHWED->pfnGetLidState)(lpDisplay->hGDO);
  }

  return(bRet);
}



/****************************Private*Routine*******************************\
*
* VOID vSetDisplayOn()
*
* Considers all factors which effect if a display should be turned ON
* and decides if the display should physically be turned on.
*
\**************************************************************************/

VOID vSetDisplayOn(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay)
{

  if (!(lpDisplay->ulFlags &
     (GDO_DPMS_DISABLED | GDO_BLANKING_DISABLED)))
  {
    // if the display is not disabled because of DPMS state
    // then turn the display on.
    (*lpDisplay->lpHWED->pfnSetDisplayOn)(lpDisplay->hGDO,
                                          lpDisplay->ulController);
  }

  lpDisplay->ulFlags |= GDO_ACTIVE;
}


/****************************Private*Routine*******************************\
*
* VOID vSetDisplayOff
*
* Considers all factors which effect if a display should be turned OFF
* and decides if the display should physically be turned on.
*
\**************************************************************************/

VOID vSetDisplayOff(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay)
{

  // go ahead, turn the display off .... there are no factors which can
  // restrict the display from being turned off.

  if(bCheckDisplaySharedResFree(lpHDE,lpDisplay)) //Only do it when the partner is not using it.
  {
    (*lpDisplay->lpHWED->pfnSetDisplayOff)(lpDisplay->hGDO,
                                           lpDisplay->ulController);
    lpDisplay->ulFlags &= ~GDO_ACTIVE;                                        
  }

  //lpHDE->ulSelectedDisplays &= (~VECTORFROMINDEX(lpDisplay->ulDisplay));
  //lpHDE->ulFlags |= HDAL_SAVESELECTED;

}



/****************************Private*Routine*******************************\
*
* VOID vSetBlanking()
*
* Function blanks a display if the display supports blanking and turns the
* display off otherwise.  Function is also used to restore a blanked
* display.
*
* Note:
*
*
\**************************************************************************/

VOID vSetBlanking(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay,
ULONG ulController,
BOOL bBlank)
{
  if (lpDisplay->ulFlags & GDO_ACTIVE)
  {
    // if the display is not active, why would the display be blanked

    if (lpDisplay->lpHWED->ulFunctionHooks & GDO_HOOK_BLANKING)
    {
      // the display hooked blanking function support, so call the function

      (*lpDisplay->lpHWED->pfnBlanking)(lpDisplay->hGDO, ulController, bBlank);
    } else
    {
      // display does not support blanking, so emulate blanking using
      // the display on / off functions.

      if (bBlank)
      {
        // DAL considers turning off the display the same as

        lpDisplay->ulFlags |= GDO_BLANKING_DISABLED;
        vSetDisplayOff(lpHDE, lpDisplay);
      } else
      {
        lpDisplay->ulFlags &= ~GDO_BLANKING_DISABLED;
        vSetDisplayOn(lpHDE, lpDisplay);
      }
    }
  }
}



/****************************Private*Routine*******************************\
*
* VOID vSetDisplayPowerState()
*
* Sets the specified power state for the display.  Caller must ensure that
* the display is currently running in a mode attached to a controller.
*
* Note:
*
*
\**************************************************************************/

VOID vSetDisplayPowerState(
LPHW_D

⌨️ 快捷键说明

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