summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@jp.adit-jv.com>2016-01-26 16:09:21 +0900
committerGernot Wirschal <gernot.wirschal@bmw.de>2016-04-28 13:48:00 +0200
commit6a8919c637b28fab7cc6f8e87cfca6f13bb8cb1d (patch)
tree560f0dd6be57ad427f41ef36c5785cb11508d0d1 /include
parent793f30a629d706bc6d8a47ca90d4627791bc3969 (diff)
downloadDLT-daemon-6a8919c637b28fab7cc6f8e87cfca6f13bb8cb1d.tar.gz
DLT_PTR: User macro to print pointers
This macro internally checks the size of a void pointer to decide if the pointer address is sent with DLT_HEX32 or DLT_HEX64 macro. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Change-Id: Ie316ac411f2174e0760e09244d04b83c8006f55d
Diffstat (limited to 'include')
-rw-r--r--include/dlt/dlt_user_macros.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/dlt/dlt_user_macros.h b/include/dlt/dlt_user_macros.h
index 3bb161f..919df7e 100644
--- a/include/dlt/dlt_user_macros.h
+++ b/include/dlt/dlt_user_macros.h
@@ -328,6 +328,18 @@
(void)dlt_user_log_write_uint16_formatted(&log_local,UINT_VAR,DLT_FORMAT_BIN16)
/**
+ * 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)
+
+/**
* Trace network message
* @param CONTEXT object containing information about one special logging context
* @param TYPE type of network trace message