|
|
1.1 root 1: /* $Header: /kernel/kersrc/ldrv/RCS/timeout.c,v 1.1 92/07/17 15:28:10 bin Exp Locker: bin $ */
2: /*
3: * The information contained herein is a trade secret of INETCO
4: * Systems, and is confidential information. It is provided under
5: * a license agreement, and may be copied or disclosed only under
6: * the terms of that agreement. Any reproduction or disclosure of
7: * this material without the express written authorization of
8: * INETCO Systems or persuant to the license agreement is unlawful.
9: *
10: * Copyright (c) 1987
11: * An unpublished work by INETCO Systems, Ltd.
12: * All rights reserved.
13: */
14:
15: /*
16: * Loadable Driver - Timed functions.
17: *
18: * $Log: timeout.c,v $
19: * Revision 1.1 92/07/17 15:28:10 bin
20: * Initial revision
21: *
22: * Revision 1.1 88/03/24 16:31:21 src
23: * Initial revision
24: *
25: * 87/12/08 Allan Cornish /usr/src/sys/ldrv/timeout.c
26: * Timed loadable driver functions now supported.
27: */
28: #include <sys/coherent.h>
29:
30: /*
31: * External functions.
32: */
33: extern void Ktimeout();
34: extern void Kldtimcall();
35: extern saddr_t getcs();
36:
37: /*
38: * Given a pointer to a timeout structure, `tp', call the function `f'
39: * with integer argument `a' in `n' ticks of the clock. The list is
40: * searched to see if the specified timeout structure is already in a
41: * list, and it is removed if already there.
42: * This module is specific to loadable drivers.
43: */
44: timeout( tp, n, f, a )
45: register TIM * tp;
46: int n;
47: void (*f)();
48: int a;
49: {
50: register int s;
51:
52: /*
53: * Cancel existing timer.
54: */
55: if ( (f == NULL) || (n <= 0) ) {
56: kcall( Ktimeout, tp, 0, NULL, 0 );
57: return;
58: }
59:
60: /*
61: * Define loadable driver interface.
62: * Kldtimcall will be invoked when timeout occurs.
63: * It will in turn invoke FP_SEL(tp->t_ldrv):4,
64: * passing FP_OFF(tp->t_ldrv) in AX.
65: */
66: s = sphi();
67: FP_SEL(tp->t_ldrv) = getcs();
68: FP_OFF(tp->t_ldrv) = f;
69: kcall( Ktimeout, tp, n, Kldtimcall, a );
70: spl(s);
71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.