Hardware
This components centralizes detected information about the runtime hardware, including MPU version, peripheral modules, and how drivers configured them.
The most common use of this header is for the isSH3() and isSH4() macros that let you run MPU-dependent jobs and are used like this: if(isSH3()) do_sh3(); else do_sh4();
Functions
Section titled “Functions”hw_detect
Section titled “hw_detect”hw_detect(): Basic hardware detection This function probes the hardware and fills in the HWMPU, HWCPUVR and HWCPUPR fields.
void hw_detect(void)Macros
Section titled “Macros”HW_KEYS
Section titled “HW_KEYS”Most of the information here is going to be stored in (key, value) pairs for predetermined keys and 32-bits values that are often integers or a set of flags. The data will be filled by gint or its drivers.
#define HW_KEYS 16HW_LOADED
Section titled “HW_LOADED”This bit should be set in all data longwords except HWMPU, HWCPUVR, HWCPUPR and HWCALC which are guaranteed to always be loaded. If not set then the information must be treated as invalid.
#define HW_LOADED 0x80000000- Key list
#define HWMPU 0 /* MPU type */HWCPUVR
Section titled “HWCPUVR”#define HWMPU 0 /* MPU type */
#define HWCPUVR 1 /* CPU Version Register */HWCPUPR
Section titled “HWCPUPR”#define HWCPUVR 1 /* CPU Version Register */
#define HWCPUPR 2 /* CPU Product Register */HWCALC
Section titled “HWCALC”#define HWCPUPR 2 /* CPU Product Register */
#define HWCALC 3 /* Calculator model, hardcoded in kernel/inth.S */#define HWCALC 3 /* Calculator model, hardcoded in kernel/inth.S */
#define HWRAM 4 /* Amount of RAM */#define HWRAM 4 /* Amount of RAM */
#define HWROM 5 /* Amount of ROM */HWURAM
Section titled “HWURAM”#define HWROM 5 /* Amount of ROM */
#define HWURAM 6 /* Userspace RAM */HWETMU
Section titled “HWETMU”#define HWURAM 6 /* Userspace RAM */
#define HWETMU /* Deprecated: use timer_count() (ETMU always load) */#define HWETMU /* Deprecated: use timer_count() (ETMU always load) */
#define HWKBD 8 /* Keyboard */HWKBDSF
Section titled “HWKBDSF”#define HWKBD 8 /* Keyboard */
#define HWKBDSF /* Deprecated: use keysc_scan_frequency() */#define HWKBDSF /* Deprecated: use keysc_scan_frequency() */
#define HWDD /* Deprecated: use the T6K11/R61524 API */#define HWDD /* Deprecated: use the T6K11/R61524 API */
#define HWFS 11 /* Filesystem type */HWMPU_UNKNOWN
Section titled “HWMPU_UNKNOWN”Unknown MPUs are all assumed to be SH-4A-based
#define HWMPU_UNKNOWN 0HWMPU_SH7337
Section titled “HWMPU_SH7337”Used on original fx-9860G, SH-3-based
#define HWMPU_SH7337 1HWMPU_SH7305
Section titled “HWMPU_SH7305”Used on recent fx-9860G derivatives such as the fx-9750G II, and also on the fx-CG 10/20/50. SH-4A-based
#define HWMPU_SH7305 2HWMPU_SH7355
Section titled “HWMPU_SH7355”Used on the fx-9860G II, SH-3-based
#define HWMPU_SH7355 3HWMPU_SH7724
Section titled “HWMPU_SH7724”Closest documented match to the SH7305, not used in any known calculator. Detected and included for reference only
#define HWMPU_SH7724 4HWCALC_FX9860G_SH3
Section titled “HWCALC_FX9860G_SH3”SH-3-based fx-9860G-family
#define HWCALC_FX9860G_SH3 1HWCALC_FX9860G_SH4
Section titled “HWCALC_FX9860G_SH4”Other SH-4A-based fx-9860G-family
#define HWCALC_FX9860G_SH4 2HWCALC_G35PE2
Section titled “HWCALC_G35PE2”Graph 35+E II, an SH-4A French extension of the fx-9860G family
#define HWCALC_G35PE2 3HWCALC_PRIZM
Section titled “HWCALC_PRIZM”fx-CG 10/20, also known as the “Prizm” family
#define HWCALC_PRIZM 4HWCALC_FXCG50
Section titled “HWCALC_FXCG50”fx-CG 50, a late extension to the Prizm family
#define HWCALC_FXCG50 5HWCALC_FXCG_MANAGER
Section titled “HWCALC_FXCG_MANAGER”fx-CG 50 emulator, hardcoded in kernel/inth.S
#define HWCALC_FXCG_MANAGER 6HWCALC_FX9860G_SLIM
Section titled “HWCALC_FX9860G_SLIM”fx-9860G Slim, SH-3-based fx-9860G with hardware differences
#define HWCALC_FX9860G_SLIM 7HWCALC_FXCP400
Section titled “HWCALC_FXCP400”fx-CP 400
#define HWCALC_FXCP400 8HWCALC_FXCG100
Section titled “HWCALC_FXCG100”fx-CG 100, successor to the CG-50 in the Prizm family. Also Graph Math+
#define HWCALC_FXCG100 9HWKBD_IO
Section titled “HWKBD_IO”The keyboard uses an I/O-port-based scan method. This is possible on both SH3 and SH4, but gint will normally do it only on SH3.
#define HWKBD_IO 0x01HWKBD_WDD
Section titled “HWKBD_WDD”When using the I/O-port scanning method on SH3, whether the watchdog is used to delay I/O operations.
#define HWKBD_WDD 0x02HWKBD_KSI
Section titled “HWKBD_KSI”The keyboard uses a KEYSC-based scan method. This is only possible on SH4
#define HWKBD_KSI 0x04HWFS_NONE
Section titled “HWFS_NONE”Unknown or no filesystem.
#define HWFS_NONE 0HWFS_CASIOWIN
Section titled “HWFS_CASIOWIN”CASIO’s in-house filesystem, now deprecated.
#define HWFS_CASIOWIN 1HWFS_FUGUE
Section titled “HWFS_FUGUE”Wrapper around Kyoto Software Research’s Fugue VFAT implementation.
#define HWFS_FUGUE 2#define isSH3 (()) 0#define isSH4 (()) 1#define isSlim (()) 0