The NvSciEventService library provides the ability to build portable event-driven applications. An event is any significant occurrence or change in the state for system hardware or software. An event notification is a message or notification sent by one software part to another to convey that an event has taken place. An event-driven model consists of an event producer and event consumers. Once an event producer detects an event, it represents the event as a message (or notification). An event is transmitted from an event producer to event consumers through an OS-specific event channel. Event consumers must be informed when an event has occurred. NvSciEventService will execute the correct response (or callback) to an event.
NvSciEventService provides a mandatory abstract interface between other SCI technologies (especially NvSciIpc and NvSciStreams) and the application-provided event loop that services them.
The following common object type(s) are implemented:
Data Structures | |
| struct | NvSciLocalEvent |
| An OS-agnostic object that sends signal to another thread in the same process. More... | |
| struct | NvSciEventService |
| An abstract interface for a program's event handling infrastructure. More... | |
| struct | NvSciEventNotifier |
| An abstract interface to notify event to event consumer and to register event handler of the event consumer client process. More... | |
| struct | NvSciEventLoopService |
| An abstract interface that event consumer can wait for events using event notifier in event loop. More... | |
Macros | |
| #define | NV_SCI_EVENT_INFINITE_WAIT -1 |
| Infinite timeout for NvSciEventLoopService::WaitForEvent() or NvSciEventLoopService::WaitForMultipleEvents(). More... | |
| #define | NV_SCI_EVENT_PRIORITIES 4 |
Typedefs | |
| typedef struct NvSciEventService | NvSciEventService |
| typedef struct NvSciEventNotifier | NvSciEventNotifier |
| typedef struct NvSciEventLoopService | NvSciEventLoopService |
| typedef struct NvSciNativeEvent | NvSciNativeEvent |
| typedef struct NvSciLocalEvent | NvSciLocalEvent |
Functions | |
| NvSciError | NvSciEventLoopServiceCreate (size_t maxEventLoops, NvSciEventLoopService **newEventLoopService) |
| Creates a new event loop service. More... | |
| NvSciError | NvSciEventLoopServiceCreateSafe (size_t maxEventLoops, void *config, NvSciEventLoopService **newEventLoopService) |
| Creates a new event loop service. More... | |
| NvSciError | NvSciEventLoopServiceCreateSafeX (size_t maxEventLoops, void *config, NvSciEventLoopService **newEventLoopService) |
| Creates a new event loop service that has the same properties as created by NvSciEventLoopServiceCreateSafe(), but supports faster local event. More... | |
| NvSciError | NvSciEventMoveNotifier (NvSciEventService *oldEventService, NvSciEventService *newEventService, NvSciEventNotifier *eventNotifier) |
| Move event notifier. More... | |
| NvSciError | NvSciEventCheckVersionCompatibility (uint32_t majorVer, uint32_t minorVer, bool *isCompatible) |
| Check NvSciEventSerivice library version compatibility. More... | |
Common QNX privileges required for all NvSciEventService APIs
Description of custom abilities
1) nvsys/system_info
2) nvsys/hardware_ability
3) nvsys/odm_info
4) nvsys/hashed_ecid
Common privileges required for all NvSys APIs
Description of custom abilites
nvhv/get_gid
nvhv/get_hv_sysinfo
Common privileges required for all NvHv Common APIs
| #define NV_SCI_EVENT_INFINITE_WAIT -1 |
Infinite timeout for NvSciEventLoopService::WaitForEvent() or NvSciEventLoopService::WaitForMultipleEvents().
Definition at line 160 of file nvscievent.h.
| #define NV_SCI_EVENT_PRIORITIES 4 |
Definition at line 161 of file nvscievent.h.
| typedef struct NvSciEventLoopService NvSciEventLoopService |
Definition at line 165 of file nvscievent.h.
| typedef struct NvSciEventNotifier NvSciEventNotifier |
Definition at line 164 of file nvscievent.h.
| typedef struct NvSciEventService NvSciEventService |
Definition at line 163 of file nvscievent.h.
| typedef struct NvSciLocalEvent NvSciLocalEvent |
Definition at line 167 of file nvscievent.h.
| typedef struct NvSciNativeEvent NvSciNativeEvent |
Definition at line 166 of file nvscievent.h.
| NvSciError NvSciEventCheckVersionCompatibility | ( | uint32_t | majorVer, |
| uint32_t | minorVer, | ||
| bool * | isCompatible | ||
| ) |
Check NvSciEventSerivice library version compatibility.
Checks if loaded NvSciEvent library version is compatible with the version the application was compiled against. This function checks loaded NvSciEvent library version with input NvSciEvent library version and sets output variable true provided major version of the loaded library is same as majorVer and minor version of the loaded library is not less than minorVer, else sets output to false
| [in] | majorVer | build major version. Valid value: 0 to UINT32_MAX |
| [in] | minorVer | build minor version. Valid value: 0 to UINT32_MAX |
| [out] | isCompatible | boolean value stating if loaded NvSciEvent library is compatible or not. Valid value: isCompatible must be non-NULL |
Usage considerations
| NvSciError NvSciEventLoopServiceCreate | ( | size_t | maxEventLoops, |
| NvSciEventLoopService ** | newEventLoopService | ||
| ) |
Creates a new event loop service.
The number of event loops that can be created in the new event loop service will be limited to at most maxEventLoops.
| NvSciError NvSciEventLoopServiceCreateSafe | ( | size_t | maxEventLoops, |
| void * | config, | ||
| NvSciEventLoopService ** | newEventLoopService | ||
| ) |
Creates a new event loop service.
The number of event loops that can be created in the new event loop service will be limited to at most maxEventLoops.
This function creates a new event loop service newEventLoopService which is a primary instance of event service. An application must call event service functions along with newEventLoopService. The number of event loops that can be created in the new event loop service will be limited to at most maxEventLoops.
More information can be found in QNX OS manual page.
| [in] | maxEventLoops | The number of event loops Valid value: must be 1. |
| [in] | config | OS-specific configuration parameter. Valid value: config must be non-NULL in QNX and NULL in Linux. |
| [out] | newEventLoopService | NvSciEventNotifier object double pointer. Valid value: newEventLoopService must be non-NULL. |
This formula gives you a bottom line of how many pulses you need. If you experience a pulse shortage in normal operation, you may need more pulses, e.g. increasing num_pulses by double of previous setting.
Usage considerations
| NvSciError NvSciEventLoopServiceCreateSafeX | ( | size_t | maxEventLoops, |
| void * | config, | ||
| NvSciEventLoopService ** | newEventLoopService | ||
| ) |
Creates a new event loop service that has the same properties as created by NvSciEventLoopServiceCreateSafe(), but supports faster local event.
For a detailed description of the API, see NvSciEventLoopServiceCreateSafe().
| [in] | maxEventLoops | The number of event loops Valid value: must be 1. |
| [in] | config | OS-specific configuration parameter. Valid value: config must be non-NULL in QNX and NULL in Linux. |
| [out] | newEventLoopService | NvSciEventNotifier object double pointer. Valid value: newEventLoopService must be non-NULL. |
Usage considerations
| NvSciError NvSciEventMoveNotifier | ( | NvSciEventService * | oldEventService, |
| NvSciEventService * | newEventService, | ||
| NvSciEventNotifier * | eventNotifier | ||
| ) |
Move event notifier.
This API exports event Notifier from old EventService and import the Notifier to new EventService. After the event notifier is migrated, the old EventService can not wait the event associated with the notifier. Instead, use the new EventService waits for the event.
| [in] | oldEventService | NvSciEventService object pointer to export event notifier Valid value: thisEventService must be non-NULL and should be obtained from a successful call to NvSciEventLoopServiceCreateSafe() API and has not yet been freed using NvSciEventService::Delete(). |
| [in] | newEventService | NvSciEventService object pointer to import event notifier Valid value: thisEventService must be non-NULL and should be obtained from a successful call to NvSciEventLoopServiceCreateSafe() API and has not yet been freed using NvSciEventService::Delete(). |
| [in] | eventNotifier | Event notifier object pointer. Valid value: thisEventNotifier must be non-NULL and should be obtained from a successful call to NvSciIpcGetEventNotifier() or NvSciEventService::CreateLocalEvent() and has not yet been freed using thisEventNotifier->Delete(). |
Usage considerations