xref: /NextBSD/sys/dev/vxge/include/vxge-os-pal.h (revision eb1a5f8de9f7ea602c373a710f531abbf81141c4)
1 /*-
2  * Copyright(c) 2002-2011 Exar Corp.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification are permitted provided the following conditions are met:
7  *
8  *    1. Redistributions of source code must retain the above copyright notice,
9  *       this list of conditions and the following disclaimer.
10  *
11  *    2. Redistributions in binary form must reproduce the above copyright
12  *       notice, this list of conditions and the following disclaimer in the
13  *       documentation and/or other materials provided with the distribution.
14  *
15  *    3. Neither the name of the Exar Corporation nor the names of its
16  *       contributors may be used to endorse or promote products derived from
17  *       this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*$FreeBSD$*/
32 
33 #ifndef	VXGE_OS_PAL_H
34 #define	VXGE_OS_PAL_H
35 
36 __EXTERN_BEGIN_DECLS
37 
38 /* --------------------------- platform switch ------------------------------ */
39 
40 /* platform specific header */
41 #include <dev/vxge/vxge-osdep.h>
42 #define	IN
43 #define	OUT
44 
45 #if !defined(VXGE_OS_PLATFORM_64BIT) && !defined(VXGE_OS_PLATFORM_32BIT)
46 #error "either 32bit or 64bit switch must be defined!"
47 #endif
48 
49 #if !defined(VXGE_OS_HOST_BIG_ENDIAN) && !defined(VXGE_OS_HOST_LITTLE_ENDIAN)
50 #error "either little endian or big endian switch must be defined!"
51 #endif
52 
53 #if defined(VXGE_OS_PLATFORM_64BIT)
54 #define	VXGE_OS_MEMORY_DEADCODE_PAT		0x5a5a5a5a5a5a5a5a
55 #else
56 #define	VXGE_OS_MEMORY_DEADCODE_PAT		0x5a5a5a5a
57 #endif
58 
59 #if defined(VXGE_DEBUG_ASSERT)
60 
61 /*
62  * vxge_assert
63  * @test: C-condition to check
64  * @fmt: printf like format string
65  *
66  * This function implements traditional assert. By default assertions
67  * are enabled. It can be disabled by defining VXGE_DEBUG_ASSERT macro in
68  * compilation
69  * time.
70  */
71 #define	vxge_assert(test) { \
72 	if (!(test)) vxge_os_bug("bad cond: "#test" at %s:%d\n", \
73 	__FILE__, __LINE__); }
74 #else
75 #define	vxge_assert(test)
76 #endif	/* end of VXGE_DEBUG_ASSERT */
77 
78 __EXTERN_END_DECLS
79 
80 #endif	/* VXGE_OS_PAL_H */
81