1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #ifndef __PVR_DEBUG_H__
28 #define __PVR_DEBUG_H__
32 #include "img_types.h"
34 #define PVR_MAX_DEBUG_MESSAGE_LEN 512
36 #define DBGPRIV_FATAL 0x01UL
37 #define DBGPRIV_ERROR 0x02UL
38 #define DBGPRIV_WARNING 0x04UL
39 #define DBGPRIV_MESSAGE 0x08UL
40 #define DBGPRIV_VERBOSE 0x10UL
41 #define DBGPRIV_CALLTRACE 0x20UL
42 #define DBGPRIV_ALLOC 0x40UL
43 #define DBGPRIV_ALLLEVELS (DBGPRIV_FATAL | DBGPRIV_ERROR | \
44 DBGPRIV_WARNING | DBGPRIV_MESSAGE | \
47 #define PVR_DBG_FATAL DBGPRIV_FATAL
48 #define PVR_DBG_ERROR DBGPRIV_ERROR
49 #define PVR_DBG_WARNING DBGPRIV_WARNING
50 #define PVR_DBG_MESSAGE DBGPRIV_MESSAGE
51 #define PVR_DBG_VERBOSE DBGPRIV_VERBOSE
52 #define PVR_DBG_CALLTRACE DBGPRIV_CALLTRACE
53 #define PVR_DBG_ALLOC DBGPRIV_ALLOC
55 #if defined(CONFIG_PVR_DEBUG)
57 #define PVR_ASSERT(EXPR) \
60 PVRSRVDebugAssertFail(__FILE__, __LINE__); \
63 #define PVR_DPF(level, fmt, ...) \
64 PVRSRVDebugPrintf(level, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
66 #define PVR_TRACE(fmt, ...) \
67 PVRSRVTrace(fmt, ##__VA_ARGS__)
69 void PVRSRVDebugAssertFail(const char *pszFile, u32 ui32Line);
70 void PVRSRVDebugPrintf(u32 ui32DebugLevel, const char *pszFileName,
71 u32 ui32Line, const char *pszFormat, ...);
72 void PVRSRVTrace(const char *pszFormat, ...);
74 int PVRDebugProcSetLevel(struct file *file, const char __user *buffer,
75 unsigned long count, void *data);
76 int PVRDebugProcGetLevel(char *page, char **start, off_t off, int count,
77 int *eof, void *data);
78 void PVRDebugSetLevel(u32 uDebugLevel);
86 #define PVR_ASSERT(EXPR) do { } while (0)
87 #define PVR_DPF(level, fmt, ...) do { } while (0)
88 #define PVR_TRACE(fmt, ...) \
89 PVRSRVTrace(fmt, ##__VA_ARGS__)
90 #define PVR_DBG_BREAK do { } while (0)
92 void PVRSRVTrace(const char *pszFormat, ...);
96 #define PVR_ASSERT(EXPR) do { } while (0)
97 #define PVR_DPF(level, fmt, ...) do { } while (0)
98 #define PVR_TRACE(fmt, ...) do { } while (0)
99 #define PVR_DBG_BREAK do { } while (0)
103 #endif /* CONFIG_PVR_DEBUG */
105 #if defined(CONFIG_PVR_DEBUG) || defined(TIMING)
107 void pvr_dbg_init(void);
108 void pvr_dbg_cleanup(void);
112 static inline void pvr_dbg_init(void) {};
113 static inline void pvr_dbg_cleanup(void) {};
117 #ifdef CONFIG_DEBUG_FS
118 extern struct dentry *pvr_debugfs_dir;