mcpx: Move DSP state structs to dsp.h

This commit is contained in:
Matt Borgerson 2025-06-03 19:17:09 -07:00 committed by mborgerson
parent 7ab7f65cdf
commit 04273de749
3 changed files with 63 additions and 23 deletions

View File

@ -37,15 +37,12 @@
#include "ui/xemu-settings.h"
#include "trace.h"
#include "dsp/dsp.h"
#include "dsp/dsp_dma.h"
#include "dsp/dsp_cpu.h"
#include "dsp/dsp_state.h"
#include "apu.h"
#include "apu_regs.h"
#include "apu_debug.h"
#include "fpconv.h"
#include "vp/vp.h"
#include "dsp.h"
#define GET_MASK(v, mask) (((v) & (mask)) >> ctz32(mask))
@ -98,20 +95,10 @@ typedef struct MCPXAPUState {
MCPXAPUVPState vp;
/* Global Processor */
struct {
bool realtime;
MemoryRegion mmio;
DSPState *dsp;
uint32_t regs[0x10000];
} gp;
MCPXAPUGPState gp;
/* Encode Processor */
struct {
bool realtime;
MemoryRegion mmio;
DSPState *dsp;
uint32_t regs[0x10000];
} ep;
MCPXAPUEPState ep;
uint32_t regs[0x20000];
@ -134,11 +121,4 @@ extern uint64_t g_dbg_muted_voices[4];
void mcpx_debug_begin_frame(void);
void mcpx_debug_end_frame(void);
extern const MemoryRegionOps gp_ops;
extern const MemoryRegionOps ep_ops;
void mcpx_apu_dsp_init(MCPXAPUState *d);
void mcpx_apu_update_dsp_preference(MCPXAPUState *d);
void mcpx_apu_dsp_frame(MCPXAPUState *d, float mixbins[NUM_MIXBINS][NUM_SAMPLES_PER_FRAME]);
#endif

57
hw/xbox/mcpx/dsp.h Normal file
View File

@ -0,0 +1,57 @@
/*
* QEMU MCPX Audio Processing Unit implementation
*
* Copyright (c) 2012 espes
* Copyright (c) 2018-2019 Jannik Vogel
* Copyright (c) 2019-2025 Matt Borgerson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HW_XBOX_MCPX_APU_DSP_H
#define HW_XBOX_MCPX_APU_DSP_H
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/pci/pci.h"
#include "hw/xbox/mcpx/apu_regs.h"
#include "dsp/dsp.h"
#include "dsp/dsp_dma.h"
#include "dsp/dsp_cpu.h"
#include "dsp/dsp_state.h"
typedef struct MCPXAPUState MCPXAPUState;
typedef struct MCPXAPUGPState {
bool realtime;
MemoryRegion mmio;
DSPState *dsp;
uint32_t regs[0x10000];
} MCPXAPUGPState;
typedef struct MCPXAPUEPState {
bool realtime;
MemoryRegion mmio;
DSPState *dsp;
uint32_t regs[0x10000];
} MCPXAPUEPState;
extern const MemoryRegionOps gp_ops;
extern const MemoryRegionOps ep_ops;
void mcpx_apu_dsp_init(MCPXAPUState *d);
void mcpx_apu_update_dsp_preference(MCPXAPUState *d);
void mcpx_apu_dsp_frame(MCPXAPUState *d, float mixbins[NUM_MIXBINS][NUM_SAMPLES_PER_FRAME]);
#endif

View File

@ -100,6 +100,9 @@ typedef struct {
float itd;
} entries[HRTF_ENTRY_COUNT];
} hrtf;
uint32_t inbuf_sge_handle; //FIXME: Where is this stored?
uint32_t outbuf_sge_handle; //FIXME: Where is this stored?
} MCPXAPUVPState;
extern const MemoryRegionOps vp_ops;