Preparing an Endpoint with NvSciEventService for Read/Write
To enable read/write on an endpoint, the following steps must be completed.
- Open the endpoint with an event service that is previously instantiated.
- Get the event notifier associated with the endpoint that was created in Step 1.
- 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.
- 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).
Note:
The event associated with an endpoint is called a native event. It is created internally when NvSciIpcGetEventNotifier()
is called and is not visible to the application.
Prepare an endpoint and getting an event notifier
NvSciEventLoopService *eventLoopService;
NvSciIpcEndpoint ipcEndpoint;
NvSciEventNotifier *eventNotifier;
struct NvSciIpcEndpointInfo info;
NvSciError err;
err = NvSciIpcOpenEndpointWithEventService("ipc_endpoint", &ipcEndpoint, &eventLoopService->EventService);
if (err != NvSciError_Success) {
goto fail;
}
err = NvSciIpcGetEventNotifier(ipcEndpoint, &eventNotifier);
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;
}