mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-19 19:21:44 +00:00
.github
.vscode
Architecture
Core
Execute
FileSystem
Files
GUI
Library
Network
Profiling
Recovery
SystemCalls
Tasking
Tests
include
boot
filesystem
net
abi.h
assert.h
atomic.hpp
bitmap.hpp
cargs.h
convert.h
cpu.hpp
crc32.h
cstring
cwalk.h
debug.h
disk.hpp
display.hpp
driver.hpp
dumper.hpp
elf.h
exec.hpp
filesystem.hpp
gui.hpp
hashmap.hpp
interrupts.hpp
io.h
ipc.hpp
kconfig.hpp
limits.h
lock.hpp
md5.h
memory.hpp
msexec.h
pci.hpp
power.hpp
printf.h
rand.hpp
recovery.hpp
smartptr.hpp
smp.hpp
std.hpp
stddef.h
stdint.h
string.hpp
symbols.hpp
sys.h
syscalls.hpp
task.hpp
time.hpp
types.h
uart.hpp
vector.hpp
.gitignore
DAPI.hpp
Doxyfile
Fex.hpp
KConfig.cpp
KThread.cpp
Kernel.cpp
LICENSE
Makefile
README.md
dump.sh
ipc.h
kernel.h
syscalls.h
122 lines
2.8 KiB
C++
122 lines
2.8 KiB
C++
#ifndef __FENNIX_KERNEL_DISPLAY_H__
|
|
#define __FENNIX_KERNEL_DISPLAY_H__
|
|
|
|
#include <types.h>
|
|
|
|
#include <boot/binfo.h>
|
|
#include <memory.hpp>
|
|
#include <debug.h>
|
|
#include <cstring>
|
|
|
|
namespace Video
|
|
{
|
|
#define PSF1_MAGIC0 0x36
|
|
#define PSF1_MAGIC1 0x04
|
|
|
|
#define PSF2_MAGIC0 0x72
|
|
#define PSF2_MAGIC1 0xb5
|
|
#define PSF2_MAGIC2 0x4a
|
|
#define PSF2_MAGIC3 0x86
|
|
|
|
struct PSF1_HEADER
|
|
{
|
|
uint8_t magic[2];
|
|
uint8_t mode;
|
|
uint8_t charsize;
|
|
};
|
|
|
|
struct PSF2_HEADER
|
|
{
|
|
uint8_t magic[4];
|
|
uint32_t version;
|
|
uint32_t headersize;
|
|
uint32_t flags;
|
|
uint32_t length;
|
|
uint32_t charsize;
|
|
uint32_t height, width;
|
|
};
|
|
|
|
typedef struct _PSF1_FONT
|
|
{
|
|
PSF1_HEADER *Header;
|
|
void *GlyphBuffer;
|
|
} PSF1_FONT;
|
|
|
|
typedef struct _PSF2_FONT
|
|
{
|
|
PSF2_HEADER *Header;
|
|
void *GlyphBuffer;
|
|
} PSF2_FONT;
|
|
|
|
enum FontType
|
|
{
|
|
None,
|
|
PCScreenFont1,
|
|
PCScreenFont2
|
|
};
|
|
|
|
struct FontInfo
|
|
{
|
|
uintptr_t *StartAddress;
|
|
uintptr_t *EndAddress;
|
|
PSF1_FONT *PSF1Font;
|
|
PSF2_FONT *PSF2Font;
|
|
uint32_t Width, Height;
|
|
FontType Type;
|
|
};
|
|
|
|
class Font
|
|
{
|
|
private:
|
|
FontInfo Info;
|
|
|
|
public:
|
|
FontInfo GetInfo() { return Info; }
|
|
Font(uintptr_t *Start, uintptr_t *End, FontType Type);
|
|
~Font();
|
|
};
|
|
|
|
struct ScreenBuffer
|
|
{
|
|
void *Buffer = nullptr;
|
|
uint32_t Width, Height;
|
|
size_t Size;
|
|
uint32_t Color;
|
|
uint32_t CursorX, CursorY;
|
|
long Checksum;
|
|
};
|
|
|
|
class Display
|
|
{
|
|
private:
|
|
BootInfo::FramebufferInfo framebuffer;
|
|
Font *CurrentFont;
|
|
ScreenBuffer *Buffers[256];
|
|
bool ColorIteration = false;
|
|
int ColorPickerIteration = 0;
|
|
|
|
public:
|
|
Font *GetCurrentFont();
|
|
void SetCurrentFont(Font *Font);
|
|
void CreateBuffer(uint32_t Width, uint32_t Height, int Index);
|
|
void SetBuffer(int Index);
|
|
ScreenBuffer *GetBuffer(int Index);
|
|
void ClearBuffer(int Index);
|
|
void DeleteBuffer(int Index);
|
|
void SetBufferCursor(int Index, uint32_t X, uint32_t Y);
|
|
void GetBufferCursor(int Index, uint32_t *X, uint32_t *Y);
|
|
void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index);
|
|
uint32_t GetPixel(uint32_t X, uint32_t Y, int Index);
|
|
uint16_t GetBitsPerPixel();
|
|
uint64_t GetPitch();
|
|
void Scroll(int Index, int Lines);
|
|
|
|
char Print(char Char, int Index, bool WriteToUART = false);
|
|
void DrawString(const char *String, uint32_t X, uint32_t Y, int Index, bool WriteToUART = false);
|
|
Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont = true);
|
|
~Display();
|
|
};
|
|
}
|
|
|
|
#endif // !__FENNIX_KERNEL_DISPLAY_H__
|