Annotation of sys/dev/wscons/wsdisplayvar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: wsdisplayvar.h,v 1.22 2006/12/02 11:25:09 miod Exp $ */
! 2: /* $NetBSD: wsdisplayvar.h,v 1.30 2005/02/04 02:10:49 perry Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: * 3. All advertising materials mentioning features or use of this software
! 16: * must display the following acknowledgement:
! 17: * This product includes software developed by Christopher G. Demetriou
! 18: * for the NetBSD Project.
! 19: * 4. The name of the author may not be used to endorse or promote products
! 20: * derived from this software without specific prior written permission
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 32: */
! 33:
! 34: struct device;
! 35:
! 36: /*
! 37: * WSDISPLAY interfaces
! 38: */
! 39:
! 40: #define WSDISPLAY_MAXSCREEN 12
! 41: #define WSDISPLAY_MAXFONT 8
! 42:
! 43: /*
! 44: * Emulation functions, for displays that can support glass-tty terminal
! 45: * emulations. These are character oriented, with row and column
! 46: * numbers starting at zero in the upper left hand corner of the
! 47: * screen.
! 48: *
! 49: * These are used only when emulating a terminal. Therefore, displays
! 50: * drivers which cannot emulate terminals do not have to provide them.
! 51: *
! 52: * There is a "void *" cookie provided by the display driver associated
! 53: * with these functions, which is passed to them when they are invoked.
! 54: */
! 55: struct wsdisplay_emulops {
! 56: void (*cursor)(void *c, int on, int row, int col);
! 57: int (*mapchar)(void *, int, unsigned int *);
! 58: void (*putchar)(void *c, int row, int col, u_int uc, long attr);
! 59: void (*copycols)(void *c, int row, int srccol, int dstcol,
! 60: int ncols);
! 61: void (*erasecols)(void *c, int row, int startcol, int ncols, long);
! 62: void (*copyrows)(void *c, int srcrow, int dstrow, int nrows);
! 63: void (*eraserows)(void *c, int row, int nrows, long attr);
! 64: int (*alloc_attr)(void *c, int fg, int bg, int flags, long *attrp);
! 65: void (*unpack_attr)(void *c, long attr, int *fg, int *bg, int *ul);
! 66: /* fg / bg values. Made identical to ANSI terminal color codes. */
! 67: #define WSCOL_BLACK 0
! 68: #define WSCOL_RED 1
! 69: #define WSCOL_GREEN 2
! 70: #define WSCOL_BROWN 3
! 71: #define WSCOL_BLUE 4
! 72: #define WSCOL_MAGENTA 5
! 73: #define WSCOL_CYAN 6
! 74: #define WSCOL_WHITE 7
! 75: /* flag values: */
! 76: #define WSATTR_REVERSE 1
! 77: #define WSATTR_HILIT 2
! 78: #define WSATTR_BLINK 4
! 79: #define WSATTR_UNDERLINE 8
! 80: #define WSATTR_WSCOLORS 16
! 81: /* XXX need a free_attr() ??? */
! 82: };
! 83:
! 84: #define WSSCREEN_NAME_SIZE 16
! 85:
! 86: struct wsscreen_descr {
! 87: char name[WSSCREEN_NAME_SIZE];
! 88: int ncols, nrows;
! 89: const struct wsdisplay_emulops *textops;
! 90: int fontwidth, fontheight;
! 91: int capabilities;
! 92: #define WSSCREEN_WSCOLORS 1 /* minimal color capability */
! 93: #define WSSCREEN_REVERSE 2 /* can display reversed */
! 94: #define WSSCREEN_HILIT 4 /* can highlight (however) */
! 95: #define WSSCREEN_BLINK 8 /* can blink */
! 96: #define WSSCREEN_UNDERLINE 16 /* can underline */
! 97: };
! 98:
! 99: /*
! 100: * Character cell description (for emulation mode).
! 101: */
! 102: struct wsdisplay_charcell {
! 103: u_int uc;
! 104: long attr;
! 105: };
! 106:
! 107: struct wsdisplay_font;
! 108: /*
! 109: * Display access functions, invoked by user-land programs which require
! 110: * direct device access, such as X11.
! 111: *
! 112: * There is a "void *" cookie provided by the display driver associated
! 113: * with these functions, which is passed to them when they are invoked.
! 114: */
! 115: struct wsdisplay_accessops {
! 116: int (*ioctl)(void *v, u_long cmd, caddr_t data, int flag,
! 117: struct proc *p);
! 118: paddr_t (*mmap)(void *v, off_t off, int prot);
! 119: int (*alloc_screen)(void *, const struct wsscreen_descr *,
! 120: void **, int *, int *, long *);
! 121: void (*free_screen)(void *, void *);
! 122: int (*show_screen)(void *, void *, int,
! 123: void (*) (void *, int, int), void *);
! 124: int (*load_font)(void *, void *, struct wsdisplay_font *);
! 125: void (*scrollback)(void *, void *, int);
! 126: int (*getchar)(void *, int, int, struct wsdisplay_charcell *);
! 127: void (*burn_screen)(void *, u_int, u_int);
! 128: void (*pollc)(void *, int);
! 129: };
! 130:
! 131: /* passed to wscons by the video driver to tell about its capabilities */
! 132: struct wsscreen_list {
! 133: int nscreens;
! 134: const struct wsscreen_descr **screens;
! 135: };
! 136:
! 137: /*
! 138: * Attachment information provided by wsemuldisplaydev devices when attaching
! 139: * wsdisplay units.
! 140: */
! 141: struct wsemuldisplaydev_attach_args {
! 142: int console; /* is it console? */
! 143: const struct wsscreen_list *scrdata; /* screen cfg info */
! 144: const struct wsdisplay_accessops *accessops; /* access ops */
! 145: void *accesscookie; /* access cookie */
! 146: u_int defaultscreens; /* screens to create */
! 147: };
! 148:
! 149: #define WSEMULDISPLAYDEVCF_CONSOLE 0
! 150: #define wsemuldisplaydevcf_console cf_loc[WSEMULDISPLAYDEVCF_CONSOLE] /* spec'd as console? */
! 151: #define WSEMULDISPLAYDEVCF_CONSOLE_UNK -1
! 152: #define WSDISPLAYDEVCF_MUX 0
! 153: #define wsdisplaydevcf_mux cf_loc[WSDISPLAYDEVCF_MUX]
! 154: #define WSEMULDISPLAYDEVCF_MUX 1
! 155: #define wsemuldisplaydevcf_mux cf_loc[WSEMULDISPLAYDEVCF_MUX]
! 156:
! 157: struct wscons_syncops {
! 158: int (*detach)(void *, int, void (*)(void *, int, int), void *);
! 159: int (*attach)(void *, int, void (*)(void *, int, int), void *);
! 160: int (*check)(void *);
! 161: void (*destroy)(void *);
! 162: };
! 163:
! 164: /*
! 165: * Autoconfiguration helper functions.
! 166: */
! 167: void wsdisplay_cnattach(const struct wsscreen_descr *, void *,
! 168: int, int, long);
! 169: int wsemuldisplaydevprint(void *, const char *);
! 170:
! 171: /*
! 172: * Console interface.
! 173: */
! 174: void wsdisplay_cnputc(dev_t dev, int i);
! 175:
! 176: /*
! 177: * for use by compatibility code
! 178: */
! 179: struct wsdisplay_softc;
! 180: struct wsscreen;
! 181: int wsscreen_attach_sync(struct wsscreen *,
! 182: const struct wscons_syncops *, void *);
! 183: int wsscreen_detach_sync(struct wsscreen *);
! 184: int wsscreen_lookup_sync(struct wsscreen *,
! 185: const struct wscons_syncops *, void **);
! 186:
! 187: int wsdisplay_maxscreenidx(struct wsdisplay_softc *);
! 188: int wsdisplay_screenstate(struct wsdisplay_softc *, int);
! 189: int wsdisplay_getactivescreen(struct wsdisplay_softc *);
! 190: int wsscreen_switchwait(struct wsdisplay_softc *, int);
! 191:
! 192: int wsdisplay_internal_ioctl(struct wsdisplay_softc *sc,
! 193: struct wsscreen *,
! 194: u_long cmd, caddr_t data,
! 195: int flag, struct proc *p);
! 196:
! 197: int wsdisplay_usl_ioctl1(struct wsdisplay_softc *,
! 198: u_long, caddr_t, int, struct proc *);
! 199:
! 200: int wsdisplay_usl_ioctl2(struct wsdisplay_softc *, struct wsscreen *,
! 201: u_long, caddr_t, int, struct proc *);
! 202:
! 203: int wsdisplay_cfg_ioctl(struct wsdisplay_softc *sc,
! 204: u_long cmd, caddr_t data,
! 205: int flag, struct proc *p);
! 206:
! 207: /*
! 208: * for general use
! 209: */
! 210: #define WSDISPLAY_NULLSCREEN -1
! 211: void wsdisplay_switchtoconsole(void);
! 212: const struct wsscreen_descr *
! 213: wsdisplay_screentype_pick(const struct wsscreen_list *, const char *);
! 214:
! 215: /*
! 216: * for use by wskbd
! 217: */
! 218: void wsdisplay_burn(void *v, u_int flags);
! 219: void wsscrollback(void *v, int op);
! 220:
! 221: #define WSDISPLAY_SCROLL_BACKWARD 0
! 222: #define WSDISPLAY_SCROLL_FORWARD 1
! 223: #define WSDISPLAY_SCROLL_RESET 2
! 224:
! 225: /*
! 226: * screen burner
! 227: */
! 228: #define WSDISPLAY_DEFBURNOUT 600000 /* ms */
! 229: #define WSDISPLAY_DEFBURNIN 250 /* ms */
! 230:
CVSweb