NVIDIA DRIVE OS Linux SDK API Reference

6.0.7 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 
58 /* use constant global version variable instead of macro for consistency with
59  * version check API of existing NvSci family
60  */
61 
63 static const uint32_t NvSciIpcMajorVersion = 1U;
64 
66 static const uint32_t NvSciIpcMinorVersion = 2U;
67 
307 /*******************************************************************/
308 /************************ DATA TYPES *******************************/
309 /*******************************************************************/
310 
314 typedef uint64_t NvSciIpcEndpoint;
315 
317 
323  uint32_t nframes;
325  uint32_t frame_size;
326 };
327 
332 #define NVSCIIPC_MAX_ENDPOINT_NAME 64U
333 
334 /* NvSciIPC Event type */
336 #define NV_SCI_IPC_EVENT_READ 0x01U
337 
338 #define NV_SCI_IPC_EVENT_WRITE 0x02U
339 
340 #define NV_SCI_IPC_EVENT_CONN_EST 0x04U
341 
342 #define NV_SCI_IPC_EVENT_CONN_RESET 0x08U
343 
344 #define NV_SCI_IPC_EVENT_WRITE_EMPTY 0x10U
345 
346 #define NV_SCI_IPC_EVENT_CONN_EST_ALL (NV_SCI_IPC_EVENT_CONN_EST | \
347  NV_SCI_IPC_EVENT_WRITE | NV_SCI_IPC_EVENT_WRITE_EMPTY | \
348  NV_SCI_IPC_EVENT_READ)
349 
351 #define NVSCIIPC_INFINITE_WAIT -1LL
352 
353 /*******************************************************************/
354 /********************* FUNCTION TYPES ******************************/
355 /*******************************************************************/
356 
382 
410 void NvSciIpcDeinit(void);
411 
462 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
463 
518  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
519 
564  NvSciEventNotifier **eventNotifier);
565 
594 
628 
672 
719 
776 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
777  int32_t *bytes);
778 
832 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
833  uint32_t *bytes);
834 
882  const volatile void **buf);
883 
930 
985 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
986  int32_t *bytes);
987 
1038 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
1039  uint32_t size, uint32_t *bytes);
1040 
1087  volatile void **buf);
1088 
1136 
1168  NvSciIpcEndpointInfo *info);
1169 
1170 #ifndef __QNX__
1171 
1189 #endif /* !__QNX__ */
1190 
1293 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1294 
1394 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1395 
1396 #if defined(__QNX__)
1397 
1461 int32_t NvSciIpcWaitEventQnx(int chid, int64_t microseconds, uint32_t bytes,
1462  void *pulse);
1463 
1532 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1533  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1534  void *pulseValue);
1535 
1601 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1602  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1603 
1604 
1657 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1658  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1659 #endif /* __QNX__ */
1660 
1661 /*
1662  * \brief Checks if loaded NvSciIpc library version is compatible with
1663  * the version the application was compiled against.
1664  *
1665  * This function checks loaded NvSciIpc library version with input NvSciIpc
1666  * library version and sets output variable true provided major version of the
1667  * loaded library is same as @a majorVer and minor version of the
1668  * loaded library is not less than @a minorVer, else sets output to false
1669  *
1670  * @param[in] majorVer build major version.
1671  * @param[in] minorVer build minor version.
1672  * @param[out] isCompatible boolean value stating if loaded NvSciIpc library
1673  * is compatible or not.
1674  *
1675  * @return ::NvSciError, the completion code of the operation:
1676  * - ::NvSciError_Success if successful.
1677  * - ::NvSciError_BadParameter if any of the following occurs:
1678  * - @a isCompatible is NULL
1679  *
1680  * @pre None
1681  *
1682  * @usage
1683  * - Allowed context for the API call
1684  * - Interrupt: No
1685  * - Signal handler: No
1686  * - Thread-safe: Yes
1687  * - Async/Sync: Sync
1688  * - Required Privileges(QNX): None
1689  * - API Group
1690  * - Init: Yes
1691  * - Runtime: Yes
1692  * - De-Init: Yes
1693  */
1695  uint32_t majorVer,
1696  uint32_t minorVer,
1697  bool* isCompatible);
1698 
1702 #ifdef __cplusplus
1703 }
1704 #endif
1705 #endif /* INCLUDED_NVSCIIPC_H */
NvSciError
NvSciError
Return/error codes for all NvSci functions.
Definition: nvscierror.h:45
NvSciIpcWriteAdvance
NvSciError NvSciIpcWriteAdvance(NvSciIpcEndpoint handle)
Writes the next frame to 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)
Returns the contents of the next frame from an endpoint.
NvSciEventNotifier
An abstract interface to notify event to event consumer and to register event handler of the event co...
Definition: nvscievent.h:354
NvSciIpcGetLinuxEventFd
NvSciError NvSciIpcGetLinuxEventFd(NvSciIpcEndpoint handle, int32_t *fd)
Returns the NvSciIpc file descriptor for a given endpoint.
NvSciIpcReadAdvance
NvSciError NvSciIpcReadAdvance(NvSciIpcEndpoint handle)
Removes the next frame from an 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.
NvSciIpcReadGetNextFrame
NvSciError NvSciIpcReadGetNextFrame(NvSciIpcEndpoint handle, const volatile void **buf)
Returns a pointer to the location of the next frame from an endpoint.
NvSciIpcEndpoint
uint64_t NvSciIpcEndpoint
Handle to the NvSciIpc endpoint.
Definition: nvsciipc.h:314
NvSciIpcReadSafe
NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size, uint32_t *bytes)
Returns the contents of the next frame from an endpoint.
NvSciIpcMinorVersion
static const uint32_t NvSciIpcMinorVersion
NvSciIpc API Minor version number.
Definition: nvsciipc.h:66
NvSciIpcWriteGetNextFrame
NvSciError NvSciIpcWriteGetNextFrame(NvSciIpcEndpoint handle, volatile void **buf)
Returns a pointer to the location of the next frame for writing data.
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 new frame to the endpoint.
NvSciIpcEndpointInfo::frame_size
uint32_t frame_size
Holds the frame size in bytes.
Definition: nvsciipc.h:325
NvSciIpcGetEventNotifier
NvSciError NvSciIpcGetEventNotifier(NvSciIpcEndpoint handle, NvSciEventNotifier **eventNotifier)
Get NvSciIpc event notifier.
nvscierror.h
NvSciIpcCheckVersionCompatibility
NvSciError NvSciIpcCheckVersionCompatibility(uint32_t majorVer, uint32_t minorVer, bool *isCompatible)
NvSciIpcEndpointInfo::nframes
uint32_t nframes
Holds the number of frames.
Definition: nvsciipc.h:323
NvSciIpcEndpointInfo
Defines information about the NvSciIpc endpoint.
Definition: nvsciipc.h:321
NvSciIpcMajorVersion
static const uint32_t NvSciIpcMajorVersion
NvSciIpc API Major version number.
Definition: nvsciipc.h:63
NvSciIpcWriteSafe
NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf, uint32_t size, uint32_t *bytes)
Writes a new frame to the endpoint.
NvSciEventService
An abstract interface for a program's event handling infrastructure.
Definition: nvscievent.h:196