#ifndef TZBSP_LOG_H
#define TZBSP_LOG_H

/**
@file tzbsp_log.h
@brief Trustzone Logging

Contains Macros for logging TZ debug messages. By default all logs go to the
internal ring buffer. Logs can also be dumped to JTAG based oncompile time flag
\c TZBSP_JTAG_LOGGING.

*/
/* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 * All rights reserved.
 * Confidential and Proprietary - Qualcomm Technologies, Inc. 
 */

/*===========================================================================

                           INCLUDE FILES

===========================================================================*/

#include <stdarg.h>
#include <stdint.h>
#include <stdbool.h>
#include "IxErrno.h"
/*===========================================================================

                              DEFINES

===========================================================================*/

#define TZBSP_LOG_TARGET_RING_BUFFER_BIT        (1<<0)

#define TZBSP_MSG_FATAL           (0)
#define TZBSP_MSG_ERROR           (1)
#define TZBSP_MSG_DEBUG           (2)
#define TZBSP_MSG_HIGH            (3)
#define TZBSP_MSG_MED             (4)
#define TZBSP_MSG_LOW             (5)
#ifdef TZBSP_ENABLE_EXCLUSIVE_LOGGING
  // NB: once exclusive logging is enabled (config flag), only messages with this
  // msg level will be printed in the tzbsp log. ONLY use it when debugging 
#define TZBSP_MSG_EXCLUSIVE       (10) 

