Compare commits

...

14 Commits
master ... dev

Author SHA1 Message Date
  Lephenixnoir b63d58515c
gint/usb: add a USB communication test (WIP) 1 day ago
  Lephenixnoir 4b4b69b2b6
gint/kmalloc: Add memory allocator integrity and stress tests 1 month ago
  Lephenixnoir 1dfe4e0375
mem: use a JustUI scene for the memory browser 1 month ago
  Lephenixnoir 9a9c366821
libs/justui: add a demo of the JustUI widget library 1 month ago
  Lephenixnoir ca2d731f39
gint/keyboard: port the keydev test to fx-CG 50 1 month ago
  Lephenixnoir ca1df5cb20
gint/keyboard: detailed test of the new keydev mechanic 1 month ago
  Lephenixnoir 02571b8957
various improvements in GUI, mainly on fx-9860G 2 months ago
  Lephenixnoir 7ee6abf4ac
gint/cpumem: show rigourously-detected static RAM size 2 months ago
  Lephe 6aa477a83a
libs/printf: add floating-point unit tests 3 months ago
  Lephe 4350b81fc8
misc organisation improvements on fx-9860G 3 months ago
  Lephe 63c4579a47
gint/spuram: Port the test to fx-9860G 3 months ago
  Lephe d6345db414
remove irrelevant tests on SH3 3 months ago
  Lephe 601dc9ea79
gint/ram: expand RAM discovery method for SPU areas 3 months ago
  Lephe 5f0cb6cd30
switch build system to CMake 3 months ago
67 changed files with 3207 additions and 954 deletions
Split View
  1. +3
    -0
      .gitignore
  2. +140
    -0
      CMakeLists.txt
  3. +0
    -198
      Makefile
  4. +8
    -0
      assets-cg/fonts/fxconv-metadata.txt
  5. +15
    -0
      assets-cg/img/fxconv-metadata.txt
  6. BIN
      assets-cg/img/kbd_events.png
  7. BIN
      assets-cg/swift-half.png
  8. BIN
      assets-cg/swords2.png
  9. +29
    -0
      assets-fx/fonts/fxconv-metadata.txt
  10. BIN
      assets-fx/fonts/mini.png
  11. BIN
      assets-fx/fonts/title.png
  12. +6
    -0
      assets-fx/img/fxconv-metadata.txt
  13. BIN
      assets-fx/img/kbd_events.png
  14. BIN
      assets-fx/img/kbd_pressed.png
  15. BIN
      assets-fx/img/kbd_released.png
  16. BIN
      assets-fx/img/keypress.png
  17. BIN
      assets-fx/img/keyrelease.png
  18. BIN
      assets-fx/img/opt_dump.png
  19. BIN
      assets-fx/img/opt_gint_bopti.png
  20. BIN
      assets-fx/img/opt_gint_cpumem.png
  21. BIN
      assets-fx/img/opt_gint_gray.png
  22. BIN
      assets-fx/img/opt_gint_keyboard.png
  23. BIN
      assets-fx/img/opt_gint_kmalloc.png
  24. BIN
      assets-fx/img/opt_gint_ram.png
  25. BIN
      assets-fx/img/opt_gint_rtc.png
  26. BIN
      assets-fx/img/opt_gint_spuram.png
  27. BIN
      assets-fx/img/opt_gint_timer_callbacks.png
  28. BIN
      assets-fx/img/opt_gint_timers.png
  29. BIN
      assets-fx/img/opt_gint_tlb.png
  30. BIN
      assets-fx/img/opt_gint_usb.png
  31. BIN
      assets-fx/img/opt_libs_jui.png
  32. BIN
      assets-fx/img/opt_main.png
  33. BIN
      assets-fx/img/opt_mem.png
  34. BIN
      assets-fx/img/opt_switch.png
  35. BIN
      assets-fx/img/tlb_cells.png
  36. BIN
      assets-fx/pattern.png
  37. BIN
      assets-fx/pattern2.png
  38. +84
    -0
      include/gintctl/assets.h
  39. +8
    -2
      include/gintctl/gint.h
  40. +3
    -0
      include/gintctl/libs.h
  41. +21
    -9
      include/gintctl/menu.h
  42. +15
    -3
      include/gintctl/util.h
  43. +111
    -0
      include/gintctl/widgets/gscreen.h
  44. +125
    -0
      include/gintctl/widgets/gtable.h
  45. +0
    -103
      project.cfg
  46. +0
    -1
      src/gint/bopti.c
  47. +220
    -0
      src/gint/cpumem.c
  48. +0
    -215
      src/gint/hardware.c
  49. +144
    -48
      src/gint/keyboard.c
  50. +561
    -0
      src/gint/kmalloc.c
  51. +134
    -117
      src/gint/ram.c
  52. +95
    -2
      src/gint/spuram.c
  53. +6
    -12
      src/gint/switch.c
  54. +9
    -5
      src/gint/timer.c
  55. +87
    -92
      src/gint/tlb.c
  56. +329
    -0
      src/gint/usb.c
  57. +52
    -45
      src/gintctl.c
  58. +172
    -0
      src/libs/justui.c
  59. +1
    -0
      src/libs/openlibm.c
  60. +125
    -23
      src/libs/printf.c
  61. +103
    -71
      src/mem/mem.c
  62. +26
    -5
      src/menu.c
  63. +1
    -0
      src/perf/cpucache.c
  64. +10
    -3
      src/regs/regs.c
  65. +23
    -0
      src/util.c
  66. +188
    -0
      src/widgets/gscreen.c
  67. +353
    -0
      src/widgets/gtable.c

+ 3
- 0
.gitignore View File

@ -5,3 +5,6 @@ build-cg/
# Targets
gintctl.g1a
gintctl.g3a
# Development files
*.sublime-*

+ 140
- 0
CMakeLists.txt View File

