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: wal util api. 15 * Create: 2022-08-22 16 */ 17 18 #ifndef __WAL_UTILS_H__ 19 #define __WAL_UTILS_H__ 20 21 #include "oal_ext_if.h" 22 #include "wlan_types_common.h" 23 #include "wlan_spec.h" 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif 29 #endif 30 31 #ifdef _PRE_WLAN_FEATURE_WS92_MERGE 32 #define WAL_CCPRIV_CMD_NAME_MAX_LEN 40 /* 字符串中每个单词的最大长度 */ 33 #else 34 #define WAL_CCPRIV_CMD_NAME_MAX_LEN 80 /* 字符串中每个单词的最大长度(原20) */ 35 #endif 36 37 #define WAL_CCPRIV_CMD_PKT_NAME_MAX_LEN 1024 /* 报文字符串的最大长度,应大于报文长度的2倍 */ 38 #define WAL_CCPRIV_CMD_PKT_MAX_LEN 490 /* 报文的最大长度 */ 39 #define WAL_CCPRIV_CMD_PKT_MIN_LEN 10 /* 报文的最小长度 */ 40 41 typedef enum { 42 CCPRIV_SWITCH_OFF = 0, 43 CCPRIV_SWITCH_ON = 1, 44 45 CCPRIV_SWITCH_BUFF 46 } ccpriv_switch; 47 48 typedef osal_u32 (*wal_ccpriv_debug_cmd_func)(const osal_s8 *cmd_name, 49 oal_net_device_stru *net_dev, osal_s8 *param); 50 51 typedef osal_u32(*wal_ccpriv_cmd_func)(oal_net_device_stru *net_dev, osal_s8 *pc_param); 52 53 /* 私有命令入口结构定义 */ 54 typedef struct { 55 char *cmd_name; /* 命令字符串 */ 56 wal_ccpriv_cmd_func func; /* 命令对应处理函数 */ 57 } wal_ccpriv_cmd_entry_stru; 58 59 osal_u8 wal_util_get_vap_id(oal_net_device_stru *net_dev); 60 osal_u32 wal_get_cmd_one_arg(const osal_s8 *cmd, osal_s8 *arg, osal_u32 arg_len, osal_u32 *cmd_offset); 61 osal_s32 wal_get_cmd_one_arg_digit(osal_s8 *cmd, osal_s8 *arg, osal_s32 arg_len, osal_u32 *cmd_offset, osal_s32 *data); 62 osal_s32 wal_cmd_get_digit_with_range(osal_s8 **src_head, osal_s32 min, osal_s32 max, osal_s32 *value); 63 osal_s32 wal_cmd_get_s8_with_range(osal_s8 **src_head, osal_s8 min, osal_s8 max, osal_s8 *value); 64 osal_u32 wal_cmd_get_u8_with_check_max(osal_s8 **src_head, osal_u8 max_value, osal_u8 *value); 65 osal_u32 wal_cmd_get_digit_with_check_max(osal_s8 **src_head, osal_u32 max_value, osal_u32 *value); 66 67 #ifdef __cplusplus 68 #if __cplusplus 69 } 70 #endif 71 #endif 72 73 #endif 74