/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Set event struct version */
#define WSKBDIO_SETVERSION _IOW('W', 25, int)
#define WSKBDIO_EVENT_VERSION WSEVENT_VERSION
/*
* Mouse ioctls (32 - 63)
*/
/* Get mouse type */
#define WSMOUSEIO_GTYPE _IOR('W', 32, u_int)
#define WSMOUSE_TYPE_VSXXX 1 /* DEC serial */
#define WSMOUSE_TYPE_PS2 2 /* PS/2-compatible */
#define WSMOUSE_TYPE_USB 3 /* USB mouse */
#define WSMOUSE_TYPE_LMS 4 /* Logitech busmouse */
#define WSMOUSE_TYPE_MMS 5 /* Microsoft InPort mouse */
#define WSMOUSE_TYPE_TPANEL 6 /* Generic Touch Panel */
#define WSMOUSE_TYPE_NEXT 7 /* NeXT mouse */
#define WSMOUSE_TYPE_ARCHIMEDES 8 /* Archimedes mouse */
#define WSMOUSE_TYPE_HIL 9 /* HIL mouse */
#define WSMOUSE_TYPE_AMIGA 10 /* Amiga mouse */
#define WSMOUSE_TYPE_MAXINE 11 /* DEC maxine mouse */
#define WSMOUSE_TYPE_MAPLE 12 /* Dreamcast Maple mouse */
#define WSMOUSE_TYPE_SGI 13 /* SGI mouse */
#define WSMOUSE_TYPE_BLUETOOTH 14 /* Bluetooth mouse */
#define WSMOUSE_TYPE_ADB 15 /* ADB mouse or touchpad */
#define WSMOUSE_TYPE_PSEUDO 16 /* not actually a mouse */
/* Set resolution. Not applicable to all mouse types. */
#define WSMOUSEIO_SRES _IOW('W', 33, u_int)
#define WSMOUSE_RES_MIN 0
#define WSMOUSE_RES_DEFAULT 75
#define WSMOUSE_RES_MAX 100
/* Set scale factor (num / den). Not applicable to all mouse types. */
#define WSMOUSEIO_SSCALE _IOW('W', 34, u_int[2])
/* Set sample rate. Not applicable to all mouse types. */
#define WSMOUSEIO_SRATE _IOW('W', 35, u_int)
#define WSMOUSE_RATE_MIN 0
#define WSMOUSE_RATE_DEFAULT 50
#define WSMOUSE_RATE_MAX 100
/* Set/get sample coordinates for calibration */
#define WSMOUSE_CALIBCOORDS_MAX 16
#define WSMOUSE_CALIBCOORDS_RESET -1
struct wsmouse_calibcoords {
int minx, miny; /* minimum value of X/Y */
int maxx, maxy; /* maximum value of X/Y */
int samplelen; /* number of samples available or
WSMOUSE_CALIBCOORDS_RESET for raw mode */
struct wsmouse_calibcoord {
int rawx, rawy; /* raw coordinate */
int x, y; /* translated coordinate */
} samples[WSMOUSE_CALIBCOORDS_MAX]; /* sample coordinates */
};
#define WSMOUSEIO_SCALIBCOORDS _IOW('W', 36, struct wsmouse_calibcoords)
#define WSMOUSEIO_GCALIBCOORDS _IOR('W', 37, struct wsmouse_calibcoords)
/* get device id for calibration */
struct wsmouse_id {
u_int type;
#define WSMOUSE_ID_TYPE_UIDSTR 0 /* ID string (null terminated) */
u_int length;
#define WSMOUSE_ID_MAXLEN 256
u_char data[WSMOUSE_ID_MAXLEN];
};
#define WSMOUSEIO_GETID _IOWR('W', 38, struct wsmouse_id)
/* Get/set button repeating. */
struct wsmouse_repeat {
unsigned long wr_buttons;
unsigned int wr_delay_first;
unsigned int wr_delay_decrement;
unsigned int wr_delay_minimum;
};
#define WSMOUSEIO_GETREPEAT _IOR('W', 39, struct wsmouse_repeat)
#define WSMOUSEIO_SETREPEAT _IOW('W', 40, struct wsmouse_repeat)
/* Basic display information. Not applicable to all display types. */
struct wsdisplay_fbinfo {
u_int height; /* height in pixels */
u_int width; /* width in pixels */
u_int depth; /* bits per pixel */
u_int cmsize; /* color map size (entries) */
};
#define WSDISPLAYIO_GINFO _IOR('W', 65, struct wsdisplay_fbinfo)
/* Colormap operations. Not applicable to all display types. */
struct wsdisplay_cmap {
u_int index; /* first element (0 origin) */
u_int count; /* number of elements */
u_char *red; /* red color map elements */
u_char *green; /* green color map elements */
u_char *blue; /* blue color map elements */
};
#define WSDISPLAYIO_GETCMAP _IOW('W', 66, struct wsdisplay_cmap)
#define WSDISPLAYIO_PUTCMAP _IOW('W', 67, struct wsdisplay_cmap)
/* Video control. Not applicable to all display types. */
#define WSDISPLAYIO_GVIDEO _IOR('W', 68, u_int)
#define WSDISPLAYIO_SVIDEO _IOW('W', 69, u_int)
#define WSDISPLAYIO_VIDEO_OFF 0 /* video off */
#define WSDISPLAYIO_VIDEO_ON 1 /* video on */
/* Cursor control. Not applicable to all display types. */
struct wsdisplay_curpos { /* cursor "position" */
u_int x, y;
};
struct wsdisplay_cursor {
u_int which; /* values to get/set */
#define WSDISPLAY_CURSOR_DOCUR 0x01 /* get/set enable */
#define WSDISPLAY_CURSOR_DOPOS 0x02 /* get/set pos */
#define WSDISPLAY_CURSOR_DOHOT 0x04 /* get/set hot spot */
#define WSDISPLAY_CURSOR_DOCMAP 0x08 /* get/set cmap */
#define WSDISPLAY_CURSOR_DOSHAPE 0x10 /* get/set img/mask */
#define WSDISPLAY_CURSOR_DOALL 0x1f /* all of the above */
u_int enable; /* enable/disable */
struct wsdisplay_curpos pos; /* position */
struct wsdisplay_curpos hot; /* hot spot */
struct wsdisplay_cmap cmap; /* color map info */
struct wsdisplay_curpos size; /* bit map size */
u_char *image; /* image data */
u_char *mask; /* mask data */
};
/* Cursor control: get and set position */
#define WSDISPLAYIO_GCURPOS _IOR('W', 70, struct wsdisplay_curpos)
#define WSDISPLAYIO_SCURPOS _IOW('W', 71, struct wsdisplay_curpos)
/* Cursor control: get maximum size */
#define WSDISPLAYIO_GCURMAX _IOR('W', 72, struct wsdisplay_curpos)
/* Obsolete, replaced by WSMUXIO_{ADD,REMOVE}_DEVICE */
struct wsdisplay_kbddata {
int op;
#define _O_WSDISPLAY_KBD_ADD 0
#define _O_WSDISPLAY_KBD_DEL 1
int idx;
};
#define _O_WSDISPLAYIO_SETKEYBOARD _IOWR('W', 81, struct wsdisplay_kbddata)
/*
* Misc control. Not applicable to all display types.
* - WSDISPLAYIO_PARAM_BACKLIGHT should be an on/off switch for screensavers,
* it should turn the display dark / turn the backlight off without changing
* the brightness value so screensavers and such can just flip the switch
* without caring about actual brightness settings
* - WSDISPLAYIO_PARAM_BRIGHTNESS should set display / backlight brightness
*/
struct wsdisplay_param {
int param;
#define WSDISPLAYIO_PARAM_BACKLIGHT 1
#define WSDISPLAYIO_PARAM_BRIGHTNESS 2
#define WSDISPLAYIO_PARAM_CONTRAST 3
int min, max, curval;
int reserved[4];
};
#define WSDISPLAYIO_GETPARAM _IOWR('W', 82, struct wsdisplay_param)
#define WSDISPLAYIO_SETPARAM _IOWR('W', 83, struct wsdisplay_param)
/*
* retrieving EDID data from a wsdisplay driver
* The EDID block will be written into a buffer pointed at by edid_data,
* the caller must fill in buffer_size and edid_data, the driver will set
* data_size to the number of bytes actually written.
* If the buffer is too small the call will fail with EAGAIN and the driver
* will set data_size without writing anything into the buffer.
*/
/*
* this is for enabling and disabling interrupt-driven drawing
* pass 1 to enable polling, 0 to go back to normal
* the kernel itself will call this on the console device when entering or
* leaving ddb and on panic
* may have side effects like hard switching to the virtual console which
* shows kernel output, resetting the video hardware etc. - not really for
* userland to mess with
*/
#define WSDISPLAYIO_SET_POLLING _IOW('W', 103, int)
#define WSDISPLAYIOMGWEHITANDKILLEDASKUNK WSDISPLAYIO_SET_POLLING
/*
* this is supposed to replace WSDISPLAYIO_GINFO, WSDISPLAYIO_GTYPE,
* WSDISPLAYIO_LINEBYTES etc.
*/
/* format type - colour index, 'true' colour etc. */
#define WSFB_RGB 0
#define WSFB_CI 1 /* colour indexed, see subtype */
#define WSFB_GREYSCALE 2
#define WSFB_YUV 3
#define WSFB_YUY2 4
struct wsdisplayio_fbinfo {
uint64_t fbi_fbsize; /* framebuffer size in bytes */
uint64_t fbi_fboffset; /* start of visible fb, in bytes */
uint32_t fbi_width; /* in pixels */
uint32_t fbi_height; /* in lines */
uint32_t fbi_stride; /* in bytes */
uint32_t fbi_bitsperpixel;
uint32_t fbi_pixeltype; /* see above */
union _fbi_subtype {
struct _fbi_rgbmasks {
/* offsets from the right, size in bits */
uint32_t red_offset;
uint32_t red_size;
uint32_t green_offset;
uint32_t green_size;
uint32_t blue_offset;
uint32_t blue_size;
uint32_t alpha_offset;
uint32_t alpha_size;
} fbi_rgbmasks;
struct _fbi_cmapinfo {
uint32_t cmap_entries;
} fbi_cmapinfo;
/*
* TODO:
* add parameter blocks for greyscale, yuv etc.
*/
} fbi_subtype;
uint32_t fbi_flags;
};
/* fbi_flags */
#define WSFB_VRAM_IS_RAM 0x0001 /* hint for wsfb - don't shadow */
#define WSFB_VRAM_IS_SPLIT 0x0002 /* workaround for wildcat... */
/*
* fill buffer pointed at by fi_fonts with wsdisplayio_fontdesc until either
* full or all fonts are listed
* just return the number of entries needed if fi_fonts is NULL
*/
/*
* return currently active font
*
* gf_name points to a buffer of gf_size bytes, the result may be truncated
* and NUL-terminated.
* gf_actual is set to the size of full name.
*/