if args.log_level != '': import logging log_level = args.log_level.strip() try: logging.basicConfig(level=eval('logging.%s' % log_level)) except AttributeError: raise RuntimeError('No such log level: %s' % log_level) if args.comms == 'katcp': HOSTCLASS = katcp_fpga.KatcpFpga else: HOSTCLASS = dcp_fpga.DcpFpga if 'CORR2INI' in os.environ.keys() and args.hosts == '': args.hosts = os.environ['CORR2INI'] hosts = utils.parse_hosts(args.hosts, section='fengine') if len(hosts) == 0: raise RuntimeError('No good carrying on without hosts.') # create the devices and connect to them fpgas = fpgautils.threaded_create_fpgas_from_hosts(HOSTCLASS, hosts) fpgautils.threaded_fpga_function(fpgas, 15, 'get_system_information') registers_missing = [] max_hostname = -1 for fpga_ in fpgas: max_hostname = max(len(fpga_.host), max_hostname) freg_error = False for necreg in ['ct_errcnt', 'ct_cnt', 'wintime_error']: if necreg not in fpga_.registers.names(): freg_error = True continue
import sys logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser( description='Set up the TVG on a x-engine VACC.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( '--config', dest='config', type=str, action='store', default='', help='a corr2 config file, will use $CORR2INI if none given') args = parser.parse_args() if 'CORR2INI' in os.environ.keys() and args.config == '': args.config = os.environ['CORR2INI'] if args.config != '': host_list = utils.parse_hosts(args.config, section='xengine') else: host_list = [] snap = 'snap_vacc_in' f = xhost_fpga.FpgaXHostVaccDebug(host_list[0], 0) f.get_system_information() NUM_ACCS = 1633 VEC_LEN = 64 * 40 # 2560 NUM_ADDS = VEC_LEN / 2 BANK0_START = 0 BANK1_START = 2048 # f.registers.snap_trig_val.write_int(NUM_ACCS)
except AttributeError: raise RuntimeError('No such log level: %s' % log_level) if args.comms == 'katcp': HOSTCLASS = katcp_fpga.KatcpFpga else: HOSTCLASS = dcp_fpga.DcpFpga # read the config config = utils.parse_ini_file(args.config) EXPECTED_FREQS = int(config['fengine']['n_chans']) # parse the hosts if args.hosts != '': hosts = utils.parse_hosts(args.hosts) else: hosts = utils.parse_hosts(config, section='fengine') if len(hosts) == 0: raise RuntimeError('No good carrying on without hosts.') def exit_gracefully(signal, frame): fpgautils.threaded_fpga_function(fpgas, 10, 'disconnect') sys.exit(0) signal.signal(signal.SIGINT, exit_gracefully) # make the FPGA objects fpgas = fpgautils.threaded_create_fpgas_from_hosts(HOSTCLASS, hosts) fpgautils.threaded_fpga_function(fpgas, 15, 'get_system_information') snapshot_missing = [] for fpga_ in fpgas:
if args.log_level != '': import logging log_level = args.log_level.strip() try: logging.basicConfig(level=eval('logging.%s' % log_level)) except AttributeError: raise RuntimeError('No such log level: %s' % log_level) if args.comms == 'katcp': HOSTCLASS = katcp_fpga.KatcpFpga else: HOSTCLASS = dcp_fpga.DcpFpga if 'CORR2INI' in os.environ.keys() and args.hosts == '': args.hosts = os.environ['CORR2INI'] hosts = utils.parse_hosts(args.hosts) if len(hosts) == 0: raise RuntimeError('No good carrying on without hosts.') try: print 'Connecting...', sys.stdout.flush() fpgas = fpgautils.threaded_create_fpgas_from_hosts(HOSTCLASS, hosts) print 'done.' print('Calculating all clocks...'), sys.stdout.flush() results = fpgautils.threaded_fpga_function(fpgas, 10, 'estimate_fpga_clock') print 'done.' for fpga_ in fpgas: print '%s: %.0f Mhz' % (fpga_.host, results[fpga_.host])
import logging if args.log_level != '': log_level = args.log_level.strip() try: logging.basicConfig(level=eval('logging.%s' % log_level)) except AttributeError: raise RuntimeError('No such log level: %s' % log_level) LOGGER = logging.getLogger(__name__) # parse the config file cfgsrc = utils.parse_ini_file(args.config) if 'CORR2INI' in os.environ.keys() and args.config == '': args.config = os.environ['CORR2INI'] hosts = utils.parse_hosts(args.config, section='filter') if len(hosts) == 0: raise RuntimeError('No good carrying on without filter hosts.') THREADED_FPGA_OP = fpgautils.threaded_fpga_operation THREADED_FPGA_FUNC = fpgautils.threaded_fpga_function # make the FPGA objects fpgas = [] for ctr, h in enumerate(hosts): _fpga = filthost_fpga.FpgaFilterHost(ctr, cfgsrc) fpgas.append(_fpga) # program the boards THREADED_FPGA_FUNC(fpgas, timeout=10, target_function=('upload_to_ram_and_program', (fpgas[0].boffile,),))
except AttributeError: raise RuntimeError("No such log level: %s" % log_level) # look for hosts in the leases file if args.dnsmasq: hosts, lease_filename = utils.hosts_from_dhcp_leases() print "Found %i roaches in %s." % (len(hosts), lease_filename) for host in hosts: print "\t", host else: # are we doing it by class? if "CORR2INI" in os.environ.keys() and args.hosts == "": args.hosts = os.environ["CORR2INI"] if args.hclass != "": if args.hclass == "fengine": hosts = utils.parse_hosts(args.hosts, section="fengine") elif args.hclass == "xengine": hosts = utils.parse_hosts(args.hosts, section="xengine") else: raise RuntimeError("No such host class: %s" % args.hclass) else: hosts = utils.parse_hosts(args.hosts) if len(hosts) == 0: raise RuntimeError("No good carrying on without hosts.") # create the devices and deprogram them fpgas = fpgautils.threaded_create_fpgas_from_hosts(katcp_fpga.KatcpFpga, hosts) running = fpgautils.threaded_fpga_function(fpgas, 10, "is_running") deprogrammed = [] to_deprogram = []