NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Data Structures

struct  NvOsOsInfo
 Info about OS type and the chip SKU. More...
 

Enumerations

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
}
 

Functions

NvError NvOsShowError (NvError err, const char *file, int line)
 This function prints an error and the line it appeared on. Does nothing if err is NvSuccess. More...
 
void * NvUAlloc0 (size_t size)
 This function dynamically allocates zeroed memory. More...
 
NvError NvOsGetOsInformation (NvOsOsInfo *pOsInfo)
 This function gets the OS information. More...
 
void NvOsGetProcessInfo (char *buf, NvU32 len)
 This function gets process information. The buf parameter is printed as 's - (pid d)' which followed a standard of printf() in QNX libc. More...
 
NvS32 NvOsAtomicExchange32 (NvS32 *pTarget, NvS32 value)
 This function atomically swaps the contents of a 32-bit memory location with a value. This is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed. More...
 
NvS32 NvOsAtomicExchangeAdd32 (NvS32 *pTarget, NvS32 value)
 This function atomically increments the contents of a 32-bit memory location by a specified amount. This function is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed. More...
 
NvError NvOsGetConfigString (const char *name, char *value, NvU32 size)
 This function gets an environment variable as string pointer. And copy it to value parameter by strncpy(), copying length is up to size parameter. More...
 
NvError NvOsGetConfigU32 (const char *name, NvU32 *value)
 This function get an environment variable as integer. More...
 
NvError NvOsGetSysConfigString (const char *name, char *value, NvU32 size)
 This function gets an environment variable as string pointer. And copy it to value parameter by strncpy(), copying length is up to size parameter. More...
 
void * NvOsAtomicCompareExchangePtr (void **pTarget, void *OldValue, void *NewValue)
 This 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, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed. More...
 
NvS32 NvOsAtomicCompareExchange32 (NvS32 *pTarget, NvS32 OldValue, NvS32 NewValue)
 This function assigns new value to pointer if the value of pointer is same with the value specified by oldValue, atomically. This function is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed. More...
 
int NvOsDebugExternalLogInit (void)
 This function initializes the connection with syslog. And if a shared memory for log level control exists, this function opens and maps the memory. NvOS logging API filters logs based on the log level control table in this shared memory. More...
 

Enumeration Type Documentation

◆ NvOsOs

enum NvOsOs
Enumerator
NvOsOs_Unknown 

Unsupported OS.

NvOsOs_Windows 

Windows OS.

NvOsOs_Linux 

Linux OS.

NvOsOs_Qnx 

QNX OS.

NvOsOs_Integrity 

Integrity OS.

NvOsOs_Force32 

Max value for NvOsOs.

Definition at line 91 of file nvos_s3_tegra_safety.h.

◆ NvOsSku

enum NvOsSku
Enumerator
NvOsSku_Unknown 

Unknown SKU.

NvOsSku_Android 

Android.

NvOsSku_Force32 

Max value for NvOsSku.

Definition at line 108 of file nvos_s3_tegra_safety.h.

Function Documentation

◆ NvOsAtomicCompareExchange32()

NvS32 NvOsAtomicCompareExchange32 ( NvS32 *  pTarget,
NvS32  OldValue,
NvS32  NewValue 
)

This function assigns new value to pointer if the value of pointer is same with the value specified by oldValue, atomically. This function is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed.

NvS32 oldTargetValue = *pTarget;
if (oldTargetValue == OldValue)
*pTarget = NewValue;
return oldTargetValue;
Parameters
[in,out]pTargetPointer to target to be compared and updated.
[in]OldValueCompare with the value of pTarget pointer
[in]NewValueNew value to assign pTarget pointer
Returns
0 when pTarget is NULL
Previous value which is pointed by pTarget parameter, before NewValue parameter is assigned to it
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsAtomicCompareExchangePtr()

void* NvOsAtomicCompareExchangePtr ( void **  pTarget,
void *  OldValue,
void *  NewValue 
)

This 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, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed.

void *OldTarget = *pTarget;
if (OldTarget == OldValue)
*pTarget = NewValue;
return OldTarget;
Parameters
[out]pTargetPointer to target to be compared and updated. Should not be NULL
[in]OldValuePointer to store old value to be compared. Should not be NULL
[in]NewValuePointer to store new value to be exchanged. Should not be NULL
Returns
Not NULL Success
NULL if one of pTargeet, oldVavlue or NewValue is NULL
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsAtomicExchange32()

NvS32 NvOsAtomicExchange32 ( NvS32 *  pTarget,
NvS32  value 
)

This function atomically swaps the contents of a 32-bit memory location with a value. This is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed.

