/** @file wlan_exp_common.h * @brief Experiment Framework (Common) * * This contains the code for WLAN Experimental Framework. * * @copyright Copyright 2013-2019, Mango Communications. All rights reserved. * Distributed under the Mango Communications Reference Design License * See LICENSE.txt included in the design archive or * at http://mangocomm.com/802.11/license * * This file is part of the Mango 802.11 Reference Design (https://mangocomm.com/802.11) */ /*************************** Constant Definitions ****************************/ #ifndef WLAN_EXP_COMMON_H_ #define WLAN_EXP_COMMON_H_ /***************************** Include Files *********************************/ #include "wlan_mac_high_sw_config.h" #include "xil_types.h" #include "wlan_common_types.h" #include "wlan_high_types.h" // Forward declarations struct pkt_queue_buffer_t; // ********************************************************************** // WLAN Experiment Controls // // NOTE: These are the most common parameters that would be modified by a user: // 1) Debug print level // 2) DDR initialization // 3) Ethernet controls // 4) Timeouts // // 1) Choose the default debug print level // // Values (see below for more information): // WLAN_EXP_PRINT_NONE - Print WLAN_EXP_PRINT_NONE messages // WLAN_EXP_PRINT_ERROR - Print WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages // WLAN_EXP_PRINT_WARNING - Print WLAN_EXP_PRINT_WARNING, WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages // WLAN_EXP_PRINT_INFO - Print WLAN_EXP_PRINT_INFO, WLAN_EXP_PRINT_WARNING, WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages // WLAN_EXP_PRINT_DEBUG - Print WLAN_EXP_PRINT_DEBUG, WLAN_EXP_PRINT_INFO, WLAN_EXP_PRINT_WARNING, WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages // #define WLAN_EXP_DEFAULT_DEBUG_PRINT_LEVEL WLAN_EXP_PRINT_WARNING // 3) Ethernet controls // // a) Choose the Ethernet device and set the base address for the subnet: // // Values for WLAN_EXP_DEFAULT_IP_ADDR: // 0xAABBCC00 - Hexadecimal representation of an IP subnet: AA.BB.CC.00 // where AA, BB, and CC are hexadecimal numbers. // // NOTE: IP subnet should match the host networking setup // #define WLAN_EXP_DEFAULT_IP_ADDR 0x0a000000 // 10.0.0.x #define WLAN_EXP_DEFAULT_UDP_UNICAST_PORT 9500 #define WLAN_EXP_DEFAULT_UDP_MULTICAST_PORT 9750 // b) Default maximum words supported by the packet // // NOTE: By default, the node will only use ~60% of a standard MTU packet #define WLAN_EXP_DEFAULT_MAX_PACKET_WORDS 240 // 4) Timeouts // // a) Timeout when requesting data from CPU Low // // Values of WLAN_EXP_CPU_LOW_DATA_REQ_TIMEOUT (in microseconds): // [1 - 1000000] - Number of microseconds before timing out on a data request from CPU Low // // NOTE: By default the host transport timeout is 1 second so the value of this timeout should be // somewhere between 1 usec and 1 sec. The reference design will set this timeout to be 0.5 sec // by default. This is used when requesting data from CPU low through: wlan_mac_high_read_low_mem() // and wlan_mac_high_read_low_param(). // #define WLAN_EXP_CPU_LOW_DATA_REQ_TIMEOUT 500000 // ********************************************************************** // WLAN Exp print levels // #define WLAN_EXP_PRINT_NONE 0U #define WLAN_EXP_PRINT_ERROR 1U #define WLAN_EXP_PRINT_WARNING 2U #define WLAN_EXP_PRINT_INFO 3U #define WLAN_EXP_PRINT_DEBUG 4U #define wlan_exp_printf(level, type, format, args...) \ do { \ if ((u8)level <= (u8)wlan_exp_print_level) { \ wlan_exp_print_header(level, type, __FILE__, __LINE__); \ xil_printf(format, ##args); \ } \ } while (0) extern u8 wlan_exp_print_level; extern const char* print_type_node; extern const char* print_type_transport; extern const char* print_type_event_log; extern const char* print_type_counts; extern const char* print_type_ltg; extern const char* print_type_queue; // ********************************************************************** // WLAN Exp Common Defines // #define RESP_SENT 1 #define NO_RESP_SENT 0 #define CMD_TO_GROUP(x) ((x) >> 24) #define CMD_TO_CMDID(x) ((x) & 0xFFFFFF) #define WLAN_EXP_FALSE 0 #define WLAN_EXP_TRUE 1 #define WLAN_EXP_DISABLE 0 #define WLAN_EXP_ENABLE 1 #define WLAN_EXP_NO_TRANSMIT 0 #define WLAN_EXP_TRANSMIT 1 #define WLAN_EXP_SILENT 0 #define WLAN_EXP_VERBOSE 1 // ********************************************************************** // Command Group defines // #define GROUP_NODE 0x00 #define GROUP_TRANSPORT 0x10 #define GROUP_USER 0x20 /*********************** Global Structure Definitions ************************/ // // Message Structures // // Command / Response Header // typedef struct cmd_resp_hdr_t{ u32 cmd; // Unique CMD ID that is used for interpreting the arguments that follow this struct u16 length; // Number of bytes that follow this struct u16 num_u32_args; // Number of u32 arguments that follow this struct // Note: the "length" includes "num_u32_args", but may also account for payloads // that are not u32 arguments (e.g. log data) } cmd_resp_hdr_t; /*************************** Function Prototypes *****************************/ #if WLAN_SW_CONFIG_ENABLE_WLAN_EXP // Initialization Functions // Callbacks int wlan_exp_null_callback(void* param); // Printing Functions void wlan_exp_print_header(u8 level, const char* type, char* filename, u32 line); void wlan_exp_print_mac_address(u8 level, u8* mac_address); void wlan_exp_set_print_level(u8 level); // WLAN Exp specific functions void wlan_exp_get_mac_addr(u32* src, u8* dest); #endif //WLAN_SW_CONFIG_ENABLE_WLAN_EXP #endif /* WLAN_EXP_COMMON_H_ */