paul@41 | 1 | /* |
paul@41 | 2 | * Common display-related functions. |
paul@41 | 3 | * |
paul@41 | 4 | * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@41 | 5 | * |
paul@41 | 6 | * This program is free software: you can redistribute it and/or modify |
paul@41 | 7 | * it under the terms of the GNU General Public License as published by |
paul@41 | 8 | * the Free Software Foundation, either version 3 of the License, or |
paul@41 | 9 | * (at your option) any later version. |
paul@41 | 10 | * |
paul@41 | 11 | * This program is distributed in the hope that it will be useful, |
paul@41 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@41 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@41 | 14 | * GNU General Public License for more details. |
paul@41 | 15 | * |
paul@41 | 16 | * You should have received a copy of the GNU General Public License |
paul@41 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@41 | 18 | */ |
paul@41 | 19 | |
paul@41 | 20 | #ifndef __DISPLAY_H__ |
paul@41 | 21 | #define __DISPLAY_H__ |
paul@41 | 22 | |
paul@41 | 23 | #include <stdint.h> |
paul@41 | 24 | |
paul@49 | 25 | |
paul@49 | 26 | |
paul@49 | 27 | /* Display configuration type. */ |
paul@49 | 28 | |
paul@49 | 29 | typedef struct |
paul@49 | 30 | { |
paul@49 | 31 | /* Framebuffer pointer and size. */ |
paul@49 | 32 | |
paul@49 | 33 | uint8_t *framebuffer; |
paul@49 | 34 | uint32_t screen_size; |
paul@49 | 35 | uint32_t line_length, line_count; /* width, height */ |
paul@49 | 36 | |
paul@49 | 37 | /* Screen start/top and limit pointers. */ |
paul@49 | 38 | |
paul@49 | 39 | uint8_t *screen_start, *screen_limit; |
paul@49 | 40 | |
paul@49 | 41 | /* Number of scanlines per display line. */ |
paul@49 | 42 | |
paul@49 | 43 | int line_multiplier; |
paul@49 | 44 | |
paul@49 | 45 | /* Number of consecutive pixels provided by a framebuffer region. */ |
paul@49 | 46 | |
paul@49 | 47 | int cell_size; |
paul@49 | 48 | |
paul@53 | 49 | /* Display line positions. */ |
paul@53 | 50 | |
paul@53 | 51 | uint32_t hfreq_limit, hsync_start, hsync_end; |
paul@53 | 52 | |
paul@50 | 53 | /* Display region scanline positions. */ |
paul@50 | 54 | |
paul@50 | 55 | uint32_t visible_start, vfp_start, vsync_start, vsync_end; |
paul@50 | 56 | |
paul@49 | 57 | } display_config_t; |
paul@49 | 58 | |
paul@49 | 59 | |
paul@49 | 60 | |
paul@49 | 61 | /* Access functions. */ |
paul@49 | 62 | |
paul@49 | 63 | int get_position(display_config_t *cfg, int x); |
paul@49 | 64 | void test_linedata(display_config_t *cfg); |
paul@41 | 65 | |
paul@41 | 66 | #endif /* __DISPLAY_H__ */ |