1 | /** @file wlan_mac_event_log.h |
---|
2 | * @brief MAC Event Log Framework |
---|
3 | * |
---|
4 | * Contains code for logging MAC events in DRAM. |
---|
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 | |
---|
16 | |
---|
17 | /*************************** Constant Definitions ****************************/ |
---|
18 | #ifndef WLAN_MAC_EVENT_LOG_H_ |
---|
19 | #define WLAN_MAC_EVENT_LOG_H_ |
---|
20 | |
---|
21 | /***************************** Include Files *********************************/ |
---|
22 | #include "xil_types.h" |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | // **************************************************************************** |
---|
28 | // Define Event Log Constants |
---|
29 | // |
---|
30 | |
---|
31 | // Define default event logging state |
---|
32 | // '0' - Event logging is disabled on boot |
---|
33 | // '1' - Event logging is enabled on boot |
---|
34 | // |
---|
35 | #define EVENT_LOG_DEFAULT_LOGGING 1 |
---|
36 | |
---|
37 | |
---|
38 | // Define event logging enable / disable |
---|
39 | #define EVENT_LOG_LOGGING_ENABLE 1 |
---|
40 | #define EVENT_LOG_LOGGING_DISABLE 2 |
---|
41 | |
---|
42 | |
---|
43 | // Define event wrapping enable / disable |
---|
44 | #define EVENT_LOG_WRAP_ENABLE 1 |
---|
45 | #define EVENT_LOG_WRAP_DISABLE 2 |
---|
46 | |
---|
47 | |
---|
48 | // Define event wrap buffer |
---|
49 | // This is the number of additional bytes that the head address will be incremented |
---|
50 | // on each request. Currently, when the log wraps, the head address will stay just |
---|
51 | // ahead of the next address which will add overhead to the logging calls. This |
---|
52 | // will allow the head address to be incremented by an additional buffer so that |
---|
53 | // the head pointer will not have to increment as often. By default this is zero. |
---|
54 | // |
---|
55 | #define EVENT_LOG_WRAPPING_BUFFER 0 |
---|
56 | |
---|
57 | |
---|
58 | // Maximum number of events to store in log |
---|
59 | // A maximum event length of -1 is used to signal that the entire DRAM after the queue |
---|
60 | // should be used for logging events. If MAX_EVENT_LOG > 0, then that number of events |
---|
61 | // will be the maximum. |
---|
62 | // |
---|
63 | #define MAX_EVENT_LOG -1 |
---|
64 | |
---|
65 | |
---|
66 | // Define magic number that will indicate the start of an event |
---|
67 | // - Magic number was chose so that: |
---|
68 | // - It would not be in DDR address space |
---|
69 | // - It is human readable |
---|
70 | // |
---|
71 | #define EVENT_LOG_MAGIC_NUMBER 0xACED0000 |
---|
72 | |
---|
73 | |
---|
74 | // Define constants for function flags |
---|
75 | // NOTE: the transmit flag is defined in wlan_exp_common.h since it is used in multiple places |
---|
76 | #define EVENT_LOG_NO_COUNTS 0 |
---|
77 | #define EVENT_LOG_COUNTS 1 |
---|
78 | |
---|
79 | |
---|
80 | /*********************** Global Structure Definitions ************************/ |
---|
81 | |
---|
82 | //----------------------------------------------- |
---|
83 | // Log Entry Header |
---|
84 | // - This is used by the event log but is not exposed to the user |
---|
85 | // |
---|
86 | typedef struct entry_header{ |
---|
87 | u32 entry_id; |
---|
88 | u16 entry_type; |
---|
89 | u16 entry_length; |
---|
90 | } entry_header; |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | /*************************** Function Prototypes *****************************/ |
---|
95 | |
---|
96 | void event_log_init( char* start_address, u32 size ); |
---|
97 | |
---|
98 | void event_log_reset(); |
---|
99 | |
---|
100 | int event_log_config_wrap( u32 enable ); |
---|
101 | int event_log_config_logging( u32 enable ); |
---|
102 | |
---|
103 | u32 event_log_get_data( u32 start_index, u32 size, u8** address_ret ); |
---|
104 | u32 event_log_get_size( u32 start_index ); |
---|
105 | u32 event_log_get_total_size( void ); |
---|
106 | u32 event_log_get_capacity( void ); |
---|
107 | u32 event_log_get_next_entry_index( void ); |
---|
108 | u32 event_log_get_oldest_entry_index( void ); |
---|
109 | u32 event_log_get_num_wraps( void ); |
---|
110 | u32 event_log_get_flags( void ); |
---|
111 | void* event_log_get_next_empty_entry( u16 entry_type, u16 entry_size ); |
---|
112 | |
---|
113 | void print_event_log( u32 num_events ); |
---|
114 | void print_event_log_size(); |
---|
115 | |
---|
116 | #endif /* WLAN_MAC_EVENT_LOG_H_ */ |
---|