Remove HW_REG I added to rcp.h, and replace all uses with IO_WRITE / IO_READ

This commit is contained in:
Ryan Myers
2021-09-21 21:01:42 -04:00
parent 78ebec9c9b
commit b335bb56d0
5 changed files with 23 additions and 26 deletions

View File

@@ -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)
*/

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -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;