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

📄 hal_indirect.h

📁 s1d13716的源码 windiws ce 或8位单片机
💻 H
字号:
//===========================================================================
//	HAL_INDIRECT.H
// (Tabs set to every 4)
//---------------------------------------------------------------------------
//  Copyright (c) 2003 Epson Research and Development, Inc.
//  All Rights Reserved.
//===========================================================================


#ifndef __HAL_INDIRECT_H__
#define __HAL_INDIRECT_H__

#include "datatype.h"


typedef struct tagHalIndStruct
{
	pvUInt8		pIndex8;
	pvUInt8		pData8;

	pvUInt16	pIndex16;
	pvUInt16	pData16;
	//
} HALIND_STRUCT, *PHALIND_STRUCT;


// Allow both standard C and C++ linkages.
#ifdef __cplusplus
   extern "C" {
#endif

#define SER_NOP			0x00
#define SER_SET_ADDR	0x40
#define SER_WRITE		0x80
#define SER_READ		0xC0

#ifndef LOBYTE
	#define LOBYTE(w)           ((UInt8)(w))
#endif
#ifndef HIBYTE
	#define HIBYTE(w)           ((UInt8)(((UInt16)(w) >> 8) & 0xFF))
#endif
#ifndef LOWORD
	#define LOWORD(w)           ((UInt16)(w))
#endif
#ifndef HIWORD
	#define HIWORD(w)           ((UInt16)(((UInt32)(w) >> 16) & 0xFFFF))
#endif

#ifndef MAKEWORD
	#define MAKEWORD(a, b)      ((UInt16)(((UInt8)(a)) | ((UInt16)((UInt8)(b))) << 8))
#endif
#ifndef MAKELONG
	#define MAKELONG(a, b)      ((UInt32)(((UInt16)(a)) | ((UInt32)((UInt16)(b))) << 16))
#endif




//----------------------------------------------------------------------------
// The following are internal functions to support the 13713 indirect
// interface. The 13713 supports two indirect methods, dubbed serial
// and parallel.
//----------------------------------------------------------------------------

//---------------------------------------------------------------------------
//	Call this function to initialize the indirect interface
//---------------------------------------------------------------------------
void halpIndirectInit( UInt32 RegAddr );


//---------------------------------------------------------------------------
//	Write control registers using indirect parallel I/O
//---------------------------------------------------------------------------
void halpParWriteReg8( UInt32 index, UInt8 value );
void halpParWriteReg16( UInt32 index, UInt16 value );
void halpParWriteReg32( UInt32 index, UInt32 value );


//---------------------------------------------------------------------------
//	Read control registers using indirect parallel I/O
//---------------------------------------------------------------------------
UInt8  halpParReadReg8( UInt32 index );
UInt16 halpParReadReg16( UInt32 index );
UInt32 halpParReadReg32( UInt32 index );


//---------------------------------------------------------------------------
//	Write to display memory using indirect parallel I/O
//---------------------------------------------------------------------------
void halpParWriteDisplay8( UInt32 addr, UInt8 data, UInt32 count );
void halpParWriteDisplay16( UInt32 addr, UInt16 data, UInt32 count );
void halpParWriteDisplay32( UInt32 addr, UInt32 data, UInt32 count );


//---------------------------------------------------------------------------
//	Read display memory using indirect parallel I/o
//---------------------------------------------------------------------------
UInt8  halpParReadDisplay8( UInt32 addr );
UInt16 halpParReadDisplay16( UInt32 addr );
UInt32 halpParReadDisplay32( UInt32 addr );


//---------------------------------------------------------------------------
//	Write registers using indirect serial I/O
//---------------------------------------------------------------------------
void halpSerWriteReg8( UInt32 index, UInt8 value );
void halpSerWriteReg16( UInt32 index, UInt16 value );
void halpSerWriteReg32( UInt32 index, UInt32 value );


//---------------------------------------------------------------------------
//	Read registers using indirect serial I/O
//---------------------------------------------------------------------------
UInt8  halpSerReadReg8( UInt32 index );
UInt16 halpSerReadReg16( UInt32 index );
UInt32 halpSerReadReg32( UInt32 index );


//---------------------------------------------------------------------------
//	Write display memory using indirect serial I/O
//---------------------------------------------------------------------------
void halpSerWriteDisplay8( UInt32 addr,  UInt8 data, UInt32 count );
void halpSerWriteDisplay16( UInt32 addr, UInt16 data, UInt32 count );
void halpSerWriteDisplay32( UInt32 addr, UInt32 data, UInt32 count );


//---------------------------------------------------------------------------
//	Read display memory using indirect serial I/O
//---------------------------------------------------------------------------
UInt8 halpSerReadDisplay8( UInt32 addr );
UInt16 halpSerReadDisplay16( UInt32 addr );
UInt32 halpSerReadDisplay32( UInt32 addr );


//---------------------------------------------------------------------------
//	Read/Write using auto increment
//---------------------------------------------------------------------------
void halpSerReadData( int Size, UInt32 Offset, void* pData, UInt32 Count );
void halpParReadData( int Size, UInt32 Offset, void* pData, UInt32 Count );
void halpSerWriteData( int Size, UInt32 Offset, const void* pData, UInt32 Count );
void halpParWriteData( int Size, UInt32 Offset, const void* pData, UInt32 Count );


//---------------------------------------------------------------------------
//	Set up display addresses for use by other routines
//---------------------------------------------------------------------------
void IndirectSetDisplayAddr( UInt32 addr, UInt8 SerialDir );
static void SetDisplayAddrParallel( UInt32 addr );
static void SetDisplayAddrSerial( UInt32 addr );


#ifdef __cplusplus
   }
#endif


#endif	//__HAL_INDIRECT_H__

⌨️ 快捷键说明

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