NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Typedefs

typedef struct NvOsSemaphoreRec * NvOsSemaphoreHandle
 

Functions

NvError NvOsSemaphoreClone (NvOsSemaphoreHandle orig, NvOsSemaphoreHandle *semaphore)
 This function clones the semaphore. More...
 
NvError NvOsSemaphoreCreate (NvOsSemaphoreHandle *semaphore, NvU32 value)
 This function creates a semaphore, and the number of wait operations, is initialized to the value parameter. More...
 
NvError NvOsSemaphoreDestroyEx (NvOsSemaphoreHandle semaphore)
 This function destroys a semaphore. More...
 
NvError NvOsSemaphoreSignalEx (NvOsSemaphoreHandle semaphore)
 This function increases the number of wait operation, to given semaphore. More...
 
NvError NvOsSemaphoreWaitEx (NvOsSemaphoreHandle semaphore)
 This function waits a semaphore, and decrease the number of wait operations. Thread is blocked infinitely, if number of semaphore wait operations is 0. More...
 
NvError NvOsSemaphoreWaitTimeout (NvOsSemaphoreHandle semaphore, NvU32 msec)
 This function waits a semaphore and decreases the number of wait operation. More...
 

Typedef Documentation

◆ NvOsSemaphoreHandle

typedef struct NvOsSemaphoreRec* NvOsSemaphoreHandle

Handle for NvOS semaphore. This is an opaque type and should not be dereferenced.

Definition at line 1245 of file nvos_s3_tegra_safety.h.

Function Documentation

◆ NvOsSemaphoreClone()

NvError NvOsSemaphoreClone ( NvOsSemaphoreHandle  orig,
NvOsSemaphoreHandle *  semaphore 
)

This function clones the semaphore.

  • If original semaphore is destroyed, cloned semaphore is still available
Parameters
[in]origOriginal semaphore
[out]semaphoreWill be cloned from original semaphore
Returns
NvSuccess Success
NvError_BadParameter Error if orig or semaphore parameter is NULL
NvError_OverFlow: The number of references to the original semaphore exceeds UINT32_MAX.
Precondition
The orig parameter should be created by NvOsSemaphoreClone() or NvOsSemaphoreCreate() 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: No
  • Maturity: GA

◆ NvOsSemaphoreCreate()

NvError NvOsSemaphoreCreate ( NvOsSemaphoreHandle *  semaphore,
NvU32  value 
)

This function creates a semaphore, and the number of wait operations, is initialized to the value parameter.

Parameters
[out]semaphoreWill be created
[in]valuePassed to the value parameter of sem_init()
Returns
NvSuccess Success
NvError_BadParameter Error if semaphore parameter is NULL
NvError_InsufficientMemory Memory allocation for semaphore is failed
NvError_ResourceError Error if sem_init() in QNX libc, return error
NvError_ResourceError Error if pthread_mutex_init() in QNX libc, return error
Precondition
NvOsSemaphoreCreate() must be called to create the semaphore handle 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: No
  • Maturity: GA

◆ NvOsSemaphoreDestroyEx()

NvError NvOsSemaphoreDestroyEx ( NvOsSemaphoreHandle  semaphore)

This function destroys a semaphore.

Parameters
[in]semaphoreSemaphore to be destroyed
Returns
NvSuccess : Success
NvError_AccessDenied : Error when the calling thread does not own the mutex.
NvError_BadParameter : Error when NvOs semaphore handle is NULL or semaphore is invalid.
NvError_Busy : Error when the mutex is locked by another thread.
NvError_InvalidState : Error when dealock condition is detected or the user of mutex is terminated while holding the mutex lock.
NvError_Timeout : Error when QNX kernel timeout unblocks the call to this API or the calling thread was unblocked by a call to QNX API pthread_mutex_wakup_np().
Precondition
NvOsSemaphoreCreate() must be called to create the semaphore handle 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

◆ NvOsSemaphoreSignalEx()

NvError NvOsSemaphoreSignalEx ( NvOsSemaphoreHandle  semaphore)

This function increases the number of wait operation, to given semaphore.

Parameters
[in]semaphoreTo increase Semaphore's number of wait operations
Returns
NvSuccess : Success
NvError_BadParameter : Error when semaphore handle is NULL or semaphore is invalid.
NvError_InterruptedBySignal : Error when the call is interrupted by a signal.
Precondition
NvOsSemaphoreCreate() must be called to create the semaphore handle before calling this function.


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

◆ NvOsSemaphoreWaitEx()

NvError NvOsSemaphoreWaitEx ( NvOsSemaphoreHandle  semaphore)

This function waits a semaphore, and decrease the number of wait operations. Thread is blocked infinitely, if number of semaphore wait operations is 0.

  • If multiple threads are waiting same semaphore,
    • The highest priority thread is returned
  • If multiple threads are waiting same semaphore, and their priority is same
    • The thread(which has been waited the longest duration) is returned
Parameters
[in]semaphoreSemaphore to wait
Returns
NvSuccess Success
NvError_BadParameter Error when semaphore handle is NULL or semaphore is invalid.
Precondition
NvOsSemaphoreCreate() must be called to create the semaphore handle before calling this function.


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

◆ NvOsSemaphoreWaitTimeout()

NvError NvOsSemaphoreWaitTimeout ( NvOsSemaphoreHandle  semaphore,
NvU32  msec 
)

This function waits a semaphore and decreases the number of wait operation.

  • If number of wait operations is 0,
    • Thread is blocked during the given msec parameter.
    • During being blocked
      • If other thread call NvOsSemaphoreSignal(), the number of wait operations is decreased, and then this function is returned
      • Otherwise, NvError_Timeout is returned
  • Otherwise, number of wait operations is decreased, and this function is returned
  • If multiple threads are waiting same semaphore,
    • The highest priority thread is returned
  • If multiple threads are waiting same semaphore, and their priority is same
    • The thread(which has been waited the longest duration) is returned
Parameters
[in]semaphoreSemaphore to wait
[in]msecWaiting duration as millisecond
Returns
NvSuccess Success
NvError_BadParameter Error if semaphore parameter is NULL
NvError_Timeout Error while the given millisecond is passed, the number of wait operation is still 0
Precondition
NvOsSemaphoreCreate() must be called to create the semaphore handle before calling this function.


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