Alchemy
Loading...
Searching...
No Matches

io_write_queue.h File Reference

The register write queue that VBlank carries out after each finished frame. More...

Go to the source code of this file.

Data Structures

struct  IoWriteQueue
 The register writes VBlank carries out once the frame loop has finished a frame; IoWriteQueue_FlushPending empties it. More...

Macros

#define IO_WRITE_8   (1 << 16)
 Writes a byte.
#define IO_WRITE_16   (2 << 16)
 Writes a halfword.
#define IO_WRITE_32   (3 << 16)
 Writes a word.
#define IO_WRITE_SET   (4 << 16)
 ORs the value into the register instead of storing it.
#define IO_WRITE_CLEAR   (8 << 16)
 Clears the value's bits in the register instead of storing it.
#define IO_WRITE_QUEUE_PUSH(address, value, control)
 Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped.
#define IO_WRITE_QUEUE_PUSH_IME(ime, address, value, control)
 Like IO_WRITE_QUEUE_PUSH, but keeps IME's address in the caller's ime variable while disabling and restoring interrupts.

Functions

void IoWriteQueue_Store8 (u32 address, u32 value)
 Queues a byte store.
void IoWriteQueue_Store16 (u32 address, u32 value)
 Queues a halfword store.
void IoWriteQueue_Store32 (u32 address, u32 value)
 Queues a word store.
void IoWriteQueue_SetBits8 (u32 address, u32 value)
 Queues setting a byte register's bits.
void IoWriteQueue_SetBits16 (u32 address, u32 value)
 Queues setting a halfword register's bits.
void IoWriteQueue_SetBits32 (u32 address, u32 value)
 Queues setting a word register's bits.
void IoWriteQueue_ClearBits8 (u32 address, u32 value)
 Queues clearing a byte register's bits.
void IoWriteQueue_ClearBits16 (u32 address, u32 value)
 Queues clearing a halfword register's bits.
void IoWriteQueue_ClearBits32 (u32 address, u32 value)
 Queues clearing a word register's bits.

Variables

struct IoWriteQueue gIoWriteQueue

Detailed Description

The register write queue that VBlank carries out after each finished frame.

Definition in file io_write_queue.h.

Macro Definition Documentation

◆ IO_WRITE_8

#define IO_WRITE_8   (1 << 16)

Writes a byte.

Definition at line 29 of file io_write_queue.h.

Referenced by IoWriteQueue_ClearBits8(), IoWriteQueue_SetBits8(), and IoWriteQueue_Store8().

◆ IO_WRITE_16

#define IO_WRITE_16   (2 << 16)

◆ IO_WRITE_32

#define IO_WRITE_32   (3 << 16)

Writes a word.

Definition at line 33 of file io_write_queue.h.

Referenced by IoWriteQueue_ClearBits32(), IoWriteQueue_SetBits32(), and IoWriteQueue_Store32().

◆ IO_WRITE_SET

#define IO_WRITE_SET   (4 << 16)

ORs the value into the register instead of storing it.

Definition at line 35 of file io_write_queue.h.

Referenced by IoWriteQueue_SetBits16(), IoWriteQueue_SetBits32(), and IoWriteQueue_SetBits8().

◆ IO_WRITE_CLEAR

#define IO_WRITE_CLEAR   (8 << 16)

Clears the value's bits in the register instead of storing it.

Definition at line 37 of file io_write_queue.h.

Referenced by IoWriteQueue_ClearBits16(), IoWriteQueue_ClearBits32(), and IoWriteQueue_ClearBits8().

◆ IO_WRITE_QUEUE_PUSH

#define IO_WRITE_QUEUE_PUSH ( address,
value,
control )
Value:
{ \
struct IoWriteQueue *q = &gIoWriteQueue; \
u32 saved; \
s32 count; \
u16 *count_ = &q->count; \
\
IRQ_LOCK(saved); \
count = *count_; \
if (count <= 31) { \
u32 *entry = q->entries[count]; \
\
*count_ = count + 1; \
*entry++ = (value); \
*entry++ = (address); \
*entry = (control); \
} \
IRQ_UNLOCK(saved); \
}
struct IoWriteQueue gIoWriteQueue
The register writes VBlank carries out once the frame loop has finished a frame; IoWriteQueue_FlushPe...
u16 count
Entries waiting, at most 32.
u32 entries[32][3]
Each entry is the value, the address and the control word, in that order.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13

Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped.

