From 1c4fb6b2b2d4f160ebefd50702f1514968beb3a6 Mon Sep 17 00:00:00 2001 From: Peter Weingartner Date: Sat, 13 Jul 2024 21:20:27 -0400 Subject: [PATCH] System Information and Start Screen Cleanup --- src/Makefile | 13 ++++++++++- src/dev/Makefile | 2 +- src/dev/interrupts_f256.c | 2 -- src/fatfs/toolbox_bdev.c | 1 + src/sys_general.c | 38 ++++++++++++++++++++++++++++++++ src/sys_general.h | 17 ++++++++------- src/toolbox.c | 46 ++++++++++++++++++++++++--------------- 7 files changed, 90 insertions(+), 29 deletions(-) diff --git a/src/Makefile b/src/Makefile index ece8038..464c0b7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ # VPATH=.:../../module/Calypsi-remote-debug/src DEBUGGER=../module/Calypsi-remote-debug/src -UNIT := F256 +UNIT := F256K MEMORY := RAM # Define OS-dependent variables @@ -43,6 +43,17 @@ else ifeq ($(UNIT),F256) SRCS_FOR_UNIT=C256/jumptable.s C256/io_stubs.c C256/extras.s CFLAGS_FOR_UNIT=-DMODEL=2 -DCPU=255 --code-model large --data-model large + ifeq ($(MEMORY),ROM) + LDFLAGS_FOR_UNIT=C256/flash-f256.scm clib-lc-ld.a --rtattr printf=medium + else + LDFLAGS_FOR_UNIT=C256/ld_lc_f256.scm clib-lc-ld.a --rtattr printf=medium + endif +else ifeq ($(UNIT),F256K) + CPU=w65816 + C_SRCS_DEBUGGER=$(DEBUGGER)/agent.c $(DEBUGGER)/c256-uart.c $(DEBUGGER)/low_level_WDC65816.s + SRCS_FOR_UNIT=C256/jumptable.s C256/io_stubs.c C256/extras.s + CFLAGS_FOR_UNIT=-DMODEL=2 -DCPU=255 --code-model large --data-model large + ifeq ($(MEMORY),ROM) LDFLAGS_FOR_UNIT=C256/flash-f256.scm clib-lc-ld.a --rtattr printf=medium else diff --git a/src/dev/Makefile b/src/dev/Makefile index d6d15d3..2811a51 100644 --- a/src/dev/Makefile +++ b/src/dev/Makefile @@ -1,5 +1,5 @@ -UNIT := F256 +UNIT := F256K # Define OS-dependent variables diff --git a/src/dev/interrupts_f256.c b/src/dev/interrupts_f256.c index 13ecb4b..4c1ff87 100644 --- a/src/dev/interrupts_f256.c +++ b/src/dev/interrupts_f256.c @@ -230,8 +230,6 @@ SYSTEMCALL void int_enable(unsigned short n) { /* Find the mask for the interrupt */ unsigned short mask = int_mask(n); - printf("Enable interrupt %d => group: %d, mask: %d\n", n, group, mask); - if ((group != 0xff) && (mask != 0xff)) { // Only set the mask if the mask and group numbers are valid uint8_t new_mask = MASK_GRP0[group] & ~mask; diff --git a/src/fatfs/toolbox_bdev.c b/src/fatfs/toolbox_bdev.c index 2d0968f..58234a8 100644 --- a/src/fatfs/toolbox_bdev.c +++ b/src/fatfs/toolbox_bdev.c @@ -20,6 +20,7 @@ #include "constants.h" #include "errors.h" #include "dev/block.h" +#include "dev/rtc.h" /** * @brief Convert Toolkit Block Device result codes to FatFS result codes diff --git a/src/sys_general.c b/src/sys_general.c index 859a5cb..22521ba 100644 --- a/src/sys_general.c +++ b/src/sys_general.c @@ -130,6 +130,27 @@ void sys_get_information(p_sys_info info) { break; } +#elif MODEL == MODEL_FOENIX_F256 || MODEL == MODEL_FOENIX_F256K || MODEL == MODEL_FOENIX_F256K2 + machine_id = GABE_SYS_STAT->machine_id; + // TODO: be able to remove this line + if (machine_id == 0x13) { + machine_id = MODEL_FOENIX_F256K; + } + + cpu = CPU_WDC65816; + clock_speed = SYSCLK_6MHZ; + + info->has_expansion_card = 0; + info->has_hard_drive = 0; + info->has_ethernet = 0; + info->screens = 1; + + info->fpga_model = GABE_VERSION->model; + info->fpga_version = GABE_VERSION->version; + info->fpga_subver = GABE_VERSION->subversion; + + info->system_ram_size = (uint32_t)512 * (uint32_t)1024 * (uint32_t)1024; + #else machine_id = 0xFF; cpu = CPU_M68000; @@ -150,6 +171,11 @@ void sys_get_information(p_sys_info info) { info->cpu = cpu; switch (clock_speed) { + case SYSCLK_6MHZ: + /* 6 MHz */ + info->cpu_clock_khz = 6000; + break; + case SYSCLK_14MHZ: /* 14.318 MHz */ info->cpu_clock_khz = 14318; @@ -243,6 +269,18 @@ void sys_get_information(p_sys_info info) { } switch (info->model) { + case MODEL_FOENIX_F256: + info->model_name = "F256jr"; + break; + + case MODEL_FOENIX_F256K: + info->model_name = "F256K"; + break; + + case MODEL_FOENIX_F256K2: + info->model_name = "F256K2"; + break; + case MODEL_FOENIX_FMX: info->model_name = "C256 FMX"; break; diff --git a/src/sys_general.h b/src/sys_general.h index ecf8ddc..b304c1e 100644 --- a/src/sys_general.h +++ b/src/sys_general.h @@ -43,14 +43,15 @@ /* Clock speeds */ -#define SYSCLK_14MHZ 0x00 /* 14.318 MHz */ -#define SYSCLK_20MHZ 0x01 /* 20 MHz */ -#define SYSCLK_25MHZ 0x02 /* 25 MHz */ -#define SYSCLK_33MHZ 0x03 /* 33 MHz */ -#define SYSCLK_40MHZ 0x04 /* 40 MHz */ -#define SYSCLK_50MHZ 0x05 /* 50 MHz */ -#define SYSCLK_66MHZ 0x06 /* 66 MHz */ -#define SYSCLK_80MHZ 0x07 /* 88 MHz */ +#define SYSCLK_6MHZ 0x00 /* 6 MHz */ +#define SYSCLK_14MHZ 0x01 /* 14.318 MHz */ +#define SYSCLK_20MHZ 0x02 /* 20 MHz */ +#define SYSCLK_25MHZ 0x03 /* 25 MHz */ +#define SYSCLK_33MHZ 0x04 /* 33 MHz */ +#define SYSCLK_40MHZ 0x05 /* 40 MHz */ +#define SYSCLK_50MHZ 0x06 /* 50 MHz */ +#define SYSCLK_66MHZ 0x07 /* 66 MHz */ +#define SYSCLK_80MHZ 0x08 /* 88 MHz */ /* * Fill out a s_sys_info structure with the information about the current system diff --git a/src/toolbox.c b/src/toolbox.c index 65f8bce..485931e 100644 --- a/src/toolbox.c +++ b/src/toolbox.c @@ -136,7 +136,6 @@ void initialize() { #error Cannot identify screen setup #endif - printf("Foenix Toolbox v%d.%02d.%04d starting up...\nHello, F256k!\n", VER_MAJOR, VER_MINOR, VER_BUILD); INFO("Text system initialized."); // // Initialize the bitmap system @@ -185,19 +184,6 @@ void initialize() { rtc_init(); INFO("Real time clock initialized"); - t_time time; - // time.year = 2024; - // time.month = 7; - // time.day = 3; - // time.hour = 16; - // time.minute = 05; - // time.second = 0; - // rtc_set_time(&time); - - rtc_get_time(&time); - printf("%04d-%02d-%02d %02d:%02d\n", time.year, time.month, time.day, time.hour, time.minute); - INFO3("%04d-%02d-%02d", time.year, time.month, time.day); - // target_jiffies = sys_time_jiffies() + 300; /* 5 seconds minimum */ // DEBUG1("target_jiffies assigned: %d", target_jiffies); @@ -442,6 +428,34 @@ void test_kbd() { printf("\n\n"); } +void test_sysinfo() { + // 8 x 22 region + t_rect region; + region.size.height = 9; + region.size.width = 23; + region.origin.x = 80 - region.size.width; + region.origin.y = 60 - region.size.height; + + txt_set_region(0, ®ion); + + printf("Foenix Retro Systems\n"); + printf("Model %s\n", info.model_name); + printf("MID %x\n", info.model); + printf("CPU %s\n", info.cpu_name); + printf("Clock %lu MHz\n", info.cpu_clock_khz / (long)1024); + printf("Memory %d MB\n", (int)(info.system_ram_size / ((long)1024 * (long)1024))); + printf("FPGA %04X %04X.%04X\n", info.fpga_model, info.fpga_version, info.fpga_subver); + printf("Toolbox v%d.%02d.%04d\n", info.mcp_version, info.sub_model, info.mcp_build); + + region.size.width = 0; + region.size.height = 0; + region.origin.x = 0; + region.origin.y = 0; + + txt_set_region(0, ®ion); + txt_set_xy(0, 0, 0); +} + int main(int argc, char * argv[]) { short result; short i; @@ -450,14 +464,12 @@ int main(int argc, char * argv[]) { initialize(); kbd_init(); - test_kbd(); + test_sysinfo(); // Attempt to start up the user code // log(LOG_INFO, "Looking for user startup code:"); // boot_launch(); - printf("Done.\n"); - #ifdef _CALYPSI_MCP_DEBUGGER extern int CalypsiDebugger(void); CalypsiDebugger(); // This will not return