Refresh 13

This commit is contained in:
n64
2020-12-03 14:26:38 -05:00
parent 8b872a71e8
commit 6d87c424b8
552 changed files with 32958 additions and 18073 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -4,8 +4,11 @@
.include "macros.inc"
.ifdef VERSION_EU
.set VERSION_EU_SH, 1
.endif
.ifdef VERSION_SH
.set VERSION_EU, 1 # HACK, someone fix this file, its poorly diff'd!
.set VERSION_EU_SH, 1
.endif
.section .text, "ax"
@@ -34,7 +37,7 @@ glabel __osException
sd $t2, 0x68($k0)
sw $zero, 0x18($k0)
mfc0 $t0, $13
.ifndef VERSION_EU
.ifndef VERSION_EU_SH
andi $t1, $t0, 0x7c
li $t2, 0
bne $t1, $t2, .L80326750
@@ -61,7 +64,7 @@ glabel __osException
lui $at, %hi(D_80334938)
.endif
move $t0, $k0
.ifndef VERSION_EU
.ifndef VERSION_EU_SH
sw $zero, %lo(D_80334938)($at)
.endif
lui $k0, %hi(D_80334890 + 0x10)
@@ -76,7 +79,7 @@ glabel __osException
sd $t1, 0x60($k0)
ld $t1, 0x68($t0)
sd $t1, 0x68($k0)
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
lw $k1, 0x118($k0)
.else
.L80326794:
@@ -84,7 +87,7 @@ glabel __osException
mflo $t0
sd $t0, 0x108($k0)
mfhi $t0
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
andi $t1, $k1, 0xff00
.endif
sd $v0, 0x28($k0)
@@ -112,28 +115,48 @@ glabel __osException
sd $sp, 0xf0($k0)
sd $fp, 0xf8($k0)
sd $ra, 0x100($k0)
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
beqz $t1, .L802F3A18
sd $t0, 0x110($k0)
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lui $t0, %hi(__OSGlobalIntMask)
addiu $t0, %lo(__OSGlobalIntMask)
lw $t0, ($t0)
li $at, -1
.ifdef VERSION_EU
xor $t0, $t0, $at
.else
xor $t2, $t0, $at
.endif
lui $at, (0xFFFF00FF >> 16)
andi $t0, $t0, 0xff00
.ifdef VERSION_EU
andi $t0, $t0, 0xFF00
.else
andi $t2, $t2, 0xFF00
.endif
ori $at, (0xFFFF00FF & 0xFFFF)
.ifdef VERSION_EU
or $t1, $t1, $t0
and $k1, $k1, $at
or $k1, $k1, $t1
sw $k1, 0x118($k0)
.else
or $t4, $t1, $t2
and $t3, $k1, $at
andi $t0, $t0, 0xFF00
or $t3, $t3, $t4
and $t1, $t1, $t0
and $k1, $k1, $at
sw $t3, 0x118($k0)
or $k1, $k1, $t1
.endif
.L802F3A18:
lui $t1, %hi(MI_INTR_MASK_REG)
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
beqz $t1, .L802F3A50
nop
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lui $t0, %hi(__OSGlobalIntMask)
addiu $t0, %lo(__OSGlobalIntMask)
lw $t0, ($t0)
lw $t4, 0x128($k0)
li $at, -1
@@ -174,14 +197,14 @@ glabel __osException
.L80326868:
mfc0 $t0, $13
sw $t0, 0x120($k0)
.ifndef VERSION_EU
.ifndef VERSION_EU_SH
lui $t1, %hi(MI_INTR_MASK_REG)
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
sw $t1, 0x128($k0)
.endif
li $t1, 2
sh $t1, 0x10($k0)
.ifndef VERSION_EU
.ifndef VERSION_EU_SH
lui $t1, %hi(D_80334934)
lw $t1, %lo(D_80334934)($t1)
beqz $t1, .L803268B4
@@ -244,7 +267,7 @@ glabel __osException
lw $t2, %lo(jtbl_80338630)($at)
jr $t2
nop
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
glabel L802F3B28
li $at, -8193
b .L8032692C
@@ -264,7 +287,7 @@ glabel L80326964
b .L8032692C
and $s0, $s0, $at
glabel L80326984
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
li $at, -2049
and $s0, $s0, $at
.endif
@@ -272,9 +295,9 @@ glabel L80326984
lui $at, %hi(D_80334920)
addu $at, $at, $t2
lw $t2, %lo(D_80334920)($at)
.ifdef VERSION_EU
lui $sp, %hi(D_80365E40)
addiu $sp, %lo(D_80365E40)
.ifdef VERSION_EU_SH
lui $sp, %hi(leoDiskStack)
addiu $sp, %lo(leoDiskStack)
li $a0, 16
beqz $t2, .L803269A4
addiu $sp, $sp, 0xff0
@@ -284,15 +307,19 @@ glabel L80326984
.endif
jalr $t2
nop
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
beqz $v0, .L803269A4
.ifdef VERSION_SH
li $a0, 0x10
.else
nop
.endif
b .L80326B9C
nop
.endif
.L803269A4:
jal send_mesg
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
nop
b .L8032692C
nop
@@ -303,14 +330,14 @@ glabel L80326984
and $s0, $s0, $at
.endif
glabel L803269B8
.ifdef VERSION_EU
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
.ifdef VERSION_EU_SH
lui $t0, %hi(__OSGlobalIntMask)
addiu $t0, %lo(__OSGlobalIntMask)
lw $t0, ($t0)
.endif
lui $s1, %hi(MI_INTR_REG)
lw $s1, %lo(MI_INTR_REG)($s1)
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
srl $t0, $t0, 0x10
and $s1, $s1, $t0
.else
@@ -487,8 +514,8 @@ glabel L80326BE8
nop
glabel send_mesg
lui $t2, %hi(D_80363830)
addiu $t2, %lo(D_80363830)
lui $t2, %hi(__osEventStateTab)
addiu $t2, %lo(__osEventStateTab)
addu $t2, $t2, $a0
lw $t1, ($t2)
move $s2, $ra
@@ -582,13 +609,13 @@ glabel __osEnqueueAndYield
sw $k1, 0x12c($a1)
.L80326D70:
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
lw $k1, 0x118($a1)
andi $t1, $k1, 0xff00
beqz $t1, .L802F3FBC
nop
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lui $t0, %hi(__OSGlobalIntMask)
addiu $t0, %lo(__OSGlobalIntMask)
lw $t0, ($t0)
li $at, -1
xor $t0, $t0, $at
@@ -603,11 +630,11 @@ glabel __osEnqueueAndYield
.endif
lui $k1, %hi(MI_INTR_MASK_REG)
lw $k1, %lo(MI_INTR_MASK_REG)($k1)
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
beqz $k1, .L802F3FF4
nop
lui $k0, %hi(D_8030208C)
addiu $k0, %lo(D_8030208C)
lui $k0, %hi(__OSGlobalIntMask)
addiu $k0, %lo(__OSGlobalIntMask)
lw $k0, ($k0)
lw $t0, 0x128($a1)
li $at, -1
@@ -664,10 +691,10 @@ glabel __osDispatchThread
li $t0, 4
sh $t0, 0x10($v0)
move $k0, $v0
.ifdef VERSION_EU
lui $t0, %hi(D_8030208C)
.ifdef VERSION_EU_SH
lui $t0, %hi(__OSGlobalIntMask)
lw $k1, 0x118($k0)
addiu $t0, %lo(D_8030208C)
addiu $t0, %lo(__OSGlobalIntMask)
lw $t0, ($t0)
lui $at, (0xFFFF00FF >> 16)
andi $t1, $k1, 0xff00
@@ -714,7 +741,7 @@ glabel __osDispatchThread
ld $ra, 0x100($k0)
lw $k1, 0x11c($k0)
mtc0 $k1, $14
.ifndef VERSION_EU
.ifndef VERSION_EU_SH
lw $k1, 0x118($k0)
mtc0 $k1, $12
.endif
@@ -741,9 +768,9 @@ glabel __osDispatchThread
ldc1 $f30, 0x1a8($k0)
.L80326EF0:
lw $k1, 0x128($k0)
.ifdef VERSION_EU
lui $k0, %hi(D_8030208C)
addiu $k0, %lo(D_8030208C)
.ifdef VERSION_EU_SH
lui $k0, %hi(__OSGlobalIntMask)
addiu $k0, %lo(__OSGlobalIntMask)
lw $k0, ($k0)
srl $k0, $k0, 0x10
and $k1, $k1, $k0
@@ -793,7 +820,7 @@ glabel jtbl_80338630
.word L803269B8
.word L80326984
.word L80326AE8
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
.word L802F3B28
.word L802F3B34
.else

