MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / _node_ph_array_prop

Function _node_ph_array_prop

scripts/kconfig/kconfigfunctions.py:249–275  ·  view source on GitHub ↗

This function takes a 'node', a property name ('prop'), index ('index') and a cell ('cell') and it will look to see if that node has a property called 'prop' and if that 'prop' is an phandle-array type. Then it will check if that phandle array has a cell matching the given index

(node, prop, index, cell, unit=None)

Source from the content-addressed store, hash-verified

247 return node.props[prop].val[int(index)] >> _dt_units_to_scale(unit)
248
249def _node_ph_array_prop(node, prop, index, cell, unit=None):
250 """
251 This function takes a 'node', a property name ('prop'), index ('index') and
252 a cell ('cell') and it will look to see if that node has a property
253 called 'prop' and if that 'prop' is an phandle-array type.
254 Then it will check if that phandle array has a cell matching the given index
255 and then return the value of the cell named 'cell' in this array index.
256 If not found it will return 0.
257
258 The function will divide the value based on 'unit':
259 None No division
260 'k' or 'K' divide by 1024 (1 << 10)
261 'm' or 'M' divide by 1,048,576 (1 << 20)
262 'g' or 'G' divide by 1,073,741,824 (1 << 30)
263 """
264 if not node:
265 return 0
266
267 if prop not in node.props:
268 return 0
269 if node.props[prop].type != "phandle-array":
270 return 0
271 if int(index) >= len(node.props[prop].val):
272 return 0
273 if cell not in node.props[prop].val[int(index)].data.keys():
274 return 0
275 return node.props[prop].val[int(index)].data[cell] >> _dt_units_to_scale(unit)
276
277def _dt_chosen_reg_addr(kconf, chosen, index=0, unit=None):
278 """

Callers 1

dt_node_ph_array_propFunction · 0.85

Calls 1

_dt_units_to_scaleFunction · 0.85

Tested by

no test coverage detected