Match Dolphin's hio based on changes from Dec 2001 SDK (#1437)

* Match Dolphin's hio based on changes from Dec 2001 SDK

* Add missing include
This commit is contained in:
Will 2024-08-17 15:56:05 -04:00 committed by GitHub
parent f87a9ceb0a
commit 9ca8391169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 358 additions and 951 deletions

View File

@ -184,6 +184,7 @@ $(BUILD_DIR)/%.c.o: %.c $(BUILD_DIR)/%.c.dep
$(BUILD_DIR)/src/melee/%.c.o: CC := $(CC_EPI)
$(BUILD_DIR)/src/sysdolphin/%.c.o: CC := $(CC_EPI)
$(BUILD_DIR)/src/dolphin/card/%.c.o: CC := $(CC_EPI)
$(BUILD_DIR)/src/dolphin/hio/%.c.o: CC := $(CC_EPI)
$(BUILD_DIR)/src/dolphin/pad/%.c.o: CC := $(CC_EPI)
-include $(DEP_FILES)

View File

@ -1,948 +0,0 @@
.include "macros.inc"
.section .text # 0x80005940 - 0x803B7240
.global ExtHandler
ExtHandler:
/* 8032BA6C 0032864C 7C 08 02 A6 */ mflr r0
/* 8032BA70 00328650 38 80 FF FF */ li r4, -1
/* 8032BA74 00328654 90 01 00 04 */ stw r0, 4(r1)
/* 8032BA78 00328658 38 00 00 00 */ li r0, 0
/* 8032BA7C 0032865C 2C 03 00 02 */ cmpwi r3, 2
/* 8032BA80 00328660 94 21 FF F8 */ stwu r1, -8(r1)
/* 8032BA84 00328664 90 8D A4 C8 */ stw r4, Chan@sda21(r13)
/* 8032BA88 00328668 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BA8C 0032866C 40 80 00 0C */ bge .L_8032BA98
/* 8032BA90 00328670 38 80 00 00 */ li r4, 0
/* 8032BA94 00328674 48 01 A7 09 */ bl EXISetExiCallback
.L_8032BA98:
/* 8032BA98 00328678 80 01 00 0C */ lwz r0, 0xc(r1)
/* 8032BA9C 0032867C 38 21 00 08 */ addi r1, r1, 8
/* 8032BAA0 00328680 7C 08 03 A6 */ mtlr r0
/* 8032BAA4 00328684 4E 80 00 20 */ blr
ExiHandler:
/* 8032BAA8 00328688 7C 08 02 A6 */ mflr r0
/* 8032BAAC 0032868C 90 01 00 04 */ stw r0, 4(r1)
/* 8032BAB0 00328690 94 21 FF F8 */ stwu r1, -8(r1)
/* 8032BAB4 00328694 81 8D BA 04 */ lwz r12, ExiCallback@sda21(r13)
/* 8032BAB8 00328698 28 0C 00 00 */ cmplwi r12, 0
/* 8032BABC 0032869C 41 82 00 0C */ beq .L_8032BAC8
/* 8032BAC0 003286A0 7D 88 03 A6 */ mtlr r12
/* 8032BAC4 003286A4 4E 80 00 21 */ blrl
.L_8032BAC8:
/* 8032BAC8 003286A8 80 01 00 0C */ lwz r0, 0xc(r1)
/* 8032BACC 003286AC 38 21 00 08 */ addi r1, r1, 8
/* 8032BAD0 003286B0 7C 08 03 A6 */ mtlr r0
/* 8032BAD4 003286B4 4E 80 00 20 */ blr
DbgHandler:
/* 8032BAD8 003286B8 7C 08 02 A6 */ mflr r0
/* 8032BADC 003286BC 38 A0 10 00 */ li r5, 0x1000
/* 8032BAE0 003286C0 90 01 00 04 */ stw r0, 4(r1)
/* 8032BAE4 003286C4 3C 60 CC 00 */ lis r3, 0xCC003000@ha
/* 8032BAE8 003286C8 94 21 FD 20 */ stwu r1, -0x2e0(r1)
/* 8032BAEC 003286CC 93 E1 02 DC */ stw r31, 0x2dc(r1)
/* 8032BAF0 003286D0 7C 9F 23 78 */ mr r31, r4
/* 8032BAF4 003286D4 80 0D BA 04 */ lwz r0, ExiCallback@sda21(r13)
/* 8032BAF8 003286D8 90 A3 30 00 */ stw r5, 0xCC003000@l(r3)
/* 8032BAFC 003286DC 28 00 00 00 */ cmplwi r0, 0
/* 8032BB00 003286E0 41 82 00 30 */ beq .L_8032BB30
/* 8032BB04 003286E4 38 61 00 10 */ addi r3, r1, 0x10
/* 8032BB08 003286E8 48 01 97 4D */ bl OSClearContext
/* 8032BB0C 003286EC 38 61 00 10 */ addi r3, r1, 0x10
/* 8032BB10 003286F0 48 01 95 7D */ bl OSSetCurrentContext
/* 8032BB14 003286F4 81 8D BA 04 */ lwz r12, ExiCallback@sda21(r13)
/* 8032BB18 003286F8 7D 88 03 A6 */ mtlr r12
/* 8032BB1C 003286FC 4E 80 00 21 */ blrl
/* 8032BB20 00328700 38 61 00 10 */ addi r3, r1, 0x10
/* 8032BB24 00328704 48 01 97 31 */ bl OSClearContext
/* 8032BB28 00328708 7F E3 FB 78 */ mr r3, r31
/* 8032BB2C 0032870C 48 01 95 61 */ bl OSSetCurrentContext
.L_8032BB30:
/* 8032BB30 00328710 80 01 02 E4 */ lwz r0, 0x2e4(r1)
/* 8032BB34 00328714 83 E1 02 DC */ lwz r31, 0x2dc(r1)
/* 8032BB38 00328718 38 21 02 E0 */ addi r1, r1, 0x2e0
/* 8032BB3C 0032871C 7C 08 03 A6 */ mtlr r0
/* 8032BB40 00328720 4E 80 00 20 */ blr
TxHandler:
/* 8032BB44 00328724 7C 08 02 A6 */ mflr r0
/* 8032BB48 00328728 90 01 00 04 */ stw r0, 4(r1)
/* 8032BB4C 0032872C 94 21 FF F8 */ stwu r1, -8(r1)
/* 8032BB50 00328730 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BB54 00328734 48 01 AC 61 */ bl EXIDeselect
/* 8032BB58 00328738 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BB5C 0032873C 48 01 B3 19 */ bl EXIUnlock
/* 8032BB60 00328740 81 8D BA 08 */ lwz r12, TxCallback@sda21(r13)
/* 8032BB64 00328744 28 0C 00 00 */ cmplwi r12, 0
/* 8032BB68 00328748 41 82 00 0C */ beq .L_8032BB74
/* 8032BB6C 0032874C 7D 88 03 A6 */ mtlr r12
/* 8032BB70 00328750 4E 80 00 21 */ blrl
.L_8032BB74:
/* 8032BB74 00328754 80 01 00 0C */ lwz r0, 0xc(r1)
/* 8032BB78 00328758 38 21 00 08 */ addi r1, r1, 8
/* 8032BB7C 0032875C 7C 08 03 A6 */ mtlr r0
/* 8032BB80 00328760 4E 80 00 20 */ blr
RxHandler:
/* 8032BB84 00328764 7C 08 02 A6 */ mflr r0
/* 8032BB88 00328768 90 01 00 04 */ stw r0, 4(r1)
/* 8032BB8C 0032876C 94 21 FF F8 */ stwu r1, -8(r1)
/* 8032BB90 00328770 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BB94 00328774 48 01 AC 21 */ bl EXIDeselect
/* 8032BB98 00328778 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BB9C 0032877C 48 01 B2 D9 */ bl EXIUnlock
/* 8032BBA0 00328780 81 8D BA 0C */ lwz r12, RxCallback@sda21(r13)
/* 8032BBA4 00328784 28 0C 00 00 */ cmplwi r12, 0
/* 8032BBA8 00328788 41 82 00 0C */ beq .L_8032BBB4
/* 8032BBAC 0032878C 7D 88 03 A6 */ mtlr r12
/* 8032BBB0 00328790 4E 80 00 21 */ blrl
.L_8032BBB4:
/* 8032BBB4 00328794 80 01 00 0C */ lwz r0, 0xc(r1)
/* 8032BBB8 00328798 38 21 00 08 */ addi r1, r1, 8
/* 8032BBBC 0032879C 7C 08 03 A6 */ mtlr r0
/* 8032BBC0 003287A0 4E 80 00 20 */ blr
.global HIOEnumDevices
HIOEnumDevices:
/* 8032BBC4 003287A4 7C 08 02 A6 */ mflr r0
/* 8032BBC8 003287A8 90 01 00 04 */ stw r0, 4(r1)
/* 8032BBCC 003287AC 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8032BBD0 003287B0 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8032BBD4 003287B4 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8032BBD8 003287B8 3B C3 00 00 */ addi r30, r3, 0
/* 8032BBDC 003287BC 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032BBE0 003287C0 2C 00 FF FF */ cmpwi r0, -1
/* 8032BBE4 003287C4 40 82 00 0C */ bne .L_8032BBF0
/* 8032BBE8 003287C8 28 1E 00 00 */ cmplwi r30, 0
/* 8032BBEC 003287CC 40 82 00 0C */ bne .L_8032BBF8
.L_8032BBF0:
/* 8032BBF0 003287D0 38 60 00 00 */ li r3, 0
/* 8032BBF4 003287D4 48 00 00 80 */ b .L_8032BC74
.L_8032BBF8:
/* 8032BBF8 003287D8 38 00 00 00 */ li r0, 0
/* 8032BBFC 003287DC 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BC00 003287E0 3B E0 00 00 */ li r31, 0
.L_8032BC04:
/* 8032BC04 003287E4 2C 1F 00 02 */ cmpwi r31, 2
/* 8032BC08 003287E8 40 80 00 14 */ bge .L_8032BC1C
.L_8032BC0C:
/* 8032BC0C 003287EC 7F E3 FB 78 */ mr r3, r31
/* 8032BC10 003287F0 48 01 A7 FD */ bl EXIProbeEx
/* 8032BC14 003287F4 2C 03 00 00 */ cmpwi r3, 0
/* 8032BC18 003287F8 41 82 FF F4 */ beq .L_8032BC0C
.L_8032BC1C:
/* 8032BC1C 003287FC 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032BC20 00328800 38 7F 00 00 */ addi r3, r31, 0
/* 8032BC24 00328804 38 A1 00 0C */ addi r5, r1, 0xc
/* 8032BC28 00328808 48 01 B3 69 */ bl EXIGetID
/* 8032BC2C 0032880C 2C 03 00 00 */ cmpwi r3, 0
/* 8032BC30 00328810 41 82 00 34 */ beq .L_8032BC64
/* 8032BC34 00328814 80 61 00 0C */ lwz r3, 0xc(r1)
/* 8032BC38 00328818 3C 03 FE FF */ addis r0, r3, 0xfeff
/* 8032BC3C 0032881C 28 00 00 00 */ cmplwi r0, 0
/* 8032BC40 00328820 40 82 00 24 */ bne .L_8032BC64
/* 8032BC44 00328824 39 9E 00 00 */ addi r12, r30, 0
/* 8032BC48 00328828 7D 88 03 A6 */ mtlr r12
/* 8032BC4C 0032882C 38 7F 00 00 */ addi r3, r31, 0
/* 8032BC50 00328830 4E 80 00 21 */ blrl
/* 8032BC54 00328834 2C 03 00 00 */ cmpwi r3, 0
/* 8032BC58 00328838 40 82 00 0C */ bne .L_8032BC64
/* 8032BC5C 0032883C 38 60 00 01 */ li r3, 1
/* 8032BC60 00328840 48 00 00 14 */ b .L_8032BC74
.L_8032BC64:
/* 8032BC64 00328844 3B FF 00 01 */ addi r31, r31, 1
/* 8032BC68 00328848 2C 1F 00 02 */ cmpwi r31, 2
/* 8032BC6C 0032884C 40 81 FF 98 */ ble .L_8032BC04
/* 8032BC70 00328850 38 60 00 01 */ li r3, 1
.L_8032BC74:
/* 8032BC74 00328854 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8032BC78 00328858 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 8032BC7C 0032885C 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 8032BC80 00328860 38 21 00 18 */ addi r1, r1, 0x18
/* 8032BC84 00328864 7C 08 03 A6 */ mtlr r0
/* 8032BC88 00328868 4E 80 00 20 */ blr
.global HIOInit
HIOInit:
/* 8032BC8C 0032886C 7C 08 02 A6 */ mflr r0
/* 8032BC90 00328870 90 01 00 04 */ stw r0, 4(r1)
/* 8032BC94 00328874 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8032BC98 00328878 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 8032BC9C 0032887C 3B E3 00 00 */ addi r31, r3, 0
/* 8032BCA0 00328880 93 C1 00 18 */ stw r30, 0x18(r1)
/* 8032BCA4 00328884 3B C4 00 00 */ addi r30, r4, 0
/* 8032BCA8 00328888 48 01 7A 65 */ bl __OSGetDIConfig
/* 8032BCAC 0032888C 28 03 00 FF */ cmplwi r3, 0xff
/* 8032BCB0 00328890 40 82 00 1C */ bne .L_8032BCCC
/* 8032BCB4 00328894 38 60 FF FF */ li r3, -1
/* 8032BCB8 00328898 38 00 00 00 */ li r0, 0
/* 8032BCBC 0032889C 90 6D A4 C8 */ stw r3, Chan@sda21(r13)
/* 8032BCC0 003288A0 38 60 00 00 */ li r3, 0
/* 8032BCC4 003288A4 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BCC8 003288A8 48 00 02 40 */ b .L_8032BF08
.L_8032BCCC:
/* 8032BCCC 003288AC 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032BCD0 003288B0 2C 00 FF FF */ cmpwi r0, -1
/* 8032BCD4 003288B4 41 82 00 0C */ beq .L_8032BCE0
/* 8032BCD8 003288B8 38 60 00 01 */ li r3, 1
/* 8032BCDC 003288BC 48 00 02 2C */ b .L_8032BF08
.L_8032BCE0:
/* 8032BCE0 003288C0 38 00 00 00 */ li r0, 0
/* 8032BCE4 003288C4 93 ED A4 C8 */ stw r31, Chan@sda21(r13)
/* 8032BCE8 003288C8 2C 1F 00 02 */ cmpwi r31, 2
/* 8032BCEC 003288CC 93 CD BA 04 */ stw r30, ExiCallback@sda21(r13)
/* 8032BCF0 003288D0 90 0D BA 08 */ stw r0, TxCallback@sda21(r13)
/* 8032BCF4 003288D4 90 0D BA 0C */ stw r0, RxCallback@sda21(r13)
/* 8032BCF8 003288D8 40 80 00 50 */ bge .L_8032BD48
/* 8032BCFC 003288DC 80 0D BA 00 */ lwz r0, Dev@sda21(r13)
/* 8032BD00 003288E0 28 00 00 00 */ cmplwi r0, 0
/* 8032BD04 003288E4 40 82 00 44 */ bne .L_8032BD48
.L_8032BD08:
/* 8032BD08 003288E8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD0C 003288EC 48 01 A7 01 */ bl EXIProbeEx
/* 8032BD10 003288F0 2C 03 00 00 */ cmpwi r3, 0
/* 8032BD14 003288F4 41 82 FF F4 */ beq .L_8032BD08
/* 8032BD18 003288F8 3C 80 80 33 */ lis r4, ExtHandler@ha
/* 8032BD1C 003288FC 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD20 00328900 38 84 BA 6C */ addi r4, r4, ExtHandler@l
/* 8032BD24 00328904 48 01 A7 9D */ bl EXIAttach
/* 8032BD28 00328908 2C 03 00 00 */ cmpwi r3, 0
/* 8032BD2C 0032890C 40 82 00 1C */ bne .L_8032BD48
/* 8032BD30 00328910 38 60 FF FF */ li r3, -1
/* 8032BD34 00328914 38 00 00 00 */ li r0, 0
/* 8032BD38 00328918 90 6D A4 C8 */ stw r3, Chan@sda21(r13)
/* 8032BD3C 0032891C 38 60 00 00 */ li r3, 0
/* 8032BD40 00328920 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BD44 00328924 48 00 01 C4 */ b .L_8032BF08
.L_8032BD48:
/* 8032BD48 00328928 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD4C 0032892C 38 A0 00 00 */ li r5, 0
/* 8032BD50 00328930 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032BD54 00328934 48 01 B0 2D */ bl EXILock
/* 8032BD58 00328938 2C 03 00 00 */ cmpwi r3, 0
/* 8032BD5C 0032893C 40 82 00 24 */ bne .L_8032BD80
/* 8032BD60 00328940 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD64 00328944 48 01 A8 69 */ bl EXIDetach
/* 8032BD68 00328948 38 60 FF FF */ li r3, -1
/* 8032BD6C 0032894C 38 00 00 00 */ li r0, 0
/* 8032BD70 00328950 90 6D A4 C8 */ stw r3, Chan@sda21(r13)
/* 8032BD74 00328954 38 60 00 00 */ li r3, 0
/* 8032BD78 00328958 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BD7C 0032895C 48 00 01 8C */ b .L_8032BF08
.L_8032BD80:
/* 8032BD80 00328960 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD84 00328964 38 A0 00 00 */ li r5, 0
/* 8032BD88 00328968 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032BD8C 0032896C 48 01 A8 FD */ bl EXISelect
/* 8032BD90 00328970 2C 03 00 00 */ cmpwi r3, 0
/* 8032BD94 00328974 40 82 00 2C */ bne .L_8032BDC0
/* 8032BD98 00328978 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BD9C 0032897C 48 01 B0 D9 */ bl EXIUnlock
/* 8032BDA0 00328980 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BDA4 00328984 48 01 A8 29 */ bl EXIDetach
/* 8032BDA8 00328988 38 60 FF FF */ li r3, -1
/* 8032BDAC 0032898C 38 00 00 00 */ li r0, 0
/* 8032BDB0 00328990 90 6D A4 C8 */ stw r3, Chan@sda21(r13)
/* 8032BDB4 00328994 38 60 00 00 */ li r3, 0
/* 8032BDB8 00328998 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BDBC 0032899C 48 00 01 4C */ b .L_8032BF08
.L_8032BDC0:
/* 8032BDC0 003289A0 38 00 00 00 */ li r0, 0
/* 8032BDC4 003289A4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BDC8 003289A8 90 01 00 14 */ stw r0, 0x14(r1)
/* 8032BDCC 003289AC 38 81 00 14 */ addi r4, r1, 0x14
/* 8032BDD0 003289B0 38 A0 00 02 */ li r5, 2
/* 8032BDD4 003289B4 38 C0 00 01 */ li r6, 1
/* 8032BDD8 003289B8 38 E0 00 00 */ li r7, 0
/* 8032BDDC 003289BC 48 01 9D 89 */ bl EXIImm
/* 8032BDE0 003289C0 7C 60 00 34 */ cntlzw r0, r3
/* 8032BDE4 003289C4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BDE8 003289C8 54 1E D9 7E */ srwi r30, r0, 5
/* 8032BDEC 003289CC 48 01 A1 61 */ bl EXISync
/* 8032BDF0 003289D0 7C 60 00 34 */ cntlzw r0, r3
/* 8032BDF4 003289D4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BDF8 003289D8 54 00 D9 7E */ srwi r0, r0, 5
/* 8032BDFC 003289DC 7F DE 03 78 */ or r30, r30, r0
/* 8032BE00 003289E0 38 81 00 10 */ addi r4, r1, 0x10
/* 8032BE04 003289E4 38 A0 00 04 */ li r5, 4
/* 8032BE08 003289E8 38 C0 00 00 */ li r6, 0
/* 8032BE0C 003289EC 38 E0 00 00 */ li r7, 0
/* 8032BE10 003289F0 48 01 9D 55 */ bl EXIImm
/* 8032BE14 003289F4 7C 60 00 34 */ cntlzw r0, r3
/* 8032BE18 003289F8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BE1C 003289FC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032BE20 00328A00 7F DE 03 78 */ or r30, r30, r0
/* 8032BE24 00328A04 48 01 A1 29 */ bl EXISync
/* 8032BE28 00328A08 7C 60 00 34 */ cntlzw r0, r3
/* 8032BE2C 00328A0C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BE30 00328A10 54 00 D9 7E */ srwi r0, r0, 5
/* 8032BE34 00328A14 7F DE 03 78 */ or r30, r30, r0
/* 8032BE38 00328A18 48 01 A9 7D */ bl EXIDeselect
/* 8032BE3C 00328A1C 7C 60 00 34 */ cntlzw r0, r3
/* 8032BE40 00328A20 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BE44 00328A24 54 00 D9 7E */ srwi r0, r0, 5
/* 8032BE48 00328A28 7F DE 03 78 */ or r30, r30, r0
/* 8032BE4C 00328A2C 48 01 B0 29 */ bl EXIUnlock
/* 8032BE50 00328A30 2C 1E 00 00 */ cmpwi r30, 0
/* 8032BE54 00328A34 40 82 00 14 */ bne .L_8032BE68
/* 8032BE58 00328A38 80 61 00 10 */ lwz r3, 0x10(r1)
/* 8032BE5C 00328A3C 3C 03 FE FF */ addis r0, r3, 0xfeff
/* 8032BE60 00328A40 28 00 00 00 */ cmplwi r0, 0
/* 8032BE64 00328A44 41 82 00 40 */ beq .L_8032BEA4
.L_8032BE68:
/* 8032BE68 00328A48 2C 1F 00 02 */ cmpwi r31, 2
/* 8032BE6C 00328A4C 40 80 00 18 */ bge .L_8032BE84
/* 8032BE70 00328A50 80 0D BA 00 */ lwz r0, Dev@sda21(r13)
/* 8032BE74 00328A54 28 00 00 00 */ cmplwi r0, 0
/* 8032BE78 00328A58 40 82 00 0C */ bne .L_8032BE84
/* 8032BE7C 00328A5C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BE80 00328A60 48 01 A7 4D */ bl EXIDetach
.L_8032BE84:
/* 8032BE84 00328A64 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BE88 00328A68 48 01 AF ED */ bl EXIUnlock
/* 8032BE8C 00328A6C 38 60 FF FF */ li r3, -1
/* 8032BE90 00328A70 38 00 00 00 */ li r0, 0
/* 8032BE94 00328A74 90 6D A4 C8 */ stw r3, Chan@sda21(r13)
/* 8032BE98 00328A78 38 60 00 00 */ li r3, 0
/* 8032BE9C 00328A7C 90 0D BA 00 */ stw r0, Dev@sda21(r13)
/* 8032BEA0 00328A80 48 00 00 68 */ b .L_8032BF08
.L_8032BEA4:
/* 8032BEA4 00328A84 80 0D BA 04 */ lwz r0, ExiCallback@sda21(r13)
/* 8032BEA8 00328A88 28 00 00 00 */ cmplwi r0, 0
/* 8032BEAC 00328A8C 41 82 00 58 */ beq .L_8032BF04
/* 8032BEB0 00328A90 2C 1F 00 02 */ cmpwi r31, 2
/* 8032BEB4 00328A94 40 80 00 38 */ bge .L_8032BEEC
/* 8032BEB8 00328A98 80 0D BA 00 */ lwz r0, Dev@sda21(r13)
/* 8032BEBC 00328A9C 28 00 00 00 */ cmplwi r0, 0
/* 8032BEC0 00328AA0 40 82 00 18 */ bne .L_8032BED8
/* 8032BEC4 00328AA4 3C 80 80 33 */ lis r4, ExiHandler@ha
/* 8032BEC8 00328AA8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BECC 00328AAC 38 84 BA A8 */ addi r4, r4, ExiHandler@l
/* 8032BED0 00328AB0 48 01 A2 CD */ bl EXISetExiCallback
/* 8032BED4 00328AB4 48 00 00 30 */ b .L_8032BF04
.L_8032BED8:
/* 8032BED8 00328AB8 3C 60 80 33 */ lis r3, ExiHandler@ha
/* 8032BEDC 00328ABC 38 83 BA A8 */ addi r4, r3, ExiHandler@l
/* 8032BEE0 00328AC0 38 60 00 02 */ li r3, 2
/* 8032BEE4 00328AC4 48 01 A2 B9 */ bl EXISetExiCallback
/* 8032BEE8 00328AC8 48 00 00 1C */ b .L_8032BF04
.L_8032BEEC:
/* 8032BEEC 00328ACC 3C 60 80 33 */ lis r3, DbgHandler@ha
/* 8032BEF0 00328AD0 38 83 BA D8 */ addi r4, r3, DbgHandler@l
/* 8032BEF4 00328AD4 38 60 00 19 */ li r3, 0x19
/* 8032BEF8 00328AD8 48 01 B4 B9 */ bl __OSSetInterruptHandler
/* 8032BEFC 00328ADC 38 60 00 40 */ li r3, 0x40
/* 8032BF00 00328AE0 48 01 B8 B5 */ bl __OSUnmaskInterrupts
.L_8032BF04:
/* 8032BF04 00328AE4 38 60 00 01 */ li r3, 1
.L_8032BF08:
/* 8032BF08 00328AE8 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8032BF0C 00328AEC 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 8032BF10 00328AF0 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 8032BF14 00328AF4 38 21 00 20 */ addi r1, r1, 0x20
/* 8032BF18 00328AF8 7C 08 03 A6 */ mtlr r0
/* 8032BF1C 00328AFC 4E 80 00 20 */ blr
.global HIOReadMailbox
HIOReadMailbox:
/* 8032BF20 00328B00 7C 08 02 A6 */ mflr r0
/* 8032BF24 00328B04 90 01 00 04 */ stw r0, 4(r1)
/* 8032BF28 00328B08 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8032BF2C 00328B0C 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8032BF30 00328B10 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8032BF34 00328B14 3B C3 00 00 */ addi r30, r3, 0
/* 8032BF38 00328B18 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032BF3C 00328B1C 2C 00 FF FF */ cmpwi r0, -1
/* 8032BF40 00328B20 41 82 00 10 */ beq .L_8032BF50
/* 8032BF44 00328B24 48 01 77 C9 */ bl __OSGetDIConfig
/* 8032BF48 00328B28 28 03 00 FF */ cmplwi r3, 0xff
/* 8032BF4C 00328B2C 40 82 00 0C */ bne .L_8032BF58
.L_8032BF50:
/* 8032BF50 00328B30 38 60 00 00 */ li r3, 0
/* 8032BF54 00328B34 48 00 00 E4 */ b .L_8032C038
.L_8032BF58:
/* 8032BF58 00328B38 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BF5C 00328B3C 38 A0 00 00 */ li r5, 0
/* 8032BF60 00328B40 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032BF64 00328B44 48 01 AE 1D */ bl EXILock
/* 8032BF68 00328B48 2C 03 00 00 */ cmpwi r3, 0
/* 8032BF6C 00328B4C 40 82 00 0C */ bne .L_8032BF78
/* 8032BF70 00328B50 38 60 00 00 */ li r3, 0
/* 8032BF74 00328B54 48 00 00 C4 */ b .L_8032C038
.L_8032BF78:
/* 8032BF78 00328B58 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BF7C 00328B5C 38 A0 00 04 */ li r5, 4
/* 8032BF80 00328B60 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032BF84 00328B64 48 01 A7 05 */ bl EXISelect
/* 8032BF88 00328B68 2C 03 00 00 */ cmpwi r3, 0
/* 8032BF8C 00328B6C 40 82 00 14 */ bne .L_8032BFA0
/* 8032BF90 00328B70 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BF94 00328B74 48 01 AE E1 */ bl EXIUnlock
/* 8032BF98 00328B78 38 60 00 00 */ li r3, 0
/* 8032BF9C 00328B7C 48 00 00 9C */ b .L_8032C038
.L_8032BFA0:
/* 8032BFA0 00328B80 3C 00 60 00 */ lis r0, 0x6000
/* 8032BFA4 00328B84 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BFA8 00328B88 90 01 00 0C */ stw r0, 0xc(r1)
/* 8032BFAC 00328B8C 38 81 00 0C */ addi r4, r1, 0xc
/* 8032BFB0 00328B90 38 A0 00 02 */ li r5, 2
/* 8032BFB4 00328B94 38 C0 00 01 */ li r6, 1
/* 8032BFB8 00328B98 38 E0 00 00 */ li r7, 0
/* 8032BFBC 00328B9C 48 01 9B A9 */ bl EXIImm
/* 8032BFC0 00328BA0 7C 60 00 34 */ cntlzw r0, r3
/* 8032BFC4 00328BA4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BFC8 00328BA8 54 1F D9 7E */ srwi r31, r0, 5
/* 8032BFCC 00328BAC 48 01 9F 81 */ bl EXISync
/* 8032BFD0 00328BB0 7C 60 00 34 */ cntlzw r0, r3
/* 8032BFD4 00328BB4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BFD8 00328BB8 54 00 D9 7E */ srwi r0, r0, 5
/* 8032BFDC 00328BBC 38 9E 00 00 */ addi r4, r30, 0
/* 8032BFE0 00328BC0 7F FF 03 78 */ or r31, r31, r0
/* 8032BFE4 00328BC4 38 A0 00 04 */ li r5, 4
/* 8032BFE8 00328BC8 38 C0 00 00 */ li r6, 0
/* 8032BFEC 00328BCC 38 E0 00 00 */ li r7, 0
/* 8032BFF0 00328BD0 48 01 9B 75 */ bl EXIImm
/* 8032BFF4 00328BD4 7C 60 00 34 */ cntlzw r0, r3
/* 8032BFF8 00328BD8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032BFFC 00328BDC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C000 00328BE0 7F FF 03 78 */ or r31, r31, r0
/* 8032C004 00328BE4 48 01 9F 49 */ bl EXISync
/* 8032C008 00328BE8 7C 60 00 34 */ cntlzw r0, r3
/* 8032C00C 00328BEC 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C010 00328BF0 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C014 00328BF4 7F FF 03 78 */ or r31, r31, r0
/* 8032C018 00328BF8 48 01 A7 9D */ bl EXIDeselect
/* 8032C01C 00328BFC 7C 60 00 34 */ cntlzw r0, r3
/* 8032C020 00328C00 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C024 00328C04 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C028 00328C08 7F FF 03 78 */ or r31, r31, r0
/* 8032C02C 00328C0C 48 01 AE 49 */ bl EXIUnlock
/* 8032C030 00328C10 7F E0 00 34 */ cntlzw r0, r31
/* 8032C034 00328C14 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C038:
/* 8032C038 00328C18 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8032C03C 00328C1C 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 8032C040 00328C20 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 8032C044 00328C24 38 21 00 18 */ addi r1, r1, 0x18
/* 8032C048 00328C28 7C 08 03 A6 */ mtlr r0
/* 8032C04C 00328C2C 4E 80 00 20 */ blr
.global HIOWriteMailbox
HIOWriteMailbox:
/* 8032C050 00328C30 7C 08 02 A6 */ mflr r0
/* 8032C054 00328C34 90 01 00 04 */ stw r0, 4(r1)
/* 8032C058 00328C38 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8032C05C 00328C3C 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8032C060 00328C40 3B E3 00 00 */ addi r31, r3, 0
/* 8032C064 00328C44 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C068 00328C48 2C 00 FF FF */ cmpwi r0, -1
/* 8032C06C 00328C4C 41 82 00 10 */ beq .L_8032C07C
/* 8032C070 00328C50 48 01 76 9D */ bl __OSGetDIConfig
/* 8032C074 00328C54 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C078 00328C58 40 82 00 0C */ bne .L_8032C084
.L_8032C07C:
/* 8032C07C 00328C5C 38 60 00 00 */ li r3, 0
/* 8032C080 00328C60 48 00 00 B0 */ b .L_8032C130
.L_8032C084:
/* 8032C084 00328C64 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C088 00328C68 38 A0 00 00 */ li r5, 0
/* 8032C08C 00328C6C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C090 00328C70 48 01 AC F1 */ bl EXILock
/* 8032C094 00328C74 2C 03 00 00 */ cmpwi r3, 0
/* 8032C098 00328C78 40 82 00 0C */ bne .L_8032C0A4
/* 8032C09C 00328C7C 38 60 00 00 */ li r3, 0
/* 8032C0A0 00328C80 48 00 00 90 */ b .L_8032C130
.L_8032C0A4:
/* 8032C0A4 00328C84 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C0A8 00328C88 38 A0 00 04 */ li r5, 4
/* 8032C0AC 00328C8C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C0B0 00328C90 48 01 A5 D9 */ bl EXISelect
/* 8032C0B4 00328C94 2C 03 00 00 */ cmpwi r3, 0
/* 8032C0B8 00328C98 40 82 00 14 */ bne .L_8032C0CC
/* 8032C0BC 00328C9C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C0C0 00328CA0 48 01 AD B5 */ bl EXIUnlock
/* 8032C0C4 00328CA4 38 60 00 00 */ li r3, 0
/* 8032C0C8 00328CA8 48 00 00 68 */ b .L_8032C130
.L_8032C0CC:
/* 8032C0CC 00328CAC 57 E0 00 FE */ clrlwi r0, r31, 3
/* 8032C0D0 00328CB0 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C0D4 00328CB4 64 00 C0 00 */ oris r0, r0, 0xc000
/* 8032C0D8 00328CB8 90 01 00 0C */ stw r0, 0xc(r1)
/* 8032C0DC 00328CBC 38 81 00 0C */ addi r4, r1, 0xc
/* 8032C0E0 00328CC0 38 A0 00 04 */ li r5, 4
/* 8032C0E4 00328CC4 38 C0 00 01 */ li r6, 1
/* 8032C0E8 00328CC8 38 E0 00 00 */ li r7, 0
/* 8032C0EC 00328CCC 48 01 9A 79 */ bl EXIImm
/* 8032C0F0 00328CD0 7C 60 00 34 */ cntlzw r0, r3
/* 8032C0F4 00328CD4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C0F8 00328CD8 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C0FC 00328CDC 48 01 9E 51 */ bl EXISync
/* 8032C100 00328CE0 7C 60 00 34 */ cntlzw r0, r3
/* 8032C104 00328CE4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C108 00328CE8 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C10C 00328CEC 7F FF 03 78 */ or r31, r31, r0
/* 8032C110 00328CF0 48 01 A6 A5 */ bl EXIDeselect
/* 8032C114 00328CF4 7C 60 00 34 */ cntlzw r0, r3
/* 8032C118 00328CF8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C11C 00328CFC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C120 00328D00 7F FF 03 78 */ or r31, r31, r0
/* 8032C124 00328D04 48 01 AD 51 */ bl EXIUnlock
/* 8032C128 00328D08 7F E0 00 34 */ cntlzw r0, r31
/* 8032C12C 00328D0C 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C130:
/* 8032C130 00328D10 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8032C134 00328D14 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 8032C138 00328D18 38 21 00 18 */ addi r1, r1, 0x18
/* 8032C13C 00328D1C 7C 08 03 A6 */ mtlr r0
/* 8032C140 00328D20 4E 80 00 20 */ blr
.global HIORead
HIORead:
/* 8032C144 00328D24 7C 08 02 A6 */ mflr r0
/* 8032C148 00328D28 90 01 00 04 */ stw r0, 4(r1)
/* 8032C14C 00328D2C 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 8032C150 00328D30 93 E1 00 24 */ stw r31, 0x24(r1)
/* 8032C154 00328D34 3B E3 00 00 */ addi r31, r3, 0
/* 8032C158 00328D38 93 C1 00 20 */ stw r30, 0x20(r1)
/* 8032C15C 00328D3C 3B C5 00 00 */ addi r30, r5, 0
/* 8032C160 00328D40 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 8032C164 00328D44 3B A4 00 00 */ addi r29, r4, 0
/* 8032C168 00328D48 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C16C 00328D4C 2C 00 FF FF */ cmpwi r0, -1
/* 8032C170 00328D50 41 82 00 10 */ beq .L_8032C180
/* 8032C174 00328D54 48 01 75 99 */ bl __OSGetDIConfig
/* 8032C178 00328D58 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C17C 00328D5C 40 82 00 0C */ bne .L_8032C188
.L_8032C180:
/* 8032C180 00328D60 38 60 00 00 */ li r3, 0
/* 8032C184 00328D64 48 00 00 E8 */ b .L_8032C26C
.L_8032C188:
/* 8032C188 00328D68 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C18C 00328D6C 38 A0 00 00 */ li r5, 0
/* 8032C190 00328D70 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C194 00328D74 48 01 AB ED */ bl EXILock
/* 8032C198 00328D78 2C 03 00 00 */ cmpwi r3, 0
/* 8032C19C 00328D7C 40 82 00 0C */ bne .L_8032C1A8
/* 8032C1A0 00328D80 38 60 00 00 */ li r3, 0
/* 8032C1A4 00328D84 48 00 00 C8 */ b .L_8032C26C
.L_8032C1A8:
/* 8032C1A8 00328D88 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C1AC 00328D8C 38 A0 00 04 */ li r5, 4
/* 8032C1B0 00328D90 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C1B4 00328D94 48 01 A4 D5 */ bl EXISelect
/* 8032C1B8 00328D98 2C 03 00 00 */ cmpwi r3, 0
/* 8032C1BC 00328D9C 40 82 00 14 */ bne .L_8032C1D0
/* 8032C1C0 00328DA0 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C1C4 00328DA4 48 01 AC B1 */ bl EXIUnlock
/* 8032C1C8 00328DA8 38 60 00 00 */ li r3, 0
/* 8032C1CC 00328DAC 48 00 00 A0 */ b .L_8032C26C
.L_8032C1D0:
/* 8032C1D0 00328DB0 57 E0 41 EA */ rlwinm r0, r31, 8, 7, 0x15
/* 8032C1D4 00328DB4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C1D8 00328DB8 64 00 20 00 */ oris r0, r0, 0x2000
/* 8032C1DC 00328DBC 90 01 00 14 */ stw r0, 0x14(r1)
/* 8032C1E0 00328DC0 38 81 00 14 */ addi r4, r1, 0x14
/* 8032C1E4 00328DC4 38 A0 00 04 */ li r5, 4
/* 8032C1E8 00328DC8 38 C0 00 01 */ li r6, 1
/* 8032C1EC 00328DCC 38 E0 00 00 */ li r7, 0
/* 8032C1F0 00328DD0 48 01 99 75 */ bl EXIImm
/* 8032C1F4 00328DD4 7C 60 00 34 */ cntlzw r0, r3
/* 8032C1F8 00328DD8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C1FC 00328DDC 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C200 00328DE0 48 01 9D 4D */ bl EXISync
/* 8032C204 00328DE4 7C 60 00 34 */ cntlzw r0, r3
/* 8032C208 00328DE8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C20C 00328DEC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C210 00328DF0 38 9D 00 00 */ addi r4, r29, 0
/* 8032C214 00328DF4 38 BE 00 00 */ addi r5, r30, 0
/* 8032C218 00328DF8 7F FF 03 78 */ or r31, r31, r0
/* 8032C21C 00328DFC 38 C0 00 00 */ li r6, 0
/* 8032C220 00328E00 38 E0 00 00 */ li r7, 0
/* 8032C224 00328E04 48 01 9C 3D */ bl EXIDma
/* 8032C228 00328E08 7C 60 00 34 */ cntlzw r0, r3
/* 8032C22C 00328E0C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C230 00328E10 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C234 00328E14 7F FF 03 78 */ or r31, r31, r0
/* 8032C238 00328E18 48 01 9D 15 */ bl EXISync
/* 8032C23C 00328E1C 7C 60 00 34 */ cntlzw r0, r3
/* 8032C240 00328E20 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C244 00328E24 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C248 00328E28 7F FF 03 78 */ or r31, r31, r0
/* 8032C24C 00328E2C 48 01 A5 69 */ bl EXIDeselect
/* 8032C250 00328E30 7C 60 00 34 */ cntlzw r0, r3
/* 8032C254 00328E34 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C258 00328E38 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C25C 00328E3C 7F FF 03 78 */ or r31, r31, r0
/* 8032C260 00328E40 48 01 AC 15 */ bl EXIUnlock
/* 8032C264 00328E44 7F E0 00 34 */ cntlzw r0, r31
/* 8032C268 00328E48 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C26C:
/* 8032C26C 00328E4C 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 8032C270 00328E50 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 8032C274 00328E54 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 8032C278 00328E58 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 8032C27C 00328E5C 38 21 00 28 */ addi r1, r1, 0x28
/* 8032C280 00328E60 7C 08 03 A6 */ mtlr r0
/* 8032C284 00328E64 4E 80 00 20 */ blr
.global HIOWrite
HIOWrite:
/* 8032C288 00328E68 7C 08 02 A6 */ mflr r0
/* 8032C28C 00328E6C 90 01 00 04 */ stw r0, 4(r1)
/* 8032C290 00328E70 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 8032C294 00328E74 93 E1 00 24 */ stw r31, 0x24(r1)
/* 8032C298 00328E78 3B E3 00 00 */ addi r31, r3, 0
/* 8032C29C 00328E7C 93 C1 00 20 */ stw r30, 0x20(r1)
/* 8032C2A0 00328E80 3B C5 00 00 */ addi r30, r5, 0
/* 8032C2A4 00328E84 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 8032C2A8 00328E88 3B A4 00 00 */ addi r29, r4, 0
/* 8032C2AC 00328E8C 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C2B0 00328E90 2C 00 FF FF */ cmpwi r0, -1
/* 8032C2B4 00328E94 41 82 00 10 */ beq .L_8032C2C4
/* 8032C2B8 00328E98 48 01 74 55 */ bl __OSGetDIConfig
/* 8032C2BC 00328E9C 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C2C0 00328EA0 40 82 00 0C */ bne .L_8032C2CC
.L_8032C2C4:
/* 8032C2C4 00328EA4 38 60 00 00 */ li r3, 0
/* 8032C2C8 00328EA8 48 00 00 E8 */ b .L_8032C3B0
.L_8032C2CC:
/* 8032C2CC 00328EAC 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C2D0 00328EB0 38 A0 00 00 */ li r5, 0
/* 8032C2D4 00328EB4 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C2D8 00328EB8 48 01 AA A9 */ bl EXILock
/* 8032C2DC 00328EBC 2C 03 00 00 */ cmpwi r3, 0
/* 8032C2E0 00328EC0 40 82 00 0C */ bne .L_8032C2EC
/* 8032C2E4 00328EC4 38 60 00 00 */ li r3, 0
/* 8032C2E8 00328EC8 48 00 00 C8 */ b .L_8032C3B0
.L_8032C2EC:
/* 8032C2EC 00328ECC 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C2F0 00328ED0 38 A0 00 04 */ li r5, 4
/* 8032C2F4 00328ED4 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C2F8 00328ED8 48 01 A3 91 */ bl EXISelect
/* 8032C2FC 00328EDC 2C 03 00 00 */ cmpwi r3, 0
/* 8032C300 00328EE0 40 82 00 14 */ bne .L_8032C314
/* 8032C304 00328EE4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C308 00328EE8 48 01 AB 6D */ bl EXIUnlock
/* 8032C30C 00328EEC 38 60 00 00 */ li r3, 0
/* 8032C310 00328EF0 48 00 00 A0 */ b .L_8032C3B0
.L_8032C314:
/* 8032C314 00328EF4 57 E0 41 EA */ rlwinm r0, r31, 8, 7, 0x15
/* 8032C318 00328EF8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C31C 00328EFC 64 00 A0 00 */ oris r0, r0, 0xa000
/* 8032C320 00328F00 90 01 00 14 */ stw r0, 0x14(r1)
/* 8032C324 00328F04 38 81 00 14 */ addi r4, r1, 0x14
/* 8032C328 00328F08 38 A0 00 04 */ li r5, 4
/* 8032C32C 00328F0C 38 C0 00 01 */ li r6, 1
/* 8032C330 00328F10 38 E0 00 00 */ li r7, 0
/* 8032C334 00328F14 48 01 98 31 */ bl EXIImm
/* 8032C338 00328F18 7C 60 00 34 */ cntlzw r0, r3
/* 8032C33C 00328F1C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C340 00328F20 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C344 00328F24 48 01 9C 09 */ bl EXISync
/* 8032C348 00328F28 7C 60 00 34 */ cntlzw r0, r3
/* 8032C34C 00328F2C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C350 00328F30 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C354 00328F34 38 9D 00 00 */ addi r4, r29, 0
/* 8032C358 00328F38 38 BE 00 00 */ addi r5, r30, 0
/* 8032C35C 00328F3C 7F FF 03 78 */ or r31, r31, r0
/* 8032C360 00328F40 38 C0 00 01 */ li r6, 1
/* 8032C364 00328F44 38 E0 00 00 */ li r7, 0
/* 8032C368 00328F48 48 01 9A F9 */ bl EXIDma
/* 8032C36C 00328F4C 7C 60 00 34 */ cntlzw r0, r3
/* 8032C370 00328F50 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C374 00328F54 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C378 00328F58 7F FF 03 78 */ or r31, r31, r0
/* 8032C37C 00328F5C 48 01 9B D1 */ bl EXISync
/* 8032C380 00328F60 7C 60 00 34 */ cntlzw r0, r3
/* 8032C384 00328F64 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C388 00328F68 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C38C 00328F6C 7F FF 03 78 */ or r31, r31, r0
/* 8032C390 00328F70 48 01 A4 25 */ bl EXIDeselect
/* 8032C394 00328F74 7C 60 00 34 */ cntlzw r0, r3
/* 8032C398 00328F78 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C39C 00328F7C 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C3A0 00328F80 7F FF 03 78 */ or r31, r31, r0
/* 8032C3A4 00328F84 48 01 AA D1 */ bl EXIUnlock
/* 8032C3A8 00328F88 7F E0 00 34 */ cntlzw r0, r31
/* 8032C3AC 00328F8C 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C3B0:
/* 8032C3B0 00328F90 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 8032C3B4 00328F94 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 8032C3B8 00328F98 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 8032C3BC 00328F9C 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 8032C3C0 00328FA0 38 21 00 28 */ addi r1, r1, 0x28
/* 8032C3C4 00328FA4 7C 08 03 A6 */ mtlr r0
/* 8032C3C8 00328FA8 4E 80 00 20 */ blr
.global HIOReadAsync
HIOReadAsync:
/* 8032C3CC 00328FAC 7C 08 02 A6 */ mflr r0
/* 8032C3D0 00328FB0 90 01 00 04 */ stw r0, 4(r1)
/* 8032C3D4 00328FB4 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 8032C3D8 00328FB8 93 E1 00 2C */ stw r31, 0x2c(r1)
/* 8032C3DC 00328FBC 3B E6 00 00 */ addi r31, r6, 0
/* 8032C3E0 00328FC0 93 C1 00 28 */ stw r30, 0x28(r1)
/* 8032C3E4 00328FC4 3B C5 00 00 */ addi r30, r5, 0
/* 8032C3E8 00328FC8 93 A1 00 24 */ stw r29, 0x24(r1)
/* 8032C3EC 00328FCC 3B A4 00 00 */ addi r29, r4, 0
/* 8032C3F0 00328FD0 93 81 00 20 */ stw r28, 0x20(r1)
/* 8032C3F4 00328FD4 3B 83 00 00 */ addi r28, r3, 0
/* 8032C3F8 00328FD8 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C3FC 00328FDC 2C 00 FF FF */ cmpwi r0, -1
/* 8032C400 00328FE0 41 82 00 10 */ beq .L_8032C410
/* 8032C404 00328FE4 48 01 73 09 */ bl __OSGetDIConfig
/* 8032C408 00328FE8 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C40C 00328FEC 40 82 00 0C */ bne .L_8032C418
.L_8032C410:
/* 8032C410 00328FF0 38 60 00 00 */ li r3, 0
/* 8032C414 00328FF4 48 00 00 C0 */ b .L_8032C4D4
.L_8032C418:
/* 8032C418 00328FF8 93 ED BA 0C */ stw r31, RxCallback@sda21(r13)
/* 8032C41C 00328FFC 38 A0 00 00 */ li r5, 0
/* 8032C420 00329000 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C424 00329004 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C428 00329008 48 01 A9 59 */ bl EXILock
/* 8032C42C 0032900C 2C 03 00 00 */ cmpwi r3, 0
/* 8032C430 00329010 40 82 00 0C */ bne .L_8032C43C
/* 8032C434 00329014 38 60 00 00 */ li r3, 0
/* 8032C438 00329018 48 00 00 9C */ b .L_8032C4D4
.L_8032C43C:
/* 8032C43C 0032901C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C440 00329020 38 A0 00 04 */ li r5, 4
/* 8032C444 00329024 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C448 00329028 48 01 A2 41 */ bl EXISelect
/* 8032C44C 0032902C 2C 03 00 00 */ cmpwi r3, 0
/* 8032C450 00329030 40 82 00 14 */ bne .L_8032C464
/* 8032C454 00329034 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C458 00329038 48 01 AA 1D */ bl EXIUnlock
/* 8032C45C 0032903C 38 60 00 00 */ li r3, 0
/* 8032C460 00329040 48 00 00 74 */ b .L_8032C4D4
.L_8032C464:
/* 8032C464 00329044 57 80 41 EA */ rlwinm r0, r28, 8, 7, 0x15
/* 8032C468 00329048 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C46C 0032904C 64 00 20 00 */ oris r0, r0, 0x2000
/* 8032C470 00329050 90 01 00 18 */ stw r0, 0x18(r1)
/* 8032C474 00329054 38 81 00 18 */ addi r4, r1, 0x18
/* 8032C478 00329058 38 A0 00 04 */ li r5, 4
/* 8032C47C 0032905C 38 C0 00 01 */ li r6, 1
/* 8032C480 00329060 38 E0 00 00 */ li r7, 0
/* 8032C484 00329064 48 01 96 E1 */ bl EXIImm
/* 8032C488 00329068 7C 60 00 34 */ cntlzw r0, r3
/* 8032C48C 0032906C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C490 00329070 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C494 00329074 48 01 9A B9 */ bl EXISync
/* 8032C498 00329078 7C 60 00 34 */ cntlzw r0, r3
/* 8032C49C 0032907C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C4A0 00329080 3C 80 80 33 */ lis r4, RxHandler@ha
/* 8032C4A4 00329084 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C4A8 00329088 38 E4 BB 84 */ addi r7, r4, RxHandler@l
/* 8032C4AC 0032908C 38 9D 00 00 */ addi r4, r29, 0
/* 8032C4B0 00329090 38 BE 00 00 */ addi r5, r30, 0
/* 8032C4B4 00329094 7F FF 03 78 */ or r31, r31, r0
/* 8032C4B8 00329098 38 C0 00 00 */ li r6, 0
/* 8032C4BC 0032909C 48 01 99 A5 */ bl EXIDma
/* 8032C4C0 003290A0 7C 60 00 34 */ cntlzw r0, r3
/* 8032C4C4 003290A4 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C4C8 003290A8 7F FF 03 78 */ or r31, r31, r0
/* 8032C4CC 003290AC 7F E0 00 34 */ cntlzw r0, r31
/* 8032C4D0 003290B0 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C4D4:
/* 8032C4D4 003290B4 80 01 00 34 */ lwz r0, 0x34(r1)
/* 8032C4D8 003290B8 83 E1 00 2C */ lwz r31, 0x2c(r1)
/* 8032C4DC 003290BC 83 C1 00 28 */ lwz r30, 0x28(r1)
/* 8032C4E0 003290C0 83 A1 00 24 */ lwz r29, 0x24(r1)
/* 8032C4E4 003290C4 83 81 00 20 */ lwz r28, 0x20(r1)
/* 8032C4E8 003290C8 38 21 00 30 */ addi r1, r1, 0x30
/* 8032C4EC 003290CC 7C 08 03 A6 */ mtlr r0
/* 8032C4F0 003290D0 4E 80 00 20 */ blr
.global HIOWriteAsync
HIOWriteAsync:
/* 8032C4F4 003290D4 7C 08 02 A6 */ mflr r0
/* 8032C4F8 003290D8 90 01 00 04 */ stw r0, 4(r1)
/* 8032C4FC 003290DC 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 8032C500 003290E0 93 E1 00 2C */ stw r31, 0x2c(r1)
/* 8032C504 003290E4 3B E6 00 00 */ addi r31, r6, 0
/* 8032C508 003290E8 93 C1 00 28 */ stw r30, 0x28(r1)
/* 8032C50C 003290EC 3B C5 00 00 */ addi r30, r5, 0
/* 8032C510 003290F0 93 A1 00 24 */ stw r29, 0x24(r1)
/* 8032C514 003290F4 3B A4 00 00 */ addi r29, r4, 0
/* 8032C518 003290F8 93 81 00 20 */ stw r28, 0x20(r1)
/* 8032C51C 003290FC 3B 83 00 00 */ addi r28, r3, 0
/* 8032C520 00329100 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C524 00329104 2C 00 FF FF */ cmpwi r0, -1
/* 8032C528 00329108 41 82 00 10 */ beq .L_8032C538
/* 8032C52C 0032910C 48 01 71 E1 */ bl __OSGetDIConfig
/* 8032C530 00329110 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C534 00329114 40 82 00 0C */ bne .L_8032C540
.L_8032C538:
/* 8032C538 00329118 38 60 00 00 */ li r3, 0
/* 8032C53C 0032911C 48 00 00 C0 */ b .L_8032C5FC
.L_8032C540:
/* 8032C540 00329120 93 ED BA 08 */ stw r31, TxCallback@sda21(r13)
/* 8032C544 00329124 38 A0 00 00 */ li r5, 0
/* 8032C548 00329128 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C54C 0032912C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C550 00329130 48 01 A8 31 */ bl EXILock
/* 8032C554 00329134 2C 03 00 00 */ cmpwi r3, 0
/* 8032C558 00329138 40 82 00 0C */ bne .L_8032C564
/* 8032C55C 0032913C 38 60 00 00 */ li r3, 0
/* 8032C560 00329140 48 00 00 9C */ b .L_8032C5FC
.L_8032C564:
/* 8032C564 00329144 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C568 00329148 38 A0 00 04 */ li r5, 4
/* 8032C56C 0032914C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C570 00329150 48 01 A1 19 */ bl EXISelect
/* 8032C574 00329154 2C 03 00 00 */ cmpwi r3, 0
/* 8032C578 00329158 40 82 00 14 */ bne .L_8032C58C
/* 8032C57C 0032915C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C580 00329160 48 01 A8 F5 */ bl EXIUnlock
/* 8032C584 00329164 38 60 00 00 */ li r3, 0
/* 8032C588 00329168 48 00 00 74 */ b .L_8032C5FC
.L_8032C58C:
/* 8032C58C 0032916C 57 80 41 EA */ rlwinm r0, r28, 8, 7, 0x15
/* 8032C590 00329170 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C594 00329174 64 00 A0 00 */ oris r0, r0, 0xa000
/* 8032C598 00329178 90 01 00 18 */ stw r0, 0x18(r1)
/* 8032C59C 0032917C 38 81 00 18 */ addi r4, r1, 0x18
/* 8032C5A0 00329180 38 A0 00 04 */ li r5, 4
/* 8032C5A4 00329184 38 C0 00 01 */ li r6, 1
/* 8032C5A8 00329188 38 E0 00 00 */ li r7, 0
/* 8032C5AC 0032918C 48 01 95 B9 */ bl EXIImm
/* 8032C5B0 00329190 7C 60 00 34 */ cntlzw r0, r3
/* 8032C5B4 00329194 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C5B8 00329198 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C5BC 0032919C 48 01 99 91 */ bl EXISync
/* 8032C5C0 003291A0 7C 60 00 34 */ cntlzw r0, r3
/* 8032C5C4 003291A4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C5C8 003291A8 3C 80 80 33 */ lis r4, TxHandler@ha
/* 8032C5CC 003291AC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C5D0 003291B0 38 E4 BB 44 */ addi r7, r4, TxHandler@l
/* 8032C5D4 003291B4 38 9D 00 00 */ addi r4, r29, 0
/* 8032C5D8 003291B8 38 BE 00 00 */ addi r5, r30, 0
/* 8032C5DC 003291BC 7F FF 03 78 */ or r31, r31, r0
/* 8032C5E0 003291C0 38 C0 00 01 */ li r6, 1
/* 8032C5E4 003291C4 48 01 98 7D */ bl EXIDma
/* 8032C5E8 003291C8 7C 60 00 34 */ cntlzw r0, r3
/* 8032C5EC 003291CC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C5F0 003291D0 7F FF 03 78 */ or r31, r31, r0
/* 8032C5F4 003291D4 7F E0 00 34 */ cntlzw r0, r31
/* 8032C5F8 003291D8 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C5FC:
/* 8032C5FC 003291DC 80 01 00 34 */ lwz r0, 0x34(r1)
/* 8032C600 003291E0 83 E1 00 2C */ lwz r31, 0x2c(r1)
/* 8032C604 003291E4 83 C1 00 28 */ lwz r30, 0x28(r1)
/* 8032C608 003291E8 83 A1 00 24 */ lwz r29, 0x24(r1)
/* 8032C60C 003291EC 83 81 00 20 */ lwz r28, 0x20(r1)
/* 8032C610 003291F0 38 21 00 30 */ addi r1, r1, 0x30
/* 8032C614 003291F4 7C 08 03 A6 */ mtlr r0
/* 8032C618 003291F8 4E 80 00 20 */ blr
.global HIOReadStatus
HIOReadStatus:
/* 8032C61C 003291FC 7C 08 02 A6 */ mflr r0
/* 8032C620 00329200 90 01 00 04 */ stw r0, 4(r1)
/* 8032C624 00329204 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8032C628 00329208 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8032C62C 0032920C 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8032C630 00329210 3B C3 00 00 */ addi r30, r3, 0
/* 8032C634 00329214 80 0D A4 C8 */ lwz r0, Chan@sda21(r13)
/* 8032C638 00329218 2C 00 FF FF */ cmpwi r0, -1
/* 8032C63C 0032921C 41 82 00 10 */ beq .L_8032C64C
/* 8032C640 00329220 48 01 70 CD */ bl __OSGetDIConfig
/* 8032C644 00329224 28 03 00 FF */ cmplwi r3, 0xff
/* 8032C648 00329228 40 82 00 0C */ bne .L_8032C654
.L_8032C64C:
/* 8032C64C 0032922C 38 60 00 00 */ li r3, 0
/* 8032C650 00329230 48 00 00 E4 */ b .L_8032C734
.L_8032C654:
/* 8032C654 00329234 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C658 00329238 38 A0 00 00 */ li r5, 0
/* 8032C65C 0032923C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C660 00329240 48 01 A7 21 */ bl EXILock
/* 8032C664 00329244 2C 03 00 00 */ cmpwi r3, 0
/* 8032C668 00329248 40 82 00 0C */ bne .L_8032C674
/* 8032C66C 0032924C 38 60 00 00 */ li r3, 0
/* 8032C670 00329250 48 00 00 C4 */ b .L_8032C734
.L_8032C674:
/* 8032C674 00329254 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C678 00329258 38 A0 00 04 */ li r5, 4
/* 8032C67C 0032925C 80 8D BA 00 */ lwz r4, Dev@sda21(r13)
/* 8032C680 00329260 48 01 A0 09 */ bl EXISelect
/* 8032C684 00329264 2C 03 00 00 */ cmpwi r3, 0
/* 8032C688 00329268 40 82 00 14 */ bne .L_8032C69C
/* 8032C68C 0032926C 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C690 00329270 48 01 A7 E5 */ bl EXIUnlock
/* 8032C694 00329274 38 60 00 00 */ li r3, 0
/* 8032C698 00329278 48 00 00 9C */ b .L_8032C734
.L_8032C69C:
/* 8032C69C 0032927C 3C 00 40 00 */ lis r0, 0x4000
/* 8032C6A0 00329280 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C6A4 00329284 90 01 00 0C */ stw r0, 0xc(r1)
/* 8032C6A8 00329288 38 81 00 0C */ addi r4, r1, 0xc
/* 8032C6AC 0032928C 38 A0 00 02 */ li r5, 2
/* 8032C6B0 00329290 38 C0 00 01 */ li r6, 1
/* 8032C6B4 00329294 38 E0 00 00 */ li r7, 0
/* 8032C6B8 00329298 48 01 94 AD */ bl EXIImm
/* 8032C6BC 0032929C 7C 60 00 34 */ cntlzw r0, r3
/* 8032C6C0 003292A0 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C6C4 003292A4 54 1F D9 7E */ srwi r31, r0, 5
/* 8032C6C8 003292A8 48 01 98 85 */ bl EXISync
/* 8032C6CC 003292AC 7C 60 00 34 */ cntlzw r0, r3
/* 8032C6D0 003292B0 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C6D4 003292B4 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C6D8 003292B8 38 9E 00 00 */ addi r4, r30, 0
/* 8032C6DC 003292BC 7F FF 03 78 */ or r31, r31, r0
/* 8032C6E0 003292C0 38 A0 00 04 */ li r5, 4
/* 8032C6E4 003292C4 38 C0 00 00 */ li r6, 0
/* 8032C6E8 003292C8 38 E0 00 00 */ li r7, 0
/* 8032C6EC 003292CC 48 01 94 79 */ bl EXIImm
/* 8032C6F0 003292D0 7C 60 00 34 */ cntlzw r0, r3
/* 8032C6F4 003292D4 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C6F8 003292D8 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C6FC 003292DC 7F FF 03 78 */ or r31, r31, r0
/* 8032C700 003292E0 48 01 98 4D */ bl EXISync
/* 8032C704 003292E4 7C 60 00 34 */ cntlzw r0, r3
/* 8032C708 003292E8 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C70C 003292EC 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C710 003292F0 7F FF 03 78 */ or r31, r31, r0
/* 8032C714 003292F4 48 01 A0 A1 */ bl EXIDeselect
/* 8032C718 003292F8 7C 60 00 34 */ cntlzw r0, r3
/* 8032C71C 003292FC 80 6D A4 C8 */ lwz r3, Chan@sda21(r13)
/* 8032C720 00329300 54 00 D9 7E */ srwi r0, r0, 5
/* 8032C724 00329304 7F FF 03 78 */ or r31, r31, r0
/* 8032C728 00329308 48 01 A7 4D */ bl EXIUnlock
/* 8032C72C 0032930C 7F E0 00 34 */ cntlzw r0, r31
/* 8032C730 00329310 54 03 D9 7E */ srwi r3, r0, 5
.L_8032C734:
/* 8032C734 00329314 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 8032C738 00329318 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 8032C73C 0032931C 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 8032C740 00329320 38 21 00 18 */ addi r1, r1, 0x18
/* 8032C744 00329324 7C 08 03 A6 */ mtlr r0
/* 8032C748 00329328 4E 80 00 20 */ blr
.section .sdata
.balign 8
.global Chan
Chan:
.4byte 0xFFFFFFFF
.section .sbss
.balign 8
.global Dev
Dev:
.skip 0x4
.global ExiCallback
ExiCallback:
.skip 0x4
.global TxCallback
TxCallback:
.skip 0x4
.global RxCallback
RxCallback:
.skip 0x4

