亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hal.c

?? 用C語言設計的EPSON LCD控制器S1D13700驅動。
?? C
?? 第 1 頁 / 共 3 頁
字號:
//=============================================================================
//	HAL.C
// (Tabs set to every 4 spaces)
//---------------------------------------------------------------------------
//	The routines in this file comprise the core of the S1D13700 miniHAL.
//---------------------------------------------------------------------------
//
//  ㏒EIKO EPSON CORPORATION 2003-2005. All rights reserved.
//
//=============================================================================

#if defined INLINE_FUNCTIONS
	#define INLINE inline
#else
	#define INLINE
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
	static HANDLE	ghHalMutex;				// Process synchronization mutex handle
#endif

#include "hal.h"
#include "HAL_platform.h"
#include "HAL_private.h"
#include "hal_indirect.h"
#include "hal_config.c"
#include "halmutex.h"
#include "libmutex.h"

#ifdef _WIN32
#pragma warning( disable : 4100 )	// Disable "unreferenced formal parameter" warning.
#endif

//===========================================================================
// PUBLIC GLOBAL VARIABLES
//===========================================================================

char	gszHALRevision[] = "$Revision: 10 $";

int		gnHalErrCode;

//===========================================================================
// PRIVATE (STATIC) FUNCTION PROTOTYPES (local to HAL only)
//===========================================================================

static void		InitRegisters( void );
static void		ClearVideoMemory( void );

//===========================================================================
// Timing globals and defines
//===========================================================================
static __int64	gSysClockBase;						// Value of CPU SysClock at calibration time
static __int64	gSysClockPS;						// Calculated number of picoseconds per SysClock

static Boolean	CalibrateSystemClock( void );

#define RDTSC(var64)						\
	__asm									\
	{										\
		__asm rdtsc							\
		__asm mov dword ptr [var64+0],eax	\
		__asm mov dword ptr [var64+4],edx	\
	} ((void)0)


//===========================================================================
// PRIVATE GLOBAL VARIABLES (local to HAL only)
//===========================================================================

static DATA_STRUCT gHD =							// Global HAL private data storage
{
	HAL_MUTEX_REVISION,
	LIB_MUTEX_REVISION,
	"Copyright (c) Seiko Epson Corporation 2003-2005.\nAll rights reserved.\n"
	// Remaining members are default initialized to zero.
};

// CRITICAL: The messages in this array MUST correspond to the error codes contained in the HAL.H enumeration.
static const char * const gapszErrMsg[ERR_FAILED + 1] =
{
	"There was no error detected",					// ERR_NONE
	"Unable to find/load the S1D13xxx driver",		// ERR_PCI_DRIVER_NOT_FOUND
	"Unable to locate an S1D13xxx controller",		// ERR_PCI_ADAPTER_NOT_FOUND
	"This program has not been configured",			// ERR_NOT_CONFIGURED
	"Config CRC does not match configuration",		// ERR_BAD_CFG_DATA
	"I2C bus/device initialization failure",		// ERR_BAD_I2C_INIT
	"The controller has not been acquired",			// ERR_NOT_ACQUIRED
	"IRQ interrupt handler failure",				// ERR_IRQ_FAILURE
	"The CNF1 pin is low (all GPIOs are outputs)",	// ERR_BAD_CNF1_SETTING
	"An unspecified error occured"					// ERR_FAILED
};


const DATA_STRUCT* const gpHalData = &gHD;

/*****************************************************************************/
/*                      FUNCTIONS exported in hal.h                          */
/*****************************************************************************/

//=============================================================================
//                                 Start Up
//=============================================================================

