1 /* 2 * LCD peripheral support for the JZ4780 and related SoCs. 3 * 4 * Copyright (C) 2018, 2020 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 "lcd-jz4740.h" 25 26 27 28 /* C++ language interface. */ 29 30 #ifdef __cplusplus 31 32 #include <l4/devices/hw_mmio_register_block.h> 33 34 class Lcd_jz4780_chip : public Lcd_jz4740_chip 35 { 36 protected: 37 /* OSD configure register value calculation. */ 38 39 uint32_t _osd_config_irq(); 40 41 /* Priority level threshold value calculation. */ 42 43 uint32_t _priority_transfer(); 44 45 /* Position value calculation. */ 46 47 uint32_t _position_bpp(); 48 49 /* Descriptor initialisation. */ 50 51 void _set_descriptor(struct Jz4740_lcd_descriptor &desc, l4_addr_t source, 52 l4_size_t size, struct Jz4740_lcd_descriptor *next, 53 uint32_t flags = 0, bool frame_enable = true); 54 55 public: 56 Lcd_jz4780_chip(l4_addr_t addr, Jz4740_lcd_panel *panel); 57 58 /* Configuration. */ 59 60 void config(struct Jz4740_lcd_descriptor *desc_vaddr, 61 struct Jz4740_lcd_descriptor *desc_paddr, 62 l4_addr_t fb_paddr); 63 }; 64 65 #endif 66 67 68 69 /* C language interface mainly provided by jz4740_lcd functions. */ 70 71 EXTERN_C_BEGIN 72 73 void *jz4780_lcd_init(l4_addr_t lcd_base, struct Jz4740_lcd_panel *panel); 74 75 EXTERN_C_END