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

Gedare Bloom gedare at rtems.org
Wed Dec 14 21:25:45 UTC 2022


How does this debugging get turned on/off?


On Sat, Dec 3, 2022 at 2:00 AM Prashanth S <fishesprashanth at gmail.com> wrote:
>
> ---
>  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__)
>
maybe use CAN_ERROR? unless there's a reason not to.

>  #define CAN_MSG_LEN(msg) ((char *)(&((struct can_msg *)msg)->data[(uint16_t)((struct can_msg *)msg)->len]) - (char *)(msg))
> --
> 2.25.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list