initial import
[dosrtxon] / src / dos / pit8254.h
1 /*
2 colcycle - color cycling image viewer
3 Copyright (C) 2016  John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef PIT8254_H_
19 #define PIT8254_H_
20
21 /* frequency of the oscillator driving the 8254 timer */
22 #define OSC_FREQ_HZ             1193182
23
24 /* I/O ports connected to the 8254 */
25 #define PORT_DATA0      0x40
26 #define PORT_DATA1      0x41
27 #define PORT_DATA2      0x42
28 #define PORT_CMD        0x43
29
30 /* command bits */
31 #define CMD_CHAN0                       0
32 #define CMD_CHAN1                       (1 << 6)
33 #define CMD_CHAN2                       (2 << 6)
34 #define CMD_RDBACK                      (3 << 6)
35
36 #define CMD_LATCH                       0
37 #define CMD_ACCESS_LOW          (1 << 4)
38 #define CMD_ACCESS_HIGH         (2 << 4)
39 #define CMD_ACCESS_BOTH         (3 << 4)
40
41 #define CMD_OP_INT_TERM         0
42 #define CMD_OP_ONESHOT          (1 << 1)
43 #define CMD_OP_RATE                     (2 << 1)
44 #define CMD_OP_SQWAVE           (3 << 1)
45 #define CMD_OP_SW_STROBE        (4 << 1)
46 #define CMD_OP_HW_STROBE        (5 << 1)
47
48 #define CMD_MODE_BIN            0
49 #define CMD_MODE_BCD            1
50
51 #endif  /* PIT8254_H_ */