Skip to content

Commit 4c9c0c8

Browse files
raiden00plxiaoxiang781216
authored andcommitted
debug: add support for IPC (interprocessor communication) debug messages
1 parent db2f204 commit 4c9c0c8

File tree

6 files changed

+68
-19
lines changed

6 files changed

+68
-19
lines changed

Kconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,37 @@ config DEBUG_RESET_INFO
20782078

20792079
endif # DEBUG_RESET
20802080

2081+
config DEBUG_IPC
2082+
bool "IPC (Interprocessor communication) Debug Features"
2083+
default n
2084+
---help---
2085+
Enable IPC debug features.
2086+
2087+
if DEBUG_IPC
2088+
2089+
config DEBUG_IPC_ERROR
2090+
bool "IPC Error Output"
2091+
default n
2092+
depends on DEBUG_ERROR
2093+
---help---
2094+
Enable IPC error output to SYSLOG.
2095+
2096+
config DEBUG_IPC_WARN
2097+
bool "IPC Warnings Output"
2098+
default n
2099+
depends on DEBUG_WARN
2100+
---help---
2101+
Enable IPC warning output to SYSLOG.
2102+
2103+
config DEBUG_IPC_INFO
2104+
bool "IPC Informational Output"
2105+
default n
2106+
depends on DEBUG_INFO
2107+
---help---
2108+
Enable IPC informational output to SYSLOG.
2109+
2110+
endif # DEBUG_IPC
2111+
20812112
endif # DEBUG_FEATURES
20822113

20832114
config ARCH_HAVE_STACKCHECK

arch/arm/src/nrf53/nrf53_ipc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static int nrf53_ipc_interrupt(int irq, void *context, void *args)
7979

8080
regval = getreg32(NRF53_IPC_INTPEND);
8181

82-
_info("IPC interrupt 0x%" PRIx32 "\n", regval);
82+
ipcinfo("IPC interrupt 0x%" PRIx32 "\n", regval);
8383

