Cleanup HW register usage

This commit is contained in:
Phillip Stephens 2023-02-07 05:51:34 -08:00
parent 1e5c3990ea
commit b1137488f6
23 changed files with 56 additions and 46 deletions

View File

@ -58,7 +58,8 @@
"osfastcast.h": "c",
"osfont.h": "c",
"arq.h": "c",
"string.h": "c"
"string.h": "c",
"hw_regs.h": "c"
},
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,

View File

@ -2,7 +2,7 @@
#define _DOLPHIN_DVDPRIV
#include <dolphin/dvd.h>
#include <dolphin/dvd_regs.h>
#include <dolphin/hw_regs.h>
#include <types.h>
#ifdef __cplusplus
@ -37,10 +37,9 @@ typedef struct DVDBB2 {
typedef void (*DVDOptionalCommandChecker)(DVDCommandBlock* block, void (*cb)(u32 intType));
typedef void (*DVDLowCallback)(u32 intType);
extern DVDDiskID* DVDGetCurrentDiskID();
DVDLowCallback DVDLowClearCallback();
BOOL DVDLowSeek(u32 offset, DVDLowCallback callback);
void __DVDLowSetWAType(u32 type, u32 location);
DVDCommandBlock* __DVDPopWaitingQueue();

View File

@ -1,9 +0,0 @@
#ifndef _DOLPHIN_DSP_REGS
#define _DOLPHIN_DSP_REGS
#include "types.h"
vu16 __DSPRegs[32] : 0xCC005000;
vu32 __AIRegs[8] : 0xCC006C00;
#endif // _DOLPHIN_DSP_REGS

View File

@ -1,6 +0,0 @@
#ifndef _DOLPHIN_DVD_REGS
#define _DOLPHIN_DVD_REGS
vu32 __DIRegs[16] : 0xCC006000;
#endif // _DOLPHIN_DVD_REGS

35
include/dolphin/hw_regs.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef _DOLPHIN_HW_REGS
#define _DOLPHIN_HW_REGS
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
vu16 __VIRegs[59] : 0xCC002000;
vu32 __PIRegs[12] : 0xCC003000;
vu16 __MEMRegs[64] : 0xCC004000;
vu16 __DSPRegs[32] : 0xCC005000;
vu32 __DIRegs[16] : 0xCC006000;
vu32 __SIRegs[64] : 0xCC006400;
vu32 __EXIRegs[16] : 0xCC006800;
vu32 __AIRegs[8] : 0xCC006C00;
#else
#define __VIRegs ((vu16*)0xCC002000)
#define __PIRegs ((vu32*)0xCC003000)
#define __MEMRegs ((vu16*)0xCC004000)
#define __DSPRegs ((vu16*)0xCC005000)
#define __DIRegs ((vu32*)0xCC006000)
#define __SIRegs ((vu32*)0xCC006400)
#define __EXIRegs ((vu32*)0xCC006800)
#define __AIRegs ((vu32*)0xCC006C00)
#endif
#ifdef __cplusplus
}
#endif
#endif // _DOLPHIN_HW_REGS

View File

@ -12,7 +12,7 @@ OSTime __OSGetSystemTime();
OSTime __OSTimeToSystemTime(OSTime);
#ifdef __cplusplus
extern "C" {
}
#endif
#endif // _DOLPHIN_OSPRIV

View File

@ -22,11 +22,7 @@ void VISetWindowFullscreen(bool fullscreen);
bool VIGetWindowFullscreen();
#endif
#ifdef __MWERKS__
vu16 __VIRegs[59] : 0xCC002000;
#else
vu16 __VIRegs[59];
#endif
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
#include "dolphin/ai.h"
#include "dolphin/dsp_regs.h"
#include "dolphin/hw_regs.h"
#include "dolphin/os.h"
const char* __AIVersion = "<< Dolphin SDK - AI\trelease build: Sep 5 2002 05:34:25 (0x2301) >>";

View File

@ -1,6 +1,6 @@
#include "dolphin/ar.h"
#include "dolphin/dsp_regs.h"
#include "dolphin/hw_regs.h"
#include "dolphin/os.h"
static const char* __ARVersion =

View File