View File

@@ -6,26 +6,33 @@
.eqv MI_INTR_MASK_REG, 0xA430000C
.ifdef VERSION_EU
.set VERSION_EU_SH, 1
.endif
.ifdef VERSION_SH
.set VERSION_EU_SH, 1
.endif
.section .text, "ax"
glabel osSetIntMask
.ifndef VERSION_EU
mfc0 $t1, $12
andi $v0, $t1, 0xff01
.else
.ifdef VERSION_EU_SH
mfc0 $t4, $12
andi $v0, $t4, 0xff01
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
lui $t0, %hi(__OSGlobalIntMask) # $t0, 0x8030
addiu $t0, %lo(__OSGlobalIntMask) # addiu $t0, $t0, 0x208c
lw $t3, ($t0)
li $at, -1
xor $t0, $t3, $at
andi $t0, $t0, 0xff00
or $v0, $v0, $t0
.else
mfc0 $t1, $12
andi $v0, $t1, 0xff01
.endif
lui $t2, %hi(MI_INTR_MASK_REG) # $t2, 0xa430
lw $t2, %lo(MI_INTR_MASK_REG)($t2)
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
beqz $t2, .L80200074
srl $t1, $t3, 0x10
li $at, -1
@@ -38,7 +45,7 @@ glabel osSetIntMask
or $v0, $v0, $t2
lui $at, 0x3f
and $t0, $a0, $at
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
and $t0, $t0, $t3
.endif
srl $t0, $t0, 0xf
@@ -48,20 +55,20 @@ glabel osSetIntMask
lui $at, %hi(MI_INTR_MASK_REG) # $at, 0xa430
sw $t2, %lo(MI_INTR_MASK_REG)($at)
andi $t0, $a0, 0xff01
.ifdef VERSION_EU
.ifdef VERSION_EU_SH
andi $t1, $t3, 0xff00
and $t0, $t0, $t1
.endif
lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
.ifndef VERSION_EU
and $t1, $t1, $at
or $t1, $t1, $t0
mtc0 $t1, $12
.else
.ifdef VERSION_EU_SH
and $t4, $t4, $at
or $t4, $t4, $t0
mtc0 $t4, $12
.else
and $t1, $t1, $at
or $t1, $t1, $t0
mtc0 $t1, $12
.endif
nop
nop

