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 for sample data. 15 */ 16 17 #ifndef __DIAG_SAMPLE_DATA_H__ 18 #define __DIAG_SAMPLE_DATA_H__ 19 20 #include "diag.h" 21 22 #define ZDIAG_SAMPLE_START 1 23 #define ZDIAG_SAMPLE_STOP 0 24 25 typedef enum { 26 ZDIAG_BGLE_SAMPLE_CB = 0, 27 ZDIAG_WLAN_SAMPLE_CB, 28 ZDIAG_SOC_SAMPLE_CB, 29 ZDIAG_WLAN_PHY_SAMPLE_CB, 30 ZDIAG_SAMPLE_CB_END, 31 }diag_sample_cb_enum; 32 33 /*********************bgle/soc sample data******************/ 34 35 typedef struct { 36 uint32_t flag; /* 1: start; 0: stop; */ 37 uint32_t transmit_id; 38 uint32_t sample_size; /* ram size: 0-7 */ 39 uint32_t sample_type; /* full stop, cyclical */ 40 } diag_btsoc_sample_cmd; 41 42 /* report end */ 43 typedef struct { 44 uint32_t transmit_id; 45 uint32_t state_code; /* end code: 11 */ 46 uint32_t len; /* reserved */ 47 uint32_t data[0]; /* reserved */ 48 } diag_sample_notify; 49 50 /***********************wifi sample data***********************/ 51 52 typedef struct { 53 uint32_t flag; /* 1: start; 0: stop; */ 54 uint32_t mode; /* mode/transmitid: 1,4,8; */ 55 uint32_t sample_size; /* ram size: 0-7 */ 56 uint32_t sample_type; /* full stop, cyclical */ 57 uint32_t sub_mode; /* 0-31 */ 58 } diag_wlan_sample_cmd; 59 60 /***********************wifi PHY数采***********************/ 61 /* hso配置参数下发结构体 */ 62 typedef struct { 63 uint32_t flag; /* 1:启动数采; 0:停止数采; */ 64 uint32_t node; /* phy 数采节点 mode */ 65 uint32_t sample_size; /* 存储数采ram大小 2k 4k 6k 8k 10k 12k 14k 16k 32k */ 66 uint32_t sample_type; /* 数采类型:存满停止 0、循环数采 1 */ 67 uint32_t trigger_start; /* 触发起始条件 */ 68 uint32_t trigger_end; /* 触发结束条件 */ 69 uint32_t event_rpt_addr; /* 事件上报寄存器 */ 70 } diag_wlan_phy_sample_cmd; 71 72 typedef struct { 73 uint32_t transmit_id; 74 uint32_t cmd_id; /* wifi/soc/bgle */ 75 uint32_t offset; 76 uint32_t running; 77 uint32_t msg_cnt; 78 } diag_sample_record; 79 80 typedef uint32_t (*diag_sample_func_cb)(void *param, uint32_t len); 81 void diag_sample_data_register(diag_sample_cb_enum idx, diag_sample_func_cb func); 82 errcode_t diag_cmd_report_sample_data(uint8_t *buf, uint32_t len); 83 errcode_t diag_report_wlan_sample_data(const uint8_t *buf, uint32_t len, uint32_t msg_id); 84 errcode_t diag_cmd_wlan_module_sample_data(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, 85 diag_option_t *option); 86 87 #endif