Esempio n. 1
0
def process_args(args):
    """
        Processes args from argparse. Unzips zip_file and finds/sets the
        args.config_file. Also set the server port to  a default values
        if it was not defined.
    """

    # Verify if the zip file was specified
    if args.zip_file:
        zip_file_name = args.zip_file

        # Verify if the zip file exist and if it is valid
        if os.path.exists(zip_file_name) and zipfile.is_zipfile(zip_file_name):

            # The ZIP file is valid
            print(f"Valid zip file '{zip_file_name}'.")

            # Add the zip file's python directory to the python path.
            pyrogue.addLibraryPath(f"{zip_file_name}/python")

            # If the default configuration file was given using a relative path,
            # it is refereed to the zip file, so build its full path.
            if args.config_file and args.config_file[0] != '/':

                # The configuration file will be in 'python/${TOP_ROGUE_PACKAGE_NAME}/config/'
                config_file = f"python/{top_rogue_package_name}/config/{args.config_file}"

                print(
                    "Default configuration was defined with a relative path.")
                print(f"Looking if the zip file contains: {config_file}")

                # Get a list of files in the zip file
                with zipfile.ZipFile(zip_file_name, 'r') as zf:
                    file_list = zf.namelist()

                # Verify that the file exist inside the zip file
                if config_file in file_list:
                    # If found, build the full path to it, including the path to the zip file
                    print("Found!")
                    args.config_file = f"{zip_file_name}/{config_file}"
                else:
                    # if not found, then clear the argument as it is invalid.
                    print("Not found. Omitting it.")
                    args.config_file = None

        else:
            print("Invalid zip file. Omitting it.")

    # If the server port was not defined, set it to a default value
    if args.server_port is None:
        # When using a real target (AMC carrier or dev board), set the server port to
        # (9000 + 2 * slot_number). Either the IP address or the RSSI lane number
        # must be defined, so calculate the slot number based on those two cases
        if args.pcie_rssi_lane:
            # If the RSSI lane number was defined, get the slot number from it
            args.server_port = 9000 + 2 * (args.pcie_rssi_lane + 2)
        elif args.ip_addr:
            # Otherwise, get th slot number from the last digit of the IP address
            args.server_port = 9000 + 2 * int(args.ip_addr[-1:])
        # Otherwise, for the emulator target set the server port to 9000.
        # This target doesn't require IP address nor RSSI lane.
        else:
            args.server_port = 9000

    return args
#-----------------------------------------------------------------------------
# This file is part of the 'ATLAS RD53 ATCA DEV'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'ATLAS RD53 ATCA DEV', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import pyrogue as pr
import os

top_level = os.path.realpath(__file__).split('software')[0]

pr.addLibraryPath(top_level+'firmware/submodules/atlas-atca-link-agg-fw-lib/python')
pr.addLibraryPath(top_level+'firmware/submodules/atlas-rd53-fw-lib/python')
pr.addLibraryPath(top_level+'firmware/submodules/surf/python')
pr.addLibraryPath(top_level+'firmware/python')
# pr.addLibraryPath(top_level+'software/python')
Esempio n. 3
0
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Camera link gateway'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Camera link gateway', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import pyrogue as pr
import os

top_level = os.getcwd().split('software')[0]

pr.addLibraryPath(top_level + 'firmware/submodules/surf/python')
pr.addLibraryPath(top_level + 'firmware/submodules/axi-pcie-core/python')
# pr.addLibraryPath(top_level+'/software/python')
Esempio n. 4
0
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Camera link gateway'. It is subject to 
# the license terms in the LICENSE.txt file found in the top-level directory 
# of this distribution and at: 
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 
# No part of the 'Camera link gateway', including this file, may be 
# copied, modified, propagated, or distributed except according to the terms 
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import pyrogue as pr
import os

top_level = os.getcwd().split('software')[0]

pr.addLibraryPath(top_level+'firmware/submodules/surf/python')
pr.addLibraryPath(top_level+'firmware/submodules/axi-pcie-core/python')
pr.addLibraryPath(top_level+'firmware/submodules/lcls-timing-core/python')
pr.addLibraryPath(top_level+'firmware/submodules/lcls2-pgp-fw-lib/python')
pr.addLibraryPath(top_level+'firmware/submodules/l2si-core/python')
pr.addLibraryPath(top_level+'firmware/submodules/clink-gateway-fw-lib/python')
pr.addLibraryPath(top_level+'firmware/common/python')
#pr.addLibraryPath(top_level+'/software/TimeTool/python')
Esempio n. 5
0
#!/usr/bin/env python3

