]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/ncsw/inc/types_ext.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
[FreeBSD/FreeBSD.git] / sys / contrib / ncsw / inc / types_ext.h
1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33  /**************************************************************************//**
34  @File          types_ext.h
35
36  @Description   General types Standard Definitions
37 *//***************************************************************************/
38
39 #ifndef __TYPES_EXT_H
40 #define __TYPES_EXT_H
41
42
43 #if defined(NCSW_LINUX)
44 #include "types_linux.h"
45
46 #elif defined(NCSW_LINUX_USD)
47 #include "types_linux_usd.h"
48
49 #elif defined(NCSW_VXWORKS)
50 #include "types_vxworks.h"
51
52 #elif defined(__MWERKS__) && defined(__GNUC__) && defined(__cplusplus)
53 #include "types_bb_gpp.h"
54
55 #elif defined(__MWERKS__) && defined(__GNUC__)
56 #include "types_bb_gcc.h"
57
58 #elif defined(__ghs__)
59 #include "types_ghs.h"
60
61 #elif defined(NCSW_FREEBSD)
62 #include "types_freebsd.h"
63
64 #else
65 #include "types_dflt.h"
66 #endif /* defined (__ROCOO__) */
67
68
69 static __inline__ void TypesChecker(void)
70 {
71 #if defined(__MWERKS__) && !defined(__GNUC__)
72 #pragma pack(push,1)
73 #endif /* defined(__MWERKS__) && ... */
74 #define MEM_MAP_START
75      _Packed struct strct {
76         __volatile__ int vi;
77     } _PackedType;
78 #define MEM_MAP_END
79 #if defined(__MWERKS__) && !defined(__GNUC__)
80 #pragma pack(pop)
81 #endif /* defined(__MWERKS__) && ... */
82     size_t          size = 0;
83     bool            tr = TRUE, fls = FALSE;
84     struct strct    *p_Strct = NULL;
85     physAddress_t   addr = 0x100;
86
87     tr      = fls;
88     p_Strct = p_Strct;
89     size++;
90     if (tr) size++;
91
92     WRITE_UINT8(*((uint8_t*)((size_t)(addr))),
93                  GET_UINT8(*((uint8_t*)((size_t)(addr)))));
94
95     WRITE_UINT8(*((uint8_t*)((size_t)(UINT8_MAX))),
96                  GET_UINT8(*((uint8_t*)((size_t)(UINT8_MAX)))));
97     WRITE_UINT16(*((uint16_t*)((size_t)(UINT16_MAX))),
98                  GET_UINT16(*((uint16_t*)((size_t)(UINT16_MAX)))));
99     WRITE_UINT32(*((uint32_t*)((size_t)(UINT32_MAX))),
100                  GET_UINT32(*((uint32_t*)((size_t)(UINT32_MAX)))));
101     WRITE_UINT64(*((uint64_t*)((size_t)(UINT64_MAX))),
102                  GET_UINT64(*((uint64_t*)((size_t)(UINT64_MAX)))));
103     WRITE_UINT8(*((uint8_t*)((size_t)(INT8_MAX))),
104                  GET_UINT8(*((uint8_t*)((size_t)(INT8_MIN)))));
105     WRITE_UINT16(*((uint16_t*)((size_t)(INT16_MAX))),
106                  GET_UINT16(*((uint16_t*)((size_t)(INT16_MIN)))));
107     WRITE_UINT32(*((uint32_t*)((size_t)(INT32_MAX))),
108                  GET_UINT32(*((uint32_t*)((size_t)(INT32_MIN)))));
109     WRITE_UINT64(*((uint64_t*)((size_t)(INT64_MAX))),
110                  GET_UINT64(*((uint64_t*)((size_t)(INT64_MIN)))));
111 }
112
113
114 #endif /* __TYPES_EXT_H */