add libs
This commit is contained in:
74
lib_gpio/tests/gpio_basic_checker.py
Normal file
74
lib_gpio/tests/gpio_basic_checker.py
Normal file
@@ -0,0 +1,74 @@
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
|
||||
class GPIOBasicChecker(xmostest.SimThread):
|
||||
"""
|
||||
This simulator thread will read and write to pins.
|
||||
"""
|
||||
|
||||
def __init__(self, mode, test_port, expected_test_port_data, num_clients,
|
||||
trigger_port = None):
|
||||
self._mode = mode
|
||||
if self._mode != 'input' and self._mode != 'output':
|
||||
print("ERROR: Checker initialised in unsupported mode %s" %
|
||||
(self._mode))
|
||||
self._test_port = test_port
|
||||
self._expected_test_port_data = expected_test_port_data
|
||||
self._num_clients = num_clients
|
||||
self._trigger_port = trigger_port
|
||||
|
||||
print("Checking %s on port %s with %d clients" % (self._mode,
|
||||
self._test_port, self._num_clients))
|
||||
if self._trigger_port != None:
|
||||
print("Using port %s as trigger" % (self._trigger_port))
|
||||
|
||||
def drive_port(self, xsi):
|
||||
# Check the xCORE is not trying to drive the port
|
||||
if xsi.is_port_driving(self._test_port):
|
||||
print("ERROR: xCORE driving port %s which expected to be input only"
|
||||
% (self._test_port))
|
||||
# Drive the port
|
||||
xsi.drive_port_pins(self._test_port, self._expected_test_port_data)
|
||||
print("Checker driving port")
|
||||
|
||||
def read_port(self, xsi):
|
||||
pin_values = []
|
||||
for client in range(0, self._num_clients):
|
||||
pin_values.append(-1)
|
||||
|
||||
correct_pin_count = 0
|
||||
while (correct_pin_count < self._num_clients):
|
||||
# Wait for the xCORE to drive the port
|
||||
self.wait_for_port_pins_change([self._test_port])
|
||||
port_data = xsi.sample_port_pins(self._test_port)
|
||||
for client in range(0, self._num_clients):
|
||||
# Check for the updated pin
|
||||
pin_data = ((port_data >> client) & 1)
|
||||
if pin_values[client] == -1:
|
||||
# Not yet seen the correct pin data yet
|
||||
if pin_data == ((self._expected_test_port_data >>
|
||||
client) & 1):
|
||||
pin_values[client] = pin_data
|
||||
correct_pin_count +=1
|
||||
print("Checker has seen correct value on pin %d " %
|
||||
(client))
|
||||
else: # Check valid pin data has not been overwritten
|
||||
if pin_values[client] != ((self._expected_test_port_data >>
|
||||
client) & 1):
|
||||
print("ERROR: Data on pin %d changed unexpected" %
|
||||
(client))
|
||||
print("Checker has seen all pins change")
|
||||
|
||||
# Drive trigger port to allow xCORE program to terminate
|
||||
xsi.drive_port_pins(self._trigger_port, 1)
|
||||
print("Checker driving termination trigger")
|
||||
|
||||
def run(self):
|
||||
if self._mode == 'input':
|
||||
# xCORE testing 'input' functionality means checker must drive port
|
||||
self.drive_port(self.xsi)
|
||||
elif self._mode == 'output':
|
||||
# xCORE testing 'output' functionality means checker must read port
|
||||
self.read_port(self.xsi)
|
||||
print("Checker complete")
|
||||
49
lib_gpio/tests/gpio_events_checker.py
Normal file
49
lib_gpio/tests/gpio_events_checker.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
|
||||
class GPIOEventsChecker(xmostest.SimThread):
|
||||
"""
|
||||
This simulator thread will write to pins to allow xCORE to event.
|
||||
"""
|
||||
|
||||
def __init__(self, test_port, expected_test_port_data, num_clients,
|
||||
trigger_port):
|
||||
self._test_port = test_port
|
||||
self._expected_test_port_data = expected_test_port_data
|
||||
self._num_clients = num_clients
|
||||
self._trigger_port = trigger_port
|
||||
|
||||
print("Checking events on port %s with %d clients" % (self._test_port,
|
||||
self._num_clients))
|
||||
print("Using port %s as trigger" % (self._trigger_port))
|
||||
|
||||
def drive_port(self, xsi):
|
||||
# Check the xCORE is not trying to drive the port
|
||||
if xsi.is_port_driving(self._test_port):
|
||||
print("ERROR: xCORE driving port %s which expected to be input only"
|
||||
% (self._test_port))
|
||||
# Drive the test port
|
||||
xsi.drive_port_pins(self._test_port, self._expected_test_port_data)
|
||||
print("Checker driving port")
|
||||
# Flip bits of expected data for second part of test
|
||||
self._expected_test_port_data = ~self._expected_test_port_data
|
||||
# Delay driving new data to test port until num_client bits of
|
||||
# trigger_port go high
|
||||
expected_trigger_data = 0
|
||||
for i in range(0, self._num_clients):
|
||||
expected_trigger_data = (expected_trigger_data << 1) + 1
|
||||
print("Checker expecting 0x%x as trigger data" % (expected_trigger_data))
|
||||
while True:
|
||||
self.wait_for_port_pins_change([self._trigger_port])
|
||||
trigger_data = xsi.sample_port_pins(self._trigger_port)
|
||||
if trigger_data == expected_trigger_data:
|
||||
print("Checker received correct trigger")
|
||||
break
|
||||
# Drive the test port
|
||||
xsi.drive_port_pins(self._test_port, self._expected_test_port_data)
|
||||
print("Checker driving port")
|
||||
|
||||
def run(self):
|
||||
self.drive_port(self.xsi)
|
||||
print("Checker complete")
|
||||
36
lib_gpio/tests/gpio_input_1bit_test/Makefile
Normal file
36
lib_gpio/tests/gpio_input_1bit_test/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
# The TARGET variable determines what target system the application is
|
||||
# compiled for. It either refers to an XN file in the source directories
|
||||
# or a valid argument for the --target option when compiling.
|
||||
|
||||
TARGET = SLICEKIT-L16
|
||||
|
||||
# The APP_NAME variable determines the name of the final .xe file. It should
|
||||
# not include the .xe postfix. If left blank the name will default to
|
||||
# the project name
|
||||
|
||||
APP_NAME =
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
# You can also set the following to override flags for a particular language:
|
||||
#
|
||||
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
|
||||
#
|
||||
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
|
||||
# xcc for the final link (mapping) stage.
|
||||
|
||||
COMMON_FLAGS = -O2 -g -save-temps -DDEBUG_PRINT_ENABLE=1 -report
|
||||
|
||||
XCC_FLAGS_input_basic = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=0
|
||||
XCC_FLAGS_input_events = $(COMMON_FLAGS) -DEVENTS=1 -DTIMESTAMPS=0
|
||||
XCC_FLAGS_input_timestamps = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=1
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application.
|
||||
|
||||
USED_MODULES = lib_gpio lib_logging
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
105
lib_gpio/tests/gpio_input_1bit_test/src/main.xc
Normal file
105
lib_gpio/tests/gpio_input_1bit_test/src/main.xc
Normal file
@@ -0,0 +1,105 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <gpio.h>
|
||||
#include <xs1.h>
|
||||
#include <timer.h>
|
||||
#include <syscall.h>
|
||||
#include "debug_print.h"
|
||||
|
||||
#define NUM_TEST_EVENTS (2)
|
||||
#define TIMESTAMP_TEST_DELAY_MICROSECONDS (5)
|
||||
#define TIMESTAMP_TEST_DELAY_CLOCKS (TIMESTAMP_TEST_DELAY_MICROSECONDS * XS1_TIMER_MHZ)
|
||||
#define TIMESTAMP_TEST_DELAY_SLACK_CLOCKS (100)
|
||||
|
||||
port input_port = XS1_PORT_1A;
|
||||
port trigger_port = XS1_PORT_4B;
|
||||
|
||||
void read_port_on_event(client input_gpio_if input_port) {
|
||||
unsigned int completed_events = 0;
|
||||
unsigned int expected_value = 1;
|
||||
|
||||
/* Setup event that should trigger immediately */
|
||||
input_port.event_when_pins_eq(expected_value);
|
||||
debug_printf("xCORE setup pins eq event\n");
|
||||
|
||||
while (1) {
|
||||
select {
|
||||
case input_port.event():
|
||||
debug_printf("xCORE got input port event\n");
|
||||
completed_events++;
|
||||
// Read value on pin to make sure it's correct
|
||||
unsigned int pin_data = input_port.input();
|
||||
if (pin_data != expected_value) {
|
||||
debug_printf("ERROR: Data 0x%x read does not match expected data 0x%x\n",
|
||||
pin_data, expected_value);
|
||||
}
|
||||
|
||||
if (completed_events < NUM_TEST_EVENTS) {
|
||||
/* Setup event that should trigger later */
|
||||
// Flip expected_value each iteration of test
|
||||
expected_value = !expected_value;
|
||||
input_port.event_when_pins_eq(expected_value);
|
||||
debug_printf("xCORE setup pins eq event\n");
|
||||
// Trigger simulator to output new expected_value
|
||||
debug_printf("xCORE driving trigger port\n");
|
||||
trigger_port <: 1;
|
||||
} else {
|
||||
_exit(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void read_port(client input_gpio_if input_port) {
|
||||
unsigned int pin_data;
|
||||
unsigned int expected_value = 1;
|
||||
|
||||
if (TIMESTAMPS) {
|
||||
gpio_time_t ts1, ts2;
|
||||
pin_data = input_port.input_and_timestamp(ts1);
|
||||
// Wait known time before second input with timestamp
|
||||
delay_microseconds(TIMESTAMP_TEST_DELAY_MICROSECONDS);
|
||||
input_port.input_and_timestamp(ts2);
|
||||
// Check that the second ts is a later time than the first
|
||||
if (porttimeafter(ts1, ts2)) {
|
||||
debug_printf("ERROR: Second timestamp (%d) read appears to be earlier than first (%d)\n",
|
||||
ts2, ts1);
|
||||
}
|
||||
// Sanity check difference between timestamps
|
||||
if ((ts2 - ts1) <
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS - TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) read smaller than expected\n",
|
||||
ts1, ts2);
|
||||
}
|
||||
if ((ts2 - ts1) >
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS + TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) read larger than expected\n",
|
||||
ts1, ts2);
|
||||
}
|
||||
} else {
|
||||
pin_data = input_port.input();
|
||||
}
|
||||
|
||||
if (pin_data != expected_value) {
|
||||
debug_printf("ERROR: Data 0x%x read does not match expected data 0x%x\n",
|
||||
pin_data, expected_value);
|
||||
} else {
|
||||
debug_printf("xCORE input data correctly\n");
|
||||
}
|
||||
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
interface input_gpio_if i_input_port;
|
||||
par {
|
||||
input_gpio_1bit_with_events(i_input_port, input_port);
|
||||
#if EVENTS
|
||||
read_port_on_event(i_input_port);
|
||||
#else
|
||||
read_port(i_input_port);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
14
lib_gpio/tests/gpio_input_1bit_test/wscript
Normal file
14
lib_gpio/tests/gpio_input_1bit_test/wscript
Normal file
@@ -0,0 +1,14 @@
|
||||
def options(opt):
|
||||
opt.load('xwaf.xcommon')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('xwaf.xcommon')
|
||||
|
||||
def build(bld):
|
||||
bld.do_xcommon()
|
||||
|
||||
def dist(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
40
lib_gpio/tests/gpio_input_basic_test/Makefile
Normal file
40
lib_gpio/tests/gpio_input_basic_test/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
# The TARGET variable determines what target system the application is
|
||||
# compiled for. It either refers to an XN file in the source directories
|
||||
# or a valid argument for the --target option when compiling.
|
||||
|
||||
TARGET = SLICEKIT-L16
|
||||
|
||||
# The APP_NAME variable determines the name of the final .xe file. It should
|
||||
# not include the .xe postfix. If left blank the name will default to
|
||||
# the project name
|
||||
|
||||
APP_NAME =
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
# You can also set the following to override flags for a particular language:
|
||||
#
|
||||
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
|
||||
#
|
||||
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
|
||||
# xcc for the final link (mapping) stage.
|
||||
|
||||
COMMON_FLAGS = -O2 -g -save-temps -DDEBUG_PRINT_ENABLE=1 -report
|
||||
|
||||
XCC_FLAGS_input_basic = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=0 -DCROSSTILE=0
|
||||
XCC_FLAGS_input_events = $(COMMON_FLAGS) -DEVENTS=1 -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=0 -DCROSSTILE=0
|
||||
XCC_FLAGS_input_timestamps = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=1 -DSUPPLY_PIN_MAP=0 -DCROSSTILE=0
|
||||
XCC_FLAGS_input_events_timestamps = $(COMMON_FLAGS) -DEVENTS=1 -DTIMESTAMPS=1 -DSUPPLY_PIN_MAP=0 -DCROSSTILE=0
|
||||
XCC_FLAGS_input_supply_pin_map = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=1 -DCROSSTILE=0
|
||||
XCC_FLAGS_input_crosstile = $(COMMON_FLAGS) -DEVENTS=0 -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=0 -DCROSSTILE=1
|
||||
XCC_FLAGS_input_events_timestamps_supply_pin_map_crosstile = $(COMMON_FLAGS) -DEVENTS=1 -DTIMESTAMPS=1 -DSUPPLY_PIN_MAP=1 -DCROSSTILE=1
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application.
|
||||
|
||||
USED_MODULES = lib_gpio lib_logging
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
85
lib_gpio/tests/gpio_input_basic_test/src/main.xc
Normal file
85
lib_gpio/tests/gpio_input_basic_test/src/main.xc
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <gpio.h>
|
||||
#include <xs1.h>
|
||||
#include <timer.h>
|
||||
#include <syscall.h>
|
||||
#include <platform.h>
|
||||
#include "debug_print.h"
|
||||
|
||||
#ifndef CROSSTILE
|
||||
#define CROSSTILE 0
|
||||
#endif
|
||||
|
||||
#define NUM_CLIENTS (4)
|
||||
#define TIMESTAMP_TEST_DELAY_MICROSECONDS (5)
|
||||
#define TIMESTAMP_TEST_DELAY_CLOCKS (TIMESTAMP_TEST_DELAY_MICROSECONDS * XS1_TIMER_MHZ)
|
||||
#define TIMESTAMP_TEST_DELAY_SLACK_CLOCKS (100 + CROSSTILE?100:0)
|
||||
|
||||
on tile[0] : port input_port = XS1_PORT_4D;
|
||||
|
||||
void read_port(client input_gpio_if input_port, unsigned int client_num) {
|
||||
unsigned int pin_data;
|
||||
unsigned int expected_value = (client_num & 1);
|
||||
if (SUPPLY_PIN_MAP) {
|
||||
expected_value = !expected_value;
|
||||
}
|
||||
|
||||
if (TIMESTAMPS) {
|
||||
gpio_time_t ts1, ts2;
|
||||
pin_data = input_port.input_and_timestamp(ts1);
|
||||
// Wait known time before second input with timestamp
|
||||
delay_microseconds(TIMESTAMP_TEST_DELAY_MICROSECONDS);
|
||||
input_port.input_and_timestamp(ts2);
|
||||
// Check that the second ts is a later time than the first
|
||||
if (porttimeafter(ts1, ts2)) {
|
||||
debug_printf("ERROR: Second timestamp (%d) read by client %d appears to be earlier than first (%d)\n",
|
||||
ts2, client_num, ts1);
|
||||
}
|
||||
// Sanity check difference between timestamps
|
||||
if ((ts2 - ts1) <
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS - TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) read by client %d smaller than expected\n",
|
||||
ts1, ts2, client_num);
|
||||
}
|
||||
if ((ts2 - ts1) >
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS + TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) read by client %d larger than expected\n",
|
||||
ts1, ts2, client_num);
|
||||
}
|
||||
} else {
|
||||
pin_data = input_port.input();
|
||||
}
|
||||
|
||||
if (pin_data != expected_value) {
|
||||
debug_printf("ERROR: Data 0x%x read by client %d does not match expected data 0x%x\n",
|
||||
pin_data, client_num, expected_value);
|
||||
} else {
|
||||
debug_printf("xCORE client %d input data correctly\n", client_num);
|
||||
}
|
||||
|
||||
// Allow other cores to complete
|
||||
delay_microseconds(5);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
#if SUPPLY_PIN_MAP
|
||||
static char pin_map[NUM_CLIENTS] = {1, 0, 3, 2};
|
||||
#else
|
||||
#define pin_map null
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
interface input_gpio_if i_input_port[NUM_CLIENTS];
|
||||
par {
|
||||
#if EVENTS
|
||||
on tile[0] : input_gpio_with_events(i_input_port, NUM_CLIENTS, input_port, pin_map);
|
||||
#else
|
||||
on tile[0] : input_gpio(i_input_port, NUM_CLIENTS, input_port, pin_map);
|
||||
#endif
|
||||
par (int i = 0; i < NUM_CLIENTS; i++) {
|
||||
on tile[CROSSTILE?i%2:0] : read_port(i_input_port[i], i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
14
lib_gpio/tests/gpio_input_basic_test/wscript
Normal file
14
lib_gpio/tests/gpio_input_basic_test/wscript
Normal file
@@ -0,0 +1,14 @@
|
||||
def options(opt):
|
||||
opt.load('xwaf.xcommon')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('xwaf.xcommon')
|
||||
|
||||
def build(bld):
|
||||
bld.do_xcommon()
|
||||
|
||||
def dist(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
35
lib_gpio/tests/gpio_input_events_test/Makefile
Normal file
35
lib_gpio/tests/gpio_input_events_test/Makefile
Normal file
@@ -0,0 +1,35 @@
|
||||
# The TARGET variable determines what target system the application is
|
||||
# compiled for. It either refers to an XN file in the source directories
|
||||
# or a valid argument for the --target option when compiling.
|
||||
|
||||
TARGET = SLICEKIT-L16
|
||||
|
||||
# The APP_NAME variable determines the name of the final .xe file. It should
|
||||
# not include the .xe postfix. If left blank the name will default to
|
||||
# the project name
|
||||
|
||||
APP_NAME =
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
# You can also set the following to override flags for a particular language:
|
||||
#
|
||||
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
|
||||
#
|
||||
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
|
||||
# xcc for the final link (mapping) stage.
|
||||
|
||||
COMMON_FLAGS = -O2 -g -save-temps -DDEBUG_PRINT_ENABLE=1 -report -DXASSERT_ENABLE_ASSERTIONS=1 -DXASSERT_ENABLE_DEBUG=1
|
||||
|
||||
XCC_FLAGS_input_basic = $(COMMON_FLAGS) -DEVENTS=0
|
||||
XCC_FLAGS_input_events = $(COMMON_FLAGS) -DEVENTS=1
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application.
|
||||
|
||||
USED_MODULES = lib_gpio lib_logging
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
70
lib_gpio/tests/gpio_input_events_test/src/main.xc
Normal file
70
lib_gpio/tests/gpio_input_events_test/src/main.xc
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <gpio.h>
|
||||
#include <xs1.h>
|
||||
#include <timer.h>
|
||||
#include <syscall.h>
|
||||
#include "debug_print.h"
|
||||
|
||||
#define NUM_CLIENTS (4)
|
||||
#define NUM_TEST_EVENTS (2)
|
||||
|
||||
port input_port = XS1_PORT_4D;
|
||||
port trigger_port = XS1_PORT_4B;
|
||||
|
||||
void read_port_on_event(client input_gpio_if input_port, unsigned int client_num,
|
||||
client output_gpio_if trigger_port) {
|
||||
unsigned int completed_events = 0;
|
||||
unsigned int expected_value = (client_num & 1);
|
||||
|
||||
/* Setup event that should trigger immediately */
|
||||
input_port.event_when_pins_eq(expected_value);
|
||||
debug_printf("xCORE client %d setup pins eq event\n", client_num);
|
||||
|
||||
while (1) {
|
||||
select {
|
||||
case input_port.event():
|
||||
debug_printf("xCORE client %d got input port event\n", client_num);
|
||||
completed_events++;
|
||||
// Read value on pin to make sure it's correct
|
||||
unsigned int pin_data = input_port.input();
|
||||
if (pin_data != expected_value) {
|
||||
debug_printf("ERROR: Data 0x%x read by client %d does not match expected data 0x%x\n",
|
||||
pin_data, client_num, expected_value);
|
||||
}
|
||||
|
||||
if (completed_events < NUM_TEST_EVENTS) {
|
||||
/* Setup event that should trigger later */
|
||||
// Flip expected_value each iteration of test
|
||||
expected_value = !expected_value;
|
||||
input_port.event_when_pins_eq(expected_value);
|
||||
debug_printf("xCORE client %d setup pins eq event\n", client_num);
|
||||
// Trigger simulator to output new expected_value
|
||||
debug_printf("xCORE client %d driving trigger port\n", client_num);
|
||||
trigger_port.output(1);
|
||||
} else {
|
||||
// Allow other cores to complete
|
||||
delay_microseconds(5);
|
||||
_exit(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
interface input_gpio_if i_input_port[NUM_CLIENTS];
|
||||
interface output_gpio_if i_trigger_port[NUM_CLIENTS];
|
||||
par {
|
||||
#if EVENTS
|
||||
input_gpio_with_events(i_input_port, NUM_CLIENTS, input_port, null);
|
||||
#else
|
||||
input_gpio(i_input_port, NUM_CLIENTS, input_port, null);
|
||||
#endif
|
||||
output_gpio(i_trigger_port, NUM_CLIENTS, trigger_port, null);
|
||||
par (int i = 0; i < NUM_CLIENTS; i++) {
|
||||
read_port_on_event(i_input_port[i], i, i_trigger_port[i]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
14
lib_gpio/tests/gpio_input_events_test/wscript
Normal file
14
lib_gpio/tests/gpio_input_events_test/wscript
Normal file
@@ -0,0 +1,14 @@
|
||||
def options(opt):
|
||||
opt.load('xwaf.xcommon')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('xwaf.xcommon')
|
||||
|
||||
def build(bld):
|
||||
bld.do_xcommon()
|
||||
|
||||
def dist(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
36
lib_gpio/tests/gpio_output_test/Makefile
Normal file
36
lib_gpio/tests/gpio_output_test/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
# The TARGET variable determines what target system the application is
|
||||
# compiled for. It either refers to an XN file in the source directories
|
||||
# or a valid argument for the --target option when compiling.
|
||||
|
||||
TARGET = SLICEKIT-L16
|
||||
|
||||
# The APP_NAME variable determines the name of the final .xe file. It should
|
||||
# not include the .xe postfix. If left blank the name will default to
|
||||
# the project name
|
||||
|
||||
APP_NAME =
|
||||
|
||||
# The flags passed to xcc when building the application
|
||||
# You can also set the following to override flags for a particular language:
|
||||
#
|
||||
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
|
||||
#
|
||||
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
|
||||
# xcc for the final link (mapping) stage.
|
||||
|
||||
COMMON_FLAGS = -O2 -g -save-temps -DDEBUG_PRINT_ENABLE=1 -report
|
||||
|
||||
XCC_FLAGS_output_basic = $(COMMON_FLAGS) -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=0
|
||||
XCC_FLAGS_output_timestamps = $(COMMON_FLAGS) -DTIMESTAMPS=1 -DSUPPLY_PIN_MAP=0
|
||||
XCC_FLAGS_output_supply_pin_map = $(COMMON_FLAGS) -DTIMESTAMPS=0 -DSUPPLY_PIN_MAP=1
|
||||
|
||||
# The USED_MODULES variable lists other module used by the application.
|
||||
|
||||
USED_MODULES = lib_gpio lib_logging
|
||||
|
||||
#=============================================================================
|
||||
# The following part of the Makefile includes the common build infrastructure
|
||||
# for compiling XMOS applications. You should not need to edit below here.
|
||||
|
||||
XMOS_MAKE_PATH ?= ../..
|
||||
include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
|
||||
75
lib_gpio/tests/gpio_output_test/src/main.xc
Normal file
75
lib_gpio/tests/gpio_output_test/src/main.xc
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright 2015-2021 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
#include <gpio.h>
|
||||
#include <xs1.h>
|
||||
#include <syscall.h>
|
||||
#include "debug_print.h"
|
||||
|
||||
#define NUM_CLIENTS (4)
|
||||
#define TIMESTAMP_TEST_DELAY_MICROSECONDS (5)
|
||||
#define TIMESTAMP_TEST_DELAY_CLOCKS (TIMESTAMP_TEST_DELAY_MICROSECONDS * XS1_TIMER_MHZ)
|
||||
#define TIMESTAMP_TEST_DELAY_SLACK_CLOCKS (100)
|
||||
|
||||
port output_port = XS1_PORT_4D;
|
||||
port trigger_port = XS1_PORT_4B;
|
||||
|
||||
void wait_for_termination_signal() {
|
||||
debug_printf("xCORE waiting for termination signal\n");
|
||||
select {
|
||||
case trigger_port when pinsneq(0) :> int _:
|
||||
_exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void drive_port(client output_gpio_if output_port, unsigned int client_num) {
|
||||
unsigned int expected_pin_data = (client_num & 1);
|
||||
if (SUPPLY_PIN_MAP) {
|
||||
expected_pin_data = !expected_pin_data;
|
||||
}
|
||||
|
||||
if (TIMESTAMPS) {
|
||||
gpio_time_t ts1, ts2;
|
||||
debug_printf("xCORE client %d driving port\n", client_num);
|
||||
ts1 = output_port.output_and_timestamp(expected_pin_data);
|
||||
// Wait known time before second input with timestamp
|
||||
delay_microseconds(TIMESTAMP_TEST_DELAY_MICROSECONDS);
|
||||
ts2 = output_port.output_and_timestamp(expected_pin_data);
|
||||
// Check that the second ts is a later time than the first
|
||||
if (porttimeafter(ts1, ts2)) {
|
||||
debug_printf("ERROR: Second timestamp (%d) received by client %d appears to be earlier than first (%d)\n",
|
||||
ts2, client_num, ts1);
|
||||
}
|
||||
// Sanity check difference between timestamps
|
||||
if ((ts2 - ts1) <
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS - TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) received by client %d smaller than expected\n",
|
||||
ts1, ts2, client_num);
|
||||
}
|
||||
if ((ts2 - ts1) >
|
||||
(TIMESTAMP_TEST_DELAY_CLOCKS + TIMESTAMP_TEST_DELAY_SLACK_CLOCKS)) {
|
||||
debug_printf("ERROR: Difference between timestamps (%d, %d) received by client %d larger than expected\n",
|
||||
ts1, ts2, client_num);
|
||||
}
|
||||
} else {
|
||||
debug_printf("xCORE client %d driving port\n", client_num);
|
||||
output_port.output(expected_pin_data);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
interface output_gpio_if i_output_port[NUM_CLIENTS];
|
||||
#if SUPPLY_PIN_MAP
|
||||
char pin_map[NUM_CLIENTS] = {1, 0, 3, 2};
|
||||
#else
|
||||
#define pin_map null
|
||||
#endif
|
||||
par {
|
||||
output_gpio(i_output_port, NUM_CLIENTS, output_port, pin_map);
|
||||
par (int i = 0; i < NUM_CLIENTS; i++) {
|
||||
drive_port(i_output_port[i], i);
|
||||
}
|
||||
wait_for_termination_signal();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
14
lib_gpio/tests/gpio_output_test/wscript
Normal file
14
lib_gpio/tests/gpio_output_test/wscript
Normal file
@@ -0,0 +1,14 @@
|
||||
def options(opt):
|
||||
opt.load('xwaf.xcommon')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('xwaf.xcommon')
|
||||
|
||||
def build(bld):
|
||||
bld.do_xcommon()
|
||||
|
||||
def dist(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.load('xwaf.xcommon')
|
||||
3
lib_gpio/tests/input_1bit_basic_test.expected
Normal file
3
lib_gpio/tests/input_1bit_basic_test.expected
Normal file
@@ -0,0 +1,3 @@
|
||||
Checker driving port
|
||||
Checker complete
|
||||
xCORE input data correctly
|
||||
10
lib_gpio/tests/input_1bit_events_test.expected
Normal file
10
lib_gpio/tests/input_1bit_events_test.expected
Normal file
@@ -0,0 +1,10 @@
|
||||
Checker driving port
|
||||
Checker expecting 0x1 as trigger data
|
||||
xCORE setup pins eq event
|
||||
xCORE got input port event
|
||||
xCORE setup pins eq event
|
||||
xCORE driving trigger port
|
||||
Checker received correct trigger
|
||||
Checker driving port
|
||||
Checker complete
|
||||
xCORE got input port event
|
||||
6
lib_gpio/tests/input_basic_test.expected
Normal file
6
lib_gpio/tests/input_basic_test.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
Checker driving port
|
||||
Checker complete
|
||||
xCORE client \d input data correctly
|
||||
xCORE client \d input data correctly
|
||||
xCORE client \d input data correctly
|
||||
xCORE client \d input data correctly
|
||||
3
lib_gpio/tests/input_events_test_basic.expected
Normal file
3
lib_gpio/tests/input_events_test_basic.expected
Normal file
@@ -0,0 +1,3 @@
|
||||
Checker driving port
|
||||
Checker expecting 0x\w as trigger data
|
||||
input_gpio task does not support events.
|
||||
25
lib_gpio/tests/input_events_test_events.expected
Normal file
25
lib_gpio/tests/input_events_test_events.expected
Normal file
@@ -0,0 +1,25 @@
|
||||
Checker driving port
|
||||
Checker expecting 0x\w as trigger data
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d setup pins eq event
|
||||
xCORE client \d driving trigger port
|
||||
xCORE client \d driving trigger port
|
||||
xCORE client \d driving trigger port
|
||||
xCORE client \d driving trigger port
|
||||
Checker received correct trigger
|
||||
Checker driving port
|
||||
Checker complete
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
xCORE client \d got input port event
|
||||
12
lib_gpio/tests/output_supply_pin_map_test.expected
Normal file
12
lib_gpio/tests/output_supply_pin_map_test.expected
Normal file
@@ -0,0 +1,12 @@
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE waiting for termination signal
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen all pins change
|
||||
Checker driving termination trigger
|
||||
Checker complete
|
||||
12
lib_gpio/tests/output_test.expected
Normal file
12
lib_gpio/tests/output_test.expected
Normal file
@@ -0,0 +1,12 @@
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE client \d driving port
|
||||
xCORE waiting for termination signal
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen correct value on pin \d
|
||||
Checker has seen all pins change
|
||||
Checker driving termination trigger
|
||||
Checker complete
|
||||
31
lib_gpio/tests/runtests.py
Normal file
31
lib_gpio/tests/runtests.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
|
||||
if __name__ == "__main__":
|
||||
xmostest.init()
|
||||
|
||||
xmostest.register_group("lib_gpio",
|
||||
"gpio_sim_tests",
|
||||
"GPIO simulator tests",
|
||||
"""
|
||||
Tests are performed by running the GPIO library connected to a simulator model
|
||||
(written as a python plugin to xsim). The simulator model checks that the pins
|
||||
are driven and read by the ports as expected. Tests are run to test the
|
||||
following features:
|
||||
|
||||
* Inputting on a multibit port with multiple clients using the default pin map
|
||||
* Inputting on a multibit port with multiple clients using a specified pin map
|
||||
* Inputting on a 1bit port
|
||||
* Inputting with timestamps
|
||||
* Eventing on a multibit input port
|
||||
* Eventing on a 1bit input port
|
||||
* Outputting on a multibit port with multiple clients using the default pin map
|
||||
* Outputting on a multibit port with multiple clients using a specified pin map
|
||||
* Outputting with timestamps
|
||||
""")
|
||||
|
||||
xmostest.runtests()
|
||||
|
||||
xmostest.finish()
|
||||
36
lib_gpio/tests/test_input_1bit_basic.py
Normal file
36
lib_gpio/tests/test_input_1bit_basic.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
from gpio_basic_checker import GPIOBasicChecker
|
||||
|
||||
def do_input_1bit_basic_test(timestamps):
|
||||
resources = xmostest.request_resource("xsim")
|
||||
|
||||
path = ''
|
||||
if not timestamps:
|
||||
path += '_basic'
|
||||
else:
|
||||
if timestamps:
|
||||
path += '_timestamps'
|
||||
|
||||
binary = 'gpio_input_1bit_test/bin/input' + path + \
|
||||
'/gpio_input_1bit_test_input' + path + '.xe'
|
||||
|
||||
checker = GPIOBasicChecker(mode="input",
|
||||
test_port="tile[0]:XS1_PORT_1A",
|
||||
expected_test_port_data=0b1,
|
||||
num_clients=1)
|
||||
|
||||
tester = xmostest.ComparisonTester(open('input_1bit_basic_test.expected'),
|
||||
'lib_gpio', 'gpio_sim_tests',
|
||||
'input_1bit_basic_test',
|
||||
{'timestamps':timestamps,},
|
||||
regexp=False)
|
||||
|
||||
xmostest.run_on_simulator(resources['xsim'], binary, simthreads = [checker],
|
||||
tester = tester)
|
||||
|
||||
def runtest():
|
||||
do_input_1bit_basic_test(timestamps=False)
|
||||
do_input_1bit_basic_test(timestamps=True)
|
||||
26
lib_gpio/tests/test_input_1bit_events.py
Normal file
26
lib_gpio/tests/test_input_1bit_events.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
from gpio_events_checker import GPIOEventsChecker
|
||||
|
||||
def do_input_1bit_events_test():
|
||||
resources = xmostest.request_resource("xsim")
|
||||
|
||||
binary = 'gpio_input_1bit_test/bin/input_events/gpio_input_1bit_test_input_events.xe'
|
||||
|
||||
checker = GPIOEventsChecker(test_port="tile[0]:XS1_PORT_1A",
|
||||
expected_test_port_data=0b1,
|
||||
num_clients=1,
|
||||
trigger_port="tile[0]:XS1_PORT_4B")
|
||||
|
||||
tester = xmostest.ComparisonTester(open('input_1bit_events_test.expected'),
|
||||
'lib_gpio', 'gpio_sim_tests',
|
||||
'input_1bit_events_test',
|
||||
regexp=False)
|
||||
|
||||
xmostest.run_on_simulator(resources['xsim'], binary, simthreads = [checker],
|
||||
tester = tester)
|
||||
|
||||
def runtest():
|
||||
do_input_1bit_events_test()
|
||||
50
lib_gpio/tests/test_input_basic.py
Normal file
50
lib_gpio/tests/test_input_basic.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
from gpio_basic_checker import GPIOBasicChecker
|
||||
|
||||
def do_input_basic_test(events, timestamps, supply_pin_map, crosstile):
|
||||
resources = xmostest.request_resource("xsim")
|
||||
|
||||
path = ''
|
||||
if not events and not timestamps and not supply_pin_map and not crosstile:
|
||||
path += '_basic'
|
||||
else:
|
||||
if events:
|
||||
path += '_events'
|
||||
if timestamps:
|
||||
path += '_timestamps'
|
||||
if supply_pin_map:
|
||||
path += '_supply_pin_map'
|
||||
if crosstile:
|
||||
path += '_crosstile'
|
||||
|
||||
binary = 'gpio_input_basic_test/bin/input' + path + \
|
||||
'/gpio_input_basic_test_input' + path + '.xe'
|
||||
|
||||
checker = GPIOBasicChecker(mode="input",
|
||||
test_port="tile[0]:XS1_PORT_4D",
|
||||
expected_test_port_data=0b1010,
|
||||
num_clients=4)
|
||||
|
||||
tester = xmostest.ComparisonTester(open('input_basic_test.expected'),
|
||||
'lib_gpio', 'gpio_sim_tests',
|
||||
'input_basic_test',
|
||||
{'events':events,
|
||||
'timestamps':timestamps,
|
||||
'supply_pin_map':supply_pin_map,
|
||||
'crosstile':crosstile},
|
||||
regexp=True)
|
||||
|
||||
xmostest.run_on_simulator(resources['xsim'], binary, simthreads = [checker],
|
||||
tester = tester)
|
||||
|
||||
def runtest():
|
||||
do_input_basic_test(events=False, timestamps=False, supply_pin_map=False, crosstile=False)
|
||||
do_input_basic_test(events=False, timestamps=False, supply_pin_map=True, crosstile=False)
|
||||
do_input_basic_test(events=False, timestamps=True, supply_pin_map=False, crosstile=False)
|
||||
do_input_basic_test(events=True, timestamps=False, supply_pin_map=False, crosstile=False)
|
||||
do_input_basic_test(events=True, timestamps=True, supply_pin_map=False, crosstile=False)
|
||||
do_input_basic_test(events=False, timestamps=False, supply_pin_map=False, crosstile=True)
|
||||
do_input_basic_test(events=True, timestamps=True, supply_pin_map=True, crosstile=True)
|
||||
36
lib_gpio/tests/test_input_events.py
Normal file
36
lib_gpio/tests/test_input_events.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
from gpio_events_checker import GPIOEventsChecker
|
||||
|
||||
def do_input_events_test(events):
|
||||
resources = xmostest.request_resource("xsim")
|
||||
|
||||
path = ''
|
||||
if not events:
|
||||
path += '_basic'
|
||||
else:
|
||||
if events:
|
||||
path += '_events'
|
||||
|
||||
binary = 'gpio_input_events_test/bin/input' + path + \
|
||||
'/gpio_input_events_test_input' + path + '.xe'
|
||||
|
||||
checker = GPIOEventsChecker(test_port="tile[0]:XS1_PORT_4D",
|
||||
expected_test_port_data=0b1010,
|
||||
num_clients=4,
|
||||
trigger_port="tile[0]:XS1_PORT_4B")
|
||||
|
||||
tester = xmostest.ComparisonTester(open('input_events_test%s.expected' % path),
|
||||
'lib_gpio', 'gpio_sim_tests',
|
||||
'input_events_test',
|
||||
{'events':events},
|
||||
regexp=True)
|
||||
|
||||
xmostest.run_on_simulator(resources['xsim'], binary, simthreads = [checker],
|
||||
tester = tester)
|
||||
|
||||
def runtest():
|
||||
do_input_events_test(events=False)
|
||||
do_input_events_test(events=True)
|
||||
45
lib_gpio/tests/test_output.py
Normal file
45
lib_gpio/tests/test_output.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2015-2021 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
import xmostest
|
||||
from gpio_basic_checker import GPIOBasicChecker
|
||||
|
||||
def do_output_test(timestamps, supply_pin_map):
|
||||
resources = xmostest.request_resource("xsim")
|
||||
|
||||
path = ''
|
||||
if not timestamps and not supply_pin_map:
|
||||
path += '_basic'
|
||||
else:
|
||||
if timestamps:
|
||||
path += '_timestamps'
|
||||
if supply_pin_map:
|
||||
path += '_supply_pin_map'
|
||||
|
||||
binary = 'gpio_output_test/bin/output' + path + \
|
||||
'/gpio_output_test_output' + path + '.xe'
|
||||
|
||||
checker = GPIOBasicChecker(mode="output",
|
||||
test_port="tile[0]:XS1_PORT_4D",
|
||||
expected_test_port_data=0b1010,
|
||||
num_clients=4,
|
||||
trigger_port="tile[0]:XS1_PORT_4B")
|
||||
|
||||
if supply_pin_map:
|
||||
expected_result = 'output_supply_pin_map_test.expected'
|
||||
else:
|
||||
expected_result = 'output_test.expected'
|
||||
tester = xmostest.ComparisonTester(open(expected_result),
|
||||
'lib_gpio', 'gpio_sim_tests',
|
||||
'output_test',
|
||||
{'timestamps':timestamps,
|
||||
'supply_pin_map':supply_pin_map},
|
||||
regexp=True)
|
||||
|
||||
xmostest.run_on_simulator(resources['xsim'], binary, simthreads = [checker],
|
||||
tester = tester)
|
||||
|
||||
def runtest():
|
||||
do_output_test(timestamps=False, supply_pin_map=False)
|
||||
do_output_test(timestamps=False, supply_pin_map=True)
|
||||
do_output_test(timestamps=True, supply_pin_map=False)
|
||||
Reference in New Issue
Block a user