diff options
Diffstat (limited to 'src/kernel/sound/frequency.c')
-rw-r--r-- | src/kernel/sound/frequency.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/kernel/sound/frequency.c b/src/kernel/sound/frequency.c index 2a88446..5ad76b3 100644 --- a/src/kernel/sound/frequency.c +++ b/src/kernel/sound/frequency.c @@ -2,29 +2,32 @@ #include <kernel/io/io.h> #include <kernel/timer/timer.h> -void play_sound(uint32_t frequency) { +void play_sound(uint32_t frequency) +{ uint32_t divided; uint8_t tmp; divided = 1193180 / frequency; - send_b(0x43, 0xb6); - send_b(0x42, (uint8_t) (divided)); - send_b(0x42, (uint8_t) (divided >> 8)); + outb(0x43, 0xb6); + outb(0x42, (uint8_t) (divided)); + outb(0x42, (uint8_t) (divided >> 8)); - tmp = receive_b(0x61); + tmp = inb(0x61); if (tmp != (tmp | 3)) { - send_b(0x61, tmp | 3); + outb(0x61, tmp | 3); } } -static void shut_up() { - uint8_t tmp = receive_b(0x61) & 0xFC; +static void shut_up() +{ + uint8_t tmp = inb(0x61) & 0xFC; - send_b(0x61, tmp); + outb(0x61, tmp); } // Make a beep -void beep(uint32_t frequency, uint32_t ticks) { +void beep(uint32_t frequency, uint32_t ticks) +{ play_sound(frequency); timer_wait(ticks); shut_up(); |