lib/sw_apps/zynqmp_pmufw/src/pm_slave.c
static s32 PmGetStateWithCaps(const PmSlave* const slave, const u32 caps,
				  PmStateId* const state)
{
	PmStateId i;
	s32 status = XST_PM_CONFLICT;

	for (i = 0U; i < slave->slvFsm->statesCnt; i++) {
		/* Find the first state that contains all capabilities */
		if ((caps & slave->slvFsm->states[i]) == caps) {
			status = XST_SUCCESS;
			if (NULL != state) {
				*state = i;
			}
			break;
		}
	}

	return status;
}
/**
 * PmGetStateWithCaps() - Get id of the state with provided capabilities
 * @slave       Slave whose states are searched
 * @caps        Capabilities the state must have
 * @state       Pointer to a PmStateId variable where the result is put if
 *              state is found
 *
 * @return      Status of the operation
 *              - XST_SUCCESS if state is found
 *              - XST_NO_FEATURE if state with required capabilities does not
 *                exist
 *
 * This function is to be called when state of a slave should be updated,
 * to find the slave's state with required capabilities.
 * Argument caps has included capabilities requested by all masters which
 * currently use the slave. Although these separate capabilities are validated
 * at the moment request is made, it could happen that there is no state that
 * has capabilities requested by all masters. This conflict has to be resolved
 * between the masters, so PM returns an error.
 */
Get id of the state with provided capabilities
@slave       Slave whose states are searched
@caps        Capabilities the state must have
@state       Pointer to a PmStateId variable where the result is put if
state is found

@return      Status of the operation
- XST_SUCCESS if state is found
- XST_NO_FEATURE if state with required capabilities does not
exist

This function is to be called when state of a slave should be updated,
to find the slave's state with required capabilities.
Argument caps has included capabilities requested by all masters which
currently use the slave. Although these separate capabilities are validated
at the moment request is made, it could happen that there is no state that
has capabilities requested by all masters. This conflict has to be resolved
between the masters, so PM returns an error.
Get id of the state with provided capabilities @slave Slave whose states are searched @caps Capabilities the state must have @state Pointer to a PmStateId variable where the result is put if state is found @return Status of the operation - XST_SUCCESS if state is found - XST_NO_FEATURE if state with required capabilities does not exist This function is to be called when state of a slave should be updated to find the slave ' s state with required capabilities . Argument caps has included capabilities requested by all masters which currently use the slave . Although these separate capabilities are validated at the moment request is made it could happen that there is no state that has capabilities requested by all masters . This conflict has to be resolved between the masters so PM returns an error .
static s32 PmGetStateWithCaps(const PmSlave* const slave, const u32 caps,
				  PmStateId* const state)
{
	PmStateId i;
	s32 status = XST_PM_CONFLICT;
	for (i = 0U; i < slave->slvFsm->statesCnt; i++) {
		if ((caps & slave->slvFsm->states[i]) == caps) {
			status = XST_SUCCESS;
			if (NULL != state) {
				*state = i;
			}
			break;
		}
	}
	return status;
}
static s32 PmGetStateWithCaps ( const PmSlave * const slave , const u32 caps , PmStateId * const state ) { PmStateId i ; s32 status = XST_PM_CONFLICT ; for ( i = 0U ; i < slave -> slvFsm -> statesCnt ; i ++ ) { if ( ( caps & slave -> slvFsm -> states [ i ] ) == caps ) { status = XST_SUCCESS ; if ( NULL != state ) { * state = i ; } break ; } } return status ; }
PmGetStateWithCaps() - Get id of the state with provided capabilities
 @slave       Slave whose states are searched
 @caps        Capabilities the state must have
 @state       Pointer to a PmStateId variable where the result is put if
              state is found
PmGetStateWithCaps () - Get id of the state with provided capabilities @slave Slave whose states are searched @caps Capabilities the state must have @state Pointer to a PmStateId variable where the result is put if state is found
/* Find the first state that contains all capabilities */