//---------------------------------------------------------------------------
//  FUNCTION:	halAcquireController()
//
//  DESCRIPTION:
//		This is the discovery portion of the the start-up sequence.
//		On the Intel platform, halAcquireController() initiates the link
//		between the application and the hardware by attempting to load
//		S1D13xxx.VxD. If the driver is loaded successfully then a call
//		is made to the VxD to determine the presence and the address
//		of the S1D13700. On all other platforms, this routine takes
//		the register and display memory addresses provided by 13700CFG.
//
//		This routine MUST be called before any other call to the HAL is made!
//		(i.e. halInitController)
//		
//		Applications can call this routine only to obtain pointers to the
//		registers and display memory and from there take over all access
//		to the S1D13700.
//
//  PARAMETERS:
//		pMem - Pointer to receive the address of the first byte of display
//			   memory.
//		pReg - Pointer to receive the address of the first byte of register
//			   space.
//
//  RETURNS:
//		TRUE if the routine is able to locate an S1D13700.
//			*pMem will be the address of the first byte of display memory.
//			*pReg will be the address of the first 13700 control register.
//		FALSE if an S1D13700 is not located.
//			If additional error information is required call
//			halGetLastError().
//
//	MODIFIES:
//		This routine does not modify any register contents.
//---------------------------------------------------------------------------
Boolean halAcquireController( UInt32 * pMem, UInt32 * pReg )
{
	static Boolean fFirstTime = FALSE;
	gHD.nErrorCode = ERR_NONE;
	// Init, one time, default state of debug register writes flag.
	if( !fFirstTime )
	{
		fFirstTime = TRUE;
#ifdef _DEBUG
		gHD.fDebugHalDelay = gHD.fDebugRegWrites = !!(HalInfo.dwFlags & fDEBUG_REG_WRITES);
#else
		gHD.fDebugHalDelay = gHD.fDebugRegWrites = FALSE;
#endif
	}

		if ( HalInfo.dwFlags & fPCCARD_INTERFACE )
		{
			// force to PCI addressing
			gHD.BaseAddress = 0;
			HalInfo.dwRegisterOffset = 0;
		}

	// Use the configured base address to retrieve the virtual address, if any.  On
	// non-Windows platforms, the base address will be copied to the virtual address.

	if( gHD.BaseAddress == 0 )		// Only do this once, so we are re-entrant.
	{
		gHD.nErrorCode = halpMapPhysicalToVirtual( HalInfo.dwBaseAddress, &gHD.BaseAddress, &gHD.BlockSize );

		if( gHD.nErrorCode != ERR_NONE )
		{
			gHD.BaseAddress = 0;
			return FALSE;
		}

		if ( HalInfo.dwFlags & fPCCARD_INTERFACE )
		{
			gHD.MemoryAddress	= gHD.BaseAddress;
			gHD.RegisterAddress	= gHD.BaseAddress + 0x8000UL * 2; //0x8000 is the offset of reg base addr from video mem bas eaddr 
		}
 		else
		{

			gHD.RegisterAddress = gHD.BaseAddress + HalInfo.dwRegisterOffset;
			// If the configured register and memory offsets are the same, assume we are
			// using the PCI evaluation board, and default the memory offset accordingly.
			gHD.MemoryAddress = gHD.BaseAddress + HAL_PCI_VRAM_OFFSET;
		}
	}

#ifndef HAL_SIMULATE
	if( (HalInfo.dwFlags & fINDIRECT_INTERFACE) )
		halpInitIndirectInterface( gHD.MemoryAddress );
#else
	HalInfo.dwFlags &= ~fINDIRECT_INTERFACE;	// In simulate mode, don't simulate any indirect interface!
#endif

	if( pReg )  *pReg = gHD.RegisterAddress;
	if( pMem )	*pMem = gHD.MemoryAddress;
	//
	return TRUE;
}


