blob: a0c32f79ac7643df3cb2dd0c1e0a8f4d9e8e2058 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Daram Sudha1f7e0e92013-12-17 07:52:31 +05302 * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#if !defined( __VOS_TRACE_H )
29#define __VOS_TRACE_H
30
31/**=========================================================================
32
33 \file vos_trace.h
34
35 \brief virtual Operating System Servies (vOS)
36
37 Trace, logging, and debugging definitions and APIs
38
Jeff Johnson295189b2012-06-20 16:38:30 -070039 ========================================================================*/
40
41/* $Header$ */
42
43/*--------------------------------------------------------------------------
44 Include Files
45 ------------------------------------------------------------------------*/
46#include <vos_types.h> // For VOS_MODULE_ID...
47#include <stdarg.h> // For va_list...
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -070048#include <vos_status.h>
49#include <i_vos_types.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070050
51/*--------------------------------------------------------------------------
52 Type declarations
53 ------------------------------------------------------------------------*/
54
55typedef enum
56{
57 // NONE means NO traces will be logged. This value is in place for the
58 // vos_trace_setlevel() to allow the user to turn off all traces.
59 VOS_TRACE_LEVEL_NONE = 0,
60
61 // the following trace levels are the ones that 'callers' of VOS_TRACE()
62 // can specify in for the VOS_TRACE_LEVEL parameter. Traces are classified
63 // by severity (FATAL being more serious than INFO for example).
64 VOS_TRACE_LEVEL_FATAL,
65 VOS_TRACE_LEVEL_ERROR,
66 VOS_TRACE_LEVEL_WARN,
67 VOS_TRACE_LEVEL_INFO,
68 VOS_TRACE_LEVEL_INFO_HIGH,
69 VOS_TRACE_LEVEL_INFO_MED,
70 VOS_TRACE_LEVEL_INFO_LOW,
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -080071 VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson295189b2012-06-20 16:38:30 -070072
73 // ALL means all trace levels will be active. This value is in place for the
74 // vos_trace_setlevel() to allow the user to turn ON all traces.
75 VOS_TRACE_LEVEL_ALL,
76
77
78 // not a real level. Used to identify the maximum number of
79 // VOS_TRACE_LEVELs defined.
80 VOS_TRACE_LEVEL_MAX
81
82} VOS_TRACE_LEVEL;
83
Siddharth Bhalec0b72c2015-05-12 21:35:54 +053084enum {
85 LOG_PKT_TYPE_DATA_MGMT = 0x1,
86 LOG_PKT_TYPE_FW_LOG = 0x2
87};
88
Sachin Ahuja715aafc2015-07-21 23:35:10 +053089
90
91/* Log types. These types are defined in mailbox*/
92typedef enum
93{
94 WLAN_MGMT_FRAME_LOGS = 0,
95 WLAN_QXDM_LOGGING = 1,
96 WLAN_FW_MEMORY_DUMP = 2
97}FrameLoggingType;
98
99
Jeff Johnson295189b2012-06-20 16:38:30 -0700100/*--------------------------------------------------------------------------
101 Preprocessor definitions and constants
102 ------------------------------------------------------------------------*/
103#define ASSERT_BUFFER_SIZE ( 512 )
104
105// below definition is obsolete and is no longer being used in BMP and WM
106// TODO: remove this once this is not used on Android
107#define VOS_ENABLE_TRACING
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700108#define MAX_VOS_TRACE_RECORDS 4000
109#define INVALID_VOS_TRACE_ADDR 0xffffffff
110#define DEFAULT_VOS_TRACE_DUMP_COUNT 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
112#include <i_vos_trace.h>
113
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700114#ifdef TRACE_RECORD
115
Daram Sudha1f7e0e92013-12-17 07:52:31 +0530116#define CASE_RETURN_STRING( str ) \
117 case ( ( str ) ): return( (tANI_U8*)(#str) );
118
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700119#define MTRACE(p) p
120#define NO_SESSION 0xFF
121
122#else
123#define MTRACE(p) { }
124
125#endif
126
127/*--------------------------------------------------------------------------
128 Structure definition
129 ------------------------------------------------------------------------*/
130typedef struct svosTraceRecord
131{
132 v_U32_t time;
133 v_U8_t module;
134 v_U8_t code;
135 v_U8_t session;
136 v_U32_t data;
137}tvosTraceRecord, *tpvosTraceRecord;
138
139typedef struct svosTraceData
140{
141 // MTRACE logs are stored in ring buffer where head represents the position
142 // of first record, tail represents the position of last record added till
143 // now and num is the count of total record added.
144 v_U32_t head;
145 v_U32_t tail;
146 v_U32_t num;
147 v_U16_t numSinceLastDump;
148
149 //Config for controlling the trace
150 v_U8_t enable;
151 v_U16_t dumpCount; //will dump after number of records reach this number.
152
153}tvosTraceData;
154
155
Jeff Johnson295189b2012-06-20 16:38:30 -0700156/*-------------------------------------------------------------------------
157 Function declarations and documenation
158 ------------------------------------------------------------------------*/
159
160
161/*----------------------------------------------------------------------------
162
163 \brief vos_trace_setLevel() - Set the trace level for a particular module
164
165 This is an external API that allows trace levels to be set for each module.
166
167 \param level - trace level. A member of the VOS_TRACE_LEVEL
168 enumeration indicating the severity of the condition causing the
169 trace message to be issued. More severe conditions are more
170 likely to be logged.
171
172 \return nothing
173
174 \sa
175 --------------------------------------------------------------------------*/
176void vos_trace_setLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level );
177
178/**----------------------------------------------------------------------------
179
180 \brief vos_trace_getLevel() - Get the trace level
181
182 This is an external API that returns a boolean value to signify if a
183 particular trace level is set for the specified module.
184
185 \param level - trace level. A member of the VOS_TRACE_LEVEL enumeration
186 indicating the severity of the condition causing the trace
187 message to be issued.
188
189 Note that individual trace levels are the only valid values
190 for this API. VOS_TRACE_LEVEL_NONE and VOS_TRACE_LEVEL_ALL
191 are not valid input and will return FALSE
192
193 \return VOS_FALSE - the specified trace level for the specified module is OFF
194
195 VOS_TRUE - the specified trace level for the specified module is ON
196
197 \sa vos_trace_setLevel()
198 --------------------------------------------------------------------------*/
199v_BOOL_t vos_trace_getLevel( VOS_MODULE_ID module, VOS_TRACE_LEVEL level );
200
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700201typedef void (*tpvosTraceCb) (void *pMac, tpvosTraceRecord, v_U16_t);
202void vos_trace(v_U8_t module, v_U8_t code, v_U8_t session, v_U32_t data);
203void vosTraceRegister(VOS_MODULE_ID, tpvosTraceCb);
204VOS_STATUS vos_trace_spin_lock_init(void);
205void vosTraceInit(void);
Katya Nigamc2f29dc2014-01-20 19:29:30 +0530206void vosTraceEnable(v_U32_t, v_U8_t enable);
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700207void vosTraceDumpAll(void*, v_U8_t, v_U8_t, v_U32_t, v_U32_t);
Jeff Johnson295189b2012-06-20 16:38:30 -0700208#endif