📄 tft_c1l5.c
字号:
/********************************************************************************
**********************************************************************************
** Copyright: 上海闻泰电子第一产品部
** All Rights Reserved.
** Project Name: T658
** File Name: tft_CIL5.c
** Description: This file contains driver for color LCD.
LCD type : LTPS TFT
Driver IC: CIL5-06
Dot pixcel:128*160
Menufacture: HuaLiWei and TianMa
** Current Ver: 1.1
** Author: Huangfusheng
** DATE: 08/15/2007
** Modify: Add the innitial Code for Tianma
** Displace Ver: 1.0
** Author : Huangfusheng
** Data : 07/26/2007
********************************************************************************
********************************************************************************/
#include "os_api.h"
#include "sci_types.h"
//#include "lcd_api.h"
#include "gpio_api.h"
#include "lcd.h"
// #include "mv3lib.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**---------------------------------------------------------------------------*
** Macro Define
**---------------------------------------------------------------------------*/
#define C1L5_WIDTH 128//176
#define C1L5_HEIGHT 160//220
#define MP4_MAX_WIDTH 176
#define MP4_MAX_HEIGHT 144
#define OFFSET_X 0
//@David.Jia 2005.11.22
#define ADC_C1L5_LOW 231
#define ADC_C1L5_HIGH 249 //@David.Jia 2006.3.3 cr42033
#define LCD_USE_DMA
extern void dma_init(void);
extern void *LCD_GetLCDBuffer(void);
/******************************************************************************/
// Description: Clear color LCD with one color
// Global resource dependence:
// Author: louis.wei
// Note:
/******************************************************************************/
LOCAL void C1L5_Clear(
uint32 color //color to fill the whole lcd.
);
/******************************************************************************/
// Description: Close the lcd.(include sub lcd.)
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL void C1L5_Close(void);
/******************************************************************************/
// Description: Enter/Exit sleep mode .
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E C1L5_EnterSleep(
BOOLEAN is_sleep //SCI_TRUE: exter sleep mode;SCI_FALSE:exit sleep mode.
);
/*****************************************************************************/
// Description: Get the lcd base information..
// Global resource dependence:
// Author: louis.wei
// Note:
/*****************************************************************************/
LOCAL ERR_LCD_E C1L5_GetInfo(
LCD_INFO_T *lcd_info_ptr //lcd information struct pointer
);
/******************************************************************************/
// Description: get the important parameter for digital camera
// Global resource dependence:
// Author: Zhemin.lin
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E C1L5_GetMainLcdSpec(
LCD_SPEC_T *spec_ptr //spec struct pointer
);
/*********************************************************************/
// Description: Initialize color LCD : C1L5
// Input:
// None.
// Return:
// None.
// Note:
/*********************************************************************/
LOCAL ERR_LCD_E C1L5_Init(void);
/******************************************************************************/
// Description: invalidate a rectang of in LCD
// Global resource dependence:
// Author: Jim.zhang
// Note:
/******************************************************************************/
LOCAL ERR_LCD_E C1L5_Invalidate(void);
/******************************************************************************/
// Description: Copy a retangle data from clcd_buffer to display RAM.
// then the rectangle display is to be refreshed
// Global resource dependence:
// Author: Jim.zhang
// Note:
// To improve speed, lcd is operate in HIGH SPEED RAM WRITE MODE(4
// uint16 are write continuously always.) So, some dummy uint16
// should be inserted to satisfy this mode. Please refer to spec.
/******************************************************************************/
LOCAL ERR_LCD_E C1L5_InvalidateRect(
uint16 left, //the left value of the rectangel
uint16 top, //top of the rectangle
uint16 right, //right of the rectangle
uint16 bottom //bottom of the rectangle
);
/******************************************************************************/
// Description: for mp4 display
// Global resource dependence:
// Author: juan.zhang
/******************************************************************************/
LOCAL ERR_LCD_E C1L5_InvalidateRectImage(
uint16 left, //the left value of the rectangel
uint16 top, //top of the rectangle
uint16 right, //right of the rectangle
uint16 bottom, //bottom of the rectangle
uint16 *buf_ptr,
uint8 is_invert//ignore
);
/******************************************************************************/
// Description: LCD go to sleep mode
// Author: Yingchun.li
// Note:
/******************************************************************************/
LOCAL C1L5_GoSleep(void);
/******************************************************************************/
// Description: LCD exit sleep mode
// Author: Yingchun.li
// Note:
/******************************************************************************/
LOCAL C1L5_ExitSleep(void);
LOCAL void main_lcd_fill_rect(uint16 left, uint16 top,uint16 right, uint16 bottom,uint16 color);
/**---------------------------------------------------------------------------*
** Function Definitions
**---------------------------------------------------------------------------*/
extern uint32 dma_request(uint32 chid, uint32 saddr, uint32 daddr, uint32 size, uint32 transfer_mode, uint32 size_mode);
#define C1L5_SEND_COMMAND( c) {*(volatile uint16 *)0x58000000 = c;}
#define C1L5_SEND_DATA(d) {*(volatile uint16 *)0x58020000 = d;}
#define C1L5_sendcommand1(command, data) {*(volatile uint16 *)0x58000000 = command;*(volatile uint16 *)0x58020000 = data;}
//LOCAL void C1L5_HW_reset(void)
//{
// GPIO_SetLcdReset(0);
// Delayms(10);
// GPIO_SetLcdReset(1);
// Delayms(10);
//}
LOCAL void C1L5_reset(void)
{
uint16 lcm_nv = REFPARAM_GetLCDType();
SCI_TRACE_LOW("C1L5_reset: 7370 GG3728 C1L5/HYDIS.");
switch(lcm_nv)
{
//case TFT_C1L5_Tianma:
{
//-------for Tianma------------
C1L5_sendcommand1(0x01,0x02);
C1L5_sendcommand1(0x02,0x12);
C1L5_sendcommand1(0x03,0x60);
C1L5_sendcommand1(0x05,0x08);
C1L5_sendcommand1(0x07,0x78);//7f
C1L5_sendcommand1(0x08,0x17);//17
C1L5_sendcommand1(0x09,0x00);
C1L5_sendcommand1(0x10,0x00);
C1L5_sendcommand1(0x04,0x50);
C1L5_sendcommand1(0x11,0x7f);
C1L5_sendcommand1(0x12,0x9f);
C1L5_sendcommand1(0x18,0x00);
C1L5_sendcommand1(0x19,0x00);
C1L5_sendcommand1(0x17,0x00);
C1L5_sendcommand1(0x06,0xc7);
C1L5_sendcommand1(0x3f,0x08);
C1L5_sendcommand1(0x72,0x0b);
}
break;
case TFT_C1L5:
{
//-------for HuaLiWei------
SCI_TRACE_LOW("000000000000000000000");
C1L5_SEND_COMMAND(0x0001);
C1L5_SEND_DATA(0x0002);
C1L5_SEND_COMMAND(0x0002);
C1L5_SEND_DATA(0x0006); //0086
C1L5_SEND_COMMAND(0x0003);
C1L5_SEND_DATA(0x8060);
C1L5_SEND_COMMAND(0x0005);
C1L5_SEND_DATA(0x0008);
C1L5_SEND_COMMAND(0x0007);
C1L5_SEND_DATA(0x007f);
C1L5_SEND_COMMAND(0x0008);
C1L5_SEND_DATA(0x0017);
C1L5_SEND_COMMAND(0x0009);
C1L5_SEND_DATA(0x0000);
C1L5_SEND_COMMAND(0x0010);
C1L5_SEND_DATA(0x0000);
C1L5_SEND_COMMAND(0x0011);
C1L5_SEND_DATA(0x007f);
C1L5_SEND_COMMAND(0x0012);
C1L5_SEND_DATA(0x009f);
C1L5_SEND_COMMAND(0x0014);
C1L5_SEND_DATA(0x0000);
C1L5_SEND_COMMAND(0x0016);
C1L5_SEND_DATA(0x009f);
C1L5_SEND_COMMAND(0x0017);
C1L5_SEND_DATA(0x0000); //0002
C1L5_SEND_COMMAND(0x0018);
C1L5_SEND_DATA(0x0000);
C1L5_SEND_COMMAND(0x0019);
C1L5_SEND_DATA(0x0000);
C1L5_SEND_COMMAND(0x0021);
C1L5_SEND_DATA(0x0088);
C1L5_SEND_COMMAND(0x0022);
C1L5_SEND_DATA(0x0033);
C1L5_SEND_COMMAND(0x0023);
C1L5_SEND_DATA(0x00cc);
C1L5_SEND_COMMAND(0x0024);
C1L5_SEND_DATA(0x00cc);
C1L5_SEND_COMMAND(0x0025);
C1L5_SEND_DATA(0x00bb);
C1L5_SEND_COMMAND(0x0026);
C1L5_SEND_DATA(0x00bb);
C1L5_SEND_COMMAND(0x0027);
C1L5_SEND_DATA(0x0077);
C1L5_SEND_COMMAND(0x0028);
C1L5_SEND_DATA(0x0077);
C1L5_SEND_COMMAND(0x0029);
C1L5_SEND_DATA(0x0077);
C1L5_SEND_COMMAND(0x0006);
C1L5_SEND_DATA(0x00c7);
}
break;
}
}
/******************************************************************************/
// Description: Clear color LCD with one color
// Global resource dependence:
// Author: louis.wei
// Note:
// modify: jim.cui 2005.0728 use dma to transport data
/******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -