def resolve_addresses(self, all_regions={}, values={}): all_resolved = True if self.addresses_resolved is True: return elif self._csv: (f, parsed) = parse_am37x_register_tables.parsecsv(self._csv) addrs = intervaltree.IntervalTree() for p in parsed: addr = p[parse_am37x_register_tables.TITable.ADDRESS] if addr: addr = int(addr, 0) else: continue wid = p[parse_am37x_register_tables.TITable.WIDTH] name = p[parse_am37x_register_tables.TITable.NAME] # create a unique name without spaces name = re.sub("[\s]", "", name) + (".%x" % addr) size = int(wid) / 8 if wid else 4 i = intervaltree.Interval(addr, addr + size) addrs.add(i) raw_perms = p[parse_am37x_register_tables.TITable.TYPE].lower() perms = "readonly" if 'w' not in raw_perms else 'global' self._raw_subregions[name] = { 'addresses': [i.begin, i.end], 'include_children': False, 'type': perms, } self.children_names.append("%s.%s" % (self.short_name, name)) self.addresses = addrs f.close() all_resolved = True elif (type(self._raw_addresses) == list): if type(self._raw_addresses[0] ) == list: # its a list of lists of subregions for a in self._raw_addresses: all_resolved = all_resolved and self._resolve_addr_region( a, all_regions, values) else: all_resolved = self._resolve_addr_region( self._raw_addresses, all_regions, values) else: all_resolved = self._resolve_special_addr_region( self._raw_addresses, all_regions, values) self.addresses_resolved = all_resolved
def _create_reg_table(self, csvfile): fields = ["startaddr", "size", "kind", "name"] cc = Main.cc (f, reader) = parse_am37x_register_tables.parsecsv(csvfile) row = self.reg_table.row for r in reader: row['address'] = int(r['address'].strip(), 16) if r['address'] else 0 row["offset"] = int(r["offset"].strip(), 16) if r["offset"] else 0 row["table"] = r["table"] if r["table"] else "" row["typ"] = r["typ"] if r["typ"] else "" row["width"] = int(r["width"]) if r["width"] else 0 row["reset"] = r["reset"] if r["reset"] else "" row["name"] = r["name"] if r["name"] else "" if row['address'] == 0: print "addr not found in %s" % r row.append() f.close() self.reg_table.cols.address.create_index(kind='full') self.reg_table.flush()