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

📄 lcddriver.h

📁 s3c2440的LCD控制器驱动程序 ps 无操作系统的情况
💻 H
字号:
/* Module: lcdCtl.h
  Author:  MCL
  Description: head file of for lcdCtl.c
  
  Copyright:
 
 */
 
 
 /* define some macros*/
 #define FALSE 0
 #define TRUE   1
 
  /*define macros of color */
 #define  WHITE  0XFFFF
 #define  RED    0XF800
 #define  BLUE   0X001F
 #define  GREEN  0X7E0
 #define  BLACK  0X0000
 #define  YELLOW  0xafe7
 
 
 /*define some addr macros*/
 
 /* define LCD control register addr*/
 #define  LCDCTL_LCDCON1_ADDR   0x4D000000
 #define  LCDCTL_LCDCON2_ADDR   0x4D000004
 #define  LCDCTL_LCDCON3_ADDR   0x4D000008
 #define  LCDCTL_LCDCON4_ADDR   0x4D00000C
 #define  LCDCTL_LCDCON5_ADDR   0x4D000010
 
 /* define frame buffer start address register addr*/
 #define LCDCTL_LCDSADDR1_ADDR  0x4D000014
 #define LCDCTL_LCDSADDR2_ADDR  0x4D000018
 #define LCDCTL_LCDSADDR3_ADDR  0x4D00001C
 
 
  #define LCDCTL_TPAL_ADDR       0x4D000050
  #define LCDCTL_LCDINTPND_ADDR  0x4D000054
  #define LCDCTL_LCDSRCPND_ADDR  0x4D000058
  #define LCDCTL_LCDINTMASK_ADDR 0x4D00005C
  #define LCDCTL_TCONSEL_ADDR    0x4D000060
  
  /*define GPIO regs ADDR*/
  #define S3C20440_GPIO_GPCCON_ADDR  0x56000020
  #define S3C20440_GPIO_GPCUP_ADDR    0x56000028
  #define S3C20440_GPIO_GPDCON_ADDR  0x56000030
  #define S3C20440_GPIO_GPDUP_ADDR    0x56000038
  
  
  
  /*define macros of LCDCON1*/
  #define S3C2440_LCDCON1_TFT16BPP  (12<<1)
  #define S3C2440_LCDCON1_TFT    (3<<5)
  #define S3C2440_LCDCON1_CLKVAL (6<<8)
  
  /*define macros of LCDCON2*/
  #define S3C2440_LCDCON2_VBPD(x)  ((x)<<24)
  #define S3C2440_LCDCON2_LINEVAL(x) ((x)<<14)
  #define S3C2440_LCDCON2_VFPD(x)   ((x)<<6)
  #define S3C2440_LCDCON2_VSPW(x) ((x)<<0)
 
  /*define macros of LCDCON3*/
  #define S3C2440_LCDCON3_HBPD(x)  ((x)<<19)
  #define S3C2440_LCDCON3_HOZVAL(x) ((x)<<8)
  #define S3C2440_LCDCON3_HFPD(x)   ((x)<<0)
  
  /*define macros of LCDCON4*/
 #define S3C2440_LCDCON4_MVAL(x) ((x)<<8)
 #define S3C2440_LCDCON4_HSPW(x) ((x) << 0)
 
 /*define macros of LCDCON5*/
 
 #define S3C2440_LCDCON5_FRM565     (1<<11)
 #define S3C2440_LCDCON5_INVVLINE   (1<<9)
 #define S3C2440_LCDCON5_INVVFRAME  (1<<8)
 #define S3C2440_LCDCON5_PWREN      (1<<3)
 #define S3C2440_LCDCON5_HWSWP      (1<<0)
 #define S3C2440_LCDCON5_INVVCLK  (1<<10)
 
 /*define macros of LCDADDR*/
 #define S3C2440_FRAME_START_ADDRESS  0X33c00000
 #define S3C2440_LCDSADDR1_LCDBANK(x)   ((x)<<21)
 #define S3C2440_LCDSADDR1_LCDBASEU(x)  (x)
 
 #define S3C2440_LCDSADDR2_LCDBASEL    0x19e12c00
 #define S3C2440_LCDSADDR3_PAGEWIDTH   0X140
 
 #define S3C2440_TPAL_TPALEN  0x0<<24
 #define S3C2440_TPAL_TPALVAL_RED  0x0<<8 
 
 #define S3C20440_GPIO_GPCCON        0xaa9556a9
 #define S3C20440_GPIO_GPCCON_MASK   0xffc003cc
 #define S3C20440_GPIO_GPCUP         0x0000ffff
 #define S3C20440_GPIO_GPCUP_MASK    0xffffffff
 
 #define S3C20440_GPIO_GPDCON        0xaa95aaa1
 #define S3C20440_GPIO_GPDCON_MASK   0xffc0fff0
 #define S3C20440_GPIO_GPDUP         0x0000faff
 #define S3C20440_GPIO_GPDUP_MASK    0xffffffff

 /*define some structs*/

 struct s3c2440fb_val {
	unsigned int	defval;
	unsigned int	min;
	unsigned int	max;
};

 struct s3c2440fb_hw {
	unsigned long	lcdcon1;
	unsigned long	lcdcon2;
	unsigned long	lcdcon3;
	unsigned long	lcdcon4;
	unsigned long	lcdcon5;
};
 
  struct s3c2440fb_mach_info 
	 {
	 unsigned char	 fixed_syncs;	 /* do not update sync/border */
	 unsigned long	 pixclock;		 
 
	 /* Screen size */
	 int	 width;
	 int	 height;
 
	 /* Screen info */
	 struct s3c2440fb_val xres;
	 struct s3c2440fb_val yres;
	 struct s3c2440fb_val bpp;
 
	 /* lcd configuration registers */
	 struct s3c2440fb_hw  regs;
 
	 /* GPIOs */
 
	 unsigned long	 gpcup;
	 unsigned long	 gpcup_mask;
	 unsigned long	 gpccon;
	 unsigned long	 gpccon_mask;
	 unsigned long	 gpdup;
	 unsigned long	 gpdup_mask;
	 unsigned long	 gpdcon;
	 unsigned long	 gpdcon_mask;
 
	 /* lpc3600 control register */
	 unsigned long	 lpcsel;

	 unsigned long  fb_base_addr;
 
	 };
 
  

 /* Forward Declaration */
 void lcdCtlInit(void);
 unsigned long	lcdCtlRead(void);
 void lcdCtlWrite(unsigned long);
 void lcdCtlOpen(void);
 void lcdCtlClose(void);
 void lcdCtlExit(void);
 
 
 void lcdCtlWriteReg(int iLcdCtlAddr, unsigned long ulData);
 unsigned long lcdCtlReadreg(int ilcdCtlAddr);
 void lcdDisplayOpen(int);
 void lcdCtlDelay(unsigned long delayTime);
 void write_pixel(unsigned short *pBufferAdress, int  x, int y, unsigned short clolorValue);
 void displayMemoryInit(unsigned short colorValue);
 void GUI_HLine(int x0, int  y0, int x1, unsigned short clolorValue);
 void GUI_HLine(int x0, int  y0, int x1, unsigned short clolorValue);
 void GUI_Point( int  x0, int y0, unsigned short clolorValue);
 








































⌨️ 快捷键说明

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