enable.c revision 1.3 1 1.3 thorpej /* $NetBSD: enable.c,v 1.3 2001/09/19 18:10:34 thorpej Exp $ */
2 1.2 gwr
3 1.2 gwr /*-
4 1.2 gwr * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.2 gwr * All rights reserved.
6 1.2 gwr *
7 1.2 gwr * This code is derived from software contributed to The NetBSD Foundation
8 1.2 gwr * by Gordon W. Ross.
9 1.2 gwr *
10 1.2 gwr * Redistribution and use in source and binary forms, with or without
11 1.2 gwr * modification, are permitted provided that the following conditions
12 1.2 gwr * are met:
13 1.2 gwr * 1. Redistributions of source code must retain the above copyright
14 1.2 gwr * notice, this list of conditions and the following disclaimer.
15 1.2 gwr * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 gwr * notice, this list of conditions and the following disclaimer in the
17 1.2 gwr * documentation and/or other materials provided with the distribution.
18 1.2 gwr * 3. All advertising materials mentioning features or use of this software
19 1.2 gwr * must display the following acknowledgement:
20 1.2 gwr * This product includes software developed by the NetBSD
21 1.2 gwr * Foundation, Inc. and its contributors.
22 1.2 gwr * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.2 gwr * contributors may be used to endorse or promote products derived
24 1.2 gwr * from this software without specific prior written permission.
25 1.2 gwr *
26 1.2 gwr * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.2 gwr * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.2 gwr * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.2 gwr * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.2 gwr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.2 gwr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.2 gwr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.2 gwr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.2 gwr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.2 gwr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.2 gwr * POSSIBILITY OF SUCH DAMAGE.
37 1.2 gwr */
38 1.2 gwr
39 1.2 gwr #include <sys/param.h>
40 1.3 thorpej #include <dev/sun/fbio.h>
41 1.2 gwr #include <sun3/dev/fbvar.h>
42 1.2 gwr #include <sun3/sun3/machdep.h>
43 1.2 gwr #include <sun3/sun3x/enable.h>
44 1.2 gwr #include <sun3/sun3x/obio.h>
45 1.2 gwr
46 1.2 gwr volatile short *enable_reg;
47 1.2 gwr
48 1.2 gwr void
49 1.2 gwr enable_init()
50 1.2 gwr {
51 1.2 gwr
52 1.2 gwr enable_reg = (short*) obio_find_mapping(OBIO_ENABLEREG, 2);
53 1.2 gwr }
54 1.2 gwr
55 1.2 gwr
56 1.2 gwr /*
57 1.2 gwr * External interfaces to the system enable register.
58 1.2 gwr */
59 1.2 gwr
60 1.2 gwr void
61 1.2 gwr enable_fpu(on)
62 1.2 gwr int on;
63 1.2 gwr {
64 1.2 gwr int s;
65 1.2 gwr short ena;
66 1.2 gwr
67 1.2 gwr s = splhigh();
68 1.2 gwr ena = *enable_reg;
69 1.2 gwr
70 1.2 gwr if (on)
71 1.2 gwr ena |= ENA_FPP;
72 1.2 gwr else
73 1.2 gwr ena &= ~ENA_FPP;
74 1.2 gwr
75 1.2 gwr *enable_reg = ena;
76 1.2 gwr splx(s);
77 1.2 gwr }
78 1.2 gwr
79 1.2 gwr void
80 1.2 gwr enable_video(on)
81 1.2 gwr int on;
82 1.2 gwr {
83 1.2 gwr int s;
84 1.2 gwr short ena;
85 1.2 gwr
86 1.2 gwr s = splhigh();
87 1.2 gwr ena = *enable_reg;
88 1.2 gwr
89 1.2 gwr if (on)
90 1.2 gwr ena |= ENA_VIDEO;
91 1.2 gwr else
92 1.2 gwr ena &= ~ENA_VIDEO;
93 1.2 gwr
94 1.2 gwr *enable_reg = ena;
95 1.2 gwr splx(s);
96 1.2 gwr }
97 1.2 gwr
98