Processing System
The processing system (PS) is the part of the Zynq SoC that contains the ARM cores and other peripherals. In XiBIF, the PS handles the communication with the programmable logic (PL) and the host computer. The PL is connected to the PS through a set of AXI interfaces, while the host computer communicates via Ethernet.
Normally, there is no reason to modify the software running on the PS. However, XiBIF has foreseen three entry points that can be used to add custom functionality to the PS.
Warning
You may modify the software running on the PS if needed. However, keep in mind that any changes will be overwritten during a XiBIF upgrade.
Bootup Code
There are some cases where it is required to run some custom code during startup of the PS. For example, if you want to enable the voltage of the FMC connector on the ZCU104 board. For this, XiBIF provides the weak function XiBIF_startUp(). This function is called before XiBIF is initialized. You can override this function in your own code and add the required functionality. By default, this function does nothing. The function declaration is as follows:
void XiBIF_startUp() __attribute__((weak));
Warning
Create a new file to overwrite this function. Do not modify any of the files generated by XiBIF. Otherwise, your changes will be lost during the next upgrade of XiBIF.
IP-Address Change
Another case where you may want to add custom code is when the IP address of the PS changes. This can, for example, be used to show the current IP address on the OLED display of the Zedboard. To do this, XiBIF provides the weak function XiBIF_printIpSettings(). This function is called whenever the IP address of the PS changes. You can override this function in your own code and add the required functionality. By default, this function writes the IP address to the console. The function declaration is as follows:
void XiBIF_printIpSettings(ip_addr_t* ip, ip_addr_t* mask, ip_addr_t* gw) __attribute__((weak));
Warning
Create a new file to overwrite this function. Do not modify any of the files generated by XiBIF. Otherwise, your changes will be lost during the next upgrade of XiBIF.
Own Command Handler
In some cases, you may want to add your own command handler to the PS. This can be used to implement custom commands that are not part of the standard XiBIF command set. To do this, XiBIF provides the weak function XiBIF_ownCommandHandler(). This function is called whenever a command with an unknown command code is received by the PS. You can override this function in your own code and add the required functionality. By default, this function does nothing. The function declaration is as follows:
XiBIF_error_t XiBIF_ownCommandHandler(u32 cmd, int sd) __attribute__((weak));
The received command code is passed as the first argument, and the socket descriptor of the connection is passed as the second argument. You can use this function to implement your own command handling logic. The socket descriptor can be used to send a response back to the host computer or receive additional data from the host. In case the connection is closed, the function should return an error code. If the command is handled successfully, the function should return XIBIF_NO_ERROR.
Warning
Create a new file to overwrite this function. Do not modify any of the files generated by XiBIF. Otherwise, your changes will be lost during the next upgrade of XiBIF.
Own Webserver API endpoint
In some cases, you may want to add your own Webserver API endpoint to the PS. This can be used to implement custom functionality that is not part of the standard XiBIF API. To do this, XiBIF provides the weak function XiBIF_webOwnCommandHandler(). This function is called whenever an HTTP request with an unknown endpoint is received by the PS. You can override this function in your own code and add the required functionality. By default, this function return the Error 400 - Bad request. The function declaration is as follows:
XiBIF_error_t XiBIF_webOwnCommandHandler(XiBIF_webMethod_t type, const char* url, u32 size_url, const char* body, u32 size_body, XiBIF_webKeepAlive_t keep_alive, int sd) __attribute__((weak));
The HTTP method type is passed as the first argument, the requested URL as the second argument, the size of the URL as the third argument, the request body as the fourth argument, the size of the body as the fifth argument, the keep-alive flag as the sixth argument, and the socket descriptor of the connection as the seventh argument. You can use this function to implement your own API endpoint logic. The socket descriptor can be used to send a response back to the host computer. In case the connection is closed, the function should return an error code. If the request is handled successfully, the function should return XIBIF_NO_ERROR.
Warning
Create a new file to overwrite this function. Do not modify any of the files generated by XiBIF. Otherwise, your changes will be lost during the next upgrade of XiBIF.