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