USER_WRITE_DATA

Writes data to specific memory locations within the device's memory.

You can find the template for this subroutine in:

usrtm_wrda.c

Syntax

void user_write_data(device_struct, address_struct,

        length, data, download_req, download_comp, 

        comm_status, status)

DEVICE_DATA *device_struct;

ADDR_DATA *address_struct;

int length;

char *data;

int download_req;

int download_comp;

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 to be written.

data

Is a pointer to the actual data to be written.

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

Bit data is always accessed in multiples of 8 bits, so write requests near the end of a bit domain must ignore extra bits that would be beyond the end of the domain.

For domains whose element size is greater than one byte, the bytes are ordered in the same way as they are ordered by the underlying operating system where the enabler is running.

download_req

Reserved for future use.

download_comp

Reserved for future use.

Output Parameters

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_REPLY_LATER

Write request queued for future processing.

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.