def __init__(self, dev_dict, status = None):
     Nysa.__init__(self, status)
     self.dev_dict = dev_dict
     self.configuration = None
     self.usb_status = USB_DEVICE_NOT_CONNECTED
     self.fx3 = PrometheusUSB(self.usb_device_status_cb,
                              self.device_to_host_comm)
 def __init__(self, path, status = None):
     Nysa.__init__(self, status)
     ser_path = path
     self.ser = serial.Serial(path, BAUDRATE)
     self.ser.timeout = 2
     self.ser.flushInput()
     if self.ser == None:
         print "Error openning Serial Port"
示例#3
0
 def __init__(self, path, status=None):
     Nysa.__init__(self, status)
     ser_path = path
     baudrate = 115200
     self.ser = serial.Serial(path, baudrate)
     self.ser.timeout = 2
     self.ser.flushInput()
     if self.ser == None:
         print "Error openning Serial Port"
示例#4
0
 def __init__(self, path, status = None):
     Nysa.__init__(self, status)
     ser_path = path
     baudrate = 115200
     self.ser = serial.Serial(path, baudrate)
     self.ser.timeout = 2
     self.ser.flushInput()
     if self.ser == None:
         print "Error openning Serial Port"
示例#5
0
    def __init__(self, dut, uart_if, sim_config, period = CLK_PERIOD, user_paths = [], status = None):
        self.dev_dict                              = json.load(open(sim_config), object_pairs_hook = OrderedDict)
        Nysa.__init__(self, Status())
        self.s.set_level('verbose')
        self.user_paths = user_paths
        self.comm_lock = cocotb.triggers.Lock('comm')
        self.dut                              = dut
        cocotb.fork(Clock(dut.clk, period).start())
        gd = GenSDB()
        self.rom = gd.gen_rom(self.dev_dict, user_paths = self.user_paths, debug = False)

        self.uart = uart_if
        self.response = Array('B')
    def __init__(self, idVendor = 0x0403, idProduct = 0x8530, sernum = None, status = False):
        Nysa.__init__(self, status)
        self.vendor = idVendor
        self.product = idProduct
        self.sernum = sernum

        self.dev = None
        #Run a full garbage collection so any previous references to Dionysus will be removed
        gc.collect()
        self.lock = threading.Lock()


        self.dev = Ftdi()
        self._open_dev()
        self.name = "Dionysus"
        self.interrupts = 0x00
        self.events = []
        for i in range (INTERRUPT_COUNT):
            e = threading.Event()
            e.set()
            self.events.append(e)

        self.hwq = Queue.Queue(10)
        self.hrq = Queue.Queue(10)

        self.d = DionysusData()

        self.worker = WorkerThread(self.dev,
                                   self.hwq,
                                   self.hrq,
                                   self.d,
                                   self.lock,
                                   self.interrupt_update_callback)
        #Is there a way to indicate closing
        self.worker.setDaemon(True)
        self.worker.start()

        try:
            #XXX: Hack to fix a strange bug where FTDI
            #XXX: won't recognize Dionysus until a read and reset occurs
            self.ping()

        except NysaCommError:
            pass

        self.reset()



        '''
示例#7
0
    def __init__(self,
                 idVendor=0x0403,
                 idProduct=0x8531,
                 sernum=None,
                 status=False):
        Nysa.__init__(self, status)
        self.vendor = idVendor
        self.product = idProduct
        self.sernum = sernum

        self.dev = None
        #Run a full garbage collection so any previous references to Artemis will be removed
        gc.collect()
        self.lock = threading.Lock()

        self.dev = Ftdi()
        self._open_dev()
        self.name = "Artemis"
        self.interrupts = 0x00
        self.events = []
        for i in range(INTERRUPT_COUNT):
            e = threading.Event()
            e.set()
            self.events.append(e)

        self.hwq = Queue.Queue(10)
        self.hrq = Queue.Queue(10)

        self.d = ArtemisData()

        self.worker = WorkerThread(self.dev, self.hwq, self.hrq, self.d,
                                   self.lock, self.interrupt_update_callback)
        #Is there a way to indicate closing
        self.worker.setDaemon(True)
        self.worker.start()

        try:
            #XXX: Hack to fix a strange bug where FTDI
            #XXX: won't recognize Artemis until a read and reset occurs
            #self.ping()
            pass

        except NysaCommError:
            pass

        self.reset()
        '''
