]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/pit.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / i386 / pit.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * @OSF_COPYRIGHT@
32 */
33/*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58/*
59 */
60
61/*
62 Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
63
64 All Rights Reserved
65
66Permission to use, copy, modify, and distribute this software and
67its documentation for any purpose and without fee is hereby
68granted, provided that the above copyright notice appears in all
69copies and that both the copyright notice and this permission notice
70appear in supporting documentation, and that the name of Intel
71not be used in advertising or publicity pertaining to distribution
72of the software without specific, written prior permission.
73
74INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
75INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
76IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
77CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
78LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
79NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
80WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
81*/
82
83#include <platforms.h>
84/* Definitions for 8254 Programmable Interrupt Timer ports on AT 386 */
85#define PITCTR0_PORT 0x40 /* counter 0 port */
86#define PITCTR1_PORT 0x41 /* counter 1 port */
87#define PITCTR2_PORT 0x42 /* counter 2 port */
88#define PITCTL_PORT 0x43 /* PIT control port */
89#define PITAUX_PORT 0x61 /* PIT auxiliary port */
90/* bits used in auxiliary control port for timer 2 */
91#define PITAUX_GATE2 0x01 /* aux port, PIT gate 2 input */
92#define PITAUX_OUT2 0x02 /* aux port, PIT clock out 2 enable */
93
94/* Following are used for Timer 0 */
95#define PIT_C0 0x00 /* select counter 0 */
96#define PIT_LOADMODE 0x30 /* load least significant byte followed
97 * by most significant byte */
98#define PIT_NDIVMODE 0x04 /*divide by N counter */
99#define PIT_SQUAREMODE 0x06 /* square-wave mode */
100
101/* Used for Timer 1. Used for delay calculations in countdown mode */
102#define PIT_C1 0x40 /* select counter 1 */
103#define PIT_READMODE 0x30 /* read or load least significant byte
104 * followed by most significant byte */
105#define PIT_RATEMODE 0x06 /* square-wave mode for USART */
106
107/*
108 * Clock speed for the timer in hz divided by the constant HZ
109 * (defined in param.h)
110 */
91447636 111#define CLKNUM 1193182 /* formerly 1193167 */
1c79356b
A
112
113#if EXL
114/* added micro-timer support. --- csy */
115typedef struct time_latch {
116 time_t ticks; /* time in HZ since boot */
117 time_t uticks; /* time in 1.25 MHZ */
118/* don't need these two for now. --- csy */
119/* time_t secs; \* seconds since boot */
120/* time_t epochsecs; \* seconds since epoch */
121 } time_latch;
122/* a couple in-line assembly codes for efficiency. */
123asm int intr_disable()
124{
125 pushfl
126 cli
127}
128
129asm int intr_restore()
130{
131 popfl
132}
133
134#endif /* EXL */