From 8e7c0a4db88079902752574f05eed673500697ed Mon Sep 17 00:00:00 2001 From: Markus Suevern Date: Fri, 17 Nov 2023 17:24:19 +0100 Subject: [PATCH] Add missing macros. --- ls-bus-guide/headers/fmi3LsBusUtil.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ls-bus-guide/headers/fmi3LsBusUtil.h b/ls-bus-guide/headers/fmi3LsBusUtil.h index 3398154..af6b158 100644 --- a/ls-bus-guide/headers/fmi3LsBusUtil.h +++ b/ls-bus-guide/headers/fmi3LsBusUtil.h @@ -114,6 +114,30 @@ typedef struct } \ while (0) +/** + * \brief Checks whether the buffer variable is empty. + * + * \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo. + */ +#define FMI3_LS_BUS_BUFFER_IS_EMPTY(BufferInfo) \ + ((BufferInfo)->writePos == (BufferInfo)->start ? fmi3True : fmi3False) + +/** + * \brief Returns the start address of the buffer variable. + * + * \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo. + */ +#define FMI3_LS_BUS_BUFFER_START(BufferInfo) \ + ((BufferInfo)->start) + +/** + * \brief Returns the actual length of the buffer variable beginning from the start address. + * + * \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo. + */ +#define FMI3_LS_BUS_BUFFER_LENGTH(BufferInfo) \ + ((BufferInfo)->writePos - (BufferInfo)->start) + /** * \brief Writes data to a buffer variable. Existing data will be overwritten. *