Alchemy
Loading...
Searching...
No Matches

dma.h File Reference

DMA channel registers, and the DMA and CPU fills. More...

Go to the source code of this file.

Data Structures

struct  DmaRegisters
 A DMA channel's registers (DMAxSAD, DMAxDAD, DMAxCNT). More...

Macros

#define DMA3   ((volatile struct DmaRegisters *)REG_DMA3)
 DMA3, the channel the game copies with, as its three registers.
#define Dma_Fill16(value, destination, size)
 Fills size bytes at destination with the halfword value by DMA3, from a volatile copy of it on the stack.
#define Dma_Fill32(value, destination, size)
 Fills size bytes at destination with the word value by DMA3.
#define Dma_Fill32Cell(cell, value, destination, size)
 Dma_Fill32 through the caller's own volatile word cell, so a function that fills several blocks keeps one word for all of them and forms its address once; the word also takes the caller's place in the frame (Map_InitializePerspectiveScene's sp+28, where Dma_Fill32's would be sp+16).
#define Cpu_Fill32(value, destination, size)
 pret's CpuFill32: repeats one word through the BIOS CpuSet service.

Functions

static __inline__ void Dma_Set (const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
 Starts a DMA transfer: stores the source, destination and control words into channel's registers with one stmia.

Detailed Description

DMA channel registers, and the DMA and CPU fills.

Definition in file dma.h.

Macro Definition Documentation

◆ DMA3

#define DMA3   ((volatile struct DmaRegisters *)REG_DMA3)

DMA3, the channel the game copies with, as its three registers.

Definition at line 18 of file dma.h.

Referenced by WaitFrames().

◆ Dma_Fill16

#define Dma_Fill16 ( value,
destination,
size )
Value:
{ \
volatile u16 fill_ = (value); \
Dma_Set((const void *)&fill_, (destination), \
(DMA_ENABLE | DMA_SRC_FIXED) << 16 | ((size) / 2), REG_DMA3); \
}
#define DMA_SRC_FIXED
Definition io_reg.h:207
#define REG_DMA3
Definition io_reg.h:153
#define DMA_ENABLE
Definition io_reg.h:217
unsigned short u16
Definition types.h:13

Fills size bytes at destination with the halfword value by DMA3, from a volatile copy of it on the stack.

Definition at line 22 of file dma.h.

Referenced by Memory_FillHalfwordsDma(), and UiWindow_FillFromScene().

◆ Dma_Fill32

