📄 mqext.ccp
字号:
/* $Header: U:/archive/CE/mq200/driver/mq200drv/ext/mqext.ccv 1.18 Apr 18 2000 15:35:48 tzyywei $
*
* ========================================================================
* Copyright (c) 1999 by MediaQ, Incorporated.
* All Rights Reserved.
*
* Confidential and Proprietary to MediaQ, Incorporated.
* ========================================================================
*
* $Log: U:/archive/CE/mq200/driver/mq200drv/ext/mqext.ccv $
*
* Rev 1.18 Apr 18 2000 15:35:48 tzyywei
*Fixed pb 3.0 exception bugs (text can not display).
*MS uses DrvEscape for Dirty Rectangel driver performance improvement.
*We have to re-arrange the return codes.
*
* Rev 1.17 Mar 29 2000 12:26:08 hoang
*Fix bug : pvOut is invalid pointer if iEsc isn't MQ_EXTENSION
*
* Rev 1.16 Jan 13 2000 11:51:46 hoang
*Fixed bug id #27: Open PPT in QView mode (Simul)
*and view slide show will corrupt pallette on screen (Transparency)
*
* Rev 1.15 Jul 19 1999 18:23:10 chijen
*cast level to ULONG when << 24
*
* Rev 1.14 Jul 19 1999 17:45:28 chijen
*fix SWAP_PWM01
*
* Rev 1.13 Jun 05 1999 14:18:56 chijen
*add SUPPORT_DDC flag
*
* Rev 1.12 Jun 03 1999 18:53:22 tzyywei
*fixed OemSetContrast bugs
*
* Rev 1.11 May 28 1999 14:37:30 chijen
*add stub for ddidump
*
* Rev 1.10 May 25 1999 15:54:10 chijen
*add DRV_COMM_STRUCT support routines
*
* Rev 1.9 May 17 1999 10:20:50 chijen
*remove bResetIW2_START_ADDR
*
* Rev 1.8 May 15 1999 09:31:36 tzyywei
*change OutputDebugStringW to RETAILMSG
*
* Rev 1.7 May 14 1999 18:59:42 chijen
*add SetCursorData
*
* Rev 1.6 May 05 1999 08:30:56 tzyywei
*Temp fix for OemSetBacklight and OemSetConstrast
*
* Rev 1.5 Apr 29 1999 17:32:22 yuhuan
*Added MIU/GE clock switching handling and flat panel off/on
*for NEC platform (patch).
*
* Rev 1.4 Apr 11 1999 08:27:22 tzyywei
*Enable re-program IW2_START_ADDR in HW_LoadingLCDTiming() routine
*
* Rev 1.3 Apr 08 1999 06:09:06 tzyywei
*Change SetupCRTTiming parameters orders.
*
* Rev 1.2 Mar 30 1999 15:10:46 tzyywei
*update for JP demo.
*
* Rev 1.1 Mar 13 1999 10:57:22 tzyywei
*Add INSTANT ROTATIION support
*
* Rev 1.0 Feb 16 1999 14:39:42 yuhuan
*Initial revision.
*/
#ifdef MQ_CPP
#include ".\cfginc\mqcfg.h"
#else
#include <windows.h>
#include "..\mqcfg.h"
#endif
#include "mqext.h"
//#include "ext\ddc.h"
#include "ddc.h"
// Defines used also in config.cpp
#define NO_RELOAD_TIMING 0
#define RELOAD_TIMING 0x0001
#define LCD_BY_GC1 0x0000
#define LCD_BY_GC2 0x0002
#ifdef DDIDUMP ///////////////////////////// Stub function to make it happy
ULONG MQDrvEscape (INT pso,
ULONG iEsc,
ULONG cjIn,
PVOID pvIn,
ULONG cjOut,
PVOID pvOut)
{
return ESC_NOT_SUPPORTED;
}
#else ////////////////////////////////////// DDI Driver
#ifdef MQ_CPP
TCHAR tcVersion[];
TCHAR tcBuild[];
TCHAR tcDate[];
#ifdef SUPPORT_DDC
extern EDID_DATA EDID_Buffer;
extern BOOL DDCTest();
#endif // SUPPORT_DDC
#endif
//****************************************************************************
// Local Function prototype
//****************************************************************************
ULONG Do_Query_MQ_Info(ULONG cjIn,PVOID pvIn,ULONG cjOut,PVOID pvOut);
ULONG Do_Query_MQ_LCD(ULONG cjOut,PVOID pvOut);
ULONG Do_Query_MQ_CRT(ULONG cjOut,PVOID pvOut);
ULONG Do_Set_Cursor_Color(PVOID cjIn);
ULONG Do_Set_Palette(PVOID cjIn);
ULONG Do_Set_Backlight_Level(PVOID pvIn);
ULONG Do_Set_Contrast_Level(PVOID pvIn);
#ifdef SUPPORT_DDC
ULONG Do_Get_EDID(PVOID pvOut);
#endif // SUPPORT_DDC
ULONG Do_Set_Display_Mode(PVOID pvIn);
ULONG Do_Enter_PowerSave(PVOID pvIn);
ULONG Do_Power_Off_LCD();
ULONG Do_Enable_Alt_Win(PVOID pvIn);
ULONG Do_Disable_Alt_Win(PVOID pvIn);
ULONG Do_Rotate_Desktop(PVOID pvIn);
ULONG Do_Enter_Ghost_Mode(PVOID pvIn);
ULONG Do_Leave_Ghost_Mode(PVOID pvIn);
extern PALETTEENTRY _rgbIdentity256[];
extern USHORT usBPP; //make DrvGetMasks happy
/**************************************************************************
*
* ULONG DrvEscape(pso, iEsc, cjIn, pvIn, cjOut, pvOut);
*
* SURFOBJ *pso; Surface that the call is directed to
* ULONG iEsc; Specifies the particular function to be performed.
* Currently, only the following are supported:
* MQ_EXTENSION:
* Determine if a function is supported
* ULONG cjIn; Size, in bytes, of the buffer pointed to by pvIn
* PVOID pvIn; Input data for the call. Format depends on function
* specified by iEsc
* ULONG cjOut; Size, in bytes, of the buffer pointed to by pvOut
* PVOID pvOut; Output buffer for the call. Format depends on function
* specified by iEsc
*
* DESCRIPTION:
* Entry point for driver- extension functions.
*
* RETURN VALUE:
* ESC_SUCCESS if successful (value = 1L
* ESC_NOT_SUPPORTED if unimplemented function requested (value = 0L)
* ESC_FAILED if failed (value = 0xFFFFFFFF)
*
* GLOBALS CHANGED:
* None
*
* CALLED BY:
* This is an entry point
*
* AUTHOR:
* Tzyywei Hwang.
*
* CHANGE HISTORY:
*
* TEST HISTORY:
*
***************************************************************************/
/////#if 0
/////ULONG DrvEscape (SURFOBJ *pso,
/////#endif
ULONG MQDrvEscape (INT pso,
ULONG iEsc,
ULONG cjIn,
PVOID pvIn,
ULONG cjOut,
PVOID pvOut)
{
ULONG ulFunction;
if(iEsc != MQ_EXTENSION)
{
return ESC_NOT_SUPPORTED;
}
#ifdef MQ_CPP
if( !pMQGC )
{
if(!(pMQGC=(MQGC *)pGPE))
pMQGC = new MQGC(0);
}
#endif
// *(ULONG *)pvOut = MQESC_SUCCESS;
ulFunction = *(ULONG *)pvIn;
switch(ulFunction)
{
case QUERY_MQ_INFO:
return Do_Query_MQ_Info(cjIn,pvIn,cjOut,pvOut);
case QUERY_MQ_LCD:
return Do_Query_MQ_LCD(cjOut, pvOut);
case QUERY_MQ_CRT:
return Do_Query_MQ_CRT(cjOut, pvOut);
case SET_CURSOR_COLOR:
if(cjIn >= sizeof(CURSOR_COLOR_STRUCT))
return Do_Set_Cursor_Color(pvIn);
else
return ESC_FAILED;
case SET_PALETTE:
if(cjIn >= sizeof(GAMMA_PALETTE_STRUCT))
return Do_Set_Palette(pvIn);
else
return ESC_FAILED;
case SET_CONTRAST_LEVEL:
if(cjIn >= sizeof(LEVEL_STRUCT))
return Do_Set_Contrast_Level(pvIn);
else
return ESC_FAILED;
case SET_BACKLIGHT_LEVEL:
if(cjIn >= sizeof(LEVEL_STRUCT))
return Do_Set_Backlight_Level(pvIn);
else
return ESC_FAILED;
#ifdef SUPPORT_DDC
case GET_EDID:
return Do_Get_EDID(pvOut);
#endif // SUPPORT_DDC
case SET_DISPLAY_MODE:
if(cjIn >= sizeof(DISPLAY_MODE_STRUCT))
return Do_Set_Display_Mode(pvIn);
else
return ESC_FAILED;
case ENTER_POWERSAVE:
if(cjIn >= sizeof(LEVEL_STRUCT))
return Do_Enter_PowerSave(pvIn);
else
return ESC_FAILED;
case POWER_OFF_LCD:
if(cjIn >= sizeof(ULONG))
return Do_Power_Off_LCD();
else
return ESC_FAILED;
case ENABLE_ALT_WIN:
if(cjIn >= sizeof(ALT_WIN_STRUCT))
return Do_Enable_Alt_Win(pvIn);
else
return ESC_FAILED;
case DISABLE_ALT_WIN:
return Do_Disable_Alt_Win(pvIn);
case ENTER_GHOST_MODE:
return Do_Enter_Ghost_Mode(pvIn);
case LEAVE_GHOST_MODE:
return Do_Leave_Ghost_Mode(pvIn);
case ROTATE_DESKTOP:
#ifdef INSTANT_ROTATE
if(cjIn >= sizeof(ROTATE_DESKTOP_STRUCT))
return Do_Rotate_Desktop(pvIn);
else
return ESC_FAILED;
#else
return ESC_NOT_SUPPORTED;
#endif
default:
break;
}
return ESC_NOT_SUPPORTED;
}
ULONG Do_Query_MQ_Info(ULONG cjIn,PVOID pvIn,ULONG cjOut,PVOID pvOut)
{
PMQINFO pMqInfo = ((PMQINFO_RESULT)pvOut)->pMqInfo;
//*******************************************
// get Flat Panel information
//*******************************************
#ifdef MQ_CPP
pMqInfo->FpInfo.fp_size.SizeX = pMQGC->m_pFPControl->usHoriSize;
pMqInfo->FpInfo.fp_size.SizeY = pMQGC->m_pFPControl->usVertSize;
/// pMqInfo->FpInfo.fp_control = pMQGC->m_pFPControl->ulFPControl;
switch(pMQGC->m_pFPControl->ulFPControl & 0x00000010)
{
default:
case 0x00L:
pMqInfo->FpInfo.fp_color = COLOR_FP;
break;
case 0x10L:
pMqInfo->FpInfo.fp_color = MONO_FP;
break;
}
switch(pMQGC->m_pFPControl->ulFPControl & 0x0000000C)
{
default:
case 0x0L:
pMqInfo->FpInfo.fp_type = TFT_FP;
break;
case 0x4L:
pMqInfo->FpInfo.fp_type = SSTN_FP;
break;
case 0x8L:
case 0xCL:
pMqInfo->FpInfo.fp_type = DSTN_FP;
break;
}
#else
pMqInfo->FpInfo.fp_size.SizeX = 800;
pMqInfo->FpInfo.fp_size.SizeY = 600;
pMqInfo->FpInfo.fp_color = COLOR_FP;
pMqInfo->FpInfo.fp_type = TFT_FP;
/// pMqInfo->FpInfo.fp_control = 0;
#endif
//*******************************************
// get CRT information
//*******************************************
pMqInfo->CrtInfo.CrtAttached = TRUE;
pMqInfo->CrtInfo.DDCType = T_DDC2B;
pMqInfo->CrtInfo.ManufactureID = 0x0E4E; // 'CRN'
pMqInfo->CrtInfo.MonitorID = 0x3037; //07
//*******************************************
// get Driver information
//*******************************************
#ifdef MQ_CPP
wcscpy(pMqInfo->DrvInfo.tcVersion,tcVersion);
wcscpy(pMqInfo->DrvInfo.tcBuild,tcBuild);
wcscpy(pMqInfo->DrvInfo.tcDate,tcDate);
#else
wcscpy(pMqInfo->DrvInfo.tcVersion,TEXT("1.00B"));// Ver = 1.00
wcscpy(pMqInfo->DrvInfo.tcBuild,TEXT("001")); // build number = 0
wcscpy(pMqInfo->DrvInfo.tcDate,TEXT("June 1, 1998"));
#endif
//*******************************************
// get MQ100 Information
//*******************************************
((PMQINFO_RESULT)pvOut)->ulResult = ESC_SUCCESS;
return ESC_SUCCESS;
}
ULONG Do_Query_MQ_LCD(ULONG cjOut,PVOID pvOut)
{
return ESC_SUCCESS;
}
ULONG Do_Query_MQ_CRT(ULONG cjOut,PVOID pvOut)
{
return ESC_SUCCESS;
}
ULONG Do_Set_Cursor_Color(PVOID cjIn)
{
PCURSOR_COLOR_STRUCT pCC = (PCURSOR_COLOR_STRUCT) cjIn;
#ifdef MQ_CPP
pMQGC->m_nCursorColor = (USHORT)pCC->ulColorIndex;
pMQGC->SetCursorColors();
#endif
return ESC_SUCCESS;
}
#ifdef MQ_CPP
extern USHORT usBPP; // make DrvGetMasks happy
#else
USHORT usBPP = 8;
#endif
ULONG Do_Set_Palette(PVOID cjIn)
{
PGAMMA_PALETTE_STRUCT pGP = (PGAMMA_PALETTE_STRUCT) cjIn;
switch(usBPP)
{
default:
return ESC_NOT_SUPPORTED;
// if BPP = 16, update HWPALETTE directly.
case 32:
case 24:
case 16:
case 8:
RETAILMSG(1,(TEXT("Do_Set_Palette\r\n")));
#ifdef MQ_CPP
pMQGC->SetHWPalette((ULONG *)(pGP->ulRGBQuad),0,256);
#endif
break;
}
InvalidateRect(0,NULL,TRUE);
UpdateWindow(0);
/////#endif
return ESC_SUCCESS;
}
ULONG Do_Set_Backlight_Level(PVOID pvIn)
{
PLEVEL_STRUCT pL = (PLEVEL_STRUCT) pvIn;
#ifdef MQ_CPP
if(pMQGC->OemSetBacklight(pL->ulLevel))
return ESC_SUCCESS;
else
return ESC_FAILED;
#else
return ESC_SUCCESS;
#endif
}
ULONG Do_Rotate_Desktop(PVOID pvIn)
{
PROTATE_DESKTOP_STRUCT pR = (PROTATE_DESKTOP_STRUCT) pvIn;
#ifdef MQ_CPP
if(pR->ulPosition == R_0 || pR->ulPosition == R_180)
{
#ifdef SUPPORT_ROTATE
if(pMQGC->m_nRotate == R_0 || pMQGC->m_nRotate == R_180)
pMQGC->m_nRotate = pR->ulPosition;
#endif
return ESC_SUCCESS;
}
else
{
if(pR->ulPosition == R_90 || pR->ulPosition == R_270)
{
#ifdef SUPPORT_ROTATE
if(pMQGC->m_nRotate == R_90 || pMQGC->m_nRotate == R_270)
pMQGC->m_nRotate = pR->ulPosition;
#endif
return ESC_SUCCESS;
}
else
return ESC_FAILED;
}
#else
return ESC_SUCCESS;
#endif
}
ULONG Do_Set_Contrast_Level(PVOID pvIn)
{
PLEVEL_STRUCT pL = (PLEVEL_STRUCT) pvIn;
#ifdef MQ_CPP
if(pMQGC->OemSetContrast(pL->ulLevel))
return ESC_SUCCESS;
else
return ESC_FAILED;
#else
return ESC_SUCCESS;
#endif
}
#ifdef SUPPORT_DDC
ULONG Do_Get_EDID(PVOID pvOut)
{
#ifdef MQ_CPP
if(pMQGC->OemGetEDID(pvOut))
return ESC_SUCCESS;
else
return ESC_FAILED;
#else
return ESC_SUCCESS;
#endif
}
#endif // SUPPORT_DDC
ULONG Do_Enter_PowerSave(PVOID pvIn)
{
PLEVEL_STRUCT pL = (PLEVEL_STRUCT) pvIn;
#ifdef MQ_CPP
if(pMQGC->OemEnterPowerSave(pL->ulLevel))
return ESC_SUCCESS;
else
return ESC_FAILED;
#else
return ESC_SUCCESS;
#endif
}
#define GC1 1
#define GC2 2
// #define GC1_LCD 1
// #define GC1_CRT 2
// #define GC1_SIMUL 3
// #define GC2 4
ULONG Do_Power_Off_LCD()
{
DEBUGMSG(GPE_ZONE_INIT,(TEXT("Shutdown LCD at GC1\r\n")));
DEBUGMSG(GPE_ZONE_INIT,(TEXT("Shutdown LCD at GC2\r\n")));
#ifdef MQ_CPP
pMQGC->HW_Disable_LCD(GC1);
pMQGC->HW_Disable_LCD(GC2);
#endif
return ESC_SUCCESS;
}
ULONG Do_Enable_Alt_Win(PVOID cjIn)
{
PALT_WIN_STRUCT pAW = (PALT_WIN_STRUCT) cjIn;
#ifdef MQ_CPP
pMQGC->OemSetupAltWin();
#endif
return ESC_SUCCESS;
}
ULONG Do_Disable_Alt_Win(PVOID cjIn)
{
PALT_WIN_STRUCT pAW = (PALT_WIN_STRUCT) cjIn;
#ifdef MQ_CPP
pMQGC->OemDisableAltWin();
#endif
return ESC_SUCCESS;
}
ULONG Do_Enter_Ghost_Mode(PVOID cjIn)
{
PDRV_COMM_STRUCT pDCS = (PDRV_COMM_STRUCT) cjIn;
#ifdef MQ_CPP
pMQGC->OemEnterGhostMode(pDCS->ulCommFlag);
#endif
return ESC_SUCCESS;
}
ULONG Do_Leave_Ghost_Mode(PVOID cjIn)
{
PDRV_COMM_STRUCT pDCS = (PDRV_COMM_STRUCT) cjIn;
#ifdef MQ_CPP
pMQGC->OemLeaveGhostMode();
#endif
return ESC_SUCCESS;
}
ULONG Do_Set_Display_Mode(PVOID pvIn)
{
#ifdef MQ_CPP
PDISPLAY_MODE_STRUCT pDmode = (PDISPLAY_MODE_STRUCT) pvIn;
ULONG ulAction = pDmode->ulActionFlag;
extern BOOL bMIUClkLow; //HSU
// DebugBreak();
if(!ulAction)
return ESC_SUCCESS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -