lib/sw_apps/zynqmp_pmufw/src/pm_requirement.c
s32 PmRequirementUpdateScheduled(const PmMaster* const master, const bool swap)
{
	s32 status = XST_SUCCESS;
	PmRequirement* req = master->reqs;

	while (NULL != req) {
		if (req->currReq != req->nextReq) {
			u32 tmpReq = req->nextReq;

			if (true == swap) {
				if (0U != req->defaultReq) {
					/* Master has default requirements for
					 * this slave, default has priority over
					 * current requirements.
					 */
					req->nextReq = req->defaultReq;
				} else {
					/* Save current requirements as next */
					req->nextReq = req->currReq;
				}
			}

			req->currReq = (u8)tmpReq;

			/* Update slave setting */
			status = PmUpdateSlave(req->slave);
			/* if rom works correctly, status should be always ok */
			if (XST_SUCCESS != status) {
				PmErr("updating %s\r\n", req->slave->node.name);
				break;
			}
		}
		req = req->nextSlave;
	}

	return status;
}
/**
 * PmRequirementUpdateScheduled() - Triggers the setting for scheduled
 *                                  requirements
 * @master  Master which changed the state and whose scheduled requirements are
 *          triggered
 * @swap    Flag stating should current/default requirements be saved as next
 *
 * a) swap=false
 * Set scheduled requirements of a master without swapping current/default and
 * next requirements - means the current requirements will be dropped and
 * default requirements has no effect. Upon every self suspend, master has to
 * explicitly re-request slave requirements.
 * b) swap=true
 * Set scheduled requirements of a master with swapping current/default and
 * next requirements (swapping means the current/default requirements will be
 * saved as next, and will be configured once master wakes-up). If the master
 * has default requirements, default requirements are saved as next instead of
 * current requirements. Default requirements has priority over current
 * requirements.
 */
Triggers the setting for scheduled
requirements
@master  Master which changed the state and whose scheduled requirements are
triggered
@swap    Flag stating should current/default requirements be saved as next

a) swap=false
Set scheduled requirements of a master without swapping current/default and
next requirements - means the current requirements will be dropped and
default requirements has no effect. Upon every self suspend, master has to
explicitly re-request slave requirements.
b) swap=true
Set scheduled requirements of a master with swapping current/default and
next requirements (swapping means the current/default requirements will be
saved as next, and will be configured once master wakes-up). If the master
has default requirements, default requirements are saved as next instead of
current requirements. Default requirements has priority over current
requirements.
Triggers the setting for scheduled requirements @master Master which changed the state and whose scheduled requirements are triggered @swap Flag stating should current / default requirements be saved as next a ) swap = false Set scheduled requirements of a master without swapping current / default and next requirements - means the current requirements will be dropped and default requirements has no effect . Upon every self suspend master has to explicitly re - request slave requirements . b ) swap = true Set scheduled requirements of a master with swapping current / default and next requirements ( swapping means the current / default requirements will be saved as next and will be configured once master wakes - up ) . If the master has default requirements default requirements are saved as next instead of current requirements . Default requirements has priority over current requirements .
s32 PmRequirementUpdateScheduled(const PmMaster* const master, const bool swap)
{
	s32 status = XST_SUCCESS;
	PmRequirement* req = master->reqs;
	while (NULL != req) {
		if (req->currReq != req->nextReq) {
			u32 tmpReq = req->nextReq;
			if (true == swap) {
				if (0U != req->defaultReq) {
					req->nextReq = req->defaultReq;
				} else {
					req->nextReq = req->currReq;
				}
			}
			req->currReq = (u8)tmpReq;
			status = PmUpdateSlave(req->slave);
			if (XST_SUCCESS != status) {
				PmErr("updating %s\r\n", req->slave->node.name);
				break;
			}
		}
		req = req->nextSlave;
	}
	return status;
}
s32 PmRequirementUpdateScheduled ( const PmMaster * const master , const bool swap ) { s32 status = XST_SUCCESS ; PmRequirement * req = master -> reqs ; while ( NULL != req ) { if ( req -> currReq != req -> nextReq ) { u32 tmpReq = req -> nextReq ; if ( true == swap ) { if ( 0U != req -> defaultReq ) { req -> nextReq = req -> defaultReq ; } else { req -> nextReq = req -> currReq ; } } req -> currReq = ( u8 ) tmpReq ; status = PmUpdateSlave ( req -> slave ) ; if ( XST_SUCCESS != status ) { PmErr ( " \r \n " , req -> slave -> node . name ) ; break ; } } req = req -> nextSlave ; } return status ; }
PmRequirementUpdateScheduled() - Triggers the setting for scheduled
                                  requirements
 @master  Master which changed the state and whose scheduled requirements are
          triggered
 @swap    Flag stating should current/default requirements be saved as next
PmRequirementUpdateScheduled () - Triggers the setting for scheduled requirements @master Master which changed the state and whose scheduled requirements are triggered @swap Flag stating should current / default requirements be saved as next
/* Master has default requirements for
					 * this slave, default has priority over
					 * current requirements.
					 */ /* Save current requirements as next */ /* Update slave setting */ /* if rom works correctly, status should be always ok */