blob: 03daccdaf9fca6e5b1baad5c450ebef16d9783de [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam988a5522014-02-19 01:15:45 -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.
Kiet Lam26cd6472014-02-11 23:30:06 -080020 */
Kiet Lam988a5522014-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( __WLAN_QCT_OS_TRACE_H )
29#define __WLAN_QCT_OS_TRACE_H
30
Madan Mohan Koyyalamudi6ed07b72013-08-20 19:15:47 +053031#include <vos_trace.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070032
Jeff Johnson48a8f3e2013-11-11 12:10:25 -080033#if !defined(__printf)
34#define __printf(a,b)
35#endif
36
Jeff Johnson295189b2012-06-20 16:38:30 -070037#ifdef WLAN_DEBUG
38
39/**----------------------------------------------------------------------------
40
41 \brief WPAL_TRACE() / wpalTrace() - Trace / logging API
42
43 Users wishing to add tracing information to their code should use
44 WPAL_TRACE. WPAL_TRACE() will compile into a call to wpalTrace() when
45 tracing is enabled.
46
47 \param module - module identifier. A member of the wpt_moduleid
48 enumeration that identifies the module issuing the trace message.
49
50 \param level - trace level. A member of the wpt_tracelevel
51 enumeration indicating the severity of the condition causing the
52 trace message to be issued. More severe conditions are more
53 likely to be logged.
54
55 \param strFormat - format string. The message to be logged. This format
56 string contains printf-like replacement parameters, which follow
57 this parameter in the variable argument list.
58
59 \return nothing
60
61 --------------------------------------------------------------------------*/
Jeff Johnson48a8f3e2013-11-11 12:10:25 -080062void __printf(3,4) wpalTrace( wpt_moduleid module, wpt_tracelevel level,
63 char *strFormat, ... );
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65/**----------------------------------------------------------------------------
66
67 \brief WPAL_DUMP() / wpalDump() - Trace / logging API
68
69 Users wishing to add tracing memory dumps to their code should use
70 WPAL_DUMP. WPAL_DUMP() will compile into a call to wpalDump() when
71 tracing is enabled.
72
73 \param module - module identifier. A member of the wpt_moduleid
74 enumeration that identifies the module performing the dump
75
76 \param level - trace level. A member of the wpt_tracelevel
77 enumeration indicating the severity of the condition causing the
78 memory to be dumped. More severe conditions are more
79 likely to be logged.
80
81 \param pMemory - memory. A pointer to the memory to be dumped
82
83 \param length - length. How many bytes of memory to be dumped
84
85 \return nothing
86
87 --------------------------------------------------------------------------*/
88void wpalDump( wpt_moduleid module, wpt_tracelevel level,
89 wpt_uint8 *memory, wpt_uint32 length);
90
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -080091#define WPAL_ASSERT( _condition ) do { \
92 if ( ! ( _condition ) ) \
93 { \
94 printk(KERN_CRIT "VOS ASSERT in %s Line %d\n", __func__, __LINE__); \
95 WARN_ON(1); \
96 } \
97 } while (0)
Jeff Johnson295189b2012-06-20 16:38:30 -070098#else //WLAN_DEBUG
99
Gopichand Nakkala9846ac42013-06-20 19:03:52 +0530100static inline void wpalTrace( wpt_moduleid module, wpt_tracelevel level,
101 char *strFormat, ... ){};
102static inline void wpalDump( wpt_moduleid module, wpt_tracelevel level,
103 wpt_uint8 *memory, wpt_uint32 length) {};
104static inline void wpalTraceSetLevel( wpt_moduleid module,
105 wpt_tracelevel level, wpt_boolean on ) {};
106static inline void wpalTraceDisplay(void) {};
107#define WPAL_ASSERT(x) do {} while (0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700108
109#endif //WLAN_DEBUG
110
Gopichand Nakkala9846ac42013-06-20 19:03:52 +0530111#define WPAL_TRACE wpalTrace
112#define WPAL_DUMP wpalDump
113
Jeff Johnson295189b2012-06-20 16:38:30 -0700114#endif // __WLAN_QCT_OS_TRACE_H