[6319] | 1 | /** @file wlan_exp_node.h |
---|
| 2 | * @brief Experiment Framework (Node) |
---|
| 3 | * |
---|
| 4 | * This contains the code for WLAN Experimental Framework. |
---|
| 5 | * |
---|
| 6 | * @copyright Copyright 2013-2019, Mango Communications. All rights reserved. |
---|
| 7 | * Distributed under the Mango Communications Reference Design License |
---|
| 8 | * See LICENSE.txt included in the design archive or |
---|
| 9 | * at http://mangocomm.com/802.11/license |
---|
| 10 | * |
---|
| 11 | * This file is part of the Mango 802.11 Reference Design (https://mangocomm.com/802.11) |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | /***************************** Include Files *********************************/ |
---|
| 16 | #include "wlan_mac_high_sw_config.h" |
---|
| 17 | #include "xil_types.h" |
---|
| 18 | #include "wlan_common_types.h" |
---|
| 19 | #include "wlan_high_types.h" |
---|
| 20 | |
---|
| 21 | /*************************** Constant Definitions ****************************/ |
---|
| 22 | #ifndef WLAN_EXP_NODE_H_ |
---|
| 23 | #define WLAN_EXP_NODE_H_ |
---|
| 24 | |
---|
| 25 | //Forward Declarations |
---|
| 26 | struct eth_rx_queue_buffer_t; |
---|
| 27 | struct eth_tx_queue_buffer_t; |
---|
| 28 | struct wlan_exp_eth_rx_queue_buffer_t; |
---|
| 29 | struct cmd_resp_hdr_t; |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | // **************************************************************************** |
---|
| 33 | // Define Node Commands |
---|
| 34 | // |
---|
| 35 | // All Command IDs (CMDID_*) must be a 24 bit unique number |
---|
| 36 | |
---|
| 37 | //----------------------------------------------- |
---|
| 38 | // Node Commands |
---|
| 39 | // |
---|
| 40 | #define CMDID_NODE_TYPE 0x000000 |
---|
| 41 | #define CMDID_NODE_INFO 0x000001 |
---|
| 42 | #define CMDID_NODE_IDENTIFY 0x000002 |
---|
| 43 | |
---|
| 44 | #define CMD_PARAM_NODE_IDENTIFY_ALL 0xFFFFFFFF |
---|
| 45 | |
---|
| 46 | #define CMDID_NODE_CONFIG_SETUP 0x000003 |
---|
| 47 | #define CMDID_NODE_CONFIG_RESET 0x000004 |
---|
| 48 | |
---|
| 49 | #define CMD_PARAM_NODE_CONFIG_RESET_ALL 0xFFFFFFFF |
---|
| 50 | |
---|
| 51 | #define CMDID_NODE_TEMPERATURE 0x000005 |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | //----------------------------------------------- |
---|
| 55 | // WLAN Exp Node Commands |
---|
| 56 | // |
---|
| 57 | #define CMDID_NODE_RESET_STATE 0x001000 |
---|
| 58 | #define CMDID_NODE_CONFIGURE 0x001001 |
---|
| 59 | #define CMDID_NODE_CONFIG_BSS 0x001002 |
---|
| 60 | #define CMDID_NODE_TIME 0x001010 |
---|
| 61 | #define CMDID_NODE_CHANNEL 0x001011 |
---|
| 62 | #define CMDID_NODE_TX_POWER 0x001012 |
---|
| 63 | #define CMDID_NODE_TX_RATE 0x001013 |
---|
| 64 | #define CMDID_NODE_TX_ANT_MODE 0x001014 |
---|
| 65 | #define CMDID_NODE_RX_ANT_MODE 0x001015 |
---|
| 66 | #define CMDID_NODE_LOW_TO_HIGH_FILTER 0x001016 |
---|
| 67 | #define CMDID_NODE_RANDOM_SEED 0x001017 |
---|
| 68 | #define CMDID_NODE_LOW_PARAM 0x001020 |
---|
| 69 | |
---|
| 70 | #define CMD_PARAM_WRITE_VAL 0x00000000 |
---|
| 71 | #define CMD_PARAM_READ_VAL 0x00000001 |
---|
| 72 | #define CMD_PARAM_RSVD 0xFFFFFFFF |
---|
| 73 | |
---|
| 74 | #define CMD_PARAM_SUCCESS 0x00000000 |
---|
| 75 | #define CMD_PARAM_WARNING 0xF0000000 |
---|
| 76 | #define CMD_PARAM_ERROR 0xFF000000 |
---|
| 77 | |
---|
| 78 | #define CMD_PARAM_TXPARAM_MASK_DATA 0x00000001 |
---|
| 79 | #define CMD_PARAM_TXPARAM_MASK_MGMT 0x00000002 |
---|
| 80 | #define CMD_PARAM_TXPARAM_MASK_CTRL 0x00000004 |
---|
| 81 | |
---|
| 82 | #define CMD_PARAM_TXPARAM_ADDR_NONE 0x00000000 |
---|
| 83 | #define CMD_PARAM_TXPARAM_ADDR_ALL_UNICAST 0x00000001 |
---|
| 84 | #define CMD_PARAM_TXPARAM_ADDR_ALL_MULTICAST 0x00000002 |
---|
| 85 | #define CMD_PARAM_TXPARAM_ADDR_ALL 0x00000003 |
---|
| 86 | #define CMD_PARAM_TXPARAM_ADDR_SINGLE 0x00000004 |
---|
| 87 | |
---|
| 88 | #define CMD_PARAM_NODE_CONFIG_ALL 0xFFFFFFFF |
---|
| 89 | |
---|
| 90 | #define CMD_PARAM_NODE_RESET_FLAG_LOG 0x00000001 |
---|
| 91 | #define CMD_PARAM_NODE_RESET_FLAG_TXRX_COUNTS 0x00000002 |
---|
| 92 | #define CMD_PARAM_NODE_RESET_FLAG_LTG 0x00000004 |
---|
| 93 | #define CMD_PARAM_NODE_RESET_FLAG_TX_DATA_QUEUE 0x00000008 |
---|
| 94 | #define CMD_PARAM_NODE_RESET_FLAG_BSS 0x00000010 |
---|
| 95 | #define CMD_PARAM_NODE_RESET_FLAG_NETWORK_LIST 0x00000020 |
---|
| 96 | |
---|
| 97 | #define CMD_PARAM_NODE_CONFIG_FLAG_DSSS_ENABLE 0x00000001 |
---|
| 98 | #define CMD_PARAM_NODE_CONFIG_FLAG_BEACON_TIME_UPDATE 0x00000002 |
---|
| 99 | #define CMD_PARAM_NODE_CONFIG_FLAG_ETH_PORTAL 0x00000004 |
---|
| 100 | #define CMD_PARAM_NODE_CONFIG_SET_WLAN_EXP_PRINT_LEVEL 0x80000000 |
---|
| 101 | |
---|
| 102 | #define CMD_PARAM_NODE_TIME_ADD_TO_LOG_VAL 0x00000002 |
---|
| 103 | #define CMD_PARAM_NODE_TIME_RSVD_VAL 0xFFFFFFFF |
---|
| 104 | #define CMD_PARAM_NODE_TIME_RSVD_VAL_64 0xFFFFFFFFFFFFFFFF |
---|
| 105 | |
---|
| 106 | #define CMD_PARAM_NODE_TX_POWER_LOW 0x00000010 |
---|
| 107 | #define CMD_PARAM_NODE_TX_POWER_ALL 0x00000020 |
---|
| 108 | |
---|
| 109 | #define CMD_PARAM_NODE_TX_ANT_ALL 0x00000010 |
---|
| 110 | |
---|
| 111 | #define CMD_PARAM_RSVD_CHANNEL 0x00000000 |
---|
| 112 | #define CMD_PARAM_RSVD_MAC_ADDR 0x00000000 |
---|
| 113 | |
---|
| 114 | #define CMD_PARAM_RANDOM_SEED_VALID 0x00000001 |
---|
| 115 | #define CMD_PARAM_RANDOM_SEED_RSVD 0xFFFFFFFF |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | //----------------------------------------------- |
---|
| 119 | // LTG Commands |
---|
| 120 | // |
---|
| 121 | #define CMDID_LTG_CONFIG 0x002000 |
---|
| 122 | #define CMDID_LTG_START 0x002001 |
---|
| 123 | #define CMDID_LTG_STOP 0x002002 |
---|
| 124 | #define CMDID_LTG_REMOVE 0x002003 |
---|
| 125 | #define CMDID_LTG_STATUS 0x002004 |
---|
| 126 | |
---|
| 127 | #define CMD_PARAM_LTG_ERROR 0x000001 |
---|
| 128 | |
---|
| 129 | #define CMD_PARAM_LTG_CONFIG_FLAG_AUTOSTART 0x00000001 |
---|
| 130 | |
---|
| 131 | #define CMD_PARAM_LTG_ALL_LTGS LTG_ID_INVALID |
---|
| 132 | |
---|
| 133 | #define CMD_PARAM_LTG_RUNNING 0x00000001 |
---|
| 134 | #define CMD_PARAM_LTG_STOPPED 0x00000000 |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | //----------------------------------------------- |
---|
| 138 | // Log Commands |
---|
| 139 | // |
---|
| 140 | #define CMDID_LOG_CONFIG 0x003000 |
---|
| 141 | #define CMDID_LOG_GET_STATUS 0x003001 |
---|
| 142 | #define CMDID_LOG_GET_CAPACITY 0x003002 |
---|
| 143 | #define CMDID_LOG_GET_ENTRIES 0x003003 |
---|
| 144 | #define CMDID_LOG_ADD_EXP_INFO_ENTRY 0x003004 |
---|
| 145 | |
---|
| 146 | #define CMD_PARAM_LOG_GET_ALL_ENTRIES 0xFFFFFFFF |
---|
| 147 | |
---|
| 148 | #define CMD_PARAM_LOG_CONFIG_FLAG_LOGGING 0x00000001 |
---|
| 149 | #define CMD_PARAM_LOG_CONFIG_FLAG_WRAP 0x00000002 |
---|
| 150 | #define CMD_PARAM_LOG_CONFIG_FLAG_PAYLOADS 0x00000004 |
---|
| 151 | #define CMD_PARAM_LOG_CONFIG_FLAG_TXRX_MPDU 0x00000008 |
---|
| 152 | #define CMD_PARAM_LOG_CONFIG_FLAG_TXRX_CTRL 0x00000010 |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | //----------------------------------------------- |
---|
| 156 | // Queue Commands |
---|
| 157 | // |
---|
| 158 | #define CMDID_QUEUE_PURGE_ALL_WIRELESS_TX 0x005000 |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | //----------------------------------------------- |
---|
| 162 | // Scan Commands |
---|
| 163 | // |
---|
| 164 | #define CMDID_NODE_SCAN_PARAM 0x006000 |
---|
| 165 | #define CMDID_NODE_SCAN 0x006001 |
---|
| 166 | |
---|
| 167 | #define CMD_PARAM_NODE_SCAN_ENABLE 0x00000001 |
---|
| 168 | #define CMD_PARAM_NODE_SCAN_DISABLE 0x00000000 |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | //----------------------------------------------- |
---|
| 172 | // Association Commands |
---|
| 173 | // |
---|
| 174 | #define CMDID_NODE_GET_BSS_MEMBERS 0x007001 |
---|
| 175 | #define CMDID_NODE_GET_NETWORK_INFO 0x007002 |
---|
| 176 | #define CMDID_NODE_GET_STATION_INFO_LIST 0x007003 |
---|
| 177 | |
---|
| 178 | #define CMDID_NODE_DISASSOCIATE 0x007010 |
---|
| 179 | #define CMDID_NODE_ASSOCIATE 0x007011 |
---|
| 180 | #define NODE_ASSOCIATE_ERROR_MEMORY 0x000001 |
---|
| 181 | #define NODE_ASSOCIATE_ERROR_TOO_MANY_ASSOC 0x000002 |
---|
| 182 | |
---|
| 183 | |
---|
| 184 | //----------------------------------------------- |
---|
| 185 | // Development Commands |
---|
| 186 | // |
---|
| 187 | #define CMDID_DEV_MEM_HIGH 0xFFF000 |
---|
| 188 | #define CMDID_DEV_MEM_LOW 0xFFF001 |
---|
| 189 | #define CMDID_DEV_EEPROM 0xFFF002 |
---|
| 190 | |
---|
| 191 | /*********************** Global Structure Definitions ************************/ |
---|
| 192 | typedef struct wlan_exp_node_info_t { |
---|
| 193 | u32 platform_id; // Platform ID, unique integer assigned to each supported hardware platform |
---|
| 194 | u32 platform_config; // Platform config flags, values are platform-specific |
---|
| 195 | u32 serial_number; // Numeric part of node serial number, full serial number format is platform-specific |
---|
| 196 | u32 wlan_exp_version; // Version of wlan_exp code running on node |
---|
| 197 | u32 node_id; // Node ID for wlan_exp transport messages, typically assigned during wlan_exp init handshake |
---|
| 198 | u8 wlan_mac_addr[MAC_ADDR_LEN]; // MAC address of node's wireless interface |
---|
| 199 | u8 high_sw_id; // ID for MAC software application in CPU High |
---|
| 200 | u8 low_sw_id; // ID for MAC software application in CPU Low |
---|
| 201 | u32 high_sw_config; // Config flags for high MAC aplication/framework |
---|
| 202 | u32 low_sw_config; // Config flags for low MAC aplication/framework |
---|
| 203 | u16 wlan_exp_eth_mtu; // MTU in bytes of wlan_exp Ethernet interface |
---|
| 204 | u16 scheduler_interval; // Minimum interval for scheduled events, in usec |
---|
| 205 | char high_compilation_date[12]; // Compilation date string for high application |
---|
| 206 | char high_compilation_time[12]; // Compilation time string for high application |
---|
| 207 | char low_compilation_date[12]; // Compilation date string for low application |
---|
| 208 | char low_compilation_time[12]; // Compilation time string for low application |
---|
| 209 | } __attribute__((__packed__)) wlan_exp_node_info_t; |
---|
| 210 | ASSERT_TYPE_SIZE(wlan_exp_node_info_t, 88); |
---|
| 211 | |
---|
| 212 | /*************************** Function Prototypes *****************************/ |
---|
| 213 | #if WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|
| 214 | |
---|
| 215 | // Initialization Commands |
---|
| 216 | int wlan_exp_node_init(); |
---|
| 217 | int wlan_exp_process_eth_rx(struct eth_rx_queue_buffer_t* eth_rx_queue_buffer); |
---|
| 218 | void wlan_exp_node_set_type_high(application_role_t application_role, char* date, char* time); |
---|
| 219 | void wlan_exp_node_set_type_low(u32 sw_id, char* date, char* time); |
---|
| 220 | int process_msg_from_host(struct wlan_exp_eth_rx_queue_buffer_t* wlan_exp_eth_rx_queue_buffer, struct eth_tx_queue_buffer_t* eth_tx_queue_buffer); |
---|
| 221 | |
---|
| 222 | // Callbacks |
---|
| 223 | void wlan_exp_reset_all_callbacks (); |
---|
| 224 | void wlan_exp_set_process_node_cmd_callback (void(*callback)()); |
---|
| 225 | void wlan_exp_set_purge_all_wireless_tx_queue_callback (void(*callback)()); |
---|
| 226 | void wlan_exp_set_process_user_cmd_callback (void(*callback)()); |
---|
| 227 | void wlan_exp_set_beacon_ts_update_mode_callback (void(*callback)()); |
---|
| 228 | void wlan_exp_set_process_config_bss_callback (void(*callback)()); |
---|
| 229 | void wlan_exp_set_active_network_info_getter_callback (void(*callback)()); |
---|
| 230 | |
---|
| 231 | wlan_exp_node_info_t* wlan_exp_get_node_info(); |
---|
| 232 | void wlan_exp_add_u32_resp_arg(struct eth_tx_queue_buffer_t* eth_tx_queue_buffer, struct cmd_resp_hdr_t* resp_hdr, u32 arg); |
---|
| 233 | |
---|
| 234 | #endif //WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | #endif /* WLAN_EXP_NODE_H_ */ |
---|