查看: 2729|回复: 0
打印 上一主题 下一主题

S3C2440 LCD控制器

[复制链接]
跳转到指定楼层
沙发
发表于 2016-6-20 20:02:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/* 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);
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入中科因仑

本版积分规则

快速回复 返回顶部 返回列表