From e0be134ced32c8ee5e0955e8fecbdf0d74cd7d30 Mon Sep 17 00:00:00 2001 From: Martin Willers Date: Sat, 2 May 2020 13:00:10 +0200 Subject: Add macro wrappers for new sized string functions Signed-off-by: Martin Willers --- include/dlt/dlt_user_macros.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include') diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h index 2c0135e..f1a531b 100644 --- a/include/dlt/dlt_user_macros.h +++ b/include/dlt/dlt_user_macros.h @@ -321,6 +321,17 @@ #define DLT_STRING(TEXT) \ (void)dlt_user_log_write_string(&log_local, TEXT) +/** + * Add string parameter with given length to the log messsage. + * The string in @a TEXT does not need to be null-terminated, but + * the copied string will be null-terminated at its destination + * in the message buffer. + * @param TEXT ASCII string + * @param LEN length in bytes to take from @a TEXT + */ +#define DLT_SIZED_STRING(TEXT, LEN) \ + (void)dlt_user_log_write_sized_string(&log_local, TEXT, LEN) + /** * Add constant string parameter to the log messsage. * @param TEXT Constant ASCII string @@ -328,6 +339,17 @@ #define DLT_CSTRING(TEXT) \ (void)dlt_user_log_write_constant_string(&log_local, TEXT) +/** + * Add constant string parameter with given length to the log messsage. + * The string in @a TEXT does not need to be null-terminated, but + * the copied string will be null-terminated at its destination + * in the message buffer. + * @param TEXT Constant ASCII string + * @param LEN length in bytes to take from @a TEXT + */ +#define DLT_SIZED_CSTRING(TEXT, LEN) \ + (void)dlt_user_log_write_sized_constant_string(&log_local, TEXT, LEN) + /** * Add utf8-encoded string parameter to the log messsage. * @param TEXT UTF8-encoded string @@ -335,6 +357,17 @@ #define DLT_UTF8(TEXT) \ (void)dlt_user_log_write_utf8_string(&log_local, TEXT) +/** + * Add utf8-encoded string parameter with given length to the log messsage. + * The string in @a TEXT does not need to be null-terminated, but + * the copied string will be null-terminated at its destination + * in the message buffer. + * @param TEXT UTF8-encoded string + * @param LEN length in bytes to take from @a TEXT + */ +#define DLT_SIZED_UTF8(TEXT, LEN) \ + (void)dlt_user_log_write_sized_utf8_string(&log_local, TEXT, LEN) + /** * Add boolean parameter to the log messsage. * @param BOOL_VAR Boolean value (mapped to uint8) -- cgit v1.2.1