1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/kaleid/include/kernel/term.h
Adrien Bourmault 228df83a1a Merging from master (#34)
* Update Readme.md

* Debug this beautiful panicked kernel !

* Stuff I don't remember

* stuff

* merge

* merge

* Step 0 : InitTerms() is the bug

* Debug stuff

* Step 1 : StartPanic is the real problem

* Step 1 : StartPanic is the real problem

* Step 1 : StartPanic is the real problem

* Step 1 : In StartPanic is the real problem

* Step 1 : In StartPanic is the real problem

* Step 1 : In StartPanic is the real problem

* Step 1 : In StartPanic is the real problem

* Step 1 : In StartPanic is the real problem

* Step 1.5 : \n was a problem

* Step 2 : Well... It was a 'sleepy' problem

* Step 2 : Well... It was a 'sleepy' problem

* Step 2.1 : GetPanicStr is an array

* Step 2.2 : Now panic accept 8 chars

* Ok then !
2019-03-11 19:22:37 +01:00

123 lines
4.1 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Terminal-related functions //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K 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 //
// any later version. //
// //
// OS/K 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 OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#ifndef _KALKERN_PROC_H
#include <kernel/proc.h> // for GetCurProc() and Process_t
#endif
#ifndef _KALKERN_TERM_H
#define _KALKERN_TERM_H
//------------------------------------------//
//
// Size of a tabulation in spaces
// Default: 4 spaces/tab
//
enum { KTABSIZE = 4 };
//
// The VGA colors
//
enum TermColor_t
{
KTERM_COLOR_BLACK, KTERM_COLOR_BLUE,
KTERM_COLOR_GREEN, KTERM_COLOR_CYAN,
KTERM_COLOR_RED, KTERM_COLOR_MAGENTA,
KTERM_COLOR_BROWN, KTERM_COLOR_LGREY,
KTERM_COLOR_DARK_GREY, KTERM_COLOR_LBLUE,
KTERM_COLOR_LGREEN, KTERM_COLOR_LCYAN,
KTERM_COLOR_LRED, KTERM_COLOR_LMAGENTA,
KTERM_COLOR_LBROWN, KTERM_COLOR_WHITE
};
//
// Terminal structure, right now VGA and output only
//
struct Terminal_t
{
uint initDone;
Lock_t lock;
const char *name;
const char *type;
void *data;
size_t width;
size_t height;
off_t currentX;
off_t currentY;
uint tabSize;
TermColor_t fgColor;
TermColor_t bgColor;
// Defined in driver
error_t (*ClearTermUnlocked)(Terminal_t *);
error_t (*PutOnTermUnlocked)(Terminal_t *, char);
error_t (*PrintOnTermUnlocked)(Terminal_t *, const char *);
};
//------------------------------------------//
void InitTerms(void);
error_t ClearTerm(Terminal_t *);
error_t PutOnTerm(Terminal_t *, char);
error_t PrintOnTerm(Terminal_t *, const char *);
error_t ChTermColor(Terminal_t *, TermColor_t, TermColor_t);
error_t KernLog(const char *, ...);
//------------------------------------------//
extern Terminal_t *stdOut;
#define GetStdOut() (stdOut)
#define SetStdOut(x) (stdOut = (x))
// Debug purposes
volatile ushort *vga;
//------------------------------------------//
#ifndef _NO_DEBUG
extern Terminal_t *stdDbg;
#define GetStdDbg() (stdDbg)
#define SetStdDbg(x) (stdDbg = (x))
error_t DebugLog(const char *, ...);
#else // _NO_DEBUG
#define GetStdDbg() NULL
#define SetStdDbg(x) ((void)0)
#define DebugLog(fmt, ...) EOK
#endif
//------------------------------------------//
#endif