mirror of
https://github.com/pret/pokediamond.git
synced 2026-09-30 12:26:48 -05:00
Merge pull request #502 from red031000/master
kill THUMB_FUNC and ARM_FUNC + scrcmd
This commit is contained in:
@@ -1274,8 +1274,8 @@ _038073E0: .word 0x0380FFFC
|
||||
_038073E4: .word 0x04000180
|
||||
_038073E8: .word 0x027FFE00
|
||||
|
||||
arm_func_start FUN_038073EC
|
||||
FUN_038073EC: ;@ 0x038073EC
|
||||
arm_func_start OSi_DoResetSystem
|
||||
OSi_DoResetSystem: ;@ 0x038073EC
|
||||
mov r1, #0
|
||||
ldr r0, _03807400 ;@ =0x04000208
|
||||
strh r1, [r0]
|
||||
|
||||
@@ -280,7 +280,7 @@
|
||||
.extern RTC_WriteTime
|
||||
.extern WVR_Shutdown
|
||||
.extern WVR_Init
|
||||
.extern FUN_038073EC
|
||||
.extern OSi_DoResetSystem
|
||||
.extern WMSP_GetAllowedChannel
|
||||
.extern OS_DisableIrqMask
|
||||
.extern OS_EnableIrqMask
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef GUARD_SND_ALARM_H
|
||||
#define GUARD_SND_ALARM_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/SND_alarm_shared.h"
|
||||
|
||||
void SND_AlarmInit(void);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "function_target.h"
|
||||
#include "MI_dma.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MI_WaitDma(u32 channel) {
|
||||
void MI_WaitDma(u32 channel) {
|
||||
OSIntrMode mode = OS_DisableInterrupts();
|
||||
vu32 * addr = (vu32 *)(REG_ADDR_DMA0SAD + (channel * 3 + 2) * 4);
|
||||
while(addr[0] & 0x80000000) ;
|
||||
@@ -15,7 +15,7 @@ ARM_FUNC void MI_WaitDma(u32 channel) {
|
||||
mode = OS_RestoreInterrupts(mode);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_StopDma(u32 channel) {
|
||||
void MI_StopDma(u32 channel) {
|
||||
OSIntrMode mode = OS_DisableInterrupts();
|
||||
vu16 * addr = (vu16 *)(REG_ADDR_DMA0SAD + (channel * 6 + 5) * 2);
|
||||
addr[0] &= ~(DMA_START_MASK | DMA_REPEAT);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "function_target.h"
|
||||
#include "MI_memory.h"
|
||||
#include "code32.h"
|
||||
|
||||
asm void MIi_CpuClear16(register u16 value, register u16 * dst, register u32 size) {
|
||||
mov r3, #0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "MI_swap.h"
|
||||
#include "code32.h"
|
||||
|
||||
asm u32 MI_SwapWord(register u32 data, register u32 * dst) {
|
||||
swp r0, r0, [r1]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "function_target.h"
|
||||
#include "consts.h"
|
||||
#include "OS_alloc.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
void* OSiHeapInfo[OS_ARENA_MAX];
|
||||
|
||||
ARM_FUNC Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
{
|
||||
cell->next = list;
|
||||
cell->prev = NULL;
|
||||
@@ -15,7 +15,7 @@ ARM_FUNC Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
return cell;
|
||||
}
|
||||
|
||||
ARM_FUNC Cell* DLExtract(Cell* list, Cell* cell)
|
||||
Cell* DLExtract(Cell* list, Cell* cell)
|
||||
{
|
||||
if (cell->next) {
|
||||
cell->next->prev = cell->prev;
|
||||
@@ -28,7 +28,7 @@ ARM_FUNC Cell* DLExtract(Cell* list, Cell* cell)
|
||||
return list;
|
||||
}
|
||||
|
||||
ARM_FUNC Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
{
|
||||
Cell *prevCell;
|
||||
Cell *nextCell;
|
||||
@@ -78,7 +78,7 @@ ARM_FUNC Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
#define HEADERSIZE OSi_ROUND(sizeof(Cell), 32)
|
||||
#define MINOBJSIZE (HEADERSIZE+32)
|
||||
|
||||
ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size)
|
||||
void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size)
|
||||
{
|
||||
OSHeapInfo* heapInfo;
|
||||
HeapDesc* hd;
|
||||
@@ -142,7 +142,7 @@ ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size)
|
||||
return (void *)((char *)cell + HEADERSIZE);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr)
|
||||
void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr)
|
||||
{
|
||||
OSHeapInfo *heapInfo;
|
||||
HeapDesc *hd;
|
||||
@@ -164,7 +164,7 @@ ARM_FUNC void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC OSHeapHandle OS_SetCurrentHeap(OSArenaId id, OSHeapHandle heap)
|
||||
OSHeapHandle OS_SetCurrentHeap(OSArenaId id, OSHeapHandle heap)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -176,7 +176,7 @@ ARM_FUNC OSHeapHandle OS_SetCurrentHeap(OSArenaId id, OSHeapHandle heap)
|
||||
return prev;
|
||||
}
|
||||
|
||||
ARM_FUNC void *OS_InitAlloc(OSArenaId id, void *arenaStart, void *arenaEnd, s32 maxHeaps)
|
||||
void *OS_InitAlloc(OSArenaId id, void *arenaStart, void *arenaEnd, s32 maxHeaps)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -207,7 +207,7 @@ ARM_FUNC void *OS_InitAlloc(OSArenaId id, void *arenaStart, void *arenaEnd, s32
|
||||
return heapInfo->arenaStart;
|
||||
}
|
||||
|
||||
ARM_FUNC OSHeapHandle OS_CreateHeap(OSArenaId id, void *start, void *end)
|
||||
OSHeapHandle OS_CreateHeap(OSArenaId id, void *start, void *end)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -250,7 +250,7 @@ ARM_FUNC OSHeapHandle OS_CreateHeap(OSArenaId id, void *start, void *end)
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ARM_FUNC s32 OS_CheckHeap(OSArenaId id, OSHeapHandle heap)
|
||||
s32 OS_CheckHeap(OSArenaId id, OSHeapHandle heap)
|
||||
{
|
||||
OSHeapInfo *heapInfo;
|
||||
HeapDesc *hd;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "function_target.h"
|
||||
#include "consts.h"
|
||||
#include "OS_arena.h"
|
||||
#include "code32.h"
|
||||
|
||||
static BOOL OSi_Initialized = FALSE;
|
||||
|
||||
@@ -9,7 +9,7 @@ extern void SDK_WRAM_ARENA_LO(void);
|
||||
extern void SDK_IRQ_STACKSIZE(void);
|
||||
extern void SDK_SYS_STACKSIZE(void);
|
||||
|
||||
ARM_FUNC void OS_InitArena(void)
|
||||
void OS_InitArena(void)
|
||||
{
|
||||
if (OSi_Initialized)
|
||||
{
|
||||
@@ -27,17 +27,17 @@ ARM_FUNC void OS_InitArena(void)
|
||||
OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, OS_GetInitArenaLo(OS_ARENA_WRAM_SUBPRIV));
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetArenaHi(OSArenaId id)
|
||||
void* OS_GetArenaHi(OSArenaId id)
|
||||
{
|
||||
return OSi_GetArenaInfo().hi[id];
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetArenaLo(OSArenaId id)
|
||||
void* OS_GetArenaLo(OSArenaId id)
|
||||
{
|
||||
return OSi_GetArenaInfo().lo[id];
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetInitArenaHi(OSArenaId id)
|
||||
void* OS_GetInitArenaHi(OSArenaId id)
|
||||
{
|
||||
switch (id) {
|
||||
case OS_ARENA_MAIN_SUBPRIV:
|
||||
@@ -74,7 +74,7 @@ ARM_FUNC void* OS_GetInitArenaHi(OSArenaId id)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
switch (id) {
|
||||
case OS_ARENA_MAIN_SUBPRIV:
|
||||
return (void *)((u32)0x027fafcc); //todo SDK_SUBPRIV_ARENA_LO
|
||||
@@ -101,10 +101,10 @@ ARM_FUNC void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetArenaHi(OSArenaId id, void* newHi) {
|
||||
void OS_SetArenaHi(OSArenaId id, void* newHi) {
|
||||
OSi_GetArenaInfo().hi[id] = newHi;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetArenaLo(OSArenaId id, void* newLo) {
|
||||
void OS_SetArenaLo(OSArenaId id, void* newLo) {
|
||||
OSi_GetArenaInfo().lo[id] = newLo;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "OS_context.h"
|
||||
#include "consts.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void OS_InitContext(register OSContext *context, register u32 newpc, register u32 newsp)
|
||||
asm void OS_InitContext(register OSContext *context, register u32 newpc, register u32 newsp)
|
||||
{
|
||||
add newpc, newpc, #4
|
||||
str newpc, [context, #0x40]
|
||||
@@ -38,7 +38,7 @@ ARM_FUNC asm void OS_InitContext(register OSContext *context, register u32 newpc
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm BOOL OS_SaveContext(register OSContext *context)
|
||||
asm BOOL OS_SaveContext(register OSContext *context)
|
||||
{
|
||||
add r1, r0, #0
|
||||
|
||||
@@ -59,7 +59,7 @@ ARM_FUNC asm BOOL OS_SaveContext(register OSContext *context)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void OS_LoadContext(register OSContext* context)
|
||||
asm void OS_LoadContext(register OSContext* context)
|
||||
{
|
||||
mrs r1, cpsr
|
||||
bic r1, r1, #HW_PSR_CPU_MODE_MASK
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_init.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern void PXI_Init(void);
|
||||
extern void OS_InitThread(void);
|
||||
extern void OS_InitAlarm(void);
|
||||
extern void CTRDG_Init(void);
|
||||
|
||||
ARM_FUNC void OS_Init(void)
|
||||
void OS_Init(void)
|
||||
{
|
||||
OS_InitArena();
|
||||
PXI_Init();
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "function_target.h"
|
||||
#include "consts.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_thread.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern OSThreadQueue OSi_IrqThreadQueue;
|
||||
|
||||
ARM_FUNC void OS_InitIrqTable(void)
|
||||
void OS_InitIrqTable(void)
|
||||
{
|
||||
OS_InitThreadQueue(&OSi_IrqThreadQueue);
|
||||
|
||||
OSi_SetVBlankCount(0);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetIrqFunction(OSIrqMask intrBit, OSIrqFunction function)
|
||||
void OS_SetIrqFunction(OSIrqMask intrBit, OSIrqFunction function)
|
||||
{
|
||||
s32 i;
|
||||
OSIrqCallbackInfo *info;
|
||||
@@ -51,7 +51,7 @@ ARM_FUNC void OS_SetIrqFunction(OSIrqMask intrBit, OSIrqFunction function)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_EnterTimerCallback(u32 timerNo, void (*callback) (void *), void *arg)
|
||||
void OSi_EnterTimerCallback(u32 timerNo, void (*callback) (void *), void *arg)
|
||||
{
|
||||
OSIrqMask mask = 1UL << (timerNo + 3);
|
||||
OSi_IrqCallbackInfo[timerNo + 4].func = callback;
|
||||
@@ -61,7 +61,7 @@ ARM_FUNC void OSi_EnterTimerCallback(u32 timerNo, void (*callback) (void *), voi
|
||||
OSi_IrqCallbackInfo[timerNo + 4].enable = TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC OSIrqMask OS_SetIrqMask(OSIrqMask mask)
|
||||
OSIrqMask OS_SetIrqMask(OSIrqMask mask)
|
||||
{
|
||||
u16 regIme = reg_OS_IME;
|
||||
reg_OS_IME = 0;
|
||||
@@ -72,7 +72,7 @@ ARM_FUNC OSIrqMask OS_SetIrqMask(OSIrqMask mask)
|
||||
return regIe;
|
||||
}
|
||||
|
||||
ARM_FUNC OSIrqMask OS_EnableIrqMask(OSIrqMask mask)
|
||||
OSIrqMask OS_EnableIrqMask(OSIrqMask mask)
|
||||
{
|
||||
u16 regIme = reg_OS_IME;
|
||||
reg_OS_IME = 0;
|
||||
@@ -83,7 +83,7 @@ ARM_FUNC OSIrqMask OS_EnableIrqMask(OSIrqMask mask)
|
||||
return regIe;
|
||||
}
|
||||
|
||||
ARM_FUNC OSIrqMask OS_DisableIrqMask(OSIrqMask mask)
|
||||
OSIrqMask OS_DisableIrqMask(OSIrqMask mask)
|
||||
{
|
||||
u16 regIme = reg_OS_IME;
|
||||
reg_OS_IME = 0;
|
||||
@@ -94,7 +94,7 @@ ARM_FUNC OSIrqMask OS_DisableIrqMask(OSIrqMask mask)
|
||||
return regIe;
|
||||
}
|
||||
|
||||
ARM_FUNC OSIrqMask OS_ResetRequestIrqMask(OSIrqMask mask)
|
||||
OSIrqMask OS_ResetRequestIrqMask(OSIrqMask mask)
|
||||
{
|
||||
u16 regIme = reg_OS_IME;
|
||||
reg_OS_IME = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "nitro/types.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_irqTable.h"
|
||||
#include "code32.h"
|
||||
|
||||
OSIrqFunction OS_IRQTable[25] = {
|
||||
OSi_IrqVBlank,
|
||||
@@ -46,12 +46,12 @@ static u16 OSi_IrqCallbackInfoIndex[9] = {
|
||||
8, 9, 10, 11, 3, 4, 5, 6, 0
|
||||
};
|
||||
|
||||
ARM_FUNC void OS_IrqDummy(void)
|
||||
void OS_IrqDummy(void)
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqCallback(s32 index)
|
||||
void OSi_IrqCallback(s32 index)
|
||||
{
|
||||
OSIrqMask imask = (1UL << OSi_IrqCallbackInfoIndex[index]);
|
||||
void (*callback) (void *) = OSi_IrqCallbackInfo[index].func;
|
||||
@@ -71,46 +71,46 @@ ARM_FUNC void OSi_IrqCallback(s32 index)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqDma0(void)
|
||||
void OSi_IrqDma0(void)
|
||||
{
|
||||
OSi_IrqCallback(0);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqDma1(void)
|
||||
void OSi_IrqDma1(void)
|
||||
{
|
||||
OSi_IrqCallback(1);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqDma2(void)
|
||||
void OSi_IrqDma2(void)
|
||||
{
|
||||
OSi_IrqCallback(2);
|
||||
}
|
||||
ARM_FUNC void OSi_IrqDma3(void)
|
||||
void OSi_IrqDma3(void)
|
||||
{
|
||||
OSi_IrqCallback(3);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqTimer0(void)
|
||||
void OSi_IrqTimer0(void)
|
||||
{
|
||||
OSi_IrqCallback(4);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqTimer1(void)
|
||||
void OSi_IrqTimer1(void)
|
||||
{
|
||||
OSi_IrqCallback(5);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqTimer2(void)
|
||||
void OSi_IrqTimer2(void)
|
||||
{
|
||||
OSi_IrqCallback(6);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqTimer3(void)
|
||||
void OSi_IrqTimer3(void)
|
||||
{
|
||||
OSi_IrqCallback(7);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_IrqVBlank(void)
|
||||
void OSi_IrqVBlank(void)
|
||||
{
|
||||
void (*callback) (void) = (void (*)(void))OSi_IrqCallbackInfo[8].func;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "OS_message.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_system.h"
|
||||
#include "OS_thread.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void OS_InitMessageQueue(OSMessageQueue *mq, OSMessage *msgArray, s32 msgCount)
|
||||
void OS_InitMessageQueue(OSMessageQueue *mq, OSMessage *msgArray, s32 msgCount)
|
||||
{
|
||||
OS_InitThreadQueue(&mq->queueSend);
|
||||
OS_InitThreadQueue(&mq->queueReceive);
|
||||
@@ -13,7 +13,7 @@ ARM_FUNC void OS_InitMessageQueue(OSMessageQueue *mq, OSMessage *msgArray, s32 m
|
||||
mq->usedCount = 0;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_SendMessage(OSMessageQueue *mq, OSMessage msg, s32 flags)
|
||||
BOOL OS_SendMessage(OSMessageQueue *mq, OSMessage msg, s32 flags)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -40,7 +40,7 @@ ARM_FUNC BOOL OS_SendMessage(OSMessageQueue *mq, OSMessage msg, s32 flags)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_ReceiveMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
|
||||
BOOL OS_ReceiveMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -70,7 +70,7 @@ ARM_FUNC BOOL OS_ReceiveMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_ReadMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
|
||||
BOOL OS_ReadMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_mutex.h"
|
||||
#include "OS_system.h"
|
||||
#include "OS_thread.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void OS_InitMutex(OSMutex* mutex) {
|
||||
void OS_InitMutex(OSMutex* mutex) {
|
||||
OS_InitThreadQueue(&mutex->queue);
|
||||
mutex->thread = NULL;
|
||||
mutex->count = 0;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_LockMutex(OSMutex* mutex) {
|
||||
void OS_LockMutex(OSMutex* mutex) {
|
||||
OSIntrMode mode;
|
||||
OSThread* current;
|
||||
|
||||
@@ -36,7 +36,7 @@ ARM_FUNC void OS_LockMutex(OSMutex* mutex) {
|
||||
(void)OS_RestoreInterrupts(mode);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_UnlockMutex(OSMutex* mutex) {
|
||||
void OS_UnlockMutex(OSMutex* mutex) {
|
||||
OSIntrMode mode;
|
||||
OSThread* current;
|
||||
|
||||
@@ -52,7 +52,7 @@ ARM_FUNC void OS_UnlockMutex(OSMutex* mutex) {
|
||||
(void)OS_RestoreInterrupts(mode);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_UnlockAllMutex(OSThread * thread) {
|
||||
void OSi_UnlockAllMutex(OSThread * thread) {
|
||||
OSMutex * mutex;
|
||||
while (thread->mutexQueue.head) {
|
||||
mutex = OSi_RemoveMutexLinkFromQueue(&thread->mutexQueue);
|
||||
@@ -62,7 +62,7 @@ ARM_FUNC void OSi_UnlockAllMutex(OSThread * thread) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_EnqueueTail(OSThread * thread, OSMutex * mutex) {
|
||||
void OSi_EnqueueTail(OSThread * thread, OSMutex * mutex) {
|
||||
OSMutex * tail = thread->mutexQueue.tail;
|
||||
if (tail == NULL) {
|
||||
thread->mutexQueue.head = mutex;
|
||||
@@ -75,7 +75,7 @@ ARM_FUNC void OSi_EnqueueTail(OSThread * thread, OSMutex * mutex) {
|
||||
thread->mutexQueue.tail = mutex;
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_DequeueItem(OSThread * thread, OSMutex * mutex) {
|
||||
void OSi_DequeueItem(OSThread * thread, OSMutex * mutex) {
|
||||
OSMutex *next = mutex->link.next;
|
||||
OSMutex *prev = mutex->link.prev;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_reset.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "PXI_fifo.h"
|
||||
#include "code32.h"
|
||||
|
||||
static u16 OSi_IsInitReset = 0;
|
||||
vu16 OSi_IsResetOccurred = 0;
|
||||
@@ -11,9 +11,9 @@ extern void MI_StopDma(u32 dma);
|
||||
extern OSIrqMask OS_SetIrqMask(OSIrqMask mask);
|
||||
extern OSIrqMask OS_ResetRequestIrqMask(OSIrqMask mask);
|
||||
extern void SND_Shutdown(void);
|
||||
extern void FUN_038073EC(void); //OSi_DoResetSystem, in wram
|
||||
extern void OSi_DoResetSystem(void); //in wram
|
||||
|
||||
ARM_FUNC void OS_InitReset(void)
|
||||
void OS_InitReset(void)
|
||||
{
|
||||
if (OSi_IsInitReset)
|
||||
return;
|
||||
@@ -22,12 +22,12 @@ ARM_FUNC void OS_InitReset(void)
|
||||
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_OS, OSi_CommonCallback);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_IsResetOccurred(void)
|
||||
BOOL OS_IsResetOccurred(void)
|
||||
{
|
||||
return OSi_IsResetOccurred;
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
static void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
{
|
||||
#pragma unused(tag, err)
|
||||
u16 command = (u16)((data & OS_PXI_COMMAND_MASK) >> OS_PXI_COMMAND_SHIFT);
|
||||
@@ -39,12 +39,12 @@ ARM_FUNC static void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
OS_Terminate();
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_SendToPxi(u16 data)
|
||||
static void OSi_SendToPxi(u16 data)
|
||||
{
|
||||
while (PXI_SendWordByFifo(PXI_FIFO_TAG_OS, (u32) data << 0x8, FALSE)) {}
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_ResetSystem(void) {
|
||||
void OS_ResetSystem(void) {
|
||||
MI_StopDma(0);
|
||||
MI_StopDma(1);
|
||||
MI_StopDma(2);
|
||||
@@ -54,5 +54,5 @@ ARM_FUNC void OS_ResetSystem(void) {
|
||||
(void)OS_ResetRequestIrqMask((u32)~0);
|
||||
SND_Shutdown();
|
||||
OSi_SendToPxi(OS_PXI_COMMAND_RESET);
|
||||
FUN_038073EC(); //OSi_DoResetSystem, in wram
|
||||
OSi_DoResetSystem();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_spinLock.h"
|
||||
#include "OS_system.h"
|
||||
#include "MI_swap.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void OS_InitLock(void)
|
||||
void OS_InitLock(void)
|
||||
{
|
||||
static BOOL isInitialized = FALSE;
|
||||
|
||||
@@ -25,12 +25,12 @@ ARM_FUNC void OS_InitLock(void)
|
||||
lockp->extension = 0xbf;
|
||||
}
|
||||
|
||||
ARM_FUNC void FUN_037F8CB4(s32 ct)
|
||||
void FUN_037F8CB4(s32 ct)
|
||||
{
|
||||
SVC_WaitByLoop((u32)ct); //todo this should be linker generated, figure out why it broke
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OSi_DoLockByWord(u16 lockId, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
s32 OSi_DoLockByWord(u16 lockId, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
BOOL disableFiq)
|
||||
{
|
||||
s32 lastLockFlag;
|
||||
@@ -41,7 +41,7 @@ ARM_FUNC s32 OSi_DoLockByWord(u16 lockId, OSLockWord *lockp, void (*ctrlFuncp) (
|
||||
return lastLockFlag;
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OSi_DoUnlockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
s32 OSi_DoUnlockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
BOOL disableFIQ)
|
||||
{
|
||||
if (lockID != lockp->ownerID)
|
||||
@@ -67,7 +67,7 @@ ARM_FUNC s32 OSi_DoUnlockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OSi_DoTryLockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
s32 OSi_DoTryLockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp) (void),
|
||||
BOOL disableFiq)
|
||||
{
|
||||
OSIntrMode lastIntrMode = (disableFiq) ? OS_DisableInterrupts_IrqAndFiq() : OS_DisableInterrupts();
|
||||
@@ -95,43 +95,43 @@ ARM_FUNC s32 OSi_DoTryLockByWord(u16 lockID, OSLockWord *lockp, void (*ctrlFuncp
|
||||
return lastLockFlag;
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OS_LockCartridge(u16 lockID)
|
||||
s32 OS_LockCartridge(u16 lockID)
|
||||
{
|
||||
return OSi_DoLockByWord(lockID, (OSLockWord *)HW_CTRDG_LOCK_BUF, OSi_AllocateCartridgeBus, TRUE);
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OS_UnlockCartridge(u16 lockID)
|
||||
s32 OS_UnlockCartridge(u16 lockID)
|
||||
{
|
||||
return OSi_DoUnlockByWord(lockID, (OSLockWord *)HW_CTRDG_LOCK_BUF, OSi_FreeCartridgeBus, TRUE);
|
||||
}
|
||||
|
||||
ARM_FUNC s32 OS_TryLockCartridge(u16 lockID)
|
||||
s32 OS_TryLockCartridge(u16 lockID)
|
||||
{
|
||||
return OSi_DoTryLockByWord(lockID, (OSLockWord *)HW_CTRDG_LOCK_BUF, OSi_AllocateCartridgeBus, TRUE);
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_AllocateCartridgeBus(void)
|
||||
void OSi_AllocateCartridgeBus(void)
|
||||
{
|
||||
//noop
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_FreeCartridgeBus(void)
|
||||
void OSi_FreeCartridgeBus(void)
|
||||
{
|
||||
//noop
|
||||
}
|
||||
|
||||
ARM_FUNC u16 OS_ReadOwnerOfLockWord(OSLockWord * lock)
|
||||
u16 OS_ReadOwnerOfLockWord(OSLockWord * lock)
|
||||
{
|
||||
return lock->ownerID;
|
||||
}
|
||||
|
||||
ARM_FUNC asm s32 OS_UnLockCartridge(u16 lockID)
|
||||
asm s32 OS_UnLockCartridge(u16 lockID)
|
||||
{
|
||||
ldr r1, =OS_UnlockCartridge
|
||||
bx r1
|
||||
}
|
||||
|
||||
ARM_FUNC asm s32 OS_GetLockID(void)
|
||||
asm s32 OS_GetLockID(void)
|
||||
{
|
||||
ldr r3, =HW_LOCK_ID_FLAG_SUB
|
||||
ldr r1, [r3]
|
||||
@@ -176,7 +176,7 @@ _037F8A98:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void OS_ReleaseLockID(register u16 lockID)
|
||||
asm void OS_ReleaseLockID(register u16 lockID)
|
||||
{
|
||||
ldr r3, =HW_LOCK_ID_FLAG_SUB
|
||||
cmp r0, #0xa0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_system.h"
|
||||
#include "OS_spinLock.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm OSIntrMode OS_EnableInterrupts(void)
|
||||
asm OSIntrMode OS_EnableInterrupts(void)
|
||||
{
|
||||
mrs r0, CPSR
|
||||
bic r1, r0, #HW_PSR_DISABLE_IRQ
|
||||
@@ -11,7 +11,7 @@ ARM_FUNC asm OSIntrMode OS_EnableInterrupts(void)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm OSIntrMode OS_DisableInterrupts(void)
|
||||
asm OSIntrMode OS_DisableInterrupts(void)
|
||||
{
|
||||
mrs r0, CPSR
|
||||
orr r1, r0, #HW_PSR_DISABLE_IRQ
|
||||
@@ -20,7 +20,7 @@ ARM_FUNC asm OSIntrMode OS_DisableInterrupts(void)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm OSIntrMode OS_RestoreInterrupts(register OSIntrMode state)
|
||||
asm OSIntrMode OS_RestoreInterrupts(register OSIntrMode state)
|
||||
{
|
||||
mrs r1, CPSR
|
||||
bic r2, r1, #HW_PSR_DISABLE_IRQ
|
||||
@@ -30,7 +30,7 @@ ARM_FUNC asm OSIntrMode OS_RestoreInterrupts(register OSIntrMode state)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm OSIntrMode OS_DisableInterrupts_IrqAndFiq(void)
|
||||
asm OSIntrMode OS_DisableInterrupts_IrqAndFiq(void)
|
||||
{
|
||||
mrs r0, CPSR
|
||||
orr r1, r0, #HW_PSR_DISABLE_IRQ_FIQ
|
||||
@@ -39,7 +39,7 @@ ARM_FUNC asm OSIntrMode OS_DisableInterrupts_IrqAndFiq(void)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm OSIntrMode OS_RestoreInterrupts_IrqAndFiq(register OSIntrMode state)
|
||||
asm OSIntrMode OS_RestoreInterrupts_IrqAndFiq(register OSIntrMode state)
|
||||
{
|
||||
mrs r1, CPSR
|
||||
bic r2, r1, #HW_PSR_DISABLE_IRQ_FIQ
|
||||
@@ -49,14 +49,14 @@ ARM_FUNC asm OSIntrMode OS_RestoreInterrupts_IrqAndFiq(register OSIntrMode state
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm OSProcMode OS_GetProcMode(void)
|
||||
asm OSProcMode OS_GetProcMode(void)
|
||||
{
|
||||
mrs r0, CPSR
|
||||
and r0, r0, #HW_PSR_CPU_MODE_MASK
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SpinWait(u32 cycle)
|
||||
void OS_SpinWait(u32 cycle)
|
||||
{
|
||||
FUN_037F8CB4((s32)cycle / 4);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "function_target.h"
|
||||
#include "nitro/types.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern void CTRDG_VibPulseEdgeUpdate(u32 param);
|
||||
extern void FUN_037F8530(void); //SVC_Halt
|
||||
extern void FUN_037F8530(void); //SVC_Halt thunk
|
||||
|
||||
ARM_FUNC void OS_Terminate(void)
|
||||
void OS_Terminate(void)
|
||||
{
|
||||
CTRDG_VibPulseEdgeUpdate(0);
|
||||
while (TRUE)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "OS_thread.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_system.h"
|
||||
#include "consts.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
@@ -8,6 +7,7 @@
|
||||
#include "OS_context.h"
|
||||
#include "nitro/OS_systemWork_shared.h"
|
||||
#include "MI_memory.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern void SDK_SYS_STACKSIZE(void);
|
||||
extern void SDK_IRQ_STACKSIZE(void);
|
||||
@@ -41,12 +41,12 @@ static void OSi_ExitThread(void *arg);
|
||||
static void OSi_ExitThread_Destroy(void);
|
||||
static void OSi_SleepAlarmCallback(void *arg);
|
||||
|
||||
ARM_FUNC static s32 OSi_GetUnusedThreadId(void)
|
||||
static s32 OSi_GetUnusedThreadId(void)
|
||||
{
|
||||
return ++OSi_ThreadIdCount;
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_InsertLinkToQueue(OSThreadQueue *queue, OSThread *thread)
|
||||
static void OSi_InsertLinkToQueue(OSThreadQueue *queue, OSThread *thread)
|
||||
{
|
||||
OSThread *next = queue->head;
|
||||
|
||||
@@ -93,7 +93,7 @@ ARM_FUNC static void OSi_InsertLinkToQueue(OSThreadQueue *queue, OSThread *threa
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static OSThread *OSi_RemoveLinkFromQueue(OSThreadQueue *queue)
|
||||
static OSThread *OSi_RemoveLinkFromQueue(OSThreadQueue *queue)
|
||||
{
|
||||
OSThread *thread = queue->head;
|
||||
|
||||
@@ -117,7 +117,7 @@ ARM_FUNC static OSThread *OSi_RemoveLinkFromQueue(OSThreadQueue *queue)
|
||||
return thread;
|
||||
}
|
||||
|
||||
ARM_FUNC static OSThread *OSi_RemoveSpecifiedLinkFromQueue(OSThreadQueue *queue, OSThread *thread)
|
||||
static OSThread *OSi_RemoveSpecifiedLinkFromQueue(OSThreadQueue *queue, OSThread *thread)
|
||||
{
|
||||
OSThread *queueHead = queue->head;
|
||||
|
||||
@@ -156,7 +156,7 @@ ARM_FUNC static OSThread *OSi_RemoveSpecifiedLinkFromQueue(OSThreadQueue *queue,
|
||||
return queueHead;
|
||||
}
|
||||
|
||||
ARM_FUNC OSMutex *OSi_RemoveMutexLinkFromQueue(OSMutexQueue *queue)
|
||||
OSMutex *OSi_RemoveMutexLinkFromQueue(OSMutexQueue *queue)
|
||||
{
|
||||
OSMutex *mutexHead = queue->head;
|
||||
|
||||
@@ -179,7 +179,7 @@ ARM_FUNC OSMutex *OSi_RemoveMutexLinkFromQueue(OSMutexQueue *queue)
|
||||
return mutexHead;
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_InsertThreadToList(OSThread *thread)
|
||||
static void OSi_InsertThreadToList(OSThread *thread)
|
||||
{
|
||||
OSThread *t = OSi_ThreadInfo.list;
|
||||
OSThread *pre = NULL;
|
||||
@@ -202,7 +202,7 @@ ARM_FUNC static void OSi_InsertThreadToList(OSThread *thread)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_RemoveThreadFromList(OSThread *thread)
|
||||
static void OSi_RemoveThreadFromList(OSThread *thread)
|
||||
{
|
||||
OSThread *t = OSi_ThreadInfo.list;
|
||||
OSThread *pre = NULL;
|
||||
@@ -223,7 +223,7 @@ ARM_FUNC static void OSi_RemoveThreadFromList(OSThread *thread)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_RescheduleThread(void)
|
||||
static void OSi_RescheduleThread(void)
|
||||
{
|
||||
if (OSi_RescheduleCount <= 0)
|
||||
{
|
||||
@@ -261,7 +261,7 @@ ARM_FUNC static void OSi_RescheduleThread(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_InitThread(void)
|
||||
void OS_InitThread(void)
|
||||
{
|
||||
if (OSi_IsThreadInitialized)
|
||||
return;
|
||||
@@ -302,7 +302,7 @@ ARM_FUNC void OS_InitThread(void)
|
||||
(void)OS_SetSwitchThreadCallback(NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_CreateThread(OSThread *thread, void (*func) (void *), void *arg, void *stack, u32 stackSize, u32 prio)
|
||||
void OS_CreateThread(OSThread *thread, void (*func) (void *), void *arg, void *stack, u32 stackSize, u32 prio)
|
||||
{
|
||||
OSIntrMode enable = OS_DisableInterrupts();
|
||||
|
||||
@@ -348,13 +348,13 @@ ARM_FUNC void OS_CreateThread(OSThread *thread, void (*func) (void *), void *arg
|
||||
(void)OS_RestoreInterrupts(enable);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_ExitThread(void)
|
||||
void OS_ExitThread(void)
|
||||
{
|
||||
(void)OS_DisableInterrupts();
|
||||
OSi_ExitThread_ArgSpecified(OS_GetCurrentThread(), 0);
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_ExitThread_ArgSpecified(OSThread *thread, void *arg)
|
||||
static void OSi_ExitThread_ArgSpecified(OSThread *thread, void *arg)
|
||||
{
|
||||
if (OSi_StackForDestructor)
|
||||
{
|
||||
@@ -370,7 +370,7 @@ ARM_FUNC static void OSi_ExitThread_ArgSpecified(OSThread *thread, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_ExitThread(void *arg)
|
||||
static void OSi_ExitThread(void *arg)
|
||||
{
|
||||
OSThread *currentThread = OSi_GetCurrentThread();
|
||||
OSThreadDestructor destructor = currentThread->destructor;
|
||||
@@ -385,7 +385,7 @@ ARM_FUNC static void OSi_ExitThread(void *arg)
|
||||
OSi_ExitThread_Destroy();
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_ExitThread_Destroy(void)
|
||||
static void OSi_ExitThread_Destroy(void)
|
||||
{
|
||||
OSThread *currentThread = OSi_GetCurrentThread();
|
||||
(void)OS_DisableScheduler();
|
||||
@@ -410,7 +410,7 @@ ARM_FUNC static void OSi_ExitThread_Destroy(void)
|
||||
OS_Terminate();
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_JoinThread(OSThread *thread)
|
||||
void OS_JoinThread(OSThread *thread)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -422,12 +422,12 @@ ARM_FUNC void OS_JoinThread(OSThread *thread)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_IsThreadTerminated(const OSThread *thread)
|
||||
BOOL OS_IsThreadTerminated(const OSThread *thread)
|
||||
{
|
||||
return (thread->state == OS_THREAD_STATE_TERMINATED) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SleepThread(OSThreadQueue *queue)
|
||||
void OS_SleepThread(OSThreadQueue *queue)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
OSThread *currentThread = OSi_GetCurrentThread();
|
||||
@@ -444,7 +444,7 @@ ARM_FUNC void OS_SleepThread(OSThreadQueue *queue)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_WakeupThread(OSThreadQueue *queue)
|
||||
void OS_WakeupThread(OSThreadQueue *queue)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -466,7 +466,7 @@ ARM_FUNC void OS_WakeupThread(OSThreadQueue *queue)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_WakeupThreadDirect(OSThread *thread)
|
||||
void OS_WakeupThreadDirect(OSThread *thread)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -476,7 +476,7 @@ ARM_FUNC void OS_WakeupThreadDirect(OSThread *thread)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC OSThread *OS_SelectThread(void)
|
||||
OSThread *OS_SelectThread(void)
|
||||
{
|
||||
OSThread *thread = OSi_ThreadInfo.list;
|
||||
|
||||
@@ -488,14 +488,14 @@ ARM_FUNC OSThread *OS_SelectThread(void)
|
||||
return thread;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_RescheduleThread(void)
|
||||
void OS_RescheduleThread(void)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
OSi_RescheduleThread();
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_SetThreadPriority(OSThread *thread, u32 prio)
|
||||
BOOL OS_SetThreadPriority(OSThread *thread, u32 prio)
|
||||
{
|
||||
OSThread *t = OSi_ThreadInfo.list;
|
||||
OSThread *pre = NULL;
|
||||
@@ -535,7 +535,7 @@ ARM_FUNC BOOL OS_SetThreadPriority(OSThread *thread, u32 prio)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_Sleep(u32 msec)
|
||||
void OS_Sleep(u32 msec)
|
||||
{
|
||||
OSAlarm alarm;
|
||||
|
||||
@@ -554,7 +554,7 @@ ARM_FUNC void OS_Sleep(u32 msec)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_SleepAlarmCallback(void *arg)
|
||||
static void OSi_SleepAlarmCallback(void *arg)
|
||||
{
|
||||
OSThread **pp_thread = (OSThread **)arg;
|
||||
OSThread *p_thread = *pp_thread;
|
||||
@@ -565,7 +565,7 @@ ARM_FUNC static void OSi_SleepAlarmCallback(void *arg)
|
||||
OS_WakeupThreadDirect(p_thread);
|
||||
}
|
||||
|
||||
ARM_FUNC OSSwitchThreadCallback OS_SetSwitchThreadCallback(OSSwitchThreadCallback callback)
|
||||
OSSwitchThreadCallback OS_SetSwitchThreadCallback(OSSwitchThreadCallback callback)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
OSSwitchThreadCallback prev = OSi_ThreadInfo.switchCallback;
|
||||
@@ -575,7 +575,7 @@ ARM_FUNC OSSwitchThreadCallback OS_SetSwitchThreadCallback(OSSwitchThreadCallbac
|
||||
return prev;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 OS_DisableScheduler(void)
|
||||
u32 OS_DisableScheduler(void)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
u32 count;
|
||||
@@ -589,7 +589,7 @@ ARM_FUNC u32 OS_DisableScheduler(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 OS_EnableScheduler(void)
|
||||
u32 OS_EnableScheduler(void)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
u32 count = 0;
|
||||
@@ -603,7 +603,7 @@ ARM_FUNC u32 OS_EnableScheduler(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetThreadDestructor(OSThread *thread, OSThreadDestructor dtor)
|
||||
void OS_SetThreadDestructor(OSThread *thread, OSThreadDestructor dtor)
|
||||
{
|
||||
thread->destructor = dtor;
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#include "OS_system.h"
|
||||
#include "OS_tick.h"
|
||||
#include "OS_timer.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
static u16 OSi_UseTick;
|
||||
static OSTick OSi_TickCounter;
|
||||
static BOOL OSi_NeedResetTimer;
|
||||
|
||||
ARM_FUNC void OS_InitTick(void) {
|
||||
void OS_InitTick(void) {
|
||||
if (OSi_UseTick == 0) {
|
||||
OSi_UseTick = 1;
|
||||
OSi_SetTimerReserved(0);
|
||||
@@ -22,11 +22,11 @@ ARM_FUNC void OS_InitTick(void) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u16 OS_IsTickAvailable(void) {
|
||||
u16 OS_IsTickAvailable(void) {
|
||||
return OSi_UseTick;
|
||||
}
|
||||
|
||||
ARM_FUNC void OSi_CountUpTick(void) {
|
||||
void OSi_CountUpTick(void) {
|
||||
OSi_TickCounter++;
|
||||
if (OSi_NeedResetTimer != 0) {
|
||||
OS_SetTimerControl(OS_TIMER_0, 0);
|
||||
@@ -37,7 +37,7 @@ ARM_FUNC void OSi_CountUpTick(void) {
|
||||
OSi_EnterTimerCallback(0, (void(*)(void*))OSi_CountUpTick, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC OSTick OS_GetTick(void) {
|
||||
OSTick OS_GetTick(void) {
|
||||
OSIntrMode prev = OS_DisableInterrupts();
|
||||
vu16 countL = *(REGType16 *)((u32)®_OS_TM0CNT_L + OS_TIMER_0 * 4);
|
||||
vu64 countH = OSi_TickCounter & 0xffffffffffffULL;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "OS_timer.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
static u16 OSi_TimerReserved = 0;
|
||||
|
||||
ARM_FUNC void OSi_SetTimerReserved(s32 timerNum)
|
||||
void OSi_SetTimerReserved(s32 timerNum)
|
||||
{
|
||||
OSi_TimerReserved |= (1 << timerNum);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "function_target.h"
|
||||
#include "OS_alarm.h"
|
||||
#include "OS_tick.h"
|
||||
#include "PAD_xyButton.h"
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
static BOOL PADi_XYButtonAvailable;
|
||||
static OSAlarm PADi_Alarm;
|
||||
|
||||
void EXIi_SelectRcnt(u16);
|
||||
|
||||
ARM_FUNC BOOL PAD_InitXYButton(void) {
|
||||
BOOL PAD_InitXYButton(void) {
|
||||
OSTick tick;
|
||||
if (!OS_IsTickAvailable() || !OS_IsAlarmAvailable())
|
||||
return FALSE;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "OS_tick.h"
|
||||
#include "PXI_fifo.h"
|
||||
#include "SND_work.h"
|
||||
#include "code32.h"
|
||||
|
||||
static void AlarmHandler(void *msg);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "SND_main.h"
|
||||
|
||||
#include "mmap.h"
|
||||
#include "code32.h"
|
||||
|
||||
static const struct SNDWaveData *GetWaveData(
|
||||
const struct SNDBankData *bankData, s32 waveArc, s32 wave);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "SND_capture.h"
|
||||
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
enum SNDLoop
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "SND_work.h"
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
static int sMasterPan = -1;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "SND_seq.h"
|
||||
#include "SND_work.h"
|
||||
|
||||
#include "code32.h"
|
||||
|
||||
#define SND_MSG_ARRAY_SIZE 8
|
||||
|
||||
static OSMessage sMsgArray[SND_MSG_ARRAY_SIZE];
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "SND_work.h"
|
||||
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
// TODO import these tables into here if we have a working .rodata section
|
||||
extern const u8 sChannelAllocationOrder[SND_CHANNEL_COUNT];
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "PM.h"
|
||||
#include "registers.h"
|
||||
#include "syscall.h"
|
||||
#include "code32.h"
|
||||
|
||||
void SND_Enable(void)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "SND_main.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "SND_alarm.h"
|
||||
#include "SND_capture.h"
|
||||
#include "SND_command.h"
|
||||
@@ -15,6 +13,7 @@
|
||||
#include "OS_message.h"
|
||||
#include "OS_thread.h"
|
||||
#include "OS_tick.h"
|
||||
#include "code32.h"
|
||||
|
||||
static void FUN_037fc330(void *);
|
||||
static void SndThread(void *);
|
||||
@@ -105,7 +104,7 @@ static void SndThread(void *arg)
|
||||
SND_SetMasterVolume(0x7F);
|
||||
SND_StartIntervalTimer();
|
||||
|
||||
while (1)
|
||||
while (TRUE)
|
||||
{
|
||||
BOOL update = FALSE;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "SND_main.h"
|
||||
#include "SND_util.h"
|
||||
#include "SND_work.h"
|
||||
#include "code32.h"
|
||||
|
||||
#define SND_TIMER_RATE 240
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "SND_util.h"
|
||||
|
||||
#include "syscall.h"
|
||||
#include "code32.h"
|
||||
|
||||
// TODO remove this extern once the static const definition of it is here
|
||||
extern s8 sLfoSinTable[0x21];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "SND_capture.h"
|
||||
#include "SND_channel.h"
|
||||
#include "SND_exChannel.h"
|
||||
#include "code32.h"
|
||||
|
||||
struct SNDWork SNDi_Work;
|
||||
struct SNDSharedWork *SNDi_SharedWork;
|
||||
|
||||
@@ -9,267 +9,9 @@
|
||||
.extern FUN_0203BBBC
|
||||
.extern FUN_0203BC04
|
||||
.extern FUN_0203BC3C
|
||||
.extern FUN_0203BC6C
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ScrCmd_Unk0209
|
||||
ScrCmd_Unk0209: ; 0x0203BE50
|
||||
push {r3, lr}
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x14
|
||||
bl FieldSysGetAttrAddr
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x1
|
||||
strb r1, [r0, #0x0]
|
||||
add r0, r1, #0x0
|
||||
pop {r3, pc}
|
||||
.balign 4
|
||||
|
||||
thumb_func_start ScrCmd_Unk028D
|
||||
ScrCmd_Unk028D: ; 0x0203BE68
|
||||
push {r3, lr}
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x14
|
||||
bl FieldSysGetAttrAddr
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x2
|
||||
strb r1, [r0, #0x0]
|
||||
mov r0, #0x1
|
||||
pop {r3, pc}
|
||||
.balign 4
|
||||
|
||||
thumb_func_start ScrCmd_Unk028E
|
||||
ScrCmd_Unk028E: ; 0x0203BE80
|
||||
push {r4, lr}
|
||||
add r4, r0, #0x0
|
||||
bl ScriptReadHalfword
|
||||
str r0, [r4, #0x64]
|
||||
ldr r1, _0203BE98 ; =FUN_0203BE9C
|
||||
add r0, r4, #0x0
|
||||
bl SetupNativeScript
|
||||
mov r0, #0x1
|
||||
pop {r4, pc}
|
||||
nop
|
||||
_0203BE98: .word FUN_0203BE9C
|
||||
|
||||
thumb_func_start FUN_0203BE9C
|
||||
FUN_0203BE9C: ; 0x0203BE9C
|
||||
push {r3-r5, lr}
|
||||
add r5, r0, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x14
|
||||
bl FieldSysGetAttrAddr
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
ldr r1, [r5, #0x64]
|
||||
add r0, #0x80
|
||||
lsl r1, r1, #0x10
|
||||
ldr r0, [r0, #0x0]
|
||||
lsr r1, r1, #0x10
|
||||
bl GetVarPointer
|
||||
ldr r0, [r4, #0x0]
|
||||
ldrb r0, [r0, #0x0]
|
||||
cmp r0, #0x3
|
||||
beq _0203BEC8
|
||||
mov r0, #0x1
|
||||
pop {r3-r5, pc}
|
||||
_0203BEC8:
|
||||
mov r0, #0x0
|
||||
pop {r3-r5, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk020A
|
||||
ScrCmd_Unk020A: ; 0x0203BECC
|
||||
push {r4-r6, lr}
|
||||
add r5, r0, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r6, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0xf
|
||||
bl FieldSysGetAttrAddr
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
add r1, r6, #0x0
|
||||
bl GetVarPointer
|
||||
add r2, r0, #0x0
|
||||
ldr r0, [r5, #0x74]
|
||||
ldr r1, [r4, #0x0]
|
||||
bl MOD05_021E1374
|
||||
mov r0, #0x1
|
||||
pop {r4-r6, pc}
|
||||
.balign 4
|
||||
|
||||
thumb_func_start ScrCmd_Unk020B
|
||||
ScrCmd_Unk020B: ; 0x0203BF00
|
||||
push {r4, lr}
|
||||
add r4, r0, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0xa
|
||||
bl FieldSysGetAttrAddr
|
||||
ldr r1, [r0, #0x0]
|
||||
cmp r1, #0x0
|
||||
beq _0203BF1C
|
||||
add r4, #0x80
|
||||
ldr r0, [r4, #0x0]
|
||||
bl MOD05_021E1994
|
||||
_0203BF1C:
|
||||
mov r0, #0x0
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk00A5
|
||||
ScrCmd_Unk00A5: ; 0x0203BF20
|
||||
push {r3, lr}
|
||||
ldr r0, [r0, #0x74]
|
||||
bl FUN_0208A338
|
||||
mov r0, #0x1
|
||||
pop {r3, pc}
|
||||
|
||||
thumb_func_start ScrCmd_Unk00A6
|
||||
ScrCmd_Unk00A6: ; 0x0203BF2C
|
||||
push {r3-r6, lr}
|
||||
sub sp, #0x4
|
||||
add r5, r0, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl GetVarPointer
|
||||
add r6, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl VarGet
|
||||
add r5, #0x80
|
||||
ldr r2, [r5, #0x0]
|
||||
add r1, r6, #0x0
|
||||
str r0, [sp, #0x0]
|
||||
ldr r0, [r2, #0x10]
|
||||
ldr r2, [r2, #0xc]
|
||||
add r3, r4, #0x0
|
||||
bl FUN_020380CC
|
||||
mov r0, #0x1
|
||||
add sp, #0x4
|
||||
pop {r3-r6, pc}
|
||||
.balign 4
|
||||
|
||||
thumb_func_start ScrCmd_Unk00A7
|
||||
ScrCmd_Unk00A7: ; 0x0203BF84
|
||||
push {r3-r7, lr}
|
||||
add r5, r0, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x13
|
||||
bl FieldSysGetAttrAddr
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r7, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl GetVarPointer
|
||||
add r1, r5, #0x0
|
||||
add r1, #0x80
|
||||
add r6, r0, #0x0
|
||||
ldr r1, [r1, #0x0]
|
||||
mov r0, #0xb
|
||||
mov r2, #0x0
|
||||
add r3, r7, #0x0
|
||||
bl FUN_0203BC6C
|
||||
str r0, [r4, #0x0]
|
||||
cmp r0, #0x0
|
||||
bne _0203BFCC
|
||||
mov r0, #0x1
|
||||
strh r0, [r6, #0x0]
|
||||
pop {r3-r7, pc}
|
||||
_0203BFCC:
|
||||
mov r0, #0x0
|
||||
strh r0, [r6, #0x0]
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
ldr r1, [r4, #0x0]
|
||||
bl FUN_02038130
|
||||
ldr r1, _0203BFE8 ; =FUN_0203BB90
|
||||
add r0, r5, #0x0
|
||||
bl SetupNativeScript
|
||||
mov r0, #0x1
|
||||
pop {r3-r7, pc}
|
||||
.balign 4
|
||||
_0203BFE8: .word FUN_0203BB90
|
||||
|
||||
thumb_func_start ScrCmd_Unk00A8
|
||||
ScrCmd_Unk00A8: ; 0x0203BFEC
|
||||
push {r3-r7, lr}
|
||||
add r5, r0, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
mov r1, #0x13
|
||||
bl FieldSysGetAttrAddr
|
||||
add r4, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r7, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
bl ScriptReadHalfword
|
||||
add r1, r0, #0x0
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
bl GetVarPointer
|
||||
add r1, r5, #0x0
|
||||
add r1, #0x80
|
||||
add r6, r0, #0x0
|
||||
ldr r1, [r1, #0x0]
|
||||
mov r0, #0xb
|
||||
mov r2, #0x1
|
||||
add r3, r7, #0x0
|
||||
bl FUN_0203BC6C
|
||||
str r0, [r4, #0x0]
|
||||
cmp r0, #0x0
|
||||
bne _0203C034
|
||||
mov r0, #0x1
|
||||
strh r0, [r6, #0x0]
|
||||
pop {r3-r7, pc}
|
||||
_0203C034:
|
||||
mov r0, #0x0
|
||||
strh r0, [r6, #0x0]
|
||||
add r0, r5, #0x0
|
||||
add r0, #0x80
|
||||
ldr r0, [r0, #0x0]
|
||||
ldr r1, [r4, #0x0]
|
||||
bl FUN_02038130
|
||||
ldr r1, _0203C050 ; =FUN_0203BB90
|
||||
add r0, r5, #0x0
|
||||
bl SetupNativeScript
|
||||
mov r0, #0x1
|
||||
pop {r3-r7, pc}
|
||||
.balign 4
|
||||
_0203C050: .word FUN_0203BB90
|
||||
|
||||
thumb_func_start ScrCmd_Unk012E
|
||||
ScrCmd_Unk012E: ; 0x0203C054
|
||||
push {r4-r6, lr}
|
||||
|
||||
@@ -313,11 +313,11 @@ gScriptCmdTable: ; 0x020F355C
|
||||
.word ScrCmd_RestoreOverworld
|
||||
.word ScrCmd_Unk00A2
|
||||
.word ScrCmd_Unk00A3
|
||||
.word ScrCmd_Unk00A4
|
||||
.word ScrCmd_GetDressupPortraitSlot
|
||||
.word ScrCmd_Unk00A5
|
||||
.word ScrCmd_Unk00A6
|
||||
.word ScrCmd_Unk00A7
|
||||
.word ScrCmd_Unk00A8
|
||||
.word ScrCmd_DressupPokemon
|
||||
.word ScrCmd_ShowDressedPokemon
|
||||
.word ScrCmd_ShowContestPokemon
|
||||
.word ScrCmd_Unk00A9
|
||||
.word ScrCmd_Unk00AA
|
||||
.word ScrCmd_MonStoragePC
|
||||
|
||||
@@ -2829,7 +2829,7 @@
|
||||
.extern ScrCmd_TerminateOverworldProcess
|
||||
.extern ScrCmd_Unk00A2
|
||||
.extern ScrCmd_Unk00A3
|
||||
.extern ScrCmd_Unk00A4
|
||||
.extern ScrCmd_GetDressupPortraitSlot
|
||||
.extern ScrCmd_Unk0207
|
||||
.extern ScrCmd_ShowPokemonPic
|
||||
.extern ScrCmd_ShowPartyPokemonPic
|
||||
@@ -2839,9 +2839,9 @@
|
||||
.extern ScrCmd_Unk020A
|
||||
.extern ScrCmd_Unk020B
|
||||
.extern ScrCmd_Unk00A5
|
||||
.extern ScrCmd_Unk00A6
|
||||
.extern ScrCmd_Unk00A7
|
||||
.extern ScrCmd_Unk00A8
|
||||
.extern ScrCmd_DressupPokemon
|
||||
.extern ScrCmd_ShowDressedPokemon
|
||||
.extern ScrCmd_ShowContestPokemon
|
||||
.extern ScrCmd_Unk012E
|
||||
.extern ScrCmd_Unk012F
|
||||
.extern ScrCmd_Unk0130
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef NITRO_MI_SWAP_H_
|
||||
#define NITRO_MI_SWAP_H_
|
||||
|
||||
#include "nitro/types.h"
|
||||
|
||||
u32 MI_SwapWord(u32 setData, volatile u32 * destp);
|
||||
|
||||
#endif //NITRO_MI_SWAP_H_
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_SND_ALARM_H
|
||||
#define GUARD_SND_ALARM_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "nitro/SND_alarm_shared.h"
|
||||
|
||||
typedef void (*SNDAlarmCallback)(void *);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef GUARD_SND_BANK_H
|
||||
#define GUARD_SND_BANK_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "nitro/types.h"
|
||||
#include "SND_main.h"
|
||||
#include "nitro/SND_bank_shared.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_SND_INTERFACE_H
|
||||
#define GUARD_SND_INTERFACE_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "SND_bank.h"
|
||||
#include "SND_work.h"
|
||||
#include "SND_alarm.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_SND_MAIN_H
|
||||
#define GUARD_SND_MAIN_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
|
||||
#include "nitro/SND_main_shared.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_SND_UTIL_H
|
||||
#define GUARD_SND_UTIL_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
|
||||
void SND_CalcTimer(void);
|
||||
u16 SND_CalcChannelVolume(s32 x);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_SND_WORK_H
|
||||
#define GUARD_SND_WORK_H
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
|
||||
#include "SND_main.h"
|
||||
#include "nitro/SND_work_shared.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H
|
||||
#define POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H
|
||||
#ifndef POKEDIAMOND_ARM9_WIFI_STUBSMD5_DUMMY_H
|
||||
#define POKEDIAMOND_ARM9_WIFI_STUBSMD5_DUMMY_H
|
||||
|
||||
#include "nitro/types.h"
|
||||
#include "dgt.h"
|
||||
@@ -8,4 +8,4 @@ void MD5Final(u8 *digest, struct DGTHash1Context *context);
|
||||
void MD5Update(struct DGTHash1Context *context, u8 *input, u32 length);
|
||||
void MD5Init(struct DGTHash1Context *context);
|
||||
|
||||
#endif //POKEDIAMOND_WIFI_STUBSMD5_DUMMY_H
|
||||
#endif //POKEDIAMOND_ARM9_WIFI_STUBSMD5_DUMMY_H
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "CARD_backup.h"
|
||||
#include "function_target.h"
|
||||
#include "nitro/types.h"
|
||||
#include "CARD_common.h"
|
||||
#include "CARD_request.h"
|
||||
#include "CARD_spi.h"
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "MI_memory.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern void OSi_ReferSymbol(void *symbol);
|
||||
extern char _SDK_NintendoBackup[];
|
||||
@@ -15,7 +16,7 @@ extern CARDiCommon cardi_common;
|
||||
|
||||
static void CARDi_RequestStreamCommandCore(CARDiCommon *p);
|
||||
|
||||
ARM_FUNC static void CARDi_RequestStreamCommandCore(CARDiCommon *p)
|
||||
static void CARDi_RequestStreamCommandCore(CARDiCommon *p)
|
||||
{
|
||||
const int req_type = p->req_type;
|
||||
const int req_mode = p->req_mode;
|
||||
@@ -84,7 +85,7 @@ ARM_FUNC static void CARDi_RequestStreamCommandCore(CARDiCommon *p)
|
||||
CARDi_EndTask(p, TRUE);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARDi_RequestStreamCommand(u32 src, u32 dst, u32 len, MIDmaCallback callback, void *arg, BOOL is_async,
|
||||
BOOL CARDi_RequestStreamCommand(u32 src, u32 dst, u32 len, MIDmaCallback callback, void *arg, BOOL is_async,
|
||||
CARDRequest req_type, int req_retry, CARDRequestMode req_mode)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
@@ -111,12 +112,12 @@ ARM_FUNC BOOL CARDi_RequestStreamCommand(u32 src, u32 dst, u32 len, MIDmaCallbac
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CARD_GetBackupSectorSize(void)
|
||||
u32 CARD_GetBackupSectorSize(void)
|
||||
{
|
||||
return cardi_common.cmd->spec.sect_size;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARD_IdentifyBackup(CARDBackupType type)
|
||||
BOOL CARD_IdentifyBackup(CARDBackupType type)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
@@ -141,17 +142,17 @@ ARM_FUNC BOOL CARD_IdentifyBackup(CARDBackupType type)
|
||||
return (p->cmd->result == CARD_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARD_WaitBackupAsync(void)
|
||||
BOOL CARD_WaitBackupAsync(void)
|
||||
{
|
||||
return CARDi_WaitAsync();
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARD_TryWaitBackupAsync(void)
|
||||
BOOL CARD_TryWaitBackupAsync(void)
|
||||
{
|
||||
return CARDi_TryWaitAsync();
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_CancelBackupAsync(void)
|
||||
void CARD_CancelBackupAsync(void)
|
||||
{
|
||||
OSIntrMode bak_cpsr = OS_DisableInterrupts();
|
||||
cardi_common.flag |= CARD_STAT_CANCEL;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "CARD_common.h"
|
||||
#include "CARD_request.h"
|
||||
#include "consts.h"
|
||||
#include "function_target.h"
|
||||
#include "MI_memory.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "OS_spinLock.h"
|
||||
@@ -9,6 +8,7 @@
|
||||
#include "MB_mb.h"
|
||||
#include "PXI_fifo.h"
|
||||
#include "mmap.h"
|
||||
#include "code32.h"
|
||||
|
||||
CARDiCommon cardi_common ALIGN(32);
|
||||
static CARDiCommandArg cardi_arg ALIGN(32);
|
||||
@@ -18,7 +18,7 @@ u8 cardi_thread_stack[0x400] ALIGN(4);
|
||||
static void CARDi_LockResource(CARDiOwner owner, CARDTargetMode target);
|
||||
static void CARDi_UnlockResource(CARDiOwner owner, CARDTargetMode target);
|
||||
|
||||
ARM_FUNC void CARDi_SetTask(void (*task) (CARDiCommon *))
|
||||
void CARDi_SetTask(void (*task) (CARDiCommon *))
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
@@ -30,7 +30,7 @@ ARM_FUNC void CARDi_SetTask(void (*task) (CARDiCommon *))
|
||||
OS_WakeupThreadDirect(p->thread);
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_LockResource(CARDiOwner owner, CARDTargetMode target)
|
||||
static void CARDi_LockResource(CARDiOwner owner, CARDTargetMode target)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
@@ -55,7 +55,7 @@ ARM_FUNC static void CARDi_LockResource(CARDiOwner owner, CARDTargetMode target)
|
||||
(void)OS_RestoreInterrupts(bak_psr);
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_UnlockResource(CARDiOwner owner, CARDTargetMode target)
|
||||
static void CARDi_UnlockResource(CARDiOwner owner, CARDTargetMode target)
|
||||
{
|
||||
CARDiCommon *p = &cardi_common;
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
@@ -80,7 +80,7 @@ ARM_FUNC static void CARDi_UnlockResource(CARDiOwner owner, CARDTargetMode targe
|
||||
(void)OS_RestoreInterrupts(bak_psr);
|
||||
}
|
||||
|
||||
ARM_FUNC void CARDi_InitCommon(void)
|
||||
void CARDi_InitCommon(void)
|
||||
{
|
||||
CARDiCommon *p = &cardi_common;
|
||||
|
||||
@@ -113,12 +113,12 @@ ARM_FUNC void CARDi_InitCommon(void)
|
||||
|
||||
static BOOL CARDi_EnableFlag = FALSE;
|
||||
|
||||
ARM_FUNC BOOL CARD_IsEnabled(void)
|
||||
BOOL CARD_IsEnabled(void)
|
||||
{
|
||||
return CARDi_EnableFlag;
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_CheckEnabled(void)
|
||||
void CARD_CheckEnabled(void)
|
||||
{
|
||||
if (!CARD_IsEnabled())
|
||||
{
|
||||
@@ -126,12 +126,12 @@ ARM_FUNC void CARD_CheckEnabled(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_Enable(BOOL enable)
|
||||
void CARD_Enable(BOOL enable)
|
||||
{
|
||||
CARDi_EnableFlag = enable;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARDi_WaitAsync(void)
|
||||
BOOL CARDi_WaitAsync(void)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
@@ -144,38 +144,38 @@ ARM_FUNC BOOL CARDi_WaitAsync(void)
|
||||
return (p->cmd->result == CARD_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARDi_TryWaitAsync(void)
|
||||
BOOL CARDi_TryWaitAsync(void)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
return !(p->flag & CARD_STAT_BUSY);
|
||||
}
|
||||
|
||||
ARM_FUNC CARDResult CARD_GetResultCode(void)
|
||||
CARDResult CARD_GetResultCode(void)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
return p->cmd->result;
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_LockRom(u16 lock_id)
|
||||
void CARD_LockRom(u16 lock_id)
|
||||
{
|
||||
CARDi_LockResource(lock_id, CARD_TARGET_ROM);
|
||||
(void)OS_TryLockCard(lock_id);
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_UnlockRom(u16 lock_id)
|
||||
void CARD_UnlockRom(u16 lock_id)
|
||||
{
|
||||
(void)OS_UnlockCard(lock_id);
|
||||
CARDi_UnlockResource(lock_id, CARD_TARGET_ROM);
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_LockBackup(u16 lock_id)
|
||||
void CARD_LockBackup(u16 lock_id)
|
||||
{
|
||||
CARDi_LockResource(lock_id, CARD_TARGET_BACKUP);
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_UnlockBackup(u16 lock_id)
|
||||
void CARD_UnlockBackup(u16 lock_id)
|
||||
{
|
||||
CARDi_UnlockResource(lock_id, CARD_TARGET_BACKUP);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "function_target.h"
|
||||
#include "CARD_common.h"
|
||||
#include "CARD_pullOut.h"
|
||||
#include "PXI_init.h"
|
||||
@@ -9,6 +8,7 @@
|
||||
#include "SPI_pm.h"
|
||||
#include "syscall.h"
|
||||
#include "mmap.h"
|
||||
#include "code32.h"
|
||||
|
||||
static CARDPulledOutCallback CARD_UserCallback;
|
||||
static BOOL CARDi_IsPulledOutFlag = FALSE;
|
||||
@@ -16,7 +16,7 @@ static BOOL CARDi_IsPulledOutFlag = FALSE;
|
||||
static void CARDi_PulledOutCallback(PXIFifoTag tag, u32 data, BOOL err);
|
||||
static void CARDi_SendtoPxi(u32 data, u32 wait);
|
||||
|
||||
ARM_FUNC void CARD_InitPulledOutCallback(void)
|
||||
void CARD_InitPulledOutCallback(void)
|
||||
{
|
||||
PXI_Init();
|
||||
|
||||
@@ -25,7 +25,7 @@ ARM_FUNC void CARD_InitPulledOutCallback(void)
|
||||
CARD_UserCallback = NULL;
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_PulledOutCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
static void CARDi_PulledOutCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
{
|
||||
#pragma unused(tag, err)
|
||||
u32 command = data & CARD_PXI_COMMAND_MASK;
|
||||
@@ -54,12 +54,12 @@ ARM_FUNC static void CARDi_PulledOutCallback(PXIFifoTag tag, u32 data, BOOL err)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARD_IsPulledOut(void)
|
||||
BOOL CARD_IsPulledOut(void)
|
||||
{
|
||||
return CARDi_IsPulledOutFlag;
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_TerminateForPulledOut(void)
|
||||
void CARD_TerminateForPulledOut(void)
|
||||
{
|
||||
BOOL should_be_halt = TRUE;
|
||||
|
||||
@@ -84,7 +84,7 @@ ARM_FUNC void CARD_TerminateForPulledOut(void)
|
||||
OS_Terminate();
|
||||
}
|
||||
|
||||
ARM_FUNC void CARDi_CheckPulledOutCore(u32 id)
|
||||
void CARDi_CheckPulledOutCore(u32 id)
|
||||
{
|
||||
vu32 iplCardID = *(vu32 *)((*(u16 *)HW_CHECK_DEBUGGER_SW == 0) ? HW_RED_RESERVED : HW_BOOT_CHECK_INFO_BUF);
|
||||
|
||||
@@ -96,7 +96,7 @@ ARM_FUNC void CARDi_CheckPulledOutCore(u32 id)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_SendtoPxi(u32 data, u32 wait)
|
||||
static void CARDi_SendtoPxi(u32 data, u32 wait)
|
||||
{
|
||||
while (PXI_SendWordByFifo(PXI_FIFO_TAG_CARD, data, FALSE) != PXI_FIFO_SUCCESS)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "function_target.h"
|
||||
#include "CARD_request.h"
|
||||
#include "OS_cache.h"
|
||||
#include "OS_system.h"
|
||||
#include "OS_thread.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern CARDiCommon cardi_common;
|
||||
|
||||
ARM_FUNC void CARDi_OnFifoRecv(PXIFifoTag tag, u32 data, BOOL err)
|
||||
void CARDi_OnFifoRecv(PXIFifoTag tag, u32 data, BOOL err)
|
||||
{
|
||||
#pragma unused (data)
|
||||
if ((tag == PXI_FIFO_TAG_FS) && err)
|
||||
@@ -17,7 +17,7 @@ ARM_FUNC void CARDi_OnFifoRecv(PXIFifoTag tag, u32 data, BOOL err)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void CARDi_TaskThread(void *arg)
|
||||
void CARDi_TaskThread(void *arg)
|
||||
{
|
||||
#pragma unused (arg)
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
@@ -35,7 +35,7 @@ ARM_FUNC void CARDi_TaskThread(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARDi_Request(CARDiCommon *p, s32 req_type, s32 retry_count)
|
||||
BOOL CARDi_Request(CARDiCommon *p, s32 req_type, s32 retry_count)
|
||||
{
|
||||
if ((p->flag & CARD_STAT_INIT_CMD) == 0)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "function_target.h"
|
||||
#include "nitro/types.h"
|
||||
#include "CARD_pullOut.h"
|
||||
#include "CARD_rom.h"
|
||||
@@ -6,6 +5,7 @@
|
||||
#include "MI_memory.h"
|
||||
#include "OS_cache.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u32 cardi_rom_base;
|
||||
u32 cardi_rom_base;
|
||||
@@ -29,7 +29,7 @@ static inline BOOL CARDi_OnReadPageDirect(CARDRomStat *arg)
|
||||
return (p->len > 0);
|
||||
}
|
||||
|
||||
ARM_FUNC static BOOL CARDi_ReadFromCache(CARDRomStat *p)
|
||||
static BOOL CARDi_ReadFromCache(CARDRomStat *p)
|
||||
{
|
||||
CARDiCommon *c = &cardi_common;
|
||||
const u32 cur_page = CARD_ALIGN_HI_BIT(c->src);
|
||||
@@ -49,7 +49,7 @@ ARM_FUNC static BOOL CARDi_ReadFromCache(CARDRomStat *p)
|
||||
return (c->len > 0);
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_SetRomOp(u32 cmd1, u32 cmd2)
|
||||
static void CARDi_SetRomOp(u32 cmd1, u32 cmd2)
|
||||
{
|
||||
while ((reg_CARD_CNT & CARD_START) != 0) {}
|
||||
|
||||
@@ -72,7 +72,7 @@ static inline void CARDi_SetRomOpReadPage1(u32 src)
|
||||
CARDi_SetRomOp((u32)(MROMOP_G_READ_PAGE | (src >> 8)), (u32)(src << 24));
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_SetCardDma(void)
|
||||
static void CARDi_SetCardDma(void)
|
||||
{
|
||||
CARDiCommon *const c = &cardi_common;
|
||||
CARDRomStat *const p = &rom_stat;
|
||||
@@ -81,7 +81,7 @@ ARM_FUNC static void CARDi_SetCardDma(void)
|
||||
reg_CARD_CNT = p->ctrl;
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_OnReadCard(void)
|
||||
static void CARDi_OnReadCard(void)
|
||||
{
|
||||
CARDRomStat *const p = &rom_stat;
|
||||
CARDiCommon *const c = &cardi_common;
|
||||
@@ -98,7 +98,7 @@ ARM_FUNC static void CARDi_OnReadCard(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CARDi_TryReadCardDma(CARDRomStat *p)
|
||||
BOOL CARDi_TryReadCardDma(CARDRomStat *p)
|
||||
{
|
||||
CARDiCommon *const c = &cardi_common;
|
||||
const u32 dst = c->dst;
|
||||
@@ -135,7 +135,7 @@ ARM_FUNC BOOL CARDi_TryReadCardDma(CARDRomStat *p)
|
||||
return is_async;
|
||||
}
|
||||
|
||||
ARM_FUNC void CARDi_ReadCard(CARDRomStat *p)
|
||||
void CARDi_ReadCard(CARDRomStat *p)
|
||||
{
|
||||
CARDiCommon *const c = &cardi_common;
|
||||
while (TRUE)
|
||||
@@ -191,7 +191,7 @@ ARM_FUNC void CARDi_ReadCard(CARDRomStat *p)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CARDi_ReadRomIDCore(void)
|
||||
u32 CARDi_ReadRomIDCore(void)
|
||||
{
|
||||
CARDi_SetRomOp(MROMOP_G_READ_ID, 0);
|
||||
reg_CARD_CNT = (u32)(CARDi_GetRomFlag(CARD_COMMAND_ID) & ~CARD_LATENCY1_MASK);
|
||||
@@ -199,7 +199,7 @@ ARM_FUNC u32 CARDi_ReadRomIDCore(void)
|
||||
return reg_CARD_DATA;
|
||||
}
|
||||
|
||||
ARM_FUNC static void CARDi_ReadRomSyncCore(CARDiCommon *c)
|
||||
static void CARDi_ReadRomSyncCore(CARDiCommon *c)
|
||||
{
|
||||
#pragma unused(c)
|
||||
CARDRomStat *const p = &rom_stat;
|
||||
@@ -211,7 +211,7 @@ ARM_FUNC static void CARDi_ReadRomSyncCore(CARDiCommon *c)
|
||||
CARDi_ReadEnd();
|
||||
}
|
||||
|
||||
ARM_FUNC void CARDi_ReadRom(u32 dma, const void *src, void *dst, u32 len, MIDmaCallback callback, void *arg, BOOL is_async)
|
||||
void CARDi_ReadRom(u32 dma, const void *src, void *dst, u32 len, MIDmaCallback callback, void *arg, BOOL is_async)
|
||||
{
|
||||
CARDRomStat *const p = &rom_stat;
|
||||
CARDiCommon *const c = &cardi_common;
|
||||
@@ -247,7 +247,7 @@ ARM_FUNC void CARDi_ReadRom(u32 dma, const void *src, void *dst, u32 len, MIDmaC
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_Init(void)
|
||||
void CARD_Init(void)
|
||||
{
|
||||
CARDiCommon *const p = &cardi_common;
|
||||
|
||||
@@ -269,12 +269,12 @@ ARM_FUNC void CARD_Init(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void CARD_WaitRomAsync(void)
|
||||
void CARD_WaitRomAsync(void)
|
||||
{
|
||||
(void)CARDi_WaitAsync();
|
||||
}
|
||||
|
||||
ARM_FUNC void (*CARDi_GetRomAccessor(void)) (CARDRomStat *)
|
||||
void (*CARDi_GetRomAccessor(void)) (CARDRomStat *)
|
||||
{
|
||||
return CARDi_ReadCard;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "function_target.h"
|
||||
#include "nitro/types.h"
|
||||
#include "CARD_common.h"
|
||||
#include "CARD_spi.h"
|
||||
#include "MI_memory.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern CARDiCommon cardi_common;
|
||||
|
||||
ARM_FUNC void CARDi_IdentifyBackupCore(CARDBackupType type)
|
||||
void CARDi_IdentifyBackupCore(CARDBackupType type)
|
||||
{
|
||||
CARDiCommandArg *const p = cardi_common.cmd;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "CP_context.h"
|
||||
#include "function_target.h"
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void CP_SaveContext(register CPContext *context)
|
||||
asm void CP_SaveContext(register CPContext *context)
|
||||
{
|
||||
ldr r1, =REG_DIV_NUMER_ADDR
|
||||
stmfd sp!, {r4}
|
||||
@@ -24,7 +24,7 @@ ARM_FUNC asm void CP_SaveContext(register CPContext *context)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void CPi_RestoreContext(register const CPContext *context)
|
||||
asm void CPi_RestoreContext(register const CPContext *context)
|
||||
{
|
||||
stmfd sp!, {r4}
|
||||
ldr r1, =REG_DIV_NUMER_ADDR
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CTRDG_backup.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_spinLock.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u16 ctrdgi_flash_lock_id;
|
||||
extern u16 ctrdgi_sram_lock_id;
|
||||
@@ -33,7 +33,7 @@ static const u16 readidtime[] = {
|
||||
20
|
||||
};
|
||||
|
||||
ARM_FUNC u16 CTRDG_IdentifyAgbBackup(CTRDGBackupType type)
|
||||
u16 CTRDG_IdentifyAgbBackup(CTRDGBackupType type)
|
||||
{
|
||||
u16 result = 1;
|
||||
u16 flashID;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "CTRDG_common.h"
|
||||
#include "function_target.h"
|
||||
#include "syscall.h"
|
||||
#include "OS_cache.h"
|
||||
#include "OS_protectionRegion.h"
|
||||
@@ -8,36 +7,37 @@
|
||||
#include "MI_dma.h"
|
||||
#include "MI_memory.h"
|
||||
#include "mmap.h"
|
||||
#include "code32.h"
|
||||
|
||||
CTRDGWork CTRDGi_Work;
|
||||
|
||||
static BOOL CTRDGi_EnableFlag = FALSE;
|
||||
|
||||
ARM_FUNC void CTRDGi_InitCommon(void)
|
||||
void CTRDGi_InitCommon(void)
|
||||
{
|
||||
SVC_CpuClear(0, &CTRDGi_Work, sizeof(CTRDGi_Work), 32);
|
||||
|
||||
CTRDGi_Work.lockID = (u16)OS_GetLockID();
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_IsAgbCartridge(void)
|
||||
BOOL CTRDG_IsAgbCartridge(void)
|
||||
{
|
||||
return (CTRDG_IsExisting() && CTRDGi_IsAgbCartridgeAtInit());
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_IsOptionCartridge(void)
|
||||
BOOL CTRDG_IsOptionCartridge(void)
|
||||
{
|
||||
return (CTRDG_IsExisting() && !CTRDGi_IsAgbCartridgeAtInit());
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDGi_IsAgbCartridgeAtInit(void)
|
||||
BOOL CTRDGi_IsAgbCartridgeAtInit(void)
|
||||
{
|
||||
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
|
||||
|
||||
return cip->isAgbCartridge;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDG_GetAgbGameCode(void)
|
||||
u32 CTRDG_GetAgbGameCode(void)
|
||||
{
|
||||
u32 ret = 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ ARM_FUNC u32 CTRDG_GetAgbGameCode(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDGi_GetAgbGameCodeAtInit(void)
|
||||
u32 CTRDGi_GetAgbGameCodeAtInit(void)
|
||||
{
|
||||
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
|
||||
u32 ret = 0;
|
||||
@@ -62,7 +62,7 @@ ARM_FUNC u32 CTRDGi_GetAgbGameCodeAtInit(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDG_GetAgbMakerCode(void)
|
||||
u16 CTRDG_GetAgbMakerCode(void)
|
||||
{
|
||||
u16 ret = 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ ARM_FUNC u16 CTRDG_GetAgbMakerCode(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_GetAgbMakerCodeAtInit(void)
|
||||
u16 CTRDGi_GetAgbMakerCodeAtInit(void)
|
||||
{
|
||||
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
|
||||
u16 ret = 0;
|
||||
@@ -87,7 +87,7 @@ ARM_FUNC u16 CTRDGi_GetAgbMakerCodeAtInit(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_IsPulledOut(void)
|
||||
BOOL CTRDG_IsPulledOut(void)
|
||||
{
|
||||
CTRDGModuleInfo *cip = CTRDGi_GetModuleInfoAddr();
|
||||
|
||||
@@ -104,7 +104,7 @@ ARM_FUNC BOOL CTRDG_IsPulledOut(void)
|
||||
return cip->detectPullOut;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_IsExisting(void)
|
||||
BOOL CTRDG_IsExisting(void)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
CTRDGLockByProc lockInfo;
|
||||
@@ -144,7 +144,7 @@ ARM_FUNC BOOL CTRDG_IsExisting(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_ChangeLatestAccessCycle(CTRDGRomCycle *r)
|
||||
void CTRDGi_ChangeLatestAccessCycle(CTRDGRomCycle *r)
|
||||
{
|
||||
r->c1 = MI_GetCartridgeRomCycle1st();
|
||||
r->c2 = MI_GetCartridgeRomCycle2nd();
|
||||
@@ -153,13 +153,13 @@ ARM_FUNC void CTRDGi_ChangeLatestAccessCycle(CTRDGRomCycle *r)
|
||||
MI_SetCartridgeRomCycle2nd(MI_CTRDG_ROMCYCLE2_6);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_RestoreAccessCycle(CTRDGRomCycle *r)
|
||||
void CTRDGi_RestoreAccessCycle(CTRDGRomCycle *r)
|
||||
{
|
||||
MI_SetCartridgeRomCycle1st(r->c1);
|
||||
MI_SetCartridgeRomCycle2nd(r->c2);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_LockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
void CTRDGi_LockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ ARM_FUNC void CTRDGi_LockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_UnlockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
void CTRDGi_UnlockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
{
|
||||
if (!info->locked)
|
||||
{
|
||||
@@ -185,7 +185,7 @@ ARM_FUNC void CTRDGi_UnlockByProcessor(u16 lockID, CTRDGLockByProc *info)
|
||||
(void)OS_RestoreInterrupts(info->irq);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_SendtoPxi(u32 data)
|
||||
void CTRDGi_SendtoPxi(u32 data)
|
||||
{
|
||||
while (PXI_SendWordByFifo(PXI_FIFO_TAG_CTRDG, data, FALSE) != PXI_FIFO_SUCCESS)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ ARM_FUNC void CTRDGi_SendtoPxi(u32 data)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_CpuCopy8(const void *src, void *dest, u32 size)
|
||||
BOOL CTRDG_CpuCopy8(const void *src, void *dest, u32 size)
|
||||
{
|
||||
if (HW_CTRDG_ROM <= (u32)dest && (u32)dest < HW_CTRDG_RAM_END)
|
||||
{
|
||||
@@ -205,17 +205,17 @@ ARM_FUNC BOOL CTRDG_CpuCopy8(const void *src, void *dest, u32 size)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_CpuCopy16(const void *src, void *dest, u32 size)
|
||||
BOOL CTRDG_CpuCopy16(const void *src, void *dest, u32 size)
|
||||
{
|
||||
return CTRDGi_CopyCommon(0, src, dest, size, CTRDGi_FORWARD_CPU16);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_CpuCopy32(const void *src, void *dest, u32 size)
|
||||
BOOL CTRDG_CpuCopy32(const void *src, void *dest, u32 size)
|
||||
{
|
||||
return CTRDGi_CopyCommon(0, src, dest, size, CTRDGi_FORWARD_CPU32);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDGi_CopyCommon(u32 dmaNo, const void *src, void *dest, u32 size, u32 forwardType)
|
||||
BOOL CTRDGi_CopyCommon(u32 dmaNo, const void *src, void *dest, u32 size, u32 forwardType)
|
||||
{
|
||||
if (!CTRDG_IsExisting())
|
||||
{
|
||||
@@ -267,12 +267,12 @@ ARM_FUNC BOOL CTRDGi_CopyCommon(u32 dmaNo, const void *src, void *dest, u32 size
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_Read32(const u32 *address, u32 *rdata)
|
||||
BOOL CTRDG_Read32(const u32 *address, u32 *rdata)
|
||||
{
|
||||
return CTRDGi_AccessCommon((void *)address, 0, rdata, CTRDGi_ACCESS_READ32);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDGi_AccessCommon(void *address, u32 data, void *rdata, u32 accessType)
|
||||
BOOL CTRDGi_AccessCommon(void *address, u32 data, void *rdata, u32 accessType)
|
||||
{
|
||||
if (!CTRDG_IsExisting())
|
||||
{
|
||||
@@ -324,12 +324,12 @@ ARM_FUNC BOOL CTRDGi_AccessCommon(void *address, u32 data, void *rdata, u32 acce
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL CTRDG_IsEnabled(void)
|
||||
BOOL CTRDG_IsEnabled(void)
|
||||
{
|
||||
return CTRDGi_EnableFlag;
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDG_Enable(BOOL enable)
|
||||
void CTRDG_Enable(BOOL enable)
|
||||
{
|
||||
OSIntrMode bak_cpsr = OS_DisableInterrupts();
|
||||
CTRDGi_EnableFlag = enable;
|
||||
@@ -341,7 +341,7 @@ ARM_FUNC void CTRDG_Enable(BOOL enable)
|
||||
(void)OS_RestoreInterrupts(bak_cpsr);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDG_CheckEnabled(void)
|
||||
void CTRDG_CheckEnabled(void)
|
||||
{
|
||||
if (!CTRDG_IsOptionCartridge() && !CTRDG_IsEnabled())
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "CTRDG_flash_AT29LV512.h"
|
||||
#include "function_target.h"
|
||||
#include "CTRDG_backup.h"
|
||||
#include "CTRDG_flash.h"
|
||||
#include "MI_exMemory.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_spinLock.h"
|
||||
#include "code32.h"
|
||||
|
||||
#define CTRDG_BACKUP_COM_ADR1 (CTRDG_AGB_FLASH_ADR+0x00005555)
|
||||
#define CTRDG_BACKUP_COM_ADR2 (CTRDG_AGB_FLASH_ADR+0x00002aaa)
|
||||
@@ -25,42 +25,52 @@ static const u16 atMaxTime[] = {
|
||||
};
|
||||
|
||||
const CTRDGiFlashTypePlus AT29LV512_lib = {
|
||||
CTRDGi_WriteFlash4KBAT,
|
||||
CTRDGi_EraseFlashChipAT,
|
||||
CTRDGi_EraseFlash4KBAT,
|
||||
CTRDGi_WriteFlash4KBAsyncAT,
|
||||
CTRDGi_EraseFlashChipAsyncAT,
|
||||
CTRDGi_EraseFlash4KBAsyncAT,
|
||||
CTRDGi_PollingSR512kCOMMON,
|
||||
atMaxTime,
|
||||
{
|
||||
0x00010000, //ROM size
|
||||
{0x00001000, 12, 16, 0}, //sector
|
||||
{MI_CTRDG_RAMCYCLE_18, MI_CTRDG_RAMCYCLE_18}, //read cycle and write cycle
|
||||
0x1f, //maker ID
|
||||
0x3d, //device ID
|
||||
.CTRDGi_WriteAgbFlashSector = CTRDGi_WriteFlash4KBAT,
|
||||
.CTRDGi_EraseAgbFlashChip = CTRDGi_EraseFlashChipAT,
|
||||
.CTRDGi_EraseAgbFlashSector = CTRDGi_EraseFlash4KBAT,
|
||||
.CTRDGi_WriteAgbFlashSectorAsync = CTRDGi_WriteFlash4KBAsyncAT,
|
||||
.CTRDGi_EraseAgbFlashChipAsync = CTRDGi_EraseFlashChipAsyncAT,
|
||||
.CTRDGi_EraseAgbFlashSectorAsync = CTRDGi_EraseFlash4KBAsyncAT,
|
||||
.CTRDGi_PollingSR = CTRDGi_PollingSR512kCOMMON,
|
||||
.maxtime = atMaxTime,
|
||||
.type = {
|
||||
.romSize = 0x00010000,
|
||||
.sector = {
|
||||
.size = 0x00001000,
|
||||
.shift = 12,
|
||||
.count = 16,
|
||||
.top = 0
|
||||
},
|
||||
.agbWait = {MI_CTRDG_RAMCYCLE_18, MI_CTRDG_RAMCYCLE_18}, //read cycle and write cycle
|
||||
.makerID = 0x1f,
|
||||
.deviceID = 0x3d,
|
||||
}
|
||||
};
|
||||
|
||||
const CTRDGiFlashTypePlus AT29LV512_org = {
|
||||
CTRDGi_WriteFlashSectorAT,
|
||||
CTRDGi_EraseFlashChipAT,
|
||||
CTRDGi_EraseFlashSectorAT,
|
||||
CTRDGi_WriteFlashSectorAsyncAT,
|
||||
CTRDGi_EraseFlashChipAsyncAT,
|
||||
CTRDGi_EraseFlashSectorAsyncAT,
|
||||
CTRDGi_PollingSR512kCOMMON,
|
||||
atMaxTime,
|
||||
{
|
||||
0x00010000, //ROM size
|
||||
{0x00000080, 7, 512, 0}, //sector
|
||||
{MI_CTRDG_RAMCYCLE_18, MI_CTRDG_RAMCYCLE_18}, //read cycle and write cycle
|
||||
0x1f, //maker ID
|
||||
0x3d, //device ID
|
||||
.CTRDGi_WriteAgbFlashSector = CTRDGi_WriteFlashSectorAT,
|
||||
.CTRDGi_EraseAgbFlashChip = CTRDGi_EraseFlashChipAT,
|
||||
.CTRDGi_EraseAgbFlashSector = CTRDGi_EraseFlashSectorAT,
|
||||
.CTRDGi_WriteAgbFlashSectorAsync = CTRDGi_WriteFlashSectorAsyncAT,
|
||||
.CTRDGi_EraseAgbFlashChipAsync = CTRDGi_EraseFlashChipAsyncAT,
|
||||
.CTRDGi_EraseAgbFlashSectorAsync = CTRDGi_EraseFlashSectorAsyncAT,
|
||||
.CTRDGi_PollingSR = CTRDGi_PollingSR512kCOMMON,
|
||||
.maxtime = atMaxTime,
|
||||
.type = {
|
||||
.romSize = 0x00010000,
|
||||
.sector = {
|
||||
.size = 0x00000080,
|
||||
.shift = 7,
|
||||
.count = 512,
|
||||
.top = 0
|
||||
},
|
||||
.agbWait = {MI_CTRDG_RAMCYCLE_18, MI_CTRDG_RAMCYCLE_18}, //read cycle and write cycle
|
||||
.makerID = 0x1f,
|
||||
.deviceID = 0x3d,
|
||||
}
|
||||
};
|
||||
|
||||
ARM_FUNC u32 CTRDGi_EraseFlashChipCoreAT(CTRDGTaskInfo *arg)
|
||||
u32 CTRDGi_EraseFlashChipCoreAT(CTRDGTaskInfo *arg)
|
||||
{
|
||||
MICartridgeRamCycle ram_cycle;
|
||||
u32 result;
|
||||
@@ -91,7 +101,7 @@ ARM_FUNC u32 CTRDGi_EraseFlashChipCoreAT(CTRDGTaskInfo *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDGi_EraseFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
u32 CTRDGi_EraseFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
{
|
||||
u32 i;
|
||||
u8 *dst;
|
||||
@@ -136,7 +146,7 @@ ARM_FUNC u32 CTRDGi_EraseFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDGi_EraseFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
u32 CTRDGi_EraseFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
{
|
||||
u32 result;
|
||||
u16 i, p_secNo, retry;
|
||||
@@ -169,7 +179,7 @@ ARM_FUNC u32 CTRDGi_EraseFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDGi_WriteFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
u32 CTRDGi_WriteFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
{
|
||||
u32 i;
|
||||
u8 *dst;
|
||||
@@ -211,7 +221,7 @@ ARM_FUNC u32 CTRDGi_WriteFlashSectorCoreAT(CTRDGTaskInfo *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 CTRDGi_WriteFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
u32 CTRDGi_WriteFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
{
|
||||
u32 result;
|
||||
u16 p_secNo, retry;
|
||||
@@ -248,20 +258,20 @@ ARM_FUNC u32 CTRDGi_WriteFlash4KBCoreAT(CTRDGTaskInfo *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_EraseFlashChipAT(void)
|
||||
u16 CTRDGi_EraseFlashChipAT(void)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
return (u16)CTRDGi_EraseFlashChipCoreAT(&p);
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_EraseFlash4KBAT(u16 l_secNo)
|
||||
u16 CTRDGi_EraseFlash4KBAT(u16 l_secNo)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
p.sec_num = l_secNo;
|
||||
return (u16)CTRDGi_EraseFlash4KBCoreAT(&p);
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_WriteFlash4KBAT(u16 l_secNo, u8 *src)
|
||||
u16 CTRDGi_WriteFlash4KBAT(u16 l_secNo, u8 *src)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
p.sec_num = l_secNo;
|
||||
@@ -269,14 +279,14 @@ ARM_FUNC u16 CTRDGi_WriteFlash4KBAT(u16 l_secNo, u8 *src)
|
||||
return (u16)CTRDGi_WriteFlash4KBCoreAT(&p);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_EraseFlashChipAsyncAT(CTRDG_TASK_FUNC callback)
|
||||
void CTRDGi_EraseFlashChipAsyncAT(CTRDG_TASK_FUNC callback)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
CTRDGi_SetTask(&p, CTRDGi_EraseFlashChipCoreAT, callback);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_EraseFlash4KBAsyncAT(u16 l_secNo, CTRDG_TASK_FUNC callback)
|
||||
void CTRDGi_EraseFlash4KBAsyncAT(u16 l_secNo, CTRDG_TASK_FUNC callback)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
@@ -284,7 +294,7 @@ ARM_FUNC void CTRDGi_EraseFlash4KBAsyncAT(u16 l_secNo, CTRDG_TASK_FUNC callback)
|
||||
CTRDGi_SetTask(&p, CTRDGi_EraseFlash4KBCoreAT, callback);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_WriteFlash4KBAsyncAT(u16 l_secNo, u8 *src, CTRDG_TASK_FUNC callback)
|
||||
void CTRDGi_WriteFlash4KBAsyncAT(u16 l_secNo, u8 *src, CTRDG_TASK_FUNC callback)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
@@ -293,14 +303,14 @@ ARM_FUNC void CTRDGi_WriteFlash4KBAsyncAT(u16 l_secNo, u8 *src, CTRDG_TASK_FUNC
|
||||
CTRDGi_SetTask(&p, CTRDGi_WriteFlash4KBCoreAT, callback);
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_EraseFlashSectorAT(u16 p_secNo)
|
||||
u16 CTRDGi_EraseFlashSectorAT(u16 p_secNo)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
p.sec_num = p_secNo;
|
||||
return (u16)CTRDGi_EraseFlashSectorCoreAT(&p);
|
||||
}
|
||||
|
||||
ARM_FUNC u16 CTRDGi_WriteFlashSectorAT(u16 p_secNo, u8 *src)
|
||||
u16 CTRDGi_WriteFlashSectorAT(u16 p_secNo, u8 *src)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
@@ -309,7 +319,7 @@ ARM_FUNC u16 CTRDGi_WriteFlashSectorAT(u16 p_secNo, u8 *src)
|
||||
return (u16)CTRDGi_WriteFlashSectorCoreAT(&p);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_EraseFlashSectorAsyncAT(u16 p_secNo, CTRDG_TASK_FUNC callback)
|
||||
void CTRDGi_EraseFlashSectorAsyncAT(u16 p_secNo, CTRDG_TASK_FUNC callback)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
@@ -317,7 +327,7 @@ ARM_FUNC void CTRDGi_EraseFlashSectorAsyncAT(u16 p_secNo, CTRDG_TASK_FUNC callba
|
||||
CTRDGi_SetTask(&p, CTRDGi_EraseFlashSectorCoreAT, callback);
|
||||
}
|
||||
|
||||
ARM_FUNC void CTRDGi_WriteFlashSectorAsyncAT(u16 p_secNo, u8 *src, CTRDG_TASK_FUNC callback)
|
||||
void CTRDGi_WriteFlashSectorAsyncAT(u16 p_secNo, u8 *src, CTRDG_TASK_FUNC callback)
|
||||
{
|
||||
CTRDGTaskInfo p;
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
#include "MI_memory.h"
|
||||
#include "MI_byteAccess.h"
|
||||
#include "OS_printf.h"
|
||||
#include "code32.h"
|
||||
|
||||
FSArchive * arc_list = NULL;
|
||||
FSDirPos current_dir_pos;
|
||||
|
||||
ARM_FUNC u32 FSi_GetPackedName(const char * name, int name_len)
|
||||
u32 FSi_GetPackedName(const char * name, int name_len)
|
||||
{
|
||||
u32 ret = 0;
|
||||
if (name_len <= FS_ARCHIVE_NAME_LEN_MAX)
|
||||
@@ -30,26 +31,26 @@ ARM_FUNC u32 FSi_GetPackedName(const char * name, int name_len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadMemCallback(struct FSArchive * p_arc, void * dest, u32 pos, u32 size)
|
||||
FSResult FSi_ReadMemCallback(struct FSArchive * p_arc, void * dest, u32 pos, u32 size)
|
||||
{
|
||||
MI_CpuCopy8((const void *)FS_GetArchiveOffset(p_arc, pos), dest, size);
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_WriteMemCallback(struct FSArchive * p_arc, const void * src, u32 pos, u32 size)
|
||||
FSResult FSi_WriteMemCallback(struct FSArchive * p_arc, const void * src, u32 pos, u32 size)
|
||||
{
|
||||
MI_CpuCopy8(src, (void *)FS_GetArchiveOffset(p_arc, pos), size);
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadMemoryCore(FSArchive * p_arc, void * dest, u32 pos, u32 size)
|
||||
FSResult FSi_ReadMemoryCore(FSArchive * p_arc, void * dest, u32 pos, u32 size)
|
||||
{
|
||||
#pragma unused(p_arc)
|
||||
MI_CpuCopy8((const void *)pos, dest, size);
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSFile * FSi_NextCommand(FSArchive * p_arc)
|
||||
FSFile * FSi_NextCommand(FSArchive * p_arc)
|
||||
{
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
if (FSi_IsArchiveCanceling(p_arc))
|
||||
@@ -116,7 +117,7 @@ ARM_FUNC FSFile * FSi_NextCommand(FSArchive * p_arc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ARM_FUNC void FSi_ExecuteAsyncCommand(FSFile * p_file)
|
||||
void FSi_ExecuteAsyncCommand(FSFile * p_file)
|
||||
{
|
||||
FSArchive *const p_arc = p_file->arc;
|
||||
while (p_file)
|
||||
@@ -137,7 +138,7 @@ ARM_FUNC void FSi_ExecuteAsyncCommand(FSFile * p_file)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FSi_ExecuteSyncCommand(FSFile * p_file)
|
||||
BOOL FSi_ExecuteSyncCommand(FSFile * p_file)
|
||||
{
|
||||
FSFile * p_target;
|
||||
FSResult ret = FSi_TranslateCommand(p_file, p_file->command);
|
||||
@@ -148,7 +149,7 @@ ARM_FUNC BOOL FSi_ExecuteSyncCommand(FSFile * p_file)
|
||||
return FS_IsSucceeded(p_file);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FSi_SendCommand(FSFile * p_file, FSCommandType command)
|
||||
BOOL FSi_SendCommand(FSFile * p_file, FSCommandType command)
|
||||
{
|
||||
FSArchive * p_arc = p_file->arc;
|
||||
const int bit = 1 << command;
|
||||
@@ -199,14 +200,14 @@ ARM_FUNC BOOL FSi_SendCommand(FSFile * p_file, FSCommandType command)
|
||||
return FSi_ExecuteSyncCommand(p_file);
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_InitArchive(FSArchive * p_arc)
|
||||
void FS_InitArchive(FSArchive * p_arc)
|
||||
{
|
||||
MI_CpuClear8(p_arc, sizeof(FSArchive));
|
||||
p_arc->sync_q.head = p_arc->sync_q.tail = NULL;
|
||||
p_arc->stat_q.head = p_arc->stat_q.tail = NULL;
|
||||
}
|
||||
|
||||
ARM_FUNC FSArchive * const FS_FindArchive(const char * name, int name_len)
|
||||
FSArchive * const FS_FindArchive(const char * name, int name_len)
|
||||
{
|
||||
u32 pack = FSi_GetPackedName(name, name_len);
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
@@ -217,7 +218,7 @@ ARM_FUNC FSArchive * const FS_FindArchive(const char * name, int name_len)
|
||||
return p_arc;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_RegisterArchiveName(FSArchive * p_arc, const char * name, int name_len)
|
||||
BOOL FS_RegisterArchiveName(FSArchive * p_arc, const char * name, int name_len)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
@@ -247,7 +248,7 @@ ARM_FUNC BOOL FS_RegisterArchiveName(FSArchive * p_arc, const char * name, int n
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_ReleaseArchiveName(FSArchive * p_arc)
|
||||
void FS_ReleaseArchiveName(FSArchive * p_arc)
|
||||
{
|
||||
if (p_arc->name.pack)
|
||||
{
|
||||
@@ -270,7 +271,7 @@ ARM_FUNC void FS_ReleaseArchiveName(FSArchive * p_arc)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_LoadArchive(FSArchive * p_arc, u32 base, u32 fat, u32 fat_size, u32 fnt, u32 fnt_size, FS_ARCHIVE_READ_FUNC read_func, FS_ARCHIVE_WRITE_FUNC write_func)
|
||||
BOOL FS_LoadArchive(FSArchive * p_arc, u32 base, u32 fat, u32 fat_size, u32 fnt, u32 fnt_size, FS_ARCHIVE_READ_FUNC read_func, FS_ARCHIVE_WRITE_FUNC write_func)
|
||||
{
|
||||
p_arc->base = base;
|
||||
p_arc->fat_size = fat_size;
|
||||
@@ -285,7 +286,7 @@ ARM_FUNC BOOL FS_LoadArchive(FSArchive * p_arc, u32 base, u32 fat, u32 fat_size,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_UnloadArchive(FSArchive * p_arc)
|
||||
BOOL FS_UnloadArchive(FSArchive * p_arc)
|
||||
{
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
if (FS_IsArchiveLoaded(p_arc))
|
||||
@@ -319,7 +320,7 @@ ARM_FUNC BOOL FS_UnloadArchive(FSArchive * p_arc)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 FS_LoadArchiveTables(FSArchive *p_arc, void *p_mem, u32 max_size)
|
||||
u32 FS_LoadArchiveTables(FSArchive *p_arc, void *p_mem, u32 max_size)
|
||||
{
|
||||
u32 total_size = ALIGN_BYTE(p_arc->fat_size + p_arc->fnt_size + 32, 32);
|
||||
if (total_size <= max_size)
|
||||
@@ -353,7 +354,7 @@ ARM_FUNC u32 FS_LoadArchiveTables(FSArchive *p_arc, void *p_mem, u32 max_size)
|
||||
return total_size;
|
||||
}
|
||||
|
||||
ARM_FUNC void * FS_UnloadArchiveTables(FSArchive * p_arc)
|
||||
void * FS_UnloadArchiveTables(FSArchive * p_arc)
|
||||
{
|
||||
void *ret = NULL;
|
||||
if (FS_IsArchiveLoaded(p_arc))
|
||||
@@ -374,7 +375,7 @@ ARM_FUNC void * FS_UnloadArchiveTables(FSArchive * p_arc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_SuspendArchive(FSArchive * p_arc)
|
||||
BOOL FS_SuspendArchive(FSArchive * p_arc)
|
||||
{
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
const BOOL bak_stat = !FS_IsArchiveSuspended(p_arc);
|
||||
@@ -396,7 +397,7 @@ ARM_FUNC BOOL FS_SuspendArchive(FSArchive * p_arc)
|
||||
return bak_stat;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_ResumeArchive(FSArchive * p_arc)
|
||||
BOOL FS_ResumeArchive(FSArchive * p_arc)
|
||||
{
|
||||
FSFile * p_target = NULL;
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
@@ -412,7 +413,7 @@ ARM_FUNC BOOL FS_ResumeArchive(FSArchive * p_arc)
|
||||
return bak_stat;
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_SetArchiveProc(struct FSArchive * p_arc, FS_ARCHIVE_PROC_FUNC proc, u32 flags)
|
||||
void FS_SetArchiveProc(struct FSArchive * p_arc, FS_ARCHIVE_PROC_FUNC proc, u32 flags)
|
||||
{
|
||||
if (!flags)
|
||||
proc = NULL;
|
||||
@@ -422,7 +423,7 @@ ARM_FUNC void FS_SetArchiveProc(struct FSArchive * p_arc, FS_ARCHIVE_PROC_FUNC p
|
||||
p_arc->proc_flag = flags;
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_NotifyArchiveAsyncEnd(FSArchive *p_arc, FSResult ret)
|
||||
void FS_NotifyArchiveAsyncEnd(FSArchive *p_arc, FSResult ret)
|
||||
{
|
||||
if (FSi_IsArchiveAsync(p_arc))
|
||||
{
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#include "FS_archive.h"
|
||||
#include "FSi_util.h"
|
||||
#include "FS_command.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void FSi_ReleaseCommand(FSFile * p_file, FSResult ret)
|
||||
void FSi_ReleaseCommand(FSFile * p_file, FSResult ret)
|
||||
{
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
FSi_CutFromList(p_file);
|
||||
@@ -13,7 +14,7 @@ ARM_FUNC void FSi_ReleaseCommand(FSFile * p_file, FSResult ret)
|
||||
(void)OS_RestoreInterrupts(bak_psr);
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_TranslateCommand(FSFile *p_file, FSCommandType command)
|
||||
FSResult FSi_TranslateCommand(FSFile *p_file, FSCommandType command)
|
||||
{
|
||||
FSResult ret;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "MI_memory.h"
|
||||
#include "FSi_util.h"
|
||||
#include "FS_command_default.h"
|
||||
#include "code32.h"
|
||||
|
||||
FSResult (*const fsi_default_command[])(FSFile *) = {
|
||||
[FS_COMMAND_READFILE] = FSi_ReadFileCommand,
|
||||
@@ -19,7 +20,7 @@ FSResult (*const fsi_default_command[])(FSFile *) = {
|
||||
};
|
||||
|
||||
// Case-insensitive string comparison
|
||||
ARM_FUNC u32 FSi_StrNICmp(const char * str1, const char * str2, u32 len)
|
||||
u32 FSi_StrNICmp(const char * str1, const char * str2, u32 len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i++)
|
||||
@@ -36,7 +37,7 @@ ARM_FUNC u32 FSi_StrNICmp(const char * str1, const char * str2, u32 len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadTable(FSiSyncReadParam * p, void * dst, u32 len)
|
||||
FSResult FSi_ReadTable(FSiSyncReadParam * p, void * dst, u32 len)
|
||||
{
|
||||
FSResult ret;
|
||||
FSArchive * const p_arc = p->arc;
|
||||
@@ -62,7 +63,7 @@ ARM_FUNC FSResult FSi_ReadTable(FSiSyncReadParam * p, void * dst, u32 len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_SeekDirDirect(FSFile * p_dir, u32 id)
|
||||
FSResult FSi_SeekDirDirect(FSFile * p_dir, u32 id)
|
||||
{
|
||||
p_dir->stat |= FS_FILE_STATUS_SYNC;
|
||||
p_dir->arg.seekdir.pos.arc = p_dir->arc;
|
||||
@@ -73,7 +74,7 @@ ARM_FUNC FSResult FSi_SeekDirDirect(FSFile * p_dir, u32 id)
|
||||
}
|
||||
|
||||
// The actual commands
|
||||
ARM_FUNC FSResult FSi_ReadFileCommand(FSFile * p_file)
|
||||
FSResult FSi_ReadFileCommand(FSFile * p_file)
|
||||
{
|
||||
FSArchive *const p_arc = p_file->arc;
|
||||
const u32 pos = p_file->prop.file.pos;
|
||||
@@ -83,7 +84,7 @@ ARM_FUNC FSResult FSi_ReadFileCommand(FSFile * p_file)
|
||||
return (*p_arc->read_func)(p_arc, dst, pos, len);
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_WriteFileCommand(FSFile * p_file)
|
||||
FSResult FSi_WriteFileCommand(FSFile * p_file)
|
||||
{
|
||||
FSArchive *const p_arc = p_file->arc;
|
||||
const u32 pos = p_file->prop.file.pos;
|
||||
@@ -93,7 +94,7 @@ ARM_FUNC FSResult FSi_WriteFileCommand(FSFile * p_file)
|
||||
return (*p_arc->write_func)(p_arc, src, pos, len);
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_SeekDirCommand(FSFile * p_dir)
|
||||
FSResult FSi_SeekDirCommand(FSFile * p_dir)
|
||||
{
|
||||
FSResult ret;
|
||||
FSArchive *const p_arc = p_dir->arc;
|
||||
@@ -117,7 +118,7 @@ ARM_FUNC FSResult FSi_SeekDirCommand(FSFile * p_dir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadDirCommand(FSFile *p_dir)
|
||||
FSResult FSi_ReadDirCommand(FSFile *p_dir)
|
||||
{
|
||||
FSDirEntry *p_entry = p_dir->arg.readdir.p_entry;
|
||||
FSResult ret;
|
||||
@@ -171,7 +172,7 @@ ARM_FUNC FSResult FSi_ReadDirCommand(FSFile *p_dir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_FindPathCommand(FSFile *p_dir)
|
||||
FSResult FSi_FindPathCommand(FSFile *p_dir)
|
||||
{
|
||||
const char *path = p_dir->arg.findpath.path;
|
||||
const BOOL is_dir = p_dir->arg.findpath.find_directory;
|
||||
@@ -246,7 +247,7 @@ ARM_FUNC FSResult FSi_FindPathCommand(FSFile *p_dir)
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file)
|
||||
FSResult FSi_GetPathCommand(FSFile *p_file)
|
||||
{
|
||||
FSArchive *const p_arc = p_file->arc;
|
||||
|
||||
@@ -409,7 +410,7 @@ ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file)
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_OpenFileFastCommand(FSFile * p_file)
|
||||
FSResult FSi_OpenFileFastCommand(FSFile * p_file)
|
||||
{
|
||||
FSArchive *const p_arc = p_file->arc;
|
||||
const FSFileID *p_id = &p_file->arg.openfilefast.id;
|
||||
@@ -437,7 +438,7 @@ ARM_FUNC FSResult FSi_OpenFileFastCommand(FSFile * p_file)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_OpenFileDirectCommand(FSFile * p_file)
|
||||
FSResult FSi_OpenFileDirectCommand(FSFile * p_file)
|
||||
{
|
||||
p_file->prop.file.top = p_file->arg.openfiledirect.top;
|
||||
p_file->prop.file.pos = p_file->arg.openfiledirect.top;
|
||||
@@ -446,7 +447,7 @@ ARM_FUNC FSResult FSi_OpenFileDirectCommand(FSFile * p_file)
|
||||
return FS_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_CloseFileCommand(FSFile * p_file)
|
||||
FSResult FSi_CloseFileCommand(FSFile * p_file)
|
||||
{
|
||||
#pragma unused (p_file)
|
||||
return FS_RESULT_SUCCESS;
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
#include "FS_rom.h"
|
||||
#include "FS_file.h"
|
||||
#include "FSi_util.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern FSDirPos current_dir_pos;
|
||||
BOOL is_init = FALSE;
|
||||
|
||||
static BOOL FSi_FindPath(FSFile * p_dir, const char * path, FSFileID * p_file_id, FSDirPos * p_dir_pos);
|
||||
|
||||
ARM_FUNC void FS_Init(u32 default_dma_no)
|
||||
void FS_Init(u32 default_dma_no)
|
||||
{
|
||||
if (!is_init)
|
||||
{
|
||||
@@ -18,12 +19,12 @@ ARM_FUNC void FS_Init(u32 default_dma_no)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_IsAvailable(void)
|
||||
BOOL FS_IsAvailable(void)
|
||||
{
|
||||
return is_init;
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_InitFile(FSFile * p_file)
|
||||
void FS_InitFile(FSFile * p_file)
|
||||
{
|
||||
p_file->link.next = p_file->link.prev = NULL;
|
||||
OS_InitThreadQueue(p_file->queue);
|
||||
@@ -90,7 +91,7 @@ static BOOL FSi_FindPath(FSFile * p_dir, const char * path, FSFileID * p_file_id
|
||||
return FSi_SendCommand(p_dir, FS_COMMAND_FINDPATH);
|
||||
}
|
||||
|
||||
ARM_FUNC int FSi_ReadFileCore(FSFile * p_file, void * dst, s32 len, BOOL async)
|
||||
int FSi_ReadFileCore(FSFile * p_file, void * dst, s32 len, BOOL async)
|
||||
{
|
||||
const s32 pos = (s32)p_file->prop.file.pos;
|
||||
const s32 rest = (s32)(p_file->prop.file.bottom - pos);
|
||||
@@ -115,7 +116,7 @@ ARM_FUNC int FSi_ReadFileCore(FSFile * p_file, void * dst, s32 len, BOOL async)
|
||||
return len;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_ConvertPathToFileID(FSFileID * p_file_id, const char * path)
|
||||
BOOL FS_ConvertPathToFileID(FSFileID * p_file_id, const char * path)
|
||||
{
|
||||
FSFile dir;
|
||||
FS_InitFile(&dir);
|
||||
@@ -124,7 +125,7 @@ ARM_FUNC BOOL FS_ConvertPathToFileID(FSFileID * p_file_id, const char * path)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_OpenFileDirect(FSFile * p_file, FSArchive * p_arc, u32 image_top, u32 image_bottom, u32 file_index)
|
||||
BOOL FS_OpenFileDirect(FSFile * p_file, FSArchive * p_arc, u32 image_top, u32 image_bottom, u32 file_index)
|
||||
{
|
||||
p_file->arc = p_arc;
|
||||
p_file->arg.openfiledirect.index = file_index;
|
||||
@@ -137,7 +138,7 @@ ARM_FUNC BOOL FS_OpenFileDirect(FSFile * p_file, FSArchive * p_arc, u32 image_to
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_OpenFileFast(FSFile * p_file, FSFileID file_id)
|
||||
BOOL FS_OpenFileFast(FSFile * p_file, FSFileID file_id)
|
||||
{
|
||||
if (!file_id.arc)
|
||||
return FALSE;
|
||||
@@ -150,13 +151,13 @@ ARM_FUNC BOOL FS_OpenFileFast(FSFile * p_file, FSFileID file_id)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_OpenFile(FSFile * p_file, const char * path)
|
||||
BOOL FS_OpenFile(FSFile * p_file, const char * path)
|
||||
{
|
||||
FSFileID file_id;
|
||||
return FS_ConvertPathToFileID(&file_id, path) && FS_OpenFileFast(p_file, file_id);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_CloseFile(FSFile * p_file)
|
||||
BOOL FS_CloseFile(FSFile * p_file)
|
||||
{
|
||||
if (!FSi_SendCommand(p_file, FS_COMMAND_CLOSEFILE))
|
||||
return FALSE;
|
||||
@@ -166,7 +167,7 @@ ARM_FUNC BOOL FS_CloseFile(FSFile * p_file)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_WaitAsync(FSFile * p_file)
|
||||
BOOL FS_WaitAsync(FSFile * p_file)
|
||||
{
|
||||
BOOL is_owner = FALSE;
|
||||
OSIntrMode bak_par = OS_DisableInterrupts();
|
||||
@@ -198,17 +199,17 @@ ARM_FUNC BOOL FS_WaitAsync(FSFile * p_file)
|
||||
return FS_IsSucceeded(p_file);
|
||||
}
|
||||
|
||||
ARM_FUNC int FS_ReadFileAsync(FSFile * p_file, void * dst, s32 len)
|
||||
int FS_ReadFileAsync(FSFile * p_file, void * dst, s32 len)
|
||||
{
|
||||
return FSi_ReadFileCore(p_file, dst, len, TRUE);
|
||||
}
|
||||
|
||||
ARM_FUNC int FS_ReadFile(FSFile * p_file, void * dst, s32 len)
|
||||
int FS_ReadFile(FSFile * p_file, void * dst, s32 len)
|
||||
{
|
||||
return FSi_ReadFileCore(p_file, dst, len, FALSE);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_SeekFile(FSFile * p_file, s32 offset, FSSeekFileMode origin)
|
||||
BOOL FS_SeekFile(FSFile * p_file, s32 offset, FSSeekFileMode origin)
|
||||
{
|
||||
switch (origin)
|
||||
{
|
||||
@@ -232,7 +233,7 @@ ARM_FUNC BOOL FS_SeekFile(FSFile * p_file, s32 offset, FSSeekFileMode origin)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_ChangeDir(const char * path)
|
||||
BOOL FS_ChangeDir(const char * path)
|
||||
{
|
||||
FSDirPos pos;
|
||||
FSFile dir;
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
#include "FS_overlay.h"
|
||||
#include "FS_mw_dtor.h"
|
||||
#include "MB_mb.h"
|
||||
#include "code32.h"
|
||||
|
||||
#define FS_OVERLAY_FLAG_COMP 0x0001
|
||||
#define FS_OVERLAY_FLAG_AUTH 0x0002
|
||||
#define FS_OVERLAY_DIGEST_SIZE DGT_HASH2_DIGEST_SIZE
|
||||
|
||||
ARM_FUNC u32 FSi_GetOverlayBinarySize(FSOverlayInfo * p_ovi)
|
||||
u32 FSi_GetOverlayBinarySize(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
u32 size = (p_ovi->header.flag & FS_OVERLAY_FLAG_COMP)
|
||||
? p_ovi->header.compressed
|
||||
@@ -23,7 +24,7 @@ ARM_FUNC u32 FSi_GetOverlayBinarySize(FSOverlayInfo * p_ovi)
|
||||
return size;
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_ClearOverlayImage(FSOverlayInfo * p_ovi)
|
||||
void FS_ClearOverlayImage(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
u8 * const im_start = FS_GetOverlayAddress(p_ovi);
|
||||
u32 const ram_size = FS_GetOverlayImageSize(p_ovi);
|
||||
@@ -34,7 +35,7 @@ ARM_FUNC void FS_ClearOverlayImage(FSOverlayInfo * p_ovi)
|
||||
MI_CpuFill8(im_start + ram_size, 0, total_size - ram_size);
|
||||
}
|
||||
|
||||
ARM_FUNC FSFileID FS_GetOverlayFileID(FSOverlayInfo * p_ovi)
|
||||
FSFileID FS_GetOverlayFileID(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
FSFileID ret;
|
||||
ret.arc = &fsi_arc_rom;
|
||||
@@ -42,7 +43,7 @@ ARM_FUNC FSFileID FS_GetOverlayFileID(FSOverlayInfo * p_ovi)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FSi_LoadOverlayInfoCore(FSOverlayInfo * p_ovi, MIProcessor target, FSOverlayID id, FSArchive * arc, u32 offset_arm9, u32 len_arm9, u32 offset_arm7, u32 len_arm7)
|
||||
BOOL FSi_LoadOverlayInfoCore(FSOverlayInfo * p_ovi, MIProcessor target, FSOverlayID id, FSArchive * arc, u32 offset_arm9, u32 len_arm9, u32 offset_arm7, u32 len_arm7)
|
||||
{
|
||||
CARDRomRegion pr[1];
|
||||
u32 pos;
|
||||
@@ -80,7 +81,7 @@ ARM_FUNC BOOL FSi_LoadOverlayInfoCore(FSOverlayInfo * p_ovi, MIProcessor target,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_LoadOverlayInfo(FSOverlayInfo * p_ovi, MIProcessor target, FSOverlayID id)
|
||||
BOOL FS_LoadOverlayInfo(FSOverlayInfo * p_ovi, MIProcessor target, FSOverlayID id)
|
||||
{
|
||||
CARDRomRegion * const pr = (target == MI_PROCESSOR_ARM9) ? &fsi_ovt9 : &fsi_ovt7;
|
||||
if (pr->offset)
|
||||
@@ -107,7 +108,7 @@ ARM_FUNC BOOL FS_LoadOverlayInfo(FSOverlayInfo * p_ovi, MIProcessor target, FSOv
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_LoadOverlayImageAsync(FSOverlayInfo * p_ovi, FSFile * p_file)
|
||||
BOOL FS_LoadOverlayImageAsync(FSOverlayInfo * p_ovi, FSFile * p_file)
|
||||
{
|
||||
FS_InitFile(p_file);
|
||||
if (!FS_OpenFileFast(p_file, FS_GetOverlayFileID(p_ovi)))
|
||||
@@ -125,7 +126,7 @@ ARM_FUNC BOOL FS_LoadOverlayImageAsync(FSOverlayInfo * p_ovi, FSFile * p_file)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_LoadOverlayImage(FSOverlayInfo * p_ovi)
|
||||
BOOL FS_LoadOverlayImage(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
FSFile file[1];
|
||||
FS_InitFile(file);
|
||||
@@ -170,7 +171,7 @@ static const u8 fsi_def_digest_key[64] = {
|
||||
static const void *fsi_digest_key_ptr = fsi_def_digest_key;
|
||||
static u32 fsi_digest_key_len = sizeof(fsi_def_digest_key);
|
||||
|
||||
ARM_FUNC BOOL FSi_CompareDigest(const u8 *spec_digest, void *src, u32 len)
|
||||
BOOL FSi_CompareDigest(const u8 *spec_digest, void *src, u32 len)
|
||||
{
|
||||
int i;
|
||||
u8 digest[FS_OVERLAY_DIGEST_SIZE];
|
||||
@@ -190,7 +191,7 @@ ARM_FUNC BOOL FSi_CompareDigest(const u8 *spec_digest, void *src, u32 len)
|
||||
extern u8 SDK_OVERLAY_DIGEST[];
|
||||
extern u8 SDK_OVERLAY_DIGEST_END[];
|
||||
|
||||
ARM_FUNC void FS_StartOverlay(FSOverlayInfo * p_ovi)
|
||||
void FS_StartOverlay(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
u32 rare_size = FSi_GetOverlayBinarySize(p_ovi);
|
||||
if (MB_IsMultiBootChild())
|
||||
@@ -230,7 +231,7 @@ ARM_FUNC void FS_StartOverlay(FSOverlayInfo * p_ovi)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void FS_EndOverlay(FSOverlayInfo *p_ovi)
|
||||
void FS_EndOverlay(FSOverlayInfo *p_ovi)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
@@ -296,13 +297,13 @@ ARM_FUNC void FS_EndOverlay(FSOverlayInfo *p_ovi)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_UnloadOverlayImage(FSOverlayInfo * p_ovi)
|
||||
BOOL FS_UnloadOverlayImage(FSOverlayInfo * p_ovi)
|
||||
{
|
||||
FS_EndOverlay(p_ovi);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_LoadOverlay(MIProcessor target, FSOverlayID id)
|
||||
BOOL FS_LoadOverlay(MIProcessor target, FSOverlayID id)
|
||||
{
|
||||
FSOverlayInfo ovi;
|
||||
if (!FS_LoadOverlayInfo(&ovi, target, id) || !FS_LoadOverlayImage(&ovi))
|
||||
@@ -311,7 +312,7 @@ ARM_FUNC BOOL FS_LoadOverlay(MIProcessor target, FSOverlayID id)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL FS_UnloadOverlay(MIProcessor target, FSOverlayID id)
|
||||
BOOL FS_UnloadOverlay(MIProcessor target, FSOverlayID id)
|
||||
{
|
||||
FSOverlayInfo ovi;
|
||||
if (!FS_LoadOverlayInfo(&ovi, target, id) || !FS_UnloadOverlayImage(&ovi))
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "CARD_common.h"
|
||||
#include "MB_mb.h"
|
||||
#include "OS_printf.h"
|
||||
#include "code32.h"
|
||||
|
||||
static u32 fsi_default_dma_no;
|
||||
s32 fsi_card_lock_id;
|
||||
@@ -13,24 +14,24 @@ CARDRomRegion fsi_ovt9;
|
||||
CARDRomRegion fsi_ovt7;
|
||||
FSArchive fsi_arc_rom;
|
||||
|
||||
ARM_FUNC void FSi_OnRomReadDone(void * p_arc)
|
||||
void FSi_OnRomReadDone(void * p_arc)
|
||||
{
|
||||
FS_NotifyArchiveAsyncEnd(p_arc, CARD_IsPulledOut() ? FS_RESULT_ERROR : FS_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadRomCallback(FSArchive * p_arc, void * dst, u32 src, u32 len)
|
||||
FSResult FSi_ReadRomCallback(FSArchive * p_arc, void * dst, u32 src, u32 len)
|
||||
{
|
||||
CARD_ReadRomAsync(fsi_default_dma_no, (const void *)src, dst, len, FSi_OnRomReadDone, p_arc);
|
||||
return FS_RESULT_PROC_ASYNC;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_WriteDummyCallback(FSArchive * p_arc, const void *src, u32 dst, u32 len)
|
||||
FSResult FSi_WriteDummyCallback(FSArchive * p_arc, const void *src, u32 dst, u32 len)
|
||||
{
|
||||
#pragma unused(p_arc, src, dst, len)
|
||||
return FS_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_RomArchiveProc(FSFile * p_arc, FSCommandType cmd)
|
||||
FSResult FSi_RomArchiveProc(FSFile * p_arc, FSCommandType cmd)
|
||||
{
|
||||
#pragma unused(p_arc)
|
||||
switch (cmd)
|
||||
@@ -48,19 +49,19 @@ ARM_FUNC FSResult FSi_RomArchiveProc(FSFile * p_arc, FSCommandType cmd)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_ReadDummyCallback(FSArchive *p_arc, void *dst, u32 src, u32 len)
|
||||
FSResult FSi_ReadDummyCallback(FSArchive *p_arc, void *dst, u32 src, u32 len)
|
||||
{
|
||||
#pragma unused (p_arc, dst, src, len)
|
||||
return FS_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
ARM_FUNC FSResult FSi_EmptyArchiveProc(FSFile *p_file, FSCommandType cmd)
|
||||
FSResult FSi_EmptyArchiveProc(FSFile *p_file, FSCommandType cmd)
|
||||
{
|
||||
#pragma unused(p_file, cmd)
|
||||
return FS_RESULT_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ARM_FUNC void FSi_InitRom(u32 default_dma_no)
|
||||
void FSi_InitRom(u32 default_dma_no)
|
||||
{
|
||||
fsi_default_dma_no = default_dma_no;
|
||||
fsi_card_lock_id = OS_GetLockID();
|
||||
@@ -107,7 +108,7 @@ ARM_FUNC void FSi_InitRom(u32 default_dma_no)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 FS_SetDefaultDMA(u32 dma_no)
|
||||
u32 FS_SetDefaultDMA(u32 dma_no)
|
||||
{
|
||||
OSIntrMode bak_psr = OS_DisableInterrupts();
|
||||
u32 bak_dma_no = fsi_default_dma_no;
|
||||
@@ -119,7 +120,7 @@ ARM_FUNC u32 FS_SetDefaultDMA(u32 dma_no)
|
||||
return bak_dma_no;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 FS_TryLoadTable(void * p_mem, u32 size)
|
||||
u32 FS_TryLoadTable(void * p_mem, u32 size)
|
||||
{
|
||||
return FS_LoadArchiveTables(&fsi_arc_rom, p_mem, size);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void FX_Init(){
|
||||
void FX_Init() {
|
||||
return;
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_Modf(fx32 x, fx32 *iptr){
|
||||
fx32 FX_Modf(fx32 x, fx32 *iptr) {
|
||||
if (x >= 0)
|
||||
{
|
||||
*iptr = x & 0x7FFFF000;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
const fx16 FX_AtanTable_[] = {
|
||||
FX16_CONST(0.0),
|
||||
@@ -133,7 +134,7 @@ const fx16 FX_AtanTable_[] = {
|
||||
FX16_CONST(2.0),
|
||||
};
|
||||
|
||||
ARM_FUNC u16 FX_Atan(fx32 x){
|
||||
u16 FX_Atan(fx32 x){
|
||||
if (x >= 0)
|
||||
{
|
||||
if (x > 0x1000)
|
||||
@@ -170,7 +171,7 @@ ARM_FUNC u16 FX_Atan(fx32 x){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
|
||||
u16 FX_Atan2(fx32 x, fx32 y){
|
||||
u32 positive, bias, denominator, numerator;
|
||||
if (x > 0)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#include "fx.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
|
||||
ARM_FUNC fx32 FX_Div(fx32 numerator, fx32 denominator){
|
||||
fx32 FX_Div(fx32 numerator, fx32 denominator){
|
||||
FX_DivAsync(numerator, denominator);
|
||||
return FX_GetDivResult();
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_Inv(fx32 x){
|
||||
fx32 FX_Inv(fx32 x){
|
||||
FX_InvAsync(x);
|
||||
return FX_GetDivResult();
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_Sqrt(fx32 x){
|
||||
fx32 FX_Sqrt(fx32 x){
|
||||
if (x > 0)
|
||||
{
|
||||
reg_CP_SQRTCNT = 0x1;
|
||||
@@ -27,34 +28,34 @@ ARM_FUNC fx32 FX_Sqrt(fx32 x){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC fx64c FX_GetDivResultFx64c(){
|
||||
fx64c FX_GetDivResultFx64c(){
|
||||
while (reg_CP_DIVCNT & 0x8000) {}
|
||||
return (fx64c)reg_CP_DIV_RESULT;
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_GetDivResult(){
|
||||
fx32 FX_GetDivResult(){
|
||||
while (reg_CP_DIVCNT & 0x8000) {}
|
||||
return (fx32)((reg_CP_DIV_RESULT + (1 << (0x14 - 1))) >> 0x14);
|
||||
}
|
||||
|
||||
ARM_FUNC void FX_InvAsync(fx32 x){
|
||||
void FX_InvAsync(fx32 x){
|
||||
reg_CP_DIVCNT = 0x1;
|
||||
reg_CP_DIV_NUMER = (fx64)0x00001000 << 32;
|
||||
reg_CP_DIV_DENOM = (u32)x;
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_GetSqrtResult(){
|
||||
fx32 FX_GetSqrtResult(){
|
||||
while (reg_CP_SQRTCNT & 0x8000) {}
|
||||
return (fx32)((reg_CP_SQRT_RESULT + (1 << (0xA - 1))) >> 0xA);
|
||||
}
|
||||
|
||||
ARM_FUNC void FX_DivAsync(fx32 numerator, fx32 denominator){
|
||||
void FX_DivAsync(fx32 numerator, fx32 denominator){
|
||||
reg_CP_DIVCNT = 0x1;
|
||||
reg_CP_DIV_NUMER = (u64)((fx64)numerator << 32);
|
||||
reg_CP_DIV_DENOM = (u32)denominator;
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_DivS32(fx32 numerator, fx32 denominator){
|
||||
fx32 FX_DivS32(fx32 numerator, fx32 denominator){
|
||||
reg_CP_DIVCNT = 0x0;
|
||||
*(REGType32v *)®_CP_DIV_NUMER = (u32)numerator; //32bit write for some reason
|
||||
reg_CP_DIV_DENOM = (u32)denominator;
|
||||
@@ -62,7 +63,7 @@ ARM_FUNC fx32 FX_DivS32(fx32 numerator, fx32 denominator){
|
||||
return (fx32)(*(REGType32v *)®_CP_DIV_RESULT);
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 FX_ModS32(fx32 num, fx32 mod){
|
||||
fx32 FX_ModS32(fx32 num, fx32 mod){
|
||||
reg_CP_DIVCNT = 0x0;
|
||||
*(REGType32v *)®_CP_DIV_NUMER = (u32)num; //32bit write for some reason
|
||||
reg_CP_DIV_DENOM = (u32)mod;
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MTX_ScaleApply22(struct Mtx22 *mtx, struct Mtx22 *dst, fx32 x, fx32 y){
|
||||
void MTX_ScaleApply22(struct Mtx22 *mtx, struct Mtx22 *dst, fx32 x, fx32 y){
|
||||
dst->_[0] = (fx32)(((fx64)x * mtx->_[0]) >> FX32_INT_SHIFT);
|
||||
dst->_[1] = (fx32)(((fx64)x * mtx->_[1]) >> FX32_INT_SHIFT);
|
||||
dst->_[2] = (fx32)(((fx64)y * mtx->_[2]) >> FX32_INT_SHIFT);
|
||||
dst->_[3] = (fx32)(((fx64)y * mtx->_[3]) >> FX32_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Identity22_(struct Mtx22 *mtx){
|
||||
asm void MTX_Identity22_(struct Mtx22 *mtx){
|
||||
mov r1, #0x0
|
||||
mov r2, #0x1000
|
||||
mov r3, #0x0
|
||||
@@ -18,7 +19,9 @@ ARM_FUNC asm void MTX_Identity22_(struct Mtx22 *mtx){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_Rot22_(struct Mtx22 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
#include "code16.h" //following func is thumb
|
||||
|
||||
asm void MTX_Rot22_(struct Mtx22 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r2, [r0, #0x0]
|
||||
str r1, [r0, #0x4]
|
||||
neg r1, r1
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MTX_ScaleApply33(struct Mtx33 *mtx, struct Mtx33 *dst, fx32 x, fx32 y, fx32 z){
|
||||
void MTX_ScaleApply33(struct Mtx33 *mtx, struct Mtx33 *dst, fx32 x, fx32 y, fx32 z){
|
||||
dst->_[0] = (fx32)(((fx64)x * mtx->_[0]) >> FX32_INT_SHIFT);
|
||||
dst->_[1] = (fx32)(((fx64)x * mtx->_[1]) >> FX32_INT_SHIFT);
|
||||
dst->_[2] = (fx32)(((fx64)x * mtx->_[2]) >> FX32_INT_SHIFT);
|
||||
@@ -14,7 +15,7 @@ ARM_FUNC void MTX_ScaleApply33(struct Mtx33 *mtx, struct Mtx33 *dst, fx32 x, fx3
|
||||
dst->_[8] = (fx32)(((fx64)z * mtx->_[8]) >> FX32_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC void MTX_Concat33(struct Mtx33 *a, struct Mtx33 *b, struct Mtx33 *c){
|
||||
void MTX_Concat33(struct Mtx33 *a, struct Mtx33 *b, struct Mtx33 *c){
|
||||
struct Mtx33 temp;
|
||||
struct Mtx33 *dst;
|
||||
fx32 a0, a1, a2;
|
||||
@@ -57,7 +58,7 @@ ARM_FUNC void MTX_Concat33(struct Mtx33 *a, struct Mtx33 *b, struct Mtx33 *c){
|
||||
*c = temp;
|
||||
}
|
||||
|
||||
ARM_FUNC void MTX_MultVec33(struct Vecx32 *vec, struct Mtx33 *mtx, struct Vecx32 *dst){
|
||||
void MTX_MultVec33(struct Vecx32 *vec, struct Mtx33 *mtx, struct Vecx32 *dst){
|
||||
fx32 x, y, z;
|
||||
x = vec->x;
|
||||
y = vec->y;
|
||||
@@ -67,7 +68,7 @@ ARM_FUNC void MTX_MultVec33(struct Vecx32 *vec, struct Mtx33 *mtx, struct Vecx32
|
||||
dst->z = (fx32)(((fx64)x * mtx->_[2] + (fx64)y * mtx->_[5] + (fx64)z * mtx->_[8]) >> FX32_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Identity33_(struct Mtx33 *mtx){
|
||||
asm void MTX_Identity33_(struct Mtx33 *mtx){
|
||||
mov r2, #0x1000
|
||||
str r2, [r0, #0x20]
|
||||
mov r3, #0x0
|
||||
@@ -79,7 +80,9 @@ ARM_FUNC asm void MTX_Identity33_(struct Mtx33 *mtx){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotX33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
#include "code16.h" //following funcs are thumb
|
||||
|
||||
asm void MTX_RotX33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
mov r3, #0x1
|
||||
lsl r3, r3, #0xc
|
||||
str r3, [r0, #0x0]
|
||||
@@ -96,7 +99,7 @@ THUMB_FUNC asm void MTX_RotX33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotY33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotY33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r2, [r0, #0x0]
|
||||
str r2, [r0, #0x20]
|
||||
mov r3, #0x0
|
||||
@@ -113,7 +116,7 @@ THUMB_FUNC asm void MTX_RotY33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotZ33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotZ33_(struct Mtx33 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
stmia r0!, {r2}
|
||||
mov r3, #0x0
|
||||
stmia r0!, {r1,r3}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
void MI_Copy48B(void *src, void *dst);
|
||||
|
||||
|
||||
ARM_FUNC void MTX_ScaleApply43(struct Mtx43 *mtx, struct Mtx43 *dst, fx32 x, fx32 y, fx32 z){
|
||||
void MTX_ScaleApply43(struct Mtx43 *mtx, struct Mtx43 *dst, fx32 x, fx32 y, fx32 z){
|
||||
//this works because matrices are indexed columns first
|
||||
MTX_ScaleApply33((struct Mtx33 *)mtx, (struct Mtx33 *)dst, x, y, z);
|
||||
dst->_[9] = mtx->_[9];
|
||||
@@ -13,7 +13,7 @@ ARM_FUNC void MTX_ScaleApply43(struct Mtx43 *mtx, struct Mtx43 *dst, fx32 x, fx3
|
||||
dst->_[11] = mtx->_[11];
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 MTX_Inverse43(struct Mtx43 *mtx, struct Mtx43 *inv){
|
||||
fx32 MTX_Inverse43(struct Mtx43 *mtx, struct Mtx43 *inv){
|
||||
struct Mtx43 tempmat;
|
||||
struct Mtx43 *dst;
|
||||
fx32 det0, det1, det2, det;
|
||||
@@ -61,7 +61,7 @@ ARM_FUNC fx32 MTX_Inverse43(struct Mtx43 *mtx, struct Mtx43 *inv){
|
||||
return 0;
|
||||
}
|
||||
|
||||
ARM_FUNC void MTX_Concat43(struct Mtx43 *a, struct Mtx43 *b, struct Mtx43 *c){
|
||||
void MTX_Concat43(struct Mtx43 *a, struct Mtx43 *b, struct Mtx43 *c){
|
||||
struct Mtx43 temp;
|
||||
struct Mtx43 *dst;
|
||||
fx32 a0, a1, a2;
|
||||
@@ -109,7 +109,7 @@ ARM_FUNC void MTX_Concat43(struct Mtx43 *a, struct Mtx43 *b, struct Mtx43 *c){
|
||||
*c = temp;
|
||||
}
|
||||
|
||||
ARM_FUNC void MTX_MultVec43(struct Vecx32 *vec, struct Mtx43 *mtx, struct Vecx32 *dst){
|
||||
void MTX_MultVec43(struct Vecx32 *vec, struct Mtx43 *mtx, struct Vecx32 *dst){
|
||||
fx32 x, y, z;
|
||||
x = vec->x;
|
||||
y = vec->y;
|
||||
@@ -122,7 +122,7 @@ ARM_FUNC void MTX_MultVec43(struct Vecx32 *vec, struct Mtx43 *mtx, struct Vecx32
|
||||
dst->z += mtx->_[11];
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Identity43_(struct Mtx43 *mtx){
|
||||
asm void MTX_Identity43_(struct Mtx43 *mtx){
|
||||
mov r2, #0x1000
|
||||
mov r3, #0x0
|
||||
stmia r0!, {r2-r3}
|
||||
@@ -135,7 +135,7 @@ ARM_FUNC asm void MTX_Identity43_(struct Mtx43 *mtx){
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Copy43To44_(struct Mtx43 *src, struct Mtx44 *dst){
|
||||
asm void MTX_Copy43To44_(struct Mtx43 *src, struct Mtx44 *dst){
|
||||
stmdb sp!, {r4}
|
||||
mov r12, #0x0
|
||||
ldmia r0!, {r2-r4}
|
||||
@@ -151,7 +151,9 @@ ARM_FUNC asm void MTX_Copy43To44_(struct Mtx43 *src, struct Mtx44 *dst){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_Scale43_(struct Mtx43 *dst, fx32 x, fx32 y, fx32 z){
|
||||
#include "code16.h" //following funcs are thumb
|
||||
|
||||
asm void MTX_Scale43_(struct Mtx43 *dst, fx32 x, fx32 y, fx32 z){
|
||||
stmia r0!, {r1}
|
||||
mov r1, #0x0
|
||||
str r3, [r0, #0x1c]
|
||||
@@ -165,7 +167,7 @@ THUMB_FUNC asm void MTX_Scale43_(struct Mtx43 *dst, fx32 x, fx32 y, fx32 z){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotX43_(struct Mtx43 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotX43_(struct Mtx43 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r1, [r0, #0x14]
|
||||
neg r1, r1
|
||||
str r1, [r0, #0x1c]
|
||||
@@ -183,7 +185,7 @@ THUMB_FUNC asm void MTX_RotX43_(struct Mtx43 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotY43_(struct Mtx43 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotY43_(struct Mtx43 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r1, [r0, #0x18]
|
||||
mov r3, #0x0
|
||||
stmia r0!, {r2-r3}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
void MI_Copy48B(void *src, void *dst);
|
||||
|
||||
|
||||
ARM_FUNC void MTX_TransApply44(struct Mtx44 *mtx, struct Mtx44 *dst, fx32 x, fx32 y, fx32 z){
|
||||
void MTX_TransApply44(struct Mtx44 *mtx, struct Mtx44 *dst, fx32 x, fx32 y, fx32 z){
|
||||
if(mtx != dst)
|
||||
MI_Copy48B(mtx, dst);
|
||||
dst->_[12] = mtx->_[12] + (fx32)(((fx64)x * mtx->_[0] + (fx64)y * mtx->_[4] + (fx64)z * mtx->_[8] ) >> FX32_INT_SHIFT);
|
||||
@@ -14,7 +14,7 @@ ARM_FUNC void MTX_TransApply44(struct Mtx44 *mtx, struct Mtx44 *dst, fx32 x, fx3
|
||||
dst->_[15] = mtx->_[15] + (fx32)(((fx64)x * mtx->_[3] + (fx64)y * mtx->_[7] + (fx64)z * mtx->_[11]) >> FX32_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC void MTX_Concat44(struct Mtx44 *a, struct Mtx44 *b, struct Mtx44 *c){
|
||||
void MTX_Concat44(struct Mtx44 *a, struct Mtx44 *b, struct Mtx44 *c){
|
||||
struct Mtx44 temp;
|
||||
struct Mtx44 *dst;
|
||||
fx32 a0, a1, a2, a3;
|
||||
@@ -73,7 +73,7 @@ ARM_FUNC void MTX_Concat44(struct Mtx44 *a, struct Mtx44 *b, struct Mtx44 *c){
|
||||
*c = temp;
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Identity44_(struct Mtx44 *dst){
|
||||
asm void MTX_Identity44_(struct Mtx44 *dst){
|
||||
mov r2, #0x1000
|
||||
mov r3, #0x0
|
||||
stmia r0!, {r2-r3}
|
||||
@@ -87,7 +87,7 @@ ARM_FUNC asm void MTX_Identity44_(struct Mtx44 *dst){
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MTX_Copy44To43_(struct Mtx44 *src, struct Mtx43 *dst){
|
||||
asm void MTX_Copy44To43_(struct Mtx44 *src, struct Mtx43 *dst){
|
||||
ldmia r0!, {r2-r3,r12}
|
||||
add r0, r0, #0x4
|
||||
stmia r1!, {r2-r3,r12}
|
||||
@@ -103,7 +103,9 @@ ARM_FUNC asm void MTX_Copy44To43_(struct Mtx44 *src, struct Mtx43 *dst){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotX44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
#include "code16.h" //following funcs are thumb
|
||||
|
||||
asm void MTX_RotX44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r2, [r0, #0x14]
|
||||
str r2, [r0, #0x28]
|
||||
str r1, [r0, #0x18]
|
||||
@@ -124,7 +126,7 @@ THUMB_FUNC asm void MTX_RotX44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotY44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotY44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r2, [r0, #0x0]
|
||||
str r2, [r0, #0x28]
|
||||
str r1, [r0, #0x20]
|
||||
@@ -145,7 +147,7 @@ THUMB_FUNC asm void MTX_RotY44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MTX_RotZ44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
asm void MTX_RotZ44_(struct Mtx44 *mtx, fx32 sinphi, fx32 cosphi){
|
||||
str r2, [r0, #0x0]
|
||||
str r2, [r0, #0x14]
|
||||
str r1, [r0, #0x4]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "fx.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
#include "function_target.h"
|
||||
#include "registers.h"
|
||||
#include "fx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
void VEC_Add(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
dst->x = a->x + b->x;
|
||||
dst->y = a->y + b->y;
|
||||
dst->z = a->z + b->z;
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
void VEC_Subtract(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
dst->x = a->x - b->x;
|
||||
dst->y = a->y - b->y;
|
||||
dst->z = a->z - b->z;
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_Fx16Add(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst){
|
||||
void VEC_Fx16Add(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst){
|
||||
dst->x = (s16)(a->x + b->x);
|
||||
dst->y = (s16)(a->y + b->y);
|
||||
dst->z = (s16)(a->z + b->z);
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b){
|
||||
fx32 VEC_DotProduct(const struct Vecx32 *a, const struct Vecx32 *b){
|
||||
return (fx32)(((fx64)a->x * b->x + (fx64)a->y * b->y + (fx64)a->z * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b){
|
||||
fx32 VEC_Fx16DotProduct(struct Vecx16 *a, struct Vecx16 *b){
|
||||
fx32 temp1, temp2;
|
||||
temp1 = (a->x * b->x) + (a->y * b->y);
|
||||
temp2 = (a->z * b->z) + (1 << (FX64_INT_SHIFT - 1));
|
||||
return (fx32)(((fx64)temp1 + temp2) >> FX64_INT_SHIFT);
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, struct Vecx32 *dst){
|
||||
fx32 x, y, z;
|
||||
x = (fx32)(((fx64)a->y * b->z - (fx64)a->z * b->y + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
|
||||
y = (fx32)(((fx64)a->z * b->x - (fx64)a->x * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
|
||||
@@ -41,7 +41,7 @@ ARM_FUNC void VEC_CrossProduct(const struct Vecx32 *a, const struct Vecx32 *b, s
|
||||
dst->z = z;
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_Fx16CrossProduct(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst){
|
||||
void VEC_Fx16CrossProduct(struct Vecx16 *a, struct Vecx16 *b, struct Vecx16 *dst){
|
||||
fx32 x, y, z;
|
||||
x = ((a->y * b->z - a->z * b->y + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
|
||||
y = ((a->z * b->x - a->x * b->z + (1 << (FX64_INT_SHIFT - 1))) >> FX64_INT_SHIFT);
|
||||
@@ -51,7 +51,7 @@ ARM_FUNC void VEC_Fx16CrossProduct(struct Vecx16 *a, struct Vecx16 *b, struct Ve
|
||||
dst->z = (fx16)z;
|
||||
}
|
||||
|
||||
ARM_FUNC fx32 VEC_Mag(struct Vecx32 *a){
|
||||
fx32 VEC_Mag(struct Vecx32 *a){
|
||||
fx64 l2 = (fx64)a->x * a->x;
|
||||
l2 += (fx64)a->y * a->y;
|
||||
l2 += (fx64)a->z * a->z;
|
||||
@@ -61,7 +61,7 @@ ARM_FUNC fx32 VEC_Mag(struct Vecx32 *a){
|
||||
return ((fx32)reg_CP_SQRT_RESULT + 1) >> 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst){
|
||||
void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst){
|
||||
fx64 l2 = (fx64)a->x * a->x;
|
||||
l2 += (fx64)a->y * a->y;
|
||||
l2 += (fx64)a->z * a->z;
|
||||
@@ -81,7 +81,7 @@ ARM_FUNC void VEC_Normalize(const struct Vecx32 *a, struct Vecx32 *dst){
|
||||
dst->z = (fx32)((l2 * a->z + (1LL << (0x2D - 1))) >> 0x2D);
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_Fx16Normalize(struct Vecx16 *a, struct Vecx16 *dst){
|
||||
void VEC_Fx16Normalize(struct Vecx16 *a, struct Vecx16 *dst){
|
||||
fx64 l2 = a->x * a->x;
|
||||
l2 += a->y * a->y;
|
||||
l2 += a->z * a->z;
|
||||
@@ -101,7 +101,7 @@ ARM_FUNC void VEC_Fx16Normalize(struct Vecx16 *a, struct Vecx16 *dst){
|
||||
dst->z = (fx16)((l2 * a->z + (1LL << (0x2D - 1))) >> 0x2D);
|
||||
}
|
||||
|
||||
ARM_FUNC void VEC_MultAdd(fx32 factor, struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
|
||||
void VEC_MultAdd(fx32 factor, struct Vecx32 *a, struct Vecx32 *b, struct Vecx32 *dst){
|
||||
dst->x = (fx32)(((fx64)factor * a->x) >> FX32_INT_SHIFT) + b->x;
|
||||
dst->y = (fx32)(((fx64)factor * a->y) >> FX32_INT_SHIFT) + b->y;
|
||||
dst->z = (fx32)(((fx64)factor * a->z) >> FX32_INT_SHIFT) + b->z;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "gx.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "OS_spinLock.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "code32.h"
|
||||
|
||||
u32 GXi_DmaId = 3;
|
||||
vu16 GXi_VRamLockId = 0;
|
||||
@@ -12,7 +13,7 @@ static u16 sIsDispOn = TRUE;
|
||||
|
||||
#define _powcnt_init_mask (REG_GX_POWCNT_E2DGB_MASK | REG_GX_POWCNT_E2DG_MASK | REG_GX_POWCNT_RE_MASK | REG_GX_POWCNT_GE_MASK)
|
||||
|
||||
ARM_FUNC void GX_Init(){
|
||||
void GX_Init(){
|
||||
reg_GX_POWCNT |= REG_GX_POWCNT_DSEL_MASK;
|
||||
reg_GX_POWCNT = (u16)((reg_GX_POWCNT & ~_powcnt_init_mask) | _powcnt_init_mask);
|
||||
reg_GX_POWCNT = (u16)(reg_GX_POWCNT | REG_GX_POWCNT_LCD_MASK);
|
||||
@@ -51,7 +52,7 @@ ARM_FUNC void GX_Init(){
|
||||
reg_G2S_DB_BG3PD = 0x100;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_HBlankIntr(u32 enable){
|
||||
u32 GX_HBlankIntr(u32 enable){
|
||||
u32 temp = (u32)(reg_GX_DISPSTAT & REG_GX_DISPSTAT_HBI_MASK);
|
||||
if (enable)
|
||||
{
|
||||
@@ -64,7 +65,7 @@ ARM_FUNC u32 GX_HBlankIntr(u32 enable){
|
||||
return temp;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_VBlankIntr(u32 enable){
|
||||
u32 GX_VBlankIntr(u32 enable){
|
||||
u32 temp = (u32)(reg_GX_DISPSTAT & REG_GX_DISPSTAT_VBI_MASK);
|
||||
if (enable)
|
||||
{
|
||||
@@ -77,14 +78,14 @@ ARM_FUNC u32 GX_VBlankIntr(u32 enable){
|
||||
return temp;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_DispOff(){
|
||||
void GX_DispOff(){
|
||||
u32 temp = reg_GX_DISPCNT;
|
||||
sIsDispOn = FALSE;
|
||||
sDispMode = (u16)((temp & REG_GX_DISPCNT_MODE_MASK) >> REG_GX_DISPCNT_MODE_SHIFT);
|
||||
reg_GX_DISPCNT = temp & ~REG_GX_DISPCNT_MODE_MASK;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_DispOn(){
|
||||
void GX_DispOn(){
|
||||
sIsDispOn = TRUE;
|
||||
if (sDispMode)
|
||||
{
|
||||
@@ -96,7 +97,7 @@ ARM_FUNC void GX_DispOn(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As bg0_2d3d){
|
||||
void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As bg0_2d3d){
|
||||
u32 temp2 = reg_GX_DISPCNT;
|
||||
sDispMode = (u16)dispMode;
|
||||
if (!sIsDispOn)
|
||||
@@ -106,11 +107,11 @@ ARM_FUNC void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As b
|
||||
sIsDispOn = FALSE;
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_SetGraphicsMode(GXBGMode mode){
|
||||
void GXS_SetGraphicsMode(GXBGMode mode){
|
||||
reg_GXS_DB_DISPCNT = (reg_GXS_DB_DISPCNT & ~REG_GXS_DB_DISPCNT_BGMODE_MASK) | mode;
|
||||
}
|
||||
|
||||
ARM_FUNC void GXx_SetMasterBrightness_(vu16 *dst, s32 brightness){
|
||||
void GXx_SetMasterBrightness_(vu16 *dst, s32 brightness){
|
||||
if (!brightness)
|
||||
{
|
||||
*dst = 0x0;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
//looks like asm and says asm on the tin...
|
||||
ARM_FUNC asm void GX_SendFifo48B(void *src, void *dst){
|
||||
asm void GX_SendFifo48B(void *src, void *dst) {
|
||||
ldmia r0!, {r2-r3,r12}
|
||||
stmia r1, {r2-r3,r12}
|
||||
ldmia r0!, {r2-r3,r12}
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "registers.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void *G2_GetBG0ScrPtr(){
|
||||
void *G2_GetBG0ScrPtr(){
|
||||
u32 temp = (u32)(((reg_G2_BG0CNT & 0x1F00) >> 0x8) << 0xB);
|
||||
return (void *)(0x6000000 + (((reg_GX_DISPCNT & 0x38000000) >> 0x1B) << 0x10) + temp);
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG0ScrPtr(){
|
||||
void *G2S_GetBG0ScrPtr(){
|
||||
return (void *)(0x6200000 + (((reg_G2S_DB_BG0CNT & 0x1F00) >> 0x8) << 0xB));
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG1ScrPtr(){
|
||||
void *G2_GetBG1ScrPtr(){
|
||||
u32 temp = (u32)(((reg_G2_BG1CNT & 0x1F00) >> 0x8) << 0xB);
|
||||
return (void *)(0x6000000 + (((reg_GX_DISPCNT & 0x38000000) >> 0x1B) << 0x10) + temp);
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG1ScrPtr(){
|
||||
void *G2S_GetBG1ScrPtr(){
|
||||
return (void *)(0x6200000 + (((reg_G2S_DB_BG1CNT & 0x1F00) >> 0x8) << 0xB));
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG2ScrPtr(){
|
||||
void *G2_GetBG2ScrPtr(){
|
||||
u32 temp12 = (reg_GX_DISPCNT & 0x7);
|
||||
u32 temp3 = reg_G2_BG2CNT;
|
||||
u32 temp2 = (((reg_GX_DISPCNT & 0x38000000) >> 0x1B) << 0x10);
|
||||
@@ -44,7 +46,7 @@ ARM_FUNC void *G2_GetBG2ScrPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG2ScrPtr(){
|
||||
void *G2S_GetBG2ScrPtr(){
|
||||
u32 temp12 = (reg_GXS_DB_DISPCNT & 0x7);
|
||||
u32 temp3 = reg_G2S_DB_BG2CNT;
|
||||
u32 temp1 = ((temp3 & 0x1F00) >> 0x8);
|
||||
@@ -68,7 +70,7 @@ ARM_FUNC void *G2S_GetBG2ScrPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG3ScrPtr(){
|
||||
void *G2_GetBG3ScrPtr(){
|
||||
u32 temp12 = (reg_GX_DISPCNT & 0x7);
|
||||
u32 temp3 = reg_G2_BG3CNT;
|
||||
u32 temp2 = (((reg_GX_DISPCNT & 0x38000000) >> 0x1B) << 0x10);
|
||||
@@ -93,7 +95,7 @@ ARM_FUNC void *G2_GetBG3ScrPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG3ScrPtr(){
|
||||
void *G2S_GetBG3ScrPtr(){
|
||||
u32 temp12 = (reg_GXS_DB_DISPCNT & 0x7);
|
||||
u32 temp3 = reg_G2S_DB_BG3CNT;
|
||||
u32 temp1 = ((temp3 & 0x1F00) >> 0x8);
|
||||
@@ -117,25 +119,25 @@ ARM_FUNC void *G2S_GetBG3ScrPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG0CharPtr(){
|
||||
void *G2_GetBG0CharPtr(){
|
||||
u32 temp = (u32)(((reg_G2_BG0CNT & 0x3C) >> 0x2) << 0xE);
|
||||
return (void *)(0x6000000 + (((reg_GX_DISPCNT & 0x7000000) >> 0x18) << 0x10) + temp);
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG0CharPtr(){
|
||||
void *G2S_GetBG0CharPtr(){
|
||||
return (void *)(0x6200000 + (((reg_G2S_DB_BG0CNT & 0x3C) >> 0x2) << 0xE));
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG1CharPtr(){
|
||||
void *G2_GetBG1CharPtr(){
|
||||
u32 temp = (u32)(((reg_G2_BG1CNT & 0x3C) >> 0x2) << 0xE);
|
||||
return (void *)(0x6000000 + (((reg_GX_DISPCNT & 0x7000000) >> 0x18) << 0x10) + temp);
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG1CharPtr(){
|
||||
void *G2S_GetBG1CharPtr(){
|
||||
return (void *)(0x6200000 + (((reg_G2S_DB_BG1CNT & 0x3C) >> 0x2) << 0xE));
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG2CharPtr(){
|
||||
void *G2_GetBG2CharPtr(){
|
||||
s32 temp1 = (s32)(reg_GX_DISPCNT & 0x7);
|
||||
u32 temp = reg_G2_BG2CNT;
|
||||
if (temp1 < 5 || !(temp & 0x80))
|
||||
@@ -150,7 +152,7 @@ ARM_FUNC void *G2_GetBG2CharPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG2CharPtr(){
|
||||
void *G2S_GetBG2CharPtr(){
|
||||
s32 temp1 = (s32)(reg_GXS_DB_DISPCNT & 0x7);
|
||||
u32 temp = reg_G2S_DB_BG2CNT;
|
||||
if (temp1 < 5 || !(temp & 0x80))
|
||||
@@ -164,7 +166,7 @@ ARM_FUNC void *G2S_GetBG2CharPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2_GetBG3CharPtr(){
|
||||
void *G2_GetBG3CharPtr(){
|
||||
s32 temp1 = (s32)(reg_GX_DISPCNT & 0x7);
|
||||
u32 temp = reg_G2_BG3CNT;
|
||||
if (temp1 < 3 || (temp1 < 6 && !(temp & 0x80)))
|
||||
@@ -179,7 +181,7 @@ ARM_FUNC void *G2_GetBG3CharPtr(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void *G2S_GetBG3CharPtr(){
|
||||
void *G2S_GetBG3CharPtr(){
|
||||
s32 temp1 = (s32)(reg_GXS_DB_DISPCNT & 0x7);
|
||||
u32 temp = reg_G2S_DB_BG3CNT;
|
||||
if (temp1 < 3 || (temp1 < 6 && !(temp & 0x80)))
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void G2x_SetBGyAffine_(u32 ptr, const struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d){
|
||||
void G2x_SetBGyAffine_(u32 ptr, const struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d){
|
||||
fx32 temp0, temp1, temp2, temp3;
|
||||
*((vu32 *)ptr + 0) = (u32)((u16)(fx16)(mtx->_[0] >> 4) | (u16)(fx16)(mtx->_[1] >> 4)<< 0x10);
|
||||
*((vu32 *)ptr + 1) = (u32)((u16)(fx16)(mtx->_[2] >> 4) | (u16)(fx16)(mtx->_[3] >> 4)<< 0x10);
|
||||
@@ -13,11 +14,11 @@ ARM_FUNC void G2x_SetBGyAffine_(u32 ptr, const struct Mtx22 *mtx, fx32 a, fx32 b
|
||||
*((vu32 *)ptr + 3) = (u32)(temp3 >> 4);
|
||||
}
|
||||
|
||||
ARM_FUNC void G2x_SetBlendAlpha_(u32 *ptr, GXBlendPlaneMask plane1, GXBlendPlaneMask plane2, fx32 c, fx32 d){
|
||||
void G2x_SetBlendAlpha_(u32 *ptr, GXBlendPlaneMask plane1, GXBlendPlaneMask plane2, fx32 c, fx32 d){
|
||||
*ptr = (u32)(((plane1 | 0x40) | (plane2 << 0x8)) | ((c | (d << 0x8)) << 0x10));
|
||||
}
|
||||
|
||||
ARM_FUNC void G2x_SetBlendBrightness_(volatile u16 *ptr, fx32 a, fx32 brightness){
|
||||
void G2x_SetBlendBrightness_(volatile u16 *ptr, fx32 a, fx32 brightness){
|
||||
if (brightness < 0)
|
||||
{
|
||||
ptr[0] = (u16)(a | 0xC0);
|
||||
@@ -30,7 +31,7 @@ ARM_FUNC void G2x_SetBlendBrightness_(volatile u16 *ptr, fx32 a, fx32 brightness
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32 d, fx32 brightness){
|
||||
void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32 d, fx32 brightness){
|
||||
ptr[1] = (u16)(c | (d << 0x8));
|
||||
if (brightness < 0)
|
||||
{
|
||||
@@ -44,7 +45,7 @@ ARM_FUNC void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G2x_ChangeBlendBrightness_(u16 *ptr, fx32 brightness){
|
||||
void G2x_ChangeBlendBrightness_(u16 *ptr, fx32 brightness){
|
||||
u32 temp = *ptr;
|
||||
if (brightness < 0)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
|
||||
ARM_FUNC void G3_BeginMakeDL(struct GXDLInfo *displaylist, void *r1, u32 r2){
|
||||
void G3_BeginMakeDL(struct GXDLInfo *displaylist, void *r1, u32 r2){
|
||||
displaylist->length = r2;
|
||||
displaylist->bottom = r1;
|
||||
displaylist->curr_cmd = r1;
|
||||
@@ -10,7 +10,7 @@ ARM_FUNC void G3_BeginMakeDL(struct GXDLInfo *displaylist, void *r1, u32 r2){
|
||||
displaylist->param0_cmd_flg = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC s32 G3_EndMakeDL(struct GXDLInfo *displaylist){
|
||||
s32 G3_EndMakeDL(struct GXDLInfo *displaylist){
|
||||
if (displaylist->bottom == (u32 *)displaylist->curr_cmd)
|
||||
return 0;
|
||||
//pads the buffer with 0 to 4byte alignment if needed
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "registers.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
|
||||
ARM_FUNC void G3i_PerspectiveW_(fx32 fovsin, fx32 fovcos, fx32 ratio, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx){
|
||||
void G3i_PerspectiveW_(fx32 fovsin, fx32 fovcos, fx32 ratio, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx){
|
||||
fx32 fovcot, temp1, temp2;
|
||||
fx64c temp0;
|
||||
vu32 *reg_ptr;
|
||||
@@ -74,7 +75,7 @@ ARM_FUNC void G3i_PerspectiveW_(fx32 fovsin, fx32 fovcos, fx32 ratio, fx32 near,
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3i_OrthoW_(fx32 top, fx32 bottom, fx32 left, fx32 right, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx){
|
||||
void G3i_OrthoW_(fx32 top, fx32 bottom, fx32 left, fx32 right, fx32 near, fx32 far, fx32 scale, u32 load, struct Mtx44 *mtx){
|
||||
fx64c temp1, temp2, temp3;
|
||||
fx32 temp0, temp4, temp5;
|
||||
vu32 *reg_ptr;
|
||||
@@ -165,7 +166,7 @@ ARM_FUNC void G3i_OrthoW_(fx32 top, fx32 bottom, fx32 left, fx32 right, fx32 nea
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3i_LookAt_(const struct Vecx32 *a, const struct Vecx32 *b, const struct Vecx32 *c, BOOL load, struct Mtx43 *mtx){
|
||||
void G3i_LookAt_(const struct Vecx32 *a, const struct Vecx32 *b, const struct Vecx32 *c, BOOL load, struct Mtx43 *mtx){
|
||||
struct Vecx32 temp, temp1, temp2;
|
||||
fx32 c1, c2, c3;
|
||||
vu32 *reg_ptr;
|
||||
@@ -216,7 +217,7 @@ ARM_FUNC void G3i_LookAt_(const struct Vecx32 *a, const struct Vecx32 *b, const
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3_RotX(fx32 sinphi, fx32 cosphi){
|
||||
void G3_RotX(fx32 sinphi, fx32 cosphi){
|
||||
vu32 *reg_ptr;
|
||||
reg_ptr = (vu32 *)®_G3_MTX_MULT_3x3;
|
||||
*reg_ptr = 0x1000;
|
||||
@@ -230,7 +231,7 @@ ARM_FUNC void G3_RotX(fx32 sinphi, fx32 cosphi){
|
||||
*reg_ptr = (vu32)cosphi;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3_RotY(fx32 sinphi, fx32 cosphi){
|
||||
void G3_RotY(fx32 sinphi, fx32 cosphi){
|
||||
vu32 *reg_ptr;
|
||||
reg_ptr = (vu32 *)®_G3_MTX_MULT_3x3;
|
||||
*reg_ptr = (vu32)cosphi;
|
||||
@@ -244,7 +245,7 @@ ARM_FUNC void G3_RotY(fx32 sinphi, fx32 cosphi){
|
||||
*reg_ptr = (vu32)cosphi;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3_RotZ(fx32 sinphi, fx32 cosphi){
|
||||
void G3_RotZ(fx32 sinphi, fx32 cosphi){
|
||||
vu32 *reg_ptr;
|
||||
reg_ptr = (vu32 *)®_G3_MTX_MULT_3x3;
|
||||
*reg_ptr = (vu32)cosphi;
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
|
||||
ARM_FUNC void G3BS_LoadMtx44(struct GXDLInfo *displaylist, struct Mtx44 *mtx){
|
||||
void G3BS_LoadMtx44(struct GXDLInfo *displaylist, struct Mtx44 *mtx){
|
||||
*(u32 *)displaylist->curr_cmd = 0x16;
|
||||
MI_Copy64B(mtx, displaylist->curr_param);
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_PushMtx(struct GXDLInfo *displaylist){
|
||||
void G3B_PushMtx(struct GXDLInfo *displaylist){
|
||||
*(u32 *)displaylist->curr_cmd = 0x11;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_PopMtx(struct GXDLInfo *displaylist, void *mtx){
|
||||
void G3B_PopMtx(struct GXDLInfo *displaylist, void *mtx){
|
||||
*(u32 *)displaylist->curr_cmd = 0x12;
|
||||
*displaylist->curr_param = (u32)mtx;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_LoadMtx44(struct GXDLInfo *displaylist, struct Mtx44 *mtx){
|
||||
void G3B_LoadMtx44(struct GXDLInfo *displaylist, struct Mtx44 *mtx){
|
||||
G3BS_LoadMtx44(displaylist, mtx);
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + sizeof(struct Mtx44);
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
//color format is RGB555, stored in the lower bits
|
||||
ARM_FUNC void G3B_Color(struct GXDLInfo * displaylist, u32 vtx_col){
|
||||
void G3B_Color(struct GXDLInfo * displaylist, u32 vtx_col){
|
||||
*(u32 *)displaylist->curr_cmd = 0x20;
|
||||
*displaylist->curr_param = vtx_col;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
@@ -39,14 +39,14 @@ Only feed normalized Vectors
|
||||
only the fractional part and the sign, which is in the first nonfraction bit
|
||||
since the vector is assumed to be normalized, are used
|
||||
*/
|
||||
ARM_FUNC void G3B_Normal(struct GXDLInfo * displaylist, fx16 x, fx16 y, fx16 z){
|
||||
void G3B_Normal(struct GXDLInfo * displaylist, fx16 x, fx16 y, fx16 z){
|
||||
*(u32 *)displaylist->curr_cmd = 0x21;
|
||||
*displaylist->curr_param = (u32)(((x >> 3) & 0x3FF) | (((y >> 3) & 0x3FF) << 0xA) | (((z >> 3) & 0x3FF) << 0x14));
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_Vtx(struct GXDLInfo * displaylist, fx32 x, fx32 y, fx32 z){
|
||||
void G3B_Vtx(struct GXDLInfo * displaylist, fx32 x, fx32 y, fx32 z){
|
||||
*(u32 *)displaylist->curr_cmd = 0x23;
|
||||
displaylist->curr_param[0] = (u32)(u16)x | (u32)(u16)y << 0x10;
|
||||
displaylist->curr_param[1] = (u32)(u16)z;
|
||||
@@ -55,14 +55,14 @@ ARM_FUNC void G3B_Vtx(struct GXDLInfo * displaylist, fx32 x, fx32 y, fx32 z){
|
||||
}
|
||||
|
||||
//TODO: name arguments
|
||||
ARM_FUNC void G3B_PolygonAttr(struct GXDLInfo *displaylist, u32 r1, u32 r2, u32 r3, u32 r4, u32 r5, u32 r6){
|
||||
void G3B_PolygonAttr(struct GXDLInfo *displaylist, u32 r1, u32 r2, u32 r3, u32 r4, u32 r5, u32 r6){
|
||||
*(u32 *)displaylist->curr_cmd = 0x29;
|
||||
*displaylist->curr_param = r1 | r2 << 0x4 | r3 << 0x6 | r6 | r4 << 0x18 | r5 << 0x10;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_MaterialColorDiffAmb(struct GXDLInfo *displaylist, u32 diffuse_col, u32 ambient_col, u32 replace){
|
||||
void G3B_MaterialColorDiffAmb(struct GXDLInfo *displaylist, u32 diffuse_col, u32 ambient_col, u32 replace){
|
||||
*(u32 *)displaylist->curr_cmd = 0x30;
|
||||
u32 replace_vtx_color_with_diffuse;
|
||||
if (replace)
|
||||
@@ -74,7 +74,7 @@ ARM_FUNC void G3B_MaterialColorDiffAmb(struct GXDLInfo *displaylist, u32 diffuse
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_MaterialColorSpecEmi(struct GXDLInfo *displaylist, u32 specular_col, u32 emission_col, u32 shiny_table){
|
||||
void G3B_MaterialColorSpecEmi(struct GXDLInfo *displaylist, u32 specular_col, u32 emission_col, u32 shiny_table){
|
||||
*(u32 *)displaylist->curr_cmd = 0x31;
|
||||
u32 enable_shininess_table;
|
||||
if (shiny_table)
|
||||
@@ -91,28 +91,28 @@ Only feed normalized Vectors
|
||||
only the fractional part and the sign, which is in the first nonfraction bit
|
||||
since the vector is assumed to be normalized, are used
|
||||
*/
|
||||
ARM_FUNC void G3B_LightVector(struct GXDLInfo * displaylist, u32 light_num, fx16 x, fx16 y, fx16 z){
|
||||
void G3B_LightVector(struct GXDLInfo * displaylist, u32 light_num, fx16 x, fx16 y, fx16 z){
|
||||
*(u32 *)displaylist->curr_cmd = 0x32;
|
||||
*displaylist->curr_param = ((x >> 3) & 0x3FF) | (((y >> 3) & 0x3FF) << 0xA) | (((z >> 3) & 0x3FF) << 0x14) | light_num << 0x1E;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_LightColor(struct GXDLInfo * displaylist, u32 light_num, u32 col){
|
||||
void G3B_LightColor(struct GXDLInfo * displaylist, u32 light_num, u32 col){
|
||||
*(u32 *)displaylist->curr_cmd = 0x33;
|
||||
*displaylist->curr_param = col | light_num << 0x1E;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_Begin(struct GXDLInfo * displaylist, u32 type){
|
||||
void G3B_Begin(struct GXDLInfo * displaylist, u32 type){
|
||||
*(u32 *)displaylist->curr_cmd = 0x40;
|
||||
*displaylist->curr_param = type;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param + 0x4;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3B_End(struct GXDLInfo * displaylist){
|
||||
void G3B_End(struct GXDLInfo * displaylist){
|
||||
*(u32 *)displaylist->curr_cmd = 0x41;
|
||||
displaylist->curr_cmd = (u8 *)displaylist->curr_param;
|
||||
displaylist->curr_param = (u32 *)displaylist->curr_cmd + 1;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void G3_LoadMtx43(struct Mtx43 *mtx){
|
||||
void G3_LoadMtx43(struct Mtx43 *mtx){
|
||||
reg_G3X_GXFIFO = 0x17;
|
||||
GX_SendFifo48B(mtx, (void *)®_G3X_GXFIFO);
|
||||
}
|
||||
|
||||
ARM_FUNC void G3_MultMtx43(struct Mtx43 *mtx){
|
||||
void G3_MultMtx43(struct Mtx43 *mtx){
|
||||
reg_G3X_GXFIFO = 0x19;
|
||||
GX_SendFifo48B(mtx, (void *)®_G3X_GXFIFO);
|
||||
}
|
||||
|
||||
ARM_FUNC void G3_MultMtx33(struct Mtx33 *mtx){
|
||||
void G3_MultMtx33(struct Mtx33 *mtx){
|
||||
reg_G3X_GXFIFO = 0x1A;
|
||||
MI_Copy36B(mtx, (void *)®_G3X_GXFIFO);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u32 GXi_DmaId;
|
||||
|
||||
ARM_FUNC asm void GXi_NopClearFifo128_(void *reg){
|
||||
asm void GXi_NopClearFifo128_(void *reg){
|
||||
mov r1, #0x0
|
||||
mov r2, #0x0
|
||||
mov r3, #0x0
|
||||
@@ -44,7 +45,7 @@ ARM_FUNC asm void GXi_NopClearFifo128_(void *reg){
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_Init(){
|
||||
void G3X_Init(){
|
||||
G3X_ClearFifo();
|
||||
reg_G3_END_VTXS = 0x0;
|
||||
while (reg_G3X_GXSTAT & 0x8000000) {} //wait for geometry engine to not be busy
|
||||
@@ -71,7 +72,7 @@ ARM_FUNC void G3X_Init(){
|
||||
reg_G3_TEXPLTT_BASE = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_ResetMtxStack(){
|
||||
void G3X_ResetMtxStack(){
|
||||
while (reg_G3X_GXSTAT & 0x8000000) {}
|
||||
reg_G3X_GXSTAT |= 0x8000;
|
||||
reg_G3X_DISP3DCNT |= 0x2000;
|
||||
@@ -82,12 +83,12 @@ ARM_FUNC void G3X_ResetMtxStack(){
|
||||
reg_G3_TEXPLTT_BASE = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_ClearFifo(){
|
||||
void G3X_ClearFifo(){
|
||||
GXi_NopClearFifo128_((void *)®_G3X_GXFIFO);
|
||||
while (reg_G3X_GXSTAT & 0x8000000) {}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_InitMtxStack(){
|
||||
void G3X_InitMtxStack(){
|
||||
u32 PV_level, PJ_level;
|
||||
reg_G3X_GXSTAT |= 0x8000;
|
||||
while (G3X_GetMtxStackLevelPV(&PV_level)) {}
|
||||
@@ -105,7 +106,7 @@ ARM_FUNC void G3X_InitMtxStack(){
|
||||
reg_G3_MTX_IDENTITY = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_ResetMtxStack_2(){
|
||||
void G3X_ResetMtxStack_2(){
|
||||
u32 PV_level, PJ_level;
|
||||
reg_G3X_GXSTAT |= 0x8000;
|
||||
while (G3X_GetMtxStackLevelPV(&PV_level)) {}
|
||||
@@ -124,7 +125,7 @@ ARM_FUNC void G3X_ResetMtxStack_2(){
|
||||
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_SetFog(u32 enable, u32 alphamode, u32 depth, s32 offset){
|
||||
void G3X_SetFog(u32 enable, u32 alphamode, u32 depth, s32 offset){
|
||||
if (enable)
|
||||
{
|
||||
reg_G3X_FOG_OFFSET = (u16)offset;
|
||||
@@ -137,7 +138,7 @@ ARM_FUNC void G3X_SetFog(u32 enable, u32 alphamode, u32 depth, s32 offset){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 G3X_GetClipMtx(struct Mtx44 *dst){
|
||||
u32 G3X_GetClipMtx(struct Mtx44 *dst){
|
||||
if (reg_G3X_GXSTAT & 0x8000000)
|
||||
{
|
||||
return (u32)-1;
|
||||
@@ -149,7 +150,7 @@ ARM_FUNC u32 G3X_GetClipMtx(struct Mtx44 *dst){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 G3X_GetVectorMtx(struct Mtx33 *dst){
|
||||
u32 G3X_GetVectorMtx(struct Mtx33 *dst){
|
||||
if (reg_G3X_GXSTAT & 0x8000000)
|
||||
{
|
||||
return (u32)-1;
|
||||
@@ -161,15 +162,15 @@ ARM_FUNC u32 G3X_GetVectorMtx(struct Mtx33 *dst){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_SetEdgeColorTable(void *tbl_ptr){
|
||||
void G3X_SetEdgeColorTable(void *tbl_ptr){
|
||||
MIi_CpuCopy16(tbl_ptr, (void *)®_G3X_EDGE_COLOR_0, 0x10);
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_SetFogTable(void *tbl_ptr){
|
||||
void G3X_SetFogTable(void *tbl_ptr){
|
||||
MI_Copy32B(tbl_ptr, (void *)®_G3X_FOG_TABLE_0);
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_SetClearColor(u32 col, u32 alpha, u32 depth, u32 polygon_id, u32 enable_fog){
|
||||
void G3X_SetClearColor(u32 col, u32 alpha, u32 depth, u32 polygon_id, u32 enable_fog){
|
||||
u32 temp = col | (alpha << 0x10) | (polygon_id << 0x18);
|
||||
if (enable_fog)
|
||||
temp |= 0x8000;
|
||||
@@ -177,7 +178,7 @@ ARM_FUNC void G3X_SetClearColor(u32 col, u32 alpha, u32 depth, u32 polygon_id, u
|
||||
reg_G3X_CLEAR_DEPTH = (u16)depth;
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_InitTable(){
|
||||
void G3X_InitTable(){
|
||||
if (GXi_DmaId != -1)
|
||||
{
|
||||
MI_DmaFill32Async(GXi_DmaId, (void *)®_G3X_EDGE_COLOR_0, 0x0, 0x10, 0x0, 0x0);
|
||||
@@ -194,7 +195,7 @@ ARM_FUNC void G3X_InitTable(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 G3X_GetMtxStackLevelPV(u32 *level){
|
||||
u32 G3X_GetMtxStackLevelPV(u32 *level){
|
||||
if (reg_G3X_GXSTAT & 0x4000)
|
||||
{
|
||||
return (u32)-1;
|
||||
@@ -206,7 +207,7 @@ ARM_FUNC u32 G3X_GetMtxStackLevelPV(u32 *level){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 G3X_GetMtxStackLevelPJ(u32 *level){
|
||||
u32 G3X_GetMtxStackLevelPJ(u32 *level){
|
||||
if (reg_G3X_GXSTAT & 0x4000)
|
||||
{
|
||||
return (u32)-1;
|
||||
@@ -218,7 +219,7 @@ ARM_FUNC u32 G3X_GetMtxStackLevelPJ(u32 *level){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC u32 G3X_GetBoxTestResult(u32 *result){
|
||||
u32 G3X_GetBoxTestResult(u32 *result){
|
||||
if (reg_G3X_GXSTAT & 0x1)
|
||||
{
|
||||
return (u32)-1;
|
||||
@@ -230,6 +231,6 @@ ARM_FUNC u32 G3X_GetBoxTestResult(u32 *result){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void G3X_SetHOffset(u32 offset){
|
||||
void G3X_SetHOffset(u32 offset){
|
||||
reg_G2_BG0OFS = offset;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "main.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u32 GXi_DmaId;
|
||||
|
||||
@@ -20,121 +21,121 @@ static inline void *_GXS_OBJ_PTR(){
|
||||
return (void *)0x6600000;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBGPltt(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBGPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(0x5000000 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBGPltt(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBGPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(0x5000400 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadOBJPltt(void *src, u32 offset, u32 size){
|
||||
void GX_LoadOBJPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(0x5000200 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadOBJPltt(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadOBJPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(0x5000600 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadOAM(void *src, u32 offset, u32 size){
|
||||
void GX_LoadOAM(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(0x7000000 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadOAM(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadOAM(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(0x7000400 + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadOBJ(void *src, u32 offset, u32 size){
|
||||
void GX_LoadOBJ(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)_GX_OBJ_PTR();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadOBJ(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadOBJ(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)_GXS_OBJ_PTR();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG0Scr(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG0Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG0ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG0Scr(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG0Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG0ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG1Scr(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG1Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG1ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG1Scr(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG1Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG1ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG2Scr(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG2Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG2ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG2Scr(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG2Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG2ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG3Scr(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG3Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG3ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG3Scr(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG3Scr(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG3ScrPtr();
|
||||
GXi_DmaCopy16(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG0Char(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG0Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG0CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG0Char(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG0Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG0CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG1Char(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG1Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG1CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG1Char(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG1Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG1CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG2Char(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG2Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG2CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG2Char(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG2Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG2CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBG3Char(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBG3Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2_GetBG3CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBG3Char(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBG3Char(void *src, u32 offset, u32 size){
|
||||
u32 base = (u32)G2S_GetBG3CharPtr();
|
||||
GXi_DmaCopy32(GXi_DmaId, src, (void *)(base + offset), size);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_BeginLoadBGExtPltt(){
|
||||
void GX_BeginLoadBGExtPltt(){
|
||||
sBGExtPltt = (s32)GX_ResetBankForBGExtPltt();
|
||||
switch (sBGExtPltt)
|
||||
{
|
||||
@@ -156,11 +157,11 @@ ARM_FUNC void GX_BeginLoadBGExtPltt(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadBGExtPltt(void *src, u32 offset, u32 size){
|
||||
void GX_LoadBGExtPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(sBGExtPlttLCDCBlk + offset - sBGExtPlttLCDCOffset), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_EndLoadBGExtPltt(){
|
||||
void GX_EndLoadBGExtPltt(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForBGExtPltt(sBGExtPltt);
|
||||
sBGExtPltt = 0x0;
|
||||
@@ -168,7 +169,7 @@ ARM_FUNC void GX_EndLoadBGExtPltt(){
|
||||
sBGExtPlttLCDCOffset = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_BeginLoadOBJExtPltt(){
|
||||
void GX_BeginLoadOBJExtPltt(){
|
||||
sOBJExtPltt = (s32)GX_ResetBankForOBJExtPltt();
|
||||
switch (sOBJExtPltt)
|
||||
{
|
||||
@@ -183,40 +184,40 @@ ARM_FUNC void GX_BeginLoadOBJExtPltt(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadOBJExtPltt(void *src, u32 offset, u32 size){
|
||||
void GX_LoadOBJExtPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(sOBJExtPlttLCDCBlk + offset), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_EndLoadOBJExtPltt(){
|
||||
void GX_EndLoadOBJExtPltt(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForOBJExtPltt(sOBJExtPltt);
|
||||
sOBJExtPltt = 0x0;
|
||||
sOBJExtPlttLCDCBlk = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_BeginLoadBGExtPltt(){
|
||||
void GXS_BeginLoadBGExtPltt(){
|
||||
sSubBGExtPltt = (s32)GX_ResetBankForSubBGExtPltt();
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadBGExtPltt(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadBGExtPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(0x06898000 + offset), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_EndLoadBGExtPltt(){
|
||||
void GXS_EndLoadBGExtPltt(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForSubBGExtPltt(sSubBGExtPltt);
|
||||
sSubBGExtPltt = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_BeginLoadOBJExtPltt(){
|
||||
void GXS_BeginLoadOBJExtPltt(){
|
||||
sSubOBJExtPltt = (s32)GX_ResetBankForSubOBJExtPltt();
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_LoadOBJExtPltt(void *src, u32 offset, u32 size){
|
||||
void GXS_LoadOBJExtPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(0x068A0000 + offset), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GXS_EndLoadOBJExtPltt(){
|
||||
void GXS_EndLoadOBJExtPltt(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForSubOBJExtPltt(sSubOBJExtPltt);
|
||||
sSubOBJExtPltt = 0x0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u32 GXi_DmaId;
|
||||
|
||||
@@ -50,7 +50,7 @@ static const u16 sTexPlttStartAddrTable[8] = {
|
||||
static s32 sClrImg = 0;
|
||||
static u32 sClrImgLCDCBlk = 0;
|
||||
|
||||
ARM_FUNC void GX_BeginLoadTex(){
|
||||
void GX_BeginLoadTex(){
|
||||
u32 temp = GX_ResetBankForTex();
|
||||
sTex = (s32)temp;
|
||||
sTexLCDCBlk1 = (u32)(sTexStartAddrTable[temp].blk1 << 0xC);
|
||||
@@ -58,7 +58,7 @@ ARM_FUNC void GX_BeginLoadTex(){
|
||||
sSzTexBlk1 = (u32)(sTexStartAddrTable[temp].szBlk1 << 0xC);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadTex(void *src, u32 offset, u32 size){
|
||||
void GX_LoadTex(void *src, u32 offset, u32 size){
|
||||
void *temp;
|
||||
if (!sTexLCDCBlk2)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ ARM_FUNC void GX_LoadTex(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, temp, size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_EndLoadTex(){
|
||||
void GX_EndLoadTex(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForTex(sTex);
|
||||
sSzTexBlk1 = 0x0;
|
||||
@@ -96,24 +96,24 @@ ARM_FUNC void GX_EndLoadTex(){
|
||||
sTex = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_BeginLoadTexPltt(){
|
||||
void GX_BeginLoadTexPltt(){
|
||||
s32 temp = (s32)GX_ResetBankForTexPltt();
|
||||
sTexPltt = temp;
|
||||
sTexPlttLCDCBlk = (u32)(sTexPlttStartAddrTable[temp >> 4] << 0xC);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadTexPltt(void *src, u32 offset, u32 size){
|
||||
void GX_LoadTexPltt(void *src, u32 offset, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(sTexPlttLCDCBlk + offset), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_EndLoadTexPltt(){
|
||||
void GX_EndLoadTexPltt(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForTexPltt(sTexPltt);
|
||||
sTexPltt = 0x0;
|
||||
sTexPlttLCDCBlk = 0x0;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_BeginLoadClearImage(){
|
||||
void GX_BeginLoadClearImage(){
|
||||
u32 temp = GX_ResetBankForClearImage();
|
||||
sClrImg = (s32)temp;
|
||||
switch (temp)
|
||||
@@ -134,15 +134,15 @@ ARM_FUNC void GX_BeginLoadClearImage(){
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadClearImageColor(void *src, u32 size){
|
||||
void GX_LoadClearImageColor(void *src, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(sClrImgLCDCBlk), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_LoadClearImageDepth(void *src, u32 size){
|
||||
void GX_LoadClearImageDepth(void *src, u32 size){
|
||||
GXi_DmaCopy32Async(GXi_DmaId, src, (void *)(sClrImgLCDCBlk + 0x20000), size, NULL, NULL);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_EndLoadClearImage(){
|
||||
void GX_EndLoadClearImage(){
|
||||
GXi_WaitDma(GXi_DmaId);
|
||||
GX_SetBankForClearImage(sClrImg);
|
||||
sClrImg = 0x0;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
struct GX_State gGXState;
|
||||
|
||||
ARM_FUNC void GX_InitGXState(){
|
||||
void GX_InitGXState(){
|
||||
gGXState.lcdc = 0x0;
|
||||
gGXState.bg = 0x0;
|
||||
gGXState.obj = 0x0;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "gx.h"
|
||||
#include "code32.h"
|
||||
|
||||
extern u16 GXi_VRamLockId;
|
||||
extern struct GX_State gGXState;
|
||||
|
||||
ARM_FUNC void GX_VRAMCNT_SetLCDC_(u32 mask){
|
||||
void GX_VRAMCNT_SetLCDC_(u32 mask) {
|
||||
if (mask & (0x1 << 0))
|
||||
reg_GX_VRAMCNT_A = 0x80;
|
||||
if (mask & (0x1 << 1))
|
||||
@@ -25,7 +26,7 @@ ARM_FUNC void GX_VRAMCNT_SetLCDC_(u32 mask){
|
||||
reg_GX_VRAMCNT_I = 0x80;
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForBG(s32 bg){
|
||||
void GX_SetBankForBG(s32 bg){
|
||||
gGXState.lcdc = (u16)(~bg & (gGXState.lcdc | gGXState.bg));
|
||||
gGXState.bg = (u16)bg;
|
||||
switch (bg)
|
||||
@@ -98,7 +99,7 @@ ARM_FUNC void GX_SetBankForBG(s32 bg){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForOBJ(s32 obj){
|
||||
void GX_SetBankForOBJ(s32 obj){
|
||||
gGXState.lcdc = (u16)(~obj & (gGXState.lcdc | gGXState.obj));
|
||||
gGXState.obj = (u16)obj;
|
||||
switch (obj)
|
||||
@@ -137,7 +138,7 @@ ARM_FUNC void GX_SetBankForOBJ(s32 obj){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForBGExtPltt(s32 bgextpltt){
|
||||
void GX_SetBankForBGExtPltt(s32 bgextpltt){
|
||||
gGXState.lcdc = (u16)(~bgextpltt & (gGXState.lcdc | gGXState.bgExtPltt));
|
||||
gGXState.bgExtPltt = (u16)bgextpltt;
|
||||
switch (bgextpltt)
|
||||
@@ -163,7 +164,7 @@ ARM_FUNC void GX_SetBankForBGExtPltt(s32 bgextpltt){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForOBJExtPltt(s32 objextpltt){
|
||||
void GX_SetBankForOBJExtPltt(s32 objextpltt){
|
||||
gGXState.lcdc = (u16)(~objextpltt & (gGXState.lcdc | gGXState.objExtPltt));
|
||||
gGXState.objExtPltt = (u16)objextpltt;
|
||||
switch (objextpltt)
|
||||
@@ -183,7 +184,7 @@ ARM_FUNC void GX_SetBankForOBJExtPltt(s32 objextpltt){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForTex(s32 tex){
|
||||
void GX_SetBankForTex(s32 tex){
|
||||
gGXState.lcdc = (u16)(~tex & (gGXState.lcdc | gGXState.tex));
|
||||
gGXState.tex = (u16)tex;
|
||||
if (tex == 0)
|
||||
@@ -246,7 +247,7 @@ ARM_FUNC void GX_SetBankForTex(s32 tex){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForTexPltt(s32 texpltt){
|
||||
void GX_SetBankForTexPltt(s32 texpltt){
|
||||
gGXState.lcdc = (u16)(~texpltt & (gGXState.lcdc | gGXState.texPltt));
|
||||
gGXState.texPltt = (u16)texpltt;
|
||||
switch (texpltt)
|
||||
@@ -272,7 +273,7 @@ ARM_FUNC void GX_SetBankForTexPltt(s32 texpltt){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForClearImage(s32 clearimage){
|
||||
void GX_SetBankForClearImage(s32 clearimage){
|
||||
gGXState.lcdc = (u16)(~clearimage & (gGXState.lcdc | gGXState.clrImg));
|
||||
gGXState.clrImg = (u16)clearimage;
|
||||
switch (clearimage)
|
||||
@@ -303,7 +304,7 @@ ARM_FUNC void GX_SetBankForClearImage(s32 clearimage){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForARM7(s32 arm7){
|
||||
void GX_SetBankForARM7(s32 arm7){
|
||||
gGXState.lcdc = (u16)(~arm7 & (gGXState.lcdc | gGXState.arm7));
|
||||
gGXState.arm7 = (u16)arm7;
|
||||
switch (arm7)
|
||||
@@ -323,12 +324,12 @@ ARM_FUNC void GX_SetBankForARM7(s32 arm7){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForLCDC(s32 lcdc){
|
||||
void GX_SetBankForLCDC(s32 lcdc){
|
||||
gGXState.lcdc |= lcdc;
|
||||
GX_VRAMCNT_SetLCDC_((u32)lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForSubBG(s32 subbg){
|
||||
void GX_SetBankForSubBG(s32 subbg){
|
||||
gGXState.lcdc = (u16)(~subbg & (gGXState.lcdc | gGXState.sub_bg));
|
||||
gGXState.sub_bg = (u16)subbg;
|
||||
switch (subbg)
|
||||
@@ -347,7 +348,7 @@ ARM_FUNC void GX_SetBankForSubBG(s32 subbg){
|
||||
}
|
||||
|
||||
|
||||
ARM_FUNC void GX_SetBankForSubOBJ(s32 subobj){
|
||||
void GX_SetBankForSubOBJ(s32 subobj){
|
||||
gGXState.lcdc = (u16)(~subobj & (gGXState.lcdc | gGXState.sub_obj));
|
||||
gGXState.sub_obj = (u16)subobj;
|
||||
switch (subobj)
|
||||
@@ -364,7 +365,7 @@ ARM_FUNC void GX_SetBankForSubOBJ(s32 subobj){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForSubBGExtPltt(s32 subbgextpltt){
|
||||
void GX_SetBankForSubBGExtPltt(s32 subbgextpltt){
|
||||
gGXState.lcdc = (u16)(~subbgextpltt & (gGXState.lcdc | gGXState.sub_bgExtPltt));
|
||||
gGXState.sub_bgExtPltt = (u16)subbgextpltt;
|
||||
switch (subbgextpltt)
|
||||
@@ -380,7 +381,7 @@ ARM_FUNC void GX_SetBankForSubBGExtPltt(s32 subbgextpltt){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC void GX_SetBankForSubOBJExtPltt(s32 subobjextpltt){
|
||||
void GX_SetBankForSubOBJExtPltt(s32 subobjextpltt){
|
||||
gGXState.lcdc = (u16)(~subobjextpltt & (gGXState.lcdc | gGXState.sub_objExtPltt));
|
||||
gGXState.sub_objExtPltt = (u16)subobjextpltt;
|
||||
switch (subobjextpltt)
|
||||
@@ -396,7 +397,7 @@ ARM_FUNC void GX_SetBankForSubOBJExtPltt(s32 subobjextpltt){
|
||||
GX_VRAMCNT_SetLCDC_(gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 resetBankForX_(u16 *ptr){
|
||||
u32 resetBankForX_(u16 *ptr){
|
||||
u16 temp = *ptr;
|
||||
*ptr = 0;
|
||||
gGXState.lcdc |= temp;
|
||||
@@ -404,55 +405,55 @@ ARM_FUNC u32 resetBankForX_(u16 *ptr){
|
||||
return temp;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForBG(){
|
||||
u32 GX_ResetBankForBG(){
|
||||
return resetBankForX_(&gGXState.bg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForOBJ(){
|
||||
u32 GX_ResetBankForOBJ(){
|
||||
return resetBankForX_(&gGXState.obj);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForBGExtPltt(){
|
||||
u32 GX_ResetBankForBGExtPltt(){
|
||||
reg_GX_DISPCNT &= ~0x40000000;
|
||||
return resetBankForX_(&gGXState.bgExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForOBJExtPltt(){
|
||||
u32 GX_ResetBankForOBJExtPltt(){
|
||||
reg_GX_DISPCNT &= ~0x80000000;
|
||||
return resetBankForX_(&gGXState.objExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForTex(){
|
||||
u32 GX_ResetBankForTex(){
|
||||
return resetBankForX_(&gGXState.tex);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForTexPltt(){
|
||||
u32 GX_ResetBankForTexPltt(){
|
||||
return resetBankForX_(&gGXState.texPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForClearImage(){
|
||||
u32 GX_ResetBankForClearImage(){
|
||||
return resetBankForX_(&gGXState.clrImg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForSubBG(){
|
||||
u32 GX_ResetBankForSubBG(){
|
||||
return resetBankForX_(&gGXState.sub_bg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForSubOBJ(){
|
||||
u32 GX_ResetBankForSubOBJ(){
|
||||
return resetBankForX_(&gGXState.sub_obj);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForSubBGExtPltt(){
|
||||
u32 GX_ResetBankForSubBGExtPltt(){
|
||||
reg_GXS_DB_DISPCNT &= ~REG_GXS_DB_DISPCNT_BG_MASK;
|
||||
return resetBankForX_(&gGXState.sub_bgExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_ResetBankForSubOBJExtPltt(){
|
||||
u32 GX_ResetBankForSubOBJExtPltt(){
|
||||
reg_GXS_DB_DISPCNT &= ~REG_GXS_DB_DISPCNT_O_MASK;
|
||||
return resetBankForX_(&gGXState.sub_objExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 disableBankForX_(u16 *ptr){
|
||||
u32 disableBankForX_(u16 *ptr){
|
||||
u32 temp = *ptr;
|
||||
*ptr = 0;
|
||||
if (temp & (0x1 << 0))
|
||||
@@ -477,102 +478,102 @@ ARM_FUNC u32 disableBankForX_(u16 *ptr){
|
||||
return temp;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForBG(){
|
||||
u32 GX_DisableBankForBG(){
|
||||
return disableBankForX_(&gGXState.bg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForOBJ(){
|
||||
u32 GX_DisableBankForOBJ(){
|
||||
return disableBankForX_(&gGXState.obj);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForBGExtPltt(){
|
||||
u32 GX_DisableBankForBGExtPltt(){
|
||||
reg_GX_DISPCNT &= ~REG_GX_DISPCNT_BG_MASK;
|
||||
return disableBankForX_(&gGXState.bgExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForOBJExtPltt(){
|
||||
u32 GX_DisableBankForOBJExtPltt(){
|
||||
reg_GX_DISPCNT &= ~REG_GX_DISPCNT_O_MASK;
|
||||
return disableBankForX_(&gGXState.objExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForTex(){
|
||||
u32 GX_DisableBankForTex(){
|
||||
return disableBankForX_(&gGXState.tex);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForTexPltt(){
|
||||
u32 GX_DisableBankForTexPltt(){
|
||||
return disableBankForX_(&gGXState.texPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForClearImage(){
|
||||
u32 GX_DisableBankForClearImage(){
|
||||
return disableBankForX_(&gGXState.clrImg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForARM7(){
|
||||
u32 GX_DisableBankForARM7(){
|
||||
return disableBankForX_(&gGXState.arm7);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForLCDC(){
|
||||
u32 GX_DisableBankForLCDC(){
|
||||
return disableBankForX_(&gGXState.lcdc);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForSubBG(){
|
||||
u32 GX_DisableBankForSubBG(){
|
||||
return disableBankForX_(&gGXState.sub_bg);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForSubOBJ(){
|
||||
u32 GX_DisableBankForSubOBJ(){
|
||||
return disableBankForX_(&gGXState.sub_obj);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForSubBGExtPltt(){
|
||||
u32 GX_DisableBankForSubBGExtPltt(){
|
||||
reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_BG_MASK;
|
||||
return disableBankForX_(&gGXState.sub_bgExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_DisableBankForSubOBJExtPltt(){
|
||||
u32 GX_DisableBankForSubOBJExtPltt(){
|
||||
reg_GXS_DB_DISPCNT &= ~REG_GX_DISPCNT_O_MASK;
|
||||
return disableBankForX_(&gGXState.sub_objExtPltt);
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForBG(){
|
||||
u32 GX_GetBankForBG(){
|
||||
return gGXState.bg;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForOBJ(){
|
||||
u32 GX_GetBankForOBJ(){
|
||||
return gGXState.obj;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForBGExtPltt(){
|
||||
u32 GX_GetBankForBGExtPltt(){
|
||||
return gGXState.bgExtPltt;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForOBJExtPltt(){
|
||||
u32 GX_GetBankForOBJExtPltt(){
|
||||
return gGXState.objExtPltt;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForTex(){
|
||||
u32 GX_GetBankForTex(){
|
||||
return gGXState.tex;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForTexPltt(){
|
||||
u32 GX_GetBankForTexPltt(){
|
||||
return gGXState.texPltt;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForLCDC(){
|
||||
u32 GX_GetBankForLCDC(){
|
||||
return gGXState.lcdc;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForSubBG(){
|
||||
u32 GX_GetBankForSubBG(){
|
||||
return gGXState.sub_bg;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForSubOBJ(){
|
||||
u32 GX_GetBankForSubOBJ(){
|
||||
return gGXState.sub_obj;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForSubBGExtPltt(){
|
||||
u32 GX_GetBankForSubBGExtPltt(){
|
||||
return gGXState.sub_bgExtPltt;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 GX_GetBankForSubOBJExtPltt(){
|
||||
u32 GX_GetBankForSubOBJExtPltt(){
|
||||
return gGXState.sub_objExtPltt;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "MATH_crc.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MATHi_CRC8InitTable(struct MATHCRC8Table *table, u8 poly) {
|
||||
void MATHi_CRC8InitTable(struct MATHCRC8Table *table, u8 poly) {
|
||||
u32 r, i, j;
|
||||
u8 *t = table->table;
|
||||
|
||||
@@ -19,7 +20,7 @@ ARM_FUNC void MATHi_CRC8InitTable(struct MATHCRC8Table *table, u8 poly) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length) {
|
||||
void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length) {
|
||||
u32 r, i;
|
||||
const u8* t = table->table;
|
||||
u8* data = (u8*)input;
|
||||
@@ -32,7 +33,7 @@ ARM_FUNC void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Contex
|
||||
*context = (MATHCRC8Context)r;
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC16InitTable(struct MATHCRC16Table *table, u16 poly) {
|
||||
void MATHi_CRC16InitTable(struct MATHCRC16Table *table, u16 poly) {
|
||||
u32 r, i, j;
|
||||
u16 *t = table->table;
|
||||
|
||||
@@ -50,7 +51,7 @@ ARM_FUNC void MATHi_CRC16InitTable(struct MATHCRC16Table *table, u16 poly) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC16InitTableRev(struct MATHCRC16Table *table, u16 poly) {
|
||||
void MATHi_CRC16InitTableRev(struct MATHCRC16Table *table, u16 poly) {
|
||||
u32 r, i, j;
|
||||
u16 *t = table->table;
|
||||
|
||||
@@ -68,7 +69,7 @@ ARM_FUNC void MATHi_CRC16InitTableRev(struct MATHCRC16Table *table, u16 poly) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length) {
|
||||
void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length) {
|
||||
u32 r, i;
|
||||
const u16* t = table->table;
|
||||
u8* data = (u8*)input;
|
||||
@@ -81,7 +82,7 @@ ARM_FUNC void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Con
|
||||
*context = (MATHCRC16Context)r;
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length) {
|
||||
void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length) {
|
||||
u32 r, i;
|
||||
const u16* t = table->table;
|
||||
u8* data = (u8*)input;
|
||||
@@ -94,7 +95,7 @@ ARM_FUNC void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16
|
||||
*context = (MATHCRC16Context)r;
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC32InitTableRev(struct MATHCRC32Table *table, u32 poly) {
|
||||
void MATHi_CRC32InitTableRev(struct MATHCRC32Table *table, u32 poly) {
|
||||
u32 r, i, j;
|
||||
u32 *t = table->table;
|
||||
|
||||
@@ -112,7 +113,7 @@ ARM_FUNC void MATHi_CRC32InitTableRev(struct MATHCRC32Table *table, u32 poly) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MATHi_CRC32UpdateRev(const struct MATHCRC32Table *table, MATHCRC32Context *context, const void *input, u32 length) {
|
||||
void MATHi_CRC32UpdateRev(const struct MATHCRC32Table *table, MATHCRC32Context *context, const void *input, u32 length) {
|
||||
u32 r, i;
|
||||
const u32* t = table->table;
|
||||
u8* data = (u8*)input;
|
||||
@@ -125,25 +126,25 @@ ARM_FUNC void MATHi_CRC32UpdateRev(const struct MATHCRC32Table *table, MATHCRC32
|
||||
*context = r;
|
||||
}
|
||||
|
||||
ARM_FUNC u8 MATH_CalcCRC8(const struct MATHCRC8Table *table, const void *data, u32 dataLength) {
|
||||
u8 MATH_CalcCRC8(const struct MATHCRC8Table *table, const void *data, u32 dataLength) {
|
||||
MATHCRC8Context ctx = 0;
|
||||
MATHi_CRC8Update(table, &ctx, data, dataLength);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ARM_FUNC u16 MATH_CalcCRC16(const struct MATHCRC16Table *table, const void *data, u32 dataLength) {
|
||||
u16 MATH_CalcCRC16(const struct MATHCRC16Table *table, const void *data, u32 dataLength) {
|
||||
MATHCRC16Context ctx = 0;
|
||||
MATHi_CRC16UpdateRev(table, &ctx, data, dataLength);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ARM_FUNC u16 MATH_CalcCRC16CCITT(const struct MATHCRC16Table *table, const void *data, u32 dataLength) {
|
||||
u16 MATH_CalcCRC16CCITT(const struct MATHCRC16Table *table, const void *data, u32 dataLength) {
|
||||
MATHCRC16Context ctx = 0xffff;
|
||||
MATHi_CRC16Update(table, &ctx, data, dataLength);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 MATH_CalcCRC32(const struct MATHCRC32Table *table, const void *data, u32 dataLength) {
|
||||
u32 MATH_CalcCRC32(const struct MATHCRC32Table *table, const void *data, u32 dataLength) {
|
||||
MATHCRC32Context ctx = (MATHCRC32Context)(~0);
|
||||
MATHi_CRC32UpdateRev(table, &ctx, data, dataLength);
|
||||
return ~ctx;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "MATH_dgt.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MATH_CalcMD5(void *digest, const void *data, u32 dataLength) {
|
||||
void MATH_CalcMD5(void *digest, const void *data, u32 dataLength) {
|
||||
MATHMD5Context context;
|
||||
MATH_MD5Init(&context);
|
||||
MATH_MD5Update(&context, data, dataLength);
|
||||
MATH_MD5GetHash(&context, digest);
|
||||
}
|
||||
|
||||
ARM_FUNC void MATH_CalcSHA1(void *digest, const void *data, u32 dataLength) {
|
||||
void MATH_CalcSHA1(void *digest, const void *data, u32 dataLength) {
|
||||
MATHSHA1Context context;
|
||||
MATH_SHA1Init(&context);
|
||||
MATH_SHA1Update(&context, data, dataLength);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "MATH_pop.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC u8 MATH_CountPopulation(u32 x) {
|
||||
u8 MATH_CountPopulation(u32 x) {
|
||||
x -= (x >> 1) & 0x55555555;
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
x += x >> 4;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "MI_dma.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "sections.h"
|
||||
#include "code32.h"
|
||||
|
||||
#pragma section ITCM begin
|
||||
ARM_FUNC void MIi_DmaSetParams(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
void MIi_DmaSetParams(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
{
|
||||
OSIntrMode lastIntrMode = OS_DisableInterrupts();
|
||||
vu32 *p = (vu32 *)((u32)REG_ADDR_DMA0SAD + dmaNo * 12);
|
||||
@@ -15,7 +15,7 @@ ARM_FUNC void MIi_DmaSetParams(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
(void)OS_RestoreInterrupts(lastIntrMode);
|
||||
}
|
||||
|
||||
ARM_FUNC void MIi_DmaSetParams_wait(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
void MIi_DmaSetParams_wait(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
vu32 *p = (vu32 *)((u32)REG_ADDR_DMA0SAD + dmaNo * 12);
|
||||
@@ -41,7 +41,7 @@ ARM_FUNC void MIi_DmaSetParams_wait(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC void MIi_DmaSetParams_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
void MIi_DmaSetParams_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
{
|
||||
vu32 *p = (vu32 *)((u32)REG_ADDR_DMA0SAD + dmaNo * 12);
|
||||
*p = (vu32)src;
|
||||
@@ -49,7 +49,7 @@ ARM_FUNC void MIi_DmaSetParams_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
*(p + 2) = (vu32)ctrl;
|
||||
}
|
||||
|
||||
ARM_FUNC void MIi_DmaSetParams_wait_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
void MIi_DmaSetParams_wait_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl)
|
||||
{
|
||||
vu32 *p = (vu32 *)((u32)REG_ADDR_DMA0SAD + dmaNo * 12);
|
||||
*p = (vu32)src;
|
||||
@@ -81,7 +81,7 @@ ARM_FUNC void MIi_DmaSetParams_wait_noInt(u32 dmaNo, u32 src, u32 dest, u32 ctrl
|
||||
}
|
||||
#pragma section ITCM end
|
||||
|
||||
ARM_FUNC void MI_DmaFill32(u32 dmaNo, void *dest, u32 data, u32 size)
|
||||
void MI_DmaFill32(u32 dmaNo, void *dest, u32 data, u32 size)
|
||||
{
|
||||
vu32 *dmaCntp;
|
||||
if (!size)
|
||||
@@ -103,7 +103,7 @@ ARM_FUNC void MI_DmaFill32(u32 dmaNo, void *dest, u32 data, u32 size)
|
||||
} while(0);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_DmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
void MI_DmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
{
|
||||
vu32 *dmaCntp;
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, DMA_SRC_INC);
|
||||
@@ -127,7 +127,7 @@ ARM_FUNC void MI_DmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
} while(0);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_DmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
void MI_DmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
{
|
||||
vu32 *dmaCntp;
|
||||
|
||||
@@ -152,7 +152,7 @@ ARM_FUNC void MI_DmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
} while(0);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_DmaFill32Async(u32 dmaNo, void *dest, u32 data, u32 size, MIDmaCallback callback, void *arg)
|
||||
void MI_DmaFill32Async(u32 dmaNo, void *dest, u32 data, u32 size, MIDmaCallback callback, void *arg)
|
||||
{
|
||||
if (!size)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ ARM_FUNC void MI_DmaFill32Async(u32 dmaNo, void *dest, u32 data, u32 size, MIDma
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_DmaCopy32Async(u32 dmaNo, const void *src, void *dest, u32 size, MIDmaCallback callback, void *arg)
|
||||
void MI_DmaCopy32Async(u32 dmaNo, const void *src, void *dest, u32 size, MIDmaCallback callback, void *arg)
|
||||
{
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, DMA_SRC_INC);
|
||||
|
||||
@@ -198,7 +198,7 @@ ARM_FUNC void MI_DmaCopy32Async(u32 dmaNo, const void *src, void *dest, u32 size
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_WaitDma(u32 dmaNo)
|
||||
void MI_WaitDma(u32 dmaNo)
|
||||
{
|
||||
OSIntrMode lastIntrMode = OS_DisableInterrupts();
|
||||
vu32 *dmaCntp = &((vu32 *)REG_ADDR_DMA0SAD)[dmaNo * 3 + 2];
|
||||
@@ -216,7 +216,7 @@ ARM_FUNC void MI_WaitDma(u32 dmaNo)
|
||||
(void)OS_RestoreInterrupts(lastIntrMode);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_StopDma(u32 dmaNo)
|
||||
void MI_StopDma(u32 dmaNo)
|
||||
{
|
||||
OSIntrMode lastIntrMode = OS_DisableInterrupts();
|
||||
vu16 *dmaCntp = &((vu16 *)REG_ADDR_DMA0SAD)[dmaNo * 6 + 5];
|
||||
@@ -243,7 +243,7 @@ ARM_FUNC void MI_StopDma(u32 dmaNo)
|
||||
(void)OS_RestoreInterrupts(lastIntrMode);
|
||||
}
|
||||
|
||||
ARM_FUNC void MIi_CheckAnotherAutoDMA(u32 dmaNo, u32 dmaType)
|
||||
void MIi_CheckAnotherAutoDMA(u32 dmaNo, u32 dmaType)
|
||||
{
|
||||
u32 dmaCnt;
|
||||
u32 timing;
|
||||
@@ -277,7 +277,7 @@ ARM_FUNC void MIi_CheckAnotherAutoDMA(u32 dmaNo, u32 dmaType)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void MIi_CheckDma0SourceAddress(u32 dmaNo, u32 src, u32 size, u32 dir)
|
||||
void MIi_CheckDma0SourceAddress(u32 dmaNo, u32 src, u32 size, u32 dir)
|
||||
{
|
||||
if (!dmaNo)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "MI_dma_card.h"
|
||||
#include "MI_dma.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MIi_CardDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
void MIi_CardDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
{
|
||||
MIi_CheckAnotherAutoDMA(dmaNo, MIi_DMA_TIMING_ANY);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_FIX);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "MI_dma_gxcommand.h"
|
||||
#include "function_target.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_reset.h"
|
||||
#include "sections.h"
|
||||
#include "code32.h"
|
||||
|
||||
static MIiGXDmaParams MIi_GXDmaParams = { FALSE };
|
||||
|
||||
@@ -11,7 +11,7 @@ static void MIi_DMACallback(void *arg);
|
||||
static void MIi_DMAFastCallback(void *arg);
|
||||
|
||||
#pragma section ITCM begin
|
||||
ARM_FUNC void MI_SendGXCommand(u32 dmaNo, const void *src, u32 commandLength)
|
||||
void MI_SendGXCommand(u32 dmaNo, const void *src, u32 commandLength)
|
||||
{
|
||||
vu32 *dmaCntp;
|
||||
u32 leftLength = commandLength;
|
||||
@@ -44,7 +44,7 @@ ARM_FUNC void MI_SendGXCommand(u32 dmaNo, const void *src, u32 commandLength)
|
||||
}
|
||||
#pragma section ITCM end
|
||||
|
||||
ARM_FUNC void MI_SendGXCommandAsync(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg)
|
||||
void MI_SendGXCommandAsync(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg)
|
||||
{
|
||||
if (!commandLength)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ ARM_FUNC void MI_SendGXCommandAsync(u32 dmaNo, const void *src, u32 commandLengt
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void MIi_FIFOCallback(void)
|
||||
static void MIi_FIFOCallback(void)
|
||||
{
|
||||
if (!MIi_GXDmaParams.length)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ ARM_FUNC static void MIi_FIFOCallback(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC static void MIi_DMACallback(void *arg)
|
||||
static void MIi_DMACallback(void *arg)
|
||||
{
|
||||
#pragma unused(arg)
|
||||
(void)OS_DisableIrqMask(OS_IE_GXFIFO);
|
||||
@@ -121,7 +121,7 @@ ARM_FUNC static void MIi_DMACallback(void *arg)
|
||||
MIi_CallCallback(MIi_GXDmaParams.callback, MIi_GXDmaParams.arg);
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_SendGXCommandAsyncFast(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg)
|
||||
void MI_SendGXCommandAsyncFast(u32 dmaNo, const void *src, u32 commandLength, MIDmaCallback callback, void *arg)
|
||||
{
|
||||
if (!commandLength)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ ARM_FUNC void MI_SendGXCommandAsyncFast(u32 dmaNo, const void *src, u32 commandL
|
||||
MIi_DmaSetParams(dmaNo, (u32)src, (u32)REG_GXFIFO_ADDR, MI_CNT_GXCOPY_IF(commandLength));
|
||||
}
|
||||
|
||||
ARM_FUNC static void MIi_DMAFastCallback(void *arg)
|
||||
static void MIi_DMAFastCallback(void *arg)
|
||||
{
|
||||
#pragma unused(arg)
|
||||
MIi_GXDmaParams.isBusy = FALSE;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "MI_dma_hblank.h"
|
||||
#include "MI_dma.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MI_HBlankDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
void MI_HBlankDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
{
|
||||
MIi_CheckAnotherAutoDMA(dmaNo, MI_DMA_TIMING_H_BLANK);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_INC);
|
||||
@@ -16,7 +16,7 @@ ARM_FUNC void MI_HBlankDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 siz
|
||||
MIi_DmaSetParams(dmaNo, (u32)src, (u32)dest, (u32)(0x96600000 | (size / 4)));
|
||||
}
|
||||
|
||||
ARM_FUNC void MI_HBlankDmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
void MI_HBlankDmaCopy16(u32 dmaNo, const void *src, void *dest, u32 size)
|
||||
{
|
||||
MIi_CheckAnotherAutoDMA(dmaNo, MI_DMA_TIMING_H_BLANK);
|
||||
MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_INC);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "MI_init.h"
|
||||
#include "nitro/types.h"
|
||||
#include "function_target.h"
|
||||
#include "MI_dma.h"
|
||||
#include "MI_wram.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MI_Init(void)
|
||||
void MI_Init(void)
|
||||
{
|
||||
MI_SetWramBank(MI_WRAM_ARM7_ALL);
|
||||
MI_StopDma(0);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "MI_memory.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void MIi_CpuClear16(register u16 data, register void *destp, register u32 size)
|
||||
asm void MIi_CpuClear16(register u16 data, register void *destp, register u32 size)
|
||||
{
|
||||
mov r3, #0
|
||||
|
||||
@@ -14,7 +14,7 @@ _020CE1CC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuCopy16(register const void *srcp, register void *destp, register u32 size)
|
||||
asm void MIi_CpuCopy16(register const void *srcp, register void *destp, register u32 size)
|
||||
{
|
||||
mov r12, #0
|
||||
|
||||
@@ -28,7 +28,7 @@ _020CE1CC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuClear32(register u32 data, register void *destp, register u32 size)
|
||||
asm void MIi_CpuClear32(register u32 data, register void *destp, register u32 size)
|
||||
{
|
||||
add r12, r1, r2
|
||||
|
||||
@@ -39,7 +39,7 @@ _020CE200:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuCopy32(register const void *srcp, register void *destp, register u32 size)
|
||||
asm void MIi_CpuCopy32(register const void *srcp, register void *destp, register u32 size)
|
||||
{
|
||||
add r12, r1, r2
|
||||
|
||||
@@ -51,7 +51,7 @@ _020CE214:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuSend32(register const void *srcp, volatile void *destp, u32 size)
|
||||
asm void MIi_CpuSend32(register const void *srcp, volatile void *destp, u32 size)
|
||||
{
|
||||
add r12, r0, r2
|
||||
|
||||
@@ -64,7 +64,7 @@ _020CE22C:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuClearFast(register u32 data, register void *destp, register u32 size)
|
||||
asm void MIi_CpuClearFast(register u32 data, register void *destp, register u32 size)
|
||||
{
|
||||
stmfd sp!, {r4-r9}
|
||||
|
||||
@@ -93,7 +93,7 @@ _020CE278:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MIi_CpuCopyFast(register const void *srcp, register void *destp, register u32 size)
|
||||
asm void MIi_CpuCopyFast(register const void *srcp, register void *destp, register u32 size)
|
||||
{
|
||||
stmfd sp!, {r4-r10}
|
||||
|
||||
@@ -116,7 +116,7 @@ _020CE2AC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_Copy32B(register const void *pSrc, register void *pDest)
|
||||
asm void MI_Copy32B(register const void *pSrc, register void *pDest)
|
||||
{
|
||||
ldmia r0!, {r2, r3, r12}
|
||||
stmia r1!, {r2, r3, r12}
|
||||
@@ -128,7 +128,7 @@ ARM_FUNC asm void MI_Copy32B(register const void *pSrc, register void *pDest)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_Copy36B(register const void *pSrc, register void *pDest)
|
||||
asm void MI_Copy36B(register const void *pSrc, register void *pDest)
|
||||
{
|
||||
ldmia r0!, {r2, r3, r12}
|
||||
stmia r1!, {r2, r3, r12}
|
||||
@@ -140,7 +140,7 @@ ARM_FUNC asm void MI_Copy36B(register const void *pSrc, register void *pDest)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_Copy48B(register const void *pSrc, register void *pDest)
|
||||
asm void MI_Copy48B(register const void *pSrc, register void *pDest)
|
||||
{
|
||||
ldmia r0!, {r2, r3, r12}
|
||||
stmia r1!, {r2, r3, r12}
|
||||
@@ -154,7 +154,7 @@ ARM_FUNC asm void MI_Copy48B(register const void *pSrc, register void *pDest)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_Copy64B(register const void *pSrc, register void *pDest)
|
||||
asm void MI_Copy64B(register const void *pSrc, register void *pDest)
|
||||
{
|
||||
ldmia r0!, {r2, r3, r12}
|
||||
stmia r1!, {r2, r3, r12}
|
||||
@@ -170,7 +170,7 @@ ARM_FUNC asm void MI_Copy64B(register const void *pSrc, register void *pDest)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_CpuFill8(register void *dstp, register u8 data, register u32 size)
|
||||
asm void MI_CpuFill8(register void *dstp, register u8 data, register u32 size)
|
||||
{
|
||||
cmp r2, #0
|
||||
bxeq lr
|
||||
@@ -222,7 +222,7 @@ _020CE3C0:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void MI_CpuCopy8(register const void *srcp, register void *dstp, register u32 size)
|
||||
asm void MI_CpuCopy8(register const void *srcp, register void *dstp, register u32 size)
|
||||
{
|
||||
cmp r2, #0
|
||||
bxeq lr
|
||||
@@ -326,7 +326,9 @@ _020CE4EC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
THUMB_FUNC asm void MI_Zero36B(register void *pDest)
|
||||
#include "code16.h" //following func is thumb
|
||||
|
||||
asm void MI_Zero36B(register void *pDest)
|
||||
{
|
||||
mov r1, #0
|
||||
mov r2, #0
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "MI_swap.h"
|
||||
|
||||
#include "code32.h"
|
||||
|
||||
/*
|
||||
* Exchange 32 bits of data between register and memory.
|
||||
*
|
||||
@@ -8,8 +10,7 @@
|
||||
* but it is not linked in pokediamond.
|
||||
*/
|
||||
|
||||
asm
|
||||
u32 MI_SwapWord(register u32 setData, register vu32 * destp)
|
||||
asm u32 MI_SwapWord(register u32 setData, register vu32 * destp)
|
||||
{
|
||||
swp setData, setData, [destp]
|
||||
bx lr
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "function_target.h"
|
||||
#include "MI_uncompress.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void MI_UncompressLZ8(register const void *srcp, register void *destp)
|
||||
asm void MI_UncompressLZ8(register const void *srcp, register void *destp)
|
||||
{
|
||||
stmfd sp!, {r4-r6, lr}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "MI_wram.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "registers.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC void MI_SetWramBank(MIWram cnt)
|
||||
void MI_SetWramBank(MIWram cnt)
|
||||
{
|
||||
reg_GX_VRAMCNT_WRAM = (u8)cnt;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "function_target.h"
|
||||
#include "consts.h"
|
||||
#include "OS_alarm.h"
|
||||
#include "OS_interrupt.h"
|
||||
#include "OS_irqTable.h"
|
||||
#include "OS_terminate_proc.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
static struct OSiAlarmQueue OSi_AlarmQueue;
|
||||
|
||||
@@ -14,7 +14,7 @@ static void OSi_SetTimer(OSAlarm *alarm);
|
||||
static void OSi_InsertAlarm(OSAlarm *alarm, OSTick fire);
|
||||
static void OSi_ArrangeTimer(void);
|
||||
|
||||
ARM_FUNC static void OSi_SetTimer(OSAlarm *alarm)
|
||||
static void OSi_SetTimer(OSAlarm *alarm)
|
||||
{
|
||||
OSTick tick = OS_GetTick();
|
||||
|
||||
@@ -44,7 +44,7 @@ ARM_FUNC static void OSi_SetTimer(OSAlarm *alarm)
|
||||
(void)OS_EnableIrqMask(OS_IE_TIMER1);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_InitAlarm(void)
|
||||
void OS_InitAlarm(void)
|
||||
{
|
||||
if (!OSi_UseAlarm)
|
||||
{
|
||||
@@ -59,18 +59,18 @@ ARM_FUNC void OS_InitAlarm(void)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL OS_IsAlarmAvailable(void)
|
||||
BOOL OS_IsAlarmAvailable(void)
|
||||
{
|
||||
return OSi_UseAlarm;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_CreateAlarm(OSAlarm *alarm)
|
||||
void OS_CreateAlarm(OSAlarm *alarm)
|
||||
{
|
||||
alarm->handler = 0;
|
||||
alarm->tag = 0;
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_InsertAlarm(OSAlarm *alarm, OSTick fire)
|
||||
static void OSi_InsertAlarm(OSAlarm *alarm, OSTick fire)
|
||||
{
|
||||
if (alarm->period > 0)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ ARM_FUNC static void OSi_InsertAlarm(OSAlarm *alarm, OSTick fire)
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetAlarm(OSAlarm * alarm, OSTick tick, OSAlarmHandler handler, void *arg)
|
||||
void OS_SetAlarm(OSAlarm * alarm, OSTick tick, OSAlarmHandler handler, void *arg)
|
||||
{
|
||||
if (!alarm || alarm->handler)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ ARM_FUNC void OS_SetAlarm(OSAlarm * alarm, OSTick tick, OSAlarmHandler handler,
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_CancelAlarm(OSAlarm *alarm)
|
||||
void OS_CancelAlarm(OSAlarm *alarm)
|
||||
{
|
||||
OSIntrMode enabled = OS_DisableInterrupts();
|
||||
|
||||
@@ -186,7 +186,7 @@ ARM_FUNC void OS_CancelAlarm(OSAlarm *alarm)
|
||||
(void)OS_RestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
ARM_FUNC asm void OSi_AlarmHandler(void *arg)
|
||||
asm void OSi_AlarmHandler(void *arg)
|
||||
{
|
||||
stmfd sp!, {r0, lr}
|
||||
bl OSi_ArrangeTimer
|
||||
@@ -194,7 +194,7 @@ ARM_FUNC asm void OSi_AlarmHandler(void *arg)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC static void OSi_ArrangeTimer(void)
|
||||
static void OSi_ArrangeTimer(void)
|
||||
{
|
||||
OS_SetTimerControl(OS_TIMER_1, 0);
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
//
|
||||
// Created by mart on 4/23/20.
|
||||
//
|
||||
#include "function_target.h"
|
||||
#include "OS_alloc.h"
|
||||
#include "consts.h"
|
||||
#include "OS_system.h"
|
||||
#include "code32.h"
|
||||
|
||||
void* OSiHeapInfo[OS_ARENA_MAX];
|
||||
|
||||
ARM_FUNC Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
{
|
||||
cell->next = list;
|
||||
cell->prev = NULL;
|
||||
@@ -18,7 +15,7 @@ ARM_FUNC Cell* DLAddFront(Cell* list, Cell* cell)
|
||||
return cell;
|
||||
}
|
||||
|
||||
ARM_FUNC Cell* DLExtract(Cell* list, Cell* cell)
|
||||
Cell* DLExtract(Cell* list, Cell* cell)
|
||||
{
|
||||
if (cell->next) {
|
||||
cell->next->prev = cell->prev;
|
||||
@@ -31,7 +28,7 @@ ARM_FUNC Cell* DLExtract(Cell* list, Cell* cell)
|
||||
return list;
|
||||
}
|
||||
|
||||
ARM_FUNC Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
{
|
||||
Cell *prevCell = NULL;
|
||||
Cell *nextCell = original;
|
||||
@@ -82,7 +79,7 @@ ARM_FUNC Cell *DLInsert(Cell *original, Cell *inserted)
|
||||
#define HEADERSIZE OSi_ROUND(sizeof(Cell), 32)
|
||||
#define MINOBJSIZE (HEADERSIZE+32)
|
||||
|
||||
ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
|
||||
void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
|
||||
OSHeapInfo* heapInfo;
|
||||
HeapDesc* hd;
|
||||
Cell* cell;
|
||||
@@ -145,7 +142,7 @@ ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
|
||||
return (void *)((char *)cell + HEADERSIZE);
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr) {
|
||||
void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr) {
|
||||
OSHeapInfo *heapInfo;
|
||||
HeapDesc *hd;
|
||||
Cell *cell;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "OS_arena.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "nitro/types.h"
|
||||
#include "OS_protectionRegion.h"
|
||||
#include "OS_emulator.h"
|
||||
#include "mmap.h"
|
||||
#include "code32.h"
|
||||
|
||||
static BOOL OSi_Initialized = FALSE;
|
||||
static BOOL OSi_MainExArenaEnabled = FALSE;
|
||||
@@ -15,7 +16,7 @@ extern void SDK_SECTION_ARENA_DTCM_START(); // TODO: technically this should be
|
||||
extern void SDK_IRQ_STACKSIZE(); // TODO: technically this should be defined in the lcf
|
||||
extern void SDK_SYS_STACKSIZE(); // TODO: technically this should be defined in the lcf
|
||||
|
||||
ARM_FUNC void OS_InitArena(void) {
|
||||
void OS_InitArena(void) {
|
||||
if (OSi_Initialized) {
|
||||
return;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ ARM_FUNC void OS_InitArena(void) {
|
||||
OS_SetArenaLo(OS_ARENA_WRAM_MAIN, OS_GetInitArenaLo(OS_ARENA_WRAM_MAIN));
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_InitArenaEx(void) {
|
||||
void OS_InitArenaEx(void) {
|
||||
OS_SetArenaHi(OS_ARENA_MAINEX, OS_GetInitArenaHi(OS_ARENA_MAINEX));
|
||||
OS_SetArenaLo(OS_ARENA_MAINEX, OS_GetInitArenaLo(OS_ARENA_MAINEX));
|
||||
|
||||
@@ -50,15 +51,15 @@ ARM_FUNC void OS_InitArenaEx(void) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetArenaHi(OSArenaId id) {
|
||||
void* OS_GetArenaHi(OSArenaId id) {
|
||||
return OSi_GetArenaInfo().hi[id];
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetArenaLo(OSArenaId id) {
|
||||
void* OS_GetArenaLo(OSArenaId id) {
|
||||
return OSi_GetArenaInfo().lo[id];
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetInitArenaHi(OSArenaId id) {
|
||||
void* OS_GetInitArenaHi(OSArenaId id) {
|
||||
switch (id) {
|
||||
case OS_ARENA_MAIN:
|
||||
return (void *)OSi_MAIN_ARENA_HI_DEFAULT;
|
||||
@@ -96,7 +97,7 @@ ARM_FUNC void* OS_GetInitArenaHi(OSArenaId id) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
switch (id) {
|
||||
case OS_ARENA_MAIN:
|
||||
return (void *)SDK_MAIN_ARENA_LO;
|
||||
@@ -119,15 +120,15 @@ ARM_FUNC void* OS_GetInitArenaLo(OSArenaId id) {
|
||||
}
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetArenaHi(OSArenaId id, void* newHi) {
|
||||
void OS_SetArenaHi(OSArenaId id, void* newHi) {
|
||||
OSi_GetArenaInfo().hi[id] = newHi;
|
||||
}
|
||||
|
||||
ARM_FUNC void OS_SetArenaLo(OSArenaId id, void* newLo) {
|
||||
void OS_SetArenaLo(OSArenaId id, void* newLo) {
|
||||
OSi_GetArenaInfo().lo[id] = newLo;
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_AllocFromArenaLo(OSArenaId id, u32 size, u32 align) {
|
||||
void* OS_AllocFromArenaLo(OSArenaId id, u32 size, u32 align) {
|
||||
void* ptr;
|
||||
u8* arenaLo;
|
||||
ptr = OS_GetArenaLo(id);
|
||||
@@ -145,7 +146,7 @@ ARM_FUNC void* OS_AllocFromArenaLo(OSArenaId id, u32 size, u32 align) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
ARM_FUNC void* OS_AllocFromArenaHi(OSArenaId id, u32 size, u32 align) {
|
||||
void* OS_AllocFromArenaHi(OSArenaId id, u32 size, u32 align) {
|
||||
void* ptr;
|
||||
u8* arenaHi;
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "OS_cache.h"
|
||||
#include "nitro/types.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void DC_InvalidateAll(void)
|
||||
asm void DC_InvalidateAll(void)
|
||||
{
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c6, 0 //Invalidate Entire Data Cache
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_StoreAll(void)
|
||||
asm void DC_StoreAll(void)
|
||||
{
|
||||
mov r1, #0
|
||||
|
||||
@@ -30,7 +30,7 @@ _020CC0CC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_FlushAll(void)
|
||||
asm void DC_FlushAll(void)
|
||||
{
|
||||
mov r12, #0
|
||||
mov r1, #0
|
||||
@@ -53,7 +53,7 @@ _020CC0FC:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_InvalidateRange(register void *startAddr, register u32 nBytes)
|
||||
asm void DC_InvalidateRange(register void *startAddr, register u32 nBytes)
|
||||
{
|
||||
add r1, r1, r0
|
||||
bic r0, r0, #31
|
||||
@@ -67,7 +67,7 @@ _020CC12C:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_StoreRange(register void *startAddr, register u32 nBytes)
|
||||
asm void DC_StoreRange(register void *startAddr, register u32 nBytes)
|
||||
{
|
||||
add r1, r1, r0
|
||||
bic r0, r0, #31
|
||||
@@ -81,7 +81,7 @@ _020CC148:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_FlushRange(register const void *startAddr, register u32 nBytes)
|
||||
asm void DC_FlushRange(register const void *startAddr, register u32 nBytes)
|
||||
{
|
||||
mov r12, #0
|
||||
add r1, r1, r0
|
||||
@@ -97,21 +97,21 @@ _020CC168:
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void DC_WaitWriteBufferEmpty(void)
|
||||
asm void DC_WaitWriteBufferEmpty(void)
|
||||
{
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c10, 4 //Drain Write Buffer
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void IC_InvalidateAll(void)
|
||||
asm void IC_InvalidateAll(void)
|
||||
{
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c5, 0 //Invalidate Entire Instruction Cache
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void IC_InvalidateRange(register void *startAddr, register u32 nBytes)
|
||||
asm void IC_InvalidateRange(register void *startAddr, register u32 nBytes)
|
||||
{
|
||||
add r1, r1, r0
|
||||
bic r0, r0, #31
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "OS_context.h"
|
||||
#include "consts.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
ARM_FUNC asm void OS_InitContext(register OSContext *context, register u32 newpc, register u32 newsp)
|
||||
asm void OS_InitContext(register OSContext *context, register u32 newpc, register u32 newsp)
|
||||
{
|
||||
add newpc, newpc, #4
|
||||
str newpc, [context, #0x40]
|
||||
@@ -38,7 +38,7 @@ ARM_FUNC asm void OS_InitContext(register OSContext *context, register u32 newpc
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm BOOL OS_SaveContext(register OSContext* context)
|
||||
asm BOOL OS_SaveContext(register OSContext* context)
|
||||
{
|
||||
stmfd sp!, {lr, r0}
|
||||
add r0, r0, #0x48
|
||||
@@ -65,7 +65,7 @@ ARM_FUNC asm BOOL OS_SaveContext(register OSContext* context)
|
||||
bx lr
|
||||
}
|
||||
|
||||
ARM_FUNC asm void OS_LoadContext(register OSContext* context)
|
||||
asm void OS_LoadContext(register OSContext* context)
|
||||
{
|
||||
stmfd sp!, {lr, r0}
|
||||
add r0, r0, #0x48
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
//
|
||||
// Created by red031000 on 2020-05-05.
|
||||
//
|
||||
|
||||
#include "OS_emulator.h"
|
||||
#include "function_target.h"
|
||||
#include "code32.h"
|
||||
|
||||
u32 OSi_ConsoleTypeCache = -1u;
|
||||
|
||||
ARM_FUNC BOOL OS_IsRunOnEmulator(void) {
|
||||
BOOL OS_IsRunOnEmulator(void) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ARM_FUNC u32 OS_GetConsoleType(void) {
|
||||
u32 OS_GetConsoleType(void) {
|
||||
OSi_ConsoleTypeCache = OS_CONSOLE_NITRO | OS_CONSOLE_DEV_CARD | OS_CONSOLE_SIZE_4MB;
|
||||
|
||||
return OSi_ConsoleTypeCache;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user