NVIDIA DRIVE OS Linux SDK API Reference

6.0.8 Release
nvsciipc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-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_NVSCIIPC_H
12 #define INCLUDED_NVSCIIPC_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdint.h>
19 #include <stddef.h>
20 #include "nvscierror.h"
21 #include "nvscievent.h"
22 
66 /* use constant global version variable instead of macro for consistency with
67  * version check API of existing NvSci family
68  */
69 
71 static const uint32_t NvSciIpcMajorVersion = 1U;
72 
74 static const uint32_t NvSciIpcMinorVersion = 4U;
75 
315 /*******************************************************************/
316 /************************ DATA TYPES *******************************/
317 /*******************************************************************/
318 
322 typedef uint64_t NvSciIpcEndpoint;
323 
325 
331  uint32_t nframes;
333  uint32_t frame_size;
334 };
335 
340 #define NVSCIIPC_MAX_ENDPOINT_NAME 64U
341 
342 /* NvSciIPC Event type */
344 #define NV_SCI_IPC_EVENT_READ 0x01U
345 
346 #define NV_SCI_IPC_EVENT_WRITE 0x02U
347 
348 #define NV_SCI_IPC_EVENT_CONN_EST 0x04U
349 
350 #define NV_SCI_IPC_EVENT_CONN_RESET 0x08U
351 
352 #define NV_SCI_IPC_EVENT_WRITE_EMPTY 0x10U
353 
354 #define NV_SCI_IPC_EVENT_ASYNC_ERROR 0x20U
355 
356 #define NV_SCI_IPC_EVENT_CONN_EST_ALL (NV_SCI_IPC_EVENT_CONN_EST | \
357  NV_SCI_IPC_EVENT_WRITE | NV_SCI_IPC_EVENT_WRITE_EMPTY | \
358  NV_SCI_IPC_EVENT_READ)
359 
361 #define NVSCIIPC_INFINITE_WAIT -1LL
362 
363 /* NvSciIpc Asynchronous erros */
365 #define NV_SCI_ASYNC_PCIE_EDMA_XFER_ERROR 0x1U
366 
367 #define NV_SCI_ASYNC_PCIE_AER_UNCORRECTABLE_FATAL 0x2U
368 
369 #define NV_SCI_ASYNC_PCIE_AER_UNCORRECTABLE_NONFATAL 0x4U
370 
371 /*******************************************************************/
372 /********************* FUNCTION TYPES ******************************/
373 /*******************************************************************/
374 
400 
428 void NvSciIpcDeinit(void);
429 
480 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
481 
536  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
537 
582  NvSciEventNotifier **eventNotifier);
583 
612 
646 
692 
741 
798 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
799  int32_t *bytes);
800 
853 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
854  uint32_t *bytes);
855 
903  const volatile void **buf);
904 
950 
1005 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
1006  int32_t *bytes);
1007 
1058 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
1059  uint32_t size, uint32_t *bytes);
1060 
1107  volatile void **buf);
1108 
1156 
1188  NvSciIpcEndpointInfo *info);
1189 
1190 #ifndef __QNX__
1191 
1209 #endif /* !__QNX__ */
1210 
1317 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1318 
1426 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1427 
1428 #if defined(__QNX__)
1429 
1493 int32_t NvSciIpcWaitEventQnx(int chid, int64_t microseconds, uint32_t bytes,
1494  void *pulse);
1495 
1564 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1565  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1566  void *pulseValue);
1567 
1633 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1634  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1635 
1636 
1689 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1690  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1691 #endif /* __QNX__ */
1692 
1730 NvSciError NvSciIpcGetAsyncErrors(NvSciIpcEndpoint handle, uint32_t* errors);
1731 
1782 
1783 /*
1784  * \brief Checks if loaded NvSciIpc library version is compatible with
1785  * the version the application was compiled against.
1786  *
1787  * This function checks loaded NvSciIpc library version with input NvSciIpc
1788  * library version and sets output variable true provided major version of the
1789  * loaded library is same as @a majorVer and minor version of the
1790  * loaded library is not less than @a minorVer, else sets output to false
1791  *
1792  * @param[in] majorVer build major version.
1793  * @param[in] minorVer build minor version.
1794  * @param[out] isCompatible boolean value stating if loaded NvSciIpc library
1795  * is compatible or not.
1796  *
1797  * @return ::NvSciError, the completion code of the operation:
1798  * - ::NvSciError_Success if successful.
1799  * - ::NvSciError_BadParameter if any of the following occurs:
1800  * - @a isCompatible is NULL
1801  *
1802  * @pre None
1803  *
1804  * @usage
1805  * - Allowed context for the API call
1806  * - Interrupt: No
1807  * - Signal handler: No
1808  * - Thread-safe: Yes
1809  * - Async/Sync: Sync
1810  * - Required Privileges(QNX): None
1811  * - API Group
1812  * - Init: Yes
1813  * - Runtime: Yes
1814  * - De-Init: Yes
1815  */
1817  uint32_t majorVer,
1818  uint32_t minorVer,
1819  bool* isCompatible);
1820 
1824 #ifdef __cplusplus
1825 }
1826 #endif
1827 #endif /* INCLUDED_NVSCIIPC_H */
NvSciError
NvSciError
Return/error codes for all NvSci functions.
Definition: nvscierror.h:45
NvSciIpcWriteAdvance
NvSciError NvSciIpcWriteAdvance(NvSciIpcEndpoint handle)
Advance to the next write frame of the endpoint.
nvscievent.h
NVIDIA Software Communications Interface (SCI) : NvSci Event Service
NvSciIpcDeinit
void NvSciIpcDeinit(void)
De-initializes the NvSciIpc library.
NvSciIpcCloseEndpoint
void NvSciIpcCloseEndpoint(NvSciIpcEndpoint handle)
Closes an endpoint with the given handle.
NvSciIpcGetEndpointInfo
NvSciError NvSciIpcGetEndpointInfo(NvSciIpcEndpoint handle, NvSciIpcEndpointInfo *info)
Returns endpoint information.
NvSciIpcOpenEndpoint
NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle)
Opens an endpoint with the given name.
NvSciIpcGetEventSafe
NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events)
Get Events (safety version)
NvSciIpcOpenEndpointWithEventService
NvSciError NvSciIpcOpenEndpointWithEventService(const char *endpoint, NvSciIpcEndpoint *handle, NvSciEventService *eventService)
Opens an endpoint with the given name and event service.
NvSciIpcRead
NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size, int32_t *bytes)
Reads a frame from the endpoint.
NvSciEventNotifier
An abstract interface to notify event to event consumer and to register event handler of the event co...
Definition: nvscievent.h:432
NvSciIpcGetLinuxEventFd
NvSciError NvSciIpcGetLinuxEventFd(NvSciIpcEndpoint handle, int32_t *fd)
Returns the NvSciIpc file descriptor for a given endpoint.
NvSciIpcReadAdvance
NvSciError NvSciIpcReadAdvance(NvSciIpcEndpoint handle)
Advance to the next read frame of the endpoint.
NvSciIpcResetEndpointSafe
NvSciError NvSciIpcResetEndpointSafe(NvSciIpcEndpoint handle)
Resets an endpoint.
NvSciIpcResetEndpoint
void NvSciIpcResetEndpoint(NvSciIpcEndpoint handle)
Resets an endpoint.
NvSciIpcGetEvent
NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events)
Get Events.
NvSciIpcEnableNotification
NvSciError NvSciIpcEnableNotification(NvSciIpcEndpoint handle, bool flag)
Enable Intra-VM notification.
NvSciIpcReadGetNextFrame
NvSciError NvSciIpcReadGetNextFrame(NvSciIpcEndpoint handle, const volatile void **buf)
Get a pointer to the read frame from the endpoint.
NvSciIpcEndpoint
uint64_t NvSciIpcEndpoint
Handle to the NvSciIpc endpoint.
Definition: nvsciipc.h:322
NvSciIpcReadSafe
NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size, uint32_t *bytes)
Reads a frame from the endpoint (safety version)
NvSciIpcMinorVersion
static const uint32_t NvSciIpcMinorVersion
NvSciIpc API Minor version number.
Definition: nvsciipc.h:74
NvSciIpcWriteGetNextFrame
NvSciError NvSciIpcWriteGetNextFrame(NvSciIpcEndpoint handle, volatile void **buf)
Get a pointer to the write frame from the endpoint.
NvSciIpcInit
NvSciError NvSciIpcInit(void)
Initializes the NvSciIpc library.
NvSciIpcCloseEndpointSafe
NvSciError NvSciIpcCloseEndpointSafe(NvSciIpcEndpoint handle, bool clear)
Closes an endpoint with the given handle (safety version)
NvSciIpcWrite
NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size, int32_t *bytes)
Writes a frame to the endpoint.
NvSciIpcEndpointInfo::frame_size
uint32_t frame_size
Holds the frame size in bytes.
Definition: nvsciipc.h:333
NvSciIpcGetEventNotifier
NvSciError NvSciIpcGetEventNotifier(NvSciIpcEndpoint handle, NvSciEventNotifier **eventNotifier)
Get NvSciIpc event notifier.
nvscierror.h
NvSciIpcCheckVersionCompatibility
NvSciError NvSciIpcCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
NvSciIpcGetAsyncErrors
NvSciError NvSciIpcGetAsyncErrors(NvSciIpcEndpoint handle, uint32_t *errors)
Get asynchronouse errors.
NvSciIpcEndpointInfo::nframes
uint32_t nframes
Holds the number of frames.
Definition: nvsciipc.h:331
NvSciIpcEndpointInfo
Defines information about the NvSciIpc endpoint.
Definition: nvsciipc.h:329
NvSciIpcMajorVersion
static const uint32_t NvSciIpcMajorVersion
NvSciIpc API Major version number.
Definition: nvsciipc.h:71
NvSciIpcWriteSafe
NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf, uint32_t size, uint32_t *bytes)
Writes a frame to the endpoint.
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:278