//---------------------------------------------------------------------------
//  FUNCTION:		halInitController()
//
//  DESCRIPTION:
//		This routine performs the initialization portion of the startup
//		sequence.
//
//		Initialization consists of several steps:
//			- Programming the ICD2061A clock generator
//			- Setting the contol registers the state defined by CFG.
//			- Setting the LUT to its default value.
//			- Clearing video memory
//
//		Parameters passed in dwFlags can cause any or all of these steps to
//		be bypassed. This allows for run-time operational changes.
//
//  PARAMETERS:
//		Flags	- contains initialization specific information.
//
//  RETURNS:
//		TRUE if the initialization was successful.
//		FALSE if the HAL was unable to initialize the S1D13700
//
//		If additional error information is required call halGetLastError()
//
//	MODIFIES:
//		Nearly every register and all display memory can or will be affected.
//---------------------------------------------------------------------------
Boolean halInitController( UInt32 Flags )
{
	gHD.nErrorCode = ERR_NONE;
	// If the program has not been CFGed then we CANNOT init the controller.
	// Set and error code and return FALSE.


	// If the program has not been CFGed then we CANNOT init the controller.
	// Set and error code and return FALSE. 
#ifndef HAL_SIMULATE
	if ( HalInfo.wHalCRC == 0x0000 )
	{
		gHD.nErrorCode = ERR_NOT_CONFIGURED;
		return FALSE;
	}

#if 0
	When registers' value are changed, the CRC of HalInfo will changed and result in CRC incorrect.
	gHD.nErrorCode is not checked, instead gnHalErrorCode is checked. Should gHD.nErrorCode be gnHalErrorCode ?
	remove the following code for above reason.
	// CRC is not zero so we have been configured. Check that the CRC
	// and the data match.
	if ( !(Flags & fDONT_CHECK_CRC) && HalInfo.wHalCRC != CalculateHalInfoCRC(&HalInfo) )
	{
		gHD.nErrorCode = ERR_BAD_CFG_DATA;
		return FALSE;
	}
#endif
#endif

	// Fail if halAcquireController() was not called, or if it failed.
	if ( gHD.BaseAddress == 0 )
	{
		gHD.nErrorCode = ERR_NOT_ACQUIRED;
		return FALSE;
	}

	gHD.fDebugHalDelay = FALSE;		// Don't debug delays during init, as they are special-cased!
	DEBUGMSG( TRUE, ("   List of HAL Initialization Events:\n") );

	// Init the registers - unless the caller has requested us not to
	if ( !(Flags & fDONT_INIT_REGS) )
	{
		InitRegisters();
		DEBUGMSG( TRUE, ("   - Registers initialized as per configured settings.\n") );
	}
	else
		DEBUGMSG( TRUE, ("   - Registers NOT initialized!\n") );

	// Clear video memory - unless the caller has requested us not to
	if ( !(Flags & fDONT_CLEAR_MEM) )
	{
		ClearVideoMemory();
		DEBUGMSG( TRUE, ("   - All video memory cleared to 00h.\n") );
	}
	else
		DEBUGMSG( TRUE, ("   - Video memory NOT cleared!\n") );

	gHD.fDebugHalDelay = gHD.fDebugRegWrites;

	return ( gHD.nErrorCode == ERR_NONE );
}


//===========================================================================
//                              Memory Access
//===========================================================================

//	*** NOTE ***
//
//	The memory access routines do not perform any error checking. This means:
//	 1) NEVER call these routines if halAcquireController() did not succeed.
//	 2) Memory boundaries are not checked. It is possible to request a read
//		or write outside of display memory.


//-----------------------------------------------------------------------------
// COMMON FUNCTION: halReadDisplay8()
// COMMON FUNCTION: halReadDisplay16()
// COMMON FUNCTION: halReadDisplay32()
//-----------------------------------------------------------------------------
UInt8 halReadDisplay8( UInt32 Offset )
{
	if ( HalInfo.dwFlags & fPCCARD_INTERFACE )
	{
		if( HalInfo.dwFlags & fINDIRECT_INTERFACE )
			return halpIndReadDisplay8( (UInt16)(Offset*2) );
		else
			return *(pvUInt8)(gHD.MemoryAddress + (Offset*2));
	}
	else
	{
		if( HalInfo.dwFlags & fINDIRECT_INTERFACE )
			return halpIndReadDisplay8( (UInt16)Offset );
		else
			return *(pvUInt8)(gHD.MemoryAddress + Offset);
	}
}