@ -6,6 +6,7 @@
#include <dolphin/CARDPriv.h>
#include <dolphin/OSRtcPriv.h>
#include <dolphin/vi.h>
#include <dolphin/hw_regs.h>
static void FormatCallback(s32 chan, s32 result) {
CARDControl* card;

View File

@ -1,7 +1,7 @@
#include "dolphin/dsp.h"
#include "dolphin/os.h"
#include "dolphin/dsp_regs.h"
#include "dolphin/hw_regs.h"
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
#include "dolphin/dsp.h"
#include "dolphin/dsp_regs.h"
#include "dolphin/hw_regs.h"
DSPTaskInfo* __DSP_curr_task;
DSPTaskInfo* __DSP_first_task;

View File

@ -1,6 +1,6 @@
#include <dolphin/DVDPriv.h>
#include <dolphin/dvd.h>
#include <dolphin/dvd_regs.h>
#include <dolphin/hw_regs.h>
#include <dolphin/os.h>
#include <dolphin/os/OSBootInfo.h>

View File

@ -1,6 +1,6 @@
#include <dolphin/DVDPriv.h>
#include <dolphin/dvd.h>
#include <dolphin/dvd_regs.h>
#include <dolphin/hw_regs.h>
#include <string.h>

View File

@ -4,7 +4,6 @@
extern DVDDiskID* DVDGetCurrentDiskID();
extern OSTime __OSGetSystemTime();
vu32 __PIRegs[12] : 0xCC003000;
static BOOL FirstRead = TRUE;
static volatile BOOL StopAtNextInt = FALSE;

View File

@ -1,6 +1,6 @@
#include <dolphin/DVDPriv.h>
#include <dolphin/dvd.h>
#include <dolphin/dvd_regs.h>
#include <dolphin/hw_regs.h>
#include <dolphin/os.h>
#include <dolphin/os/OSBootInfo.h>
#include <string.h>

View File

@ -1,9 +1,8 @@
#include "dolphin/os.h"
#include "dolphin/hw_regs.h"
#pragma scheduling off
vu32 __EXIRegs[16] : 0xCC006800;
static const char* __EXIVersion =
"<< Dolphin SDK - EXI\trelease build: Sep 5 2002 05:33:04 (0x2301) >>";

View File

@ -605,7 +605,6 @@ void __OSPSInit(void)
// clang-format on
}
vu32 __DIRegs[16] : 0xCC006000;
#define DI_CONFIG_IDX 0x9
#define DI_CONFIG_CONFIG_MASK 0xFF
u32 __OSGetDIConfig(void) { return (__DIRegs[DI_CONFIG_IDX] & DI_CONFIG_CONFIG_MASK); }

View File

@ -1,4 +1,5 @@
#include "types.h"
#include "dolphin/hw_regs.h"
#ifdef __cplusplus
extern "C" {
@ -17,7 +18,6 @@ static u8 DSPInitCode[128] = {
// clang-format on
};
volatile u16 __DSPRegs[] : 0xCC005000;
#define __DSPWorkBuffer (void*)0x81000000
void __OSInitAudioSystem(void) {

View File

@ -1,6 +1,5 @@
#include <dolphin/PPCArch.h>
#include <dolphin/dsp_regs.h>
#include <dolphin/dvd_regs.h>
#include <dolphin/hw_regs.h>
#include <dolphin/os.h>
#include <stdio.h>

View File

@ -1,15 +1,9 @@
#include <dolphin/os.h>
#include <dolphin/hw_regs.h>
static asm void ExternalInterruptHandler(register __OSException exception,
register OSContext* context);
// TODO: Move these to a more appropriate location
vu32 __PIRegs[12] : 0xCC003000;
vu32 __EXIRegs[16] : 0xCC006800;
vu16 __MEMRegs[64] : 0xCC004000;
vu16 __DSPRegs[32] : 0xCC005000;
vu32 __AIRegs[8] : 0xCC006C00;
extern void __RAS_OSDisableInterrupts_begin(void);
extern void __RAS_OSDisableInterrupts_end(void);

View File

@ -1,6 +1,7 @@
#include "dolphin/OSRtcPriv.h"
#include "dolphin/os.h"
#include "dolphin/vi.h"
#include "dolphin/hw_regs.h"
volatile u8 DAT_800030e2 : 0x800030e2;
typedef struct Unk {

View File

@ -1,5 +1,7 @@
#include "dolphin/sipriv.h"
#include "dolphin/vi.h"
#include "dolphin/hw_regs.h"
#pragma dont_inline on
static u32 SamplingRate;