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