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/osContInit.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/osContInit.c')
| -rw-r--r-- | src/libultra_code_O2/osContInit.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/libultra_code_O2/osContInit.c b/src/libultra_code_O2/osContInit.c deleted file mode 100644 index 5b44e0112..000000000 --- a/src/libultra_code_O2/osContInit.c +++ /dev/null @@ -1,94 +0,0 @@ -#include "global.h" - -OSPifRam __osPifInternalBuff; -u8 __osContLastPoll; -u8 __osMaxControllers; // always 4 - -OSTimer __osEepromTimer; -OSMesgQueue __osEepromTimerMsgQ; -OSMesg __osEepromTimerMsg; - -u32 gOSContInitialized = 0; - -#define HALF_SECOND OS_USEC_TO_CYCLES(500000) - -s32 osContInit(OSMesgQueue* mq, u8* ctlBitfield, OSContStatus* status) { - OSMesg mesg; - s32 ret = 0; - OSTime currentTime; - OSTimer timer; - OSMesgQueue timerqueue; - - if (gOSContInitialized) { - return 0; - } - - gOSContInitialized = 1; - currentTime = osGetTime(); - if (HALF_SECOND > currentTime) { - osCreateMesgQueue(&timerqueue, &mesg, 1); - osSetTimer(&timer, HALF_SECOND - currentTime, 0, &timerqueue, &mesg); - osRecvMesg(&timerqueue, &mesg, OS_MESG_BLOCK); - } - __osMaxControllers = MAXCONTROLLERS; - __osPackRequestData(CONT_CMD_REQUEST_STATUS); - ret = __osSiRawStartDma(OS_WRITE, &__osPifInternalBuff); - osRecvMesg(mq, &mesg, OS_MESG_BLOCK); - ret = __osSiRawStartDma(OS_READ, &__osPifInternalBuff); - osRecvMesg(mq, &mesg, OS_MESG_BLOCK); - __osContGetInitData(ctlBitfield, status); - __osContLastPoll = CONT_CMD_REQUEST_STATUS; - __osSiCreateAccessQueue(); - osCreateMesgQueue(&__osEepromTimerMsgQ, &__osEepromTimerMsg, 1); - - return ret; -} - -void __osContGetInitData(u8* ctlBitfield, OSContStatus* status) { - u8* bufptr; - __OSContRequestHeader req; - s32 i; - u8 bitfieldTemp = 0; - - bufptr = (u8*)(&__osPifInternalBuff); - - for (i = 0; i < __osMaxControllers; i++, bufptr += sizeof(req), status++) { - req = *((__OSContRequestHeader*)bufptr); - status->errno = (req.rxsize & 0xC0) >> 4; - if (status->errno) { - continue; - } - status->type = req.typel << 8 | req.typeh; - status->status = req.status; - bitfieldTemp |= 1 << i; - } - *ctlBitfield = bitfieldTemp; -} - -void __osPackRequestData(u8 poll) { - u8* bufptr; - __OSContRequestHeader req; - s32 i; - - for (i = 0; i < 0xF; i++) { - __osPifInternalBuff.ram[i] = 0; - } - __osPifInternalBuff.status = 1; - - bufptr = (u8*)(&__osPifInternalBuff); - - req.align = 0xFF; - req.txsize = 1; - req.rxsize = 3; - req.poll = poll; - req.typeh = 0xFF; - req.typel = 0xFF; - req.status = 0xFF; - req.align1 = 0xFF; - - for (i = 0; i < __osMaxControllers; i++) { - *((__OSContRequestHeader*)bufptr) = req; - bufptr += sizeof(req); - } - *((u8*)bufptr) = 254; -} |
