xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/ssv6xxx/ssvdevice/ssv_cmd.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
3  * Copyright (c) 2015 iComm Corporation
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _SSV_CMD_H_
18 #define _SSV_CMD_H_
19 #define CLI_BUFFER_SIZE 256
20 #define CLI_ARG_SIZE 10
21 #define CLI_RESULT_BUF_SIZE (4096)
22 #define DEBUG_DIR_ENTRY "ssv"
23 #define DEBUG_DEVICETYPE_ENTRY "ssv_devicetype"
24 #define DEBUG_CMD_ENTRY "ssv_cmd"
25 #define MAX_CHARS_PER_LINE 256
26 struct ssv_cmd_table {
27     const char *cmd;
28     int (*cmd_func_ptr)(int, char **);
29     const char *usage;
30 };
31 struct ssv6xxx_cfg_cmd_table {
32     u8 *cfg_cmd;
33     void *var;
34     u32 arg;
35     int (*translate_func)(u8 *, void *, u32);
36 };
37 #define SSV_REG_READ1(ops,reg,val) \
38         (ops)->ifops->readreg((ops)->dev, reg, val)
39 #define SSV_REG_WRITE1(ops,reg,val) \
40         (ops)->ifops->writereg((ops)->dev, reg, val)
41 #define SSV_REG_SET_BITS1(ops,reg,set,clr) \
42     { \
43         u32 reg_val; \
44         SSV_REG_READ(ops, reg, &reg_val); \
45         reg_val &= ~(clr); \
46         reg_val |= (set); \
47         SSV_REG_WRITE(ops, reg, reg_val); \
48     }
49 int ssv_cmd_submit(char *cmd);
50 #endif
51