mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-08-21 21:40:36 -04:00
Link jaudio_NES/audiothread.c
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
#ifndef _DOLPHIN_HW_REGS_H_
|
||||
#define _DOLPHIN_HW_REGS_H_
|
||||
|
||||
#ifdef __MWERKS__
|
||||
volatile u16 __VIRegs[59] : 0xCC002000;
|
||||
volatile u32 __PIRegs[12] : 0xCC003000;
|
||||
volatile u16 __MEMRegs[64] : 0xCC004000;
|
||||
volatile u16 __DSPRegs[] : 0xCC005000;
|
||||
volatile u32 __DIRegs[] : 0xCC006000;
|
||||
volatile u32 __SIRegs[0x100] : 0xCC006400;
|
||||
volatile u32 __EXIRegs[0x40] : 0xCC006800;
|
||||
volatile u32 __AIRegs[8] : 0xCC006C00;
|
||||
#else
|
||||
#define __VIRegs ((volatile u16*)0xCC002000)
|
||||
#define __PIRegs ((volatile u32*)0xCC003000)
|
||||
#define __MEMRegs ((volatile u16*)0xCC004000)
|
||||
#define __DSPRegs ((volatile u16*)0xCC005000)
|
||||
#define __DIRegs ((volatile u32*)0xCC006000)
|
||||
#define __SIRegs ((volatile u32*)0xCC006400)
|
||||
#define __EXIRegs ((volatile u32*)0xCC006800)
|
||||
#define __AIRegs ((volatile u32*)0xCC006C00)
|
||||
#endif
|
||||
|
||||
// Offsets for __VIRegs
|
||||
|
||||
// offsets for __VIRegs[i]
|
||||
#define VI_VERT_TIMING (0)
|
||||
#define VI_DISP_CONFIG (1)
|
||||
#define VI_HORIZ_TIMING_0L (2)
|
||||
#define VI_HORIZ_TIMING_0U (3)
|
||||
#define VI_HORIZ_TIMING_1L (4)
|
||||
#define VI_HORIZ_TIMING_1U (5)
|
||||
#define VI_VERT_TIMING_ODD (6)
|
||||
#define VI_VERT_TIMING_ODD_U (7)
|
||||
#define VI_VERT_TIMING_EVEN (8)
|
||||
#define VI_VERT_TIMING_EVEN_U (9)
|
||||
|
||||
#define VI_BBI_ODD (10) // burst blanking interval
|
||||
#define VI_BBI_ODD_U (11) // burst blanking interval
|
||||
#define VI_BBI_EVEN (12) // burst blanking interval
|
||||
#define VI_BBI_EVEN_U (13) // burst blanking interval
|
||||
|
||||
#define VI_TOP_FIELD_BASE_LEFT (14) // top in 2d, top of left pic in 3d
|
||||
#define VI_TOP_FIELD_BASE_LEFT_U (15) // top in 2d, top of left pic in 3d
|
||||
|
||||
#define VI_TOP_FIELD_BASE_RIGHT (16) // top of right pic in 3d
|
||||
#define VI_TOP_FIELD_BASE_RIGHT_U (17) // top of right pic in 3d
|
||||
|
||||
#define VI_BTTM_FIELD_BASE_LEFT (18) // bottom in 2d, bottom of left pic in 3d
|
||||
#define VI_BTTM_FIELD_BASE_LEFT_U (19) // bottom in 2d, bottom of left pic in 3d
|
||||
|
||||
#define VI_BTTM_FIELD_BASE_RIGHT (20) // bottom of right pic in 3d
|
||||
#define VI_BTTM_FIELD_BASE_RIGHT_U (21) // bottom of right pic in 3d
|
||||
|
||||
#define VI_VERT_COUNT (22) // vertical display position
|
||||
#define VI_HORIZ_COUNT (23) // horizontal display position
|
||||
|
||||
#define VI_DISP_INT_0 (24) // display interrupt 0L
|
||||
#define VI_DISP_INT_0U (25) // display interrupt 0U
|
||||
#define VI_DISP_INT_1 (26) // display interrupt 1L
|
||||
#define VI_DISP_INT_1U (27) // display interrupt 1U
|
||||
#define VI_DISP_INT_2 (28) // display interrupt 2L
|
||||
#define VI_DISP_INT_2U (29) // display interrupt 2U
|
||||
#define VI_DISP_INT_3 (30) // display interrupt 3L
|
||||
#define VI_DISP_INT_3U (31) // display interrupt 3U
|
||||
|
||||
#define VI_HSW (36) // horizontal scaling width
|
||||
#define VI_HSR (37) // horizontal scaling register
|
||||
|
||||
#define VI_FCT_0 (38) // filter coefficient table 0L
|
||||
#define VI_FCT_0U (39) // filter coefficient table 0U
|
||||
#define VI_FCT_1 (40) // filter coefficient table 1L
|
||||
#define VI_FCT_1U (41) // filter coefficient table 1U
|
||||
#define VI_FCT_2 (42) // filter coefficient table 2L
|
||||
#define VI_FCT_2U (43) // filter coefficient table 2U
|
||||
#define VI_FCT_3 (44) // filter coefficient table 3L
|
||||
#define VI_FCT_3U (45) // filter coefficient table 3U
|
||||
#define VI_FCT_4 (46) // filter coefficient table 4L
|
||||
#define VI_FCT_4U (47) // filter coefficient table 4U
|
||||
#define VI_FCT_5 (48) // filter coefficient table 5L
|
||||
#define VI_FCT_5U (49) // filter coefficient table 5U
|
||||
#define VI_FCT_6 (50) // filter coefficient table 6L
|
||||
#define VI_FCT_6U (51) // filter coefficient table 6U
|
||||
|
||||
#define VI_CLOCK_SEL (54) // clock select
|
||||
#define VI_DTV_STAT (55) // DTV status
|
||||
|
||||
#define VI_WIDTH (56)
|
||||
|
||||
// offsets for __DSPRegs[i]
|
||||
#define DSP_MAILBOX_IN_HI (0)
|
||||
#define DSP_MAILBOX_IN_LO (1)
|
||||
#define DSP_MAILBOX_OUT_HI (2)
|
||||
#define DSP_MAILBOX_OUT_LO (3)
|
||||
#define DSP_CONTROL_STATUS (5)
|
||||
|
||||
#define DSP_ARAM_SIZE (9)
|
||||
#define DSP_ARAM_MODE (11)
|
||||
#define DSP_ARAM_REFRESH (13)
|
||||
#define DSP_ARAM_DMA_MM_HI (16) // Main mem address
|
||||
#define DSP_ARAM_DMA_MM_LO (17)
|
||||
#define DSP_ARAM_DMA_ARAM_HI (18) // ARAM address
|
||||
#define DSP_ARAM_DMA_ARAM_LO (19)
|
||||
#define DSP_ARAM_DMA_SIZE_HI (20) // DMA buffer size
|
||||
#define DSP_ARAM_DMA_SIZE_LO (21)
|
||||
|
||||
#define DSP_DMA_START_HI (24) // DMA start address
|
||||
#define DSP_DMA_START_LO (25)
|
||||
#define DSP_DMA_CONTROL_LEN (27)
|
||||
#define DSP_DMA_BYTES_LEFT (29)
|
||||
|
||||
#define DSP_DMA_START_FLAG (0x8000) // set to start DSP
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
#ifndef _DOLPHIN_OS_OSFASTCAST_H
|
||||
#define _DOLPHIN_OS_OSFASTCAST_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
/////// FAST CAST DEFINES ////////
|
||||
// GQR formats.
|
||||
#define OS_GQR_U8 (0x0004) // GQR 1
|
||||
#define OS_GQR_U16 (0x0005) // GQR 2
|
||||
#define OS_GQR_S8 (0x0006) // GQR 3
|
||||
#define OS_GQR_S16 (0x0007) // GQR 4
|
||||
|
||||
// GQRs for fast casting.
|
||||
#define OS_FASTCAST_U8 (2)
|
||||
#define OS_FASTCAST_U16 (3)
|
||||
#define OS_FASTCAST_S8 (4)
|
||||
#define OS_FASTCAST_S16 (5)
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
/////// FAST CAST INLINES ////////
|
||||
// Initialise fast casting.
|
||||
static inline void OSInitFastCast() {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
li r3, OS_GQR_U8
|
||||
oris r3, r3, OS_GQR_U8
|
||||
mtspr 0x392, r3
|
||||
li r3, OS_GQR_U16
|
||||
oris r3, r3, OS_GQR_U16
|
||||
mtspr 0x393, r3
|
||||
li r3, OS_GQR_S8
|
||||
oris r3, r3, OS_GQR_S8
|
||||
mtspr 0x394, r3
|
||||
li r3, OS_GQR_S16
|
||||
oris r3, r3, OS_GQR_S16
|
||||
mtspr 0x395, r3
|
||||
}
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
// Float to int.
|
||||
static inline s16 __OSf32tos16(register f32 inF) {
|
||||
register s16 out;
|
||||
u32 tmp;
|
||||
register u32* tmpPtr = &tmp;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_S16
|
||||
lha out, 0(tmpPtr)
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline void OSf32tos16(f32* f, s16* out) {
|
||||
*out = __OSf32tos16(*f);
|
||||
}
|
||||
|
||||
static inline u8 __OSf32tou8(register f32 inF) {
|
||||
register u8 out;
|
||||
u32 tmp;
|
||||
register u32* tmpPtr = &tmp;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_U8
|
||||
lbz out, 0(tmpPtr)
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline void OSf32tou8(f32* f, u8* out) {
|
||||
*out = __OSf32tou8(*f);
|
||||
}
|
||||
|
||||
static inline s8 __OSf32tos8(register f32 inF) {
|
||||
register s8 out;
|
||||
u32 tmp;
|
||||
register u32* tmpPtr = &tmp;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
psq_st inF, 0(tmpPtr), 0x1, OS_FASTCAST_S8
|
||||
lbz out, 0(tmpPtr)
|
||||
extsb out, out
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline void OSf32tos8(f32* f, s8* out) {
|
||||
*out = __OSf32tos8(*f);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,12 @@ extern "C" {
|
||||
#define AUDIO_ARAM_SIZE 0x400000 /* 4MB */
|
||||
#define AUDIO_ARAM_HEAP_SIZE 0xC000
|
||||
|
||||
typedef enum DSPBUF_EVENTS {
|
||||
DSPBUF_EVENTS_0 = 0,
|
||||
DSPBUF_EVENTS_1 = 1,
|
||||
DSPBUF_EVENTS_2 = 2,
|
||||
} DSPBUF_EVENTS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,16 +1,31 @@
|
||||
#ifndef AUDIOTHREAD_H
|
||||
#define AUDIOTHREAD_H
|
||||
|
||||
#include "types.h"
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiostruct.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
#define AUDIO_THREAD_FLAG_DVD (1 << 0)
|
||||
#define AUDIO_THREAD_FLAG_AUDIO (1 << 1)
|
||||
#define AUDIO_THREAD_FLAG_NEOS (1 << 2)
|
||||
|
||||
extern volatile int intcount;
|
||||
OSThread jac_audioThread[3];
|
||||
OSThread jac_neosThread;
|
||||
OSThread jac_dvdThread;
|
||||
|
||||
extern void NeosSync(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void StartAudioThread(void*, u32, u32, u32);
|
||||
extern void DspSyncCountClear(int count);
|
||||
extern int DspSyncCountCheck(void);
|
||||
extern void StartAudioThread(void* pHeap, s32 heapSize, u32 aramSize, u32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef CPUBUF_H
|
||||
#define CPUBUF_H
|
||||
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiocommon.h"
|
||||
|
||||
extern u32 CpubufProcess(DSPBUF_EVENTS event);
|
||||
extern void CpuFrameEnd(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DSPBOOT_H
|
||||
#define DSPBOOT_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void DspBoot(void);
|
||||
|
||||
#endif
|
||||
@@ -2,7 +2,11 @@
|
||||
#define DSPBUF_H
|
||||
|
||||
#include "types.h"
|
||||
#include "jaudio_NES/audiocommon.h"
|
||||
|
||||
extern u32 DspbufProcess(DSPBUF_EVENTS event);
|
||||
extern s16* MixDsp(s32 nSamples);
|
||||
extern void UpdateDSP(void);
|
||||
extern void DspFrameEnd(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DSPINTERFACE_H
|
||||
#define DSPINTERFACE_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void DSP_InitBuffer(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef DSPPROC_H
|
||||
#define DSPPROC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern u32 DSPReleaseHalt(void);
|
||||
|
||||
#endif
|
||||
@@ -9,5 +9,7 @@ typedef void (*Jac_DVDCallback)(u32);
|
||||
extern s32 DVDT_DRAMtoARAM(u32 owner, u32 dram, u32 aram, u32 len, u32* outLen, Jac_DVDCallback callback);
|
||||
extern s32 DVDT_ARAMtoDRAM(u32 owner, u32 dram, u32 aram, u32 len, u32* outLen, Jac_DVDCallback callback);
|
||||
extern u32 Jac_CheckFile(char* path);
|
||||
extern void* jac_dvdproc(void* param);
|
||||
extern void jac_dvdproc_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef JA_CALC_H
|
||||
#define JA_CALC_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void Jac_InitSinTable(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef NEOSTHREAD_H
|
||||
#define NEOSTHREAD_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern void* neosproc(void* param);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef PLAYERCALL_H
|
||||
#define PLAYERCALL_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void ResetPlayerCallback(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -7,6 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern u32 JAC_AI_SETTING;
|
||||
extern u32 JAC_FRAMESAMPLES;
|
||||
extern u32 DAC_SIZE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user