NvS32 OldTarget = *pTarget;
*pTarget = Value;
return OldTarget;
Parameters
[in]pTargetPointer to assign new value. Should not be NULL
[in]valuenew value to assign pTarget parameter
Returns
0 if pTarget is NULL
Previous value which is pointed by pTarget parameter, before Value parameter is assigned to it
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsAtomicExchangeAdd32()

NvS32 NvOsAtomicExchangeAdd32 ( NvS32 *  pTarget,
NvS32  value 
)

This function atomically increments the contents of a 32-bit memory location by a specified amount. This function is the equivalent of the following code, which is atomically executed. It means that the operation is not affected by other threads or processors and safely executed.

NvS32 OldTarget = *pTarget;
*pTarget = OldTarget + Value;
return OldTarget;
Parameters
[in]pTargetPointer to add new value. Should not be NULL
[in]valuenew value to add pTarget parameter
Returns
0 if pTarget is NULL
Previous value which is pointed by pTarget parameter, before Value parameter is add to it
N/A
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsDebugExternalLogInit()

int NvOsDebugExternalLogInit ( void  )

This function initializes the connection with syslog. And if a shared memory for log level control exists, this function opens and maps the memory. NvOS logging API filters logs based on the log level control table in this shared memory.

Returns
Always 0
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: No
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsGetConfigString()

NvError NvOsGetConfigString ( const char *  name,
char *  value,
NvU32  size 
)

This function gets an environment variable as string pointer. And copy it to value parameter by strncpy(), copying length is up to size parameter.

Parameters
[in]nameName of environment variable, passed to name parameter of getenv() in QNX libc
[out]valueA buffer to store the value of the envionment specified by name
[in]sizeMaximum length of string to be copied to value
Returns
NvSuccess Success
NvError_BadParameter Error if either name or value parameter is NULL
NvError_BadParameter Error if size is 0
NvError_ConfigVarNotFound Error if getenv() in QNX libc, return NULL
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsGetConfigU32()

NvError NvOsGetConfigU32 ( const char *  name,
NvU32 *  value 
)

This function get an environment variable as integer.

Parameters
[in]nameName of environment variable, passed to name parameter of getenv() in QNX libc
[out]valueEnvironment variable as 32 bit unsigned interger.
Returns
NvSuccess Success
NvError_BadParameter Error if name parameter is NULL
NvError_BadValue Error if name of environment variable is existed, however, the value of it is 0-length string.
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsGetOsInformation()

NvError NvOsGetOsInformation ( NvOsOsInfo *  pOsInfo)

This function gets the OS information.

Parameters
[out]pOsInfoDescribe OS information
Returns
NvError_BadParameter if pOsInfo parameter is NULL
NvSuccess if success
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: Yes
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsGetProcessInfo()

void NvOsGetProcessInfo ( char *  buf,
NvU32  len 
)

This function gets process information. The buf parameter is printed as 's - (pid d)' which followed a standard of printf() in QNX libc.

  • If process name can be read from '/proc/self/cmdline',
    • process name is printed into 's' format string
  • If not, '-' is printed into 's' format string
  • process id is printed into 'd' format string
Parameters
[out]bufBuffer that both process name and process id are printed into
[in]lenlength of buf parameter, printed length will not exceed len parameter
Returns
N/A
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsGetSysConfigString()

NvError NvOsGetSysConfigString ( const char *  name,
char *  value,
NvU32  size 
)

This function gets an environment variable as string pointer. And copy it to value parameter by strncpy(), copying length is up to size parameter.

Parameters
[in]nameName of environment variable, passed to name parameter of getenv() in QNX libc
[out]valueA buffer to store the value of the envionment specified by name
[in]sizeMaximum length of string to be copied to value
Returns
NvSuccess Success
NvError_BadParameter Error if either name or value parameter is NULL
NvError_BadParameter Error if size is 0
NvError_BadValue Error if name of environment variable is existed, however, the value of it is 0-length string.
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsShowError()

NvError NvOsShowError ( NvError  err,
const char *  file,
int  line 
)

This function prints an error and the line it appeared on. Does nothing if err is NvSuccess.

Parameters
[in]errError which is a type of NvError
[in]fileFile anme where an error happens in
[in]lineLine number where an error happens on
Returns
Error value that is same with input parameter, err.
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvUAlloc0()

void* NvUAlloc0 ( size_t  size)

This function dynamically allocates zeroed memory.

Parameters
[in]sizeThe number of bytes to allocate
Returns
A pointer to zeroed memory if success
NULL error
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA
NvRmFenceRec::Value
NvU32 Value
Definition: nvrm_host1x_safe_compat.h:57