View File

@@ -16,3 +16,13 @@ gsymbol osCiCId 0x80000310
gsymbol osVersion 0x80000314
gsymbol osMemSize 0x80000318
gsymbol osAppNmiBuffer 0x8000031C
.ifdef VERSION_SH
nop
nop
nop
nop
nop
nop
nop
nop
.endif

View File

@@ -17,12 +17,12 @@ glabel rspF3DEnd
.else /* Use one of the Fast3DEX series grucodes. */
glabel rspF3DStart
.if F3DEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DEX2.bin"
.if F3DZEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DZEX_NoN.bin"
.elseif F3DEX_GBI == 1
.incbin "lib/PR/f3dex/F3DEX.bin"
.else /* Fast3DZEX */
.incbin "lib/PR/f3dex2/F3DZEX.bin"
.elseif F3DEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DEX2.bin"
.endif
glabel rspF3DEnd
.endif
@@ -132,12 +132,12 @@ glabel rspF3DDataEnd
.else /* Using one of the Fast3DEX series grucodes */
glabel rspF3DDataStart
.if F3DEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DEX2_data.bin"
.if F3DZEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DZEX_NoN_data.bin"
.elseif F3DEX_GBI == 1
.incbin "lib/PR/f3dex/F3DEX_data.bin"
.else /* Fast3DZEX */
.incbin "lib/PR/f3dex2/F3DZEX_data.bin"
.elseif F3DEX_GBI_2 == 1
.incbin "lib/PR/f3dex2/F3DEX2_data.bin"
.endif
glabel rspF3DDataEnd
.endif

