#include <devide.h>
#include <devsd.h>
#include <blkdev.h>
+#include <devtty.h>
struct devsw dev_tab[] = /* The device driver switch table */
{
/* 1: /dev/fd Floppy disc block devices: nope */
{ no_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) */
#include <keycode.h>
#include <vt.h>
#include <tty.h>
+#include <graphics.h>
char tbuf1[TTYSIZ];
/* This is used by the vt asm code, but needs to live in the kernel */
uint16_t cursorpos;
+
+static struct display specdisplay = {
+ 0,
+ 256, 192,
+ 256, 192,
+ 0xFF, 0xFF,
+ FMT_SPECTRUM,
+ HW_UNACCEL,
+ GFX_VBLANK|GFX_MAPPABLE|GFX_TEXT,
+ 0
+};
+
+static struct videomap specmap = {
+ 0,
+ 0,
+ 0x4000,
+ 6912,
+ 0,
+ 0,
+ 0,
+ MAP_FBMEM|MAP_FBMEM_SIMPLE
+};
+
+/*
+ * Graphics ioctls. Very minimal for this platform. It's a single fixed
+ * mode with direct memory mapping.
+ */
+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(&specdisplay, ptr, sizeof(struct display));
+ case GFXIOC_MAP:
+ return uput(&specmap, ptr, sizeof(struct videomap));
+ case GFXIOC_UNMAP:
+ return 0;
+ case GFXIOC_WAITVB:
+ /* Our system clock is vblank */
+ psleep(&timer_interrupt);
+ chksigs();
+ if (udata.u_cursig) {
+ udata.u_error = EINTR;
+ return -1;
+ }
+ return 0;
+ }
+ return -1;
+}
extern uint8_t keyboard[8][5];
extern uint8_t shiftkeyboard[8][5];
+extern int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr);
+
#endif
n = MAX_SWAPS;
#ifdef SWAPDEV
while (n)
- swapmap_add(n--);
+ swapmap_init(n--);
#endif
}
{
tty_pollirq();
timer_interrupt();
+ wakeup(&timer_interrupt);
}
/*