summaryrefslogtreecommitdiff
path: root/hw/jazz_led.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-10 16:33:14 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-10 16:33:14 +0000
commit4d3b6f6e126553107a78999bd1070b086ae3c023 (patch)
tree53efc029b509407306b900d509256fdaabd6f49f /hw/jazz_led.c
parentc0be16d39fd7187764dcd3d65a63167c92e48142 (diff)
Add an ncurses UI.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3976 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/jazz_led.c')
-rw-r--r--hw/jazz_led.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index a0eea26b5..d547138b9 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -285,6 +285,22 @@ static void jazz_led_screen_dump(void *opaque, const char *filename)
printf("jazz_led_screen_dump() not implemented\n");
}
+static void jazz_led_text_update(void *opaque, console_ch_t *chardata)
+{
+ LedState *s = opaque;
+ char buf[2];
+
+ dpy_cursor(s->ds, -1, -1);
+ dpy_resize(s->ds, 2, 1);
+
+ /* TODO: draw the segments */
+ snprintf(buf, 2, "%02hhx\n", s->segments);
+ console_write_ch(chardata++, 0x00200100 | buf[0]);
+ console_write_ch(chardata++, 0x00200100 | buf[1]);
+
+ dpy_update(s->ds, 0, 0, 2, 1);
+}
+
void jazz_led_init(DisplayState *ds, target_phys_addr_t base)
{
LedState *s;
@@ -301,5 +317,7 @@ void jazz_led_init(DisplayState *ds, target_phys_addr_t base)
io = cpu_register_io_memory(0, led_read, led_write, s);
cpu_register_physical_memory(s->base, 1, io);
- graphic_console_init(ds, jazz_led_update_display, jazz_led_invalidate_display, jazz_led_screen_dump, s);
+ graphic_console_init(ds, jazz_led_update_display,
+ jazz_led_invalidate_display, jazz_led_screen_dump,
+ jazz_led_text_update, s);
}