mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-20 22:21:41 +00:00
dtoc: Move the output code into its own function
The code to generate the tables is quite long. Move the node-output code into its own function. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
parent
ff71f9ac33
commit
49eec8c7f1
1 changed files with 52 additions and 44 deletions
|
@ -301,19 +301,12 @@ class DtbPlatdata:
|
||||||
self.Out(';\n')
|
self.Out(';\n')
|
||||||
self.Out('};\n')
|
self.Out('};\n')
|
||||||
|
|
||||||
def GenerateTables(self):
|
def OutputNode(self, node):
|
||||||
"""Generate device defintions for the platform data
|
"""Output the C code for a node
|
||||||
|
|
||||||
This writes out C platform data initialisation data and
|
Args:
|
||||||
U_BOOT_DEVICE() declarations for each valid node. See the
|
node: node to output
|
||||||
documentation in README.of-plat for more information.
|
|
||||||
"""
|
"""
|
||||||
self.Out('#include <common.h>\n')
|
|
||||||
self.Out('#include <dm.h>\n')
|
|
||||||
self.Out('#include <dt-structs.h>\n')
|
|
||||||
self.Out('\n')
|
|
||||||
node_txt_list = []
|
|
||||||
for node in self._valid_nodes:
|
|
||||||
struct_name = self.GetCompatName(node)
|
struct_name = self.GetCompatName(node)
|
||||||
var_name = Conv_name_to_c(node.name)
|
var_name = Conv_name_to_c(node.name)
|
||||||
self.Buf('static struct %s%s %s%s = {\n' %
|
self.Buf('static struct %s%s %s%s = {\n' %
|
||||||
|
@ -359,6 +352,21 @@ class DtbPlatdata:
|
||||||
self.Buf('};\n')
|
self.Buf('};\n')
|
||||||
self.Buf('\n')
|
self.Buf('\n')
|
||||||
|
|
||||||
|
def GenerateTables(self):
|
||||||
|
"""Generate device defintions for the platform data
|
||||||
|
|
||||||
|
This writes out C platform data initialisation data and
|
||||||
|
U_BOOT_DEVICE() declarations for each valid node. See the
|
||||||
|
documentation in README.of-plat for more information.
|
||||||
|
"""
|
||||||
|
self.Out('#include <common.h>\n')
|
||||||
|
self.Out('#include <dm.h>\n')
|
||||||
|
self.Out('#include <dt-structs.h>\n')
|
||||||
|
self.Out('\n')
|
||||||
|
node_txt_list = []
|
||||||
|
for node in self._valid_nodes:
|
||||||
|
self.OutputNode(node)
|
||||||
|
|
||||||
# Output phandle target nodes first, since they may be referenced
|
# Output phandle target nodes first, since they may be referenced
|
||||||
# by others
|
# by others
|
||||||
if 'phandle' in node.props:
|
if 'phandle' in node.props:
|
||||||
|
|
Loading…
Add table
Reference in a new issue