1 /* 2 * LCD device support for the JZ4740 and related SoCs. 3 * 4 * Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (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, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #include <l4/devices/lcd.h> 25 26 #include "lcd-device.h" 27 28 #include <l4/re/dma_space> 29 #include <l4/re/c/video/view.h> 30 #include <l4/sys/types.h> 31 32 33 34 /* C++ language interface. */ 35 36 #ifdef __cplusplus 37 38 /* Support for specific JZ4740-based devices. */ 39 40 class Lcd_jz4740_device : public Lcd_device 41 { 42 /* DMA descriptor virtual and physical addresses. */ 43 44 l4_addr_t desc_vaddr; 45 L4Re::Dma_space::Dma_addr desc_paddr; 46 47 protected: 48 /* Device-specific memory allocation. */ 49 50 int _setup_memory(); 51 52 public: 53 /* Inherit constructor. */ 54 55 Lcd_jz4740_device(Lcd_chip *chip, Activation *display) 56 : Lcd_device(chip, display) 57 { 58 _setup_memory(); 59 } 60 61 /* Device operations. */ 62 63 void disable(); 64 void enable(); 65 66 l4_size_t get_framebuffer_size() 67 { 68 return static_cast<Lcd_jz4740_chip *>(_chip)->get_screen_size(); 69 } 70 71 void get_view_info(l4re_video_view_info_t *view_info); 72 73 /* Common device instance. */ 74 75 static Lcd_jz4740_device *device; 76 }; 77 78 #endif