v65c816: add the graphics mode ioctls remove a debug output to uart for vt
authorAlan Cox <alan@linux.intel.com>
Sun, 7 Jan 2018 23:10:16 +0000 (23:10 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 7 Jan 2018 23:10:16 +0000 (23:10 +0000)
We still hack the input side while I debug the SDL input logic on the
emulator.

Kernel/platform-v65c816/devices.c
Kernel/platform-v65c816/devtty.c
Kernel/platform-v65c816/devtty.h

index c6a101f..f6387ce 100644 (file)
@@ -16,7 +16,7 @@ struct devsw dev_tab[] =  /* The device driver switch table */
   /* 1: /dev/hd                Hard disc block devices (absent) */
   {  nxio_open,     no_close,    no_rdwr,   no_rdwr,   no_ioctl },
   /* 2: /dev/tty       TTY devices */
-  {  tty_open,     tty_close,   tty_read,  tty_write,  vt_ioctl },
+  {  tty_open,     tty_close,   tty_read,  tty_write,  gfx_ioctl },
   /* 3: /dev/lpr       Printer devices */
   {  no_open,     no_close,   no_rdwr,   no_rdwr,  no_ioctl  },
   /* 4: /dev/mem etc   System devices (one offs) */
index 6acaeb1..ee6df79 100644 (file)
@@ -6,6 +6,7 @@
 #include <device.h>
 #include <vt.h>
 #include <tty.h>
+#include <graphics.h>
 
 extern void charprint(uint8_t ch);
 extern void do_clear_bytes(void);
@@ -58,7 +59,6 @@ void plot_char(int8_t y, int8_t x, uint16_t c)
 {
        fb_off = y * 640 + x;
        charprint(c);
-       uart[0] = c;
 }
 
 void cursor_on(int8_t y, int8_t x)
@@ -126,3 +126,44 @@ void platform_interrupt(void)
                timer_interrupt();
        }
 }
+
+/* Declare a single 640x200 mappable display that doesn't bother supporting
+   kernel mode graphics helpers (because it's mappable */
+static struct display display[1] = {
+       {
+               0,
+               640, 200,
+               640, 200,
+               FMT_MONO_BW,
+               HW_UNACCEL,
+               GFX_TEXT|GFX_MAPPABLE,
+               0,
+               0,
+       }
+};
+
+static struct videomap displaymap = {
+       0,
+       0,
+       0,              /* Base is 0 in bank */
+       16384,
+       0,
+       0xFE,           /* Bank $FE is framebuffer */
+       0,
+       MAP_FBMEM|MAP_FBMEM_SEG
+};
+
+int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr)
+{
+       if (minor > 1 || arg >> 8 != 0x03)
+               return vt_ioctl(minor, arg, ptr);
+       switch(arg) {
+       case GFXIOC_GETINFO:
+               return uput(&display[0], ptr, sizeof(struct display));
+       case GFXIOC_MAP:
+               return uput(&displaymap, ptr, sizeof(displaymap));
+       case GFXIOC_UNMAP:
+               return 0;
+       }
+       return -1;
+}
index da0afba..360715f 100644 (file)
@@ -2,5 +2,6 @@
 #define __DEVTTY_DOT_H__
 
 extern void tty_poll(void);
+extern int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr);
 
 #endif