Skip to content

Commit

Permalink
Merge pull request #211 from shuchitak/feature/i2s_slave_rpc_assert
Browse files Browse the repository at this point in the history
Added a runtime check for RPC being set up for I2S Slave case
  • Loading branch information
shuchitak authored Oct 31, 2023
2 parents 8bc813f + dd78892 commit 524d1fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
3 changes: 2 additions & 1 deletion modules/drivers/i2s/api/rtos_i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* The public API for using the RTOS I2S driver.
* @{
*/

#include <stdbool.h>
#include <xcore/clock.h>
#include <xcore/port.h>
#include "i2s.h"
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions modules/drivers/i2s/src/rtos_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions modules/drivers/i2s/src/rtos_i2s_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 524d1fc

Please sign in to comment.