Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 5 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6 | #if !defined( __I_VOS_TRACE_H ) |
| 7 | #define __I_VOS_TRACE_H |
| 8 | |
Jeff Johnson | 40d09f7 | 2013-11-11 12:10:25 -0800 | [diff] [blame] | 9 | #if !defined(__printf) |
| 10 | #define __printf(a,b) |
| 11 | #endif |
| 12 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13 | /**========================================================================= |
| 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 Johnson | 40d09f7 | 2013-11-11 12:10:25 -0800 | [diff] [blame] | 54 | void __printf(3,4) vos_trace_msg( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, |
| 55 | char *strFormat, ... ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | |
Madan Mohan Koyyalamudi | 99af06e | 2013-08-08 02:17:17 +0530 | [diff] [blame] | 57 | void vos_trace_hex_dump( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, |
| 58 | void *data, int buf_len ); |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | void vos_trace_display(void); |
| 61 | |
| 62 | void 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 Koyyalamudi | 99af06e | 2013-08-08 02:17:17 +0530 | [diff] [blame] | 76 | #define VOS_TRACE_HEX_DUMP vos_trace_hex_dump |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | #else |
Madan Mohan Koyyalamudi | 99af06e | 2013-08-08 02:17:17 +0530 | [diff] [blame] | 78 | #define VOS_TRACE(arg...) |
| 79 | #define VOS_TRACE_HEX_DUMP(arg...) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | #endif |
| 81 | |
| 82 | |
Jeff Johnson | 40d09f7 | 2013-11-11 12:10:25 -0800 | [diff] [blame] | 83 | void __printf(3,4) vos_snprintf(char *strBuffer, unsigned int size, |
| 84 | char *strFormat, ...); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 85 | #define VOS_SNPRINTF vos_snprintf |
| 86 | |
| 87 | #ifdef VOS_ENABLE_TRACING |
| 88 | |
| 89 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 90 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | |
| 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 Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 111 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | |
| 119 | #else |
| 120 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 121 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | |
| 129 | #endif |
| 130 | |
| 131 | #endif |