blob: 794945c244042ebeb8d1c234696e6cd530576a4e [file] [log] [blame]
Stefan Reinauer67fed692009-11-05 12:38:34 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
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.
Stefan Reinauer67fed692009-11-05 12:38:34 +000014 */
15
16#ifndef PC80_I8254_H
17#define PC80_I8254_H
18
Stefan Reinauer67fed692009-11-05 12:38:34 +000019/* Ports for the 8254 timer chip */
20#define TIMER0_PORT 0x40
21#define TIMER1_PORT 0x41
22#define TIMER2_PORT 0x42
23#define TIMER_MODE_PORT 0x43
24
25/* Meaning of the mode bits */
26#define TIMER0_SEL 0x00
27#define TIMER1_SEL 0x40
28#define TIMER2_SEL 0x80
29#define READBACK_SEL 0xC0
30
31#define LATCH_COUNT 0x00
32#define LOBYTE_ACCESS 0x10
33#define HIBYTE_ACCESS 0x20
34#define WORD_ACCESS 0x30
35
36#define MODE0 0x00
37#define MODE1 0x02
38#define MODE2 0x04
39#define MODE3 0x06
40#define MODE4 0x08
41#define MODE5 0x0A
42
43#define BINARY_COUNT 0x00
44#define BCD_COUNT 0x01
45
46/* Timers tick over at this rate */
47#define TICKS_PER_MS 1193
48
49/* Parallel Peripheral Controller Port B */
50#define PPC_PORTB 0x61
51
52/* Meaning of the port bits */
53#define PPCB_T2OUT 0x20 /* Bit 5 */
54#define PPCB_SPKR 0x02 /* Bit 1 */
55#define PPCB_T2GATE 0x01 /* Bit 0 */
56
Stefan Reinauer491e2a22011-09-27 16:26:05 -070057void setup_i8254(void);
Edward O'Callaghanc5fff752014-06-24 16:29:12 +100058
59#endif /* PC80_I8254_H */