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

Prashanth S fishesprashanth at gmail.com
Thu Dec 15 07:28:41 UTC 2022


>How does this debugging get turned on/off?

-DRTEMS_CAN_DEBUG as a Compiler Flag will enable the debug prints.

>
>maybe use CAN_ERROR? unless there's a reason not to.

The debug #defines helps us to have control over the debug prints based on
the entity (isr, locks, rx, tx).
This helps the BSP CAN driver development to have debug prints based on the
entity (isr, locks, rx, tx).
Can we have this feature?

>
>>  #define CAN_MSG_LEN(msg) ((char *)(&((struct can_msg
*)msg)->data[(uint16_t)((struct can_msg *)msg)->len]) - (char *)(msg))

On Thu, 15 Dec 2022 at 02:55, Gedare Bloom <gedare at rtems.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20221215/99676878/attachment.htm>


More information about the devel mailing list