summaryrefslogtreecommitdiffstats
path: root/sys/modules/syscons
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1999-06-22 14:14:06 +0000
committeryokota <yokota@FreeBSD.org>1999-06-22 14:14:06 +0000
commit4f4eb0cfe54e001639240b3b63551c42280cdcc0 (patch)
tree75738e04df5c55c7d14fd6fb083ab1062bd92a85 /sys/modules/syscons
parentd252fb51781d3bcdc1697ebd89678c9a00d94124 (diff)
downloadFreeBSD-src-4f4eb0cfe54e001639240b3b63551c42280cdcc0.zip
FreeBSD-src-4f4eb0cfe54e001639240b3b63551c42280cdcc0.tar.gz
The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize some of complicated functions. - Many static variables are moved to the softc structure. - Added a new key function, PREV. When this key is pressed, the vty immediately before the current vty will become foreground. Analogue to PREV, which is usually assigned to the PrntScrn key. PR: kern/10113 Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de> - Modified the kernel console input function sccngetc() so that it handles function keys properly. - Reorganized the screen update routine. - VT switching code is reorganized. It now should be slightly more robust than before. - Added the DEVICE_RESUME function so that syscons no longer hooks the APM resume event directly. - New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING, SC_NO_HISTORY and SC_NO_SYSMOUSE. Various parts of syscons can be omitted so that the kernel size is reduced. SC_PIXEL_MODE Made the VESA 800x600 mode an option, rather than a standard part of syscons. SC_DISABLE_DDBKEY Disables the `debug' key combination. SC_ALT_MOUSE_IMAGE Inverse the character cell at the mouse cursor position in the text console, rather than drawing an arrow on the screen. Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG) SC_DFLT_FONT makeoptions "SC_DFLT_FONT=_font_name_" Include the named font as the default font of syscons. 16-line, 14-line and 8-line font data will be compiled in. This option replaces the existing STD8X16FONT option, which loads 16-line font data only. - The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c. - The video driver provides a set of ioctl commands to manipulate the frame buffer. - New kernel configuration option: VGA_WIDTH90 Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These modes are mot always supported by the video card. PR: i386/7510 Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx. - The header file machine/console.h is reorganized; its contents is now split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h (another new file). machine/console.h is still maintained for compatibility reasons. - Kernel console selection/installation routines are fixed and slightly rebumped so that it should now be possible to switch between the interanl kernel console (sc or vt) and a remote kernel console (sio) again, as it was in 2.x, 3.0 and 3.1. - Screen savers and splash screen decoders Because of the header file reorganization described above, screen savers and splash screen decoders are slightly modified. After this update, /sys/modules/syscons/saver.h is no longer necessary and is removed.
Diffstat (limited to 'sys/modules/syscons')
-rw-r--r--sys/modules/syscons/blank/blank_saver.c71
-rw-r--r--sys/modules/syscons/daemon/daemon_saver.c103
-rw-r--r--sys/modules/syscons/fade/fade_saver.c69
-rw-r--r--sys/modules/syscons/fire/fire_saver.c9
-rw-r--r--sys/modules/syscons/green/green_saver.c82
-rw-r--r--sys/modules/syscons/logo/logo_saver.c10
-rw-r--r--sys/modules/syscons/rain/rain_saver.c8
-rw-r--r--sys/modules/syscons/saver.h39
-rw-r--r--sys/modules/syscons/snake/snake_saver.c56
-rw-r--r--sys/modules/syscons/star/star_saver.c49
-rw-r--r--sys/modules/syscons/warp/warp_saver.c9
11 files changed, 217 insertions, 288 deletions
diff --git a/sys/modules/syscons/blank/blank_saver.c b/sys/modules/syscons/blank/blank_saver.c
index 89dd199..2979c0d 100644
--- a/sys/modules/syscons/blank/blank_saver.c
+++ b/sys/modules/syscons/blank/blank_saver.c
@@ -25,82 +25,35 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: blank_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
+ * $Id: blank_saver.c,v 1.15 1999/01/11 03:18:44 yokota Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <dev/fb/vgareg.h>
-
-#include <i386/isa/isa.h>
-
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static int
blank_saver(video_adapter_t *adp, int blank)
{
- u_char val;
- if (blank) {
- switch (adp->va_type) {
- case KD_VGA:
- outb(TSIDX, 0x01); val = inb(TSREG);
- outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(adp->va_crtc_addr + 4, 0x25);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(adp->va_crtc_addr + 4, 0x21);
- break;
- default:
- break;
- }
- }
- else {
- switch (adp->va_type) {
- case KD_VGA:
- outb(TSIDX, 0x01); val = inb(TSREG);
- outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(adp->va_crtc_addr + 4, 0x2d);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(adp->va_crtc_addr + 4, 0x29);
- break;
- default:
- break;
- }
- }
+ (*vidsw[adp->va_index]->blank_display)(adp,
+ (blank) ? V_DISPLAY_BLANK
+ : V_DISPLAY_ON);
return 0;
}
static int
blank_init(video_adapter_t *adp)
{
- switch (adp->va_type) {
- case KD_MONO:
- case KD_HERCULES:
- case KD_CGA:
- case KD_VGA:
- break;
- case KD_EGA:
- /* EGA is yet to be supported */
- default:
- return ENODEV;
- }
- return 0;
+ if ((*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) == 0)
+ return 0;
+ return ENODEV;
}
static int
diff --git a/sys/modules/syscons/daemon/daemon_saver.c b/sys/modules/syscons/daemon/daemon_saver.c
index 423e6c7..ebedfaa 100644
--- a/sys/modules/syscons/daemon/daemon_saver.c
+++ b/sys/modules/syscons/daemon/daemon_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: daemon_saver.c,v 1.14 1999/01/17 14:25:08 yokota Exp $
+ * $Id: daemon_saver.c,v 1.15 1999/02/05 12:40:15 des Exp $
*/
#include <sys/param.h>
@@ -34,21 +34,20 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <machine/md_var.h>
#include <machine/pc/display.h>
-#include <saver.h>
-
-#define CONSOLE_VECT(x, y) \
- (window + (y)*cur_console->xsize + (x))
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
#define DAEMON_MAX_WIDTH 32
#define DAEMON_MAX_HEIGHT 19
static char *message;
static int messagelen;
-static u_short *window;
static int blanked;
/* Who is the author of this ASCII pic? */
@@ -119,20 +118,23 @@ xflip_symbol(char symbol)
}
static void
-clear_daemon(int xpos, int ypos, int dxdir, int xoff, int yoff,
+clear_daemon(sc_softc_t *sc, int xpos, int ypos, int dxdir, int xoff, int yoff,
int xlen, int ylen)
{
int y;
if (xlen <= 0)
return;
- for (y = yoff; y < ylen; y++)
- fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
- CONSOLE_VECT(xpos + xoff, ypos + y), xlen - xoff);
+ for (y = yoff; y < ylen; y++) {
+ sc_vtb_erase(&sc->cur_scp->scr,
+ (ypos + y)*sc->cur_scp->xsize + xpos + xoff,
+ xlen - xoff,
+ sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8);
+ }
}
static void
-draw_daemon(int xpos, int ypos, int dxdir, int xoff, int yoff,
+draw_daemon(sc_softc_t *sc, int xpos, int ypos, int dxdir, int xoff, int yoff,
int xlen, int ylen)
{
int x, y;
@@ -148,41 +150,60 @@ draw_daemon(int xpos, int ypos, int dxdir, int xoff, int yoff,
continue;
for (x = xoff; (x < xlen) && (daemon_pic[y][px] != '\0'); x++, px++) {
switch (daemon_attr[y][px]) {
+#ifndef PC98
case 'R': attr = (FG_LIGHTRED|BG_BLACK)<<8; break;
case 'Y': attr = (FG_YELLOW|BG_BLACK)<<8; break;
case 'B': attr = (FG_LIGHTBLUE|BG_BLACK)<<8; break;
case 'W': attr = (FG_LIGHTGREY|BG_BLACK)<<8; break;
case 'C': attr = (FG_CYAN|BG_BLACK)<<8; break;
default: attr = (FG_WHITE|BG_BLACK)<<8; break;
+#else /* PC98 */
+ case 'R': attr = (FG_RED|BG_BLACK)<<8; break;
+ case 'Y': attr = (FG_BROWN|BG_BLACK)<<8; break;
+ case 'B': attr = (FG_BLUE|BG_BLACK)<<8; break;
+ case 'W': attr = (FG_LIGHTGREY|BG_BLACK)<<8; break;
+ case 'C': attr = (FG_CYAN|BG_BLACK)<<8; break;
+ default: attr = (FG_LIGHTGREY|BG_BLACK)<<8; break;
+#endif /* PC98 */
}
if (dxdir < 0) { /* Moving left */
- *CONSOLE_VECT(xpos + x, ypos + y) =
- scr_map[daemon_pic[y][px]]|attr;
+ sc_vtb_putc(&sc->cur_scp->scr,
+ (ypos + y)*sc->cur_scp->xsize
+ + xpos + x,
+ sc->scr_map[daemon_pic[y][px]],
+ attr);
} else { /* Moving right */
- *CONSOLE_VECT(xpos + DAEMON_MAX_WIDTH - px - 1, ypos + y) =
- scr_map[xflip_symbol(daemon_pic[y][px])]|attr;
+ sc_vtb_putc(&sc->cur_scp->scr,
+ (ypos + y)*sc->cur_scp->xsize
+ + xpos + DAEMON_MAX_WIDTH
+ - px - 1,
+ sc->scr_map[xflip_symbol(daemon_pic[y][px])],
+ attr);
}
}
}
}
static void
-clear_string(int xpos, int ypos, int xoff, char *s, int len)
+clear_string(sc_softc_t *sc, int xpos, int ypos, int xoff, char *s, int len)
{
if (len <= 0)
return;
- fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
- CONSOLE_VECT(xpos + xoff, ypos), len - xoff);
+ sc_vtb_erase(&sc->cur_scp->scr,
+ ypos*sc->cur_scp->xsize + xpos + xoff, len - xoff,
+ sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8);
}
static void
-draw_string(int xpos, int ypos, int xoff, char *s, int len)
+draw_string(sc_softc_t *sc, int xpos, int ypos, int xoff, char *s, int len)
{
int x;
- for (x = xoff; x < len; x++)
- *CONSOLE_VECT(xpos + x, ypos) =
- scr_map[s[x]]|(FG_LIGHTGREEN|BG_BLACK)<<8;
+ for (x = xoff; x < len; x++) {
+ sc_vtb_putc(&sc->cur_scp->scr,
+ ypos*sc->cur_scp->xsize + xpos + x,
+ sc->scr_map[s[x]], (FG_LIGHTGREEN | BG_BLACK) << 8);
+ }
}
static int
@@ -195,17 +216,30 @@ daemon_saver(video_adapter_t *adp, int blank)
static int moved_daemon = 0;
static int xoff, yoff, toff;
static int xlen, ylen, tlen;
- scr_stat *scp = cur_console;
+ sc_softc_t *sc;
+ scr_stat *scp;
int min, max;
+ sc = sc_find_softc(adp, NULL);
+ if (sc == NULL)
+ return EAGAIN;
+ scp = sc->cur_scp;
+
if (blank) {
if (adp->va_info.vi_flags & V_INFO_GRAPHICS)
return EAGAIN;
if (blanked == 0) {
- window = (u_short *)adp->va_window;
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) & ~0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
/* clear the screen and set the border color */
- fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
- window, scp->xsize * scp->ysize);
+ sc_vtb_clear(&scp->scr, sc->scr_map[0x20],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
+ (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
set_border(scp, 0);
xlen = ylen = tlen = 0;
}
@@ -213,8 +247,8 @@ daemon_saver(video_adapter_t *adp, int blank)
return 0;
blanked = 1;
- clear_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
- clear_string(txpos, typos, toff, (char *)message, tlen);
+ clear_daemon(sc, dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
+ clear_string(sc, txpos, typos, toff, (char *)message, tlen);
if (++moved_daemon) {
/*
@@ -319,9 +353,16 @@ daemon_saver(video_adapter_t *adp, int blank)
else if (txpos + tlen > scp->xsize)
tlen = scp->xsize - txpos;
- draw_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
- draw_string(txpos, typos, toff, (char *)message, tlen);
+ draw_daemon(sc, dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
+ draw_string(sc, txpos, typos, toff, (char *)message, tlen);
} else {
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) | 0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
blanked = 0;
}
return 0;
diff --git a/sys/modules/syscons/fade/fade_saver.c b/sys/modules/syscons/fade/fade_saver.c
index 70d36c9..4a44c85 100644
--- a/sys/modules/syscons/fade/fade_saver.c
+++ b/sys/modules/syscons/fade/fade_saver.c
@@ -25,17 +25,19 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: fade_saver.c,v 1.15 1998/11/04 03:49:38 peter Exp $
+ * $Id: fade_saver.c,v 1.16 1999/01/11 03:18:46 yokota Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <i386/isa/isa.h>
-
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static u_char palette[256*3];
static int blanked;
@@ -49,11 +51,10 @@ fade_saver(video_adapter_t *adp, int blank)
if (blank) {
blanked = TRUE;
- switch (adp->va_type) {
- case KD_VGA:
+ if (ISPALAVAIL(adp->va_flags)) {
if (count <= 0)
save_palette(adp, palette);
- if (count < 64) {
+ if (count < 256) {
pal[0] = pal[1] = pal[2] = 0;
for (i = 3; i < 256*3; i++) {
if (palette[i] - count > 60)
@@ -64,39 +65,17 @@ fade_saver(video_adapter_t *adp, int blank)
load_palette(adp, pal);
count++;
}
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(adp->va_crtc_addr + 4, 0x25);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(adp->va_crtc_addr + 4, 0x21);
- break;
- default:
- break;
+ } else {
+ (*vidsw[adp->va_index]->blank_display)(adp,
+ V_DISPLAY_BLANK);
}
- }
- else {
- switch (adp->va_type) {
- case KD_VGA:
+ } else {
+ if (ISPALAVAIL(adp->va_flags)) {
load_palette(adp, palette);
count = 0;
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(adp->va_crtc_addr + 4, 0x2d);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(adp->va_crtc_addr + 4, 0x29);
- break;
- default:
- break;
+ } else {
+ (*vidsw[adp->va_index]->blank_display)(adp,
+ V_DISPLAY_ON);
}
blanked = FALSE;
}
@@ -106,21 +85,9 @@ fade_saver(video_adapter_t *adp, int blank)
static int
fade_init(video_adapter_t *adp)
{
- switch (adp->va_type) {
- case KD_MONO:
- case KD_HERCULES:
- case KD_CGA:
- /*
- * `fade' saver is not fully implemented for MDA and CGA.
- * It simply blanks the display instead.
- */
- case KD_VGA:
- break;
- case KD_EGA:
- /* EGA is yet to be supported */
- default:
+ if (!ISPALAVAIL(adp->va_flags)
+ && (*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) != 0)
return ENODEV;
- }
blanked = FALSE;
return 0;
}
diff --git a/sys/modules/syscons/fire/fire_saver.c b/sys/modules/syscons/fire/fire_saver.c
index aea36a9..db4b80b 100644
--- a/sys/modules/syscons/fire/fire_saver.c
+++ b/sys/modules/syscons/fire/fire_saver.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: fire_saver.c,v 1.2.2.1 1999/05/10 15:20:30 des Exp $
+ * $Id: fire_saver.c,v 1.4 1999/05/10 15:25:50 des Exp $
*/
/*
@@ -38,11 +38,14 @@
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/syslog.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <machine/md_var.h>
#include <machine/random.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
#define X_SIZE 320
#define Y_SIZE 200
diff --git a/sys/modules/syscons/green/green_saver.c b/sys/modules/syscons/green/green_saver.c
index 9decd72..103154b 100644
--- a/sys/modules/syscons/green/green_saver.c
+++ b/sys/modules/syscons/green/green_saver.c
@@ -25,93 +25,35 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: green_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
+ * $Id: green_saver.c,v 1.15 1999/01/11 03:18:48 yokota Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <dev/fb/vgareg.h>
-
-#include <i386/isa/isa.h>
-
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static int
green_saver(video_adapter_t *adp, int blank)
{
- int crtc_addr;
- u_char val;
-
- crtc_addr = adp->va_crtc_addr;
- if (blank) {
- switch (adp->va_type) {
- case KD_VGA:
- outb(TSIDX, 0x01); val = inb(TSREG);
- outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
- outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
- outb(crtc_addr + 1, val & ~0x80);
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(crtc_addr + 4, 0x25);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(crtc_addr + 4, 0x21);
- break;
- default:
- break;
- }
- }
- else {
- switch (adp->va_type) {
- case KD_VGA:
- outb(TSIDX, 0x01); val = inb(TSREG);
- outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
- outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
- outb(crtc_addr + 1, val | 0x80);
- break;
- case KD_EGA:
- /* not yet done XXX */
- break;
- case KD_CGA:
- outb(crtc_addr + 4, 0x2d);
- break;
- case KD_MONO:
- case KD_HERCULES:
- outb(crtc_addr + 4, 0x29);
- break;
- default:
- break;
- }
- }
+ (*vidsw[adp->va_index]->blank_display)(adp,
+ (blank) ? V_DISPLAY_STAND_BY
+ : V_DISPLAY_ON);
return 0;
}
static int
green_init(video_adapter_t *adp)
{
- switch (adp->va_type) {
- case KD_MONO:
- case KD_HERCULES:
- case KD_CGA:
- /*
- * `green' saver is not fully implemented for MDA and CGA.
- * It simply blanks the display instead.
- */
- case KD_VGA:
- break;
- case KD_EGA:
- /* EGA is yet to be supported */
- default:
- return ENODEV;
- }
- return 0;
+ if ((*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) == 0)
+ return 0;
+ return ENODEV;
}
static int
diff --git a/sys/modules/syscons/logo/logo_saver.c b/sys/modules/syscons/logo/logo_saver.c
index b6a46ac..24da964 100644
--- a/sys/modules/syscons/logo/logo_saver.c
+++ b/sys/modules/syscons/logo/logo_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: logo_saver.c,v 1.5 1999/02/05 12:40:15 des Exp $
+ * $Id: logo_saver.c,v 1.6 1999/04/12 13:34:57 des Exp $
*/
#include <sys/param.h>
@@ -33,8 +33,12 @@
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/syslog.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static u_char *vid;
static int banksize, scrmode, bpsl, scrw, scrh;
@@ -104,6 +108,7 @@ logo_saver(video_adapter_t *adp, int blank)
#endif
blanked++;
vid = (u_char *)adp->va_window;
+ banksize = adp->va_window_size;
bpsl = adp->va_line_width;
splx(pl);
for (i = 0; i < bpsl*scrh; i += banksize) {
@@ -132,7 +137,6 @@ logo_init(video_adapter_t *adp)
return ENODEV;
}
- banksize = info.vi_window_size;
scrw = info.vi_width;
scrh = info.vi_height;
blanked = 0;
diff --git a/sys/modules/syscons/rain/rain_saver.c b/sys/modules/syscons/rain/rain_saver.c
index 9aa7370..200dc59 100644
--- a/sys/modules/syscons/rain/rain_saver.c
+++ b/sys/modules/syscons/rain/rain_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rain_saver.c,v 1.2 1999/01/11 03:18:50 yokota Exp $
+ * $Id: rain_saver.c,v 1.3 1999/04/12 13:34:57 des Exp $
*/
#include <sys/param.h>
@@ -33,10 +33,14 @@
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/syslog.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
#include <machine/random.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static u_char *vid;
diff --git a/sys/modules/syscons/saver.h b/sys/modules/syscons/saver.h
deleted file mode 100644
index 748dfdd..0000000
--- a/sys/modules/syscons/saver.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * Copyright (c) 1995-1998 Søren Schmidt
- * 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,
- * without modification, immediately at the beginning of the file.
- * 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. 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.
- *
- * $Id: saver.h,v 1.16 1999/01/16 10:20:13 des Exp $
- */
-#include <machine/apm_bios.h>
-#include <machine/console.h>
-
-#include <dev/fb/fbreg.h>
-#include <dev/fb/splashreg.h>
-
-#include <dev/syscons/syscons.h>
-
-extern scr_stat *cur_console;
-extern char scr_map[];
diff --git a/sys/modules/syscons/snake/snake_saver.c b/sys/modules/syscons/snake/snake_saver.c
index ef64741..51e1746 100644
--- a/sys/modules/syscons/snake/snake_saver.c
+++ b/sys/modules/syscons/snake/snake_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: snake_saver.c,v 1.22 1999/01/17 14:25:19 yokota Exp $
+ * $Id: snake_saver.c,v 1.23 1999/02/05 12:40:15 des Exp $
*/
#include <sys/param.h>
@@ -34,16 +34,18 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <machine/md_var.h>
#include <machine/pc/display.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static char *message;
-static u_char **messagep;
+static int *messagep;
static int messagelen;
-static u_short *window;
static int blanked;
static int
@@ -51,36 +53,50 @@ snake_saver(video_adapter_t *adp, int blank)
{
static int dirx, diry;
int f;
- scr_stat *scp = cur_console;
+ sc_softc_t *sc;
+ scr_stat *scp;
/* XXX hack for minimal changes. */
#define save message
#define savs messagep
+ sc = sc_find_softc(adp, NULL);
+ if (sc == NULL)
+ return EAGAIN;
+ scp = sc->cur_scp;
+
if (blank) {
if (adp->va_info.vi_flags & V_INFO_GRAPHICS)
return EAGAIN;
if (blanked <= 0) {
- window = (u_short *)adp->va_window;
- fillw(((FG_LIGHTGREY|BG_BLACK)<<8) | scr_map[0x20],
- window, scp->xsize * scp->ysize);
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) & ~0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
+ sc_vtb_clear(&scp->scr, sc->scr_map[0x20],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
+ (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
set_border(scp, 0);
dirx = (scp->xpos ? 1 : -1);
diry = (scp->ypos ?
scp->xsize : -scp->xsize);
for (f=0; f< messagelen; f++)
- savs[f] = (u_char *)window + 2 *
- (scp->xpos+scp->ypos*scp->xsize);
- *(savs[0]) = scr_map[*save];
+ savs[f] = scp->xpos + scp->ypos*scp->xsize;
+ sc_vtb_putc(&scp->scr, savs[0], sc->scr_map[*save],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
blanked = 1;
}
if (blanked++ < 4)
return 0;
blanked = 1;
- *(savs[messagelen-1]) = scr_map[0x20];
+ sc_vtb_putc(&scp->scr, savs[messagelen - 1], sc->scr_map[0x20],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
for (f=messagelen-1; f > 0; f--)
savs[f] = savs[f-1];
- f = (savs[0] - (u_char *)window) / 2;
+ f = savs[0];
if ((f % scp->xsize) == 0 ||
(f % scp->xsize) == scp->xsize - 1 ||
(random() % 50) == 0)
@@ -89,11 +105,19 @@ snake_saver(video_adapter_t *adp, int blank)
(f / scp->xsize) == scp->ysize - 1 ||
(random() % 20) == 0)
diry = -diry;
- savs[0] += 2*dirx + 2*diry;
+ savs[0] += dirx + diry;
for (f=messagelen-1; f>=0; f--)
- *(savs[f]) = scr_map[save[f]];
+ sc_vtb_putc(&scp->scr, savs[f], sc->scr_map[save[f]],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
}
else {
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) | 0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
blanked = 0;
}
return 0;
diff --git a/sys/modules/syscons/star/star_saver.c b/sys/modules/syscons/star/star_saver.c
index aaa23fb..56408dc 100644
--- a/sys/modules/syscons/star/star_saver.c
+++ b/sys/modules/syscons/star/star_saver.c
@@ -25,22 +25,24 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: star_saver.c,v 1.19 1999/01/17 14:25:19 yokota Exp $
+ * $Id: star_saver.c,v 1.20 1999/02/05 12:40:16 des Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <machine/md_var.h>
#include <machine/pc/display.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
#define NUM_STARS 50
-static u_short *window;
static int blanked;
/*
@@ -50,21 +52,39 @@ static int blanked;
static int
star_saver(video_adapter_t *adp, int blank)
{
- scr_stat *scp = cur_console;
+ sc_softc_t *sc;
+ scr_stat *scp;
int cell, i;
char pattern[] = {"...........++++*** "};
+#ifndef PC98
char colors[] = {FG_DARKGREY, FG_LIGHTGREY,
FG_WHITE, FG_LIGHTCYAN};
+#else
+ char colors[] = {FG_BLUE, FG_LIGHTGREY,
+ FG_LIGHTGREY, FG_CYAN};
+#endif /* PC98 */
static u_short stars[NUM_STARS][2];
+ sc = sc_find_softc(adp, NULL);
+ if (sc == NULL)
+ return EAGAIN;
+ scp = sc->cur_scp;
+
if (blank) {
if (adp->va_info.vi_flags & V_INFO_GRAPHICS)
return EAGAIN;
if (!blanked) {
- window = (u_short *)adp->va_window;
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) & ~0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
/* clear the screen and set the border color */
- fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
- window, scp->xsize * scp->ysize);
+ sc_vtb_clear(&scp->scr, sc->scr_map[0x20],
+ (FG_LIGHTGREY | BG_BLACK) << 8);
+ (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
set_border(scp, 0);
blanked = TRUE;
for(i=0; i<NUM_STARS; i++) {
@@ -74,15 +94,22 @@ star_saver(video_adapter_t *adp, int blank)
}
}
cell = random() % NUM_STARS;
- *((u_short*)(window + stars[cell][0])) =
- scr_map[pattern[stars[cell][1]]] |
- colors[random()%sizeof(colors)] << 8;
+ sc_vtb_putc(&scp->scr, stars[cell][0],
+ sc->scr_map[pattern[stars[cell][1]]],
+ colors[random()%sizeof(colors)] << 8);
if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) {
stars[cell][0] = random() % (scp->xsize*scp->ysize);
stars[cell][1] = 0;
}
}
else {
+#ifdef PC98
+ if (epson_machine_id == 0x20) {
+ outb(0x43f, 0x42);
+ outb(0x0c17, inb(0xc17) | 0x08);
+ outb(0x43f, 0x40);
+ }
+#endif /* PC98 */
blanked = FALSE;
}
return 0;
diff --git a/sys/modules/syscons/warp/warp_saver.c b/sys/modules/syscons/warp/warp_saver.c
index 3476c36..cd6f42b 100644
--- a/sys/modules/syscons/warp/warp_saver.c
+++ b/sys/modules/syscons/warp/warp_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: warp_saver.c,v 1.4 1999/01/11 03:18:55 yokota Exp $
+ * $Id: warp_saver.c,v 1.5 1999/04/12 13:34:58 des Exp $
*/
#include <sys/param.h>
@@ -33,11 +33,14 @@
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/syslog.h>
+#include <sys/consio.h>
+#include <sys/fbio.h>
-#include <machine/md_var.h>
#include <machine/random.h>
-#include <saver.h>
+#include <dev/fb/fbreg.h>
+#include <dev/fb/splashreg.h>
+#include <dev/syscons/syscons.h>
static u_char *vid;
static int blanked;
OpenPOWER on IntegriCloud