source: svn/trunk/newcon3bcm2_21bu/magnum/basemodules/dbg/bdbg_app.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 7.7 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2010, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bdbg_app.h $
11 * $brcm_Revision: Hydra_Software_Devel/1 $
12 * $brcm_Date: 7/7/10 10:49a $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/basemodules/dbg/bdbg_app.h $
19 *
20 * Hydra_Software_Devel/1   7/7/10 10:49a vsilyaev
21 * SW7420-867: Application interface to the debug module
22 *
23 ***************************************************************************/
24
25#ifndef BDBG_APP_H
26#define BDBG_APP_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#if BDBG_DEBUG_BUILD
33
34/***************************************************************************
35Summary:
36    Set the instance debug level.
37
38Description:
39    Set debug level for the module instance.
40
41Input:
42    handle - the module instance
43    level - new debug level
44
45Returns:
46    BERR_SUCCESS - instance has been registered
47    BERR_INVALID_PARAMETER - unknown instance
48****************************************************************************/
49BERR_Code BDBG_SetInstanceLevel(BDBG_Instance handle, BDBG_Level level);
50
51/***************************************************************************
52Summary:
53    Get the instance debug level.
54
55Description:
56    Get current debug level for the module instance.
57
58Input:
59    handle - the module instance
60
61Output:
62    level - current debug level
63
64Returns:
65    BERR_SUCCESS - instance has been registered
66    BERR_INVALID_PARAMETER - unknown instance
67****************************************************************************/
68BERR_Code BDBG_GetInstanceLevel(BDBG_Instance handle, BDBG_Level *level);
69
70/***************************************************************************
71Summary:
72    Set the instance name.
73
74Description:
75    Set name for the module instance.
76
77Input:
78    handle - the module instance
79    new - name for the module instance
80
81Returns:
82    BERR_SUCCESS - instance has been registered
83    BERR_INVALID_PARAMETER - unknown instance
84****************************************************************************/
85BERR_Code BDBG_SetInstanceName(BDBG_Instance handle, const char *name);
86
87/***************************************************************************
88Summary:
89    Set the module debug level.
90
91Description:
92    Set debug level for the module.
93
94Input:
95    name - the module or module:instance name
96    level - new debug level
97
98Returns:
99    BERR_SUCCESS - the module debug level has been set
100    BERR_INVALID_PARAMETER - unknown module
101****************************************************************************/
102BERR_Code BDBG_SetModuleLevel(const char *name, BDBG_Level level);
103
104/***************************************************************************
105Summary:
106    Get module debug level.
107
108Description:
109    Get current debug level for the module.
110
111Input:
112    name - the module or module:instance name
113    level - new debug level
114
115Returns:
116    BERR_SUCCESS - the module debug level has been returned
117    BERR_INVALID_PARAMETER - unknown module
118****************************************************************************/
119BERR_Code BDBG_GetModuleLevel(const char *name, BDBG_Level *level);
120
121/***************************************************************************
122Summary:
123    Get the module's instance debug level.
124
125Description:
126    Get current debug level for the module's instance.
127
128Input:
129    name - the module name
130    handle - the module instance
131
132Output:
133    level - current debug level
134
135Returns:
136    BERR_SUCCESS - instance has been registered
137    BERR_INVALID_PARAMETER - unknown instance
138****************************************************************************/
139BERR_Code BDBG_GetModuleInstanceLevel(const char *name, BDBG_Instance handle, BDBG_Level *level);
140
141/***************************************************************************
142Summary:
143    Set the module's instance debug level.
144
145Description:
146    Set debug level for the module's instance.
147
148Input:
149    name - the module name
150    handle - the instance
151    level - new debug level
152
153Returns:
154    BERR_SUCCESS - the module debug level has been set
155    BERR_INVALID_PARAMETER - unknown module
156****************************************************************************/
157BERR_Code BDBG_SetModuleInstanceLevel(const char *name, BDBG_Instance handle, BDBG_Level level);
158
159/***************************************************************************
160Summary:
161    Set global debug level.
162
163Description:
164    Set the global debug level.
165
166Input:
167    level - new debug level
168
169Returns:
170    BERR_SUCCESS - global debug level has been set
171****************************************************************************/
172BERR_Code BDBG_SetLevel(BDBG_Level level);
173
174/***************************************************************************
175Summary:
176    Get the global debug level.
177
178Description:
179    Return the global debug level.
180
181Input:
182    <none>
183
184Output:
185    level - current global debug level
186
187Returns:
188    BERR_SUCCESS - current debug level has been retrieved
189****************************************************************************/
190BERR_Code BDBG_GetLevel(BDBG_Level *level);
191
192/***************************************************************************
193Summary:
194    Enumerates debug modules
195
196Description:
197    This function is used to enumerate all modules that are
198        to the debug subsystem. Module becomes known to the debug subsystem
199        after it was used any of following primitives:
200        BDBG_ENTER, BDBG_LEAVE, BDBG_MSG,  BDBG_WRN, BDBG_ERR
201        or debug modules was accessed using by BDBG_SetModuleLevel
202        BDBG_GetModuleLevel functions.
203
204Input:
205    callback - callback function that is called for each module and instance
206        cntx - user specified context that would be passed into the callback function
207
208Output:
209    None
210
211Returns:
212    None
213****************************************************************************/
214void BDBG_EnumerateAll(void (*callback)(void *cntx, const char *module, BDBG_Instance instance, const char *inst_name), void *cntx);
215
216
217/***************************************************************************
218Summary:
219    Set function to receive output the module;
220
221Description:
222    Set function that would receive all debug output generated by the module. Setting this
223    function would not affect debug output that directed to usual output channel.
224    If module_print
225
226Input:
227    name - the module or module:instance name
228    module_print - function that would receive all debug output generated by the module
229
230Returns:
231    BERR_SUCCESS - the module debug level has been set
232    BERR_INVALID_PARAMETER - unknown module
233****************************************************************************/
234BERR_Code BDBG_SetModulePrintFunction(const char *name, BDBG_DebugModule_Print module_print);
235
236#else /* BDBG_DEBUG_BUILD */
237
238#define BDBG_SetLevel(level)  (BERR_SUCCESS)
239#define BDBG_GetLevel(pLevel) (*(pLevel) = BDBG_eMsg, BERR_SUCCESS)
240#define BDBG_SetModuleLevel(module, level)  (BERR_SUCCESS)
241#define BDBG_EnumerateAll(callback, cntx) BDBG_NOP()
242#define BDBG_GetModuleLevel(module, pLevel) (*(pLevel) = BDBG_eMsg, BERR_SUCCESS)
243#define BDBG_SetModuleInstanceLevel(module, handle, level) (BERR_SUCCESS)
244#define BDBG_GetModuleInstanceLevel(module, handle, pLevel) (*(pLevel) = BDBG_eMsg, BERR_SUCCESS)
245#define BDBG_SetInstanceLevel(handle, level) (BERR_SUCCESS)
246#define BDBG_GetInstanceLevel(handle, pLevel) (*(pLevel) = BDBG_eMsg, BERR_SUCCESS)
247#define BDBG_SetInstanceName(handle, name) (BERR_SUCCESS)
248#endif /* BDBG_DEBUG_BUILD */
249
250#ifdef __cplusplus
251}
252#endif
253
254#endif /* BDBG_APP_H */
255
Note: See TracBrowser for help on using the repository browser.