1: /* packet.c Routines to allocate, free, and use packets
2: *
3: * OpenDisplay Open it
4: * InitDisplay Download it
5: * DisplayDead Check if dead
6: * Allocate_space Allocate some temporary storage
7: * Deallocate_space Flush space of unsent packet
8: *
9: */
10:
11:
12: #include <stdio.h>
13: #include <fcntl.h>
14: #include <errno.h>
15: #include <sys/types.h>
16: #include <sys/ioctl.h>
17: #include "ddxqvss.h"
18: #include <vaxuba/qvioctl.h>
19:
20: vsIoAddr *VSAddr;
21: vsEvent *VSEvent;
22: int VSqMax;
23:
24: BITMAP pbm; /* the actual screen memory */
25: BITMAP vbm; /* the size of the root window */
26: caddr_t ltable[YSIZE]; /* line address table */
27:
28: int vsdev = -1;
29: extern int errno;
30:
31: /* Open the display */
32:
33: /*ARGSUSED*/
34: OpenDisplay (vsNumber)
35: char *vsNumber;
36: {
37: char vsname[10];
38:
39: return(vsdev = open ("/dev/mouse", O_RDWR|O_NDELAY));
40: }
41:
42: /* Do qvss specific initialization */
43:
44: InitDisplay (info)
45: register DEVICE *info;
46: {
47: register int i;
48: if (ioctl(vsdev,QIOCADDR,&VSAddr) == -1) return(-1);
49: if (ioctl(vsdev,QIOCINIT,0) == -1) return(-1);
50: VSEvent = VSAddr->ibuff;
51: VSqMax = VSAddr->iqsize - 1;
52: vbm.data = VSAddr->bitmap;
53: vbm.width = VSAddr->max_x;
54: vbm.height = VSAddr->max_y;
55: pbm.data = VSAddr->bitmap;
56: pbm.width = 1024;
57: pbm.height = VSAddr->max_y;
58: for(i = 0; i < YSIZE; i++) ltable[i] = VSAddr->bitmap + (i * XSIZE);
59: info->id = XDEV_QVSS;
60: info->width = vbm.width;
61: info->height = vbm.height;
62: info->planes = 1;
63: info->entries = 0;
64: info->mouse = &VSAddr->mouse;
65: info->mbox = &VSAddr->mbox;
66: info->queue = (vsEventQueue *) &VSAddr->ibuff;
67: return (0);
68: }
69:
70: /* Check if display is dead */
71:
72: DisplayDead ()
73: {
74: return(0);
75: }
76:
77: /* the presumption here is that only one Allocate_space call is made/request */
78:
79: #define ABUFSIZE 3072
80: static char ABuffer[3072]; /* random size buffer for allocate space */
81: caddr_t AllocateSpace (size)
82: register int size;
83: {
84: if (size < ABUFSIZE) return(ABuffer);
85: errno = ENOMEM;
86: return (NULL);
87: }
Defined functions
Defined variables
pbm
defined in line
24; used 3 times
vbm
defined in line
25; used 5 times
vsdev
defined in line
28; used 11 times
Defined macros