1ddi_device_copy(9F) Kernel Functions for Drivers ddi_device_copy(9F)
2
3
4
6 ddi_device_copy - copy data from one device register to another device
7 register
8
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13
14
15 int ddi_device_copy(ddi_acc_handle_t src_handle, caddr_t src_addr,
16 ssize_t src_advcnt, ddi_acc_handle_t dest_handle,
17 caddr_t dest_addr, ssize_t dest_advcnt,
18 size_t bytecount, uint_t dev_datasz);
19
20
22 Solaris DDI specific (Solaris DDI).
23
25 src_handle The data access handle of the source device.
26
27
28 src_addr Base data source address.
29
30
31 src_advcnt Number of dev_datasz units to advance on every access.
32
33
34 dest_handle The data access handle of the destination device.
35
36
37 dest_addr Base data destination address.
38
39
40 dest_advcnt Number of dev_datasz units to advance on every access.
41
42
43 bytecount Number of bytes to transfer.
44
45
46 dev_datasz The size of each data word. Possible values are defined
47 as:
48
49 DDI_DATA_SZ01_ACC 1 byte data size
50
51
52 DDI_DATA_SZ02_ACC 2 bytes data size
53
54
55 DDI_DATA_SZ04_ACC 4 bytes data size
56
57
58 DDI_DATA_SZ08_ACC 8 bytes data size
59
60
61
63 ddi_device_copy() copies bytecount bytes from the source address,
64 src_addr, to the destination address, dest_addr. The attributes
65 encoded in the access handles, src_handle and dest_handle, govern how
66 data is actually copied from the source to the destination. Only
67 matching data sizes between the source and destination are supported.
68
69
70 Data will automatically be translated to maintain a consistent view
71 between the source and the destination. The translation may involve
72 byte-swapping if the source and the destination devices have incompat‐
73 ible endian characteristics.
74
75
76 The src_advcnt and dest_advcnt arguments specifies the number of
77 dev_datasz units to advance with each access to the device addresses. A
78 value of 0 will use the same source and destination device address on
79 every access. A positive value increments the corresponding device
80 address by certain number of data size units in the next access. On
81 the other hand, a negative value decrements the device address.
82
83
84 The dev_datasz argument determines the size of the data word on each
85 access. The data size must be the same between the source and destina‐
86 tion.
87
89 ddi_device_copy() returns:
90
91 DDI_SUCCESS Successfully transferred the data.
92
93
94 DDI_FAILURE The byte count is not a multiple dev_datasz.
95
96
98 ddi_device_copy() can be called from user, kernel, or interrupt con‐
99 text.
100
102 ddi_regs_map_free(9F), ddi_regs_map_setup(9F)
103
104
105 Writing Device Drivers
106
107
108
109SunOS 5.11 15 Nov 1996 ddi_device_copy(9F)