ENGR00156850 gpu-viv: add gpu-viv driver source
[wandboard.git] / drivers / mxc / gpu-viv / hal / os / linux / kernel / gc_hal_kernel_debug.h
bloba9b633e5d8582cadd9724bdd31ca573ba0287c31
1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
24 #ifndef __gc_hal_kernel_debug_h_
25 #define __gc_hal_kernel_debug_h_
27 #include <gc_hal_kernel_linux.h>
28 #include <linux/spinlock.h>
29 #include <linux/time.h>
30 #include <stdarg.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /******************************************************************************\
37 ****************************** OS-dependent Macros *****************************
38 \******************************************************************************/
40 typedef va_list gctARGUMENTS;
42 #define gcmkARGUMENTS_START(Arguments, Pointer) \
43 va_start(Arguments, Pointer)
45 #define gcmkARGUMENTS_END(Arguments) \
46 va_end(Arguments)
48 #define gcmkDECLARE_LOCK(__spinLock__) \
49 static spinlock_t __spinLock__ = SPIN_LOCK_UNLOCKED;
51 #define gcmkLOCKSECTION(__spinLock__) \
52 spin_lock(&__spinLock__)
54 #define gcmkUNLOCKSECTION(__spinLock__) \
55 spin_unlock(&__spinLock__)
57 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
58 # define gcmkGETPROCESSID() \
59 task_tgid_vnr(current)
60 #else
61 # define gcmkGETPROCESSID() \
62 current->tgid
63 #endif
65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
66 # define gcmkGETTHREADID() \
67 task_pid_vnr(current)
68 #else
69 # define gcmkGETTHREADID() \
70 current->pid
71 #endif
73 #define gcmkOUTPUT_STRING(String) \
74 printk(String); \
75 touch_softlockup_watchdog()
77 #define gcmkSPRINTF(Destination, Size, Message, Value) \
78 snprintf(Destination, Size, Message, Value)
80 #define gcmkSPRINTF2(Destination, Size, Message, Value1, Value2) \
81 snprintf(Destination, Size, Message, Value1, Value2)
83 #define gcmkSPRINTF3(Destination, Size, Message, Value1, Value2, Value3) \
84 snprintf(Destination, Size, Message, Value1, Value2, Value3)
86 #define gcmkVSPRINTF(Destination, Size, Message, Arguments) \
87 vsnprintf(Destination, Size, Message, *(va_list *) &Arguments)
89 #define gcmkSTRCAT(Destination, Size, String) \
90 strncat(Destination, String, Size)
92 /* If not zero, forces data alignment in the variable argument list
93 by its individual size. */
94 #define gcdALIGNBYSIZE 1
96 #ifdef __cplusplus
98 #endif
100 #endif /* __gc_hal_kernel_debug_h_ */