/
definitions.h
82 lines (73 loc) · 2.16 KB
/
definitions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _DEFINITIONS_H_
#define _DEFINITIONS_H_
#if defined(SIMU)
#define __ALIGNED
#else
#define __ALIGNED __attribute__((aligned(32)))
#endif
#if defined(SIMU)
#define __DMA
#elif (defined(STM32F4) && !defined(BOOT)) || defined(PCBHORUS)
#define __DMA __attribute__((section(".ram"), aligned(32)))
#else
#define __DMA __ALIGNED
#endif
#if defined(PCBHORUS) && !defined(SIMU)
#define __SDRAM __attribute__((section(".sdram"), aligned(32)))
#else
#define __SDRAM __DMA
#endif
#if defined(PCBHORUS) && !defined(SIMU)
#define __NOINIT __attribute__((section(".noinit")))
#else
#define __NOINIT
#endif
#if defined(SIMU) || defined(CPUARM) || GCC_VERSION < 472
typedef int32_t int24_t;
#else
typedef __int24 int24_t;
#endif
#if __GNUC__
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
#else
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
#endif
#if defined(SIMU)
#if !defined(FORCEINLINE)
#define FORCEINLINE inline
#endif
#if !defined(NOINLINE)
#define NOINLINE
#endif
#define CONVERT_PTR_UINT(x) ((uint32_t)(uint64_t)(x))
#define CONVERT_UINT_PTR(x) ((uint32_t*)(uint64_t)(x))
#else
#if !defined(_MSC_VER) || (_MSC_VER < 1200)
#define FORCEINLINE inline __attribute__ ((always_inline))
#endif
#define NOINLINE __attribute__ ((noinline))
#define SIMU_SLEEP(x)
#define SIMU_SLEEP_NORET(x)
#define CONVERT_PTR_UINT(x) ((uint32_t)(x))
#define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
#endif
#endif // _DEFINITIONS_H_