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

📄 config.cpp

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*
 * $Workfile: CONFIG.CPP $
 * $Revision: 21 $
 * $Date: 4/07/00 8:48a $
 * $Modtime: 4/07/00 8:39a $
 * $Author: Sarma $
 *
 * Contains routines for GXVideo initialization and also to set modes.
 *
 * Copyright (c) 1998 National Semiconductor Corporation.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of National 
 * Semiconductor Corporation. ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into
 * with National Semiconductor Corporation.
 * This code is supplied as is.
 *
 */

/*
 *$Log: /CE/Platform/Nsc/Drivers/Video/gxvideo/base/CONFIG.CPP $
 * 
 * 21    4/07/00 8:48a Sarma
 * Removed Cyrix Corporation from the legal/confidentail information.
 * 
 * 20    4/06/00 4:09p Sarma
 * Removed personal messages.
 * 
 * 19    4/06/00 3:44p Sarma
 * Initialized the gfx_vidptr only once during object creation.
 * 
 * 18    4/06/00 11:13a Ejapsc
 * took out DhruvaSetReg call because it is not needed here.
 * 
 * 17    4/06/00 10:35a Hari
 * Removed Debug messages.
 * 
 * 16    4/05/00 5:17p Ejapsc
 * added id for device in pdriverdata structure 
 * 
 * 15    4/05/00 4:46p Sarma
 * Set the pDriver member variable only in case of DD_SUPPORT, as it is
 * deifned only in case of directdraw.
 * 
 * 14    3/29/00 2:17p Sarma
 * moved pdriverdata-vtiming and htiming to the end of the function
 * because they were getting updated at the wrong time.
 * 
 * 13    3/29/00 9:26a Sarma
 * Added HALInit as a stub function when no directdraw interface and in
 * directdraw interface this comes from one of the directdraw lib. This is
 * just to keep the export function happy as we cannot modify the *.def
 * file depending upon the env set.
 * Added drirectdraw initialization, and dhruva chipset detection mech.
 * We use 4MB for Directdraw as this seems to be the config for directdraw
 * else directdraw dosen't work. For the non directdraw we still use the
 * 2.5MB memory block. For some reason in the later case the 4MB  usage
 * freezes the screen, so we have two memory sizes.
 * Added durnago based setmode.
 * 
 * 12    10/20/99 9:47a Sarma
 * Added compilation flag FB16BPP to control the depth of the framebuffer.
 * This can be added in "CDEFINES" sources file by adding "-DFB16BPP".
 * Also need to enable CEPC_GX16BPP=1 so that the 1280x1024 is knocked off
 * from the resoultions list. 
 * set CEPC_GX16BPP=1
 * 
 * 11    10/14/99 2:54p Sarma
 * Moved the DEFINES to gxvideo.h for flash.cpp to share the same
 * variables.
 * Deleted the DrvGetModes which was added for test purpose.
 * 
 * 10    9/17/99 2:33p Sarma
 * Setting to possitive sync poll. in 5530 is t set the bits 8/9 on Disply
 * Configuration Register and 0 for negative sync.
 * 
 * 9     9/14/99 11:25a Sarma
 * Use appropraite Horiz/Vert Sync polarity as per the VESA document
 * "Monitor Timing Specifications V1.0 Rev 0.8". Now we have a seperate
 * filed in each resolution data having this information, which will be
 * used in setmode.
 * 
 * 8     8/31/99 2:56p Sarma
 * Modified the "Using DDC". It is found that when in WBT the user seletcs
 * the "Best Using DDC" the Resolution key word in the registry is not
 * set. Resolution not set in the regisrt means automatic assignment and
 * we need to chek the monitor.
 * 
 * 7     8/11/99 4:15p Sarma
 * Added support for 85Hx resoulution for 640x480, 800x600, 1024x768.
 * 1280x1024 dosen't support 85Hz as it is not sable.
 * 
 * 6     7/20/99 2:08p Sarma
 * Added DDC support. This will enable to put the wince is the best
 * available highest resolution supported by the display connected. If
 * display dosen't support or for any other reason if failed it defaults
 * to 640x480x60.
 * 
 * 5     1/13/99 10:11a Sliu
 * Change the video memory size from 4MB to 2.5 MB.
 * 
 * 4     12/01/98 1:14p Sarma
 * No need to create the cursor memory in pDummy which was carried out
 * from s3Trio implementation.
 * The node2D creation has to be sent the screenstride instead of
 * screenwidth, this is true as we opperate on x1024. This is the cause
 * for the RDP not being comming up for 1280x1024 res. This looks the
 * problem for the atifact which used to appear on the bottom of the
 * screen in ICA for 1280x1024.
 * 
 * 3     11/13/98 11:32a Sarma
 * 85 Hz needs to be removed as its not being supported.
 * 
 * 2     11/12/98 3:33p Sarma
 * Added Confidential copyright to files with VSS keywords for
 * log/history.
 * Added DDI interface routine DriverGetModes, but currently not in use.
 *$History: CONFIG.CPP $
 * 
 * *****************  Version 21  *****************
 * User: Sarma        Date: 4/07/00    Time: 8:48a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Removed Cyrix Corporation from the legal/confidentail information.
 * 
 * *****************  Version 20  *****************
 * User: Sarma        Date: 4/06/00    Time: 4:09p
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Removed personal messages.
 * 
 * *****************  Version 19  *****************
 * User: Sarma        Date: 4/06/00    Time: 3:44p
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Initialized the gfx_vidptr only once during object creation.
 * 
 * *****************  Version 18  *****************
 * User: Ejapsc       Date: 4/06/00    Time: 11:13a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * took out DhruvaSetReg call because it is not needed here.
 * 
 * *****************  Version 17  *****************
 * User: Hari         Date: 4/06/00    Time: 10:35a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Removed Debug messages.
 * 
 * *****************  Version 16  *****************
 * User: Ejapsc       Date: 4/05/00    Time: 5:17p
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * added id for device in pdriverdata structure 
 * 
 * *****************  Version 15  *****************
 * User: Sarma        Date: 4/05/00    Time: 4:46p
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Set the pDriver member variable only in case of DD_SUPPORT, as it is
 * deifned only in case of directdraw.
 * 
 * *****************  Version 14  *****************
 * User: Sarma        Date: 3/29/00    Time: 2:17p
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * moved pdriverdata-vtiming and htiming to the end of the function
 * because they were getting updated at the wrong time.
 * 
 * *****************  Version 13  *****************
 * User: Sarma        Date: 3/29/00    Time: 9:26a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Added HALInit as a stub function when no directdraw interface and in
 * directdraw interface this comes from one of the directdraw lib. This is
 * just to keep the export function happy as we cannot modify the *.def
 * file depending upon the env set.
 * Added drirectdraw initialization, and dhruva chipset detection mech.
 * We use 4MB for Directdraw as this seems to be the config for directdraw
 * else directdraw dosen't work. For the non directdraw we still use the
 * 2.5MB memory block. For some reason in the later case the 4MB  usage
 * freezes the screen, so we have two memory sizes.
 * Added durnago based setmode.
 * 
 * *****************  Version 12  *****************
 * User: Sarma        Date: 10/20/99   Time: 9:47a
 * Updated in $/wince/v2.1/gxvideo
 * Added compilation flag FB16BPP to control the depth of the framebuffer.
 * This can be added in "CDEFINES" sources file by adding "-DFB16BPP".
 * Also need to enable CEPC_GX16BPP=1 so that the 1280x1024 is knocked off
 * from the resoultions list. 
 * set CEPC_GX16BPP=1
 * 
 * *****************  Version 11  *****************
 * User: Sarma        Date: 10/14/99   Time: 2:54p
 * Updated in $/wince/v2.1/gxvideo
 * Moved the DEFINES to gxvideo.h for flash.cpp to share the same
 * variables.
 * Deleted the DrvGetModes which was added for test purpose.
 * 
 * *****************  Version 10  *****************
 * User: Sarma        Date: 9/17/99    Time: 2:33p
 * Updated in $/wince/v2.1/gxvideo
 * Setting to possitive sync poll. in 5530 is t set the bits 8/9 on Disply
 * Configuration Register and 0 for negative sync.
 * 
 * *****************  Version 9  *****************
 * User: Sarma        Date: 9/14/99    Time: 11:25a
 * Updated in $/wince/v2.1/gxvideo
 * Use appropraite Horiz/Vert Sync polarity as per the VESA document
 * "Monitor Timing Specifications V1.0 Rev 0.8". Now we have a seperate
 * filed in each resolution data having this information, which will be
 * used in setmode.
 * 
 * *****************  Version 8  *****************
 * User: Sarma        Date: 8/31/99    Time: 2:56p
 * Updated in $/wince/v2.1/gxvideo
 * Modified the "Using DDC". It is found that when in WBT the user seletcs
 * the "Best Using DDC" the Resolution key word in the registry is not
 * set. Resolution not set in the regisrt means automatic assignment and
 * we need to chek the monitor.
 * 
 * *****************  Version 7  *****************
 * User: Sarma        Date: 8/11/99    Time: 4:15p
 * Updated in $/wince/v2.1/gxvideo
 * Added support for 85Hx resoulution for 640x480, 800x600, 1024x768.
 * 1280x1024 dosen't support 85Hz as it is not sable.
 * 
 * *****************  Version 6  *****************
 * User: Sarma        Date: 7/20/99    Time: 2:08p
 * Updated in $/wince/v2.1/gxvideo
 * Added DDC support. This will enable to put the wince is the best
 * available highest resolution supported by the display connected. If
 * display dosen't support or for any other reason if failed it defaults
 * to 640x480x60.
 * 
 * *****************  Version 5  *****************
 * User: Sliu         Date: 1/13/99    Time: 10:11a
 * Updated in $/wince/v2.1/gxvideo
 * Change the video memory size from 4MB to 2.5 MB.
 * 
 * *****************  Version 4  *****************
 * User: Sarma        Date: 12/01/98   Time: 1:14p
 * Updated in $/wince/v2.1/gxvideo
 * No need to create the cursor memory in pDummy which was carried out
 * from s3Trio implementation.
 * The node2D creation has to be sent the screenstride instead of
 * screenwidth, this is true as we opperate on x1024. This is the cause
 * for the RDP not being comming up for 1280x1024 res. This looks the
 * problem for the atifact which used to appear on the bottom of the
 * screen in ICA for 1280x1024.
 * 
 * *****************  Version 3  *****************
 * User: Sarma        Date: 11/13/98   Time: 11:32a
 * Updated in $/wince/v2.1/gxvideo
 * 85 Hz needs to be removed as its not being supported.
 * 
 * *****************  Version 2  *****************
 * User: Sarma        Date: 11/12/98   Time: 3:33p
 * Updated in $/wince/v2.1/gxvideo
 * Added Confidential copyright to files with VSS keywords for
 * log/history.
 * Added DDI interface routine DriverGetModes, but currently not in use.
*/


