Skip to content

Commit cd54a44

Browse files
doki-nordiclstnl
authored andcommitted
Check unbound in icmsg sample
1 parent 6d394fb commit cd54a44

File tree

2 files changed

+29
-3
lines changed
  • samples/subsys/ipc/ipc_service/icmsg

2 files changed

+29
-3
lines changed

samples/subsys/ipc/ipc_service/icmsg/remote/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,11 @@ int main(void)
161161
LOG_INF("Received %zu [Bytes] in total", received);
162162
LOG_INF("IPC-service REMOTE demo ended");
163163

164+
#if defined(CONFIG_MULTITHREADING)
165+
while (1) {
166+
LOG_INF("Alive");
167+
k_msleep(2000);
168+
}
169+
#endif
164170
return 0;
165171
}

samples/subsys/ipc/ipc_service/icmsg/src/main.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ static void ep_bound(void *priv)
4040
LOG_INF("Ep bounded");
4141
}
4242

43+
static void ep_unbound(void *priv)
44+
{
45+
LOG_INF("Ep unbounded");
46+
}
47+
4348
static void ep_recv(const void *data, size_t len, void *priv)
4449
{
4550
#if defined(CONFIG_ASSERT)
@@ -68,6 +73,11 @@ static void ep_recv(const void *data, size_t len, void *priv)
6873
}
6974
}
7075

76+
static void ep_error(const char *message, void *priv)
77+
{
78+
LOG_ERR("ICMsg error: %s", message);
79+
}
80+
7181
static int send_for_time(struct ipc_ept *ep, const int64_t sending_time_ms)
7282
{
7383
struct data_packet msg = {.data[0] = 'a'};
@@ -122,8 +132,10 @@ static int send_for_time(struct ipc_ept *ep, const int64_t sending_time_ms)
122132

123133
static struct ipc_ept_cfg ep_cfg = {
124134
.cb = {
125-
.bound = ep_bound,
135+
.bound = ep_bound,
136+
.unbound = ep_unbound,
126137
.received = ep_recv,
138+
.error = ep_error,
127139
},
128140
};
129141

@@ -137,7 +149,7 @@ int main(void)
137149

138150
#if defined(CONFIG_SOC_NRF5340_CPUAPP)
139151
LOG_INF("Run network core");
140-
nrf53_cpunet_enable(true);
152+
//nrf53_cpunet_enable(true); printk("sample");
141153
#endif
142154

143155
ipc0_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0));
@@ -180,6 +192,14 @@ int main(void)
180192
LOG_INF("Stop network core");
181193
nrf53_cpunet_enable(false);
182194

195+
LOG_INF("Run network core");
196+
nrf53_cpunet_enable(true); printk("sample 2");
197+
198+
k_msleep(500);
199+
200+
LOG_INF("Stop network core");
201+
nrf53_cpunet_enable(false);
202+
183203
LOG_INF("Reset IPC service");
184204

185205
ret = ipc_service_deregister_endpoint(&ep);
@@ -206,7 +226,7 @@ int main(void)
206226
}
207227

208228
LOG_INF("Run network core");
209-
nrf53_cpunet_enable(true);
229+
nrf53_cpunet_enable(true); printk("sample 2");
210230

211231
k_sem_take(&bound_sem, K_FOREVER);
212232

0 commit comments

Comments
 (0)