/* LCDCON1 */
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_CLKVAL 7 // HCLK/((CLKVAL+1)*2) 100M/2/(7+1) = 6.25M
/* LCDCON2 */
#define LCD_VBPD 0
#define LCD_VFPD 2
#define LCD_VSPW 2
/* LCDCON3 */
#define LCD_HBPD 20
#define LCD_HFPD 10
/* LCDCON4 */
#define LCD_SPW 10
#pragma pack(100)
unsigned short VRAM[LCD_HEIGHT][LCD_WIDTH];
#pragma pack()
#define M5D(n) ((n)&0x1fffff)
#define LCD_ADDR (cyg_uint32)VRAM
#define LCD_POWOFF_TIMEOUT 600 //60s
static struct pos {
cyg_uint32 x;
cyg_uint32 y;
cyg_uint16 c;
cyg_uint32 idle;
cyg_uint32 busy;
} cursor;
static void Lcd_Port_Init(void)
{
rGPCUP = 0xFFFFFFFF; // Disable Pull-up register
rGPCCON = 0xAAAA02A8; // Initialize VD[7:0],VM,VFRAME,VLINE,VCLK
rGPDUP = 0xFFFFFFFF; // Disable Pull-up register
rGPDCON = 0xAAAAAAAA; // Initialize VD[15:8]
}
static void LCD_Init(void)
{
rLCDCON1 = (LCD_CLKVAL << 8) | (3 << 5) | (12 << 1);
rLCDCON2 = (LCD_VBPD << 24) | ((LCD_HEIGHT - 1) << 14) | (LCD_VFPD << 6)|(LCD_VSPW << 0);
rLCDCON3 = (LCD_HBPD << 19) | ((LCD_WIDTH - 1) << 8) | (LCD_HFPD << 0);
rLCDCON4 = (LCD_SPW << 0);
#if !defined(LCD_CON5)
# define LCD_CON5 ((1<<11) | (1 << 9) | (1 << 8) | (1 << 3) | (1 << 0))
#endif
rLCDCON5 = LCD_CON5;
rLCDSADDR1 = ((LCD_ADDR >> 22) << 21) | ((M5D(LCD_ADDR >> 1)) << 0);
rLCDSADDR2 = M5D((LCD_ADDR + LCD_WIDTH * LCD_HEIGHT * 2) >> 1);
rLCDSADDR3 = LCD_WIDTH;
rLCDINTMSK |= 3;
rLPCSEL &= (~7);
rTPAL = 0x0;
rLPCSEL &= ~((1 << 4) | 1);
}
|