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 /* Vertical sync operations. */ 42 43 void (*vsync_high)(); 44 void (*vsync_low)(); 45 46 /* Current scanline. */ 47 48 uint32_t line; 49 50 /* Pointers to pixel lines. */ 51 52 uint8_t *linedata; 53 54 /* General display configuration. */ 55 56 display_config_t *display_config; 57 58 } vga_display_t; 59 60 61 62 /* Initialisation. */ 63 64 void init_vga(display_config_t *display_config, 65 void (*start_visible)(), 66 void (*update_visible)(), 67 void (*stop_visible)(), 68 void (*vsync_high)(), 69 void (*vsync_low)()); 70 71 void vga_configure_sync(int hsync_unit, int vsync_unit, int timer); 72 73 /* Interrupt handlers. */ 74 75 void vga_interrupt_handler(void); 76 77 /* Display state handlers. */ 78 79 void vbp_active(void); 80 void visible_active(void); 81 void vfp_active(void); 82 void vsync_active(void); 83 84 #endif /* __VGA_DISPLAY_H__ */