Files
oot/src/libultra_boot_O2/__osPiRawStartDma.c
T
Tharo f9d96d9f73 Fix most compiler warnings in the boot and code segments (#674)
* Less warnings in boot & code segments

* few more warnings gone

* Ran formatter

* z_view warning gone

* -> 1

* f31 -> 31

* Remove function casts

* Few more small improvements

* Separate declaration and assignment in func_80091738 and Item_Give

Co-authored-by: Thar0 <maximilianc64@gmail.com>
2021-02-13 19:49:40 -05:00

27 lines
728 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 | PI_STATUS_ERROR)) {
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;
}