mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
Kernel: Move TTY-related code to a new subdirectory under Devices
The TTY subsystem is represented with unix devices, so it should be under the Devices directory like the Audio, Storage, GPU and HID subsystems.
This commit is contained in:
parent
c99c065a40
commit
b55199c227
31 changed files with 42 additions and 42 deletions
45
Kernel/Devices/TTY/ConsoleManagement.h
Normal file
45
Kernel/Devices/TTY/ConsoleManagement.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Devices/TTY/VirtualConsole.h>
|
||||
#include <Kernel/Library/NonnullLockRefPtr.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class ConsoleManagement {
|
||||
friend class VirtualConsole;
|
||||
|
||||
public:
|
||||
ConsoleManagement();
|
||||
|
||||
static constexpr size_t s_max_virtual_consoles = 6;
|
||||
|
||||
static bool is_initialized();
|
||||
static ConsoleManagement& the();
|
||||
|
||||
void switch_to(unsigned);
|
||||
void initialize();
|
||||
|
||||
void resolution_was_changed();
|
||||
|
||||
void switch_to_debug() { switch_to(1); }
|
||||
|
||||
NonnullLockRefPtr<VirtualConsole> first_tty() const { return m_consoles[0]; }
|
||||
NonnullLockRefPtr<VirtualConsole> debug_tty() const { return m_consoles[1]; }
|
||||
|
||||
RecursiveSpinlock<LockRank::None>& tty_write_lock() { return m_tty_write_lock; }
|
||||
|
||||
private:
|
||||
Vector<NonnullLockRefPtr<VirtualConsole>, s_max_virtual_consoles> m_consoles;
|
||||
VirtualConsole* m_active_console { nullptr };
|
||||
Spinlock<LockRank::None> m_lock {};
|
||||
RecursiveSpinlock<LockRank::None> m_tty_write_lock {};
|
||||
};
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue