📄 lcdlib.h
字号:
/************************************************
NAME : LCDLIB.H
DESC :
History : 2004.01.10 : draft ver 0.0
************************************************/
#ifndef __LCDLIB_H__
#define __LCDLIB_H__
#ifdef __cplusplus
extern "C"{
#endif
#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 BPP18 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_18BIT_176220 (0x1107)
//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_18BIT_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_18BIT_240320 (0x2207)
//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_18BIT_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_18BIT_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_18BIT_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_18BIT_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_18BIT_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_18BIT_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 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 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)
//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 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 LTS350Q1(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 LTS222Q1-HF1(SAMSUNG)
#define VBPD_240320 ((9-1)&0xff)
#define VFPD_240320 ((10-1)&0xff)
#define VSPW_240320 ((3-1)&0xff)
#define HBPD_240320 ((1-1)&0xff)
#define HFPD_240320 ((6-1)&0xff)
#define HSPW_240320 ((3-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 S3C24A0X
//#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_PAR_176220 (6) //for S3C24A0X
//#define CLKVAL_PAR_240320 (12)
// 60hz @135Mhz
//HBPD=6VCLK,HFPD=2VCLK,HSPW=3VCLK
//VBPD=1HSYNC,VFPD=2HSYNC,VSPW=1HSYNC
#define CLKVAL_PAR_240320 (8)
//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 COMPKEY_8BPP
#define COMPKEY_8BPPNP
#define COMPKEY_16BPP
#define COMPKEY_18BPP
//#define LCDFRAMEBUFFERBG1 0x13900000 //_NONCACHE_STARTADDRESS
//#define LCDFRAMEBUFFERBG2 0x13900000 //_NONCACHE_STARTADDRESS
//#define LCDFRAMEBUFFERFG1 0x13900000 //_NONCACHE_STARTADDRESS
//#define LCDFRAMEBUFFERFG2 0x13900000 //_NONCACHE_STARTADDRESS
#if 0
#define LCDFRAMEBUFFERBG1 0x11300000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERBG2 0x11300000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERFG1 0x11300000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERFG2 0x11300000 //_NONCACHE_STARTADDRESS
#else
#define LCDFRAMEBUFFERBG1 0x13000000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERBG2 0x13200000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERFG1 0x13400000 //_NONCACHE_STARTADDRESS
#define LCDFRAMEBUFFERFG2 0x13600000 //_NONCACHE_STARTADDRESS
#endif
// 1. The LCD frame buffer should be write-through or non-cachable.
// 2. The total frame memory should be inside 16MB.
// 3. To meet above 2 conditions, the frame buffer should be
// inside the following region.
// ????????????
#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_18BPP (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 U32 DisplayType;
//extern volatile U32 WhichFrameBuffer;
extern U32 mpegframebuffer;
void LcdBGInit(U32 displaytype);
void PaletteInit(U32 type);
void LcdFGInit(U32 displaytype);
void LcdEnvidOnOff(U32 onoff);
void LcdEnvidOnOffDirect(U32 onoff);
void LcdSelectBuffer(U32 whichbuffer);
void LcdOsdEnDiable(U32 endiable);
void LcdOsdSetAlpha(U32 alpha);
void LcdOsdSelectFunction(U32 function);
void LcdDitheringEnDisable(U32 endisable);
void LcdBGColorMap(U32 endisable, U32 bgcolor);
void LcdFGColorMap(U32 endisable, U32 fgcolor);
void LcdColorKeyInit(U32 displaytype);
void LcdSetColorKey(U32 direction, U32 compkey, U32 colval);
void LcdSetFrameInterrupt(U32 framesel0, U32 framesel1);
void LcdEnableFrameInterrupt(U32 framesel0, U32 framesel1);
void LcdDisableFrameInterrupt(void);
void LcdEnableFifoInterrupt(U32 fifosel, U32 fifolevel);
void LcdDisableFifoInterrupt(void);
void MoveViewPort(U32 displaytype, U32 whichframebuffer);
void LcdMoveViewPort(int vx,int vy, U32 displaytype, U32 whichframebuffer);
void SLcdGpioSet(U8 type, U8 data);
void SLcdRegSet(U8 IndexReg, U16 Inst);
void SLcdSpiSet(U8 RS, U8 RW, U16 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 delayLoop(int count);
void Write_LDI(int address, int data);
void InitLDI(void);
#ifdef __cplusplus
}
#endif
#endif /*__LCDLIB_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -