Displaying 1 result from an estimated 1 matches for "pit_ctrl_squarewave_gen".
2020 Jan 22
0
[PATCH] com32/modules: introduce play module
...#define BASE_TEMPO (60 * 1000)
+#define T_REST 0
+
+#define PIT_COUNTER_2 0x42
+#define PIT_CTRL 0x43
+#define PIT_SPEAKER_PORT 0x61
+
+#define PIT_SPK_TMR2 0x01
+#define PIT_SPK_DATA 0x02
+#define PIT_SPK_TMR2_LATCH 0x20
+#define PIT_CTRL_SELECT_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;
+...