blob: 0b631c6a2436149d028771f08e402dd5051b0f4c [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42
43#if !defined( __I_VOS_TRACE_H )
44#define __I_VOS_TRACE_H
45
46/**=========================================================================
47
48 \file i_vos_trace.h
49
50 \brief Linux-specific definitions for VOSS trace
51
52 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
53
54 Qualcomm Confidential and Proprietary.
55
56 ========================================================================*/
57
58/* $Header$ */
59
60/*--------------------------------------------------------------------------
61 Include Files
62 ------------------------------------------------------------------------*/
63
64/**----------------------------------------------------------------------------
65
66 \brief VOS_TRACE() / vos_trace_msg() - Trace / logging API
67
68 Users wishing to add tracing information to their code should use
69 VOS_TRACE. VOS_TRACE() will compile into a call to vos_trace_msg() when
70 tracing is enabled.
71
72 \param module - module identifier. A member of the VOS_MODULE_ID
73 enumeration that identifies the module issuing the trace message.
74
75 \param level - trace level. A member of the VOS_TRACE_LEVEL
76 enumeration indicating the severity of the condition causing the
77 trace message to be issued. More severe conditions are more
78 likely to be logged.
79
80 \param strFormat - format string. The message to be logged. This format
81 string contains printf-like replacement parameters, which follow
82 this parameter in the variable argument list.
83
84 \return nothing
85
86 --------------------------------------------------------------------------*/
87void vos_trace_msg( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, char *strFormat, ... );
88
89void vos_trace_display(void);
90
91void vos_trace_setValue( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, v_U8_t on );
92
93
94// VOS_TRACE is the macro invoked to add trace messages to code. See the
95// documenation for vos_trace_msg() for the parameters etc. for this function.
96//
97// NOTE: Code VOS_TRACE() macros into the source code. Do not code directly
98// to the vos_trace_msg() function.
99//
100// NOTE 2: vos tracing is totally turned off if WLAN_DEBUG is *not* defined.
101// This allows us to build 'performance' builds where we can measure performance
102// without being bogged down by all the tracing in the code.
103#if defined( WLAN_DEBUG )
104#define VOS_TRACE vos_trace_msg
105#else
106#define VOS_TRACE(arg...)
107#endif
108
109
110void vos_snprintf(char *strBuffer, unsigned int size, char *strFormat, ...);
111#define VOS_SNPRINTF vos_snprintf
112
113#ifdef VOS_ENABLE_TRACING
114
115
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800116#define VOS_ASSERT( _condition ) do { \
117 if ( ! ( _condition ) ) \
118 { \
119 printk(KERN_CRIT "VOS ASSERT in %s Line %d\n", __func__, __LINE__); \
120 WARN_ON(1); \
121 } \
122 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700123
124#else
125
126
127 // This code will be used for compilation if tracing is to be compiled out
128 // of the code so these functions/macros are 'do nothing'
129 VOS_INLINE_FN void vos_trace_msg( VOS_MODULE_ID module, ... ){}
130
131 #define VOS_ASSERT( _condition )
132
133#endif
134
135#ifdef PANIC_ON_BUG
136
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800137#define VOS_BUG( _condition ) do { \
138 if ( ! ( _condition ) ) \
139 { \
140 printk(KERN_CRIT "VOS BUG in %s Line %d\n", __func__, __LINE__); \
141 BUG_ON(1); \
142 } \
143 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
145#else
146
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800147#define VOS_BUG( _condition ) do { \
148 if ( ! ( _condition ) ) \
149 { \
150 printk(KERN_CRIT "VOS BUG in %s Line %d\n", __func__, __LINE__); \
151 WARN_ON(1); \
152 } \
153 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700154
155#endif
156
157#endif