summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristoph Lipka <clipka@jp.adit-jv.com>2016-06-13 14:25:45 +0100
committerChristoph Lipka <clipka@jp.adit-jv.com>2016-10-24 13:39:56 +0900
commitce137a345cf2f637453aa1795af3d381157bf055 (patch)
tree87a0ae1e914c340315c23774d6b7b07d3da627cd /src
parent3894a8d101a7be0f67262de8af3746a768433fed (diff)
downloadDLT-daemon-ce137a345cf2f637453aa1795af3d381157bf055.tar.gz
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 <clipka@jp.adit-jv.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/dlt_user.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index 9870cf2..b3ee5da 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -1963,6 +1963,38 @@ DltReturnValue dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t
return DLT_RETURN_OK;
}
+DltReturnValue dlt_user_log_write_ptr(DltContextData *log, void *data)
+{
+ if (log == NULL)
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
+ if (!dlt_user_initialised)
+ {
+ dlt_vlog(LOG_WARNING, "%user_initialised false\n", __FUNCTION__);
+ return DLT_RETURN_ERROR;
+ }
+
+ switch(sizeof(void *))
+ {
+ case 4:
+ return dlt_user_log_write_uint32_formatted(log,
+ (uintptr_t)data,
+ DLT_FORMAT_HEX32);
+ break;
+ case 8:
+ return dlt_user_log_write_uint64_formatted(log,
+ (uintptr_t)data,
+ DLT_FORMAT_HEX64);
+ break;
+ default:
+ ; /* skip */
+ }
+
+ return DLT_RETURN_OK;
+}
+
DltReturnValue dlt_user_log_write_int(DltContextData *log, int data)
{
if (log == NULL)