From 57f1b732dd0301fd99a709633ff80a1d3633dfae Mon Sep 17 00:00:00 2001 From: sorgelig Date: Mon, 16 Oct 2017 02:36:22 +0800 Subject: [PATCH] Debug notify about current video resolution from supported cores. --- user_io.c | 29 +++++++++++++++++++++++++++++ user_io.h | 1 + 2 files changed, 30 insertions(+) diff --git a/user_io.c b/user_io.c index c86b485..9d722bc 100644 --- a/user_io.c +++ b/user_io.c @@ -1499,6 +1499,35 @@ void user_io_poll() keyboard_leds = leds; } + static uint32_t res_timer = 0; + if(!res_timer || CheckTimer(res_timer)) + { + res_timer = GetTimer(2000); // every 2 sec + + static uint8_t nres = 0; + spi_uio_cmd_cont(UIO_GET_VRES); + uint8_t res = spi_in(); + if (nres != res) + { + nres = res; + uint32_t width = spi_w(0) | (spi_w(0) << 16); + uint32_t height = spi_w(0) | (spi_w(0) << 16); + uint32_t htime = spi_w(0) | (spi_w(0) << 16); + uint32_t vtime = spi_w(0) | (spi_w(0) << 16); + uint32_t ptime = spi_w(0) | (spi_w(0) << 16); + + float vrate = 100000000; + vrate /= vtime; + float hrate = 100000; + hrate /= htime; + + float prate = width*100; + prate /= ptime; + + printf("\033[1;33mINFO: Video resolution: %u x %u, fHorz = %.1fKHz, fVert = %.1fHz, fPix = %.2fMHz\033[0m\n", width, height, hrate, vrate, prate); + } + DisableIO(); + } } char user_io_dip_switch1() diff --git a/user_io.h b/user_io.h index cc7e64b..cc2f994 100644 --- a/user_io.h +++ b/user_io.h @@ -55,6 +55,7 @@ #define UIO_SET_VIDEO 0x20 // set HDMI video mode 0: 1280x720p60(TV), 1: 1280x1024p60(PC), 2-255: reserved #define UIO_PS2_CTL 0x21 // get PS2 control from supported cores #define UIO_RTC 0x22 // transmit RTC data to core +#define UIO_GET_VRES 0x23 // get video resolution // codes as used by 8bit (atari 800, zx81) via SS2 #define UIO_GET_STATUS 0x50