From 2e5e56f82e49f7462534d2e1f9fc5df9af103a7a Mon Sep 17 00:00:00 2001 From: Lephe Date: Mon, 6 Dec 2021 21:31:00 +0100 Subject: [PATCH] hardware: expose filesystem type in the hardware info Filesystem type is detected with a trivial heuristic: * fx-9860G: CASIOWIN, unless Fugue in the G-III series (OS >= 3.00) * fx-CG 50: Always Fugue --- include/gint/hardware.h | 12 ++++++++++++ src/kernel/hardware.c | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/gint/hardware.h b/include/gint/hardware.h index 60aa1dc..8e86b80 100644 --- a/include/gint/hardware.h +++ b/include/gint/hardware.h @@ -70,6 +70,7 @@ void hw_detect(void); #define HWKBD 8 /* Keyboard */ #define HWKBDSF /* Deprecated: use keysc_scan_frequency() */ #define HWDD /* Deprecated: use the T6K11/R61524 API */ +#define HWFS 11 /* Filesystem type */ /* ** MPU type @@ -118,6 +119,17 @@ void hw_detect(void); /* The keyboard uses a KEYSC-based scan method. This is only possible on SH4 */ #define HWKBD_KSI 0x04 +/* +** Filesystem type +*/ + +/* Unknown or no filesystem. */ +#define HWFS_NONE 0 +/* CASIO's in-house filesystem, now deprecated. */ +#define HWFS_CASIOWIN 1 +/* Wrapper around Kyoto Software Research's Fugue VFAT implementation. */ +#define HWFS_FUGUE 2 + #ifdef __cplusplus } #endif diff --git a/src/kernel/hardware.c b/src/kernel/hardware.c index 4fc8491..52b1da9 100644 --- a/src/kernel/hardware.c +++ b/src/kernel/hardware.c @@ -78,7 +78,15 @@ void hw_detect(void) be real, is enough for now. TODO: Try to detect Graph 35+E II from amount of ROM in BSC? */ char *version = (void *)0x80010020; - if(version[1] == '3') gint[HWCALC] = HWCALC_G35PE2; + if(version[1] == '3') + { + gint[HWCALC] = HWCALC_G35PE2; + gint[HWFS] = HWFS_FUGUE; + } + else + { + gint[HWFS] = HWFS_CASIOWIN; + } /* Detect RAM by checking if 8804'0000 is the same as 8800'0000. */ @@ -121,7 +129,8 @@ void hw_detect(void) /* Tell Prizms apart from fx-CG 50 by checking the stack address*/ uint32_t stack; __asm__("mov r15, %0" : "=r"(stack)); - gint[HWCALC] = (stack < 0x8c000000) ? HWCALC_PRIZM : HWCALC_FXCG50; + gint[HWCALC] = (stack < 0x8c000000) ? HWCALC_PRIZM : HWCALC_FXCG50; + gint[HWFS] = HWFS_FUGUE; /* Tell the fx-CG emulator apart using the product ID */ uint8_t *productID = (void *)0x8001ffd0;