if( minor == curminor ) apply_gime( minor );
return 0;
}
+ if (arg == GFXIOC_DRAW ){
+ int err;
+ err = gfx_draw_op(arg, ptr);
+ if (err) {
+ udata.u_error = err;
+ err = -1;
+ }
+ return err;
+ }
udata.u_error = ENOTTY;
return -1;
#include <kernel.h>
#include <devtty.h>
-
+extern video_cmd( char *rlt_data);
/* These are routines stolen from the stock vt.c's VT_SIMPLE code, and modified
to suite multiple vts
memset( (char *)0x2000, ' ', 0x4000 );
map_for_kernel();
}
+
+int gfx_draw_op(uarg_t arg, char *ptr)
+{
+ int err=0;
+ int l;
+ int c = 8; /* 4 x uint16_t */
+ uint16_t *p = (uint16_t *)(char *)0x5e00;
+
+ map_for_video();
+ l = ugetw(ptr);
+ if (l < 6 || l > 512){
+ err = EINVAL;
+ goto ret;
+ }
+ if (arg != GFXIOC_READ)
+ c = l;
+ if (uget((char *)0x5e00, ptr + 2, c)){
+ err = EFAULT;
+ goto ret;
+ }
+ switch(arg) {
+ case GFXIOC_DRAW:
+ /* TODO
+ if (draw_validate(ptr, l, 256, 192)) - or 128!
+ return EINVAL */
+ video_cmd( ( char *)0x5e00 );
+ break;
+ case GFXIOC_WRITE:
+ case GFXIOC_READ:
+ err = EFAULT;
+ goto ret;
+ /* Not implemented yet....
+ if (l < 8)
+ return EINVAL;
+ l -= 8;
+ if (p[0] > 31 || p[1] > 191 || p[2] > 31 || p[3] > 191 ||
+ p[0] + p[2] > 32 || p[1] + p[3] > 192 ||
+ (p[2] * p[3]) > l)
+ return -EFAULT;
+ if (arg == GFXIOC_READ) {
+ video_read(buf);
+ if (uput(buf + 8, ptr, l))
+ return EFAULT;
+ return 0;
+ }
+ video_write(buf);
+ */
+ }
+ ret:
+ map_for_kernel();
+ return err;
+}