lib/sw_services/xilsem/src/client/xsem_client_api.c
XStatus XSem_CmdNpiGetStatus(XSemNpiStatus *NpiStatusInfo)
{
	XStatus Status = XST_FAILURE;
	u32 Index = 0U;

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

	NpiStatusInfo->Status = XSem_In32(PMC_RAM_SEM_NPI_STATUS);
	NpiStatusInfo->ScanCnt = XSem_In32(PMC_RAM_SEM_NPI_SCAN_CNT);
	NpiStatusInfo->HbCnt = XSem_In32(PMC_RAM_SEM_NPI_HEARTBEAT_CNT);

	for (Index = 0U; Index < MAX_NPI_SLV_SKIP_CNT; Index++) {
		NpiStatusInfo->SlvSkipCnt[Index] = \
			XSem_In32(PMC_RAM_SEM_NPI_SLVSKIP_CNT0 + (Index * 4U));
	}

	for (Index = 0U; Index < MAX_NPI_ERR_INFO_CNT; Index++) {
		NpiStatusInfo->ErrInfo[Index] = \
			XSem_In32(PMC_RAM_SEM_NPIERR_INFO0 + (Index * 4U));
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to read all NPI Status registers from
 *		PMC RAM and send to user application
 *
 * @param[out]	NpiStatusInfo Structure Pointer with NPI Status details
 *		- NpiStatusInfo->Status: Provides details about NPI scan
 *			- Bit [31]: Cryptographic acceleration blocks are disabled for
 *			export compliance
 *			- Bit [30-26]: Reserved
 *			- Bit [25]: NPI GPIO write failure
 *			- Bit [24]: NPI SHA engine failure
 *			- Bit [23]: NPI Safety register write failure
 *			- Bit [22]: NPI GT slave arbitration failure
 *			- Bit [21]: NPI DDRMC Main slave arbitration failure
 *			- Bit [20]: NPI Slave Address is not valid
 *			- Bit [19]: NPI Descriptor SHA header is not valid
 *			- Bit [18]: NPI Descriptor header is not valid
 *			- Bit [17]: NPI SHA mismatch error is detected during
 *			scan
 *			- Bit [16]: NPI SHA mismatch error is detected in
 *			first scan
 *			- Bit [15-12]: Reserved
 *			- Bit [11]: NPI periodic scan is enabled
 *			- Bit [10]: NPI scan is suspended
 *			- Bit [09]: NPI completed the first scan
 *			- Bit [08]: NPI Scan is included in design
 *			- Bit [07-06]: Reserved
 *			- Bit [05]: NPI Internal Error State
 *			- Bit [04]: NPI SHA mismatch Error State
 *			- Bit [03]: NPI SHA Error Injection State
 *			- Bit [02]: NPI Scan State
 *			- Bit [01]: NPI Initialization State
 *			- Bit [00]: NPI Idle State
 *		- NpiStatusInfo->SlvSkipCnt: Provides NPI descriptor slave skip
 *		counter value if arbitration failure. This is 8 words result
 *		to accommodate 32 1-Byte skip counters for individual slaves
 *		arbitration failures. Slaves can be DDRMC Main, GT for which
 *		arbitration is required before performing scanning.
 *		- NpiStatusInfo->ScanCnt: NPI scan counter value. This
 *		counter represents number of periodic scan cycle completion.
 *		- NpiStatusInfo->HbCnt: NPI heartbeat counter value. This
 *		counter represents number of scanned descriptor slaves.
 *		- NpiStatusInfo->ErrInfo: NPI scan error information if SHA
 *		mismatch is detected. This is 2 word information.
 *			- Word 0: Node ID of descriptor for which SHA
 *			mismatch is detected
 *			- Word 1 Bit [15-8]: NPI descriptor index number
 *			- Word 1 Bit [7-0]: NPI Slave Skip count Index
 *
 * @return	This API returns the success or failure.
 *		- XST_FAILURE: If NULL pointer reference of NpiStatusInfo
 *		- XST_SUCCESS: On successful read from PMC RAM
 *****************************************************************************/
@brief       This function is used to read all NPI 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 NpiStatusInfo
- XST_SUCCESS: On successful read from PMC RAM
@brief This function is used to read all NPI 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 NpiStatusInfo - XST_SUCCESS : On successful read from PMC RAM
XStatus XSem_CmdNpiGetStatus(XSemNpiStatus *NpiStatusInfo)
{
	XStatus Status = XST_FAILURE;
	u32 Index = 0U;
	if (NULL == NpiStatusInfo) {
		XSem_Dbg("[%s] ERROR: NpiStatusInfo is NULL\n\r", __func__);
		goto END;
	}
	NpiStatusInfo->Status = XSem_In32(PMC_RAM_SEM_NPI_STATUS);
	NpiStatusInfo->ScanCnt = XSem_In32(PMC_RAM_SEM_NPI_SCAN_CNT);
	NpiStatusInfo->HbCnt = XSem_In32(PMC_RAM_SEM_NPI_HEARTBEAT_CNT);
	for (Index = 0U; Index < MAX_NPI_SLV_SKIP_CNT; Index++) {
		NpiStatusInfo->SlvSkipCnt[Index] = \
			XSem_In32(PMC_RAM_SEM_NPI_SLVSKIP_CNT0 + (Index * 4U));
	}
	for (Index = 0U; Index < MAX_NPI_ERR_INFO_CNT; Index++) {
		NpiStatusInfo->ErrInfo[Index] = \
			XSem_In32(PMC_RAM_SEM_NPIERR_INFO0 + (Index * 4U));
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
XStatus XSem_CmdNpiGetStatus ( XSemNpiStatus * NpiStatusInfo ) { XStatus Status = XST_FAILURE ; u32 Index = 0U ; if ( NULL == NpiStatusInfo ) { XSem_Dbg ( " \n \r " , __func__ ) ; goto END ; } NpiStatusInfo -> Status = XSem_In32 ( PMC_RAM_SEM_NPI_STATUS ) ; NpiStatusInfo -> ScanCnt = XSem_In32 ( PMC_RAM_SEM_NPI_SCAN_CNT ) ; NpiStatusInfo -> HbCnt = XSem_In32 ( PMC_RAM_SEM_NPI_HEARTBEAT_CNT ) ; for ( Index = 0U ; Index < MAX_NPI_SLV_SKIP_CNT ; Index ++ ) { NpiStatusInfo -> SlvSkipCnt [ Index ] = XSem_In32 ( PMC_RAM_SEM_NPI_SLVSKIP_CNT0 + ( Index * 4U ) ) ; } for ( Index = 0U ; Index < MAX_NPI_ERR_INFO_CNT ; Index ++ ) { NpiStatusInfo -> ErrInfo [ Index ] = XSem_In32 ( PMC_RAM_SEM_NPIERR_INFO0 + ( Index * 4U ) ) ; } Status = XST_SUCCESS ; END : return Status ; }
@brief       This function is used to read all NPI Status registers from
              PMC RAM and send to user application
@brief This function is used to read all NPI Status registers from PMC RAM and send to user application