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: diag channel adapt api header file 15 * This file should be changed only infrequently and with great care. 16 */ 17 #ifndef __SOC_ZDIAG_CHANNEL_H__ 18 #define __SOC_ZDIAG_CHANNEL_H__ 19 20 #include <stdint.h> 21 #include <stdbool.h> 22 #include "errcode.h" 23 #include "diag_config.h" 24 #include "diag_common.h" 25 #include "dfx_write_interface.h" 26 27 typedef enum { 28 SOC_DIAG_CHANNEL_ATTR_NEED_RX_BUF = 0x1, 29 } soc_diag_channel_attribute_t; 30 31 typedef int32_t (*diag_channel_tx_hook)(void *fd, dfx_data_type_t data_type, uint8_t *data[], 32 uint16_t len[], uint8_t cnt); 33 typedef errcode_t (*diag_channel_notify_hook)(uint32_t id, uint32_t data); 34 35 errcode_t soc_diag_channel_init(diag_channel_id_t id, uint32_t attribute); 36 37 errcode_t soc_diag_channel_set_tx_hook(diag_channel_id_t id, diag_channel_tx_hook hook); 38 39 errcode_t soc_diag_channel_set_notify_hook(diag_channel_id_t id, diag_channel_notify_hook hook); 40 41 errcode_t soc_diag_channel_rx_mux_data(diag_channel_id_t id, uint8_t *data, uint16_t size); 42 43 int32_t soc_diag_channel_rx_mux_char_data(diag_channel_id_t id, uint8_t *data, uint16_t size); 44 45 errcode_t soc_diag_channel_set_connect_hso_addr(diag_channel_id_t id, uint8_t hso_addr); 46 #endif 47