Displaying 1 result from an estimated 1 matches for "beep_on".
Did you mean:
sleep_on
2020 Jan 22
0
[PATCH] com32/modules: introduce play module
...2 0x80
+#define PIT_CTRL_READLOAD_WORD 0x30
+#define PIT_CTRL_SQUAREWAVE_GEN 0x06
+#define PIT_CTRL_COUNT_BINARY 0x00
+
+static void beep_off(void)
+{
+ unsigned char status;
+
+ status = inb(PIT_SPEAKER_PORT);
+ outb(status & ~(PIT_SPK_TMR2 | PIT_SPK_DATA), PIT_SPEAKER_PORT);
+}
+
+static void beep_on(uint16_t pitch)
+{
+ unsigned char status;
+ unsigned int counter;
+
+ if (pitch < 20)
+ pitch = 20;
+ else if (pitch > 20000)
+ pitch = 20000;
+
+ counter = SPEAKER_PIT_FREQUENCY / pitch;
+ outb(PIT_CTRL_SELECT_2
+ | PIT_CTRL_READLOAD_WORD
+ | PIT_CTRL_SQUAREWAVE_GEN
+ | PIT_CTRL_COU...