From 61e68d01bbc0bc44d67b770635ac98ee35e2e6be Mon Sep 17 00:00:00 2001 From: Lephe Date: Wed, 4 Sep 2019 14:44:48 +0200 Subject: [PATCH] expose more platform-agnostic code May be useful later on for libraries such as libprof. --- TODO | 4 +++- include/gint/drivers.h | 6 ++---- src/core/hardware.c | 4 ++-- src/cpg/cpg.c | 6 +++--- src/rtc/rtc.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 4287009..81d3b91 100644 --- a/TODO +++ b/TODO @@ -10,10 +10,12 @@ Tests to run. * topti: all charsets Complementary elements on existing code. +* core: make it possiblé to catch exceptions (gintctl's memory browser) +* core: check if -DX still works in GCC 9 and if not, put spaces * gray: find good values for more models than the Graph 35+E II * render: get rid of GINT_NEED_VRAM and #define vram gint_vram if you need * dma: dma_memcpy() and dma_memset(), possibly requiring alignment -* core: find the #ifdef FX9860G|FXCG50 that have a cross-platform def +* dma: maybe relax the 4-byte size constraint for dma_memset() * core: try to leave add-in without reset in case of fatal exception * topti: support Unicode fonts * hardware: fill in the HWMEM_FITTLB flag diff --git a/include/gint/drivers.h b/include/gint/drivers.h index 9814d28..bda3b3a 100644 --- a/include/gint/drivers.h +++ b/include/gint/drivers.h @@ -105,12 +105,10 @@ typedef struct This macro makes its argument NULL on fxcg50, this way the named function can be defined under #ifdef FX9860G while keeping the structure clean. */ -#ifdef FX9860G -#define GINT_DRIVER_SH3(name) name -#endif - #ifdef FXCG50 #define GINT_DRIVER_SH3(name) NULL +#else +#define GINT_DRIVER_SH3(name) name #endif /* GINT_DRIVER_STATUS() - declare a function for status string generation diff --git a/src/core/hardware.c b/src/core/hardware.c index c756610..4f32186 100644 --- a/src/core/hardware.c +++ b/src/core/hardware.c @@ -16,7 +16,7 @@ GBSS uint32_t gint[HW_KEYS]; /* Product Register */ #define PRR (*((volatile uint32_t *)0xff000044)) -#ifdef FX9860G +#if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50)) /* mpu_detect() - detect the underlying MPU Many thanks to Simon Lothar for relevant documentation. @@ -90,7 +90,7 @@ void hw_detect(void) gint[HWROM] = (gint[HWCALC] == HWCALC_G35PE2) ? (4 << 20) : (8 << 20); } -#endif /* FX9860G */ +#endif /* FX9860G and platform-agnostic */ #ifdef FXCG50 diff --git a/src/cpg/cpg.c b/src/cpg/cpg.c index 9f700bb..494d983 100644 --- a/src/cpg/cpg.c +++ b/src/cpg/cpg.c @@ -25,7 +25,7 @@ const clock_frequency_t *clock_freq(void) // SH7705 Clock signals //--- -#ifdef FX9860G +#if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50)) #define CPG SH7705_CPG static void sh7705_probe(void) @@ -69,7 +69,7 @@ static void sh7705_probe(void) } #undef CPG -#endif /* FX9860G */ +#endif /* FX9860G and platform-agnostic */ //--- // SH7305 clock signals @@ -144,7 +144,7 @@ static void init(void) /* This avoids warnings about sh7705_probe() being undefined when building for fxcg50 */ - #ifdef FX9860G + #if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50)) isSH3() ? sh7705_probe() : #endif sh7305_probe(); diff --git a/src/rtc/rtc.c b/src/rtc/rtc.c index 7ac99f9..4394ee1 100644 --- a/src/rtc/rtc.c +++ b/src/rtc/rtc.c @@ -125,7 +125,7 @@ void rtc_stop_timer(void) // Driver initialization //--- -#ifdef FX9860G +#if defined(FX9860G) || (!defined(FX9860G) && !defined(FXCG50)) static void driver_sh3(void) { /* Adjust the address of the RTC */