📄 kernstream.hxx
字号:
#ifndef __KERNSTREAM_HXX__#define __KERNSTREAM_HXX__/* * Copyright (C) 2001, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * This program 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 2, * or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <kerninc/kernel.hxx>/** KernStream is really an interface specification. The kernel * maintains three KernStreams: ConsoleStream, SerialStream, * LogStream. LogStream is global, and present in all * kernels. ConsoleStream is present if a console is * configured. SerialStream is present if the kernel debugger has been * configured for serial mode. * * Pointers to the ConsoleStream and SerialStream objects are in * turn conditionally assigned to two variables syscon_stream and * dbg_stream. */struct ASCII { enum { NUL = 0x00, SOH = 0x01, STX = 0x02, ETX = 0x03, EOT = 0x04, ENQ = 0x05, ACK = 0x06, BEL = 0x07, BS = 0x08, TAB = 0x09, LF = 0x0a, VT = 0x0b, FF = 0x0c, CR = 0x0d, SO = 0x0e, SI = 0x0f, DLE = 0x10, DC1 = 0x11, DC2 = 0x12, DC3 = 0x13, DC4 = 0x14, NAK = 0x15, SYN = 0x16, ETB = 0x17, CAN = 0x18, EM = 0x19, SUB = 0x1a, ESC = 0x1b, FS = 0x1c, GS = 0x1d, RS = 0x1e, US = 0x1f, SPC = 0x20, DEL = 0x7f, };};struct KernStream { virtual void Init() = 0; virtual void Put(uint8_t c) = 0;#ifdef OPTION_DDB /* Following only called via dbg_stream */ virtual uint8_t Get() = 0; virtual void SetDebugging(bool onoff) = 0; virtual void EnableDebuggerInput() = 0;#endif /*** END OF MEMBERS -- REST IS JUST NAMESPACE TRICKERY ***/#ifdef OPTION_DDB static bool debuggerIsActive;#endif /* I would like to make these references, but the global constructor * code generator is screwing up the pointer initialization. */ static KernStream* LogStream; static KernStream* ConsoleStream;#ifdef OPTION_DDB_ON_TTY0 static KernStream* SerialStream;#endif#ifdef OPTION_DDB static KernStream *dbg_stream;#endif static KernStream *syscon_stream; static KernStream *log_stream; static bool IsPrint(uint8_t c); static void KernStream::InitStreams(); static void PutBuf(uint8_t *s, uint32_t len); static void nl_putc(char c); static void do_putc(char c); static void BeginUserThreads();};#endif /* __KERNSTREAM_HXX__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -