Exemplo n.º 1
0
def do_test(baud):
    myenv = {'baud': baud}
    path = "app_uart_test_multi_rx"
    resources = xmostest.request_resource("xsim")

    rx_checker = UARTRxChecker("tile[0]:XS1_PORT_8B.0", "tile[0]:XS1_PORT_1A", RxParity['UART_PARITY_NONE'], baud, 1, 8, data=[0x7f, 0x00, 0x2f, 0xff])
    rx_checker2 = UARTRxChecker("tile[0]:XS1_PORT_8B.2", "tile[0]:XS1_PORT_1A", RxParity['UART_PARITY_NONE'], baud/2, 1, 8, data=[0xaa, 0x01, 0xfc, 0x8e])
    uart_clock = UARTClockDevice("tile[0]:XS1_PORT_1L", 1843200)

    drive_high0 = DriveHigh("tile[0]:XS1_PORT_8B.1")

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

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

    xmostest.run_on_simulator(resources['xsim'],
                              'app_uart_test_multi_rx/bin/smoke/app_uart_test_multi_rx_smoke.xe',
                              simthreads=[drive_high0, rx_checker, rx_checker2, uart_clock],
                              xscope_io=True,
                              tester=tester,
                              simargs=["--trace-to", "trace", "--vcd-tracing", "-tile tile[0] -pads -o trace.vcd"],
                              clean_before_build=True,
                              build_env=myenv)
Exemplo n.º 2
0
def do_test(baud):
    myenv = {'baud': baud, 'parity': 'UART_PARITY_EVEN'}
    path = "app_uart_test_rx_intermittent"
    resources = xmostest.request_resource("xsim")

    checker = UARTRxChecker("tile[0]:XS1_PORT_1A",
                            "tile[0]:XS1_PORT_1B",
                            Parity['UART_PARITY_BAD'],
                            baud,
                            1,
                            8,
                            data=range(50),
                            intermittent=True)
    tester = xmostest.ComparisonTester(
        open('test_rx_intermittent_uart.expect'),
        "lib_uart",
        "sim_regression",
        "rx_intermittent",
        myenv,
        regexp=True)

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

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_rx_intermittent/bin/smoke/app_uart_test_rx_intermittent_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -ports -o trace.vcd"],
        clean_before_build=True,
        build_env=myenv)
Exemplo n.º 3
0
def do_test(baud, parity):
    myenv = {'baud': baud, 'parity': parity}
    path = "app_uart_test_rx_parity"
    resources = xmostest.request_resource("xsim")

    checker = UARTRxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity[parity], baud, 1, 8)
    tester = xmostest.ComparisonTester(open('test_rx_parity_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "rx_parity",
                                       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_rx_parity/bin/smoke/app_uart_test_rx_parity_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -ports -o trace.vcd"],
        clean_before_build=True,
        build_env=myenv)
Exemplo n.º 4
0
def do_test(baud, parity, bpb):
    myenv = {'parity': parity, 'baud': baud, 'bits_per_byte': bpb}
    path = "app_uart_test_rx_bpb"
    resources = xmostest.request_resource("xsim")

    checker = UARTRxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity[parity], baud, 1, bpb,
                            [0x00, 0x1a, 0x07, 0x12])
    tester = xmostest.ComparisonTester(open('test_rx_bpb_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "rx_bpb",
                                       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_rx_bpb/bin/smoke/app_uart_test_rx_bpb_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        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)
Exemplo n.º 6
0
def do_test(baud, stopbits):
    myenv = {'stop_bits': stopbits, 'baud': baud}
    path = "app_uart_test_rx_stopbits"
    resources = xmostest.request_resource("xsim")

    checker = UARTRxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity['UART_PARITY_NONE'], baud, stopbits, 8)
    tester = xmostest.ComparisonTester(open('test_rx_stopbits_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "rx_stopbits",
                                       myenv,
                                       regexp=True)

    # Only want 115200 baud w/ 2 stopbits for smoke tests
    if baud != 115200 or stopbits != 2:
        tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_rx_stopbits/bin/smoke/app_uart_test_rx_stopbits_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        clean_before_build=True,
        build_env=myenv)
Exemplo n.º 7
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)
Exemplo n.º 8
0
def do_test(baud, parity):
    myenv = {'baud': baud, 'parity': parity}
    path = "app_uart_test_rx_large"
    resources = xmostest.request_resource("xsim")

    checker = UARTRxChecker("tile[0]:XS1_PORT_1A", "tile[0]:XS1_PORT_1B",
                            Parity[parity], baud, 1, 8, range(128))
    tester = xmostest.ComparisonTester(open('test_rx_large_uart.expect'),
                                       "lib_uart",
                                       "sim_regression",
                                       "rx_large",
                                       myenv,
                                       regexp=True)

    # This test takes some time, nightly only
    tester.set_min_testlevel('nightly')

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_rx_large/bin/smoke/app_uart_test_rx_large_smoke.xe',
        simthreads=[checker],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -ports -o trace.vcd"],
        clean_before_build=True,
        build_env=myenv)
Exemplo n.º 9
0
def do_test(baud):
    myenv = {'baud': baud}
    path = "app_uart_test_half_duplex_rx"
    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)

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

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

    xmostest.run_on_simulator(
        resources['xsim'],
        'app_uart_test_half_duplex_rx/bin/smoke/app_uart_test_half_duplex_rx_smoke.xe',
        simthreads=[rx_checker],
        xscope_io=True,
        tester=tester,
        simargs=["--vcd-tracing", "-tile tile[0] -ports -o trace.vcd"],
        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)