summaryrefslogtreecommitdiff
path: root/include/dlt/dlt_user.h
diff options
context:
space:
mode:
authorManikandanC <Manikandan.Chockalingam@in.bosch.com>2017-05-22 10:57:21 +0530
committerChristoph Lipka <clipka@users.noreply.github.com>2018-12-10 15:40:58 +0100
commitb2ce65d9947849160e04e751075c7fe4b5dcd158 (patch)
tree17bd0227f0d26d3557deecb83b026284975019a1 /include/dlt/dlt_user.h
parentea836f6de185f32c14404950f5cfb2ebf084e1ca (diff)
downloadDLT-daemon-b2ce65d9947849160e04e751075c7fe4b5dcd158.tar.gz
Dynamic allocation of msg buffer
It is possible to change the default buffer size for log message creation via environment variable: export DLT_LOG_MSG_BUF_LEN=<value> Instead of using a static buffer with size of 1390 bytes, the buffer is allocated dynamically with the specified value.The max size is restricted to approx 65k. Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
Diffstat (limited to 'include/dlt/dlt_user.h')
-rw-r--r--include/dlt/dlt_user.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/dlt/dlt_user.h b/include/dlt/dlt_user.h
index 82e5e31..8e676c6 100644
--- a/include/dlt/dlt_user.h
+++ b/include/dlt/dlt_user.h
@@ -115,7 +115,7 @@ typedef struct
typedef struct
{
DltContext *handle; /**< pointer to DltContext */
- unsigned char buffer[DLT_USER_BUF_MAX_SIZE]; /**< buffer for building log message*/
+ unsigned char *buffer; /**< buffer for building log message*/
int32_t size; /**< payload size */
int32_t log_level; /**< log level */
int32_t trace_status; /**< trace status */
@@ -222,7 +222,7 @@ typedef struct
DltBuffer startup_buffer; /**< Ring-buffer for buffering messages during startup and missing connection */
/* Buffer used for resending, locked by DLT semaphore */
- uint8_t resend_buffer[DLT_USER_RESENDBUF_MAX_SIZE];
+ uint8_t *resend_buffer;
uint32_t timeout_at_exit_handler; /**< timeout used in dlt_user_atexit_blow_out_user_buffer, in 0.1 milliseconds */
dlt_env_ll_set initial_ll_set;
@@ -236,6 +236,7 @@ typedef struct
int16_t corrupt_message_size_size;
#endif
DltUserConnectionState connection_state;
+ uint16_t log_buf_len; /**< length of message buffer, by default: DLT_USER_BUF_MAX_SIZE */
} DltUser;
/**************************************************************************************************
@@ -795,6 +796,11 @@ DltReturnValue dlt_user_log_resend_buffer(void);
*/
static inline DltReturnValue dlt_user_is_logLevel_enabled(DltContext *handle,DltLogLevelType loglevel)
{
+ if (loglevel < DLT_LOG_OFF || loglevel >= DLT_LOG_MAX)
+ {
+ return DLT_RETURN_WRONG_PARAMETER;
+ }
+
if (handle == NULL || handle->log_level_ptr == NULL)
{
return DLT_RETURN_WRONG_PARAMETER;