8484
for (i = 0; i < NRF53_IPC_CHANS; i += 1)
8585
{
@@ -113,7 +113,7 @@ void nrf53_ipc_subscribe(int id, ipc_callback_t callback, void *args)
113113

114114
DEBUGASSERT(id < NRF53_IPC_CHANS);
115115

116-
_info("IPC subscribe %d\n", id);
116+
ipcinfo("IPC subscribe %d\n", id);
117117

118118
/* Register callaback */
119119

@@ -143,7 +143,7 @@ void nrf53_ipc_signal(int id)
143143
{
144144
DEBUGASSERT(id < NRF53_IPC_CHANS);
145145

146-
_info("IPC signal %d\n", id);
146+
ipcinfo("IPC signal %d\n", id);
147147

148148
putreg32(1, NRF53_IPC_TASKS_SEND(id));
149149
}
@@ -156,7 +156,7 @@ void nrf53_ipc_send_cfg(int id)
156156
{
157157
DEBUGASSERT(id < NRF53_IPC_CHANS);
158158

159-
_info("IPC send cfg %d\n", id);
159+
ipcinfo("IPC send cfg %d\n", id);
160160

161161
/* Enable send event on a single IPC channel */
162162

arch/arm/src/nrf53/nrf53_rptun.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static void nrf53_rptun_panic(struct rptun_dev_s *dev)
365365

366366
static void nrf53_ipc_master_callback(int id, void *arg)
367367
{
368-
_info("Rptun IPC master %d\n", id);
368+
ipcinfo("Rptun IPC master %d\n", id);
369369

370370
switch (id)
371371
{
@@ -404,7 +404,7 @@ static void nrf53_rptun_ipc_app(struct nrf53_rptun_dev_s *dev)
404404

405405
static void nrf53_ipc_slave_callback(int id, void *arg)
406406
{
407-
_info("Rptun IPC slave %d\n", id);
407+
ipcinfo("Rptun IPC slave %d\n", id);
408408

409409
switch (id)
410410
{
@@ -516,7 +516,7 @@ int nrf53_rptun_init(const char *shmemname, const char *cpuname)
516516
ret = rptun_initialize(&dev->rptun);
517517
if (ret < 0)
518518
{
519-
_err("ERROR: rptun_initialize failed %d!\n", ret);
519+
ipcerr("ERROR: rptun_initialize failed %d!\n", ret);
520520
goto errout;
521521
}
522522

@@ -526,7 +526,7 @@ int nrf53_rptun_init(const char *shmemname, const char *cpuname)
526526
CONFIG_RPTUN_STACKSIZE, nrf53_rptun_thread, NULL);
527527
if (ret < 0)
528528
{
529-
_err("ERROR: kthread_create failed %d\n", ret);
529+
ipcerr("ERROR: kthread_create failed %d\n", ret);
530530
}
531531

532532
errout:

arch/arm/src/stm32h7/stm32_hsem.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static int stm32_hsem_interrupt(int irq, void *context, void *args)
7474

7575
regval = getreg32(STM32_HSEM_CXMISR(dev->block));
7676

77-
_info("HSEM interrupt 0x%" PRIx32 "\n", regval);
77+
ipcinfo("HSEM interrupt 0x%" PRIx32 "\n", regval);
7878

7979
for (i = 0; i < STM32_HSEM_CHANS; i++)
8080
{
@@ -112,7 +112,7 @@ void stm32_hsem_subscribe(uint8_t id, hsem_callback_t callback, void *args)
112112

113113
DEBUGASSERT(id < STM32_HSEM_CHANS);
114114

115-
_info("HSEM subscribe %d\n", id);
115+
ipcinfo("HSEM subscribe %d\n", id);
116116

117117
/* Register callaback */
118118

@@ -149,7 +149,7 @@ void stm32_hsem_signal(uint8_t id)
149149
{
150150
DEBUGASSERT(id < STM32_HSEM_CHANS);
151151

152-
_info("HSEM signal %d\n", id);
152+
ipcinfo("HSEM signal %d\n", id);
153153

154154
/* Lock semaphore */
155155

@@ -172,7 +172,7 @@ void stm32_hsem_busywait_lock(uint8_t id)
172172
{
173173
DEBUGASSERT(id < STM32_HSEM_CHANS);
174174

175-
_info("HSEM busywait lock %d\n", id);
175+
ipcinfo("HSEM busywait lock %d\n", id);
176176

177177
/* Wait for semaphore lock */
178178

@@ -191,7 +191,7 @@ void stm32_hsem_busywait_free(uint8_t id)
191191
{
192192
DEBUGASSERT(id < STM32_HSEM_CHANS);
193193

194-
_info("HSEM busywait free %d\n", id);
194+
ipcinfo("HSEM busywait free %d\n", id);
195195

196196
/* Wait for semaphore free */
197197

@@ -210,7 +210,7 @@ void stm32_hsem_wait_take(uint8_t id)
210210
{
211211
DEBUGASSERT(id < STM32_HSEM_CHANS);
212212

213-
_info("HSEM wait take %d\n", id);
213+
ipcinfo("HSEM wait take %d\n", id);
214214

215215
stm32_hsem_busywait_free(id);
216216
while (stm32_hsem_take(id) == 0);
@@ -228,7 +228,7 @@ bool stm32_hsem_take(uint8_t id)
228228
{
229229
DEBUGASSERT(id < STM32_HSEM_CHANS);
230230

231-
_info("HSEM take %d\n", id);
231+
ipcinfo("HSEM take %d\n", id);
232232

233233
/* Take semaphore */
234234

arch/arm/src/stm32h7/stm32_rptun.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static void stm32_rptun_panic(struct rptun_dev_s *dev)
363363

364364
static void stm32_hsem_master_callback(uint8_t id, void *arg)
365365
{
366-
_info("Rptun HSEM master %d\n", id);
366+
ipcinfo("Rptun HSEM master %d\n", id);
367367

368368
switch (id)
369369
{
@@ -399,7 +399,7 @@ static void stm32_rptun_hsem_cm7(struct stm32_rptun_dev_s *dev)
399399

400400
static void stm32_hsem_slave_callback(uint8_t id, void *arg)
401401
{
402-
_info("Rptun HSEM slave %d\n", id);
402+
ipcinfo("Rptun HSEM slave %d\n", id);
403403

404404
switch (id)
405405
{
@@ -510,7 +510,7 @@ int stm32_rptun_init(const char *shmemname, const char *cpuname)
510510
ret = rptun_initialize(&dev->rptun);
511511
if (ret < 0)
512512
{
513-
_err("ERROR: rptun_initialize failed %d!\n", ret);
513+
ipcerr("ERROR: rptun_initialize failed %d!\n", ret);
514514
goto errout;
515515
}
516516

@@ -520,7 +520,7 @@ int stm32_rptun_init(const char *shmemname, const char *cpuname)
520520
CONFIG_RPTUN_STACKSIZE, stm32_rptun_thread, NULL);
521521
if (ret < 0)
522522
{
523-
_err("ERROR: kthread_create failed %d\n", ret);
523+
ipcerr("ERROR: kthread_create failed %d\n", ret);
524524
}
525525

526526
errout:

include/debug.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,24 @@
866866
# define rstinfo _none
867867
#endif
868868

869+
#ifdef CONFIG_DEBUG_IPC_ERROR
870+
# define ipcerr _err
871+
#else
872+
# define ipcerr _none
873+
#endif
874+
875+
#ifdef CONFIG_DEBUG_IPC_WARN
876+
# define ipcwarn _warn
877+
#else
878+
# define ipcwarn _none
879+
#endif
880+
881+
#ifdef CONFIG_DEBUG_IPC_INFO
882+
# define ipcinfo _info
883+
#else
884+
# define ipcinfo _none
885+
#endif
886+
869887
/* Buffer dumping macros do not depend on varargs */
870888

871889
#ifdef CONFIG_DEBUG_ERROR

0 commit comments

Comments
 (0)