UInt16 halReadDisplay16( UInt32 Offset )
{
	if ( HalInfo.dwFlags & fPCCARD_INTERFACE )
	{
		if( HalInfo.dwFlags & fINDIRECT_INTERFACE )
			return halpIndReadDisplay16( (UInt16)(Offset*2) );
		else
		{
			UInt16  wRetVal;
			
			wRetVal  =  *(pvUInt8)(gHD.MemoryAddress + Offset*2);
			wRetVal |= (*(pvUInt8)(gHD.MemoryAddress + (Offset + 1)*2))<<8;

			return wRetVal;
		}
	}
	else
	{
		if( HalInfo.dwFlags & fINDIRECT_INTERFACE )
			return halpIndReadDisplay16( (UInt16)Offset );
		else
		{
			UInt16  wRetVal;
			
			wRetVal  =  *(pvUInt8)(gHD.MemoryAddress + Offset);
			wRetVal |= (*(pvUInt8)(gHD.MemoryAddress + Offset + 1))<<8;

			return wRetVal;
		}
	}
}


UInt32 halReadDisplay32( UInt32 Offset )
{
	if ( HalInfo.dwFlags & fPCCARD_INTERFACE )
	{
		if( HalInfo.dwFlags & fINDIRECT_INTERFACE )
			return halpIndReadDisplay32( (UInt16)(Offset*2) );
		else
		{
			UInt32  dwRetVal;

			dwRetVal  =  *(pvUInt8)(gHD.MemoryAddress + Offset*2);
			dwRetVal |= (*(pvUInt8)(gHD.MemoryAddress + (Offset + 1)*2))<< 8;
			dwRetVal |= (*(pvUInt8)(gHD.MemoryAddress + (Offset + 1)*2))<<16;
			dwRetVal |= (*(pvUInt8)(gHD.MemoryAddress + (Offset + 1)*2))<<24;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区精品在线观看| 本田岬高潮一区二区三区| 日本道在线观看一区二区| 中文字幕高清不卡| 国产高清无密码一区二区三区| 欧美一区二区三区四区高清| 偷窥国产亚洲免费视频| 在线播放中文字幕一区| 最新不卡av在线| 国产麻豆一精品一av一免费 | 日韩电影在线观看电影| 在线观看三级视频欧美| 视频一区欧美日韩| 久久久久国产精品麻豆| 91视频免费播放| 免费在线观看成人| 中文字幕一区二区三区在线不卡 | 一区二区视频在线| 欧美老女人第四色| 岛国av在线一区| 亚洲综合色视频| 精品国产一二三| 99久久99久久精品国产片果冻| 五月天精品一区二区三区| 久久噜噜亚洲综合| 欧美中文字幕一区二区三区亚洲| 男男成人高潮片免费网站| 国产精品三级在线观看| 欧美区在线观看| 成人精品一区二区三区四区 | 久久aⅴ国产欧美74aaa| 亚洲视频 欧洲视频| 精品毛片乱码1区2区3区| 91麻豆.com| 国产精品中文字幕一区二区三区| 一区二区三区不卡在线观看| 国产亚洲欧美日韩日本| 欧美精品丝袜久久久中文字幕| 成人午夜伦理影院| 另类小说色综合网站| 一区二区三区资源| 国产精品美女久久久久久| 日韩免费高清视频| 欧美精品粉嫩高潮一区二区| eeuss鲁一区二区三区| 国内精品在线播放| 日韩成人一区二区| 亚洲一区二区精品视频| 国产精品久久久久国产精品日日| 日韩无一区二区| 在线播放/欧美激情| 色94色欧美sute亚洲线路一ni | 欧美伊人久久久久久久久影院 | 国产成人精品一区二| 日韩av不卡一区二区| 一区二区高清视频在线观看| 国产精品美女久久久久aⅴ| 精品免费99久久| 日韩一区二区三区四区| 欧美精品xxxxbbbb| 欧美日韩国产欧美日美国产精品| 9久草视频在线视频精品| 国产91对白在线观看九色| 激情综合五月婷婷| 极品少妇xxxx精品少妇| 久久99精品国产麻豆不卡| 奇米影视7777精品一区二区| 日韩成人免费在线| 青青草原综合久久大伊人精品 | 日韩精品中文字幕在线不卡尤物| 欧美日韩国产首页| 制服丝袜中文字幕一区| 欧美精品日韩精品| 日韩欧美在线一区二区三区| 日韩午夜小视频| 精品999久久久| 久久久国际精品| 中日韩免费视频中文字幕| 中文字幕国产一区二区| 最新国产の精品合集bt伙计| 亚洲人成伊人成综合网小说| 一区二区三区精密机械公司| 一区二区不卡在线播放| 五月天久久比比资源色| 麻豆精品久久久| 国产成a人亚洲精| 成人av网站大全| 欧美三区在线观看| 日韩三级伦理片妻子的秘密按摩| 欧美一区二区三区视频免费播放| 日韩欧美在线不卡| 国产亚洲精品资源在线26u| 中文字幕av免费专区久久| 中文字幕第一区综合| 亚洲激情欧美激情| 蜜桃一区二区三区在线| 国产成人av电影| 91亚洲精品久久久蜜桃网站| 欧美午夜精品电影| 日韩精品一区二区三区中文不卡| 国产欧美视频在线观看| 亚洲精品国产无套在线观 | 另类专区欧美蜜桃臀第一页| 精品一区二区免费看| 国产a精品视频| 欧美日韩在线三区| 2024国产精品| 亚洲卡通欧美制服中文| 蜜臀精品久久久久久蜜臀| 国产成人av电影在线播放| 欧美视频一二三区| 欧美精品一区二区蜜臀亚洲| 日韩美女精品在线| 麻豆国产精品官网| 色狠狠一区二区| 精品国产区一区| 亚洲激情中文1区| 狠狠色综合播放一区二区| 在线一区二区三区| 久久婷婷成人综合色| 亚洲一级电影视频| 国产宾馆实践打屁股91| 91精品一区二区三区在线观看| 亚洲国产精品成人久久综合一区| 亚欧色一区w666天堂| 成人av在线播放网址| 91精品欧美综合在线观看最新| 国产精品国产三级国产aⅴ入口| 日韩精品一区第一页| 成人精品亚洲人成在线| 精品人在线二区三区| 一个色妞综合视频在线观看| 国产成人av一区二区三区在线| 欧美人牲a欧美精品| 亚洲日本护士毛茸茸| 国内一区二区视频| 欧美一级高清片| 亚洲自拍偷拍综合| 色综合久久久久综合体 | 亚洲日穴在线视频| 国产福利一区二区三区视频| 欧美一区二区三区视频免费播放| 亚洲精品自拍动漫在线| thepron国产精品| 日本一区二区免费在线观看视频 | 国产亚洲1区2区3区| 日本欧美一区二区| 在线播放一区二区三区| 亚洲一区二区三区四区在线免费观看 | 久久99精品久久久久久| 欧美一二三区在线| 日日摸夜夜添夜夜添亚洲女人| 91啪在线观看| 日韩一区欧美小说| 成人av电影在线| 欧美国产日韩在线观看| 国产精品一二三| 国产性做久久久久久| 国产suv精品一区二区883| 国产午夜精品一区二区三区四区| 国产一区欧美一区| 久久久不卡影院| 成人一区二区视频| 中文在线资源观看网站视频免费不卡 | 正在播放一区二区| 日本aⅴ免费视频一区二区三区| 在线播放日韩导航| 美美哒免费高清在线观看视频一区二区 | 国产黄色精品视频| 国产精品网站一区| eeuss鲁片一区二区三区在线看| 国产精品久久久久久久浪潮网站| 成人激情免费电影网址| 亚洲同性gay激情无套| 色狠狠综合天天综合综合| 亚洲一二三四在线| 日韩一区二区三| 国产麻豆精品在线观看| 国产精品理伦片| 色哟哟精品一区| 午夜精品视频在线观看| 51久久夜色精品国产麻豆| 九九国产精品视频| 国产亚洲污的网站| 91美女片黄在线观看91美女| 亚洲bt欧美bt精品777| 精品免费视频.| 波多野结衣精品在线| 亚洲福利一区二区三区| 日韩精品中文字幕在线不卡尤物| 国产精品一区在线观看乱码| 椎名由奈av一区二区三区| 欧美日本一区二区在线观看| 韩国理伦片一区二区三区在线播放| 国产蜜臀av在线一区二区三区| 在线观看av一区| 国内久久婷婷综合| 亚洲最新视频在线播放| 日韩写真欧美这视频| 99精品久久99久久久久|