Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / prex-0.9.0 / bsp / drv / arm / gba / lcd.h @ 03e9c04a

History | View | Annotate | Download (3.01 KB)

1
/*-
2
 * Copyright (c) 2005, Kohsuke Ohtani
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 * 3. Neither the name of the author nor the names of any co-contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 */
29

    
30
/*
31
 * lcd.h - GBA LCD definition
32
 */
33

    
34
/**
35
 * Memo: Map/Tile Location
36
 *
37
 *  BG1 ... Keyboard1 (normal)
38
 *  BG2 ... Keyboard2 (shifted)
39
 *  BG3 ... Text
40
 *
41
 *  +------------+ 6010000
42
 *  |            |
43
 *  |            |
44
 *  |            |
45
 *  |            |
46
 *  |            |
47
 *  +------------+ 600C000
48
 *  |  BG2 MAP   |
49
 *  +------------+ 600A000
50
 *  |  BG1 MAP   |
51
 *  +------------+ 6009000
52
 *  |  BG3 MAP   |
53
 *  +------------+ 6008000
54
 *  |   Tile 2   |
55
 *  |(KBD2)      |
56
 *  |- - - - - - | 6006000
57
 *  |            |
58
 *  |(KBD1)      |
59
 *  +------------+ 6004000
60
 *  |   Tile 1   |
61
 *  |            |
62
 *  |            |
63
 *  |            |
64
 *  |(Font)      |
65
 *  +------------+ 6000000
66
 */
67

    
68
#define VSCR_COLS        32
69
#define SCR_COLS        30
70
#define SCR_ROWS        20
71

    
72
/* Registers for keypad control */
73
#define REG_DISPCNT        (*(volatile uint16_t *)0x4000000)
74
#define REG_BG0CNT        (*(volatile uint16_t *)0x4000008)
75
#define REG_BG1CNT        (*(volatile uint16_t *)0x400000A)
76
#define REG_BG2CNT        (*(volatile uint16_t *)0x400000C)
77
#define REG_BG3CNT        (*(volatile uint16_t *)0x400000E)
78

    
79
#define BG_PALETTE        (uint16_t *)0x5000000
80

    
81
#define CONSOLE_TILE        (uint16_t *)0x6000000
82
#define CONSOLE_MAP        (uint16_t *)0x6008000
83

    
84
#define KBD1_TILE        (uint16_t *)0x6004000
85
#define KBD2_TILE        (uint16_t *)0x6006000
86
#define KBD1_MAP        (uint16_t *)0x6009000
87
#define KBD2_MAP        (uint16_t *)0x600A000
88

    
89
#define OAM                (uint16_t *)0x7000000
90
#define SPL_PALETTE        (uint16_t *)0x5000200
91
#define CURSOR_DATA        (uint16_t *)0x6010000
92

    
93

    
94
#define        RGB(r, g, b)        (((b) << 10) + ((g) << 5) + (r))