2 ********************************************************************************
3 Copyright (C) 2015 Annapurna Labs Ltd.
5 This file may be licensed under the terms of the Annapurna Labs Commercial
8 Alternatively, this file can be distributed under the terms of the GNU General
9 Public License V2 as published by the Free Software Foundation and can be
10 found at http://www.gnu.org/licenses/gpl-2.0.html
12 Alternatively, redistribution and use in source and binary forms, with or
13 without modification, are permitted provided that the following conditions are
16 * Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
19 * Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
28 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *******************************************************************************/
38 * @defgroup group_common HAL Common Layer
40 * @file al_hal_types.h
42 * @brief macros used by HALs and platform layer
46 #ifndef __AL_HAL_TYPES_H__
47 #define __AL_HAL_TYPES_H__
49 #include "al_hal_plat_types.h"
50 #include "al_hal_plat_services.h"
60 #if (!AL_TRUE) || (AL_FALSE)
61 #error "AL_TRUE must be non zero and AL_FALSE must be zero"
64 typedef int AL_RETURN;
67 #define NULL (void *)0
71 #define likely(x) (__builtin_expect(!!(x), 1))
72 #define unlikely(x) (__builtin_expect(!!(x), 0))
77 #if !defined(__packed)
78 #define __packed __attribute__ ((packed))
80 /* packed and alinged types */
81 #define __packed_a4 __attribute__ ((packed, aligned(4)))
82 #define __packed_a8 __attribute__ ((packed, aligned(8)))
83 #define __packed_a16 __attribute__ ((packed, aligned(16)))
86 #if !defined(__packed)
87 #error "__packed is not defined!!"
95 #if !defined(__cache_aligned)
97 #define __cache_aligned __attribute__ ((__aligned__(64)))
99 #define __cache_aligned
105 #define INLINE inline
116 /** @} end of Common group */
117 #endif /* __TYPES_H__ */