import pyrogue
import time
import cProfile

pyrogue.addLibraryPath('../../firmware/submodules/axi-pcie-core/python')
pyrogue.addLibraryPath('../../firmware/submodules/surf/python')
pyrogue.addLibraryPath('../../firmware/python')

import pyrogue.pydm
import pyrogue.gui
import rogue

from AxiPcieDevel.InterCardTest import InterCardRoot

#rogue.Logging.setFilter('pyrogue.memory.block',rogue.Logging.Debug)
#rogue.Logging.setFilter('pyrogue.prbs.rx',rogue.Logging.Debug)
#rogue.Logging.setLevel(rogue.Logging.Debug)


def loopReadTest(root, count):
    for i in range(count):
        root.PcieControl[0].Fpga.AxiPcieCore.AxiVersion.ScratchPad.get()


def loopWriteTest(root, count):
    for i in range(count):
        root.PcieControl[0].Fpga.AxiPcieCore.AxiVersion.ScratchPad.set(i)

#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Camera link gateway'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Camera link gateway', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import pyrogue as pr

pr.addLibraryPath('../../firmware/submodules/atlas-rd53-fw-lib/python')
pr.addLibraryPath('../../firmware/submodules/axi-pcie-core/python')
pr.addLibraryPath('../../firmware/submodules/surf/python')
pr.addLibraryPath('../../firmware/submodules/rce-gen3-fw-lib/python')
pr.addLibraryPath('../../firmware/common/fmc/python')
#pr.addLibraryPath('../../firmware/common/feb/python')
pr.addLibraryPath('../python')
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Camera link gateway'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Camera link gateway', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------

import pyrogue as pr
import os
baseDir = os.path.dirname(os.path.realpath(__file__))
pr.addLibraryPath(baseDir)
pr.addLibraryPath(baseDir + '/../../surf/python')
pr.addLibraryPath(baseDir + '/../../axi-pcie-core/python')
pr.addLibraryPath(baseDir + '/../../lcls-timing-core/python')
pr.addLibraryPath(baseDir + '/../../lcls2-pgp-fw-lib/python')

import sys
import argparse
import time

import rogue.hardware.axi
import rogue.protocols

import XilinxKcu1500Pgp as kcu1500
import ClinkFeb as feb

#################################################################
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Camera link gateway'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Camera link gateway', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import pyrogue as pr

#pr.addLibraryPath('../../../firmware/submodules/axi-pcie-core/python')
#pr.addLibraryPath('../../../firmware/submodules/surf/python')
#pr.addLibraryPath('../../../firmware/common/python')
pr.addLibraryPath('../../python')
Esempio n. 9
0
# File       : updatePcieFpga.py
# Created    : 2018-06-22
#-----------------------------------------------------------------------------
# This file is part of the 'axi-pcie-core'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'axi-pcie-core', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------

import pyrogue as pr
import os
baseDir = os.path.dirname(os.path.realpath(__file__))
pr.addLibraryPath(baseDir)
pr.addLibraryPath(baseDir + '/../../surf/python')

import sys
import glob
import argparse
import rogue.hardware.axi
import axipcie as pcie
from collections import OrderedDict as odict

# Set the argument parser
parser = argparse.ArgumentParser()

# Add arguments
parser.add_argument(
    "--dev",
Esempio n. 10
0
# Description:
# Python script to start a PyRogue server using ETH communication
#-----------------------------------------------------------------------------
# This file is part of the pysmurf software platform. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
#    https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the rogue software platform, including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------

import pyrogue

# Setup python path for testing
pyrogue.addLibraryPath("../python")
pyrogue.addLibraryPath("../lib")
pyrogue.addLibraryPath("../../cryo-det/firmware/python")
pyrogue.addLibraryPath(
    "../../cryo-det/firmware/submodules/amc-carrier-core/python")
#pyrogue.addLibraryPath("../../cryo-det/firmware/submodules/axi-pcie-core/python")
pyrogue.addLibraryPath(
    "../../cryo-det/firmware/submodules/lcls-timing-core/python")
pyrogue.addLibraryPath("../../cryo-det/firmware/submodules/surf/python")

import pyrogue.utilities.fileio

from pysmurf.core.roots.EmulationRoot import EmulationRoot

#rogue.Logging.setFilter('pyrogue.epicsV3.Value',rogue.Logging.Debug)
#rogue.Logging.setLevel(rogue.Logging.Debug)