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_CPU_H__ 21 #define __VGA_DISPLAY_CPU_H__ 22 23 #include "pic32_c.h" 24 #include "display.h" 25 26 27 28 /* Display configuration type. */ 29 30 typedef struct 31 { 32 /* Current display state handler. */ 33 34 void (*state_handler)(); 35 36 /* Transfer properties. */ 37 38 int line_timer; 39 uint32_t output; 40 41 /* Horizontal and vertical sync peripherals. */ 42 43 int 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, int line_timer); 64 65 void init_vga_with_timer(display_config_t *display_config, int line_timer); 66 67 void vga_configure_sync(int hsync_unit, int vsync_unit); 68 69 void vga_configure_transfer(uint32_t output); 70 71 /* Interrupt handlers. */ 72 73 void vga_interrupt_handler(void); 74 void vga_transfer_interrupt_handler(void); 75 76 /* Display state handlers. */ 77 78 void vbp_active(void); 79 void visible_active(void); 80 void vfp_active(void); 81 void vsync_active(void); 82 83 /* Display operations. */ 84 85 void start_visible(void); 86 void update_visible(void); 87 void stop_visible(void); 88 void update_transfers(int enable); 89 90 /* Vertical sync operations. */ 91 92 void vsync_high(void); 93 void vsync_low(void); 94 95 #endif /* __VGA_DISPLAY_CPU_H__ */