Functions

xvsec_lib_init

Syntax:

int xvsec_lib_init (int max_devices)

Details:

xvsec_lib_init() - Initializes the XVSEC Library by allocating memory to support requested number of devices

Parameters:

max_devices Maximum devices to support

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_MEM_ALLOC_FAILED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Filure

xvsec_lib_deinit

Syntax:

int xvsec_lib_deinit (void)

Details:

xvsec_lib_deinit() - De-initializes the XVSEC Library by freeing allocated memory and clearing the context

Parameters:

none  

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_open

Syntax:

int xvsec_open (
    uint16_t bus_no,
    uint16_t dev_no,
    xvsec_handle_t* handle,
    char* dev_str
    )

Details:

xvsec_open() - Opens XVSEC character device which is dedicated to the given bus number and device number and returns a unique handle to access the device

Parameters:

bus_no PCIe bus number on which device sits
dev_no Device number in the PCIe bus
dev_str string to append to create character device.
handle Unique handle returned to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_MAX_DEVICES_LIMIT_REACHED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

xvsec_close

Syntax:

int xvsec_close (xvsec_handle_t* handle)

Details:

xvsec_close() - Closes XVSEC character device of provided handle

Parameters:

handle Unique handle to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_NULL_POINTER : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_get_cap_list

Syntax:

int xvsec_get_cap_list (
    xvsec_handle_t* handle,
    xvsec_cap_list_t* cap_list
    )

Details:

xvsec_get_cap_list() - Returns the supported VSEC capabilities of the given handle

Parameters:

handle Unique handle to access the device
cap_list Supported capability list

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_show_device

Syntax:

int xvsec_show_device (xvsec_handle_t* handle)

Details:

xvsec_show_device() - Shows the device information of the given handle

Parameters:

handle Unique handle to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_reset

Syntax:

int xvsec_mcap_reset (xvsec_handle_t* handle)

Details:

xvsec_mcap_reset() - Resets the configuration logic of the given handle

Parameters:

handle Unique handle to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_module_reset

Syntax:

int xvsec_mcap_module_reset (xvsec_handle_t* handle)

Details:

xvsec_mcap_module_reset() - Resets the MCAP module of the given handle

Parameters:

handle Unique handle to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_full_reset

Syntax:

int xvsec_mcap_full_reset (xvsec_handle_t* handle)

Details:

xvsec_mcap_full_reset() - Resets bothconfiguration logic & MCAP module of the given handle

Parameters:

handle Unique handle to access the device

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_get_data_registers

Syntax:

int xvsec_mcap_get_data_registers (
    xvsec_handle_t* handle,
    uint32_t data [4]
    )

Details:

xvsec_mcap_get_data_registers() - Returns the MCAP read data registers

Parameters:

handle Unique handle to access the device
data[] MCAP read data register values

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_get_revision

Syntax:

int xvsec_mcap_get_revision (
    xvsec_handle_t* handle,
    uint32_t* rev
    )

Details:

xvsec_mcap_get_revision() - Returns the MCAP read data registers

Parameters:

handle Unique handle to access the device
rev[] MCAP read data register values

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_get_registers

Syntax:

int xvsec_mcap_get_registers (
    xvsec_handle_t* handle,
    xvsec_mcap_regs_t* mcap_regs
    )

Details:

xvsec_mcap_get_registers() - Returns the MCAP register set

Parameters:

handle Unique handle to access the device
mcap_regs MCAP register values

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_get_fpga_registers

Syntax:

int xvsec_mcap_get_fpga_registers (
    xvsec_handle_t* handle,
    xvsec_fpga_cfg_regs_t* fpga_cfg_regs
    )

Details:

xvsec_mcap_get_fpga_registers() - Returns the FPGA configuration register set

Parameters:

handle Unique handle to access the device
fpga_cfg_regs FPGA configuration register values

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_access_config_reg

Syntax:

int xvsec_mcap_access_config_reg (
    xvsec_handle_t* handle,
    uint16_t offset,
    void* data,
    access_type_t access,
    bool write
    )

Details:

xvsec_mcap_access_config_reg() - Performs read/write operations on the MCAP register set

Parameters:

handle Unique handle to access the device
offset Register address offset from MCAP Base address
data Data pointer which holds the data to write / the data after read
access Control specifier which specifies type of access (8 bits/16 bits/32 bits)
write Control specifier which specifies write/read operation

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_INVALID_OFFSET : Failure

XVSEC_ERR_INVALID_OFFSET_ACCESS_COMBO : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_access_fpga_config_reg

Syntax:

int xvsec_mcap_access_fpga_config_reg (
    xvsec_handle_t* handle,
    uint16_t offset,
    void* data,
    bool write
    )

