3 Copyright (c) 2008 Daniel Mack <daniel@caiaq.de>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "wikireader.h"
27 u8
spi_transmit_lcd(u8 out
)
30 do {} while (REG_SPI_STAT
& (1 << 6));
40 REG_CMU_PROTECT
= CMU_PROTECT_OFF
;
47 REG_CMU_CLKCNTL
= (REG_CMU_CLKCNTL
& ~LCDCDIV_MASK
) | LCDCDIV_16
;
49 REG_CMU_PROTECT
= CMU_PROTECT_ON
;
55 /* SPI setup - should move somewhere else */
56 REG_SPI_WAIT
= 0x00000000;
57 REG_SPI_RXMK
= 0x00000000;
58 REG_SPI_INT
= 0x00000014;
59 REG_SPI_CTL1
= 0x00001C73;
75 /* HT = (47+1) * 8 = 384 characters, HDP = (39+1) * 8 = 320 characters */
76 #define HDP (LCD_VRAM_WIDTH_BYTES - 1)
81 (HDP
<< HDPCNT_SHIFT
) |
84 /* VT = 244 + 1 = 255 lines, VDP = 239 + 1 = 480 lines */
85 #define VDP (LCD_VRAM_HEIGHT_LINES - 1)
88 ((VDP
+ 1) << VTCNT_SHIFT
) |
89 (VDP
<< VDPCNT_SHIFT
) |
95 /* LCDC Display Mode Register, grayscale */
145 /* relocate the frame buffer RAM */
146 REG_LCDC_MADD
= LCD_VRAM
;
150 spi_transmit_lcd(0xa8);
157 /* set reg_power_save = 11b (normal mode) */