summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/eswin/ecrnx_testmode.h
blob: 36d85620cea16bc3f2cf2ad3deaf35ce10cc0d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
 ****************************************************************************************
 *
 * @file ecrnx_testmode.h
 *
 * @brief Test mode function declarations
 *
 * Copyright (C) ESWIN 2015-2020
 *
 ****************************************************************************************
 */

#ifndef ECRNX_TESTMODE_H_
#define ECRNX_TESTMODE_H_

#include <net/mac80211.h>
#include <net/netlink.h>

/* Commands from user space to kernel space(ECRNX_TM_CMD_APP2DEV_XX) and
 * from and kernel space to user space(ECRNX_TM_CMD_DEV2APP_XX).
 * The command ID is carried with ECRNX_TM_ATTR_COMMAND.
 */
enum ecrnx_tm_cmd_t {
    /* commands from user application to access register */
    ECRNX_TM_CMD_APP2DEV_REG_READ = 1,
    ECRNX_TM_CMD_APP2DEV_REG_WRITE,

    /* commands from user application to select the Debug levels */
    ECRNX_TM_CMD_APP2DEV_SET_DBGMODFILTER,
    ECRNX_TM_CMD_APP2DEV_SET_DBGSEVFILTER,

    /* commands to access registers without sending messages to LMAC layer,
     * this must be used when LMAC FW is stuck. */
    ECRNX_TM_CMD_APP2DEV_REG_READ_DBG,
    ECRNX_TM_CMD_APP2DEV_REG_WRITE_DBG,

    ECRNX_TM_CMD_MAX,
};

enum ecrnx_tm_attr_t {
    ECRNX_TM_ATTR_NOT_APPLICABLE = 0,

    ECRNX_TM_ATTR_COMMAND,

    /* When ECRNX_TM_ATTR_COMMAND is ECRNX_TM_CMD_APP2DEV_REG_XXX,
     * The mandatory fields are:
     * ECRNX_TM_ATTR_REG_OFFSET for the offset of the target register;
     * ECRNX_TM_ATTR_REG_VALUE32 for value */
    ECRNX_TM_ATTR_REG_OFFSET,
    ECRNX_TM_ATTR_REG_VALUE32,

    /* When ECRNX_TM_ATTR_COMMAND is ECRNX_TM_CMD_APP2DEV_SET_DBGXXXFILTER,
     * The mandatory field is ECRNX_TM_ATTR_REG_FILTER. */
    ECRNX_TM_ATTR_REG_FILTER,

    ECRNX_TM_ATTR_MAX,
};

/***********************************************************************/
int ecrnx_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb);
int ecrnx_testmode_dbg_filter(struct ieee80211_hw *hw, struct nlattr **tb);
int ecrnx_testmode_reg_dbg(struct ieee80211_hw *hw, struct nlattr **tb);

#endif /* ECRNX_TESTMODE_H_ */