xref: /openbmc/qemu/include/hw/display/macfb.h (revision 67abc3dd)
1 /*
2  * QEMU Motorola 680x0 Macintosh Video Card Emulation
3  *                 Copyright (c) 2012-2018 Laurent Vivier
4  *
5  * some parts from QEMU G364 framebuffer Emulator.
6  *                 Copyright (c) 2007-2011 Herve Poussineau
7  *
8  * This work is licensed under the terms of the GNU GPL, version 2 or later.
9  * See the COPYING file in the top-level directory.
10  *
11  */
12 
13 #ifndef MACFB_H
14 #define MACFB_H
15 
16 #include "qemu/osdep.h"
17 #include "exec/memory.h"
18 #include "ui/console.h"
19 
20 typedef struct MacfbState {
21     MemoryRegion mem_vram;
22     MemoryRegion mem_ctrl;
23     QemuConsole *con;
24 
25     uint8_t *vram;
26     uint32_t vram_bit_mask;
27     uint32_t palette_current;
28     uint8_t color_palette[256 * 3];
29     uint32_t width, height; /* in pixels */
30     uint8_t depth;
31 } MacfbState;
32 
33 #define TYPE_MACFB "sysbus-macfb"
34 #define MACFB(obj) \
35     OBJECT_CHECK(MacfbSysBusState, (obj), TYPE_MACFB)
36 
37 typedef struct {
38     SysBusDevice busdev;
39 
40     MacfbState macfb;
41 } MacfbSysBusState;
42 
43 #define NUBUS_MACFB_CLASS(class) \
44     OBJECT_CLASS_CHECK(MacfbNubusDeviceClass, (class), TYPE_NUBUS_MACFB)
45 #define NUBUS_MACFB_GET_CLASS(obj) \
46     OBJECT_GET_CLASS(MacfbNubusDeviceClass, (obj), TYPE_NUBUS_MACFB)
47 
48 typedef struct MacfbNubusDeviceClass {
49     DeviceClass parent_class;
50 
51     DeviceRealize parent_realize;
52 } MacfbNubusDeviceClass;
53 
54 #define TYPE_NUBUS_MACFB "nubus-macfb"
55 #define NUBUS_MACFB(obj) \
56     OBJECT_CHECK(MacfbNubusState, (obj), TYPE_NUBUS_MACFB)
57 
58 typedef struct {
59     NubusDevice busdev;
60 
61     MacfbState macfb;
62 } MacfbNubusState;
63 
64 #endif
65