USB#

Note

These functions were distributed in xia_usb.dll before they were merged into the Handel library.

int xia_usb2_close(HANDLE h)#

Uses the provided HANDLE to find the device and close out the connection.

Param[in] h:

A handle to the device that needs to be closed.

Returns:

A status code indicating the result of the operation.

char *xia_usb2_get_last_error(void)#

Return the content of the last info_string printed to screen. This is overwritten every time the api function is called.

Returns:

A pointer to the last message printed to the screen.

int xia_usb2_open(int dev, HANDLE *h)#

Opens the device number provided and attaches the device handle to the provided pointer.

Param[in] dev:

The device ID used to find the device on the interface and open it.

Param[out] h:

A pointer to the HANDLE object that will point to the opened device.

Returns:

A status code indicating the result of the operation.

int xia_usb2_read(HANDLE h, unsigned long addr, unsigned long n_bytes, byte_t *buf)#

Read the number of bytes from the address and into a memory buffer.

Param[in] h:

A handle to the device that will be read from.

Param[in] addr:

The address in the memory space that will be read.

Param[in] n_bytes:

The number of bytes to be read out of the provided address.

Param[out] buf:

The data buffer with a size of n_bytes to read the data into.

Returns:

A status code indicating the result of the operation.

int xia_usb2_readn(HANDLE h, unsigned long addr, unsigned long n_bytes, byte_t *buf, unsigned long *n_bytes_read)#

Read the number of bytes from the address and into a memory buffer. Differs from xia_usb2_read() in that it also provides the number of bytes that were actually read and provides length validations.

Param[in] h:

A handle to the device that will be read from.

Param[in] addr:

The address in the memory space that will be read.

Param[in] n_bytes:

The number of bytes to be read out of the provided address.

Param[out] buf:

The data buffer with a size of n_bytes to read the data into.

Param[out] n_bytes_read:

The number of bytes that were read. This can be less than the number of bytes requested if the transfer succeeds but the device returns fewer bytes for whatever reason, e.g. microDXP not padding out a 512 byte transfer for smaller commands.

Returns:

A status code indicating the result of the operation.

int xia_usb2_write(HANDLE h, unsigned long addr, unsigned long n_bytes, byte_t *buf)#

Writes a data buffer to the address using the device handle.

Param[in] h:

A handle to the device that will be read from.

Param[in] addr:

The address in the memory space that will be read.

Param[in] n_bytes:

The number of bytes to be written.

Param[out] buf:

The data buffer with a size of n_bytes to write into the address.

Returns:

A status code indicating the result of the operation.