summaryrefslogtreecommitdiff
path: root/src/libultra_code_O2/__osContRamRead.c
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2021-02-14 00:49:40 +0000
committerGitHub <noreply@github.com>2021-02-13 19:49:40 -0500
commitf9d96d9f73ac090245a518ec04f3fa0e50655d1e (patch)
tree9dc905fce276cbfb07a05fc2bf0883bcedddcf23 /src/libultra_code_O2/__osContRamRead.c
parentd615ec4f31563b939f8c0dce1c20c79e137c2043 (diff)
Fix most compiler warnings in the boot and code segments (#674)
* Less warnings in boot & code segments * few more warnings gone * Ran formatter * z_view warning gone * -> 1 * f31 -> 31 * Remove function casts * Few more small improvements * Separate declaration and assignment in func_80091738 and Item_Give Co-authored-by: Thar0 <maximilianc64@gmail.com>
Diffstat (limited to 'src/libultra_code_O2/__osContRamRead.c')
-rw-r--r--src/libultra_code_O2/__osContRamRead.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libultra_code_O2/__osContRamRead.c b/src/libultra_code_O2/__osContRamRead.c
index 07c72e54b..97d5db651 100644
--- a/src/libultra_code_O2/__osContRamRead.c
+++ b/src/libultra_code_O2/__osContRamRead.c
@@ -12,15 +12,15 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) {
__osSiGetAccess();
do {
- bufptr = &pifMempakBuf;
- if ((__osContLastPoll != 2) || (__osPfsLastChannel != channel)) {
+ bufptr = (u8*)&gPifMempakBuf;
+ if ((__osContLastPoll != 2) || (__osPfsLastChannel != channel)) {
__osContLastPoll = 2;
__osPfsLastChannel = channel;
// clang-format off
for (i = 0; i < channel; i++) { *bufptr++ = 0; }
// clang-format on
- pifMempakBuf.status = 1;
+ gPifMempakBuf.status = 1;
((__OSContRamHeader*)bufptr)->unk_00 = 0xFF;
((__OSContRamHeader*)bufptr)->txsize = 3;
((__OSContRamHeader*)bufptr)->rxsize = 0x21;
@@ -31,12 +31,14 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) {
} else {
bufptr += channel;
}
+
((__OSContRamHeader*)bufptr)->hi = addr >> 3; // send byte 1
((__OSContRamHeader*)bufptr)->lo = (s8)(__osContAddressCrc(addr) | (addr << 5)); // send byte 2
- __osSiRawStartDma(OS_WRITE, &pifMempakBuf);
+ __osSiRawStartDma(OS_WRITE, &gPifMempakBuf);
osRecvMesg(ctrlrqueue, NULL, OS_MESG_BLOCK);
- __osSiRawStartDma(OS_READ, &pifMempakBuf);
+ __osSiRawStartDma(OS_READ, &gPifMempakBuf);
osRecvMesg(ctrlrqueue, NULL, OS_MESG_BLOCK);
+
ret = (((__OSContRamHeader*)bufptr)->rxsize & 0xC0) >> 4;
if (!ret) {
if (((__OSContRamHeader*)bufptr)->datacrc != __osContDataCrc(bufptr + 6)) {
@@ -56,5 +58,6 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) {
}
} while (0 <= retryCount--);
__osSiRelAccess();
+
return ret;
}