summaryrefslogtreecommitdiff
path: root/arch/arm/plat-omap/include/syslink/gt.h
blob: 95e3feb18e7b57c5eeb6664eda3356695725c6b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320

/*
 * gt.h
 *
 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
 *
 * Copyright (C) 2008 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */


/*
 *  ======== gt.h ========
 *  Purpose:
 *	There are two definitions that affect which portions of trace
 *	are acutally compiled into the client: GT_TRACE and GT_ASSERT. If
 *	GT_TRACE is set to 0 then all trace statements (except for assertions)
 *	will be compiled out of the client. If GT_ASSERT is set to 0 then
 *	assertions will be compiled out of the client. GT_ASSERT can not be
 *	set to 0 unless GT_TRACE is also set to 0 (i.e. GT_TRACE == 1 implies
 *	GT_ASSERT == 1).
 *
 *! Revision History
 *! ================
 *! 02-Feb-2000 rr:	Renamed this file to gtce.h. GT CLASS and trace
 *!			definitions are WinCE Specific.
 *! 03-Jan-1997	ge	Replaced "GT_" prefix to GT_Config structure members
 *!			to eliminate preprocessor confusion with other macros.
 */
#include <linux/types.h>
#ifndef GT_
#define GT_

#ifndef GT_TRACE
#define GT_TRACE 0	/* 0 = "trace compiled out"; 1 = "trace active" */
#endif

/* #include <syslink/host_os.h> */

typedef s32(*Fxn)();	/* generic function type */


#if !defined(GT_ASSERT) || GT_TRACE
#define GT_ASSERT 1
#endif

struct GT_Config {
	Fxn PRINTFXN;
	Fxn PIDFXN;
	Fxn TIDFXN;
	Fxn ERRORFXN;
};

extern struct GT_Config *GT;

struct gt_mask {
	char *modName;
	u8 *flags;
} ;

/*
 *  New GT Class defenitions.
 *
 *  The following are the explanations and how it could be used in the code
 *
 *  -   GT_ENTER	On Entry to Functions
 *
 *  -   GT_1CLASS	Display level of debugging status- Object/Automatic
 *			variables
 *  -   GT_2CLASS	---- do ----
 *
 *  -   GT_3CLASS	 ---- do ---- + It can be used(recommended) for debug
 *			status in the ISR, IST
 *  -   GT_4CLASS	---- do ----
 *
 *  -   GT_5CLASS	Display entry for module init/exit functions
 *
 *  -   GT_6CLASS	Warn whenever SERVICES function fails
 *
 *  -   GT_7CLASS	Warn failure of Critical failures
 *
 */

#define GT_ENTER	((u8)0x01)
#define GT_1CLASS	((u8)0x02)
#define GT_2CLASS	((u8)0x04)
#define GT_3CLASS	((u8)0x08)
#define GT_4CLASS	((u8)0x10)
#define GT_5CLASS	((u8)0x20)
#define GT_6CLASS	((u8)0x40)
#define GT_7CLASS	((u8)0x80)
#define GT_LEAVE	((u8)0x02)

#ifdef _LINT_

/* LINTLIBRARY */

/*
 *  ======== GT_assert ========
 */
/* ARGSUSED */
void GT_assert(struct gt_mask mask, s32 expr)
{
}

/*
 *  ======== GT_config ========
 */
/* ARGSUSED */
void GT_config(struct GT_Config config)
{
}

/*
 *  ======== GT_create ========
 */
/* ARGSUSED */
void GT_create(struct gt_mask *mask, char *modName)
{
}

/*
 *  ======== GT_curline ========
 *  Purpose:
 *	Returns the current source code line number. Is useful for performing
 *	branch testing using trace.  For example,
 *
 *	gt_1trace(curTrace, GT_1CLASS,
 *	  "in module XX_mod, executing line %u\n", GT_curline());
 */
/* ARGSUSED */
u16 GT_curline(void)
{
	return (u16)NULL;
}

/*
 *  ======== GT_exit ========
 */
/* ARGSUSED */
void GT_exit(void)
{
}

/*
 *  ======== GT_init ========
 */
/* ARGSUSED */
void GT_init(void)
{
}

/*
 *  ======== GT_query ========
 */
/* ARGSUSED */
bool GT_query(struct gt_mask mask, u8 class)
{
	return false;
}

/*
 *  ======== GT_set ========
 *  sets trace mask according to settings
 */

/* ARGSUSED */
void GT_set(char *settings)
{
}

/*
 *  ======== GT_setprintf ========
 *  sets printf function
 */

/* ARGSUSED */
void GT_setprintf(Fxn fxn)
{
}

/* ARGSUSED */
void gt_0trace(struct gt_mask mask, u8 class, char *format)
{
}

/* ARGSUSED */
void gt_1trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

/* ARGSUSED */
void gt_2trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

/* ARGSUSED */
void gt_3trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

/* ARGSUSED */
void gt_4trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

/* ARGSUSED */
void gt_5trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

/* ARGSUSED */
void GT_6trace(struct gt_mask mask, u8 class, char *format, ...)
{
}

#else

#define	GT_BOUND	26	/* 26 letters in alphabet */

extern void _GT_create(struct gt_mask *mask, char *modName);

#define GT_exit()

extern void GT_init(void);
extern void _GT_set(char *str);
extern s32 _GT_trace(struct gt_mask *mask, char *format, ...);

#if GT_ASSERT == 0

#define GT_assert(mask, expr)
#define GT_config(config)
#define GT_configInit(config)
#define GT_seterror(fxn)

#else

extern struct GT_Config _GT_params;

#define GT_assert(mask, expr) \
	(!(expr) ? \
		printk(KERN_ALERT "assertion violation: %s, line %d\n", \
				__FILE__, __LINE__), NULL : NULL)

#define GT_config(config)		(_GT_params = *(config))
#define GT_configInit(config)		(*(config) = _GT_params)
#define GT_seterror(fxn)		(_GT_params.ERRORFXN = (Fxn)(fxn))

#endif

#if GT_TRACE == 0

#define GT_curline()			((u16)__LINE__)
#define GT_create(mask, modName)
#define GT_exit()
#define GT_init()
#define GT_set(settings)
#define GT_setprintf(fxn)

#define GT_query(mask, class)		false

#define gt_0trace(mask, class, format)
#define gt_1trace(mask, class, format, arg1)
#define gt_2trace(mask, class, format, arg1, arg2)
#define gt_3trace(mask, class, format, arg1, arg2, arg3)
#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4)
#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5)
#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6)

#else				/* GT_TRACE == 1 */

#define GT_create(mask, modName)	_GT_create((mask), (modName))
#define GT_curline()			((u16)__LINE__)
#define GT_set(settings)		_GT_set(settings)
#define GT_setprintf(fxn)		(_GT_params.PRINTFXN = (Fxn)(fxn))

#define GT_query(mask, class) ((*(mask).flags & (class)))

#define gt_0trace(mask, class, format) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format)) : 0)

#define gt_1trace(mask, class, format, arg1) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1)) : 0)

#define gt_2trace(mask, class, format, arg1, arg2) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1), (arg2)) : 0)

#define gt_3trace(mask, class, format, arg1, arg2, arg3) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1), (arg2), (arg3)) : 0)

#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4)) : 0)

#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5)) \
	 : 0)

#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6) \
	((*(mask).flags & (class)) ? \
	_GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5), \
	(arg6)) : 0)

#endif				/* GT_TRACE */

#endif				/* _LINT_ */

#endif				/* GTCE_ */