interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / third_party / nvidia-open-580.173.02 / src / common / sdk / nvidia / inc / nvstatus.h

123 lines · 4565 bytes Raw Blame History
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2014-2019 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#ifndef SDK_NVSTATUS_H
25#define SDK_NVSTATUS_H
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include "nvtypes.h"
32
33typedef NvU32 NV_STATUS;
34
35#define NV_STATUS_CODE( name, code, string ) name = (code),
36
37enum
38{
39 #include "nvstatuscodes.h"
40};
41
42#undef NV_STATUS_CODE
43
44/*!
45 * @def NV_STATUS_LEVEL_OK
46 * @see NV_STATUS_LEVEL
47 * @brief Success: No error or special condition
48 */
49#define NV_STATUS_LEVEL_OK 0
50
51/*!
52 * @def NV_STATUS_LEVEL_WARN
53 * @see NV_STATUS_LEVEL
54 * @brief Success, but there is an special condition
55 *
56 * @details In general, NV_STATUS_LEVEL_WARN status codes are handled the
57 * same as NV_STATUS_LEVEL_OK, but are usefil to indicate that
58 * there is a condition that may be specially handled.
59 *
60 * Therefore, in most cases, client function should test for
61 * status <= NV_STATUS_LEVEL_WARN or status > NV_STATUS_LEVEL_WARN
62 * to determine success v. failure of a call.
63 */
64#define NV_STATUS_LEVEL_WARN 1
65
66/*!
67 * @def NV_STATUS_LEVEL_ERR
68 * @see NV_STATUS_LEVEL
69 * @brief Unrecoverable error condition
70 */
71#define NV_STATUS_LEVEL_ERR 3
72
73/*!
74 * @def NV_STATUS_LEVEL
75 * @see NV_STATUS_LEVEL_OK
76 * @see NV_STATUS_LEVEL_WARN
77 * @see NV_STATUS_LEVEL_ERR
78 * @brief Level of the status code
79 *
80 * @warning IMPORTANT: When comparing NV_STATUS_LEVEL(_S) against one of
81 * these constants, it is important to use '<=' or '>' (rather
82 * than '<' or '>=').
83 *
84 * For example. do:
85 * if (NV_STATUS_LEVEL(status) <= NV_STATUS_LEVEL_WARN)
86 * rather than:
87 * if (NV_STATUS_LEVEL(status) < NV_STATUS_LEVEL_ERR)
88 *
89 * By being consistent in this manner, it is easier to systematically
90 * add additional level constants. New levels are likely to lower
91 * (rather than raise) the severity of _ERR codes. For example,
92 * if we were to add NV_STATUS_LEVEL_RETRY to indicate hardware
93 * failures that may be recoverable (e.g. RM_ERR_TIMEOUT_RETRY
94 * or RM_ERR_BUSY_RETRY), it would be less severe than
95 * NV_STATUS_LEVEL_ERR the level to which these status codes now
96 * belong. Using '<=' and '>' ensures your code is not broken in
97 * cases like this.
98 */
99#define NV_STATUS_LEVEL(_S) \
100 ((_S) == NV_OK? NV_STATUS_LEVEL_OK: \
101 ((_S) != NV_ERR_GENERIC && (_S) & 0x00010000? NV_STATUS_LEVEL_WARN: \
102 NV_STATUS_LEVEL_ERR))
103
104/*!
105 * @def NV_STATUS_LEVEL
106 * @see NV_STATUS_LEVEL_OK
107 * @see NV_STATUS_LEVEL_WARN
108 * @see NV_STATUS_LEVEL_ERR
109 * @brief Character representing status code level
110 */
111#define NV_STATUS_LEVEL_CHAR(_S) \
112 ((_S) == NV_OK? '0': \
113 ((_S) != NV_ERR_GENERIC && (_S) & 0x00010000? 'W': \
114 'E'))
115
116// Function definitions
117const char *nvstatusToString(NV_STATUS nvStatusIn);
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif /* SDK_NVSTATUS_H */