5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _DEFINITIONS_H_
22 #define _DEFINITIONS_H_
29 #define UNUSED(x) ((void)(x)) /* to avoid warnings */
34 #define __SECTION_USED(s)
36 #define __ALIGNED(x) __attribute__((aligned(x)))
37 #define __SECTION_USED(s) __attribute__((section(s), used))
42 #elif (defined(STM32F4) && !defined(BOOT)) || defined(SDRAM)
43 #define __DMA __attribute__((section(".ram"), aligned(4)))
45 #define __DMA __ALIGNED(4)
48 #if defined(SDRAM) && !defined(SIMU)
49 #define __SDRAM __attribute__((section(".sdram"), aligned(4)))
50 #define __NOINIT __attribute__((section(".noinit")))
57 #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
59 #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
63 #define CONVERT_PTR_UINT(x) ((uint32_t)(uint64_t)(x))
64 #define CONVERT_UINT_PTR(x) ((uint32_t*)(uint64_t)(x))
66 #define CONVERT_PTR_UINT(x) ((uint32_t)(x))
67 #define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
71 #define DIM(__arr) (sizeof((__arr)) / sizeof((__arr)[0]))
74 #endif // _DEFINITIONS_H_