prc
Xilinx SDK Drivers API Documentation
xprc_example.c File Reference

Overview

This file contains an example using the XPrc driver to test the registers on the device.

Note
None

MODIFICATION HISTORY:

Ver      Who   Date           Changes


1.0 ms 07/18/2016 First Release ms 04/05/2017 Modified comment lines notation in functions to avoid unnecessary description displayed while generating doxygen.

 

Macros

#define XPRC_DEVICE_ID   XPAR_PRC_0_DEVICE_ID
 The following constants map to the XPAR parameters created in the xparameters.h file. More...
 

Functions

u32 XPrc_Example (u16 DeviceId)
 This function does a minimal test on the PRC device and driver as a design example. More...
 
u32 Xprc_Check_User_Command (u16 VsmId, XGpio ShiftVsmGpio, XGpio CountVsmGpio)
 This function is used to test the User Command. More...
 
u32 Xprc_Check_RestartWithStatus_Command (u16 VsmId)
 This function is used to test the Restart with Status Command. More...
 
u32 Xprc_Check_TriggerRmMapping (u16 VsmId)
 This function is used to test that we can set/get the Trigger to RM mapping registers. More...
 
u32 Xprc_Check_BsIndex_Reg (u16 VsmId)
 This function is used to test that we can set/get the BS Index registers. More...
 
u32 Xprc_Check_RmControl_Reg (u16 VsmId)
 This function is used to test that we can set/get the RM Control registers. More...
 
u32 Xprc_Check_BsSize_Reg (u16 VsmId)
 This function is used to test that we can set/get the BS Size registers. More...
 
u32 Xprc_Check_BsAddress_Reg (u16 VsmId)
 This function is used to test that we can set/get the BS Address registers. More...
 
u32 Xprc_Program_PRC (u16 VsmId)
 This function is used to Program the PRC. More...
 
void Xprc_Restart_VSMs (u16 VsmId)
 This function is used to Restart the VSMs. More...
 
int main (void)
 This is the main function to call the example. More...
 

Macro Definition Documentation

#define XPRC_DEVICE_ID   XPAR_PRC_0_DEVICE_ID

The following constants map to the XPAR parameters created in the xparameters.h file.

They are defined here such that a user can easily change all the needed parameters in one place.

Referenced by main().

Function Documentation

int main ( void  )

This is the main function to call the example.

Parameters
None.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPRC_DEVICE_ID, and XPrc_Example().

u32 Xprc_Check_BsAddress_Reg ( u16  VsmId)

This function is used to test that we can set/get the BS Address registers.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPrc_GetBsAddress(), XPrc_GetNumberOfVsms, XPrc_GetNumRmsAllocated, and XPrc_SetBsAddress().

Referenced by XPrc_Example().

u32 Xprc_Check_BsIndex_Reg ( u16  VsmId)

This function is used to test that we can set/get the BS Index registers.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPrc_GetNumberOfVsms, XPrc_GetNumRmsAllocated, XPrc_GetRmBsIndex(), and XPrc_SetRmBsIndex().

Referenced by XPrc_Example().

u32 Xprc_Check_BsSize_Reg ( u16  VsmId)

This function is used to test that we can set/get the BS Size registers.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPrc_GetBsSize(), XPrc_GetNumberOfVsms, XPrc_GetNumRmsAllocated, and XPrc_SetBsSize().

Referenced by XPrc_Example().

u32 Xprc_Check_RestartWithStatus_Command ( u16  VsmId)

This function is used to test the Restart with Status Command.

Flip the VSM state and set a new RM. Check the status is as expected. Flip the VSM state back to what it was and set the original RM. Check the status is as expected

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPRC_CR_VS_EMPTY, XPRC_CR_VS_FULL, XPrc_GetNumberOfVsms, XPrc_GetNumRms, XPrc_GetRmIdFromStatus(), XPrc_GetVsmState(), XPrc_IsVsmInShutdown(), XPrc_ReadStatusReg(), XPrc_SendRestartWithNoStatusCommand(), XPrc_SendRestartWithStatusCommand(), XPrc_SendShutdownCommand(), XPRC_SR_STATE_EMPTY, and XPRC_SR_STATE_FULL.

Referenced by XPrc_Example().

u32 Xprc_Check_RmControl_Reg ( u16  VsmId)

This function is used to test that we can set/get the RM Control registers.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
The RM Control register contains the following fields: Name | Min value | Max value | Shutdown Required | 0 | 3 | Startup Required | 0 | 1 | Reset Required | 0 | 3 | Reset Duration | 0 | 255 |

References XPrc_GetNumberOfVsms, XPrc_GetNumRmsAllocated, XPrc_GetRmControl(), and XPrc_SetRmControl().

Referenced by XPrc_Example().

u32 Xprc_Check_TriggerRmMapping ( u16  VsmId)

This function is used to test that we can set/get the Trigger to RM mapping registers.

For each trigger allocated, set the value of the RM it will load.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
The width of this register is set by the number of allocated RMs, so we can't use any number greater than that or else it will alias.

References XPrc_GetNumberOfVsms, XPrc_GetNumRmsAllocated, XPrc_GetNumTriggersAllocated, XPrc_GetTriggerToRmMapping(), and XPrc_SetTriggerToRmMapping().

Referenced by XPrc_Example().

u32 Xprc_Check_User_Command ( u16  VsmId,
XGpio  ShiftVsmGpio,
XGpio  CountVsmGpio 
)

This function is used to test the User Command.

Parameters
VsmIdis the identifier of the VSM to access.
ShiftVsmGpiois Instance of the GPIO attached to the PRC's Shift VSM.
CountVsmGpiois Instance of the GPIO attached to the PRC's Count VSM.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
This is only valid for this particular configuration of the PRC so it cannot be used in a general PRC test case. This is configuration dependent because each VSM has its own GPIO.

References XPRC_CR_USER_CONTROL_RM_DECOUPLE_BIT, XPRC_CR_USER_CONTROL_RM_RESET_BIT, XPRC_CR_USER_CONTROL_RM_SHUTDOWN_REQ_BIT, XPRC_CR_USER_CONTROL_SW_SHUTDOWN_REQ_BIT, XPRC_CR_USER_CONTROL_SW_STARTUP_REQ_BIT, XPrc_GetNumberOfVsms, and XPrc_SendUserControlCommand().

Referenced by XPrc_Example().

u32 XPrc_Example ( u16  DeviceId)
u32 Xprc_Program_PRC ( u16  VsmId)

This function is used to Program the PRC.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
For each allocated RM in each VSM, generate a partial bitstream and store it in memory. Program the PRC to point at it.

References XPrc_GetNumberOfVsms, XPrc_GetNumRms, XPrc_SetBsAddress(), XPrc_SetBsSize(), XPrc_SetRmBsIndex(), and XPrc_SetRmControl().

Referenced by XPrc_Example().

void Xprc_Restart_VSMs ( u16  VsmId)

This function is used to Restart the VSMs.

Parameters
VsmIdis the identifier of the VSM to access.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XPrc_GetNumberOfVsms, XPrc_IsVsmInShutdown(), and XPrc_SendRestartWithNoStatusCommand().

Referenced by XPrc_Example().