📄 hw_display.c
字号:
/* * Copyright (C) 2006 Pawel Kolodziejski * * Some defines are from linux 2.6 kernel sources * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "types.h"#include "pxa-regs.h"#include "gpio.h"int clear_screen(void) { int l; for (l = 0; l < 153600; l++) { *(char *)(0xA3000000 + l) = 0xff; }}int display_on(void) { lcd_power_on(); pxafb_enable(); pxafb_disable(); pxafb_enable(); backlight_power_on();}int lcd_power_on(void) { gpo_set(GPO_A716_LCD_ENABLE); gpo_set(GPO_A716_LCD_POWER3); mdelay(30); gpo_set(GPO_A716_LCD_POWER1); mdelay(30);}int lcd_power_off(void) { gpo_clear(GPO_A716_LCD_POWER1); mdelay(65); gpo_clear(GPO_A716_LCD_POWER3); gpo_clear(GPO_A716_LCD_ENABLE);}int backlight_power_on(void) { CKEN |= CKEN0_PWM0; PWM_PWDUTY0 = 255; PWM_PERVAL0 = 255; gpo_set(GPO_A716_BACKLIGHT);}int backlight_power_off(void) { PWM_PWDUTY0 = 0; PWM_PERVAL0 = 0; gpo_clear(GPO_A716_BACKLIGHT); CKEN &= ~CKEN0_PWM0; mdelay(30);}struct pxafb_dma_descriptor { unsigned int fdadr; unsigned int fsadr; unsigned int fidr; unsigned int ldcmd;} __attribute__ ((aligned(16)));int pxafb_disable(void) { LCCR0 &= ~(LCCR0_LDM); LCCR0 &= ~(LCCR0_ENB); LCCR0 = 0; LCCR1 = 0; LCCR2 = 0; LCCR3 = 0; LCSR = 0xffffffff; FDADR0 = 0;}int pxafb_enable(void) { struct pxafb_dma_descriptor *dma = (struct pxafb_dma_descriptor *)0xA3100000; unsigned int *fdadr0 = (unsigned int *)0xA3100100; CKEN &= ~CKEN16_LCD; CKEN |= CKEN16_LCD; dma->fdadr = (unsigned int)dma; dma->fsadr = (unsigned int)0xA3000000; dma->fidr = 0; dma->ldcmd = 153600; LCCR3 = (LCCR3_16BPP | LCCR3_HorSnchL | LCCR3_VrtSnchL | 7); LCCR2 = LCCR2_DisHght(320) + LCCR2_VrtSnchWdth(6) + LCCR2_BegFrmDel(4) + LCCR2_EndFrmDel(4); LCCR1 = LCCR1_DisWdth(240) + LCCR1_HorSnchWdth(64) + LCCR1_BegLnDel(11) + LCCR1_EndLnDel(11); LCCR0 = (LCCR0_PAS | LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | LCCR0_QDM | LCCR0_BM | LCCR0_OUM); *fdadr0 = FDADR0; FDADR0 = dma->fdadr; FDADR1 = 0; LCCR0 |= LCCR0_ENB;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -