1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: zdiag ind producer 15 * This file should be changed only infrequently and with great care. 16 */ 17 #ifndef __ZDIAG_IND_SRC_H__ 18 #define __ZDIAG_IND_SRC_H__ 19 20 #include "errcode.h" 21 #include "diag_common.h" 22 #include "diag.h" 23 #include "diag_pkt.h" 24 25 typedef struct { 26 diag_addr src; 27 diag_addr dst; 28 uint16_t cmd_id; 29 uint16_t ctrl; 30 uint16_t len; 31 uint8_t data[0]; 32 } zdiag_ind_msg_t; 33 34 typedef struct { 35 diag_addr src; 36 diag_addr dst; 37 uint16_t cmd_id; 38 uint16_t ctrl; 39 uint16_t len; 40 uint8_t *data; 41 } diag_ind_param_t; 42 43 typedef struct { 44 uint8_t *packet; 45 uint16_t packet_size; 46 } diag_report_sys_msg_packet; 47 48 typedef struct { 49 uint8_t **packet; 50 uint16_t *packet_size; 51 uint8_t pkt_cnt; 52 } diag_report_packet; 53 54 typedef errcode_t (*report_msg_func)(uint32_t module_id, uint32_t msg_id, const uint8_t *buf, uint16_t buf_size, 55 uint8_t level); 56 57 errcode_t uapi_diag_report_ack(msp_diag_ack_param_t *ack, diag_option_t *option); 58 errcode_t uapi_zdiag_report_sys_msg_instance(uint32_t module_id, uint32_t msg_id, const uint8_t *packet, 59 uint16_t packet_size, uint8_t level); 60 errcode_t uapi_zdiag_report_sys_msg_instance_sn(uint32_t module_id, uint32_t msg_id, 61 diag_report_sys_msg_packet *report_sys_msg_packet, uint8_t level, uint32_t sn); 62 errcode_t uapi_zdiag_report_packet(uint16_t cmd_id, diag_option_t *option, const uint8_t *packet, 63 uint16_t packet_size, bool sync); 64 #endif 65