From a6b67d12dc98e48fae69c8df411a3dda65ea48cf Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 16 Sep 2019 20:01:31 +0200 Subject: Added small boot-up chime --- src/kernel.c | 10 +++++++++- src/sound/frequency.c | 7 +++---- src/sound/sound.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/kernel.c b/src/kernel.c index 102c21e..ca4150e 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -19,6 +19,14 @@ void kernel_main(void) { mouse_install(); terminal_write_string("Melvix loaded successfully!\n"); - beep(); + + beep(262, 20); + beep(294, 20); + beep(330, 20); + beep(349, 20); + beep(392, 20); + beep(440, 20); + beep(494, 20); + beep(523, 20); // __asm__ ("div %0" :: "r"(0)); // Exception testing x/0 } \ No newline at end of file diff --git a/src/sound/frequency.c b/src/sound/frequency.c index e5e831c..6d02690 100644 --- a/src/sound/frequency.c +++ b/src/sound/frequency.c @@ -11,7 +11,6 @@ static void play_sound(uint32_t frequency) { send(0x42, (uint8_t) (divided)); send(0x42, (uint8_t) (divided >> 8)); - //And play the sound using the PC speaker tmp = receive(0x61); if (tmp != (tmp | 3)) { send(0x61, tmp | 3); @@ -25,8 +24,8 @@ static void shut_up() { } //Make a beep -void beep() { - play_sound(1000); - timer_wait(100); +void beep(uint32_t frequency, uint32_t ticks) { + play_sound(frequency); + timer_wait(ticks); shut_up(); } \ No newline at end of file diff --git a/src/sound/sound.h b/src/sound/sound.h index f8692ea..baf70b2 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -1,6 +1,6 @@ #ifndef MELVIX_SOUND_H #define MELVIX_SOUND_H -void beep(); +void beep(uint32_t frequency, uint32_t ticks); #endif -- cgit v1.2.3