lib/sw_apps/zynqmp_pmufw/src/pm_ddr.c
static s32 PmDdrFsmHandler(PmSlave* const slave, const PmStateId nextState)
{
	s32 status = XST_SUCCESS;

	/* Handle transition to OFF state here */
	if ((PM_DDR_STATE_OFF != slave->node.currState) &&
	    (PM_DDR_STATE_OFF == nextState)) {
		/* Here, user can put the DDR controller in reset */
		XPfw_AibEnable(XPFW_AIB_LPD_TO_DDR);
		goto done;
	}

	switch (slave->node.currState) {
	case PM_DDR_STATE_ON:
		if (PM_DDR_STATE_SR == nextState) {
			XPfw_AibEnable(XPFW_AIB_LPD_TO_DDR);
			status = pm_ddr_sr_enter();
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	case PM_DDR_STATE_SR:
		if (PM_DDR_STATE_ON == nextState) {
			bool ddrss_is_reset = ((0U == Xil_In32(DDRC_STAT)) ? true : false);
			pm_ddr_sr_exit(ddrss_is_reset);
			XPfw_AibDisable(XPFW_AIB_LPD_TO_DDR);
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	case PM_DDR_STATE_OFF:
		if (PM_DDR_STATE_ON == nextState) {
			/*
			 * Bring DDR controller out of reset if it was in reset
			 * during DDR OFF state
			 * */
			XPfw_AibDisable(XPFW_AIB_LPD_TO_DDR);
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	default:
		status = XST_PM_INTERNAL;
		PmNodeLogUnknownState(&slave->node, slave->node.currState);
		break;
	}

done:
	return status;
}
/**
 * PmDdrFsmHandler() - DDR FSM handler, performs transition actions
 * @slave       Slave whose state should be changed (pointer to DDR object)
 * @nextState   State the slave should enter
 *
 * @return      Status of performing transition action
 */
DDR FSM handler, performs transition actions
@slave       Slave whose state should be changed (pointer to DDR object)
@nextState   State the slave should enter

@return      Status of performing transition action
DDR FSM handler performs transition actions @slave Slave whose state should be changed ( pointer to DDR object ) @nextState State the slave should enter @return Status of performing transition action
static s32 PmDdrFsmHandler(PmSlave* const slave, const PmStateId nextState)
{
	s32 status = XST_SUCCESS;
	if ((PM_DDR_STATE_OFF != slave->node.currState) &&
	    (PM_DDR_STATE_OFF == nextState)) {
		XPfw_AibEnable(XPFW_AIB_LPD_TO_DDR);
		goto done;
	}
	switch (slave->node.currState) {
	case PM_DDR_STATE_ON:
		if (PM_DDR_STATE_SR == nextState) {
			XPfw_AibEnable(XPFW_AIB_LPD_TO_DDR);
			status = pm_ddr_sr_enter();
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	case PM_DDR_STATE_SR:
		if (PM_DDR_STATE_ON == nextState) {
			bool ddrss_is_reset = ((0U == Xil_In32(DDRC_STAT)) ? true : false);
			pm_ddr_sr_exit(ddrss_is_reset);
			XPfw_AibDisable(XPFW_AIB_LPD_TO_DDR);
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	case PM_DDR_STATE_OFF:
		if (PM_DDR_STATE_ON == nextState) {
			XPfw_AibDisable(XPFW_AIB_LPD_TO_DDR);
		} else {
			status = XST_NO_FEATURE;
		}
		break;
	default:
		status = XST_PM_INTERNAL;
		PmNodeLogUnknownState(&slave->node, slave->node.currState);
		break;
	}
done:
	return status;
}
static s32 PmDdrFsmHandler ( PmSlave * const slave , const PmStateId nextState ) { s32 status = XST_SUCCESS ; if ( ( PM_DDR_STATE_OFF != slave -> node . currState ) && ( PM_DDR_STATE_OFF == nextState ) ) { XPfw_AibEnable ( XPFW_AIB_LPD_TO_DDR ) ; goto done ; } switch ( slave -> node . currState ) { case PM_DDR_STATE_ON : if ( PM_DDR_STATE_SR == nextState ) { XPfw_AibEnable ( XPFW_AIB_LPD_TO_DDR ) ; status = pm_ddr_sr_enter ( ) ; } else { status = XST_NO_FEATURE ; } break ; case PM_DDR_STATE_SR : if ( PM_DDR_STATE_ON == nextState ) { bool ddrss_is_reset = ( ( 0U == Xil_In32 ( DDRC_STAT ) ) ? true : false ) ; pm_ddr_sr_exit ( ddrss_is_reset ) ; XPfw_AibDisable ( XPFW_AIB_LPD_TO_DDR ) ; } else { status = XST_NO_FEATURE ; } break ; case PM_DDR_STATE_OFF : if ( PM_DDR_STATE_ON == nextState ) { XPfw_AibDisable ( XPFW_AIB_LPD_TO_DDR ) ; } else { status = XST_NO_FEATURE ; } break ; default : status = XST_PM_INTERNAL ; PmNodeLogUnknownState ( & slave -> node , slave -> node . currState ) ; break ; } done : return status ; }
PmDdrFsmHandler() - DDR FSM handler, performs transition actions
 @slave       Slave whose state should be changed (pointer to DDR object)
 @nextState   State the slave should enter
PmDdrFsmHandler () - DDR FSM handler performs transition actions @slave Slave whose state should be changed ( pointer to DDR object ) @nextState State the slave should enter
/* Handle transition to OFF state here */ /* Here, user can put the DDR controller in reset */ /*
			 * Bring DDR controller out of reset if it was in reset
			 * during DDR OFF state
			 * */