chiplib.h
来自「是一个手机功能的模拟程序」· C头文件 代码 · 共 1,014 行 · 第 1/2 页
H
1,014 行
//===========================================================================
// chiplib.h
//---------------------------------------------------------------------------
//
// Copyright (c) 2002, 2003 Epson Research and Development, Inc.
// All Rights Reserved.
//
//===========================================================================
#ifndef __CHIPLIB_H__
#define __CHIPLIB_H__
#include "datatype.h"
#ifdef __cplusplus
extern "C" {
#endif
//
// The prefix "cl" means that the given definition is used in the chiplib library.
//
typedef enum
{
cl_MAIN_WINDOW = 0,
cl_OVERLAY_WINDOW
} WindowDef;
typedef enum
{
cl_PORT_ALL_OFF = 0,
cl_PORT_LCD1,
cl_PORT_LCD2,
cl_PORT_LCD3
} OutputPortDef;
//
// Note: cl_LUT_TEST_PATTERN can be logically OR'd with one of the preceding cl_LUT definitions
//
#define cl_LUT_ERROR 0x0000
#define cl_LUT_NOBYPASS_8BPP_256COLOR_LUT 0x0001
#define cl_LUT_NOBYPASS_16BPP_565LUT 0x0002
#define cl_LUT_BYPASS_8BPP_332RGB 0x0003
#define cl_LUT_BYPASS_16BPP_565RGB 0x0004
#define cl_LUT_TEST_PATTERN 0x8000
//---------------------------------------------------------------------------
// MACRO: RgbTo332()
//
// DESCRIPTION:
// This routine converts an RGB value to 3-3-2 format.
//
// PARAMETERS:
// red - value from 0 to 0xff
// green - value from 0 to 0xff
// blue - value from 0 to 0xff
//
// RETURNS:
// 8 bit value which is in 3-3-2 RGB format.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
#define RgbTo332(red, green, blue) (UInt8) ((((red) & 0xe0) | (((green) & 0xe0) >> 3) | (((blue) & 0xc0) >> 6)))
//---------------------------------------------------------------------------
// MACRO: RgbTo565()
//
// DESCRIPTION:
// This routine converts an RGB value to 5-6-5 format.
//
// PARAMETERS:
// red - value from 0 to 0xff
// green - value from 0 to 0xff
// blue - value from 0 to 0xff
//
// RETURNS:
// 16 bit value which is in 5-6-5 RGB format.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
#define RgbTo565(red, green, blue) (UInt16) ((((red) & 0xf8) << 8) | (((green) & 0xfc) << 3)) | (((blue) & 0xf8) >> 3)))
//---------------------------------------------------------------------------
// FUNCTION: InitChipLib()
//
// DESCRIPTION:
// This routine initializes the variables for the chip library functions.
//
// PARAMETERS:
// None.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
void InitChipLib( void );
//---------------------------------------------------------------------------
// FUNCTION: is13716Chip()
//
// DESCRIPTION:
// This routine checks whether the given LCD controller is this chip ID.
//
// PARAMETERS:
// None.
//
// RETURNS:
// TRUE if the LCD controller is configured for this chip ID.
// FALSE if the LCD controller is not configured for this chip ID.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
int is13716Chip( void );
//---------------------------------------------------------------------------
// FUNCTION: GetChipName()
//
// DESCRIPTION:
// This routine returns a pointer to the chip name from the HalInfo structure.
//
// PARAMETERS:
// None.
//
// RETURNS:
// Pointer to string.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
char *GetChipName( void );
//---------------------------------------------------------------------------
// FUNCTION: GetChipId()
//
// DESCRIPTION:
// This routine reads the product and revision code.
//
// PARAMETERS:
// pProductCode - pointer to product code. Caller must instantiate ProductCode.
// pRevisionCode - pointer to revision code. Caller must instantiate RevisionCode.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
void GetChipId( UInt32 *pProductCode, UInt32 *pRevisionCode );
//---------------------------------------------------------------------------
// FUNCTION: GetMemSize()
//
// DESCRIPTION:
// This routine determines the total amount of display memory.
//
// PARAMETERS:
// None.
//
// RETURNS:
// The amount of display memory, in bytes.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
UInt32 GetMemSize( void );
//---------------------------------------------------------------------------
// FUNCTION: SetBitsPerPixel()
//
// DESCRIPTION:
// This routine sets the bits-per-pixel state.
//
// PARAMETERS:
// bpp - the bits-per-pixel value, which must be one of the following:
// 8 or 16
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// REG[004C]
//---------------------------------------------------------------------------
void SetBitsPerPixel( WindowDef Window, int bpp );
//---------------------------------------------------------------------------
// FUNCTION: GetBitsPerPixel()
//
// DESCRIPTION:
// This routine reads the bits-per-pixel state for the Main Window
// or PIP+ Window.
//
// PARAMETERS:
// None.
//
// RETURNS:
// The bits-per-pixel value.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
int GetBitsPerPixel( WindowDef Window );
//---------------------------------------------------------------------------
// FUNCTION: SetLutEntry()
//
// DESCRIPTION:
// This routine writes an RGB entry into the Look-Up Table 1.
//
// PARAMETERS:
// addr - index into LUT.
// red - red component.
// green - green component.
// blue - blue component.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// REG[0400h+] Look-Up Table Registers
//---------------------------------------------------------------------------
void SetLutEntry( int addr, UInt8 red, UInt8 green, UInt8 blue );
//---------------------------------------------------------------------------
// FUNCTION: GetLutEntry()
//
// DESCRIPTION:
// This routine reads an RGB entry from the Look-Up Table 1.
//
// PARAMETERS:
// addr - index into LUT.
// pRed - pointer to red component. Caller must instantiate Red.
// pGreen - pointer to green component. Caller must instantiate Green.
// pBlue - pointer to blue component. Caller must instantiate Blue.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
void GetLutEntry( int addr, pUInt8 pRed, pUInt8 pGreen, pUInt8 pBlue );
//---------------------------------------------------------------------------
// FUNCTION: SetLut()
//
// DESCRIPTION:
// This routine writes an array of LUT values into Look-Up Table 1.
//
// PARAMETERS:
// pLut - pointer into LUT array. This one-dimensional array consists
// of a series of red, green, and blue values.
// size - the number of RGB triplets in the pLut array.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// REG[0400h+] Look-Up Table Registers
//---------------------------------------------------------------------------
void SetLut( pUInt8 pLut, int size );
//---------------------------------------------------------------------------
// FUNCTION: InitLut()
//
// DESCRIPTION:
// This routine initializes the LUT to default values.
//
// PARAMETERS:
// LutMode - cl_LUT_NOBYPASS_8BPP_256COLOR_LUT Program to standard 256 color LUT
// - cl_LUT_NOBYPASS_16BPP_565LUT Program LUT to simulate LUT bypass 5-6-5 RGB
// - cl_LUT_TEST_PATTERN Logically ORd with one of the above LUT selections
// to ensure that LUT supports TEST PATTERN image.
// RETURNS:
// Nothing.
//
// MODIFIES:
// REG[0400h-07FEh] Look-Up Table Registers
//---------------------------------------------------------------------------
void InitLut( UInt32 LutMode );
//---------------------------------------------------------------------------
// FUNCTION: GetStartAddress()
//
// DESCRIPTION:
// This routine returns the window start address in bytes.
//
// NOTE: The address returned by GetStartAddress() represents the
// offset address to the top left corner of the window's
// image in display memory.
//
// PARAMETERS:
// None.
//
// RETURNS:
// The window start address in bytes, where an address of 0 is
// the start of display memory.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
UInt32 GetStartAddress( WindowDef Window );
//---------------------------------------------------------------------------
// FUNCTION: SetStartAddress()
//
// DESCRIPTION:
// This routine set the window start address in UInt32.
//
// NOTE: The address pass to GetStartAddress() represents the
// offset address to the top left corner of the window's
// image in display memory.
//
// PARAMETERS:
// The window start address in Uint32, where an address of 0 is
// the start of display memory.
//
// RETURNS:
// None.
// The window start address in bytes, where an address of 0 is
// the start of display memory.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
void SetStartAddress( WindowDef Window,UInt32 Address );
//---------------------------------------------------------------------------
// FUNCTION: GetMemAddress()
//
// DESCRIPTION:
// This routine determines the address to the top left corner of the screen.
//
// PARAMETERS:
// BaseAddress - The display memory start address, which points to the
// beginning of display memory.
//
// RETURNS:
// The pointer to the top left corner of screen memory.
//
// MODIFIES:
// REG0240_OSADDR0,REG0241_OSADDR1,REG0242_OSADDR2
// or
// REG0224_YUVWRSTART0,REG0225_YUVWRSTART1,REG0226_YUVWRSTART2,
//---------------------------------------------------------------------------
UInt32 GetMemAddress( UInt32 BaseAddress );
//---------------------------------------------------------------------------
// FUNCTION: GetStride()
//
// DESCRIPTION:
// This routine gets the display Line Address Offset in bytes.
//
// PARAMETERS:
// None.
//
// RETURNS:
// The display stride in bytes.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
UInt32 GetStride( WindowDef Window );
//---------------------------------------------------------------------------
// FUNCTION: GetDisplayWidth()
// GetDisplayHeight()
//
// DESCRIPTION:
// These routines return the logical width and height of the display.
//
// PARAMETERS:
// None.
//
// RETURNS:
// The logical width or height of the display.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
int GetDisplayWidth( WindowDef Window );
int GetDisplayHeight( WindowDef Window );
//---------------------------------------------------------------------------
// FUNCTION: SetResizerSize()
//
// DESCRIPTION:
// This routine assigns a rectangular region to the resizer.
// The rectangle, defined by starting coordinates (xStart, yStart) and
// ending coordinates (xEnd, yEnd).
//
//
// PARAMETERS:
// xStart - Resizer Start X Position
// yStart - Resizer Start Y Position
// xEnd - Resizer End X Position
// yEnd - Resizer End Y Position
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// REG[0204h]-REG[020Bh]
//---------------------------------------------------------------------------
void SetResizerSize( UInt32 xStart, UInt32 yStart, UInt32 xEnd, UInt32 yEnd );
//---------------------------------------------------------------------------
// FUNCTION: GetResizerSize()
//
// DESCRIPTION:
// This routine gets the coordinates of the resizer.
// See SetResizerSize() for more information.
//
//
// PARAMETERS:
// *xStart - Resizer Start X Position
// *yStart - Resizer Start Y Position
// *xEnd - Resizer End X Position
// *yEnd - Resizer End Y Position
//
// NOTE: It is not necessary to provide all four pointers.
// If the given argument is not needed, set its respective
// pointer to NULL.
//
// RETURNS:
// Nothing.
//
// MODIFIES:
// Nothing.
//---------------------------------------------------------------------------
void GetResizerSize( pUInt32 xStart, pUInt32 yStart, pUInt32 xEnd, pUInt32 yEnd );
//----------------------------------------------------------------------------
// GetPllPowerDown()
//
// DESCRIPTION:
// This routine determines if the PLL is enabled or disabled.
//
// PARAMETERS:
// Nothing.
//
// RETURNS:
// TRUE if PLL is disabled.
// FALSE otherwise.
//
// MODIFIES:
// Nothing.
//
//----------------------------------------------------------------------------
Boolean GetPllPowerDown( void );
//---------------------------------------------------------------------------
// SetPll()
//
// DESCRIPTION:
// This routine will program the internal PLL to the specifed frequency.
//
// PARAMETERS:
// freq - The desired frequency (in Hz).
//
// RETURNS:
// TRUE if the function was successful in setting the PLL.
// FALSE if there was an error detected while trying to set the PLL.
//
// MODIFIES:
// REG[0010h]
// REG[0011h]
// REG[0012h]
// REG[0018h]
//
//---------------------------------------------------------------------------
Boolean SetPll( UInt32 freq );
//---------------------------------------------------------------------------
// GetPll()
//
// DESCRIPTION:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?