NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Functions

NvError NvOsMapRegSpace (NvU64 *reg, NvU32 base, NvU32 size)
 This function map device's physical address to process's address space. And mapped address is stored into VirtReg. VirtReg can be used as a reg parameter of NvOsReadReg(). More...
 
NvU32 NvOsReadReg (NvU64 reg, NvU32 off)
 This function reads the value of device's physical address from mapped pointer. And mapped address is given as Reg and Off parameter. This function returns the value of address, which is pointed by the sum of two parameters (Reg and Off). And the sum is passed to port parameter of in32() in QNX libc. More...
 
NvError NvOsUnMapRegSpace (NvU64 *reg, NvU32 base, NvU32 size)
 This function unmap device's physical address from process's address space. More...
 
void NvOsWriteReg (NvU64 reg, NvU32 off, NvU32 val)
 This function writes the val parameter to the sum of two parameters (Reg and Off) and the sum is passed to port parameter of out32() in QNX libc. More...
 

Function Documentation

◆ NvOsMapRegSpace()

NvError NvOsMapRegSpace ( NvU64 *  reg,
NvU32  base,
NvU32  size 
)

This function map device's physical address to process's address space. And mapped address is stored into VirtReg. VirtReg can be used as a reg parameter of NvOsReadReg().

Parameters
[out]regPointer is mapped to device's physical address
[in]baseDevice's physical address to map to process's address space. And it is passed to physical parameter of mmap_device_memory() in QNX libc
[in]sizeNumber of bytes to map device's physical address. This is passed to len parameter of mmap_device_memory() in QNX libc
Returns
0 Success
NvError_BadParameter Error if reg is NULL
NvError_InsufficientMemory Error if there is not enough memory to satisfy the request
NvError_AccessDenied Error if a calling thread doesn't have the privilege
NvError_ModuleNotPresent Error if The address from physical for len bytes is invalid for the requested object
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: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsReadReg()

NvU32 NvOsReadReg ( NvU64  reg,
NvU32  off 
)

This function reads the value of device's physical address from mapped pointer. And mapped address is given as Reg and Off parameter. This function returns the value of address, which is pointed by the sum of two parameters (Reg and Off). And the sum is passed to port parameter of in32() in QNX libc.

Parameters
[in]regMapped pointer which is pointing device's physical address
[in]offOffset address from mapped pointer, and it is passed to port parameter of in32()
Returns
The value of address(which is pointed the sum of two parameters (Reg and Off)) as unsigned int 32 bit
Precondition
NvOsMapRegSpace() must be called to map the device's physical address before calling this function.


Usage considerations

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

◆ NvOsUnMapRegSpace()

NvError NvOsUnMapRegSpace ( NvU64 *  reg,
NvU32  base,
NvU32  size 
)

This function unmap device's physical address from process's address space.

Parameters
[out]regMapped pointer which is pointing device's physical address
[in]baseDevice's physical address to unmap to process's address space and it is passed to addr parameter of munmap_device_memory()
[in]sizeNumber of bytes to unmap device's physical address. This is passed to len parameter of munmap_device_memory()
Returns
NvSuccess Success
NvError_BadParameter The parameter reg is NULL or the region specified reg and size are outside the range allowed for the address space of a process.
Precondition
NvOsMapRegSpace() must be called to map the device's physical address 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: Yes
    • 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

◆ NvOsWriteReg()

void NvOsWriteReg ( NvU64  reg,
NvU32  off,
NvU32  val 
)

This function writes the val parameter to the sum of two parameters (Reg and Off) and the sum is passed to port parameter of out32() in QNX libc.

Parameters
[in]regMapped pointer which is pointing device's physical address
[in]offOffset address from mapped pointer
[in]valvariable to write
Returns
N/A
Precondition
NvOsMapRegSpace() must be called to map the device's physical address before calling this function.


Usage considerations

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