[PATCH 1/4] cpukit/include/dev/can: Added debug print configuration under RTEMS_CAN_DEBUG macro.

Prashanth S fishesprashanth at gmail.com
Fri Dec 16 13:27:49 UTC 2022


---
 cpukit/include/dev/can/can.h | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/dev/can/can.h b/cpukit/include/dev/can/can.h
index 9e55395039..4ee51ebc9d 100644
--- a/cpukit/include/dev/can/can.h
+++ b/cpukit/include/dev/can/can.h
@@ -53,13 +53,28 @@
       printf(str, ##__VA_ARGS__);                                             \
     } while (false);
 
+#ifdef RTEMS_CAN_DEBUG
+
 #define CAN_DEBUG(str, ...) DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_BUF(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_ISR(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_LOCK(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_RX(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_TX(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_REG(str, ...) //CAN_DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_BUF(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_ISR(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_LOCK(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_RX(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_TX(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_REG(str, ...) /* CAN_DEBUG(str, ##__VA_ARGS__) */
+
+#else /* RTEMS_CAN_DEBUG */
+
+#define CAN_DEBUG(str, ...)
+#define CAN_DEBUG_BUF(str, ...)
+#define CAN_DEBUG_ISR(str, ...)
+#define CAN_DEBUG_LOCK(str, ...)
+#define CAN_DEBUG_RX(str, ...)
+#define CAN_DEBUG_TX(str, ...)
+#define CAN_DEBUG_REG(str, ...)
+
+#endif /* RTEMS_CAN_DEBUG */
+
 #define CAN_ERR(str, ...) DEBUG(str, ##__VA_ARGS__)
 
 #define CAN_MSG_LEN(msg) ((char *)(&((struct can_msg *)msg)->data[(uint16_t)((struct can_msg *)msg)->len]) - (char *)(msg))
-- 
2.25.1



More information about the devel mailing list