1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-15 03:20:35 +00:00

libultra files and directories restructure (#1038)

* Restructure files, begin header restructure

* Format

* us2dex

* Fix parallel spelling

Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com>

* Use OS_K0_TO_PHYSICAL in place of VIRTUAL_TO_PHYSICAL in osAiSetNextBuffer

* Uppercase hex, exception vector address defines

* Interrupt flags 1

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* Interrupt flags 2

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
Tharo 2021-12-01 00:08:57 +00:00 committed by GitHub
parent eabc918817
commit f1d183d6fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
164 changed files with 1171 additions and 738 deletions

View file

@ -0,0 +1,58 @@
#include "global.h"
OSPiHandle __DriveRomHandle;
OSPiHandle* osDriveRomInit(void) {
register s32 status;
register u32 a;
register u32 prevInt;
static u32 D_8000AC70 = 1;
__osPiGetAccess();
if (!D_8000AC70) {
__osPiRelAccess();
return &__DriveRomHandle;
}
D_8000AC70 = 0;
__DriveRomHandle.type = DEVICE_TYPE_BULK;
__DriveRomHandle.baseAddress = 0xA6000000;
__DriveRomHandle.domain = PI_DOMAIN1;
__DriveRomHandle.speed = 0;
bzero(&__DriveRomHandle.transferInfo, sizeof(__OSTranxInfo));
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
;
}
HW_REG(PI_BSD_DOM1_LAT_REG, u32) = 0xFF;
HW_REG(PI_BSD_DOM1_PGS_REG, u32) = 0;
HW_REG(PI_BSD_DOM1_RLS_REG, u32) = 3;
HW_REG(PI_BSD_DOM1_PWD_REG, u32) = 0xFF;
a = HW_REG(__DriveRomHandle.baseAddress, u32);
__DriveRomHandle.latency = a & 0xFF;
__DriveRomHandle.pulse = (a >> 8) & 0xFF;
__DriveRomHandle.pageSize = (a >> 0x10) & 0xF;
__DriveRomHandle.relDuration = (a >> 0x14) & 0xF;
HW_REG(PI_BSD_DOM1_LAT_REG, u32) = (u8)a;
HW_REG(PI_BSD_DOM1_PGS_REG, u32) = __DriveRomHandle.pageSize;
HW_REG(PI_BSD_DOM1_RLS_REG, u32) = __DriveRomHandle.relDuration;
HW_REG(PI_BSD_DOM1_PWD_REG, u32) = __DriveRomHandle.pulse;
__osCurrentHandle[__DriveRomHandle.domain]->type = __DriveRomHandle.type;
__osCurrentHandle[__DriveRomHandle.domain]->latency = __DriveRomHandle.latency;
__osCurrentHandle[__DriveRomHandle.domain]->pageSize = __DriveRomHandle.pageSize;
__osCurrentHandle[__DriveRomHandle.domain]->relDuration = __DriveRomHandle.relDuration;
__osCurrentHandle[__DriveRomHandle.domain]->pulse = __DriveRomHandle.pulse;
prevInt = __osDisableInt();
__DriveRomHandle.next = __osPiTable;
__osPiTable = &__DriveRomHandle;
__osRestoreInt(prevInt);
__osPiRelAccess();
return &__DriveRomHandle;
}