View File

@ -1222,10 +1222,10 @@ config.libs = [
Object(NonMatching, "dolphin/OdemuExi2/DebuggerDriver.c"),
],
),
DolphinLib(
Lib(
"hio",
[
Object(NonMatching, "dolphin/hio/hio.c"),
Object(Matching, "dolphin/hio/hio.c"),
],
),
DolphinLib(

View File

@ -823,7 +823,7 @@ TEXT_O_FILES +=\
$(BUILD_DIR)/asm/dolphin/OdemuExi2/DebuggerDriver.s.o\
TEXT_O_FILES +=\
$(BUILD_DIR)/asm/dolphin/hio/hio.s.o\
$(BUILD_DIR)/src/dolphin/hio/hio.c.o\
TEXT_O_FILES +=\
$(BUILD_DIR)/asm/dolphin/mcc/mcc.s.o\

View File

@ -1 +1,336 @@
#include "hio.h"
#include <dolphin/os/OSContext.h>
#include <dolphin/os/OSExi.h>
#include <dolphin/os/OSInit.h>
#include <dolphin/os/OSInterrupt.h>
static s32 Chan = -1;
static unsigned long Dev;
static HIOCallback ExiCallback;
static HIOCallback TxCallback;
static HIOCallback RxCallback;
static void ExtHandler(s32 chan, OSContext* context)
{
Chan = -1;
Dev = 0;
if ((chan < 2)) {
EXISetExiCallback(chan, NULL);
return;
}
}
static void ExiHandler(s32 chan, OSContext* context)
{
if (ExiCallback) {
ExiCallback();
}
}
static void DbgHandler(__OSInterrupt interrupt, OSContext* context)
{
struct OSContext exceptionContext;
__PIRegs[0] = 0x1000;
if (ExiCallback) {
OSClearContext(&exceptionContext);
OSSetCurrentContext(&exceptionContext);
ExiCallback();
OSClearContext(&exceptionContext);
OSSetCurrentContext(context);
}
}
static void TxHandler(s32 chan, OSContext* context)
{
EXIDeselect(Chan);
EXIUnlock(Chan);
if (TxCallback) {
TxCallback();
}
}
static void RxHandler(s32 chan, OSContext* context)
{
EXIDeselect(Chan);
EXIUnlock(Chan);
if (RxCallback) {
RxCallback();
}
}
bool HIOEnumDevices(HIOEnumCallback callback)
{
s32 chan;
u32 id;
if (Chan != -1 || callback == NULL) {
return 0;
}
Dev = 0;
for (chan = 0; chan <= 2; chan++) {
if (chan < 2) {
do {
} while (EXIProbeEx(chan) == 0);
}
if ((EXIGetID(chan, Dev, &id) != 0) &&
((u32) (id + 0xFEFF0000) == 0U) && (callback(chan) == 0))
{
return 1;
}
}
return 1;
}
bool HIOInit(s32 chan, HIOCallback callback)
{
int err;
u32 cmd;
u32 id;
if (__OSGetDIConfig() == 0xFFU) {
Chan = -1;
Dev = 0U;
return 0;
}
if (Chan != -1) {
return 1;
}
Chan = chan;
ExiCallback = callback;
TxCallback = NULL;
RxCallback = NULL;
if (chan < 2 && Dev == 0) {
do {
} while (EXIProbeEx(Chan) == 0);
if (EXIAttach(Chan, ExtHandler) == 0) {
Chan = -1;
Dev = 0;
return 0;
}
}
if (EXILock(Chan, Dev, 0) == 0) {
EXIDetach(Chan);
Chan = -1;
Dev = 0;
return 0;
}
if (EXISelect(Chan, Dev, 0) == 0) {
EXIUnlock(Chan);
EXIDetach(Chan);
Chan = -1;
Dev = 0;
return 0;
}
cmd = 0;
err = 0;
err |= !EXIImm(Chan, &cmd, 2, 1, 0);
err |= !EXISync(Chan);
err |= !EXIImm(Chan, &id, 4, 0, 0);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
if (err != 0 || id != 0x1010000) {
if (chan < 2 && Dev == 0) {
EXIDetach(Chan);
}
EXIUnlock(Chan);
Chan = -1;
Dev = 0;
return 0;
}
if (ExiCallback) {
if (chan < 2) {
if (Dev == 0) {
EXISetExiCallback(Chan, ExiHandler);
} else {
EXISetExiCallback(2, ExiHandler);
}
} else {
__OSSetInterruptHandler(0x19, DbgHandler);
__OSUnmaskInterrupts(0x40);
}
}
return 1;
}
bool HIOReadMailbox(u32* word)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = 0x60000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 2, 1, 0);
err |= !EXISync(Chan);
err |= !EXIImm(Chan, word, 4, 0, 0);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
return !err;
}
bool HIOWriteMailbox(u32 word)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = (word & 0x1FFFFFFF) | 0xC0000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 4, 1, 0);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
return !err;
}
bool HIORead(u32 addr, void* buffer, s32 size)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = ((addr << 8) & 0x01FFFC00) | 0x20000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 4, 1, 0);
err |= !EXISync(Chan);
err |= !EXIDma(Chan, buffer, size, 0, NULL);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
return !err;
}
bool HIOWrite(u32 addr, void* buffer, s32 size)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = ((addr << 8) & 0x01FFFC00) | 0xA0000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 4, 1, 0);
err |= !EXISync(Chan);
err |= !EXIDma(Chan, buffer, size, 1, NULL);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
return !err;
}
bool HIOReadAsync(u32 addr, void* buffer, s32 size, HIOCallback callback)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
RxCallback = callback;
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = ((addr << 8) & 0x01FFFC00) | 0x20000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 4, 1, 0);
err |= !EXISync(Chan);
err |= !EXIDma(Chan, buffer, size, 0, RxHandler);
return !err;
}
bool HIOWriteAsync(u32 addr, void* buffer, s32 size, HIOCallback callback)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
TxCallback = callback;
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = ((addr << 8) & 0x01FFFC00) | 0xA0000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 4, 1, 0);
err |= !EXISync(Chan);
err |= !EXIDma(Chan, buffer, size, 1, TxHandler);
return !err;
}
bool HIOReadStatus(u32* status)
{
int err;
u32 cmd;
if (Chan == -1 || __OSGetDIConfig() == 0xFFU) {
return 0;
}
if (EXILock(Chan, Dev, 0) == 0) {
return 0;
}
if (EXISelect(Chan, Dev, 4) == 0) {
EXIUnlock(Chan);
return 0;
}
cmd = 0x40000000;
err = 0;
err |= !EXIImm(Chan, &cmd, 2, 1, 0);
err |= !EXISync(Chan);
err |= !EXIImm(Chan, status, 4, 0, 0);
err |= !EXISync(Chan);
err |= !EXIDeselect(Chan);
EXIUnlock(Chan);
return !err;
}

View File

@ -1 +1,20 @@
#ifndef _DOLPHIN_HIO_H_
#include <platform.h>
#define HIO_DEV Dev
typedef void (*HIOCallback)(void);
typedef bool (*HIOEnumCallback)(s32 chan);
bool HIOEnumDevices(HIOEnumCallback callback);
bool HIOInit(s32 chan, HIOCallback callback);
bool HIOReadMailbox(u32* word);
bool HIOWriteMailbox(u32 word);
bool HIORead(u32 addr, void* buffer, s32 size);
bool HIOWrite(u32 addr, void* buffer, s32 size);
bool HIOReadAsync(u32 addr, void* buffer, s32 size, HIOCallback callback);
bool HIOWriteAsync(u32 addr, void* buffer, s32 size, HIOCallback callback);
bool HIOReadStatus(u32* status);
#endif