2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #368 from purpasmart96/dsp_mem

MemMap: Add support for DSP Read & Writes in the memory map
This commit is contained in:
bunnei 2014-12-29 23:08:51 -05:00
commit b3240f6455
3 changed files with 12 additions and 2 deletions

View file

@ -21,6 +21,7 @@ u8* g_heap = nullptr; ///< Application heap (main memory)
u8* g_heap_linear = nullptr; ///< Linear heap u8* g_heap_linear = nullptr; ///< Linear heap
u8* g_vram = nullptr; ///< Video memory (VRAM) pointer u8* g_vram = nullptr; ///< Video memory (VRAM) pointer
u8* g_shared_mem = nullptr; ///< Shared memory u8* g_shared_mem = nullptr; ///< Shared memory
u8* g_dsp_mem = nullptr; ///< DSP memory
u8* g_kernel_mem; ///< Kernel memory u8* g_kernel_mem; ///< Kernel memory
static u8* physical_bootrom = nullptr; ///< Bootrom physical memory static u8* physical_bootrom = nullptr; ///< Bootrom physical memory
@ -32,6 +33,7 @@ static u8* physical_fcram = nullptr; ///< Main physical memory (FCRAM)
static u8* physical_heap_gsp = nullptr; ///< GSP heap physical memory static u8* physical_heap_gsp = nullptr; ///< GSP heap physical memory
static u8* physical_vram = nullptr; ///< Video physical memory (VRAM) static u8* physical_vram = nullptr; ///< Video physical memory (VRAM)
static u8* physical_shared_mem = nullptr; ///< Physical shared memory static u8* physical_shared_mem = nullptr; ///< Physical shared memory
static u8* physical_dsp_mem = nullptr; ///< Physical DSP memory
static u8* physical_kernel_mem; ///< Kernel memory static u8* physical_kernel_mem; ///< Kernel memory
// We don't declare the IO region in here since its handled by other means. // We don't declare the IO region in here since its handled by other means.
@ -41,6 +43,7 @@ static MemoryView g_views[] = {
{&g_heap, &physical_fcram, HEAP_VADDR, HEAP_SIZE, MV_IS_PRIMARY_RAM}, {&g_heap, &physical_fcram, HEAP_VADDR, HEAP_SIZE, MV_IS_PRIMARY_RAM},
{&g_shared_mem, &physical_shared_mem, SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, 0}, {&g_shared_mem, &physical_shared_mem, SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, 0},
{&g_system_mem, &physical_system_mem, SYSTEM_MEMORY_VADDR, SYSTEM_MEMORY_SIZE, 0}, {&g_system_mem, &physical_system_mem, SYSTEM_MEMORY_VADDR, SYSTEM_MEMORY_SIZE, 0},
{&g_dsp_mem, &physical_dsp_mem, DSP_MEMORY_VADDR, DSP_MEMORY_SIZE, 0},
{&g_kernel_mem, &physical_kernel_mem, KERNEL_MEMORY_VADDR, KERNEL_MEMORY_SIZE, 0}, {&g_kernel_mem, &physical_kernel_mem, KERNEL_MEMORY_VADDR, KERNEL_MEMORY_SIZE, 0},
{&g_heap_linear, &physical_heap_gsp, HEAP_LINEAR_VADDR, HEAP_LINEAR_SIZE, 0}, {&g_heap_linear, &physical_heap_gsp, HEAP_LINEAR_VADDR, HEAP_LINEAR_SIZE, 0},
}; };

View file

@ -134,6 +134,7 @@ extern u8* g_heap; ///< Application heap (main memory)
extern u8* g_vram; ///< Video memory (VRAM) extern u8* g_vram; ///< Video memory (VRAM)
extern u8* g_shared_mem; ///< Shared memory extern u8* g_shared_mem; ///< Shared memory
extern u8* g_kernel_mem; ///< Kernel memory extern u8* g_kernel_mem; ///< Kernel memory
extern u8* g_dsp_mem; ///< DSP memory
extern u8* g_system_mem; ///< System memory extern u8* g_system_mem; ///< System memory
extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here

View file

@ -82,6 +82,10 @@ inline void Read(T &var, const VAddr vaddr) {
} else if ((vaddr >= CONFIG_MEMORY_VADDR) && (vaddr < CONFIG_MEMORY_VADDR_END)) { } else if ((vaddr >= CONFIG_MEMORY_VADDR) && (vaddr < CONFIG_MEMORY_VADDR_END)) {
ConfigMem::Read<T>(var, vaddr); ConfigMem::Read<T>(var, vaddr);
// DSP memory
} else if ((vaddr >= DSP_MEMORY_VADDR) && (vaddr < DSP_MEMORY_VADDR_END)) {
var = *((const T*)&g_dsp_mem[vaddr - DSP_MEMORY_VADDR]);
// VRAM // VRAM
} else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
var = *((const T*)&g_vram[vaddr - VRAM_VADDR]); var = *((const T*)&g_vram[vaddr - VRAM_VADDR]);
@ -122,8 +126,10 @@ inline void Write(const VAddr vaddr, const T data) {
} else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) { } else if ((vaddr >= VRAM_VADDR) && (vaddr < VRAM_VADDR_END)) {
*(T*)&g_vram[vaddr - VRAM_VADDR] = data; *(T*)&g_vram[vaddr - VRAM_VADDR] = data;
//} else if ((vaddr & 0xFFF00000) == 0x1FF00000) { // DSP memory
// _assert_msg_(MEMMAP, false, "umimplemented write to DSP memory"); } else if ((vaddr >= DSP_MEMORY_VADDR) && (vaddr < DSP_MEMORY_VADDR_END)) {
*(T*)&g_dsp_mem[vaddr - DSP_MEMORY_VADDR] = data;
//} else if ((vaddr & 0xFFFF0000) == 0x1FF80000) { //} else if ((vaddr & 0xFFFF0000) == 0x1FF80000) {
// _assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory"); // _assert_msg_(MEMMAP, false, "umimplemented write to Configuration Memory");
//} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) { //} else if ((vaddr & 0xFFFFF000) == 0x1FF81000) {