Parameters
controla width (IO_WRITE_8 to IO_WRITE_32), with IO_WRITE_SET or IO_WRITE_CLEAR to change bits; or a DMA control word.

Definition at line 58 of file io_write_queue.h.

Referenced by BattleFx_BeginCanvasLayer(), BattleFx_ConfigureEffectDisplay(), BattleFx_EndCanvasLayer(), BattleFx_OpenCanvasLayer(), BattleFx_PlayUnitElementEffect(), BattleFx_RunShatteringOpening(), BattleFx_RunTorch(), BattlePalette_UpdateBlend(), BattlePres_RunEntryTransition(), BattlePresentation_ConfigurePaletteFade(), Clear_UpdateBlend(), Colosso_FadeInCompetitor(), Colosso_UpdateLettering(), DisplayTransition_Start(), DisplayTransition_UpdateFrame(), Graphics_LoadCharacterBlockAndPalette(), Map_ShowWorldMap(), Map_UpdateWorldMapMarkers(), Menu_RunCommandRow(), PaletteFade_Update(), SuhallaDesert_RaiseStorm(), SuhallaDesert_SetUpFirstSceneStorms(), SuhallaDesert_SetUpSecondSceneStorms(), Title_RevealScreen(), Title_ShowIntro(), and WorldMap_PlayLighthouseTransition().

◆ IO_WRITE_QUEUE_PUSH_IME

#define IO_WRITE_QUEUE_PUSH_IME ( ime,
address,
value,
control )
Value:
{ \
struct IoWriteQueue *q; \
u32 saved; \
s32 count; \
u16 *count_; \
\
q = &gIoWriteQueue; \
count_ = &q->count; \
IME_SAVE(ime, saved); \
IME_DISABLE(ime); \
count = *count_; \
if (count <= 31) { \
u32 *entry = q->entries[count]; \
\
*count_ = count + 1; \
*entry++ = (value); \
*entry++ = (address); \
*entry = (control); \
} \
IME_RESTORE(ime, saved); \
}

Like IO_WRITE_QUEUE_PUSH, but keeps IME's address in the caller's ime variable while disabling and restoring interrupts.

Definition at line 82 of file io_write_queue.h.

Referenced by BattleFx_PlayUnitElementEffect(), and BattleFx_RunJudgment().

Function Documentation

◆ IoWriteQueue_Store8()

void IoWriteQueue_Store8 ( u32 address,
u32 value )

Queues a byte store.

Definition at line 19 of file io_queue.c.

Referenced by IoWriteQueue_Store8().

◆ IoWriteQueue_Store16()

◆ IoWriteQueue_Store32()

void IoWriteQueue_Store32 ( u32 address,
u32 value )

Queues a word store.

Definition at line 23 of file io_queue.c.

Referenced by HeatGauge_Draw(), and IoWriteQueue_Store32().

◆ IoWriteQueue_SetBits8()

void IoWriteQueue_SetBits8 ( u32 address,
u32 value )

Queues setting a byte register's bits.

Definition at line 25 of file io_queue.c.

Referenced by IoWriteQueue_SetBits8().

◆ IoWriteQueue_SetBits16()

void IoWriteQueue_SetBits16 ( u32 address,
u32 value )

◆ IoWriteQueue_SetBits32()

void IoWriteQueue_SetBits32 ( u32 address,
u32 value )

Queues setting a word register's bits.

Definition at line 29 of file io_queue.c.

Referenced by IoWriteQueue_SetBits32().

◆ IoWriteQueue_ClearBits8()

void IoWriteQueue_ClearBits8 ( u32 address,
u32 value )

Queues clearing a byte register's bits.

Definition at line 31 of file io_queue.c.

Referenced by IoWriteQueue_ClearBits8().

◆ IoWriteQueue_ClearBits16()

void IoWriteQueue_ClearBits16 ( u32 address,
u32 value )

◆ IoWriteQueue_ClearBits32()

void IoWriteQueue_ClearBits32 ( u32 address,
u32 value )

Queues clearing a word register's bits.

Definition at line 35 of file io_queue.c.

Referenced by IoWriteQueue_ClearBits32().

Variable Documentation

◆ gIoWriteQueue

struct IoWriteQueue gIoWriteQueue
extern