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@56 | 47 | uint32_t cell_size; |
paul@56 | 48 | |
paul@56 | 49 | /* DMA transfer sizes. */ |
paul@56 | 50 | |
paul@56 | 51 | uint32_t transfer_cell_size; |
paul@49 | 52 | |
paul@53 | 53 | /* Display line positions. */ |
paul@53 | 54 | |
paul@53 | 55 | uint32_t hfreq_limit, hsync_start, hsync_end; |
paul@53 | 56 | |
paul@50 | 57 | /* Display region scanline positions. */ |
paul@50 | 58 | |
paul@50 | 59 | uint32_t visible_start, vfp_start, vsync_start, vsync_end; |
paul@50 | 60 | |
paul@49 | 61 | } display_config_t; |
paul@49 | 62 | |
paul@49 | 63 | |
paul@49 | 64 | |
paul@49 | 65 | /* Access functions. */ |
paul@49 | 66 | |
paul@49 | 67 | int get_position(display_config_t *cfg, int x); |
paul@74 | 68 | |
paul@49 | 69 | void test_linedata(display_config_t *cfg); |
paul@74 | 70 | |
paul@74 | 71 | void copy_display(display_config_t *cfg, uint8_t *store, int width, int height, |
paul@74 | 72 | int x, int y, int key, int to_display); |
paul@41 | 73 | |
paul@83 | 74 | void copy_display_section(display_config_t *cfg, uint8_t *store, |
paul@83 | 75 | int width, int height, |
paul@83 | 76 | int xstart, int ystart, int xsize, int ysize, |
paul@83 | 77 | int x, int y, int key, int to_display); |
paul@83 | 78 | |
paul@83 | 79 | void scroll_display(display_config_t *cfg, int x, int y); |
paul@83 | 80 | |
paul@41 | 81 | #endif /* __DISPLAY_H__ */ |