From 2577ab08c5a84229580c83a0cd00a03328eba89b Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 6 Mar 2014 13:06:31 -0700 Subject: Initial set of scripts A set of scripts to generate Linux kernel and U-Boot pinmux drivers and board pinmux configuration tables. Also included are scripts to convert existing Linux kernel pinmux drivers and NV-internal spreadsheets to the internal data representation. SoC configuration files are included for Tegra30, Tegra114, and Tegra124. Board configuration files are included for Jetson TK1 and Venice2. configs/tegra30.soc configs/tegra114.soc configs/tegra124.soc SoC pin definitions configs/jetson-tk1.board configs/venice2.board Board configurations soc-to-kernel-pinctrl-driver.py soc-to-uboot-driver.py Generate Linux kernel and U-Boot pinmux drivers board-to-kernel-dt.py board-to-uboot.py Generate board configuration tables for the Linux kernel (DT) and U-Boot. kernel-pinctrl-driver-to-soc.py Convert an existing Linux kernel pinmux driver to the internal representation of an SoC used by this project. csv-to-board-tegra124-xlsx.py Convert an NV-internal board configuration spreadsheet to the internal representation of a board configuration used by this project. tegra_pmx_board_parser.py tegra_pmx_parser_utils.py tegra_pmx_soc_parser.py tegra_pmx_utils.py Internal Python modules used to parse the internal data representations, and various other utilities. Signed-off-by: Stephen Warren --- tegra_pmx_parser_utils.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tegra_pmx_parser_utils.py (limited to 'tegra_pmx_parser_utils.py') diff --git a/tegra_pmx_parser_utils.py b/tegra_pmx_parser_utils.py new file mode 100644 index 0000000..cb06061 --- /dev/null +++ b/tegra_pmx_parser_utils.py @@ -0,0 +1,38 @@ +# Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +class ReprDictObj(object): + def __repr__(self): + return self.__class__.__name__ + '(' + repr(self.__dict__) + ')' + + def __str__(self): + return self.__class__.__name__ + '(' + str(self.__dict__) + ')' + +class TopLevelParsedObj(ReprDictObj): + def __init__(self, name, copy_attrs, data): + self.name = name + self.titlename = name.title() + + for attr, default in copy_attrs: + if attr in data: + val = data[attr] + else: + val = default + self.__setattr__(attr, val) -- cgit v1.2.1