NVIDIA DRIVE OS Linux SDK API Reference

6.0.7 Release
nvscievent.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
11 #ifndef INCLUDED_NVSCIEVENT_H
12 #define INCLUDED_NVSCIEVENT_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <string.h>
19 #include <stdint.h>
20 #include <stdlib.h>
21 #include <stdbool.h>
22 #include <nvscierror.h>
23 
47 /* use constant global version variable instead of macro for consistency with
48  * version check API of existing NvSci family
49  */
50 
52 static const uint32_t NvSciEventMajorVersion = 1U;
53 
55 static const uint32_t NvSciEventMinorVersion = 2U;
56 
149 /*****************************************************************************/
150 /* DATA TYPES */
151 /*****************************************************************************/
152 
157 #define NV_SCI_EVENT_INFINITE_WAIT -1
158 #define NV_SCI_EVENT_PRIORITIES 4
159 
163 
165 typedef struct NvSciNativeEvent NvSciNativeEvent;
166 typedef struct NvSciLocalEvent NvSciLocalEvent;
167 typedef struct NvSciTimerEvent NvSciTimerEvent;
168 typedef struct NvSciEventLoop NvSciEventLoop;
170 
241  NvSciError (*CreateNativeEventNotifier)(
243  NvSciEventService* thisEventService,
244  NvSciNativeEvent* nativeEvent,
245  NvSciEventNotifier** newEventNotifier);
247 
282  NvSciError (*CreateLocalEvent)(
284  NvSciEventService* thisEventService,
285  NvSciLocalEvent** newLocalEvent);
287 
297  NvSciError (*CreateTimerEvent)(
299  NvSciEventService* thisEventService,
300  NvSciTimerEvent** newTimerEvent);
302 
345  void (*Delete)(NvSciEventService* thisEventService);
346 };
347 
404  NvSciError (*SetHandler)(NvSciEventNotifier* thisEventNotifier,
405  void (*callback)(void* cookie),
406  void* cookie,
407  uint32_t priority);
408 
447  void (*Delete)(NvSciEventNotifier* thisEventNotifier);
448 };
449 
491  size_t maxEventLoops,
492  NvSciEventLoopService** newEventLoopService);
493 
559  size_t maxEventLoops,
560  void* config,
561  NvSciEventLoopService** newEventLoopService);
562 
571 
582  NvSciError (*CreateEventLoop)(NvSciEventLoopService* eventLoopService,
584  NvSciEventLoop** eventLoop);
586 
641  NvSciEventNotifier* eventNotifier,
642  int64_t microseconds);
643 
706  NvSciEventNotifier* const * eventNotifierArray,
707  size_t eventNotifierCount,
708  int64_t microseconds,
709  bool* newEventArray);
710 
786  NvSciEventService *eventService,
787  NvSciEventNotifier* const * eventNotifierArray,
788  size_t eventNotifierCount,
789  int64_t microseconds,
790  bool* newEventArray);
791 };
792 
793 #ifdef __QNX__
794 
834 NvSciError NvSciEventInspect(
835  NvSciEventService *thisEventSerivce,
836  uint32_t numEvents,
837  uint32_t eventNotifierCount,
838  NvSciEventNotifier** eventNotifierArray);
839 #endif /* __QNX__ */
840 
841 /*
842  * \brief Checks if loaded NvSciEvent library version is compatible with
843  * the version the application was compiled against.
844  *
845  * This function checks loaded NvSciEvent library version with input NvSciEvent
846  * library version and sets output variable true provided major version of the
847  * loaded library is same as @a majorVer and minor version of the
848  * loaded library is not less than @a minorVer, else sets output to false
849  *
850  * @param[in] majorVer build major version.
851  * @param[in] minorVer build minor version.
852  * @param[out] isCompatible boolean value stating if loaded NvSciEvent library
853  * is compatible or not.
854  *
855  * @return ::NvSciError, the completion code of the operation:
856  * - ::NvSciError_Success if successful.
857  * - ::NvSciError_BadParameter if any of the following occurs:
858  * - @a isCompatible is NULL
859  *
860  * @pre None
861  *
862  * @usage
863  * - Allowed context for the API call
864  * - Interrupt: No
865  * - Signal handler: No
866  * - Thread-safe: Yes
867  * - Async/Sync: Sync
868  * - Required Privileges(QNX): None
869  * - API Group
870  * - Init: Yes
871  * - Runtime: Yes
872  * - De-Init: Yes
873  */
875  uint32_t majorVer,
876  uint32_t minorVer,
877  bool* isCompatible);
878 
881 #ifdef __cplusplus
882 }
883 #endif
884 #endif /* INCLUDED_NVSCIEVENT_H */
NvSciError
NvSciError
Return/error codes for all NvSci functions.
Definition: nvscierror.h:45
NvSciEventMinorVersion
static const uint32_t NvSciEventMinorVersion
NvSciEvent API Minor version number.
Definition: nvscievent.h:55
NvSciEventCheckVersionCompatibility
NvSciError NvSciEventCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
NvSciEventNotifier
An abstract interface to notify event to event consumer and to register event handler of the event co...
Definition: nvscievent.h:354
NvSciEventLoopServiceCreate
NvSciError NvSciEventLoopServiceCreate(size_t maxEventLoops, NvSciEventLoopService **newEventLoopService)
Creates a new event loop service.
NvSciEventLoopService::WaitForEvent
NvSciError(* WaitForEvent)(NvSciEventNotifier *eventNotifier, int64_t microseconds)
Waits up to a configurable timeout for a particular event notification, servicing events with configu...
Definition: nvscievent.h:640
NvSciEventMajorVersion
static const uint32_t NvSciEventMajorVersion
NvSciEvent API Major version number.
Definition: nvscievent.h:52
NvSciEventLoopServiceCreateSafe
NvSciError NvSciEventLoopServiceCreateSafe(size_t maxEventLoops, void *config, NvSciEventLoopService **newEventLoopService)
Creates a new event loop service.
NvSciEventNotifier::Delete
void(* Delete)(NvSciEventNotifier *thisEventNotifier)
Unregisters any previously-registered event handler and delete this event notifier.
Definition: nvscievent.h:447
NvSciEventLoopService::WaitForMultipleEvents
NvSciError(* WaitForMultipleEvents)(NvSciEventNotifier *const *eventNotifierArray, size_t eventNotifierCount, int64_t microseconds, bool *newEventArray)
Waits up to a configurable timeout for any of a set of particular event notifications,...
Definition: nvscievent.h:705
NvSciEventLoopService::EventService
NvSciEventService EventService
Definition: nvscievent.h:570
NvSciEventLoopService
An abstract interface that event consumer can wait for events using event notifier in event loop.
Definition: nvscievent.h:569
nvscierror.h
NvSciEventService::Delete
void(* Delete)(NvSciEventService *thisEventService)
Releases any resources associated with this event service.
Definition: nvscievent.h:345
NvSciEventNotifier::SetHandler
NvSciError(* SetHandler)(NvSciEventNotifier *thisEventNotifier, void(*callback)(void *cookie), void *cookie, uint32_t priority)
Registers or unregisters a handler for a particular event notifier.
Definition: nvscievent.h:404
NvSciEventLoopService::WaitForMultipleEventsExt
NvSciError(* WaitForMultipleEventsExt)(NvSciEventService *eventService, NvSciEventNotifier *const *eventNotifierArray, size_t eventNotifierCount, int64_t microseconds, bool *newEventArray)
Waits up to a configurable timeout for any of a set of particular event notifications,...
Definition: nvscievent.h:785
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:196