示例#8
0
    def __init__(self,
                 dut,
                 uart_if,
                 sim_config,
                 period=CLK_PERIOD,
                 user_paths=[],
                 status=None):
        self.dev_dict = json.load(open(sim_config),
                                  object_pairs_hook=OrderedDict)
        Nysa.__init__(self, Status())
        self.s.set_level('verbose')
        self.user_paths = user_paths
        self.comm_lock = cocotb.triggers.Lock('comm')
        self.dut = dut
        cocotb.fork(Clock(dut.clk, period).start())
        gd = GenSDB()
        self.rom = gd.gen_rom(self.dev_dict,
                              user_paths=self.user_paths,
                              debug=False)

        self.uart = uart_if
        self.response = Array('B')
示例#9
0
def main(argv):
    #Parse out the commandline arguments
    s = status.Status()
    s.set_level(status.StatusLevel.INFO)
    parser = argparse.ArgumentParser(
            formatter_class = argparse.RawDescriptionHelpFormatter,
            description = DESCRIPTION,
            epilog = EPILOG
    )
    debug = False

    parser.add_argument("-d", "--debug",
                        action = "store_true",
                        help = "Enable Debug Messages")
    parser.add_argument("-l", "--list",
                        action = "store_true",
                        help = "List the available devices from a platform scan")
    parser.add_argument("platform",
                        type = str,
                        nargs='?',
                        default=["first"],
                        help="Specify the platform to use")
 
    args = parser.parse_args()
    plat = ["", None, None]

    if args.debug:
        s.set_level(status.StatusLevel.VERBOSE)
        s.Debug("Debug Enabled")
        debug = True

    pscanner = PlatformScanner()
    platform_dict = pscanner.get_platforms()
    platform_names = platform_dict.keys()
    if "sim" in platform_names:
        #If sim is in the platforms, move it to the end
        platform_names.remove("sim")
        platform_names.append("sim")
    dev_index = None
    for platform_name in platform_dict:
        s.Verbose("Platform: %s" % str(platform_name))
        s.Verbose("Type: %s" % str(platform_dict[platform_name]))

        platform_instance = platform_dict[platform_name](s)
        s.Verbose("Platform Instance: %s" % str(platform_instance))


        instances_dict = platform_instance.scan()
        if plat[1] is not None:
            break
        
        for name in instances_dict:

            #s.Verbose("Found Platform Item: %s" % str(platform_item))
            n = instances_dict[name]
            plat = ["", None, None]
            
            if n is not None:
                s.Verbose("Found a nysa instance: %s" % name)
                n.read_sdb()
                dev_index = n.find_device(Nysa.get_id_from_name("LCD"))
                if dev_index is not None:
                    s.Important("Found a device at %d" % dev_index)
                    plat = [platform_name, name, n]
                    break
                continue

            if platform_name == args.platform and plat[0] != args.platform:
                #Found a match for a platfom to use
                plat = [platform_name, name, n]
                continue

            s.Verbose("\t%s" % psi)

    if args.list:
        s.Verbose("Listed all platforms, exiting")
        sys.exit(0)

    if plat is not None:
        s.Important("Using: %s" % plat)
    else:
        s.Fatal("Didn't find a platform to use!")


    c = Controller()
    if dev_index is None:
        sys.exit("Failed to find an LCD Device")

    c.start_standalone_app(plat, dev_index, status, debug)
示例#10
0
 def __init__(self, dev_dict, status = None):
     Nysa.__init__(self, status)
     self.dev_dict = dev_dict
示例#11
0
 def __init__(self, dev_dict, status=None):
     Nysa.__init__(self, status)
     self.dev_dict = dev_dict