Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 : #ifndef AICPU_TS_UBG_CHANNEL_H
11 : #define AICPU_TS_UBG_CHANNEL_H
12 :
13 : #include "aicpu_ts_uboe_ubg_channel_helper.h"
14 :
15 : namespace hcomm {
16 :
17 : constexpr char_t UBG_FINISH_MSG[FINISH_MSG_SIZE] = "Ubg Comm Pipe ready!";
18 :
19 : class AicpuTsUbgChannel : public AicpuTsUboeUbgChannelHelper {
20 : public:
21 16 : AicpuTsUbgChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc)
22 16 : : AicpuTsUboeUbgChannelHelper(endpointHandle, channelDesc)
23 16 : {}
24 :
25 16 : ~AicpuTsUbgChannel() = default;
26 :
27 1 : HcommChannelKind GetChannelKind() const override { return HcommChannelKind::AICPU_TS_UBG; }
28 :
29 : HcclResult Init() override;
30 : ChannelStatus GetStatus() override;
31 : HcclResult Clean() override;
32 : HcclResult Resume() override;
33 :
34 : protected:
35 : HcclResult BuildConnection() override;
36 : void SendFinish() override;
37 : void RecvFinish() override;
38 :
39 : private:
40 : void ProcessUbgState();
41 :
42 29 : MAKE_ENUM(
43 : UbgStatus, INIT, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA, RECV_DATA, SEND_FIN, RECV_FIN, PROCESS_DATA,
44 : SET_READY, READY)
45 : UbgStatus ubgStatus{UbgStatus::INIT};
46 : };
47 :
48 : } // namespace hcomm
49 :
50 : #endif // AICPU_TS_UBG_CHANNEL_H
|