Debian Codegraph @

src/include/pc80/i8254.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef PC80_I8254_H
4 #define PC80_I8254_H
5
6 /* Ports for the 8254 timer chip */
7 #define TIMER0_PORT 0x40
8 #define TIMER1_PORT 0x41
9 #define TIMER2_PORT 0x42
10 #define TIMER_MODE_PORT 0x43
11
12 /* Meaning of the mode bits */
13 #define TIMER0_SEL 0x00
14 #define TIMER1_SEL 0x40
15 #define TIMER2_SEL 0x80
16 #define READBACK_SEL 0xC0
17
18 #define LATCH_COUNT 0x00
19 #define LOBYTE_ACCESS 0x10
20 #define HIBYTE_ACCESS 0x20
21 #define WORD_ACCESS 0x30
22
23 #define MODE0 0x00
24 #define MODE1 0x02
25 #define MODE2 0x04
26 #define MODE3 0x06
27 #define MODE4 0x08
28 #define MODE5 0x0A
29
30 #define BINARY_COUNT 0x00
31 #define BCD_COUNT 0x01
32
33 /* Timers tick over at this rate */
34 #define TICKS_PER_MS 1193
35
36 /* Parallel Peripheral Controller Port B */
37 #define PPC_PORTB 0x61
38
39 /* Meaning of the port bits */
40 #define PPCB_T2OUT 0x20 /* Bit 5 */
41 #define PPCB_SPKR 0x02 /* Bit 1 */
42 #define PPCB_T2GATE 0x01 /* Bit 0 */
43
44 void setup_i8254(void);
45 unsigned long calibrate_tsc_with_pit(void);
46 void beep(unsigned int frequency_hz, unsigned int duration_msec);
47
48 #endif /* PC80_I8254_H */