#define Dma_Fill32 ( value,
destination,
size )
Value:
{ \
volatile u32 fill_ = (value); \
Dma_Set((const void *)&fill_, (destination), \
(DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | ((size) / 4), \
}
#define DMA_32BIT
Definition io_reg.h:210
unsigned int u32
Definition types.h:15

Fills size bytes at destination with the word value by DMA3.

Definition at line 30 of file dma.h.

Referenced by AffineEffect_InitializeWork(), AltmillerCave_Initialize(), BattleEffect_InitializeBuffers(), BattleFx_ClearOwnedSlot(), BattleFx_InitializeSlots(), BattleFx_LoadActionEffectResources(), BattleFx_RunAnnihilation(), BattleFx_SetupResourcesAndWindow(), BattleFx_StartBufferBlend(), BattlePresentation_InitializeWorkAndResetState(), Colosso_ShowItemIcon(), Curtain_Start(), DebugText_Clear(), DisplayScroll_InitializeHBlankDma(), DisplayTransition_AllocateAndClearState(), DisplayTransition_FillTilemapAndSolidTile(), DisplayTransition_InitializeBattleEffectState(), DisplayTransition_InitializeState(), EffectSlot_Initialize(), Field_PlaceMapMarkers(), Field_RunScene(), FieldEffect_InitSparkles(), FieldFx_StartGroundParticles(), FieldFx_StartLightning(), FieldMotes_Start(), FieldObject_Create(), MapAnimation_StartChannels(), MercuryLighthouse_RestoreLights(), ObjectDispatch_Release(), OptionMenu_InitializeWork(), PaletteFade_Init(), ResourceMetadata_ClearRecord(), ResourceObject_Release(), RunSceneTransitionEffect(), Runtime_InitializeHeap(), SaveMenu_SelectSlot(), SaveState_InitializeWorkspace(), SaveState_InvalidateSlot(), SaveState_LoadSummaryRecords(), SaveState_WriteRecord(), SerialRuntime_Initialize(), Shop_InitializeCursorWork(), SolSanctum_StartFloatingLights(), System_Initialize(), SystemMenu_Initialize(), UiWindow_InitializeWork(), and WorldMap_LoadGraphics().

◆ Dma_Fill32Cell

#define Dma_Fill32Cell ( cell,
value,
destination,
size )
Value:
{ \
(cell) = (value); \
Dma_Set((const void *)&(cell), (destination), \
(DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | ((size) / 4), \
}

Dma_Fill32 through the caller's own volatile word cell, so a function that fills several blocks keeps one word for all of them and forms its address once; the word also takes the caller's place in the frame (Map_InitializePerspectiveScene's sp+28, where Dma_Fill32's would be sp+16).

Definition at line 42 of file dma.h.

Referenced by Battle_RunEncounter(), BattleFx_SetupBlendedDisplay(), BattleFx_StartFadeOverlay(), BattlePres_RunEntryTransition(), DisplayScroll_InitObjectTable(), Graphics_ClearCharacterBlockAndPalette(), Map_InitializePerspectiveScene(), ObjectSystem_Configure(), ObjectSystem_Initialize(), and Ui_RunIconMonitor().

◆ Cpu_Fill32

#define Cpu_Fill32 ( value,
destination,
size )
Value:
{ \
volatile u32 fill_ = (value); \
Bios_CpuSet((const void *)&fill_, (destination), \
CPU_SET_32BIT | CPU_SET_SRC_FIXED | ((size) / 4)); \
}
#define CPU_SET_SRC_FIXED
BIOS CpuSet control flags, above its count.
Definition io_reg.h:236
#define CPU_SET_32BIT
Definition io_reg.h:237

pret's CpuFill32: repeats one word through the BIOS CpuSet service.

Definition at line 51 of file dma.h.

Referenced by SerialTest_Run().

Function Documentation

◆ Dma_Set()

__inline__ void Dma_Set ( const volatile void * source,
volatile void * destination,
u32 control,
volatile u32 * channel )
static

Starts a DMA transfer: stores the source, destination and control words into channel's registers with one stmia.

Definition at line 62 of file dma.h.

Referenced by AltinPeak_StepPaletteAnim(), AltmillerCave_BeginRetreat(), BattleBackground_Load(), BattleEffect_InitializeBuffers(), BattleEffect_InitializeSharedScene(), BattleFx_ArmBg0HBlankDma(), BattleFx_ArmBg2AffineHBlankDma(), BattleFx_ArmPaletteHBlankDma(), BattleFx_ArmWin0HBlankDma(), BattleFx_BuildBuffer(), BattleFx_BuildWindowEdgeTable(), BattleFx_InitializeStarField(), BattleFx_RunJudgment(), BattleFx_RunParticleStreams(), BattleFx_RunTorch(), BattleFx_StartWindowHBlankDma(), BattlePres_RunEntryTransition(), BattlePres_UpdateHBlankScroll(), BattlePresentation_BuildSortedUnitEntries(), BattlePresentation_ConfigurePaletteFade(), BattlePresentation_InitializeTilePattern(), BattlePresentation_SetPaletteLevel(), BattlePresentation_UploadTileVariant(), CharacterSelector_RunRearrange(), Clear_LoadBackground(), ColorBuffer_BackupAndBrighten(), ColorBuffer_BackupAndBrightenPartial(), ColorBuffer_BackupAndDarken(), ColorBuffer_BackupAndDarkenPartial(), ColorBuffer_BackupAndHalve(), ColorBuffer_BackupAndHalveNonzero(), ColorBuffer_BackupAndScaleNonzeroThreeQuarters(), ColorBuffer_BackupAndScaleThreeQuarters(), Colosso_DrawGauge(), Colosso_LoadLettering(), CrossboneIslePillarRooms_ReadMapCell(), CrossboneIslePillarRooms_SortPillarActors(), DebugMenu_SelectItem(), DisplayBlend_StartScript(), DisplayScroll_ArmHBlankDma(), DisplayScroll_UpdateObjects(), DisplayTransition_FillTilemapAndSolidTile(), Dma_Set(), Dma_StopAllThenRunHook(), Event_MovePillar(), FieldFx_UpdateLightning(), HeatGauge_Draw(), IoWriteQueue_FlushPending(), ItemLevel_SelectAbility(), ItemLevel_SelectItem(), ItemMenu_SelectGiveQuantity(), KolimaForestBend_Initialize(), KolimaPalette_Capture(), KolimaPalette_Restore(), KolimaPalette_SaveFirst(), KolimaPalette_SaveSecond(), LuckyDice_Run(), Map_LoadAreaGraphics(), Map_ShowBg1FromBuffer(), Map_ShowWorldMap(), Map_WriteLayerCellTile(), MapAnimation_ApplyAffineFrame(), MapAnimation_PresentFrame(), MapAnimation_Update(), Menu_OpenBackdropScreen(), NameEntry_EditOwnerName(), ObjectTable_Restore(), ObjectTable_Snapshot(), OptionMenu_Open(), Palette_CopyObjectBankToBackground14(), Palette_LightenBankHighlight(), Palette_LoadBasicObjColors(), Palette_StepTowardResource(), Palette_Transform(), PaletteFade_Init(), PaletteFade_Update(), PaletteQueue_Add(), PaletteQueue_StepCycles(), PartyTalkMenu_Choose(), ReelGame_Run(), ReelGame_RunFrame(), ReelGame_TransferCanvas(), Resource_DecompressHalfwords(), RunLuckyDice(), RunReelGame(), Runtime_InstallIwramAndIrqs(), SaveState_ReadSlotAndCheckChecksum(), SerialRuntime_CollectReceivedPayloads(), SerialRuntime_PrepareSendPacket(), SerialRuntime_StepBlockTransfer(), SerialTest_Run(), ShipGlow_CyclePalette(), Shop_CreatePriceSprite(), Shop_SaveAndTintFieldPalette(), Shop_SelectQuantity(), Sound_LoadPresetParameters(), Sprite_ComposeAnimationFrame(), StatusMenu_Run(), System_CopyBuildStamp(), System_VBlankHandler(), Title_LoadBackground(), Title_LoadIntroBackgrounds(), Title_LoadSprites(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), Title_UpdateIntroSprites(), Transform_BuildLookAt(), Transform_Load(), Transform_Pop(), Transform_Push(), Transform_Store(), TretPalette_SaveSceneColors(), Ui_LoadWindowGraphics(), UiGlyph_LoadEntryWithPalette(), UiText_BuildRenderEntries(), UiText_DrawGlyph(), UiText_LoadRemappedGlyph(), UiText_ScrollCanvasUp(), UiWindow_DrawStatusBarTiles(), UiWindow_OverlayTilePattern(), UiWork_Initialize(), UiWork_InitializeWithResourceCounters(), UiWork_UploadDirtyBlocks(), Vram_CopyTile(), VramCache_Load(), WaitFrames(), WorldMap_BeginStillView(), and WorldMap_LoadGraphics().