#include "precomp.h"
#include "ddc.h"

#ifdef DURANGO
#include "gfx_rtns.h"   //hrhr
#endif

#ifdef DD_SUPPORT
extern DDRAWDATA *pDriverData;
extern DDRAWDATA DriverData;
#endif //DD_SUPPORT

INSTANTIATE_GPE_ZONES(0x0003,"DDI Driver","unused1","unused2")	 /* Start with Errors, warnings, and temporary messages */

#include "palette.h"	// for 8Bpp we use the natural palette
INSTANTIATE_PALETTE

static GPE *pGPE = (GPE *)NULL;
// Main entry point for a GPE-compliant driver
GPE *GetGPE()
{
	if( !pGPE )
		pGPE = new GxVideo();
	return pGPE;
}


BOOL APIENTRY GPEEnableDriver(          // This gets around problems exporting from .lib
	ULONG          iEngineVersion,
	ULONG          cj,
	DRVENABLEDATA *pded,
	PENGCALLBACKS  pEngCallbacks);

unsigned long BitMasks[] = { 0xF800,0x07E0,0x001F };

ULONG *APIENTRY DrvGetMasks(
    DHPDEV     dhpdev)
{
	return BitMasks;
}


BOOL APIENTRY DrvEnableDriver(
	ULONG          iEngineVersion,
	ULONG          cj,
	DRVENABLEDATA *pded,
	PENGCALLBACKS  pEngCallbacks)
{
	BOOL ret;
	ret = GPEEnableDriver( iEngineVersion, cj, pded, pEngCallbacks );

	//pded->DrvGetModes = DriverGetModes;

	return ret;
}

