lib/sw_apps/zynqmp_pmufw/src/pm_slave.c
static s32 PmSlaveChangeState(PmSlave* const slave, const PmStateId state)
{
	u32 t;
	s32 status;
	const PmSlaveFsm* fsm = slave->slvFsm;
	PmStateId oldState = slave->node.currState;

	/* Check what needs to be done prior to performing the transition */
	status = PmSlavePrepareState(slave, state);
	if (XST_SUCCESS != status) {
		goto done;
	}

	if (0U == fsm->transCnt) {
		/* Slave's FSM has no transitions when it has only one state */
		status = XST_SUCCESS;
	} else {
		/*
		 * Slave has transitions to change the state. Assume the failure
		 * and change status if state is changed correctly.
		 */
		status = XST_FAILURE;
	}

	for (t = 0U; t < fsm->transCnt; t++) {
		/* Find transition from current state to state to be set */
		if ((fsm->trans[t].fromState != slave->node.currState) ||
			(fsm->trans[t].toState != state)) {
			continue;
		}
		if (NULL != slave->slvFsm->enterState) {
			/* Execute transition action of slave's FSM */
			status = slave->slvFsm->enterState(slave, state);
		} else {
			status = XST_SUCCESS;
		}
		break;
	}

done:
	if ((oldState != state) && (XST_SUCCESS == status)) {
		PmNodeUpdateCurrState(&slave->node, state);
		PmSlaveClearAfterState(slave, oldState);
	}
	if (XST_SUCCESS == status) {
		PmInfo("%s %d->%d\r\n", slave->node.name, oldState,
		       slave->node.currState);
	} else {
		PmErr("#%d %s state#%u\r\n", status, slave->node.name,
		      oldState);
	}

	return status;
}
/**
 * PmSlaveChangeState() - Change state of a slave
 * @slave       Slave pointer whose state should be changed
 * @state       New state
 *
 * @return      XST_SUCCESS if transition was performed successfully.
 *              Error otherwise.
 */
Change state of a slave
@slave       Slave pointer whose state should be changed
@state       New state

@return      XST_SUCCESS if transition was performed successfully.
Error otherwise.
Change state of a slave @slave Slave pointer whose state should be changed @state New state @return XST_SUCCESS if transition was performed successfully . Error otherwise .
static s32 PmSlaveChangeState(PmSlave* const slave, const PmStateId state)
{
	u32 t;
	s32 status;
	const PmSlaveFsm* fsm = slave->slvFsm;
	PmStateId oldState = slave->node.currState;
	status = PmSlavePrepareState(slave, state);
	if (XST_SUCCESS != status) {
		goto done;
	}
	if (0U == fsm->transCnt) {
		status = XST_SUCCESS;
	} else {
		status = XST_FAILURE;
	}
	for (t = 0U; t < fsm->transCnt; t++) {
		if ((fsm->trans[t].fromState != slave->node.currState) ||
			(fsm->trans[t].toState != state)) {
			continue;
		}
		if (NULL != slave->slvFsm->enterState) {
			status = slave->slvFsm->enterState(slave, state);
		} else {
			status = XST_SUCCESS;
		}
		break;
	}
done:
	if ((oldState != state) && (XST_SUCCESS == status)) {
		PmNodeUpdateCurrState(&slave->node, state);
		PmSlaveClearAfterState(slave, oldState);
	}
	if (XST_SUCCESS == status) {
		PmInfo("%s %d->%d\r\n", slave->node.name, oldState,
		       slave->node.currState);
	} else {
		PmErr("#%d %s state#%u\r\n", status, slave->node.name,
		      oldState);
	}
	return status;
}
static s32 PmSlaveChangeState ( PmSlave * const slave , const PmStateId state ) { u32 t ; s32 status ; const PmSlaveFsm * fsm = slave -> slvFsm ; PmStateId oldState = slave -> node . currState ; status = PmSlavePrepareState ( slave , state ) ; if ( XST_SUCCESS != status ) { goto done ; } if ( 0U == fsm -> transCnt ) { status = XST_SUCCESS ; } else { status = XST_FAILURE ; } for ( t = 0U ; t < fsm -> transCnt ; t ++ ) { if ( ( fsm -> trans [ t ] . fromState != slave -> node . currState ) || ( fsm -> trans [ t ] . toState != state ) ) { continue ; } if ( NULL != slave -> slvFsm -> enterState ) { status = slave -> slvFsm -> enterState ( slave , state ) ; } else { status = XST_SUCCESS ; } break ; } done : if ( ( oldState != state ) && ( XST_SUCCESS == status ) ) { PmNodeUpdateCurrState ( & slave -> node , state ) ; PmSlaveClearAfterState ( slave , oldState ) ; } if ( XST_SUCCESS == status ) { PmInfo ( " \r \n " , slave -> node . name , oldState , slave -> node . currState ) ; } else { PmErr ( " \r \n " , status , slave -> node . name , oldState ) ; } return status ; }
PmSlaveChangeState() - Change state of a slave
 @slave       Slave pointer whose state should be changed
 @state       New state
PmSlaveChangeState () - Change state of a slave @slave Slave pointer whose state should be changed @state New state
/* Check what needs to be done prior to performing the transition */ /* Slave's FSM has no transitions when it has only one state */ /*
		 * Slave has transitions to change the state. Assume the failure
		 * and change status if state is changed correctly.
		 */ /* Find transition from current state to state to be set */ /* Execute transition action of slave's FSM */