NVIDIA DRIVE OS Linux SDK API Reference

6.0.5 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 
277 /*******************************************************************/
278 /************************ DATA TYPES *******************************/
279 /*******************************************************************/
280 
284 typedef uint64_t NvSciIpcEndpoint;
285 
287 
293  uint32_t nframes;
295  uint32_t frame_size;
296 };
297 
302 #define NVSCIIPC_MAX_ENDPOINT_NAME 64U
303 
304 /* NvSciIPC Event type */
306 #define NV_SCI_IPC_EVENT_READ 0x01U
307 
308 #define NV_SCI_IPC_EVENT_WRITE 0x02U
309 
310 #define NV_SCI_IPC_EVENT_CONN_EST 0x04U
311 
312 #define NV_SCI_IPC_EVENT_CONN_RESET 0x08U
313 
314 #define NV_SCI_IPC_EVENT_WRITE_EMPTY 0x10U
315 
316 #define NV_SCI_IPC_EVENT_CONN_EST_ALL (NV_SCI_IPC_EVENT_CONN_EST | \
317  NV_SCI_IPC_EVENT_WRITE | NV_SCI_IPC_EVENT_WRITE_EMPTY | \
318  NV_SCI_IPC_EVENT_READ)
319 
321 #define NVSCIIPC_INFINITE_WAIT -1LL
322 
323 /*******************************************************************/
324 /********************* FUNCTION TYPES ******************************/
325 /*******************************************************************/
326 
351 
376 void NvSciIpcDeinit(void);
377 
423 NvSciError NvSciIpcOpenEndpoint(const char *endpoint, NvSciIpcEndpoint *handle);
424 
474  NvSciIpcEndpoint *handle, NvSciEventService *eventService);
475 
517  NvSciEventNotifier **eventNotifier);
518 
546 
577 
618 
662 
718 NvSciError NvSciIpcRead(NvSciIpcEndpoint handle, void *buf, size_t size,
719  int32_t *bytes);
720 
774 NvSciError NvSciIpcReadSafe(NvSciIpcEndpoint handle, void *buf, uint32_t size,
775  uint32_t *bytes);
776 
824  const volatile void **buf);
825 
872 
926 NvSciError NvSciIpcWrite(NvSciIpcEndpoint handle, const void *buf, size_t size,
927  int32_t *bytes);
928 
979 NvSciError NvSciIpcWriteSafe(NvSciIpcEndpoint handle, const void *buf,
980  uint32_t size, uint32_t *bytes);
981 
1028  volatile void **buf);
1029 
1077 
1109  NvSciIpcEndpointInfo *info);
1110 
1111 #ifndef __QNX__
1112 
1130 #endif /* !__QNX__ */
1131 
1233 NvSciError NvSciIpcGetEvent(NvSciIpcEndpoint handle, uint32_t *events);
1234 
1334 NvSciError NvSciIpcGetEventSafe(NvSciIpcEndpoint handle, uint32_t *events);
1335 
1336 #ifdef __QNX__
1337 
1401 int32_t NvSciIpcWaitEventQnx(int chid, int64_t microseconds, uint32_t bytes,
1402  void *pulse);
1403 
1468 NvSciError NvSciIpcSetQnxPulseParam(NvSciIpcEndpoint handle,
1469  int32_t coid, int16_t pulsePriority, int16_t pulseCode,
1470  void *pulseValue);
1471 
1534 NvSciError NvSciIpcSetQnxPulseParamSafe(NvSciIpcEndpoint handle,
1535  int32_t coid, int16_t pulsePriority, int16_t pulseCode);
1536 
1537 
1590 NvSciError NvSciIpcInspectEventQnx(int32_t chid, uint16_t numEvents,
1591  uint32_t epCount, NvSciIpcEndpoint **epHandleArray);
1592 #endif /* __QNX__ */
1593 
1594 /*
1595  * \brief Checks if loaded NvSciIpc library version is compatible with
1596  * the version the application was compiled against.
1597  *
1598  * This function checks loaded NvSciIpc library version with input NvSciIpc
1599  * library version and sets output variable true provided major version of the
1600  * loaded library is same as @a majorVer and minor version of the
1601  * loaded library is not less than @a minorVer, else sets output to false
1602  *
1603  * @param[in] majorVer build major version.
1604  * @param[in] minorVer build minor version.
1605  * @param[out] isCompatible boolean value stating if loaded NvSciIpc library
1606  * is compatible or not.
1607  *
1608  * @return ::NvSciError, the completion code of the operation:
1609  * - ::NvSciError_Success if successful.
1610  * - ::NvSciError_BadParameter if any of the following occurs:
1611  * - @a isCompatible is NULL
1612  *
1613  * @pre None
1614  *
1615  * @usage
1616  * - Allowed context for the API call
1617  * - Interrupt: No
1618  * - Signal handler: No
1619  * - Thread-safe: Yes
1620  * - Async/Sync: Sync
1621  * - Required Privileges(QNX): None
1622  * - API Group
1623  * - Init: Yes
1624  * - Runtime: Yes
1625  * - De-Init: Yes
1626  */
1628  uint32_t majorVer,
1629  uint32_t minorVer,
1630  bool* isCompatible);
1631 
1635 #ifdef __cplusplus
1636 }
1637 #endif
1638 #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:284
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:295
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:293
NvSciIpcEndpointInfo
Defines information about the NvSciIpc endpoint.
Definition: nvsciipc.h:291
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