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(
30 : TsAicpuMsgInfo& aicpuMsgInfo, uint32_t handleId, uint32_t devId, uint32_t tsId) const;
31 : int32_t ResponseToTs(hwts_response_t& hwtsResp, uint32_t devId, EVENT_ID eventId, uint32_t subeventId) const;
32 :
33 : // invalid parameter
34 : virtual bool IsAdapterInvaildParameter() const = 0;
35 :
36 : // dump
37 : virtual void GetAicpuDataDumpInfo(AicpuDataDumpInfo& info) = 0;
38 : virtual bool IsOpMappingDumpTaskInfoVaild(const AicpuOpMappingDumpTaskInfo& info) const = 0;
39 : virtual void GetAicpuDumpTaskInfo(AicpuOpMappingDumpTaskInfo& opmappingInfo, AicpuDumpTaskInfo& dumpTaskInfo) = 0;
40 : virtual void GetAicpuDataDumpInfoLoad(AicpuDataDumpInfoLoad& info) = 0;
41 : virtual int32_t AicpuDumpResponseToTs(const int32_t result) = 0;
42 : virtual int32_t AicpuDataDumpLoadResponseToTs(const int32_t result) = 0;
43 :
44 : // model operator
45 : virtual void GetAicpuModelOperateInfo(AicpuModelOperateInfo& info) = 0;
46 : virtual int32_t AicpuModelOperateResponseToTs(const int32_t result, const uint32_t subEvent) = 0;
47 : virtual void AicpuActiveStreamSetMsg(ActiveStreamInfo& info) = 0;
48 :
49 : // version set
50 : virtual void GetAicpuMsgVersionInfo(AicpuMsgVersionInfo& info) = 0;
51 : virtual int32_t AicpuMsgVersionResponseToTs(const int32_t result) = 0;
52 :
53 : // task report
54 : virtual void GetAicpuTaskReportInfo(AicpuTaskReportInfo& info) = 0;
55 : virtual int32_t ErrorMsgResponseToTs(ErrMsgRspInfo& rspInfo) = 0;
56 :
57 : // pid notice
58 : virtual int32_t AicpuNoticeTsPidResponse(const uint32_t deviceId) const = 0;
59 :
60 : // timeout
61 : virtual void GetAicpuTimeOutConfigInfo(AicpuTimeOutConfigInfo& info) = 0;
62 : virtual int32_t AicpuTimeOutConfigResponseToTs(const int32_t result) = 0;
63 :
64 : // info load
65 : virtual void GetAicpuInfoLoad(AicpuInfoLoad& info) = 0;
66 : virtual int32_t AicpuInfoLoadResponseToTs(const int32_t result) = 0;
67 :
68 : // err report
69 : virtual void GetAicErrReportInfo(AicErrReportInfo& info) = 0;
70 :
71 : // record
72 : virtual int32_t AicpuRecordResponseToTs(AicpuRecordInfo& info) = 0;
73 :
74 : protected:
75 : // member variables
76 : uint32_t pid_;
77 : uint8_t cmdType_;
78 : uint8_t vfId_;
79 : uint8_t tid_;
80 : uint8_t tsId_;
81 : };
82 : } // namespace AicpuSchedule
83 : #endif // TS_MSG_ADAPTER_H
|