Kernel: Move PCSpeaker code to the x86-specific architecture directory

The PCSpeaker code is specific to x86 platforms, thus it makes sense to
put in the Arch/x86 subdirectory.
This commit is contained in:
Liav A 2022-09-02 15:50:56 +03:00 committed by Linus Groh
parent 1596ee241f
commit fdef8d0d37
5 changed files with 14 additions and 4 deletions

View file

@ -5,7 +5,7 @@
*/
#include <Kernel/Arch/x86/IO.h>
#include <Kernel/Devices/PCSpeaker.h>
#include <Kernel/Arch/x86/common/PCSpeaker.h>
#include <Kernel/Time/PIT.h>
void PCSpeaker::tone_on(int frequency)

View file

@ -59,7 +59,6 @@ set(KERNEL_SOURCES
Devices/MemoryDevice.cpp
Devices/NullDevice.cpp
Devices/PCISerialDevice.cpp
Devices/PCSpeaker.cpp
Devices/RandomDevice.cpp
Devices/SelfTTYDevice.cpp
Devices/SerialDevice.cpp
@ -335,6 +334,7 @@ if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64")
Arch/x86/common/DebugOutput.cpp
Arch/x86/common/Delay.cpp
Arch/x86/common/I8042Reboot.cpp
Arch/x86/common/PCSpeaker.cpp
Arch/x86/common/RTC.cpp
Arch/x86/common/ScopedCritical.cpp
Arch/x86/common/SmapDisabler.cpp

View file

@ -5,7 +5,9 @@
*/
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/PCSpeaker.h>
#if ARCH(I386) || ARCH(X86_64)
# include <Kernel/Arch/x86/common/PCSpeaker.h>
#endif
#include <Kernel/Process.h>
namespace Kernel {
@ -15,12 +17,16 @@ ErrorOr<FlatPtr> Process::sys$beep()
VERIFY_NO_PROCESS_BIG_LOCK(this);
if (!kernel_command_line().is_pc_speaker_enabled())
return ENODEV;
#if ARCH(I386) || ARCH(X86_64)
PCSpeaker::tone_on(440);
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
PCSpeaker::tone_off();
if (result.was_interrupted())
return EINTR;
return 0;
#else
return ENOTIMPL;
#endif
}
}

View file

@ -8,11 +8,13 @@
#include <AK/StdLibExtras.h>
#include <Kernel/Arch/Delay.h>
#if ARCH(I386) || ARCH(X86_64)
# include <Kernel/Arch/x86/common/PCSpeaker.h>
#endif
#include <Kernel/CommandLine.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/DeviceManagement.h>
#include <Kernel/Devices/HID/HIDManagement.h>
#include <Kernel/Devices/PCSpeaker.h>
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/Heap/kmalloc.h>
#include <Kernel/Sections.h>
@ -327,9 +329,11 @@ void VirtualConsole::beep()
{
if (!kernel_command_line().is_pc_speaker_enabled())
return;
#if ARCH(I386) || ARCH(X86_64)
PCSpeaker::tone_on(440);
microseconds_delay(10000);
PCSpeaker::tone_off();
#endif
}
void VirtualConsole::set_window_title(StringView)