1
/* Defines for routines to implement a low-overhead timer for drivers */
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2, or (at
7
* your option) any later version.
13
/* Ports for the 8254 timer chip */
14
#define TIMER2_PORT 0x42
15
#define TIMER_MODE_PORT 0x43
17
/* Meaning of the mode bits */
18
#define TIMER0_SEL 0x00
19
#define TIMER1_SEL 0x40
20
#define TIMER2_SEL 0x80
21
#define READBACK_SEL 0xC0
23
#define LATCH_COUNT 0x00
24
#define LOBYTE_ACCESS 0x10
25
#define HIBYTE_ACCESS 0x20
26
#define WORD_ACCESS 0x30
35
#define BINARY_COUNT 0x00
36
#define BCD_COUNT 0x01
38
/* Timers tick over at this rate */
39
#define CLOCK_TICK_RATE 1193180U
40
#define TICKS_PER_MS (CLOCK_TICK_RATE/1000)
42
/* Parallel Peripheral Controller Port B */
43
#define PPC_PORTB 0x61
45
/* Meaning of the port bits */
46
#define PPCB_T2OUT 0x20 /* Bit 5 */
47
#define PPCB_SPKR 0x02 /* Bit 1 */
48
#define PPCB_T2GATE 0x01 /* Bit 0 */
50
/* Ticks must be between 0 and 65535 (0 == 65536)
51
because it is a 16 bit counter */
52
extern void load_timer2(unsigned int ticks);
53
extern inline int timer2_running(void);
54
extern void waiton_timer2(unsigned int ticks);
56
extern void setup_timers(void);
57
extern void ndelay(unsigned int nsecs);
58
extern void udelay(unsigned int usecs);
59
extern void mdelay(unsigned int msecs);