paul@50 | 1 | /* |
paul@50 | 2 | * VGA display-related functions. |
paul@50 | 3 | * |
paul@50 | 4 | * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@50 | 5 | * |
paul@50 | 6 | * This program is free software: you can redistribute it and/or modify |
paul@50 | 7 | * it under the terms of the GNU General Public License as published by |
paul@50 | 8 | * the Free Software Foundation, either version 3 of the License, or |
paul@50 | 9 | * (at your option) any later version. |
paul@50 | 10 | * |
paul@50 | 11 | * This program is distributed in the hope that it will be useful, |
paul@50 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@50 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@50 | 14 | * GNU General Public License for more details. |
paul@50 | 15 | * |
paul@50 | 16 | * You should have received a copy of the GNU General Public License |
paul@50 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@50 | 18 | */ |
paul@50 | 19 | |
paul@50 | 20 | #ifndef __VGA_DISPLAY_H__ |
paul@50 | 21 | #define __VGA_DISPLAY_H__ |
paul@50 | 22 | |
paul@50 | 23 | #include "display.h" |
paul@50 | 24 | |
paul@50 | 25 | |
paul@50 | 26 | |
paul@50 | 27 | /* Display configuration type. */ |
paul@50 | 28 | |
paul@50 | 29 | typedef struct |
paul@50 | 30 | { |
paul@50 | 31 | /* Current display state handler. */ |
paul@50 | 32 | |
paul@50 | 33 | void (*state_handler)(); |
paul@50 | 34 | |
paul@50 | 35 | /* Display state handlers. */ |
paul@50 | 36 | |
paul@50 | 37 | void (*start_visible)(); |
paul@50 | 38 | void (*update_visible)(); |
paul@50 | 39 | void (*stop_visible)(); |
paul@50 | 40 | |
paul@54 | 41 | /* Horizontal and vertical sync peripherals. */ |
paul@50 | 42 | |
paul@54 | 43 | int timer, hsync_unit, vsync_unit; |
paul@50 | 44 | |
paul@50 | 45 | /* Current scanline. */ |
paul@50 | 46 | |
paul@50 | 47 | uint32_t line; |
paul@50 | 48 | |
paul@50 | 49 | /* Pointers to pixel lines. */ |
paul@50 | 50 | |
paul@50 | 51 | uint8_t *linedata; |
paul@50 | 52 | |
paul@50 | 53 | /* General display configuration. */ |
paul@50 | 54 | |
paul@50 | 55 | display_config_t *display_config; |
paul@50 | 56 | |
paul@50 | 57 | } vga_display_t; |
paul@50 | 58 | |
paul@50 | 59 | |
paul@50 | 60 | |
paul@50 | 61 | /* Initialisation. */ |
paul@50 | 62 | |
paul@50 | 63 | void init_vga(display_config_t *display_config, |
paul@50 | 64 | void (*start_visible)(), |
paul@50 | 65 | void (*update_visible)(), |
paul@54 | 66 | void (*stop_visible)()); |
paul@50 | 67 | |
paul@53 | 68 | void vga_configure_sync(int hsync_unit, int vsync_unit, int timer); |
paul@53 | 69 | |
paul@50 | 70 | /* Interrupt handlers. */ |
paul@50 | 71 | |
paul@50 | 72 | void vga_interrupt_handler(void); |
paul@50 | 73 | |
paul@50 | 74 | /* Display state handlers. */ |
paul@50 | 75 | |
paul@50 | 76 | void vbp_active(void); |
paul@50 | 77 | void visible_active(void); |
paul@50 | 78 | void vfp_active(void); |
paul@50 | 79 | void vsync_active(void); |
paul@50 | 80 | |
paul@54 | 81 | /* Vertical sync operations. */ |
paul@54 | 82 | |
paul@54 | 83 | void vsync_high(void); |
paul@54 | 84 | void vsync_low(void); |
paul@54 | 85 | |
paul@50 | 86 | #endif /* __VGA_DISPLAY_H__ */ |