FreeBSD/sys/dev/fb/vga.c
/*
 * save_font():
 * Read the font data in the requested font page from the video adapter.
 *
 * EGA/VGA
 */
Read the font data in the requested font page from the video adapter.

EGA/VGA
Read the font data in the requested font page from the video adapter . EGA / VGA
static int
vga_save_font(video_adapter_t *adp, int page, int fontsize, int fontwidth,
	      u_char *data, int ch, int count)
{
#ifndef VGA_NO_FONT_LOADING
    u_char buf[PARAM_BUFSIZE];
    vm_offset_t segment;
    int c;
#ifdef VGA_ALT_SEQACCESS
    int s;
    u_char val = 0;
#endif
    prologue(adp, V_ADP_FONT, ENODEV);
    if (fontsize < 14) {
	fontsize = 8;
    } else if (fontsize >= 32) {
	fontsize = 32;
    } else if (fontsize >= 16) {
	fontsize = 16;
    } else {
	fontsize = 14;
    }
    if (page < 0 || page >= 8 || fontwidth != 8)
	return EINVAL;
    segment = FONT_BUF + 0x4000*page;
    if (page > 3)
	segment -= 0xe000;
#ifdef VGA_ALT_SEQACCESS
    if (adp->va_type == KD_VGA) {	
	s = splhigh();
	outb(TSIDX, 0x00); outb(TSREG, 0x01);
	outb(TSIDX, 0x01); val = inb(TSREG);	
	outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
	outb(TSIDX, 0x00); outb(TSREG, 0x03);
	splx(s);
    }
#endif
    set_font_mode(adp, buf);
    if (fontsize == 32) {
	bcopy_fromio((uintptr_t)segment + ch*32, data, fontsize*count);
    } else {
	for (c = ch; count > 0; ++c, --count) {
	    bcopy_fromio((uintptr_t)segment + c*32, data, fontsize);
	    data += fontsize;
	}
    }
    set_normal_mode(adp, buf);
#ifdef VGA_ALT_SEQACCESS
    if (adp->va_type == KD_VGA) {
	s = splhigh();
	outb(TSIDX, 0x00); outb(TSREG, 0x01);
	outb(TSIDX, 0x01); outb(TSREG, val & 0xdf);	
	outb(TSIDX, 0x00); outb(TSREG, 0x03);
	splx(s);
    }
#endif
    return 0;
#else 
    return ENODEV;
#endif 
}
static int vga_save_font ( video_adapter_t * adp , int page , int fontsize , int fontwidth , u_char * data , int ch , int count ) { #ifndef VGA_NO_FONT_LOADING u_char buf [ PARAM_BUFSIZE ] ; vm_offset_t segment ; int c ; #ifdef VGA_ALT_SEQACCESS int s ; u_char val = 0 ; #endif prologue ( adp , V_ADP_FONT , ENODEV ) ; if ( fontsize < 14 ) { fontsize = 8 ; } else if ( fontsize >= 32 ) { fontsize = 32 ; } else if ( fontsize >= 16 ) { fontsize = 16 ; } else { fontsize = 14 ; } if ( page < 0 || page >= 8 || fontwidth != 8 ) return EINVAL ; segment = FONT_BUF + 0x4000 * page ; if ( page > 3 ) segment -= 0xe000 ; #ifdef VGA_ALT_SEQACCESS if ( adp -> va_type == KD_VGA ) { s = splhigh ( ) ; outb ( TSIDX , 0x00 ) ; outb ( TSREG , 0x01 ) ; outb ( TSIDX , 0x01 ) ; val = inb ( TSREG ) ; outb ( TSIDX , 0x01 ) ; outb ( TSREG , val | 0x20 ) ; outb ( TSIDX , 0x00 ) ; outb ( TSREG , 0x03 ) ; splx ( s ) ; } #endif set_font_mode ( adp , buf ) ; if ( fontsize == 32 ) { bcopy_fromio ( ( uintptr_t ) segment + ch * 32 , data , fontsize * count ) ; } else { for ( c = ch ; count > 0 ; ++ c , -- count ) { bcopy_fromio ( ( uintptr_t ) segment + c * 32 , data , fontsize ) ; data += fontsize ; } } set_normal_mode ( adp , buf ) ; #ifdef VGA_ALT_SEQACCESS if ( adp -> va_type == KD_VGA ) { s = splhigh ( ) ; outb ( TSIDX , 0x00 ) ; outb ( TSREG , 0x01 ) ; outb ( TSIDX , 0x01 ) ; outb ( TSREG , val & 0xdf ) ; outb ( TSIDX , 0x00 ) ; outb ( TSREG , 0x03 ) ; splx ( s ) ; } #endif return 0 ; #else return ENODEV ; #endif }
save_font():
 Read the font data in the requested font page from the video adapter.
save_font () : Read the font data in the requested font page from the video adapter .
/* FONT_8 */ /* FONT_16 */ /* FONT_14 */ /* what about EGA? XXX */ /* disable screen */ /* enable screen */ /* VGA_NO_FONT_LOADING */ /* VGA_NO_FONT_LOADING */