NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvos_common_tegra_safety.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef INCLUDED_NVOS_COMMON_TEGRA_SAFETY_H
14 #define INCLUDED_NVOS_COMMON_TEGRA_SAFETY_H
15 
16 #include <errno.h>
17 #include <stdio.h>
18 #include "nvcommon.h"
19 #include "nverror.h"
20 
21 #include "nvos_static_analysis.h"
22 
23 #if defined(__QNX__)
24 
25 #ifndef EOK
26 #define EOK 0
27 #endif
28 
32 typedef NvS32 NvOsTlsKeyHandle;
33 
34 /*
35  * qnx/src/libs/nvcpufreq/common_cpufreq_t18x.c
36  */
37 typedef paddr_t NvOsPhysAddr;
38 
39 #elif defined(__linux__)
40 
41 typedef NvU32 NvOsTlsKeyHandle;
42 
43 typedef NvU32 NvOsPhysAddr;
44 
45 #endif /* defined(__QNX__) */
46 
47 #if defined(__cplusplus)
48 extern "C"
49 {
50 #endif
51 
55 #define NVOS_OPEN_READ (0x1U)
56 
60 #define NVOS_OPEN_WRITE (0x2U)
61 
65 #define NVOS_OPEN_CREATE (0x4U)
66 
70 #define NVOS_OPEN_APPEND (0x8U)
71 
75 typedef void *NvOsDirHandle;
76 
81 typedef enum
82 {
89 
90  NvOsFileType_Force32 = 0x7FFFFFFF
91 } NvOsFileType;
92 
93 /* Magic number for opaque handle */
94 #define NVOS_MAGIC_NUM_COMMON (0xF0250000U)
95 #define NVOS_MAGIC_NUM_COND_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000A001U)
96 #define NVOS_MAGIC_NUM_FILE_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000B001U)
97 #define NVOS_MAGIC_NUM_LIB_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000C001U)
98 #define NVOS_MAGIC_NUM_MUTEX_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000D001U)
99 #define NVOS_MAGIC_NUM_SEMA_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000E001U)
100 #define NVOS_MAGIC_NUM_THREAD_HANDLE (NVOS_MAGIC_NUM_COMMON | 0x0000F001U)
101 #define NVOS_MAGIC_NUM_INVALID (0xFFFFFFFFU)
102 
103 typedef struct NvOsFileRec
104 {
105  FILE *file;
106  int fd;
108  NvU32 reserved;
109 } NvOsFile;
110 
114 typedef struct NvOsFileRec *NvOsFileHandle;
115 
120 typedef struct NvOsStatTypeRec
121 {
122  NvU64 size;
124  NvU64 mtime;
125 } NvOsStatType;
126 
127 #if defined(__QNX__)
128 /* This static function converts QNX errno to NvError.
129  * The caller of this function should first check the return valu of QNX API.
130  * When QNX API is failed and errno is set, it should call this function.
131  */
132 static inline void NvOsQnxErrnoToNvError(NvError *e)
133 {
134  NvS32 tmp = errno;
135 
136  switch (tmp)
137  {
138  case EROFS:
139  *e = NvError_ReadOnlyAttribute;
140  break;
141  case ENOENT:
142  *e = NvError_FileNotFound;
143  break;
144  case EACCES:
145  *e = NvError_AccessDenied;
146  break;
147  case ENOTDIR:
148  *e = NvError_DirOperationFailed;
149  break;
150  case EFAULT:
151  *e = NvError_InvalidAddress;
152  break;
153  case ENFILE:
154  *e = NvError_NotSupported;
155  break;
156  case EMFILE:
157  *e = NvError_NotSupported;
158  break;
159  case EIO:
160  *e = NvError_ResourceError;
161  break;
162  case EADDRINUSE:
163  *e = NvError_AlreadyAllocated;
164  break;
165  case EBADF:
166  *e = NvError_FileOperationFailed;
167  break;
168  case EBUSY:
169  case EAGAIN:
170  *e = NvError_Busy;
171  break;
172  case EADDRNOTAVAIL:
173  *e = NvError_InvalidAddress;
174  break;
175  case EFBIG:
176  *e = NvError_InvalidSize;
177  break;
178  case EINTR:
179  *e = NvError_InterruptedBySignal;
180  break;
181  case EALREADY:
182  *e = NvError_AlreadyAllocated;
183  break;
184  case ENOTSUP:
185  *e = NvError_NotSupported;
186  break;
187  case ENOSPC:
188  *e = NvError_InvalidSize;
189  break;
190  case EPERM:
191  *e = NvError_AccessDenied;
192  break;
193  case ETIME:
194  *e = NvError_Timeout;
195  break;
196  case ETIMEDOUT:
197  *e = NvError_Timeout;
198  break;
199  case ELOOP:
200  *e = NvError_InvalidState;
201  break;
202  case ENXIO:
203  *e = NvError_ModuleNotPresent;
204  break;
205  case EINVAL:
206  *e = NvError_BadParameter;
207  break;
208  case ENOSYS:
209  *e = NvError_NotSupported;
210  break;
211  case ENOMEM:
212  *e = NvError_InsufficientMemory;
213  break;
214  case ESRCH:
215  *e = NvError_ProcessDoesNotExist;
216  break;
217  case ERANGE:
218  *e = NvError_InvalidSize;
219  break;
220  default:
221  *e = NvError_InvalidState;
222  break;
223  }
224 }
225 
226 #elif defined(__linux__)
227 
228 static inline NvBool NvOsLinuxErrnoToNvError(NvError *e)
229 {
230  switch (errno)
231  {
232  case EROFS: *e = NvError_ReadOnlyAttribute; break;
233  case ENOENT: *e = NvError_FileNotFound; break;
234  case EACCES: *e = NvError_AccessDenied; break;
235  case ENOTDIR: *e = NvError_DirOperationFailed; break;
236  case EEXIST: *e = NvError_PathAlreadyExists; break;
237  case EFAULT: *e = NvError_InvalidAddress; break;
238  case ENFILE: *e = NvError_FileOperationFailed; break;
239  case EMFILE: *e = NvError_FileOperationFailed; break;
240  case EIO: *e = NvError_ResourceError; break;
241  case EADDRINUSE: *e = NvError_AlreadyAllocated; break;
242  case EBADF: *e = NvError_FileOperationFailed; break;
243  case EAGAIN: *e = NvError_Busy; break;
244  case EADDRNOTAVAIL: *e = NvError_InvalidAddress; break;
245  case EFBIG: *e = NvError_InvalidSize; break;
246  case EINTR: *e = NvError_Timeout; break;
247  case EALREADY: *e = NvError_AlreadyAllocated; break;
248  case EOPNOTSUPP: *e = NvError_NotSupported; break;
249  case ENOSPC: *e = NvError_InvalidSize; break;
250  case EPERM: *e = NvError_AccessDenied; break;
251  case ETIME: *e = NvError_Timeout; break;
252  case ETIMEDOUT: *e = NvError_Timeout; break;
253  case ELOOP: *e = NvError_InvalidState; break;
254  case ENXIO: *e = NvError_ModuleNotPresent; break;
255  case ENOMEM: *e = NvError_InsufficientMemory; break;
256  case EINVAL: *e = NvError_BadValue; break;
257  case ENODEV: *e = NvError_DeviceNotFound; break;
258  case ERANGE: *e = NvError_InvalidSize; break;
259  default:
260  return NV_FALSE;
261  }
262  errno = 0;
263  return NV_TRUE;
264 }
265 
266 #endif /* defined(__QNX__) */
267 
268 /*
269  * These definitions are not used for NvOS S!, S2 and S3 units.
270  * However, they has been used from legacy NvOS header, so they have blocked
271  * a migration both NvOS QNX and Common header files.
272  * To resolve blocking, these definitions are copied from legacy NvOS header.
273  * Eventually, these definitions will be moved into actual using components.
274  */
275 
276 /*
277  * Used by core/include/nvrm_memmgr.h
278  */
280 typedef enum
281 {
282 #ifdef INCLUDED_NVOS_H
283  NvOsMemAttribute_Reserved = 0,
284 #else
286 #endif
294 
297 
298 #ifdef INCLUDED_NVOS_H
299 #if defined(__LP64__) && !defined(__DEPRECATE_NVOS_MEM_ATTR_UNCACHED__) && (!NVOS_IS_QNX)
300  #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
301  #pragma GCC diagnostic warning "-Wdeprecated-declarations"
302  #define DEPRECATE_NVOS_MEM_ATTR_UNCACHED __attribute__ ((deprecated(\
303  "Use NvOsMemAttribute_WriteCombined instead!!\n"\
304  "Use proper barrier protection when moved to writecombined\n"\
305  "VPR is treated as strongly ordered in kernel even if you use\n"\
306  "writecombined. So, no need for barrier protection for VPR allocations")))
307  DEPRECATE_NVOS_MEM_ATTR_UNCACHED static const NvOsMemAttribute NvOsMemAttribute_Uncached = NvOsMemAttribute_Reserved;
308  #else
309  #define NvOsMemAttribute_Uncached NvOsMemAttribute_Reserved
310  #endif
311 #else
312  #define NvOsMemAttribute_Uncached NvOsMemAttribute_Reserved
313 #endif
314 #endif
315 
317 #define NVOS_MEM_NONE 0x0U
318 
320 #define NVOS_MEM_READ 0x1U
321 
323 #define NVOS_MEM_WRITE 0x2U
324 
326 #define NVOS_MEM_EXECUTE 0x4U
327 
329 #define NVOS_MEM_READ_WRITE (NVOS_MEM_READ | NVOS_MEM_WRITE)
330 
332 #define NVOS_MEM_MMAP_FIXED 0x40U
333 
335 #define NVOS_MEM_MMAP_LAZY 0x80U
336 
338 #define NVOS_MEM_MMAP_POPULATE 0x100U
339 
340 /*
341  * Used by tests-multimedia
342  */
350 typedef enum
351 {
356  NvOsCodePage_Force32 = 0x7fffffffUL,
357 } NvOsCodePage;
358 
359 #if !defined(NV_ENABLE_DEBUG_PRINTS)
360 #define NV_ENABLE_DEBUG_PRINTS 0
361 #endif
362 #if NV_ENABLE_DEBUG_PRINTS && NV_DEBUG
363 #define NV_DEBUG_PRINTF(x) do { NvOsDebugPrintf x; } while (NV_FALSE)
364 #else
365 #define NV_DEBUG_PRINTF(x) do {} while (NV_FALSE)
366 #endif
367 
370 #define NVOS_PATH_MAX 256
371 
372 typedef enum
373 {
382 
386 
387 /*
388  * Used by gpu/drv/driver/unix/common/nvos
389  */
390 typedef struct NvOsSharedMemRec *NvOsSharedMemHandle;
391 
392 NvError
393 NvOsSharedMemAlloc(const char *key, size_t size,
394  NvOsSharedMemHandle *descriptor);
395 
396 NvError
398 
399 void NvOsSharedMemFree(NvOsSharedMemHandle descriptor);
400 
401 NvError
402 NvOsSharedMemGetFd(NvOsSharedMemHandle descriptor, int *fd);
403 
404 NvError
405 NvOsSharedMemMap(NvOsSharedMemHandle descriptor, size_t offset,
406  size_t size, void **ptr);
407 
408 void NvOsSharedMemUnmap(void *ptr, size_t size);
409 
410 /*
411  * Used by core/drivers/nvrm/memory/nvrm_memmgr_private.h
412  */
413 typedef enum
414 {
417 
419 } NvOsPageFlags;
420 
421 typedef struct NvOsPageAllocRec *NvOsPageAllocHandle;
422 
423 /*
424  * multimedia/codecs/nvmmlite_image/jpeg_enc_lite/nvjpegenc.h
425  */
426 typedef struct NvOsInterruptRec *NvOsInterruptHandle;
427 
474 int32_t NvOsSnprintfS32(char *dst, size_t max_count, NvS32 val);
475 
517 int32_t NvOsSnprintfU32(char *dst, size_t max_count, NvU32 val);
518 
560 int32_t NvOsSnprintfU64(char *dst, size_t max_count, NvU64 val);
561 
605 int32_t NvOsSnprintfStr(char *dst, size_t max_count, const char *src);
606 
653 int32_t NvOsSnprintfStrS32(
654  char *dst,
655  size_t max_count,
656  const char *src,
657  NvS32 val);
658 
705 int32_t NvOsSnprintfStrU32(
706  char *dst,
707  size_t max_count,
708  const char *src,
709  NvU32 val);
710 
757 int32_t NvOsSnprintfStrU64(
758  char *dst,
759  size_t max_count,
760  const char *src,
761  NvU64 val);
762 
809 int32_t NvOsSnprintfStrFloat(
810  char *dst,
811  size_t max_count,
812  const char *src,
813  NvF32 val);
814 
861 int32_t NvOsSnprintfStrPtr(
862  char *dst,
863  size_t max_count,
864  const char *src,
865  const void *ptr);
866 
913 int32_t NvOsSnprintfStrHexU32(
914  char *dst,
915  size_t max_count,
916  const char *src,
917  NvU32 val);
918 
966  char *dst,
967  size_t max_count,
968  const char *src,
969  NvU32 val);
970 
1017 int32_t NvOsSnprintfStrHexU64(
1018  char *dst,
1019  size_t max_count,
1020  const char *src,
1021  NvU64 val);
1022 
1070 int32_t NvOsSnprintfStrWith2S32(
1071  char *dst,
1072  size_t max_count,
1073  const char *src,
1074  NvS32 val0,
1075  NvS32 val1);
1076 
1124 int32_t NvOsSnprintfStrWith2U32(
1125  char *dst,
1126  size_t max_count,
1127  const char *src,
1128  NvU32 val0,
1129  NvU32 val1);
1130 
1163 long int NvUStrtol(const char *s, char **endptr, int base);
1164 
1197 uint32_t NvUStrtoui(const char *s, char **endptr, int32_t base);
1198 
1231 unsigned long int NvUStrtoul(const char *s, char **endptr, int base);
1232 
1266 unsigned long long int NvUStrtoull(const char *s, char **endptr, int base);
1267 
1299 size_t NvOsStrnlen(const char *s, size_t size);
1300 
1332 void NvOsStrncpy(char *dest, const char *src, size_t size);
1333 
1336 #define NV_SHOW_ERRORS NV_DEBUG
1337 #if NV_SHOW_ERRORS
1338 
1340 #define NV_SHOW_ERROR(err) NvOsShowError(err,__FILE__,__LINE__)
1341 #else
1342 
1344 #define NV_SHOW_ERROR(err) (err)
1345 #endif
1346 
1377 NvError
1378 NvOsShowError(NvError err, const char *file, int line);
1379 
1408 void NvOsMemcpy(void *dest, const void *src, size_t size);
1409 
1433 void NvOsThreadYield(void);
1434 
1460 NvU64 NvOsGetCurrentThreadId(void);
1461 
1496 void *NvUAlloc0(size_t size);
1497 
1535 NvError NvOsOpendir(const char *path, NvOsDirHandle *dir);
1536 
1570 void NvOsClosedir(NvOsDirHandle dir);
1571 
1617 NvError NvOsTlsAddTerminator(void (*func)(void *args), void *context);
1618 
1654 
1692 NvOsTlsKeyHandle NvOsTlsAllocWithDestructor(void (*destructor)(void *args));
1693 
1728 void NvOsTlsFree(NvOsTlsKeyHandle TlsIndex);
1729 
1758 void *NvOsTlsGet(NvOsTlsKeyHandle TlsIndex);
1759 
1796 #if defined(__QNX__)
1797 NvBool NvOsTlsRemoveTerminator(void (*func)(void *args), const void *context);
1798 #else
1799 NvBool NvOsTlsRemoveTerminator(void (*func)(void *args), void *context);
1800 #endif
1801 
1831 #if defined(__QNX__)
1832 void NvOsTlsSet(NvOsTlsKeyHandle TlsIndex, const void *value);
1833 #else
1834 void NvOsTlsSet(NvOsTlsKeyHandle TlsIndex, void *value);
1835 #endif
1836 
1837 
1847 typedef enum
1848 {
1855 
1857  NvOsSeek_Force32 = 0x7FFFFFFF
1858 } NvOsSeekEnum;
1859 
1899 NvError NvOsFgetc(NvOsFileHandle hFile, NvU8 *c);
1900 
1961 NvError NvOsFopen(const char *path, NvU32 flags, NvOsFileHandle *file);
1962 
2005 
2050  NvOsFileHandle hFile,
2051  void *ptr,
2052  size_t size,
2053  size_t *bytes);
2054 
2097 NvError NvOsFseek(NvOsFileHandle hFile, NvS64 offset, NvOsSeekEnum whence);
2098 
2141 NvError NvOsFstat(NvOsFileHandle hFile, NvOsStatType *filestat);
2142 
2176 NvError NvOsFtell(NvOsFileHandle hFile, NvU64 *position);
2177 
2218 NvError NvOsFwrite(NvOsFileHandle hFile, const void *ptr, size_t size);
2219 
2263 
2313 NvError NvOsStat(const char *filename, NvOsStatType *filestat);
2314 
2351 NvError NvOsStrncpySafe(char *dest, size_t destsz,
2352  const char *src, size_t count);
2353 
2390 NvError NvOsStrncatSafe(char *dest, size_t destsz,
2391  const char *src, size_t count);
2392 
2425 NvError NvOsStrErrorSafe(int errnum, char *buf, size_t buflen);
2426 
2427 #if defined(__cplusplus)
2428 }
2429 #endif
2430 
2431 #endif // INCLUDED_NVOS_COMMON_TEGRA_SAFETY_H
NvOsSnprintfStrWith2U32
int32_t NvOsSnprintfStrWith2U32(char *dst, size_t max_count, const char *src, NvU32 val0, NvU32 val1)
This function generates a formatted string with a string and two unsigned integers and copy it into t...
NvUAlloc0
void * NvUAlloc0(size_t size)
This function dynamically allocates zeroed memory.
NvOsCodePage_Windows1252
@ NvOsCodePage_Windows1252
Definition: nvos_common_tegra_safety.h:355
NvOsTlsGet
void * NvOsTlsGet(NvOsTlsKeyHandle TlsIndex)
This function gets the thread specific data, which is pointed by TlsIndex parameter.
NvOsFileType_Unknown
@ NvOsFileType_Unknown
Definition: nvos_common_tegra_safety.h:83
NvOsSnprintfStrHexU64
int32_t NvOsSnprintfStrHexU64(char *dst, size_t max_count, const char *src, NvU64 val)
This function generates a formatted string with a string and an unsigned 64bit integer(in hex format)...
NvOsSnprintfStrU64
int32_t NvOsSnprintfStrU64(char *dst, size_t max_count, const char *src, NvU64 val)
This function generates a formatted string with a string and unsigned 64-bit integer and copy it into...
NvOsPageAllocHandle
struct NvOsPageAllocRec * NvOsPageAllocHandle
Definition: nvos_common_tegra_safety.h:421
NvOsSeek_End
@ NvOsSeek_End
NvOS equivalent of SEEK_END.
Definition: nvos_common_tegra_safety.h:1854
NvOsMemcpy
void NvOsMemcpy(void *dest, const void *src, size_t size)
This function copy to destination pointer from source pointer, and copying length is given as size pa...
NvError
NvError
The NvError enumeration contains ALL return / error codes.
Definition: nverror.h:43
NvOsClosedir
void NvOsClosedir(NvOsDirHandle dir)
This function closes a directory.
NvOsFileType_Directory
@ NvOsFileType_Directory
Definition: nvos_common_tegra_safety.h:85
NvOsFileRec::reserved
NvU32 reserved
Definition: nvos_common_tegra_safety.h:108
NvOsCodePage_Force32
@ NvOsCodePage_Force32
Definition: nvos_common_tegra_safety.h:356
NvOsThreadYield
void NvOsThreadYield(void)
This function yields the caller thread and let other thread run.
NvOsCodePage_Utf8
@ NvOsCodePage_Utf8
Definition: nvos_common_tegra_safety.h:353
NvOsFcloseEx
NvError NvOsFcloseEx(NvOsFileHandle hFile)
This function closes a file stream.
NvOsSnprintfStrHexRawBytes
int32_t NvOsSnprintfStrHexRawBytes(char *dst, size_t max_count, const char *src, NvU32 val)
This function generates a formatted string with a string and an unsigned integer(in hex format) and c...
NvOsThreadPriorityType_Last
@ NvOsThreadPriorityType_Last
Definition: nvos_common_tegra_safety.h:383
NvOsMemAttribute_End
@ NvOsMemAttribute_End
Definition: nvos_common_tegra_safety.h:293
nverror.h
NvOsFileType_File
@ NvOsFileType_File
Definition: nvos_common_tegra_safety.h:84
NvOsStrncpySafe
NvError NvOsStrncpySafe(char *dest, size_t destsz, const char *src, size_t count)
This function copies the source string to the destination string up to the maximum length specified b...
NvOsMemFlags_Forceword
@ NvOsMemFlags_Forceword
Definition: nvos_common_tegra_safety.h:418
NvOsThreadPriorityType_Native
@ NvOsThreadPriorityType_Native
NvOsThreadPriorityType_Native is ONLY valid when used with NvOsThreadCreateWithAttr using this value ...
Definition: nvos_common_tegra_safety.h:381
NvOsOpendir
NvError NvOsOpendir(const char *path, NvOsDirHandle *dir)
This function opens a directory.
NvOsSeek_Set
@ NvOsSeek_Set
NvOS equivalent of SEEK_SET.
Definition: nvos_common_tegra_safety.h:1850
NvOsCodePage
NvOsCodePage
Defines straight-forward mappings to international language encodings.
Definition: nvos_common_tegra_safety.h:350
NvOsSnprintfStrS32
int32_t NvOsSnprintfStrS32(char *dst, size_t max_count, const char *src, NvS32 val)
This function generates a formatted string with a string and a signed integer and copy it into the ou...
NvOsStrncpy
void NvOsStrncpy(char *dest, const char *src, size_t size)
This function copy to dest string parameter from src string parameter, And the maximum copying length...
NvOsSnprintfStrHexU32
int32_t NvOsSnprintfStrHexU32(char *dst, size_t max_count, const char *src, NvU32 val)
This function generates a formatted string with a string and an unsigned integer(in hex format) and c...
NvOsSnprintfStrU32
int32_t NvOsSnprintfStrU32(char *dst, size_t max_count, const char *src, NvU32 val)
This function generates a formatted string with a string and unsigned integer and copy it into the ou...
NvOsTlsKeyHandle
NvU32 NvOsTlsKeyHandle
Definition: nvos_common_tegra_safety.h:41
NvOsSnprintfU32
int32_t NvOsSnprintfU32(char *dst, size_t max_count, NvU32 val)
This function generates a formatted string with a unsigned integer and copy it into the output array,...
NvOsInterruptHandle
struct NvOsInterruptRec * NvOsInterruptHandle
Definition: nvos_common_tegra_safety.h:426
NvOsFileRec
Definition: nvos_common_tegra_safety.h:103
NvOsFileType_CharacterDevice
@ NvOsFileType_CharacterDevice
Definition: nvos_common_tegra_safety.h:87
NvOsPageFlags_Contiguous
@ NvOsPageFlags_Contiguous
Definition: nvos_common_tegra_safety.h:415
NvOsFread
NvError NvOsFread(NvOsFileHandle hFile, void *ptr, size_t size, size_t *bytes)
This function read from a file stream and store to ptr parameter.
NvOsShowError
NvError NvOsShowError(NvError err, const char *file, int line)
This function prints an error and the line it appeared on. Does nothing if err is NvSuccess.
NvOsStatType
struct NvOsStatTypeRec NvOsStatType
NvOsSnprintfStrPtr
int32_t NvOsSnprintfStrPtr(char *dst, size_t max_count, const char *src, const void *ptr)
This function generates a formatted string with a string and a pointer and copy it into the output ar...
NvOsFileRec::type
NvOsFileType type
Definition: nvos_common_tegra_safety.h:107
NvOsTlsAddTerminator
NvError NvOsTlsAddTerminator(void(*func)(void *args), void *context)
This function registers a function which will be called when thread terminates successfully.
NvOsSharedMemMap
NvError NvOsSharedMemMap(NvOsSharedMemHandle descriptor, size_t offset, size_t size, void **ptr)
nvcommon.h
NvOsStrErrorSafe
NvError NvOsStrErrorSafe(int errnum, char *buf, size_t buflen)
The function converts an error number to an error string and stores the string inside the buffer spec...
NvOsSharedMemHandle
struct NvOsSharedMemRec * NvOsSharedMemHandle
Definition: nvos_common_tegra_safety.h:390
NvUStrtoui
uint32_t NvUStrtoui(const char *s, char **endptr, int32_t base)
This function convert to unsigned int from string pointer.
NvOsLinuxErrnoToNvError
static NvBool NvOsLinuxErrnoToNvError(NvError *e)
Definition: nvos_common_tegra_safety.h:228
NvOsFile
struct NvOsFileRec NvOsFile
NvOsFileType_Force32
@ NvOsFileType_Force32
Definition: nvos_common_tegra_safety.h:90
NvOsFstat
NvError NvOsFstat(NvOsFileHandle hFile, NvOsStatType *filestat)
This function gets a type of file stream, as file, directory, fifo, character device and unknown.
NvOsStatTypeRec::size
NvU64 size
Definition: nvos_common_tegra_safety.h:122
NvOsFopen
NvError NvOsFopen(const char *path, NvU32 flags, NvOsFileHandle *file)
This function opens a file stream from path parameter.
NvUStrtol
long int NvUStrtol(const char *s, char **endptr, int base)
This function converts a string to integer.
NvOsStrnlen
size_t NvOsStrnlen(const char *s, size_t size)
This function counts the length of given string, and its length is counted up to given size parameter...
nvos_static_analysis.h
NvUStrtoull
unsigned long long int NvUStrtoull(const char *s, char **endptr, int base)
This function convert to unsigned long long int from string pointer.
NvOsSnprintfS32
int32_t NvOsSnprintfS32(char *dst, size_t max_count, NvS32 val)
This function generates a formatted string with a signed integer and copy it into the output array,...
NvOsFseek
NvError NvOsFseek(NvOsFileHandle hFile, NvS64 offset, NvOsSeekEnum whence)
This function changes the current position of file stream as it is specified by offset and whence par...
NvOsFileHandle
struct NvOsFileRec * NvOsFileHandle
Definition: nvos_common_tegra_safety.h:114
NvOsThreadPriorityType_Force32
@ NvOsThreadPriorityType_Force32
Definition: nvos_common_tegra_safety.h:384
NvOsSeek_Cur
@ NvOsSeek_Cur
NvOS equivalent of SEEK_CUR.
Definition: nvos_common_tegra_safety.h:1852
NvOsSnprintfU64
int32_t NvOsSnprintfU64(char *dst, size_t max_count, NvU64 val)
This function generates a formatted string with an unsigned 64-bit integer and copy it into the outpu...
NvOsStrncatSafe
NvError NvOsStrncatSafe(char *dest, size_t destsz, const char *src, size_t count)
This function appends the source string to the destination string up to the maximum length specified ...
NvOsTlsAlloc
NvOsTlsKeyHandle NvOsTlsAlloc(void)
This function creates a thread specific data.
NvUStrtoul
unsigned long int NvUStrtoul(const char *s, char **endptr, int base)
This function convert to unsigned long int from string pointer.
NvOsFileType
NvOsFileType
Definition: nvos_common_tegra_safety.h:81
NvOsSharedMemAlloc
NvError NvOsSharedMemAlloc(const char *key, size_t size, NvOsSharedMemHandle *descriptor)
NvOsPhysAddr
NvU32 NvOsPhysAddr
Definition: nvos_common_tegra_safety.h:43
NvOsStat
NvError NvOsStat(const char *filename, NvOsStatType *filestat)
This function gets a type of path.
NvOsTlsRemoveTerminator
NvBool NvOsTlsRemoveTerminator(void(*func)(void *args), void *context)
This function unregisters a function from the list of functions will be called when thread terminates...
NvOsFileType_Fifo
@ NvOsFileType_Fifo
Definition: nvos_common_tegra_safety.h:86
NvOsMemAttribute_InnerWriteBack
@ NvOsMemAttribute_InnerWriteBack
Definition: nvos_common_tegra_safety.h:289
NvOsTlsFree
void NvOsTlsFree(NvOsTlsKeyHandle TlsIndex)
This function free the thread specific data, which is pointed by TlsIndex parameter.
NvOsSharedMemFree
void NvOsSharedMemFree(NvOsSharedMemHandle descriptor)
NvOsMemAttribute
NvOsMemAttribute
Defines memory attributes.
Definition: nvos_common_tegra_safety.h:280
NvOsTlsSet
void NvOsTlsSet(NvOsTlsKeyHandle TlsIndex, void *value)
This function set a thread specific data, which is pointed by TlsIndex parameter.
NvOsFileRec::file
FILE * file
Definition: nvos_common_tegra_safety.h:105
NvOsPageFlags_NonContiguous
@ NvOsPageFlags_NonContiguous
Definition: nvos_common_tegra_safety.h:416
NvOsSharedMemHandleFromFd
NvError NvOsSharedMemHandleFromFd(int fd, NvOsSharedMemHandle *descriptor)
NvOsSharedMemGetFd
NvError NvOsSharedMemGetFd(NvOsSharedMemHandle descriptor, int *fd)
NvOsSeek_Force32
@ NvOsSeek_Force32
Max value of NvOsSeekEnum.
Definition: nvos_common_tegra_safety.h:1857
NvOsSnprintfStrWith2S32
int32_t NvOsSnprintfStrWith2S32(char *dst, size_t max_count, const char *src, NvS32 val0, NvS32 val1)
This function generates a formatted string with a string and two signed integers and copy it into the...
NvOsStatTypeRec
Definition: nvos_common_tegra_safety.h:120
NvOsCodePage_Unknown
@ NvOsCodePage_Unknown
Definition: nvos_common_tegra_safety.h:352
NvOsMemAttribute_Uncached
@ NvOsMemAttribute_Uncached
Definition: nvos_common_tegra_safety.h:285
NvOsCodePage_Utf16
@ NvOsCodePage_Utf16
Definition: nvos_common_tegra_safety.h:354
NvOsSnprintfStr
int32_t NvOsSnprintfStr(char *dst, size_t max_count, const char *src)
This function generates a formatted string with a string and copy it into the output array,...
NvOsMemAttribute_Secured
@ NvOsMemAttribute_Secured
Definition: nvos_common_tegra_safety.h:290
NvOsFflush
NvError NvOsFflush(NvOsFileHandle hFile)
This function flush a file stream, if there is any buffered/unwritten memory regarding the file strea...
NvOsMemAttribute_Force32
@ NvOsMemAttribute_Force32
Definition: nvos_common_tegra_safety.h:295
NvOsMemAttribute_DeviceMemory
@ NvOsMemAttribute_DeviceMemory
Definition: nvos_common_tegra_safety.h:291
NvOsThreadPriorityType_NearInterrupt
@ NvOsThreadPriorityType_NearInterrupt
Definition: nvos_common_tegra_safety.h:375
NvOsStatTypeRec::type
NvOsFileType type
Definition: nvos_common_tegra_safety.h:123
NvOsSeekEnum
NvOsSeekEnum
Definition: nvos_common_tegra_safety.h:1847
NvOsGetCurrentThreadId
NvU64 NvOsGetCurrentThreadId(void)
This function returns the thread id.
NvOsFileRec::fd
int fd
Definition: nvos_common_tegra_safety.h:106
NvOsTlsAllocWithDestructor
NvOsTlsKeyHandle NvOsTlsAllocWithDestructor(void(*destructor)(void *args))
This function creates a thread specific data, and store function pointer into it, and the function po...
NvOsDirHandle
void * NvOsDirHandle
Definition: nvos_common_tegra_safety.h:75
NvOsFtell
NvError NvOsFtell(NvOsFileHandle hFile, NvU64 *position)
This function gets the current position of file stream, and it is stored to position parameter as byt...
NvOsMemAttribute_SO_DeviceMemory
@ NvOsMemAttribute_SO_DeviceMemory
Definition: nvos_common_tegra_safety.h:292
NvOsStatTypeRec::mtime
NvU64 mtime
Definition: nvos_common_tegra_safety.h:124
NvOsFileType_BlockDevice
@ NvOsFileType_BlockDevice
Definition: nvos_common_tegra_safety.h:88
NvOsFwrite
NvError NvOsFwrite(NvOsFileHandle hFile, const void *ptr, size_t size)
This function writes the buffer to a file stream, and the length or writing is up to size parameter.
NvOsSharedMemUnmap
void NvOsSharedMemUnmap(void *ptr, size_t size)
NvOsThreadPriorityType
NvOsThreadPriorityType
Definition: nvos_common_tegra_safety.h:372
NvOsMemAttribute_WriteBack
@ NvOsMemAttribute_WriteBack
Definition: nvos_common_tegra_safety.h:287
NvOsPageFlags
NvOsPageFlags
Definition: nvos_common_tegra_safety.h:413
NvOsSnprintfStrFloat
int32_t NvOsSnprintfStrFloat(char *dst, size_t max_count, const char *src, NvF32 val)
This function generates a formatted string with a string and a float and copy it into the output arra...
NvOsMemAttribute_WriteCombined
@ NvOsMemAttribute_WriteCombined
Definition: nvos_common_tegra_safety.h:288
NvOsThreadPriorityType_Normal
@ NvOsThreadPriorityType_Normal
Definition: nvos_common_tegra_safety.h:374
NvOsFgetc
NvError NvOsFgetc(NvOsFileHandle hFile, NvU8 *c)
This function read a character from the current position of a file stream,and the read character is s...