| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /* 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>
- #define TAB_SIZE 8
- #define rgb(r, g, b) ((b) + ((g) << 8) + ((r) << 16))
- #define black 0x00000000
- #define red rgb(255, 0, 0)
- #define success rgb(114, 176, 161)
- #define error rgb(244, 130, 100)
- #define yellow rgb(0, 255, 255)
- #define green rgb(0, 255, 0)
- #define white rgb(255, 255, 255)
- 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 *, ...);
- void syslog(const char *);
- /*
- * we support 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 16
- #define CHAR_WIDTH 8
- #define X_CHARS (VGA_X / CHAR_WIDTH)
- #define Y_LINES (VGA_Y / CHAR_HEIGHT)
- #endif
|