Landfall

pkg/devices/lcd/include/lcd-jz4740-device.h

263:18edc9c73263
8 months ago Paul Boddie Exposed the card registry and added support for inspecting partition tables. cpm-library-improvements
     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 #include <l4/devices/lcd-device.h>    26     27 #include <l4/re/c/dma_space.h>    28 #include <l4/re/c/video/view.h>    29 #include <l4/sys/types.h>    30     31     32     33 /* C++ language interface. */    34     35 #ifdef __cplusplus    36     37 /* Support for specific JZ4740-based devices. */    38     39 class Lcd_jz4740_device : public Lcd_device    40 {    41   /* DMA descriptor virtual and physical addresses. */    42     43   l4_addr_t desc_vaddr;    44   l4re_dma_space_dma_addr_t desc_paddr;    45     46 protected:    47   /* Device-specific memory allocation. */    48     49   int _setup_memory();    50     51 public:    52   /* Inherit constructor. */    53     54   Lcd_jz4740_device(Lcd_chip *chip, Activation *display)    55   : Lcd_device(chip, display)    56   {    57     _setup_memory();    58   }    59     60   /* Device operations. */    61     62   void disable();    63   void enable();    64     65   l4_size_t get_framebuffer_size()    66   {    67     return static_cast<Lcd_jz4740_chip *>(_chip)->get_screen_size();    68   }    69     70   void get_view_info(l4re_video_view_info_t *view_info);    71     72   /* Common device instance. */    73     74   static Lcd_jz4740_device *device;    75 };    76     77 #endif