From d6345db414a5715cd9c51dbc28f41c4511375fc8 Mon Sep 17 00:00:00 2001 From: Lephe Date: Sun, 31 Jan 2021 17:08:28 +0100 Subject: [PATCH] remove irrelevant tests on SH3 --- include/gintctl/menu.h | 11 ++++++++ src/gint/ram.c | 4 +-- src/gintctl.c | 58 +++++++++++++++++++++--------------------- src/menu.c | 11 +++++++- src/perf/cpucache.c | 1 + 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/include/gintctl/menu.h b/include/gintctl/menu.h index 4353df4..f7d09e4 100644 --- a/include/gintctl/menu.h +++ b/include/gintctl/menu.h @@ -12,6 +12,14 @@ struct menuentry { char const *name; void (*function)(void); + int flags; +}; + +enum { + /* SH3-only */ + MENU_SH3_ONLY, + /* SH4-only */ + MENU_SH4_ONLY, }; struct menu { @@ -27,6 +35,9 @@ struct menu { }; /* menu_init(): Initialize a menu list + This function will initialize the menu data and remove entries that are not + available on the current platform? + @menu Any list menu, even uninitialized @top Number of lines reserved on top (including title on fx9860g) @bottom Number of lines reserved at bottom */ diff --git a/src/gint/ram.c b/src/gint/ram.c index ebb98bd..19fbdc2 100644 --- a/src/gint/ram.c +++ b/src/gint/ram.c @@ -202,7 +202,7 @@ void gintctl_gint_ram(void) { NULL }, }; - /* Region count (for the scrolling list on fx-9860G */ + /* Region count (for the scrolling list on fx-9860G) */ GUNUSED int region_count = 9; /* List scroll no fx-9860G */ GUNUSED int scroll = spu_zero(); @@ -214,7 +214,7 @@ void gintctl_gint_ram(void) #ifdef FX9860G show_region(1, NULL); - for(int i = 0; i < 9; i++) + for(int i = 0; i < region_count; i++) { show_region(i+2-scroll, &r[i]); } diff --git a/src/gintctl.c b/src/gintctl.c index b908237..6f8ac0d 100644 --- a/src/gintctl.c +++ b/src/gintctl.c @@ -33,46 +33,46 @@ struct menu menu_gint = { _("gint tests", "gint features and driver tests"), .entries = { - { "Hardware", gintctl_gint_hardware }, - { "RAM discovery", gintctl_gint_ram }, + { "Hardware", gintctl_gint_hardware, 0 }, + { "RAM discovery", gintctl_gint_ram, MENU_SH4_ONLY }, #ifdef FXCG50 - { "DSP processors", gintctl_gint_dsp }, - { "SPU memory", gintctl_gint_spuram }, + { "DSP processors", gintctl_gint_dsp, 0 }, + { "SPU memory", gintctl_gint_spuram, MENU_SH4_ONLY }, #endif - { "Memory dump", gintctl_gint_dump }, - { "Switching to OS", gintctl_gint_switch }, - { "TLB management", gintctl_gint_tlb }, - { "Keyboard", gintctl_gint_keyboard }, - { "Timers", gintctl_gint_timer }, - { "Timer callbacks", gintctl_gint_timer_callbacks }, + { "Memory dump", gintctl_gint_dump, 0 }, + { "Switching to OS", gintctl_gint_switch, 0 }, + { "TLB management", gintctl_gint_tlb, 0 }, + { "Keyboard", gintctl_gint_keyboard, 0 }, + { "Timers", gintctl_gint_timer, 0 }, + { "Timer callbacks", gintctl_gint_timer_callbacks, 0 }, #ifdef FXCG50 - { "DMA control", gintctl_gint_dma }, + { "DMA control", gintctl_gint_dma, 0 }, #endif - { "Real-time clock", gintctl_gint_rtc }, - { "Image rendering", gintctl_gint_bopti }, - { "Text rendering", gintctl_gint_topti }, + { "Real-time clock", gintctl_gint_rtc, 0 }, + { "Image rendering", gintctl_gint_bopti, 0 }, + { "Text rendering", gintctl_gint_topti, 0 }, #ifdef FX9860G - { "Gray engine", gintctl_gint_gray }, - { "Gray rendering", gintctl_gint_grayrender }, + { "Gray engine", gintctl_gint_gray, 0 }, + { "Gray rendering", gintctl_gint_grayrender, 0 }, #endif - { NULL, NULL }, + { NULL, NULL, 0 }, }}; /* Performance menu */ struct menu menu_perf = { _("Performance", "Performance benchmarks"), .entries = { - { "libprof basics", gintctl_perf_libprof }, - { "CPU and cache", gintctl_perf_cpucache }, - { "Interrupt stress", gintctl_perf_interrupts }, + { "libprof basics", gintctl_perf_libprof, 0 }, + { "CPU and cache", gintctl_perf_cpucache, 0 }, + { "Interrupt stress", gintctl_perf_interrupts, 0 }, #ifdef FXCG50 - { "Memory access speed", gintctl_perf_memory }, + { "Memory access speed", gintctl_perf_memory, 0 }, #endif - { "Rendering functions", gintctl_perf_render }, + { "Rendering functions", gintctl_perf_render, 0 }, /* TODO: Comparison with MonochromeLib */ - { NULL, NULL }, + { NULL, NULL, 0 }, }}; /* External libraries */ @@ -80,16 +80,16 @@ struct menu menu_libs = { _("Libraries", "External and standard libraries"), .entries = { { "libc: " _("TinyMT32", "TinyMT random number generation"), - gintctl_libs_tinymt }, + gintctl_libs_tinymt, 0 }, { "libc: " _("printf family", "Formatted printing functions"), - gintctl_libs_printf }, + gintctl_libs_printf, 0 }, { "libc: " _("mem functions", "Core memory functions"), - gintctl_libs_memory }, + gintctl_libs_memory, 0 }, { "libm: " _("OpenLibm", "OpenLibm floating-point functions"), - gintctl_libs_openlibm }, + gintctl_libs_openlibm, 0 }, { "libimg" _("",": Image transforms"), - gintctl_libs_libimg }, - { NULL, NULL }, + gintctl_libs_libimg, 0 }, + { NULL, NULL, 0 }, }}; //--- diff --git a/src/menu.c b/src/menu.c index 31b3235..8648f09 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -7,7 +8,15 @@ void menu_init(struct menu *menu, int top, int bottom) { menu->len = 0; - while(menu->entries[menu->len].name) menu->len++; + + for(int i = 0; menu->entries[i].name; i++) + { + int f = menu->entries[i].flags; + if(isSH3() && (f & MENU_SH4_ONLY)) continue; + if(isSH4() && (f & MENU_SH3_ONLY)) continue; + + menu->entries[menu->len++] = menu->entries[i]; + } menu->offset = 0; menu->pos = 0; diff --git a/src/perf/cpucache.c b/src/perf/cpucache.c index f8e9a69..13060c0 100644 --- a/src/perf/cpucache.c +++ b/src/perf/cpucache.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include