def Main (argv): from HWIOParser import LoadAddressFile config_mods = [] ParseCommandLine(argv) # Disable compiling modules when importing settings dont_write_bytecode = sys.dont_write_bytecode sys.dont_write_bytecode = True for f in config_files: LogInfo("-- Importing config from '" + f + "'") config_mods.append(imp.load_source(f, f)) # Restore setting sys.dont_write_bytecode = dont_write_bytecode bases = LoadAddressFile(address_file, silent) for mod in config_mods: if 'HWIO_REGISTER_FILES' in dir(mod): GenerateRegisters(bases, mod.HWIO_REGISTER_FILES)
ParseCommandLine(sys.argv[1:], config) # Load the dump if config['dragonfly']: register_values = LoadDumpDragonfly(config['dump_file']) metadata = None else: register_values, metadata = LoadDumpXML(config['dump_file'], config['dev_index']) # If we could not load any values, error out. if register_values is None: sys.exit(1) # Load the address file bases = LoadAddressFile(config['flat_file'], use_apre=True) # Create an output file if requested. if 'output_file' in config: try: output = open(config['output_file'], 'w') except: LogError('Unable to open "%s"' % config['output_file']) sys.exit(1) else: output = sys.stdout # Attempt to get the PMIC version revid_all_layer = register_values.get(0x105, None) revid_metal = register_values.get(0x102, None)