X-Git-Url: https://git.ti.com/gitweb?p=glsdk%2Fhost-tools.git;a=blobdiff_plain;f=respart%2FRM-autogen-data.py;h=2654a1f091f055bdebbd15922592666d9886ced0;hp=75ae7fc88b3b05607bb51e6892d69e78fb385d22;hb=659637b47d155713da5244f2bc52cc073e5a0359;hpb=88105055aee9baf423a103b5cd3359bf04dc9a14 diff --git a/respart/RM-autogen-data.py b/respart/RM-autogen-data.py index 75ae7fc..2654a1f 100755 --- a/respart/RM-autogen-data.py +++ b/respart/RM-autogen-data.py @@ -7,13 +7,12 @@ from xlwt.Utils import rowcol_to_cell COL_COMMENT = 0 COL_RES_TYPE = 1 COL_SUB_TYPE = 2 -COL_RES_FIELD = 3 -COL_RES_COUNT = 5 -COL_RES_START = 6 -COL_HOST_START = 7 +COL_RES_COUNT = 3 +COL_RES_START = 4 +COL_HOST_START = 5 ROW_HOST_ID = 0 -ROW_RES_START = 2 +ROW_RES_START = 1 dict_dev = {} dict_subtype = {} @@ -52,6 +51,13 @@ const_values = { return output % (header, devs, subtypes, hosts) +def gen_rm_resasg_csv(): + output = "" + for entry in utypes: + (dev, subtype, count, start) = entry + output += "%s,%s,%d,%d\n" % (dev, subtype, start, count) + return output + def gen_rm_resasg_sheet(sheet): fmt_header = xlwt.easyxf('font: color-index blue, bold on') @@ -107,7 +113,7 @@ args = parser.parse_args() print(args) # Parse docuemntation and extract host_id defines -output = evalcmd('cat %s/output/%s/sec_proxy/hosts.h | grep "#define HOST_ID" | awk -F"[ ()]*" \'{print $2" " $3}\'' % (args.prefix, args.soc)) +output = evalcmd('cat %s/include/soc/%s/hosts.h | grep "#define HOST_ID" | awk -F"[ ()]*" \'{print $2" " $3}\'' % (args.prefix, args.soc)) for line in output.split('\n'): if (line == ''): continue @@ -116,7 +122,7 @@ for line in output.split('\n'): dict_host[host] = host_id # Parse docuemntation and extract dev_id and subtype defines -output = evalcmd('cat %s/output/%s/rm/resasg_types.rst | grep -v "\------" | grep -A100000 "+======" | tail -n +2' % (args.prefix, args.soc)) +output = evalcmd('cat %s/docs/public/5_soc_doc/%s/resasg_types.rst | grep -v "\------" | grep -A100000 "+======" | tail -n +2' % (args.prefix, args.soc)) dev = dev_id = None for line in output.split('\n'): array = line.replace(' ', '').split('|') @@ -129,11 +135,12 @@ for line in output.split('\n'): (x, x, x, subtype, subtype_id, utype_id, start, count, x) = array else: (x, x, x, x, x, x, start, count, x) = array + start=int(start, 0) + count=int(count, 0) #print (dev, dev_id, subtype, subtype_id, utype_id, start, count) dict_dev[dev] = int(dev_id, 0) dict_subtype[subtype] = int(subtype_id, 0) - # TODO Add raneg parsing when documentation supports utypes.append((dev, subtype, start, count)) ''' @@ -162,6 +169,12 @@ ofile = open("%s.py" % args.soc, "w") ofile.write(data) ofile.close() +#Generate the csv file with default values +data = gen_rm_resasg_csv() +ofile = open("%s.csv" % args.soc, "w") +ofile.write(data) +ofile.close() + #Generate the excel sheet with default values workbook = xlwt.Workbook() sheet = workbook.add_sheet(args.soc)