USER_READ_DATA

Reads data from specific memory locations from the device's memory.

You can find the template for this subroutine in:

usrtm_reada.c

Syntax

void user_read_data(device_struct, address_struct,

        length, data, comm_status, status);

DEVICE_DATA *device_struct;

ADDR_DATA *address_struct;

int length;

char *data;

int *comm_status;

int *status;

Input Parameters

device_struct

Is a pointer to the structure defining device data. DEVICE_DATA is a typedef to a structure defined in <inc_path/toolkit.h>.

address_struct

Is a pointer to the address from which the data was read. ADDR_DATA is a typedef to a structure defined in <inc_path/toolkit.h>.

length

Is the number of bytes of data requested.

Output Parameters

data

Is a pointer to an array that contains the data that was read from the device.

For data from bit (TOOLKIT_BIT) domains, bit data should be packed into bytes so that the leftmost bit is the most significant.

For domains whose element size is greater than one byte, the bytes should be ordered in the same way as they are ordered by the underlying operating system on which the enabler is to run.

comm_status

Indicates whether a status of TOOLKIT_FAILURE occurred as a result of a communication failure. Valid values are:

TOOLKIT_SUCCESS

Failure is not due to communications failure.

TOOLKIT_WRITE_FAILED

Could not send command or data to device.

TOOLKIT_TIMEOUT

Sent command or data to device, timed-out waiting for a response.

TOOLKIT_BAD_DATA

Received response from device but it contained invalid data such as an incorrect checksum.

TOOLKIT_FAILURE

Failure is due to communications failure.

status

Indicates whether the function read all the data. Valid values are:

TOOLKIT_SUCCESS

Function completed successfully.

TOOLKIT_FAILURE

Function did not complete successfully. Check comm_status to see if the failure was the result of a communication failure.

Return Value

None.

More information

Device Communications toolkit subroutines.