RFSoC Data Converter Evaluation Tool User Guide 66
UG1287 (v2018.2) October 1, 2018 www.xilinx.com
Appendix A: Reference Design Protocol Specification
• cmd_interface (.c/.h)
°
This is the core of the command protocol. It contains a menu/table of commands
and their expected arguments.
°
This menu is implemented as an array of command-structures.
- The command-structures contain the command name, the expected arguments,
the argument number format (long, unsigned, double), and a function-pointer
to call if the command matches.
- Extending to add a new command involves adding a new entry in the table,
adding the associated function-pointer, and adding the function itself.
When a command is received, it is checked for a match in the table, and the number of
arguments received is checked against the expected number of arguments from the
table. Arguments are parsed from the command string and converted based on the
expected data type. The arguments are put into an array of unions to allow the same
data type to be passed to functions that expect different argument data types.
The associated wrapper function is called by the function-pointer, and a return
value/message string generated.
• rfdc_commands (.c/.h)
°
This file contains the ADC/DAC wrapper functions that are called from the menu
(via the function pointer).
°
Each wrapper function calls the corresponding API function.
Porting
Porting the control path to support a new communications interface involves only editing
the io_interface functions. The key functions that must be addressed are:
•GetString
°
This function must return a full command string, which is terminated by \n.
°
If a string is partially received (i.e., still being received), this function should not
block (see the Non-blocking function), and return 0.
°
When a string is fully received, it returns a non-zero number to reflect there is a new
command to be parsed.
•SendHW
°
This function is called from SendString which pre-parses a string to remove
embedded \r and \n characters and append a single \r\n at the end.
°
SendHW is essentially a print function that actually transmits the information at the
end.