This provides a basic set of interfaces to unify code across all supported operating systems. This layer does not handle any hardware specific functions, such as interrupts. "Platform" setup and GPU access are done by other layers.
For APIs that take key parameters, keys may be of NVOS_KEY_MAX length. Any characters beyond this maximum is ignored.
All strings passed to or from NvOS functions are encoded in UTF-8. For character values below 128, this is the same as simple ASCII.
At interrupt time there are only a handful of NvOS functions that are safe to call:
NvOs supports named configuration variables that may have string values or unsigned integer values.
The storage of the configuration data is highly platform dependent. The platform may provide the means to set the initial data for the storage in the platform build phase. Also it may be possible to set and retrieve the values in a running system via OS provided mechanisms.
Information about the configuration data storages for various operating systems follows.
On x86 host systems and Linux the configuration data storage is the environment inherited from the shell that launches the application. To set configuration variable values export the appropriate environment variables from the launching shell.
On target Windows systems the configuration data is stored in the Windows registry, under the registry path:
HKEY_LOCAL_MACHINE\Software\NVIDIA Corporation\NvOs
The configuration data can be set by .reg files in the image build.
On Android the configuration store is the Android property mechanism. NvOs config variables are stored in the "persist.tegra" namespace. Values can be set via the "setprop" tool and values queried via the "getprop" tool.
As with other Linux systems, the environment acts as a read-only configuration data store. Values read from the environment override those read from Android properties.
The default for target systems is to use a file on the file system as the data storage. The path to the file on the target file system is:
/etc/tegra_config.txt
Data Structures | |
struct | NvOsOsInfoRec |
struct | NvOsStatTypeRec |
struct | NvOsSystemTimeRec |
Defines the system time structure. More... | |
struct | NvOsAllocatorRec |
Macros | |
#define | NVOS_KEY_MAX 128 |
The maximum length of a shared resource identifier string. More... | |
#define | NVOS_PATH_MAX 256 |
The maximum length for a file system path. More... | |
#define | NVOS_HAS_MTIME 1 |
Indicates that NvOsStatType structure has mtime . More... | |
#define | NVOS_HAS_MKDIR 1 |
Indicates that NvOs has NvOsMkdir(). More... | |
#define | NVOS_HAS_FTRUNCATE 1 |
Indicates that NvOs has NvOsFtruncate(). More... | |
#define | NVOS_HAS_CONDITION 1 |
Indicates that NvOs has condition variables. More... | |
Typedefs | |
typedef NvU32 | NvOsPhysAddr |
A physical address. More... | |
Print Operations | |
enum | { NVOS_VERB_LVL_0 = 0, NVOS_VERB_LVL_1 = 1, NVOS_VERB_LVL_2 = 2, NVOS_VERB_LVL_3 = 3, NVOS_VERB_LVL_4 = 4 } |
typedef struct NvOsFileRec * | NvOsFileHandle |
Printf family. More... | |
NvError | NvOsFprintf (NvOsFileHandle stream, const char *format,...) |
Prints a string to a file stream. More... | |
NvS32 | NvOsSnprintf (char *str, size_t size, const char *format,...) |
Expands a string into a given string buffer. More... | |
NvError | NvOsVfprintf (NvOsFileHandle stream, const char *format, va_list ap) |
Prints a string to a file stream using a va_list. More... | |
NvS32 | NvOsVsnprintf (char *str, size_t size, const char *format, va_list ap) |
Expands a string into a string buffer using a va_list. More... | |
void | NvOsDebugPrintf (const char *format,...) |
Outputs a message to the debugging console, if present. More... | |
void | NvOsLogPrintf (int prio, const char *tag, const char *format,...) |
Same as NvOsDebugPrintf, except takes priority and tag fields. More... | |
void | NvOsDebugVprintf (const char *format, va_list ap) |
Same as NvOsDebugPrintf, except takes a va_list. More... | |
NvS32 | NvOsDebugNprintf (const char *format,...) |
Same as NvOsDebugPrintf, except returns the number of chars written. More... | |
void | NvOsDebugString (const char *str) |
int | NvOsSetVerboseLevel (NvS32 VerbLevel) |
int | NvOsGetVerboseLevel (NvS32 *VerbLevel) |
void | NvOsVerbosePrintf (NvS32 VerbLevel, const char *Fmt,...) |
NvError | NvOsShowError (NvError err, const char *file, int line) |
Prints an error and the line it appeared on. More... | |
#define | NV_SHOW_ERRORS NV_DEBUG |
Prints err if it is an error (does nothing if err==NvSuccess). More... | |
#define | NV_SHOW_ERROR(err) (err) |
#define | NV_ENABLE_DEBUG_PRINTS 0 |
Helper macro to go along with NvOsDebugPrintf. More... | |
#define | NV_DEBUG_PRINTF(x) do {} while (NV_FALSE) |
OS Version | |
enum | NvOsOs { NvOsOs_Unknown = 0x0UL, NvOsOs_Windows = 0x1UL, NvOsOs_Linux = 0x2UL, NvOsOs_Qnx = 0x4UL, NvOsOs_Integrity = 0x5UL, NvOsOs_Force32 = 0x7fffffffUL } |
enum | NvOsSku { NvOsSku_Unknown = 0x0UL, NvOsSku_Android = 0x1UL, NvOsSku_Force32 = 0x7fffffffUL } |
typedef struct NvOsOsInfoRec | NvOsOsInfo |
NvError | NvOsGetOsInformation (NvOsOsInfo *pOsInfo) |
Gets the current OS version. More... | |
String Operations | |
enum | NvOsCodePage { NvOsCodePage_Unknown = 0x0UL, NvOsCodePage_Utf8 = 0x1UL, NvOsCodePage_Utf16 = 0x2UL, NvOsCodePage_Windows1252 = 0x3UL, NvOsCodePage_Force32 = 0x7fffffffUL } |
Defines straight-forward mappings to international language encodings. More... | |
void | NvOsStrcpy (char *dest, const char *src) |
Copies a string. More... | |
void | NvOsStrncpy (char *dest, const char *src, size_t size) |
Copies a string, length-limited. More... | |
size_t | NvOsStrlen (const char *s) |
Gets the length of a string. More... | |
size_t | NvOsStrnlen (const char *s, size_t size) |
Gets the length of a string. More... | |
Memory Operations (Basic) | |
void | NvOsMemcpy (void *dest, const void *src, size_t size) |
Copies memory. More... | |
int | NvOsMemcmp (const void *s1, const void *s2, size_t size) |
Compares two memory regions. More... | |
void | NvOsMemset (void *s, NvU8 c, size_t size) |
Sets a region of memory to a value. More... | |
File Input/Output | |
enum | NvOsSeekEnum { NvOsSeek_Set = 0, NvOsSeek_Cur = 1, NvOsSeek_End = 2, NvOsSeek_Force32 = 0x7FFFFFFF } |
Defines wrappers over stdlib's file stream functions, with some changes to the API. More... | |
enum | NvOsFileType { NvOsFileType_Unknown = 0, NvOsFileType_File = 1, NvOsFileType_Directory = 2, NvOsFileType_Fifo = 3, NvOsFileType_CharacterDevice = 4, NvOsFileType_BlockDevice = 5, NvOsFileType_Force32 = 0x7FFFFFFF } |
typedef struct NvOsStatTypeRec | NvOsStatType |
NvError | NvOsFopen (const char *path, NvU32 flags, NvOsFileHandle *file) |
Opens a file stream. More... | |
NvError | NvOsFcloseEx (NvOsFileHandle stream) |
Closes a file stream. More... | |
void | NvOsFclose (NvOsFileHandle stream) |
Closes a file stream. More... | |
NvError | NvOsFwrite (NvOsFileHandle stream, const void *ptr, size_t size) |
Writes to a file stream. More... | |
NvError | NvOsFread (NvOsFileHandle stream, void *ptr, size_t size, size_t *bytes) |
Reads a file stream. More... | |
NvError | NvOsFgetc (NvOsFileHandle stream, NvU8 *c) |
Gets a character from a file stream. More... | |
NvError | NvOsFseek (NvOsFileHandle file, NvS64 offset, NvOsSeekEnum whence) |
Changes the file position pointer. More... | |
NvError | NvOsFtell (NvOsFileHandle file, NvU64 *position) |
Gets the current file position pointer. More... | |
NvError | NvOsStat (const char *filename, NvOsStatType *stat) |
Gets file information. More... | |
NvError | NvOsFstat (NvOsFileHandle file, NvOsStatType *stat) |
Gets file information from an already open file. More... | |
NvError | NvOsFflush (NvOsFileHandle stream) |
Flushes any pending writes to the file stream. More... | |
NvError | NvOsFsync (NvOsFileHandle stream) |
Commits any pending writes to storage media. More... | |
NvError | NvOsFremove (const char *filename) |
Removes a file from the storage media. More... | |
NvError | NvOsFtruncate (NvOsFileHandle stream, NvU64 length) |
Causes the file to have a size of length bytes. More... | |
#define | NVOS_OPEN_READ 0x1 |
Opens a file with read permissions. More... | |
#define | NVOS_OPEN_WRITE 0x2 |
Opens a file with write persmissions. More... | |
#define | NVOS_OPEN_CREATE 0x4 |
Creates a file if is not present on the file system. More... | |
#define | NVOS_OPEN_APPEND 0x8 |
Open file in append mode. More... | |
Directories | |
typedef struct NvOsDirRec * | NvOsDirHandle |
A handle to a directory. More... | |
NvError | NvOsOpendir (const char *path, NvOsDirHandle *dir) |
Opens a directory. More... | |
NvError | NvOsReaddir (NvOsDirHandle dir, char *name, size_t size) |
Gets the next entry in the directory. More... | |
void | NvOsClosedir (NvOsDirHandle dir) |
Closes the directory. More... | |
NvError | NvOsMkdir (char *dirname) |
Creates the directory. More... | |
NvError | NvOsGetConfigU32 (const char *name, NvU32 *value) |
Retrieves an unsigned integer variable from the config store. More... | |
NvError | NvOsGetConfigString (const char *name, char *value, NvU32 size) |
Retrieves a string variable from the config store. More... | |
NvError | NvOsGetSysConfigString (const char *name, char *value, NvU32 size) |
Retrieves a string variable from the config store, with a persist.sys prefix. More... | |
Memory Allocation | |
enum | NvOsMemAttribute { NvOsMemAttribute_Uncached = 0, NvOsMemAttribute_WriteBack = 1, NvOsMemAttribute_WriteCombined = 2, NvOsMemAttribute_InnerWriteBack = 3, NvOsMemAttribute_Secured = 4, NvOsMemAttribute_DeviceMemory = 5, NvOsMemAttribute_SO_DeviceMemory = 6, NvOsMemAttribute_End = 7, NvOsMemAttribute_Force32 = 0x7FFFFFFF } |
Defines memory attributes. More... | |
typedef struct NvOsSharedMemRec * | NvOsSharedMemHandle |
An opaque handle returned by shared memory allocations. More... | |
void * | NvOsAlloc (size_t size) |
Dynamically allocates memory. More... | |
void * | NvOsAllocAlign (size_t align, size_t size) |
Dynamically allocates memory with specific alignment. More... | |
void * | NvOsRealloc (void *ptr, size_t size) |
Re-sizes a previous dynamic allocation. More... | |
void | NvOsFree (void *ptr) |
Frees a dynamic memory allocation. More... | |
NvError | NvOsSharedMemAlloc (const char *key, size_t size, NvOsSharedMemHandle *descriptor) |
Dynamically allocates multiprocess shared memory. More... | |
NvError | NvOsSharedMemHandleFromFd (int fd, NvOsSharedMemHandle *descriptor) |
Enables sharing NvOsSharedMemHandle memory that was created by a call to NvOsSharedMemAlloc(). More... | |
NvError | NvOsSharedMemGetFd (NvOsSharedMemHandle descriptor, int *fd) |
Extracts the file descriptor from a handle. More... | |
NvError | NvOsSharedMemMap (NvOsSharedMemHandle descriptor, size_t offset, size_t size, void **ptr) |
Maps a shared memory region into the process virtual memory. More... | |
void | NvOsSharedMemUnmap (void *ptr, size_t size) |
Unmaps a mapped region of shared memory. More... | |
void | NvOsSharedMemFree (NvOsSharedMemHandle descriptor) |
Frees shared memory from NvOsSharedMemAlloc(). More... | |
NvError | NvOsPhysicalMemMap (NvOsPhysAddr phys, size_t size, NvOsMemAttribute attrib, NvU32 flags, void **ptr) |
Maps computer resources into user space. More... | |
void | NvOsPhysicalMemUnmap (void *ptr, size_t size) |
Releases resources previously allocated by NvOsPhysicalMemMap(). More... | |
#define | NVOS_MEM_NONE 0x0U |
Specifies no memory flags. More... | |
#define | NVOS_MEM_READ 0x1U |
Specifies the memory may be read. More... | |
#define | NVOS_MEM_WRITE 0x2U |
Specifies the memory may be written to. More... | |
#define | NVOS_MEM_EXECUTE 0x4U |
Specifies the memory may be executed. More... | |
#define | NVOS_MEM_GLOBAL_ADDR 0x8U |
The memory must be visible by all processes, this is only valid for WinCE 5.0. More... | |
#define | NVOS_MEM_READ_WRITE (NVOS_MEM_READ | NVOS_MEM_WRITE) |
The memory may be both read and writen. More... | |
#define | NVOS_MEM_MMAP_FIXED 0x40U |
Specifies the memory must be mapped as fixed for mmap. More... | |
#define | NVOS_MEM_MMAP_LAZY 0x80U |
Support MAP_LAZY for mmap in QNX. More... | |
#define | NVOS_MEM_MMAP_POPULATE 0x100U |
Support MAP_POPULATE for mmap. More... | |
Page Allocator | |
enum | NvOsPageFlags { NvOsPageFlags_Contiguous = 0, NvOsPageFlags_NonContiguous = 1, NvOsMemFlags_Forceword = 0x7ffffff } |
Low-level memory allocation of the external system memory. More... | |
typedef struct NvOsPageAllocRec * | NvOsPageAllocHandle |
NvError | NvOsPageAlloc (size_t size, NvOsMemAttribute attrib, NvOsPageFlags flags, NvU32 protect, NvOsPageAllocHandle *descriptor) |
Allocates memory via the page allocator. More... | |
void | NvOsPageFree (NvOsPageAllocHandle descriptor) |
Frees pages from NvOsPageAlloc(). More... | |
NvError | NvOsPageMap (NvOsPageAllocHandle descriptor, size_t offset, size_t size, void **ptr) |
Maps pages into the virtual address space. More... | |
void | NvOsPageUnmap (NvOsPageAllocHandle descriptor, void *ptr, size_t size) |
Unmaps the virtual address from NvOsPageMap(). More... | |
NvOsPhysAddr | NvOsPageAddress (NvOsPageAllocHandle descriptor, size_t offset) |
Returns the physical address given an offset. More... | |
Dynamic Library Handling | |
typedef struct NvOsLibraryRec * | NvOsLibraryHandle |
A handle to a dynamic library. More... | |
NvError | NvOsLibraryLoad (const char *name, NvOsLibraryHandle *library) |
Load a dynamic library. More... | |
void * | NvOsLibraryGetSymbol (NvOsLibraryHandle library, const char *symbol) |
Gets an address of a symbol in a dynamic library. More... | |
void | NvOsLibraryUnload (NvOsLibraryHandle library) |
Unloads a dynamic library. More... | |
NvError | NvOsLibraryUnloadEx (NvOsLibraryHandle library) |
Unloads a dynamic library. More... | |
Syncronization Objects and Thread Management | |
enum | NvOsThreadPriorityType { NvOsThreadPriorityType_Normal = 1, NvOsThreadPriorityType_NearInterrupt = 2, NvOsThreadPriorityType_Native = 3, NvOsThreadPriorityType_Last = 4, NvOsThreadPriorityType_Force32 = 0x7FFFFFFF } |
typedef struct NvOsMutexRec * | NvOsMutexHandle |
typedef struct NvOsIntrMutexRec * | NvOsIntrMutexHandle |
typedef struct NvOsConditionRec * | NvOsConditionHandle |
typedef struct NvOsSemaphoreRec * | NvOsSemaphoreHandle |
typedef struct NvOsThreadRec * | NvOsThreadHandle |
typedef void(* | NvOsThreadFunction) (void *args) |
Entry point for a thread. More... | |
typedef NvU32 | NvOsTlsKeyHandle |
A NvOsTlsKey Handle. More... | |
void | NvOsSleepMS (NvU32 msec) |
Unschedules the calling thread for at least the given number of milliseconds. More... | |
void | NvOsWaitUS (NvU32 usec) |
Stalls the calling thread for at least the given number of microseconds. More... | |
NvError | NvOsSleepUS (NvU32 usec) |
NvError | NvOsSleepNS (NvU32 nsec) |
NvError | NvOsBusyWaitUS (NvU32 usec) |
Stalls the calling thread for at least the given number of microseconds. More... | |
NvError | NvOsBusyWaitNS (NvU32 nsec) |
NvError | NvOsMutexCreate (NvOsMutexHandle *mutex) |
Allocates a new process-local mutex. More... | |
void | NvOsMutexLock (NvOsMutexHandle mutex) |
Locks the given unlocked mutex. More... | |
NvError | NvOsMutexLockEx (NvOsMutexHandle mutex) |
Locks the given unlocked mutex. More... | |
void | NvOsMutexUnlock (NvOsMutexHandle mutex) |
Unlocks a locked mutex. More... | |
NvError | NvOsMutexUnlockEx (NvOsMutexHandle mutex) |
Unlocks a locked mutex. More... | |
void | NvOsMutexDestroy (NvOsMutexHandle mutex) |
Frees the resources held by a mutex. More... | |
NvError | NvOsMutexDestroyEx (NvOsMutexHandle mutex) |
Frees the resources held by a mutex. More... | |
NvError | NvOsIntrMutexCreate (NvOsIntrMutexHandle *mutex) |
Creates a mutex that is safe to aquire in an ISR. More... | |
void | NvOsIntrMutexLock (NvOsIntrMutexHandle mutex) |
Aquire an ISR-safe mutex. More... | |
void | NvOsIntrMutexUnlock (NvOsIntrMutexHandle mutex) |
Releases an ISR-safe mutex. More... | |
void | NvOsIntrMutexDestroy (NvOsIntrMutexHandle mutex) |
Destroys an ISR-safe mutex. More... | |
NvError | NvOsConditionCreate (NvOsConditionHandle *cond) |
Creates a condition variable. More... | |
NvError | NvOsConditionDestroy (NvOsConditionHandle cond) |
Frees resources held by the condition variable. More... | |
NvError | NvOsConditionBroadcast (NvOsConditionHandle cond) |
Unblocks all threads currently blocked on the specified condition variable. More... | |
NvError | NvOsConditionSignal (NvOsConditionHandle cond) |
Unblocks atleast one of the threads that are blocked on the specified condition variable. More... | |
NvError | NvOsConditionWait (NvOsConditionHandle cond, NvOsMutexHandle mutex) |
Atomically releases the mutex and causes the calling thread to block on the condition variable. More... | |
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 timeout. More... | |
NvError | NvOsSemaphoreCreate (NvOsSemaphoreHandle *semaphore, NvU32 value) |
Creates a counting semaphore. More... | |
NvError | NvOsSemaphoreClone (NvOsSemaphoreHandle orig, NvOsSemaphoreHandle *semaphore) |
Creates a duplicate semaphore from the given semaphore. More... | |
void | NvOsSemaphoreWait (NvOsSemaphoreHandle semaphore) |
Waits until the semaphore value becomes non-zero, then decrements the value and returns. More... | |
NvError | NvOsSemaphoreWaitEx (NvOsSemaphoreHandle semaphore) |
Waits until the semaphore value becomes non-zero, then decrements the value and returns. More... | |
NvError | NvOsSemaphoreWaitTimeout (NvOsSemaphoreHandle semaphore, NvU32 msec) |
Waits for the given semaphore value to become non-zero with timeout. More... | |
void | NvOsSemaphoreSignal (NvOsSemaphoreHandle semaphore) |
Increments the semaphore value. More... | |
NvError | NvOsSemaphoreSignalEx (NvOsSemaphoreHandle semaphore) |
Increments the semaphore value. More... | |
void | NvOsSemaphoreDestroy (NvOsSemaphoreHandle semaphore) |
Frees resources held by the semaphore. More... | |
NvError | NvOsSemaphoreDestroyEx (NvOsSemaphoreHandle semaphore) |
Frees resources held by the semaphore. More... | |
NvError | NvOsThreadCreate (NvOsThreadFunction function, void *args, NvOsThreadHandle *thread) |
Creates a thread. More... | |
NvError | NvOsInterruptPriorityThreadCreate (NvOsThreadFunction function, void *args, NvOsThreadHandle *thread) |
Creates a near interrupt priority thread. More... | |
const char * | NvOsThreadGetName (NvOsThreadHandle thread) |
Returns the name of the given thread. More... | |
NvError | NvOsThreadSetName (NvOsThreadHandle thread, const char *name) |
Assigns the given name to the given thread. More... | |
void | NvOsThreadJoin (NvOsThreadHandle thread) |
Waits for the given thread to exit. More... | |
NvError | NvOsThreadJoinEx (NvOsThreadHandle thread) |
Waits for the given thread to exit. More... | |
void | NvOsThreadYield (void) |
Yields to another runnable thread. More... | |
NvU64 | NvOsGetCurrentThreadId (void) |
Returns current thread ID. More... | |
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, updates it to a new value. More... | |
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, updates it to a new value. More... | |
NvS32 | NvOsAtomicExchange32 (NvS32 *pTarget, NvS32 Value) |
Atomically swaps the contents of a 32-bit memory location with a value. More... | |
NvS32 | NvOsAtomicExchangeAdd32 (NvS32 *pTarget, NvS32 Value) |
Atomically increments the contents of a 32-bit memory location by a specified amount. More... | |
NvOsTlsKeyHandle | NvOsTlsAlloc (void) |
Allocates a thread-local storage variable. More... | |
NvOsTlsKeyHandle | NvOsTlsAllocWithDestructor (void(*destructor)(void *)) |
Allocates a thread-local storage variable, with destructor when thread exits. More... | |
void | NvOsTlsFree (NvOsTlsKeyHandle TlsIndex) |
Frees a thread-local storage variable. More... | |
void * | NvOsTlsGet (NvOsTlsKeyHandle TlsIndex) |
Gets the value of a thread-local storage variable. More... | |
void | NvOsTlsSet (NvOsTlsKeyHandle TlsIndex, void *Value) |
Sets the value of a thread-local storage variable. More... | |
NvError | NvOsTlsAddTerminator (void(*func)(void *), void *context) |
Registers a function that should be called when the thread terminates to clean up any structures stored in thread-local storage. More... | |
NvBool | NvOsTlsRemoveTerminator (void(*func)(void *), void *context) |
Checks the list of existing terminator functions for one that matches both the function and the data, and then removes that function from the list. More... | |
#define | NVOS_INVALID_TLS_INDEX 0xFFFFFFFF |
A TLS index that is guaranteed to be invalid. More... | |
#define | NVOS_TLS_CNT 4 |
Time Functions | |
typedef struct NvOsSystemTimeRec | NvOsSystemTime |
Defines the system time structure. More... | |
NvError | NvOsGetSystemTime (NvOsSystemTime *hNvOsSystemtime) |
Gets system realtime clock. More... | |
NvU32 | NvOsGetTimeMS (void) |
NvU64 | NvOsGetTimeUS (void) |
NvU64 | NvOsGetTimeNS (void) |
CPU Cache | |
Cache operations for both instruction and data cache, implemented per processor. | |
enum | NvOsCallstackType { NvOsCallstackType_NoStack = 1, NvOsCallstackType_HexStack = 2, NvOsCallstackType_SymbolStack = 3, NvOsCallstackType_Last = 4, NvOsCallstackType_Force32 = 0x7FFFFFFF } |
typedef void(* | NvOsInterruptHandler) (void *args) |
Interrupt handler function. More... | |
typedef struct NvOsInterruptRec * | NvOsInterruptHandle |
Interrupt handler type. More... | |
typedef void *(* | NvOsAllocFunc) (struct NvOsAllocatorRec *, size_t size) |
typedef void *(* | NvOsAllocAlignFunc) (struct NvOsAllocatorRec *, size_t align, size_t size) |
typedef void *(* | NvOsReallocFunc) (struct NvOsAllocatorRec *, void *ptr, size_t size) |
typedef void(* | NvOsFreeFunc) (struct NvOsAllocatorRec *, void *ptr) |
typedef struct NvOsAllocatorRec | NvOsAllocator |
typedef struct NvCallstackRec | NvCallstack |
typedef void(* | NvOsDumpCallback) (void *context, const char *line) |
void | NvOsDataCacheWriteback (void) |
Writes back the entire data cache. More... | |
void | NvOsDataCacheWritebackInvalidate (void) |
Writes back and invalidates the entire data cache. More... | |
void | NvOsDataCacheWritebackRange (void *start, NvU32 length) |
Writes back a range of the data cache. More... | |
void | NvOsDataCacheWritebackInvalidateRange (void *start, NvU32 length) |
Writes back and invlidates a range of the data cache. More... | |
void | NvOsInstrCacheInvalidate (void) |
Invalidates the entire instruction cache. More... | |
void | NvOsInstrCacheInvalidateRange (void *start, NvU32 length) |
Invalidates a range of the instruction cache. More... | |
NvBool | NvOsIsMemoryOfGivenType (NvOsMemAttribute Attrib, NvU32 Addr) |
Checks and returns whether the given memory address is within memory of given attribute. More... | |
void | NvOsFlushWriteCombineBuffer (void) |
Flushes the CPU's write combine buffer. More... | |
NvError | NvOsInterruptRegister (NvU32 IrqListSize, const NvU32 *pIrqList, const NvOsInterruptHandler *pIrqHandlerList, void *context, NvOsInterruptHandle *handle, NvBool InterruptEnable) |
Registers the interrupt handler with the IRQ number. More... | |
void | NvOsInterruptUnregister (NvOsInterruptHandle handle) |
Unregisters the interrupt handler from the associated IRQ number. More... | |
NvError | NvOsInterruptEnable (NvOsInterruptHandle handle) |
Enables the interrupt handler with the IRQ number. More... | |
void | NvOsInterruptDone (NvOsInterruptHandle handle) |
Called when the ISR/IST is done handling the interrupt. More... | |
void | NvOsInterruptMask (NvOsInterruptHandle handle, NvBool mask) |
Mask/unmask an interrupt. More... | |
struct NvOsAllocatorRec * | NvOsGetCurrentAllocator (void) |
void | NvOsDumpToDebugPrintf (void *context, const char *line) |
NvCallstack * | NvOsCallstackCreate (NvOsCallstackType stackType) |
void | NvOsCallstackDestroy (NvCallstack *callstack) |
NvU32 | NvOsCallstackGetHeight (NvCallstack *stack) |
void | NvOsCallstackGetFrame (char *buf, NvU32 len, NvCallstack *stack, NvU32 level) |
void | NvOsCallstackDump (NvCallstack *stack, NvU32 skip, NvOsDumpCallback callBack, void *context) |
NvU32 | NvOsCallstackHash (NvCallstack *stack) |
NvBool | NvOsCallstackContainsPid (NvCallstack *stack, NvU32 pid) |
void | NvOsGetProcessInfo (char *buf, NvU32 len) |
static NV_INLINE void | NvOsDebugCallstack (NvU32 skip) |
int | NvOsSetFpsTarget (int target) |
To be deprecated. More... | |
int | NvOsModifyFpsTarget (int fd, int target) |
To be deprecated. More... | |
void | NvOsCancelFpsTarget (int fd) |
To be deprecated. More... | |
NvU32 | NvOsReadReg (NvU64 Reg, NvU32 Off) |
void | NvOsWriteReg (NvU64 reg, NvU32 off, NvU32 val) |
NvError | NvOsMapRegSpace (NvU64 *VirtReg, NvU32 Base, NvU32 Size) |
NvError | NvOsUnMapRegSpace (NvU64 *VirtReg, NvU32 Base, NvU32 Size) |
int | NvOsDebugExternalLogInit (void) |
This function does slog initialization for current executing context. More... | |
#define NV_DEBUG_PRINTF | ( | x | ) | do {} while (NV_FALSE) |
Definition at line 309 of file nvos_tegra_nonsafety.h.
#define NV_ENABLE_DEBUG_PRINTS 0 |
Helper macro to go along with NvOsDebugPrintf.
Usage:
NV_DEBUG_PRINTF(("foo: %s\n", bar));
The debug print will be disabled by default in all builds, debug and release.
To enable debug prints in a particular .c file, add the following to the top of the .c file and rebuild:
#define NV_ENABLE_DEBUG_PRINTS 1
To enable debug prints in a particular module, add the following to the makefile and rebuild:
LCDEFS += -DNV_ENABLE_DEBUG_PRINTS=1
Definition at line 304 of file nvos_tegra_nonsafety.h.
#define NV_SHOW_ERROR | ( | err | ) | (err) |
Definition at line 276 of file nvos_tegra_nonsafety.h.
#define NV_SHOW_ERRORS NV_DEBUG |
Prints err if it is an error (does nothing if err==NvSuccess).
Always returns err unchanged never prints anything if err==NvSuccess)
NOTE: Do not use this with errors that are expected to occur under normal situations.
err | - the error to return |
Definition at line 272 of file nvos_tegra_nonsafety.h.
#define NVOS_HAS_CONDITION 1 |
Indicates that NvOs has condition variables.
Definition at line 144 of file nvos_tegra_nonsafety.h.
#define NVOS_HAS_FTRUNCATE 1 |
Indicates that NvOs has NvOsFtruncate().
Definition at line 140 of file nvos_tegra_nonsafety.h.
#define NVOS_HAS_MKDIR 1 |
Indicates that NvOs has NvOsMkdir().
Definition at line 136 of file nvos_tegra_nonsafety.h.
#define NVOS_HAS_MTIME 1 |
Indicates that NvOsStatType structure has mtime
.
Definition at line 132 of file nvos_tegra_nonsafety.h.
#define NVOS_INVALID_TLS_INDEX 0xFFFFFFFF |
A TLS index that is guaranteed to be invalid.
Definition at line 1582 of file nvos_tegra_nonsafety.h.
#define NVOS_KEY_MAX 128 |
The maximum length of a shared resource identifier string.
Definition at line 124 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_EXECUTE 0x4U |
Specifies the memory may be executed.
Definition at line 921 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_GLOBAL_ADDR 0x8U |
The memory must be visible by all processes, this is only valid for WinCE 5.0.
Definition at line 927 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_MMAP_FIXED 0x40U |
Specifies the memory must be mapped as fixed for mmap.
Definition at line 933 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_MMAP_LAZY 0x80U |
Support MAP_LAZY for mmap in QNX.
Definition at line 936 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_MMAP_POPULATE 0x100U |
Support MAP_POPULATE for mmap.
Definition at line 939 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_NONE 0x0U |
Specifies no memory flags.
Definition at line 912 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_READ 0x1U |
Specifies the memory may be read.
Definition at line 915 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_READ_WRITE (NVOS_MEM_READ | NVOS_MEM_WRITE) |
The memory may be both read and writen.
Definition at line 930 of file nvos_tegra_nonsafety.h.
#define NVOS_MEM_WRITE 0x2U |
Specifies the memory may be written to.
Definition at line 918 of file nvos_tegra_nonsafety.h.
#define NVOS_OPEN_APPEND 0x8 |
#define NVOS_OPEN_CREATE 0x4 |
Creates a file if is not present on the file system.
Definition at line 506 of file nvos_tegra_nonsafety.h.
#define NVOS_OPEN_READ 0x1 |
Opens a file with read permissions.
Definition at line 500 of file nvos_tegra_nonsafety.h.
#define NVOS_OPEN_WRITE 0x2 |
Opens a file with write persmissions.
Definition at line 503 of file nvos_tegra_nonsafety.h.
#define NVOS_PATH_MAX 256 |
The maximum length for a file system path.
Definition at line 128 of file nvos_tegra_nonsafety.h.
#define NVOS_TLS_CNT 4 |
Definition at line 1583 of file nvos_tegra_nonsafety.h.
typedef struct NvCallstackRec NvCallstack |
Definition at line 2045 of file nvos_tegra_nonsafety.h.
typedef void*(* NvOsAllocAlignFunc) (struct NvOsAllocatorRec *, size_t align, size_t size) |
Definition at line 1858 of file nvos_tegra_nonsafety.h.
typedef struct NvOsAllocatorRec NvOsAllocator |
typedef void*(* NvOsAllocFunc) (struct NvOsAllocatorRec *, size_t size) |
Definition at line 1857 of file nvos_tegra_nonsafety.h.
typedef struct NvOsConditionRec* NvOsConditionHandle |
Definition at line 1107 of file nvos_tegra_nonsafety.h.
typedef struct NvOsDirRec* NvOsDirHandle |
A handle to a directory.
Definition at line 674 of file nvos_tegra_nonsafety.h.
Definition at line 2057 of file nvos_tegra_nonsafety.h.
typedef struct NvOsFileRec* NvOsFileHandle |
Printf family.
Definition at line 151 of file nvos_tegra_nonsafety.h.
typedef void(* NvOsFreeFunc) (struct NvOsAllocatorRec *, void *ptr) |
Definition at line 1860 of file nvos_tegra_nonsafety.h.
typedef struct NvOsInterruptRec* NvOsInterruptHandle |
Interrupt handler type.
Definition at line 1778 of file nvos_tegra_nonsafety.h.
Interrupt handler function.
Definition at line 1774 of file nvos_tegra_nonsafety.h.
typedef struct NvOsIntrMutexRec* NvOsIntrMutexHandle |
Definition at line 1106 of file nvos_tegra_nonsafety.h.
typedef struct NvOsLibraryRec* NvOsLibraryHandle |
A handle to a dynamic library.
Definition at line 1048 of file nvos_tegra_nonsafety.h.
typedef struct NvOsMutexRec* NvOsMutexHandle |
Definition at line 1105 of file nvos_tegra_nonsafety.h.
typedef struct NvOsOsInfoRec NvOsOsInfo |
typedef struct NvOsPageAllocRec* NvOsPageAllocHandle |
Definition at line 978 of file nvos_tegra_nonsafety.h.
typedef NvU32 NvOsPhysAddr |
A physical address.
Must be 64 bits for OSs that support more than 64 bits of physical addressing, not necessarily correlated to the size of a virtual address.
Currently, 64-bit physical addressing is supported by NvOS on WinNT only.
XXX 64-bit phys addressing really should be supported on Linux/x86, since all modern x86 CPUs have 36-bit (or more) physical addressing. We might need to control a PCI card that the SBIOS has placed at an address above 4 GB.
Definition at line 119 of file nvos_tegra_nonsafety.h.
typedef void*(* NvOsReallocFunc) (struct NvOsAllocatorRec *, void *ptr, size_t size) |
Definition at line 1859 of file nvos_tegra_nonsafety.h.
typedef struct NvOsSemaphoreRec* NvOsSemaphoreHandle |
Definition at line 1108 of file nvos_tegra_nonsafety.h.
typedef struct NvOsSharedMemRec* NvOsSharedMemHandle |
An opaque handle returned by shared memory allocations.
Definition at line 804 of file nvos_tegra_nonsafety.h.
typedef struct NvOsStatTypeRec NvOsStatType |
typedef struct NvOsSystemTimeRec NvOsSystemTime |
Defines the system time structure.
Entry point for a thread.
Definition at line 1434 of file nvos_tegra_nonsafety.h.
typedef struct NvOsThreadRec* NvOsThreadHandle |
Definition at line 1109 of file nvos_tegra_nonsafety.h.
typedef NvU32 NvOsTlsKeyHandle |
A NvOsTlsKey Handle.
On Integrity pthread_key_t
is a pointer type, whereas it is an unsigned int on other platforms.
For Integrity case, NvOsTlsKeyHandle will be typedef'ed to NvUPtr later in a subsequent change.
Definition at line 1579 of file nvos_tegra_nonsafety.h.
anonymous enum |
Enumerator | |
---|---|
NVOS_VERB_LVL_0 | |
NVOS_VERB_LVL_1 | |
NVOS_VERB_LVL_2 | |
NVOS_VERB_LVL_3 | |
NVOS_VERB_LVL_4 |
Definition at line 232 of file nvos_tegra_nonsafety.h.
enum NvOsCallstackType |
Enumerator | |
---|---|
NvOsCallstackType_NoStack | |
NvOsCallstackType_HexStack | |
NvOsCallstackType_SymbolStack | |
NvOsCallstackType_Last | |
NvOsCallstackType_Force32 |
Definition at line 2047 of file nvos_tegra_nonsafety.h.
enum NvOsCodePage |
Defines straight-forward mappings to international language encodings.
Commonly-used encodings on supported operating systems are provided.
Enumerator | |
---|---|
NvOsCodePage_Unknown | |
NvOsCodePage_Utf8 | |
NvOsCodePage_Utf16 | |
NvOsCodePage_Windows1252 | |
NvOsCodePage_Force32 |
Definition at line 384 of file nvos_tegra_nonsafety.h.
enum NvOsFileType |
Enumerator | |
---|---|
NvOsFileType_Unknown | |
NvOsFileType_File | |
NvOsFileType_Directory | |
NvOsFileType_Fifo | |
NvOsFileType_CharacterDevice | |
NvOsFileType_BlockDevice | |
NvOsFileType_Force32 |
Definition at line 471 of file nvos_tegra_nonsafety.h.
enum NvOsMemAttribute |
Defines memory attributes.
Definition at line 875 of file nvos_tegra_nonsafety.h.
enum NvOsOs |
Enumerator | |
---|---|
NvOsOs_Unknown | |
NvOsOs_Windows | |
NvOsOs_Linux | |
NvOsOs_Qnx | |
NvOsOs_Integrity | |
NvOsOs_Force32 |
Definition at line 317 of file nvos_tegra_nonsafety.h.
enum NvOsPageFlags |
Low-level memory allocation of the external system memory.
Enumerator | |
---|---|
NvOsPageFlags_Contiguous | |
NvOsPageFlags_NonContiguous | |
NvOsMemFlags_Forceword |
Definition at line 970 of file nvos_tegra_nonsafety.h.
enum NvOsSeekEnum |
Defines wrappers over stdlib's file stream functions, with some changes to the API.
Enumerator | |
---|---|
NvOsSeek_Set | NvOS equivalent of SEEK_SET. |
NvOsSeek_Cur | NvOS equivalent of SEEK_CUR. |
NvOsSeek_End | NvOS equivalent of SEEK_END. |
NvOsSeek_Force32 | Max value for NvOsSeekEnum. |
Definition at line 458 of file nvos_tegra_nonsafety.h.
enum NvOsSku |
Enumerator | |
---|---|
NvOsSku_Unknown | |
NvOsSku_Android | |
NvOsSku_Force32 |
Definition at line 327 of file nvos_tegra_nonsafety.h.
Enumerator | |
---|---|
NvOsThreadPriorityType_Normal | |
NvOsThreadPriorityType_NearInterrupt | |
NvOsThreadPriorityType_Native | |
NvOsThreadPriorityType_Last | |
NvOsThreadPriorityType_Force32 |
Definition at line 1420 of file nvos_tegra_nonsafety.h.
void* NvOsAlloc | ( | size_t | size | ) |
Dynamically allocates memory.
Alignment, if desired, must be done by the caller.
size | The size of the memory to allocate. |
void* NvOsAllocAlign | ( | size_t | align, |
size_t | size | ||
) |
Dynamically allocates memory with specific alignment.
align | The alignment of the memory to allocate. Must be a power of two. |
size | The size of the memory to allocate, in bytes. |
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, updates it to a new value.
This function is the equivalent of the following code, except that other threads or processors are effectively prevented from reading or writing *pTarget while we are inside the function.
Atomically compares the contents of a pointer-sized memory location with a value, and if they match, updates it to a new value.
This function is the equivalent of the following code, except that other threads or processors are effectively prevented from reading or writing *pTarget while we are inside the function.
NvS32 NvOsAtomicExchange32 | ( | NvS32 * | pTarget, |
NvS32 | Value | ||
) |
Atomically swaps the contents of a 32-bit memory location with a value.
This function is the equivalent of the following code, except that other threads or processors are effectively prevented from reading or writing *pTarget while we are inside the function.
NvS32 NvOsAtomicExchangeAdd32 | ( | NvS32 * | pTarget, |
NvS32 | Value | ||
) |
Atomically increments the contents of a 32-bit memory location by a specified amount.
This function is the equivalent of the following code, except that other threads or processors are effectively prevented from reading or writing *pTarget while we are inside the function.
NvError NvOsBusyWaitNS | ( | NvU32 | nsec | ) |
NvError NvOsBusyWaitUS | ( | NvU32 | usec | ) |
Stalls the calling thread for at least the given number of microseconds.
The actual time waited might be longer; you cannot depend on this function for precise timing.
usec | The number of microseconds to wait. |
NvSuccess | If successful, or the appropriate error code. |
NvBool NvOsCallstackContainsPid | ( | NvCallstack * | stack, |
NvU32 | pid | ||
) |
NvCallstack* NvOsCallstackCreate | ( | NvOsCallstackType | stackType | ) |
Referenced by NvOsDebugCallstack().
void NvOsCallstackDestroy | ( | NvCallstack * | callstack | ) |
Referenced by NvOsDebugCallstack().
void NvOsCallstackDump | ( | NvCallstack * | stack, |
NvU32 | skip, | ||
NvOsDumpCallback | callBack, | ||
void * | context | ||
) |
Referenced by NvOsDebugCallstack().
void NvOsCallstackGetFrame | ( | char * | buf, |
NvU32 | len, | ||
NvCallstack * | stack, | ||
NvU32 | level | ||
) |
NvU32 NvOsCallstackGetHeight | ( | NvCallstack * | stack | ) |
NvU32 NvOsCallstackHash | ( | NvCallstack * | stack | ) |
void NvOsCancelFpsTarget | ( | int | fd | ) |
To be deprecated.
Cancels the fps target previously supplied with the NvOsSetFpsTarget() function.
fd | The file descriptor generated by NvOsSetFpsTarget . |
void NvOsClosedir | ( | NvOsDirHandle | dir | ) |
Closes the directory.
dir | The directory to close. Passing in a null handle is okay. |
NvError NvOsConditionBroadcast | ( | NvOsConditionHandle | cond | ) |
Unblocks all threads currently blocked on the specified condition variable.
cond | The condition variable on which other threads may be blocked. |
NvError_BadParameter | if the condition variable is not valid. |
NvError NvOsConditionCreate | ( | NvOsConditionHandle * | cond | ) |
Creates a condition variable.
cond | A pointer to the condition variable to initialize. |
NvSuccess | if successful, or the appropriate error code. |
NvError_InsufficientMemory | if insufficient memory exists. |
NvError_Busy | if there are insufficient resources. |
NvError NvOsConditionDestroy | ( | NvOsConditionHandle | cond | ) |
Frees resources held by the condition variable.
cond | The condition variable to destroy. |
NvSuccess | if successful. |
NvError_BadParameter | if condition variable is not valid. |
NvError_Busy | if the condition variable is currently being used in another thread. |
NvError NvOsConditionSignal | ( | NvOsConditionHandle | cond | ) |
Unblocks atleast one of the threads that are blocked on the specified condition variable.
cond | The condition variable on which other threads may be blocked. |
NvError_BadParameter | if condition variable is not valid. |
NvError NvOsConditionWait | ( | NvOsConditionHandle | cond, |
NvOsMutexHandle | mutex | ||
) |
Atomically releases the mutex and causes the calling thread to block on the condition variable.
This function must be called with mutex locked by the calling thread or undefined behaviour results. Upon successful return, the mutex shall have been locked and be owned by the calling thread.
cond | The condition variable to wait on. |
mutex | The associated mutex that needs to be locked by the calling thread. |
NvSuccess | if successful. |
NVError_AccessDenied | if the mutex was not owned by the calling thread. |
NvError_BadParameter | if condition variable or mutex is not valid. |
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 timeout.
Must be called with mutex locked by the calling thread or undefined behaviour results. Upon successful return, the mutex shall have been locked and be owned by the calling thread
cond | The condition variable to wait on. |
mutex | The associated mutex that needs to be locked by the calling thread. |
microsecs | Time specified in microseconds for timeout to occur. |
NvSuccess | if successful. |
NVError_AccessDenied | if the mutex was not owned by the calling thread. |
NVError_Timeout | if the time specified by microsecs has passed before the condition variable is signalled or broadcast. |
NvError_BadParameter | if condition variable or mutex is not valid. |
Writes back and invlidates a range of the data cache.
start | A pointer to the start address. |
length | The number of bytes to write back. |
Writes back a range of the data cache.
start | A pointer to the start address. |
length | The number of bytes to write back. |
|
static |
Definition at line 2070 of file nvos_tegra_nonsafety.h.
References NvOsCallstackCreate(), NvOsCallstackDestroy(), NvOsCallstackDump(), NvOsCallstackType_SymbolStack, and NvOsDumpToDebugPrintf().
int NvOsDebugExternalLogInit | ( | void | ) |
This function does slog initialization for current executing context.
The Log init operation is performed internally in the NvOs library constructor. So this function call is not required for process where NvOs library loaded. However this function should be called when child process is executed using fork().
SWUD ID:
NvS32 NvOsDebugNprintf | ( | const char * | format, |
... | |||
) |
Same as NvOsDebugPrintf, except returns the number of chars written.
void NvOsDebugPrintf | ( | const char * | format, |
... | |||
) |
Outputs a message to the debugging console, if present.
All device driver debug printfs should use this. Do not use this for interacting with a user from an application; in that case, use NvTestPrintf() instead.
format | A pointer to the format string. |
void NvOsDebugString | ( | const char * | str | ) |
void NvOsDebugVprintf | ( | const char * | format, |
va_list | ap | ||
) |
Same as NvOsDebugPrintf, except takes a va_list.
Referenced by NvOsDebugCallstack().
void NvOsFclose | ( | NvOsFileHandle | stream | ) |
Closes a file stream.
stream | The file stream to close. Passing in a null handle is okay. |
NvError NvOsFcloseEx | ( | NvOsFileHandle | stream | ) |
Closes a file stream.
stream | The file stream to close. Passing in a null handle is okay. |
NvError NvOsFflush | ( | NvOsFileHandle | stream | ) |
Flushes any pending writes to the file stream.
stream | The file stream. |
NvError NvOsFgetc | ( | NvOsFileHandle | stream, |
NvU8 * | c | ||
) |
Gets a character from a file stream.
stream | The file stream. | |
[out] | c | A pointer to the character from the file stream. |
NvError_EndOfFile | When the end of file is reached. |
NvError NvOsFopen | ( | const char * | path, |
NvU32 | flags, | ||
NvOsFileHandle * | file | ||
) |
Opens a file stream.
If the NVOS_OPEN_CREATE flag is specified, NVOS_OPEN_WRITE must also be specified.
If NVOS_OPEN_WRITE
is specified, the file will be opened for write and will be truncated if it was previously existing.
If NVOS_OPEN_WRITE
and NVOS_OPEN_READ are specified, the file will not be truncated.
path | A pointer to the path to the file. | |
flags | Or'd flags for the open operation (NVOS_OPEN_* ). | |
[out] | file | A pointer to the file that will be opened, if successful. |
NvError NvOsFprintf | ( | NvOsFileHandle | stream, |
const char * | format, | ||
... | |||
) |
Prints a string to a file stream.
stream | The file stream to which to print. |
format | The format string. |
NvError NvOsFread | ( | NvOsFileHandle | stream, |
void * | ptr, | ||
size_t | size, | ||
size_t * | bytes | ||
) |
Reads a file stream.
Buffered read implementation if available for a particular OS may return corrupted data if multiple threads read from the same stream simultaneously.
To detect short reads (less that specified amount), pass in bytes and check its value to the expected value. The bytes parameter may be null.
stream | The file stream. | |
ptr | A pointer to the buffer for the read data. | |
size | The length of the read. | |
[out] | bytes | A pointer to the number of bytes readd; may be null. |
NvError_FileReadFailed | If the file read encountered any system errors. |
NvError_EndOfFile | Indicates end of file reached. Bytes must be checked to determine whether data was read into the buffer. |
Frees a dynamic memory allocation.
Freeing a null value is okay.
ptr | A pointer to the memory to free, which should be from NvOsAlloc(). |
NvError NvOsFremove | ( | const char * | filename | ) |
Removes a file from the storage media.
If the file is open, this function marks the file for deletion upon close.
filename | A pointer to the file to remove. |
NvError_FileOperationFailed | If cannot remove file. |
NvError NvOsFseek | ( | NvOsFileHandle | file, |
NvS64 | offset, | ||
NvOsSeekEnum | whence | ||
) |
Changes the file position pointer.
file | The file. |
offset | The offset from whence to seek. |
whence | The starting point for the seek. |
NvError_FileOperationFailed | On error. |
NvError NvOsFstat | ( | NvOsFileHandle | file, |
NvOsStatType * | stat | ||
) |
Gets file information from an already open file.
file | The open file. | |
[out] | stat | A pointer to the information structure. |
NvError NvOsFsync | ( | NvOsFileHandle | stream | ) |
Commits any pending writes to storage media.
After this completes, any pending writes are guaranteed to be on the storage media associated with the stream (if any).
stream | The file stream. |
NvError NvOsFtell | ( | NvOsFileHandle | file, |
NvU64 * | position | ||
) |
Gets the current file position pointer.
file | The file. | |
[out] | position | A pointer to the file position. |
NvError_FileOperationFailed | On error. |
NvError NvOsFtruncate | ( | NvOsFileHandle | stream, |
NvU64 | length | ||
) |
Causes the file to have a size of length bytes.
The file must be opened for writing.
stream | Holds the file stream. |
length | Specifies the size of file in bytes to which to truncate. |
NvError_FileOperationFailed | If file is not open for writing. |
NvError_ResourceError | If I/O error occurred when writing to the file. |
NvError NvOsFwrite | ( | NvOsFileHandle | stream, |
const void * | ptr, | ||
size_t | size | ||
) |
Writes to a file stream.
stream | The file stream. |
ptr | A pointer to the data to write. |
size | The length of the write. |
NvError_FileWriteFailed | Returned on error. |
NvError NvOsGetConfigString | ( | const char * | name, |
char * | value, | ||
NvU32 | size | ||
) |
Retrieves a string variable from the config store.
See also: NvOs Configuration Data Storage Support
name | A pointer to the name of the variable. |
value | A pointer to the value to write into. |
size | The size of the value buffer. |
NvError_ConfigVarNotFound | If the name is not found in the config store. |
NvError NvOsGetConfigU32 | ( | const char * | name, |
NvU32 * | value | ||
) |
Retrieves an unsigned integer variable from the config store.
See also: NvOs Configuration Data Storage Support
name | A pointer to the name of the variable. | |
[out] | value | A pointer to the value to write. |
NvError_ConfigVarNotFound | If the name is not found in the config store. |
NvError_InvalidConfigVar | If the configuration variable cannot be converted into an unsigned integer. |
struct NvOsAllocatorRec* NvOsGetCurrentAllocator | ( | void | ) |
NvU64 NvOsGetCurrentThreadId | ( | void | ) |
Returns current thread ID.
ThreadId |
NvError NvOsGetOsInformation | ( | NvOsOsInfo * | pOsInfo | ) |
Gets the current OS version.
pOsInfo | A pointer to the operating system information structure. |
void NvOsGetProcessInfo | ( | char * | buf, |
NvU32 | len | ||
) |
NvError NvOsGetSysConfigString | ( | const char * | name, |
char * | value, | ||
NvU32 | size | ||
) |
Retrieves a string variable from the config store, with a persist.sys prefix.
See also: NvOs Configuration Data Storage Support
name | A pointer to the name of the variable. |
value | A pointer to the value to write into. |
size | The size of the value buffer. |
NvError_ConfigVarNotFound | If the name is not found in the config store. |
NvError NvOsGetSystemTime | ( | NvOsSystemTime * | hNvOsSystemtime | ) |
Gets system realtime clock.
hNvOsSystemtime | A pointer to the system handle used to set the time. |
NvU32 NvOsGetTimeMS | ( | void | ) |
The returned values are guaranteed to be monotonically increasing, but may wrap back to zero (after about 50 days of runtime).
In some systems, this is the number of milliseconds since power-on, or may actually be an accurate date.
NvU64 NvOsGetTimeNS | ( | void | ) |
The returned values are guaranteed to be monotonically increasing, but may wrap back to zero.
Some systems cannot gauantee a nanosecond resolution timer. Even though the time returned is in nanoseconds, it is not guaranteed to have nano-second resolution.
Please be advised that this API is mainly used for code profiling and meant to be used direclty in driver code.
NvU64 NvOsGetTimeUS | ( | void | ) |
The returned values are guaranteed to be monotonically increasing, but may wrap back to zero.
Some systems cannot gauantee a microsecond resolution timer. Even though the time returned is in microseconds, it is not gaurnateed to have micro-second resolution.
Please be advised that this API is mainly used for code profiling and meant to be used direclty in driver code.
int NvOsGetVerboseLevel | ( | NvS32 * | VerbLevel | ) |
Invalidates a range of the instruction cache.
start | A pointer to the start address. |
length | The number of bytes. |
void NvOsInterruptDone | ( | NvOsInterruptHandle | handle | ) |
Called when the ISR/IST is done handling the interrupt.
handle | Interrupt handle returned when a successfull call is made to NvOsInterruptRegister(). |
NvError NvOsInterruptEnable | ( | NvOsInterruptHandle | handle | ) |
Enables the interrupt handler with the IRQ number.
handle | Interrupt handle returned when a successfull call is made to NvOsInterruptRegister . |
NvError_BadParameter | If the handle is not valid. |
NvError_InsufficientMemory | If interrupt enable failed. |
NvSuccess | If interrupt enable is successful. |
void NvOsInterruptMask | ( | NvOsInterruptHandle | handle, |
NvBool | mask | ||
) |
Mask/unmask an interrupt.
Drivers can use this API to fend off interrupts. Mask means no interrupts are forwarded to the CPU. Unmask means, interrupts are forwarded to the CPU. In case of SMP systems, this API masks the interrutps to all the CPUs, not just the calling CPU.
handle | Interrupt handle returned by NvOsInterruptRegister(). |
mask | NV_FALSE to forward the interrupt to CPU; NV_TRUE to mask the interrupts to CPU. |
NvError NvOsInterruptPriorityThreadCreate | ( | NvOsThreadFunction | function, |
void * | args, | ||
NvOsThreadHandle * | thread | ||
) |
Creates a near interrupt priority thread.
function | The thread entry point. | |
args | A pointer to the thread arguments. | |
[out] | thread | A pointer to the result thread ID structure. |
NvError NvOsInterruptRegister | ( | NvU32 | IrqListSize, |
const NvU32 * | pIrqList, | ||
const NvOsInterruptHandler * | pIrqHandlerList, | ||
void * | context, | ||
NvOsInterruptHandle * | handle, | ||
NvBool | InterruptEnable | ||
) |
Registers the interrupt handler with the IRQ number.
IrqListSize | Size of the IrqList passed in for registering the IRQ handlers for each IRQ number. |
pIrqList | Array of IRQ numbers for which interupt handlers are to be registerd. |
pIrqHandlerList | A pointer to an array of interrupt routines to be called when an interrupt occurs. |
context | A pointer to the register's context handle. |
handle | A pointer to the interrupt handle. |
InterruptEnable | If true, immediately enable interrupt. Otherwise enable interrupt only after calling NvOsInterruptEnable(). |
NvError_IrqRegistrationFailed | If the interrupt is already registered. |
NvError_BadParameter | If the IRQ number is not valid. |
void NvOsInterruptUnregister | ( | NvOsInterruptHandle | handle | ) |
Unregisters the interrupt handler from the associated IRQ number.
handle | interrupt Handle returned when a successfull call is made to NvOsInterruptRegister(). |
NvError NvOsIntrMutexCreate | ( | NvOsIntrMutexHandle * | mutex | ) |
Creates a mutex that is safe to aquire in an ISR.
mutex | A pointer to the mutex is stored here on success. |
void NvOsIntrMutexDestroy | ( | NvOsIntrMutexHandle | mutex | ) |
Destroys an ISR-safe mutex.
mutex | The mutex to destroy. If mutex is NULL, this API has no effect. |
void NvOsIntrMutexLock | ( | NvOsIntrMutexHandle | mutex | ) |
Aquire an ISR-safe mutex.
mutex | The mutex to lock. For kernel (OAL) implementations, NULL implies the system-wide lock will be used. |
void NvOsIntrMutexUnlock | ( | NvOsIntrMutexHandle | mutex | ) |
Releases an ISR-safe mutex.
mutex | The mutex to unlock. For kernel (OAL) implementations, NULL implies the system-wide lock will be used. |
NvBool NvOsIsMemoryOfGivenType | ( | NvOsMemAttribute | Attrib, |
NvU32 | Addr | ||
) |
Checks and returns whether the given memory address is within memory of given attribute.
Attrib | Memory attribute to check. |
Addr | Address of the memory, which is to be checked. |
NV_TRUE | if memory pointed by Addr is of given attribute, NV_FASLE otherwise. |
void* NvOsLibraryGetSymbol | ( | NvOsLibraryHandle | library, |
const char * | symbol | ||
) |
Gets an address of a symbol in a dynamic library.
library | The dynamic library. |
symbol | A pointer to the symbol to lookup. |
NvError NvOsLibraryLoad | ( | const char * | name, |
NvOsLibraryHandle * | library | ||
) |
Load a dynamic library.
No operating system specific suffixes or paths should be used for the library name. So do not use:
/usr/lib/libnvos.so libnvos.dll
Just use:
libnvos
name | A pointer to the library name. | |
[out] | library | A pointer to the result library. |
NvError_LibraryNotFound | If the library cannot be opened. |
void NvOsLibraryUnload | ( | NvOsLibraryHandle | library | ) |
Unloads a dynamic library.
library | The dynamic library to unload. It is okay to pass a null library value. |
NvError NvOsLibraryUnloadEx | ( | NvOsLibraryHandle | library | ) |
Unloads a dynamic library.
library | The dynamic library to unload. |
void NvOsLogPrintf | ( | int | prio, |
const char * | tag, | ||
const char * | format, | ||
... | |||
) |
Same as NvOsDebugPrintf, except takes priority and tag fields.
NvError NvOsMapRegSpace | ( | NvU64 * | VirtReg, |
NvU32 | Base, | ||
NvU32 | Size | ||
) |
Compares two memory regions.
s1 | A pointer to the first memory region. |
s2 | A pointer to the second memory region. |
size | The length to compare. |
This returns 0 If the memory regions are identical
Copies memory.
dest | A pointer to the destination of the copy. |
src | A pointer to the source memory. |
size | The length of the copy. |
Sets a region of memory to a value.
This API is deprecated – use memset() instead in new code!
s | A pointer to the memory region. |
c | The value to set. |
size | The length of the region. |
NvError NvOsMkdir | ( | char * | dirname | ) |
Creates the directory.
This is currently only implemented on Linux.
dirname | A pointer to the name of the directory to create. |
NvError_PathAlreadyExists | If directory could not be created because the path already exists. |
NvSuccess | If the directory was created. |
int NvOsModifyFpsTarget | ( | int | fd, |
int | target | ||
) |
To be deprecated.
Sets the frame rate target with an existing file descriptor (fd).
fd | An open fd returned by the NvOsSetFpsTarget() function. |
target | The fps target. |
NvError NvOsMutexCreate | ( | NvOsMutexHandle * | mutex | ) |
Allocates a new process-local mutex.
mutex | The mutex to initialize. |
void NvOsMutexDestroy | ( | NvOsMutexHandle | mutex | ) |
Frees the resources held by a mutex.
Mutecies are reference counted and a given mutex will not be destroyed until the last reference has gone away.
mutex | The mutex to destroy. Passing in a null mutex is okay. |
NvError NvOsMutexDestroyEx | ( | NvOsMutexHandle | mutex | ) |
Frees the resources held by a mutex.
Mutecies are reference counted and a given mutex will not be destroyed until the last reference has gone away.
mutex | The mutex to destroy. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsMutexLock | ( | NvOsMutexHandle | mutex | ) |
Locks the given unlocked mutex.
If a process is holding a lock on a multi-process mutex when it terminates, this lock will be automatically released.
mutex | The mutex to lock; note that this is a recursive lock. |
NvError NvOsMutexLockEx | ( | NvOsMutexHandle | mutex | ) |
Locks the given unlocked mutex.
If a process is holding a lock on a multi-process mutex when it terminates, this lock will be automatically released.
mutex | The mutex to lock; note that this is a recursive lock. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsMutexUnlock | ( | NvOsMutexHandle | mutex | ) |
Unlocks a locked mutex.
A mutex must be unlocked exactly as many times as it has been locked.
mutex | The mutex to unlock. |
NvError NvOsMutexUnlockEx | ( | NvOsMutexHandle | mutex | ) |
Unlocks a locked mutex.
A mutex must be unlocked exactly as many times as it has been locked.
mutex | The mutex to unlock. |
NvSuccess | If successful, or the appropriate error code. |
NvError NvOsOpendir | ( | const char * | path, |
NvOsDirHandle * | dir | ||
) |
Opens a directory.
path | A pointer to the path of the directory to open. | |
[out] | dir | A pointer to the directory that will be opened, if successful. |
NvError_DirOperationFailed | Returned upon failure. |
NvOsPhysAddr NvOsPageAddress | ( | NvOsPageAllocHandle | descriptor, |
size_t | offset | ||
) |
Returns the physical address given an offset.
This is useful for non-contiguous page allocations.
descriptor | The descriptor from NvOsPageAlloc(), etc. |
offset | The offset in bytes into the page range. |
NvError NvOsPageAlloc | ( | size_t | size, |
NvOsMemAttribute | attrib, | ||
NvOsPageFlags | flags, | ||
NvU32 | protect, | ||
NvOsPageAllocHandle * | descriptor | ||
) |
Allocates memory via the page allocator.
size | The number of bytes to allocate. | |
attrib | Page caching attributes. | |
flags | Various memory allocation flags. | |
protect | Page protection attributes (NVOS_MEM_* ). | |
[out] | descriptor | A pointer to the result descriptor. |
void NvOsPageFree | ( | NvOsPageAllocHandle | descriptor | ) |
Frees pages from NvOsPageAlloc().
It is not valid to call NvOsPageFree() while there are outstanding mappings.
descriptor | The descriptor from NvOsPageAlloc . |
NvError NvOsPageMap | ( | NvOsPageAllocHandle | descriptor, |
size_t | offset, | ||
size_t | size, | ||
void ** | ptr | ||
) |
Maps pages into the virtual address space.
Upon successful completion, *ptr holds a virtual address that may be accessed.
descriptor | Allocated pages from NvOsPageAlloc(), etc. | |
offset | Offset in bytes into the page range. | |
size | The size of the mapping. | |
[out] | ptr | A pointer to the result pointer. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsPageUnmap | ( | NvOsPageAllocHandle | descriptor, |
void * | ptr, | ||
size_t | size | ||
) |
Unmaps the virtual address from NvOsPageMap().
descriptor | Allocated pages from NvOsPageAlloc(), etc. |
ptr | A pointer to the virtual address to unmap that was returned from NvOsPageMap . |
size | The size of the mapping, which should match what was passed into NvOsPageMap . |
NvError NvOsPhysicalMemMap | ( | NvOsPhysAddr | phys, |
size_t | size, | ||
NvOsMemAttribute | attrib, | ||
NvU32 | flags, | ||
void ** | ptr | ||
) |
Maps computer resources into user space.
phys | The physical address start. | |
size | The size of the aperture. | |
attrib | Memory attributes (caching). | |
flags | Bitwise OR of NVOS_MEM_* . | |
[out] | ptr | A pointer to the result pointer. |
Releases resources previously allocated by NvOsPhysicalMemMap().
ptr | The virtual pointer returned by NvOsPhysicalMemMap . If this pointer is null, this function has no effect. |
size | The size of the mapped region. |
NvError NvOsReaddir | ( | NvOsDirHandle | dir, |
char * | name, | ||
size_t | size | ||
) |
Gets the next entry in the directory.
dir | The directory pointer. | |
[out] | name | A pointer to the name of the next file. |
size | The size of the name buffer. |
NvError_EndOfDirList | When there are no more entries in the directory. |
NvError_DirOperationFailed | If there is a system error. |
NvU32 NvOsReadReg | ( | NvU64 | Reg, |
NvU32 | Off | ||
) |
Re-sizes a previous dynamic allocation.
ptr | A pointer to the original allocation. |
size | The new size to allocate. |
NvError NvOsSemaphoreClone | ( | NvOsSemaphoreHandle | orig, |
NvOsSemaphoreHandle * | semaphore | ||
) |
Creates a duplicate semaphore from the given semaphore.
Freeing the original semaphore has no effect on the new semaphore.
orig | The semaphore to duplicate. |
semaphore | A pointer to the new semaphore. |
NvSuccess | If successful, or the appropriate error code. |
NvError NvOsSemaphoreCreate | ( | NvOsSemaphoreHandle * | semaphore, |
NvU32 | value | ||
) |
Creates a counting semaphore.
semaphore | A pointer to the semaphore to initialize. |
value | The initial semaphore value. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsSemaphoreDestroy | ( | NvOsSemaphoreHandle | semaphore | ) |
Frees resources held by the semaphore.
Semaphores are reference counted across the computer (multiproceses), and a given semaphore will not be destroyed until the last reference has gone away.
semaphore | The semaphore to destroy. Passing in a null semaphore is okay (no op). |
NvError NvOsSemaphoreDestroyEx | ( | NvOsSemaphoreHandle | semaphore | ) |
Frees resources held by the semaphore.
Semaphores are reference counted across the computer (multiproceses), and a given semaphore will not be destroyed until the last reference has gone away.
semaphore | The semaphore to destroy. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsSemaphoreSignal | ( | NvOsSemaphoreHandle | semaphore | ) |
Increments the semaphore value.
semaphore | The semaphore to signal. |
NvError NvOsSemaphoreSignalEx | ( | NvOsSemaphoreHandle | semaphore | ) |
Increments the semaphore value.
semaphore | The semaphore to signal. |
NvSuccess | If successful, or the appropriate error code. |
void NvOsSemaphoreWait | ( | NvOsSemaphoreHandle | semaphore | ) |
Waits until the semaphore value becomes non-zero, then decrements the value and returns.
semaphore | The semaphore to wait for. |
NvError NvOsSemaphoreWaitEx | ( | NvOsSemaphoreHandle | semaphore | ) |
Waits until the semaphore value becomes non-zero, then decrements the value and returns.
semaphore | The semaphore to wait for. |
NvSuccess | If successful, or the appropriate error code. |
NvError NvOsSemaphoreWaitTimeout | ( | NvOsSemaphoreHandle | semaphore, |
NvU32 | msec | ||
) |
Waits for the given semaphore value to become non-zero with timeout.
If the semaphore value becomes non-zero before the timeout, then the value is decremented and NvSuccess is returned.
semaphore | The semaphore to wait for. |
msec | Timeout value in milliseconds. NV_WAIT_INFINITE can be used to wait forever. |
NvError_Timeout | If the wait expires. |
int NvOsSetFpsTarget | ( | int | target | ) |
To be deprecated.
Sets a frame rate target that matches the CPU frequency scaling to the measured performance.
target | The fps target. |
int NvOsSetVerboseLevel | ( | NvS32 | VerbLevel | ) |
NvError NvOsSharedMemAlloc | ( | const char * | key, |
size_t | size, | ||
NvOsSharedMemHandle * | descriptor | ||
) |
Dynamically allocates multiprocess shared memory.
The memory will be zero initialized when it is first created.
key | A pointer to the global key to identify the shared allocation. | |
size | The size of the allocation. | |
[out] | descriptor | A pointer to the result descriptor. |
void NvOsSharedMemFree | ( | NvOsSharedMemHandle | descriptor | ) |
Frees shared memory from NvOsSharedMemAlloc().
It is valid to call NvOsSharedMemFree
while mappings are still outstanding.
descriptor | The memory descriptor. |
NvError NvOsSharedMemGetFd | ( | NvOsSharedMemHandle | descriptor, |
int * | fd | ||
) |
Extracts the file descriptor from a handle.
descriptor | The memory descriptor to map. | |
[out] | fd | A pointer to the result. |
NvError NvOsSharedMemHandleFromFd | ( | int | fd, |
NvOsSharedMemHandle * | descriptor | ||
) |
Enables sharing NvOsSharedMemHandle memory that was created by a call to NvOsSharedMemAlloc().
fd | A pointer to the global key to identify the shared allocation. | |
[out] | descriptor | A pointer to the result descriptor. |
NvError_SharedMemMapFailed | on failure. |
NvError NvOsSharedMemMap | ( | NvOsSharedMemHandle | descriptor, |
size_t | offset, | ||
size_t | size, | ||
void ** | ptr | ||
) |
Maps a shared memory region into the process virtual memory.
descriptor | The memory descriptor to map. | |
offset | The offset in bytes into the mapped area. | |
size | The size area to map. | |
[out] | ptr | A pointer to the result pointer. |
NvError_SharedMemMapFailed | on failure. |
Unmaps a mapped region of shared memory.
ptr | A pointer to the pointer to virtual memory. |
size | The size of the mapped region. |
Prints an error and the line it appeared on.
Does nothing if err is NvSuccess
.
err | The error to return. |
file | A pointer to the file the error occurred in. |
line | The line number the error occurred on. |
void NvOsSleepMS | ( | NvU32 | msec | ) |
Unschedules the calling thread for at least the given number of milliseconds.
Other threads may run during the sleep time.
msec | The number of milliseconds to sleep. |
NvError NvOsSleepNS | ( | NvU32 | nsec | ) |
NvError NvOsSleepUS | ( | NvU32 | usec | ) |
NvS32 NvOsSnprintf | ( | char * | str, |
size_t | size, | ||
const char * | format, | ||
... | |||
) |
Expands a string into a given string buffer.
str | A pointer to the target string buffer. |
size | The size of the string buffer. |
format | A pointer to the format string. |
NvError NvOsStat | ( | const char * | filename, |
NvOsStatType * | stat | ||
) |
Gets file information.
filename | A pointer to the file about which to get information. | |
[out] | stat | A pointer to the information structure. |
void NvOsStrcpy | ( | char * | dest, |
const char * | src | ||
) |
Copies a string.
The src string must be NUL terminated.
dest | A pointer to the destination of the copy. |
src | A pointer to the source string. |
size_t NvOsStrlen | ( | const char * | s | ) |
void NvOsStrncpy | ( | char * | dest, |
const char * | src, | ||
size_t | size | ||
) |
Copies a string, length-limited.
dest | A pointer to the destination of the copy. |
src | A pointer to the source string. |
size | The length of the dest string buffer plus NULL terminator. |
size_t NvOsStrnlen | ( | const char * | s, |
size_t | size | ||
) |
Gets the length of a string.
length-limited.
s | A pointer to the string. |
size | the maximum length to check |
NvError NvOsThreadCreate | ( | NvOsThreadFunction | function, |
void * | args, | ||
NvOsThreadHandle * | thread | ||
) |
Creates a thread.
function | The thread entry point. | |
args | A pointer to the thread arguments. | |
[out] | thread | A pointer to the result thread ID structure. |
const char* NvOsThreadGetName | ( | NvOsThreadHandle | thread | ) |
Returns the name of the given thread.
thread | The thread whose name needs to be returned. |
void NvOsThreadJoin | ( | NvOsThreadHandle | thread | ) |
Waits for the given thread to exit.
The joined thread will be destroyed automatically. All OS resources will be reclaimed. There is no method for terminating a thread before it exits naturally.
thread | The thread to wait for. Passing in a null thread ID is okay (no op). |
NvError NvOsThreadJoinEx | ( | NvOsThreadHandle | thread | ) |
Waits for the given thread to exit.
The joined thread will be destroyed automatically. All OS resources will be reclaimed. There is no method for terminating a thread before it exits naturally.
thread | The thread to wait for. |
NvSuccess | If successful, or the appropriate error code. |
NvError NvOsThreadSetName | ( | NvOsThreadHandle | thread, |
const char * | name | ||
) |
Assigns the given name to the given thread.
thread | The thread to assign the name to. |
name | String codifying the thread name. |
Registers a function that should be called when the thread terminates to clean up any structures stored in thread-local storage.
func | The callback function called when the thread terminates. |
context | A pointer to the data to pass to the callback function. |
NvOsTlsKeyHandle NvOsTlsAlloc | ( | void | ) |
Allocates a thread-local storage variable.
All TLS variables have initial value NULL in all threads when first allocated.
NvOsTlsKeyHandle NvOsTlsAllocWithDestructor | ( | void(*)(void *) | destructor | ) |
Allocates a thread-local storage variable, with destructor when thread exits.
All TLS variables have initial value NULL in all threads when first allocated.
destructor | Callback to invoke when thread is destroyed. |
void NvOsTlsFree | ( | NvOsTlsKeyHandle | TlsIndex | ) |
Frees a thread-local storage variable.
TlsIndex | The TLS index of the TLS variable. This function is a no-op if TlsIndex equals NVOS_INVALID_TLS_INDEX. |
void* NvOsTlsGet | ( | NvOsTlsKeyHandle | TlsIndex | ) |
Gets the value of a thread-local storage variable.
TlsIndex | The TLS index of the TLS variable. The current value of the TLS variable is returned. |
Checks the list of existing terminator functions for one that matches both the function and the data, and then removes that function from the list.
func | The callback function called when the thread terminates. |
context | A pointer to the data to pass to the callback function. |
void NvOsTlsSet | ( | NvOsTlsKeyHandle | TlsIndex, |
void * | Value | ||
) |
Sets the value of a thread-local storage variable.
TlsIndex | The TLS index of the TLS variable. |
Value | A pointer to the new value of the TLS variable. |
NvError NvOsUnMapRegSpace | ( | NvU64 * | VirtReg, |
NvU32 | Base, | ||
NvU32 | Size | ||
) |
void NvOsVerbosePrintf | ( | NvS32 | VerbLevel, |
const char * | Fmt, | ||
... | |||
) |
NvError NvOsVfprintf | ( | NvOsFileHandle | stream, |
const char * | format, | ||
va_list | ap | ||
) |
Prints a string to a file stream using a va_list.
stream | The file stream. |
format | A pointer to the format string. |
ap | The va_list structure. |
NvS32 NvOsVsnprintf | ( | char * | str, |
size_t | size, | ||
const char * | format, | ||
va_list | ap | ||
) |
Expands a string into a string buffer using a va_list.
str | A pointer to the target string buffer. |
size | The size of the string buffer. |
format | A pointer to the format string. |
ap | The va_list structure. |
void NvOsWaitUS | ( | NvU32 | usec | ) |
Stalls the calling thread for at least the given number of microseconds.
The actual time waited might be longer; you cannot depend on this function for precise timing.
usec | The number of microseconds to wait. |
void NvOsWriteReg | ( | NvU64 | reg, |
NvU32 | off, | ||
NvU32 | val | ||
) |
NvOsAllocFunc NvOsAllocatorRec::Alloc |
Definition at line 1863 of file nvos_tegra_nonsafety.h.
NvOsAllocAlignFunc NvOsAllocatorRec::AllocAlign |
Definition at line 1864 of file nvos_tegra_nonsafety.h.
NvOsFreeFunc NvOsAllocatorRec::Free |
Definition at line 1866 of file nvos_tegra_nonsafety.h.
NvU32 NvOsSystemTimeRec::Milliseconds |
Definition at line 1659 of file nvos_tegra_nonsafety.h.
NvU64 NvOsStatTypeRec::mtime |
last modified time of the file
Definition at line 496 of file nvos_tegra_nonsafety.h.
NvOsOs NvOsOsInfoRec::OsType |
Definition at line 336 of file nvos_tegra_nonsafety.h.
NvOsReallocFunc NvOsAllocatorRec::Realloc |
Definition at line 1865 of file nvos_tegra_nonsafety.h.
NvU32 NvOsSystemTimeRec::Seconds |
Definition at line 1658 of file nvos_tegra_nonsafety.h.
NvU64 NvOsStatTypeRec::size |
Definition at line 493 of file nvos_tegra_nonsafety.h.
NvOsSku NvOsOsInfoRec::Sku |
Definition at line 337 of file nvos_tegra_nonsafety.h.
NvOsFileType NvOsStatTypeRec::type |
Definition at line 494 of file nvos_tegra_nonsafety.h.