From ce137a345cf2f637453aa1795af3d381157bf055 Mon Sep 17 00:00:00 2001 From: Christoph Lipka Date: Mon, 13 Jun 2016 14:25:45 +0100 Subject: DLT_PTR macro: Improve implementation and function API added The original implementation result in a compile error when DLT_PTR is used with other macros like DLT_STRING. This patch overcomes that problem. Signed-off-by: Christoph Lipka --- include/dlt/dlt_user.h | 10 ++++++++++ include/dlt/dlt_user_macros.h | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h index 326a733..a151e95 100644 --- a/include/dlt/dlt_user.h +++ b/include/dlt/dlt_user.h @@ -332,6 +332,16 @@ DltReturnValue dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t DltReturnValue dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t data, DltFormatType type); DltReturnValue dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t data, DltFormatType type); +/** + * Write a pointer value architecture independent. + * dlt_user_log_write_start has to be called before adding any attributes to the log message. + * Finish sending log message by calling dlt_user_log_write_finish. + * @param log pointer to an object containing information about logging context data + * @param data void* parameter written into log message. + * @return Value from DltReturnValue enum + */ +DltReturnValue dlt_user_log_write_ptr(DltContextData *log, void *data); + /** * Write a int parameter into a DLT log message. * dlt_user_log_write_start has to be called before adding any attributes to the log message. diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h index e1e9104..e1968a2 100644 --- a/include/dlt/dlt_user_macros.h +++ b/include/dlt/dlt_user_macros.h @@ -331,13 +331,7 @@ * Architecture independent macro to print pointers */ #define DLT_PTR(PTR_VAR) \ - do { \ - if (sizeof(void *) < 8) { \ - DLT_HEX32((uintptr_t)PTR_VAR); \ - } else { \ - DLT_HEX64((uintptr_t)PTR_VAR); \ - } \ - } while(0) + (void)dlt_user_log_write_ptr(&log_local, PTR_VAR) /** * Trace network message -- cgit v1.2.1