Landfall

pkg/devices/lcd/include/lcd-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.     3  *     4  * Copyright (C) 2018, 2020, 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/activation_interface.h>    25 #include <l4/devices/lcd.h>    26     27 #include <l4/re/c/video/view.h>    28 #include <l4/sys/types.h>    29     30     31     32 #ifdef __cplusplus    33     34 #include <l4/re/c/dataspace.h>    35 #include <l4/re/c/dma_space.h>    36     37 class Lcd_device    38 {    39 protected:    40   /* LCD peripheral abstraction. */    41     42   Lcd_chip *_chip;    43     44   /* Display server abstraction. */    45     46   Activation *_display;    47     48   /* Framebuffer virtual and physical addresses. */    49     50   l4_addr_t fb_vaddr;    51   l4re_dma_space_dma_addr_t fb_paddr;    52     53   /* Memory capability for the framebuffer. */    54     55   l4re_ds_t _fbmem;    56     57   /* Display operations. */    58     59   virtual void disable_display();    60   virtual void enable_display();    61     62 public:    63   /* Initialise a device with a controller and display object reference. */    64     65   Lcd_device(Lcd_chip *chip, Activation *display)    66   : _chip(chip), _display(display)    67   {    68     /* Subclasses must set up any memory. */    69   }    70     71   /* Framebuffer operations. */    72     73   virtual l4_addr_t get_framebuffer()    74   {    75     return fb_vaddr;    76   }    77     78   virtual l4re_ds_t get_framebuffer_cap()    79   {    80     return _fbmem;    81   }    82     83   /* Querying operations. */    84     85   virtual l4_size_t get_framebuffer_size() = 0;    86   virtual void get_view_info(l4re_video_view_info_t *view_info) = 0;    87     88   /* Device operations. */    89     90   virtual void disable() = 0;    91   virtual void enable() = 0;    92     93   /* Device access. */    94     95   static Lcd_device *get_device();    96 };    97     98 #endif    99    100    101    102 /* C language interface. */   103    104 EXTERN_C_BEGIN   105    106 void *lcd_get_device(void);   107 l4_addr_t lcd_get_framebuffer(void *lcd);   108 l4_size_t lcd_get_framebuffer_size(void *lcd);   109 void lcd_get_view_info(void *lcd, l4re_video_view_info_t *view_info);   110 void lcd_disable(void *lcd);   111 void lcd_enable(void *lcd);   112    113 EXTERN_C_END