/* * Copyright (c) 2018-2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Kernel { class ConsoleDevice final : public CharacterDevice { AK_MAKE_ETERNAL public: static ConsoleDevice& the(); static void initialize(); static bool is_initialized(); ConsoleDevice(); virtual ~ConsoleDevice() override; // ^CharacterDevice virtual bool can_read(const Kernel::OpenFileDescription&, size_t) const override; virtual bool can_write(const Kernel::OpenFileDescription&, size_t) const override { return true; } virtual Kernel::KResultOr read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override; virtual Kernel::KResultOr write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override; virtual StringView class_name() const override { return "Console"; } void put_char(char); const CircularQueue& logbuffer() const { return m_logbuffer; } private: CircularQueue m_logbuffer; }; }