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