Optimize andes_clear_page() and andes_copy_page() with prefetch
[linux-2.6/linux-mips.git] / include / asm-mips64 / shmiq.h
blobcbce272121f0dd42c235ab8c17bee6972d16b9ca
1 /* $Id$
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
7 * Please note that the comments on this file may be out of date
8 * and that they represent what I have figured about the shmiq device
9 * so far in IRIX.
11 * This also contains some streams and idev bits.
13 * They may contain errors, please, refer to the source code of the Linux
14 * kernel for a definitive answer on what we have implemented
16 * Miguel.
18 #ifndef _ASM_SHMIQ_H
19 #define _ASM_SHMIQ_H
21 /* STREAMs ioctls */
22 #define STRIOC ('S' << 8)
23 #define I_STR (STRIOC | 010)
24 #define I_PUSH (STRIOC | 02)
25 #define I_LINK (STRIOC | 014)
26 #define I_UNLINK (STRIOC | 015)
28 /* Data structure passed on I_STR ioctls */
29 struct strioctl {
30 int ic_cmd; /* streams ioctl command */
31 int ic_timout; /* timeout */
32 int ic_len; /* lenght of data */
33 void *ic_dp; /* data */
37 * For mapping the shared memory input queue, you have to:
39 * 1. Map /dev/zero for the number of bytes you want to use
40 * for your shared memory input queue plus the size of the
41 * sharedMemoryInputQueue structure + 4 (I still have not figured
42 * what this one is for
44 * 2. Open /dev/shmiq
46 * 3. Open /dev/qcntlN N is [0..Nshmiqs]
48 * 4. Fill a shmiqreq structure. user_vaddr should point to the return
49 * address from the /dev/zero mmap. Arg is the number of shmqevents
50 * that fit into the /dev/zero region (remember that at the beginning there
51 * is a sharedMemoryInputQueue header).
53 * 5. Issue the ioctl (qcntlfd, QIOCATTACH, &your_shmiqreq);
56 struct shmiqreq {
57 char *user_vaddr;
58 int arg;
61 /* map the shmiq into the process address space */
62 #define QIOCATTACH _IOW('Q',1,struct shmiqreq)
64 /* remove mappings */
65 #define QIOCDETACH _IO('Q',2)
68 * A shared memory input queue event.
70 struct shmqdata {
71 unsigned char device; /* device major */
72 unsigned char which; /* device minor */
73 unsigned char type; /* event type */
74 unsigned char flags; /* little event data */
75 union {
76 int pos; /* big event data */
77 short ptraxis [2]; /* event data for PTR events */
78 } un;
81 /* indetifies the shmiq and the device */
82 struct shmiqlinkid {
83 short int devminor;
84 short int index;
87 struct shmqevent {
88 union {
89 int time;
90 struct shmiqlinkid id;
91 } un ;
92 struct shmqdata data ;
96 * sharedMemoryInputQueue: this describes the shared memory input queue.
98 * head is the user index into the events, user can modify this one.
99 * tail is managed by the kernel.
100 * flags is one of SHMIQ_OVERFLOW or SHMIQ_CORRUPTED
101 * if OVERFLOW is set it seems ioctl QUIOCSERVICED should be called
102 * to notify the kernel.
103 * events where the kernel sticks the events.
105 struct sharedMemoryInputQueue {
106 volatile int head; /* user's index into events */
107 volatile int tail; /* kernel's index into events */
108 volatile unsigned int flags; /* place for out-of-band data */
109 #define SHMIQ_OVERFLOW 1
110 #define SHMIQ_CORRUPTED 2
111 struct shmqevent events[1]; /* input event buffer */
114 /* have to figure this one out */
115 #define QIOCGETINDX _IOWR('Q', 8, int)
118 /* acknowledge shmiq overflow */
119 #define QIOCSERVICED _IO('Q', 3)
121 /* Double indirect I_STR ioctl, yeah, fun fun fun */
123 struct muxioctl {
124 int index; /* lower stream index */
125 int realcmd; /* the actual command for the subdevice */
127 /* Double indirect ioctl */
128 #define QIOCIISTR _IOW('Q', 7, struct muxioctl)
130 /* Cursor ioclts: */
132 /* set cursor tracking mode */
133 #define QIOCURSTRK _IOW('Q', 4, int)
135 /* set cursor filter box */
136 #define QIOCURSIGN _IOW('Q', 5, int [4])
138 /* set cursor axes */
139 struct shmiqsetcurs {
140 short index;
141 short axes;
144 #define QIOCSETCURS _IOWR('Q', 9, struct shmiqsetcurs)
146 /* set cursor position */
147 struct shmiqsetcpos {
148 short x;
149 short y;
151 #define QIOCSETCPOS _IOWR('Q', 10, struct shmiqsetcpos)
153 /* get time since last event */
154 #define QIOCGETITIME _IOR('Q', 11, time_t)
156 /* set curent screen */
157 #define QIOCSETSCRN _IOW('Q',6,int)
160 /* -------------------- iDev stuff -------------------- */
162 #define IDEV_MAX_NAME_LEN 15
163 #define IDEV_MAX_TYPE_LEN 15
165 typedef struct {
166 char devName[IDEV_MAX_NAME_LEN+1];
167 char devType[IDEV_MAX_TYPE_LEN+1];
168 unsigned short nButtons;
169 unsigned short nValuators;
170 unsigned short nLEDs;
171 unsigned short nStrDpys;
172 unsigned short nIntDpys;
173 unsigned char nBells;
174 unsigned char flags;
175 #define IDEV_HAS_KEYMAP 0x01
176 #define IDEV_HAS_PROXIMITY 0x02
177 #define IDEV_HAS_PCKBD 0x04
178 } idevDesc;
180 typedef struct {
181 char *nothing_for_now;
182 } idevInfo;
184 #define IDEV_KEYMAP_NAME_LEN 15
186 typedef struct {
187 char name[IDEV_KEYMAP_NAME_LEN+1];
188 } idevKeymapDesc;
190 /* The valuator definition */
191 typedef struct {
192 unsigned hwMinRes;
193 unsigned hwMaxRes;
194 int hwMinVal;
195 int hwMaxVal;
197 unsigned char possibleModes;
198 #define IDEV_ABSOLUTE 0x0
199 #define IDEV_RELATIVE 0x1
200 #define IDEV_EITHER 0x2
202 unsigned char mode; /* One of: IDEV_ABSOLUTE, IDEV_RELATIVE */
204 unsigned short resolution;
205 int minVal;
206 int maxVal;
207 } idevValuatorDesc;
209 /* This is used to query a specific valuator with the IDEVGETVALUATORDESC ioctl */
210 typedef struct {
211 short valNum;
212 unsigned short flags;
213 idevValuatorDesc desc;
214 } idevGetSetValDesc;
216 #define IDEVGETDEVICEDESC _IOWR('i', 0, idevDesc)
217 #define IDEVGETVALUATORDESC _IOWR('i', 1, idevGetSetValDesc)
218 #define IDEVGETKEYMAPDESC _IOWR('i', 2, idevKeymapDesc)
219 #define IDEVINITDEVICE _IOW ('i', 51, unsigned int)
222 #ifdef __KERNEL__
224 /* These are only interpreted by SHMIQ-attacheable devices and are internal
225 * to the kernel
227 #define SHMIQ_OFF _IO('Q',1)
228 #define SHMIQ_ON _IO('Q',2)
230 void shmiq_push_event (struct shmqevent *e);
231 int get_sioc (struct strioctl *sioc, unsigned long arg);
232 #endif
234 #endif /* _ASM_SHMIQ_H */