VisualApplets supports different models for accessing design parameters at runtime:
-
Using eVA runtime environment based on HAP files
-
Using GenICam API based on generated GenICam XML code
-
Using generic, design-specific C API code generated by VisualApplets
VisualApplets controls synthesis and implementation of the FPGA design. The resulting design is saved in a proprietary Basler file format (*.hap). This format contains the configuration bitstream for the FPGA and means for realizing a design-specific software interface.
In general, VisualApplets operators contain dynamic parameters which can be modified during runtime. The HAP file contains all necessary information for accessing design specific parameters easily.
For proper function of the runtime software on the user platform, the following requirements must be fulfilled:
-
The user needs access to the FPGA bitstream as he needs to do the configuration. For that purpose, the runtime interface provides the function
vaRt_GetConfig()
. -
For accessing the slave interface for the design registers, the user must implement the functions
WriteReg32()
,ReadReg32()
, or optionallyWriteReg64()
andReadReg64()
. The runtime software is notified about these functions when the functionvaRt_InitParams()
is called.
Then the VisualApplets bitstream can be configured and the runtime software can write and read design parameters.
The register access functions must comply with following function types:
typedef int ReadReg32(void* device, const uintptr_t address, uint32_t *value) typedef int WriteReg32(void* device, const uintptr_t address, uint32_t value) typedef int ReadReg64(void* device, const uintptr_t address, uint64_t *value) typedef int WriteReg64(void* device, const uintptr_t address, uint64_t value)
The software interface library provides additional functions for controlling the VisualApplets design. In the following table, the full set of access functions is listed:
Nr. |
Function |
Description |
---|---|---|
1 |
|
Opens the hardware applet |
2 |
|
Closes the hardware applet which has been opened by |
3 |
|
Returns a pointer to the configuration bit stream for the FPGA. |
4 |
|
Query function for applet properties like the maximum frequency of the clock net iDesignClk of the applet, information about the target platform, and version information. |
5 |
|
Returns the number of processes of which the design is composed. |
6 |
|
Returns the number of used external interface ports. All kinds of interface
ports are joined in a list where the position in the list is the logical number of
the port. Port names and properties can be obtained by below specified functions
|
7 |
|
Get the name of the interface port with the given logical port number. |
8 |
|
Query I/O port properties like the name of a connected operator, the process which controls this port, and the current image format setting for this port. |
9 |
|
Returns the number of parameters of a design. |
10 |
|
For a given parameter number the corresponding name is returned. |
11 |
|
For a given parameter number the parameter ID is returned. |
12 |
|
For a given parameter name the parameter ID is returned. |
13 |
|
Query parameter properties. |
14 |
|
Configure parameter interface and initialize parameters to default values. |
15 |
|
Query parameter value. |
16 |
|
Query array of parameters. |
17 |
|
Set parameter value. |
18 |
|
Set array of parameters. |
19 |
|
Set the Master Enable signal. |
20 |
|
Activate a process of the VisualApplets design. |
21 |
|
Perform a reset of a VisualApplets design process. |
22 |
|
Query description for given error code. |
For querying information and configuring parameters, data must be exchanged through the
runtime interface. In order to keep the interface functions simple but providing a type-save
interface, an abstraction mechanism for data is implemented. Whenever data of different
types needs to be communicated, a data structure called va_data
is used,
containing a reference to the data and information about the underlying data type. This data
structure is created by the user but configured by dedicated functions listed below. The
following table shows the data types which are handled by this method:
Data Type |
Description |
---|---|
|
Enum entry given as 32-bit integer. |
|
32-bit signed integer. |
|
32-bit unsigned integer. |
V |
64-bit signed integer. |
|
64-bit unsigned integer. |
|
Floating-point value, double precision. |
|
Array of 32-bit signed integer numbers. |
|
Array of 32-bit unsigned integer numbers. |
|
Array of 64-bit signed integer numbers. |
|
Array of 64-bit unsigned integer numbers. |
|
Array of double numbers. |
|
String given as |
Configuring an earlier created va_data
structure (vaData) for setting up
data communication is done via the following functions:
va_data* va_data_enum(va_data* vaData, int32_t *data) va_data* va_data_int32(va_data* vaData, int32_t *data) va_data* va_data_uint32(va_data* vaData, uint32_t *data) va_data* va_data_int64(va_data* vaData, int64_t *data) va_data* va_data_uint64(va_data* vaData, uint64_t *data) va_data* va_data_double(va_data* vaData, double *data) va_data* va_data_int32_array(va_data* vaData, int32_t *data, size_t elementCount) va_data* va_data_uint32_array (va_data* vaData, uint32_t *data, size_t elementCount) va_data* va_data_int64_array (va_data* vaData, int64_t *data, size_t elementCount) va_data* va_data_uint64_array (va_data* vaData, uint64_t *data, size_t elementCount) va_data* va_data_double_array (va_data* vaData, double *data, size_t elementCount) va_data* va_data_string(va_data* vaData, char *data, size_t strSize) va_data* va_data_const_string(va_data* vaData, const char **data)
For strings there are two options how strings are communicated:
-
Providing a char array via
va_data_string()
. Then queried string data will be copied to that array. -
Providing a pointer to
const char*
. Then a pointer to an internal string representation is returned when information of typeVA_STRING
is queried. When you use this approach check the live time of the returned string.
Example Code:
The following example shows code for querying the design frequency for a configured design.
double desFreq; va_data va_desFreq; va_data_double(&va_desFreq,&desFreq); vaRt_GetAppletProperty(hapHandle, "DesignFreq",&va_desFreq);
After that, the variable desFreq
will contain the requested information.
The following table gives a detailed description of parameters and returned values for the specified runtime access functions.
Function |
|
---|---|
Parameter 1 |
Name of hap file which shall be opened. |
Parameter 2 |
Return pointer for hap handle. |
Description |
Opens the hardware applet with the provided name and returns a pointer to the hap structure. The returned pointer is used as a handle in all other interface functions. |
Return value |
0 : OK <0: Error opening applet |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Description |
Closes the VA hardware applet. |
Return value |
0 = OK <0 = Error closing HAP |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
ID of the FPGA within the target platform. For single-configuration HAP files (currently the only option) this parameter may be fixed to -1. Otherwise this parameter must correspond to the (optional) FPGA ID specified in the hardware definition file used for creating the VisualApplets platform. |
Parameter 3 |
Pointer to buffer for the configuration bitstream. |
Parameter 4 |
Communicate the size of the configuration bitstream in bytes. |
Description |
Get the configuration bitstream for the FPGA design. The function has two modes of operation: |
Return value |
0: OK <0: Error acquiring the bitstream |
Function |
int vaRt_GetAppletProperty (va_hap_handle handle, const char* propName,va_data
* data)
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Name of property which shall be queried. |
Parameter 3 |
Pointer to data structure which will used for communication. |
Description |
Get property of the applet. Following properties may be queried:
The properties are identified by one of the above strings (provided through
parameter 2) and communicated via the data structure given through parameter 3.
For properties of type |
Return value |
0 : OK <0 : Can’t retrieve applet property |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Return value for process count. |
Description |
Get the number of processes of which the design is composed. |
Return value |
0: OK <0 : Can’t retrieve information |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Return value for port count. |
Description |
Get the number of used I/O ports of the VA IP Core. The returned number represents the size of an internally managed port list where all interface ports are registered and the position in the list is the logical number of the I/O port. |
Return value |
0: OK <0 : Can’t retrieve information |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Logical interface port number, which is an integer between Zero and the
returned value from |
Description |
Get the name of the interface port with the given logical number. When there are several ports of the same kind these ports are differentiated by a suffix _X where X is the port index (e.g. DmaRd_0). |
Return value |
0: OK; <0 : No port with given index found |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Name of I/O port. |
Parameter 3 |
Name of property which shall be queried. |
Parameter 4 |
Pointer to data structure which will be used for communication. |
Description |
Get property of the I/O port with the given name. Following properties may be queried:
The properties are identified by one of the above strings (provided through
parameter 3) and communicated via the data structure given through parameter 4.
For properties of type |
Return value |
0: OK <0 : Can’t retrieve the requested property |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Pointer to device handle which is provided to the low level access functions
|
Parameter 3 |
Function pointer for 32-bit register read function. |
Parameter 4 |
Function pointer for 32-bit register write function. |
Parameter 5 |
Function pointer for 64-bit register read function. |
Parameter 6 |
Function pointer for 64-bit register write function. |
Description |
Initialize parameter interface by providing low level register access
functions and associating a board interface pointer to them. The initialization
procedure includes configuring initial values. Note that any other function
Regarding the register access functions following options are available: |
Return value |
0: Parameter interface has been initialized successfully <0 : Error during initialization |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Return value for number of parameters. |
Description |
Get the number of parameters of the applet which can be accessed via the parameter interface. The returned number represents the size of an internally managed parameter list where all available parameters are registered and the position in the list defines the logical number of the parameter. |
Return value |
0: OK <0 : Can’t retrieve information |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Logical parameter number, which is an integer between Zero and the returned
value from |
Parameter 3 |
Return pointer to name string. |
Description |
Get the name of the applet parameter by the given logical parameter number. |
Return value |
0: OK; *name returns a pointer to a static buffer which holds the parameter name (0-terminated). Note that the buffer may be overwritten by the next call of this function. <0 : Can’t retrieve information |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Logical parameter number, which is an integer between zero and the returned
value from |
Parameter 3 |
Return pointer for parameter ID. |
Description |
Get the ID of a parameter of the applet. This ID is used for accessing that parameter. |
Return value |
0: OK <0 : No parameter with given index found |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Name of parameter which can be one of the values provided by
|
Parameter 3 |
Return pointer for parameter ID. |
Description |
Get the ID of a parameter with the given name. This ID is used for accessing that parameter. |
Return value |
0: OK <0 : No parameter with given name found |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Parameter name. |
Parameter 3 |
Name of property which shall be queried. |
Parameter 4 |
Pointer to data structure which will be used for communication. |
Description |
Query property of applet parameter. Different parameter types do have
different properties. See the VA Engine specification for a list of available
parameter properties. The properties are identified by a string given by parameter
3 and communicated via the data structure provided by parameter 4. For properties
of type |
Return value |
0 : OK <0 : Can’t retrieve parameter property |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Parameter ID. |
Parameter 3 |
Pointer to data structure which will be used for communication. The associated data element will be overwritten by the acquired value. |
Description |
Query the applet parameter by parameter ID. The data is communicated using a
data structure given by parameter 3. For querying field parameters use
|
Return value |
0: OK. <0 : Error querying the parameter. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Parameter ID. |
Parameter 3 |
Pointer to the data structure which will be used for communication. The associated data elements will be overwritten by the acquired values. |
Parameter 4 |
Start index within the parameter field |
Parameter 5 |
Number of elements which shall be queried |
Description |
Query field parameter of applet by parameter ID filling an array of data elements. The data is communicated via the data structure given by parameter 4. |
Return value |
0: OK. <0 : Error querying the array. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Parameter ID. |
Parameter 3 |
Pointer to the data structure which will be used for submitting data to the Applet. |
Description |
Set applet parameter with the given name. Data is provided by a data
structure (Parameter 4). For setting field parameters use
v |
Return value |
0: OK. <0 : Error setting the parameter. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Parameter ID. |
Parameter 3 |
Pointer to the data structure which will be used for submitting values to the applet. |
Parameter 4 |
Start index within parameter field. |
Parameter 5 |
Number of elements which shall be set. |
Description |
Set field parameter of applet with the given name submitting an array of data elements. The data is provided via a data structure (Parameter 3). |
Return value |
0: OK. <0 : Error setting the parameter field. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
State to which the global enable shall be set (1 or 0). |
Description |
Set the global enable to 1 (active=1) or 0 (active=0). |
Return value |
0: OK <0 : Error setting the global enable state. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Process number or ((unsigned int)-1) for identifying all processes at once. |
Parameter 3 |
State to which the enable shall be set (1 or 0). |
Description |
Set the enable of a process (or all processes) to 1 (active=1) or 0 (active=0). |
Return value |
0: OK. <0 : Error setting the process enable state. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter 2 |
Process number or ((unsigned int)-1) for identifying all processes at once. |
Description |
Reset the process with the given logical process number (or all processes).
The according process reset signal(s) will be asserted and released again. The
enable signal(s) of the corresponding process(es) is not touched. Use
|
Return value |
0: OK. <0 : Cannot reset the process. |
Function |
|
---|---|
Parameter 1 |
Hap handle from |
Parameter2 |
Code from |
Description |
Query error message string for given error code. |
Return value |
Not NULL: Error description (0-terminated c-string) NULL: No description available |
For a given design, VisualApplets may generate GenICam XML code. When the target platform is connected via a GenICam compatible interface to the software, this option allows a seamless integration of image processing parameters into the GenICam API. There is no need for any additional software component.
If the parameter access needs to be integrated into an existing master GenICam XML file, you need to do some post processing. This is usually the case when the platform is already controlled via GenICam before embedding the VA IP core.
To integrate the parameter access into an existing master GenICam XML file:
-
Cut the header of the XML file generated by VisualApplets.
-
Copy the remaining code for the categories, variables, and registers into the master XML file.
VisualApplets may automatize this step as it is capable calling custom post processing tasks.
For a given design, VisualApplets may generate generic C API code. The code is platform independent ANSI-C code. This approach is well suited for software integration in embedded systems (e.g., Zynq7000).
The generated code provides the following interface:
#include <stdint.h> typedef int (*write_func_t)(void* boardHandle,int address, uint64_t value, size_t sizeInBytes); int (*read_func_t)(void* boardHandle,int address, uint64_t *value, size_t sizeInBytes); enum VariableTypes_enum{ TYPE_UNKNOWN = 0, TYPE_INT = 1, TYPE_FLOAT = 2, TYPE_STRING = 3 }; typedef enum VariableTypes_enum VariableType_t; enum AccessMode_enum{ RO, WO, RW }; typedef enum AccessMode_enum AccessMode_t; int va_init(void* boardHandle, write_func_t wrFunc, read_func_t rdFunc); int va_set_property(const char* propName, const char* propValue); int va_get_int_value(const char* varName, int64_t *retValue); int va_set_int_value(const char* varName, int64_t value); int va_get_float_value(const char* varName, double *retValue); int va_set_float_value(const char* varName, double value); int va_get_string_value(const char* varName, const char **retValue); int va_get_enum_value(const char* varName, const char** retValue); int va_set_enum_value(const char* varName, const char* value); int va_get_enum_item_count(const char* varName, int64_t *itemCount); int va_get_enum_item_info(const char* varName, int64_t index, const char** itemName, int64_t *itemValue); int va_query_variables_count(int32_t *retCount); int va_query_variable_name(int32_t index, const char** retName); int va_query_variable_type(const char* varName, VariableType_t *type); int va_query_int_variable_properties(const char* varName, int64_t *from, int64_t *to, int64_t *inc, AccessMode_t *access); int va_query_float_variable_properties(const char* varName, double *from, double *to, double *inc, AccessMode_t *access);
You initialize the interface by calling va_init()
.
The callback functions for write and read access to the register slave interface of the
VA IP core are registered. The given boardHandle
is stored and provided with any
triggered call of these write and read functions. The set of query functions provide a
baseline mechanism for implementing a generic runtime interface. For a given design the set
functions and get functions provide parameter access where parameters are addressed by name.
These functions perform the translation from accessing design parameters to accessing
registers on the hardware via the call back functions for register access.