Lines Matching full:self

916     def __init__(self, path, verbose):  argument
917 self.verbose = verbose
918 self.cur_offset = 0
919 self.ext_mft_length = 0
920 self.info(f'Reading SOF ri image {path}', show_offset=False)
921 self.file_name = path
923 self.data = open(path, 'rb').read()
924 self.file_size = len(self.data)
925 self.info('File size ' + uint_to_string(self.file_size, True),
928 def get_offset(self): argument
931 return self.cur_offset
933 def ff_data(self, delta_offset): argument
936 self.cur_offset += delta_offset
938 def set_offset(self, offset): argument
941 old_offset = self.cur_offset
942 self.cur_offset = offset
945 def get_data(self, beg, length): argument
949 return self.data[self.cur_offset +beg : self.cur_offset +beg +length]
951 def read_bytes(self, count): argument
954 bts = self.get_data(0, count)
955 self.ff_data(count)
958 def read_dw(self): argument
961 dword, = struct.unpack('I', self.get_data(0, 4))
962 self.ff_data(4)
965 def read_w(self): argument
968 word, = struct.unpack('H', self.get_data(0, 2))
969 self.ff_data(2)
972 def read_b(self): argument
975 byte, = struct.unpack('B', self.get_data(0, 1))
976 self.ff_data(1)
979 def read_string(self, size_in_file): argument
982 return self.read_bytes(size_in_file).decode().rstrip('\0')
984 def read_uuid(self): argument
987 out = '{:08x}'.format(self.read_dw())
988 out += '-'+'{:04x}'.format(self.read_w())
989 out += '-'+'{:04x}'.format(self.read_w())
990 out += '-'+'{:02x}'.format(self.read_b()) + \
991 '{:02x}'.format(self.read_b()) + '-'
993 out += '{:02x}'.format(self.read_b())
996 def offset_to_string(self, delta=0): argument
999 return uint_to_string(self.cur_offset+delta)
1001 def info(self, loginfo, off_delta=0, verb_info=True, show_offset=True): argument
1004 if verb_info and not self.verbose:
1007 print(self.offset_to_string(off_delta) + '\t' + loginfo)
1011 def error(self, logerror, off_delta=0): argument
1014 print(self.offset_to_string(off_delta) + '\terror: ' + logerror,
1028 def __init__(self, name, val, color='none'): argument
1029 self.name = name
1030 self.val = val
1031 self.color = color
1033 def __str__(self): argument
1035 return uint_to_string(self.val)
1036 return '{}{}{}'.format(change_color(self.color),
1037 uint_to_string(self.val),
1043 def __init__(self, name, val, color='none'): argument
1044 self.name = name
1045 self.val = val
1046 self.color = color
1048 def __str__(self): argument
1050 return hex(self.val)
1051 return '{}{}{}'.format(change_color(self.color), hex(self.val),
1057 def __init__(self, name, val): argument
1058 self.name = name
1059 self.val = val
1061 def __str__(self): argument
1062 return repr(self.val)
1067 def __init__(self, name, val, color='none'): argument
1068 self.name = name
1069 self.val = val
1070 self.color = color
1072 def __str__(self): argument
1073 length = len(self.val)
1077 out = '{}'.format(change_color(self.color))
1079 out += ' '.join(['{:02x}'.format(b) for b in self.val])
1086 …out += ',\n'.join([', '.join(['0x{:02x}'.format(b) for b in self.val[i:i + n]]) for i in range(0, …
1088 out += ' '.join('{:02x}'.format(b) for b in self.val[:8])
1090 out += ' '.join('{:02x}'.format(b) for b in self.val[length-8:length])
1098 def __init__(self, name, val): argument
1099 self.name = name
1100 self.val = val
1102 def __str__(self): argument
1103 return date_to_string(self.val)
1108 def __init__(self, name, val): argument
1109 self.name = name
1110 self.val = val
1112 def __str__(self): argument
1113 return self.val
1118 def __init__(self, name, major, minor, hotfix, build): argument
1119 self.name = name
1120 self.val = '{:d}.{:d}.{:d}.{:d}'.format(major, minor, hotfix, build)
1122 def __str__(self): argument
1123 return self.val
1128 def __init__(self, name, val, val_type): argument
1130 self.val_type = val_type
1132 def __str__(self): argument
1136 out += ' ({})'.format(self.val_type)
1138 out += ' {}({}){}'.format(change_color('red'), self.val_type,
1145 def __init__(self, uid, name, file_offset): argument
1146 self.uid = uid
1147 self.name = name
1148 self.file_offset = file_offset
1149 self.attribs = []
1150 self.adir = {}
1151 self.max_attr_name_len = 0
1152 self.components = []
1153 self.cdir = {}
1155 def add_a(self, attrib): argument
1158 self.max_attr_name_len = max(self.max_attr_name_len,
1160 self.attribs.append(attrib)
1161 self.adir[attrib.name] = attrib
1163 def add_comp(self, comp): argument
1166 self.components.append(comp)
1167 self.cdir[comp.uid] = comp
1169 def get_comp(self, comp_uid): argument
1172 for comp in self.components:
1177 def dump_info(self, pref, comp_filter): argument
1180 print(pref + self.name)
1181 for attrib in self.attribs:
1183 self.max_attr_name_len, attrib))
1184 self.dump_comp_info(pref, comp_filter)
1186 def dump_attrib_info(self, pref, attr_name): argument
1189 attrib = self.adir[attr_name]
1191 self.max_attr_name_len, attrib))
1193 def dump_comp_info(self, pref, comp_filter=''): argument
1196 for comp in self.components:
1202 def add_comp_to_mem_map(self, mem_map): argument
1203 for comp in self.components:
1209 def __init__(self): argument
1210 super(ExtendedManifestAE1, self).__init__('ext_mft',
1213 def dump_info(self, pref, comp_filter): argument
1214 hdr = self.cdir['ext_mft_hdr']
1217 out = '{}{}'.format(pref, self.name)
1221 self.dump_comp_info(pref, comp_filter + ['Header'])
1226 def __init__(self): argument
1227 super(ExtendedManifestXMan, self).__init__('ext_mft',
1230 def dump_info(self, pref, comp_filter): argument
1231 hdr = self.cdir['ext_mft_hdr']
1234 out = '{}{}'.format(pref, self.name)
1238 self.dump_comp_info(pref, comp_filter + ['Header'])
1243 def __init__(self, offset): argument
1244 super(CseManifest, self).__init__('cse_mft', 'CSE Manifest', offset)
1246 def dump_info(self, pref, comp_filter): argument
1247 hdr = self.cdir['cse_mft_hdr']
1250 self.name, hdr.adir['header_version'],
1252 self.dump_comp_info(pref, comp_filter + ['Header'])
1257 def __init__(self, name, offset): argument
1258 super(CssManifest, self).__init__('css_mft', name, offset)
1260 def dump_info(self, pref, comp_filter): argument
1261 hdr = self.cdir['css_mft_hdr']
1262 out = '{}{} (CSS Manifest)'.format(pref, self.name)
1265 self.file_offset, hdr.adir['header_len_dw'].val * 4
1283 self.dump_comp_info(pref, comp_filter + ['Header'])
1288 def __init__(self, ext_id, name, offset): argument
1289 super(MftExtension, self).__init__('mft_ext'+repr(ext_id), name,
1292 def dump_info(self, pref, comp_filter): argument
1294 format(pref, self.name,
1295 self.adir['type'], self.file_offset, self.adir['length']))
1300 def __init__(self, ext_id, offset): argument
1302 self).__init__(ext_id, 'Plat Fw Auth Extension', offset)
1304 def dump_info(self, pref, comp_filter): argument
1307 out += ' name {}'.format(self.adir['name'])
1308 out += ' vcn {}'.format(self.adir['vcn'])
1309 out += ' bitmap {}'.format(self.adir['bitmap'])
1310 out += ' svn {}'.format(self.adir['svn'])
1316 def __init__(self, ext_id, offset): argument
1318 self).__init__(ext_id, 'ADSP Metadata File Extension',
1321 def dump_info(self, pref, comp_filter): argument
1324 out += ' ver {}'.format(self.adir['version'])
1325 out += ' base offset {}'.format(self.adir['base_offset'])
1326 out += ' limit offset {}'.format(self.adir['limit_offset'])
1328 print('{} IMR type {}'.format(pref, self.adir['adsp_imr_type']))
1330 print('{} {}'.format(pref, self.adir['attributes']))
1335 def __init__(self, name, offset): argument
1336 super(AdspManifest, self).__init__('adsp_mft', name, offset)
1338 def dump_info(self, pref, comp_filter): argument
1339 hdr = self.cdir['adsp_mft_hdr']
1340 out = '{}{} (ADSP Manifest) file offset 0x{:x}'.format(pref, self.name, self.file_offset)
1352 self.dump_comp_info(pref, comp_filter + ['ADSP Manifest Header'])
1357 def __init__(self, uid, offset): argument
1358 super(AdspModuleEntry, self).__init__(uid, 'Module Entry', offset)
1360 def dump_info(self, pref, comp_filter): argument
1361 print('{}{:9} {}'.format(pref, str(self.adir['mod_name']),
1362 self.adir['uuid']))
1363 print('{} entry point {} type {}'.format(pref, self.adir['entry_point'],
1364 self.adir['type']))
1366 self.adir['cfg_offset'], self.adir['cfg_count'],
1367 self.adir['affinity_mask'])
1369 self.adir['instance_max_count'], self.adir['instance_stack_size'])
1372 self.adir['seg_0_v_base_addr'], self.adir['seg_0_file_offset'],
1373 self.adir['seg_0_flags']))
1375 self.adir['seg_1_v_base_addr'], self.adir['seg_1_file_offset'],
1376 self.adir['seg_1_flags']))
1378 self.adir['seg_2_v_base_addr'], self.adir['seg_2_file_offset'],
1379 self.adir['seg_2_flags']))
1381 def add_comp_to_mem_map(self, mem_map): argument
1383 self.adir['mod_name'].val + '.text',
1384 self.adir['seg_0_v_base_addr'].val,
1385 self.adir['seg_0_size'].val));
1387 self.adir['mod_name'].val + '.rodata',
1388 self.adir['seg_1_v_base_addr'].val,
1389 self.adir['seg_1_size'].val));
1391 self.adir['mod_name'].val + '.bss',
1392 self.adir['seg_2_v_base_addr'].val,
1393 self.adir['seg_2_size'].val));
1398 def __init__(self): argument
1399 super(FwBin, self).__init__('bin', 'SOF Binary', 0)
1401 def dump_info(self, pref, comp_filter): argument
1405 self.adir['file_name'], self.adir['file_size']))
1406 self.dump_comp_info(pref, comp_filter)
1408 def populate_mem_map(self, mem_map): argument
1411 self.add_comp_to_mem_map(mem_map)
1458 def __init__(self, name, base_address, size): argument
1459 self.name = name
1460 self.base_address = base_address
1461 self.size = size
1462 self.used_size = 0
1463 self.inner_segments = []
1465 def is_inner(self, segment): argument
1466 return self.base_address <= segment.base_address and \
1467 segment.base_address + segment.size <= self.base_address + self.size
1469 def insert_segment(self, segment): argument
1470 for seg in self.inner_segments:
1474 self.inner_segments.append(segment)
1475 self.used_size += segment.size
1477 def dump_info(self, pref): argument
1478 free_size = self.size - self.used_size
1479 out = '{}{:<35} 0x{:x}'.format(pref, self.name, self.base_address)
1480 if self.used_size > 0:
1481 out += ' ({} + {} {:.2f}% used)'.format(self.used_size, free_size,
1482 self.used_size*100/self.size)
1486 for seg in self.inner_segments:
1492 def __init__(self, platform_name, segments): argument
1493 self.platform_name = platform_name
1494 self.segments = segments
1496 def insert_segment(self, segment): argument
1499 for seg in self.segments:
1504 def dump_info(self): argument
1505 if not self.segments:
1506 print(self.platform_name) # "no platform found"
1509 print("Memory layout for: " + self.platform_name)
1510 for seg in self.segments: