source: ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/include/wlan_exp_common.h

Last change on this file was 6319, checked in by chunter, 5 years ago

1.8.0 release wlan-mac-se

File size: 6.8 KB
RevLine 
[6319]1/** @file wlan_exp_common.h
2 *  @brief Experiment Framework (Common)
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/*************************** Constant Definitions ****************************/
16#ifndef WLAN_EXP_COMMON_H_
17#define WLAN_EXP_COMMON_H_
18
19/***************************** Include Files *********************************/
20#include "wlan_mac_high_sw_config.h"
21#include "xil_types.h"
22#include "wlan_common_types.h"
23#include "wlan_high_types.h"
24
25// Forward declarations
26struct pkt_queue_buffer_t;
27
28
29// **********************************************************************
30// WLAN Experiment Controls
31//
32//   NOTE:  These are the most common parameters that would be modified by a user:
33//       1) Debug print level
34//       2) DDR initialization
35//       3) Ethernet controls
36//       4) Timeouts
37//
38
39
40// 1) Choose the default debug print level
41//
42//    Values (see below for more information):
43//        WLAN_EXP_PRINT_NONE      - Print WLAN_EXP_PRINT_NONE messages
44//        WLAN_EXP_PRINT_ERROR     - Print WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages
45//        WLAN_EXP_PRINT_WARNING   - Print WLAN_EXP_PRINT_WARNING, WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages
46//        WLAN_EXP_PRINT_INFO      - Print WLAN_EXP_PRINT_INFO, WLAN_EXP_PRINT_WARNING, WLAN_EXP_PRINT_ERROR and WLAN_EXP_PRINT_NONE messages
47//        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
48//
49#define WLAN_EXP_DEFAULT_DEBUG_PRINT_LEVEL                 WLAN_EXP_PRINT_WARNING
50
51// 3) Ethernet controls
52//
53//    a) Choose the Ethernet device and set the base address for the subnet:
54//
55//       Values for WLAN_EXP_DEFAULT_IP_ADDR:
56//           0xAABBCC00      - Hexadecimal representation of an IP subnet:  AA.BB.CC.00
57//                             where AA, BB, and CC are hexadecimal numbers.
58//
59//           NOTE:  IP subnet should match the host networking setup
60//
61#define WLAN_EXP_DEFAULT_IP_ADDR                           0x0a000000     // 10.0.0.x
62#define WLAN_EXP_DEFAULT_UDP_UNICAST_PORT                  9500
63#define WLAN_EXP_DEFAULT_UDP_MULTICAST_PORT                9750
64
65//    b) Default maximum words supported by the packet
66//
67//   NOTE:  By default, the node will only use ~60% of a standard MTU packet
68#define WLAN_EXP_DEFAULT_MAX_PACKET_WORDS                  240
69
70
71// 4) Timeouts
72//
73//    a) Timeout when requesting data from CPU Low
74//
75//       Values of WLAN_EXP_CPU_LOW_DATA_REQ_TIMEOUT (in microseconds):
76//           [1 - 1000000]   - Number of microseconds before timing out on a data request from CPU Low
77//
78//     NOTE:  By default the host transport timeout is 1 second so the value of this timeout should be
79//         somewhere between 1 usec and 1 sec.  The reference design will set this timeout to be 0.5 sec
80//         by default.  This is used when requesting data from CPU low through:  wlan_mac_high_read_low_mem()
81//         and wlan_mac_high_read_low_param().
82//
83#define WLAN_EXP_CPU_LOW_DATA_REQ_TIMEOUT                  500000
84
85
86
87// **********************************************************************
88// WLAN Exp print levels
89//
90#define WLAN_EXP_PRINT_NONE                      0U
91#define WLAN_EXP_PRINT_ERROR                     1U
92#define WLAN_EXP_PRINT_WARNING                   2U
93#define WLAN_EXP_PRINT_INFO                      3U
94#define WLAN_EXP_PRINT_DEBUG                     4U
95
96
97#define wlan_exp_printf(level, type, format, args...) \
98            do {  \
99                if ((u8)level <= (u8)wlan_exp_print_level) { \
100                    wlan_exp_print_header(level, type, __FILE__, __LINE__); \
101                    xil_printf(format, ##args); \
102                } \
103            } while (0)
104
105
106
107extern u8 wlan_exp_print_level;
108extern const char* print_type_node;
109extern const char* print_type_transport;
110extern const char* print_type_event_log;
111extern const char* print_type_counts;
112extern const char* print_type_ltg;
113extern const char* print_type_queue;
114
115
116
117// **********************************************************************
118// WLAN Exp Common Defines
119//
120#define RESP_SENT                                          1
121#define NO_RESP_SENT                                       0
122
123#define CMD_TO_GROUP(x)                                  ((x) >> 24)
124#define CMD_TO_CMDID(x)                                  ((x) & 0xFFFFFF)
125
126#define WLAN_EXP_FALSE                                     0
127#define WLAN_EXP_TRUE                                      1
128
129#define WLAN_EXP_DISABLE                                   0
130#define WLAN_EXP_ENABLE                                    1
131
132#define WLAN_EXP_NO_TRANSMIT                               0
133#define WLAN_EXP_TRANSMIT                                  1
134
135#define WLAN_EXP_SILENT                                    0
136#define WLAN_EXP_VERBOSE                                   1
137
138
139// **********************************************************************
140// Command Group defines
141//
142#define GROUP_NODE                                         0x00
143#define GROUP_TRANSPORT                                    0x10
144#define GROUP_USER                                         0x20
145
146
147
148/*********************** Global Structure Definitions ************************/
149//
150// Message Structures
151//
152
153// Command / Response Header
154//
155typedef struct cmd_resp_hdr_t{
156    u32 cmd;           // Unique CMD ID that is used for interpreting the arguments that follow this struct
157    u16 length;        // Number of bytes that follow this struct
158    u16 num_u32_args;  // Number of u32 arguments that follow this struct
159                       //  Note: the "length" includes "num_u32_args", but may also account for payloads
160                       //  that are not u32 arguments (e.g. log data)
161} cmd_resp_hdr_t;
162
163/*************************** Function Prototypes *****************************/
164#if WLAN_SW_CONFIG_ENABLE_WLAN_EXP
165
166// Initialization Functions
167
168// Callbacks
169int           wlan_exp_null_callback(void* param);
170
171// Printing Functions
172void          wlan_exp_print_header(u8 level, const char* type, char* filename, u32 line);
173void          wlan_exp_print_mac_address(u8 level, u8* mac_address);
174void          wlan_exp_set_print_level(u8 level);
175
176// WLAN Exp specific functions
177void          wlan_exp_get_mac_addr(u32* src, u8* dest);
178
179#endif //WLAN_SW_CONFIG_ENABLE_WLAN_EXP
180
181#endif /* WLAN_EXP_COMMON_H_ */
Note: See TracBrowser for help on using the repository browser.