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 TS_MSG_ADAPTER_H
11 : #define TS_MSG_ADAPTER_H
12 : #include <memory>
13 : #include "aicpusd_common.h"
14 : #include "ts_msg_adapter_common.h"
15 : #include "aicpusd_drv_manager.h"
16 : #include "type_def.h"
17 : #include "ts_api.h"
18 : namespace AicpuSchedule {
19 : class TsMsgAdapter {
20 : public:
21 : TsMsgAdapter(const TsMsgAdapter&) = delete;
22 : TsMsgAdapter(TsMsgAdapter&&) = delete;
23 : TsMsgAdapter& operator=(const TsMsgAdapter&) = delete;
24 : TsMsgAdapter& operator=(TsMsgAdapter&&) = delete;
25 : TsMsgAdapter(const uint32_t pid, const uint8_t cmdType, const uint8_t vfId, const uint8_t tid, const uint8_t tsId);
26 : TsMsgAdapter();
27 60 : virtual ~TsMsgAdapter() = default;
28 : int32_t ResponseToTs(TsAicpuSqe& aicpuSqe, uint32_t handleId, uint32_t devId, uint32_t tsId) const;
29 : int32_t ResponseToTs(TsAicpuMsgInfo& aicpuMsgInfo, uint32_t handleId, uint32_t devId, uint32_t tsId) const;
30 : int32_t ResponseToTs(hwts_response_t& hwtsResp, uint32_t devId, EVENT_ID eventId, uint32_t subeventId) const;
31 :
32 : // invalid parameter
33 : virtual bool IsAdapterInvalidParameter() const = 0;
34 :
35 : // dump
36 : virtual void GetAicpuDataDumpInfo(AicpuDataDumpInfo& info) = 0;
37 : virtual bool IsOpMappingDumpTaskInfoVaild(const AicpuOpMappingDumpTaskInfo& info) const = 0;
38 : virtual void GetAicpuDumpTaskInfo(AicpuOpMappingDumpTaskInfo& opmappingInfo, AicpuDumpTaskInfo& dumpTaskInfo) = 0;
39 : virtual void GetAicpuDataDumpInfoLoad(AicpuDataDumpInfoLoad& info) = 0;
40 : virtual int32_t AicpuDumpResponseToTs(const int32_t result) = 0;
41 : virtual int32_t AicpuDataDumpLoadResponseToTs(const int32_t result) = 0;
42 :
43 : // model operator
44 : virtual void GetAicpuModelOperateInfo(AicpuModelOperateInfo& info) = 0;
45 : virtual int32_t AicpuModelOperateResponseToTs(const int32_t result, const uint32_t subEvent) = 0;
46 : virtual void AicpuActiveStreamSetMsg(ActiveStreamInfo& info) = 0;
47 :
48 : // version set
49 : virtual void GetAicpuMsgVersionInfo(AicpuMsgVersionInfo& info) = 0;
50 : virtual int32_t AicpuMsgVersionResponseToTs(const int32_t result) = 0;
51 :
52 : // task report
53 : virtual void GetAicpuTaskReportInfo(AicpuTaskReportInfo& info) = 0;
54 : virtual int32_t ErrorMsgResponseToTs(ErrMsgRspInfo& rspInfo) = 0;
55 :
56 : // pid notice
57 : virtual int32_t AicpuNoticeTsPidResponse(const uint32_t deviceId) const = 0;
58 :
59 : // timeout
60 : virtual void GetAicpuTimeOutConfigInfo(AicpuTimeOutConfigInfo& info) = 0;
61 : virtual int32_t AicpuTimeOutConfigResponseToTs(const int32_t result) = 0;
62 :
63 : // info load
64 : virtual void GetAicpuInfoLoad(AicpuInfoLoad& info) = 0;
65 : virtual int32_t AicpuInfoLoadResponseToTs(const int32_t result) = 0;
66 :
67 : // err report
68 : virtual void GetAicErrReportInfo(AicErrReportInfo& info) = 0;
69 :
70 : // record
71 : virtual int32_t AicpuRecordResponseToTs(AicpuRecordInfo& info) = 0;
72 :
73 : protected:
74 : // member variables
75 : uint32_t pid_;
76 : uint8_t cmdType_;
77 : uint8_t vfId_;
78 : uint8_t tid_;
79 : uint8_t tsId_;
80 : };
81 : } // namespace AicpuSchedule
82 : #endif // TS_MSG_ADAPTER_H
|