blob: 1ee1d483d5112b774fae847f1e025feb8ae4e0b4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
Jeff Johnson295189b2012-06-20 16:38:30 -07006#if !defined( __I_VOS_TRACE_H )
7#define __I_VOS_TRACE_H
8
Jeff Johnson40d09f72013-11-11 12:10:25 -08009#if !defined(__printf)
10#define __printf(a,b)
11#endif
12
Jeff Johnson295189b2012-06-20 16:38:30 -070013/**=========================================================================
14
15 \file i_vos_trace.h
16
17 \brief Linux-specific definitions for VOSS trace
18
19 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
20
21 Qualcomm Confidential and Proprietary.
22
23 ========================================================================*/
24
25/* $Header$ */
26
27/*--------------------------------------------------------------------------
28 Include Files
29 ------------------------------------------------------------------------*/
30
31/**----------------------------------------------------------------------------
32
33 \brief VOS_TRACE() / vos_trace_msg() - Trace / logging API
34
35 Users wishing to add tracing information to their code should use
36 VOS_TRACE. VOS_TRACE() will compile into a call to vos_trace_msg() when
37 tracing is enabled.
38
39 \param module - module identifier. A member of the VOS_MODULE_ID
40 enumeration that identifies the module issuing the trace message.
41
42 \param level - trace level. A member of the VOS_TRACE_LEVEL
43 enumeration indicating the severity of the condition causing the
44 trace message to be issued. More severe conditions are more
45 likely to be logged.
46
47 \param strFormat - format string. The message to be logged. This format
48 string contains printf-like replacement parameters, which follow
49 this parameter in the variable argument list.
50
51 \return nothing
52
53 --------------------------------------------------------------------------*/
Jeff Johnson40d09f72013-11-11 12:10:25 -080054void __printf(3,4) vos_trace_msg( VOS_MODULE_ID module, VOS_TRACE_LEVEL level,
55 char *strFormat, ... );
Jeff Johnson295189b2012-06-20 16:38:30 -070056
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +053057void vos_trace_hex_dump( VOS_MODULE_ID module, VOS_TRACE_LEVEL level,
58 void *data, int buf_len );
59
Jeff Johnson295189b2012-06-20 16:38:30 -070060void vos_trace_display(void);
61
62void vos_trace_setValue( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, v_U8_t on );
63
64
65// VOS_TRACE is the macro invoked to add trace messages to code. See the
66// documenation for vos_trace_msg() for the parameters etc. for this function.
67//
68// NOTE: Code VOS_TRACE() macros into the source code. Do not code directly
69// to the vos_trace_msg() function.
70//
71// NOTE 2: vos tracing is totally turned off if WLAN_DEBUG is *not* defined.
72// This allows us to build 'performance' builds where we can measure performance
73// without being bogged down by all the tracing in the code.
74#if defined( WLAN_DEBUG )
75#define VOS_TRACE vos_trace_msg
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +053076#define VOS_TRACE_HEX_DUMP vos_trace_hex_dump
Jeff Johnson295189b2012-06-20 16:38:30 -070077#else
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +053078#define VOS_TRACE(arg...)
79#define VOS_TRACE_HEX_DUMP(arg...)
Jeff Johnson295189b2012-06-20 16:38:30 -070080#endif
81
82
Jeff Johnson40d09f72013-11-11 12:10:25 -080083void __printf(3,4) vos_snprintf(char *strBuffer, unsigned int size,
84 char *strFormat, ...);
Jeff Johnson295189b2012-06-20 16:38:30 -070085#define VOS_SNPRINTF vos_snprintf
86
87#ifdef VOS_ENABLE_TRACING
88
89
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -080090#define VOS_ASSERT( _condition ) do { \
91 if ( ! ( _condition ) ) \
92 { \
93 printk(KERN_CRIT "VOS ASSERT in %s Line %d\n", __func__, __LINE__); \
94 WARN_ON(1); \
95 } \
96 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -070097
98#else
99
100
101 // This code will be used for compilation if tracing is to be compiled out
102 // of the code so these functions/macros are 'do nothing'
103 VOS_INLINE_FN void vos_trace_msg( VOS_MODULE_ID module, ... ){}
104
105 #define VOS_ASSERT( _condition )
106
107#endif
108
109#ifdef PANIC_ON_BUG
110
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800111#define VOS_BUG( _condition ) do { \
112 if ( ! ( _condition ) ) \
113 { \
114 printk(KERN_CRIT "VOS BUG in %s Line %d\n", __func__, __LINE__); \
115 BUG_ON(1); \
116 } \
117 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700118
119#else
120
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800121#define VOS_BUG( _condition ) do { \
122 if ( ! ( _condition ) ) \
123 { \
124 printk(KERN_CRIT "VOS BUG in %s Line %d\n", __func__, __LINE__); \
125 WARN_ON(1); \
126 } \
127 } while(0)
Jeff Johnson295189b2012-06-20 16:38:30 -0700128
129#endif
130
131#endif