NVIDIA DRIVE OS Linux SDK API Reference

6.0.8 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 
57 /* use constant global version variable instead of macro for consistency with
58  * version check API of existing NvSci family
59  */
60 
62 static const uint32_t NvSciEventMajorVersion = 1U;
63 
65 static const uint32_t NvSciEventMinorVersion = 3U;
66 
157 /*****************************************************************************/
158 /* DATA TYPES */
159 /*****************************************************************************/
160 
165 #define NV_SCI_EVENT_INFINITE_WAIT -1
166 #define NV_SCI_EVENT_PRIORITIES 4
167 
173 
175 typedef struct NvSciTimerEvent NvSciTimerEvent;
176 typedef struct NvSciEventLoop NvSciEventLoop;
178 
188 
220  NvSciError (*Signal)(NvSciLocalEvent* thisLocalEvent);
221 
250  void (*Delete)(NvSciLocalEvent* thisLocalEvent);
251 };
252 
323  NvSciError (*CreateNativeEventNotifier)(
325  NvSciEventService* thisEventService,
326  NvSciNativeEvent* nativeEvent,
327  NvSciEventNotifier** newEventNotifier);
329 
363  NvSciEventService* thisEventService,
364  NvSciLocalEvent** newLocalEvent);
365 
375  NvSciError (*CreateTimerEvent)(
377  NvSciEventService* thisEventService,
378  NvSciTimerEvent** newTimerEvent);
380 
423  void (*Delete)(NvSciEventService* thisEventService);
424 };
425 
475  NvSciError (*SetHandler)(NvSciEventNotifier* thisEventNotifier,
476  void (*callback)(void* cookie),
477  void* cookie,
478  uint32_t priority);
479 
513  void (*Delete)(NvSciEventNotifier* thisEventNotifier);
514 };
515 
557  size_t maxEventLoops,
558  NvSciEventLoopService** newEventLoopService);
559 
625  size_t maxEventLoops,
626  void* config,
627  NvSciEventLoopService** newEventLoopService);
628 
629 #ifdef __QNX__
630 
675 NvSciError NvSciEventLoopServiceCreateSafeX(
676  size_t maxEventLoops,
677  void* config,
678  NvSciEventLoopService** newEventLoopService);
679 #endif /* __QNX__ */
680 
689 
700  NvSciError (*CreateEventLoop)(NvSciEventLoopService* eventLoopService,
702  NvSciEventLoop** eventLoop);
704 
754  NvSciEventNotifier* eventNotifier,
755  int64_t microseconds);
756 
814  NvSciEventNotifier* const * eventNotifierArray,
815  size_t eventNotifierCount,
816  int64_t microseconds,
817  bool* newEventArray);
818 
889  NvSciEventService *eventService,
890  NvSciEventNotifier* const * eventNotifierArray,
891  size_t eventNotifierCount,
892  int64_t microseconds,
893  bool* newEventArray);
894 };
895 
896 #ifdef __QNX__
897 
937 NvSciError NvSciEventInspect(
938  NvSciEventService *thisEventSerivce,
939  uint32_t numEvents,
940  uint32_t eventNotifierCount,
941  NvSciEventNotifier** eventNotifierArray);
942 
992 NvSciError NvSciEventMoveNotifier(
993  NvSciEventService *oldEventSerivce,
994  NvSciEventService *newEventSerivce,
995  NvSciEventNotifier *eventNotifier);
996 #endif /* __QNX__ */
997 
998 /*
999  * \brief Checks if loaded NvSciEvent library version is compatible with
1000  * the version the application was compiled against.
1001  *
1002  * This function checks loaded NvSciEvent library version with input NvSciEvent
1003  * library version and sets output variable true provided major version of the
1004  * loaded library is same as @a majorVer and minor version of the
1005  * loaded library is not less than @a minorVer, else sets output to false
1006  *
1007  * @param[in] majorVer build major version.
1008  * @param[in] minorVer build minor version.
1009  * @param[out] isCompatible boolean value stating if loaded NvSciEvent library
1010  * is compatible or not.
1011  *
1012  * @return ::NvSciError, the completion code of the operation:
1013  * - ::NvSciError_Success if successful.
1014  * - ::NvSciError_BadParameter if any of the following occurs:
1015  * - @a isCompatible is NULL
1016  *
1017  * @pre None
1018  *
1019  * @usage
1020  * - Allowed context for the API call
1021  * - Interrupt: No
1022  * - Signal handler: No
1023  * - Thread-safe: Yes
1024  * - Async/Sync: Sync
1025  * - Required Privileges(QNX): None
1026  * - API Group
1027  * - Init: Yes
1028  * - Runtime: Yes
1029  * - De-Init: Yes
1030  */
1032  uint32_t majorVer,
1033  uint32_t minorVer,
1034  bool* isCompatible);
1035 
1038 #ifdef __cplusplus
1039 }
1040 #endif
1041 #endif /* INCLUDED_NVSCIEVENT_H */
NvSciError
NvSciError
Return/error codes for all NvSci functions.
Definition: nvscierror.h:45
NvSciLocalEvent::Signal
NvSciError(* Signal)(NvSciLocalEvent *thisLocalEvent)
Sends an intra-process local event signal.
Definition: nvscievent.h:220
NvSciLocalEvent::eventNotifier
NvSciEventNotifier * eventNotifier
Event notifier associated with this local event.
Definition: nvscievent.h:187
NvSciEventMinorVersion
static const uint32_t NvSciEventMinorVersion
NvSciEvent API Minor version number.
Definition: nvscievent.h:65
NvSciEventService::CreateLocalEvent
NvSciError(* CreateLocalEvent)(NvSciEventService *thisEventService, NvSciLocalEvent **newLocalEvent)
Creates an intra-process local event with an event notifier that reports each event signaled through ...
Definition: nvscievent.h:362
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:432
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:753
NvSciEventMajorVersion
static const uint32_t NvSciEventMajorVersion
NvSciEvent API Major version number.
Definition: nvscievent.h:62
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:513
NvSciLocalEvent
An OS-agnostic object that sends signal to another thread in the same process.
Definition: nvscievent.h:185
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:813
NvSciEventLoopService::EventService
NvSciEventService EventService
Definition: nvscievent.h:688
NvSciLocalEvent::Delete
void(* Delete)(NvSciLocalEvent *thisLocalEvent)
Releases any resources associated with this local event.
Definition: nvscievent.h:250
NvSciEventLoopService
An abstract interface that event consumer can wait for events using event notifier in event loop.
Definition: nvscievent.h:687
nvscierror.h
NvSciEventService::Delete
void(* Delete)(NvSciEventService *thisEventService)
Releases any resources associated with this event service.
Definition: nvscievent.h:423
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:475
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:888
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:278
NvSciNativeEvent
struct NvSciNativeEvent NvSciNativeEvent
Definition: nvscievent.h:171