diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-01-17 20:10:46 -0800 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-01-20 10:27:39 -0800 |
commit | 73ca22c9e880b0598935c871d809ecfb1f3473fc (patch) | |
tree | c89154ae6c156f2096b11a335f185df7f51dcc79 | |
parent | 724340cf36b4e2a87d8c545410224b617f813cc8 (diff) |
quick_dump: Allow comments in the register files
Simple addition to the parser to add the following full line comments:
{';', '#', "//"}
Empty lines will also be ignored
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rwxr-xr-x | tools/quick_dump/quick_dump.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/quick_dump/quick_dump.py b/tools/quick_dump/quick_dump.py index 4059bca7..0352a557 100755 --- a/tools/quick_dump/quick_dump.py +++ b/tools/quick_dump/quick_dump.py @@ -17,10 +17,24 @@ import subprocess import chipset import reg_access as reg +# Ignore lines which are considered comments +def ignore_line(line): + if not line.strip(): + return True + if len(line) > 1: + if line[1] == '/' and line[0] == '/': + return True + if len(line) > 0: + if line[0] == '#' or line[0] == ';': + return True + return False + def parse_file(file): print('{0:^10s} | {1:^28s} | {2:^10s}'. format('offset', file.name, 'value')) print('-' * 54) for line in file: + if ignore_line(line): + continue register = ast.literal_eval(line) if register[2] == 'DPIO': val = reg.dpio_read(register[1], 0) |