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