diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-10-09 19:30:19 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-10-09 19:30:19 +0000 |
commit | 6d6684b48d2816da7e3e4106dbe3499763bbde22 (patch) | |
tree | c300957e7a9071df53f3482302f59c44a34b1577 /sys/dev | |
parent | 9f57ef5a6d6b46a4a8ffdea5f4855078e2135ec8 (diff) |
Nobody expects the spanish inquisition!
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/rcons/files.rcons | 9 | ||||
-rw-r--r-- | sys/dev/rcons/rcons.h | 124 | ||||
-rw-r--r-- | sys/dev/rcons/rcons_kern.c | 256 | ||||
-rw-r--r-- | sys/dev/rcons/rcons_subr.c | 598 | ||||
-rw-r--r-- | sys/dev/rcons/rcons_subr.h | 62 |
5 files changed, 0 insertions, 1049 deletions
diff --git a/sys/dev/rcons/files.rcons b/sys/dev/rcons/files.rcons deleted file mode 100644 index c12adc496e9..00000000000 --- a/sys/dev/rcons/files.rcons +++ /dev/null @@ -1,9 +0,0 @@ -# $OpenBSD: files.rcons,v 1.3 1997/11/07 08:07:37 niklas Exp $ -# $NetBSD: files.rcons,v 1.2 1996/04/11 21:54:38 cgd Exp $ -# -# Configuration file for RASTER Console. -# -file dev/rcons/raster_op.c rasterconsole | raster -file dev/rcons/raster_text.c rasterconsole | raster -file dev/rcons/rcons_kern.c rasterconsole -file dev/rcons/rcons_subr.c rasterconsole diff --git a/sys/dev/rcons/rcons.h b/sys/dev/rcons/rcons.h deleted file mode 100644 index b720c9bb680..00000000000 --- a/sys/dev/rcons/rcons.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $OpenBSD: rcons.h,v 1.4 2002/03/14 01:27:02 millert Exp $ */ -/* $NetBSD: rcons.h,v 1.4 1996/03/14 19:02:32 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - * - * @(#)fbvar.h 8.1 (Berkeley) 6/11/93 - */ - -#include <sys/timeout.h> -#include <dev/rcons/raster.h> - -struct rconsole { - /* Raster console emulator state */ - - /* This section must be filled in by the framebugger device */ - int rc_width; - int rc_height; - int rc_depth; - caddr_t rc_pixels; /* display RAM */ - int rc_linebytes; /* bytes per display line */ - int rc_maxrow; /* emulator height of screen */ - int rc_maxcol; /* emulator width of screen */ - void (*rc_bell)(int); /* ring the bell */ - /* The following two items may optionally be left zero */ - int *rc_row; /* emulator row */ - int *rc_col; /* emulator column */ - - /* Bits maintained by the raster routines */ - u_int rc_bits; /* see defines below */ - int rc_ringing; /* bell currently ringing */ - int rc_belldepth; /* audible bell depth */ - int rc_scroll; /* stupid sun scroll mode */ - - int rc_p0; /* escape sequence parameter 0 */ - int rc_p1; /* escape sequence parameter 1 */ - - int rc_emuwidth; /* emulator screen width */ - int rc_emuheight; /* emulator screen height */ - - int rc_xorigin; /* x origin for first column */ - int rc_yorigin; /* y origin for first row */ - - struct raster *rc_sp; /* frame buffer raster */ - struct raster *rc_cursor; /* optional cursor */ - int rc_ras_blank; /* current screen blank raster op */ - - struct raster_font *rc_font; /* font and related info */ - - struct timeout bell_timeout; -}; - -#define FB_INESC 0x001 /* processing an escape sequence */ -#define FB_STANDOUT 0x002 /* standout mode */ -#ifdef notyet -#define FB_BOLD 0x? /* boldface mode */ -#endif -#define FB_INVERT 0x008 /* white on black mode */ -#define FB_VISBELL 0x010 /* visual bell */ -#define FB_CURSOR 0x020 /* cursor is visible */ -#define FB_P0_DEFAULT 0x100 /* param 0 is defaulted */ -#define FB_P1_DEFAULT 0x200 /* param 1 is defaulted */ -#define FB_P0 0x400 /* working on param 0 */ -#define FB_P1 0x800 /* working on param 1 */ - - -/* rcons_kern.c */ -void rcons_cnputc(int); -void rcons_bell(struct rconsole *); -void rcons_init(struct rconsole *); - -/* rcons_subr.c */ -void rcons_puts(struct rconsole *, unsigned char *, int); -void rcons_text(struct rconsole *, unsigned char *, int); -void rcons_pctrl(struct rconsole *, int); -void rcons_esc(struct rconsole *, int); -void rcons_doesc(struct rconsole *, int); -void rcons_cursor(struct rconsole *); -void rcons_invert(struct rconsole *, int); -void rcons_clear2eop(struct rconsole *); -void rcons_clear2eol(struct rconsole *); -void rcons_scroll(struct rconsole *, int); -void rcons_delchar(struct rconsole *, int); -void rcons_delline(struct rconsole *, int); -void rcons_insertchar(struct rconsole *, int); -void rcons_insertline(struct rconsole *, int); diff --git a/sys/dev/rcons/rcons_kern.c b/sys/dev/rcons/rcons_kern.c deleted file mode 100644 index 96699ad016f..00000000000 --- a/sys/dev/rcons/rcons_kern.c +++ /dev/null @@ -1,256 +0,0 @@ -/* $OpenBSD: rcons_kern.c,v 1.6 2002/03/14 01:27:02 millert Exp $ */ -/* $NetBSD: rcons_kern.c,v 1.4 1996/03/14 19:02:33 christos Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - * - * @(#)rcons_kern.c 8.1 (Berkeley) 6/11/93 - */ - -#include <sys/param.h> -#include <sys/device.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <dev/rcons/raster.h> -#include <dev/rcons/rcons.h> - -extern struct tty *fbconstty; - -static void rcons_belltmr(void *); - -#include "rcons_subr.h" - -static struct rconsole *mydevicep; -static void rcons_output(struct tty *); - -void -rcons_cnputc(c) - int c; -{ - char buf[1]; - - if (c == '\n') - rcons_puts(mydevicep, "\r\n", 2); - else { - buf[0] = c; - rcons_puts(mydevicep, buf, 1); - } -} - -static void -rcons_output(tp) - register struct tty *tp; -{ - register int s, n; - char buf[OBUFSIZ]; - - s = spltty(); - if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) { - splx(s); - return; - } - tp->t_state |= TS_BUSY; - splx(s); - n = q_to_b(&tp->t_outq, buf, sizeof(buf)); - rcons_puts(mydevicep, buf, n); - - s = spltty(); - tp->t_state &= ~TS_BUSY; - /* Come back if there's more to do */ - if (tp->t_outq.c_cc) { - tp->t_state |= TS_TIMEOUT; - timeout_add(&tp->t_rstrt_to, 1); - } - if (tp->t_outq.c_cc <= tp->t_lowat) { - if (tp->t_state&TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_outq); - } - selwakeup(&tp->t_wsel); - } - splx(s); -} - -/* Ring the console bell */ -void -rcons_bell(rc) - register struct rconsole *rc; -{ - register int i, s; - - if (rc->rc_bits & FB_VISBELL) { - /* invert the screen twice */ - for (i = 0; i < 2; ++i) - raster_op(rc->rc_sp, 0, 0, - rc->rc_sp->width, rc->rc_sp->height, - RAS_INVERT, (struct raster *) 0, 0, 0); - } - - s = splhigh(); - if (rc->rc_belldepth++) { - if (rc->rc_belldepth > 3) - rc->rc_belldepth = 3; - splx(s); - } else { - rc->rc_ringing = 1; - splx(s); - (*rc->rc_bell)(1); - /* XXX Chris doesn't like the following divide */ - timeout_add(&rc->bell_timeout, hz / 10); - } -} - -/* Bell timer service routine */ -static void -rcons_belltmr(p) - void *p; -{ - register struct rconsole *rc = p; - register int s = splhigh(), i; - - if (rc->rc_ringing) { - rc->rc_ringing = 0; - i = --rc->rc_belldepth; - splx(s); - (*rc->rc_bell)(0); - if (i != 0) - /* XXX Chris doesn't like the following divide */ - timeout_add(&rc->bell_timeout, hz / 30); - } else { - rc->rc_ringing = 1; - splx(s); - (*rc->rc_bell)(1); - timeout_add(&rc->bell_timeout, hz / 10); - } -} - -void -rcons_init(rc) - register struct rconsole *rc; -{ - /* XXX this should go away */ - static struct raster xxxraster; - register struct raster *rp = rc->rc_sp = &xxxraster; - register struct winsize *ws; - register int i; - static int row, col; - - mydevicep = rc; - - /* XXX mostly duplicates of data in other places */ - rp->width = rc->rc_width; - rp->height = rc->rc_height; - rp->depth = rc->rc_depth; - if (rc->rc_linebytes & 0x3) { - printf("rcons_init: linebytes assumption botched (0x%x)\n", - rc->rc_linebytes); - return; - } - rp->linelongs = rc->rc_linebytes >> 2; - rp->pixels = (u_int32_t *)rc->rc_pixels; - - rc->rc_ras_blank = RAS_CLEAR; - - /* Impose upper bounds on rc_max{row,col} */ - i = rc->rc_height / rc->rc_font->height; - if (rc->rc_maxrow > i) - rc->rc_maxrow = i; - i = rc->rc_width / rc->rc_font->width; - if (rc->rc_maxcol > i) - rc->rc_maxcol = i; - - /* Let the system know how big the console is */ - ws = &fbconstty->t_winsize; - ws->ws_row = rc->rc_maxrow; - ws->ws_col = rc->rc_maxcol; - ws->ws_xpixel = rc->rc_width; - ws->ws_ypixel = rc->rc_height; - - /* Center emulator screen (but align x origin to 32 bits) */ - rc->rc_xorigin = - ((rc->rc_width - rc->rc_maxcol * rc->rc_font->width) / 2) & ~0x1f; - rc->rc_yorigin = - (rc->rc_height - rc->rc_maxrow * rc->rc_font->height) / 2; - - /* Emulator width and height used for scrolling */ - rc->rc_emuwidth = rc->rc_maxcol * rc->rc_font->width; - if (rc->rc_emuwidth & 0x1f) { - /* Pad to 32 bits */ - i = (rc->rc_emuwidth + 0x1f) & ~0x1f; - /* Make sure emulator width isn't too wide */ - if (rc->rc_xorigin + i <= rc->rc_width) - rc->rc_emuwidth = i; - } - rc->rc_emuheight = rc->rc_maxrow * rc->rc_font->height; - -#ifdef RASTERCONS_WONB - rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank); - rc->rc_bits |= FB_INVERT; -#endif - - if (rc->rc_row == NULL || rc->rc_col == NULL) { - /* - * No address passed; use private copies - * go to LL corner and scroll. - */ - rc->rc_row = &row; - rc->rc_col = &col; - row = rc->rc_maxrow; - col = 0; -#if 0 - rcons_clear2eop(rc); /* clear the display */ -#endif - rcons_scroll(rc, 1); - rcons_cursor(rc); /* and draw the initial cursor */ - } else { - /* Prom emulator cursor is currently visible */ - rc->rc_bits |= FB_CURSOR; - } - - timeout_set(&rc->bell_timeout, rcons_belltmr, rc); - - /* Initialization done; hook us up */ - fbconstty->t_oproc = rcons_output; - /*fbconstty->t_stop = (void (*)()) nullop;*/ -} diff --git a/sys/dev/rcons/rcons_subr.c b/sys/dev/rcons/rcons_subr.c deleted file mode 100644 index f4e05a1d5e3..00000000000 --- a/sys/dev/rcons/rcons_subr.c +++ /dev/null @@ -1,598 +0,0 @@ -/* $OpenBSD: rcons_subr.c,v 1.2 1997/11/07 08:07:40 niklas Exp $ */ -/* $NetBSD: rcons_subr.c,v 1.2 1995/10/04 23:57:26 pk Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - * - * @(#)rcons_subr.c 8.1 (Berkeley) 6/11/93 - */ - -#ifdef _KERNEL -#include <sys/param.h> -#include <sys/device.h> -#else -#include <sys/types.h> -#include "myfbdevice.h" -#endif - -#include <dev/rcons/rcons.h> -#include <dev/rcons/raster.h> - -#include "rcons_subr.h" - -extern void rcons_bell(struct rconsole *); - -#define RCONS_ISPRINT(c) ((((c) >= ' ') && ((c) <= '~')) || ((c) > 160)) -#define RCONS_ISDIGIT(c) ((c) >= '0' && (c) <= '9') - -/* Output (or at least handle) a string sent to the console */ -void -rcons_puts(rc, str, n) - register struct rconsole *rc; - register unsigned char *str; - register int n; -{ - register int c, i, j; - register unsigned char *cp; - - /* Jump scroll */ - /* XXX maybe this should be an option? */ - if ((rc->rc_bits & FB_INESC) == 0) { - /* Count newlines up to an escape sequence */ - i = 0; - j = 0; - for (cp = str; j++ < n && *cp != '\033'; ++cp) { - if (*cp == '\n') - ++i; - else if (*cp == '\013') - --i; - } - - /* Only jump scroll two or more rows */ - if (*rc->rc_row + i >= rc->rc_maxrow + 1) { - /* Erase the cursor (if necessary) */ - if (rc->rc_bits & FB_CURSOR) - rcons_cursor(rc); - - rcons_scroll(rc, i); - } - } - - /* Process characters */ - while (--n >= 0) { - c = *str; - if (c == '\033') { - /* Start an escape (perhaps aborting one in progress) */ - rc->rc_bits |= FB_INESC | FB_P0_DEFAULT | FB_P1_DEFAULT; - rc->rc_bits &= ~(FB_P0 | FB_P1); - - /* Most parameters default to 1 */ - rc->rc_p0 = rc->rc_p1 = 1; - } else if (rc->rc_bits & FB_INESC) { - rcons_esc(rc, c); - } else { - /* Erase the cursor (if necessary) */ - if (rc->rc_bits & FB_CURSOR) - rcons_cursor(rc); - - /* Display the character */ - if (RCONS_ISPRINT(c)) { - /* Try to output as much as possible */ - j = rc->rc_maxcol - (*rc->rc_col + 1); - if (j > n) - j = n; - for (i = 1; i < j && RCONS_ISPRINT(str[i]); ++i) - continue; - rcons_text(rc, str, i); - --i; - str += i; - n -= i; - } else - rcons_pctrl(rc, c); - } - ++str; - } - /* Redraw the cursor (if necessary) */ - if ((rc->rc_bits & FB_CURSOR) == 0) - rcons_cursor(rc); -} - -/* Actually write a string to the frame buffer */ -void -rcons_text(rc, str, n) - register struct rconsole *rc; - register unsigned char *str; - register int n; -{ - register int x, y, op; - - x = *rc->rc_col * rc->rc_font->width + rc->rc_xorigin; - y = *rc->rc_row * rc->rc_font->height + - rc->rc_font->ascent + rc->rc_yorigin; - op = RAS_SRC; - if (((rc->rc_bits & FB_STANDOUT) != 0) ^ - ((rc->rc_bits & FB_INVERT) != 0)) - op = RAS_NOT(op); - raster_textn(rc->rc_sp, x, y, op, rc->rc_font, str, n); - *rc->rc_col += n; - if (*rc->rc_col >= rc->rc_maxcol) { - *rc->rc_col = 0; - (*rc->rc_row)++; - } - if (*rc->rc_row >= rc->rc_maxrow) - rcons_scroll(rc, 1); -} - -/* Handle a control character sent to the console */ -void -rcons_pctrl(rc, c) - register struct rconsole *rc; - register int c; -{ - - switch (c) { - - case '\r': /* Carriage return */ - *rc->rc_col = 0; - break; - - case '\b': /* Backspace */ - if (*rc->rc_col > 0) - (*rc->rc_col)--; - break; - - case '\013': /* Vertical tab */ - if (*rc->rc_row > 0) - (*rc->rc_row)--; - break; - - case '\f': /* Formfeed */ - *rc->rc_row = *rc->rc_col = 0; - rcons_clear2eop(rc); - break; - - case '\n': /* Linefeed */ - (*rc->rc_row)++; - if (*rc->rc_row >= rc->rc_maxrow) - rcons_scroll(rc, 1); - break; - - case '\007': /* Bell */ - rcons_bell(rc); - break; - - case '\t': /* Horizontal tab */ - *rc->rc_col = (*rc->rc_col + 8) & ~7; - if (*rc->rc_col >= rc->rc_maxcol) - *rc->rc_col = rc->rc_maxcol - 1; - break; - } -} - -/* Handle the next character in an escape sequence */ -void -rcons_esc(rc, c) - register struct rconsole *rc; - register int c; -{ - - if (c == '[') { - /* Parameter 0 */ - rc->rc_bits &= ~FB_P1; - rc->rc_bits |= FB_P0; - } else if (c == ';') { - /* Parameter 1 */ - rc->rc_bits &= ~FB_P0; - rc->rc_bits |= FB_P1; - } else if (RCONS_ISDIGIT(c)) { - /* Add a digit to a parameter */ - if (rc->rc_bits & FB_P0) { - /* Parameter 0 */ - if (rc->rc_bits & FB_P0_DEFAULT) { - rc->rc_bits &= ~FB_P0_DEFAULT; - rc->rc_p0 = 0; - } - rc->rc_p0 *= 10; - rc->rc_p0 += c - '0'; - } else if (rc->rc_bits & FB_P1) { - /* Parameter 1 */ - if (rc->rc_bits & FB_P1_DEFAULT) { - rc->rc_bits &= ~FB_P1_DEFAULT; - rc->rc_p1 = 0; - } - rc->rc_p1 *= 10; - rc->rc_p1 += c - '0'; - } - } else { - /* Erase the cursor (if necessary) */ - if (rc->rc_bits & FB_CURSOR) - rcons_cursor(rc); - - /* Process the completed escape sequence */ - rcons_doesc(rc, c); - rc->rc_bits &= ~FB_INESC; - } -} - -/* Process a complete escape sequence */ -void -rcons_doesc(rc, c) - register struct rconsole *rc; - register int c; -{ - -#ifdef notdef - /* XXX add escape sequence to enable visual (and audible) bell */ - rc->rc_bits = FB_VISBELL; -#endif - - switch (c) { - - case '@': - /* Insert Character (ICH) */ - rcons_insertchar(rc, rc->rc_p0); - break; - - case 'A': - /* Cursor Up (CUU) */ - *rc->rc_row -= rc->rc_p0; - if (*rc->rc_row < 0) - *rc->rc_row = 0; - break; - - case 'B': - /* Cursor Down (CUD) */ - *rc->rc_row += rc->rc_p0; - if (*rc->rc_row >= rc->rc_maxrow) - *rc->rc_row = rc->rc_maxrow - 1; - break; - - case 'C': - /* Cursor Forward (CUF) */ - *rc->rc_col += rc->rc_p0; - if (*rc->rc_col >= rc->rc_maxcol) - *rc->rc_col = rc->rc_maxcol - 1; - break; - - case 'D': - /* Cursor Backward (CUB) */ - *rc->rc_col -= rc->rc_p0; - if (*rc->rc_col < 0) - *rc->rc_col = 0; - break; - - case 'E': - /* Cursor Next Line (CNL) */ - *rc->rc_col = 0; - *rc->rc_row += rc->rc_p0; - if (*rc->rc_row >= rc->rc_maxrow) - *rc->rc_row = rc->rc_maxrow - 1; - break; - - case 'f': - /* Horizontal And Vertical Position (HVP) */ - case 'H': - /* Cursor Position (CUP) */ - *rc->rc_col = rc->rc_p1 - 1; - if (*rc->rc_col < 0) - *rc->rc_col = 0; - else if (*rc->rc_col >= rc->rc_maxcol) - *rc->rc_col = rc->rc_maxcol - 1; - - *rc->rc_row = rc->rc_p0 - 1; - if (*rc->rc_row < 0) - *rc->rc_row = 0; - else if (*rc->rc_row >= rc->rc_maxrow) - *rc->rc_row = rc->rc_maxrow - 1; - break; - - case 'J': - /* Erase in Display (ED) */ - rcons_clear2eop(rc); - break; - - case 'K': - /* Erase in Line (EL) */ - rcons_clear2eol(rc); - break; - - case 'L': - /* Insert Line (IL) */ - rcons_insertline(rc, rc->rc_p0); - break; - - case 'M': - /* Delete Line (DL) */ - rcons_delline(rc, rc->rc_p0); - break; - - case 'P': - /* Delete Character (DCH) */ - rcons_delchar(rc, rc->rc_p0); - break; - - case 'm': - /* Select Graphic Rendition (SGR); */ - /* (defaults to zero) */ - if (rc->rc_bits & FB_P0_DEFAULT) - rc->rc_p0 = 0; - if (rc->rc_p0) - rc->rc_bits |= FB_STANDOUT; - else - rc->rc_bits &= ~FB_STANDOUT; - break; - - case 'p': - /* Black On White (SUNBOW) */ - rcons_invert(rc, 0); - break; - - case 'q': - /* White On Black (SUNWOB) */ - rcons_invert(rc, 1); - break; - - case 'r': - /* Set scrolling (SUNSCRL) */ - /* (defaults to zero) */ - if (rc->rc_bits & FB_P0_DEFAULT) - rc->rc_p0 = 0; - /* XXX not implemented yet */ - rc->rc_scroll = rc->rc_p0; - break; - - case 's': - /* Reset terminal emulator (SUNRESET) */ - rc->rc_bits &= ~FB_STANDOUT; - rc->rc_scroll = 0; - if (rc->rc_bits & FB_INVERT) - rcons_invert(rc, 0); - break; - } -} - -/* Paint (or unpaint) the cursor */ -void -rcons_cursor(rc) - register struct rconsole *rc; -{ - register int x, y; - - x = *rc->rc_col * rc->rc_font->width + rc->rc_xorigin; - y = *rc->rc_row * rc->rc_font->height + rc->rc_yorigin; - raster_op(rc->rc_sp, x, y, -#ifdef notdef - /* XXX This is the right way but too slow */ - rc->rc_font->chars[(int)' '].r->width, - rc->rc_font->chars[(int)' '].r->height, -#else - rc->rc_font->width, rc->rc_font->height, -#endif - RAS_INVERT, (struct raster *) 0, 0, 0); - rc->rc_bits ^= FB_CURSOR; -} - -/* Possibly change to SUNWOB or SUNBOW mode */ -void -rcons_invert(rc, wob) - struct rconsole *rc; - int wob; -{ - if (((rc->rc_bits & FB_INVERT) != 0) ^ wob) { - /* Invert the display */ - raster_op(rc->rc_sp, 0, 0, rc->rc_sp->width, rc->rc_sp->height, - RAS_INVERT, (struct raster *) 0, 0, 0); - - /* Swap things around */ - rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank); - rc->rc_bits ^= FB_INVERT; - } -} - -/* Clear to the end of the page */ -void -rcons_clear2eop(rc) - register struct rconsole *rc; -{ - register int y; - - if (*rc->rc_col == 0 && *rc->rc_row == 0) { - /* Clear the entire frame buffer */ - raster_op(rc->rc_sp, 0, 0, - rc->rc_sp->width, rc->rc_sp->height, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); - } else { - /* Only clear what needs to be cleared */ - rcons_clear2eol(rc); - y = (*rc->rc_row + 1) * rc->rc_font->height; - - raster_op(rc->rc_sp, rc->rc_xorigin, rc->rc_yorigin + y, - rc->rc_emuwidth, rc->rc_emuheight - y, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); - } -} - -/* Clear to the end of the line */ -void -rcons_clear2eol(rc) - register struct rconsole *rc; -{ - register int x; - - x = *rc->rc_col * rc->rc_font->width; - - raster_op(rc->rc_sp, - rc->rc_xorigin + x, - *rc->rc_row * rc->rc_font->height + rc->rc_yorigin, - rc->rc_emuwidth - x, rc->rc_font->height, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} - -/* Scroll up one line */ -void -rcons_scroll(rc, n) - register struct rconsole *rc; - register int n; -{ - register int ydiv; - - /* Can't scroll more than the whole screen */ - if (n > rc->rc_maxrow) - n = rc->rc_maxrow; - - /* Calculate new row */ - *rc->rc_row -= n; - if (*rc->rc_row < 0) - *rc->rc_row = 0; - - /* Calculate number of pixels to scroll */ - ydiv = rc->rc_font->height * n; - - raster_op(rc->rc_sp, rc->rc_xorigin, rc->rc_yorigin, - rc->rc_emuwidth, rc->rc_emuheight - ydiv, - RAS_SRC, rc->rc_sp, rc->rc_xorigin, ydiv + rc->rc_yorigin); - - raster_op(rc->rc_sp, - rc->rc_xorigin, rc->rc_yorigin + rc->rc_emuheight - ydiv, - rc->rc_emuwidth, ydiv, rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} - -/* Delete characters */ -void -rcons_delchar(rc, n) - register struct rconsole *rc; - register int n; -{ - register int tox, fromx, y, width; - - /* Can't delete more chars than there are */ - if (n > rc->rc_maxcol - *rc->rc_col) - n = rc->rc_maxcol - *rc->rc_col; - - fromx = (*rc->rc_col + n) * rc->rc_font->width; - tox = *rc->rc_col * rc->rc_font->width; - y = *rc->rc_row * rc->rc_font->height; - width = n * rc->rc_font->width; - - raster_op(rc->rc_sp, tox + rc->rc_xorigin, y + rc->rc_yorigin, - rc->rc_emuwidth - fromx, rc->rc_font->height, - RAS_SRC, rc->rc_sp, fromx + rc->rc_xorigin, y + rc->rc_yorigin); - - raster_op(rc->rc_sp, - rc->rc_emuwidth - width + rc->rc_xorigin, y + rc->rc_yorigin, - width, rc->rc_font->height, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} - -/* Delete a number of lines */ -void -rcons_delline(rc, n) - register struct rconsole *rc; - register int n; -{ - register int fromy, toy, height; - - /* Can't delete more lines than there are */ - if (n > rc->rc_maxrow - *rc->rc_row) - n = rc->rc_maxrow - *rc->rc_row; - - fromy = (*rc->rc_row + n) * rc->rc_font->height; - toy = *rc->rc_row * rc->rc_font->height; - height = rc->rc_font->height * n; - - raster_op(rc->rc_sp, rc->rc_xorigin, toy + rc->rc_yorigin, - rc->rc_emuwidth, rc->rc_emuheight - fromy, RAS_SRC, - rc->rc_sp, rc->rc_xorigin, fromy + rc->rc_yorigin); - - raster_op(rc->rc_sp, - rc->rc_xorigin, rc->rc_emuheight - height + rc->rc_yorigin, - rc->rc_emuwidth, height, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} - -/* Insert some characters */ -void -rcons_insertchar(rc, n) - register struct rconsole *rc; - register int n; -{ - register int tox, fromx, y; - - /* Can't insert more chars than can fit */ - if (n > rc->rc_maxcol - *rc->rc_col) - n = rc->rc_maxcol - *rc->rc_col; - - tox = (*rc->rc_col + n) * rc->rc_font->width; - fromx = *rc->rc_col * rc->rc_font->width; - y = *rc->rc_row * rc->rc_font->height; - - raster_op(rc->rc_sp, tox + rc->rc_xorigin, y + rc->rc_yorigin, - rc->rc_emuwidth - tox, rc->rc_font->height, - RAS_SRC, rc->rc_sp, fromx + rc->rc_xorigin, y + rc->rc_yorigin); - - raster_op(rc->rc_sp, fromx + rc->rc_xorigin, y + rc->rc_yorigin, - rc->rc_font->width * n, rc->rc_font->height, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} - -/* Insert some lines */ -void -rcons_insertline(rc, n) - register struct rconsole *rc; - register int n; -{ - register int fromy, toy; - - /* Can't insert more lines than can fit */ - if (n > rc->rc_maxrow - *rc->rc_row) - n = rc->rc_maxrow - *rc->rc_row; - - toy = (*rc->rc_row + n) * rc->rc_font->height; - fromy = *rc->rc_row * rc->rc_font->height; - - raster_op(rc->rc_sp, rc->rc_xorigin, toy + rc->rc_yorigin, - rc->rc_emuwidth, rc->rc_emuheight - toy, - RAS_SRC, rc->rc_sp, rc->rc_xorigin, fromy + rc->rc_yorigin); - - raster_op(rc->rc_sp, rc->rc_xorigin, fromy + rc->rc_yorigin, - rc->rc_emuwidth, rc->rc_font->height * n, - rc->rc_ras_blank, (struct raster *) 0, 0, 0); -} diff --git a/sys/dev/rcons/rcons_subr.h b/sys/dev/rcons/rcons_subr.h deleted file mode 100644 index b6663bffbe3..00000000000 --- a/sys/dev/rcons/rcons_subr.h +++ /dev/null @@ -1,62 +0,0 @@ -/* $OpenBSD: rcons_subr.h,v 1.3 2002/03/14 01:27:02 millert Exp $ */ -/* $NetBSD: rcons_subr.h,v 1.1 1995/10/04 23:57:28 pk Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - * - * extracted from: @(#)rcons_subr.c 8.1 (Berkeley) 6/11/93 - */ - -extern void rcons_puts(struct rconsole *, unsigned char *, int); -extern void rcons_font(struct rconsole *); -extern void rcons_text(struct rconsole *, unsigned char *, int); -extern void rcons_pctrl(struct rconsole *, int); -extern void rcons_esc(struct rconsole *, int); -extern void rcons_doesc(struct rconsole *, int); -extern void rcons_cursor(struct rconsole *); -extern void rcons_invert(struct rconsole *, int); -extern void rcons_clear2eop(struct rconsole *); -extern void rcons_clear2eol(struct rconsole *); -extern void rcons_scroll(struct rconsole *, int); -extern void rcons_delchar(struct rconsole *, int); -extern void rcons_delline(struct rconsole *, int); -extern void rcons_insertchar(struct rconsole *, int); -extern void rcons_insertline(struct rconsole *, int); |