diff --git a/CMakeLists.txt b/CMakeLists.txt index a8370125..1ebe2717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,7 @@ set(REDREAM_SOURCES src/emu/emulator.c src/emu/tracer.c src/hw/aica/aica.c - src/hw/arm/arm.c + src/hw/arm7/arm7.c src/hw/gdrom/disc.c src/hw/gdrom/gdrom.c src/hw/holly/holly.c diff --git a/src/hw/aica/aica.c b/src/hw/aica/aica.c index 1e0a2f60..e66e5f48 100644 --- a/src/hw/aica/aica.c +++ b/src/hw/aica/aica.c @@ -2,7 +2,7 @@ #include "core/log.h" #include "core/option.h" #include "hw/aica/aica_types.h" -#include "hw/arm/arm.h" +#include "hw/arm7/arm7.h" #include "hw/dreamcast.h" #include "hw/holly/holly.h" #include "hw/memory.h" @@ -338,9 +338,9 @@ static void aica_common_reg_write(struct aica *aica, uint32_t addr, } break; case 0x400: { /* ARMRST */ if (data) { - arm_suspend(aica->arm); + arm7_suspend(aica->arm); } else { - arm_resume(aica->arm); + arm7_resume(aica->arm); } } break; } @@ -441,7 +441,7 @@ static bool aica_init(struct device *dev) { aica_timer_init(aica); aica_rtc_init(aica); - arm_suspend(aica->arm); + arm7_suspend(aica->arm); return true; } diff --git a/src/hw/arm/arm.c b/src/hw/arm/arm.c deleted file mode 100644 index 435c246a..00000000 --- a/src/hw/arm/arm.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "hw/arm/arm.h" -#include "hw/aica/aica.h" -#include "hw/dreamcast.h" - -struct arm { - struct device; -}; - -static bool arm_init(struct device *dev) { - // struct arm *arm = (struct arm *)dev; - return true; -} - -static void arm_run(struct device *dev, int64_t ns) { - // struct arm *arm = (struct arm *)dev; -} - -void arm_suspend(struct arm *arm) { - arm->execute_if->suspended = true; -} - -void arm_resume(struct arm *arm) { - arm->execute_if->suspended = false; -} - -struct arm *arm_create(struct dreamcast *dc) { - struct arm *arm = dc_create_device(dc, sizeof(struct arm), "arm", &arm_init); - arm->execute_if = dc_create_execute_interface(&arm_run); - arm->memory_if = dc_create_memory_interface(dc, &arm_data_map); - return arm; -} - -void arm_destroy(struct arm *arm) { - dc_destroy_memory_interface(arm->memory_if); - dc_destroy_execute_interface(arm->execute_if); - dc_destroy_device((struct device *)arm); -} - -// clang-format off -AM_BEGIN(struct arm, arm_data_map); - AM_RANGE(0x00000000, 0x007fffff) AM_MASK(0x00ffffff) AM_DEVICE("aica", aica_data_map) - AM_RANGE(0x00800000, 0x00810fff) AM_MASK(0x00ffffff) AM_DEVICE("aica", aica_reg_map) -AM_END(); -// clang-format on diff --git a/src/hw/arm/arm.h b/src/hw/arm/arm.h deleted file mode 100644 index 61d05e7a..00000000 --- a/src/hw/arm/arm.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ARM_H -#define ARM_H - -#include "hw/memory.h" - -struct arm; -struct dreamcast; - -void arm_suspend(struct arm *arm); -void arm_resume(struct arm *arm); - -struct arm *arm_create(struct dreamcast *dc); -void arm_destroy(struct arm *arm); - -AM_DECLARE(arm_data_map); - -#endif diff --git a/src/hw/arm7/arm7.c b/src/hw/arm7/arm7.c new file mode 100644 index 00000000..c9620360 --- /dev/null +++ b/src/hw/arm7/arm7.c @@ -0,0 +1,44 @@ +#include "hw/arm7/arm7.h" +#include "hw/aica/aica.h" +#include "hw/dreamcast.h" + +struct arm7 { + struct device; +}; + +static bool arm7_init(struct device *dev) { + // struct arm7 *arm7 = (struct arm7 *)dev; + return true; +} + +static void arm7_run(struct device *dev, int64_t ns) { + // struct arm *arm7 = (struct arm7 *)dev; +} + +void arm7_suspend(struct arm7 *arm) { + arm->execute_if->suspended = true; +} + +void arm7_resume(struct arm7 *arm) { + arm->execute_if->suspended = false; +} + +struct arm7 *arm7_create(struct dreamcast *dc) { + struct arm7 *arm = dc_create_device(dc, sizeof(struct arm7), "arm7", &arm7_init); + arm->execute_if = dc_create_execute_interface(&arm7_run); + arm->memory_if = dc_create_memory_interface(dc, &arm7_data_map); + return arm; +} + +void arm7_destroy(struct arm7 *arm) { + dc_destroy_memory_interface(arm->memory_if); + dc_destroy_execute_interface(arm->execute_if); + dc_destroy_device((struct device *)arm); +} + +// clang-format off +AM_BEGIN(struct arm7, arm7_data_map); + AM_RANGE(0x00000000, 0x007fffff) AM_MASK(0x00ffffff) AM_DEVICE("aica", aica_data_map) + AM_RANGE(0x00800000, 0x00810fff) AM_MASK(0x00ffffff) AM_DEVICE("aica", aica_reg_map) +AM_END(); +// clang-format on diff --git a/src/hw/arm7/arm7.h b/src/hw/arm7/arm7.h new file mode 100644 index 00000000..11229690 --- /dev/null +++ b/src/hw/arm7/arm7.h @@ -0,0 +1,17 @@ +#ifndef ARM7_H +#define ARM7_H + +#include "hw/memory.h" + +struct arm7; +struct dreamcast; + +void arm7_suspend(struct arm7 *arm); +void arm7_resume(struct arm7 *arm); + +struct arm7 *arm7_create(struct dreamcast *dc); +void arm7_destroy(struct arm7 *arm); + +AM_DECLARE(arm7_data_map); + +#endif diff --git a/src/hw/dreamcast.c b/src/hw/dreamcast.c index 0360221c..651616c6 100644 --- a/src/hw/dreamcast.c +++ b/src/hw/dreamcast.c @@ -2,7 +2,7 @@ #include "core/option.h" #include "core/string.h" #include "hw/aica/aica.h" -#include "hw/arm/arm.h" +#include "hw/arm7/arm7.h" #include "hw/debugger.h" #include "hw/gdrom/gdrom.h" #include "hw/holly/holly.h" @@ -174,7 +174,7 @@ struct dreamcast *dc_create(struct video_backend *video) { dc->memory = memory_create(dc); dc->scheduler = scheduler_create(dc); dc->sh4 = sh4_create(dc); - dc->arm = arm_create(dc); + dc->arm = arm7_create(dc); dc->aica = aica_create(dc); dc->boot = boot_create(dc); dc->flash = flash_create(dc); @@ -201,7 +201,7 @@ void dc_destroy(struct dreamcast *dc) { flash_destroy(dc->flash); boot_destroy(dc->boot); aica_destroy(dc->aica); - arm_destroy(dc->arm); + arm7_destroy(dc->arm); sh4_destroy(dc->sh4); scheduler_destroy(dc->scheduler); memory_destroy(dc->memory); diff --git a/src/hw/dreamcast.h b/src/hw/dreamcast.h index 423dca62..25a1dcc8 100644 --- a/src/hw/dreamcast.h +++ b/src/hw/dreamcast.h @@ -9,7 +9,7 @@ #include "ui/keycode.h" struct aica; -struct arm; +struct arm7; struct boot; struct debugger; struct device; @@ -116,7 +116,7 @@ struct device { struct memory *memory; struct scheduler *scheduler; struct sh4 *sh4; - struct arm *arm; + struct arm7 *arm; struct aica *aica; struct boot *boot; struct flash *flash; @@ -137,7 +137,7 @@ struct dreamcast { struct memory *memory; struct scheduler *scheduler; struct sh4 *sh4; - struct arm *arm; + struct arm7 *arm; struct aica *aica; struct boot *boot; struct flash *flash;