periph_gba.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 HAW Hamburg. All rights reserved.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
21 #include <stdint.h>
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
31 #define REG32(ADDR) (*(uint32_t volatile (*))(ADDR))
32 
36 #define REG16(ADDR) (*(uint16_t volatile (*))(ADDR))
37 
41 #define MEM16(ADDR) ((uint16_t(*))(ADDR))
42 
47 #define GBA_SCREEN_WIDTH (240)
48 #define GBA_SCREEN_HEIGHT (160)
54 #define GBA_DISPCNT REG16(0x4000000)
55 
60 #define GBA_DISPCNT_BGMODE_0 0x0000
61 #define GBA_DISPCNT_BGMODE_1 0x0001
62 #define GBA_DISPCNT_BGMODE_2 0x0002
63 #define GBA_DISPCNT_BGMODE_3 0x0003
64 #define GBA_DISPCNT_BGMODE_4 0x0004
65 #define GBA_DISPCNT_BGMODE_5 0x0005
67 #define GBA_DISPCNT_SDBG_0 0x0100
68 #define GBA_DISPCNT_SDBG_1 0x0200
69 #define GBA_DISPCNT_SDBG_2 0x0400
70 #define GBA_DISPCNT_SDBG_3 0x0800
72 #define GBA_DISPCNT_SDOBJ 0x1000
78 #define GBA_DISPSTAT REG16(0x4000004)
79 
84 #define GBA_BG0CNT REG16(0x4000008)
85 #define GBA_BG1CNT REG16(0x400000a)
86 #define GBA_BG2CNT REG16(0x400000c)
87 #define GBA_BG3CNT REG16(0x400000e)
93 #define GBA_VRAM_PALETTE MEM16(0x5000000)
94 
98 #define GBA_VRAM MEM16(0x6000000)
99 
100 #ifdef __cplusplus
101 }
102 #endif
103