| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /* Copyright (C) 2021 Rain */
- /* This file is part of XNIX. */
- /*
- XNIX is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) and later version.
- */
- /*
- XNIX is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- */
- /*
- You should have received a copy of the GNU General Public License
- along with XNIX. If not, see <https://www.gnu.org/licenses/>.
- */
- #ifndef _GRAPHIC_H
- #define _GRAPHIC_H
- #include <kernel/types.h>
- void putblock(__uint32_t, int, int, int, int);
- void putc(char, __uint32_t, __uint32_t);
- void print(__uint32_t, __uint32_t, char *);
- int printk(__uint32_t, __uint32_t, char *, ...);
- /*
- * we supports PSF format in XNIX.
- * in linux, PSF fonts are in /usr/share/kbd/consolefonts, and they are always compressed.
- * */
- #define PSF_MAGIC 0x864ab572
- struct psf_header {
- __uint32_t magic;
- /* zero */
- __uint32_t version;
- __uint32_t header_size;
- /* zero if there's no unicode table */
- __uint32_t flags;
- /* in psf, a font calls glyph */
- __uint32_t glyphs_count;
- /* size of a glyph */
- __uint32_t glyph_size;
- __uint32_t height;
- __uint32_t width;
- };
- /* '__uint64_t * ' can change to other types */
- /* because they are all just lables with an address */
- extern __uint8_t *font_start;
- extern __uint8_t *font_end;
- /* but 'font_size' must be __uint64_t because it's a value */
- extern __uint64_t font_size;
- #define FB_ADDR ((__uint32_t *) 0x400000)
- /* x and y in this vga mode */
- #define VGA_X (bootarg->vga_x)
- #define VGA_Y (bootarg->vga_y)
- /* this is default value */
- #define CHAR_HEIGHT 8
- #define CHAR_WIDTH 16
- #define X_CHARS (VGA_X / CHAR_WIDTH)
- #define Y_LINES (VGA_Y / CHAR_HEIGHT)
- #endif
|