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 :
24 16 : ~AicpuTsUbgChannel() = default;
25 :
26 1 : HcommChannelKind GetChannelKind() const override
27 : {
28 1 : return HcommChannelKind::AICPU_TS_UBG;
29 : }
30 :
31 : HcclResult Init() override;
32 : ChannelStatus GetStatus() override;
33 :
34 : protected:
35 : HcclResult BuildConnection() override;
36 : void SendFinish() override;
37 : void RecvFinish() override;
38 :
39 : private:
40 : void ProcessUbgState();
41 :
42 27 : MAKE_ENUM(UbgStatus, INIT, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA,
43 : RECV_DATA, SEND_FIN, RECV_FIN, PROCESS_DATA, SET_READY, READY)
44 : UbgStatus ubgStatus{UbgStatus::INIT};
45 : };
46 :
47 : } // namespace hcomm
48 :
49 : #endif // AICPU_TS_UBG_CHANNEL_H
|