All pastes #885374 Raw Edit

Miscellany

public c v1 · immutable
#885374 ·published 2008-01-30 21:55 UTC
rendered paste body
/*************************************************************************** *             __________               __   ___. *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  / *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  < *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \ *                     \/            \/     \/    \/            \/ * $Id: lcd-archos-bitmap.c 13114 2007-04-11 23:51:00Z amiconn $ * * Copyright (C) 2002 by Alan Korr * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/#include "config.h"#include "cpu.h"#include "lcd.h"#include "kernel.h"#include "system.h"#include "system-target.h"#include "hwcompat.h"/* TCC77x specific defines */#define HwCSCFG1                        *(volatile unsigned long *)0xF0000014   // R/W, Ext. CS Configuration#define HwMCFG                          *(volatile unsigned long *)0xF0000008   // R/W, Misc. Configuration#define HwCSCFG1_URDY  (1<<21)  // Use Ready#define LCD_CMD   *(volatile unsigned char*)(0x50080000)#define LCD_DATA  *(volatile unsigned char*)(0x50080001)#define LCD_CS          1#define LCD_BASEADDR    0x5#define LCD_BUSWIDTH    3#define LCD_STUPTIME    5#define LCD_PULSEWIDTH  9#define LCD_HOLDTIME    2#define HwCSCFG(CS)   *(volatile unsigned long*)(0xF0000010 + ((CS)<<2))#define McSetLCD(CS, BASE, BW, URDY, SETUP, PW, HOLD)   \        HwCSCFG(CS)     = ( \                ((3) << 26) | \                (((BW)^((HwMCFG&0x1800)>>11)) << 28) | \                 ((BASE)<<22) | \                 ((URDY)<<21) | \                 ((1<<20)) | \                 (((SETUP)&7)<<11) | \                 (((PW)&0xFF)<<3) | \                 ((HOLD)&7) \                )void lcd_write_command(int byte){    LCD_CMD = byte;            asm volatile (        "nop      \n\t"        "nop      \n\t"        "nop      \n\t"    );}void lcd_write_data(const fb_data* p_bytes, int count){    while (count--)    {        LCD_DATA = *(p_bytes++);        asm volatile (            "nop      \n\t"            "nop      \n\t"            "nop      \n\t"        );    }}void lcd_write_reg(int reg, int data){    GPIOA |= 0x400;    outw(0, 0x50010000);    outw(reg<<1,0x50010000);    GPIOA &= ~0x400;    outw((data & 0xff00) >> 7, 0x50010008);    outw((data << 24)>>23, 0x50010008);}static void lcd_delay(int x){    int i;    x *= 0xc35;     for (i=0;i<x*8;i++) {}; }/* End of TCC77x specific defines *//** globals **/static int xoffset; /* needed for flip *//*** hardware configuration ***/int lcd_default_contrast(void){    return 31;}void lcd_set_contrast(int val){}void lcd_set_invert_display(bool yesno){}/* turn the display upside down (call lcd_update() afterwards) */void lcd_set_flip(bool yesno){}/* LCD init */void lcd_init_device(void){// 58c30:	e52de004	str 	lr, [sp, -0x4]!// 58c34:	e3a024f0	mov 	r2, 0xf0000000// 58c38:	e5920008	ldr 	r0, [r2, 0x8]// 58c3c:	e1a00980	mov 	r0, r0 lsl #19// 58c40:	e3a01002	mov 	r1, 0x2// 58c44:	e0210f20	eor 	r0,	r1,	r0 lsr #30// 58c48:	e59f10ac	ldr 	r1, [pc, 0xac] <- 0xd500023// 58c4c:	e1810e00	orr 	r0,	r1,	r0 lsl #28// 58c50:	e5820014	str 	r0, [r2, 0x14]    CSCFG1 = ((2 ^ ((MCFG << 19) >> 30)) <<28) | 0x0d500023;    /* lcd init 1 */    lcd_write_reg(0x0, 0x1);    lcd_delay(0xf);    lcd_write_reg(0x7, 0x0);    lcd_delay(0xa);    lcd_write_reg(0x11, 0x2);    lcd_write_reg(0x12, 0xa);    lcd_write_reg(0x13, 0xc5a);             lcd_write_reg(0x10, 0x4);    lcd_write_reg(0x10, 0x134);    lcd_write_reg(0x11, 0x111);    lcd_write_reg(0x12, 0x1c);    lcd_delay(0x28);    lcd_write_reg(0x13, 0x2c40);    lcd_write_reg(0x10, 0x510);    lcd_delay(0x3c);    /* lcd init 2 */    lcd_write_reg(0x1, 0x113);    lcd_write_reg(0x2, 0x700);    lcd_write_reg(0x3, 0x1038);    lcd_write_reg(0x8, 0x508);    lcd_write_reg(0x9, 0x0);    lcd_write_reg(0xb, 0x3);    lcd_write_reg(0x21, 0x0);    lcd_write_reg(0x30, 0x406);    lcd_write_reg(0x31, 0x303);    lcd_write_reg(0x32, 0x0);    lcd_write_reg(0x33, 0x305);    lcd_write_reg(0x34, 0x404);    lcd_write_reg(0x35, 0x0);    lcd_write_reg(0x36, 0x0);    lcd_write_reg(0x37, 0x503);    lcd_write_reg(0x38, 0x1d05);    lcd_write_reg(0x39, 0x1d05);    lcd_write_reg(0x41, 0x0);    lcd_write_reg(0x42, 0x9f00);    lcd_write_reg(0x43, 0x9f00);    lcd_write_reg(0x44, 0x7f00);    lcd_write_reg(0x45, 0x9f00);    /* lcd init 3 */    lcd_write_reg(0x10, 0x4510);    lcd_write_reg(0x7, 0x5);    lcd_delay(0x28);    lcd_write_reg(0x7, 0x25);    lcd_write_reg(0x7, 0x27);    lcd_delay(0x28);    lcd_write_reg(0x7, 0x37);}/*** Update functions ***//* Performance function that works with an external buffer   note that by and bheight are in 8-pixel units! */void lcd_blit(const fb_data* data, int x, int by, int width,                     int bheight, int stride){}/* Update the display.   This must be called after all other LCD functions that change the display. *///void lcd_update(void) ICODE_ATTR;void lcd_update(void){}/* Update a fraction of the display. *///void lcd_update_rect(int, int, int, int) ICODE_ATTR;void lcd_update_rect(int x, int y, int width, int height){}