# HG changeset patch # User Paul Boddie # Date 1540927185 -3600 # Node ID b5c583edf1c296b3d9ace2d9fded90485329516d # Parent 0338c4362083f07be1de5c993e2ce0db30627a26 Moved common VGA timings to a separate file, adjusting the visible start. diff -r 0338c4362083 -r b5c583edf1c2 examples/vga-dual/vga.h --- a/examples/vga-dual/vga.h Tue Oct 30 19:23:34 2018 +0100 +++ b/examples/vga-dual/vga.h Tue Oct 30 20:19:45 2018 +0100 @@ -20,9 +20,11 @@ #ifndef __VGA_H__ #define __VGA_H__ +#include "vga_common.h" + #define LINE_LENGTH 160 /* pixels */ #define LINE_COUNT 256 /* distinct display lines */ -#define LINE_MULTIPLIER 2 +#define LINE_MULTIPLIER (SCANLINES / LINE_COUNT) /* 24MHz cycle measurements. */ @@ -31,19 +33,6 @@ #define HSYNC_LIMIT 64 #define HSYNC_END (HSYNC_START + HSYNC_LIMIT) -/* Horizontal lines, back porch end. */ - -#define VISIBLE_START 70 -#define VFP_START (VISIBLE_START + LINE_MULTIPLIER * LINE_COUNT) - -/* Horizontal lines, front porch end. */ - -#define VSYNC_START 620 - -/* Horizontal lines, back porch start. */ - -#define VSYNC_END 622 - /* Framebuffer properties. */ #define SCREEN_SIZE (LINE_LENGTH * LINE_COUNT) diff -r 0338c4362083 -r b5c583edf1c2 examples/vga-pmp/vga.h --- a/examples/vga-pmp/vga.h Tue Oct 30 19:23:34 2018 +0100 +++ b/examples/vga-pmp/vga.h Tue Oct 30 20:19:45 2018 +0100 @@ -20,9 +20,11 @@ #ifndef __VGA_H__ #define __VGA_H__ +#include "vga_common.h" + #define LINE_LENGTH 160 /* pixels */ #define LINE_COUNT 256 /* distinct display lines */ -#define LINE_MULTIPLIER 2 +#define LINE_MULTIPLIER (SCANLINES / LINE_COUNT) /* 48MHz cycle measurements. */ @@ -31,19 +33,6 @@ #define HSYNC_LIMIT 128 #define HSYNC_END (HSYNC_START + HSYNC_LIMIT) -/* Horizontal lines, back porch end. */ - -#define VISIBLE_START 70 -#define VFP_START (VISIBLE_START + LINE_MULTIPLIER * LINE_COUNT) - -/* Horizontal lines, front porch end. */ - -#define VSYNC_START 620 - -/* Horizontal lines, back porch start. */ - -#define VSYNC_END 622 - /* Framebuffer properties. */ #define SCREEN_SIZE (LINE_LENGTH * LINE_COUNT) diff -r 0338c4362083 -r b5c583edf1c2 examples/vga-timer/vga.h --- a/examples/vga-timer/vga.h Tue Oct 30 19:23:34 2018 +0100 +++ b/examples/vga-timer/vga.h Tue Oct 30 20:19:45 2018 +0100 @@ -20,9 +20,11 @@ #ifndef __VGA_H__ #define __VGA_H__ +#include "vga_common.h" + #define LINE_LENGTH 92 /* pixels */ #define LINE_COUNT 128 /* distinct display lines */ -#define LINE_MULTIPLIER 4 +#define LINE_MULTIPLIER (SCANLINES / LINE_COUNT) /* 24MHz cycle measurements. */ @@ -31,19 +33,6 @@ #define HSYNC_LIMIT 40 #define HSYNC_END (HSYNC_START + HSYNC_LIMIT) -/* Horizontal lines, back porch end. */ - -#define VISIBLE_START 70 -#define VFP_START (VISIBLE_START + LINE_MULTIPLIER * LINE_COUNT) - -/* Horizontal lines, front porch end. */ - -#define VSYNC_START 620 - -/* Horizontal lines, back porch start. */ - -#define VSYNC_END 622 - /* Framebuffer properties. */ #define SCREEN_SIZE (LINE_LENGTH * LINE_COUNT) diff -r 0338c4362083 -r b5c583edf1c2 examples/vga/vga.h --- a/examples/vga/vga.h Tue Oct 30 19:23:34 2018 +0100 +++ b/examples/vga/vga.h Tue Oct 30 20:19:45 2018 +0100 @@ -20,9 +20,11 @@ #ifndef __VGA_H__ #define __VGA_H__ +#include "vga_common.h" + #define LINE_LENGTH 160 /* pixels */ #define LINE_COUNT 256 /* distinct display lines */ -#define LINE_MULTIPLIER 2 +#define LINE_MULTIPLIER (SCANLINES / LINE_COUNT) /* 24MHz cycle measurements. */ @@ -31,19 +33,6 @@ #define HSYNC_LIMIT 64 #define HSYNC_END (HSYNC_START + HSYNC_LIMIT) -/* Horizontal lines, back porch end. */ - -#define VISIBLE_START 70 -#define VFP_START (VISIBLE_START + LINE_MULTIPLIER * LINE_COUNT) - -/* Horizontal lines, front porch end. */ - -#define VSYNC_START 620 - -/* Horizontal lines, back porch start. */ - -#define VSYNC_END 622 - /* Framebuffer properties. */ #define SCREEN_SIZE (LINE_LENGTH * LINE_COUNT) diff -r 0338c4362083 -r b5c583edf1c2 include/vga_common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/vga_common.h Tue Oct 30 20:19:45 2018 +0100 @@ -0,0 +1,43 @@ +/* + * Generate a VGA signal using a PIC32 microcontroller. + * + * Copyright (C) 2017, 2018 Paul Boddie + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __VGA_COMMON_H__ +#define __VGA_COMMON_H__ + +/* Number of raster scan lines to be used. */ + +#define SCANLINES 512 + +/* Horizontal lines, back porch end. */ + +#define VISIBLE_START 72 + +/* Horizontal lines, front porch start. */ + +#define VFP_START (VISIBLE_START + SCANLINES) + +/* Horizontal lines, front porch end. */ + +#define VSYNC_START 620 + +/* Horizontal lines, back porch start. */ + +#define VSYNC_END 622 + +#endif /* __VGA_COMMON_H__ */