lib/sw_services/xilsem/src/client/xsem_client_api.c
XStatus XSem_CmdCfrGetStatus(XSemCfrStatus *CfrStatusInfo)
{
	XStatus Status = XST_FAILURE;
	u32 Index = 0U;

	if (NULL == CfrStatusInfo) {
		XSem_Dbg("[%s] ERROR: CfrStatusInfo is NULL\n\r", __func__);
		goto END;
	}

	CfrStatusInfo->Status = XSem_In32(PMC_RAM_SEM_CRAM_STATUS);
	CfrStatusInfo->ErrCorCnt = XSem_In32(PMC_RAM_SEM_CRAM_COR_BITCNT);

	for (Index = 0U; Index < MAX_CRAMERR_REGISTER_CNT; Index++) {
		CfrStatusInfo->ErrAddrL[Index] = \
			XSem_In32((PMC_RAM_SEM_CRAMERR_ADDRL0 + (Index * 8U)));
		CfrStatusInfo->ErrAddrH[Index] = \
			XSem_In32((PMC_RAM_SEM_CRAMERR_ADDRH0 + (Index * 8U)));
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to read all CRAM Status registers from
 *		PMC RAM and send to user application
 *
 * @param[out]	CfrStatusInfo Structure Pointer with CRAM Status details
 *		- CfrStatusInfo->Status: Provides details about CRAM scan
 *			- Bit [31-25]: Reserved
 *			- Bit [24:20]: CRAM Error codes
 *				- 00001: Unexpected CRC error when CRAM is
 *				not in observation state
 *				- 00010: Unexpected ECC error when CRAM is
 *				not in Observation or Initialization state
 *				- 00011: Safety write error in SEU handler
 *				- 00100: ECC/CRC ISR not found in any Row
 *				- 00101: CRAM Initialization is not done
 *				- 00110: CRAM Start Scan failure
 *				- 00111: CRAM Stop Scan failure
 *				- 01000: Invalid Row for Error Injection
 *				- 01001: Invalid QWord for Error Injection
 *				- 01010: Invalid Bit for Error Injection
 *				- 01011: Invalid Frame Address for Error
 *				Injection
 *				- 01100: Unexpected Bit flip during Error
 *				Injection
 *				- 01101: Masked Bit during Injection
 *				- 01110: Invalid Block Type for Error
 *				Injection
 *				- 01111: CRC or Uncorrectable Error is
 *				active in CRAM
 *				- 10000: ECC or CRC Error detected during
 *				CRAM Calibration in case of SWECC
 *			- Bit [19-17]: Reserved
 *			- Bit [16]: CRAM Initialization is completed
 *			- Bit [15-14]: CRAM Correctable ECC error status
 *				- 00: No Correctable error encountered
 *				- 01: Correctable error detected and
 *				corrected
 *				- 10: Correctable error detected but not
 *				corrected (Correction is disabled)
 *				- 11: Reserved
 *			- Bit [13]: CRAM Scan internal error
 *			- Bit [12]: CRAM Invalid Error Location detected
 *			- Bit [11]: CRAM Correctable ECC error detected
 *			- Bit [10]: CRAM CRC error detected
 *			- Bit [09]: CRAM Uncorrectable ECC error detected
 *			- Bit [08]: CRAM ECC error during Initialization
 *			- Bit [07]: CRAM Calibration Timeout error
 *			- Bit [06]: CRAM Fatal/Error State
 *			- Bit [05]: CRAM Error Injection State
 *			- Bit [04]: CRAM Idle State
 *			- Bit [03]: CRAM Correction State
 *			- Bit [02]: CRAM Observation State
 *			- Bit [01]: CRAM Initialization State
 *			- Bit [00]: CRAM Scan is included in design
 *		- CfrStatusInfo->ErrAddrL: This stores the low address of
 *		the last 7 corrected error details if correction is enabled
 *		in design.
 *		- CfrStatusInfo->ErrAddrH: This stores the high address of
 *		the last 7 corrected error details if correction is enabled
 *		in design.
 *		- CfrStatusInfo->ErrCorCnt: Counter value of Correctable
 *		Error Bits
 *
 * @return	This API returns the success or failure.
 *		- XST_FAILURE: If NULL pointer reference of CfrStatusInfo
 *		- XST_SUCCESS: On successful read from PMC RAM
 *****************************************************************************/
@brief       This function is used to read all CRAM Status registers from
PMC RAM and send to user application



@return      This API returns the success or failure.
- XST_FAILURE: If NULL pointer reference of CfrStatusInfo
- XST_SUCCESS: On successful read from PMC RAM
@brief This function is used to read all CRAM Status registers from PMC RAM and send to user application @return This API returns the success or failure . - XST_FAILURE : If NULL pointer reference of CfrStatusInfo - XST_SUCCESS : On successful read from PMC RAM
XStatus XSem_CmdCfrGetStatus(XSemCfrStatus *CfrStatusInfo)
{
	XStatus Status = XST_FAILURE;
	u32 Index = 0U;
	if (NULL == CfrStatusInfo) {
		XSem_Dbg("[%s] ERROR: CfrStatusInfo is NULL\n\r", __func__);
		goto END;
	}
	CfrStatusInfo->Status = XSem_In32(PMC_RAM_SEM_CRAM_STATUS);
	CfrStatusInfo->ErrCorCnt = XSem_In32(PMC_RAM_SEM_CRAM_COR_BITCNT);
	for (Index = 0U; Index < MAX_CRAMERR_REGISTER_CNT; Index++) {
		CfrStatusInfo->ErrAddrL[Index] = \
			XSem_In32((PMC_RAM_SEM_CRAMERR_ADDRL0 + (Index * 8U)));
		CfrStatusInfo->ErrAddrH[Index] = \
			XSem_In32((PMC_RAM_SEM_CRAMERR_ADDRH0 + (Index * 8U)));
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
XStatus XSem_CmdCfrGetStatus ( XSemCfrStatus * CfrStatusInfo ) { XStatus Status = XST_FAILURE ; u32 Index = 0U ; if ( NULL == CfrStatusInfo ) { XSem_Dbg ( " \n \r " , __func__ ) ; goto END ; } CfrStatusInfo -> Status = XSem_In32 ( PMC_RAM_SEM_CRAM_STATUS ) ; CfrStatusInfo -> ErrCorCnt = XSem_In32 ( PMC_RAM_SEM_CRAM_COR_BITCNT ) ; for ( Index = 0U ; Index < MAX_CRAMERR_REGISTER_CNT ; Index ++ ) { CfrStatusInfo -> ErrAddrL [ Index ] = XSem_In32 ( ( PMC_RAM_SEM_CRAMERR_ADDRL0 + ( Index * 8U ) ) ) ; CfrStatusInfo -> ErrAddrH [ Index ] = XSem_In32 ( ( PMC_RAM_SEM_CRAMERR_ADDRH0 + ( Index * 8U ) ) ) ; } Status = XST_SUCCESS ; END : return Status ; }
@brief       This function is used to read all CRAM Status registers from
              PMC RAM and send to user application
@brief This function is used to read all CRAM Status registers from PMC RAM and send to user application