lib/sw_apps/zynqmp_pmufw/src/pm_slave.c
static s32 PmSlavePrepareState(PmSlave* const slv, const PmStateId next)
{
	s32 status = XST_SUCCESS;
	const PmStateId curr = slv->node.currState;

	/* If slave has power parent make sure the parent is in proper state */
	if (NULL != slv->node.parent) {

		if ((0U == (slv->slvFsm->states[curr] & PM_CAP_POWER)) &&
		    (0U != (slv->slvFsm->states[next] & PM_CAP_POWER))) {
			status = PmPowerRequestParent(&slv->node);
			if (XST_SUCCESS != status) {
				goto done;
			}
		}
	}

	/* Check if slave requires clocks in the next state */
	if (NULL != slv->node.clocks) {
		if ((0U == (slv->slvFsm->states[curr] & PM_CAP_CLOCK)) &&
		    (0U != (slv->slvFsm->states[next] & PM_CAP_CLOCK))) {
			status = PmClockRequest(&slv->node);
		}
	}

done:
	return status;
}
/**
 * PmSlavePrepareState() - Prepare for entering a state
 * @slv		Slave that would enter next state
 * @next	Next state the slave would enter
 *
 * @return	Status fo preparing for the transition (XST_SUCCESS or an error
 *		code)
 */
Prepare for entering a state
@slv         Slave that would enter next state
@next        Next state the slave would enter

@return      Status fo preparing for the transition (XST_SUCCESS or an error
code)
Prepare for entering a state @slv Slave that would enter next state @next Next state the slave would enter @return Status fo preparing for the transition ( XST_SUCCESS or an error code )
static s32 PmSlavePrepareState(PmSlave* const slv, const PmStateId next)
{
	s32 status = XST_SUCCESS;
	const PmStateId curr = slv->node.currState;
	if (NULL != slv->node.parent) {
		if ((0U == (slv->slvFsm->states[curr] & PM_CAP_POWER)) &&
		    (0U != (slv->slvFsm->states[next] & PM_CAP_POWER))) {
			status = PmPowerRequestParent(&slv->node);
			if (XST_SUCCESS != status) {
				goto done;
			}
		}
	}
	if (NULL != slv->node.clocks) {
		if ((0U == (slv->slvFsm->states[curr] & PM_CAP_CLOCK)) &&
		    (0U != (slv->slvFsm->states[next] & PM_CAP_CLOCK))) {
			status = PmClockRequest(&slv->node);
		}
	}
done:
	return status;
}
static s32 PmSlavePrepareState ( PmSlave * const slv , const PmStateId next ) { s32 status = XST_SUCCESS ; const PmStateId curr = slv -> node . currState ; if ( NULL != slv -> node . parent ) { if ( ( 0U == ( slv -> slvFsm -> states [ curr ] & PM_CAP_POWER ) ) && ( 0U != ( slv -> slvFsm -> states [ next ] & PM_CAP_POWER ) ) ) { status = PmPowerRequestParent ( & slv -> node ) ; if ( XST_SUCCESS != status ) { goto done ; } } } if ( NULL != slv -> node . clocks ) { if ( ( 0U == ( slv -> slvFsm -> states [ curr ] & PM_CAP_CLOCK ) ) && ( 0U != ( slv -> slvFsm -> states [ next ] & PM_CAP_CLOCK ) ) ) { status = PmClockRequest ( & slv -> node ) ; } } done : return status ; }
PmSlavePrepareState() - Prepare for entering a state
 @slv         Slave that would enter next state
 @next        Next state the slave would enter
PmSlavePrepareState () - Prepare for entering a state @slv Slave that would enter next state @next Next state the slave would enter
/* If slave has power parent make sure the parent is in proper state */ /* Check if slave requires clocks in the next state */