mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
Format all src C files
This commit is contained in:
parent
251aea64ab
commit
8cfe7cce9f
652 changed files with 12488 additions and 19093 deletions
|
@ -1,19 +1,16 @@
|
|||
#include <global.h>
|
||||
|
||||
void __osDequeueThread(OSThread **queue, OSThread *thread)
|
||||
{
|
||||
register OSThread **a2;
|
||||
register OSThread *a3;
|
||||
void __osDequeueThread(OSThread** queue, OSThread* thread) {
|
||||
register OSThread** a2;
|
||||
register OSThread* a3;
|
||||
a2 = queue;
|
||||
a3 = *a2;
|
||||
while (a3 != NULL)
|
||||
{
|
||||
if (a3 == thread)
|
||||
{
|
||||
while (a3 != NULL) {
|
||||
if (a3 == thread) {
|
||||
*a2 = thread->next;
|
||||
return;
|
||||
}
|
||||
a2 = &a3->next;
|
||||
a3 = *a2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg)
|
||||
{
|
||||
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg) {
|
||||
*outQueue = __osHwIntTable[idx].queue;
|
||||
*outMsg = __osHwIntTable[idx].msg;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#include <global.h>
|
||||
|
||||
void __osResetGlobalIntMask(u32 mask)
|
||||
{
|
||||
void __osResetGlobalIntMask(u32 mask) {
|
||||
register s32 prevInt;
|
||||
|
||||
prevInt = __osDisableInt();
|
||||
__OSGlobalIntMask &= ~(mask & ~0x401);
|
||||
__osRestoreInt(prevInt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#include <global.h>
|
||||
|
||||
void __osSetGlobalIntMask(u32 mask)
|
||||
{
|
||||
void __osSetGlobalIntMask(u32 mask) {
|
||||
register s32 prevInt;
|
||||
|
||||
prevInt = __osDisableInt();
|
||||
__OSGlobalIntMask |= mask;
|
||||
__osRestoreInt(prevInt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg)
|
||||
{
|
||||
void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg) {
|
||||
register int prevInt;
|
||||
|
||||
prevInt = __osDisableInt();
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include <global.h>
|
||||
#include <ultra64/hardware.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 ins_00; //lui k0, 0x8000
|
||||
u32 ins_04; //addiu k0, k0, 0x39e0
|
||||
u32 ins_08; //jr k0 ; __osException
|
||||
u32 ins_0C; //nop
|
||||
typedef struct {
|
||||
u32 ins_00; // lui k0, 0x8000
|
||||
u32 ins_04; // addiu k0, k0, 0x39e0
|
||||
u32 ins_08; // jr k0 ; __osException
|
||||
u32 ins_0C; // nop
|
||||
} struct_exceptionPreamble;
|
||||
|
||||
u64 osClockRate = 62500000;
|
||||
|
@ -16,14 +15,13 @@ u32 __OSGlobalIntMask = 0x003FFF01;
|
|||
|
||||
u32 D_800145C0;
|
||||
|
||||
void __createSpeedParam(void)
|
||||
{
|
||||
void __createSpeedParam(void) {
|
||||
__Dom1SpeedParam.type = DEVICE_TYPE_INIT;
|
||||
__Dom1SpeedParam.latency = HW_REG(PI_BSD_DOM1_LAT_REG, u32);
|
||||
__Dom1SpeedParam.pulse = HW_REG(PI_BSD_DOM1_PWD_REG, u32);
|
||||
__Dom1SpeedParam.pageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32);
|
||||
__Dom1SpeedParam.relDuration = HW_REG(PI_BSD_DOM1_RLS_REG, u32);
|
||||
|
||||
|
||||
__Dom2SpeedParam.type = DEVICE_TYPE_INIT;
|
||||
__Dom2SpeedParam.latency = HW_REG(PI_BSD_DOM2_LAT_REG, u32);
|
||||
__Dom2SpeedParam.pulse = HW_REG(PI_BSD_DOM2_PWD_REG, u32);
|
||||
|
@ -31,25 +29,26 @@ void __createSpeedParam(void)
|
|||
__Dom2SpeedParam.relDuration = HW_REG(PI_BSD_DOM2_RLS_REG, u32);
|
||||
}
|
||||
|
||||
void __osInitialize_common(void)
|
||||
{
|
||||
void __osInitialize_common(void) {
|
||||
u32 sp2C;
|
||||
|
||||
D_800145C0 = 1;
|
||||
__osSetSR(__osGetSR() | 0x20000000);
|
||||
__osSetFpcCsr(0x1000800);
|
||||
__osSetWatchLo(0x4900000);
|
||||
|
||||
while (__osSiRawReadIo((void*)0x1fc007fc, &sp2C))
|
||||
;
|
||||
|
||||
while (__osSiRawWriteIo((void*)0x1fc007fc, sp2C | 8))
|
||||
while (__osSiRawReadIo((void*)0x1fc007fc, &sp2C)) {
|
||||
;
|
||||
|
||||
*(struct_exceptionPreamble*)0x80000000 = *(struct_exceptionPreamble*)__osExceptionPreamble; //TLB miss
|
||||
*(struct_exceptionPreamble*)0x80000080 = *(struct_exceptionPreamble*)__osExceptionPreamble; //XTLB miss
|
||||
*(struct_exceptionPreamble*)0x80000100 = *(struct_exceptionPreamble*)__osExceptionPreamble; //cache errors
|
||||
*(struct_exceptionPreamble*)0x80000180 = *(struct_exceptionPreamble*)__osExceptionPreamble; //general exceptions
|
||||
}
|
||||
|
||||
while (__osSiRawWriteIo((void*)0x1fc007fc, sp2C | 8)) {
|
||||
;
|
||||
}
|
||||
|
||||
*(struct_exceptionPreamble*)0x80000000 = *(struct_exceptionPreamble*)__osExceptionPreamble; // TLB miss
|
||||
*(struct_exceptionPreamble*)0x80000080 = *(struct_exceptionPreamble*)__osExceptionPreamble; // XTLB miss
|
||||
*(struct_exceptionPreamble*)0x80000100 = *(struct_exceptionPreamble*)__osExceptionPreamble; // cache errors
|
||||
*(struct_exceptionPreamble*)0x80000180 = *(struct_exceptionPreamble*)__osExceptionPreamble; // general exceptions
|
||||
|
||||
osWritebackDCache(0x80000000, 0x190);
|
||||
osInvalICache(0x80000000, 0x190);
|
||||
|
@ -59,25 +58,28 @@ void __osInitialize_common(void)
|
|||
|
||||
osClockRate = (u64)((osClockRate * 3ll) / 4ull);
|
||||
|
||||
if (!osResetType)
|
||||
if (!osResetType) {
|
||||
bzero(osAppNmiBuffer, 0x40);
|
||||
}
|
||||
|
||||
if (osTvType == 0)
|
||||
if (osTvType == 0) {
|
||||
osViClock = VI_PAL_CLOCK;
|
||||
else if (osTvType == 2)
|
||||
} else if (osTvType == 2) {
|
||||
osViClock = VI_MPAL_CLOCK;
|
||||
else
|
||||
} else {
|
||||
osViClock = VI_NTSC_CLOCK;
|
||||
}
|
||||
|
||||
if (__osGetCause() & 0x1000)
|
||||
while (true)
|
||||
if (__osGetCause() & 0x1000) {
|
||||
while (true) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
HW_REG(AI_CONTROL_REG, u32) = 1;
|
||||
HW_REG(AI_DACRATE_REG, u32) = 0x3fff;
|
||||
HW_REG(AI_BITRATE_REG, u32) = 0xf;
|
||||
}
|
||||
|
||||
void __osInitialize_autodetect()
|
||||
{
|
||||
void __osInitialize_autodetect() {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count)
|
||||
{
|
||||
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count) {
|
||||
mq->mtqueue = __osThreadTail;
|
||||
mq->fullqueue = __osThreadTail;
|
||||
mq->validCount = 0;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include <global.h>
|
||||
|
||||
OSThread* __osThreadTail[2] = { NULL, (OSThread*)-1 };
|
||||
OSThread *__osRunQueue = __osThreadTail;
|
||||
OSThread *__osActiveQueue = __osThreadTail;
|
||||
OSThread *__osRunningThread = NULL;
|
||||
OSThread* __osRunQueue = __osThreadTail;
|
||||
OSThread* __osActiveQueue = __osThreadTail;
|
||||
OSThread* __osRunningThread = NULL;
|
||||
OSThread* __osFaultedThread = NULL;
|
||||
|
||||
void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri)
|
||||
{
|
||||
void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) {
|
||||
register u32 s0;
|
||||
u32 t8;
|
||||
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
#include <global.h>
|
||||
|
||||
void osDestroyThread(OSThread *thread)
|
||||
{
|
||||
void osDestroyThread(OSThread* thread) {
|
||||
register s32 int_disabled;
|
||||
|
||||
register OSThread *s1;
|
||||
register OSThread *s2;
|
||||
|
||||
register OSThread* s1;
|
||||
register OSThread* s2;
|
||||
|
||||
int_disabled = __osDisableInt();
|
||||
|
||||
if (thread == NULL)
|
||||
if (thread == NULL) {
|
||||
thread = __osRunningThread;
|
||||
|
||||
else if (thread->state != OS_STATE_STOPPED)
|
||||
} else if (thread->state != OS_STATE_STOPPED) {
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
}
|
||||
|
||||
if (__osActiveQueue == thread)
|
||||
if (__osActiveQueue == thread) {
|
||||
__osActiveQueue = __osActiveQueue->tlnext;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
s1 = __osActiveQueue;
|
||||
while (s1->priority != -1)
|
||||
{
|
||||
while (s1->priority != -1) {
|
||||
s2 = s1->tlnext;
|
||||
if (s2 == thread)
|
||||
{
|
||||
if (s2 == thread) {
|
||||
s1->tlnext = thread->tlnext;
|
||||
break;
|
||||
}
|
||||
|
@ -32,8 +29,9 @@ void osDestroyThread(OSThread *thread)
|
|||
}
|
||||
}
|
||||
|
||||
if (thread == __osRunningThread)
|
||||
if (thread == __osRunningThread) {
|
||||
__osDispatchThread();
|
||||
}
|
||||
|
||||
__osRestoreInt(int_disabled);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
#define STEP 0x100000
|
||||
|
||||
u32 osGetMemSize(void)
|
||||
{
|
||||
u32 osGetMemSize(void) {
|
||||
u32* ptr;
|
||||
u32 size;
|
||||
u32 data0;
|
||||
|
@ -11,21 +10,21 @@ u32 osGetMemSize(void)
|
|||
|
||||
size = 0x400000;
|
||||
|
||||
while(size < 0x800000)
|
||||
{
|
||||
while (size < 0x800000) {
|
||||
ptr = (u32*)(0xA0000000 + size);
|
||||
|
||||
data0 = *ptr;
|
||||
data1 = ptr[STEP/4-1];
|
||||
data1 = ptr[STEP / 4 - 1];
|
||||
|
||||
*ptr ^= ~0;
|
||||
ptr[STEP/4-1] ^= ~0;
|
||||
ptr[STEP / 4 - 1] ^= ~0;
|
||||
|
||||
if ((*ptr != (data0 ^ ~0)) || (ptr[STEP/4-1] != (data1 ^ ~0)))
|
||||
if ((*ptr != (data0 ^ ~0)) || (ptr[STEP / 4 - 1] != (data1 ^ ~0))) {
|
||||
return size;
|
||||
}
|
||||
|
||||
*ptr = data0;
|
||||
ptr[STEP/4-1] = data1;
|
||||
ptr[STEP / 4 - 1] = data1;
|
||||
|
||||
size += STEP;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <global.h>
|
||||
|
||||
OSId osGetThreadId(OSThread* thread)
|
||||
{
|
||||
if (thread == NULL)
|
||||
OSId osGetThreadId(OSThread* thread) {
|
||||
if (thread == NULL) {
|
||||
thread = __osRunningThread;
|
||||
}
|
||||
|
||||
return thread->id;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <global.h>
|
||||
|
||||
OSPri osGetThreadPri(OSThread* thread)
|
||||
{
|
||||
if (thread == NULL)
|
||||
OSPri osGetThreadPri(OSThread* thread) {
|
||||
if (thread == NULL) {
|
||||
thread = __osRunningThread;
|
||||
}
|
||||
|
||||
return thread->priority;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
OSTime osGetTime(void)
|
||||
{
|
||||
OSTime osGetTime(void) {
|
||||
u32 sp34;
|
||||
u32 sp30;
|
||||
u64 t1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) {
|
||||
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
|
||||
register s32 int_disabled;
|
||||
int_disabled = __osDisableInt();
|
||||
while (mq->validCount >= mq->msgCount) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#include <global.h>
|
||||
|
||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag)
|
||||
{
|
||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) {
|
||||
register s32 s0 = __osDisableInt();
|
||||
|
||||
while (mq->validCount == 0)
|
||||
{
|
||||
if (flag == OS_MESG_NOBLOCK)
|
||||
{
|
||||
while (mq->validCount == 0) {
|
||||
if (flag == OS_MESG_NOBLOCK) {
|
||||
__osRestoreInt(s0);
|
||||
return -1;
|
||||
}
|
||||
|
@ -15,14 +12,16 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag)
|
|||
__osEnqueueAndYield(mq);
|
||||
}
|
||||
|
||||
if (msg != NULL)
|
||||
if (msg != NULL) {
|
||||
*msg = mq->msg[mq->first];
|
||||
}
|
||||
|
||||
mq->first = (mq->first + 1) % mq->msgCount;
|
||||
mq->validCount--;
|
||||
|
||||
if (mq->fullqueue->next != NULL)
|
||||
if (mq->fullqueue->next != NULL) {
|
||||
osStartThread(__osPopThread(&mq->fullqueue));
|
||||
}
|
||||
|
||||
__osRestoreInt(s0);
|
||||
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
#include <global.h>
|
||||
|
||||
s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag)
|
||||
{
|
||||
s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag) {
|
||||
register u32 s0 = __osDisableInt();
|
||||
register u32 index;
|
||||
|
||||
while (mq->validCount >= mq->msgCount)
|
||||
{
|
||||
if (flag == OS_MESG_BLOCK)
|
||||
{
|
||||
while (mq->validCount >= mq->msgCount) {
|
||||
if (flag == OS_MESG_BLOCK) {
|
||||
__osRunningThread->state = 8;
|
||||
__osEnqueueAndYield(&mq->fullqueue);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
__osRestoreInt(s0);
|
||||
return -1;
|
||||
}
|
||||
|
@ -23,8 +18,9 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag)
|
|||
mq->msg[index] = mesg;
|
||||
mq->validCount++;
|
||||
|
||||
if (mq->mtqueue->next != NULL)
|
||||
if (mq->mtqueue->next != NULL) {
|
||||
osStartThread(__osPopThread(&mq->mtqueue));
|
||||
}
|
||||
|
||||
__osRestoreInt(s0);
|
||||
|
||||
|
|
|
@ -4,23 +4,21 @@ __OSEventState __osEventStateTab[16];
|
|||
|
||||
u32 __osPreNMI = 0;
|
||||
|
||||
void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg msg)
|
||||
{
|
||||
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg) {
|
||||
register u32 int_disabled;
|
||||
__OSEventState *msgs;
|
||||
|
||||
__OSEventState* msgs;
|
||||
|
||||
int_disabled = __osDisableInt();
|
||||
msgs = __osEventStateTab + e;
|
||||
msgs->queue = mq;
|
||||
msgs->msg = msg;
|
||||
|
||||
if (e == OS_EVENT_PRENMI)
|
||||
{
|
||||
if (__osShutdown && !__osPreNMI)
|
||||
if (e == OS_EVENT_PRENMI) {
|
||||
if (__osShutdown && !__osPreNMI) {
|
||||
osSendMesg(mq, msg, 0);
|
||||
}
|
||||
|
||||
__osPreNMI = true;
|
||||
}
|
||||
__osRestoreInt(int_disabled);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
#include <global.h>
|
||||
|
||||
void osSetThreadPri(OSThread* thread, OSPri pri)
|
||||
{
|
||||
void osSetThreadPri(OSThread* thread, OSPri pri) {
|
||||
register u32 s0 = __osDisableInt();
|
||||
|
||||
if (thread == NULL)
|
||||
if (thread == NULL) {
|
||||
thread = __osRunningThread;
|
||||
}
|
||||
|
||||
if (thread->priority != pri)
|
||||
{
|
||||
if (thread->priority != pri) {
|
||||
thread->priority = pri;
|
||||
if (thread != __osRunningThread && thread->state != 1)
|
||||
{
|
||||
if (thread != __osRunningThread && thread->state != 1) {
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
__osEnqueueThread(thread->queue, thread);
|
||||
}
|
||||
if (__osRunningThread->priority < __osRunQueue->priority)
|
||||
{
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
__osRunningThread->state = 2;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
}
|
||||
|
|
|
@ -1,38 +1,29 @@
|
|||
#include <global.h>
|
||||
|
||||
void osStartThread(OSThread* thread)
|
||||
{
|
||||
void osStartThread(OSThread* thread) {
|
||||
register u32 s0 = __osDisableInt();
|
||||
|
||||
switch (thread->state)
|
||||
{
|
||||
case 8:
|
||||
thread->state = 2;
|
||||
__osEnqueueThread(&__osRunQueue, thread);
|
||||
break;
|
||||
case 1:
|
||||
if (thread->queue == NULL || thread->queue == &__osRunQueue)
|
||||
{
|
||||
switch (thread->state) {
|
||||
case 8:
|
||||
thread->state = 2;
|
||||
__osEnqueueThread(&__osRunQueue, thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
thread->state = 8;
|
||||
__osEnqueueThread(thread->queue, thread);
|
||||
__osEnqueueThread(&__osRunQueue, __osPopThread(thread->queue));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
if (thread->queue == NULL || thread->queue == &__osRunQueue) {
|
||||
thread->state = 2;
|
||||
__osEnqueueThread(&__osRunQueue, thread);
|
||||
} else {
|
||||
thread->state = 8;
|
||||
__osEnqueueThread(thread->queue, thread);
|
||||
__osEnqueueThread(&__osRunQueue, __osPopThread(thread->queue));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (__osRunningThread == NULL)
|
||||
{
|
||||
if (__osRunningThread == NULL) {
|
||||
__osDispatchThread();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__osRunningThread->priority < __osRunQueue->priority)
|
||||
{
|
||||
} else {
|
||||
if (__osRunningThread->priority < __osRunQueue->priority) {
|
||||
__osRunningThread->state = 2;
|
||||
__osEnqueueAndYield(&__osRunQueue);
|
||||
}
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
#include <global.h>
|
||||
|
||||
void osStopThread(OSThread* thread)
|
||||
{
|
||||
void osStopThread(OSThread* thread) {
|
||||
register u32 s0 = __osDisableInt();
|
||||
register u32 state;
|
||||
|
||||
if (thread == NULL)
|
||||
if (thread == NULL) {
|
||||
state = 4;
|
||||
else
|
||||
} else {
|
||||
state = thread->state;
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 4:
|
||||
__osRunningThread->state = 1;
|
||||
__osEnqueueAndYield(NULL);
|
||||
break;
|
||||
case 2:
|
||||
case 8:
|
||||
thread->state = 1;
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
break;
|
||||
switch (state) {
|
||||
case 4:
|
||||
__osRunningThread->state = 1;
|
||||
__osEnqueueAndYield(NULL);
|
||||
break;
|
||||
case 2:
|
||||
case 8:
|
||||
thread->state = 1;
|
||||
__osDequeueThread(thread->queue, thread);
|
||||
break;
|
||||
}
|
||||
|
||||
__osRestoreInt(s0);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <global.h>
|
||||
|
||||
void osViExtendVStart(u32 arg0)
|
||||
{
|
||||
void osViExtendVStart(u32 arg0) {
|
||||
__additional_scanline = arg0;
|
||||
}
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
#include <global.h>
|
||||
|
||||
OSViMode osViModePalLan1 =
|
||||
{
|
||||
0x10, //type
|
||||
{ //comRegs
|
||||
0x311E, //ctrl
|
||||
0x140, //width
|
||||
0x4541E3A, //burst
|
||||
0x271, //vSync
|
||||
0x170C69, //hSync
|
||||
0xC6F0C6D, //leap
|
||||
0x800300, //hStart
|
||||
0x200, //xScale
|
||||
0 //vCurrent
|
||||
OSViMode osViModePalLan1 = {
|
||||
0x10, // type
|
||||
{
|
||||
// comRegs
|
||||
0x311E, // ctrl
|
||||
0x140, // width
|
||||
0x4541E3A, // burst
|
||||
0x271, // vSync
|
||||
0x170C69, // hSync
|
||||
0xC6F0C6D, // leap
|
||||
0x800300, // hStart
|
||||
0x200, // xScale
|
||||
0 // vCurrent
|
||||
},
|
||||
{ //fldRegs
|
||||
{
|
||||
0x280, //origin
|
||||
0x400, //yScale
|
||||
0x5F0239, //vStart
|
||||
0x9026B, //vBurst
|
||||
2, //vIntr
|
||||
},
|
||||
{
|
||||
0x280, //origin
|
||||
0x400, //yScale
|
||||
0x5F0239, //vStart
|
||||
0x9026B, //vBurst
|
||||
2 //vIntr
|
||||
}
|
||||
}
|
||||
{ // fldRegs
|
||||
{
|
||||
0x280, // origin
|
||||
0x400, // yScale
|
||||
0x5F0239, // vStart
|
||||
0x9026B, // vBurst
|
||||
2, // vIntr
|
||||
},
|
||||
{
|
||||
0x280, // origin
|
||||
0x400, // yScale
|
||||
0x5F0239, // vStart
|
||||
0x9026B, // vBurst
|
||||
2 // vIntr
|
||||
} },
|
||||
};
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include <global.h>
|
||||
|
||||
u32 osVirtualToPhysical(void* vaddr)
|
||||
{
|
||||
if ((u32)vaddr >= 0x80000000 && (u32)vaddr < 0xA0000000)
|
||||
u32 osVirtualToPhysical(void* vaddr) {
|
||||
if ((u32)vaddr >= 0x80000000 && (u32)vaddr < 0xA0000000) {
|
||||
return (u32)vaddr & 0x1FFFFFFF;
|
||||
}
|
||||
|
||||
if ((u32)vaddr >= 0xA0000000 && (u32)vaddr < 0xC0000000)
|
||||
if ((u32)vaddr >= 0xA0000000 && (u32)vaddr < 0xC0000000) {
|
||||
return (u32)vaddr & 0x1FFFFFFF;
|
||||
}
|
||||
|
||||
return __osProbeTLB(vaddr);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <global.h>
|
||||
|
||||
void osYieldThread()
|
||||
{
|
||||
void osYieldThread() {
|
||||
register u32 prevInt;
|
||||
|
||||
prevInt = __osDisableInt();
|
||||
|
|
|
@ -5,24 +5,22 @@ u32 __osPiAccessQueueEnabled = 0;
|
|||
OSMesg piAccessBuf;
|
||||
OSMesgQueue __osPiAccessQueue;
|
||||
|
||||
void __osPiCreateAccessQueue(void)
|
||||
{
|
||||
void __osPiCreateAccessQueue(void) {
|
||||
__osPiAccessQueueEnabled = 1;
|
||||
osCreateMesgQueue(&__osPiAccessQueue, &piAccessBuf, 1);
|
||||
osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
void __osPiGetAccess(void)
|
||||
{
|
||||
void __osPiGetAccess(void) {
|
||||
OSMesg mesg;
|
||||
|
||||
if (!__osPiAccessQueueEnabled)
|
||||
if (!__osPiAccessQueueEnabled) {
|
||||
__osPiCreateAccessQueue();
|
||||
}
|
||||
|
||||
osRecvMesg(&__osPiAccessQueue, &mesg, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
void __osPiRelAccess(void)
|
||||
{
|
||||
void __osPiRelAccess(void) {
|
||||
osSendMesg(&__osPiAccessQueue, 0, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ u32 __osViIntrCount;
|
|||
u32 __osTimerCounter;
|
||||
OSTimer* __osTimerList = &__osBaseTimer;
|
||||
|
||||
void __osTimerServicesInit()
|
||||
{
|
||||
void __osTimerServicesInit() {
|
||||
__osCurrentTime = 0;
|
||||
__osBaseCounter = 0;
|
||||
__osViIntrCount = 0;
|
||||
|
@ -20,9 +19,8 @@ void __osTimerServicesInit()
|
|||
__osTimerList->msg = NULL;
|
||||
}
|
||||
|
||||
void __osTimerInterrupt()
|
||||
{
|
||||
OSTimer *sp24;
|
||||
void __osTimerInterrupt() {
|
||||
OSTimer* sp24;
|
||||
u32 sp20;
|
||||
u32 sp1c;
|
||||
if (__osTimerList->next == __osTimerList) {
|
||||
|
@ -58,13 +56,13 @@ void __osTimerInterrupt()
|
|||
}
|
||||
}
|
||||
|
||||
void __osSetTimerIntr(OSTime tim)
|
||||
{
|
||||
void __osSetTimerIntr(OSTime tim) {
|
||||
OSTime NewTime;
|
||||
u32 savedMask;
|
||||
|
||||
if (tim < 468)
|
||||
if (tim < 468) {
|
||||
tim = 468;
|
||||
}
|
||||
|
||||
savedMask = __osDisableInt();
|
||||
|
||||
|
@ -74,9 +72,8 @@ void __osSetTimerIntr(OSTime tim)
|
|||
__osRestoreInt(savedMask);
|
||||
}
|
||||
|
||||
OSTime __osInsertTimer(OSTimer *a0)
|
||||
{
|
||||
OSTimer *sp34;
|
||||
OSTime __osInsertTimer(OSTimer* a0) {
|
||||
OSTimer* sp34;
|
||||
u64 sp28;
|
||||
s32 intDisabled;
|
||||
intDisabled = __osDisableInt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue