NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
nvos_tegra_nonsafety.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION and its licensors retain all intellectual property
6  * and proprietary rights in and to this software, related documentation
7  * and any modifications thereto. Any use, reproduction, disclosure or
8  * distribution of this software and related documentation without an express
9  * license agreement from NVIDIA CORPORATION is strictly prohibited
10  */
11 
12 #ifndef INCLUDED_NVOS_TEGRA_NONSAFETY_H
13 #define INCLUDED_NVOS_TEGRA_NONSAFETY_H
14 
94 #include <stdarg.h>
95 #include "nvcommon.h"
96 #include "nverror.h"
97 /* common logging APIs */
98 #include "nvos_s3_tegra_log.h"
99 #if defined(__cplusplus)
100 extern "C"
101 {
102 #endif
103 
116 #if NVOS_IS_WINDOWS
117 typedef NvU64 NvOsPhysAddr;
118 #else
119 typedef NvU32 NvOsPhysAddr;
120 #endif
121 
124 #define NVOS_KEY_MAX 128
125 
128 #define NVOS_PATH_MAX 256
129 
132 #define NVOS_HAS_MTIME 1
133 
136 #define NVOS_HAS_MKDIR 1
137 
140 #define NVOS_HAS_FTRUNCATE 1
141 
144 #define NVOS_HAS_CONDITION 1
145 
149 
151 typedef struct NvOsFileRec *NvOsFileHandle;
152 
158 NvError
159 NvOsFprintf(NvOsFileHandle stream, const char *format, ...);
160 
161 // Doxygen requires escaping backslash characters (\) with another \ so in
162 // @return, ignore the first backslash if you are reading this in the header.
173 NvS32
174 NvOsSnprintf(char *str, size_t size, const char *format, ...);
175 
182 NvError
183 NvOsVfprintf(NvOsFileHandle stream, const char *format, va_list ap);
184 
196 NvS32
197 NvOsVsnprintf(char *str, size_t size, const char *format, va_list ap);
198 
206 void
207 NvOsDebugPrintf(const char *format, ...);
208 
212 void
213 NvOsLogPrintf(int prio, const char *tag, const char *format, ...);
214 
218 void
219 NvOsDebugVprintf( const char *format, va_list ap );
220 
226 NvS32
227 NvOsDebugNprintf( const char *format, ...);
228 
229 void
230 NvOsDebugString(const char *str);
231 
232 enum {
238 };
239 
240 int
241 NvOsSetVerboseLevel(NvS32 VerbLevel);
242 
243 int
244 NvOsGetVerboseLevel(NvS32 *VerbLevel);
245 
246 void
247 NvOsVerbosePrintf(NvS32 VerbLevel, const char *Fmt, ...);
248 
258 NvError
259 NvOsShowError(NvError err, const char *file, int line);
260 
272 #define NV_SHOW_ERRORS NV_DEBUG
273 #if NV_SHOW_ERRORS
274 #define NV_SHOW_ERROR(err) NvOsShowError(err,__FILE__,__LINE__)
275 #else
276 #define NV_SHOW_ERROR(err) (err)
277 #endif
278 
279 // Doxygen requires escaping # with a backslash, so in the examples below
280 // ignore the backslash before the # if reading this in the header file.
303 #if !defined(NV_ENABLE_DEBUG_PRINTS)
304 #define NV_ENABLE_DEBUG_PRINTS 0
305 #endif
306 #if NV_ENABLE_DEBUG_PRINTS
307 #define NV_DEBUG_PRINTF(x) do { NvOsDebugPrintf x; } while (NV_FALSE)
308 #else
309 #define NV_DEBUG_PRINTF(x) do {} while (NV_FALSE)
310 #endif
311 
316 
317 typedef enum
318 {
319  NvOsOs_Unknown = 0x0UL,
320  NvOsOs_Windows = 0x1UL,
321  NvOsOs_Linux = 0x2UL,
322  NvOsOs_Qnx = 0x4UL,
324  NvOsOs_Force32 = 0x7fffffffUL,
325 } NvOsOs;
326 
327 typedef enum
328 {
331  NvOsSku_Force32 = 0x7fffffffUL,
332 } NvOsSku;
333 
334 typedef struct NvOsOsInfoRec
335 {
338 } NvOsOsInfo;
339 
345 NvError
347 
353 
363 void
364 NvOsStrcpy(char *dest, const char *src);
365 
374 void
375 NvOsStrncpy(char *dest, const char *src, size_t size);
376 
384 typedef enum
385 {
390  NvOsCodePage_Force32 = 0x7fffffffUL,
391 } NvOsCodePage;
392 
399 size_t
400 NvOsStrlen(const char *s);
401 
407 size_t
408 NvOsStrnlen(const char *s, size_t size);
409 
414 
423 void NvOsMemcpy(void *dest, const void *src, size_t size);
424 
435 int
436 NvOsMemcmp(const void *s1, const void *s2, size_t size);
437 
446 void
447 NvOsMemset(void *s, NvU8 c, size_t size);
448 
453 
458 typedef enum
459 {
466 
468  NvOsSeek_Force32 = 0x7FFFFFFF
469 } NvOsSeekEnum;
470 
471 typedef enum
472 {
479 
480  NvOsFileType_Force32 = 0x7FFFFFFF
481 } NvOsFileType;
482 
483 #if NVOS_IS_LINUX
484 typedef struct NvOsFileRec
485 {
486  int fd;
488 } NvOsFile;
489 #endif
490 
491 typedef struct NvOsStatTypeRec
492 {
493  NvU64 size;
496  NvU64 mtime;
497 } NvOsStatType;
498 
500 #define NVOS_OPEN_READ 0x1
501 
503 #define NVOS_OPEN_WRITE 0x2
504 
506 #define NVOS_OPEN_CREATE 0x4
507 
509 #define NVOS_OPEN_APPEND 0x8
510 
526 NvError
527 NvOsFopen(const char *path, NvU32 flags, NvOsFileHandle *file);
528 
539 
545 void NvOsFclose(NvOsFileHandle stream);
546 
555 NvError
556 NvOsFwrite(NvOsFileHandle stream, const void *ptr, size_t size);
557 
579 NvError
580 NvOsFread(NvOsFileHandle stream, void *ptr, size_t size, size_t *bytes);
581 
589 NvError
590 NvOsFgetc(NvOsFileHandle stream, NvU8 *c);
591 
600 NvError
601 NvOsFseek(NvOsFileHandle file, NvS64 offset, NvOsSeekEnum whence);
602 
610 NvError
611 NvOsFtell(NvOsFileHandle file, NvU64 *position);
612 
618 NvError
619 NvOsStat(const char *filename, NvOsStatType *stat);
620 
626 NvError
628 
633 NvError
634 NvOsFflush(NvOsFileHandle stream);
635 
643 NvError
644 NvOsFsync(NvOsFileHandle stream);
645 
653 NvError
654 NvOsFremove(const char *filename);
655 
665 NvError
666 NvOsFtruncate(NvOsFileHandle stream, NvU64 length);
667 
672 
674 typedef struct NvOsDirRec *NvOsDirHandle;
675 
683 NvError
684 NvOsOpendir(const char *path, NvOsDirHandle *dir);
685 
696 NvError
697 NvOsReaddir(NvOsDirHandle dir, char *name, size_t size);
698 
704 void NvOsClosedir(NvOsDirHandle dir);
705 
718 NvError NvOsMkdir(char *dirname);
719 
733 NvError
734 NvOsGetConfigU32(const char *name, NvU32 *value);
735 
748 NvError
749 NvOsGetConfigString(const char *name, char *value, NvU32 size);
750 
764 NvError
765 NvOsGetSysConfigString(const char *name, char *value, NvU32 size);
766 
771 
777 void *NvOsAlloc(size_t size);
778 
784 void *NvOsAllocAlign(size_t align, size_t size);
785 
791 void *NvOsRealloc(void *ptr, size_t size);
792 
800 void NvOsFree(void *ptr);
801 
804 typedef struct NvOsSharedMemRec *NvOsSharedMemHandle;
805 
817 NvError
818 NvOsSharedMemAlloc(const char *key, size_t size,
819  NvOsSharedMemHandle *descriptor);
820 
831 NvError
833 
842 NvError
843 NvOsSharedMemGetFd(NvOsSharedMemHandle descriptor, int *fd);
844 
854 NvError
855 NvOsSharedMemMap(NvOsSharedMemHandle descriptor, size_t offset,
856  size_t size, void **ptr);
857 
863 void NvOsSharedMemUnmap(void *ptr, size_t size);
864 
872 void NvOsSharedMemFree(NvOsSharedMemHandle descriptor);
873 
875 typedef enum
876 {
877 #ifdef INCLUDED_NVOS_TEGRA_NONSAFETY_H
878  NvOsMemAttribute_Reserved = 0,
879 #else
881 #endif
889 
892 
893 #ifdef INCLUDED_NVOS_TEGRA_NONSAFETY_H
894 #if defined(__LP64__) && !defined(__DEPRECATE_NVOS_MEM_ATTR_UNCACHED__) && (!NVOS_IS_QNX)
895  #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
896  #pragma GCC diagnostic warning "-Wdeprecated-declarations"
897  #define __DEPRECATE_NVOS_MEM_ATTR_UNCACHED__ __attribute__ ((deprecated(\
898  "Use NvOsMemAttribute_WriteCombined instead!!\n"\
899  "Use proper barrier protection when moved to writecombined\n"\
900  "VPR is treated as strongly ordered in kernel even if you use\n"\
901  "writecombined. So, no need for barrier protection for VPR allocations")))
902  __DEPRECATE_NVOS_MEM_ATTR_UNCACHED__ static const NvOsMemAttribute NvOsMemAttribute_Uncached = NvOsMemAttribute_Reserved;
903  #else
904  static const NvOsMemAttribute NvOsMemAttribute_Uncached = NvOsMemAttribute_Reserved;
905  #endif
906 #else
907  static const NvOsMemAttribute NvOsMemAttribute_Uncached = NvOsMemAttribute_Reserved;
908 #endif
909 #endif
910 
912 #define NVOS_MEM_NONE 0x0U
913 
915 #define NVOS_MEM_READ 0x1U
916 
918 #define NVOS_MEM_WRITE 0x2U
919 
921 #define NVOS_MEM_EXECUTE 0x4U
922 
927 #define NVOS_MEM_GLOBAL_ADDR 0x8U
928 
930 #define NVOS_MEM_READ_WRITE (NVOS_MEM_READ | NVOS_MEM_WRITE)
931 
933 #define NVOS_MEM_MMAP_FIXED 0x40U
934 
936 #define NVOS_MEM_MMAP_LAZY 0x80U
937 
939 #define NVOS_MEM_MMAP_POPULATE 0x100U
940 
949 NvError
950 NvOsPhysicalMemMap(NvOsPhysAddr phys, size_t size,
951  NvOsMemAttribute attrib, NvU32 flags, void **ptr);
952 
960 void NvOsPhysicalMemUnmap(void *ptr, size_t size);
961 
966 
970 typedef enum
971 {
974 
976 } NvOsPageFlags;
977 
978 typedef struct NvOsPageAllocRec *NvOsPageAllocHandle;
979 
991 NvError
992 NvOsPageAlloc(size_t size, NvOsMemAttribute attrib,
993  NvOsPageFlags flags, NvU32 protect, NvOsPageAllocHandle *descriptor);
994 
1002 void
1003 NvOsPageFree(NvOsPageAllocHandle descriptor);
1004 
1017 NvError
1018 NvOsPageMap(NvOsPageAllocHandle descriptor, size_t offset, size_t size,
1019  void **ptr);
1020 
1029 void
1030 NvOsPageUnmap(NvOsPageAllocHandle descriptor, void *ptr, size_t size);
1031 
1040 NvOsPageAddress(NvOsPageAllocHandle descriptor, size_t offset);
1041 
1046 
1048 typedef struct NvOsLibraryRec *NvOsLibraryHandle;
1049 
1070 NvError
1071 NvOsLibraryLoad(const char *name, NvOsLibraryHandle *library);
1072 
1080 void*
1081 NvOsLibraryGetSymbol(NvOsLibraryHandle library, const char *symbol);
1082 
1088 void NvOsLibraryUnload(NvOsLibraryHandle library);
1089 
1099 
1104 
1105 typedef struct NvOsMutexRec *NvOsMutexHandle;
1106 typedef struct NvOsIntrMutexRec *NvOsIntrMutexHandle;
1107 typedef struct NvOsConditionRec *NvOsConditionHandle;
1108 typedef struct NvOsSemaphoreRec *NvOsSemaphoreHandle;
1109 typedef struct NvOsThreadRec *NvOsThreadHandle;
1110 
1118 void
1119 NvOsSleepMS(NvU32 msec);
1120 
1129 void NvOsWaitUS(NvU32 usec);
1130 
1131 NvError NvOsSleepUS(NvU32 usec);
1132 NvError NvOsSleepNS(NvU32 nsec);
1133 
1144 NvError NvOsBusyWaitUS(NvU32 usec);
1145 NvError NvOsBusyWaitNS(NvU32 nsec);
1146 
1159 
1167 void NvOsMutexLock(NvOsMutexHandle mutex);
1168 
1179 
1186 void NvOsMutexUnlock(NvOsMutexHandle mutex);
1187 
1197 
1205 void NvOsMutexDestroy(NvOsMutexHandle mutex);
1206 
1217 
1224 
1232 
1240 
1248 
1259 
1271 
1280 
1290 
1308 
1329 
1338 NvError
1339 NvOsSemaphoreCreate(NvOsSemaphoreHandle *semaphore, NvU32 value);
1340 
1350 NvError
1352 
1358 void NvOsSemaphoreWait(NvOsSemaphoreHandle semaphore);
1359 
1368 
1380 NvError
1381 NvOsSemaphoreWaitTimeout(NvOsSemaphoreHandle semaphore, NvU32 msec);
1382 
1388 
1396 
1407 
1419 
1420 typedef enum
1421 {
1424  // NvOsThreadPriorityType_Native is ONLY valid when used with NvOsThreadCreateWithAttr
1425  // Using this value means that the priority of thread will be set to "nativePriority"
1427 
1431 
1434 typedef void (*NvOsThreadFunction)(void *args);
1435 
1442 NvError
1443 NvOsThreadCreate( NvOsThreadFunction function, void *args,
1444  NvOsThreadHandle *thread);
1445 
1452 NvError
1454  NvOsThreadHandle *thread);
1455 
1460 const char*
1462 
1468 NvError
1469 NvOsThreadSetName( NvOsThreadHandle thread, const char *name);
1470 
1480 void NvOsThreadJoin(NvOsThreadHandle thread);
1481 
1493 
1496 void NvOsThreadYield(void);
1497 
1504 NvU64 NvOsGetCurrentThreadId(void);
1505 
1520 void *NvOsAtomicCompareExchangePtr(void **pTarget, void *OldValue,
1521  void *NewValue);
1522 
1537 NvS32 NvOsAtomicCompareExchange32(NvS32 *pTarget, NvS32 OldValue, NvS32
1538  NewValue);
1539 
1552 NvS32 NvOsAtomicExchange32(NvS32 *pTarget, NvS32 Value);
1553 
1566 NvS32 NvOsAtomicExchangeAdd32(NvS32 *pTarget, NvS32 Value);
1567 
1576 #if NVOS_IS_INTEGRITY
1577 typedef NvU64 NvOsTlsKeyHandle;
1578 #else
1579 typedef NvU32 NvOsTlsKeyHandle;
1580 #endif
1581 
1582 #define NVOS_INVALID_TLS_INDEX 0xFFFFFFFF
1583 #define NVOS_TLS_CNT 4
1584 
1593 
1602 NvOsTlsKeyHandle NvOsTlsAllocWithDestructor(void (*destructor)(void*));
1603 
1610 void NvOsTlsFree(NvOsTlsKeyHandle TlsIndex);
1611 
1618 void *NvOsTlsGet(NvOsTlsKeyHandle TlsIndex);
1619 
1626 void NvOsTlsSet(NvOsTlsKeyHandle TlsIndex, void *Value);
1627 
1635 NvError NvOsTlsAddTerminator(void (*func)(void *), void *context);
1636 
1646 NvBool NvOsTlsRemoveTerminator(void (*func)(void *), void *context);
1647 
1652 
1656 typedef struct NvOsSystemTimeRec
1657 {
1658  NvU32 Seconds;
1660 } NvOsSystemTime;
1661 
1666 NvError
1667 NvOsGetSystemTime(NvOsSystemTime *hNvOsSystemtime);
1668 
1677 NvU32
1678 NvOsGetTimeMS(void);
1679 
1692 NvU64
1693 NvOsGetTimeUS(void);
1694 
1707 NvU64
1708 NvOsGetTimeNS(void);
1709 
1716 
1719 void
1721 
1724 void
1726 
1732 void
1733 NvOsDataCacheWritebackRange(void *start, NvU32 length);
1734 
1740 void
1741 NvOsDataCacheWritebackInvalidateRange(void *start, NvU32 length);
1742 
1745 void
1747 
1753 void
1754 NvOsInstrCacheInvalidateRange(void *start, NvU32 length);
1755 
1764 NvBool
1765 NvOsIsMemoryOfGivenType(NvOsMemAttribute Attrib, NvU32 Addr);
1766 
1769 void
1771 
1774 typedef void (*NvOsInterruptHandler)(void *args);
1775 
1778 typedef struct NvOsInterruptRec *NvOsInterruptHandle;
1779 
1797 NvError
1798 NvOsInterruptRegister(NvU32 IrqListSize,
1799  const NvU32 *pIrqList,
1800  const NvOsInterruptHandler *pIrqHandlerList,
1801  void *context,
1803  NvBool InterruptEnable);
1804 
1814 void
1816 
1830 NvError
1832 
1839 void
1841 
1854 void NvOsInterruptMask(NvOsInterruptHandle handle, NvBool mask);
1855 
1856 struct NvOsAllocatorRec;
1857 typedef void* (*NvOsAllocFunc)(struct NvOsAllocatorRec *, size_t size);
1858 typedef void* (*NvOsAllocAlignFunc)(struct NvOsAllocatorRec *, size_t align, size_t size);
1859 typedef void* (*NvOsReallocFunc)(struct NvOsAllocatorRec *, void *ptr, size_t size);
1860 typedef void (*NvOsFreeFunc)(struct NvOsAllocatorRec *, void *ptr);
1861 
1862 typedef struct NvOsAllocatorRec {
1867 } NvOsAllocator;
1868 
1870 
1871 
1872 /*
1873  * Debug support.
1874  */
1875 #if NV_DEBUG
1876 
1877 // The first parameter of the debug allocator functions is a function pointer to the
1878 // actual allocator function.
1879 void *NvOsAllocLeak(NvOsAllocator *, size_t size, const char *f, int l);
1880 void *NvOsAllocAlignLeak(NvOsAllocator *, size_t align, size_t size, const char *f, int l);
1881 void *NvOsReallocLeak(NvOsAllocator *, void *ptr, size_t size, const char *f, int l);
1882 void NvOsFreeLeak(NvOsAllocator *, void *ptr, const char *f, int l);
1883 
1884 #define NvOsAlloc(size) NvOsAllocLeak(NvOsGetCurrentAllocator(), size, __FILE__, __LINE__)
1885 #define NvOsAllocAlign(align, size) NvOsAllocAlignLeak(NvOsGetCurrentAllocator(), align, size, __FILE__, __LINE__)
1886 #define NvOsRealloc(ptr, size) NvOsReallocLeak(NvOsGetCurrentAllocator(), ptr, size, __FILE__, __LINE__)
1887 #define NvOsFree(ptr) NvOsFreeLeak(NvOsGetCurrentAllocator(), ptr, __FILE__, __LINE__)
1888 
1889 #endif /* NVOS_DEBUG */
1890 
1891 
1892 #if NV_DEBUG
1893 
1905 void NvOsSetResourceAllocFileLine(void* userptr, const char* file, int line);
1906 
1907 static NV_INLINE NvError
1908 NvOsSharedMemAllocTraced(const char *key, size_t size,
1909  NvOsSharedMemHandle *descriptor, const char *f, int l )
1910 {
1911  NvError status;
1912  status = (NvOsSharedMemAlloc)(key, size, descriptor);
1913  if (status == NvSuccess)
1914  NvOsSetResourceAllocFileLine(*descriptor, f, l);
1915  return status;
1916 }
1917 
1918 static NV_INLINE NvError
1919 NvOsSharedMemHandleFromFdTraced(int fd,
1920  NvOsSharedMemHandle *descriptor, const char *f, int l )
1921 {
1922  NvError status;
1923  status = (NvOsSharedMemHandleFromFd)(fd, descriptor);
1924  if (status == NvSuccess)
1925  NvOsSetResourceAllocFileLine(*descriptor, f, l);
1926  return status;
1927 }
1928 
1929 static NV_INLINE NvError
1930 NvOsPhysicalMemMapTraced(NvOsPhysAddr phys, size_t size,
1931  NvOsMemAttribute attrib, NvU32 flags, void **ptr, const char *f, int l )
1932 {
1933  NvError status;
1934  status = (NvOsPhysicalMemMap)(phys, size, attrib, flags, ptr);
1935  if (status == NvSuccess)
1936  NvOsSetResourceAllocFileLine(*ptr, f, l);
1937  return status;
1938 }
1939 
1940 static NV_INLINE NvError
1941 NvOsPageAllocTraced(size_t size, NvOsMemAttribute attrib,
1942  NvOsPageFlags flags, NvU32 protect, NvOsPageAllocHandle *descriptor,
1943  const char *f, int l )
1944 {
1945  NvError status;
1946  status = (NvOsPageAlloc)(size, attrib, flags, protect, descriptor);
1947  if (status == NvSuccess)
1948  NvOsSetResourceAllocFileLine(*descriptor, f, l);
1949  return status;
1950 }
1951 
1952 static NV_INLINE NvError
1953 NvOsMutexCreateTraced(NvOsMutexHandle *mutex, const char *f, int l )
1954 {
1955  NvError status;
1956  status = (NvOsMutexCreate)(mutex);
1957  if (status == NvSuccess)
1958  NvOsSetResourceAllocFileLine(*mutex, f, l);
1959  return status;
1960 }
1961 
1962 static NV_INLINE NvError
1963 NvOsIntrMutexCreateTraced(NvOsIntrMutexHandle *mutex, const char *f, int l )
1964 {
1965  NvError status;
1966  status = (NvOsIntrMutexCreate)(mutex);
1967  if (status == NvSuccess)
1968  NvOsSetResourceAllocFileLine(*mutex, f, l);
1969  return status;
1970 }
1971 
1972 static NV_INLINE NvError
1973 NvOsSemaphoreCreateTraced( NvOsSemaphoreHandle *semaphore, NvU32 value,
1974  const char *f, int l )
1975 {
1976  NvError status;
1977  status = (NvOsSemaphoreCreate)(semaphore, value);
1978  if (status == NvSuccess)
1979  NvOsSetResourceAllocFileLine(*semaphore, f, l);
1980  return status;
1981 }
1982 
1983 static NV_INLINE NvError
1984 NvOsSemaphoreCloneTraced( NvOsSemaphoreHandle orig, NvOsSemaphoreHandle *clone,
1985  const char *f, int l )
1986 {
1987  NvError status;
1988  status = (NvOsSemaphoreClone)(orig, clone);
1989  if (status == NvSuccess)
1990  NvOsSetResourceAllocFileLine(*clone, f, l);
1991  return status;
1992 }
1993 
1994 static NV_INLINE NvError
1995 NvOsThreadCreateTraced( NvOsThreadFunction function, void *args,
1996  NvOsThreadHandle *thread, const char *f, int l )
1997 {
1998  NvError status;
1999  status = (NvOsThreadCreate)(function, args, thread);
2000  if (status == NvSuccess)
2001  NvOsSetResourceAllocFileLine(*thread, f, l);
2002  return status;
2003 }
2004 
2005 static NV_INLINE NvError
2006 NvOsInterruptRegisterTraced(NvU32 IrqListSize, const NvU32 *pIrqList,
2007  const NvOsInterruptHandler *pIrqHandlerList, void *context,
2008  NvOsInterruptHandle *handle, NvBool InterruptEnable, const char *f, int l )
2009 {
2010  NvError status;
2011  (void) f; /* potentially unused parameter */
2012  (void) l; /* potentially unused parameter */
2013  status = (NvOsInterruptRegister)(IrqListSize, pIrqList, pIrqHandlerList,
2014  context, handle, InterruptEnable);
2015  return status;
2016 }
2017 
2018 #define NvOsSharedMemAlloc(key, size, descriptor) \
2019  NvOsSharedMemAllocTraced(key, size, descriptor, __FILE__, __LINE__)
2020 #define NvOsSharedMemHandleFromFd(fd, descriptor) \
2021  NvOsSharedMemHandleFromFdTraced(fd, descriptor, __FILE__, __LINE__)
2022 #define NvOsPhysicalMemMap(phys, size, attrib, flags, ptr) \
2023  NvOsPhysicalMemMapTraced(phys, size, attrib, flags, ptr, \
2024  __FILE__, __LINE__)
2025 #define NvOsPageAlloc(size, attrib, flags, protect, descriptor) \
2026  NvOsPageAllocTraced(size, attrib, flags, protect, descriptor, \
2027  __FILE__, __LINE__)
2028 #define NvOsMutexCreate(mutex) NvOsMutexCreateTraced(mutex, __FILE__, __LINE__)
2029 #define NvOsIntrMutexCreate(mutex) \
2030  NvOsIntrMutexCreateTraced(mutex, __FILE__, __LINE__)
2031 #define NvOsSemaphoreCreate(semaphore, value) \
2032  NvOsSemaphoreCreateTraced(semaphore, value, __FILE__, __LINE__)
2033 #define NvOsSemaphoreClone(orig, semaphore) \
2034  NvOsSemaphoreCloneTraced(orig, semaphore, __FILE__, __LINE__)
2035 #define NvOsThreadCreate(func, args, thread) \
2036  NvOsThreadCreateTraced(func, args, thread, __FILE__, __LINE__)
2037 #define NvOsInterruptRegister(IrqListSize, pIrqList, pIrqHandlerList, \
2038  context, handle, InterruptEnable) \
2039  NvOsInterruptRegisterTraced(IrqListSize, pIrqList, pIrqHandlerList, \
2040  context, handle, InterruptEnable, __FILE__, __LINE__)
2041 
2042 #endif // NVOS_DEBUG
2043 
2044 // Forward declare resource tracking struct.
2045 typedef struct NvCallstackRec NvCallstack;
2046 
2047 typedef enum
2048 {
2052 
2056 
2057 typedef void (*NvOsDumpCallback)(void* context, const char* line);
2058 
2059 void NvOsDumpToDebugPrintf(void* context, const char* line);
2060 
2062 void NvOsCallstackDestroy (NvCallstack* callstack);
2063 NvU32 NvOsCallstackGetHeight (NvCallstack* stack);
2064 void NvOsCallstackGetFrame (char* buf, NvU32 len, NvCallstack* stack, NvU32 level);
2065 void NvOsCallstackDump (NvCallstack* stack, NvU32 skip, NvOsDumpCallback callBack, void* context);
2066 NvU32 NvOsCallstackHash (NvCallstack* stack);
2067 NvBool NvOsCallstackContainsPid (NvCallstack* stack, NvU32 pid);
2068 void NvOsGetProcessInfo (char* buf, NvU32 len);
2069 
2070 static NV_INLINE void NvOsDebugCallstack(NvU32 skip)
2071 {
2073  if (stack)
2074  {
2075  NvOsCallstackDump(stack, skip, NvOsDumpToDebugPrintf, NULL);
2076  NvOsCallstackDestroy(stack);
2077  }
2078 }
2079 
2089 int NvOsSetFpsTarget(int target);
2090 
2099 int NvOsModifyFpsTarget(int fd, int target);
2100 
2108 void NvOsCancelFpsTarget(int fd);
2109 
2110 
2111 #if NVOS_IS_HOS
2112 
2116 typedef int NvOsDrvHandle;
2117 
2122 NvOsDrvHandle NvOsDrvOpen(const char *pathname);
2123 
2127 void NvOsDrvClose(NvOsDrvHandle);
2128 
2133 NvError NvOsDrvIoctl(NvOsDrvHandle, unsigned int iocode, void *arg, size_t argsize);
2134 
2139 NvError NvOsDrvIoctl2(NvOsDrvHandle, unsigned int iocode, void *arg, size_t argsize, const void *inbuf, size_t inbufsize);
2140 
2145 NvError NvOsDrvIoctl3(NvOsDrvHandle, unsigned int iocode, void *arg, size_t argsize, void *outbuf, size_t outbufsize);
2146 
2150 NvError NvOsDrvMapSharedMem(NvOsDrvHandle, unsigned int handle, unsigned int hMem);
2151 
2166 typedef struct NvOsEventPoolRec NvOsEventPool;
2167 typedef struct NvOsEventRec NvOsEvent;
2168 
2169 NvError NvOsEventPoolCreate(NvU32 numEvents, NvOsEventPool **eventPool);
2170 
2175 void NvOsEventPoolDestroy(NvOsEventPool *eventPool);
2176 
2187 NvError NvOsEventPoolLink(NvOsEventPool *eventPool, NvOsEvent *event);
2188 
2195 void NvOsEventPoolWait(NvOsEventPool *eventPool, NvU32 timeoutUs, NvOsEvent **event);
2196 
2205 NvError NvOsSystemEventCreate(int fd, NvU32 id, NvOsEvent **event);
2206 
2214 NvError NvOsTimerEventCreate(NvU32 timeoutMs, NvOsEvent **event);
2215 
2222 NvError NvOsUserEventCreate(NvOsEvent **event);
2223 
2230 NvError NvOsUserEventSignal(NvOsEvent *event);
2231 
2236 void NvOsEventDestroy(NvOsEvent *event);
2237 
2244 void NvOsEventClear(NvOsEvent *event);
2245 
2257 NvError NvOsEventWait(NvOsEvent* event, NvU32 timeoutUs);
2258 
2259 typedef struct NvOsThreadCreateAttrRec
2260 {
2261  // If NULL, driver will allocate memory for stack
2262  void *threadStack;
2263  // If 0, driver will use OS-dependent default stack size
2264  size_t threadStackSize;
2265  // If NvOsThreadPriorityType_Native, nativePriority is used instead
2266  NvOsThreadPriorityType priority;
2267  // OS-dependent priority value of thread
2268  int nativePriority;
2269  // Preferred CPU core number to run on. -1 indicates no preference
2270  int idealCore;
2271  // Bitmask of CPU cores allowed for the thread to run on. 0 indicates core mask is not specified
2272  uint64_t affinityMask;
2273  // If NULL, thread name is not set
2274  const char *threadName;
2275 } NvOsThreadCreateAttr;
2276 
2277 #define NVOS_DEFINE_THREAD_CREATE_ATTR(x) \
2278  NvOsThreadCreateAttr x = { NULL, 0, NvOsThreadPriorityType_Normal, 0, -1, 0, NULL }
2279 
2291 NvError
2292 NvOsThreadCreateWithAttr(NvOsThreadFunction function, void *args,
2293  NvOsThreadHandle *thread, const NvOsThreadCreateAttr *attr);
2294 
2295 typedef void (*NvOsExitHandlerFunc)(void);
2296 typedef struct NvOsExitHandlerContextRec
2297 {
2298  NvOsExitHandlerFunc Func;
2299  struct NvOsExitHandlerContextRec *Prev;
2300 } NvOsExitHandlerContext;
2301 
2306 typedef enum
2307 {
2308  NvOsTelemetryCategory_Test,
2309  NvOsTelemetryCategory_VideoInfo,
2310 } NvOsTelemetryCategory;
2311 
2322 NvError NvOsTelemetrySubmitData(NvOsTelemetryCategory category, void *arg);
2323 
2356 void NvOsRegisterExitHandler(NvOsExitHandlerFunc func, NvOsExitHandlerContext *ctx, NvBool toLast);
2357 
2358 #define NVOS_REGISTER_EXIT_HANDLER(_func) \
2359  do { \
2360  static NvOsExitHandlerContext _ctx = {0,0}; \
2361  NvOsRegisterExitHandler(_func, &_ctx, false); \
2362  } while(0)
2363 
2364 #define NVOS_REGISTER_EXIT_HANDLER_LAST(_func) \
2365  do { \
2366  static NvOsExitHandlerContext _ctx = {0,0}; \
2367  NvOsRegisterExitHandler(_func, &_ctx, true); \
2368  } while(0)
2369 
2370 #endif
2371 
2372 NvU32 NvOsReadReg(NvU64 Reg, NvU32 Off);
2373 void NvOsWriteReg(NvU64 reg, NvU32 off, NvU32 val);
2374 NvError NvOsMapRegSpace(NvU64 *VirtReg, NvU32 Base, NvU32 Size);
2375 NvError NvOsUnMapRegSpace(NvU64 *VirtReg, NvU32 Base, NvU32 Size);
2376 
2399 int NvOsDebugExternalLogInit(void);
2400 
2404 #if defined(__cplusplus)
2405 }
2406 #endif
2407 
2408 /* Additional or redefined NvOs APIs for HOS */
2409 #if NVOS_IS_HOS
2410 #include "../../core-hos/include/nvos_hos.h"
2411 #endif
2412 
2413 #endif // INCLUDED_NVOS_TEGRA_NONSAFETY_H
NvOsInterruptRegister
NvError NvOsInterruptRegister(NvU32 IrqListSize, const NvU32 *pIrqList, const NvOsInterruptHandler *pIrqHandlerList, void *context, NvOsInterruptHandle *handle, NvBool InterruptEnable)
Registers the interrupt handler with the IRQ number.
NvOsWriteReg
void NvOsWriteReg(NvU64 reg, NvU32 off, NvU32 val)
NvOsAtomicCompareExchangePtr
void * NvOsAtomicCompareExchangePtr(void **pTarget, void *OldValue, void *NewValue)
Atomically compares the contents of a pointer-sized memory location with a value, and if they match,...
NvOsRealloc
void * NvOsRealloc(void *ptr, size_t size)
Re-sizes a previous dynamic allocation.
NvOsOsInfoRec::OsType
NvOsOs OsType
Definition: nvos_tegra_nonsafety.h:336
NvOsDataCacheWritebackInvalidate
void NvOsDataCacheWritebackInvalidate(void)
Writes back and invalidates the entire data cache.
NvOsGetConfigString
NvError NvOsGetConfigString(const char *name, char *value, NvU32 size)
Retrieves a string variable from the config store.
NvOsStatType
struct NvOsStatTypeRec NvOsStatType
NvOsVfprintf
NvError NvOsVfprintf(NvOsFileHandle stream, const char *format, va_list ap)
Prints a string to a file stream using a va_list.
NvOsFileHandle
struct NvOsFileRec * NvOsFileHandle
Printf family.
Definition: nvos_tegra_nonsafety.h:151
NvOsAllocatorRec::Free
NvOsFreeFunc Free
Definition: nvos_tegra_nonsafety.h:1866
NvOsStat
NvError NvOsStat(const char *filename, NvOsStatType *stat)
Gets file information.
NvOsFileType_CharacterDevice
@ NvOsFileType_CharacterDevice
Definition: nvos_tegra_nonsafety.h:477
NvOsSnprintf
NvS32 NvOsSnprintf(char *str, size_t size, const char *format,...)
Expands a string into a given string buffer.
NvOsPageAlloc
NvError NvOsPageAlloc(size_t size, NvOsMemAttribute attrib, NvOsPageFlags flags, NvU32 protect, NvOsPageAllocHandle *descriptor)
Allocates memory via the page allocator.
NvOsSeekEnum
NvOsSeekEnum
Defines wrappers over stdlib's file stream functions, with some changes to the API.
Definition: nvos_tegra_nonsafety.h:458
NvOsFsync
NvError NvOsFsync(NvOsFileHandle stream)
Commits any pending writes to storage media.
NvOsThreadPriorityType
NvOsThreadPriorityType
Definition: nvos_tegra_nonsafety.h:1420
NvOsConditionCreate
NvError NvOsConditionCreate(NvOsConditionHandle *cond)
Creates a condition variable.
NvOsInstrCacheInvalidateRange
void NvOsInstrCacheInvalidateRange(void *start, NvU32 length)
Invalidates a range of the instruction cache.
NvOsTlsAlloc
NvOsTlsKeyHandle NvOsTlsAlloc(void)
Allocates a thread-local storage variable.
NvOsSku_Unknown
@ NvOsSku_Unknown
Definition: nvos_tegra_nonsafety.h:329
NvOsCodePage_Utf16
@ NvOsCodePage_Utf16
Definition: nvos_tegra_nonsafety.h:388
NvOsTlsRemoveTerminator
NvBool NvOsTlsRemoveTerminator(void(*func)(void *), void *context)
Checks the list of existing terminator functions for one that matches both the function and the data,...
NvOsUnMapRegSpace
NvError NvOsUnMapRegSpace(NvU64 *VirtReg, NvU32 Base, NvU32 Size)
NvOsThreadPriorityType_NearInterrupt
@ NvOsThreadPriorityType_NearInterrupt
Definition: nvos_tegra_nonsafety.h:1423
NvOsThreadHandle
struct NvOsThreadRec * NvOsThreadHandle
Definition: nvos_tegra_nonsafety.h:1109
NvOsMkdir
NvError NvOsMkdir(char *dirname)
Creates the directory.
NvError
NvError
The NvError enumeration contains ALL return / error codes.
Definition: nverror.h:33
NvOsFileType_BlockDevice
@ NvOsFileType_BlockDevice
Definition: nvos_tegra_nonsafety.h:478
NvOsSleepMS
void NvOsSleepMS(NvU32 msec)
Unschedules the calling thread for at least the given number of milliseconds.
NvOsStrncpy
void NvOsStrncpy(char *dest, const char *src, size_t size)
Copies a string, length-limited.
NvOsFtell
NvError NvOsFtell(NvOsFileHandle file, NvU64 *position)
Gets the current file position pointer.
NvOsSemaphoreDestroy
void NvOsSemaphoreDestroy(NvOsSemaphoreHandle semaphore)
Frees resources held by the semaphore.
NvOsConditionHandle
struct NvOsConditionRec * NvOsConditionHandle
Definition: nvos_tegra_nonsafety.h:1107
NVOS_VERB_LVL_2
@ NVOS_VERB_LVL_2
Definition: nvos_tegra_nonsafety.h:235
NvOsFileType_Fifo
@ NvOsFileType_Fifo
Definition: nvos_tegra_nonsafety.h:476
NvOsInterruptDone
void NvOsInterruptDone(NvOsInterruptHandle handle)
Called when the ISR/IST is done handling the interrupt.
NvOsFgetc
NvError NvOsFgetc(NvOsFileHandle stream, NvU8 *c)
Gets a character from a file stream.
NvOsCallstackType_SymbolStack
@ NvOsCallstackType_SymbolStack
Definition: nvos_tegra_nonsafety.h:2051
NvOsCodePage_Utf8
@ NvOsCodePage_Utf8
Definition: nvos_tegra_nonsafety.h:387
NvOsSku_Force32
@ NvOsSku_Force32
Definition: nvos_tegra_nonsafety.h:331
NvOsFcloseEx
NvError NvOsFcloseEx(NvOsFileHandle stream)
Closes a file stream.
NvOsMutexUnlock
void NvOsMutexUnlock(NvOsMutexHandle mutex)
Unlocks a locked mutex.
NvOsThreadGetName
const char * NvOsThreadGetName(NvOsThreadHandle thread)
Returns the name of the given thread.
NvOsSemaphoreSignalEx
NvError NvOsSemaphoreSignalEx(NvOsSemaphoreHandle semaphore)
Increments the semaphore value.
nvos_s3_tegra_log.h
NvOsOs_Qnx
@ NvOsOs_Qnx
Definition: nvos_tegra_nonsafety.h:322
NvOsGetSysConfigString
NvError NvOsGetSysConfigString(const char *name, char *value, NvU32 size)
Retrieves a string variable from the config store, with a persist.sys prefix.
NvOsDataCacheWriteback
void NvOsDataCacheWriteback(void)
Writes back the entire data cache.
NvOsGetVerboseLevel
int NvOsGetVerboseLevel(NvS32 *VerbLevel)
ctx
DW_API_PUBLIC dwPointCloudRangeImageCreatorParams const *const const dwContextHandle_t ctx
Definition: PointCloudRangeImageCreator.h:293
NvOsPageFlags
NvOsPageFlags
Low-level memory allocation of the external system memory.
Definition: nvos_tegra_nonsafety.h:970
NvOsStatTypeRec::size
NvU64 size
Definition: nvos_tegra_nonsafety.h:493
NvOsClosedir
void NvOsClosedir(NvOsDirHandle dir)
Closes the directory.
NvOsStatTypeRec::mtime
NvU64 mtime
last modified time of the file
Definition: nvos_tegra_nonsafety.h:496
nverror.h
NvOsCallstackType_NoStack
@ NvOsCallstackType_NoStack
Definition: nvos_tegra_nonsafety.h:2049
NvOsModifyFpsTarget
int NvOsModifyFpsTarget(int fd, int target)
To be deprecated.
NvOsConditionWait
NvError NvOsConditionWait(NvOsConditionHandle cond, NvOsMutexHandle mutex)
Atomically releases the mutex and causes the calling thread to block on the condition variable.
NvOsConditionSignal
NvError NvOsConditionSignal(NvOsConditionHandle cond)
Unblocks atleast one of the threads that are blocked on the specified condition variable.
NvOsMemAttribute_WriteCombined
@ NvOsMemAttribute_WriteCombined
Definition: nvos_tegra_nonsafety.h:883
NvOsDebugNprintf
NvS32 NvOsDebugNprintf(const char *format,...)
Same as NvOsDebugPrintf, except returns the number of chars written.
NvOsGetConfigU32
NvError NvOsGetConfigU32(const char *name, NvU32 *value)
Retrieves an unsigned integer variable from the config store.
NvOsGetSystemTime
NvError NvOsGetSystemTime(NvOsSystemTime *hNvOsSystemtime)
Gets system realtime clock.
NVOS_VERB_LVL_0
@ NVOS_VERB_LVL_0
Definition: nvos_tegra_nonsafety.h:233
NvOsOsInfoRec
Definition: nvos_tegra_nonsafety.h:334
NvOsThreadYield
void NvOsThreadYield(void)
Yields to another runnable thread.
NvOsCallstackType_HexStack
@ NvOsCallstackType_HexStack
Definition: nvos_tegra_nonsafety.h:2050
NvOsDebugPrintf
void NvOsDebugPrintf(const char *format,...)
Outputs a message to the debugging console, if present.
NvOsDataCacheWritebackRange
void NvOsDataCacheWritebackRange(void *start, NvU32 length)
Writes back a range of the data cache.
NvOsPageMap
NvError NvOsPageMap(NvOsPageAllocHandle descriptor, size_t offset, size_t size, void **ptr)
Maps pages into the virtual address space.
NvOsDirHandle
struct NvOsDirRec * NvOsDirHandle
A handle to a directory.
Definition: nvos_tegra_nonsafety.h:674
NvOsIntrMutexUnlock
void NvOsIntrMutexUnlock(NvOsIntrMutexHandle mutex)
Releases an ISR-safe mutex.
NvOsSemaphoreWaitTimeout
NvError NvOsSemaphoreWaitTimeout(NvOsSemaphoreHandle semaphore, NvU32 msec)
Waits for the given semaphore value to become non-zero with timeout.
NvOsCallstackType
NvOsCallstackType
Definition: nvos_tegra_nonsafety.h:2047
NvOsAllocatorRec::AllocAlign
NvOsAllocAlignFunc AllocAlign
Definition: nvos_tegra_nonsafety.h:1864
NvOsDumpCallback
void(* NvOsDumpCallback)(void *context, const char *line)
Definition: nvos_tegra_nonsafety.h:2057
NvOsSetVerboseLevel
int NvOsSetVerboseLevel(NvS32 VerbLevel)
NvOsPageFree
void NvOsPageFree(NvOsPageAllocHandle descriptor)
Frees pages from NvOsPageAlloc().
NvOsSemaphoreWaitEx
NvError NvOsSemaphoreWaitEx(NvOsSemaphoreHandle semaphore)
Waits until the semaphore value becomes non-zero, then decrements the value and returns.
NvOsAtomicExchangeAdd32
NvS32 NvOsAtomicExchangeAdd32(NvS32 *pTarget, NvS32 Value)
Atomically increments the contents of a 32-bit memory location by a specified amount.
NvOsCodePage_Windows1252
@ NvOsCodePage_Windows1252
Definition: nvos_tegra_nonsafety.h:389
NvOsThreadPriorityType_Native
@ NvOsThreadPriorityType_Native
Definition: nvos_tegra_nonsafety.h:1426
NvOsSharedMemGetFd
NvError NvOsSharedMemGetFd(NvOsSharedMemHandle descriptor, int *fd)
Extracts the file descriptor from a handle.
NvOsMemAttribute_End
@ NvOsMemAttribute_End
Definition: nvos_tegra_nonsafety.h:888
NvOsCallstackType_Last
@ NvOsCallstackType_Last
Definition: nvos_tegra_nonsafety.h:2053
NvOsConditionWaitTimeout
NvError NvOsConditionWaitTimeout(NvOsConditionHandle cond, NvOsMutexHandle mutex, NvU32 microsecs)
Atomically releases the mutex and causes the calling thread to block on the condition variable with a...
NvOsDumpToDebugPrintf
void NvOsDumpToDebugPrintf(void *context, const char *line)
event
CK_NOTIFICATION event
Definition: pkcs11t.h:1332
NvOsIntrMutexCreate
NvError NvOsIntrMutexCreate(NvOsIntrMutexHandle *mutex)
Creates a mutex that is safe to aquire in an ISR.
NvOsLibraryLoad
NvError NvOsLibraryLoad(const char *name, NvOsLibraryHandle *library)
Load a dynamic library.
NvOsPageFlags_NonContiguous
@ NvOsPageFlags_NonContiguous
Definition: nvos_tegra_nonsafety.h:973
NvOsSeek_Cur
@ NvOsSeek_Cur
NvOS equivalent of SEEK_CUR.
Definition: nvos_tegra_nonsafety.h:463
NvOsPageAllocHandle
struct NvOsPageAllocRec * NvOsPageAllocHandle
Definition: nvos_tegra_nonsafety.h:978
NvOsThreadPriorityType_Normal
@ NvOsThreadPriorityType_Normal
Definition: nvos_tegra_nonsafety.h:1422
NvOsFreeFunc
void(* NvOsFreeFunc)(struct NvOsAllocatorRec *, void *ptr)
Definition: nvos_tegra_nonsafety.h:1860
NvOsSharedMemUnmap
void NvOsSharedMemUnmap(void *ptr, size_t size)
Unmaps a mapped region of shared memory.
NvOsReallocFunc
void *(* NvOsReallocFunc)(struct NvOsAllocatorRec *, void *ptr, size_t size)
Definition: nvos_tegra_nonsafety.h:1859
handle
const WFDCommitType const WFDHandle handle
Definition: wfdext.h:124
NvOsShowError
NvError NvOsShowError(NvError err, const char *file, int line)
Prints an error and the line it appeared on.
NvOsSemaphoreHandle
struct NvOsSemaphoreRec * NvOsSemaphoreHandle
Definition: nvos_tegra_nonsafety.h:1108
NvOsConditionBroadcast
NvError NvOsConditionBroadcast(NvOsConditionHandle cond)
Unblocks all threads currently blocked on the specified condition variable.
NvOsSharedMemHandle
struct NvOsSharedMemRec * NvOsSharedMemHandle
An opaque handle returned by shared memory allocations.
Definition: nvos_tegra_nonsafety.h:804
nvcommon.h
NvOsMutexUnlockEx
NvError NvOsMutexUnlockEx(NvOsMutexHandle mutex)
Unlocks a locked mutex.
NvOsMemAttribute
NvOsMemAttribute
Defines memory attributes.
Definition: nvos_tegra_nonsafety.h:875
NvOsMemFlags_Forceword
@ NvOsMemFlags_Forceword
Definition: nvos_tegra_nonsafety.h:975
NvOsDebugCallstack
static NV_INLINE void NvOsDebugCallstack(NvU32 skip)
Definition: nvos_tegra_nonsafety.h:2070
NvOsSemaphoreSignal
void NvOsSemaphoreSignal(NvOsSemaphoreHandle semaphore)
Increments the semaphore value.
NvOsThreadPriorityType_Last
@ NvOsThreadPriorityType_Last
Definition: nvos_tegra_nonsafety.h:1428
NvOsInterruptEnable
NvError NvOsInterruptEnable(NvOsInterruptHandle handle)
Enables the interrupt handler with the IRQ number.
NvOsMutexDestroyEx
NvError NvOsMutexDestroyEx(NvOsMutexHandle mutex)
Frees the resources held by a mutex.
NvOsFflush
NvError NvOsFflush(NvOsFileHandle stream)
Flushes any pending writes to the file stream.
NvOsTlsKeyHandle
NvU32 NvOsTlsKeyHandle
A NvOsTlsKey Handle.
Definition: nvos_tegra_nonsafety.h:1579
NvOsAllocFunc
void *(* NvOsAllocFunc)(struct NvOsAllocatorRec *, size_t size)
Definition: nvos_tegra_nonsafety.h:1857
NvOsInterruptPriorityThreadCreate
NvError NvOsInterruptPriorityThreadCreate(NvOsThreadFunction function, void *args, NvOsThreadHandle *thread)
Creates a near interrupt priority thread.
NvOsPageAddress
NvOsPhysAddr NvOsPageAddress(NvOsPageAllocHandle descriptor, size_t offset)
Returns the physical address given an offset.
NvOsDebugExternalLogInit
int NvOsDebugExternalLogInit(void)
This function does slog initialization for current executing context.
NvOsSemaphoreDestroyEx
NvError NvOsSemaphoreDestroyEx(NvOsSemaphoreHandle semaphore)
Frees resources held by the semaphore.
NvOsDebugVprintf
void NvOsDebugVprintf(const char *format, va_list ap)
Same as NvOsDebugPrintf, except takes a va_list.
NvOsCallstackDump
void NvOsCallstackDump(NvCallstack *stack, NvU32 skip, NvOsDumpCallback callBack, void *context)
NvOsThreadSetName
NvError NvOsThreadSetName(NvOsThreadHandle thread, const char *name)
Assigns the given name to the given thread.
NvOsStrnlen
size_t NvOsStrnlen(const char *s, size_t size)
Gets the length of a string.
NvOsOsInfo
struct NvOsOsInfoRec NvOsOsInfo
NvOsMemAttribute_WriteBack
@ NvOsMemAttribute_WriteBack
Definition: nvos_tegra_nonsafety.h:882
NvOsAllocator
struct NvOsAllocatorRec NvOsAllocator
NvOsCodePage
NvOsCodePage
Defines straight-forward mappings to international language encodings.
Definition: nvos_tegra_nonsafety.h:384
NvOsCodePage_Force32
@ NvOsCodePage_Force32
Definition: nvos_tegra_nonsafety.h:390
NvOsIntrMutexLock
void NvOsIntrMutexLock(NvOsIntrMutexHandle mutex)
Aquire an ISR-safe mutex.
NvOsMutexLock
void NvOsMutexLock(NvOsMutexHandle mutex)
Locks the given unlocked mutex.
NvOsFileType_Force32
@ NvOsFileType_Force32
Definition: nvos_tegra_nonsafety.h:480
NvOsStrcpy
void NvOsStrcpy(char *dest, const char *src)
Copies a string.
NvOsMemcpy
void NvOsMemcpy(void *dest, const void *src, size_t size)
Copies memory.
NvOsThreadJoin
void NvOsThreadJoin(NvOsThreadHandle thread)
Waits for the given thread to exit.
NvOsThreadCreate
NvError NvOsThreadCreate(NvOsThreadFunction function, void *args, NvOsThreadHandle *thread)
Creates a thread.
NvOsAlloc
void * NvOsAlloc(size_t size)
Dynamically allocates memory.
NvOsMapRegSpace
NvError NvOsMapRegSpace(NvU64 *VirtReg, NvU32 Base, NvU32 Size)
NvOsVsnprintf
NvS32 NvOsVsnprintf(char *str, size_t size, const char *format, va_list ap)
Expands a string into a string buffer using a va_list.
NvOsOs_Linux
@ NvOsOs_Linux
Definition: nvos_tegra_nonsafety.h:321
NvOsOs
NvOsOs
Definition: nvos_tegra_nonsafety.h:317
NvOsMemAttribute_DeviceMemory
@ NvOsMemAttribute_DeviceMemory
Definition: nvos_tegra_nonsafety.h:886
NvOsSleepNS
NvError NvOsSleepNS(NvU32 nsec)
NvOsInterruptUnregister
void NvOsInterruptUnregister(NvOsInterruptHandle handle)
Unregisters the interrupt handler from the associated IRQ number.
NvOsFremove
NvError NvOsFremove(const char *filename)
Removes a file from the storage media.
NvOsOpendir
NvError NvOsOpendir(const char *path, NvOsDirHandle *dir)
Opens a directory.
NvOsCallstackCreate
NvCallstack * NvOsCallstackCreate(NvOsCallstackType stackType)
NvOsReadReg
NvU32 NvOsReadReg(NvU64 Reg, NvU32 Off)
NvOsSemaphoreClone
NvError NvOsSemaphoreClone(NvOsSemaphoreHandle orig, NvOsSemaphoreHandle *semaphore)
Creates a duplicate semaphore from the given semaphore.
NvOsCallstackType_Force32
@ NvOsCallstackType_Force32
Definition: nvos_tegra_nonsafety.h:2054
NvOsLibraryUnload
void NvOsLibraryUnload(NvOsLibraryHandle library)
Unloads a dynamic library.
NvOsOsInfoRec::Sku
NvOsSku Sku
Definition: nvos_tegra_nonsafety.h:337
NvOsFileType_Unknown
@ NvOsFileType_Unknown
Definition: nvos_tegra_nonsafety.h:473
NvOsFread
NvError NvOsFread(NvOsFileHandle stream, void *ptr, size_t size, size_t *bytes)
Reads a file stream.
NvOsAtomicCompareExchange32
NvS32 NvOsAtomicCompareExchange32(NvS32 *pTarget, NvS32 OldValue, NvS32 NewValue)
Atomically compares the contents of a 32-bit memory location with a value, and if they match,...
NvOsConditionDestroy
NvError NvOsConditionDestroy(NvOsConditionHandle cond)
Frees resources held by the condition variable.
NvOsGetTimeNS
NvU64 NvOsGetTimeNS(void)
NvOsFlushWriteCombineBuffer
void NvOsFlushWriteCombineBuffer(void)
Flushes the CPU's write combine buffer.
NvOsOs_Unknown
@ NvOsOs_Unknown
Definition: nvos_tegra_nonsafety.h:319
NvOsReaddir
NvError NvOsReaddir(NvOsDirHandle dir, char *name, size_t size)
Gets the next entry in the directory.
NvOsPageFlags_Contiguous
@ NvOsPageFlags_Contiguous
Definition: nvos_tegra_nonsafety.h:972
NvOsCodePage_Unknown
@ NvOsCodePage_Unknown
Definition: nvos_tegra_nonsafety.h:386
NvOsWaitUS
void NvOsWaitUS(NvU32 usec)
Stalls the calling thread for at least the given number of microseconds.
NvCallstack
struct NvCallstackRec NvCallstack
Definition: nvos_tegra_nonsafety.h:2045
NvSuccess
@ NvSuccess
Definition: nverror.h:42
NvOsStrlen
size_t NvOsStrlen(const char *s)
Gets the length of a string.
NvOsTlsAddTerminator
NvError NvOsTlsAddTerminator(void(*func)(void *), void *context)
Registers a function that should be called when the thread terminates to clean up any structures stor...
NvOsCallstackGetHeight
NvU32 NvOsCallstackGetHeight(NvCallstack *stack)
NvOsSemaphoreWait
void NvOsSemaphoreWait(NvOsSemaphoreHandle semaphore)
Waits until the semaphore value becomes non-zero, then decrements the value and returns.
NvOsSystemTimeRec
Defines the system time structure.
Definition: nvos_tegra_nonsafety.h:1656
NvOsMutexDestroy
void NvOsMutexDestroy(NvOsMutexHandle mutex)
Frees the resources held by a mutex.
NvOsTlsGet
void * NvOsTlsGet(NvOsTlsKeyHandle TlsIndex)
Gets the value of a thread-local storage variable.
NvOsFtruncate
NvError NvOsFtruncate(NvOsFileHandle stream, NvU64 length)
Causes the file to have a size of length bytes.
NvOsMutexHandle
struct NvOsMutexRec * NvOsMutexHandle
Definition: nvos_tegra_nonsafety.h:1105
NvOsFree
void NvOsFree(void *ptr)
Frees a dynamic memory allocation.
NvOsSleepUS
NvError NvOsSleepUS(NvU32 usec)
void
typedef void(WFD_APIENTRY PFNWFDBINDSOURCETOPIPELINEWITHTIMESTAMPNV)(const WFDDevice device
NvOsInterruptHandler
void(* NvOsInterruptHandler)(void *args)
Interrupt handler function.
Definition: nvos_tegra_nonsafety.h:1774
NvOsAllocAlignFunc
void *(* NvOsAllocAlignFunc)(struct NvOsAllocatorRec *, size_t align, size_t size)
Definition: nvos_tegra_nonsafety.h:1858
NvOsSharedMemMap
NvError NvOsSharedMemMap(NvOsSharedMemHandle descriptor, size_t offset, size_t size, void **ptr)
Maps a shared memory region into the process virtual memory.
NvOsSharedMemAlloc
NvError NvOsSharedMemAlloc(const char *key, size_t size, NvOsSharedMemHandle *descriptor)
Dynamically allocates multiprocess shared memory.
NvOsAtomicExchange32
NvS32 NvOsAtomicExchange32(NvS32 *pTarget, NvS32 Value)
Atomically swaps the contents of a 32-bit memory location with a value.
NvOsSharedMemHandleFromFd
NvError NvOsSharedMemHandleFromFd(int fd, NvOsSharedMemHandle *descriptor)
Enables sharing NvOsSharedMemHandle memory that was created by a call to NvOsSharedMemAlloc().
NvOsThreadPriorityType_Force32
@ NvOsThreadPriorityType_Force32
Definition: nvos_tegra_nonsafety.h:1429
NvOsMemAttribute_InnerWriteBack
@ NvOsMemAttribute_InnerWriteBack
Definition: nvos_tegra_nonsafety.h:884
NvOsGetTimeMS
NvU32 NvOsGetTimeMS(void)
NvOsFileType_File
@ NvOsFileType_File
Definition: nvos_tegra_nonsafety.h:474
NVOS_VERB_LVL_4
@ NVOS_VERB_LVL_4
Definition: nvos_tegra_nonsafety.h:237
NvOsGetProcessInfo
void NvOsGetProcessInfo(char *buf, NvU32 len)
NvOsSemaphoreCreate
NvError NvOsSemaphoreCreate(NvOsSemaphoreHandle *semaphore, NvU32 value)
Creates a counting semaphore.
NvOsGetOsInformation
NvError NvOsGetOsInformation(NvOsOsInfo *pOsInfo)
Gets the current OS version.
NvOsMemAttribute_SO_DeviceMemory
@ NvOsMemAttribute_SO_DeviceMemory
Definition: nvos_tegra_nonsafety.h:887
NvOsOs_Force32
@ NvOsOs_Force32
Definition: nvos_tegra_nonsafety.h:324
NvOsSeek_Force32
@ NvOsSeek_Force32
Max value for NvOsSeekEnum.
Definition: nvos_tegra_nonsafety.h:468
NvOsMemcmp
int NvOsMemcmp(const void *s1, const void *s2, size_t size)
Compares two memory regions.
NvOsBusyWaitUS
NvError NvOsBusyWaitUS(NvU32 usec)
Stalls the calling thread for at least the given number of microseconds.
NvOsLibraryHandle
struct NvOsLibraryRec * NvOsLibraryHandle
A handle to a dynamic library.
Definition: nvos_tegra_nonsafety.h:1048
NvOsSku_Android
@ NvOsSku_Android
Definition: nvos_tegra_nonsafety.h:330
NvOsCallstackGetFrame
void NvOsCallstackGetFrame(char *buf, NvU32 len, NvCallstack *stack, NvU32 level)
NvOsFprintf
NvError NvOsFprintf(NvOsFileHandle stream, const char *format,...)
Prints a string to a file stream.
NvOsInstrCacheInvalidate
void NvOsInstrCacheInvalidate(void)
Invalidates the entire instruction cache.
NvOsStatTypeRec
Definition: nvos_tegra_nonsafety.h:491
NvOsMemAttribute_Force32
@ NvOsMemAttribute_Force32
Definition: nvos_tegra_nonsafety.h:890
NvOsMemset
void NvOsMemset(void *s, NvU8 c, size_t size)
Sets a region of memory to a value.
NvOsIntrMutexDestroy
void NvOsIntrMutexDestroy(NvOsIntrMutexHandle mutex)
Destroys an ISR-safe mutex.
NvOsSku
NvOsSku
Definition: nvos_tegra_nonsafety.h:327
NvOsOs_Windows
@ NvOsOs_Windows
Definition: nvos_tegra_nonsafety.h:320
NvOsIsMemoryOfGivenType
NvBool NvOsIsMemoryOfGivenType(NvOsMemAttribute Attrib, NvU32 Addr)
Checks and returns whether the given memory address is within memory of given attribute.
NvOsGetCurrentAllocator
struct NvOsAllocatorRec * NvOsGetCurrentAllocator(void)
NvOsGetCurrentThreadId
NvU64 NvOsGetCurrentThreadId(void)
Returns current thread ID.
NvOsPageUnmap
void NvOsPageUnmap(NvOsPageAllocHandle descriptor, void *ptr, size_t size)
Unmaps the virtual address from NvOsPageMap().
NvOsMemAttribute_Secured
@ NvOsMemAttribute_Secured
Definition: nvos_tegra_nonsafety.h:885
NvOsSharedMemFree
void NvOsSharedMemFree(NvOsSharedMemHandle descriptor)
Frees shared memory from NvOsSharedMemAlloc().
NvOsPhysAddr
NvU32 NvOsPhysAddr
A physical address.
Definition: nvos_tegra_nonsafety.h:119
NvOsFopen
NvError NvOsFopen(const char *path, NvU32 flags, NvOsFileHandle *file)
Opens a file stream.
NvOsThreadJoinEx
NvError NvOsThreadJoinEx(NvOsThreadHandle thread)
Waits for the given thread to exit.
NvOsAllocatorRec::Alloc
NvOsAllocFunc Alloc
Definition: nvos_tegra_nonsafety.h:1863
NvOsTlsSet
void NvOsTlsSet(NvOsTlsKeyHandle TlsIndex, void *Value)
Sets the value of a thread-local storage variable.
NvOsSystemTimeRec::Seconds
NvU32 Seconds
Definition: nvos_tegra_nonsafety.h:1658
NvOsMutexCreate
NvError NvOsMutexCreate(NvOsMutexHandle *mutex)
Allocates a new process-local mutex.
NVOS_VERB_LVL_1
@ NVOS_VERB_LVL_1
Definition: nvos_tegra_nonsafety.h:234
NvOsSystemTimeRec::Milliseconds
NvU32 Milliseconds
Definition: nvos_tegra_nonsafety.h:1659
NvOsDataCacheWritebackInvalidateRange
void NvOsDataCacheWritebackInvalidateRange(void *start, NvU32 length)
Writes back and invlidates a range of the data cache.
NvOsLogPrintf
void NvOsLogPrintf(int prio, const char *tag, const char *format,...)
Same as NvOsDebugPrintf, except takes priority and tag fields.
NvOsAllocatorRec
Definition: nvos_tegra_nonsafety.h:1862
NvOsInterruptMask
void NvOsInterruptMask(NvOsInterruptHandle handle, NvBool mask)
Mask/unmask an interrupt.
NvOsFseek
NvError NvOsFseek(NvOsFileHandle file, NvS64 offset, NvOsSeekEnum whence)
Changes the file position pointer.
NvOsSeek_End
@ NvOsSeek_End
NvOS equivalent of SEEK_END.
Definition: nvos_tegra_nonsafety.h:465
NvOsPhysicalMemMap
NvError NvOsPhysicalMemMap(NvOsPhysAddr phys, size_t size, NvOsMemAttribute attrib, NvU32 flags, void **ptr)
Maps computer resources into user space.
NvOsFileType_Directory
@ NvOsFileType_Directory
Definition: nvos_tegra_nonsafety.h:475
NvOsBusyWaitNS
NvError NvOsBusyWaitNS(NvU32 nsec)
NvOsVerbosePrintf
void NvOsVerbosePrintf(NvS32 VerbLevel, const char *Fmt,...)
NvOsLibraryGetSymbol
void * NvOsLibraryGetSymbol(NvOsLibraryHandle library, const char *symbol)
Gets an address of a symbol in a dynamic library.
NvOsDebugString
void NvOsDebugString(const char *str)
NvOsFclose
void NvOsFclose(NvOsFileHandle stream)
Closes a file stream.
NvOsCallstackHash
NvU32 NvOsCallstackHash(NvCallstack *stack)
NvOsIntrMutexHandle
struct NvOsIntrMutexRec * NvOsIntrMutexHandle
Definition: nvos_tegra_nonsafety.h:1106
NvOsStatTypeRec::type
NvOsFileType type
Definition: nvos_tegra_nonsafety.h:494
NvOsMemAttribute_Uncached
@ NvOsMemAttribute_Uncached
Definition: nvos_tegra_nonsafety.h:880
NvOsCancelFpsTarget
void NvOsCancelFpsTarget(int fd)
To be deprecated.
NvOsSetFpsTarget
int NvOsSetFpsTarget(int target)
To be deprecated.
NvOsFstat
NvError NvOsFstat(NvOsFileHandle file, NvOsStatType *stat)
Gets file information from an already open file.
NvOsTlsAllocWithDestructor
NvOsTlsKeyHandle NvOsTlsAllocWithDestructor(void(*destructor)(void *))
Allocates a thread-local storage variable, with destructor when thread exits.
NvOsTlsFree
void NvOsTlsFree(NvOsTlsKeyHandle TlsIndex)
Frees a thread-local storage variable.
NvOsPhysicalMemUnmap
void NvOsPhysicalMemUnmap(void *ptr, size_t size)
Releases resources previously allocated by NvOsPhysicalMemMap().
NvOsLibraryUnloadEx
NvError NvOsLibraryUnloadEx(NvOsLibraryHandle library)
Unloads a dynamic library.
NvOsMutexLockEx
NvError NvOsMutexLockEx(NvOsMutexHandle mutex)
Locks the given unlocked mutex.
type
const WFDCommitType type
Definition: wfdext.h:123
NvOsAllocatorRec::Realloc
NvOsReallocFunc Realloc
Definition: nvos_tegra_nonsafety.h:1865
NvOsOs_Integrity
@ NvOsOs_Integrity
Definition: nvos_tegra_nonsafety.h:323
NvOsSystemTime
struct NvOsSystemTimeRec NvOsSystemTime
Defines the system time structure.
NvOsFwrite
NvError NvOsFwrite(NvOsFileHandle stream, const void *ptr, size_t size)
Writes to a file stream.
NvOsInterruptHandle
struct NvOsInterruptRec * NvOsInterruptHandle
Interrupt handler type.
Definition: nvos_tegra_nonsafety.h:1778
NVOS_VERB_LVL_3
@ NVOS_VERB_LVL_3
Definition: nvos_tegra_nonsafety.h:236
NvOsCallstackDestroy
void NvOsCallstackDestroy(NvCallstack *callstack)
NvOsSeek_Set
@ NvOsSeek_Set
NvOS equivalent of SEEK_SET.
Definition: nvos_tegra_nonsafety.h:461
NvOsAllocAlign
void * NvOsAllocAlign(size_t align, size_t size)
Dynamically allocates memory with specific alignment.
NvOsFileType
NvOsFileType
Definition: nvos_tegra_nonsafety.h:471
NvOsGetTimeUS
NvU64 NvOsGetTimeUS(void)
NvOsCallstackContainsPid
NvBool NvOsCallstackContainsPid(NvCallstack *stack, NvU32 pid)
NvOsThreadFunction
void(* NvOsThreadFunction)(void *args)
Entry point for a thread.
Definition: nvos_tegra_nonsafety.h:1434