Details:

xvsec_mcap_access_fpga_config_reg() - Performs read/write operations on the FPGA configuration register set

Parameters:

handle Unique handle to access the device
offset Register address offset from MCAP Base address
data Data pointer which holds the data to write / the data after read
write Control specifier which specifies write/read operation

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

XVSEC_ERR_INVALID_FPGA_REG_NUM : Failure

xvsec_mcap_configure_fpga

Syntax:

int xvsec_mcap_configure_fpga (
    xvsec_handle_t* handle,
    char* partial_cfg_file,
    char* bitfile
    )

Details:

xvsec_mcap_configure_fpga() - Performs bitstream programming on FPGA

Parameters:

handle Unique handle to access the device
partial_cfg_file Partial Clear bitstream file
bitfile Bitstream file

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

XVSEC_ERR_INVALID_FPGA_REG_NUM : Failure

xvsec_mcapv3_configure_fpga

Syntax:

int xvsec_mcapv3_configure_fpga (
    xvsec_handle_t* handle,
    char* partial_cfg_file,
    char* bitfile,
    data_transfer_mode_t tr_mode,
    bool is_full_raw
    )

Details:

xvsec_mcapv3_configure_fpga() - Performs bitstream programming on FPGA

Parameters:

handle Unique handle to access the device
partial_cfg_file Partial Clear bitstream file
bitfile Bitstream file
tr_mode Data transfer mode(slow/fast)
is_full_raw Flag to indicate full raw bitstream programming mode

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

XVSEC_ERR_INVALID_FPGA_REG_NUM : Failure

xvsec_mcap_access_axi_reg

Syntax:

int xvsec_mcap_access_axi_reg (
    xvsec_handle_t* handle,
    uint32_t address,
    void* value,
    bool write,
    axi_access_mode_t mode
    )

Details:

xvsec_mcap_access_axi_reg - Performs AXI read/write operations

Parameters:

handle Unique handle to access the device
address axi address to be read/write
value Data pointer which holds the data to write/read For Read Only 32b mode is supported. For Write 32b/128b modes are supported. Data buffer size is assumed 4 bytes in case of 32b mode Data buffer size is assumed 16 bytes in case of 128b mode
write Control specifier which specifies write/read operation
mode 32bit or 128bit axi mode

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_file_download

Syntax:

int xvsec_mcap_file_download (
    xvsec_handle_t* handle,
    bool fixed_address,
    bool mode_128_bit,
    char* file_name,
    uint32_t dev_address,
    data_transfer_mode_t tr_mode,
    uint32_t sbi_address,
    file_operation_status_t* op_status,
    size_t* err_index
    )

Details:

xvsec_mcap_file_download() - Performs File download at specified address

Parameters:

handle Unique handle to access the device
fixed_address Address Type (is it fixed/incr)
mode_128_bit Access Mode (128 bit or 32 bit)
file_name File to download
dev_address The address to download the file
tr_mode Data transfer mode(slow/fast)
sbi_address SBI reg block address
op_status file download status
err_index file download error index

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_mcap_file_upload

Syntax:

int xvsec_mcap_file_upload (
    xvsec_handle_t* handle,
    bool fixed_address,
    char* file_name,
    uint32_t dev_address,
    size_t length,
    file_operation_status_t* op_status,
    size_t* err_index
    )

Details:

xvsec_mcap_file_upload() - Performs File Upload from specified address

Parameters:

handle Unique handle to access the device
fixed_address Address Type (is it fixed/incr)
file_name File to download
dev_address The address to download the file
length Length of the file to upload
op_status file upload status
err_index file upload error index

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

XVSEC_FAILURE : Failure

xvsec_mcap_set_axi_cache_attr

Syntax:

int xvsec_mcap_set_axi_cache_attr (
    xvsec_handle_t* handle,
    axi_cache_attr_t* user_attr
    )

Details:

xvsec_mcap_set_axi_cache_attr - To set AXI cache and protection bits

Parameters:

handle Unique handle to access the device
user_attr structure having axi cache and protection value to be set

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure

XVSEC_ERR_LINUX_SYSTEM_CALL : Failure

xvsec_lib_get_mcap_revision

Syntax:

int xvsec_lib_get_mcap_revision (
    xvsec_handle_t* handle,
    uint8_t* mrev
    )

Details:

xvsec_lib_get_mcap_revision - To get the MCAP version info from Library

Parameters:

handle Unique handle to access the device
mrev Pointer variable to get the MCAP revision

Returns:

XVSEC_SUCCESS : Success

XVSEC_ERR_INVALID_PARAM : Failure

XVSEC_ERR_OPERATION_NOT_SUPPORTED : Failure