xref: /illumos-gate/usr/src/uts/sun4u/sys/i2c/clients/pic16f819_reg.h (revision 1f5207b7604fb44407eb4342aff613f7c4508508)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PIC16F819_REG_H
28 #define	_PIC16F819_REG_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	PIC16F819_FAN_PERIOD_MSB_REGISTER	3
37 #define	PIC16F819_FAN_PERIOD_LSB_REGISTER	2
38 #define	PIC16F819_STATUS_REGISTER		1
39 #define	PIC16F819_COMMAND_REGISTER		0
40 #define	PIC16F819_DEBUG_REGISTER		9
41 #define	PIC16F819_FAN_STATUS_MASK		0x7
42 #define	PIC16F819_FAN_FAULT			0x1
43 #define	PIC16F819_FAN_FAULT_CLEAR		0x4
44 #define	PIC16F819_SW_AWARE_MODE			0x2
45 #define	PIC16F819_FAN_FAULT_LATCHED		0x2
46 #define	PIC16F819_FAN_FAILED			0x8
47 
48 /*
49  * The actual formula is ((CLK_FREQ * 60)/ (tach period * 4)
50  * tach period is multiplied by 4 because we get 4 tach pulses per
51  * revolution.
52  * tach period is the number of clks we count per tach pulse.
53  */
54 #define	PIC16F819_FAN_TACH_TO_RPM(tach)	\
55 	((327000 * 15)/tach)
56 
57 #define	MAX_RETRIES_FOR_PIC16F819_REG_READ	5
58 
59 #ifdef	__cplusplus
60 }
61 #endif
62 
63 #endif	/* _PIC16F819_REG_H */
64