Exemplo n.º 1
0
def program_board(args, status):
    s = status
    #print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    board.program()
    if not board.is_programmed():
        sys.stdout.write("Wait for board to finish programming")
        sys.stdout.flush()

        while not board.is_programmed():
            sys.stdout.write(".")
            sys.stdout.flush()
            time.sleep(.200)

        sys.stdout.write("Done!\n")
Exemplo n.º 2
0
def program_board(args, status):
    s = status
    # print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s:
            s.Error("%s" % str(ex))
        sys.exit(1)

    board.program()
    if not board.is_programmed():
        sys.stdout.write("Wait for board to finish programming")
        sys.stdout.flush()

        while not board.is_programmed():
            sys.stdout.write(".")
            sys.stdout.flush()
            time.sleep(0.200)

        sys.stdout.write("Done!\n")
Exemplo n.º 3
0
 def setUp(self):
     name = "sim"
     serial = "dionysus_uart_pmod"
     s = Status()
     s.set_level("fatal")
     try:
         self.n = find_board(name, serial, s)
     except PlatformScannerException as ex:
         print "Could not find platform :%s" % str(ex)
         sys.exit(1)
     self.n.read_sdb()
Exemplo n.º 4
0
 def setUp(self):
     self.dbg = False
     name = "sim"
     serial = "dionysus_uart_pmod"
     s = Status()
     s.set_level(StatusLevel.FATAL)
     try:
         self.board = find_board(name, serial, s)
     except PlatformScannerException as ex:
         print "Could not find platform :%s" % str(ex)
         sys.exit(1)
     self.board.read_sdb()
     self.nsm = self.board.nsm
Exemplo n.º 5
0
def reset_board(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    board.reset()
Exemplo n.º 6
0
def reset_board(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    board.reset()
Exemplo n.º 7
0
def board_programmed(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    p = board.is_programmed()
    print "Board Programmed: %s" % str(p)
    return p
Exemplo n.º 8
0
def board_programmed(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    p = board.is_programmed()
    print "Board Programmed: %s" % str(p)
    return p
Exemplo n.º 9
0
def upload_board(args, status):
    s = status
    #print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    board.upload(args.bin[0])
    board.program()
Exemplo n.º 10
0
def upload_board(args, status):
    s = status
    #print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    board.upload(args.bin[0])
    board.program()
Exemplo n.º 11
0
    def setUp(self):
        name = "sim"
        serial = "dionysus_dma_test"
        s = Status()
        s.set_level("fatal")
        try:
            self.n = find_board(name, serial, s)
        except PlatformScannerException as ex:
            print "Could not find platform :%s" % str(ex)
            sys.exit(1)
        self.n.read_sdb()
        urns = self.n.find_device(MockGPIODriver)
        #self.simple_dev = MockGPIODriver(self.n, urns[0], True)
        self.simple_dev = MockGPIODriver(self.n, urns[0], False)
        urns = self.n.find_device(MockDMAReaderDriver)
        self.dmar = MockDMAReaderDriver(self.n, urns[0], False)

        urns = self.n.find_device(MockDMAWriterDriver)
        self.dmaw = MockDMAWriterDriver(self.n, urns[0], False)
        s.set_level("error")
Exemplo n.º 12
0
    def setUp(self):
        name = "sim"
        serial = "dionysus_dma_test"
        s = Status()
        s.set_level("fatal")
        try:
            self.n = find_board(name, serial, s)
        except PlatformScannerException as ex:
            print "Could not find platform :%s" % str(ex)
            sys.exit(1)
        self.n.read_sdb()
        urns = self.n.find_device(MockGPIODriver)
        #self.simple_dev = MockGPIODriver(self.n, urns[0], True)
        self.simple_dev = MockGPIODriver(self.n, urns[0], False)
        urns = self.n.find_device(MockDMAReaderDriver)
        self.dmar = MockDMAReaderDriver(self.n, urns[0], False)

        urns = self.n.find_device(MockDMAWriterDriver)
        self.dmaw = MockDMAWriterDriver(self.n, urns[0], False)
        s.set_level("error")
Exemplo n.º 13
0
def view_sdb(args, status):
    s = status
    #print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.file is not None:
        parse_sdb_file(args.file[0])
        sys.exit(0)
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    if not board and serial:
        if s:
            s.Error(
                "Board with serial: %s does not exist, is it possible you mistyped the serial?"
                % serial)
        sys.exit(1)

    if not board.is_programmed():
        sys.stdout.write("Wait for board to finish programming")
        sys.stdout.flush()

        while not board.is_programmed():
            sys.stdout.write(".")
            sys.stdout.flush()
            time.sleep(.200)

        sys.stdout.write("Done!\n")

    #board.reset()
    board.read_sdb()
    board.pretty_print_sdb()
Exemplo n.º 14
0
def view_sdb(args, status):
    s = status
    #print "args.name: %s" % args.name
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.file is not None:
        parse_sdb_file(args.file[0])
        sys.exit(0)
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    if not board and serial:
        if s: s.Error("Board with serial: %s does not exist, is it possible you mistyped the serial?" % serial)
        sys.exit(1)
        

    if not board.is_programmed():
        sys.stdout.write("Wait for board to finish programming")
        sys.stdout.flush()

        while not board.is_programmed():
            sys.stdout.write(".")
            sys.stdout.flush()
            time.sleep(.200)

        sys.stdout.write("Done!\n")

    #board.reset()
    board.read_sdb()
    board.pretty_print_sdb()
Exemplo n.º 15
0
def ping_board(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    print "Pinging board...",
    try:
        board.ping()
    except NysaCommError as e:
        print "Communication Error: %s" % str(e)
        sys.exit(1)
    print "Received a Response!"
Exemplo n.º 16
0
def ping_board(args, status):
    s = status
    name = args.name
    if name == "any":
        name = None
    serial = None
    board = None
    if args.serial is not None:
        serial = args.serial[0]

    try:
        board = find_board(name, serial, status)
    except PlatformScannerException as ex:
        if s: s.Error("%s" % str(ex))
        sys.exit(1)

    print "Pinging board...",
    try:
        board.ping()
    except NysaCommError as e:
        print "Communication Error: %s" % str(e)
        sys.exit(1)
    print "Received a Response!"
Exemplo n.º 17
0
def upload(board_name, serial_number, file_path, status):
    board = find_board(board_name, serial_number, status)
    board.upload(file_path)
    board.program()
Exemplo n.º 18
0
def upload(board_name, serial_number, file_path, status):
    board = find_board(board_name, serial_number, status)
    board.upload(file_path)
    board.program()