Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <nrf_rpc/rpc_utils/dev_info.h>
#include <nrf_rpc/rpc_utils/remote_shell.h>
#include <nrf_rpc/rpc_utils/system_health.h>
#include <nrf_rpc.h>

#if defined(CONFIG_NRF_RPC_UTILS_DEV_INFO)
static int remote_version_cmd(const struct shell *sh, size_t argc, char *argv[])
Expand Down Expand Up @@ -118,6 +119,30 @@ static int cmd_system_health(const struct shell *sh, size_t argc, char *argv[])
}
#endif /* CONFIG_NRF_RPC_UTILS_SYSTEM_HEALTH */

static int cmd_rpc(const struct shell *sh, size_t argc, char *argv[])
{
static bool enabled = true;
int err = 0;

if (argc > 1) {
bool enable = shell_strtobool(argv[1], 10, &err);

if (err == 0) {
if (enable) {
nrf_rpc_resume();
} else {
nrf_rpc_stop(true);
}

enabled = enable;
}
}

shell_print(sh, "RPC is: %s", enabled ? "Enabled" : "Disabled");

return err;
}

SHELL_STATIC_SUBCMD_SET_CREATE(
util_cmds,
#if defined(CONFIG_NRF_RPC_UTILS_DEV_INFO)
Expand All @@ -134,6 +159,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
#if defined(CONFIG_NRF_RPC_UTILS_SYSTEM_HEALTH)
SHELL_CMD_ARG(system_health, NULL, "Get system health", cmd_system_health, 0, 0),
#endif
SHELL_CMD_ARG(control, NULL, "Control RPC subsystem ", cmd_rpc, 2, 0),
SHELL_SUBCMD_SET_END);

SHELL_CMD_ARG_REGISTER(rpc, &util_cmds, "nRF RPC utility commands", NULL, 1, 0);
13 changes: 12 additions & 1 deletion subsys/nrf_rpc/nrf_rpc_cbkproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdint.h>

#include <zephyr/kernel.h>

#include <nrf_rpc.h>
#include <nrf_rpc/nrf_rpc_cbkproxy.h>

static K_MUTEX_DEFINE(mutex);
Expand Down Expand Up @@ -141,16 +141,27 @@ static struct

static uint32_t next_free_in_slot;

static void nrf_rpc_cbproxy_clear(void *context)
{
k_mutex_lock(&mutex, K_FOREVER);
memset(in_slots, 0, sizeof(in_slots));
next_free_in_slot = 0;
k_mutex_unlock(&mutex);
}

int nrf_rpc_cbkproxy_in_set(void *callback)
{
int index = 0;
uint16_t *attach_to = NULL;
uintptr_t callback_int = (uintptr_t)callback;
static struct nrf_rpc_cleanup_handler cleanup_handler;

k_mutex_lock(&mutex, K_FOREVER);

if (next_free_in_slot == 0) {
attach_to = &in_slots[0].lt;
cleanup_handler.handler = nrf_rpc_cbproxy_clear;
nrf_rpc_register_cleanup_handler(&cleanup_handler);
} else {
do {
if (callback_int == in_slots[index].callback) {
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ manifest:
- name: nrfxlib
repo-path: sdk-nrfxlib
path: nrfxlib
revision: 1d88c4484f24820c7cad542916080f409db9257d
revision: 545ef5d19d2e1d1d7a9d4e0cf238c5164dfaac14
- name: trusted-firmware-m
repo-path: sdk-trusted-firmware-m
path: modules/tee/tf-m/trusted-firmware-m
Expand Down
Loading