paul@35 | 1 | /* |
paul@35 | 2 | * Generate a VGA signal using a PIC32 microcontroller. |
paul@35 | 3 | * |
paul@35 | 4 | * Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk> |
paul@35 | 5 | * |
paul@35 | 6 | * This program is free software: you can redistribute it and/or modify |
paul@35 | 7 | * it under the terms of the GNU General Public License as published by |
paul@35 | 8 | * the Free Software Foundation, either version 3 of the License, or |
paul@35 | 9 | * (at your option) any later version. |
paul@35 | 10 | * |
paul@35 | 11 | * This program is distributed in the hope that it will be useful, |
paul@35 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@35 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@35 | 14 | * GNU General Public License for more details. |
paul@35 | 15 | * |
paul@35 | 16 | * You should have received a copy of the GNU General Public License |
paul@35 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@35 | 18 | */ |
paul@35 | 19 | |
paul@35 | 20 | #ifndef __VGA_H__ |
paul@35 | 21 | #define __VGA_H__ |
paul@35 | 22 | |
paul@35 | 23 | #define LINE_LENGTH 160 /* pixels */ |
paul@35 | 24 | #define LINE_COUNT 256 /* distinct display lines */ |
paul@35 | 25 | |
paul@35 | 26 | #define ZERO_LENGTH 1 /* pixels */ |
paul@35 | 27 | |
paul@35 | 28 | /* 48MHz cycle measurements. */ |
paul@35 | 29 | |
paul@35 | 30 | #define HFREQ_LIMIT 1286 |
paul@35 | 31 | #define HSYNC_START 920 |
paul@35 | 32 | #define HSYNC_LIMIT 128 |
paul@35 | 33 | #define HSYNC_END (HSYNC_START + HSYNC_LIMIT) |
paul@35 | 34 | |
paul@35 | 35 | /* Horizontal lines, back porch end. */ |
paul@35 | 36 | |
paul@35 | 37 | #define VISIBLE_START 70 |
paul@35 | 38 | #define VFP_START (VISIBLE_START + 2 * LINE_COUNT) |
paul@35 | 39 | |
paul@35 | 40 | /* Horizontal lines, front porch end. */ |
paul@35 | 41 | |
paul@35 | 42 | #define VSYNC_START 620 |
paul@35 | 43 | |
paul@35 | 44 | /* Horizontal lines, back porch start. */ |
paul@35 | 45 | |
paul@35 | 46 | #define VSYNC_END 622 |
paul@35 | 47 | |
paul@35 | 48 | #define SCREEN_BASE 256 |
paul@35 | 49 | #define SCREEN_SIZE (40 * 1024) |
paul@35 | 50 | #define SCREEN_LIMIT (SCREEN_BASE + SCREEN_SIZE) |
paul@35 | 51 | |
paul@35 | 52 | #define SCREEN_BASE_KSEG0 (KSEG0_BASE + SCREEN_BASE) |
paul@35 | 53 | #define SCREEN_LIMIT_KSEG0 (KSEG0_BASE + SCREEN_LIMIT) |
paul@35 | 54 | |
paul@35 | 55 | #endif /* __VGA_H__ */ |