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 #define NV_SCI_ASYNC_PCIE_VALIDATION_ERROR 0x8U
372 
373 /*******************************************************************/
374 /********************* FUNCTION TYPES ******************************/
375 /*******************************************************************/
376 
402 
430 void NvSciIpcDeinit(void);
431 
482 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
483 
538  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
539 
584  NvSciEventNotifier **eventNotifier);
585 
614 
648 
694 
743 
800 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
801  int32_t *bytes);
802 
855 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
856  uint32_t *bytes);
857 
905  const volatile void **buf);
906 
952 
1007 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
1008  int32_t *bytes);
1009 
1060 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
1061  uint32_t size, uint32_t *bytes);
1062 
1109  volatile void **buf);
1110 
1158 
1190  NvSciIpcEndpointInfo *info);
1191 
1192 #ifndef __QNX__
1193 
1211 #endif /* !__QNX__ */
1212 
1319 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1320 
1428 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1429 
1430 #if defined(__QNX__)
1431 
1495 int32_t NvSciIpcWaitEventQnx(int chid, int64_t microseconds, uint32_t bytes,
1496  void *pulse);
1497 
1566 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1567  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1568  void *pulseValue);
1569 
1635 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1636  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1637 
1638 
1691 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1692  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1693 #endif /* __QNX__ */
1694 
1733 NvSciError NvSciIpcGetAsyncErrors(NvSciIpcEndpoint handle, uint32_t* errors);
1734 
1785 
1786 /*
1787  * \brief Checks if loaded NvSciIpc library version is compatible with
1788  * the version the application was compiled against.
1789  *
1790  * This function checks loaded NvSciIpc library version with input NvSciIpc
1791  * library version and sets output variable true provided major version of the
1792  * loaded library is same as @a majorVer and minor version of the
1793  * loaded library is not less than @a minorVer, else sets output to false
1794  *
1795  * @param[in] majorVer build major version.
1796  * @param[in] minorVer build minor version.
1797  * @param[out] isCompatible boolean value stating if loaded NvSciIpc library
1798  * is compatible or not.
1799  *
1800  * @return ::NvSciError, the completion code of the operation:
1801  * - ::NvSciError_Success if successful.
1802  * - ::NvSciError_BadParameter if any of the following occurs:
1803  * - @a isCompatible is NULL
1804  *
1805  * @pre None
1806  *
1807  * @usage
1808  * - Allowed context for the API call
1809  * - Interrupt: No
1810  * - Signal handler: No
1811  * - Thread-safe: Yes
1812  * - Async/Sync: Sync
1813  * - Required Privileges(QNX): None
1814  * - API Group
1815  * - Init: Yes
1816  * - Runtime: Yes
1817  * - De-Init: Yes
1818  */
1820  uint32_t majorVer,
1821  uint32_t minorVer,
1822  bool* isCompatible);
1823 
1827 #ifdef __cplusplus
1828 }
1829 #endif
1830 #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