Skip to content
Snippets Groups Projects
Commit 802e67dd authored by Gopi Krishna Nedanuri's avatar Gopi Krishna Nedanuri
Browse files

dcc_parser: Add support to parse ATB data

Change-Id: I213cc3f8b8403704e9bcf24b1cfedc0014666c25
parent a66f79f9
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ import logging.handlers ...@@ -15,6 +15,7 @@ import logging.handlers
import os import os
import struct import struct
import sys import sys
import re
from optparse import OptionParser from optparse import OptionParser
...@@ -72,12 +73,12 @@ def read_data(data_pt): ...@@ -72,12 +73,12 @@ def read_data(data_pt):
return nr return nr
list_nr = []
def read_config(config_pt): def read_config(config_pt):
list_nr = []
list_nr.append(0)
offset = 0 offset = 0
base = 0 base = 0
list_nr.append(0)
if options.version is None: if options.version is None:
address_descriptor = 0x1 << 31 address_descriptor = 0x1 << 31
link_descriptor = 0 link_descriptor = 0
...@@ -102,9 +103,6 @@ def read_config(config_pt): ...@@ -102,9 +103,6 @@ def read_config(config_pt):
#empty SRAM is filled with 0xdededede #empty SRAM is filled with 0xdededede
empty_ind = 0xdededede empty_ind = 0xdededede
if options.config_offset is not None:
config_pt.seek(int(options.config_offset, 16), 1)
if options.config_loopoffset is not None: if options.config_loopoffset is not None:
config_loopoffset = int(options.config_loopoffset) config_loopoffset = int(options.config_loopoffset)
else: else:
...@@ -139,7 +137,6 @@ def read_config(config_pt): ...@@ -139,7 +137,6 @@ def read_config(config_pt):
length = (val & 0x7f) length = (val & 0x7f)
val = val >> link_second_arg val = val >> link_second_arg
if length != 0: if length != 0:
list_nr.append(length + list_nr[- 1]) list_nr.append(length + list_nr[- 1])
add_addr(base, offset, length) add_addr(base, offset, length)
...@@ -227,6 +224,23 @@ def dump_regs(options): ...@@ -227,6 +224,23 @@ def dump_regs(options):
dump_regs_xml(options) dump_regs_xml(options)
def read_data_atb(atb_data_pt):
for line in atb_data_pt:
if "ATID\" : 65, \"OpCode\" : \"D8\"" in line:
data1 = ""
for i in range(4):
data_byte_re = re.match(
"\{\"ATID\" : 65, \"OpCode\" : \"D8\", \"Payload\" : "
"\"0x([0-9A-Fa-f][0-9A-Fa-f])\"\}", line)
if data_byte_re:
data1 = (data_byte_re.group(1))+data1
else:
log.error("ATB file format wrong")
exit(1)
if i < 3:
line = atb_data_pt.next()
data.append(int(data1, 16))
if __name__ == '__main__': if __name__ == '__main__':
usage = 'usage: %prog [options to print]. Run with --help for more details' usage = 'usage: %prog [options to print]. Run with --help for more details'
parser = OptionParser(usage) parser = OptionParser(usage)
...@@ -299,20 +313,25 @@ if __name__ == '__main__': ...@@ -299,20 +313,25 @@ if __name__ == '__main__':
sys.exit(1) sys.exit(1)
count = 0 count = 0
while True:
count = read_config(sram_file)
if options.atbfile is None: if options.config_offset is not None:
atb_file = sram_file sram_file.seek(int(options.config_offset, 16), 1)
if read_data(sram_file): count = read_config(sram_file)
log.error('Couldn\'t read complete data.')
break
if new_linked_list(sram_file) is False: if options.atbfile is None:
parsed_data = log_init('PARSED_DATA', options.outdir, options.outfile) atb_file = sram_file
dump_regs(options)
break if read_data(sram_file):
log.error('Couldn\'t read complete data.')
sys.exit(1)
if new_linked_list(sram_file):
read_config(sram_file)
read_data_atb(atb_file)
parsed_data = log_init('PARSED_DATA', options.outdir, options.outfile)
dump_regs(options)
sram_file.close() sram_file.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment