summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/ddi_device_copy.9f
blob: 5adb569f61d2999936cf5ce5b654702fa3753365 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
'\" te
.\"  Copyright (c) 1996, Sun Microsystems, Inc  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DDI_DEVICE_COPY 9F "Nov 15, 1996"
.SH NAME
ddi_device_copy \- copy data from one device register to another device
register
.SH SYNOPSIS
.LP
.nf
#include <sys/ddi.h>
#include <sys/sunddi.h>



\fBint\fR \fBddi_device_copy\fR(\fBddi_acc_handle_t\fR \fIsrc_handle\fR, \fBcaddr_t\fR \fIsrc_addr\fR,
     \fBssize_t\fR \fIsrc_advcnt\fR, \fBddi_acc_handle_t\fR \fIdest_handle\fR,
     \fBcaddr_t\fR \fIdest_addr\fR, \fBssize_t\fR \fIdest_advcnt\fR,
     \fBsize_t\fR \fIbytecount\fR, \fBuint_t\fR \fIdev_datasz\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIsrc_handle\fR \fR
.ad
.RS 16n
The data access handle of the source device.
.RE

.sp
.ne 2
.na
\fB\fIsrc_addr\fR \fR
.ad
.RS 16n
Base data source address.
.RE

.sp
.ne 2
.na
\fB\fIsrc_advcnt\fR \fR
.ad
.RS 16n
Number of  \fIdev_datasz\fR units to advance on every access.
.RE

.sp
.ne 2
.na
\fB\fIdest_handle\fR \fR
.ad
.RS 16n
The data access handle of the destination device.
.RE

.sp
.ne 2
.na
\fB\fIdest_addr\fR \fR
.ad
.RS 16n
Base data destination address.
.RE

.sp
.ne 2
.na
\fB\fIdest_advcnt\fR \fR
.ad
.RS 16n
Number of  \fIdev_datasz\fR units to advance on every access.
.RE

.sp
.ne 2
.na
\fB\fIbytecount\fR \fR
.ad
.RS 16n
Number of bytes to transfer.
.RE

.sp
.ne 2
.na
\fB\fIdev_datasz\fR \fR
.ad
.RS 16n
The size of each data word. Possible values are defined as:
.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ01_ACC\fR \fR
.ad
.RS 22n
1 byte data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ02_ACC\fR \fR
.ad
.RS 22n
2 bytes data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ04_ACC\fR \fR
.ad
.RS 22n
4 bytes data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ08_ACC\fR \fR
.ad
.RS 22n
8 bytes data size
.RE

.RE

.SH DESCRIPTION
.sp
.LP
\fBddi_device_copy()\fR copies  \fIbytecount\fR bytes from the source  address,
\fIsrc_addr\fR, to the destination address,  \fIdest_addr\fR. The attributes
encoded in the access handles, \fIsrc_handle\fR and \fIdest_handle\fR, govern
how data is actually copied from the  source to the destination. Only matching
data sizes between the source and destination are supported.
.sp
.LP
Data will automatically be translated to maintain a consistent  view between
the source and the destination. The translation may  involve byte-swapping if
the source and the destination devices  have incompatible endian
characteristics.
.sp
.LP
The  \fIsrc_advcnt\fR and  \fIdest_advcnt\fR arguments specifies the number of
\fIdev_datasz\fR units to advance with each access to the device addresses. A
value of  \fB0\fR will use the same source and destination device address  on
every access. A positive value increments the corresponding device  address by
certain number of data size units in the next access.  On the other hand, a
negative value decrements the device address.
.sp
.LP
The \fIdev_datasz\fR argument determines the size of the data word on each
access. The data size must be the same between the source and destination.
.SH RETURN VALUES
.sp
.LP
\fBddi_device_copy()\fR returns:
.sp
.ne 2
.na
\fB\fBDDI_SUCCESS\fR \fR
.ad
.RS 16n
Successfully transferred the data.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FAILURE\fR \fR
.ad
.RS 16n
The byte count is not a multiple \fIdev_datasz\fR.
.RE

.SH CONTEXT
.sp
.LP
\fBddi_device_copy()\fR can be called from user, kernel, or interrupt context.
.SH SEE ALSO
.sp
.LP
\fBddi_regs_map_free\fR(9F), \fBddi_regs_map_setup\fR(9F)
.sp
.LP
\fIWriting Device Drivers\fR