Index Index for
Section 9
Index Alphabetical
listing for I
Bottom of page Bottom of
page

io_copyin(9r)

NAME

io_copyin - General: Copies data from bus address space to system memory

SYNOPSIS

int io_copyin( io_handle_t srcaddr, vm_offset_t destaddr, u_long byte_count );

ARGUMENTS

srcaddr Specifies an I/O handle that you can use to reference a device register or memory located in bus address space (either I/O space or memory space). For io_copyin, the I/O handle identifies the location in bus address space where the copy originates. You can perform standard C mathematical operations (addition and subtraction only) on the I/O handle. For example, you can add an offset to or subtract an offset from the I/O handle. destaddr Specifies the kernel virtual address where io_copyin copies the data to in-system memory. byte_count Specifies the number of bytes in the data block to be copied. The interface assumes that the buffer associated with the data block is physically contiguous.

DESCRIPTION

The io_copyin interface copies data from bus address space to system memory. The interface optimizes the copy operation for 32-bit transfers. The I/O handle you pass to srcaddr identifies where the copy originates in bus address space, and the address you pass to destaddr identifies where the copy occurs in system memory. The io_copyin interface assumes no alignment of data associated with srcaddr and destaddr.

NOTES

The io_copyin interface is a generic interface that maps to a bus- and machine-specific interface that actually performs the copy from bus address space to system memory. Using io_copyin to perform the copy operation makes the device driver more portable across different CPU architectures and different CPU types within the same architecture.

CAUTIONS

The I/O handle that you pass to the srcaddr argument of the io_copyin interface must be an I/O handle that references addresses residing in sparse space. All Alpha CPUs support sparse space. As a result, all bus configuration code should supply an I/O handle that references bus address space. If you pass an I/O handle to the srcaddr argument that references addresses residing in some other space (for example, dense space) the results of the copy operation are unpredictable. Tru64 UNIX provides the following interfaces that allow device drivers to perform copy operations and zero blocks of memory on addresses that reside in dense space: · bcopy Copies a series of bytes with a specified limit · blkclr and bzero Zeros a block of memory · copyin Copies data from a user address space to a kernel address space · copyinstr Copies a null-terminated string from a user address space to a kernel address space · copyout Copies data from a kernel address space to a user address space · copyoutstr Copies a null-terminated string from a kernel address space to a user address space

RETURN VALUES

Upon successful completion, io_copyin returns IOA_OKAY. It returns the value -1 on failure.

EXAMPLE

See Writing Device Drivers: Tutorial for a code example of the io_copyin interface.

SEE ALSO

Kernel Interfaces: io_copyio(9r), io_copyout(9r)

Index Index for
Section 9
Index Alphabetical
listing for I
Top of page Top of
page