#define TZBSP_LOG_EXCLUSIVE(xx_sc,...) \
    TZBSP_LOG(TZBSP_MSG_EXCLUSIVE, xx_sc, ##__VA_ARGS__)
#endif /* TZBSP_ENABLE_EXCLUSIVE_LOGGING */

/**
 * Shortcut macros for error logging, @see TZBSP_LOG.
 */
#define TZBSP_LOG_ERR(xx_sc,...) \
  TZBSP_LOG(TZBSP_MSG_ERROR, xx_sc, ##__VA_ARGS__)

#define TZBSP_LOG_NAME_ERR(xx_sc,...) \
  TZBSP_LOG_NAME(TZBSP_MSG_ERROR, xx_sc, ##__VA_ARGS__)

#define TZBSP_LOG_NAME_DBG(xx_sc,...) \
  TZBSP_LOG_NAME(TZBSP_MSG_DEBUG, xx_sc, ##__VA_ARGS__)

/**
 * Shortcut macros for fatal error logging, @see TZBSP_LOG.
 */
#define TZBSP_LOG_ERR_FATAL(xx_sc,...) \
  TZBSP_LOG(TZBSP_MSG_FATAL, xx_sc, ##__VA_ARGS__)

#define TZBSP_LOG_NAME_ERR_FATAL(xx_sc,...) \
  TZBSP_LOG_NAME(TZBSP_MSG_FATAL, xx_sc, ##__VA_ARGS__)

/**
 * Shortcut macro for conditinally logging an error, log is only printed if
 * error condition is present in \c pred.
 * Modified the maro to no longer take error format, but to take error codes/status codes.
 */
#define TZBSP_LOG_ERR_E(pred, xx_sc, ...)                              \
  if(E_SUCCESS != (pred))                                               \
  {                                                                     \
    TZBSP_LOG(TZBSP_MSG_ERROR, xx_sc, ##__VA_ARGS__);                  \
  }

/**
 * Modified the maro to no longer take error format, but to take error codes/status codes.
 * Shortcut macro for debug logging, @see TZBSP_LOG.
 */
#define TZBSP_LOG_DBG(xx_sc, ...) \
  TZBSP_LOG(TZBSP_MSG_DEBUG, xx_sc, ##__VA_ARGS__)

/**
 * This function is used to log to a ring buffer. The function is intlocked,
 * hence printing from ISRs is allowed. This function should be used of use case requires string logging.
 *
 * @param [in] pri  Prioriy of message to be logged.
 * @param [in] fmt  String describing the format of msg.
 * @param [in] ...  Variable argument list.
 */
void tzbsp_log(uint32_t pri, const char* fmt, ...);

/**
 * This function is used to log to a ring buffer. The function is intlocked,
 * hence printing from ISRs is allowed.
 *
 * @param [in] pri  Prioriy of message to be logged.
 * @param [in] fmt  String describing the format of msg.
 * @param [in] ap   Variable argument list pointer.
 */
void tzbsp_log_with_ap(uint32_t pri, const char* fmt, va_list ap);

/**
 * This function wraps `tzbsp_log_with_ap`. It is called only when the
 * "OEM_tz_num_of_diag_log_chunks_to_encr" devcfg flag is set to >= 2.
 * It will log normally until the first error fatal is logged. On this
 * first error fatal, the ring buffer will be rotated. All subsequent
 * logs with lower priority than error fatal will NOT be logged.
 */
void tzbsp_log_with_ap_and_oem_rotate_support(uint32_t pri, const char* fmt, va_list ap);

/**
 * Initializes the logging module.  If this isn't called during boot, then all
 * logging functions (e.g. TZBSP_LOG) effectively become NOPs.
 */
void tzbsp_log_init(void);

/**
 * This function rotates the ring buffer. The last character logged
 * before rotation will be at the end of the ring buffer.
 */
void tzbsp_log_rotate(void);

/**
 * This function queries if an error fatal has been logged before.
 * This flag would only be set to true when the
 * "OEM_tz_num_of_diag_log_chunks_to_encr" devcfg flag is set to >= 2.
 *
 * @return true if enabled, false otherwise
 */
bool tzbsp_log_is_err_fatal_logged(void);

/**
 * This function clears the error fatal logged flag. This is needed
 * to continue logging non error fatal logs after running tests
 * associated with the feature.
 */
void tzbsp_log_reset_is_err_fatal_logged(void);

/**
 *  \brief  API to query if log encryption is enabled
 *          Log encryption is enabled iff
 *          feature is enabled through devcfg &&
 *          device state is secure &&
 *          logging is not enabled through apdp

 * @return true if enabled, false otherwise
*/
bool tzbsp_is_log_encryption_enabled(void);

/**
 * This API checks APPS Secure Minidump and logging status 
 *
 * @return True if APPS Secure Minidump is enabled and logging is disabled
 *         False if either APPS Secure Minidump is disabled or logging is enabled
 */
bool tzbsp_is_apps_secure_minidump_enabled_and_logging_disabled(void);

/**
 * This API binds the smc call to request encrypted logs with the smc call to query whether log encryption is enabled.
 * Client must first query if log encryption is enabled before making first request for encrypted logs.
 * if queried and log encryption is enabled, set the global is_log_encr_queried_and_enabled to true
 * @param [in] state   true if log_encryption is enabled
 *                     false if log_encryption is disabled
 */
void tzbsp_set_is_log_encr_allowed_state(bool state);

/**
 * This API gets the value of the `is_log_encr_queried_and_enabled` static global variable.
 * It is used for `tzbsp_log_encr_buff_req()` tests.
 *
 * @return true if `is_log_encr_queried_and_enabled` is true
 *         false otherwise
 */
bool tzbsp_get_is_log_encr_allowed_state(void);

/**
 * This API resets the current offset and wraparound count of the Diag log buffer.
 * It is used for Diag log tests that require an "empty" and/or unwrapped Diag log buffer.
 */
void tzbsp_reset_diag_log_pos(void);

/**
 * This API resets the current offset and wraparound count of the QSEE log buffer.
 * It is used for QSEE log tests that require an "empty" and/or unwrapped QSEE log buffer.
 */
void tzbsp_reset_qsee_log_pos(void);

/**Macro's used to count arguments passed.**/
#define _NUM_ARGS_EVALUATOR_(_1,_2,_3,_4,_5,_6,_7,_8,                         \
            _9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,N,...) N           \

#define _NUM_ARGS_COUNT_(...)                                                 \
     _NUM_ARGS_EVALUATOR_(_0, ##__VA_ARGS__,                                  \
            19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)                \

#define _GET_MACRO_TZ_(name, n)    name##n

#define _GET_MACRO_TZ(name, n)     _GET_MACRO_TZ_(name, n)

#define GET_MACRO_TZ(macro, xx_prio, xx_sc, ...)                               \
     _GET_MACRO_TZ(macro, _NUM_ARGS_COUNT_(__VA_ARGS__)) (xx_prio, xx_sc, ##__VA_ARGS__)

/**
 * TZBSP macro's to log  messages to a ring buffer.
 * @param [in] xx_prio - Priority of the message to be logged
 * @param [in] xx_sc   - error code/status code.
 * @param [in] ...     - Arguments, the arguments should not contain any strings.
 * Please note we support max 9 arguments to be printed.
 * The Macro  prints all the arguments in %lx format.
 */
#define TZBSP_LOG(xx_prio, xx_sc, ...)                                             \
    GET_MACRO_TZ(TZBSP_LOG, xx_prio, xx_sc, ##__VA_ARGS__)

#define TZBSP_LOG_NAME(xx_prio, xx_sc, ...)                                        \
    GET_MACRO_TZ(TZBSP_LOG_NAME, xx_prio, xx_sc, ##__VA_ARGS__)

#define TZBSP_LOG_NAME1(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %s)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG_NAME2(xx_prio, xx_sc, arg_str, arg0)                             \
    tzbsp_log(xx_prio, "(%x %s %lx)",                                              \
      xx_sc, arg_str, (uintptr_t)arg0);

#define TZBSP_LOG_NAME3(xx_prio, xx_sc, arg_str, arg0, arg1)                       \
    tzbsp_log(xx_prio, "(%x %s %lx %lx)",                                          \
      xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1);

#define TZBSP_LOG_NAME4(xx_prio, xx_sc, arg_str, arg0, arg1, arg2)                 \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx)",                                      \
      xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2);

#define TZBSP_LOG_NAME5(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3)           \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx)",                                  \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
             (uintptr_t)arg3);

#define TZBSP_LOG_NAME6(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3, arg4)     \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx)",                              \
             xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,    \
            (uintptr_t)arg3, (uintptr_t)arg4);

#define TZBSP_LOG_NAME7(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,           \
                        arg4, arg5)                                                \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx)",                          \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);

#define TZBSP_LOG_NAME8(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,           \
                        arg4, arg5, arg6)                                          \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx)",                      \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6);

#define TZBSP_LOG_NAME9(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,           \
                        arg4, arg5, arg6, arg7)                                    \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx)",                  \
              xx_sc,  arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,  \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7);

#define TZBSP_LOG_NAME10(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8)                             \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx)",              \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8);

#define TZBSP_LOG_NAME11(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8, arg9)                       \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)",          \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9);

#define TZBSP_LOG_NAME12(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10)                \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)",      \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10);

#define TZBSP_LOG_NAME13(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)         \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx "       \
                        "%lx)",                                                    \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10, \
              (uintptr_t)arg11);

