DDI_DEVICE_COPY(9F) | Kernel Functions for Drivers | DDI_DEVICE_COPY(9F) |
ddi_device_copy - copy data from one device register to another device register
#include <sys/ddi.h> #include <sys/sunddi.h> int ddi_device_copy(ddi_acc_handle_t src_handle, caddr_t src_addr,
ssize_t src_advcnt, ddi_acc_handle_t dest_handle,
caddr_t dest_addr, ssize_t dest_advcnt,
size_t bytecount, uint_t dev_datasz);
illumos DDI specific (illumos DDI).
src_handle
src_addr
src_advcnt
dest_handle
dest_addr
dest_advcnt
bytecount
dev_datasz
DDI_DATA_SZ01_ACC
DDI_DATA_SZ02_ACC
DDI_DATA_SZ04_ACC
DDI_DATA_SZ08_ACC
ddi_device_copy() copies bytecount bytes from the source address, src_addr, to the destination address, dest_addr. The attributes encoded in the access handles, src_handle and dest_handle, govern how data is actually copied from the source to the destination. Only matching data sizes between the source and destination are supported.
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.
The src_advcnt and dest_advcnt arguments specifies the number of dev_datasz units to advance with each access to the device addresses. A value of 0 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.
The dev_datasz argument determines the size of the data word on each access. The data size must be the same between the source and destination.
ddi_device_copy() returns:
DDI_SUCCESS
DDI_FAILURE
ddi_device_copy() can be called from user, kernel, or interrupt context.
ddi_regs_map_free(9F), ddi_regs_map_setup(9F)
Writing Device Drivers
November 15, 1996 | OmniOS |