The pdiag_dd_write() and the pdiag_dd_write_64() functions perform write operations on a resource.
#include <sys/pdiagex_dds.h> int32 pdiag_dd_write( handle, type, offset, data, flags ) pdiag_info_handle_t handle; uint32 type; uint32 offset; pdiag_addr_t data; pdiagex_opflags_t *flags;
#include <sys/pdiagex_dds.h> int32 pdiag_dd_write_64( handle, type, offset, data, flags ) pdiag_info_handle_t handle; uint32 type; uint32 offset; pdiag_addr_t data; pdiagex_opflags_t *flags;
The pdiag_dd_write() and the pdiag_dd_write_64() functions write the specified data to the specified offset address. If the user enables the times variable, timing information for this function is also returned. Each write performed is dependent on the memio operation and count parameters.
memio Operation | Description |
---|---|
PDIAG_IO_OP | If count is1, data is written to the specified bus I/O offset address. |
PDIAG_MEM_OP | If count is1, data is written to the specified memory offset address. |
PDIAG_POS_OP | If count is1, data is written to the specified POS offset address. |
A specified number of write accesses to the offset address may be performed if count is greater than 1. The user may choose to write the data to one location (the offset address) count times, or write the data to count consecutive locations, starting at the offset address. In either case, the data to be written is supplied by consecutive locations of the data buffer starting at the specified buffer address.
The pdiag_dd_write() function can be called from the process or the interrupt environment. The pdiag_dd_write_64() function can only be called from the interrupt environment.
Parameter | Description |
---|---|
handle | Points to pdiag_info_handle_t structure which is returned from pdiag_open(). |
type | Defines the data length (byte, word or long) read from the address specified when type is IOCHAR8, IOSHORT16, and IOLONG32 respectively. |
offset | Offset value that is dependent on the type of operation being performed.
It can be one of the following values:
|
data | Pointer to a block of information to be written to the specified
address. This block will be of size:
|
flags | The flags structure contains the following members: |
memio | Indication of the type of read operation to perform.
|
count | Number of accesses to perform.
|
addr_incr_flag | Determines whether the data buffer address
and the offset address get incremented on each of count accesses:
|
intrlev | Indicates which environment the calling routine is in:
Note
For the pdiag_dd_write function,
the intrlev parameter may be set to either PROCLEV
or INTRKMEM. For the pdiag_dd_write_64 function, the intrlev parameter must always be set to INTRKMEM. |
times | Points to the timestruc_t structure which returns timing information. If times is a null pointer, no timing information will be returned back to the user. |
The pdiag_dd_write and the pdiag_dd_write_64 functions return one of the following values:
Return Value | Description |
---|---|
DGX_OK | The operation was successful. The errno is not set. |
DGX_INVALID_HANDLE | Specified handle has been closed or was not generated by the pdiag_open() call. The errno is not set. |
DGX_BOUND_FAIL | offset given was larger than the width of the I/O address range. The errno is not set. |
DGX_BADVAL_FAIL | Type field was not valid (that is, not IOCHAR8, IOSHORT16, or IOLONG32). The errno is not set. |
DGX_FAIL | Error occurred during the I/O write access. The errno is set to BUS_PUT(L/S/C)X macro return code. |
DGX_COPY_FAIL | User data buffer could not be copied to or from kernel memory. The errno is set to the xmemin/out or copyin/out return code. |
pdiag_dd_read, pdiag_dd_read_64 function.