Runtime Interface Based on Generated API Code
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);typedef 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.