1321936Shselasky/*
2321936Shselasky * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3321936Shselasky * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
4321936Shselasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5321936Shselasky *
6321936Shselasky * This software is available to you under a choice of one of two
7321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
8321936Shselasky * General Public License (GPL) Version 2, available from the file
9321936Shselasky * COPYING in the main directory of this source tree, or the
10321936Shselasky * OpenIB.org BSD license below:
11321936Shselasky *
12321936Shselasky *     Redistribution and use in source and binary forms, with or
13321936Shselasky *     without modification, are permitted provided that the following
14321936Shselasky *     conditions are met:
15321936Shselasky *
16321936Shselasky *      - Redistributions of source code must retain the above
17321936Shselasky *        copyright notice, this list of conditions and the following
18321936Shselasky *        disclaimer.
19321936Shselasky *
20321936Shselasky *      - Redistributions in binary form must reproduce the above
21321936Shselasky *        copyright notice, this list of conditions and the following
22321936Shselasky *        disclaimer in the documentation and/or other materials
23321936Shselasky *        provided with the distribution.
24321936Shselasky *
25321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32321936Shselasky * SOFTWARE.
33321936Shselasky *
34321936Shselasky */
35321936Shselasky
36321936Shselasky/*
37321936Shselasky * Abstract:
38321936Shselasky *	Defines sized datatypes for Linux User mode
39321936Shselasky *  exported sizes are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t
40321936Shselasky *  int64_t, uint64_t.
41321936Shselasky */
42321936Shselasky
43321936Shselasky#ifndef _CL_TYPES_OSD_H_
44321936Shselasky#define _CL_TYPES_OSD_H_
45321936Shselasky
46321936Shselasky#ifdef __cplusplus
47321936Shselasky#  define BEGIN_C_DECLS extern "C" {
48321936Shselasky#  define END_C_DECLS   }
49321936Shselasky#else				/* !__cplusplus */
50321936Shselasky#  define BEGIN_C_DECLS
51321936Shselasky#  define END_C_DECLS
52321936Shselasky#endif				/* __cplusplus */
53321936Shselasky
54321936ShselaskyBEGIN_C_DECLS
55321936Shselasky#if defined (_DEBUG_)
56321936Shselasky#ifdef __IA64__
57321936Shselasky#define cl_break() asm("   break 0")
58321936Shselasky#else				/* __IA64__ */
59321936Shselasky#define cl_break() asm("   int $3")
60321936Shselasky#endif				/* __IA64__ */
61321936Shselasky#else				/* _DEBUG_ */
62321936Shselasky#define cl_break
63321936Shselasky#endif
64321936Shselasky#include <inttypes.h>
65321936Shselasky#include <assert.h>
66321936Shselasky#include <string.h>
67321936Shselasky
68321936Shselasky/*
69321936Shselasky * Branch prediction hints
70321936Shselasky */
71321936Shselasky#if defined(HAVE_BUILTIN_EXPECT)
72321936Shselasky#define PT(exp)    __builtin_expect( ((uintptr_t)(exp)), 1 )
73321936Shselasky#define PF(exp)    __builtin_expect( ((uintptr_t)(exp)), 0 )
74321936Shselasky#else
75321936Shselasky#define PT(exp)    (exp)
76321936Shselasky#define PF(exp)    (exp)
77321936Shselasky#endif
78321936Shselasky
79321936Shselasky#if defined (_DEBUG_)
80321936Shselasky#define CL_ASSERT	assert
81321936Shselasky#else				/* _DEBUG_ */
82321936Shselasky#define CL_ASSERT( __exp__ )
83321936Shselasky#endif				/* _DEBUG_ */
84321936Shselasky/*
85321936Shselasky * Types not explicitly defined are native to the platform.
86321936Shselasky */
87321936Shselaskytypedef int boolean_t;
88321936Shselaskytypedef volatile int32_t atomic32_t;
89321936Shselasky
90321936Shselasky#ifndef NULL
91321936Shselasky#define NULL	(void*)0
92321936Shselasky#endif
93321936Shselasky
94321936Shselasky#define UNUSED_PARAM( P )
95321936Shselasky
96321936ShselaskyEND_C_DECLS
97321936Shselasky#endif				/* _CL_TYPES_OSD_H_ */
98