diff --git a/modules/rtos b/modules/rtos index 899963db2..bcb58c085 160000 --- a/modules/rtos +++ b/modules/rtos @@ -1 +1 @@ -Subproject commit 899963db24ed7ac403038123dfb5f8e2ea9fdee5 +Subproject commit bcb58c085c39b57ebb77f9f4e58fa4966b6e2b26 diff --git a/test/rtos_drivers/hil/run_tests.sh b/test/rtos_drivers/hil/run_tests.sh index f40a6aa98..ed1c05f58 100755 --- a/test/rtos_drivers/hil/run_tests.sh +++ b/test/rtos_drivers/hil/run_tests.sh @@ -21,14 +21,14 @@ echo "****************" echo "* Run Tests *" echo "****************" if [ "$UNAME" == "Linux" ] ; then - timeout ${TIMEOUT_S}s xrun --xscope ${XCORE_SDK_PATH}/dist/${FIRMWARE} 2>&1 | tee -a ${REPORT} + timeout ${TIMEOUT_S}s xrun --xscope ${XCORE_SDK_ROOT}/dist/${FIRMWARE} 2>&1 | tee -a ${REPORT} elif [ "$UNAME" == "Darwin" ] ; then - gtimeout ${TIMEOUT_S}s xrun --xscope ${XCORE_SDK_PATH}/dist/${FIRMWARE} 2>&1 | tee -a ${REPORT} + gtimeout ${TIMEOUT_S}s xrun --xscope ${XCORE_SDK_ROOT}/dist/${FIRMWARE} 2>&1 | tee -a ${REPORT} fi echo "****************" echo "* Parse Result *" echo "****************" -python ${XCORE_SDK_PATH}/test/rtos_drivers/python/parse_test_output.py testing/test.rpt -outfile="testing/test_results" --print_test_results --verbose +python ${XCORE_SDK_ROOT}/test/rtos_drivers/python/parse_test_output.py testing/test.rpt -outfile="testing/test_results" --print_test_results --verbose pytest diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.c index 8fc836288..daf55577c 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.c @@ -69,12 +69,26 @@ static void i2c_slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *da i2c_printf("SLAVE missing i2c_slave_tx_done callback on test %d", test_ctx->cur_test); } } + +RTOS_I2C_SLAVE_RX_BYTE_CHECK_CALLBACK_ATTR +void i2c_slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + if (test_ctx->slave_rx_check_byte[test_ctx->cur_test] != NULL) + { + I2C_SLAVE_RX_BYTE_CHECK_ATTR i2c_slave_rx_byte_check_cb_t fn; + fn = test_ctx->slave_rx_check_byte[test_ctx->cur_test]; + fn(ctx, app_data, data, cur_status); + } else { + i2c_printf("SLAVE missing slave_rx_check_byte callback on test %d", test_ctx->cur_test); + } +} + #endif /* ON_TILE(1) */ static int run_i2c_tests(i2c_test_ctx_t *test_ctx, chanend_t c) { int retval = 0; - do { sync(c); @@ -116,6 +130,7 @@ static void start_i2c_devices(i2c_test_ctx_t *test_ctx) i2c_slave_rx, i2c_slave_tx_start, i2c_slave_tx_done, + i2c_slave_rx_byte_check, I2C_SLAVE_ISR_CORE, configMAX_PRIORITIES-1); #endif diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.h b/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.h index a8d818f24..c5c2eddd2 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.h +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/i2c_test.h @@ -10,10 +10,11 @@ #define I2C_MAX_TESTS 12 -#define I2C_MAIN_TEST_ATTR __attribute__((fptrgroup("rtos_test_i2c_main_test_fptr_grp"))) -#define I2C_SLAVE_RX_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_rx_fptr_grp"))) -#define I2C_SLAVE_TX_START_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_tx_start_fptr_grp"))) -#define I2C_SLAVE_TX_DONE_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_tx_done_fptr_grp"))) +#define I2C_MAIN_TEST_ATTR __attribute__((fptrgroup("rtos_test_i2c_main_test_fptr_grp"))) +#define I2C_SLAVE_RX_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_rx_fptr_grp"))) +#define I2C_SLAVE_TX_START_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_tx_start_fptr_grp"))) +#define I2C_SLAVE_TX_DONE_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_tx_done_fptr_grp"))) +#define I2C_SLAVE_RX_BYTE_CHECK_ATTR __attribute__((fptrgroup("rtos_test_i2c_slave_rx_byte_check_fptr_grp"))) typedef struct i2c_test_ctx i2c_test_ctx_t; @@ -30,12 +31,14 @@ struct i2c_test_ctx { I2C_SLAVE_RX_ATTR void (*slave_rx[I2C_MAX_TESTS])(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_t len); I2C_SLAVE_TX_START_ATTR size_t (*slave_tx_start[I2C_MAX_TESTS])(rtos_i2c_slave_t *ctx, void *app_data, uint8_t **data); I2C_SLAVE_TX_DONE_ATTR void (*slave_tx_done[I2C_MAX_TESTS])(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_t len); + I2C_SLAVE_RX_BYTE_CHECK_ATTR void (*slave_rx_check_byte[I2C_MAX_TESTS])(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status); }; typedef int (*i2c_main_test_t)(i2c_test_ctx_t *ctx); typedef void (*i2c_slave_rx_t)(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_t len); typedef size_t (*i2c_slave_tx_start_t)(rtos_i2c_slave_t *ctx, void *app_data, uint8_t **data); typedef void (*i2c_slave_tx_done_t)(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_t len); +typedef void (*i2c_slave_rx_byte_check_cb_t)(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status); int i2c_device_tests(rtos_i2c_master_t *i2c_master_ctx, rtos_i2c_slave_t *i2c_slave_ctx, chanend_t c); diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_multiple_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_multiple_test.c index 95f39042a..1e6cde662 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_multiple_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_multiple_test.c @@ -146,6 +146,20 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, test_slave_iters++; } +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_READ_MULTIPLE_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_master_read_multiple_test(i2c_test_ctx_t *test_ctx) @@ -161,6 +175,7 @@ void register_master_read_multiple_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_test.c index 13da10eee..7f9ebb20e 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_read_test.c @@ -127,6 +127,20 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, test_slave_iters++; } +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_READ_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_master_read_test(i2c_test_ctx_t *test_ctx) @@ -142,6 +156,7 @@ void register_master_read_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_read_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_read_test.c index 8d8adc4e8..3f2ffcc61 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_read_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_read_test.c @@ -148,6 +148,11 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, } } +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); +} #endif void register_master_reg_read_test(i2c_test_ctx_t *test_ctx) @@ -163,6 +168,7 @@ void register_master_reg_read_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_write_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_write_test.c index 2a2ab457e..86547b323 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_write_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_reg_write_test.c @@ -111,6 +111,12 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); +} #endif void register_master_reg_write_test(i2c_test_ctx_t *test_ctx) @@ -124,6 +130,7 @@ void register_master_reg_write_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_multiple_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_multiple_test.c index 691904361..db9935254 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_multiple_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_multiple_test.c @@ -130,6 +130,25 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +static int slave_byte_check_iters = 0; +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_WRITE_MULTIPLE_TEST_SIZE; + slave_byte_check++; + if (test_vector[slave_byte_check_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } + if ((slave_byte_check % I2C_MASTER_WRITE_MULTIPLE_TEST_SIZE) == 0) { + slave_byte_check_iters++; + } +} #endif void register_master_write_multiple_test(i2c_test_ctx_t *test_ctx) @@ -143,6 +162,7 @@ void register_master_write_multiple_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_test.c index 6ff1af36a..e16ba3169 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/local/master_write_test.c @@ -107,6 +107,21 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_WRITE_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_master_write_test(i2c_test_ctx_t *test_ctx) @@ -120,6 +135,7 @@ void register_master_write_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(I2C_MASTER_TILE) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_multiple_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_multiple_test.c index d91a335d7..f56074aeb 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_multiple_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_multiple_test.c @@ -146,6 +146,20 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, test_slave_iters++; } +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_READ_MULTIPLE_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_rpc_master_read_multiple_test(i2c_test_ctx_t *test_ctx) @@ -161,6 +175,7 @@ void register_rpc_master_read_multiple_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_test.c index 47de79f41..f5676d049 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_read_test.c @@ -127,6 +127,20 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, test_slave_iters++; } +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_READ_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_rpc_master_read_test(i2c_test_ctx_t *test_ctx) @@ -142,6 +156,7 @@ void register_rpc_master_read_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_read_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_read_test.c index 376803fc1..40cfa4046 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_read_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_read_test.c @@ -148,6 +148,11 @@ static void slave_tx_done(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, } } +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); +} #endif void register_rpc_master_reg_read_test(i2c_test_ctx_t *test_ctx) @@ -163,6 +168,7 @@ void register_rpc_master_reg_read_test(i2c_test_ctx_t *test_ctx) test_ctx->slave_rx[this_test_num] = slave_rx; test_ctx->slave_tx_start[this_test_num] = slave_tx_start; test_ctx->slave_tx_done[this_test_num] = slave_tx_done; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_write_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_write_test.c index e5d0e69be..ca434e908 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_write_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_reg_write_test.c @@ -111,6 +111,12 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); +} #endif void register_rpc_master_reg_write_test(i2c_test_ctx_t *test_ctx) @@ -124,6 +130,7 @@ void register_rpc_master_reg_write_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_multiple_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_multiple_test.c index b28eb51f9..b6c0397a3 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_multiple_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_multiple_test.c @@ -130,6 +130,25 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +static int slave_byte_check_iters = 0; +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_WRITE_MULTIPLE_TEST_SIZE; + slave_byte_check++; + if (test_vector[slave_byte_check_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } + if ((slave_byte_check % I2C_MASTER_WRITE_MULTIPLE_TEST_SIZE) == 0) { + slave_byte_check_iters++; + } +} #endif void register_rpc_master_write_multiple_test(i2c_test_ctx_t *test_ctx) @@ -143,6 +162,7 @@ void register_rpc_master_write_multiple_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0) diff --git a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_test.c b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_test.c index 6cbd3ce8d..32798f9a6 100644 --- a/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_test.c +++ b/test/rtos_drivers/hil/src/individual_tests/i2c/rpc/master_write_test.c @@ -107,6 +107,21 @@ static void slave_rx(rtos_i2c_slave_t *ctx, void *app_data, uint8_t *data, size_ test_slave_iters++; } + +static int slave_byte_check = 0; + +I2C_SLAVE_RX_BYTE_CHECK_ATTR +static void slave_rx_byte_check(rtos_i2c_slave_t *ctx, void *app_data, uint8_t data, i2c_slave_ack_t *cur_status) +{ + i2c_test_ctx_t *test_ctx = (i2c_test_ctx_t*)ctx->app_data; + local_printf("SLAVE rx byte check 0x%x status %d", data, *cur_status); + int i = slave_byte_check % I2C_MASTER_WRITE_TEST_SIZE; + slave_byte_check++; + if (test_vector[test_slave_iters][i] != data) { + local_printf("SLAVE rx byte check failed"); + test_ctx->slave_success[test_ctx->cur_test] = -1; + } +} #endif void register_rpc_master_write_test(i2c_test_ctx_t *test_ctx) @@ -120,6 +135,7 @@ void register_rpc_master_write_test(i2c_test_ctx_t *test_ctx) #if ON_TILE(I2C_SLAVE_TILE) test_ctx->slave_rx[this_test_num] = slave_rx; + test_ctx->slave_rx_check_byte[this_test_num] = slave_rx_byte_check; #endif #if ON_TILE(0)