#define TZBSP_LOG_NAME14(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11,         \
                         arg12)                                                    \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx"    \
                        " %lx)",                                                   \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10, \
              (uintptr_t)arg11, (uintptr_t)arg12);


#define TZBSP_LOG_NAME15(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,          \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11,         \
                         arg12, arg13)                                             \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx"    \
                        " %lx %lx)",                                               \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,   \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6,  \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10, \
              (uintptr_t)arg11, (uintptr_t)arg12, (uintptr_t)arg13);


#define TZBSP_LOG_NAME16(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,         \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11,        \
                          arg12, arg13, arg14)                                    \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx"   \
                         " %lx %lx %lx)",                                         \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,  \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6, \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10,\
              (uintptr_t)arg11, (uintptr_t)arg12, (uintptr_t)arg13,               \
              (uintptr_t)arg14);

#define TZBSP_LOG_NAME17(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,         \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11,        \
                         arg12, arg13, arg14, arg15)                              \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx"   \
                         " %lx %lx %lx %lx)",                                     \
               xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6, \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10,\
              (uintptr_t)arg11, (uintptr_t)arg12, (uintptr_t)arg13,               \
              (uintptr_t)arg14, uint64_t)arg15);

#define TZBSP_LOG_NAME18(xx_prio, xx_sc, arg_str, arg0, arg1, arg2, arg3,         \
                         arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11,        \
                         arg12, arg13, arg14, arg15, arg16)                       \
    tzbsp_log(xx_prio, "(%x %s %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx"   \
                         " %lx %lx %lx %lx %lx)",                                 \
              xx_sc, arg_str, (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,  \
              (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, (uintptr_t)arg6, \
              (uintptr_t)arg7, (uintptr_t)arg8, (uintptr_t)arg9, (uintptr_t)arg10,\
              (uintptr_t)arg11, (uintptr_t)arg12, (uintptr_t)arg13,               \
              (uintptr_t)arg14, (uintptr_t)arg15, (uintptr_t)arg16);

#define TZBSP_LOG0(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x)", xx_sc);

#define TZBSP_LOG1(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG2(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG3(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG4(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG5(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG6(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx)", xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG7(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx)", xx_sc,             \
              ##__VA_ARGS__);

#define TZBSP_LOG8(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx)", xx_sc,         \
              ##__VA_ARGS__);

#define TZBSP_LOG9(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx)", xx_sc,     \
             ##__VA_ARGS__);

#define TZBSP_LOG10(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", xx_sc,  \
             ##__VA_ARGS__);

#define TZBSP_LOG11(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)",     \
      xx_sc, ##__VA_ARGS__);                                                   \

#define TZBSP_LOG12(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG13(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG14(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG15(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG16(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG17(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG18(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);

#define TZBSP_LOG19(xx_prio, xx_sc, ...)                                       \
    tzbsp_log(xx_prio, "(%x %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx %lx)", \
      xx_sc, ##__VA_ARGS__);


#endif /* TZBSP_LOG_H */




