Porting to Platform - 2022.2 English

Vitis Networking P4 User Guide (UG1308)

Document ID
2022.2 English

The drivers provided by Vitis Networking P4 are deliberately decoupled from platform-specific functionality such as FPGA register access. This is done to maximize portability, but requires that customer applications using the drivers provide this functionality during initialization.

To utilize the drivers on a user platform an environment interface structure must be provided for the specific platform. The environment interface structure provides the driver with the platform specific implementations for the following:

  • Read and write functions for 32 bit registers (mandatory)
  • Logging functions for information and error logging (mandatory)
  • A context data structure supporting the implementation of the above functions (optional)

The environment interface structure XilVitisNetP4EnvIf is defined as follows in the vitisnetp4_common.h file:

struct XilVitisNetP4EnvIf
  XilVitisNetP4UserCtxType    UserCtx;     /**< Pointer to application-specific 
                                           context needed by callbacks (set to 
                                           NULL if not needed)*/
  XilVitisNetP4WordWrite32Fp  WordWrite32; /**< Callback for function to perform 
                                           a 32-bit write to a hardware 
  XilVitisNetP4WordRead32Fp   WordRead32;  /**< Callback for function to perform 
                                           a 32-bit read from a hardware 
  XilVitisNetP4LogFp          LogError;    /**< Callback for function to emit 
                                           error messages*/
  XilVitisNetP4LogFp          LogInfo;     /**< Callback for function to emit 
                                           informational messages*/

A reference implementation is provided by function XilVitisNetP4StubEnvIf() implemented in file vitisnetp4_common.c. This reference is a stubbed implementation of the environment structure interface which does not perform any register reads or writes.