Prepare an NvSciIpc Endpoint for read/write
To enable read/write on an endpoint, the following steps must be completed.
- The application must open the endpoint.
- Get the endpoint information, such as the number of frames and each frame size. This is important as only single frames can be read/written at a given time.
- Get the FD associated with the endpoint. This is required to handle event notifications.
- Reset the endpoint. This is important as it ensures that the endpoint is not reading/writing any stale data (for example, from the previous start or instance).
Prepare an NvSciIpc Endpoint for read/write
NvSciIpcEndpoint ipcEndpoint;
struct NvSciIpcEndpointInfo info;
int32_t fd;
NvSciError err;
err = NvSciIpcOpenEndpoint("ipc_endpoint", &ipcEndpoint);
if (err != NvSciError_Success) {
goto fail;
}
err = NvSciIpcGetLinuxEventFd(ipcEndpoint, &fd);
if (err != NvSciError_Success) {
goto fail;
}
err = NvSciIpcGetEndpointInfo(ipcEndpoint, &info);
if (err != NvSciError_Success) {
goto fail;
}
printf("Endpointinfo: nframes = %d, frame_size = %d\n", info.nframes, info.frame_size);
err = NvSciIpcResetEndpointSafe(ipcEndpoint);
if (err != NvSciError_Success) {
goto fail;
}