Fix files with now new line at end to resolve some warnings, and also minor style guide cleanup as well

This commit is contained in:
Ryan Myers
2021-09-22 08:12:12 -04:00
parent 1c6382654f
commit fdd8d104dc
17 changed files with 81 additions and 126 deletions
+2 -3
View File
@@ -7,8 +7,7 @@
extern OSThread *__osActiveQueue; //__osActiveQueue;
void __osCleanupThread(void); //__osCleanupThread
void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p)
{
void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p) {
register u32 saveMask;
OSIntMask mask;
t->id = id;
@@ -30,4 +29,4 @@ void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void
t->tlnext = __osActiveQueue;
__osActiveQueue = t;
__osRestoreInt(saveMask);
}
}
+2 -3
View File
@@ -4,9 +4,8 @@
#include "libultra_internal.h"
extern OSThread *__osRunningThread;
OSPri osGetThreadPri(OSThread *thread)
{
OSPri osGetThreadPri(OSThread *thread) {
if (thread == NULL)
thread = __osRunningThread;
return thread->priority;
}
}
+1 -1
View File
@@ -18,4 +18,4 @@ OSTime osGetTime()
currentCount = __osCurrentTime;
__osRestoreInt(saveMask);
return currentCount + elapseCount;
}
}
+6 -11
View File
@@ -6,18 +6,14 @@
extern OSThread *__osRunningThread;
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
{
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) {
register u32 saveMask = __osDisableInt();
while (mq->validCount >= mq->msgCount)
{
if (flag == OS_MESG_BLOCK)
{
while (mq->validCount >= mq->msgCount) {
if (flag == OS_MESG_BLOCK) {
__osRunningThread->state = OS_STATE_WAITING;
__osEnqueueAndYield(&mq->fullqueue);
}
else
{
else {
__osRestoreInt(saveMask);
return -1;
}
@@ -26,10 +22,9 @@ s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
mq->first = (mq->first + mq->msgCount - 1) % mq->msgCount;
mq->msg[mq->first] = msg;
mq->validCount++;
if (mq->mtqueue->next != NULL)
{
if (mq->mtqueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtqueue));
}
__osRestoreInt(saveMask);
return 0;
}
}
+4 -7
View File
@@ -4,8 +4,7 @@
#include "libultra_internal.h"
#include "controller.h"
s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used)
{
s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used) {
int j;
int pages;
__OSInode inode;
@@ -16,19 +15,17 @@ s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used)
ret = 0;
PFS_CHECK_STATUS;
PFS_CHECK_ID;
for (bank = 0; bank < pfs->banks; bank++)
{
for (bank = 0; bank < pfs->banks; bank++) {
ERRCK(__osPfsRWInode(pfs, &inode, OS_READ, bank));
if (bank > 0)
offset = 1;
else
offset = pfs->inodeStartPage;
for (j = offset; j < ARRLEN(inode.inodePage); j++)
{
for (j = offset; j < ARRLEN(inode.inodePage); j++) {
if (inode.inodePage[j].ipage == 3)
pages++;
}
}
*bytes_not_used = pages * 8 * 32;
return 0;
}
}
+2 -3
View File
@@ -5,9 +5,8 @@
extern OSDevMgr __osPiDevMgr;
OSMesgQueue *osPiGetCmdQueue(void)
{
OSMesgQueue *osPiGetCmdQueue(void) {
if (!__osPiDevMgr.active)
return NULL;
return __osPiDevMgr.cmdQueue;
}
}
+2 -3
View File
@@ -5,8 +5,7 @@
extern OSDevMgr __osPiDevMgr; //__osPiDevMgr;
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *dramAddr, u32 size, OSMesgQueue *mq)
{
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *dramAddr, u32 size, OSMesgQueue *mq) {
register s32 ret;
if (!__osPiDevMgr.active)
return -1;
@@ -29,4 +28,4 @@ s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *d
ret = osSendMesg(osPiGetCmdQueue(), (OSMesg)mb, OS_MESG_NOBLOCK);
}
return ret;
}
}
+6 -11
View File
@@ -7,15 +7,12 @@
extern OSThread *__osRunningThread;
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags)
{
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags) {
register u32 saveMask;
saveMask = __osDisableInt();
while (MQ_IS_EMPTY(mq))
{
if (flags == OS_MESG_NOBLOCK)
{
while (MQ_IS_EMPTY(mq)) {
if (flags == OS_MESG_NOBLOCK) {
__osRestoreInt(saveMask);
return -1;
}
@@ -23,16 +20,14 @@ s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags)
__osEnqueueAndYield(&mq->mtqueue);
}
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(saveMask);
return 0;
}
}
+6 -11
View File
@@ -4,20 +4,16 @@
extern OSThread *__osRunningThread;
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags)
{
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags) {
register u32 saveMask;
register s32 last;
saveMask = __osDisableInt();
while (MQ_IS_FULL(mq))
{
if (flags == OS_MESG_BLOCK)
{
while (MQ_IS_FULL(mq)) {
if (flags == OS_MESG_BLOCK) {
__osRunningThread->state = OS_STATE_WAITING;
__osEnqueueAndYield(&mq->fullqueue);
}
else
{
else {
__osRestoreInt(saveMask);
return -1;
}
@@ -25,10 +21,9 @@ s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags)
last = (mq->first + mq->validCount) % mq->msgCount;
mq->msg[last] = msg;
mq->validCount++;
if (mq->mtqueue->next != NULL)
{
if (mq->mtqueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtqueue));
}
__osRestoreInt(saveMask);
return 0;
}
}
+3 -6
View File
@@ -3,16 +3,13 @@
#include "libultra_internal.h"
typedef struct __OSEventState
{
typedef struct __OSEventState {
OSMesgQueue *messageQueue;
OSMesg message;
} __OSEventState;
__OSEventState __osEventStateTab[15]; // __osEventStateTab[OS_NUM_EVENTS];
void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg)
{
void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg) {
register u32 saveMask = __osDisableInt();
__OSEventState *es;
@@ -20,4 +17,4 @@ void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg)
es->messageQueue = mq;
es->message = msg;
__osRestoreInt(saveMask);
}
}
+2 -2
View File
@@ -5,6 +5,6 @@
extern OSTime __osCurrentTime;
void osSetTime(OSTime time){
void osSetTime(OSTime time) {
__osCurrentTime = time;
}
}
+1 -2
View File
@@ -10,8 +10,7 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osSetTimer.s")
extern OSTimer *D_800E4910;
u32 osSetTimer(OSTimer *t, OSTime value, OSTime interval, OSMesgQueue *mq, OSMesg msg)
{
u32 osSetTimer(OSTimer *t, OSTime value, OSTime interval, OSMesgQueue *mq, OSMesg msg) {
OSTime time;
t->next = NULL;
t->prev = NULL;
+18 -24
View File
@@ -9,37 +9,31 @@ extern OSThread *__RunQueue; //__osRunQueue
void osStartThread(OSThread *t)
{
register u32 saveMask = __osDisableInt();
switch (t->state)
{
case OS_STATE_WAITING:
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__RunQueue, t);
break;
case OS_STATE_STOPPED:
if (t->queue == NULL || t->queue == &__RunQueue)
{
switch (t->state) {
case OS_STATE_WAITING:
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__RunQueue, t);
}
else
{
t->state = OS_STATE_WAITING;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__RunQueue, __osPopThread(t->queue));
}
break;
break;
case OS_STATE_STOPPED:
if (t->queue == NULL || t->queue == &__RunQueue) {
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__RunQueue, t);
}
else {
t->state = OS_STATE_WAITING;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__RunQueue, __osPopThread(t->queue));
}
break;
}
if (__osRunningThread == NULL)
{
if (__osRunningThread == NULL) {
__osDispatchThread();
}
else
{
if (__osRunningThread->priority < __RunQueue->priority)
{
else {
if (__osRunningThread->priority < __RunQueue->priority) {
__osRunningThread->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&__RunQueue);
}
}
__osRestoreInt(saveMask);
}
}
+14 -18
View File
@@ -5,29 +5,25 @@
extern OSThread *__osRunningThread;
void osStopThread(OSThread *t)
{
void osStopThread(OSThread *t) {
register u32 saveMask = __osDisableInt();
register u16 state;
if (t == NULL)
{
if (t == NULL) {
state = OS_STATE_RUNNING;
}
else
{
else {
state = t->state;
}
switch (state)
{
case OS_STATE_RUNNING:
__osRunningThread->state = OS_STATE_STOPPED;
__osEnqueueAndYield(NULL);
break;
case OS_STATE_RUNNABLE:
case OS_STATE_WAITING:
t->state = OS_STATE_STOPPED;
__osDequeueThread(t->queue, t);
break;
switch (state) {
case OS_STATE_RUNNING:
__osRunningThread->state = OS_STATE_STOPPED;
__osEnqueueAndYield(NULL);
break;
case OS_STATE_RUNNABLE:
case OS_STATE_WAITING:
t->state = OS_STATE_STOPPED;
__osDequeueThread(t->queue, t);
break;
}
__osRestoreInt(saveMask);
}
}
+7 -12
View File
@@ -33,15 +33,14 @@ void __osTimerServicesInit(void)
}
#endif
void __osTimerInterrupt(void)
{
void __osTimerInterrupt(void) {
OSTimer *t;
u32 count;
u32 elapsed_cycles;
if (D_800E4910->next == D_800E4910)
return;
while (1){
while (1) {
t = D_800E4910->next;
if (t == D_800E4910){
__osSetCompare(0);
@@ -55,8 +54,7 @@ void __osTimerInterrupt(void)
t->remaining -= elapsed_cycles;
__osSetTimerIntr(t->remaining);
return;
}
else{
} else {
t->prev->next = t->next;
t->next->prev = t->prev;
t->next = NULL;
@@ -75,8 +73,7 @@ void __osTimerInterrupt(void)
#if 1
GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetTimerIntr.s")
#else
void __osSetTimerIntr(OSTime tim)
{
void __osSetTimerIntr(OSTime tim) {
OSTime NewTime;
u32 savedMask;
savedMask = __osDisableInt();
@@ -88,16 +85,14 @@ void __osSetTimerIntr(OSTime tim)
#endif
OSTime __osInsertTimer(OSTimer *t)
{
OSTime __osInsertTimer(OSTimer *t) {
OSTimer *timep;
OSTime tim;
u32 savedMask;
savedMask = __osDisableInt();
for (timep = D_800E4910->next, tim = t->remaining;
timep != D_800E4910 && tim > timep->remaining;
tim -= timep->remaining, timep = timep->next)
{
tim -= timep->remaining, timep = timep->next) {
;
}
t->remaining = tim;
@@ -109,4 +104,4 @@ OSTime __osInsertTimer(OSTimer *t)
timep->prev = t;
__osRestoreInt(savedMask);
return tim;
}
}
+4 -8
View File
@@ -25,13 +25,11 @@ extern OSIoMesg viCounterMsg; //viCounterMsg
void viMgrMain(void *arg);
void osCreateViManager(OSPri pri)
{
void osCreateViManager(OSPri pri) {
u32 savedMask;
OSPri oldPri;
OSPri myPri;
if (__osViDevMgr.active == 0)
{
if (__osViDevMgr.active == 0) {
__osTimerServicesInit();
osCreateMesgQueue(&viEventQueue, viEventBuf, 5);
viRetraceMsg.hdr.type = OS_MESG_TYPE_VRETRACE;
@@ -44,8 +42,7 @@ void osCreateViManager(OSPri pri)
osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg);
oldPri = -1;
myPri = osGetThreadPri(NULL);
if (myPri < pri)
{
if (myPri < pri) {
oldPri = myPri;
osSetThreadPri(NULL, pri);
}
@@ -61,8 +58,7 @@ void osCreateViManager(OSPri pri)
__osViInit();
osStartThread(&viThread);
__osRestoreInt(savedMask);
if (oldPri != -1)
{
if (oldPri != -1) {
osSetThreadPri(0, oldPri);
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
extern OSViContext *__osViNext;
void osViSwapBuffer(void *frameBufPtr){
void osViSwapBuffer(void *frameBufPtr) {
u32 saveMask = __osDisableInt();
__osViNext->buffer = frameBufPtr;
__osViNext->unk00 |= 0x10;