#ifndef DD_SUPPORT
void HALInit()
{
	DEBUGMSG( 0,(TEXT("HALInit: Stub, Shouldn't have come in hereX\n")));
	RETAILMSG( 0,(TEXT("HALInit: Stub, Shouldn't have come in hereX\n")));
}
#endif //DD_SUPPORT

GxVideo::GxVideo()
{
	unsigned char GCRvalue;
	unsigned long regaddr; 
	unsigned long fbaddr;
	unsigned long CxId;
	unsigned long cx5530addr;
	HKEY hKey;
	
	// READ GX PROCESSOR PARAMETERS

	ProcessorID = gx_read_processor_id();
	GCRvalue = gx_read_gcr();

	// SET REGISTER ADDRESS
	// Bits [1:0] of the GCR specify the base address.
	
	regaddr = ((unsigned long)(GCRvalue & 0x03)) << 30;
	fbaddr = regaddr + 0x00800000;

	CxId = GetDeviceId();
	switch(CxId)
    {
        case 0x00001078: //CX5510 present
			DeviceId = CX5510;
            break;

        case 0x00021078: //CX5520 present
			DeviceId = CX5520;
            break;

        case 0x01001078: //CX5530 present
			DeviceId = CX5530;
            break;
#ifdef DD_SUPPORT
        case 0x04001078: //DHRUVA/MediaPC2 present
			DeviceId = DHRUVA;
            break;
#endif //DD_SUPPORT
        default:		 //CX5510 present
 			DeviceId = CX5510;
           break;

⌨️ 快捷键说明

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