|
|
1.1 root 1: /* Support for minimal console's bell using PC speaker.
2: This replaces the default oskit function that busy-waits. */
3:
4: #include <oskit/machine/pc/direct_cons.h>
5: #include <oskit/machine/pc/speaker.h>
6:
7: #include "time_out.h"
8:
9: #define BELL_FREQUENCY 750 /* Hz */
10: #define BELL_DURATION (hz>>3) /* 1/8th second duration */
11:
12: /* This is the private timer used to turn off the speaker. */
13: static timer_elt_data_t bell_timer = { fcn: (int (*)()) &pc_speaker_off };
14:
15: void
16: direct_cons_bell (void)
17: {
18: /* Cancel the timeout for a bell we are already ringing. */
19: if (reset_timeout (&bell_timer))
20: /* Turn the speaker off for an instant to distinguish this bell
21: from the next. */
22: pc_speaker_off ();
23:
24: /* Turn the speaker on and set the timeout to turn it off. */
25: pc_speaker_on (BELL_FREQUENCY);
26: set_timeout (&bell_timer, BELL_DURATION);
27: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.