paul@226 | 1 | /* |
paul@226 | 2 | * LCD device support for the JZ4740 and related SoCs. |
paul@226 | 3 | * |
paul@226 | 4 | * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@226 | 5 | * |
paul@226 | 6 | * This program is free software; you can redistribute it and/or |
paul@226 | 7 | * modify it under the terms of the GNU General Public License as |
paul@226 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@226 | 9 | * the License, or (at your option) any later version. |
paul@226 | 10 | * |
paul@226 | 11 | * This program is distributed in the hope that it will be useful, |
paul@226 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@226 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@226 | 14 | * GNU General Public License for more details. |
paul@226 | 15 | * |
paul@226 | 16 | * You should have received a copy of the GNU General Public License |
paul@226 | 17 | * along with this program; if not, write to the Free Software |
paul@226 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@226 | 19 | * Boston, MA 02110-1301, USA |
paul@226 | 20 | */ |
paul@226 | 21 | |
paul@226 | 22 | #pragma once |
paul@226 | 23 | |
paul@226 | 24 | #include <l4/devices/lcd.h> |
paul@226 | 25 | #include <l4/devices/lcd-device.h> |
paul@226 | 26 | |
paul@226 | 27 | #include <l4/re/c/dma_space.h> |
paul@226 | 28 | #include <l4/re/c/video/view.h> |
paul@226 | 29 | #include <l4/sys/types.h> |
paul@226 | 30 | |
paul@226 | 31 | |
paul@226 | 32 | |
paul@226 | 33 | /* C++ language interface. */ |
paul@226 | 34 | |
paul@226 | 35 | #ifdef __cplusplus |
paul@226 | 36 | |
paul@226 | 37 | /* Support for specific JZ4780-based devices. */ |
paul@226 | 38 | |
paul@226 | 39 | class Lcd_jz4780_spi_device : public Lcd_device |
paul@226 | 40 | { |
paul@226 | 41 | /* DMA descriptor virtual and physical addresses. */ |
paul@226 | 42 | |
paul@226 | 43 | l4_addr_t desc_vaddr; |
paul@226 | 44 | l4re_dma_space_dma_addr_t desc_paddr; |
paul@226 | 45 | |
paul@226 | 46 | protected: |
paul@226 | 47 | /* Device-specific memory allocation. */ |
paul@226 | 48 | |
paul@226 | 49 | int _setup_memory(); |
paul@226 | 50 | |
paul@226 | 51 | public: |
paul@226 | 52 | Lcd_jz4780_spi_device(Activation *display) |
paul@226 | 53 | : Lcd_device(display) |
paul@226 | 54 | { |
paul@226 | 55 | _setup_memory(); |
paul@226 | 56 | } |
paul@226 | 57 | |
paul@226 | 58 | /* Device operations. */ |
paul@226 | 59 | |
paul@226 | 60 | void disable(); |
paul@226 | 61 | void enable(); |
paul@226 | 62 | |
paul@226 | 63 | l4_size_t get_framebuffer_size(); |
paul@226 | 64 | |
paul@226 | 65 | void get_view_info(l4re_video_view_info_t *view_info); |
paul@226 | 66 | |
paul@226 | 67 | /* Common device instance. */ |
paul@226 | 68 | |
paul@226 | 69 | static Lcd_jz4780_spi_device *device; |
paul@226 | 70 | }; |
paul@226 | 71 | |
paul@226 | 72 | #endif |