From 3c4a9533883d628e28c89905fcdbd53842041ef3 Mon Sep 17 00:00:00 2001 From: fslongjin Date: Wed, 31 Aug 2022 18:04:38 +0800 Subject: [PATCH] =?UTF-8?q?new:=20=E5=A2=9E=E5=8A=A0=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E6=80=A7=E8=B4=A8=E7=9A=84=E8=9C=82=E9=B8=A3=E5=99=A8=E5=8F=91?= =?UTF-8?q?=E5=A3=B0=E5=87=BD=E6=95=B0=EF=BC=88=E6=9C=AA=E6=9D=A5=E5=B0=86?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/common/glib.c | 25 +++++++++++++++++++++++++ kernel/common/glib.h | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/kernel/common/glib.c b/kernel/common/glib.c index e5ae7aa3..2e80ec09 100644 --- a/kernel/common/glib.c +++ b/kernel/common/glib.c @@ -1,3 +1,28 @@ #include "glib.h" #include "string.h" +/** + * @brief 这个函数让蜂鸣器发声,目前仅用于真机调试。未来将移除,请勿依赖此函数。 + * + * @param times 发声循环多少遍 + */ +void __experimental_beep(uint64_t times) +{ + io_out8(0x43, 182&0xff); + io_out8(0x42, 2280&0xff); + io_out8(0x42, (2280>>8)&0xff); + uint32_t x = io_in8(0x61)&0xff; + x |= 3; + io_out8(0x61, x&0xff); + + times *= 10000; + for(uint64_t i=0;i