mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +00:00
Kernel+Userland: Add support for using the PCSpeaker with various tones
This commit is contained in:
parent
2d27c98659
commit
11a7e21c2a
9 changed files with 26 additions and 12 deletions
|
@ -291,7 +291,7 @@ public:
|
|||
ErrorOr<FlatPtr> sys$emuctl();
|
||||
ErrorOr<FlatPtr> sys$yield();
|
||||
ErrorOr<FlatPtr> sys$sync();
|
||||
ErrorOr<FlatPtr> sys$beep();
|
||||
ErrorOr<FlatPtr> sys$beep(int tone);
|
||||
ErrorOr<FlatPtr> sys$get_process_name(Userspace<char*> buffer, size_t buffer_size);
|
||||
ErrorOr<FlatPtr> sys$set_process_name(Userspace<char const*> user_name, size_t user_name_length);
|
||||
ErrorOr<FlatPtr> sys$create_inode_watcher(u32 flags);
|
||||
|
|
|
@ -12,13 +12,15 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$beep()
|
||||
ErrorOr<FlatPtr> Process::sys$beep(int tone)
|
||||
{
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
if (!kernel_command_line().is_pc_speaker_enabled())
|
||||
return ENODEV;
|
||||
if (tone < 20 || tone > 20000)
|
||||
return EINVAL;
|
||||
#if ARCH(X86_64)
|
||||
PCSpeaker::tone_on(440);
|
||||
PCSpeaker::tone_on(tone);
|
||||
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
|
||||
PCSpeaker::tone_off();
|
||||
if (result.was_interrupted())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue