aa1c82f81e
- Add usr/ subsystem: in-kernel cpio initramfs unpacker, gen_init_cpio tool, Kconfig, Makefile - Add init/ subsystem: UTS metadata (airlys_banner, linux_banner), BogoMIPS calibration loop, delay functions - Add block/ subsystem: block device registration, MBR partition table scanner, No-Op I/O elevator scheduler - Add ipc/ subsystem: POSIX circular pipes, System V message queues, counting semaphores - Add crypto/ subsystem: FIPS 180-4 SHA-256 and IEEE 802.3 CRC-32 cryptographic engines - Add net/ subsystem: socket buffer (sk_buff) manager, loopback (lo) interface, ARP table - Add sound/ subsystem: ALSA audio core, PCM stream queue, PC Speaker PIT channel 2 hardware driver - Add virt/ subsystem: VirtIO hypervisor PCI discovery and split-ring virtqueues - Add certs/ subsystem: sovereign X.509 keyring and certificate authority - Add samples/ subsystem: sample kernel worker thread and IPC pipe demonstration modules - Add top-level Linux root metadata: Kconfig, Kbuild, MAINTAINERS, Documentation/, LICENSES/ - Wire all subsystems into kernel_main and airlys-sh shell commands (lsblk, netdev, initramfs, virtio, keyring, pipe, beep, sha256, crc32) - Zero-warning freestanding build verification with clang & ld.lld (x86_64-unknown-none-elf) Co-Authored-By: Er. Adam Eehan <adameehanairagroup@gmail.com> Co-Authored-By: Sovereign AI Aira 3 Ultra (Engine v3.6)
36 lines
735 B
C
36 lines
735 B
C
#include <airlys/sound.h>
|
|
#include <airlys/io.h>
|
|
#include <airlys/timer.h>
|
|
|
|
void pcspkr_tone(uint32_t freq_hz) {
|
|
if (freq_hz == 0) {
|
|
pcspkr_stop();
|
|
return;
|
|
}
|
|
|
|
uint32_t div = 1193180 / freq_hz;
|
|
if (div == 0) div = 1;
|
|
|
|
outb(0x43, 0xB6);
|
|
outb(0x42, (uint8_t)(div & 0xFF));
|
|
outb(0x42, (uint8_t)((div >> 8) & 0xFF));
|
|
|
|
uint8_t tmp = inb(0x61);
|
|
if ((tmp & 3) != 3) {
|
|
outb(0x61, tmp | 3);
|
|
}
|
|
}
|
|
|
|
void pcspkr_stop(void) {
|
|
uint8_t tmp = inb(0x61) & 0xFC;
|
|
outb(0x61, tmp);
|
|
}
|
|
|
|
void pcspkr_beep(uint32_t freq_hz, uint32_t duration_ms) {
|
|
pcspkr_tone(freq_hz);
|
|
uint32_t ticks = duration_ms / 10;
|
|
if (ticks == 0) ticks = 1;
|
|
timer_sleep(ticks);
|
|
pcspkr_stop();
|
|
}
|