xref: /openbsd/lib/libarch/alpha/inb.2 (revision 404b540a)
1.\" $OpenBSD: inb.2,v 1.7 2007/05/31 19:19:27 jmc Exp $
2.\"
3.\" Copyright (c) 2002 Matthieu Herrb
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\"    - Redistributions of source code must retain the above copyright
11.\"      notice, this list of conditions and the following disclaimer.
12.\"    - Redistributions in binary form must reproduce the above
13.\"      copyright notice, this list of conditions and the following
14.\"      disclaimer in the documentation and/or other materials provided
15.\"      with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd $Mdocdate: May 31 2007 $
31.Dt LIBALPHA 2 alpha
32.Os
33.Sh NAME
34.Nm dense_base ,
35.Nm inb ,
36.Nm inl ,
37.Nm inw ,
38.Nm ioperm ,
39.Nm map_memory ,
40.Nm outb ,
41.Nm outl ,
42.Nm outw ,
43.Nm readb ,
44.Nm readl ,
45.Nm readw ,
46.Nm unmap_memory ,
47.Nm writeb ,
48.Nm writel ,
49.Nm writew
50.Nd Alpha devices I/O ports and memory access functions
51.Sh SYNOPSIS
52.Ft u_int64_t
53.Fn dense_base "void"
54.Ft u_int8_t
55.Fn inb "u_int32_t port"
56.Ft u_int32_t
57.Fn inl "u_int32_t port"
58.Ft u_int16_t
59.Fn inw "u_int32_t port"
60.Ft int
61.Fn ioperm "unsigned long from" "unsigned long num" "int on"
62.Ft void *
63.Fn map_memory "u_int32_t address" "u_int32_t size"
64.Ft void
65.Fn outb "u_int32_t port" "u_int8_t val"
66.Ft void
67.Fn outl "u_int32_t port" "u_int32_t val"
68.Ft void
69.Fn outw "u_int32_t port" "u_int16_t val"
70.Ft u_int8_t
71.Fn readb "void *handle" "u_int32_t offset"
72.Ft u_int32_t
73.Fn readl "void *handle" "u_int32_t offset"
74.Ft u_int16_t
75.Fn readw "void *handle" "u_int32_t offset"
76.Ft void
77.Fn unmap_memory "void *handle" "u_int32_t size"
78.Ft void
79.Fn writeb "void *handle" "u_int32_t offset" "u_int8_t val"
80.Ft void
81.Fn writel "void *handle" "u_int32_t offset" "u_int32_t val"
82.Ft void
83.Fn writew "void *handle" "u_int32_t offset" "u_int16_t val"
84.Sh DESCRIPTION
85The functions in libalpha give userland programs access to the I/O
86ports on the OpenBSD/alpha platform.
87.Pp
88The
89.Fn in*
90functions return data read from the specified I/O port.
91.Pp
92The
93.Fn out*
94functions write data to the specified I/O port.
95.Pp
96.Fn ioperm
97enables access to the specified port numbers if
98.Fa on
99is
100.Dv TRUE
101and disables access if
102.Fa on
103is
104.Dv FALSE .
105.Pp
106The
107.Fn map_memory
108function allows a user program to map part of a device memory.
109.Pp
110The
111.Fn unmap_memory
112function unmaps memory that was previously mapped by
113.Fn map_memory .
114.Pp
115The
116.Fn read*
117functions read data from device memory previously mapped by
118.Fn map_memory .
119.Pp
120The
121.Fn write*
122functions write data to the device memory previously mapped by
123.Fn map_memory .
124.Pp
125.Sy Note :
126Code using these functions must be compiled using
127.Fl lalpha .
128.\" .Sh EXAMPLES
129.\" TBW
130.Sh HISTORY
131These functions originally appeared in
132.Fx .
133.Sh CAVEATS
134Only BWX bus access method is supported for now. Machines requiring
135swiz type access are not supported.
136.Pp
137Root credentials are needed to use these functions.
138