diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2021-12-01 00:08:57 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-30 19:08:57 -0500 |
| commit | f1d183d6feac23275306bfa2dee939d123702765 (patch) | |
| tree | c20585c17dea94561f7c4cfcff572e39bc033a3e /src/libultra_code_O2/__osContRamRead.c | |
| parent | eabc91881761a82856cca3fab9a4749c60ea1fe7 (diff) | |
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>
Diffstat (limited to 'src/libultra_code_O2/__osContRamRead.c')
| -rw-r--r-- | src/libultra_code_O2/__osContRamRead.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/libultra_code_O2/__osContRamRead.c b/src/libultra_code_O2/__osContRamRead.c deleted file mode 100644 index 97d5db651..000000000 --- a/src/libultra_code_O2/__osContRamRead.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "global.h" - -#define BLOCKSIZE 32 - -s32 __osPfsLastChannel = -1; - -s32 __osContRamRead(OSMesgQueue* ctrlrqueue, s32 channel, u16 addr, u8* data) { - s32 ret; - s32 i; - u8* bufptr; - s32 retryCount = 2; - - __osSiGetAccess(); - do { - 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 - gPifMempakBuf.status = 1; - ((__OSContRamHeader*)bufptr)->unk_00 = 0xFF; - ((__OSContRamHeader*)bufptr)->txsize = 3; - ((__OSContRamHeader*)bufptr)->rxsize = 0x21; - ((__OSContRamHeader*)bufptr)->poll = CONT_CMD_READ_MEMPACK; // read mempak; send byte 0 - ((__OSContRamHeader*)bufptr)->datacrc = 0xFF; // read mempak; send byte 0 - // Received bytes are 6-26 inclusive - bufptr[sizeof(__OSContRamHeader)] = CONT_CMD_END; // End of commands - } 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, &gPifMempakBuf); - osRecvMesg(ctrlrqueue, NULL, OS_MESG_BLOCK); - __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)) { - ret = __osPfsGetStatus(ctrlrqueue, channel); - if (ret) { - break; - } - ret = 4; // Retry - } else { - bcopy(bufptr + 6, data, BLOCKSIZE); - } - } else { - ret = 1; // Error - } - if (ret != 4) { - break; - } - } while (0 <= retryCount--); - __osSiRelAccess(); - - return ret; -} |
