|
|
1.1 root 1: /* $Header: /usr/src/sys/ldrv/RCS/timeout.c,v 1.1 88/03/24 16:31:21 src Exp $ */
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: /usr/src/sys/ldrv/RCS/timeout.c,v $
19: * Revision 1.1 88/03/24 16:31:21 src
20: * Initial revision
21: *
22: * 87/12/08 Allan Cornish /usr/src/sys/ldrv/timeout.c
23: * Timed loadable driver functions now supported.
24: */
25: #include <sys/coherent.h>
26:
27: /*
28: * External functions.
29: */
30: extern void Ktimeout();
31: extern void Kldtimcall();
32: extern saddr_t getcs();
33:
34: /*
35: * Given a pointer to a timeout structure, `tp', call the function `f'
36: * with integer argument `a' in `n' ticks of the clock. The list is
37: * searched to see if the specified timeout structure is already in a
38: * list, and it is removed if already there.
39: * This module is specific to loadable drivers.
40: */
41: timeout( tp, n, f, a )
42: register TIM * tp;
43: int n;
44: void (*f)();
45: int a;
46: {
47: register int s;
48:
49: /*
50: * Cancel existing timer.
51: */
52: if ( (f == NULL) || (n <= 0) ) {
53: kcall( Ktimeout, tp, 0, NULL, 0 );
54: return;
55: }
56:
57: /*
58: * Define loadable driver interface.
59: * Kldtimcall will be invoked when timeout occurs.
60: * It will in turn invoke FP_SEL(tp->t_ldrv):4,
61: * passing FP_OFF(tp->t_ldrv) in AX.
62: */
63: s = sphi();
64: FP_SEL(tp->t_ldrv) = getcs();
65: FP_OFF(tp->t_ldrv) = f;
66: kcall( Ktimeout, tp, n, Kldtimcall, a );
67: spl(s);
68: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.