📄 dbglcd.c
字号:
/******************************************************************
* Copyright (C), 2005-2007, HISILICON Tech. Co., Ltd. *
* *
* File name: Pl110_clcdc.c *
* *
* Description: *
* The CLCDC driver C file for public use. *
* *
* Author: H55798 *
* *
* Version: v0.1 *
* *
* Date: 2007.04.20 *
* *
* History: *
* *
* 1. Date: *
* Author: *
* Modification: *
* 2. ... *
*******************************************************************/
#include "syslib.h"
#include "pl110_clcdc.h"
#include "lcmPanel.h"
#include "spi.h"
#ifdef DEBUG
#ifdef __cplusplus
extern "C" { /* allow C++ to use these headers */
#endif /* __cplusplus */
//------------------------------------------------------------------
/*
* LCD bit set function
*/
#define LCD_BIT_MASK(__bws) \
( (UINT32)(((bw ## __bws)==32)? 0xFFFFFFFF : ((1U << (bw ## __bws)) - 1)) \
<<(bs ## __bws) )
#define LCD_BIT_SET(__datum, __bws, __val) \
( (__datum) = ((UINT32) (__datum) & (UINT32)~(LCD_BIT_MASK(__bws))) \
| ((UINT32) ((UINT32)(__val) << (UINT32)(bs ## __bws)) & (LCD_BIT_MASK(__bws))) )
#define LCD_DELAY(t) Sleep((t) * 10)//lcmSspXferDelay((t)*10000)//Sleep((t) * 10)
enum
{
CORLOR_RED = 1,
CORLOR_GREEN,
CORLOR_BLUE,
CORLOR_WHITE,
CORLOR_BLACK,
CORLOR_WHITE_GRAYSCALE
};
/*
* Define LCD driver registers
*/
typedef struct
{
volatile ULONG* pLcmGpio10Reg;
P_CLCDC_REG pClcdcReg;
/*define LCD display related parameters*/
UINT32 width;
UINT32 height;
UINT32 stride;
INT32 ulDispBpp;
UINT32 ulFrameBufferSize;
UINT32 ulFrameBufferPhyAddr;
UINT32 ulFrameBufferVirtualAddr;
}DISPLAY_T, *P_DISPLAY_T;
/*GLOBAL*/
#ifdef RGB_PANEL_SAMSUNG_S6D0139
//please write power on sequence here
//power on sequence
static const UINT8 powerOnData1[] = { 0x74, 0x00,0x07, 0x76, 0x00,0x00,
0x74, 0x00,0x13, 0x76, 0x00,0x00};
//wait 10ms
static const UINT8 powerOnData2[] = { 0x74, 0x00,0x11, 0x76, 0x30,0x04,
0x74, 0x00,0x14, 0x76, 0x20,0x0f,
0x74, 0x00,0x10, 0x76, 0x1a,0x20,
0x74, 0x00,0x13, 0x76, 0x00,0x40};
//wait 50ms
static const UINT8 powerOnData3[] = { 0x74, 0x00,0x13, 0x76, 0x00,0x60,
0x74, 0x00,0x13, 0x76, 0x00,0x70};
//wait 200ms
static const UINT8 powerOnData4[] = { 0x74, 0x00,0x01, 0x76, 0x11,0x27,
0x74, 0x00,0x02, 0x76, 0x07,0x00,
0x74, 0x00,0x03, 0x76, 0x10,0x30,
0x74, 0x00,0x08, 0x76, 0x08,0x08,
0x74, 0x00,0x0b, 0x76, 0x06,0x20,
0x74, 0x00,0x0c, 0x76, 0x01,0x10,
0x74, 0x00,0x30, 0x76, 0x01,0x20,
0x74, 0x00,0x31, 0x76, 0x01,0x27,
0x74, 0x00,0x32, 0x76, 0x00,0x00,
0x74, 0x00,0x33, 0x76, 0x05,0x03,
0x74, 0x00,0x34, 0x76, 0x07,0x27,
0x74, 0x00,0x35, 0x76, 0x01,0x24,
0x74, 0x00,0x36, 0x76, 0x07,0x06,
0x74, 0x00,0x37, 0x76, 0x07,0x01,
0x74, 0x00,0x38, 0x76, 0x0f,0x00,
0x74, 0x00,0x39, 0x76, 0x0f,0x00,
0x74, 0x00,0x40, 0x76, 0x00,0x00,
0x74, 0x00,0x41, 0x76, 0x00,0x00,
0x74, 0x00,0x42, 0x76, 0x01,0x3f,
0x74, 0x00,0x43, 0x76, 0x00,0x00,
0x74, 0x00,0x44, 0x76, 0x01,0x3f,
0x74, 0x00,0x45, 0x76, 0x00,0x00,
0x74, 0x00,0x46, 0x76, 0xef,0x00,
0x74, 0x00,0x47, 0x76, 0x01,0x3f,
0x74, 0x00,0x48, 0x76, 0x00,0x00,
0x74, 0x00,0x07, 0x76, 0x00,0x15};
//wait 30ms
static const UINT8 powerOnData5[] = { 0x74, 0x00,0x07, 0x76, 0x00,0x17};
static const UINT8 powerOnData6[] = { 0x74, 0x00,0x20, 0x76, 0x00,0x00,
0x74, 0x00,0x21, 0x76, 0x00,0x00,
0x74, 0x00,0x22, 0x76, 0x00,0x00};
//please write power off sequence here
//power off sequence
static const UINT8 powerOffData1[] = { 0x74, 0x00,0x07, 0x76, 0x00,0x16};
//wait 30ms
static const UINT8 powerOffData2[] = { 0x74, 0x00,0x07, 0x76, 0x00,0x04,
0x74, 0x00,0x10, 0x76, 0x02,0x20};
//wait 20ms
static const UINT8 powerOffData3[] = { 0x74, 0x00,0x13, 0x76, 0x00,0x60};
//wait 50ms
static const UINT8 powerOffData4[] = { 0x74, 0x00,0x13, 0x76, 0x00,0x40};
//wait 50ms
static const UINT8 powerOffData5[] = { 0x74, 0x00,0x13, 0x76, 0x00,0x00,
0x74, 0x00,0x10, 0x76, 0x00,0x00};
#endif
static void ShowLogo(void);
#ifdef HISI3610_CHIP
/************************************************
*
* Functions declare
*
************************************************/
/*Define LCM functions*/
static BOOL LcmInit(void);
static INT32 LcdReset();
//static INT32 lcmBackLight(P_DISPLAY_T pLcdReg, UINT32 ulLcmBackLightOpFlag);//for test
/*Define CLCDC functions*/
static INT32 ClcdcInit(P_DISPLAY_T pLcdReg);
static INT32 ClcdcSwitch(P_DISPLAY_T pLcdReg, UINT32 ulClcdcOpFlag);
DWORD gPCD = 4;
DISPLAY_T g_display;
#define HISI_EDC_SRAM_SIZE (192*1024)
/************************************************
*
* SSP Functions Definition
*
************************************************/
#ifdef RGB_PANEL_SAMSUNG_S6D0139
static BOOL samsungS6d0139PowerOff(void)
{
BOOL errRet = TRUE;
errRet |= WriteLCDRegister(powerOffData1, sizeof(powerOffData1));
LCD_DELAY(5);//10ms
errRet |= WriteLCDRegister(powerOffData2,sizeof(powerOffData2));
LCD_DELAY(4);//50ms
errRet |= WriteLCDRegister(powerOffData3,sizeof(powerOffData3));
LCD_DELAY(10);//200ms
errRet |= WriteLCDRegister(powerOffData4,sizeof(powerOffData4));
LCD_DELAY(10);
errRet |= WriteLCDRegister(powerOffData5,sizeof(powerOffData5));
return errRet;
}
static BOOL samsungS6d0139Init(void)
{
BOOL errRet = TRUE;
errRet |= WriteLCDRegister(powerOnData1, sizeof(powerOnData1));
LCD_DELAY(2);//10ms
errRet |= WriteLCDRegister(powerOnData2,sizeof(powerOnData2));
LCD_DELAY(7);//50ms
errRet |= WriteLCDRegister(powerOnData3,sizeof(powerOnData3));
LCD_DELAY(30);//200ms
errRet |= WriteLCDRegister(powerOnData4,sizeof(powerOnData4));
LCD_DELAY(6);
errRet |= WriteLCDRegister(powerOnData5,sizeof(powerOnData5));
LCD_DELAY(10);
errRet |= WriteLCDRegister(powerOnData6,sizeof(powerOnData6));
return errRet;
}
#endif
static void BacklightTurnOnOff(BOOL isOn)
{
#define PWM_OUTA_DIV 0x30082008
#define PWM_OUTA_WIDE 0x30082010
#define PWM_OUTA_EN 0x30082000
if(isOn)
{
/****************set pwm**********************/
OUTREG32(PWM_OUTA_EN, TRUE);
//set32(PWM_OUTA_DIV,0x40);
//set32(PWM_OUTA_WIDE,0x20);
OUTREG32(PWM_OUTA_DIV,0x20);
OUTREG32(PWM_OUTA_WIDE,0x10);
}
else
{
OUTREG32(PWM_OUTA_EN, FALSE);
}
}
/************************************************
*
* LCM Functions Definition
*
************************************************/
static BOOL LcmInit(void)
{
return samsungS6d0139Init();
}
static BOOL LcmPowerOff(void)
{
return samsungS6d0139PowerOff();
}
static INT32 LcdReset(void)
{
GpioSetDirection(GPIO_22, EGPIO_DIR_OUTPUT);
GpioSetValue(GPIO_22, EGPIO_DATA_HIGH);
LCD_DELAY(4);//20MS
GpioSetValue(GPIO_22, EGPIO_DATA_LOW);
LCD_DELAY(10);//1MS
GpioSetValue(GPIO_22, EGPIO_DATA_HIGH);
LCD_DELAY(4);
return CLCDC_SUCCESS;
}
/************************************************
*
* CLCDC Functions Definition
*
************************************************/
static INT32 ClcdcInit(P_DISPLAY_T pLcdReg)
{
DISPLAY_T * const pLocalLcdReg = pLcdReg;
CLCDC_REG * pLocalClcdcReg = (P_CLCDC_REG)NULL;
//DEBUGMSG(CLCDC_DEBUG ,(TEXT("clcdcInit: clcdcInit!\r\n")));
if (NULL == pLocalLcdReg)
{
//DEBUGMSG(CLCDC_DEBUG ,(TEXT("NULL pointer: pLocalLcdReg!\r\n")));
return CLCDC_FAILURE;
}
pLocalClcdcReg = pLocalLcdReg->pClcdcReg;
if (NULL == pLocalClcdcReg)
{
//DEBUGMSG(CLCDC_DEBUG ,(TEXT("NULL pointer: pLocalClcdcReg or pLocalSysReg!\r\n")));
return CLCDC_FAILURE;
}
/*Set CLCDC LCDTiming0 register*/
//pLocalClcdcReg->LCDTIMING_0_R = VAL_CLCDC_TIMING_0;
pLocalClcdcReg->LCDTIMING_0_R = 0x0f0f0f38;
/*Set CLCDC LCDTiming1 register*/
//pLocalClcdcReg->LCDTIMING_1_R = VAL_CLCDC_TIMING_1;
pLocalClcdcReg->LCDTIMING_1_R = 0x0808153f;
/*Set CLCDC LCDTiming2 register*/
//pLocalClcdcReg->LCDTIMING_2_R = (VAL_CLCDC_TIMING_2 | (gPCD << 0));
pLocalClcdcReg->LCDTIMING_2_R = 0xef5801;
/*Set CLCDC LCDTiming3 register*/
//pLocalClcdcReg->LCDTIMING_3_R = VAL_CLCDC_TIMING_3;
pLocalClcdcReg->LCDTIMING_3_R = 0x0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -