lib/sw_apps/zynqmp_pmufw/src/pm_power.c
static s32 PmPowerGetPowerData(const PmNode* const powerNode, u32* const data)
{
	PmNode* node;
	u32 val = 0U;
	s32 status = XST_NO_FEATURE;

	*data = 0U;
	if (PM_PWR_STATE_OFF == powerNode->currState) {
		status = XST_SUCCESS;
		goto done;
	}

	PmPowerDfsBegin((PmPower*)powerNode->derived);
	node = PmPowerDfsGetNext();
	while (NULL != node) {
		if (NODE_IS_POWER(node)) {
			status = PmNodeGetPowerInfo(node, &val);
		} else {
			if (NULL != node->class->getPowerData) {
				status = node->class->getPowerData(node, &val);
			} else {
				status = XST_NO_FEATURE;
			}
		}
		if (XST_SUCCESS != status) {
			goto done;
		}
		*data += val;
		node = PmPowerDfsGetNext();
	}

done:
	return status;
}
/**
 * PmPowerGetPowerData() - Get power consumption of the node
 * @powerNode	Power node whose power consumption should be get
 * @data	Pointer to the location where the power data should be stored
 *
 * @return	XST_SUCCESS if power consumption data is stored in *data
 *		XST_NO_FEATURE otherwise
 * @note	Power consumption of power node is a sum of consumptions of the
 *		children.
 */
Get power consumption of the node
@powerNode   Power node whose power consumption should be get
@data        Pointer to the location where the power data should be stored

@return      XST_SUCCESS if power consumption data is stored in *data
XST_NO_FEATURE otherwise
@note        Power consumption of power node is a sum of consumptions of the
children.
Get power consumption of the node @powerNode Power node whose power consumption should be get @data Pointer to the location where the power data should be stored @return XST_SUCCESS if power consumption data is stored in * data XST_NO_FEATURE otherwise @note Power consumption of power node is a sum of consumptions of the children .
static s32 PmPowerGetPowerData(const PmNode* const powerNode, u32* const data)
{
	PmNode* node;
	u32 val = 0U;
	s32 status = XST_NO_FEATURE;
	*data = 0U;
	if (PM_PWR_STATE_OFF == powerNode->currState) {
		status = XST_SUCCESS;
		goto done;
	}
	PmPowerDfsBegin((PmPower*)powerNode->derived);
	node = PmPowerDfsGetNext();
	while (NULL != node) {
		if (NODE_IS_POWER(node)) {
			status = PmNodeGetPowerInfo(node, &val);
		} else {
			if (NULL != node->class->getPowerData) {
				status = node->class->getPowerData(node, &val);
			} else {
				status = XST_NO_FEATURE;
			}
		}
		if (XST_SUCCESS != status) {
			goto done;
		}
		*data += val;
		node = PmPowerDfsGetNext();
	}
done:
	return status;
}
static s32 PmPowerGetPowerData ( const PmNode * const powerNode , u32 * const data ) { PmNode * node ; u32 val = 0U ; s32 status = XST_NO_FEATURE ; * data = 0U ; if ( PM_PWR_STATE_OFF == powerNode -> currState ) { status = XST_SUCCESS ; goto done ; } PmPowerDfsBegin ( ( PmPower * ) powerNode -> derived ) ; node = PmPowerDfsGetNext ( ) ; while ( NULL != node ) { if ( NODE_IS_POWER ( node ) ) { status = PmNodeGetPowerInfo ( node , & val ) ; } else { if ( NULL != node -> class -> getPowerData ) { status = node -> class -> getPowerData ( node , & val ) ; } else { status = XST_NO_FEATURE ; } } if ( XST_SUCCESS != status ) { goto done ; } * data += val ; node = PmPowerDfsGetNext ( ) ; } done : return status ; }
PmPowerGetPowerData() - Get power consumption of the node
 @powerNode   Power node whose power consumption should be get
 @data        Pointer to the location where the power data should be stored
PmPowerGetPowerData () - Get power consumption of the node @powerNode Power node whose power consumption should be get @data Pointer to the location where the power data should be stored