annotate f103c8/Drivers/CMSIS/Include/cmsis_armcc_V6.h @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /**************************************************************************//**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 * @file cmsis_armcc_V6.h
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 * @brief CMSIS Cortex-M Core Function/Instruction Header File
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * @version V4.30
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * @date 20. October 2015
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 ******************************************************************************/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 /* Copyright (c) 2009 - 2015 ARM LIMITED
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 All rights reserved.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 Redistribution and use in source and binary forms, with or without
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 modification, are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 - Redistributions of source code must retain the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 notice, this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 - Redistributions in binary form must reproduce the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 notice, this list of conditions and the following disclaimer in the
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 documentation and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 - Neither the name of ARM nor the names of its contributors may be used
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 to endorse or promote products derived from this software without
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 ---------------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 #ifndef __CMSIS_ARMCC_V6_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 #define __CMSIS_ARMCC_V6_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 /* ########################### Core Function Access ########################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 /** \ingroup CMSIS_Core_FunctionInterface
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 \brief Enable IRQ Interrupts
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 __attribute__((always_inline)) __STATIC_INLINE void __enable_irq(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 __ASM volatile ("cpsie i" : : : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 \brief Disable IRQ Interrupts
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 \details Disables IRQ interrupts by setting the I-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 __attribute__((always_inline)) __STATIC_INLINE void __disable_irq(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 __ASM volatile ("cpsid i" : : : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 \brief Get Control Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 \details Returns the content of the Control Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 \return Control Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 __ASM volatile ("MRS %0, control" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 \brief Get Control Register (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 \details Returns the content of the non-secure Control Register when in secure mode.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 \return non-secure Control Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_CONTROL_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 \brief Set Control Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 \details Writes the given value to the Control Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 \param [in] control Control Register value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 __attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 \brief Set Control Register (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 \details Writes the given value to the non-secure Control Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 \param [in] control Control Register value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_CONTROL_NS(uint32_t control)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 \brief Get IPSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 \details Returns the content of the IPSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 \return IPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 \brief Get IPSR Register (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 \details Returns the content of the non-secure IPSR Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 \return IPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_IPSR_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 __ASM volatile ("MRS %0, ipsr_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 \brief Get APSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 \details Returns the content of the APSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 \return APSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 \brief Get APSR Register (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168 \details Returns the content of the non-secure APSR Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 \return APSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_APSR_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 __ASM volatile ("MRS %0, apsr_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182 \brief Get xPSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183 \details Returns the content of the xPSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184 \return xPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197 \brief Get xPSR Register (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 \details Returns the content of the non-secure xPSR Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 \return xPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_xPSR_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205 __ASM volatile ("MRS %0, xpsr_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212 \brief Get Process Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 \details Returns the current value of the Process Stack Pointer (PSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 \return PSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 __ASM volatile ("MRS %0, psp" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 \brief Get Process Stack Pointer (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228 \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229 \return PSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 \brief Set Process Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243 \details Assigns the given value to the Process Stack Pointer (PSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 \param [in] topOfProcStack Process Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 __attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248 __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : "sp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
249 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
250
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
251
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
252 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
253 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
254 \brief Set Process Stack Pointer (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
255 \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
256 \param [in] topOfProcStack Process Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
257 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
258 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
259 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
260 __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : "sp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
261 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
262 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
263
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
264
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
265 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
266 \brief Get Main Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
267 \details Returns the current value of the Main Stack Pointer (MSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
268 \return MSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
269 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
270 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
271 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
272 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
273
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
274 __ASM volatile ("MRS %0, msp" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
275 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
276 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
277
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
278
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
279 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
280 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
281 \brief Get Main Stack Pointer (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
282 \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
283 \return MSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
284 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
285 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
286 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
287 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
288
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
289 __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
290 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
291 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
292 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
293
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
294
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
295 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
296 \brief Set Main Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
297 \details Assigns the given value to the Main Stack Pointer (MSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
298 \param [in] topOfMainStack Main Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
299 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
300 __attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
301 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
302 __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : "sp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
303 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
304
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
305
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
306 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
307 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
308 \brief Set Main Stack Pointer (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
309 \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
310 \param [in] topOfMainStack Main Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
311 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
312 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
313 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
314 __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : "sp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
315 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
316 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
317
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
318
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
319 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
320 \brief Get Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
321 \details Returns the current state of the priority mask bit from the Priority Mask Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
322 \return Priority Mask value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
323 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
324 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
325 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
326 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
327
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
328 __ASM volatile ("MRS %0, primask" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
329 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
330 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
331
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
332
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
333 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
334 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
335 \brief Get Priority Mask (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
336 \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
337 \return Priority Mask value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
338 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
339 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
340 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
341 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
342
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
343 __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
344 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
345 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
346 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
347
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
348
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
349 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
350 \brief Set Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
351 \details Assigns the given value to the Priority Mask Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
352 \param [in] priMask Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
353 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
354 __attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
355 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
356 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
357 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
358
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
359
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
360 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
361 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
362 \brief Set Priority Mask (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
363 \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
364 \param [in] priMask Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
365 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
366 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
367 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
368 __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
369 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
370 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
371
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
372
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
373 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
374
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
375 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
376 \brief Enable FIQ
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
377 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
378 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
379 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
380 __attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
381 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
382 __ASM volatile ("cpsie f" : : : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
383 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
384
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
385
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
386 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
387 \brief Disable FIQ
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
388 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
389 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
390 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
391 __attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
392 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
393 __ASM volatile ("cpsid f" : : : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
394 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
395
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
396
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
397 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
398 \brief Get Base Priority
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
399 \details Returns the current value of the Base Priority register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
400 \return Base Priority register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
401 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
402 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
403 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
404 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
405
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
406 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
407 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
408 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
409
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
410
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
411 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
412 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
413 \brief Get Base Priority (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
414 \details Returns the current value of the non-secure Base Priority register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
415 \return Base Priority register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
416 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
417 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
418 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
419 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
420
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
421 __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
422 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
423 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
424 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
425
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
426
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
427 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
428 \brief Set Base Priority
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
429 \details Assigns the given value to the Base Priority register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
430 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
431 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
432 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
433 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
434 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
435 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
436
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
437
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
438 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
439 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
440 \brief Set Base Priority (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
441 \details Assigns the given value to the non-secure Base Priority register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
442 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
443 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
444 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
445 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
446 __ASM volatile ("MSR basepri_ns, %0" : : "r" (value) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
447 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
448 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
449
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
450
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
451 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
452 \brief Set Base Priority with condition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
453 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
454 or the new value increases the BASEPRI priority level.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
455 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
456 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
457 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
458 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
459 __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
460 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
461
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
462
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
463 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
464 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
465 \brief Set Base Priority with condition (non_secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
466 \details Assigns the given value to the non-secure Base Priority register when in secure state only if BASEPRI masking is disabled,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
467 or the new value increases the BASEPRI priority level.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
468 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
469 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
470 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_MAX_NS(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
471 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
472 __ASM volatile ("MSR basepri_max_ns, %0" : : "r" (value) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
473 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
474 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
475
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
476
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
477 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
478 \brief Get Fault Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
479 \details Returns the current value of the Fault Mask register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
480 \return Fault Mask register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
481 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
482 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
483 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
484 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
485
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
486 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
487 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
488 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
489
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
490
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
491 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
492 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
493 \brief Get Fault Mask (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
494 \details Returns the current value of the non-secure Fault Mask register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
495 \return Fault Mask register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
496 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
497 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
498 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
499 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
500
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
501 __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
502 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
503 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
504 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
505
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
506
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
507 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
508 \brief Set Fault Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
509 \details Assigns the given value to the Fault Mask register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
510 \param [in] faultMask Fault Mask value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
511 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
512 __attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
513 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
514 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
515 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
516
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
517
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
518 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
519 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
520 \brief Set Fault Mask (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
521 \details Assigns the given value to the non-secure Fault Mask register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
522 \param [in] faultMask Fault Mask value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
523 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
524 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
525 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
526 __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
527 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
528 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
529
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
530
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
531 #endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
532
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
533
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
534 #if (__ARM_ARCH_8M__ == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
535
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
536 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
537 \brief Get Process Stack Pointer Limit
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
538 \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
539 \return PSPLIM Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
540 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
541 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
542 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
543 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
544
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
545 __ASM volatile ("MRS %0, psplim" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
546 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
547 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
548
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
549
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
550 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
551 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
552 \brief Get Process Stack Pointer Limit (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
553 \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
554 \return PSPLIM Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
555 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
556 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
557 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
558 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
559
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
560 __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
561 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
562 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
563 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
564
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
565
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
566 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
567 \brief Set Process Stack Pointer Limit
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
568 \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
569 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
570 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
571 __attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
572 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
573 __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
574 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
575
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
576
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
577 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
578 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
579 \brief Set Process Stack Pointer (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
580 \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
581 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
582 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
583 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
584 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
585 __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
586 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
587 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
588
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
589
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
590 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
591 \brief Get Main Stack Pointer Limit
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
592 \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
593 \return MSPLIM Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
594 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
595 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
596 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
597 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
598
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
599 __ASM volatile ("MRS %0, msplim" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
600
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
601 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
602 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
603
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
604
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
605 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
606 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
607 \brief Get Main Stack Pointer Limit (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
608 \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
609 \return MSPLIM Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
610 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
611 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
612 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
613 register uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
614
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
615 __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
616 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
617 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
618 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
619
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
620
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
621 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
622 \brief Set Main Stack Pointer Limit
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
623 \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
624 \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
625 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
626 __attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
627 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
628 __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
629 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
630
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
631
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
632 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M') /* ToDo: ARMCC_V6: check predefined macro for mainline */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
633 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
634 \brief Set Main Stack Pointer Limit (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
635 \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
636 \param [in] MainStackPtrLimit Main Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
637 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
638 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
639 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
640 __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
641 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
642 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
643
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
644 #endif /* (__ARM_ARCH_8M__ == 1U) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
645
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
646
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
647 #if ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=4 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
648
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
649 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
650 \brief Get FPSCR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
651 \details eturns the current value of the Floating Point Status/Control register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
652 \return Floating Point Status/Control register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
653 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
654 #define __get_FPSCR __builtin_arm_get_fpscr
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
655 #if 0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
656 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
657 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
658 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
659 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
660
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
661 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
662 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
663 __ASM volatile ("");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
664 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
665 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
666 return(0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
667 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
668 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
669 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
670
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
671 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
672 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
673 \brief Get FPSCR (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
674 \details Returns the current value of the non-secure Floating Point Status/Control register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
675 \return Floating Point Status/Control register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
676 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
677 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FPSCR_NS(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
678 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
679 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
680 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
681
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
682 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
683 __ASM volatile ("VMRS %0, fpscr_ns" : "=r" (result) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
684 __ASM volatile ("");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
685 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
686 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
687 return(0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
688 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
689 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
690 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
691
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
692
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
693 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
694 \brief Set FPSCR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
695 \details Assigns the given value to the Floating Point Status/Control register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
696 \param [in] fpscr Floating Point Status/Control value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
697 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
698 #define __set_FPSCR __builtin_arm_set_fpscr
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
699 #if 0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
700 __attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
701 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
702 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
703 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
704 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
705 __ASM volatile ("");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
706 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
707 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
708 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
709
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
710 #if (__ARM_FEATURE_CMSE == 3U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
711 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
712 \brief Set FPSCR (non-secure)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
713 \details Assigns the given value to the non-secure Floating Point Status/Control register when in secure state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
714 \param [in] fpscr Floating Point Status/Control value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
715 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
716 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FPSCR_NS(uint32_t fpscr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
717 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
718 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
719 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
720 __ASM volatile ("VMSR fpscr_ns, %0" : : "r" (fpscr) : "vfpcc");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
721 __ASM volatile ("");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
722 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
723 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
724 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
725
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
726 #endif /* ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
727
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
728
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
729
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
730 /*@} end of CMSIS_Core_RegAccFunctions */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
731
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
732
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
733 /* ########################## Core Instruction Access ######################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
734 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
735 Access to dedicated instructions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
736 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
737 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
738
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
739 /* Define macros for porting to both thumb1 and thumb2.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
740 * For thumb1, use low register (r0-r7), specified by constraint "l"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
741 * Otherwise, use general registers, specified by constraint "r" */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
742 #if defined (__thumb__) && !defined (__thumb2__)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
743 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
744 #define __CMSIS_GCC_USE_REG(r) "l" (r)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
745 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
746 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
747 #define __CMSIS_GCC_USE_REG(r) "r" (r)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
748 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
749
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
750 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
751 \brief No Operation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
752 \details No Operation does nothing. This instruction can be used for code alignment purposes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
753 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
754 #define __NOP __builtin_arm_nop
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
755
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
756 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
757 \brief Wait For Interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
758 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
759 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
760 #define __WFI __builtin_arm_wfi
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
761
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
762
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
763 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
764 \brief Wait For Event
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
765 \details Wait For Event is a hint instruction that permits the processor to enter
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
766 a low-power state until one of a number of events occurs.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
767 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
768 #define __WFE __builtin_arm_wfe
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
769
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
770
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
771 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
772 \brief Send Event
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
773 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
774 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
775 #define __SEV __builtin_arm_sev
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
776
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
777
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
778 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
779 \brief Instruction Synchronization Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
780 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
781 so that all instructions following the ISB are fetched from cache or memory,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
782 after the instruction has been completed.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
783 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
784 #define __ISB() __builtin_arm_isb(0xF);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
785
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
786 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
787 \brief Data Synchronization Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
788 \details Acts as a special kind of Data Memory Barrier.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
789 It completes when all explicit memory accesses before this instruction complete.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
790 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
791 #define __DSB() __builtin_arm_dsb(0xF);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
792
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
793
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
794 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
795 \brief Data Memory Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
796 \details Ensures the apparent order of the explicit memory operations before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
797 and after the instruction, without ensuring their completion.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
798 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
799 #define __DMB() __builtin_arm_dmb(0xF);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
800
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
801
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
802 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
803 \brief Reverse byte order (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
804 \details Reverses the byte order in integer value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
805 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
806 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
807 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
808 #define __REV __builtin_bswap32
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
809
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
810
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
811 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
812 \brief Reverse byte order (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
813 \details Reverses the byte order in two unsigned short values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
814 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
815 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
816 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
817 #define __REV16 __builtin_bswap16 /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
818 #if 0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
819 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
820 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
821 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
822
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
823 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
824 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
825 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
826 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
827
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
828
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
829 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
830 \brief Reverse byte order in signed short value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
831 \details Reverses the byte order in a signed short value with sign extension to integer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
832 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
833 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
834 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
835 /* ToDo: ARMCC_V6: check if __builtin_bswap16 could be used */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
836 __attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
837 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
838 int32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
839
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
840 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
841 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
842 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
843
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
844
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
845 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
846 \brief Rotate Right in unsigned value (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
847 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
848 \param [in] op1 Value to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
849 \param [in] op2 Number of Bits to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
850 \return Rotated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
851 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
852 __attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
853 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
854 return (op1 >> op2) | (op1 << (32U - op2));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
855 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
856
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
857
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
858 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
859 \brief Breakpoint
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
860 \details Causes the processor to enter Debug state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
861 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
862 \param [in] value is ignored by the processor.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
863 If required, a debugger can use it to store additional information about the breakpoint.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
864 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
865 #define __BKPT(value) __ASM volatile ("bkpt "#value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
866
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
867
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
868 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
869 \brief Reverse bit order of value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
870 \details Reverses the bit order of the given value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
871 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
872 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
873 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
874 /* ToDo: ARMCC_V6: check if __builtin_arm_rbit is supported */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
875 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
876 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
877 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
878
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
879 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
880 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
881 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
882 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
883
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
884 result = value; /* r will be reversed bits of v; first get LSB of v */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
885 for (value >>= 1U; value; value >>= 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
886 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
887 result <<= 1U;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
888 result |= value & 1U;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
889 s--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
890 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
891 result <<= s; /* shift when v's highest bits are zero */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
892 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
893 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
894 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
895
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
896
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
897 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
898 \brief Count leading zeros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
899 \details Counts the number of leading zeros of a data value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
900 \param [in] value Value to count the leading zeros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
901 \return number of leading zeros in value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
902 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
903 #define __CLZ __builtin_clz
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
904
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
905
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
906 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) /* ToDo: ARMCC_V6: check if this is ok for cortex >=3 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
907
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
908 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
909 \brief LDR Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
910 \details Executes a exclusive LDR instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
911 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
912 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
913 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
914 #define __LDREXB (uint8_t)__builtin_arm_ldrex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
915
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
916
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
917 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
918 \brief LDR Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
919 \details Executes a exclusive LDR instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
920 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
921 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
922 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
923 #define __LDREXH (uint16_t)__builtin_arm_ldrex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
924
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
925
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
926 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
927 \brief LDR Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
928 \details Executes a exclusive LDR instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
929 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
930 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
931 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
932 #define __LDREXW (uint32_t)__builtin_arm_ldrex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
933
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
934
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
935 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
936 \brief STR Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
937 \details Executes a exclusive STR instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
938 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
939 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
940 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
941 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
942 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
943 #define __STREXB (uint32_t)__builtin_arm_strex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
944
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
945
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
946 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
947 \brief STR Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
948 \details Executes a exclusive STR instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
949 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
950 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
951 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
952 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
953 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
954 #define __STREXH (uint32_t)__builtin_arm_strex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
955
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
956
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
957 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
958 \brief STR Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
959 \details Executes a exclusive STR instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
960 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
961 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
962 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
963 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
964 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
965 #define __STREXW (uint32_t)__builtin_arm_strex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
966
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
967
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
968 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
969 \brief Remove the exclusive lock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
970 \details Removes the exclusive lock which is created by LDREX.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
971 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
972 #define __CLREX __builtin_arm_clrex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
973
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
974
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
975 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
976 \brief Signed Saturate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
977 \details Saturates a signed value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
978 \param [in] value Value to be saturated
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
979 \param [in] sat Bit position to saturate to (1..32)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
980 \return Saturated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
981 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
982 /*#define __SSAT __builtin_arm_ssat*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
983 #define __SSAT(ARG1,ARG2) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
984 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
985 int32_t __RES, __ARG1 = (ARG1); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
986 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
987 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
988 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
989
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
990
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
991 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
992 \brief Unsigned Saturate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
993 \details Saturates an unsigned value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
994 \param [in] value Value to be saturated
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
995 \param [in] sat Bit position to saturate to (0..31)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
996 \return Saturated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
997 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
998 #define __USAT __builtin_arm_usat
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
999 #if 0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1000 #define __USAT(ARG1,ARG2) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1001 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1002 uint32_t __RES, __ARG1 = (ARG1); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1003 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1004 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1005 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1006 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1007
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1008
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1009 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1010 \brief Rotate Right with Extend (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1011 \details Moves each bit of a bitstring right by one bit.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1012 The carry input is shifted in at the left end of the bitstring.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1013 \param [in] value Value to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1014 \return Rotated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1015 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1016 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1017 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1018 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1019
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1020 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1021 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1022 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1023
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1024
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1025 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1026 \brief LDRT Unprivileged (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1027 \details Executes a Unprivileged LDRT instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1028 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1029 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1030 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1031 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1032 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1033 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1034
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1035 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1036 return ((uint8_t) result); /* Add explicit type cast here */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1037 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1038
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1039
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1040 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1041 \brief LDRT Unprivileged (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1042 \details Executes a Unprivileged LDRT instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1043 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1044 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1045 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1046 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1047 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1048 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1049
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1050 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1051 return ((uint16_t) result); /* Add explicit type cast here */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1052 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1053
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1054
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1055 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1056 \brief LDRT Unprivileged (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1057 \details Executes a Unprivileged LDRT instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1058 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1059 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1060 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1061 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1062 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1063 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1064
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1065 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1066 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1067 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1068
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1069
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1070 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1071 \brief STRT Unprivileged (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1072 \details Executes a Unprivileged STRT instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1073 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1074 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1075 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1076 __attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1077 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1078 __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1079 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1080
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1081
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1082 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1083 \brief STRT Unprivileged (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1084 \details Executes a Unprivileged STRT instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1085 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1086 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1087 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1088 __attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1089 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1090 __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1091 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1092
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1093
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1094 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1095 \brief STRT Unprivileged (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1096 \details Executes a Unprivileged STRT instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1097 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1098 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1099 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1100 __attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1101 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1102 __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1103 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1104
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1105 #endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1106
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1107
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1108 #if (__ARM_ARCH_8M__ == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1109
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1110 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1111 \brief Load-Acquire (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1112 \details Executes a LDAB instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1113 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1114 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1115 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1116 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1117 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1118 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1119
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1120 __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1121 return ((uint8_t) result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1122 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1123
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1124
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1125 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1126 \brief Load-Acquire (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1127 \details Executes a LDAH instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1128 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1129 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1130 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1131 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1132 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1133 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1135 __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1136 return ((uint16_t) result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1137 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1138
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1139
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1140 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1141 \brief Load-Acquire (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1142 \details Executes a LDA instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1143 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1144 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1145 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1146 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1147 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1148 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1149
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1150 __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1151 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1152 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1153
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1154
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1155 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1156 \brief Store-Release (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1157 \details Executes a STLB instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1158 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1159 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1160 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1161 __attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1162 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1163 __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1164 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1165
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1166
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1167 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1168 \brief Store-Release (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1169 \details Executes a STLH instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1170 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1171 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1172 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1173 __attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1174 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1175 __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1176 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1177
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1178
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1179 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1180 \brief Store-Release (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1181 \details Executes a STL instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1182 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1183 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1184 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1185 __attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1186 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1187 __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1188 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1189
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1190
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1191 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1192 \brief Load-Acquire Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1193 \details Executes a LDAB exclusive instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1194 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1195 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1196 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1197 #define __LDAEXB (uint8_t)__builtin_arm_ldaex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1198
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1199
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1200 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1201 \brief Load-Acquire Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1202 \details Executes a LDAH exclusive instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1203 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1204 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1205 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1206 #define __LDAEXH (uint16_t)__builtin_arm_ldaex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1207
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1208
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1209 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1210 \brief Load-Acquire Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1211 \details Executes a LDA exclusive instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1212 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1213 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1214 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1215 #define __LDAEX (uint32_t)__builtin_arm_ldaex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1216
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1217
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1218 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1219 \brief Store-Release Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1220 \details Executes a STLB exclusive instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1221 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1222 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1223 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1224 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1225 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1226 #define __STLEXB (uint32_t)__builtin_arm_stlex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1227
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1228
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1229 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1230 \brief Store-Release Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1231 \details Executes a STLH exclusive instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1232 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1233 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1234 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1235 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1236 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1237 #define __STLEXH (uint32_t)__builtin_arm_stlex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1238
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1239
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1240 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1241 \brief Store-Release Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1242 \details Executes a STL exclusive instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1243 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1244 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1245 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1246 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1247 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1248 #define __STLEX (uint32_t)__builtin_arm_stlex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1249
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1250 #endif /* (__ARM_ARCH_8M__ == 1U) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1251
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1252 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1253
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1254
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1255 /* ################### Compiler specific Intrinsics ########################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1256 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1257 Access to dedicated SIMD instructions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1258 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1259 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1260
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1261 #if (__ARM_FEATURE_DSP == 1U) /* ToDo: ARMCC_V6: This should be ARCH >= ARMv7-M + SIMD */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1262
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1263 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1264 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1265 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1266
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1267 __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1268 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1269 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1270
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1271 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1272 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1273 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1274
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1275 __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1276 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1277 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1278
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1279 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1280 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1281 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1282
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1283 __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1284 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1285 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1286
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1287 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1288 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1289 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1290
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1291 __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1292 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1293 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1294
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1295 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1296 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1297 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1298
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1299 __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1300 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1301 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1302
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1303 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1304 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1305 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1306
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1307 __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1308 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1309 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1310
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1311
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1312 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1313 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1314 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1315
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1316 __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1317 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1318 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1319
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1320 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1321 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1322 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1323
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1324 __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1325 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1326 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1327
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1328 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1329 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1330 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1331
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1332 __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1333 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1334 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1335
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1336 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1337 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1338 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1339
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1340 __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1341 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1342 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1343
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1344 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1345 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1346 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1347
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1348 __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1349 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1350 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1351
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1352 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1353 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1354 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1355
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1356 __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1357 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1358 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1359
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1360
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1361 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1362 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1363 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1364
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1365 __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1366 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1367 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1368
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1369 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1370 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1371 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1372
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1373 __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1374 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1375 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1376
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1377 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1378 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1379 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1380
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1381 __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1382 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1383 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1384
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1385 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1386 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1387 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1388
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1389 __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1390 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1391 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1392
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1393 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1394 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1395 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1396
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1397 __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1398 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1399 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1400
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1401 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1402 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1403 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1404
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1405 __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1406 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1407 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1408
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1409 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1410 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1411 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1412
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1413 __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1414 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1415 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1416
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1417 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1418 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1419 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1420
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1421 __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1422 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1423 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1424
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1425 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1426 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1427 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1428
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1429 __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1430 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1431 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1432
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1433 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1434 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1435 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1436
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1437 __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1438 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1439 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1440
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1441 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1442 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1443 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1444
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1445 __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1446 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1447 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1448
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1449 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1450 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1451 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1452
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1453 __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1454 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1455 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1456
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1457 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1458 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1459 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1460
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1461 __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1462 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1463 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1464
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1465 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1466 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1467 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1468
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1469 __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1470 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1471 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1472
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1473 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1474 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1475 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1476
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1477 __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1478 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1479 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1480
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1481 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1482 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1483 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1484
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1485 __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1486 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1487 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1488
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1489 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1490 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1491 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1492
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1493 __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1494 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1495 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1496
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1497 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1498 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1499 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1500
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1501 __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1502 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1503 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1504
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1505 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1506 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1507 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1508
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1509 __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1510 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1511 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1512
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1513 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1514 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1515 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1516
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1517 __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1518 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1519 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1520
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1521 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1522 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1523 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1524
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1525 __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1526 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1527 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1528
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1529 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1530 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1531 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1532
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1533 __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1534 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1535 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1536
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1537 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1538 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1539 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1540
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1541 __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1542 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1543 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1544
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1545 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1546 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1547 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1548
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1549 __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1550 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1551 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1552
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1553 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1554 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1555 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1556
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1557 __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1558 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1559 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1560
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1561 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1562 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1563 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1564
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1565 __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1566 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1567 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1568
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1569 #define __SSAT16(ARG1,ARG2) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1570 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1571 uint32_t __RES, __ARG1 = (ARG1); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1572 __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1573 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1574 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1575
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1576 #define __USAT16(ARG1,ARG2) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1577 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1578 uint32_t __RES, __ARG1 = (ARG1); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1579 __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1580 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1581 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1582
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1583 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1584 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1585 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1586
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1587 __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1588 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1589 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1590
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1591 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1592 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1593 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1594
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1595 __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1596 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1597 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1598
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1599 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1600 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1601 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1602
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1603 __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1604 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1605 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1606
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1607 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1608 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1609 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1610
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1611 __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1612 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1613 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1614
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1615 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1616 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1617 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1618
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1619 __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1620 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1621 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1622
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1623 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1624 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1625 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1626
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1627 __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1628 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1629 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1630
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1631 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1632 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1633 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1634
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1635 __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1636 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1637 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1638
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1639 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1640 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1641 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1642
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1643 __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1644 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1645 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1646
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1647 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1648 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1649 union llreg_u{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1650 uint32_t w32[2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1651 uint64_t w64;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1652 } llr;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1653 llr.w64 = acc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1654
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1655 #ifndef __ARMEB__ /* Little endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1656 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1657 #else /* Big endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1658 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1659 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1660
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1661 return(llr.w64);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1662 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1663
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1664 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1665 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1666 union llreg_u{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1667 uint32_t w32[2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1668 uint64_t w64;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1669 } llr;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1670 llr.w64 = acc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1671
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1672 #ifndef __ARMEB__ /* Little endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1673 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1674 #else /* Big endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1675 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1676 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1677
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1678 return(llr.w64);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1679 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1680
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1681 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1682 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1683 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1684
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1685 __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1686 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1687 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1688
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1689 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1690 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1691 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1692
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1693 __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1694 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1695 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1696
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1697 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1698 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1699 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1700
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1701 __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1702 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1703 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1704
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1705 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1706 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1707 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1708
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1709 __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1710 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1711 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1712
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1713 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1714 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1715 union llreg_u{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1716 uint32_t w32[2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1717 uint64_t w64;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1718 } llr;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1719 llr.w64 = acc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1720
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1721 #ifndef __ARMEB__ /* Little endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1722 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1723 #else /* Big endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1724 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1725 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1726
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1727 return(llr.w64);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1728 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1729
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1730 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1731 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1732 union llreg_u{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1733 uint32_t w32[2];
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1734 uint64_t w64;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1735 } llr;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1736 llr.w64 = acc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1737
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1738 #ifndef __ARMEB__ /* Little endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1739 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1740 #else /* Big endian */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1741 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1742 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1743
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1744 return(llr.w64);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1745 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1746
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1747 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1748 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1749 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1750
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1751 __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1752 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1753 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1754
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1755 __attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1756 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1757 int32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1758
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1759 __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1760 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1761 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1762
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1763 __attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1764 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1765 int32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1766
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1767 __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1768 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1769 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1770
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1771 #define __PKHBT(ARG1,ARG2,ARG3) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1772 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1773 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1774 __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1775 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1776 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1777
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1778 #define __PKHTB(ARG1,ARG2,ARG3) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1779 ({ \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1780 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1781 if (ARG3 == 0) \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1782 __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1783 else \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1784 __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1785 __RES; \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1786 })
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1787
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1788 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1789 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1790 int32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1791
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1792 __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1793 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1794 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1795
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1796 #endif /* (__ARM_FEATURE_DSP == 1U) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1797 /*@} end of group CMSIS_SIMD_intrinsics */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1798
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1799
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1800 #endif /* __CMSIS_ARMCC_V6_H */