mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
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>
This commit is contained in:
parent
724340cf36
commit
73ca22c9e8
@ -17,10 +17,24 @@ import subprocess
|
|||||||
import chipset
|
import chipset
|
||||||
import reg_access as reg
|
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):
|
def parse_file(file):
|
||||||
print('{0:^10s} | {1:^28s} | {2:^10s}'. format('offset', file.name, 'value'))
|
print('{0:^10s} | {1:^28s} | {2:^10s}'. format('offset', file.name, 'value'))
|
||||||
print('-' * 54)
|
print('-' * 54)
|
||||||
for line in file:
|
for line in file:
|
||||||
|
if ignore_line(line):
|
||||||
|
continue
|
||||||
register = ast.literal_eval(line)
|
register = ast.literal_eval(line)
|
||||||
if register[2] == 'DPIO':
|
if register[2] == 'DPIO':
|
||||||
val = reg.dpio_read(register[1], 0)
|
val = reg.dpio_read(register[1], 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user