Import 2.3.18pre1
[davej-history.git] / include / asm-mips / shmiq.h
blob931aeeacc572f993e819f7e00f014ee43fb358dc
1 /*
2 * Please note that the comments on this file may be out of date
3 * and that they represent what I have figured about the shmiq device
4 * so far in IRIX.
6 * This also contains some streams and idev bits.
8 * They may contain errors, please, refer to the source code of the Linux
9 * kernel for a definitive answer on what we have implemented
11 * Miguel.
14 /* STREAMs ioctls */
15 #define STRIOC ('S' << 8)
16 #define I_STR (STRIOC | 010)
17 #define I_PUSH (STRIOC | 02)
18 #define I_LINK (STRIOC | 014)
19 #define I_UNLINK (STRIOC | 015)
21 /* Data structure passed on I_STR ioctls */
22 struct strioctl {
23 int ic_cmd; /* streams ioctl command */
24 int ic_timout; /* timeout */
25 int ic_len; /* lenght of data */
26 void *ic_dp; /* data */
30 * For mapping the shared memory input queue, you have to:
32 * 1. Map /dev/zero for the number of bytes you want to use
33 * for your shared memory input queue plus the size of the
34 * sharedMemoryInputQueue structure + 4 (I still have not figured
35 * what this one is for
37 * 2. Open /dev/shmiq
39 * 3. Open /dev/qcntlN N is [0..Nshmiqs]
41 * 4. Fill a shmiqreq structure. user_vaddr should point to the return
42 * address from the /dev/zero mmap. Arg is the number of shmqevents
43 * that fit into the /dev/zero region (remember that at the beginning there
44 * is a sharedMemoryInputQueue header).
46 * 5. Issue the ioctl (qcntlfd, QIOCATTACH, &your_shmiqreq);
49 struct shmiqreq {
50 char *user_vaddr;
51 int arg;
54 /* map the shmiq into the process address space */
55 #define QIOCATTACH _IOW('Q',1,struct shmiqreq)
57 /* remove mappings */
58 #define QIOCDETACH _IO('Q',2)
61 * A shared memory input queue event.
63 struct shmqdata {
64 unsigned char device; /* device major */
65 unsigned char which; /* device minor */
66 unsigned char type; /* event type */
67 unsigned char flags; /* little event data */
68 union {
69 int pos; /* big event data */
70 short ptraxis [2]; /* event data for PTR events */
71 } un;
74 /* indetifies the shmiq and the device */
75 struct shmiqlinkid {
76 short int devminor;
77 short int index;
80 struct shmqevent {
81 union {
82 int time;
83 struct shmiqlinkid id;
84 } un ;
85 struct shmqdata data ;
89 * sharedMemoryInputQueue: this describes the shared memory input queue.
91 * head is the user index into the events, user can modify this one.
92 * tail is managed by the kernel.
93 * flags is one of SHMIQ_OVERFLOW or SHMIQ_CORRUPTED
94 * if OVERFLOW is set it seems ioctl QUIOCSERVICED should be called
95 * to notify the kernel.
96 * events where the kernel sticks the events.
98 struct sharedMemoryInputQueue {
99 volatile int head; /* user's index into events */
100 volatile int tail; /* kernel's index into events */
101 volatile unsigned int flags; /* place for out-of-band data */
102 #define SHMIQ_OVERFLOW 1
103 #define SHMIQ_CORRUPTED 2
104 struct shmqevent events[1]; /* input event buffer */
107 /* have to figure this one out */
108 #define QIOCGETINDX _IOWR('Q', 8, int)
111 /* acknowledge shmiq overflow */
112 #define QIOCSERVICED _IO('Q', 3)
114 /* Double indirect I_STR ioctl, yeah, fun fun fun */
116 struct muxioctl {
117 int index; /* lower stream index */
118 int realcmd; /* the actual command for the subdevice */
120 /* Double indirect ioctl */
121 #define QIOCIISTR _IOW('Q', 7, struct muxioctl)
123 /* Cursor ioclts: */
125 /* set cursor tracking mode */
126 #define QIOCURSTRK _IOW('Q', 4, int)
128 /* set cursor filter box */
129 #define QIOCURSIGN _IOW('Q', 5, int [4])
131 /* set cursor axes */
132 struct shmiqsetcurs {
133 short index;
134 short axes;
137 #define QIOCSETCURS _IOWR('Q', 9, struct shmiqsetcurs)
139 /* set cursor position */
140 struct shmiqsetcpos {
141 short x;
142 short y;
144 #define QIOCSETCPOS _IOWR('Q', 10, struct shmiqsetcpos)
146 /* get time since last event */
147 #define QIOCGETITIME _IOR('Q', 11, time_t)
149 /* set curent screen */
150 #define QIOCSETSCRN _IOW('Q',6,int)
153 /* -------------------- iDev stuff -------------------- */
155 #define IDEV_MAX_NAME_LEN 15
156 #define IDEV_MAX_TYPE_LEN 15
158 typedef struct {
159 char devName[IDEV_MAX_NAME_LEN+1];
160 char devType[IDEV_MAX_TYPE_LEN+1];
161 unsigned short nButtons;
162 unsigned short nValuators;
163 unsigned short nLEDs;
164 unsigned short nStrDpys;
165 unsigned short nIntDpys;
166 unsigned char nBells;
167 unsigned char flags;
168 #define IDEV_HAS_KEYMAP 0x01
169 #define IDEV_HAS_PROXIMITY 0x02
170 #define IDEV_HAS_PCKBD 0x04
171 } idevDesc;
173 typedef struct {
174 char *nothing_for_now;
175 } idevInfo;
177 #define IDEV_KEYMAP_NAME_LEN 15
179 typedef struct {
180 char name[IDEV_KEYMAP_NAME_LEN+1];
181 } idevKeymapDesc;
183 /* The valuator definition */
184 typedef struct {
185 unsigned hwMinRes;
186 unsigned hwMaxRes;
187 int hwMinVal;
188 int hwMaxVal;
190 unsigned char possibleModes;
191 #define IDEV_ABSOLUTE 0x0
192 #define IDEV_RELATIVE 0x1
193 #define IDEV_EITHER 0x2
195 unsigned char mode; /* One of: IDEV_ABSOLUTE, IDEV_RELATIVE */
197 unsigned short resolution;
198 int minVal;
199 int maxVal;
200 } idevValuatorDesc;
202 /* This is used to query a specific valuator with the IDEVGETVALUATORDESC ioctl */
203 typedef struct {
204 short valNum;
205 unsigned short flags;
206 idevValuatorDesc desc;
207 } idevGetSetValDesc;
209 #define IDEVGETDEVICEDESC _IOWR('i', 0, idevDesc)
210 #define IDEVGETVALUATORDESC _IOWR('i', 1, idevGetSetValDesc)
211 #define IDEVGETKEYMAPDESC _IOWR('i', 2, idevKeymapDesc)
212 #define IDEVINITDEVICE _IOW ('i', 51, unsigned int)
215 #ifdef __KERNEL__
217 /* These are only interpreted by SHMIQ-attacheable devices and are internal
218 * to the kernel
220 #define SHMIQ_OFF _IO('Q',1)
221 #define SHMIQ_ON _IO('Q',2)
223 void shmiq_push_event (struct shmqevent *e);
224 int get_sioc (struct strioctl *sioc, unsigned long arg);
225 #endif