summaryrefslogtreecommitdiff
path: root/tegra_pmx_utils.py
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2015-02-11 12:25:38 -0700
committerStephen Warren <swarren@nvidia.com>2015-02-25 15:58:04 -0700
commitca5bbef466b5c7ba899fbf69078049d6abbcce96 (patch)
tree5d4e78dcf01528132bfe73514ba7dec63bd62629 /tegra_pmx_utils.py
parent32ceb32d4f3babf4ad97dbd4d7002ee7a59f32ba (diff)
downloadtegra-pinmux-scripts-ca5bbef466b5c7ba899fbf69078049d6abbcce96.tar.gz
Support Tegra210
Tegra210 changes the pinmux HW in a few ways; at least: - The set of drive groups is much more 1:1 with the set of pins. Most pins have an associated drive group register as well as an associated pinmux register, and most drive groups cover a single pin. - Some register fields have moved from the drive group registers into the pinmux registers. - The set of available options for each pin and group varies relative to previous chips, and hence the register layouts vary a bit too. This patch updates tegra-pinmux-scripts minimally to handle these changes, to a level equivalent to the support for previous chips. For example, some new options such as per-pin schmitt aren't handled since the syseng-supplied pinmux spreadsheets don't provide a value for this option. csv-to-board-tegra124-xlsx.py is renamed to csv-to-board.py since it now supports boards using different SoCs, and it's not worth encoding all supported SoCs in the filename (Tegra30/114 aren't supported by it, hence the previous naming). Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'tegra_pmx_utils.py')
-rw-r--r--tegra_pmx_utils.py52
1 files changed, 50 insertions, 2 deletions
diff --git a/tegra_pmx_utils.py b/tegra_pmx_utils.py
index 0635ab8..ece3c16 100644
--- a/tegra_pmx_utils.py
+++ b/tegra_pmx_utils.py
@@ -20,14 +20,17 @@
import sys
-def emit_tab_padding_to(curpos, targetpos):
+def gen_tab_padding_to(curpos, targetpos):
curpos -= 1
targetpos -= 1
if (targetpos & 7):
raise Exception(str(targetpos) + ' is not a TAB stop')
left = targetpos - curpos
tabs = (left + 7) // 8
- print('\t' * tabs, end='')
+ return '\t' * tabs
+
+def emit_tab_padding_to(curpos, targetpos):
+ print(gen_tab_padding_to(curpos, targetpos), end='')
def emit_padded_field(s, maxl, skip_comma=False, right_justify=False, file=sys.stdout):
pad = (' ' * (maxl - len(s)))
@@ -46,12 +49,57 @@ def emit_define(define, value, valuecol):
emit_tab_padding_to(len(s) + 1, valuecol)
print(value)
+def gen_wrapped_c_macro_header(macro, params):
+ intro = '#define %s(' % macro
+ intro_space = ' ' * len(intro)
+ s = ''
+ l = intro
+ for i, param in enumerate(params):
+ if i != 0:
+ prefix = ' '
+ else:
+ prefix = ''
+ if i == len(params) - 1:
+ suffix = ')'
+ else:
+ suffix = ','
+ # ', ' ','
+ if (len(l) + len(prefix) + len(param) + len(suffix)) < 71:
+ l += prefix + param + suffix
+ else:
+ s += l + '\n'
+ l = intro_space + param + suffix
+ if l:
+ s += l
+ s += '\n'
+ return s
+
+def append_aligned_tabs_indent_with_tabs(s):
+ lines = s.split('\n')
+ if lines[-1].strip() == '':
+ del lines[-1]
+ for i, l in enumerate(lines):
+ lines[i] = l.replace('\t', ' ')
+ max_len = 0
+ for l in lines:
+ max_len = max(max_len, len(l))
+ tabpos = (max_len + 7) // 8
+ for i, l in enumerate(lines):
+ remaining = 72 - len(l)
+ lines[i] += gen_tab_padding_to(len(l) + 1, 73) + '\\'
+ for i, l in enumerate(lines):
+ lines[i] = l.replace(' ', '\t')
+ return '\n'.join(lines)
+
def yn_to_boolean(s):
return {'N': False, 'Y': True}[s]
def boolean_to_yn(val):
return {True: 'Y', False: 'N'}[val]
+def boolean_to_c_bool(val):
+ return {True: 'true', False: 'false'}[val]
+
def dump_table(heading_prefix, heading_suffix, headings, row_prefix, row_suffix, rows, col_widths, file, right_justifies):
num_cols = 0
if headings: