NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
nvscievent.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION and its licensors retain all intellectual property
6  * and proprietary rights in and to this software, related documentation
7  * and any modifications thereto. Any use, reproduction, disclosure or
8  * distribution of this software and related documentation without an express
9  * license agreement from NVIDIA CORPORATION is strictly prohibited.
10  */
11 
12 #ifndef INCLUDED_NVSCIEVENT_H
13 #define INCLUDED_NVSCIEVENT_H
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <string.h>
20 #include <stdint.h>
21 #include <stdlib.h>
22 #include <stdbool.h>
23 #include "nvscierror.h"
24 
64 /*
65  * use constant global version variable instead of macro for consistency with
66  * version check API of existing NvSci family
67  */
68 
70 static const uint32_t NvSciEventMajorVersion = 1U;
71 
73 static const uint32_t NvSciEventMinorVersion = 5U;
74 
139 /*******************************************************************/
140 /********************* ACCESS CONTROL ******************************/
141 /*******************************************************************/
142 
152 /*****************************************************************************/
153 /* DATA TYPES */
154 /*****************************************************************************/
155 
160 #define NV_SCI_EVENT_INFINITE_WAIT -1
161 #define NV_SCI_EVENT_PRIORITIES 4
162 
168 
170 typedef struct NvSciTimerEvent NvSciTimerEvent;
171 typedef struct NvSciEventLoop NvSciEventLoop;
173 
182 
212  NvSciError (*Signal)(NvSciLocalEvent* thisLocalEvent);
213 
242  void (*Delete)(NvSciLocalEvent* thisLocalEvent);
243 };
244 
315  NvSciError (*CreateNativeEventNotifier)(
317  NvSciEventService* thisEventService,
318  NvSciNativeEvent* nativeEvent,
319  NvSciEventNotifier** newEventNotifier);
321 
353  NvSciEventService* thisEventService,
354  NvSciLocalEvent** newLocalEvent);
355 
365  NvSciError (*CreateTimerEvent)(
367  NvSciEventService* thisEventService,
368  NvSciTimerEvent** newTimerEvent);
370 
415  void (*Delete)(NvSciEventService* thisEventService);
416 };
417 
467  NvSciError (*SetHandler)(NvSciEventNotifier* thisEventNotifier,
468  void (*callback)(void* cookie),
469  void* cookie,
470  uint32_t priority);
471 
507  void (*Delete)(NvSciEventNotifier* thisEventNotifier);
508 };
509 
520  size_t maxEventLoops,
521  NvSciEventLoopService** newEventLoopService);
522 
597  size_t maxEventLoops,
598  void* config,
599  NvSciEventLoopService** newEventLoopService);
600 
638  size_t maxEventLoops,
639  void* config,
640  NvSciEventLoopService** newEventLoopService);
641 
650 
661  NvSciError (*CreateEventLoop)(NvSciEventLoopService* eventLoopService,
663  NvSciEventLoop** eventLoop);
665 
715  NvSciEventNotifier* eventNotifier,
716  int64_t microseconds);
717 
776  NvSciEventNotifier* const * eventNotifierArray,
777  size_t eventNotifierCount,
778  int64_t microseconds,
779  bool* newEventArray);
780 
851  NvSciEventService *eventService,
852  NvSciEventNotifier* const * eventNotifierArray,
853  size_t eventNotifierCount,
854  int64_t microseconds,
855  bool* newEventArray);
856 
863 #ifndef __QNX__
864  /* Since an array is used to notify what events have occured or not,
865  * the index of array becomes the default priority for handling of
866  * events. In such a case, the possibility for event starvation might
867  * arise. The user should keep in mind this possibility before calling
868  * this API.
869  */
870 #endif /* __QNX__ */
871  /*
872  * Each event notifier in @a eventNotifierArray must have been created
873  * through EventService.
874  *
875  * On a successful return, for all integer `i` in the range
876  * `[0, eventNotifierCount-1]`, there will be only one `newEventArray[i]`
877  * true.
878  *
879  * @param[in] eventNotifierArray Array of NvSciEventNotifier object
880  * pointers. If it is NULL,
881  * @a eventNotifierCount should be zero and
882  * @a newEventArray should be NULL together.
883  * @param[in] eventNotifierCount Event notifier count in eventNotifierArray.
884  * @param[in] microseconds A 64-bit integer timeout in microsecond.
885  * Set to -1 for infinite timeout, for example,
886  * the value @ref NV_SCI_EVENT_INFINITE_WAIT.
887  * Timeout must be 2msec or greater as high
888  * precision timer is not supported in DRIVE OS.
889  * @param[out] newEventArray Array of event occurrence.
890  *
891  * @return ::NvSciError, the completion code of operations:
892  * - ::NvSciError_Success Indicates a successful operation.
893  * - ::NvSciError_BadParameter Indicates an invalid input parameter.
894  * - ::NvSciError_InvalidState Indicates an invalid operation state.
895  * - ::NvSciError_NotSupported Indicates another thread already
896  * waiting for events.
897  * - ::NvSciError_Timeout Indicates a timeout occurrence.
898  * - ::NvSciError_ResourceError Indicates not enough system resources.
899  * - ::NvSciError_InterruptedCall Indicates an interrupt occurred.
900  *
901  * @pre NvSciEventLoopServiceCreateSafe() must be called.
902  * NvSciIpcGetEventNotifier() must be called for NvSciNativeEvent.
903  * NvSciEventService::CreateLocalEvent() must be called
904  * for NvSciLocalEvent.
905  *
906  * @usage
907  * - Allowed context for the API call
908  * - Interrupt handler: No
909  * - Signal handler: No
910  * - Thread-safe: Yes
911  * - Async/Sync: Sync
912  * - Required Privileges(QNX): None
913  * - API Group
914  * - Init: No
915  * - Runtime: Yes
916  * - De-Init: No
917  */
919  NvSciEventNotifier* const * eventNotifierArray,
920  size_t eventNotifierCount,
921  int64_t microseconds,
922  bool* newEventArray);
923 
924 };
925 
926 #ifdef __QNX__
927 
967 NvSciError NvSciEventInspect(
968  NvSciEventService *thisEventService,
969  uint32_t numEvents,
970  uint32_t eventNotifierCount,
971  NvSciEventNotifier** eventNotifierArray);
972 #endif /* __QNX__ */
973 
1038  NvSciEventService *oldEventService,
1039  NvSciEventService *newEventService,
1040  NvSciEventNotifier *eventNotifier);
1041 
1077  uint32_t majorVer,
1078  uint32_t minorVer,
1079  bool* isCompatible);
1080 
1083 #ifdef __cplusplus
1084 }
1085 #endif
1086 #endif /* INCLUDED_NVSCIEVENT_H */
1087 
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:212
NvSciLocalEvent::eventNotifier
NvSciEventNotifier * eventNotifier
Event notifier associated with this local event.
Definition: nvscievent.h:181
NvSciEventMinorVersion
static const uint32_t NvSciEventMinorVersion
NvSciEvent API Minor version number.
Definition: nvscievent.h:73
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:352
NvSciEventCheckVersionCompatibility
NvSciError NvSciEventCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
Check NvSciEventSerivice library version compatibility.
NvSciEventNotifier
An abstract interface to notify event to event consumer and to register event handler of the event co...
Definition: nvscievent.h:424
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:714
NvSciEventMajorVersion
static const uint32_t NvSciEventMajorVersion
NvSciEvent API Major version number.
Definition: nvscievent.h:70
NvSciEventLoopServiceCreateSafeX
NvSciError NvSciEventLoopServiceCreateSafeX(size_t maxEventLoops, void *config, NvSciEventLoopService **newEventLoopService)
Creates a new event loop service that has the same properties as created by NvSciEventLoopServiceCrea...
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:507
NvSciLocalEvent
An OS-agnostic object that sends signal to another thread in the same process.
Definition: nvscievent.h:179
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:775
void
typedef void(WFD_APIENTRY PFNWFDBINDSOURCETOPIPELINEWITHTIMESTAMPNV)(const WFDDevice device
NvSciEventLoopService::EventService
NvSciEventService EventService
Definition: nvscievent.h:649
NvSciLocalEvent::Delete
void(* Delete)(NvSciLocalEvent *thisLocalEvent)
Releases any resources associated with this local event.
Definition: nvscievent.h:242
NvSciEventLoopService
An abstract interface that event consumer can wait for events using event notifier in event loop.
Definition: nvscievent.h:648
nvscierror.h
NvSciEventService::Delete
void(* Delete)(NvSciEventService *thisEventService)
Releases any resources associated with this event service.
Definition: nvscievent.h:415
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:467
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:850
NvSciEventMoveNotifier
NvSciError NvSciEventMoveNotifier(NvSciEventService *oldEventService, NvSciEventService *newEventService, NvSciEventNotifier *eventNotifier)
Move event notifier.
NvSciEventLoopService::WaitForAnyEvent
NvSciError(* WaitForAnyEvent)(NvSciEventNotifier *const *eventNotifierArray, size_t eventNotifierCount, int64_t microseconds, bool *newEventArray)
Waits up to a configurable timeout for the first occurence of any of a set of particular event notifi...
Definition: nvscievent.h:918
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:270
NvSciNativeEvent
struct NvSciNativeEvent NvSciNativeEvent
Definition: nvscievent.h:166