|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1992 NeXT Computer, Inc.
27: *
28: * 8253 Timer (PIT) definitions.
29: *
30: * HISTORY
31: *
32: * 30 May 1992 ? at NeXT
33: * Formalized 8253 support.
34: *
35: * 24 March 1992 ? at NeXT
36: * Created.
37: */
38:
39: /*
40: * Control register.
41: */
42: typedef struct {
43: unsigned char
44: bcd :1,
45: mode :3,
46: #define TIMER_EVENTMODE 0 /* event timer */
47: #define TIMER_1SHOTMODE 1 /* one-shot */
48: #define TIMER_NDIVMODE 2 /* divide by n */
49: #define TIMER_SQWAVEMODE 3 /* square wave generator */
50: #define TIMER_SWTRIGMODE 4 /* software trigger */
51: #define TIMER_HWTRIGMODE 5 /* hardware trigger */
52: rw :2,
53: #define TIMER_CTL_LATCH 0
54: #define TIMER_CTL_RW_LSB 1
55: #define TIMER_CTL_RW_MSB 2
56: #define TIMER_CTL_RW_BOTH 3
57: sel :2;
58: #define TIMER_CNT0_SEL 0
59: #define TIMER_CNT1_SEL 1
60: #define TIMER_CNT2_SEL 2
61: } timer_ctl_reg_t;
62:
63: /*
64: * Counter value (16 bits)
65: */
66: typedef unsigned short timer_cnt_val_t;
67:
68: /*
69: * Maximum count value
70: */
71: #define TIMER_COUNT_MAX ((timer_cnt_val_t) -1)
72:
73: /*
74: * Timer I/O ports
75: */
76: #define TIMER_CNT0_PORT 0x40 /* counter 0 */
77: #define TIMER_CNT1_PORT 0x41 /* counter 1 */
78: #define TIMER_CNT2_PORT 0x42 /* counter 2 */
79: #define TIMER_CTL_PORT 0x43 /* control port */
80:
81: /*
82: * Timer count rate (1/s)
83: */
84: #define TIMER_CONSTANT 1193167
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.