You've already forked Diddy-Kong-Racing
mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-03-10 11:36:09 -07:00
Remove HW_REG I added to rcp.h, and replace all uses with IO_WRITE / IO_READ
This commit is contained in:
@@ -68,8 +68,6 @@ The Indy development board use cartridge domain 1:
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#define HW_REG(reg, type) *(volatile type *)(u32*)(reg | 0xa0000000)
|
||||
|
||||
/*************************************************************************
|
||||
* RDRAM Memory (Assumes that maximum size is 4 MB)
|
||||
*/
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
/* RAM_POS: 0x800D4590 */
|
||||
|
||||
#include "types.h"
|
||||
#include "siint.h"
|
||||
#include "PR/rcp.h"
|
||||
|
||||
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
|
||||
#define IO_READ(addr) (*(vu32 *)PHYS_TO_K1(addr))
|
||||
|
||||
s32 __osSiRawReadIo(u32 devAddr, u32 *data)
|
||||
{
|
||||
if (__osSiDeviceBusy())
|
||||
s32 __osSiRawReadIo(u32 devAddr, u32 *data) {
|
||||
if (__osSiDeviceBusy()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*data = IO_READ(devAddr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
/* RAM_POS: 0x800D45E0 */
|
||||
|
||||
#include "types.h"
|
||||
#include "siint.h"
|
||||
#include "PR/rcp.h"
|
||||
|
||||
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
|
||||
#define IO_WRITE(addr,data) (*(vu32 *)PHYS_TO_K1(addr)=(u32)(data))
|
||||
|
||||
s32 __osSiRawWriteIo(u32 devAddr, u32 data)
|
||||
{
|
||||
|
||||
if (__osSiDeviceBusy())
|
||||
s32 __osSiRawWriteIo(u32 devAddr, u32 data) {
|
||||
if (__osSiDeviceBusy()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
IO_WRITE(devAddr, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
#include "PR/rcp.h"
|
||||
|
||||
void __osSpSetStatus(u32 status) {
|
||||
HW_REG(SP_STATUS_REG, u32) = status;
|
||||
IO_WRITE(SP_STATUS_REG, status);
|
||||
}
|
||||
|
||||
@@ -9,24 +9,22 @@
|
||||
GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s")
|
||||
GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s")
|
||||
|
||||
s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size)
|
||||
{
|
||||
s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) {
|
||||
register int status;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
status = IO_READ(PI_STATUS_REG);
|
||||
while (status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY | PI_STATUS_ERROR)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
status = IO_READ(PI_STATUS_REG);
|
||||
}
|
||||
|
||||
HW_REG(PI_DRAM_ADDR_REG, void *) = (void *) osVirtualToPhysical(dramAddr);
|
||||
|
||||
HW_REG(PI_CART_ADDR_REG, void *) = (void *) (((uintptr_t) osRomBase | devAddr) & 0x1fffffff);
|
||||
IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr));
|
||||
IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(osRomBase | devAddr));
|
||||
|
||||
switch (direction) {
|
||||
case OS_READ:
|
||||
HW_REG(PI_WR_LEN_REG, u32) = size - 1;
|
||||
IO_WRITE(PI_WR_LEN_REG, size - 1);
|
||||
break;
|
||||
case OS_WRITE:
|
||||
HW_REG(PI_RD_LEN_REG, u32) = size - 1;
|
||||
IO_WRITE(PI_RD_LEN_REG, size - 1);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user