5 #ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_LOG_H_
6 #define OPENTITAN_SW_DEVICE_LIB_RUNTIME_LOG_H_
107 #define OT_FAIL_IF_64_BIT_LOG(arg) OT_FAIL_IF_64_BIT(arg, LOG)
117 #define OT_CHECK_VALID_LOG_ARGS(...) \
118 OT_VA_FOR_EACH(OT_FAIL_IF_64_BIT_LOG, ##__VA_ARGS__)
130 #define LOG(severity, format, ...) \
132 OT_CHECK_VALID_LOG_ARGS(__VA_ARGS__); \
133 if (kDeviceLogBypassUartAddress != 0) { \
139 __attribute__((section(".logs.fields"))) \
140 static const log_fields_t kLogFields = \
141 LOG_MAKE_FIELDS_(severity, format, ##__VA_ARGS__); \
142 base_log_internal_dv(&kLogFields, \
143 OT_VA_ARGS_COUNT(format, ##__VA_ARGS__), \
146 static const log_fields_t log_fields = \
147 LOG_MAKE_FIELDS_(severity, format, ##__VA_ARGS__); \
148 base_log_internal_core(&log_fields, ##__VA_ARGS__); \
155 #define LOG_MAKE_FIELDS_(_severity, _format, ...) \
157 .severity = _severity, .file_name = "" __FILE__ "", .line = __LINE__, \
158 .nargs = OT_VA_ARGS_COUNT(_format, ##__VA_ARGS__), .format = _format, \
169 #define LOG_INFO(...) LOG(kLogSeverityInfo, __VA_ARGS__)
179 #define LOG_WARNING(...) LOG(kLogSeverityWarn, __VA_ARGS__)
189 #define LOG_ERROR(...) LOG(kLogSeverityError, __VA_ARGS__)
202 #define LOG_FATAL(...) LOG(kLogSeverityFatal, __VA_ARGS__)
204 #endif // OPENTITAN_SW_DEVICE_LIB_RUNTIME_LOG_H_