1245803Stheraven/* 2245803Stheraven * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 3245803Stheraven * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4245803Stheraven * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5245803Stheraven * 6245803Stheraven * This software is available to you under a choice of one of two 7245803Stheraven * licenses. You may choose to be licensed under the terms of the GNU 8245803Stheraven * General Public License (GPL) Version 2, available from the file 9245803Stheraven * COPYING in the main directory of this source tree, or the 10245803Stheraven * OpenIB.org BSD license below: 11245803Stheraven * 12245803Stheraven * Redistribution and use in source and binary forms, with or 13245803Stheraven * without modification, are permitted provided that the following 14245803Stheraven * conditions are met: 15245803Stheraven * 16245803Stheraven * - Redistributions of source code must retain the above 17245803Stheraven * copyright notice, this list of conditions and the following 18245803Stheraven * disclaimer. 19245803Stheraven * 20245803Stheraven * - Redistributions in binary form must reproduce the above 21245803Stheraven * copyright notice, this list of conditions and the following 22245803Stheraven * disclaimer in the documentation and/or other materials 23245803Stheraven * provided with the distribution. 24245803Stheraven * 25245803Stheraven * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26245803Stheraven * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27245803Stheraven * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28245803Stheraven * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29245803Stheraven * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30245803Stheraven * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31245803Stheraven * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32245803Stheraven * SOFTWARE. 33245803Stheraven * 34245803Stheraven */ 35245803Stheraven 36245839Stheraven/* 37245839Stheraven * Abstract: 38245839Stheraven * Debug Macros. 39245839Stheraven */ 40245839Stheraven 41245803Stheraven#ifndef _CL_DEBUG_OSD_H_ 42245839Stheraven#define _CL_DEBUG_OSD_H_ 43245803Stheraven 44245803Stheraven#include <complib/cl_types.h> 45245803Stheraven 46245803Stheraven#ifdef __cplusplus 47245803Stheraven# define BEGIN_C_DECLS extern "C" { 48245803Stheraven# define END_C_DECLS } 49245803Stheraven#else /* !__cplusplus */ 50245803Stheraven# define BEGIN_C_DECLS 51245803Stheraven# define END_C_DECLS 52245803Stheraven#endif /* __cplusplus */ 53245803Stheraven 54245803StheravenBEGIN_C_DECLS 55245803Stheraven#if !defined(__MODULE__) 56245803Stheraven#define __MODULE__ "" 57245803Stheraven#define __MOD_DELIMITER__ "" 58245803Stheraven#else /* !defined(__MODULE__) */ 59245803Stheraven#define __MOD_DELIMITER__ ":" 60245803Stheraven#endif /* !defined(__MODULE__) */ 61245803Stheraven/* 62245803Stheraven * Define specifiers for print functions based on the platform 63245803Stheraven */ 64245803Stheraven#ifdef __IA64__ 65245803Stheraven#define PRIdSIZE_T "ld" 66245803Stheraven#else 67245803Stheraven#define PRIdSIZE_T "d" 68245803Stheraven#endif 69245803Stheraven#include <inttypes.h> 70245803Stheraven#include <stdio.h> 71245803Stheraven#define cl_msg_out printf 72245803Stheraven#if defined( _DEBUG_ ) 73245803Stheraven#define cl_dbg_out printf 74245803Stheraven#else 75245803Stheraven#define cl_dbg_out foo 76245803Stheraven#endif /* _DEBUG_ */ 77245803Stheraven/* 78245803Stheraven * The following macros are used internally by the CL_ENTER, CL_TRACE, 79245803Stheraven * CL_TRACE_EXIT, and CL_EXIT macros. 80245803Stheraven */ 81245803Stheraven#define _CL_DBG_ENTER \ 82245803Stheraven ("%s%s%s() [\n", __MODULE__, __MOD_DELIMITER__, __func__) 83245803Stheraven#define _CL_DBG_EXIT \ 84245803Stheraven ("%s%s%s() ]\n", __MODULE__, __MOD_DELIMITER__, __func__) 85245803Stheraven#define _CL_DBG_INFO \ 86245803Stheraven ("%s%s%s(): ", __MODULE__, __MOD_DELIMITER__, __func__) 87245803Stheraven#define _CL_DBG_ERROR \ 88245803Stheraven ("%s%s%s() !ERROR!: ", __MODULE__, __MOD_DELIMITER__, __func__) 89245803Stheraven#define CL_CHK_STK 90245803StheravenEND_C_DECLS 91245803Stheraven#endif /* _CL_DEBUG_OSD_H_ */ 92245803Stheraven