From 9412c9debe735e4708fd1b499851cc80026e5849 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 1 May 2011 21:50:20 -0300 Subject: [PATCH] ubb-vga: test image now shows detailed horizontal and vertical timing - ubb-vga.c (CYCLES), ubb-vga.h: corrected conversion and moved to ubb-vga.h - tstimg.c (printc): added characters '=' and '+' - tstimg.c (tstimg): print detailed horizontal and vertical timing --- ubb-vga/tstimg.c | 24 ++++++++++++++++++++++-- ubb-vga/ubb-vga.c | 2 -- ubb-vga/ubb-vga.h | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ubb-vga/tstimg.c b/ubb-vga/tstimg.c index 4b9d47c..66a4318 100644 --- a/ubb-vga/tstimg.c +++ b/ubb-vga/tstimg.c @@ -415,6 +415,14 @@ static void printc(void **f, int xres, int x, int y, char c, int n, case '-': line45(f, xres, x, y+2*n, 1, 0, 2*n, color, side); break; + case '=': + line45(f, xres, x, y+1*n, 1, 0, 2*n, color, side); + line45(f, xres, x, y+3*n, 1, 0, 2*n, color, side); + break; + case '+': + line45(f, xres, x, y+2*n, 1, 0, 2*n, color, side); + line45(f, xres, x+n, y+n, 0, 1, 2*n, color, side); + break; case ' ': break; case '.': @@ -453,7 +461,7 @@ static void ctext(void **f, int xres, int x, int y, const char *s, int n, void tstimg(void **f, int xres, int yres) { - char buf[20]; + char buf[40]; double line_freq_hz; grid(f, xres, yres); @@ -471,6 +479,18 @@ void tstimg(void **f, int xres, int yres) sprintf(buf, "LINE %5.2f KHZ", line_freq_hz/1000); text(f, xres, xres/8, yres/8+5*6, buf, 5, WHITE, 1); - sprintf(buf, "FRAME %5.2f HZ", line_freq_hz/(mode->yres+2+32+14)); + sprintf(buf, "FRAME %5.2f HZ", + line_freq_hz/(mode->vsync_lines+ mode->vfront_lines+mode->yres+ + mode->vback_lines)); text(f, xres, xres/8, yres/8+5*12, buf, 5, WHITE, 1); + + sprintf(buf, "VERT %d+%d+%d+%d LINES", + mode->vsync_lines, mode->vfront_lines, mode->yres, + mode->vback_lines); + text(f, xres, xres/8, yres/8+5*18, buf, 5, WHITE, 1); + + sprintf(buf, "HOR %4.2f+...+%4.2f = %5.2f US", + CYCLES(mode->hsync_cycles), CYCLES(mode->hback_cycles), + CYCLES(mode->line_cycles)); + text(f, xres, xres/8, yres/8+5*24, buf, 5, WHITE, 1); } diff --git a/ubb-vga/ubb-vga.c b/ubb-vga/ubb-vga.c index e753c2d..1d271d9 100644 --- a/ubb-vga/ubb-vga.c +++ b/ubb-vga/ubb-vga.c @@ -452,8 +452,6 @@ int main(int argc, char *const *argv) } #if 0 -#define CYCLES(cy) ((cy)/112.0+0.5) - printf("V: %d+%d+%d+%d\n", mode->vsync_lines, mode->vfront_lines, mode->yres, mode->vback_lines); printf("H: %4.1f+?+?+%4.1f (%4.1f)\n", CYCLES(mode->hsync_cycles), diff --git a/ubb-vga/ubb-vga.h b/ubb-vga/ubb-vga.h index 78d2174..b0a72a9 100644 --- a/ubb-vga/ubb-vga.h +++ b/ubb-vga/ubb-vga.h @@ -41,6 +41,9 @@ extern const struct mode *mode; void *map(off_t addr, size_t size); +#define CYCLES(cy) ((cy)/112.0) + + /* ccube.c */ uint8_t ccube_map(uint8_t r, uint8_t g, uint8_t b);