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

📄 lcdlib.h

📁 三星s3c2460开发板完整功能测试代码
💻 H
字号:
/************************************************ 
  NAME    : LCDLIB.H
  DESC    :
  History  :  2004.01.10 : draft ver 0.0
 ************************************************/

#ifndef __LCDLIB_H__
#define __LCDLIB_H__

#ifdef __cplusplus
extern "C"{
#endif

#include "Option.h"

#define nCS		1 //XgpIO6
#define SCLK		2 //GPIO5
#define SDI		3 //GPIO4
#define ALL		4

#define BPP1			0
#define BPP2			1
#define BPP4			2
#define BPP8			3
#define BPP8_NP		4
#define BPP16_565	5
#define BPP16_5551	6
#define BPP24		7


// Palette Mode
#define PAL_666_1BPP		(0x11)
#define PAL_666_2BPP		(0x12)
#define PAL_666_4BPP		(0x14)
#define PAL_666_8BPPBG		(0x18)
#define PAL_666_8BPPFG		(0x1a)
#define PAL_565_1BPP		(0x21)	
#define PAL_565_2BPP		(0x22)
#define PAL_565_4BPP		(0x24)
#define PAL_565_8BPPBG		(0x28)
#define PAL_565_8BPPFG		(0x2a)
#define PAL_5551_1BPP		(0x41)
#define PAL_5551_2BPP		(0x42)
#define PAL_5551_4BPP		(0x44)
#define PAL_5551_8BPPBG	(0x48)
#define PAL_5551_8BPPFG	(0x4a)

#define COMPKEY(n)		((n)&0xFFFFFF)
#define LCDBASEL(n) 		((n)&0xFFFFFF)	// To get lower 24 bits
#define COLVAL(n)		((n)&0xFFFFFF)
#define BGCOLOR(n)		((n)&0xFFFF)
#define FGCOLOR(n)		((n)&0xFFFF)


//Serial TFT LCD Panel(176x220)
#define MODE_SER_1BIT_176220			(0x1100)
#define MODE_SER_2BIT_176220			(0x1101)
#define MODE_SER_4BIT_176220			(0x1102)
#define MODE_SER_8BIT_176220			(0x1103)
#define MODE_SER_8BITNP_176220		(0x1104)
#define MODE_SER_16BIT565_176220		(0x1105)
#define MODE_SER_16BIT5551_176220		(0x1106)
#define MODE_SER_24BIT_176220			(0x1107)
//Serail TFT LCD Panel(2408320) 2004.06.16
#define MODE_SER_1BIT_240320			(0x1200)
#define MODE_SER_2BIT_240320			(0x1201)
#define MODE_SER_4BIT_240320			(0x1202)
#define MODE_SER_8BIT_240320			(0x1203)
#define MODE_SER_8BITNP_240320		(0x1204)
#define MODE_SER_16BIT565_240320		(0x1205)
#define MODE_SER_16BIT5551_240320		(0x1206)
#define MODE_SER_24BIT_240320			(0x1207)
//Parallel TFT LCD Panel(176x220)
#define MODE_PAR_1BIT_176220			(0x2100)
#define MODE_PAR_2BIT_176220			(0x2101)
#define MODE_PAR_4BIT_176220			(0x2102)
#define MODE_PAR_8BIT_176220			(0x2103)
#define MODE_PAR_8BITNP_176220		(0x2104)
#define MODE_PAR_16BIT565_176220		(0x2105)
#define MODE_PAR_16BIT5551_176220		(0x2106)
#define MODE_PAR_24BIT_176220			(0x2107)
//Parallel TFT LCD Panel(240x320)
#define MODE_PAR_1BIT_240320			(0x2200)
#define MODE_PAR_2BIT_240320			(0x2201)
#define MODE_PAR_4BIT_240320			(0x2202)
#define MODE_PAR_8BIT_240320			(0x2203)
#define MODE_PAR_8BITNP_240320		(0x2204)
#define MODE_PAR_16BIT565_240320		(0x2205)
#define MODE_PAR_16BIT5551_240320		(0x2206)
#define MODE_PAR_24BIT_240320			(0x2207)
//Parallel TFT LCD Panel(320x240)
#define MODE_PAR_16BIT565_320240		(0x2305)
#define MODE_PAR_24BIT_320240			(0x2307)
//Parallel TFT LCD Panel(640x480)
#define MODE_PAR_1BIT_640480			(0x2400)
#define MODE_PAR_2BIT_640480			(0x2401)
#define MODE_PAR_4BIT_640480			(0x2402)
#define MODE_PAR_8BIT_640480			(0x2403)
#define MODE_PAR_8BITNP_640480		(0x2404)
#define MODE_PAR_16BIT565_640480		(0x2405)
#define MODE_PAR_16BIT5551_640480		(0x2406)
#define MODE_PAR_24BIT_640480			(0x2407)
//Parallel TFT LCD Panel(800x600)
#define MODE_PAR_1BIT_800600			(0x2800)
#define MODE_PAR_2BIT_800600			(0x2801)
#define MODE_PAR_4BIT_800600			(0x2802)
#define MODE_PAR_8BIT_800600			(0x2803)
#define MODE_PAR_8BITNP_800600		(0x2804)
#define MODE_PAR_16BIT565_800600		(0x2805)
#define MODE_PAR_16BIT5551_800600		(0x2806)
#define MODE_PAR_24BIT_800600			(0x2807)

//OSD 176x220
#define MODE_OSD_8BIT_176220			(0x4103)
#define MODE_OSD_8BITNP_176220		(0x4104)
#define MODE_OSD_16BIT565_176220		(0x4105)
#define MODE_OSD_16BIT5551_176220	(0x4106)
#define MODE_OSD_24BIT_176220			(0x4107)
//OSD 240x320
#define MODE_OSD_8BIT_240320			(0x4203)
#define MODE_OSD_8BITNP_240320		(0x4204)
#define MODE_OSD_16BIT565_240320		(0x4205)
#define MODE_OSD_16BIT5551_240320	(0x4206)
#define MODE_OSD_24BIT_240320			(0x4207)
//OSD 640x480
#define MODE_OSD_8BIT_640480			(0x4403)
#define MODE_OSD_8BITNP_640480		(0x4404)
#define MODE_OSD_16BIT565_640480		(0x4405)
#define MODE_OSD_16BIT5551_640480	(0x4406)
#define MODE_OSD_24BIT_640480			(0x4407)
//OSD 800x600
#define MODE_OSD_8BIT_800600			(0x4803)
#define MODE_OSD_8BITNP_800600		(0x4804)
#define MODE_OSD_16BIT565_800600		(0x4805)
#define MODE_OSD_16BIT5551_800600	(0x4806)
#define MODE_OSD_24BIT_800600			(0x4807)

#define MODE_MANUAL					(0x8000)
#define MODE_NO_VIRTUAL_16B			(0x10)
#define MODE_NO_VIRTUAL_24B			(0x20)
#define MODE_MPEG_DISPLAY_16B			(0x40)
#define MODE_MPEG_DISPLAY_24B			(0x80)




//TFT 176x220
#define BG_XSIZE_176220		(176)	
//#define BG_YSIZE_176220		(220)
#define BG_YSIZE_176220		(192)

//TFT 240x320
#define BG_XSIZE_240320		(240)	
#define BG_YSIZE_240320		(320)
//TFT 320x240
#define BG_XSIZE_320240		(320)	
#define BG_YSIZE_320240		(240)
//TFT 640x480
#define BG_XSIZE_640480		(640)	
#define BG_YSIZE_640480		(480)
//TFT 800x600
#define BG_XSIZE_800600		(800)	
#define BG_YSIZE_800600		(600)


//TFT 176x220
#define BG_VXSIZE_176220	(BG_XSIZE_176220*2)
#define BG_VYSIZE_176220	(BG_YSIZE_176220*2)
//TFT 240x320
#define BG_VXSIZE_240320	(BG_XSIZE_240320*2)
#define BG_VYSIZE_240320	(BG_YSIZE_240320*2)
//TFT 320x240
#define BG_VXSIZE_320240	(BG_XSIZE_320240*2)
#define BG_VYSIZE_320240	(BG_YSIZE_320240*2)
//TFT 640x480
#define BG_VXSIZE_640480	(BG_XSIZE_640480*2)
#define BG_VYSIZE_640480	(BG_YSIZE_640480*2)
//TFT 800x600
#define BG_VXSIZE_800600	(BG_XSIZE_800600*2)
#define BG_VYSIZE_800600	(BG_YSIZE_800600*2)

//OSD 176x220
#define FG_XSIZE_176220		(BG_XSIZE_176220/2)
#define FG_YSIZE_176220		(BG_YSIZE_176220/2)
//OSD 240x320
#define FG_XSIZE_240320		(BG_XSIZE_240320/2)
#define FG_YSIZE_240320		(BG_YSIZE_240320/2)
//OSD 640x480
#define FG_XSIZE_640480		(BG_XSIZE_640480/2)
#define FG_YSIZE_640480		(BG_YSIZE_640480/2)
//OSD 800x600
#define FG_XSIZE_800600		(BG_XSIZE_800600/2)
#define FG_YSIZE_800600		(BG_YSIZE_800600/2)


//OSD 176x220
#define FG_VXSIZE_176220		(FG_XSIZE_176220*2)
#define FG_VYSIZE_176220		(FG_YSIZE_176220*2)
//OSD 240x320
#define FG_VXSIZE_240320		(FG_XSIZE_240320*2)
#define FG_VYSIZE_240320		(FG_YSIZE_240320*2)
//OSD 640x480
#define FG_VXSIZE_640480		(FG_XSIZE_640480*2)
#define FG_VYSIZE_640480		(FG_YSIZE_640480*2)
//OSD 800x600
#define FG_VXSIZE_800600		(FG_XSIZE_800600*2)
#define FG_VYSIZE_800600		(FG_YSIZE_800600*2)


//TFT176x220
#define HOZVAL_176220			(BG_XSIZE_176220-1)
#define LINEVAL_176220			(BG_YSIZE_176220-1)
//TFT240x320
#define HOZVAL_240320			(BG_XSIZE_240320-1)
#define LINEVAL_240320			(BG_YSIZE_240320-1)
//TFT320x240
#define HOZVAL_320240			(BG_XSIZE_320240-1)
#define LINEVAL_320240			(BG_YSIZE_320240-1)
//TFT640x480
#define HOZVAL_640480			(BG_XSIZE_640480-1)
#define LINEVAL_640480			(BG_YSIZE_640480-1)
//TFT800x600
#define HOZVAL_800600			(BG_XSIZE_800600-1)
#define LINEVAL_800600			(BG_YSIZE_800600-1)


//Timing parameter for LTS222Q1-HF1(SAMSUNG 240x320) 2004.06.16
#define VBPD_SER_240320			((3-1)&0xff)
//#define VBPD_SER_240320			((7-1)&0xff)
#define VFPD_SER_240320			((10-1)&0xff)
#define VSPW_SER_240320			((3-1) &0xff)
#define HBPD_SER_240320			((9-1)&0xff)
//#define HBPD_SER_240320			((6-1)&0xff)
#define HFPD_SER_240320			((6-1)&0xff)
#define HSPW_SER_240320			((3-1)&0xff)
//Timing parameter for LTS203Q1(SAMSUNG)
#define VBPD_176220					((5-1)&0xff)
#define VFPD_176220					((7-1)&0xff)
#define VSPW_176220				((4-1)&0xff)
#define HBPD_176220					((12-1)&0xff)
#define HFPD_176220					((24-1)&0xff)
#define HSPW_176220				((12-1)&0xff)
//Timing parameter for LTS222(SAMSUNG) 
#define VBPD_240320					((2-1)&0xff)
#define VFPD_240320					((3-1)&0xff)
#define VSPW_240320				((2-1) &0xff)
#define HBPD_240320					((7-1)&0xff)
#define HFPD_240320					((3-1)&0xff)
#define HSPW_240320				((4-1)&0xff)
//Timing parameter for LTV350(SAMSUNG) 
#define VBPD_320240					((5-1)&0xff)
#define VFPD_320240					((3-1)&0xff)
#define VSPW_320240				((4-1) &0xff)
#define HBPD_320240					((5-1)&0xff)
#define HFPD_320240					((3-1)&0xff)
#define HSPW_320240				((10-1)&0xff)
//Timing parameter for V16C6448AB(PRIME VIEW) 
#define VBPD_640480					((33-1)&0xff)
#define VFPD_640480					((10-1)&0xff)
#define VSPW_640480				((2-1) &0xff)
#define HBPD_640480					((48-1)&0xff)
#define HFPD_640480					((16-1)&0xff)
#define HSPW_640480				((96-1)&0xff)
//Timing parameter for 800x600
#define VBPD_800600					((33-1)&0xff)
#define VFPD_800600					((10-1)&0xff)
#define VSPW_800600				((2-1) &0xff)
#define HBPD_800600					((48-1)&0xff)
#define HFPD_800600					((16-1)&0xff)
#define HSPW_800600				((96-1)&0xff)


#define CLKVAL_SER_176220	(6) //for S3C2460X
//#define CLKVAL_TFT_176192	(4) 	
    // 85.9hz @HCLK=105Mhz, VCLK=10.5Mhz
//#define CLKVAL_TFT_176192	(5) 	
    // 71.6hz @HCLK=105Mhz, VCLK=8.75Mhz
#define CLKVAL_SER_240320	(4) 	// 2004.06.16 
// 2 : 68hz, VCLK=17Mhz @HCLK=102Mhz
// 3 : 51hz, VCLK=12.8Mhz @HCLK=102Mhz
// 4 : 41hz, VCLK=10.2Mhz @HCLK=102Mhz
    
#define CLKVAL_PAR_176220	(6) //for S3C2460X
//#define CLKVAL_PAR_240320	(12) 	
    // 60hz @135Mhz
    //HBPD=6VCLK,HFPD=2VCLK,HSPW=3VCLK
    //VBPD=1HSYNC,VFPD=2HSYNC,VSPW=1HSYNC
#define CLKVAL_PAR_240320	(9) 	// 5.1MHz(VCLK) @102MHz(HCLK)
//60hz @90Mhz
//#define CLKVAL_PAR_240320	(5) 	
    // 67.7hz @67.5Mhz
    // 90hz @90Mhz
    //HBPD=6VCLK,HFPD=2VCLK,HSPW=3VCLK
    //VBPD=1HSYNC,VFPD=2HSYNC,VSPW=1HSYNC    
#define CLKVAL_PAR_640480 	(1)
    //53.5hz @90Mhz
    //VSYNC,HSYNC should be inverted
    //HBPD=47VCLK,HFPD=15VCLK,HSPW=95VCLK
    //VBPD=32HSYNC,VFPD=9HSYNC,VSPW=1HSYNC
#define CLKVAL_PAR_800600 	(1)


#define CLKVAL_PAR_320240	(9) 	// 5.1MHz(VCLK) @102MHz(HCLK)


#define COMPKEY_8BPP
#define COMPKEY_8BPPNP
#define COMPKEY_16BPP
#define COMPKEY_24BPP


// 1. The LCD frame buffer should be write-through or non-cachable.
// 2. The frame memory should be upto 16MB. (ex) 2048 x 2048, 24bpp[max]
#if 0
#define LCDFRAMEBUFFERBG1 0x11000000 //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERBG2 0x11000000 //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERFG1 0x11000000 //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERFG2 0x11000000 //_NONCACHE_STARTADDRESS 
#else
#define LCDFRAMEBUFFERBG1 (_NONCACHE_STARTADDRESS+0x00600000) //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERBG2 (LCDFRAMEBUFFERBG1+0x00200000) //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERFG1 (LCDFRAMEBUFFERBG2+0x00200000) //_NONCACHE_STARTADDRESS 
#define LCDFRAMEBUFFERFG2 (LCDFRAMEBUFFERFG1+0x00200000) //_NONCACHE_STARTADDRESS 
#endif


#define BGBUFFER1		(0)
#define BGBUFFER2		(1)
#define FGBUFFER1		(2)
#define FGBUFFER2		(3)
#define BGCOLORMAP		(4)
#define FGCOLORMAP		(5)

#define PNRMODE_PAR_RGB	(0)
#define PNRMODE_PAR_BGR	(1)
#define PNRMODE_SER_RGB	(2)
#define PNRMODE_SER_BGR	(3)

#define BPPMODE_1BPP		(0)
#define BPPMODE_2BPP		(1)
#define BPPMODE_4BPP		(2)
#define BPPMODE_8BPP		(3)
#define BPPMODE_8BPPNP		(4)
#define BPPMODE_16BPP565	(5)
#define BPPMODE_16BPP5551	(6)
#define BPPMODE_24BPP		(7)

#define FRAMESEL0_BACK		(0)
#define FRAMESEL0_VSYNC	(1)
#define FRAMESEL0_ACTIVE	(2)
#define FRAMESEL0_FRONT	(3)
#define FRAMESEL1_NONE		(0)
#define FRAMESEL1_BACK		(1)
#define FRAMESEL1_VSYNC	(2)
#define FRAMESEL1_FRONT	(3)

#define FIFOSEL_ALL			(0)
#define FIFOSEL_BG			(1)
#define FIFOSEL_FG			(2)

#define FIFOLEVEL_32		(0)
#define FIFOLEVEL_64		(1)
#define FIFOLEVEL_96		(2)
#define FIFOLEVEL_OR		(3)


#define OSD_BLENDING	(0)
#define OSD_COLORKEY	(1)

//extern volatile unsigned int DisplayType;
//extern volatile unsigned int WhichFrameBuffer;
extern unsigned int mpegframebuffer;



void LcdBGInit(unsigned int displaytype);
void PaletteInit(unsigned int type);
void LcdFGInit(unsigned int displaytype);
void LcdEnvidOnOff(unsigned int onoff);
void LcdEnvidOnOffDirect(unsigned int onoff);
void LcdSelectBuffer(unsigned int whichbuffer);
void LcdOsdEnDiable(unsigned int endiable);
void LcdOsdSetAlpha(unsigned int alpha);
void LcdOsdSelectFunction(unsigned int function);
void LcdOsdChangeCoordination(unsigned int topx, unsigned int topy, unsigned int botx, unsigned int boty);
void LcdDitheringEnDisable(unsigned int endisable);
void LcdBGColorMap(unsigned int endisable, unsigned int bgcolor);
void LcdFGColorMap(unsigned int endisable, unsigned int fgcolor);
void LcdColorKeyInit(unsigned int displaytype);
void LcdSetColorKey(unsigned int direction, unsigned int compkey, unsigned int colval);
void LcdSetFrameInterrupt(unsigned int framesel0, unsigned int framesel1);
void LcdEnableFrameInterrupt(unsigned int framesel0, unsigned int framesel1);
void LcdDisableFrameInterrupt(void);
void LcdEnableFifoInterrupt(unsigned int fifosel, unsigned int fifolevel);
void LcdDisableFifoInterrupt(void);
void LcdBacklightOnOff(unsigned char onoff);


void MoveViewPort(unsigned int displaytype, unsigned int whichframebuffer);
void LcdMoveViewPort(int vx,int vy, unsigned int displaytype, unsigned int whichframebuffer);


void SLcdGpioSet(unsigned char type, unsigned char data);
void SLcdRegSet(unsigned char IndexReg, unsigned short Inst);
void SLcdSpiSet(unsigned char RS, unsigned char RW, unsigned short data);
void SLcdPowerOn(void);
void SLcdPowerOff(void);
void SLcdInit1(void);
void SLcdInit2(void);
void SLcdPowerSet(void);
void SLcdDisplayOn(void);
void SLcdDisplayOff(void);
void SLcdInternalModeChange(void);
void SLcdRGBModeChange(void);
void SLcdSleep(void);
void SLcdSleepWakeUp(void);
void SLcdStangBy(void);
void SLcdStandByWakeUp(void);

void Init_320X240_AMLCD(void);	//added by Sue.060322


#ifdef __cplusplus
}
#endif

#endif /*__LCDLIB_H__*/

⌨️ 快捷键说明

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