📄 drv_lcd.h
字号:
// drv_lcd.h v1.0 2004/01/05
//---------------------------------------------------------------------------------
//
// Copyright (C) SEIKO EPSON CORP. 2003
//
// GROUP : SEE LSI
// FILE : drv_lcd.h
// MODULE : Lcd header file
//
// Function description : Lcd header file includes grobal and static variables and macros.
// Revision history :
// Date userName Description
// 2004/01/05 Hellen Yao start
//
// Notes :
//
//---------------------------------------------------------------------------------
#ifndef _DRV_LCDC_H
#define _DRV_LCDC_H
//---------------------------------------------------------------------------------
// Include files (#include)
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
// Constants (#define)
//---------------------------------------------------------------------------------
//Lcdc clock DT
#define LCLG_dt1 0x80
#define LCLG_dt2 0x81
#define LCLG_dt3 0x82
#define LCLG_dt4 0x83
#define LCLG_dt5 0x84
#define LCLG_dt6 0x85
#define LCLG_dt7 0x86
#define LCLG_dt8 0x87
#define LCLG_dt9 0x88
#define LCLG_dt10 0x89
#define LCLG_dt11 0x8a
#define LCLG_dt12 0x8b
#define LCLG_dt13 0x8c
#define LCLG_dt14 0x8d
#define LCLG_dt15 0x8e
#define LCLG_dt16 0x8f
//DMA type
#define NORMAL_DMA 0x77000000
#define INVERSE_DMA 0x75000000
#define FIX_DMA 0x47000000
//Panel type definition
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define VRAM_ADDR_1 0x2000000 // (0x200_0000~0x202_5800-1), range:0x25800
#define VRAM_ADDR_2 0x2025800 // (0x202_5800~0x204_b000-1), range:0x25800
#define VIRTUAL_VRAM_ADDR_1 0x204b000 // (0x204_b000~0x20a_2e40-1), range:0x57e40
#define VIRTUAL_VRAM_ADDR_2 0x204b000 // (0x204_b000~0x20a_2e40-1), range:0x57e40
#define LCD_BPP_UNIT 2 // 16bpp
#define MONO_4BIT 0x2200 // swinv - mono
#define MONO_8BIT 0x2600 // swinv - mono
#define COLOR_4BIT 0x4000
#define COLOR_8BIT_F1 0x4400
#define COLOR_8BIT_F2 0x4c00
//#define COLOR_PANEL
#define LCD_OK 0x0
#define LCD_NG 0x1
#define LCD_PAR_ERROR 0x2
#define LCD_SUCCESS 1
#define LCD_FAILED 0
//---------------------------------------------------------------------------------
// Macros (#define)
//---------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
// macro definition
/*Extended I/O port pins*/
#define SET_P16_O *(volatile unsigned char*) 0x402d6 |= 0x40 //set P16 as output port(LCD display switch)
#define SET_P16_H *(volatile unsigned char*) 0x402d5 |= 0x40 //set P16 high
#define SET_P16_L *(volatile unsigned char*) 0x402d5 &= 0xbf //set P16 low
#define SET_P15_O *(volatile unsigned char*) 0x402d6 |= 0x20 //set P15 as output port(LCDPWR of C33L05)
#define SET_P15_H *(volatile unsigned char*) 0x402d5 |= 0x20 //set P15 high
#define SET_P15_L *(volatile unsigned char*) 0x402d5 &= 0xdf //set P15 low
#define PB_FUNC1_LCDC *(volatile unsigned char*) 0x300f62 = 0x55 //set PB function:FPDAT3--0
#define PB_FUNC2_LCDC *(volatile unsigned char*) 0x300f63 = 0x55 //set PB function:FPDAT7--4
#define PC_FUNC_LCDC *(volatile unsigned char*) 0x300f64 = 0x55 //set PC function:DRDY, FPSHIFT, FPLINE, FPFRAME
/*Misc register initialize*/
#define MISC_LCLG_EN *(volatile unsigned char*) 0x300f34|=0x80 //enable lcdc clock
#define MISC_LCLG_DN *(volatile unsigned char*) 0x300f34&=0x7f //disable lcdc clock
/*LCDC register initialize*/
#define EN_FRAME_INT *(volatile unsigned short*) 0x380010=0x8000 //enable lcdc frame interrupt
#define DN_FRAME_INT *(volatile unsigned short*) 0x380010=0x0 //disable lcdc frame interrupt
#define CHECK_INT_FLAG (*(volatile unsigned short*) 0x380014 & 0x8000) //if frame interrupt is generated
#define RESET_INT_FLAG *(volatile unsigned short*) 0x380014 |= 0x8000 //reset frame interrupt flag
#define CHECK_TIMEOUT_FLAG (*(volatile unsigned short*) 0x380014 & 0x0020) //if timeout error is generated
#define POWER_SAVE *(volatile unsigned short*) 0x380014&=0xfffc //set power save mode
#define POWER_NORMAL *(volatile unsigned short*) 0x380014|=0x0003 //set power normal mode
#define SET_COLOR *(volatile unsigned short*) 0x380202|=0x4000 //set color mode
#define SET_MONO *(volatile unsigned short*) 0x380202&=0xbfff //set mono mode
#define SET_FPSHIFT_MASK *(volatile unsigned short*) 0x380202|=0x2000 //set fpshift mask
#define CLR_FPSHIFT_MASK *(volatile unsigned short*) 0x380202&=0xdfff //clear fpshift mask
#define SET_SWDT_INV *(volatile unsigned short*) 0x380202|=0x0200 //set swdt invert
#define CLR_SWDT_INV *(volatile unsigned short*) 0x380202&=0xfdff //clear swdt invert
#define SET_DISP_BLANK *(volatile unsigned short*) 0x380202|=0x0100 //set disp blank
#define CLR_DISP_BLANK *(volatile unsigned short*) 0x380202&=0xfeff //clear disp blank
//---------------------------------------------------------------------------------
// Structures & unions & enums (#typedef)
//---------------------------------------------------------------------------------
typedef struct SCREEN_PAR{
U32 vram_start_addr; //* virtual screen vram start address */
U16 x_pos; //* actual LCD dipslay start x */
U16 y_pos; //* actual LCD dipslay start y */
U16 virtual_width; //* vitual screen width */
U16 virtual_height; //* vitual screen height */
U16 v_size;
} SCREEN_PAR;
//---------------------------------------------------------------------------------
// Externals (extern)
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
// Function prototypes
//---------------------------------------------------------------------------------
// defined in drv_lcd.c
void _init_lcdc(unsigned char lcdclkdt);
void lcd_SetPixel(S16 x, S16 y, U16 ColorPattern);
void lcd_GetPixel(S16 x, S16 y, U16 *ColorPattern);
void lcd_FillRect( S16 x, S16 y, S16 width, S16 height, U16 ColorPattern);
void lcd_SetHLine( S16 x, S16 y, S16 width, U16 *buffer);
void lcd_GetHLine( S16 x, S16 y, S16 width, U16 *buffer);
void lcd_SetImage(S16 x, S16 y, S16 width, S16 height, U16 *buffer, U32 BufLen);
void lcd_GetImage(S16 x, S16 y, S16 width, S16 height, U16 *buffer, U32 BufLen);
void lcd_GetImage_Dyn(SCREEN_PAR* s_par,U16 * des);
void lcd_DrawNow();
U8 lcd_display(SCREEN_PAR* ptrS1_par,SCREEN_PAR* ptrS2_par);
//----------------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif //_DRV_LCDC_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -