Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef HCCLV2_RTS_CNT_NOTIFY_H
12 : #define HCCLV2_RTS_CNT_NOTIFY_H
13 :
14 : #include <memory>
15 : #include <string>
16 : #include "stream.h"
17 : #include "orion_adapter_rts.h"
18 : #include "orion_adapter_hccp.h"
19 : #include "cnt_nto1_notify_lite.h"
20 :
21 : namespace Hccl {
22 :
23 :
24 : class BaseTask;
25 : class RtsCntNotify {
26 : public:
27 : RtsCntNotify();
28 : ~RtsCntNotify();
29 : std::unique_ptr<BaseTask> PostBits(u32 bitValue);
30 : std::unique_ptr<BaseTask> WaitValue(u32 value);
31 : void PostBits(u32 bitValue, const Stream &stream) const;
32 : void WaitValue(u32 value, u32 timeout, const aclrtStream &rtStream) const;
33 : void WaitValue(u32 value, u32 timeout, const Stream &stream) const;
34 :
35 : std::string Describe() const;
36 :
37 9 : u32 GetId() const
38 : {
39 9 : return id;
40 : }
41 :
42 49 : u64 GetAddr() const
43 : {
44 49 : return addr;
45 : }
46 :
47 49 : u32 GetSize() const
48 : {
49 49 : return size;
50 : }
51 :
52 : std::vector<char> GetUniqueId() const;
53 :
54 : private:
55 : u32 deviceId;
56 : u32 devPhyId;
57 : RtCntNotify_t handle{nullptr};
58 : u32 id{0};
59 : u64 addr{0};
60 : u32 size{0};
61 : };
62 :
63 :
64 : struct UbCntNotifyExchangeData {
65 : u32 userData;
66 : u64 addr{0};
67 : u32 id{0};
68 : u32 size{0};
69 : u8 key[HRT_UB_MEM_KEY_MAX_LEN]{0};
70 : u32 tokenValue{0};
71 : u32 tokenId{0};
72 : u32 keySize{0};
73 : };
74 :
75 : } // namespace Hccl
76 :
77 : #endif // HCCLV2_RTS_CNT_NOTIFY_H
|