2021-09-15 23:24:19 +00:00
|
|
|
#ifndef Z64_DMA_H
|
|
|
|
#define Z64_DMA_H
|
2020-03-23 01:24:00 +00:00
|
|
|
|
2020-10-03 15:22:44 +00:00
|
|
|
#include "ultra64.h"
|
2022-11-17 02:57:02 +00:00
|
|
|
#include "alignment.h"
|
2024-02-29 13:15:04 +00:00
|
|
|
#include "romfile.h"
|
2020-03-23 01:24:00 +00:00
|
|
|
|
2024-08-12 07:07:48 +00:00
|
|
|
typedef struct DmaRequest {
|
2022-07-12 16:47:25 +00:00
|
|
|
/* 0x00 */ uintptr_t vromAddr; // VROM address (source)
|
|
|
|
/* 0x04 */ void* dramAddr; // DRAM address (destination)
|
2022-11-17 02:57:02 +00:00
|
|
|
/* 0x08 */ size_t size; // File Transfer size
|
2022-07-12 16:47:25 +00:00
|
|
|
/* 0x0C */ const char* filename; // Filename for debugging
|
2024-02-27 07:37:33 +00:00
|
|
|
/* 0x10 */ int line; // Line number for debugging
|
2022-07-12 16:47:25 +00:00
|
|
|
/* 0x14 */ s32 unk_14;
|
2020-03-23 01:24:00 +00:00
|
|
|
/* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message
|
2022-07-12 16:47:25 +00:00
|
|
|
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
|
2020-03-23 01:24:00 +00:00
|
|
|
} DmaRequest; // size = 0x20
|
|
|
|
|
2024-08-12 07:07:48 +00:00
|
|
|
typedef struct DmaEntry {
|
2024-02-29 13:15:04 +00:00
|
|
|
/* 0x00 */ RomFile file;
|
2022-07-12 16:47:25 +00:00
|
|
|
/* 0x08 */ uintptr_t romStart;
|
|
|
|
/* 0x0C */ uintptr_t romEnd;
|
2020-03-23 01:24:00 +00:00
|
|
|
} DmaEntry;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2022-11-17 02:57:02 +00:00
|
|
|
extern DmaEntry gDmaDataTable[];
|
|
|
|
|
|
|
|
extern u32 gDmaMgrVerbose;
|
|
|
|
extern size_t gDmaMgrDmaBuffSize;
|
|
|
|
|
|
|
|
#define DMAMGR_DEFAULT_BUFSIZE ALIGN16(0x2000)
|
|
|
|
|
|
|
|
// Standard DMA Requests
|
|
|
|
|
2024-01-09 12:59:03 +00:00
|
|
|
s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue,
|
|
|
|
OSMesg msg);
|
2022-11-17 02:57:02 +00:00
|
|
|
s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size);
|
2024-01-31 00:53:16 +00:00
|
|
|
#if OOT_DEBUG
|
2024-01-09 12:59:03 +00:00
|
|
|
s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue,
|
2024-02-27 07:37:33 +00:00
|
|
|
OSMesg msg, const char* file, int line);
|
|
|
|
s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line);
|
2024-01-31 00:53:16 +00:00
|
|
|
#endif
|
2022-11-17 02:57:02 +00:00
|
|
|
|
|
|
|
// Special-purpose DMA Requests
|
|
|
|
|
|
|
|
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size);
|
|
|
|
void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size);
|
|
|
|
s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
|
|
|
|
void DmaMgr_Init(void);
|
|
|
|
|
2020-03-23 01:24:00 +00:00
|
|
|
#endif
|