mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-13 23:36:49 +00:00
new: 增加实验性质的蜂鸣器发声函数(未来将移除)
This commit is contained in:
parent
c39af9d952
commit
3c4a953388
@ -1,3 +1,28 @@
|
|||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
#include "string.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<times;++i)
|
||||||
|
pause();
|
||||||
|
x = io_in8(0x61);
|
||||||
|
x &= 0xfc;
|
||||||
|
io_out8(0x61, x&0xff);
|
||||||
|
|
||||||
|
// 延迟一段时间
|
||||||
|
for(uint64_t i=0;i<times;++i)
|
||||||
|
pause();
|
||||||
|
}
|
@ -484,3 +484,10 @@ static inline uint64_t copy_to_user(void *dst, void *src, uint64_t size)
|
|||||||
: "memory");
|
: "memory");
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 这个函数让蜂鸣器发声,目前仅用于真机调试。未来将移除,请勿依赖此函数。
|
||||||
|
*
|
||||||
|
* @param times 发声循环多少遍
|
||||||
|
*/
|
||||||
|
void __experimental_beep(uint64_t times);
|
Loading…
x
Reference in New Issue
Block a user