mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-08-13 17:03:47 -04:00
39cc86c260
subrepo: subdir: "soh" merged: "ba904bbd0" upstream: origin: "https://github.com/HarbourMasters/soh.git" branch: "master" commit: "ba904bbd0" git-subrepo: version: "0.4.1" origin: "???" commit: "???"
27 lines
710 B
C
27 lines
710 B
C
#include "global.h"
|
|
|
|
s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size) {
|
|
register s32 status = HW_REG(PI_STATUS_REG, u32);
|
|
|
|
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
|
status = HW_REG(PI_STATUS_REG, u32);
|
|
}
|
|
|
|
HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr);
|
|
|
|
HW_REG(PI_CART_ADDR_REG, void*) = (void*)((osRomBase | cartAddr) & 0x1FFFFFFF);
|
|
|
|
switch (dir) {
|
|
case OS_READ:
|
|
HW_REG(PI_WR_LEN_REG, u32) = size - 1;
|
|
break;
|
|
case OS_WRITE:
|
|
HW_REG(PI_RD_LEN_REG, u32) = size - 1;
|
|
break;
|
|
default:
|
|
return -1;
|
|
break;
|
|
}
|
|
return 0;
|
|
}
|