View File

@@ -2,7 +2,8 @@
#include "hardware.h"
#include "new_func.h"
#include "macros.h"
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU)
u32 D_802F4380() {
u32 sp3c;
u32 sp38;
@@ -25,7 +26,7 @@ u32 D_802F4380() {
WAIT_ON_IOBUSY(sp38);
HW_REG(ASIC_BM_CTL, u32) = sp30->bmCtlShadow | MECHANIC_INTERRUPT_RESET;
}
sp30->unk10 = 75;
sp30->errStatus = 75;
func_802F4A20();
return 1;
}
@@ -34,24 +35,24 @@ u32 D_802F4380() {
if (sp3c & MECHANIC_INTERRUPT) {
WAIT_ON_IOBUSY(sp38);
HW_REG(ASIC_BM_CTL, u32) = sp30->bmCtlShadow | MECHANIC_INTERRUPT_RESET;
sp30->unk10 = 0;
sp30->errStatus = 0;
return 0;
}
if (sp3c & BUFFER_MANAGER_ERROR) {
sp30->unk10 = 3;
sp30->errStatus = 3;
func_802F4A20();
return 1;
}
if (sp30->cmdType == 1) {
if ((sp3c & DATA_REQUEST) == 0) {
if (sp30->sectorNum + 1 != sp30->transferMode * 85) {
sp30->unk10 = 6;
sp30->errStatus = 6;
func_802F4A20();
return 1;
}
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
D_8030208C |= 0x00100401;
sp30->unk10 = 0;
__OSGlobalIntMask |= 0x00100401;
sp30->errStatus = 0;
func_802F4B08();
return 1;
}
@@ -63,12 +64,12 @@ u32 D_802F4380() {
if (sp30->cmdType == 0) {
if (sp30->transferMode == 3) {
if ((s32)(sp2c->C1ErrNum + 17) < sp30->sectorNum) {
sp30->unk10 = 0;
sp30->errStatus = 0;
func_802F4A20();
return 1;
}
if ((sp3c & DATA_REQUEST) == 0) {
sp30->unk10 = 17;
sp30->errStatus = 17;
func_802F4A20();
return 1;
}
@@ -80,7 +81,7 @@ u32 D_802F4380() {
{
if (sp2c->C1ErrNum > 3) {
if (sp30->transferMode != 3 || sp30->sectorNum > 0x52) {
sp30->unk10 = 17;
sp30->errStatus = 17;
func_802F4A20();
return 1;
}
@@ -92,7 +93,7 @@ u32 D_802F4380() {
}
if (sp3c & C2_TRANSFER) {
if (sp30->sectorNum != 87) {
sp30->unk10 = 6;
sp30->errStatus = 6;
func_802F4A20();
}
if (sp30->transferMode == 2 && sp30->blockNum == 0) {
@@ -102,10 +103,10 @@ u32 D_802F4380() {
(void *) ((u32) sp30->block[1].dramAddr - sp30->block[1].sectorSize);
} else {
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
D_8030208C |= 0x00100401;
__OSGlobalIntMask |= 0x00100401;
}
osEPiRawStartDma(__osDiskHandle, 0, 0x5000000, sp2c->C2Addr, sp2c->sectorSize * 4);
sp30->unk10 = 0;
sp30->errStatus = 0;
return 1;
}
@@ -114,33 +115,33 @@ u32 D_802F4380() {
if (sp30->block[0].C1ErrNum == 0) {
if (((u32 *) sp30->block[0].C2Addr)[0] | ((u32 *) sp30->block[0].C2Addr)[1]
| ((u32 *) sp30->block[0].C2Addr)[2] | ((u32 *) sp30->block[0].C2Addr)[3]) {
sp30->unk10 = 6;
sp30->errStatus = 6;
func_802F4A20();
return 1;
}
}
sp30->unk10 = 0;
sp30->errStatus = 0;
func_802F4B08();
}
sp30->sectorNum += 1;
if (sp3c & DATA_REQUEST) {
if (sp30->sectorNum > 0x54) {
sp30->unk10 = 6;
sp30->errStatus = 6;
func_802F4A20();
return 1;
}
osEPiRawStartDma(__osDiskHandle, 0, 0x05000400, sp2c->dramAddr, sp2c->sectorSize);
sp30->unk10 = 0;
sp30->errStatus = 0;
return 1;
}
if (sp30->sectorNum <= 0x54) {
sp30->unk10 = 6;
sp30->errStatus = 6;
func_802F4A20();
return 1;
}
return 1;
}
sp30->unk10 = 75;
sp30->errStatus = 75;
func_802F4A20();
return 1;
}

View File

@@ -41,14 +41,21 @@ s32 _Printf(char *(*prout)(char *, const char *, size_t), char *dst, const char
u8 sp4c[0x20]; // probably a buffer?
s32 sp48, sp44, sp40, sp3c, sp38, sp34, sp30, sp2c, sp28, sp24;
sp78.size = 0;
while (1) {
while (TRUE) {
fmt_ptr = (u8 *) fmt;
#ifdef VERSION_SH
// new version: don't point fmt_ptr beyond NUL character
while ((c = *fmt_ptr) != 0 && c != '%') {
fmt_ptr++;
}
#else
while ((c = *fmt_ptr++) > 0) {
if (c == '%') {
fmt_ptr--;
break;
}
}
#endif
_PROUT(dst, fmt, fmt_ptr - (u8 *) fmt);
if (c == 0) {
return sp78.size;

View File

@@ -1,83 +1,118 @@
#include "libultra_internal.h"
#include "macros.h"
#if defined(VERSION_EU)
#if defined(VERSION_EU) || defined(VERSION_SH)
#include "new_func.h"
void __osDevMgrMain(void *args) {
OSIoMesg *sp44;
OSMesg sp40;
OSMesg sp3c;
s32 sp38;
OSIoMesg *mb;
OSMesg em;
OSMesg dummy;
s32 ret;
OSMgrArgs *sp34;
#ifndef VERSION_SH
UNUSED u32 sp30;
#endif
u32 sp2c;
__OSBlockInfo *sp28;
__OSTranxInfo *sp24;
#ifdef VERSION_SH
u32 tmp;
#endif
#ifndef VERSION_SH
sp30 = 0;
#endif
sp2c = 0;
sp44 = NULL;
sp38 = 0;
mb = NULL;
ret = 0;
sp34 = (OSMgrArgs *) args;
while (1) {
osRecvMesg(sp34->unk08, (OSMesg) &sp44, OS_MESG_BLOCK);
if (sp44->piHandle != NULL && sp44->piHandle->type == 2
&& (sp44->piHandle->transferInfo.cmdType == 0
|| sp44->piHandle->transferInfo.cmdType == 1)) {
sp24 = &sp44->piHandle->transferInfo;
while (TRUE) {
osRecvMesg(sp34->cmdQueue, (OSMesg) &mb, OS_MESG_BLOCK);
if (mb->piHandle != NULL && mb->piHandle->type == 2
&& (mb->piHandle->transferInfo.cmdType == 0
|| mb->piHandle->transferInfo.cmdType == 1)) {
sp24 = &mb->piHandle->transferInfo;
sp28 = &sp24->block[sp24->blockNum];
sp24->sectorNum = -1;
if (sp24->transferMode != 3) {
sp28->dramAddr = (void *) ((u32) sp28->dramAddr - sp28->sectorSize);
}
if (sp24->transferMode == 2 && sp44->piHandle->transferInfo.cmdType == 0)
if (sp24->transferMode == 2 && mb->piHandle->transferInfo.cmdType == 0) {
sp2c = 1;
else
sp2c = 0;
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
func_802F7140(0x00100401); // remove magic constant!
func_802F71A0(sp44->piHandle, 0x05000510, (sp24->bmCtlShadow | 0x80000000));
while (1) {
osRecvMesg(sp34->unk0c, &sp40, OS_MESG_BLOCK);
sp30 = osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
if (sp2c != 1 || sp44->piHandle->transferInfo.unk10 != 0)
break;
} else {
sp2c = 0;
}
osSendMesg(sp34->unk10, NULL, OS_MESG_NOBLOCK);
if (sp44->piHandle->transferInfo.blockNum == 1)
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
__osResetGlobalIntMask(0x00100401); // remove magic constant!
__osEPiRawWriteIo(mb->piHandle, 0x05000510, (sp24->bmCtlShadow | 0x80000000));
while (TRUE) {
osRecvMesg(sp34->eventQueue, &em, OS_MESG_BLOCK);
#ifdef VERSION_SH
sp24 = &mb->piHandle->transferInfo;
sp28 = &sp24->block[sp24->blockNum];
if (sp28->errStatus == 0x1D) {
__osEPiRawWriteIo(mb->piHandle, 0x5000510, sp24->bmCtlShadow | 0x10000000);
__osEPiRawWriteIo(mb->piHandle, 0x5000510, sp24->bmCtlShadow);
__osEPiRawReadIo(mb->piHandle, 0x5000508, &tmp);
if ((tmp & 0x2000000) != 0) {
__osEPiRawWriteIo(mb->piHandle, 0x5000510, sp24->bmCtlShadow | 0x1000000);
}
sp28->errStatus = 4;
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
__osSetGlobalIntMask(0x100C01);
}
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
if (sp2c != 1 || mb->piHandle->transferInfo.block[0].errStatus != 0) {
break;
}
#else
sp30 = osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
if (sp2c != 1 || mb->piHandle->transferInfo.errStatus != 0) {
break;
}
#endif
sp2c = 0;
}
osSendMesg(sp34->accessQueue, NULL, OS_MESG_NOBLOCK);
if (mb->piHandle->transferInfo.blockNum == 1) {
func_802F71F0();
}
} else {
switch (sp44->hdr.type) {
switch (mb->hdr.type) {
case 11:
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
sp38 = sp34->dma_func(OS_READ, sp44->devAddr, sp44->dramAddr, sp44->size);
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->dma_func(OS_READ, mb->devAddr, mb->dramAddr, mb->size);
break;
case 12:
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
sp38 = sp34->dma_func(OS_WRITE, sp44->devAddr, sp44->dramAddr, sp44->size);
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->dma_func(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size);
break;
case 15:
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
sp38 = sp34->edma_func(sp44->piHandle, OS_READ, sp44->devAddr, sp44->dramAddr,
sp44->size);
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->edma_func(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr,
mb->size);
break;
case 16:
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
sp38 = sp34->edma_func(sp44->piHandle, OS_WRITE, sp44->devAddr, sp44->dramAddr,
sp44->size);
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->edma_func(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr,
mb->size);
break;
case 10:
osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
sp38 = -1;
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
ret = -1;
break;
break;
default:
sp38 = -1;
ret = -1;
break;
}
if (sp38 == 0) {
osRecvMesg(sp34->unk0c, &sp40, OS_MESG_BLOCK);
sp30 = osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
osSendMesg(sp34->unk10, NULL, OS_MESG_NOBLOCK);
if (ret == 0) {
osRecvMesg(sp34->eventQueue, &em, OS_MESG_BLOCK);
#ifndef VERSION_SH
sp30 =
#endif
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
osSendMesg(sp34->accessQueue, NULL, OS_MESG_NOBLOCK);
}
}
}
@@ -92,15 +127,15 @@ void __osDevMgrMain(void *args) {
sp34 = NULL;
sp28 = 0;
sp24 = (OSMgrArgs *) args;
while (1) {
osRecvMesg(sp24->unk08, (OSMesg) &sp34, OS_MESG_BLOCK);
while (TRUE) {
osRecvMesg(sp24->cmdQueue, (OSMesg) &sp34, OS_MESG_BLOCK);
switch (sp34->hdr.type) {
case 11:
osRecvMesg(sp24->unk10, &sp2c, OS_MESG_BLOCK);
osRecvMesg(sp24->accessQueue, &sp2c, OS_MESG_BLOCK);
sp28 = sp24->dma_func(OS_READ, sp34->devAddr, sp34->dramAddr, sp34->size);
break;
case 12:
osRecvMesg(sp24->unk10, &sp2c, OS_MESG_BLOCK);
osRecvMesg(sp24->accessQueue, &sp2c, OS_MESG_BLOCK);
sp28 = sp24->dma_func(OS_WRITE, sp34->devAddr, sp34->dramAddr, sp34->size);
break;
case 10:
@@ -112,9 +147,9 @@ void __osDevMgrMain(void *args) {
break;
}
if (sp28 == 0) {
osRecvMesg(sp24->unk0c, &sp30, OS_MESG_BLOCK);
osRecvMesg(sp24->eventQueue, &sp30, OS_MESG_BLOCK);
osSendMesg(sp34->hdr.retQueue, sp34, OS_MESG_NOBLOCK);
osSendMesg(sp24->unk10, NULL, OS_MESG_NOBLOCK);
osSendMesg(sp24->accessQueue, NULL, OS_MESG_NOBLOCK);
}
}
}

View File

@@ -0,0 +1,11 @@
#include "libultra_internal.h"
#include "hardware.h"
s32 __osEPiRawReadIo(OSPiHandle *arg0, u32 devAddr, u32 *data) {
register s32 stat;
while (stat = HW_REG(PI_STATUS_REG, s32), stat & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
;
}
*data = HW_REG(arg0->baseAddress | devAddr, s32);
return 0;
}

View File

@@ -1,8 +1,7 @@
#include "libultra_internal.h"
#include "hardware.h"
//possibly osEpiWriteIo
s32 func_802F71A0(OSPiHandle *a0, u32 a1, u32 a2) {
s32 __osEPiRawWriteIo(OSPiHandle *a0, u32 a1, u32 a2) {
register u32 a3 = HW_REG(PI_STATUS_REG, u32);
while (a3 & PI_STATUS_ERROR)
a3 = HW_REG(PI_STATUS_REG, u32);

View File

@@ -0,0 +1,9 @@
#include "libultra_internal.h"
#include "new_func.h"
void __osResetGlobalIntMask(u32 mask) {
register u32 prev;
prev = __osDisableInt();
__OSGlobalIntMask &= ~(-0x402 & mask);
__osRestoreInt(prev);
}

View File

@@ -0,0 +1,9 @@
#include "libultra_internal.h"
#include "hardware.h"
#include "new_func.h"
void __osSetGlobalIntMask(s32 arg0) {
register u32 prev = __osDisableInt();
__OSGlobalIntMask |= arg0;
__osRestoreInt(prev);
}

View File

@@ -1,9 +1,11 @@
#include "libultra_internal.h"
#define SIAccessQueueSize 2
OSMesg osSiMesgBuff[SIAccessQueueSize];
OSMesgQueue gOsSiMessageQueue;
u32 gOsSiAccessQueueCreated = 0;
void __osSiCreateAccessQueue() {
gOsSiAccessQueueCreated = 1;
osCreateMesgQueue(&gOsSiMessageQueue, &osSiMesgBuff[0], SIAccessQueueSize - 1);

View File

@@ -1,5 +1,6 @@
#include "libultra_internal.h"
#include "hardware.h"
s32 __osSiRawReadIo(void *a0, u32 *a1) {
if (__osSiDeviceBusy()) {
return -1;

View File

@@ -1,5 +1,6 @@
#include "libultra_internal.h"
#include "hardware.h"
s32 __osSiRawWriteIo(void *a0, u32 a1) {
if (__osSiDeviceBusy()) {
return -1;

View File

@@ -1,5 +1,6 @@
#include "libultra_internal.h"
#include "hardware.h"
u32 __osSpGetStatus() {
return HW_REG(SP_STATUS_REG, u32);
}

View File

@@ -1,5 +1,6 @@
#include "libultra_internal.h"
#include "hardware.h"
void __osSpSetStatus(u32 status) {
HW_REG(SP_STATUS_REG, u32) = status;
}

View File

@@ -1,5 +1,7 @@
#include "libultra_internal.h"
extern OSViContext *D_80334910;
extern OSViContext *__osViCurr;
OSViContext *__osViGetCurrentContext() {
return D_80334910;
return __osViCurr;
}

Some files were not shown because too many files have changed in this diff Show More