xref: /netbsd/sys/arch/shark/shark/hat.h (revision bf9ec67e)
1 /*	$NetBSD: hat.h,v 1.1 2002/02/10 01:58:03 thorpej Exp $	*/
2 
3 /*
4  * Copyright 1997
5  * Digital Equipment Corporation. All rights reserved.
6  *
7  * This software is furnished under license and may be used and
8  * copied only in accordance with the following terms and conditions.
9  * Subject to these conditions, you may download, copy, install,
10  * use, modify and distribute this software in source and/or binary
11  * form. No title or ownership is transferred hereby.
12  *
13  * 1) Any source code used, modified or distributed must reproduce
14  *    and retain this copyright notice and list of conditions as
15  *    they appear in the source file.
16  *
17  * 2) No right is granted to use any trade name, trademark, or logo of
18  *    Digital Equipment Corporation. Neither the "Digital Equipment
19  *    Corporation" name nor any trademark or logo of Digital Equipment
20  *    Corporation may be used to endorse or promote products derived
21  *    from this software without the prior written permission of
22  *    Digital Equipment Corporation.
23  *
24  * 3) This software is provided "AS-IS" and any express or implied
25  *    warranties, including but not limited to, any implied warranties
26  *    of merchantability, fitness for a particular purpose, or
27  *    non-infringement are disclaimed. In no event shall DIGITAL be
28  *    liable for any damages whatsoever, and in particular, DIGITAL
29  *    shall not be liable for special, indirect, consequential, or
30  *    incidental damages or damages for lost profits, loss of
31  *    revenue or loss of use, whether such damages arise in contract,
32  *    negligence, tort, under statute, in equity, at law or otherwise,
33  *    even if advised of the possibility of such damage.
34  */
35 
36 /*
37  * hat.h
38  *
39  * interface to high-availability timer on SHARK
40  *
41  * Created      : 19/05/97
42  */
43 
44 /* interface to high-availability timer.
45    DO NOT CALL ANY OF THESE FUNCTIONS FROM CODE CALLED BY THE FIQ!
46    (e.g. hatFn)
47 */
48 
49 /* hatClkOff(): turn off HAT clock.
50 
51    returns: 0 => success  -1 => error
52 */
53 int hatClkOff(void);
54 
55 /* hatClkOn(): turn on HAT clock.
56 
57    count   = count for ISA TIMER 2, which generates HAT clock
58    hatFn   = function to be called on every HAT FIQ.
59    arg     = argument to pass to hatFn.
60              if (arg == 0)
61               then the FIQ handler will pass the contents of
62                    sequoia register 001H, including the PMI source bits
63               otherwise the FIQ handler will not load the register and
64                         will pass arg directly
65    stack   = stack for hatFn
66    wedgeFn = function called when the HAT wedges and needs to be restarted.
67              the argument is the total number of FIQs received by the system.
68              (wraps at 32-bits).
69 
70    returns: 0 => success  -1 => error
71 */
72 int hatClkOn(int count, void (*hatFn)(int), int arg,
73 	     unsigned char *stack, void (*wedgeFn)(int));
74 
75 /* hatClkAdjust: adjusts the speed of the HAT.
76 
77    count = new count for ISA TIMER 2
78 
79    returns: 0 => success  -1 => error
80 */
81 int hatClkAdjust(int count);
82 
83 /* hatUnwedge: call this function periodically (slower than the frequency
84                of the HAT) to unwedge the HAT, if necessary.
85 */
86 void hatUnwedge();
87 
88 /* HAT_MIN_FREQ: should be a power of 2.  Call hatUnwedge() no more
89                  often than HAT_MIN_FREQ.  HMF should be a power of 2.
90 */
91 #define HAT_MIN_FREQ 64
92