NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvscievent.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2026 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 
219  NvSciError (*Signal)(NvSciLocalEvent* thisLocalEvent);
220 
255  void (*Delete)(NvSciLocalEvent* thisLocalEvent);
256 };
257 
336  NvSciError (*CreateNativeEventNotifier)(
338  NvSciEventService* thisEventService,
339  NvSciNativeEvent* nativeEvent,
340  NvSciEventNotifier** newEventNotifier);
342 
380  NvSciError (*CreateLocalEvent)(
381  NvSciEventService* thisEventService,
382  NvSciLocalEvent** newLocalEvent);
383 
393  NvSciError (*CreateTimerEvent)(
395  NvSciEventService* thisEventService,
396  NvSciTimerEvent** newTimerEvent);
398 
448  void (*Delete)(NvSciEventService* thisEventService);
449 };
450 
508  NvSciError (*SetHandler)(NvSciEventNotifier* thisEventNotifier,
509  void (*callback)(void* cookie),
510  void* cookie,
511  uint32_t priority);
512 
556  void (*Delete)(NvSciEventNotifier* thisEventNotifier);
557 };
558 
568 NvSciError NvSciEventLoopServiceCreate(
569  size_t maxEventLoops,
570  NvSciEventLoopService** newEventLoopService);
571 
652  size_t maxEventLoops,
653  void* config,
654  NvSciEventLoopService** newEventLoopService);
655 
699  size_t maxEventLoops,
700  void* config,
701  NvSciEventLoopService** newEventLoopService);
702 
711 
722  NvSciError (*CreateEventLoop)(NvSciEventLoopService* eventLoopService,
724  NvSciEventLoop** eventLoop);
726 
783  NvSciError (*WaitForEvent)(
784  NvSciEventNotifier* eventNotifier,
785  int64_t microseconds);
786 
854  NvSciError (*WaitForMultipleEvents)(
855  NvSciEventNotifier* const * eventNotifierArray,
856  size_t eventNotifierCount,
857  int64_t microseconds,
858  bool* newEventArray);
859 
948  NvSciEventService *eventService,
949  NvSciEventNotifier* const * eventNotifierArray,
950  size_t eventNotifierCount,
951  int64_t microseconds,
952  bool* newEventArray);
953 
960 #ifndef __QNX__
961  /* Since an array is used to notify what events have occured or not,
962  * the index of array becomes the default priority for handling of
963  * events. In such a case, the possibility for event starvation might
964  * arise. The user should keep in mind this possibility before calling
965  * this API.
966  */
967 #endif /* __QNX__ */
968  /*
969  * Each event notifier in @a eventNotifierArray must have been created
970  * through EventService.
971  *
972  * On a successful return, for all integer `i` in the range
973  * `[0, eventNotifierCount-1]`, there will be only one `newEventArray[i]`
974  * true.
975  *
976  * @param[in] eventNotifierArray Array of NvSciEventNotifier object
977  * pointers.
978  * Valid value: @a eventNotifierArray must be non-NULL. each eventNotifier
979  * of array must be also non-NULL and should be obtained from a successful
980  * call to NvSciIpcGetEventNotifier() or
981  * NvSciEventService::CreateLocalEvent() and has not yet been freed using
982  * eventNotifierArray[n]->Delete().
983  * @param[in] eventNotifierCount Event notifier count in eventNotifierArray.
984  * @param[in] microseconds A 64-bit integer timeout in microsecond.
985  * Timeout must be 2msec or greater as high
986  * precision timer is not supported in DRIVE OS.
987  * Valid value: NVSCIIPC_INFINITE_WAIT, 0 to INT64_MAX.
988  * @param[out] newEventArray Array of event occurrence.
989  * Valid value: @a newEventArray must be non-NULL
990  *
991  * @return ::NvSciError, the completion code of operations:
992  * - ::NvSciError_Success Indicates a successful operation.
993  * - ::NvSciError_BadParameter Indicates an invalid input parameter.
994  * - ::NvSciError_InvalidState Indicates an invalid operation state.
995  * - ::NvSciError_NotSupported Indicates another thread already
996  * waiting for events.
997  * - ::NvSciError_Timeout Indicates a timeout occurrence.
998  * - ::NvSciError_ResourceError Indicates not enough system resources.
999  * - ::NvSciError_InterruptedCall Indicates an interrupt occurred.
1000  *
1001  * @pre Invocation of NvSciEventLoopServiceCreateSafe() must be successful.
1002  * Invocation of NvSciIpcGetEventNotifier() must be successful for
1003  * NvSciNativeEvent.
1004  * Invocation of NvSciEventService::CreateLocalEvent() must be
1005  * successful for NvSciLocalEvent.
1006  *
1007  * @usage
1008  * - Allowed context for the API call
1009  * - Interrupt handler: No
1010  * - Signal handler: No
1011  * - Thread-safe: Yes
1012  * - Async/Sync: Sync
1013  * - Required privileges(QNX): None
1014  * - Allowed execution state
1015  * - Initialization: No
1016  * - Operational: Yes
1017  * - Reinit/Deinit Preparation: No
1018  * \if NV_SAFETY
1019  * - Implementation ASIL: ASIL D
1020  * \endif
1021  * - Maturity: GA
1022  */
1023  NvSciError (*WaitForAnyEvent)(
1024  NvSciEventNotifier* const * eventNotifierArray,
1025  size_t eventNotifierCount,
1026  int64_t microseconds,
1027  bool* newEventArray);
1028 
1029 };
1030 
1031 #ifdef __QNX__
1032 
1079 NvSciError NvSciEventInspect(
1080  NvSciEventService *thisEventService,
1081  uint32_t numEvents,
1082  uint32_t eventNotifierCount,
1083  NvSciEventNotifier** eventNotifierArray);
1084 #endif /* __QNX__ */
1085 
1163 NvSciError NvSciEventMoveNotifier(
1164  NvSciEventService *oldEventService,
1165  NvSciEventService *newEventService,
1166  NvSciEventNotifier *eventNotifier);
1167 
1210  uint32_t majorVer,
1211  uint32_t minorVer,
1212  bool* isCompatible);
1213 
1216 #ifdef __cplusplus
1217 }
1218 #endif
1219 #endif /* INCLUDED_NVSCIEVENT_H */
1220 
NvSciLocalEvent::Signal
NvSciError(* Signal)(NvSciLocalEvent *thisLocalEvent)
Sends an intra-process local event signal.
Definition: nvscievent.h:219
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:380
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:457
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:783
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:556
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:854
void
typedef void(WFD_APIENTRY PFNWFDBINDSOURCETOPIPELINEWITHTIMESTAMPNV)(const WFDDevice device
NvSciEventLoopService::EventService
NvSciEventService EventService
Definition: nvscievent.h:710
NvSciLocalEvent::Delete
void(* Delete)(NvSciLocalEvent *thisLocalEvent)
Releases any resources associated with this local event.
Definition: nvscievent.h:255
NvSciEventLoopService
An abstract interface that event consumer can wait for events using event notifier in event loop.
Definition: nvscievent.h:709
NvSciEventService::Delete
void(* Delete)(NvSciEventService *thisEventService)
Releases any resources associated with this event service.
Definition: nvscievent.h:448
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:508
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:947
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:1023
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:283
NvSciNativeEvent
struct NvSciNativeEvent NvSciNativeEvent
Definition: nvscievent.h:166