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/__osContRamWrite.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/__osContRamWrite.c')
| -rw-r--r-- | src/libultra_code_O2/__osContRamWrite.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/libultra_code_O2/__osContRamWrite.c b/src/libultra_code_O2/__osContRamWrite.c deleted file mode 100644 index e27c03227..000000000 --- a/src/libultra_code_O2/__osContRamWrite.c +++ /dev/null @@ -1,68 +0,0 @@ -#include "ultra64.h" -#include "global.h" - -s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force) { - s32 ret = 0; - s32 i; - u8* ptr; - s32 retry = 2; - u8 crc; - - if ((force != PFS_FORCE) && (address < PFS_LABEL_AREA) && (address != 0)) { - return 0; - } - - __osSiGetAccess(); - - do { - ptr = (u8*)(&gPifMempakBuf); - - if (__osContLastPoll != CONT_CMD_WRITE_MEMPACK || __osPfsLastChannel != channel) { - __osContLastPoll = CONT_CMD_WRITE_MEMPACK; - __osPfsLastChannel = channel; - - // clang-format off - for (i = 0; i < channel; i++) { *ptr++ = 0; } - // clang-format on - - gPifMempakBuf.status = 1; - - ((__OSContRamHeader*)ptr)->unk_00 = 0xFF; - ((__OSContRamHeader*)ptr)->txsize = 35; - ((__OSContRamHeader*)ptr)->rxsize = 1; - ((__OSContRamHeader*)ptr)->poll = CONT_CMD_WRITE_MEMPACK; - ((__OSContRamHeader*)ptr)->datacrc = 0xFF; - - ptr[sizeof(__OSContRamHeader)] = CONT_CMD_END; - } else { - ptr += channel; - } - ((__OSContRamHeader*)ptr)->hi = address >> 3; - ((__OSContRamHeader*)ptr)->lo = ((address << 5) | __osContAddressCrc(address)); - - bcopy(buffer, ((__OSContRamHeader*)ptr)->data, BLOCKSIZE); - - ret = __osSiRawStartDma(OS_WRITE, &gPifMempakBuf); - crc = __osContDataCrc(buffer); - osRecvMesg(mq, (OSMesg*)NULL, OS_MESG_BLOCK); - - ret = __osSiRawStartDma(OS_READ, &gPifMempakBuf); - osRecvMesg(mq, (OSMesg*)NULL, OS_MESG_BLOCK); - - ret = ((((__OSContRamHeader*)ptr)->rxsize & 0xC0) >> 4); - if (!ret) { - if (crc != ((__OSContRamHeader*)ptr)->datacrc) { - if ((ret = __osPfsGetStatus(mq, channel))) { - break; - } else { - ret = PFS_ERR_CONTRFAIL; - } - } - } else { - ret = PFS_ERR_NOPACK; - } - } while ((ret == PFS_ERR_CONTRFAIL) && (retry-- >= 0)); - __osSiRelAccess(); - - return ret; -} |
