diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2021-02-14 00:49:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-13 19:49:40 -0500 |
| commit | f9d96d9f73ac090245a518ec04f3fa0e50655d1e (patch) | |
| tree | 9dc905fce276cbfb07a05fc2bf0883bcedddcf23 /src/libultra_code_O2/osReadMempak.c | |
| parent | d615ec4f31563b939f8c0dce1c20c79e137c2043 (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/osReadMempak.c')
| -rw-r--r-- | src/libultra_code_O2/osReadMempak.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libultra_code_O2/osReadMempak.c b/src/libultra_code_O2/osReadMempak.c index 07c72e54b..bcbca66ab 100644 --- a/src/libultra_code_O2/osReadMempak.c +++ b/src/libultra_code_O2/osReadMempak.c @@ -11,8 +11,10 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) { s32 retryCount = 2; __osSiGetAccess(); + do { - bufptr = &pifMempakBuf; + bufptr = (u8*)&gPifMempakBuf; + if ((__osContLastPoll != 2) || (__osPfsLastChannel != channel)) { __osContLastPoll = 2; @@ -20,7 +22,7 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) { // 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 +33,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)) { @@ -55,6 +59,8 @@ s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) { break; } } while (0 <= retryCount--); + __osSiRelAccess(); + return ret; } |
