From 32ffebacda4c5d80989e7131019edb9f632dbb67 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Sun, 24 Mar 2024 09:00:07 +0100 Subject: [PATCH] gintctl: boring macro replacement for build-fxg3a support --- .gitignore | 2 ++ CMakeLists.txt | 3 ++ include/gintctl/assets.h | 10 +++--- include/gintctl/gint.h | 5 ++- include/gintctl/util.h | 17 +++++----- include/gintctl/widgets/gscreen.h | 4 +-- src/gint/cpumem.c | 23 +++++++------ src/gint/dma.c | 8 ++--- src/gint/drivers.c | 26 +++++++-------- src/gint/dsp.c | 2 +- src/gint/dump.c | 10 +++--- src/gint/gray.c | 11 +++++-- src/gint/image.c | 5 +-- src/gint/keyboard.c | 12 +++---- src/gint/kmalloc.c | 26 +++++++-------- src/gint/overclock.c | 2 +- src/gint/ram.c | 10 +++--- src/gint/rtc.c | 28 ++++++++-------- src/gint/spuram.c | 12 +++---- src/gint/timer.c | 12 +++---- src/gint/timer_callbacks.c | 4 +-- src/gint/tlb.c | 35 ++++++++++---------- src/gint/usb.c | 16 ++++----- src/gint/usbtrace.c | 2 +- src/gintctl.c | 30 ++++++++--------- src/libs/openlibm.c | 2 +- src/mem/mem.c | 6 ++-- src/perf/cpucache.c | 55 ++++++++++++++++++------------- src/perf/interrupt.c | 4 +-- src/perf/libprof.c | 8 ++--- src/perf/memory.c | 4 +-- src/perf/render.c | 6 ++-- src/regs/regs.c | 2 ++ src/util.c | 29 +++++++--------- src/widgets/gscreen.c | 10 +++--- 35 files changed, 229 insertions(+), 212 deletions(-) diff --git a/.gitignore b/.gitignore index 42c53c1..f9a8c62 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,12 @@ build-fx/ build-cg/ build-cg-push/ +build-fxg3a/ # Targets gintctl.g1a gintctl.g3a +gintctl-fx.g3a # Development files *.sublime-* diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f0123f..fc66340 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,4 +143,7 @@ elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) add_custom_command(TARGET gintctl POST_BUILD COMMAND echo -n "g3a file size: " COMMAND stat -c %s "${CMAKE_CURRENT_SOURCE_DIR}/gintctl.g3a") +elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G_G3A) + generate_g3a(TARGET gintctl OUTPUT "gintctl-fx.g3a" + NAME "" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) endif() diff --git a/include/gintctl/assets.h b/include/gintctl/assets.h index a270c69..be3a7ea 100644 --- a/include/gintctl/assets.h +++ b/include/gintctl/assets.h @@ -5,7 +5,9 @@ #ifndef _GINTCTL_ASSETS #define _GINTCTL_ASSETS -#ifdef FX9860G +#include + +#if GINT_RENDER_MONO #include @@ -56,9 +58,9 @@ extern bopti_image_t extern img_t img_libimg_swords; -#endif /* FX9860G */ +#endif -#ifdef FXCG50 +#if GINT_RENDER_RGB extern bopti_image_t img_kbd_events, @@ -74,6 +76,6 @@ extern bopti_image_t img_libimg_sq_odd, img_libimg_train; -#endif /* FXCG50 */ +#endif #endif /* _GINTCTL_ASSETS */ diff --git a/include/gintctl/gint.h b/include/gintctl/gint.h index f62fb98..25a4d9a 100644 --- a/include/gintctl/gint.h +++ b/include/gintctl/gint.h @@ -5,6 +5,8 @@ #ifndef GINTCTL_GINT #define GINTCTL_GINT +#include + /* gintctl_gint_cpumem(): Detected CPU and memory configuration */ void gintctl_gint_cpumem(void); @@ -62,14 +64,11 @@ void gintctl_gint_usb(void); /* gintctl_gint_usbtrace(): A detailed USB troubleshooter */ void gintctl_gint_usbtrace(void); -#ifdef FX9860G - /* gintctl_gint_gray(): Gray engine tuning */ void gintctl_gint_gray(void); /* gintctl_gint_grayrender(): Gray rendering functions */ void gintctl_gint_grayrender(void); -#endif /* FX9860G */ #endif /* GINTCTL_GINT */ diff --git a/include/gintctl/util.h b/include/gintctl/util.h index fa3e486..809a6aa 100644 --- a/include/gintctl/util.h +++ b/include/gintctl/util.h @@ -9,17 +9,16 @@ #include #include #include +#include //--- // Platform disambiguation functions //--- -#ifdef FX9860G -#define _(fx,cg) fx -#endif - -#ifdef FXCG50 -#define _(fx,cg) cg +#if GINT_HW_FX || GINT_FX9860G_G3A +# define _(fx,cg) fx +#else +# define _(fx,cg) cg #endif //--- @@ -84,7 +83,7 @@ void scrollbar_px(int view_top, int view_bottom, int range_min, int range_max, // F-key rendering //--- -#ifdef FXCG50 +#if GINT_RENDER_RGB /* fkey_action(): A black-on-white F-key */ void fkey_action(int position, char const *text); @@ -95,12 +94,12 @@ void fkey_button(int position, char const *text); /* fkey_menu(): A rectangular F-key with the bottom right corner removed */ void fkey_menu(int position, char const *text); +#endif /* FXCG50 */ + //--- // USB commands //--- void gintctl_handle_usb_command(usb_fxlink_header_t const *header); -#endif /* FXCG50 */ - #endif /* GINTCTL_UTIL */ diff --git a/include/gintctl/widgets/gscreen.h b/include/gintctl/widgets/gscreen.h index 7d75e48..482f926 100644 --- a/include/gintctl/widgets/gscreen.h +++ b/include/gintctl/widgets/gscreen.h @@ -47,12 +47,12 @@ struct gscreen_tab { function bar. To show a title/function bar on some tabs but not all, create one here and use gscreen_set_tab_{title,fkeys}_visible(). */ -#ifdef FX9860G +#if GINT_RENDER_MONO gscreen *gscreen_create(char const *title, bopti_image_t const *fkeys); #define gscreen_create2(short, img, long, fkeys) gscreen_create(short, img) #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB gscreen *gscreen_create(char const *title, char const *fkeys); #define gscreen_create2(short, img, long, fkeys) gscreen_create(long, fkeys) #endif diff --git a/src/gint/cpumem.c b/src/gint/cpumem.c index 9688ba6..7abd5d2 100644 --- a/src/gint/cpumem.c +++ b/src/gint/cpumem.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -15,23 +16,21 @@ extern uint32_t cpu_getVBR(void); extern uint32_t brom, srom, /* Limits of ROM mappings */ sdata, rdata, /* User's data section */ - sbss, rbss; /* User's BSS section */ -#ifdef FX9860G -extern uint32_t sgmapped; /* Permanently mapped functions */ -#endif + sbss, rbss, /* User's BSS section */ + sgmapped; /* Permanently mapped functions */ /* MPU type and processor version */ void show_mpucpu(void) { char const *mpu_names[] = { - #ifdef FX9860G + #if GINT_RENDER_MONO "Unknown", "SH-3 SH7337", "SH-4A SH7305", "SH-3 SH7355", "SH-4A SH7724", - #else + #elif GINT_RENDER_RGB "Unknown MPU product", "SH-3-based SH7337", "SH-4A-based SH7305", @@ -83,7 +82,7 @@ void show_mpucpu(void) __asm__("stc sr, %0" : "=r"(SR)); __asm__("mov r15, %0" : "=r"(r15)); - #ifdef FX9860G + #if GINT_RENDER_MONO extern font_t font_mini; font_t const *old_font = dfont(&font_mini); @@ -110,7 +109,7 @@ void show_mpucpu(void) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Calculator model: %s", str_calc); row_print(3, 1, "MPU: %s", str_mpu); row_print(4, 1, " Status Register: %08x", SR); @@ -127,7 +126,7 @@ void show_mpucpu(void) /* Memory */ static void show_memory(void) { - #ifdef FX9860G + #if GINT_RENDER_MONO extern font_t font_mini; font_t const *old_font = dfont(&font_mini); print_prefix(28, 10, "brom", "%08X", &brom); @@ -147,7 +146,7 @@ static void show_memory(void) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB uint32_t base_ram = 0x88000000; if(gint[HWCALC] == HWCALC_FXCG50) base_ram = 0x8c000000; @@ -219,13 +218,13 @@ void gintctl_gint_cpumem(void) if(tab == 0) show_mpucpu(); if(tab == 1) show_memory(); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("CPU and memory"); extern bopti_image_t img_opt_gint_cpumem; dimage(0, 56, &img_opt_gint_cpumem); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Processor and memory"); fkey_menu(1, "MPU/CPU"); fkey_menu(2, "MEMORY"); diff --git a/src/gint/dma.c b/src/gint/dma.c index 3cf9348..0bad069 100644 --- a/src/gint/dma.c +++ b/src/gint/dma.c @@ -14,7 +14,7 @@ void show_dma(int x, int y, GUNUSED int channel, sh7305_dma_channel_t *dma) { - #ifdef FX9860G + #if GINT_RENDER_MONO int dx=60, dy=8; dprint(x, y, "SAR:"); dprint(x, y+1*dy, "DAR:"); @@ -26,7 +26,7 @@ void show_dma(int x, int y, GUNUSED int channel, sh7305_dma_channel_t *dma) dprint(x+dx, y+3*dy, "%08X", dma->CHCR); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB int dx=45, dy=14; dprint(x, y, "DMA%d:", channel); dprint(x, y+1*dy, "SAR"); @@ -64,7 +64,7 @@ void gintctl_gint_dma(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO show_dma(1, 0, channel, addr[channel]); dprint(1, 32, "Channel DMA%d", channel); dprint(1, 40, "Interrupts %s", interrupts ? "Yes" : "No"); @@ -75,7 +75,7 @@ void gintctl_gint_dma(void) dimage(0, 56, &img_opt_gint_dma); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Direct Memory Access status"); show_dma(6, 24, 0, addr[0]); diff --git a/src/gint/drivers.c b/src/gint/drivers.c index fea8e55..7860c9a 100644 --- a/src/gint/drivers.c +++ b/src/gint/drivers.c @@ -20,7 +20,7 @@ static void draw_list(int offset, int maximum) { - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 2, "Id"); row_print(1, 5, "Name"); row_print(1, 13, "Size"); @@ -97,7 +97,7 @@ static void draw_state(gint_world_t world, int i) { dma_state_t const *s = world[i]; - #ifdef FX9860G + #if GINT_RENDER_MONO for(int i = 0; i < 6; i++) { dprint(1, 1+6*i, C_BLACK, "%d: %08X->%08X %08X", i, s->ch[i].SAR, s->ch[i].DAR, s->ch[i].CHCR); @@ -105,7 +105,7 @@ static void draw_state(gint_world_t world, int i) dprint(1, 43, C_BLACK, "OR: %08X", s->OR); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB for(int i = 0; i < 6; i++) { int y=3+5*(i/3), x=1+16*(i%3); row_print(y, x, "%d:", i); @@ -125,7 +125,7 @@ static void draw_state(gint_world_t world, int i) { intc_state_t const *s = world[i]; - #ifdef FX9860G + #if GINT_RENDER_MONO for(int i = 0; i < 12; i++) { dprint(1+32*(i%4),1+6*(i/4), C_BLACK, "%c:%04X", 'A'+i, s->IPR[i]); } @@ -134,7 +134,7 @@ static void draw_state(gint_world_t world, int i) } #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB for(int i = 0; i < 12; i++) { row_print(3+i/4, 1+11*(i%4), "IPR%c:", 'A'+i); row_print(3+i/4, 6+11*(i%4), "%04X", s->IPR[i]); @@ -170,14 +170,14 @@ static void draw_state(gint_world_t world, int i) { spu_state_t const *s = world[i]; - #ifdef FX9860G + #if GINT_RENDER_MONO dprint(1, 1, C_BLACK, "PBANKC0: %08X", s->PBANKC0); dprint(1, 7, C_BLACK, "PBANKC1: %08X", s->PBANKC1); dprint(1, 13, C_BLACK, "XBANKC0: %08X", s->XBANKC0); dprint(1, 19, C_BLACK, "XBANKC1: %08X", s->XBANKC1); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(3,1, "PBANKC0: %08X PBANKC1: %08X", s->PBANKC0, s->PBANKC1); row_print(4,1, "XBANKC0: %08X XBANKC1: %08X", s->XBANKC0, s->XBANKC1); #endif @@ -196,14 +196,14 @@ static void draw_state(gint_world_t world, int i) tmu_state_t const *s = world[i]; for(int k = 0; k < 9; k++) { - #ifdef FX9860G + #if GINT_RENDER_MONO if(k < 3) dprint(1, 6*k, C_BLACK, "TMU%d: CNT:%08X TCR:%04X %s", k, s->t[k].TCNT, s->t[k].TCR, (s->TSTR & (1<t[k].TCNT, s->t[k].TCR, s->t[k].TSTR); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(k+3, 1, "%sTMU%d:", (k<3 ? "" : "E"), (k<3 ? k : k-3)); if(k < 3) row_print(k+3, 8, "%08X/%08X TCR:%04X", s->t[k].TCNT, s->t[k].TCOR, s->t[k].TCR); @@ -234,7 +234,7 @@ struct switch_stats { static void draw_manual(struct switch_stats *stats) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(2, 1, "World switches: %d", stats->world_switch_count); row_print(3, 1, "Return-to-menu: %d", stats->return_to_menu_count); // row_print(4, 1, "Switch time: %d µs", stats->world_switch_time); @@ -243,7 +243,7 @@ static void draw_manual(struct switch_stats *stats) row_print(7, 1, "[3]: Measure perf"); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "World switches performed: %d", stats->world_switch_count); row_print(2, 1, "Return-to-menu performed: %d", @@ -269,12 +269,12 @@ void gintctl_gint_drivers(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO if(tab == 0 || tab == 3) row_print(1, 1, "Drivers and worlds"); dimage(0, 56, &img_opt_gint_drivers); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Drivers and world switches"); fkey_menu(1, "DRIVERS"); fkey_menu(2, "OS"); diff --git a/src/gint/dsp.c b/src/gint/dsp.c index d5308ba..b7d9a69 100644 --- a/src/gint/dsp.c +++ b/src/gint/dsp.c @@ -4,7 +4,7 @@ #include #include -#ifdef FXCG50 +#if GINT_HW_CG && GINT_RENDER_RGB extern void dsp_ldrc(void); extern int dsp_padd(int x, int y); diff --git a/src/gint/dump.c b/src/gint/dump.c index 3867a59..18d577f 100644 --- a/src/gint/dump.c +++ b/src/gint/dump.c @@ -19,13 +19,11 @@ struct region { }; static struct region const regs[] = { - #ifdef FX9860G + #if GINT_HW_FX { "ROM", 0x80000000, 0x807fffff, 8 }, { "RAM", 0x88000000, 0x88040000, 1 }, { "RS", 0xfd800000, 0xfd803fff, 1 }, - #endif - - #ifdef FXCG50 + #elif GINT_HW_CG { "ROM", 0x80000000, 0x81ffffff, 32 }, { "RAM_88", 0x88000000, 0x881fffff, 2 }, { "RAM_8C", 0x8c000000, 0x8c7fffff, 8 }, @@ -116,7 +114,7 @@ void gintctl_gint_dump(void) dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(1, 1, "Memory dump"); row_print(3, 1, "Region: %s", regs[region].name); @@ -131,7 +129,7 @@ void gintctl_gint_dump(void) if(retcode < 0) dprint(77, 56, C_BLACK, "E%d",retcode); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Memory dump to filesystem"); row_print(1, 1, "Region:"); diff --git a/src/gint/gray.c b/src/gint/gray.c index 55bfe8b..915a800 100644 --- a/src/gint/gray.c +++ b/src/gint/gray.c @@ -1,13 +1,14 @@ -#ifdef FX9860G - #include #include #include +#include #include #include #include +#if GINT_HW_FX + /* gintctl_gint_gray(): Gray engine tuning */ void gintctl_gint_gray(void) { @@ -83,6 +84,10 @@ void gintctl_gint_gray(void) dgray(DGRAY_OFF); } +#endif + +#if GINT_RENDER_MONO + /* gintctl_gint_grayrender(): Gray rendering functions */ void gintctl_gint_grayrender(void) { @@ -154,4 +159,4 @@ void gintctl_gint_grayrender(void) dgray(DGRAY_OFF); } -#endif /* FX9860G */ +#endif diff --git a/src/gint/image.c b/src/gint/image.c index 20ff57d..feaee34 100644 --- a/src/gint/image.c +++ b/src/gint/image.c @@ -1,10 +1,11 @@ #include #include +#include #include #include -#ifdef FXCG50 +#if GINT_RENDER_RGB static void scene_1(void) { dclear(0x5555); @@ -196,7 +197,7 @@ void gintctl_gint_image(void) } #endif -#ifdef FX9860G +#if GINT_RENDER_MONO static void img(int x, int y, bopti_image_t *img, int sub, int flags) { int ix = 0; diff --git a/src/gint/keyboard.c b/src/gint/keyboard.c index b0367f5..7804df2 100644 --- a/src/gint/keyboard.c +++ b/src/gint/keyboard.c @@ -9,7 +9,7 @@ static void position(int row, int col, int *x, int *y, int *w, int *h) { - #ifdef FX9860G + #if GINT_RENDER_MONO *x = 1 + (5 + (row>=5)) * col; *y = 1 + 4 * row + (row >= 1) + (row >= 3); *w = 4; @@ -23,7 +23,7 @@ static void position(int row, int col, int *x, int *y, int *w, int *h) } #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB if(row == 0) *y=2, *x=7+29*col, *w=16, *h=16; if(row >= 5) *y=108+23*(row-5), *x=2+35*col, *w=30, *h=17; if(row >= 1 && row <= 4) @@ -103,13 +103,13 @@ static void render(keydev_t *d, key_event_t *last_events, int counter) key_event_t ev; dclear(C_WHITE); - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Keyboard state visualizer"); int y0=190, dy=14, maxev=12; int x1=290, x2=350; #endif - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(1, 1, "Keyboard state"); dimage(0, 56, &img_opt_gint_keyboard); int y0=47, dy=7, maxev=6; @@ -134,7 +134,7 @@ static void render(keydev_t *d, key_event_t *last_events, int counter) render_keyboard(d, _(2,10), _(6,21)); int tr = d->tr.enabled; - #ifdef FX9860G + #if GINT_RENDER_MONO dtext(35, 10, C_BLACK, "Shift:"); render_option(35, 16, "Del", (tr & KEYDEV_TR_DELAYED_SHIFT) != 0); render_option(47, 16, "Ins", (tr & KEYDEV_TR_INSTANT_SHIFT) != 0); @@ -153,7 +153,7 @@ static void render(keydev_t *d, key_event_t *last_events, int counter) dfont(old_font); #endif /* FX9860G */ - #ifdef FXCG50 + #if GINT_RENDER_RGB dtext(200, 30, C_BLACK, "Shift:"); render_icon(245, 30, d->delayed_shift ? 7 : (d->pressed_shift ? 6 : 5)); render_option(205, 42, "Del", (tr & KEYDEV_TR_DELAYED_SHIFT) != 0); diff --git a/src/gint/kmalloc.c b/src/gint/kmalloc.c index e8bf454..b3c1713 100644 --- a/src/gint/kmalloc.c +++ b/src/gint/kmalloc.c @@ -20,7 +20,7 @@ static void draw_info(kmalloc_arena_t *arena) { int expected_os_heap_kB = _(48, 128); - #ifdef FX9860G + #if GINT_RENDER_MONO dimage(0, 56, &img_opt_gint_kmalloc); row_title("Heap allocators"); font_t const *old_font = dfont(&font_mini); @@ -43,7 +43,7 @@ static void draw_info(kmalloc_arena_t *arena) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Arena details:"); fkey_action(6, "ARENA"); @@ -105,7 +105,7 @@ static void m_clear(void *ptr[MANUAL_COUNT], uint16_t size[MANUAL_COUNT]) static void draw_manual(void *ptr[MANUAL_COUNT], uint16_t size[MANUAL_COUNT], int cursor) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Manual allocation"); font_t const *old_font = dfont(&font_mini); #endif @@ -130,14 +130,14 @@ static void draw_manual(void *ptr[MANUAL_COUNT], uint16_t size[MANUAL_COUNT], for(int c = 0; c < 6; c++) dprint(_(88,275), _(15+6*c,row_y(c+2)), C_BLACK, "%c: %d", 'A'+c, m_classes[c]); - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Manual allocation test:"); dprint(265, row_y(1), C_BLACK, "Allocate:"); dprint(265, row_y(8), C_BLACK, "Free:"); dprint(275, row_y(9), C_BLACK, "AC/ON"); #endif - #ifdef FX9860G + #if GINT_RENDER_MONO dprint(88, 9, C_BLACK, "ON: 0"); dfont(old_font); #endif @@ -181,14 +181,14 @@ static void run_fill(char const *arena, uint8_t classes[FILL_CLASSES]) static void draw_fill(uint8_t classes[FILL_CLASSES]) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Heap filler"); #endif font_t const *old_font = dfont(_(&font_mini, dfont_default())); int total = 0; - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Blocks allocated to fill, by size:"); #endif @@ -237,7 +237,7 @@ struct mass_test static void draw_mass(struct mass_test *test) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Random operations"); font_t const *old_font = dfont(&font_mini); dprint(1, 9, C_BLACK, "Filled %d (all blocks < %d)", @@ -254,7 +254,7 @@ static void draw_mass(struct mass_test *test) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB if(!test->done) { row_print(1, 1, "Mass allocation in a small space"); @@ -349,7 +349,7 @@ static void draw_stats(kmalloc_arena_t *arena) struct kmalloc_stats *s = &arena->stats; kmalloc_gint_stats_t *S = kmalloc_get_gint_stats(arena); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Statistics"); font_t const *old_font = dfont(&font_mini); @@ -374,7 +374,7 @@ static void draw_stats(kmalloc_arena_t *arena) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "General arena statistics:"); row_print(2, 2, "Live blocks: %d (peak: %d)", s->live_blocks, s->peak_live_blocks); @@ -497,7 +497,7 @@ void gintctl_gint_kmalloc(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO dimage(0, 56, &img_opt_gint_kmalloc); font_t const *old_font = dfont(&font_mini); dprint_opt(DWIDTH-2, 54, C_BLACK, C_NONE, DTEXT_RIGHT, DTEXT_BOTTOM, @@ -512,7 +512,7 @@ void gintctl_gint_kmalloc(void) if(tab == 4) draw_stats(arena); draw_integrity(arena); - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Integrity and stress tests for heap allocators"); fkey_menu(1, "INFO"); fkey_menu(2, "MANUAL"); diff --git a/src/gint/overclock.c b/src/gint/overclock.c index ec91cc1..7022654 100644 --- a/src/gint/overclock.c +++ b/src/gint/overclock.c @@ -11,7 +11,7 @@ #include #include -#ifdef FXCG50 +#if GINT_HW_CG && GINT_RENDER_RGB #define CPG SH7305_CPG #define BSC SH7305_BSC diff --git a/src/gint/ram.c b/src/gint/ram.c index 810ee22..ca9a581 100644 --- a/src/gint/ram.c +++ b/src/gint/ram.c @@ -154,7 +154,7 @@ static void e500_search(int e500_pages[32]) } } -#ifdef FX9860G +#if GINT_RENDER_MONO static void show_region(int row, struct region *r) { /* Out-of-bounds rows */ @@ -189,7 +189,7 @@ static void show_region(int row, struct region *r) } #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB static void show_region(int y, struct region *r) { char const *reasons[] = { @@ -254,7 +254,7 @@ void gintctl_gint_ram(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO if(tab == 0) { show_region(1, NULL); dhline(6, C_BLACK); @@ -269,7 +269,7 @@ void gintctl_gint_ram(void) } #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("On-chip memory discovery"); if(tab == 0) { @@ -323,7 +323,7 @@ void gintctl_gint_ram(void) explore_region(&r[11]); } - #ifdef FX9860G + #ifdef GINT_RENDER_MONO int scroll_max = region_count - 8; if(tab == 0 && key == KEY_UP) { diff --git a/src/gint/rtc.c b/src/gint/rtc.c index 55b22fe..81442bc 100644 --- a/src/gint/rtc.c +++ b/src/gint/rtc.c @@ -18,7 +18,7 @@ extern bopti_image_t img_rtc_segments; -#ifdef FX9860G +#if GINT_RENDER_MONO char const *days[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; @@ -33,7 +33,7 @@ static int x0=20, y0=8, dx=13; static int yd=36, eyd=12; #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB char const *days[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" @@ -80,14 +80,14 @@ static void draw_time(rtc_time_t *time, int edit_field) int x = x0 + (2 * dx + cw) * edit_field - 1; int y = y0 - 1; - #ifdef FX9860G + #if GINT_RENDER_MONO drect(x, y, x + 2*dx - 1, y + sh+1, C_INVERT); row_print(6, 1, "EXE: Set time"); row_print(7, 1, "EXIT: Cancel"); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB for(int a = y - 1; a <= y + sh + 2; a++) for(int b = x - 1; b <= x + 2*dx - 2; b++) { @@ -134,14 +134,14 @@ static void draw_date(rtc_time_t *time, int edit_field) for(int i = 0; i < edit_field; i++) x += w[i] + space_width + 2; - #ifdef FX9860G + #if GINT_RENDER_MONO drect(xd+x-1, y-1, xd+x+w[edit_field], y+h, C_INVERT); row_print(6, 1, "EXE: Set date"); row_print(7, 1, "EXIT: Cancel"); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB for(int a = y-2; a <= y+h; a++) for(int b = xd+x-2; b <= xd+x+w[edit_field]+1; b++) { @@ -167,12 +167,12 @@ static void draw_rtc(rtc_time_t *time) draw_time(time, -1); draw_date(time, -1); - #ifdef FX9860G + #if GINT_RENDER_MONO extern bopti_image_t img_opt_gint_rtc; dsubimage(0, 56, &img_opt_gint_rtc, 0, 0, 128, 8, DIMAGE_NONE); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Real-Time Clock"); fkey_menu(1, "RTC"); fkey_menu(2, "TIMER"); @@ -191,7 +191,7 @@ static void draw_speed(rtc_time_t *time, uint32_t elapsed) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO extern bopti_image_t img_opt_gint_rtc; row_print(1, 1, "Speed of RTC vs TMU"); dsubimage(0, 56, &img_opt_gint_rtc, 0, 9, 128, 8, DIMAGE_NONE); @@ -200,7 +200,7 @@ static void draw_speed(rtc_time_t *time, uint32_t elapsed) row_print(4, 1, "TMU time: %d us", elapsed); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Speed comparison of RTC and timers"); fkey_menu(1, "RTC"); fkey_menu(2, "TIMER"); @@ -335,7 +335,7 @@ static void edit_time(void) { dclear(C_WHITE); draw_time(&time, edit_field); - #ifdef FXCG50 + #if GINT_RENDER_RGB draw_date(&time, -1); row_title("Real-Time Clock"); #endif @@ -403,13 +403,13 @@ static void edit_date(void) while(key != KEY_EXE && key != KEY_EXIT) { dclear(C_WHITE); - #ifdef FXCG50 + #if GINT_RENDER_RGB draw_time(&time, -1); row_title("Real-Time Clock"); #endif draw_date(&time, edit_field); - #ifdef FX9860G + #if GINT_RENDER_MONO extern bopti_image_t img_opt_gint_rtc; if(edit_field == 0) dsubimage(0, 56, &img_opt_gint_rtc, 0, option_tab*9+18, @@ -419,7 +419,7 @@ static void edit_date(void) 128, 8, DIMAGE_NONE); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB char const *fkey_days[] = { "SUN", "MON", "TUE", "WED", "THUR", "FRI", "SAT" }; diff --git a/src/gint/spuram.c b/src/gint/spuram.c index 4a98fcf..f73e493 100644 --- a/src/gint/spuram.c +++ b/src/gint/spuram.c @@ -40,7 +40,7 @@ static void restore(volatile uint32_t *area, uint32_t *save, int pages) } } -#ifdef FX9860G +#if GINT_RENDER_MONO static void render_header(int y, GUNUSED int bank_count) { y = 9 + 6*y; @@ -88,7 +88,7 @@ static void render_bank(int y, char const *name, volatile uint32_t *bank, } #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB static void render_header(int y, int bank_count) { dtext(row_x(2), row_y(y), C_BLACK, "Area:"); @@ -168,7 +168,7 @@ void gintctl_gint_spuram(void) int switch_key = _(KEY_F6, KEY_F1); - #ifdef FX9860G + #if GINT_RENDER_MONO int tab = 0; #endif @@ -176,7 +176,7 @@ void gintctl_gint_spuram(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("SPU memory banking"); extern font_t font_hexa; @@ -210,7 +210,7 @@ void gintctl_gint_spuram(void) (tab == 1 ? 128 : 107), 8, DIMAGE_NONE); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("SPU memory: PRAM0, XRAM0, YRAM0, YRAM"); row_print(1, 1, "Pages layout in memory (offsets in kiB):"); @@ -258,7 +258,7 @@ void gintctl_gint_spuram(void) SPU.XBANKC1 ^= (1 << cur_page); } - #ifdef FX9860G + #if GINT_RENDER_MONO if(key == KEY_F1) tab = 0; if(key == KEY_F2) tab = 1; #endif diff --git a/src/gint/timer.c b/src/gint/timer.c index e47489c..affcdcd 100644 --- a/src/gint/timer.c +++ b/src/gint/timer.c @@ -16,7 +16,7 @@ void timer_print(int x, int y, char const *name, uint32_t TCOR, uint32_t TCNT, int dy = _(8,14); dprint(x, y, C_BLACK, "%s:", name); - #ifdef FXCG50 + #if GINT_RENDER_RGB dprint(x, y+dy, C_BLACK, "TCOR"); dprint(x, y+2*dy, C_BLACK, "TCNT"); #endif @@ -46,7 +46,7 @@ void etmu_print(int x, int y, char const *name, etmu_t *etmu) } -#ifdef FX9860G +#if GINT_RENDER_MONO static int x[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static int y[] = { 0, 16, 32, 0, 16, 32, 0, 16, 32 }; #else @@ -100,7 +100,7 @@ void gintctl_gint_timer(void) int key=0, tid=0; GUNUSED int timeout=1; - #ifdef FX9860G + #if GINT_RENDER_MONO int tab = 1; #endif @@ -108,7 +108,7 @@ void gintctl_gint_timer(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO if(tab == 1) show_tmu(); if(tab == 2) show_etmu_1(); if(tab == 3) show_etmu_2(); @@ -123,7 +123,7 @@ void gintctl_gint_timer(void) dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Timer status"); show_tmu(); @@ -151,7 +151,7 @@ void gintctl_gint_timer(void) if(free == tid) timer_start(tid); } - #ifdef FX9860G + #if GINT_RENDER_MONO /* On F4, F5 and F6, switch tabs */ if(key == KEY_F4) tab = 1; if(key == KEY_F5) tab = 2; diff --git a/src/gint/timer_callbacks.c b/src/gint/timer_callbacks.c index 5fdeb2b..ccd8a04 100644 --- a/src/gint/timer_callbacks.c +++ b/src/gint/timer_callbacks.c @@ -53,7 +53,7 @@ void gintctl_gint_timer_callbacks(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Timer callbacks"); row_print(3, 1, "F1:Simple callback"); @@ -68,7 +68,7 @@ void gintctl_gint_timer_callbacks(void) dprint(86, 56, C_BLACK, "Done:%d", tests); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Interrupt management in timer callbacks"); row_print(1, 1, diff --git a/src/gint/tlb.c b/src/gint/tlb.c index 5f58403..f60542d 100644 --- a/src/gint/tlb.c +++ b/src/gint/tlb.c @@ -11,7 +11,7 @@ #define PAGE_MAPPED 0x02 #define TLB_VIEW_MAX (64 - TLB_VIEW) -#ifdef FXCG50 +#if GINT_RENDER_RGB #define PAGE_COUNT 0x200 #define SQUARE_WIDTH 8 #define SQUARE_HEIGHT 8 @@ -36,7 +36,7 @@ static void draw_rom_cell(int x, int y, int status) } #endif -#ifdef FX9860G +#if GINT_RENDER_MONO #define PAGE_COUNT 0x80 #define SQUARE_WIDTH 5 #define SQUARE_HEIGHT 5 @@ -110,7 +110,7 @@ static void explore_pages(uint8_t *pages, uint32_t *next_miss) } } -#ifdef FXCG50 +#if GINT_RENDER_RGB void show_utlb(int row, int E) { if(E == -1) @@ -198,7 +198,7 @@ void show_itlb(int row, int E) } #endif -#ifdef FX9860G +#if GINT_RENDER_MONO void show_utlb(int row, int E) { extern font_t font_mini; @@ -305,7 +305,6 @@ void show_itlb(int row, int E) uint32_t src = addr.VPN << 10; uint32_t dst = data.PPN << 10; - int valid = (addr.V != 0) && (data.V != 0); int size = (data.SZ1 << 1) | data.SZ0; dprint( 1, y, C_BLACK, "%d", E); @@ -330,19 +329,19 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) uint32_t rom_size = (uint32_t)&srom; int rom_pages = (rom_size + (1 << 12)-1) >> 12; - #ifdef FX9860G + #if GINT_RENDER_MONO if(tab != 2 && tab != 3) #endif row_title(_("TLB management", "TLB miss handler and TLB management")); - #ifdef FX9860G + #if GINT_RENDER_MONO extern font_t font_mini; font_t const *old_font = dfont(&font_mini); #endif if(tab == 0) { - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Size of ROM sections: %08X (%d pages of 4k)", rom_size, rom_pages); #endif @@ -360,7 +359,7 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) _(11,36) + rom_cell_y(p), pages[p]); } - #ifdef FXCG50 + #if GINT_RENDER_RGB if(next_miss != 0xffffffff) { uint p = (next_miss - 0x00300000) >> 12; @@ -392,7 +391,7 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) dprint(_(72,212), _(22,50), C_BLACK, _("Mapped", "Currently mapped")); - #ifdef FXCG50 + #if GINT_RENDER_RGB draw_rom_cell(18, 64, -1); dprint(30, 64, C_BLACK, "Next page to load"); @@ -410,7 +409,7 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) "data before the intended TLB miss occurs."); #endif - #ifdef FX9860G + #if GINT_RENDER_MONO dprint(1, 30, C_BLACK, "Size of ROM text: %X (%d pages)", rom_size, rom_pages); @@ -430,11 +429,11 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) for(int i = 0; i < TLB_VIEW; i++) show_utlb(i+2, tlb_scroll+i); - #ifdef FX9860G + #if GINT_RENDER_MONO dhline(6, C_BLACK); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB dline(12, 34, 363, 34, C_BLACK); #endif @@ -450,23 +449,23 @@ static void draw(int tab, uint8_t *pages, uint32_t next_miss, int tlb_scroll) for(int E = 0; E < 4; E++) show_itlb(E+2, E); - #ifdef FX9860G + #if GINT_RENDER_MONO dhline(6, C_BLACK); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB dline(12, 34, 363, 34, C_BLACK); #endif } - #ifdef FX9860G + #if GINT_RENDER_MONO dfont(old_font); extern bopti_image_t img_opt_gint_tlb; dimage(0, 56, &img_opt_gint_tlb); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB fkey_menu(1, "ROM"); fkey_menu(2, "INFO"); fkey_menu(3, "TLB"); @@ -485,6 +484,8 @@ static int generate_tlb_miss(volatile void *arg) static int test_function(int x, int y) { + (void)x; + (void)y; return 0; } diff --git a/src/gint/usb.c b/src/gint/usb.c index 2f4fdb8..6de5a90 100644 --- a/src/gint/usb.c +++ b/src/gint/usb.c @@ -174,14 +174,14 @@ static void draw_registers(GUNUSED int scroll) val(40, "MSELCRA", *MSELCRA); val(41, "MSELCRB", *MSELCRB); - #ifdef FX9860G + #if GINT_RENDER_MONO if(scroll >= 14) dprint(3, 50 - 6 * (scroll - 14), C_BLACK, "USBCLKCR:%08X", SH7305_CPG.USBCLKCR.lword); if(scroll >= 15) dprint(3, 50 - 6 * (scroll - 15), C_BLACK, "MSTPCR2: %08X", SH7305_POWER.MSTPCR2.lword); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB dprint(row_x(1), 188, C_BLACK, "USBCLKCR:%08X MSTPCR2:%08X", SH7305_CPG.USBCLKCR.lword, SH7305_POWER.MSTPCR2.lword); #endif @@ -301,7 +301,7 @@ static int draw_log(int offset) static void draw_pipes(void) { -#ifdef FXCG50 +#if GINT_RENDER_RGB char const *PID[4] = { "NAK", "BUF", "STALL0", "STALL1" }; char const *BSTS[2] = { "Disabled", "Enabled" }; char const *FRDY[2] = { "NotReady", "Ready" }; @@ -347,7 +347,7 @@ static void draw_pipes(void) static void draw_tests(GUNUSED struct alignment_write_data *data) { -#ifdef FX9860G +#if GINT_RENDER_MONO dprint(1, 8, C_BLACK, "1: Screenshot"); dprint(1, 14, C_BLACK, "2: Async screenshot"); dprint(1, 20, C_BLACK, "3: Send text"); @@ -355,7 +355,7 @@ static void draw_tests(GUNUSED struct alignment_write_data *data) dprint(1, 32, C_BLACK, "5: FIFO alignm. test"); #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB row_print(1, 1, "[1]: Take screenshot (fxlink API)"); row_print(2, 1, "[2]: Take screenshot (asynchronous)"); row_print(3, 1, "[3]: Send some text (fxlink API)"); @@ -473,7 +473,7 @@ void gintctl_gint_usb(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("USB 2.0 communication"); dsubimage(0, 56, &img_opt_gint_usb, 0, open * 9, 128, 9, DIMAGE_NONE); if(tab == 0) scrollbar_px(8, 52, 0, 22, scroll0, 8); @@ -487,7 +487,7 @@ void gintctl_gint_usb(void) if(tab == 3) draw_pipes(); if(tab == 4) draw_tests(&awd); - #ifdef FXCG50 + #if GINT_RENDER_RGB if(tab == 2) row_title("USB logs (SHIFT+7: Save to file, SHIFT+8: Clear)"); else @@ -532,7 +532,7 @@ void gintctl_gint_usb(void) if(keydown(KEY_SHIFT)) scroll_speed = 4; if(keydown(KEY_ALPHA)) scroll_speed = 16; - #ifdef FX9860G + #if GINT_RENDER_MONO if(tab == 0 && key == KEY_UP && scroll0 > 0) scroll0--; if(tab == 0 && key == KEY_DOWN && scroll0 < 15) scroll0++; #endif diff --git a/src/gint/usbtrace.c b/src/gint/usbtrace.c index c150fc6..b6f6ef5 100644 --- a/src/gint/usbtrace.c +++ b/src/gint/usbtrace.c @@ -14,7 +14,7 @@ #include #include -#ifdef FXCG50 +#if GINT_RENDER_RGB #define USB SH7305_USB diff --git a/src/gintctl.c b/src/gintctl.c index 9747fc7..e3197b5 100644 --- a/src/gintctl.c +++ b/src/gintctl.c @@ -5,10 +5,8 @@ #include #include #include - -#ifdef FX9860G +#include #include -#endif #include #include @@ -34,14 +32,14 @@ struct menu menu_gint = { { "CPU and memory", gintctl_gint_cpumem, 0 }, { "RAM discovery", gintctl_gint_ram, MENU_SH4_ONLY }, - #ifdef FXCG50 + #if GINT_HW_CG && GINT_RENDER_RGB { "DSP processors", gintctl_gint_dsp, 0 }, #endif { "SPU memory", gintctl_gint_spuram, MENU_SH4_ONLY }, { "Memory dump", gintctl_gint_dump, 0 }, { "Drivers and worlds", gintctl_gint_drivers, 0 }, { "TLB management", gintctl_gint_tlb, 0 }, - #ifdef FXCG50 + #if GINT_HW_CG && GINT_RENDER_RGB { "Overclocking", gintctl_gint_overclock, MENU_SH4_ONLY }, #endif { "Memory allocation", gintctl_gint_kmalloc, 0 }, @@ -51,14 +49,16 @@ struct menu menu_gint = { { "DMA control", gintctl_gint_dma, MENU_SH4_ONLY }, { "Real-time clock", gintctl_gint_rtc, 0 }, { "USB communication", gintctl_gint_usb, MENU_SH4_ONLY }, - #ifdef FXCG50 + #if GINT_HW_CG && GINT_RENDER_RGB { "USB tracer", gintctl_gint_usbtrace, MENU_SH4_ONLY }, #endif { "Basic rendering", gintctl_gint_render, 0 }, { "Image rendering", gintctl_gint_image, 0 }, { "Text rendering", gintctl_gint_topti, 0 }, - #ifdef FX9860G + #if GINT_HW_FX { "Gray engine", gintctl_gint_gray, 0 }, + #endif + #if GINT_RENDER_MONO { "Gray rendering", gintctl_gint_grayrender, 0 }, #endif { NULL, NULL, 0 }, @@ -73,7 +73,7 @@ struct menu menu_perf = { { _("CPU parallelism", "Superscalar and pipeline parallelism"), gintctl_perf_cpu, 0 }, { "Interrupt stress", gintctl_perf_interrupts, 0 }, - #ifdef FXCG50 + #if GINT_RENDER_RGB { "Memory read/write speed", gintctl_perf_memory, 0 }, #endif @@ -206,7 +206,7 @@ key_event_t gintctl_getkey(void) /* gintctl_main(): Show the main tab */ void gintctl_main(void) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("gint %s %07x", GINT_VERSION, GINT_HASH); row_print(3, 1, "F2:gint tests"); @@ -214,9 +214,9 @@ void gintctl_main(void) row_print(5, 1, "F4:Libraries"); row_print(6, 1, "F5:MPU registers"); row_print(7, 1, "F6:Memory map/dump"); - #endif /* FX9860G */ + #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("gint %s (@%07x) for fx-CG 50", GINT_VERSION, GINT_HASH); row_print(1,1, "F2: gint features and driver tests"); row_print(2,1, "F3: Performance benchmarks"); @@ -227,7 +227,7 @@ void gintctl_main(void) row_print(7,1, "This add-in is running a unikernel called gint by"); row_print(8,1, "Lephe'. Information about the project is available"); row_print(9,1, "on planet-casio.com."); - #endif /* FXCG50 */ + #endif } static void draw(struct menu *menu) @@ -237,11 +237,11 @@ static void draw(struct menu *menu) if(menu) menu_show(menu); else gintctl_main(); - #ifdef FX9860G + #if GINT_RENDER_MONO dimage(0, 56, &img_opt_main); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB fkey_action(1, "INFO"); fkey_menu(2, "GINT"); fkey_menu(3, "PERF"); @@ -272,7 +272,7 @@ int main(GUNUSED int isappli, GUNUSED int optnum) /* Enable fixed-point formatters */ __printf_enable_fixed(); - #ifdef FX9860G + #if GINT_RENDER_MONO /* Use the Unicode font uf5x7 on fx-9860G */ dfont(&font_uf5x7); #endif diff --git a/src/libs/openlibm.c b/src/libs/openlibm.c index 53c67ee..557e826 100644 --- a/src/libs/openlibm.c +++ b/src/libs/openlibm.c @@ -22,7 +22,7 @@ void gintctl_libs_openlibm(void) dclear(C_WHITE); - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("OpenLibm floating-point functions"); row_print(1, 1, "Basic sine curve:"); diff --git a/src/mem/mem.c b/src/mem/mem.c index a04d574..f76a312 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -96,14 +96,14 @@ static void paint_mem(int x, int y, struct view *v) { GUNUSED int status = line(mem, header, bytes, ascii, 8); - #ifdef FX9860G + #if GINT_RENDER_MONO font_t const *old_font = dfont(&font_hexa); dtext(x, y + 6*i, C_BLACK, v->ascii ? ascii : header); dtext(x + 40, y + 6*i, C_BLACK, bytes); dfont(old_font); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB dtext(x, y + 12*i, C_BLACK, header); dtext(x + 85, y + 12*i, status ? C_RED : C_BLACK, bytes); @@ -182,7 +182,7 @@ void gintctl_mem(void) gscreen_focus(s, input); } - #ifdef FX9860G + #if GINT_RENDER_MONO if(key == KEY_F2 && !input_focus) { v.ascii = !v.ascii; diff --git a/src/perf/cpucache.c b/src/perf/cpucache.c index 8d5fab0..da2d2d6 100644 --- a/src/perf/cpucache.c +++ b/src/perf/cpucache.c @@ -44,7 +44,7 @@ uint32_t test_cpucache_rounds(uint8_t const *buf, size_t len, int rounds) return PLL_cycles / freq->Iphi_div; } -#ifdef FX9860G +#if GINT_RENDER_MONO static void tick_formatter(char *str, size_t size, int32_t v) { if(v == 0) snprintf(str, size, "0"); @@ -72,12 +72,34 @@ void gintctl_perf_cpucache(void) .data_y = y_time, .data_len = SAMPLES, - #ifdef FX9860G + #if GINT_RENDER_MONO .area = { .x = 0, .y = 18, .w = 128, .h = 44, }, .color = C_BLACK, + .grid = { + .level = PLOT_MAINGRID, + .primary_color = C_BLACK, + .dotted = 1, + }, + #endif + + #if GINT_RENDER_RGB + .area = { + .x = 24, .y = 51, + .w = 340, .h = 120, + }, + .color = C_RED, + .grid = { + .level = PLOT_FULLGRID, + .primary_color = C_RGB(20, 20, 20), + .secondary_color = C_RGB(28, 28, 28), + .dotted = 1, + }, + #endif + + #if GINT_HW_FX .ticks_x = { .multiples = 250, .subtick_divisions = 4, @@ -88,35 +110,24 @@ void gintctl_perf_cpucache(void) .subtick_divisions = 2, .formatter = tick_formatter, }, - .grid = { - .level = PLOT_MAINGRID, - .primary_color = C_BLACK, - .dotted = 1, - }, #endif - #ifdef FXCG50 - .area = { - .x = 24, .y = 51, - .w = 340, .h = 120, - }, - .color = C_RED, + #if GINT_HW_CG .ticks_x = { .multiples = CACHE_MAX / 16, .subtick_divisions = 4, + #if GINT_RENDER_MONO + .formatter = tick_formatter, + #endif }, .ticks_y = { .multiples = 125000, .subtick_divisions = 2, - }, - .grid = { - .level = PLOT_FULLGRID, - .primary_color = C_RGB(20, 20, 20), - .secondary_color = C_RGB(28, 28, 28), - .dotted = 1, + #if GINT_RENDER_MONO + .formatter = tick_formatter, + #endif }, #endif - }; int y_min = -1; @@ -136,7 +147,7 @@ void gintctl_perf_cpucache(void) dclear(C_WHITE); row_title(_("CPU and cache", "CPU speed and cache size")); - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(2, 1, "4096 nop: %d Iϕ", nop4096); extern font_t font_hexa; font_t const *old = dfont(&font_hexa); @@ -144,7 +155,7 @@ void gintctl_perf_cpucache(void) dfont(old); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_print(1, 1, "Time for 4096 nop (with overhead): %d Iphi", nop4096); row_print(2, 1, "Time needed to read a buffer multiple times:"); diff --git a/src/perf/interrupt.c b/src/perf/interrupt.c index a7bf6b0..08a673d 100644 --- a/src/perf/interrupt.c +++ b/src/perf/interrupt.c @@ -45,7 +45,7 @@ void gintctl_perf_interrupts(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_title("Interrupt stress"); if(time_spent == 0) @@ -60,7 +60,7 @@ void gintctl_perf_interrupts(void) } #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Interrupt handling stress test"); if(time_spent == 0) diff --git a/src/perf/libprof.c b/src/perf/libprof.c index 8443bf0..cc4a91c 100644 --- a/src/perf/libprof.c +++ b/src/perf/libprof.c @@ -39,7 +39,7 @@ void gintctl_perf_libprof(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(1, 1, "Measures time for"); row_print(2, 1, "10ms sleep +1us each"); row_print(3, 1, "time, and empty code."); @@ -52,9 +52,9 @@ void gintctl_perf_libprof(void) extern bopti_image_t img_opt_perf_libprof; dimage(0, 56, &img_opt_perf_libprof); - #endif /* FX9860G */ + #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("libprof basics"); row_print(1, 1, "This program shows the execution time " "measured"); @@ -71,7 +71,7 @@ void gintctl_perf_libprof(void) } fkey_button(1, "START"); - #endif /* FXCG50 */ + #endif dupdate(); key = getkey().key; diff --git a/src/perf/memory.c b/src/perf/memory.c index 2a006ed..6aca84d 100644 --- a/src/perf/memory.c +++ b/src/perf/memory.c @@ -12,7 +12,7 @@ #include #include -#ifdef FXCG50 +#if GINT_RENDER_RGB //--- // Functions for read/write access patterns @@ -405,4 +405,4 @@ void gintctl_perf_memory(void) free(info); } -#endif /* FXCG50 */ +#endif diff --git a/src/perf/render.c b/src/perf/render.c index 321c16d..175f89d 100644 --- a/src/perf/render.c +++ b/src/perf/render.c @@ -30,7 +30,7 @@ static void run_test(struct elapsed *time) drect(0, 0, _(127,395), _(63,223), C_WHITE); }); - #ifdef FXCG50 + #if GINT_RENDER_RGB extern bopti_image_t img_swift; time->fs_r5g6b5 = prof_exec({ dimage(0, 0, &img_swift); @@ -58,7 +58,7 @@ void gintctl_perf_render(void) { dclear(C_WHITE); - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(1, 1, "Rendering functions"); if(test) @@ -74,7 +74,7 @@ void gintctl_perf_render(void) dimage(0, 56, &img_opt_perf_render); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB row_title("Rendering functions"); row_print(1, 1, "This program measures the execution time of"); row_print(2, 1, "common drawing functions."); diff --git a/src/regs/regs.c b/src/regs/regs.c index 8cd8de4..f2dfa37 100644 --- a/src/regs/regs.c +++ b/src/regs/regs.c @@ -13,6 +13,7 @@ void gintctl_regs(void) dclear(C_WHITE); row_title("Register browser"); +#if GINT_HW_FX if(isSH3()) { #define IPR(X) (*SH7705_INTC._.IPR##X).word @@ -27,6 +28,7 @@ void gintctl_regs(void) #undef IPR } else +#endif { #define IPR(X) SH7305_INTC._->IPR##X.word row_print(2,1, "A:%04x B:%04x C:%04x", IPR(A), IPR(B), IPR(C)); diff --git a/src/util.c b/src/util.c index bbaecb5..232ec0c 100644 --- a/src/util.c +++ b/src/util.c @@ -1,6 +1,7 @@ #include #include #include +#include #include @@ -18,23 +19,23 @@ // Row manipulation functions //--- -#ifdef FX9860G +#if GINT_RENDER_MONO #define ROW_X 1 #define ROW_W 6 #define ROW_Y 0 #define ROW_YPAD 0 #define ROW_H 8 #define ROW_COUNT 8 -#endif /* FX9860G */ +#endif -#ifdef FXCG50 +#if GINT_RENDER_RGB #define ROW_X 6 #define ROW_W 8 #define ROW_Y 20 #define ROW_YPAD 2 #define ROW_H 14 #define ROW_COUNT 14 -#endif /* FXCG50 */ +#endif /* row_title(): Render the main title */ void row_title(char const *format, ...) @@ -42,11 +43,9 @@ void row_title(char const *format, ...) char str[80]; shortprint(str, format); - #ifdef FX9860G + #if GINT_RENDER_MONO dtext(1, 0, C_BLACK, str); - #endif - - #ifdef FXCG50 + #elif GINT_RENDER_RGB dtext(ROW_X, 3, C_BLACK, str); drect(0, 0, DWIDTH-1, 15, C_INVERT); #endif @@ -82,11 +81,9 @@ void row_highlight(int row) int y1 = ROW_Y + ROW_H * (row - 1); int y2 = y1 + ROW_H; - #ifdef FX9860G + #if GINT_RENDER_MONO drect(0, y1, 125, y2 - 1, C_INVERT); - #endif - - #ifdef FXCG50 + #elif GINT_RENDER_RGB drect(0, y1, DWIDTH - 1, y2 - 1, C_INVERT); #endif } @@ -94,11 +91,9 @@ void row_highlight(int row) /* row_right(): Print at the last column of a row */ void row_right(int row, char const *character) { - #ifdef FX9860G + #if GINT_RENDER_MONO row_print(row, 21, character); - #endif - - #ifdef FXCG50 + #elif GINT_RENDER_RGB dtext(370, ROW_Y + ROW_H * (row - 1) + ROW_YPAD, C_BLACK, character); #endif } @@ -160,7 +155,7 @@ void scrollbar_px(int view_top, int view_bottom, int range_min, int range_max, // Other drawing utilities //--- -#ifdef FXCG50 +#if GINT_RENDER_RGB /* fkey_action(): A black-on-white F-key */ void fkey_action(int position, char const *text) diff --git a/src/widgets/gscreen.c b/src/widgets/gscreen.c index 36a9769..eb5942d 100644 --- a/src/widgets/gscreen.c +++ b/src/widgets/gscreen.c @@ -8,10 +8,10 @@ #include -#ifdef FX9860G +#if GINT_RENDER_MONO gscreen *gscreen_create(char const *name, bopti_image_t const *img) #endif -#ifdef FXCG50 +#if GINT_RENDER_RGB gscreen *gscreen_create(char const *name, char const *labels) #endif { @@ -46,17 +46,17 @@ gscreen *gscreen_create(char const *name, char const *labels) jlabel_set_font(title, _(&font_title, dfont_default())); jwidget_set_stretch(title, 1, 0, false); - #ifdef FX9860G + #if GINT_RENDER_MONO jwidget_set_padding(title, 1, 1, 0, 1); jwidget_set_margin(title, 0, 0, 1, 0); #endif - #ifdef FXCG50 + #if GINT_RENDER_RGB jwidget_set_padding(title, 3, 6, 3, 6); #endif } - #ifdef FXCG50 + #if GINT_RENDER_RGB jwidget_set_padding(stack, 1, 3, 1, 3); #endif