Compute Graph Framework SDK Reference  5.16
Channel.hpp
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
31#ifndef DW_FRAMEWORK_CHANNEL_HPP_
32#define DW_FRAMEWORK_CHANNEL_HPP_
33
34#include "ChannelParameters.hpp"
35#include "IChannelPacket.hpp"
36
37#include <dw/core/context/Context.h>
38#include <dwshared/dwfoundation/dw/core/language/Function.hpp>
39#include <dwshared/dwfoundation/dw/core/container/BaseString.hpp>
40#include <dw/core/health/HealthSignals.h>
41
42#include <memory>
43#include <mutex>
44#include <string>
45
46namespace dw
47{
48namespace framework
49{
50
52// coverity[autosar_cpp14_a0_1_1_violation]
53// coverity[autosar_cpp14_m0_1_4_violation]
54static constexpr dwTime_t CHN_WAIT_TIMEOUT_US{50'000'000};
55
60{
61public:
62 virtual ~ChannelObject() = default;
63
68 {
69 public:
78 virtual void getSyncObjs(dw::core::span<NvSciSyncObj>& syncObjs) = 0;
79 };
80
84 class SyncWaiter : public SyncClient
85 {
86 public:
96 virtual void getWaitFences(void* data, dw::core::span<NvSciSyncFence>& waitFences) = 0;
97 };
98
103 {
104 public:
113 virtual void setSignalFences(void* data, dw::core::span<const NvSciSyncFence> postFences) = 0;
114 };
115
119 // coverity[autosar_cpp14_m3_4_1_violation]
121 {
122 public:
124
126
136 virtual dwStatus wait(dwTime_t timeout) = 0;
137
141 virtual dw::core::VectorFixed<GenericData> getAllBuffers() = 0;
142
143 using OnDataReady = dw::core::Function<void()>;
144
150 virtual void setOnDataReady(void* opaque, OnDataReady onDataReady) = 0;
151 };
152
156 class Producer : public PacketPool
157 {
158 public:
165 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
166 virtual dwStatus get(GenericData* data) = 0;
176 virtual dwStatus send(void* data) = 0;
177
186 virtual dwStatus release(void* data) = 0;
187 };
188
192 class Consumer : public PacketPool
193 {
194 public:
205 virtual dwStatus recv(GenericData* data) = 0;
216 virtual dwStatus release(void* data) = 0;
217 };
218
229 virtual Producer* getProducer(const GenericDataReference& ref) = 0;
230
240 virtual Consumer* getConsumer(const GenericDataReference& ref) = 0;
241
246 virtual bool hasClients() const = 0;
247
252 virtual bool isConnected() const = 0;
253
264 virtual dwStatus connect(dwTime_t timeout) = 0;
265
269 virtual const ChannelParams& getParams() const = 0;
270
271 virtual ChannelParams& getParams() = 0;
272
278 virtual void disconnectEndpoint(const char* nvsciipcEndpoint) = 0;
279
285 virtual void connectEndpoint(const char* nvsciipcEndpoint) = 0;
286};
287
289{
290 CONNECTED,
292 ERROR,
293 READY,
295};
296
297// coverity[autosar_cpp14_a0_1_6_violation]
299{
301 uint32_t uid;
302 uint32_t connectGroupID;
303 void* opaque;
305};
306
307// coverity[autosar_cpp14_a0_1_6_violation]
309{
310 dwErrorSignal errorSignal;
311 dw::core::FixedString<64U> nvsciipcEndpoint;
312};
313
314} // namespace framework
315} // namespace dw
316
317#endif // DW_FRAMEWORK_CHANNEL_HPP_
virtual dwStatus recv(GenericData *data)=0
virtual dwStatus release(void *data)=0
virtual dwStatus wait(dwTime_t timeout)=0
virtual void setOnDataReady(void *opaque, OnDataReady onDataReady)=0
dw::core::Function< void()> OnDataReady
Definition: Channel.hpp:143
virtual dw::core::VectorFixed< GenericData > getAllBuffers()=0
virtual dwStatus get(GenericData *data)=0
virtual dwStatus release(void *data)=0
virtual dwStatus send(void *data)=0
virtual void getSyncObjs(dw::core::span< NvSciSyncObj > &syncObjs)=0
virtual void setSignalFences(void *data, dw::core::span< const NvSciSyncFence > postFences)=0
virtual void getWaitFences(void *data, dw::core::span< NvSciSyncFence > &waitFences)=0
virtual ChannelParams & getParams()=0
virtual const ChannelParams & getParams() const =0
virtual Consumer * getConsumer(const GenericDataReference &ref)=0
virtual ~ChannelObject()=default
virtual bool isConnected() const =0
virtual dwStatus connect(dwTime_t timeout)=0
virtual void connectEndpoint(const char *nvsciipcEndpoint)=0
virtual void disconnectEndpoint(const char *nvsciipcEndpoint)=0
virtual bool hasClients() const =0
virtual Producer * getProducer(const GenericDataReference &ref)=0
dw::core::FixedString< 64U > nvsciipcEndpoint
The endpoint, if relevant, or empty string.
Definition: Channel.hpp:311
uint32_t connectGroupID
connect group identifier of the event, relevant only for group connected event
Definition: Channel.hpp:302
void * opaque
The opaque pointer set for the channel tthat is ready. Only valid for type=READY.
Definition: Channel.hpp:303
@ GROUP_CONNECTED
Channel group connected.
@ DISCONNECTED
Channel became or is disconnected.
@ CONNECTED
Channel became connected.
@ ERROR
Channel encountered error.
dwErrorSignal errorSignal
The error signal.
Definition: Channel.hpp:310
uint32_t uid
unique identifier of the channel
Definition: Channel.hpp:301
static constexpr dwTime_t CHN_WAIT_TIMEOUT_US
Definition: Channel.hpp:54
ChannelObject::PacketPool::OnDataReady onDataReady
The callback set for the channel that is ready. Only valid for type=READY.
Definition: Channel.hpp:304
ChannelEventType type
The type of the event.
Definition: Channel.hpp:300
Definition: Buffer.hpp:40