1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 2016-2017 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: MIT 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 /** 25 * @file 26 * @brief NvLog call that logs prints. 27 * 28 * This is the traditional NvLog component. When enabled, it will also activate 29 * preprocessing of all source files to detect calls to NVLOG_PRINTF, and 30 * generate a database to be used for decoding. 31 * 32 * This file just defines the macros used by NV_PRINTF and others clients 33 */ 34 35 #ifndef _NVLOG_PRINTF_H_ 36 #define _NVLOG_PRINTF_H_ 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 #ifndef NVLOG_ENABLED 43 /// @brief If zero, most of NvLog will be compiled out 44 #define NVLOG_ENABLED 0 45 #endif 46 47 #ifndef NVLOG_LEVEL 48 /// @brief Level below which all prints will be compiled out. 49 #define NVLOG_LEVEL 2 50 #endif 51 52 /// @brief Maximum number of arguments to NVLOG_PRINTF 53 #define NVLOG_MAX_ARGS 20 54 55 /** 56 * @brief Log this printf in NvLog internal binary buffers 57 * 58 * These calls are picked up by the NvLog parser, and are replaced with custom 59 * calls from the generated header. See @page nvlog-parser for details. 60 * 61 * @param tag - An identifier to help with offline filtering. Doesn't need to 62 * be defined anywhere. 63 * @param route - 8bit mask of buffers the print will be routed to. 64 * Use NVLOG_BUFFER_XXX constants 65 * @param level - Level at which to print. Calls with level < NVLOG_LEVEL will 66 * be compiled out. 67 * @param format - printf-like format string 68 * @param ... - printf arguments 69 */ 70 #define NVLOG_PRINTF(tag, route, level, format, ...) _NVLOG_PRINTF(tag, route, level, format, __VA_ARGS__) 71 72 #define NVLOG_BUFFER_NULL 0x01 73 #define NVLOG_BUFFER_RM 0x02 74 #define NVLOG_BUFFER_RM_BOOT 0x04 75 #define NVLOG_BUFFER_ETW 0x08 76 #define NVLOG_BUFFER_KMD_BOOT 0x10 77 #define NVLOG_BUFFER_KMD 0x20 78 #define NVLOG_BUFFER_ERROR 0x40 79 #define NVLOG_BUFFER_DD 0x80 80 81 #define NVLOG_ROUTE_RM (NVLOG_BUFFER_RM | NVLOG_BUFFER_RM_BOOT | NVLOG_BUFFER_ETW) 82 #define NVLOG_ROUTE_KMD (NVLOG_BUFFER_KMD | NVLOG_BUFFER_KMD_BOOT | NVLOG_BUFFER_ETW) 83 #define NVLOG_ROUTE_DD (NVLOG_BUFFER_DD | NVLOG_BUFFER_KMD_BOOT | NVLOG_BUFFER_ETW) 84 85 #include "nvlog/internal/nvlog_printf_internal.h" 86 87 #ifdef __cplusplus 88 } //extern "C" 89 #endif 90 91 #endif // _NVLOG_PRINTF_H_ 92