@ -43,6 +43,14 @@ class Prop(PropBase):
return
return
self . type , self . value = self . BytesToValue ( bytes )
self . type , self . value = self . BytesToValue ( bytes )
def GetOffset ( self ) :
""" Get the offset of a property
Returns :
The offset of the property ( struct fdt_property ) within the file
"""
return self . _node . _fdt . GetStructOffset ( self . _offset )
class Node ( NodeBase ) :
class Node ( NodeBase ) :
""" A device tree node
""" A device tree node
@ -193,6 +201,16 @@ class FdtNormal(Fdt):
""" Refresh the offset cache """
""" Refresh the offset cache """
self . _root . Refresh ( 0 )
self . _root . Refresh ( 0 )
def GetStructOffset ( self , offset ) :
""" Get the file offset of a given struct offset
Args :
offset : Offset within the ' struct ' region of the device tree
Returns :
Position of @offset within the device tree binary
"""
return libfdt . fdt_off_dt_struct ( self . _fdt ) + offset
@classmethod
@classmethod
def Node ( self , fdt , offset , name , path ) :
def Node ( self , fdt , offset , name , path ) :
""" Create a new node
""" Create a new node