2019-07-17 18:59:17 +02:00
|
|
|
#include <gint/hardware.h>
|
|
|
|
#include <gint/keyboard.h>
|
|
|
|
#include <gint/display.h>
|
2021-02-01 12:00:22 +01:00
|
|
|
#include <gint/mmu.h>
|
2019-07-17 18:59:17 +02:00
|
|
|
|
|
|
|
#include <gintctl/gint.h>
|
|
|
|
#include <gintctl/util.h>
|
|
|
|
|
2021-06-08 10:45:51 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2021-02-06 16:42:43 +01:00
|
|
|
/* TODO: Include <gint/cpu.h> */
|
|
|
|
extern uint32_t cpu_getVBR(void);
|
|
|
|
|
|
|
|
/* Some symbols from the linker script */
|
|
|
|
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
|
2019-07-17 18:59:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* MPU type and processor version */
|
2020-07-02 16:01:49 +02:00
|
|
|
void show_mpucpu(void)
|
2019-07-17 18:59:17 +02:00
|
|
|
{
|
|
|
|
char const *mpu_names[] = {
|
|
|
|
#ifdef FX9860G
|
|
|
|
"Unknown",
|
|
|
|
"SH-3 SH7337",
|
|
|
|
"SH-4A SH7305",
|
|
|
|
"SH-3 SH7355",
|
|
|
|
"SH-4A SH7724",
|
|
|
|
#else
|
|
|
|
"Unknown MPU product",
|
|
|
|
"SH-3-based SH7337",
|
|
|
|
"SH-4A-based SH7305",
|
|
|
|
"SH-3-based SH7355",
|
|
|
|
"SH-4A-based SH7724",
|
|
|
|
#endif
|
|
|
|
};
|
2020-07-02 16:01:49 +02:00
|
|
|
char const *calc_names[] = {
|
|
|
|
"Unknown",
|
2021-02-06 16:42:43 +01:00
|
|
|
"fx-9860G-like",
|
|
|
|
"fx-9860G-like",
|
2020-07-02 16:01:49 +02:00
|
|
|
"Graph 35+E II",
|
|
|
|
"Prizm fx-CG 20",
|
|
|
|
"fx-CG 50/Graph 90+E",
|
|
|
|
"fx-CG Manager",
|
|
|
|
};
|
|
|
|
|
|
|
|
int mpu = gint[HWMPU];
|
|
|
|
int calc = gint[HWCALC];
|
|
|
|
|
2021-05-17 15:09:23 +02:00
|
|
|
extern volatile int cpu_sleep_block_counter;
|
|
|
|
|
2021-02-06 16:42:43 +01:00
|
|
|
/* Generate a default calc name if invalid values are found */
|
|
|
|
char calc_default[16];
|
|
|
|
sprintf(calc_default, "<CALCID %d>", calc);
|
|
|
|
char const *str_calc = calc_default;
|
|
|
|
if(calc >= 0 && calc < 7) str_calc = calc_names[calc];
|
2019-07-17 18:59:17 +02:00
|
|
|
|
2021-02-06 16:42:43 +01:00
|
|
|
/* Generate a default MPU name if invalid values are found */
|
|
|
|
char mpu_default[16];
|
|
|
|
sprintf(mpu_default, "<MPUID %d>", mpu);
|
|
|
|
char const *str_mpu = mpu_default;
|
|
|
|
if(mpu >= 0 && mpu < 5) str_mpu = mpu_names[mpu];
|
2020-06-20 22:48:35 +02:00
|
|
|
|
|
|
|
volatile uint32_t *CPUOPM = (void *)0xff2f0000;
|
2021-02-06 16:42:43 +01:00
|
|
|
uint32_t SR, r15;
|
|
|
|
__asm__("stc sr, %0" : "=r"(SR));
|
|
|
|
__asm__("mov r15, %0" : "=r"(r15));
|
2021-02-01 12:00:22 +01:00
|
|
|
|
|
|
|
#ifdef FX9860G
|
2021-02-06 16:42:43 +01:00
|
|
|
extern font_t font_mini;
|
|
|
|
font_t const *old_font = dfont(&font_mini);
|
|
|
|
|
|
|
|
dprint(1, 10, C_BLACK, "Model: %s", str_calc);
|
|
|
|
dprint(1, 16, C_BLACK, "MPU: %s", str_mpu);
|
|
|
|
|
|
|
|
print_prefix(29, 24, "SR", "%08X", SR);
|
|
|
|
dline(29, 24, 29, 46, C_BLACK);
|
|
|
|
if(isSH3()) {
|
|
|
|
print_prefix(29, 30, "PVR", "");
|
|
|
|
print_prefix(29, 36, "PRR", "");
|
|
|
|
print_prefix(29, 42, "CPUOPM", "");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_prefix(29, 30, "PVR", "%08X", gint[HWCPUVR]);
|
|
|
|
print_prefix(29, 36, "PRR", "%08X", gint[HWCPUPR]);
|
|
|
|
print_prefix(29, 42, "CPUOPM", "%08X", *CPUOPM);
|
2021-02-01 12:00:22 +01:00
|
|
|
}
|
2021-02-06 16:42:43 +01:00
|
|
|
print_prefix(85, 24, "VBR", "%08X", cpu_getVBR());
|
|
|
|
print_prefix(85, 30, "R15", "%08X", r15);
|
2021-05-17 15:09:23 +02:00
|
|
|
print_prefix(85, 36, "sbc", "%d", cpu_sleep_block_counter);
|
|
|
|
dline(85, 24, 85, 40, C_BLACK);
|
2021-02-06 16:42:43 +01:00
|
|
|
dfont(old_font);
|
2021-02-01 12:00:22 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FXCG50
|
2021-02-06 16:42:43 +01:00
|
|
|
row_print(1, 1, "Calculator model: %s", str_calc);
|
|
|
|
row_print(3, 1, "MPU: %s", str_mpu);
|
2021-02-01 12:00:22 +01:00
|
|
|
row_print(4, 1, " Status Register: %08x", SR);
|
|
|
|
row_print(5, 1, " Processor Version Register: %08x", gint[HWCPUVR]);
|
|
|
|
row_print(6, 1, " Product Register: %08x", gint[HWCPUPR]);
|
|
|
|
row_print(7, 1, " CPU Operation Mode: %08x", *CPUOPM);
|
2021-02-06 16:42:43 +01:00
|
|
|
row_print(8, 1, " Current VBR: %08x", cpu_getVBR());
|
|
|
|
row_print(9, 1, " Current stack pointer: %08x", r15);
|
2021-05-17 15:09:23 +02:00
|
|
|
row_print(10, 1, " CPU sleep block level: %d", cpu_sleep_block_counter);
|
2021-02-01 12:00:22 +01:00
|
|
|
#endif
|
2019-07-17 18:59:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Memory */
|
2020-07-02 16:01:49 +02:00
|
|
|
static void show_memory(void)
|
2019-07-17 18:59:17 +02:00
|
|
|
{
|
|
|
|
#ifdef FX9860G
|
2021-02-06 16:42:43 +01:00
|
|
|
extern font_t font_mini;
|
|
|
|
font_t const *old_font = dfont(&font_mini);
|
|
|
|
print_prefix(28, 10, "brom", "%08X", &brom);
|
|
|
|
print_prefix(28, 16, "rdata", "%08X", &rdata);
|
|
|
|
print_prefix(28, 22, "rbss", "%08X", &rbss);
|
|
|
|
print_prefix(28, 28, "rreloc", "%08X", mmu_uram());
|
|
|
|
|
|
|
|
print_prefix(98, 10, "srom", "%06d", &srom);
|
|
|
|
print_prefix(98, 16, "sdata", "%06d", &sdata);
|
|
|
|
print_prefix(98, 22, "sbss", "%06d", &sbss);
|
|
|
|
print_prefix(98, 28, "sreloc", "%06d", &sgmapped);
|
|
|
|
|
|
|
|
dprint(1, 38, C_BLACK, "ROM: %dk, RAM: %dk",
|
|
|
|
gint[HWROM] >> 10, gint[HWRAM] >> 10);
|
|
|
|
dprint(1, 45, C_BLACK, "User RAM: %08X (%dk, P0 %dk)",
|
|
|
|
mmu_uram(), mmu_uram_size() >> 10, gint[HWURAM] >> 10);
|
|
|
|
dfont(old_font);
|
2020-07-02 16:01:49 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FXCG50
|
2021-02-06 16:42:43 +01:00
|
|
|
uint32_t base_ram = 0x88000000;
|
2021-02-01 12:00:22 +01:00
|
|
|
if(gint[HWCALC] == HWCALC_FXCG50) base_ram = 0x8c000000;
|
2021-02-06 16:42:43 +01:00
|
|
|
|
|
|
|
row_print(1, 1, "RAM: %dM, RAM: %dM (starts at %08X)",
|
|
|
|
gint[HWROM] >> 20, gint[HWRAM] >> 20, base_ram);
|
|
|
|
row_print(2, 1, "Userspace RAM: %08X (%dk continuous block)",
|
|
|
|
mmu_uram(), mmu_uram_size() >> 10);
|
|
|
|
row_print(3, 1, "Total RAM mapped in P0: %dk",
|
|
|
|
gint[HWURAM] >> 10);
|
|
|
|
|
|
|
|
print_prefix(80, row_y(5), "brom", "%08X", &brom);
|
|
|
|
print_prefix(80, row_y(6), "rdata", "%08X", &rdata);
|
|
|
|
print_prefix(80, row_y(7), "rbss", "%08X", &rbss);
|
|
|
|
|
|
|
|
print_prefix(240, row_y(5), "srom", "%06d", &srom);
|
|
|
|
print_prefix(240, row_y(6), "sdata", "%06d", &sdata);
|
|
|
|
print_prefix(240, row_y(7), "sbss", "%06d", &sbss);
|
2019-07-17 18:59:17 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-02-01 12:00:22 +01:00
|
|
|
#if 0
|
2019-07-17 18:59:17 +02:00
|
|
|
static void hw_keyboard(int *row)
|
|
|
|
{
|
|
|
|
int kbd = gint[HWKBD];
|
|
|
|
|
|
|
|
if(kbd & HWKBD_IO)
|
|
|
|
{
|
|
|
|
put(_(" I/O driven","Driven by I/O port scanning"));
|
|
|
|
put(kbd & HWKBD_WDD
|
|
|
|
? _(" Watchdog delay"," Watchdog timer I/O delays")
|
|
|
|
: _(" Active delay"," Active-waiting I/O delays"));
|
|
|
|
}
|
|
|
|
if(kbd & HWKBD_KSI)
|
|
|
|
{
|
|
|
|
put(_(" Key scan interface",
|
|
|
|
" Driven by SH7305-style key scan interface"));
|
|
|
|
}
|
|
|
|
|
2021-02-01 12:00:22 +01:00
|
|
|
// + scan frequency
|
2019-07-17 18:59:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void hw_display(int *row)
|
|
|
|
{
|
|
|
|
int dd = gint[HWDD];
|
|
|
|
|
|
|
|
#ifdef FXCG50
|
|
|
|
if(dd & HWDD_KNOWN) put(" Known R61524-type model");
|
|
|
|
if(dd & HWDD_FULL) put(" Fullscreen mode enabled (no borders)");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FX9860G
|
|
|
|
if(dd & HWDD_CONTRAST) put(" Contrast known");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(dd & HWDD_LIGHT) put(_(" Backlight supported",
|
|
|
|
" Backlight configuration is enabled"));
|
|
|
|
}
|
2021-02-01 12:00:22 +01:00
|
|
|
#endif
|
2019-07-17 18:59:17 +02:00
|
|
|
|
2021-02-01 12:00:22 +01:00
|
|
|
/* gintctl_gint_cpumem(): Detected CPU and memory configuration */
|
|
|
|
void gintctl_gint_cpumem(void)
|
2019-07-17 18:59:17 +02:00
|
|
|
{
|
2021-02-01 12:00:22 +01:00
|
|
|
int tab=0, key=0;
|
2019-07-17 18:59:17 +02:00
|
|
|
|
|
|
|
while(key != KEY_EXIT)
|
|
|
|
{
|
|
|
|
dclear(C_WHITE);
|
2019-07-18 23:53:54 +02:00
|
|
|
|
2020-07-02 16:01:49 +02:00
|
|
|
if(tab == 0) show_mpucpu();
|
|
|
|
if(tab == 1) show_memory();
|
2021-02-01 12:00:22 +01:00
|
|
|
|
|
|
|
#ifdef FX9860G
|
2021-02-06 16:42:43 +01:00
|
|
|
row_title("CPU and memory");
|
2021-02-01 12:00:22 +01:00
|
|
|
extern bopti_image_t img_opt_gint_cpumem;
|
|
|
|
dimage(0, 56, &img_opt_gint_cpumem);
|
|
|
|
#endif
|
2020-07-02 16:01:49 +02:00
|
|
|
|
2019-07-18 23:53:54 +02:00
|
|
|
#ifdef FXCG50
|
2021-02-01 12:00:22 +01:00
|
|
|
row_title("Processor and memory");
|
2020-07-02 16:01:49 +02:00
|
|
|
fkey_menu(1, "MPU/CPU");
|
|
|
|
fkey_menu(2, "MEMORY");
|
2019-07-18 23:53:54 +02:00
|
|
|
#endif
|
2019-07-17 18:59:17 +02:00
|
|
|
|
|
|
|
dupdate();
|
|
|
|
key = getkey().key;
|
2020-07-02 16:01:49 +02:00
|
|
|
if(key == KEY_F1) tab = 0;
|
|
|
|
if(key == KEY_F2) tab = 1;
|
2019-07-17 18:59:17 +02:00
|
|
|
}
|
|
|
|
}
|