2020-07-30 21:38:15 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-30 21:38:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Kernel/Devices/PCSpeaker.h>
|
|
|
|
#include <Kernel/Process.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2021-11-07 23:51:39 +00:00
|
|
|
ErrorOr<FlatPtr> Process::sys$beep()
|
2020-07-30 21:38:15 +00:00
|
|
|
{
|
2021-08-06 11:22:21 +00:00
|
|
|
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
2020-07-30 21:38:15 +00:00
|
|
|
PCSpeaker::tone_on(440);
|
2021-02-27 22:56:16 +00:00
|
|
|
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
|
2020-07-30 21:38:15 +00:00
|
|
|
PCSpeaker::tone_off();
|
2020-11-15 18:58:19 +00:00
|
|
|
if (result.was_interrupted())
|
2021-03-01 12:49:16 +00:00
|
|
|
return EINTR;
|
2020-07-30 21:38:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|