1 | /** |
---|
2 | * @file gba.h |
---|
3 | * |
---|
4 | * This include file contains definitions related to the ARM BSP. |
---|
5 | */ |
---|
6 | /* |
---|
7 | * RTEMS GBA BSP |
---|
8 | * |
---|
9 | * Copyright (c) 2004 Markku Puro <markku.puro@kopteri.net> |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _GBA_H |
---|
19 | #define _GBA_H |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
25 | #include <gba_registers.h> |
---|
26 | |
---|
27 | /*---------------------------------------------------------------------------* |
---|
28 | * Clock * |
---|
29 | *---------------------------------------------------------------------------*/ |
---|
30 | #define __ClockFrequency 16780000L /**< ClockFreguency in Hz */ |
---|
31 | #define __TimPreScaler 1024L /**< Prescaler value 1,64,256,1024 */ |
---|
32 | |
---|
33 | /*---------------------------------------------------------------------------* |
---|
34 | * Activation defines * |
---|
35 | *---------------------------------------------------------------------------*/ |
---|
36 | /** |
---|
37 | * Multiboot/Cart boot Selection. |
---|
38 | * |
---|
39 | * If the variable __gba_multiboot is defined |
---|
40 | * (probably should be in your main project file) then code |
---|
41 | * is generated which will run as a multiboot image (code starts |
---|
42 | * at 0x02000000) or as a normal flash cart / emulator image. |
---|
43 | * (i.e. start.S copies code from ROM to EWRAM if started in cart |
---|
44 | * or emulator.) If this variable is not defined then code is |
---|
45 | * generated for flash cart / emulator only operation (code starts |
---|
46 | * at 0x08000000). |
---|
47 | */ |
---|
48 | #define MULTIBOOT volatile const unsigned short __gba_multiboot; |
---|
49 | |
---|
50 | /** |
---|
51 | * IWRAM/EWRAM data Selection. |
---|
52 | * |
---|
53 | * If the variable __gba_iwram_data is defined |
---|
54 | * (probably should be in your main project file) then code |
---|
55 | * is generated which will allocate data section in IWRAM |
---|
56 | * (data starts at 0x03000080). |
---|
57 | * If this variable is not defined then data sections is |
---|
58 | * allocated in EWRAM (data starts at 0x02000000). |
---|
59 | */ |
---|
60 | #define IWRAMDATA volatile const unsigned short __gba_iwram_data; |
---|
61 | |
---|
62 | /** |
---|
63 | * IWRAM/EWRAM bss Selection. |
---|
64 | * |
---|
65 | * If the variable __gba_iwram_bss is defined |
---|
66 | * (probably should be in your main project file) then code |
---|
67 | * is generated which will allocate bss section in IWRAM |
---|
68 | * (data starts at 0x03000080). |
---|
69 | * If this variable is not defined then bss sections is |
---|
70 | * allocated in EWRAM (data starts at 0x02000000). |
---|
71 | */ |
---|
72 | #define IWRAMBSS volatile const unsigned short __gba_iwram_bss; |
---|
73 | |
---|
74 | |
---|
75 | /*---------------------------------------------------------------------------* |
---|
76 | * Attributes * |
---|
77 | *---------------------------------------------------------------------------*/ |
---|
78 | #define CODE_IN_ROM __attribute__ ((section (".text"), long_call)) |
---|
79 | #define CODE_IN_IWRAM __attribute__ ((section (".iwram"), long_call)) |
---|
80 | #define IN_IWRAM __attribute__ ((section (".iwram"))) |
---|
81 | #define IN_EWRAM __attribute__ ((section (".ewram"))) |
---|
82 | |
---|
83 | /*---------------------------------------------------------------------------* |
---|
84 | * Console Keypad * |
---|
85 | *---------------------------------------------------------------------------*/ |
---|
86 | #define OK_KEY (0==0) /**< TRUE */ |
---|
87 | #define NO_KEY (0==1) /**< FALSE */ |
---|
88 | #define GBA_KEYS_PRESSED(keys) (( ((~GBA_REG_P1) & (keys)) == (keys)) ? (OK_KEY) : (NO_KEY)) |
---|
89 | #define GBA_ANY_KEY(keys) (( ((~GBA_REG_P1) & (keys)) != 0) ? (OK_KEY) : (NO_KEY)) |
---|
90 | #define GBA_KEY() ((~GBA_REG_P1)&GBA_KEY_ALL) |
---|
91 | |
---|
92 | /*---------------------------------------------------------------------------* |
---|
93 | * Console Screen * |
---|
94 | *---------------------------------------------------------------------------*/ |
---|
95 | #define GBA_LCD_WIDTH 240 |
---|
96 | #define GBA_LCD_HEIGHT 160 |
---|
97 | #define GBA_MODE5_WIDTH 160 |
---|
98 | #define GBA_MODE5_HEIGHT 128 |
---|
99 | #define GBA_LCD_ASPECT ((float)(GBA_LCD_WIDTH / GBA_LCD_HEIGHT)) |
---|
100 | |
---|
101 | |
---|
102 | #ifdef __cplusplus |
---|
103 | } |
---|
104 | #endif |
---|
105 | |
---|
106 | #endif |
---|