📄 bspslcdcclass.h
字号:
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Copyright (C) 2005-2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//---------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// File: BSPSlcdcClass.h
// Purpose: Macros and Function Prototypes for SLCD Controller
//
//------------------------------------------------------------------------------
#ifndef __BSP_SLCDC_CLASS_H__
#define __BSP_SLCDC_CLASS_H__
//------------------------------------------------------------------------------
// DEFINITIONS
//------------------------------------------------------------------------------
// 1. slcdc controller
#define SLCD_RESET_MASK 0x80000000
#define SLCD_DATCTL_PARM_RGB565 0x00000028
#define GPIO_OCR_BIT31_MASK 0xc0000000
#define SLCD_OCR_BIT31_OS 0xc0000000
#define SLCDC_IMGEND_16BLE 0x00010000
#define SLCDC_WORDDEFWRITE_16BIT 0x00000020
#define SLCDC_WORDDEFDAT_16BIT 0x00000010
#define SLCDC_WORDDEFCOM_16BIT 0x00000008
#define SLCDC_XFERMODE_PARALLEL 0x00000004
#define SLCDC_CSPOL_ACTIVEHIGH 0x00000002
#define SLCDC_FIFOCONFIG_BURST 0x00000006
#define SLCDC_CLOCKCONFIG_DIVIDE 0x0000003f
#define SLCDC_AUTOMODE_MASK 0x00001800
#define SLCDC_AUTOMODE_ACTIVEHIGH 0x00000800
#define SLCDC_GO_MASK 0x00000001
#define SLCDC_BUSY_MASK 0x00000004
#define SLCDC_IRQ_MASK 0x00000040
#define SLCDC_UNDERFLOW_MASK 0x00000020
#define SLCDC_TEA_MASK 0x00000010
// 2. panel command
//------------------------------------------------------------------------------
// Epson_QVGA_L2F50282T00_(E)
//------------------------------------------------------------------------------
#define DISON 0x29 // 1. display on
#define DISOFF 0x28 // 2. display off
#define DISINOFF 0x20 // 3. normal display
#define DISINV 0x21 // 4. inverse display
#define DISCTL 0xB0 // 5. display control
#define GCPSET0 0xB1 // 6. 64 grayscale pulse positon set-0
#define GCPSET1 0xB2 // 7. 64 grayscale pulse positon set-1
#define GAMSET 0x26 // 8. 64 grayscale set select
#define IDMON 0x39 // 9. enter to 8 colors mode
#define IDMOFF 0x38 // 10. quit from 8 colors mode
#define SLPIN 0x10 // 11. sleep in
#define SLPOUT 0x11 // 12. sleep out
#define PASET 0x2B // 13. page address set
#define CASET 0x2A // 14. column address set
#define MADCTL 0x36 // 15. data control.
#define COLMOD 0x3A // 16. data mode select.
#define IFMOD 0xC2 // 17. data control.
#define RAMWR 0x2C // 18. writing to memory
#define RAMRD 0x2E // 19. read memory
#define PTLON 0x12 // 20. partial driving on
#define PTLAR 0x30 // 21. partial area setting
#define NORON 0x13 // 22. cancel the partial
#define VOLCTR 0xBE // 23. Electronic volume control
#define EPCTIN 0xB3 // 24. control disable for E2PROM
#define EPSRRD 0xB5 // 25. read internal register for E2PROM
#define VSCRDEF 0x33 // 26. scroll area setting
#define VSCRSADD 0x37 // 27. scroll start position setting
#define RGBSET 0x2D // 28. 4096/256 colors setting
#define TEON 0x35 // 29. VD output enable
#define TEOFF 0x34 // 30. VD output disable
//------------------------------------------------------------------------------
// COMMAND PARAMETERS
//------------------------------------------------------------------------------
UINT16 lcd_para_DISCTL[15] = { 0x01, 0x98, 0x01, 0x48,
0x01, 0x40, 0x04, 0x01,
0x01, 0x41, 0x09, 0x00,
0x00, 0x40, 0x00};
UINT16 lcd_para_GCPSET0_type500282[64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x20, 0x00, 0x08, 0x04, 0x01, 0x00,
0x08, 0x02, 0x04, 0x08, 0x21, 0x08, 0x92, 0x52,
0x52, 0x94, 0xA5, 0x52, 0xA5, 0x52, 0xAD, 0x55,
0xB5, 0xBB, 0x6A, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
UINT16 lcd_para_GCPSET1_type500282[64] = {
0x02, 0x00, 0x24, 0x28, 0xA9, 0x49, 0x94, 0xa4,
0xAA, 0x51, 0x29, 0x29, 0x25, 0x49, 0x24, 0xA5,
0x24, 0x92, 0x44, 0x21, 0x04, 0x08, 0x10, 0x08,
0x00, 0x40, 0x10, 0x10, 0x00, 0x04, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
UINT16 lcd_para_PASET_500282[4] = { 0x00, 0x00, 0x01, 0x3f};
UINT16 lcd_para_CASET_500282[4] = { 0x00, 0x0c, 0x00, 0xfb};
// 3. main
//------------------------------------------------------------------------------
// SLCD Module physical constants
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Epson_QVGA_L2F50282T00
//------------------------------------------------------------------------------
#define SLCD_WIDTH 240 // memory pixels wide (visual)
#define SLCD_HEIGHT 320 // memory pixels high (visual)
#define SLCD_BYTESPER_PIXEL 2 // 16bits / pixel
#define SLCD_START_COL 12 // from physical screen
#define SLCD_END_COL 251 // to physical screen
#define SLCD_START_ROW 0 // from physical screen
#define SLCD_END_ROW 319 // to physical screen
typedef enum displayMode
{
DISPLAY_240x320x16bpp_default, // QVGA display mode
numModes, // This enum should be ended by numModes
}displayMode_c;
typedef enum displayPanel
{
DISPLAY_Epson_QVGA_L2F50282T00, // QVGA display
numPanels, // This enum should be ended by numPanels
}displayPanel_c;
#define DISPLAY_PANEL_DEFAULT DISPLAY_Epson_QVGA_L2F50282T00
#define MAX_NUM_MODES 1 // The supported mode types, such as SLCD, TV, etc
#define DISPLAY_MODE_DEVICE 0
//------------------------------------------------------------------------------
// SLCD registry entries
//------------------------------------------------------------------------------
#define VIDEO_REG_PATH TEXT("Drivers\\Display\\SLCDC")
#define PANEL_TYPE TEXT("PanelType")
//------------------------------------------------------------------------------
// DEFINITIONS
//------------------------------------------------------------------------------
#define RGB565_RED 0xf800
#define RGB565_GREEN 0x07e0
#define RGB565_BLUE 0x001f
//------------------------------------------------------------------------------
// Frame buffer physical address & size
//------------------------------------------------------------------------------
#define SLCDC_PARMBUFFER_SIZE 128
#define SLCDC_PARMBUFFER_PADDR IMAGE_SHARE_FRAMEBUFFER_RAM_PA_START
#define SLCDC_FRAMEBUFFER_PADDR (SLCDC_PARMBUFFER_PADDR + SLCDC_PARMBUFFER_SIZE)
// 4. variable and function
//------------------------------------------------------------------------------
CSP_SLCDC_REGS *slcdc; // SLCDC registers
GPEMode mode; // Graphics mode info
UINT16 *parm_mem; // Parameter buffer pointer
UINT16 *video_mem; // Frambuffer pointer
UINT32 video_size; // Size of video_mem
UINT32 parm_size; // Size of parm_mem
DWORD m_dwPanelType; // LCD Panel identifier
GPEMode *m_SupportedModes; // Array of supported modes
void Destroy(void);
void SlcdcInit(void);
DWORD GetPanelTypeFromRegistry(void);
BOOL DisplayFrame(UINT16 *data, UINT16 start_col, UINT16 end_col,
UINT16 start_page, UINT16 end_page);
BOOL SendCommand(UINT16 cmd, UINT16 *data, UINT32 size);
void SendCommandWait(UINT16 cmd); // Handle timing
void SLCDConfig(void);
void SetDisplayConfig_16bit(void);
void TurnOnSLCD( BOOL bTurnOn);
void ResetSLCD(BOOL bReset);
void ConfigGPIO_to_SLCD16bit(BOOL bEnable);
void ConfigClock_to_SLCDC(BOOL bEnable);
void SelectPanel(void);
void TurnOnBKL(BOOL bOnBKL);
void BSPSlcdcClassInit(void);
void BSPSlcdcClassDeInit(void);
SCODE BspSetMode(int modeId, HPALETTE *pPalette);
SCODE BspGetModeInfo(GPEMode *pMode, int modeNo);
int BspNumModes(void);
void BspPowerHandler(BOOL bOff);
SCODE BspBltComplete(void);
ULONG *BSPGetSLCDCBitMasks(void);
UINT16 *BspGetVideoMem(void);
GPEMode BspGetMode(void);
#endif // __BSP_SLCDC_CLASS_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -