Loading...
Searching...
No Matches
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
19#ifndef PERIPH_GBA_H
20#define PERIPH_GBA_H
21
22#include <stdint.h>
23
24#ifdef __cplusplus
25extern "C"
26{
27#endif
28
32#define REG32(ADDR) (*(uint32_t volatile (*))(ADDR))
33
37#define REG16(ADDR) (*(uint16_t volatile (*))(ADDR))
38
42#define MEM16(ADDR) ((uint16_t(*))(ADDR))
43
48#define GBA_SCREEN_WIDTH (240)
49#define GBA_SCREEN_HEIGHT (160)
55#define GBA_DISPCNT REG16(0x4000000)
56
61#define GBA_DISPCNT_BGMODE_0 0x0000
62#define GBA_DISPCNT_BGMODE_1 0x0001
63#define GBA_DISPCNT_BGMODE_2 0x0002
64#define GBA_DISPCNT_BGMODE_3 0x0003
65#define GBA_DISPCNT_BGMODE_4 0x0004
66#define GBA_DISPCNT_BGMODE_5 0x0005
68#define GBA_DISPCNT_SDBG_0 0x0100
69#define GBA_DISPCNT_SDBG_1 0x0200
70#define GBA_DISPCNT_SDBG_2 0x0400
71#define GBA_DISPCNT_SDBG_3 0x0800
73#define GBA_DISPCNT_SDOBJ 0x1000
79#define GBA_DISPSTAT REG16(0x4000004)
80
85#define GBA_BG0CNT REG16(0x4000008)
86#define GBA_BG1CNT REG16(0x400000a)
87#define GBA_BG2CNT REG16(0x400000c)
88#define GBA_BG3CNT REG16(0x400000e)
94#define GBA_VRAM_PALETTE MEM16(0x5000000)
95
99#define GBA_VRAM MEM16(0x6000000)
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif /* PERIPH_GBA_H */