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

117 lines
4.0 KiB
C
Raw Normal View History

2019-02-16 23:36:33 +01:00
//----------------------------------------------------------------------------//
// 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 };
2019-03-18 14:21:00 +01:00
//
// Upper bound on what a single KernLog() can write
//
enum { KLOG_MAX_BUFSIZE = 4096 };
2019-02-16 23:36:33 +01:00
//
// 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
2019-03-19 13:37:23 +01:00
error_t (*clear)(Terminal_t *);
error_t (*putchar)(Terminal_t *, char);
2019-02-16 23:36:33 +01:00
};
//------------------------------------------//
void InitTerms(void);
error_t ClearTerm(Terminal_t *);
2019-03-19 13:37:23 +01:00
error_t ChTermColor(Terminal_t *, TermColor_t, TermColor_t);
2019-02-16 23:36:33 +01:00
error_t PutOnTerm(Terminal_t *, char);
2019-03-19 13:37:23 +01:00
error_t PutOnTermUnlocked(Terminal_t *, char);
2019-02-16 23:36:33 +01:00
error_t PrintOnTerm(Terminal_t *, const char *);
2019-03-19 13:37:23 +01:00
error_t PrintOnTermUnlocked(Terminal_t *, const char *);
2019-02-16 23:36:33 +01:00
error_t KernLog(const char *, ...);
2019-02-16 23:36:33 +01:00
//------------------------------------------//
2019-03-19 13:37:23 +01:00
extern Terminal_t *StdOut;
extern Terminal_t *StdDbg;
2019-02-16 23:36:33 +01:00
//------------------------------------------//
#ifndef _NO_DEBUG
2019-03-24 14:44:59 +01:00
error_t DebugLog(const char *, ...);
#else // _NO_DEBUG
2019-03-24 14:44:59 +01:00
#define DebugLog(fmt, ...) EOK
2019-02-16 23:36:33 +01:00
#endif
//------------------------------------------//
#endif