1 /*-
2 * Copyright (c) KATO Takenori, 1996. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer as
9 * the first lines of this file unmodified.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $FreeBSD: releng/6.0/sys/pc98/pc98/epsonio.h 139825 2005-01-07 02:29:27Z imp $
28 */
29
30 #ifndef __PC98_PC98_EPSONIO_H__
31 #define __PC98_PC98_EPSONIO_H__
32
33 #include <machine/cpufunc.h>
34
35 static __inline u_char
36 epson_inb(u_int port)
37 {
38 u_char data;
39
40 outb(0x43f, 0x42);
41 data = inb(port);
42 outb(0x43f, 0x40);
43 return (data);
44 }
45
46 static __inline void
47 epson_outb(u_int port, u_char data)
48 {
49 outb(0x43f, 0x42);
50 outb(port,data);
51 outb(0x43f, 0x40);
52 }
53
54 static __inline u_int16_t
55 epson_inw(u_int port)
56 {
57 u_int16_t data;
58
59 outb(0x43f, 0x42);
60 data = inw(port);
61 outb(0x43f, 0x40);
62 return (data);
63 }
64
65 static __inline void
66 epson_insw(u_int port, void *addr, size_t cnt)
67 {
68 int s;
69
70 s = splbio();
71 outb(0x43f, 0x42);
72 disable_intr();
73 insw((u_int)port, (void *)addr, (size_t)cnt);
74 outb(0x43f, 0x40);
75 enable_intr();
76 splx(s);
77 }
78
79 static __inline void
80 epson_outsw(u_int port, void *addr, size_t cnt)
81 {
82 int s;
83
84 s = splbio();
85 outb(0x43f, 0x42);
86 disable_intr();
87 outsw((u_int)port, (void *)addr, (size_t)cnt);
88 outb(0x43f, 0x40);
89 enable_intr();
90 splx(s);
91 }
92
93 #endif
Cache object: b076f52168fd1ccb371428ee0d6036d0
|