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