NVIDIA DRIVE OS Linux SDK API Reference

6.0.6 Release
nvsciipc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2022, 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 
40 /* use constant global version variable instead of macro for consistency with
41  * version check API of existing NvSci family
42  */
43 
45 static const uint32_t NvSciIpcMajorVersion = 1U;
46 
48 static const uint32_t NvSciIpcMinorVersion = 0U;
49 
284 /*******************************************************************/
285 /************************ DATA TYPES *******************************/
286 /*******************************************************************/
287 
291 typedef uint64_t NvSciIpcEndpoint;
292 
294 
300  uint32_t nframes;
302  uint32_t frame_size;
303 };
304 
309 #define NVSCIIPC_MAX_ENDPOINT_NAME 64U
310 
311 /* NvSciIPC Event type */
313 #define NV_SCI_IPC_EVENT_READ 0x01U
314 
315 #define NV_SCI_IPC_EVENT_WRITE 0x02U
316 
317 #define NV_SCI_IPC_EVENT_CONN_EST 0x04U
318 
319 #define NV_SCI_IPC_EVENT_CONN_RESET 0x08U
320 
321 #define NV_SCI_IPC_EVENT_WRITE_EMPTY 0x10U
322 
323 #define NV_SCI_IPC_EVENT_CONN_EST_ALL (NV_SCI_IPC_EVENT_CONN_EST | \
324  NV_SCI_IPC_EVENT_WRITE | NV_SCI_IPC_EVENT_WRITE_EMPTY | \
325  NV_SCI_IPC_EVENT_READ)
326 
328 #define NVSCIIPC_INFINITE_WAIT -1LL
329 
330 /*******************************************************************/
331 /********************* FUNCTION TYPES ******************************/
332 /*******************************************************************/
333 
358 
383 void NvSciIpcDeinit(void);
384 
430 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
431 
481  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
482 
524  NvSciEventNotifier **eventNotifier);
525 
553 
583 
624 
668 
724 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
725  int32_t *bytes);
726 
780 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
781  uint32_t *bytes);
782 
830  const volatile void **buf);
831 
878 
932 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
933  int32_t *bytes);
934 
985 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
986  uint32_t size, uint32_t *bytes);
987 
1034  volatile void **buf);
1035 
1083 
1115  NvSciIpcEndpointInfo *info);
1116 
1117 #ifndef __QNX__
1118 
1136 #endif /* !__QNX__ */
1137 
1239 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1240 
1340 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1341 
1342 #ifdef __QNX__
1343 
1407 int32_t NvSciIpcWaitEventQnx(int chid, int64_t microseconds, uint32_t bytes,
1408  void *pulse);
1409 
1474 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1475  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1476  void *pulseValue);
1477 
1540 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1541  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1542 
1543 
1596 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1597  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1598 #endif /* __QNX__ */
1599 
1600 /*
1601  * \brief Checks if loaded NvSciIpc library version is compatible with
1602  * the version the application was compiled against.
1603  *
1604  * This function checks loaded NvSciIpc library version with input NvSciIpc
1605  * library version and sets output variable true provided major version of the
1606  * loaded library is same as @a majorVer and minor version of the
1607  * loaded library is not less than @a minorVer, else sets output to false
1608  *
1609  * @param[in] majorVer build major version.
1610  * @param[in] minorVer build minor version.
1611  * @param[out] isCompatible boolean value stating if loaded NvSciIpc library
1612  * is compatible or not.
1613  *
1614  * @return ::NvSciError, the completion code of the operation:
1615  * - ::NvSciError_Success if successful.
1616  * - ::NvSciError_BadParameter if any of the following occurs:
1617  * - @a isCompatible is NULL
1618  *
1619  * @pre None
1620  *
1621  * @usage
1622  * - Allowed context for the API call
1623  * - Interrupt: No
1624  * - Signal handler: No
1625  * - Thread-safe: Yes
1626  * - Async/Sync: Sync
1627  * - Required Privileges(QNX): None
1628  * - API Group
1629  * - Init: Yes
1630  * - Runtime: Yes
1631  * - De-Init: Yes
1632  */
1634  uint32_t majorVer,
1635  uint32_t minorVer,
1636  bool* isCompatible);
1637 
1641 #ifdef __cplusplus
1642 }
1643 #endif
1644 #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:342
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:291
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:48
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:302
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:300
NvSciIpcEndpointInfo
Defines information about the NvSciIpc endpoint.
Definition: nvsciipc.h:298
NvSciIpcMajorVersion
static const uint32_t NvSciIpcMajorVersion
NvSciIpc API Major version number.
Definition: nvsciipc.h:45
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:188