1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 François Dinel
11 * Copyright (C) 2008-2009 Rafaël Carré
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
29 void lcd_hw_init(void)
31 /* DBOP initialisation, do what OF does */
32 CGU_DBOP
= (1<<3) | AS3525_DBOP_DIV
;
34 GPIOB_AFSEL
= 0x08; /* DBOP on pin 3 */
35 GPIOC_AFSEL
= 0x0f; /* DBOP on pins 3:0 */
38 DBOP_TIMPOL_01
= 0x6E167;
39 DBOP_TIMPOL_23
= 0xA167E06F;
41 GPIOA_DIR
|= 0x33; /* pins 5:4 and 1:0 out */
42 GPIOB_DIR
|= 0x40; /* pin 6 out */
44 GPIOA_PIN(1) = (1<<1);
45 GPIOA_PIN(0) = (1<<0);
47 GPIOB_PIN(6) = (1<<6);
52 void lcd_write_command(int byte
)
55 while(i
<LCD_DELAY
) i
++;
57 /* unset D/C# (data or command) */
61 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
62 DBOP_DOUT
= (byte
<< 8) | byte
;
64 /* While push fifo is not empty */
65 while ((DBOP_STAT
& (1<<10)) == 0)
69 void lcd_write_data(const fb_data
* p_bytes
, int count
)
72 while(i
<LCD_DELAY
) i
++;
74 /* set D/C# (data or command) */
75 GPIOA_PIN(5) = (1<<5);
80 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
81 DBOP_DOUT
= (*p_bytes
<< 8) | *p_bytes
;
83 p_bytes
++; /* next packed pixels */
85 /* Wait if push fifo is full */
86 while ((DBOP_STAT
& (1<<6)) != 0);
88 /* While push fifo is not empty */
89 while ((DBOP_STAT
& (1<<10)) == 0);