很简单,代码如下:

void 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);
}

转载请注明来源:https://longjin666.cn/?p=1537

欢迎关注我的公众号“灯珑”,让我们一起了解更多的事物~

你也可能喜欢

发表评论