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