GBA specific definitions for internal peripheral handling. More...
GBA specific definitions for internal peripheral handling.
Definition in file periph_gba.h.
Include dependency graph for periph_gba.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | gba_timer |
| Struct whose members map onto the timer register. More... | |
Macros | |
| #define | GBA_TIMER_MAX_TICKS (0xFFFF) |
| We have 16 bit timer. | |
| #define | GBA_DISPCNT REG16(0x4000000) |
| Display Control register. | |
| #define | GBA_DISPSTAT REG16(0x4000004) |
| General LCD Status register. | |
| #define | GBA_VRAM_PALETTE MEM16(0x5000000) |
| VRAM color palette memory. | |
| #define | GBA_VRAM MEM16(0x6000000) |
| VRAM, 96Kb, 0x6017FFF - size depends on display mode! | |
Typedefs | |
| typedef volatile gba_timer | gba_timer_t |
| The type for the GBA timers. | |
| #define | REG32(ADDR) |
| Type for 32-bit registers. | |
| #define | REG16(ADDR) |
| Type for 16-bit registers. | |
| #define | MEM16(ADDR) |
| Type for 16-bit memory addresses. | |
| #define | GBA_PTR_TO_IRQ_HANDLER REG32(0x3007ffc) |
| Pointer to our IRQ handler, must be in 32bit ARM code. | |
| #define | GBA_IE REG16(0x4000200) |
| Interrupt enable register. | |
| #define | GBA_IE_TIMERS (0x0F << 3) |
| Bit mask for the timer interrupts enable-flag. | |
| #define | GBA_IF REG16(0x4000202) |
| Interrupt flags register. | |
| #define | GBA_IF_CLEAR_ALL (0x3FFF) |
| Bit mask to clear all pending interrupts. | |
| #define | GBA_IF_TIMERS (0x0F << 3) |
| Bit mask for the timer interrupts has-fired-flag. | |
| #define | GBA_IME REG16(0x4000208) /* Technically 32 bit reg, but only bit 0 is used */ |
| Interrupt Master Enable, globally enables / disables interrupts. | |
Timer control register | |
| #define | GBA_TM0_CNT_L REG16(0x4000100) |
| current value | |
| #define | GBA_TM0_CNT_H REG16(0x4000102) |
| settings | |
| #define | GBA_TM1_CNT_L REG16(0x4000104) |
| current value | |
| #define | GBA_TM1_CNT_H REG16(0x4000106) |
| settings | |
| #define | GBA_TM2_CNT_L REG16(0x4000108) |
| current value | |
| #define | GBA_TM2_CNT_H REG16(0x400010A) |
| settings | |
| #define | GBA_TM3_CNT_L REG16(0x400010C) |
| current value | |
| #define | GBA_TM3_CNT_H REG16(0x400010E) |
| settings | |
| #define | GBA_TIMER_FRQ_16K (16400lu) |
| Possible timer frequencies. | |
| #define | GBA_TIMER_FRQ_65K (65500lu) |
| F = 65.5kHz. | |
| #define | GBA_TIMER_FRQ_262K (262200lu) |
| F = 262.2kHz. | |
| #define | GBA_TIMER_FRQ_16M (16780000lu) |
| F = 16.78MHz. | |
| #define | GBA_TIMER_0 ((gba_timer_t *)0x4000100) |
| The four timers of the GBA. | |
| #define | GBA_TIMER_1 ((gba_timer_t *)0x4000104) |
| A GBA timer. | |
| #define | GBA_TIMER_2 ((gba_timer_t *)0x4000108) |
| A GBA timer. | |
| #define | GBA_TIMER_3 ((gba_timer_t *)0x400010C) |
| A GBA timer. | |
| #define | GBA_SCREEN_WIDTH (240) |
| Screen dimension in pixel. | |
| #define | GBA_SCREEN_HEIGHT (160) |
| height | |
Settings for GBA_DISPCNT | |
| #define | GBA_DISPCNT_BGMODE_0 0x0000 |
| Tiled, four layers, up to 1024 tiles. | |
| #define | GBA_DISPCNT_BGMODE_1 0x0001 |
| Tiled, three layers, up to 1024 tiles. | |
| #define | GBA_DISPCNT_BGMODE_2 0x0002 |
| Tiled, two layers, up to 1024 tiles. | |
| #define | GBA_DISPCNT_BGMODE_3 0x0003 |
| Bitmap, 240x160, 15-bit RGB. | |
| #define | GBA_DISPCNT_BGMODE_4 0x0004 |
| Bitmap, 240x160, 8-bit RGB. | |
| #define | GBA_DISPCNT_BGMODE_5 0x0005 |
| Bitmap, 160x128, 15-bit RGB. | |
| #define | GBA_DISPCNT_SDBG_0 0x0100 |
| Enable display of background 0. | |
| #define | GBA_DISPCNT_SDBG_1 0x0200 |
| Enable display of background 1. | |
| #define | GBA_DISPCNT_SDBG_2 0x0400 |
| Enable display of background 2. | |
| #define | GBA_DISPCNT_SDBG_3 0x0800 |
| Enable display of background 3. | |
| #define | GBA_DISPCNT_SDOBJ 0x1000 |
| Enable display of objects. | |
LCD background control registers | |
| #define | GBA_BG0CNT REG16(0x4000008) |
| BG0. | |
| #define | GBA_BG1CNT REG16(0x400000a) |
| BG1. | |
| #define | GBA_BG2CNT REG16(0x400000c) |
| BG2. | |
| #define | GBA_BG3CNT REG16(0x400000e) |
| BG3. | |
| #define GBA_BG0CNT REG16(0x4000008) |
BG0.
Definition at line 213 of file periph_gba.h.
| #define GBA_BG1CNT REG16(0x400000a) |
BG1.
Definition at line 214 of file periph_gba.h.
| #define GBA_BG2CNT REG16(0x400000c) |
BG2.
Definition at line 215 of file periph_gba.h.
| #define GBA_BG3CNT REG16(0x400000e) |
BG3.
Definition at line 216 of file periph_gba.h.
| #define GBA_DISPCNT REG16(0x4000000) |
Display Control register.
Definition at line 183 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_0 0x0000 |
Tiled, four layers, up to 1024 tiles.
Definition at line 189 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_1 0x0001 |
Tiled, three layers, up to 1024 tiles.
Definition at line 190 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_2 0x0002 |
Tiled, two layers, up to 1024 tiles.
Definition at line 191 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_3 0x0003 |
Bitmap, 240x160, 15-bit RGB.
Definition at line 192 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_4 0x0004 |
Bitmap, 240x160, 8-bit RGB.
Definition at line 193 of file periph_gba.h.
| #define GBA_DISPCNT_BGMODE_5 0x0005 |
Bitmap, 160x128, 15-bit RGB.
Definition at line 194 of file periph_gba.h.
| #define GBA_DISPCNT_SDBG_0 0x0100 |
Enable display of background 0.
Definition at line 196 of file periph_gba.h.
| #define GBA_DISPCNT_SDBG_1 0x0200 |
Enable display of background 1.
Definition at line 197 of file periph_gba.h.
| #define GBA_DISPCNT_SDBG_2 0x0400 |
Enable display of background 2.
Definition at line 198 of file periph_gba.h.
| #define GBA_DISPCNT_SDBG_3 0x0800 |
Enable display of background 3.
Definition at line 199 of file periph_gba.h.
| #define GBA_DISPCNT_SDOBJ 0x1000 |
Enable display of objects.
Definition at line 201 of file periph_gba.h.
| #define GBA_DISPSTAT REG16(0x4000004) |
General LCD Status register.
Definition at line 207 of file periph_gba.h.
| #define GBA_IE REG16(0x4000200) |
Interrupt enable register.
Bit Expl. 0 LCD V-Blank 1 LCD H-Blank 2 LCD V-Counter Match 3 Timer 0 Overflow 4 Timer 1 Overflow 5 Timer 2 Overflow 6 Timer 3 Overflow 7 Serial Communication 8 DMA 0 9 DMA 1 10 DMA 2 11 DMA 3 12 Keypad 13 Game Pak (external IRQ source) 14-15 Not used
Definition at line 66 of file periph_gba.h.
| #define GBA_IE_TIMERS (0x0F << 3) |
Bit mask for the timer interrupts enable-flag.
Definition at line 71 of file periph_gba.h.
| #define GBA_IF REG16(0x4000202) |
Interrupt flags register.
Bit Expl. 0 LCD V-Blank 1 LCD H-Blank 2 LCD V-Counter Match 3 Timer 0 Overflow 4 Timer 1 Overflow 5 Timer 2 Overflow 6 Timer 3 Overflow 7 Serial Communication 8 DMA 0 9 DMA 1 10 DMA 2 11 DMA 3 12 Keypad 13 Game Pak (external IRQ source) 14-15 Not used
Definition at line 93 of file periph_gba.h.
| #define GBA_IF_CLEAR_ALL (0x3FFF) |
Bit mask to clear all pending interrupts.
Definition at line 98 of file periph_gba.h.
| #define GBA_IF_TIMERS (0x0F << 3) |
Bit mask for the timer interrupts has-fired-flag.
Definition at line 103 of file periph_gba.h.
| #define GBA_IME REG16(0x4000208) /* Technically 32 bit reg, but only bit 0 is used */ |
Interrupt Master Enable, globally enables / disables interrupts.
We usually keep this register enabled but use the "official" ARM IME register for our needs
Definition at line 110 of file periph_gba.h.
| #define GBA_PTR_TO_IRQ_HANDLER REG32(0x3007ffc) |
Pointer to our IRQ handler, must be in 32bit ARM code.
Definition at line 44 of file periph_gba.h.
| #define GBA_SCREEN_HEIGHT (160) |
height
Definition at line 177 of file periph_gba.h.
| #define GBA_SCREEN_WIDTH (240) |
| #define GBA_TIMER_0 ((gba_timer_t *)0x4000100) |
| #define GBA_TIMER_1 ((gba_timer_t *)0x4000104) |
A GBA timer.
Definition at line 167 of file periph_gba.h.
| #define GBA_TIMER_2 ((gba_timer_t *)0x4000108) |
A GBA timer.
Definition at line 168 of file periph_gba.h.
| #define GBA_TIMER_3 ((gba_timer_t *)0x400010C) |
A GBA timer.
Definition at line 169 of file periph_gba.h.
| #define GBA_TIMER_FRQ_16K (16400lu) |
| #define GBA_TIMER_FRQ_16M (16780000lu) |
F = 16.78MHz.
Definition at line 138 of file periph_gba.h.
| #define GBA_TIMER_FRQ_262K (262200lu) |
F = 262.2kHz.
Definition at line 137 of file periph_gba.h.
| #define GBA_TIMER_FRQ_65K (65500lu) |
F = 65.5kHz.
Definition at line 136 of file periph_gba.h.
| #define GBA_TIMER_MAX_TICKS (0xFFFF) |
We have 16 bit timer.
Definition at line 129 of file periph_gba.h.
| #define GBA_TM0_CNT_H REG16(0x4000102) |
settings
Definition at line 117 of file periph_gba.h.
| #define GBA_TM0_CNT_L REG16(0x4000100) |
current value
Definition at line 116 of file periph_gba.h.
| #define GBA_TM1_CNT_H REG16(0x4000106) |
settings
Definition at line 119 of file periph_gba.h.
| #define GBA_TM1_CNT_L REG16(0x4000104) |
current value
Definition at line 118 of file periph_gba.h.
| #define GBA_TM2_CNT_H REG16(0x400010A) |
settings
Definition at line 121 of file periph_gba.h.
| #define GBA_TM2_CNT_L REG16(0x4000108) |
current value
Definition at line 120 of file periph_gba.h.
| #define GBA_TM3_CNT_H REG16(0x400010E) |
settings
Definition at line 123 of file periph_gba.h.
| #define GBA_TM3_CNT_L REG16(0x400010C) |
current value
Definition at line 122 of file periph_gba.h.
| #define GBA_VRAM MEM16(0x6000000) |
VRAM, 96Kb, 0x6017FFF - size depends on display mode!
Definition at line 227 of file periph_gba.h.
| #define GBA_VRAM_PALETTE MEM16(0x5000000) |
VRAM color palette memory.
Definition at line 222 of file periph_gba.h.
| #define MEM16 | ( | ADDR | ) |
Type for 16-bit memory addresses.
Definition at line 39 of file periph_gba.h.
| #define REG16 | ( | ADDR | ) |
Type for 16-bit registers.
Definition at line 34 of file periph_gba.h.
| #define REG32 | ( | ADDR | ) |
Type for 32-bit registers.
Definition at line 29 of file periph_gba.h.
| typedef volatile gba_timer gba_timer_t |
The type for the GBA timers.
Definition at line 160 of file periph_gba.h.