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 : class BaseTask;
24 : class RtsCntNotify {
25 : public:
26 : RtsCntNotify();
27 : ~RtsCntNotify();
28 : std::unique_ptr<BaseTask> PostBits(u32 bitValue);
29 : std::unique_ptr<BaseTask> WaitValue(u32 value);
30 : void PostBits(u32 bitValue, const Stream& stream) const;
31 : void WaitValue(u32 value, u32 timeout, const aclrtStream& rtStream) const;
32 : void WaitValue(u32 value, u32 timeout, const Stream& stream) const;
33 :
34 : std::string Describe() const;
35 :
36 9 : u32 GetId() const { return id; }
37 :
38 55 : u64 GetAddr() const { return addr; }
39 :
40 55 : u32 GetSize() const { return size; }
41 :
42 : std::vector<char> GetUniqueId() const;
43 :
44 : private:
45 : u32 deviceId;
46 : u32 devPhyId;
47 : RtCntNotify_t handle{nullptr};
48 : u32 id{0};
49 : u64 addr{0};
50 : u32 size{0};
51 : };
52 :
53 : struct UbCntNotifyExchangeData {
54 : u32 userData;
55 : u64 addr{0};
56 : u32 id{0};
57 : u32 size{0};
58 : u8 key[HRT_UB_MEM_KEY_MAX_LEN]{0};
59 : u32 tokenValue{0};
60 : u32 tokenId{0};
61 : u32 keySize{0};
62 : };
63 :
64 : } // namespace Hccl
65 :
66 : #endif // HCCLV2_RTS_CNT_NOTIFY_H
|