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 :
11 : #ifndef TS_MSG_ADAPTER_COMMON_H
12 : #define TS_MSG_ADAPTER_COMMON_H
13 : namespace AicpuSchedule {
14 : struct ErrLogRptInfo;
15 : constexpr uint16_t INVALID_VALUE16 = 0xFFFFU;
16 : constexpr uint32_t INVALID_VALUE32 = 0xFFFFFFFFU;
17 : constexpr uint8_t VERSION_0 = 0;
18 : constexpr uint8_t VERSION_1 = 1;
19 : constexpr uint8_t MSG_EVENT_SUB_EVENTID_RECORD = 1;
20 :
21 : struct AicpuTaskReportInfo {
22 : volatile uint16_t model_id;
23 : volatile uint16_t result_code;
24 : volatile uint16_t stream_id;
25 : volatile uint32_t task_id;
26 : };
27 :
28 : struct AicpuModelOperateInfo {
29 : volatile uint64_t arg_ptr;
30 : volatile uint16_t stream_id;
31 : volatile uint16_t task_id;
32 : volatile uint16_t model_id;
33 : volatile uint8_t cmd_type;
34 : volatile uint8_t reserved[3];
35 : };
36 :
37 : struct AicpuDataDumpInfo {
38 : volatile bool is_debug;
39 : volatile uint32_t dump_task_id;
40 : volatile uint16_t dump_stream_id;
41 : volatile uint32_t debug_dump_task_id;
42 : volatile uint16_t debug_dump_stream_id;
43 : volatile bool is_model;
44 : volatile uint32_t file_name_task_id;
45 : volatile uint16_t file_name_stream_id;
46 : };
47 :
48 : struct AicpuDumpFFTSPlusDataInfo {
49 : TsToAicpuFFTSPlusDataDump i;
50 : };
51 :
52 : struct AicpuDataDumpInfoLoad {
53 : volatile uint64_t dumpinfoPtr;
54 : volatile uint32_t length;
55 : volatile uint16_t stream_id;
56 : volatile uint32_t task_id;
57 : };
58 :
59 : struct AicpuTimeOutConfigInfo {
60 : TsToAicpuTimeOutConfig i;
61 : };
62 :
63 : struct AicpuInfoLoad {
64 : volatile uint64_t aicpuInfoPtr;
65 : volatile uint32_t length;
66 : volatile uint16_t stream_id;
67 : volatile uint32_t task_id;
68 : };
69 :
70 : struct AicErrReportInfo {
71 : union {
72 : TsToAicpuAicErrReport aicError;
73 : TsToAicpuAicErrMsgReport aicErrorMsg;
74 : } u;
75 : };
76 :
77 : struct AicpuMsgVersionInfo {
78 : volatile uint16_t magic_num;
79 : volatile uint16_t version;
80 : };
81 :
82 : struct AicpuOpMappingDumpTaskInfo {
83 : AicpuOpMappingDumpTaskInfo() = default;
84 4 : AicpuOpMappingDumpTaskInfo(uint32_t protoTaskId, uint32_t protoStreamId, uint32_t taskId, uint32_t streamId)
85 4 : : proto_info_task_id(protoTaskId), proto_info_stream_id(protoStreamId), task_id(taskId), stream_id(streamId)
86 4 : {}
87 : volatile uint32_t proto_info_task_id;
88 : volatile uint32_t proto_info_stream_id;
89 : volatile uint32_t task_id;
90 : volatile uint32_t stream_id;
91 : };
92 :
93 : struct AicpuDumpTaskInfo {
94 : volatile uint32_t task_id;
95 : volatile uint32_t stream_id;
96 : volatile uint32_t context_id;
97 : volatile uint32_t thread_id;
98 : };
99 :
100 : struct AicpuRecordInfo {
101 : AicpuRecordInfo() = default;
102 2 : AicpuRecordInfo(
103 : uint32_t recordId, uint8_t recordType, uint16_t retCode, uint8_t tsId, uint32_t taskId, uint16_t streamId,
104 : uint32_t devId)
105 2 : : record_id(recordId),
106 2 : record_type(recordType),
107 2 : ret_code(retCode),
108 2 : ts_id(tsId),
109 2 : fault_task_id(taskId),
110 2 : fault_stream_id(streamId),
111 2 : dev_id(devId) {};
112 : volatile uint32_t record_id;
113 : volatile uint8_t record_type;
114 : volatile uint16_t ret_code;
115 : volatile uint8_t ts_id;
116 : volatile uint32_t fault_task_id;
117 : volatile uint32_t fault_stream_id;
118 : volatile uint32_t dev_id;
119 : };
120 :
121 : struct ActiveStreamInfo {
122 : ActiveStreamInfo() = default;
123 1 : ActiveStreamInfo(uint16_t streamId, uint8_t tsId, uint64_t aicpuStamp, uint32_t deviceId, uint32_t handleId)
124 1 : : stream_id(streamId), ts_id(tsId), aicpu_stamp(aicpuStamp), device_id(deviceId), handle_id(handleId) {};
125 : volatile uint16_t stream_id;
126 : volatile uint8_t ts_id;
127 : volatile uint64_t aicpu_stamp;
128 : volatile uint32_t device_id;
129 : volatile uint32_t handle_id;
130 : };
131 :
132 : #pragma pack(push, 1)
133 : struct ErrMsgRspInfo {
134 : ErrMsgRspInfo() = default;
135 1 : ErrMsgRspInfo(uint32_t off, uint32_t errCode, uint32_t streamId, uint32_t taskId, uint32_t modelId, uint32_t tsId)
136 1 : : offset(off), err_code(errCode), stream_id(streamId), task_id(taskId), model_id(modelId), ts_id(tsId) {};
137 : uint32_t offset;
138 : uint32_t err_code;
139 : uint32_t stream_id;
140 : uint32_t task_id;
141 : uint32_t model_id;
142 : uint32_t ts_id;
143 : };
144 : #pragma pack(pop)
145 :
146 : } // namespace AicpuSchedule
147 : #endif // TS_MSG_ADAPTER_COMMON_H
|