#include "stddef.h"#include "string.h"#include <gpxe/io.h>#include "console.h"#include <gpxe/init.h>#include "vga.h"Go to the source code of this file.
Defines | |
| #define | VIDBUFFER 0xB8000 |
Functions | |
| static void | memsetw (void *s, int c, unsigned int n) |
| static void | video_init (void) |
| static void | video_scroll (void) |
| static void | vga_putc (int byte) |
| struct init_fn video_init_fn | __init_fn (INIT_EARLY) |
Variables | |
| struct console_driver | vga_console |
| static char * | vidmem |
| static int | video_line |
| static int | video_col |
| struct console_driver vga_console | __console_driver |
| #define VIDBUFFER 0xB8000 |
| static void memsetw | ( | void * | s, | |
| int | c, | |||
| unsigned int | n | |||
| ) | [static] |
Definition at line 22 of file video_subr.c.
References u16.
Referenced by video_init().
00023 { 00024 unsigned int i; 00025 u16 *ss = (u16 *) s; 00026 00027 for (i = 0; i < n; i++) { 00028 ss[i] = ( u16 ) c; 00029 } 00030 }
| static void video_init | ( | void | ) | [static] |
Definition at line 32 of file video_subr.c.
References memsetw(), phys_to_virt(), VGA_ATTR_CLR_WHT, VIDBUFFER, video_col, video_line, and vidmem.
00033 { 00034 static int inited=0; 00035 00036 vidmem = (char *)phys_to_virt(VIDBUFFER); 00037 00038 if (!inited) { 00039 video_line = 0; 00040 video_col = 0; 00041 00042 memsetw(vidmem, VGA_ATTR_CLR_WHT, 2*1024); // 00043 00044 inited=1; 00045 } 00046 }
| static void video_scroll | ( | void | ) | [static] |
Definition at line 48 of file video_subr.c.
References COLS, LINES, memcpy, and vidmem.
Referenced by vga_putc().
00049 { 00050 int i; 00051 00052 memcpy(vidmem, vidmem + COLS * 2, (LINES - 1) * COLS * 2); 00053 for (i = (LINES - 1) * COLS * 2; i < LINES * COLS * 2; i += 2) 00054 vidmem[i] = ' '; 00055 }
| static void vga_putc | ( | int | byte | ) | [static] |
Definition at line 57 of file video_subr.c.
References COLS, CRTC_CURSOR_HI, CRTC_CURSOR_LO, LINES, VGA_ATTR_CLR_WHT, video_col, video_line, video_scroll(), vidmem, and write_crtc.
00058 { 00059 if (byte == '\n') { 00060 video_line++; 00061 video_col = 0; 00062 00063 } else if (byte == '\r') { 00064 video_col = 0; 00065 00066 } else if (byte == '\b') { 00067 video_col--; 00068 00069 } else if (byte == '\t') { 00070 video_col += 4; 00071 00072 } else if (byte == '\a') { 00073 //beep 00074 //beep(500); 00075 00076 } else { 00077 vidmem[((video_col + (video_line *COLS)) * 2)] = byte; 00078 vidmem[((video_col + (video_line *COLS)) * 2) +1] = VGA_ATTR_CLR_WHT; 00079 video_col++; 00080 } 00081 if (video_col < 0) { 00082 video_col = 0; 00083 } 00084 if (video_col >= COLS) { 00085 video_line++; 00086 video_col = 0; 00087 } 00088 if (video_line >= LINES) { 00089 video_scroll(); 00090 video_line--; 00091 } 00092 // move the cursor 00093 write_crtc((video_col + (video_line *COLS)) >> 8, CRTC_CURSOR_HI); 00094 write_crtc((video_col + (video_line *COLS)) & 0x0ff, CRTC_CURSOR_LO); 00095 }
| struct init_fn video_init_fn __init_fn | ( | INIT_EARLY | ) | [read] |
| struct console_driver vga_console |
Definition at line 15 of file video_subr.c.
char* vidmem [static] |
Definition at line 17 of file video_subr.c.
Referenced by vga_putc(), video_init(), and video_scroll().
int video_line [static] |
int video_col [static] |
1.5.7.1