/*
* QEMU model of the Milkymist VGA framebuffer.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* http://www.milkymist.org/socdoc/vgafb.pdf
*/
-#include "hw.h"
-#include "sysbus.h"
+#include "hw/hw.h"
+#include "hw/sysbus.h"
#include "trace.h"
-#include "console.h"
-#include "framebuffer.h"
-#include "pixel_ops.h"
-#include "qemu-error.h"
+#include "ui/console.h"
+#include "hw/framebuffer.h"
+#include "ui/pixel_ops.h"
+#include "qemu/error-report.h"
#define BITS 8
-#include "milkymist-vgafb_template.h"
+#include "hw/milkymist-vgafb_template.h"
#define BITS 15
-#include "milkymist-vgafb_template.h"
+#include "hw/milkymist-vgafb_template.h"
#define BITS 16
-#include "milkymist-vgafb_template.h"
+#include "hw/milkymist-vgafb_template.h"
#define BITS 24
-#include "milkymist-vgafb_template.h"
+#include "hw/milkymist-vgafb_template.h"
#define BITS 32
-#include "milkymist-vgafb_template.h"
+#include "hw/milkymist-vgafb_template.h"
enum {
R_CTRL = 0,
R_BASEADDRESS,
R_BASEADDRESS_ACT,
R_BURST_COUNT,
+ R_DDC,
R_SOURCE_CLOCK,
R_MAX
};
struct MilkymistVgafbState {
SysBusDevice busdev;
MemoryRegion regs_region;
- DisplayState *ds;
+ QemuConsole *con;
int invalidate;
uint32_t fb_offset;
static void vgafb_update_display(void *opaque)
{
MilkymistVgafbState *s = opaque;
+ DisplaySurface *surface = qemu_console_surface(s->con);
int first = 0;
int last = 0;
drawfn fn;
int dest_width = s->regs[R_HRES];
- switch (ds_get_bits_per_pixel(s->ds)) {
+ switch (surface_bits_per_pixel(surface)) {
case 0:
return;
case 8:
break;
}
- framebuffer_update_display(s->ds, sysbus_address_space(&s->busdev),
+ framebuffer_update_display(surface, sysbus_address_space(&s->busdev),
s->regs[R_BASEADDRESS] + s->fb_offset,
s->regs[R_HRES],
s->regs[R_VRES],
&first, &last);
if (first >= 0) {
- dpy_update(s->ds, 0, first, s->regs[R_HRES], last - first + 1);
+ dpy_gfx_update(s->con, 0, first, s->regs[R_HRES], last - first + 1);
}
s->invalidate = 0;
}
return;
}
- qemu_console_resize(s->ds, s->regs[R_HRES], s->regs[R_VRES]);
+ qemu_console_resize(s->con, s->regs[R_HRES], s->regs[R_VRES]);
s->invalidate = 1;
}
-static uint64_t vgafb_read(void *opaque, target_phys_addr_t addr,
+static uint64_t vgafb_read(void *opaque, hwaddr addr,
unsigned size)
{
MilkymistVgafbState *s = opaque;
case R_VSCAN:
case R_BASEADDRESS:
case R_BURST_COUNT:
+ case R_DDC:
case R_SOURCE_CLOCK:
r = s->regs[addr];
break;
return r;
}
-static void vgafb_write(void *opaque, target_phys_addr_t addr, uint64_t value,
+static void vgafb_write(void *opaque, hwaddr addr, uint64_t value,
unsigned size)
{
MilkymistVgafbState *s = opaque;
case R_VSYNC_END:
case R_VSCAN:
case R_BURST_COUNT:
+ case R_DDC:
case R_SOURCE_CLOCK:
s->regs[addr] = value;
break;
"milkymist-vgafb", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
- s->ds = graphic_console_init(vgafb_update_display,
- vgafb_invalidate_display,
- NULL, NULL, s);
+ s->con = graphic_console_init(vgafb_update_display,
+ vgafb_invalidate_display,
+ NULL, NULL, s);
return 0;
}
dc->props = milkymist_vgafb_properties;
}
-static TypeInfo milkymist_vgafb_info = {
+static const TypeInfo milkymist_vgafb_info = {
.name = "milkymist-vgafb",
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MilkymistVgafbState),