@ -0,0 +1,140 @@
# gintctl: gint's control application
cmake_minimum_required(VERSION 3.18)
project(gintctl VERSION 2.2.1 LANGUAGES C ASM)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.1 REQUIRED)
find_package(LibProf 2.1 REQUIRED)
find_package(LibImg 2.1 REQUIRED)
find_package(JustUI 1.0 REQUIRED)
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
set(SOURCES
src/gintctl.c
src/menu.c
src/plot.c
src/util.c
src/gint/bopti.c
src/gint/cpumem.c
src/gint/dma.c
src/gint/dsp.c
src/gint/dsp.s
src/gint/dump.c
src/gint/gray.c
src/gint/keyboard.c
src/gint/kmalloc.c
src/gint/ram.c
src/gint/rtc.c
src/gint/spuram.c
src/gint/switch.c
src/gint/timer.c
src/gint/timer_callbacks.c
src/gint/tlb.c
src/gint/topti.c
src/gint/usb.c
src/libs/justui.c
src/libs/libimg.c
src/libs/memory.c
src/libs/openlibm.c
src/libs/printf.c
src/libs/tinymt.c
src/mem/mem.c
src/perf/cpucache.c
src/perf/cpucache.S
src/perf/interrupt.c
src/perf/libprof.c
src/perf/memory.c
src/perf/memory.s
src/perf/render.c
src/regs/regs.c
src/widgets/gscreen.c
src/widgets/gtable.c
)
set(ASSETS_fx
assets-fx/fonts/hexa.png
assets-fx/fonts/mini.png
assets-fx/fonts/title.png
assets-fx/fonts/uf5x7
assets-fx/img/bopti_1col.png
assets-fx/img/bopti_2col.png
assets-fx/img/bopti_3col.png
assets-fx/img/kbd_events.png
assets-fx/img/kbd_pressed.png
assets-fx/img/kbd_released.png
assets-fx/img/libimg_swords.png
assets-fx/img/opt_dump.png
assets-fx/img/opt_gint_bopti.png
assets-fx/img/opt_gint_cpumem.png
assets-fx/img/opt_gint_gray.png
assets-fx/img/opt_gint_keyboard.png
assets-fx/img/opt_gint_kmalloc.png
assets-fx/img/opt_gint_ram.png
assets-fx/img/opt_gint_rtc.png
assets-fx/img/opt_gint_spuram.png
assets-fx/img/opt_gint_timer_callbacks.png
assets-fx/img/opt_gint_timers.png
assets-fx/img/opt_gint_tlb.png
assets-fx/img/opt_gint_usb.png
assets-fx/img/opt_libs_jui.png
assets-fx/img/opt_main.png
assets-fx/img/opt_mem.png
assets-fx/img/opt_perf_libprof.png
assets-fx/img/opt_perf_render.png
assets-fx/img/opt_switch_ctx.png
assets-fx/img/opt_switch_ctx_sh3.png
assets-fx/img/opt_switch.png
assets-fx/img/profile_gray_alpha.png
assets-fx/img/profile_gray.png
assets-fx/img/profile_mono_alpha.png
assets-fx/img/profile_mono.png
assets-fx/img/rtc_arrows.png
assets-fx/img/rtc_segments.png
assets-fx/img/tlb_cells.png
)
set(ASSETS_cg
assets-cg/fonts/font8x9_bold.png
assets-cg/img/applejack_31x27.png
assets-cg/img/applejack_36x25.png
assets-cg/img/kbd_events.png
assets-cg/img/kbd_pressed.png
assets-cg/img/kbd_released.png
assets-cg/img/libimg_even_odd.png
assets-cg/img/libimg_odd_even.png
assets-cg/img/libimg_sq_even.png
assets-cg/img/libimg_sq_odd.png
assets-cg/img/libimg_train.png
assets-cg/img/potion_17x22.png
assets-cg/img/potion_18x22.png
assets-cg/img/potion_21x22.png
assets-cg/img/rtc_arrows.png
assets-cg/img/rtc_segments.png
assets-cg/img/swift.png
assets-cg/img/swords.png
)
fxconv_declare_assets(${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(gintctl ${SOURCES} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(gintctl PRIVATE
-Wall -Wextra -Os)
target_link_options(gintctl PRIVATE
-Wl,-Map=map -Wl,--print-memory-usage)
target_include_directories(gintctl PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${FXSDK_COMPILER_INSTALL}/include/openlibm")
target_link_libraries(gintctl
Gint::Gint LibProf::LibProf LibImg::LibImg JustUI::JustUI -lopenlibm)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
generate_g1a(TARGET gintctl OUTPUT "gintctl.g1a"
NAME "gintctl" INTERNAL "@GINTCTL" ICON assets-fx/icon.png)
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET gintctl OUTPUT "gintctl.g3a"
NAME "" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

+ 0
- 198
Makefile View File

@ -1,198 +0,0 @@
#! /usr/bin/make -f
# Default Makefile for fxSDK add-ins. This file was probably copied there by
# the [fxsdk] program.
#---
#
# Configuration
#
include project.cfg
# Compiler flags
CFLAGSFX = $(CFLAGS) $(CFLAGS_FX) $(INCLUDE_FX)
CFLAGSCG = $(CFLAGS) $(CFLAGS_CG) $(INCLUDE_CG)
# Linker flags
LDFLAGSFX := $(LDFLAGS) $(LDFLAGS_FX)
LDFLAGSCG := $(LDFLAGS) $(LDFLAGS_CG)
# Dependency list generation flags
depflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
# ELF to binary flags
BINFLAGS := -R .bss -R .gint_bss
# G1A and G3A generation flags
NAME_G1A ?= $(NAME)
NAME_G3A ?= $(NAME)
G1AF := -i "$(ICON_FX)" -n "$(NAME_G1A)" --internal="$(INTERNAL)"
G3AF := -n basic:"$(NAME_G3A)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
ifeq "$(TOOLCHAIN_FX)" ""
TOOLCHAIN_FX := sh3eb-elf
endif
ifeq "$(TOOLCHAIN_CG)" ""
TOOLCHAIN_CG := sh4eb-elf
endif
# fxconv flags
FXCONVFX := --fx --toolchain=$(TOOLCHAIN_FX)
FXCONVCG := --cg --toolchain=$(TOOLCHAIN_CG)
# Determine the compiler install and include path
GCC_BASE_FX := $(shell $(TOOLCHAIN_FX)-gcc --print-search-dirs | grep install | sed 's/install: //')
GCC_BASE_CG := $(shell $(TOOLCHAIN_CG)-gcc --print-search-dirs | grep install | sed 's/install: //')
GCC_INCLUDE_FX := $(GCC_BASE_FX)/include
GCC_INCLUDE_CG := $(GCC_BASE_CG)/include
#
# File listings
#
NULL :=
TARGET := $(subst $(NULL) $(NULL),-,$(NAME))
ifeq "$(TARGET_FX)" ""
TARGET_FX := $(TARGET).g1a
endif
ifeq "$(TARGET_CG)" ""
TARGET_CG := $(TARGET).g3a
endif
ELF_FX := build-fx/$(shell basename -s .g1a $(TARGET_FX)).elf
BIN_FX := $(ELF_FX:.elf=.bin)
ELF_CG := build-cg/$(shell basename -s .g3a $(TARGET_CG)).elf
BIN_CG := $(ELF_CG:.elf=.bin)
# Source files
src := $(wildcard src/*.[csS] \
src/*/*.[csS] \
src/*/*/*.[csS] \
src/*/*/*/*.[csS])
assets-fx := $(wildcard assets-fx/*/*)
assets-cg := $(wildcard assets-cg/*/*)
# Object files
obj-fx := $(src:%=build-fx/%.o) \
$(assets-fx:assets-fx/%=build-fx/assets/%.o)
obj-cg := $(src:%=build-cg/%.o) \
$(assets-cg:assets-cg/%=build-cg/assets/%.o)
# Additional dependencies
deps-fx := $(ICON_FX)
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
# All targets
all :=
ifneq "$(wildcard build-fx)" ""
all += all-fx
endif
ifneq "$(wildcard build-cg)" ""
all += all-cg
endif
#
# Build rules
#
all: $(all)
all-fx: $(TARGET_FX)
all-cg: $(TARGET_CG)
$(TARGET_FX): $(obj-fx) $(deps-fx)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -o $(ELF_FX) $(obj-fx) $(CFLAGSFX) $(LDFLAGSFX)
$(TOOLCHAIN_FX)-objcopy -O binary $(BINFLAGS) $(ELF_FX) $(BIN_FX)
fxg1a $(BIN_FX) -o $@ $(G1AF)
$(TARGET_CG): $(obj-cg) $(deps-cg)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -o $(ELF_CG) $(obj-cg) $(CFLAGSCG) $(LDFLAGSCG)
$(TOOLCHAIN_CG)-objcopy -O binary $(BINFLAGS) $(ELF_CG) $(BIN_CG)
mkg3a $(G3AF) $(BIN_CG) $@
# C sources
build-fx/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(CFLAGSFX) $(depflags)
build-cg/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(CFLAGSCG) $(depflags)
# Assembler sources
build-fx/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ -Wa,--dsp
build-cg/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ -Wa,--dsp
# Preprocessed assembler sources
build-fx/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE_FX) -Wa,--dsp
build-cg/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE_CG) -Wa,--dsp
# Images
build-fx/assets/img/%.o: assets-fx/img/%
@ mkdir -p $(dir $@)
fxconv --bopti-image $< -o $@ $(FXCONVFX) name:img_$(basename $*) $(IMG.$*)
build-cg/assets/img/%.o: assets-cg/img/%
@ mkdir -p $(dir $@)
fxconv --bopti-image $< -o $@ $(FXCONVCG) name:img_$(basename $*) $(IMG.$*)
# Fonts
build-fx/assets/fonts/%.o: assets-fx/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ $(FXCONVFX) name:font_$(basename $*) $(FONT.$*)
build-cg/assets/fonts/%.o: assets-cg/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ $(FXCONVCG) name:font_$(basename $*) $(FONT.$*)
# Binaries
build-fx/assets/bin/%.o: assets-fx/bin/%
@ mkdir -p $(dir $@)
fxconv -b $< -o $@ $(FXCONVFX) name:bin_$(basename $*) $(BIN.$*)
build-cg/assets/bin/%.o: assets-cg/bin/%
@ mkdir -p $(dir $@)
fxconv -b $< -o $@ $(FXCONVCG) name:bin_$(basename $*) $(BIN.$*)
#
# Cleaning and utilities
#
# Dependency information
-include $(shell find build* -name *.d 2> /dev/null)
build-fx/%.d: ;
build-cg/%.d: ;
.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
clean-fx:
@ rm -rf build-fx/
clean-cg:
@ rm -rf build-cg/
distclean-fx: clean-fx
@ rm -f $(TARGET_FX)
distclean-cg: clean-cg
@ rm -f $(TARGET_CG)
clean: clean-fx clean-cg
distclean: distclean-fx distclean-cg
install-fx: $(TARGET_FX)
p7 send -f $<
install-cg: $(TARGET_CG)
@ prizm-mount
@ rm -f /mnt/prizm/$<
@ cp $< /mnt/prizm
@ prizm-eject
.PHONY: all all-fx all-cg clean distclean install-fx install-cg

+ 8
- 0
assets-cg/fonts/fxconv-metadata.txt View File

@ -0,0 +1,8 @@
font8x9_bold.png:
type: font
name: font_font8x9_bold
charset: print
grid.size: 8x11
grid.padding: 1
grid.border: 0
proportional: true

+ 15
- 0
assets-cg/img/fxconv-metadata.txt View File

@ -0,0 +1,15 @@
*:
type: bopti-image
name_regex: (.*).png img_\1
libimg_*.png:
type: libimg-image
swift.png:
profile: p4
swords.png:
profile: p8
kbd_pressed.png:
profile: p4
kbd_released.png:
profile: p4

BIN
assets-cg/img/kbd_events.png View File

Before After
Width: 72  |  Height: 9  |  Size: 4.6 KiB

BIN
assets-cg/swift-half.png View File

Before After
Width: 396  |  Height: 112  |  Size: 102 KiB

BIN
assets-cg/swords2.png View File

Before After
Width: 154  |  Height: 24  |  Size: 6.1 KiB

+ 29
- 0
assets-fx/fonts/fxconv-metadata.txt View File

@ -0,0 +1,29 @@
hexa.png:
type: font
name: font_hexa
charset: print
grid.size: 3x5
grid.padding: 1
mini.png:
type: font
name: font_mini
charset: ascii
proportional: true
height: 5
grid.size: 5x6
grid.padding: 1
title.png:
type: font
name: font_title
charset: print
grid.size: 5x6
grid.padding: 1
uf5x7:
type: font
name: font_uf5x7
charset: unicode
grid.size: 5x7
grid.padding: 1

BIN
assets-fx/fonts/mini.png View File

Before After
Width: 112  |  Height: 64  |  Size: 16 KiB

BIN
assets-fx/fonts/title.png View File

Before After
Width: 112  |  Height: 48  |  Size: 17 KiB

+ 6
- 0
assets-fx/img/fxconv-metadata.txt View File

@ -0,0 +1,6 @@
*:
type: bopti-image
name_regex: (.*)\.png img_\1
libimg_swords.png:
type: libimg-image

BIN
assets-fx/img/kbd_events.png View File

Before After
Width: 49  |  Height: 7  |  Size: 244 B

BIN
assets-fx/img/kbd_pressed.png View File

Before After
Width: 31  |  Height: 44  |  Size: 350 B

BIN
assets-fx/img/kbd_released.png View File

Before After
Width: 31  |  Height: 44  |  Size: 362 B

BIN
assets-fx/img/keypress.png View File

Before After
Width: 5  |  Height: 5  |  Size: 146 B

BIN
assets-fx/img/keyrelease.png View File

Before After
Width: 5  |  Height: 5  |  Size: 166 B

BIN
assets-fx/img/opt_dump.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.5 KiB Width: 128  |  Height: 8  |  Size: 2.5 KiB

BIN
assets-fx/img/opt_gint_bopti.png View File

Before After
Width: 128  |  Height: 35  |  Size: 4.9 KiB Width: 128  |  Height: 35  |  Size: 4.9 KiB

BIN
assets-fx/img/opt_gint_cpumem.png View File

Before After
Width: 128  |  Height: 8  |  Size: 1.7 KiB

BIN
assets-fx/img/opt_gint_gray.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.5 KiB Width: 128  |  Height: 8  |  Size: 2.7 KiB

BIN
assets-fx/img/opt_gint_keyboard.png View File

Before After
Width: 128  |  Height: 8  |  Size: 3.4 KiB

BIN
assets-fx/img/opt_gint_kmalloc.png View File

Before After
Width: 128  |  Height: 17  |  Size: 3.6 KiB

BIN
assets-fx/img/opt_gint_ram.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.3 KiB Width: 128  |  Height: 8  |  Size: 2.4 KiB

BIN
assets-fx/img/opt_gint_rtc.png View File

Before After
Width: 128  |  Height: 62  |  Size: 13 KiB Width: 128  |  Height: 62  |  Size: 13 KiB

BIN
assets-fx/img/opt_gint_spuram.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.2 KiB

BIN
assets-fx/img/opt_gint_timer_callbacks.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.2 KiB Width: 128  |  Height: 8  |  Size: 2.2 KiB

BIN
assets-fx/img/opt_gint_timers.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.5 KiB Width: 128  |  Height: 8  |  Size: 2.6 KiB

BIN
assets-fx/img/opt_gint_tlb.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.9 KiB Width: 128  |  Height: 8  |  Size: 3.0 KiB

BIN
assets-fx/img/opt_gint_usb.png View File

Before After
Width: 128  |  Height: 17  |  Size: 4.4 KiB

BIN
assets-fx/img/opt_libs_jui.png View File

Before After
Width: 128  |  Height: 8  |  Size: 1.7 KiB

BIN
assets-fx/img/opt_main.png View File

Before After
Width: 128  |  Height: 8  |  Size: 3.4 KiB Width: 128  |  Height: 8  |  Size: 3.4 KiB

BIN
assets-fx/img/opt_mem.png View File

Before After
Width: 128  |  Height: 17  |  Size: 3.8 KiB Width: 128  |  Height: 17  |  Size: 5.9 KiB

BIN
assets-fx/img/opt_switch.png View File

Before After
Width: 128  |  Height: 8  |  Size: 2.6 KiB Width: 128  |  Height: 8  |  Size: 2.2 KiB

BIN
assets-fx/img/tlb_cells.png View File

Before After
Width: 35  |  Height: 5  |  Size: 3.4 KiB Width: 41  |  Height: 6  |  Size: 3.4 KiB

BIN
assets-fx/pattern.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.4 KiB

BIN
assets-fx/pattern2.png View File

Before After
Width: 48  |  Height: 16  |  Size: 7.8 KiB

+ 84
- 0
include/gintctl/assets.h View File

@ -0,0 +1,84 @@
//---
// gintctl:assets - List of imported assets
//---
#ifndef _GINTCTL_ASSETS
#define _GINTCTL_ASSETS
#include <libimg.h>
#ifdef FX9860G
extern font_t
font_hexa,
font_mini,
font_title,
font_uf5x7;
extern bopti_image_t
img_bopti_1col,
img_bopti_2col,
img_bopti_3col,
img_kbd_events,
img_kbd_pressed,
img_kbd_released,
img_opt_dump,
img_opt_gint_bopti,
img_opt_gint_cpumem,
img_opt_gint_gray,
img_opt_gint_keyboard,
img_opt_gint_kmalloc,
img_opt_gint_ram,
img_opt_gint_rtc,
img_opt_gint_spuram,
img_opt_gint_timer_callbacks,
img_opt_gint_timers,
img_opt_gint_tlb,
img_opt_gint_usb,
img_opt_libs_jui,
img_opt_main,
img_opt_mem,
img_opt_perf_libprof,
img_opt_perf_render,
img_opt_switch_ctx,
img_opt_switch_ctx_sh3,
img_opt_switch,
img_profile_gray_alpha,
img_profile_gray,
img_profile_mono_alpha,
img_profile_mono,
img_rtc_arrows,
img_rtc_segments,
img_tlb_cells;
extern img_t
img_libimg_swords;
#endif /* FX9860G */
#ifdef FXCG50
extern bopti_image_t
img_applejack_31x27,
img_applejack_36x25,
img_kbd_events,
img_kbd_pressed,
img_kbd_released,
img_potion_17x22,
img_potion_18x22,
img_potion_21x22,
img_rtc_arrows,
img_rtc_segments,
img_swift,
img_swords;
extern img_t
img_libimg_even_odd,
img_libimg_odd_even,
img_libimg_sq_even,
img_libimg_sq_odd,
img_libimg_train;
#endif /* FXCG50 */
#endif /* _GINTCTL_ASSETS */

+ 8
- 2
include/gintctl/gint.h View File

@ -5,8 +5,8 @@
#ifndef GINTCTL_GINT
#define GINTCTL_GINT
/* gintctl_gint_hardware(): Detected hardware configuration */
void gintctl_gint_hardware(void);
/* gintctl_gint_cpumem(): Detected CPU and memory configuration */
void gintctl_gint_cpumem(void);
/* gintctl_gint_ram(): Determine the size of some memory areas */
void gintctl_gint_ram(void);
@ -44,6 +44,12 @@ void gintctl_gint_bopti(void);
/* gintctl_gint_topti(): Test text rendering */
void gintctl_gint_topti(void);
/* gintctl_gint_kmalloc(): Dynamic memory allocator */
void gintctl_gint_kmalloc(void);
/* gintctl_gint_usb(): USB communication */
void gintctl_gint_usb(void);
#ifdef FXCG50
/* gintctl_gint_dma(): Test the Direct Access Memory Controller */


+ 3
- 0
include/gintctl/libs.h View File

@ -20,4 +20,7 @@ void gintctl_libs_openlibm(void);
/* gintctl_libs_libimg(): libimg-based rendering and image transform */
void gintctl_libs_libimg(void);
/* gintctl_libs_justui(): Just User Interfaces */
void gintctl_libs_justui(void);
#endif /* GINTCTL_LIBS */

+ 21
- 9
include/gintctl/menu.h View File

@ -12,31 +12,43 @@
struct menuentry {
char const *name;
void (*function)(void);
int flags;
};
enum {
/* SH3-only */
MENU_SH3_ONLY,
/* SH4-only */
MENU_SH4_ONLY,
};
struct menu {
char const *name;
int len;
int offset;
int pos;
int top;
int bottom;
int8_t len;
int8_t offset;
int8_t pos;
int8_t top;
int8_t bottom;
struct menuentry entries[];
};
/* 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 */
void menu_init(struct menu *menu, int top, int bottom);
/* menu_move(): Move the cursor in a menu
@menu Initialized list menu
@key Either KEY_UP, indicating up, or KEY_DOWN indicating down
@wrap Allow wrap-around */
void menu_move(struct menu *menu, int key, int wrap);
@menu Initialized list menu
@key Either KEY_UP, indicating up, or KEY_DOWN indicating down
@quick Whether to quick-move to start or end
@wrap Allow wrap-around */
void menu_move(struct menu *menu, int key, int quick, int wrap);
/* menu_show(): Render a list menu */
void menu_show(struct menu const *menu);


+ 15
- 3
include/gintctl/util.h View File

@ -50,11 +50,23 @@ int row_x(int x);
int row_y(int y);
//---
// General (x,y) printing
// General rendering
//---
/* print(): Formatted printing shorthand */
void print(int x, int y, char const *format, ...);
/* scrollbar_px(): Pixel-based scrollbar
@view_top First pixel covered by scrollbar area
@view_bottom Pixel below last pixel covered by scrollbar area
@range_min Minimum value in the virtual range we're scrolling through
@range_max Maximum value in the virtual range
@range_pos Position within the virtual range
@range_view How much of the range is visible on-screen */
void scrollbar_px(int view_top, int view_bottom, int range_min, int range_max,
int range_pos, int range_view);
#define print_prefix(x, y, prefix, fmt, ...) { \
dtext_opt(x-_(3,5), y, C_BLACK,C_NONE,DTEXT_RIGHT,DTEXT_TOP, prefix); \
dprint(x+_(3,5), y, C_BLACK, fmt __VA_OPT__(,) __VA_ARGS__); \
}
//---
// F-key rendering


+ 111
- 0
include/gintctl/widgets/gscreen.h View File

@ -0,0 +1,111 @@
//---
// gintctl.widgets.gscreen: gintctl's extended standard scene
//---
#ifndef _GINTCTL_WIDGETS_GSCREEN
#define _GINTCTL_WIDGETS_GSCREEN
#include <justui/jscene.h>
#include <justui/jlabel.h>
#include <justui/jfkeys.h>
#include <gintctl/util.h>
#include <gint/display.h>
struct gscreen_tab;
/* gscreen: gintctl's standard screen.
The gscreen is a scene with a stylized title bar, an optional function key
bar at the bottom, and a stacked layout of tabs in the middle. Each tab can
have specific properties set, and the gscreen handles some of the focus
management caused by hiding and showing a lot of widgets in tabs.
The scene of a gscreen can be accessed with (the_gscreen->scene). */
typedef struct {
jscene *scene;
/* Number of tabs */
int tab_count;
/* Information on tabs */
struct gscreen_tab *tabs;
/* Fixed widets */
jlabel *title;
jfkeys *fkeys;
/* Current function bar level */
int8_t fkey_level;
} gscreen;
struct gscreen_tab {
/* TODO: gscreen: Hide title bar and/or status bar */
bool title_visible, fkeys_visible;
/* Most recent focused widget one */
jwidget *focus;
};
/* gscreen_create(): Set up a standard scene.
If (title = NULL), the scene has no title bar, if (fkeys = NULL) it has no
function bar. To show a title/function bar on some tabs but not all, create
one here and use gscreen_set_tab_{title,fkeys}_visible(). */
#ifdef FX9860G
gscreen *gscreen_create(char const *title, bopti_image_t const *fkeys);
#define gscreen_create2(short, img, long, fkeys) gscreen_create(short, img)
#endif
#ifdef FXCG50
gscreen *gscreen_create(char const *title, char const *fkeys);
#define gscreen_create2(short, img, long, fkeys) gscreen_create(long, fkeys)
#endif
void gscreen_destroy(gscreen *s);
//---
// Function bar settings
//---
/* gscreen_set_fkeys_level(): Select the function key bar */
void gscreen_set_fkeys_level(gscreen *s, int level);
//---
// Tab settings
//---
/* gscreen_add_tab(): Add a tab to the stacked layout
The child's parent will be changed. The widget will also have a stretch of
(1, 1, false) set by default. If not NULL, the last parameter indicates
which widget to focus when the tab is first shown. */
void gscreen_add_tab(gscreen *scene, void *widget, void *focus);
/* gcreen_add_tabs(): Add several tabs at once, with no special parameters */
void gscreen_add_tabs(gscreen *s, ...);
#define gscreen_add_tabs(...) gscreen_add_tabs(__VA_ARGS__, NULL)
/* gscreen_set_tab_title_visible(): Set whether title bar is shown on a tab */
void gscreen_set_tab_title_visible(gscreen *s, int tab, bool visible);
/* gscreen_set_tab_fkeys_visible(): Set whether fkeys are shown on a tab */
void gscreen_set_tab_fkeys_visible(gscreen *s, int tab, bool visible);
//---
// Tab navigation
//---
/* gscreen_show_tab(): Show a tab from the stack
Returns true if the tab changed, false if it was already active or if it is
an invalid tab widget. */
bool gscreen_show_tab(gscreen *s, int tab);
/* gscreen_current_tab(): Give the currently visible tab */
int gscreen_current_tab(gscreen *s);
/* gscreen_in(): Check if we're in a specific tab */
bool gscreen_in(gscreen *s, int tab);
//---
// Focus management
//---
/* Set focus for the current tab */
void gscreen_focus(gscreen *s, void *widget);
#endif /* _GINTCTL_WIDGETS_GSCREEN */

+ 125
- 0
include/gintctl/widgets/gtable.h View File

@ -0,0 +1,125 @@
//---
// gintctl.widgets.gtable: gintctl's scrolling tables
//---
#ifndef _GINTCTL_WIDGETS_GTABLE
#define _GINTCTL_WIDGETS_GTABLE
#include <justui/jwidget.h>
#include <gint/display.h>
/* gtable: A dynamic scrolling table
This widget is a table with a header and a set of rows, that scrolls
vertically to show more rows than there is space available on-screen.
The columns all have their own width, label, and font. During rendering, the
data is provided to the table through a user-provided function that
generates strings for every column in a chosen row. */
typedef struct gtable {
jwidget widget;
/* Column details */
struct gtable_column *meta;
/* Function to generate the strings for a row */
void (*generator)(struct gtable *g, int row, j_arg_t arg);
j_arg_t arg;
/* Number of columns, number of rows visible on-screen, number of rows,
and current top row */
uint8_t columns;
uint8_t visible;
uint16_t rows;
uint16_t offset;
/* Row height */
uint8_t row_height;
/* Additional row spacing */
uint8_t row_spacing;
/* Coordinates during rendering */
int16_t x, y;
} gtable;
/* gtable_create(): Create a scrolling table
The number of columns of the table must be fixed, while the number of rows
can be set and changed later with gtable_set_rows().
The generator is a function that will be called during rendering to generate
strings for each row. It should have the following prototype, where the last
argument is an optional object of a type listed in j_arg_t (essentially an
integer or a pointer).
void generator(gtable *g, int row [, <an type of j_arg_t>])
The generator should return all the strings for the row by a call to
gtable_provide(). */
gtable *gtable_create(int columns, void *generator, j_arg_t arg, void *parent);
/* gtable_provide(): Pass strings to display on a given row
The strings should be passed as variable arguments. A NULL terminator is
added automatically. The strings will not be used after the call finishes,
so they can be allocated statically or on the stack of the caller. */
void gtable_provide(gtable *g, ...);
#define gtable_provide(...) gtable_provide(__VA_ARGS__, NULL)
//---
// Configuration of columns
//---
/* gtable_set_column_title(): Set the title of a column */
void gtable_set_column_title(gtable *t, int column, char const *title);
/* gtable_set_column_font(): Set the font of a column */
void gtable_set_column_font(gtable *t, int column, font_t const *font);
/* gtable_set_column_size(): Set the size of a column
This function sets the size of a column in relative units. During layout,
the width of the table will be split, and each column will receive space
proportional to their size setting. The default is 1 for all columns. */
void gtable_set_column_size(gtable *t, int column, uint size);
/* The previous functions have group-setting functions to set properties for
all columns at once. Simply list the headers/fonts/widths all at once;
columns 0 through the number of args will be assigned. */
void gtable_set_column_titles(gtable *t, ...);
#define gtable_set_column_titles(...) \
gtable_set_column_titles(__VA_ARGS__, NULL)
void gtable_set_column_sizes(gtable *t, ...);
#define gtable_set_column_sizes(...) \
gtable_set_column_sizes(__VA_ARGS__, 0)
void gtable_set_column_fonts(gtable *t, ...);
#define gtable_set_column_fonts(...) \
gtable_set_column_fonts(__VA_ARGS__, NULL)
/* gtable_set_font(): Set the font for all columns */
void gtable_set_font(gtable *t, font_t const *font);
//---
// Configuration of rows
//---
/* gtable_set_rows(): Set the number of rows */
void gtable_set_rows(gtable *t, int rows);
/* gtable_set_row_height(): Fix row height instead of guessing from font
Setting 0 will reset to the default behavior. */
void gtable_set_row_height(gtable *t, int row_height);
/* gtable_set_row_spacing(): Set additional row spacing */
void gtable_set_row_spacing(gtable *t, int row_spacing);
//---
// Movement
//---
/* gtable_scroll_to(): Scroll to the specified offset (if acceptable) */
void gtable_scroll_to(gtable *t, int offset);
/* gtable_end(): Offset of the end of the table */
int gtable_end(gtable *t);
#endif /* _GINTCTL_WIDGETS_GTABLE */

+ 0
- 103
project.cfg View File

@ -1,103 +0,0 @@
#---
# fxSDK project configuration file for gintctl
#---
# Project name, should be at most 8 bytes long.
# (You can also specify NAME_G1A or NAME_G3A to override individually.)
NAME := gintctl
NAME_G3A :=
# Internal name, should be '@' followed by at most 7 uppercase letters.
# WARNING: If this convention is not followed, the add-in might not appear in
# the main menu of the calculator!
INTERNAL := @GINTCTL
# Output file name. The default is to take <NAME>, replace spaces with dashes,
# and add .g1a (or .g3a). You can specify a different folder if you want.
TARGET_FX :=
TARGET_CG :=
# fx-9860G icon location
ICON_FX = assets-fx/icon.png
# fx-CG 50 icon locations
ICON_CG_UNS = assets-cg/icon-uns.png
ICON_CG_SEL = assets-cg/icon-sel.png
#---
# Toolchain selection
#---
# Toolchain for fx9860g. Please see also CFLAGS_FX below.
TOOLCHAIN_FX := sh-elf
# Toolchain for fxcg50. Please see also CFLAGS_CG below.
TOOLCHAIN_CG := sh-elf
#---
# Compiler flags
#---
# Base compiler flags for the fxSDK, you usually want to keep these.
CFLAGS := -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields
# Platform-specific compiler flags.
# <> If you are using sh3eb-elf, use -m3. (You can do this on both FX and CG.)
# <> If you are using sh4eb-elf, use -m4-nofpu. (Not ideal on FX but works.)
# <> If you are using sh4eb-nofpu-elf, then your compiler will likely use the
# FPU and cause problems on the calculator. Consider another configuration.
# <> If you are using an sh-elf with several targets, specify whichever you
# support. I recommend -m3 on FX and -m4-nofpu on CG.
# Please see also TOOLCHAIN_FX and TOOLCHAIN_CG above.
CFLAGS_FX := -D FX9860G -m3
CFLAGS_CG := -D FXCG50 -m4-nofpu
# Additional compiler flags, change to your own taste!
CFLAGS += -Wall -Wextra -Os
# Include paths. Add one -I option for each folder from which you want to
# be able to include files with #include<>. The Makefile provides a variable
# GCC_INCLUDE_FX/GCC_INCLUDE_CG that represents the default include folder,
# which is useful for some libraries such as OpenLibm.
INCLUDE_FX = -I include -I $(GCC_INCLUDE_FX)/openlibm
INCLUDE_CG = -I include -I $(GCC_INCLUDE_CG)/openlibm
# Libraries. Add one -l option for each library you are using, and also
# suitable -L options if you have library files in custom folders. To use
# fxlib, add libfx.a to the project directory and use "-L . -lfx".
LIBS_FX := -lprof -limg-fx -lopenlibm
LIBS_CG := -lprof -limg-cg -lopenlibm
# Base linker flags for the fxSDK, you usually want to keep these.
LDFLAGS_FX := -T fx9860g.ld -lgint-fx $(LIBS_FX) -lgint-fx -lgcc
LDFLAGS_CG := -T fxcg50.ld -lgint-cg $(LIBS_CG) -lgint-cg -lgcc
# Additional linker flags, if you need any.
LDFLAGS := -Wl,--print-memory-usage
# Additional platform-specific linker flags.
LDFLAGS_FX += -Wl,-Map=build-fx/map
LDFLAGS_CG += -Wl,-Map=build-cg/map
#---
# File conversion parameters
#---
# Parameters for the hexadecimal font on fx9860g
FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1
FONT.font8x9_bold.png = charset:print grid.size:8x11 grid.padding:1 \
grid.border:0 proportional:true
FONT.uf5x7 = charset:unicode grid.size:5x7 grid.padding:1
IMG.swift.png = profile:p4
IMG.swords.png = profile:p8
IMG.kbd_pressed.png = profile:p4
IMG.kbd_released.png = profile:p4
IMG.libimg_even_odd.png = type:libimg-image
IMG.libimg_odd_even.png = type:libimg-image
IMG.libimg_sq_even.png = type:libimg-image
IMG.libimg_sq_odd.png = type:libimg-image
IMG.libimg_train.png = type:libimg-image
IMG.libimg_swords.png = type:libimg-image

+ 0
- 1
src/gint/bopti.c View File

@ -9,7 +9,6 @@
/* gintctl_gint_bopti(): Test image rendering */
void gintctl_gint_bopti(void)
{
extern bopti_image_t img_swift;
extern bopti_image_t img_swords;
extern bopti_image_t img_potion_17x22, img_potion_18x22;
extern bopti_image_t img_applejack_31x27, img_applejack_36x25;


+ 220
- 0
src/gint/cpumem.c View File

@ -0,0 +1,220 @@
#include <gint/hardware.h>
#include <gint/keyboard.h>
#include <gint/display.h>
#include <gint/mmu.h>
#include <gint/std/stdio.h>
#include <gintctl/gint.h>
#include <gintctl/util.h>
/* 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
/* MPU type and processor version */
void show_mpucpu(void)
{
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
};
char const *calc_names[] = {
"Unknown",
"fx-9860G-like",
"fx-9860G-like",
"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];
/* 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];
/* 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];
volatile uint32_t *CPUOPM = (void *)0xff2f0000;
uint32_t SR, r15;
__asm__("stc sr, %0" : "=r"(SR));
__asm__("mov r15, %0" : "=r"(r15));
#ifdef FX9860G
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);
}
print_prefix(85, 24, "VBR", "%08X", cpu_getVBR());
print_prefix(85, 30, "R15", "%08X", r15);
dline(85, 24, 85, 34, C_BLACK);
dfont(old_font);
#endif
#ifdef FXCG50
row_print(1, 1, "Calculator model: %s", str_calc);
row_print(3, 1, "MPU: %s", str_mpu);
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);
row_print(8, 1, " Current VBR: %08x", cpu_getVBR());
row_print(9, 1, " Current stack pointer: %08x", r15);
#endif
}
/* Memory */
static void show_memory(void)
{
#ifdef FX9860G
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);
#endif
#ifdef FXCG50
uint32_t base_ram = 0x88000000;
if(gint[HWCALC] == HWCALC_FXCG50) base_ram = 0x8c000000;
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);
#endif
}
#if 0
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"));
}
// + scan frequency
}
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"));
}
#endif
/* gintctl_gint_cpumem(): Detected CPU and memory configuration */
void gintctl_gint_cpumem(void)
{
int tab=0, key=0;
while(key != KEY_EXIT)
{
dclear(C_WHITE);
if(tab == 0) show_mpucpu();
if(tab == 1) show_memory();
#ifdef FX9860G
row_title("CPU and memory");
extern bopti_image_t img_opt_gint_cpumem;
dimage(0, 56, &img_opt_gint_cpumem);
#endif
#ifdef FXCG50
row_title("Processor and memory");
fkey_menu(1, "MPU/CPU");
fkey_menu(2, "MEMORY");
#endif
dupdate();
key = getkey().key;
if(key == KEY_F1) tab = 0;
if(key == KEY_F2) tab = 1;
}
}

+ 0
- 215
src/gint/hardware.c View File

@ -1,215 +0,0 @@
#include <gint/hardware.h>
#include <gint/keyboard.h>
#include <gint/display.h>
#include <gintctl/gint.h>
#include <gintctl/util.h>
#define put(...) row_print(++(*row), 1, __VA_ARGS__)
#define load_barrier(x) { \
if(!((x) & HW_LOADED)) { \
put(" (not loaded)"); \
return; \
} \
}
/* MPU type and processor version */
void show_mpucpu(void)
{
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
};
char const *calc_names[] = {
"Unknown",
"SH-3 fx-9860G-like",
"SH-4 fx-9860G-like",
"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];
if(calc < 0 || calc > 6)
row_print(1, 1, "Calculator model: <CALCID %d>", calc);
else
row_print(1, 1, "Calculator model: %s", calc_names[calc]);
if(mpu < 0 || mpu > 4)
row_print(3, 1, "MPU: <MPUID %d>", mpu);
else
row_print(3, 1, "MPU: %s", mpu_names[mpu]);
if(!isSH4()) return;
row_print(4, 1, _(" PVR:"," Processor Version Register: ") "%08x",
gint[HWCPUVR]);
row_print(5, 1, _(" PRR:"," Product Register: ") "%08x",gint[HWCPUPR]);
volatile uint32_t *CPUOPM = (void *)0xff2f0000;
row_print(6, 1, _(" CPUOPM:"," CPU Operation Mode: ") "%08x", *CPUOPM);
uint32_t SR;
__asm__("stc sr, %0" : "=r"(SR));
row_print(7, 1, _(" SR:", " Status Register: ") "%08x", SR);
}
/* Memory */
static void show_memory(void)
{
int rom = gint[HWROM];
int ram = gint[HWRAM];
int uram = gint[HWURAM];
#ifdef FX9860G
row_print(1, 1, "ROM: %dM", rom >> 20);
row_print(2, 1, "RAM:%dk (%dk user)", ram >> 10, uram >> 10);
#endif
#ifdef FXCG50
row_print(1, 1, "ROM: %dM", rom >> 20);
row_print(2, 2, "%08X .. %08X", 0x80000000, 0x80000000+rom-1);
row_print(3, 1, "RAM: %dM (%dk mapped in userspace)",
ram >> 20, uram >> 10);
#endif
}
/* Extra Timer Unit */
static void hw_etmu(int *row)
{
int etmu = gint[HWETMU];
put("Extra Timer Unit" _(,":"));
load_barrier(etmu);
if(etmu & HWETMU_1)
{
put(" Extra timers: 1");
put(" Operational: %c", (etmu & HWETMU_OK0 ? 'y' : 'n'));
}
else if(etmu & HWETMU_6)
{
char operational[7] = { 0 };
for(int i = 0; i < 6; i++)
operational[i] = etmu & (1 << (i + 2)) ? 'y' : 'n';
put(" Extra timers: 6");
put(" Operational: %s", operational);
}
}
/* Keyboard */
static void hw_keyboard(int *row)
{
int kbd = gint[HWKBD];
put("Keyboard" _(,":"), kbd);
load_barrier(kbd);
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"));
}
put(_(" Scans at %dHz"," Scans keys at %dHz"), gint[HWKBDSF]);
}
/* Display driver */
static void hw_display(int *row)
{
int dd = gint[HWDD];
put("Display" _(,":"));
load_barrier(dd);
#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"));
}
static int display_data(int offset)
{
int row_value = -offset;
int *row = &row_value;
hw_etmu(row);
put("");
hw_keyboard(row);
put("");
hw_display(row);
return row_value + offset;
}
/* gintctl_hardware(): Show the hardware screen */
void gintctl_gint_hardware(void)
{
int offset = 0, tab = 0;
int max, key = 0;
while(key != KEY_EXIT)
{
dclear(C_WHITE);
if(tab == 0) show_mpucpu();
if(tab == 1) show_memory();
if(tab == 2)
{
max = display_data(offset);
scrollbar(offset, max, 1, row_count() + 1);
}
#ifdef FXCG50
row_title("Hardware and loaded drivers");
fkey_menu