Nu:Tekt NTS-1 digital SDK  v1.1-0
cortexm4.h
Go to the documentation of this file.
1 /*
2  BSD 3-Clause License
3 
4  Copyright (c) 2018, KORG INC.
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice, this
11  list of conditions and the following disclaimer.
12 
13  * Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17  * Neither the name of the copyright holder nor the names of its
18  contributors may be used to endorse or promote products derived from
19  this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 //*/
33 
45 #ifndef __cortexm4_h
46 #define __cortexm4_h
47 
48 #include "arm_math.h" // CMSIS
49 
56 #define bkpt __BKPT
57 #define clrex __CLREX
58 #define clz __CLZ
59 #define dmb __DMB
60 #define dsb __DSB
61 #define isb __ISB
62 #define lda __LDA
63 #define ldab __LDAB
64 #define ldaex __LDAEX
65 #define ldaxb __LDAEXB
66 #define ldaxh __LDAEXH
67 #define ldah __LDAH
68 #define ldrbt __LDRBT
69 #define ldrexb __LDREXB
70 #define ldrexh __LDREXH
71 #define ldrexw __LDREXW
72 #define ldrht __LDRHT
73 #define ldrt __LDRT
74 #define nop __NOP
75 #define rbit __RBIT
76 #define rev __REV
77 #define rev16 __REV16
78 #define revsh __REVSH
79 #define ror __ROR
80 #define rrx __RRX
81 #define sev __SEV
82 #define ssat __SSAT
83 #define stl __STL
84 #define stlb __STLB
85 #define stlex __STLEX
86 #define stlexb __STLEXB
87 #define stlexh __STLEXH
88 #define stlh __STLH
89 #define strbt __STRBT
90 #define strexb __STREXB
91 #define strexh __STREXH
92 #define strexw __STREXW
93 #define strht __STRHT
94 #define strt __STRT
95 #define usat __USAT
96 #define wfe __WFE
97 #define wfi __WFI
98 
106 #define apsr() __get_APSR()
107 #define apsr_clr(m) { \
108  uint32_t p; \
109  __asm__ volatile ("mrs %0, APSR\r\n" \
110  "bic %0, %0, %1\r\n" \
111  "msr APSR_nzcvq, %0\r\n" : "=r" (p) : "i" ((m))); \
112  }
113 
122 #define simd32_t __SIMD32_TYPE
123 
124 #define sadd8 __SADD8
125 #define qadd8 __QADD8
126 #define shadd8 __SHADD8
127 #define uadd8 __UADD8
128 #define uqadd8 __UQADD8
129 #define uhadd8 __UHADD8
130 #define ssub8 __SSUB8
131 #define qsub8 __QSUB8
132 #define shsub8 __SHSUB8
133 #define usub8 __USUB8
134 #define uqsub8 __UQSUB8
135 #define uhsub8 __UHSUB8
136 #define sadd16 __SADD16
137 #define qadd16 __QADD16
138 #define shadd16 __SHADD16
139 #define uadd16 __UADD16
140 #define uqadd16 __UQADD16
141 #define uhadd16 __UHADD16
142 #define ssub16 __SSUB16
143 #define qsub16 __QSUB16
144 #define shsub16 __SHSUB16
145 #define usub16 __USUB16
146 #define uqsub16 __UQSUB16
147 #define uhsub16 __UHSUB16
148 #define sasx __SASX
149 #define qasx __QASX
150 #define shasx __SHASX
151 #define uasx __UASX
152 #define uqasx __UQASX
153 #define uhasx __UHASX
154 #define ssax __SSAX
155 #define qsax __QSAX
156 #define shsax __SHSAX
157 #define usax __USAX
158 #define uqsax __UQSAX
159 #define uhsax __UHSAX
160 #define usad8 __USAD8
161 #define usada8 __USADA8
162 #define ssat16 __SSAT16
163 #define usat16 __USAT16
164 #define uxtb16 __UXTB16
165 #define uxtab16 __UXTAB16
166 #define sxtb16 __SXTB16
167 #define sxtab16 __SXTAB16
168 #define smuad __SMUAD
169 #define smuadx __SMUADX
170 #define smlad __SMLAD
171 #define smladx __SMLADX
172 #define smlald __SMLALD
173 #define smlaldx __SMLALDX
174 #define smusd __SMUSD
175 #define smusdx __SMUSDX
176 #define smlsd __SMLSD
177 #define smlsdx __SMLSDX
178 #define smlsld __SMLSLD
179 #define smlsldx __SMLSLDX
180 #define sel __SEL
181 #define qadd __QADD
182 #define qsub __QSUB
183 #define pkhbt __PKHBT
184 #define pkhtb __PKHTB
185 #define smmla __SMMLA
186 
189 #endif // __cortexm4_h
190