NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Functions

void NvOsMemcpy (void *dest, const void *src, size_t size)
 This function copy to destination pointer from source pointer, and copying length is given as size parameter. More...
 
void * NvOsAllocAlign (size_t align, size_t size)
 This function allocates aligned memory. More...
 
void * NvOsAlloc (size_t size)
 This function returns the allocated memory dynamically, and allocated memory is not initialized. More...
 
void NvOsFree (void *ptr)
 This function free the allocated memory. More...
 
void NvOsMemset (void *s, NvU8 c, size_t size)
 This function initializes the memory with the c parameter, And the length of initializing memory, is give the size parameter as bytes. More...
 
void * NvOsRealloc (void *ptr, size_t size)
 This function resizes the allocated memory as the size parameter. More...
 
int32_t NvOsTypeMemInit (const char *typ_mem_name, int32_t *handle)
 Open type memory specified by typ_mem_name and return the handle to the typed memory. More...
 
int32_t NvOsTypeMemDeinit (int32_t handle)
 Close typed memory handle. More...
 
void * NvOsAllocTypeMemCached (int32_t handle, size_t size, uint32_t flags, int64_t *paddr)
 Allocate cached typed memory. More...
 
void * NvOsAllocTypeMemUncached (int32_t handle, size_t size, uint32_t flags, int64_t *paddr)
 Allocate non-cached typed memory. More...
 
int32_t NvOsTypeMemFree (size_t size, void *ptr)
 Frees the previously allocated memory. This function removes any mappings for pages in the address range starting at ptr (passed as input parameter) and continuing for size (passed as input parameter) bytes, rounded up to the next multiple of the page size. References to unmapped pages cause a SIGSEGV signalto be set on the process. If there are no mappings in the specified address range, then this call has no effect. More...
 

Function Documentation

◆ NvOsAlloc()

void* NvOsAlloc ( size_t  size)

This function returns the allocated memory dynamically, and allocated memory is not initialized.

Parameters
[in]sizeThe size to allocate memory, as bytes
Returns
Not NULL Success
NULL Error if malloc() return NULL
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: No
  • Maturity: GA

◆ NvOsAllocAlign()

void* NvOsAllocAlign ( size_t  align,
size_t  size 
)

This function allocates aligned memory.

Parameters
[in]alignFollowed/passed to alignment parameter of posix_memalign() in QNX libc
[in]sizeMemory size to allocate as bytes, passed to size parameter of posix_memalign() in QNX libc
Returns
Not NULL Success
Null Error if posix_memalign() return error
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.
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: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsAllocTypeMemCached()

void* NvOsAllocTypeMemCached ( int32_t  handle,
size_t  size,
uint32_t  flags,
int64_t *  paddr 
)

Allocate cached typed memory.

Parameters
[in]handlehandle to typed memory which is opened by NvOsTypeMemInit() call.
[in]sizesize of memory to be allocated. It should not be 0.
[in]flagsflags to be used for mmap, limited to MAP_NOINHERIT.
[out]paddrreturning physical address of the allocated memory
Returns
Address(VA) of the allocated memory in case of Success
NULL in case of allocation failure
Precondition
NvOsTypeMemInit() must be called to open the typed memory before calling this function.
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: PROCMGR_AID_MEM_PHYS
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsAllocTypeMemUncached()

void* NvOsAllocTypeMemUncached ( int32_t  handle,
size_t  size,
uint32_t  flags,
int64_t *  paddr 
)

Allocate non-cached typed memory.

Parameters
[in]handlehandle to typed memory which is opened by NvOsTypeMemInit() call.
[in]sizesize of memory to be allocated
[in]flagsflags to be used for mmap, limited to MAP_NOINHERIT.
[out]paddrreturning physical address of the allocated memory
Returns
Address(VA) of the allocated memory in case of success
NULL in case of allocation failure
Precondition
NvOsTypeMemInit() must be called to open the typed memory before calling this function.
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: PROCMGR_AID_MEM_PHYS
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsFree()

void NvOsFree ( void *  ptr)

This function free the allocated memory.

Parameters
[in]ptrThe pointer of allocated memory
Returns
N/A
Precondition
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

◆ NvOsMemcpy()

void NvOsMemcpy ( void *  dest,
const void *  src,
size_t  size 
)

This function copy to destination pointer from source pointer, and copying length is given as size parameter.

Parameters
[out]destDestination memory pointer
[in]srcSource memory pointer
[in]sizeCopying length as bytes
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

◆ NvOsMemset()

void NvOsMemset ( void *  s,
NvU8  c,
size_t  size 
)

This function initializes the memory with the c parameter, And the length of initializing memory, is give the size parameter as bytes.

Parameters
[out]sMemory pointer will be initialized with c parameter
[in]cs parameter is initialized with c parameter
[in]sizeLength of initializing memory, as bytes
Returns
N/A
Precondition
None


Usage considerations

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

◆ NvOsRealloc()

void* NvOsRealloc ( void *  ptr,
size_t  size 
)

This function resizes the allocated memory as the size parameter.

  • If size parameter is greater than the allocated memory size
    • Extended allocated memory is not initialized
  • If size parameter is equal or smaller than the allocated memory size
    • Value of ptr parameter is kept as per size parameter
Parameters
[in]ptrAllocated memory pointer
[in]sizeNew size of allocated memory as bytes
Returns
Not NULL Success
Null Error if realloc() in QNX libc return NULL
Precondition
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

◆ NvOsTypeMemDeinit()

int32_t NvOsTypeMemDeinit ( int32_t  handle)

Close typed memory handle.

Parameters
[in]handlehandle to typed memory which is opened by NvOsTypeMemInit() call.
Returns
0 in case of success
EBADF if handle is invalid or checking API mode is failed
errno if closing handle is failed, errno will return
Precondition
NvOsTypeMemInit() must be called to open the typed memory before calling this function.
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

◆ NvOsTypeMemFree()

int32_t NvOsTypeMemFree ( size_t  size,
void *  ptr 
)

Frees the previously allocated memory. This function removes any mappings for pages in the address range starting at ptr (passed as input parameter) and continuing for size (passed as input parameter) bytes, rounded up to the next multiple of the page size. References to unmapped pages cause a SIGSEGV signalto be set on the process. If there are no mappings in the specified address range, then this call has no effect.

Parameters
[in]sizeSize of the memory to free.
[in]ptrA pointer to the memory to be freed.
Returns
0 for success
-1 for failure
Precondition
NvOsAllocTypeMemCached() or NvOsAllocTypeMemUncached() must be called to allocate the memory before calling this function.
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

◆ NvOsTypeMemInit()

int32_t NvOsTypeMemInit ( const char *  typ_mem_name,
int32_t *  handle 
)

Open type memory specified by typ_mem_name and return the handle to the typed memory.

Parameters
[in]typ_mem_nametyped memory name
[out]handlehandle to typed memory
Returns
non-negative integer in case of success
NvError_AccessDenied if an error occurred
Precondition
The typed memory entry must be created by using as_add() in startup.
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: PROCMGR_AID_MEM_PHYS
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA