Пример #1
0
def do_test(baud, parity):
    myenv = {'parity': parity, 'baud': baud}
    path = "app_uart_test_parity"
    resources = xmostest.request_resource("xsim")

    checker = UARTTxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity[parity], baud, 4, 1, 8)
    tester = xmostest.ComparisonTester(open('test_tx_parity_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "tx_parity",
                                       myenv,
                                       regexp=True)

    # Only want no parity @ 115200 baud for smoke tests
    if baud != 115200 or parity != 'UART_PARITY_EVEN':
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_parity/bin/smoke/app_uart_test_parity_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        clean_before_build=True,
        build_env=myenv)
Пример #2
0
def do_test(baud):
    myenv = {'baud': baud}
    path = "app_uart_test_tx"
    resources = xmostest.request_resource("xsim")

    checker = UARTTxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity['UART_PARITY_NONE'], baud, 128, 1, 8)
    tester = xmostest.ComparisonTester(open('test_tx_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "tx",
                                       myenv,
                                       regexp=True)

    # This test is long, only run on nightly
    tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_tx/bin/smoke/app_uart_test_tx_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        clean_before_build=True,
        build_env=myenv)
def do_test(baud, parity):
    myenv = {'baud': baud, 'parity': parity}
    path = "app_uart_test_half_duplex"
    resources = xmostest.request_resource("xsim")

    tx_checker = UARTTxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1A",
                               TxParity[parity], baud, 4, 1, 8)

    tester = xmostest.ComparisonTester(open('test_half_duplex_tx_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "half_duplex_tx_simple",
                                       myenv,
                                       regexp=True)

    # Only want no parity @ 115200 baud for smoke tests
    if baud != 115200 or parity != "UART_PARITY_NONE":
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_half_duplex/bin/smoke/app_uart_test_half_duplex_smoke.xe',
        simthreads=[tx_checker],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -ports -o trace.vcd"],
        clean_before_build=True,
        build_env=myenv)
Пример #4
0
def do_test(baud, internal_clock):
    myenv = {'baud': baud, 'internal_clock': internal_clock}
    path = "app_uart_test_multi_tx"
    resources = xmostest.request_resource("xsim")

    tx_checker = UARTTxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_8B.1",
                               TxParity['UART_PARITY_NONE'], baud, 4, 1, 8)
    uart_clock = UARTClockDevice("tile[0]:XS1_PORT_1F", 230400)

    tester = xmostest.ComparisonTester(open('test_tx_multi_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "multi_tx_simple",
                                       myenv,
                                       regexp=True)

    # Only want no parity @ 230400 baud for smoke tests
    if baud != 115200:
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_multi_tx/bin/smoke/app_uart_test_multi_tx_smoke.xe',
        simthreads=[tx_checker, uart_clock],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -pads -o trace.vcd"],
        clean_before_build=True,
        build_env=myenv)
class UARTHalfDuplexChecker(xmostest.SimThread):
    def __init__(self, rx_port, tx_port, notif_port, parity, baud, length, stop_bits, bpb):
        self._rx_port = rx_port
        self._tx_port = tx_port
        self._notif_port = notif_port
        self._parity = parity
        self._baud = baud
        self._length = length
        self._stop_bits = stop_bits
        self._bits_per_byte = bpb

        self._tx = TxC(rx_port, tx_port, parity, baud, length, stop_bits, bpb)
        self._rx = RxC(rx_port, tx_port, parity, baud, stop_bits, bpb)

    def do_read_test(self, xsi):
        # Device reads 4 bytes from UART.
        [self._rx.send_byte(xsi, byte) for byte in [0x7f, 0x00, 0x2f, 0xff]]

    def do_write_test(self, xsi):
        # Device sends 4 bytes down UART
        k = self._tx.read_packet(self.xsi, self._parity, self._length)
        print ", ".join(map((lambda x: "0x%02x" % ord(x)), k))

    def run(self):
        # Wait for the xcore to bring the uart tx port up
        self.wait((lambda x: self.xsi.is_port_driving(self._tx_port)))

        self._tx.xsi = self.xsi
        self.do_write_test(self.xsi)

        self.wait((lambda x: self.xsi.is_port_driving(self._notif_port)))

        self._rx.xsi = self.xsi
        self.do_read_test(self.xsi)
Пример #6
0
def do_test(baud):
    myenv = {'baud': baud}
    resources = xmostest.request_resource("xsim")

    rx_checker = UARTRxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                               RxParity['UART_PARITY_NONE'], baud, 1, 8)

    tx_checker = UARTTxChecker("tile[0]:XS1_PORT_1D", "tile[0]:XS1_PORT_1C",
                               TxParity['UART_PARITY_NONE'], baud, 4, 1, 8)

    tester = xmostest.ComparisonTester(open('test_loopback_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "loopback",
                                       myenv,
                                       regexp=True)

    if baud != 115200:
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_loopback/bin/{}/app_uart_test_loopback_{}.xe'.format(
            baud, baud),
        simthreads=[rx_checker, tx_checker],
        xscope_io=True,
        tester=tester,
        simargs=[
            "--vcd-tracing", "-tile tile[0] -functions -ports -o trace.vcd"
        ],
        clean_before_build=True,
        build_env=myenv)
Пример #7
0
def do_test(baud):
    myenv = {'baud': baud}
    path = "app_uart_test_intermittent"
    resources = xmostest.request_resource("xsim")

    checker = UARTTxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity['UART_PARITY_NONE'], baud, 64, 1, 8)
    tester = xmostest.ComparisonTester(
        open('test_tx_intermittent_uart.expect'),
        "lib_uart",
        "sim_regression",
        "tx_intermittent",
        myenv,
        regexp=True)

    # Only want no parity @ 230400 baud for smoke tests
    if baud != 230400:
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_intermittent/bin/smoke/app_uart_test_intermittent_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        clean_before_build=True,
        build_env=myenv)
    def __init__(self, rx_port, tx_port, notif_port, parity, baud, length, stop_bits, bpb):
        self._rx_port = rx_port
        self._tx_port = tx_port
        self._notif_port = notif_port
        self._parity = parity
        self._baud = baud
        self._length = length
        self._stop_bits = stop_bits
        self._bits_per_byte = bpb

        self._tx = TxC(rx_port, tx_port, parity, baud, length, stop_bits, bpb)
        self._rx = RxC(rx_port, tx_port, parity, baud, stop_bits, bpb)