1 /* Taken from Etherboot */
2 /* Defines for routines to implement a low-overhead timer for drivers */
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2, or (at
8 * your option) any later version.
14 /* Ports for the 8254 timer chip */
15 #define TIMER2_PORT 0x42
16 #define TIMER_MODE_PORT 0x43
18 /* Meaning of the mode bits */
19 #define TIMER0_SEL 0x00
20 #define TIMER1_SEL 0x40
21 #define TIMER2_SEL 0x80
22 #define READBACK_SEL 0xC0
24 #define LATCH_COUNT 0x00
25 #define LOBYTE_ACCESS 0x10
26 #define HIBYTE_ACCESS 0x20
27 #define WORD_ACCESS 0x30
36 #define BINARY_COUNT 0x00
37 #define BCD_COUNT 0x01
39 /* Timers tick over at this rate */
40 #define CLOCK_TICK_RATE 1193180U
41 #define TICKS_PER_MS (CLOCK_TICK_RATE/1000)
43 /* Parallel Peripheral Controller Port B */
44 #define PPC_PORTB 0x61
46 /* Meaning of the port bits */
47 #define PPCB_T2OUT 0x20 /* Bit 5 */
48 #define PPCB_SPKR 0x02 /* Bit 1 */
49 #define PPCB_T2GATE 0x01 /* Bit 0 */
51 extern void setup_timers(void);
52 extern void ndelay(unsigned int nsecs
);
53 extern void udelay(unsigned int usecs
);
54 extern void mdelay(unsigned int msecs
);
55 extern unsigned long currticks(void);
56 extern unsigned long get_timer_freq(void);
58 #define TICKS_PER_SEC 1000