Exemplo n.º 1
0
def _create_uart_object():
    ret_value = True
    for bus_name, bus in Profile.get_buses().iteritems():
        try:
            if bus['bus'] == 'uart':
                device_path = bus['path']
                if utility.mount_on_fpga(device_path):
                    class_name = 'Axi4Uart'
                    createok = XObject.create_object(bus_name, class_name,
                                                     device_path)
                else:
                    class_name = 'UartBus'
                    createok = XObject.create_object(bus_name, class_name,
                                                     device_path)

                if createok:
                    logger.boot("create the %s uart object %s" %
                                (bus_name, class_name))
                else:
                    logger.boot(
                        "warning: can not find the %s uart class %s in this project code"
                        % (bus_name, class_name))
                    ret_value = False
        except Exception as e:
            logger.boot("error: create %s uart object fail:\n%s" %
                        (bus_name, traceback.format_exc()))
            ret_value = False
    return ret_value
Exemplo n.º 2
0
def test_read_profile(jsonfile):
    classes = globals()
    XObject.set_classes(classes)
    parser = ProfileParser()
    parser.read_profile(jsonfile)

    boards = Profile.get_boards()
    boards[power_profile['id']] = power_profile

    assert len(Profile.get_extendio()) == 1
    assert len(Profile.get_busswitch()) == 9
    assert len(Profile.get_eeprom()) == 8
    assert len(Profile.get_boards()) == 5
    assert len(Profile.get_buses()) == 8
    assert len(Profile.get_chips()) == 12
Exemplo n.º 3
0
def create_uart_server():
    for name, bus in Profile.get_buses().iteritems():
        if bus['bus'] == 'uart' and bus.has_key('port'):
            uartserver = UartServer(name, bus['port'])
            uartserver.start()