From 2c58523f170ffa19b216b94a81329ae1da8450f8 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Tue, 31 Oct 2023 12:12:26 +0000 Subject: [PATCH 1/2] Added a runtime check for RPC being set up for I2S Slave case --- modules/drivers/i2s/api/rtos_i2s.h | 3 ++- modules/drivers/i2s/src/rtos_i2s.c | 3 +++ modules/drivers/i2s/src/rtos_i2s_rpc.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/drivers/i2s/api/rtos_i2s.h b/modules/drivers/i2s/api/rtos_i2s.h index 18d2d31d3..9c25247e2 100644 --- a/modules/drivers/i2s/api/rtos_i2s.h +++ b/modules/drivers/i2s/api/rtos_i2s.h @@ -10,7 +10,7 @@ * The public API for using the RTOS I2S driver. * @{ */ - +#include #include #include #include "i2s.h" @@ -148,6 +148,7 @@ struct rtos_i2s_struct{ volatile size_t required_available_count; } recv_buffer; uint8_t isr_cmd; + bool is_slave; }; #include "rtos_i2s_rpc.h" diff --git a/modules/drivers/i2s/src/rtos_i2s.c b/modules/drivers/i2s/src/rtos_i2s.c index 852e808e5..c09fccbc3 100644 --- a/modules/drivers/i2s/src/rtos_i2s.c +++ b/modules/drivers/i2s/src/rtos_i2s.c @@ -397,6 +397,7 @@ static void rtos_i2s_init( ctx->rpc_config = NULL; ctx->rx = i2s_local_rx; ctx->tx = i2s_local_tx; + ctx->is_slave = false; triggerable_setup_interrupt_callback(ctx->c_i2s_isr.end_b, ctx, RTOS_INTERRUPT_CALLBACK(rtos_i2s_isr)); @@ -490,4 +491,6 @@ void rtos_i2s_slave_init( bclk, (rtos_osal_entry_function_t) i2s_slave_thread, RTOS_THREAD_STACK_SIZE(i2s_slave_thread)); + + i2s_ctx->is_slave = true; } diff --git a/modules/drivers/i2s/src/rtos_i2s_rpc.c b/modules/drivers/i2s/src/rtos_i2s_rpc.c index d7176b7f0..48b115060 100644 --- a/modules/drivers/i2s/src/rtos_i2s_rpc.c +++ b/modules/drivers/i2s/src/rtos_i2s_rpc.c @@ -231,6 +231,8 @@ void rtos_i2s_rpc_host_init( rtos_intertile_t *client_intertile_ctx[], size_t remote_client_count) { + xassert(i2s_ctx->is_slave == false); + i2s_ctx->rpc_config = rpc_config; rpc_config->rpc_host_start = i2s_rpc_start; rpc_config->remote_client_count = remote_client_count; From dd7889288f3d69b609dee633717e304e3daa9e37 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Tue, 31 Oct 2023 12:32:42 +0000 Subject: [PATCH 2/2] Changelog update --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8914c8950..443b075e0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ RTOS Framework change log avoid warnings when configNUM_CORES is set to 1. * UPDATED: Tested against fwk_io v3.3.0 updated from v3.0.1 * UPDATED: Tested against fwk_core v1.0.2 updated from v1.0.0 + * ADDED: Runtime check for I2S RPC functions called for I2S Slave 3.0.4 -----