annotate f103c8/Drivers/CMSIS/Include/cmsis_armcc.h @ 2:0c59e7a7782a

Working on GPIO and RCC
author cin
date Mon, 16 Jan 2017 11:04:47 +0300
parents
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.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_H
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 #define __CMSIS_ARMCC_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 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 /* ########################### Core Function Access ########################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 /** \ingroup CMSIS_Core_FunctionInterface
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 /* intrinsic void __enable_irq(); */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 /* intrinsic void __disable_irq(); */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 \brief Get Control Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 \details Returns the content of the Control Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 \return Control Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 __STATIC_INLINE uint32_t __get_CONTROL(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 register uint32_t __regControl __ASM("control");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 return(__regControl);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 \brief Set Control Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 \details Writes the given value to the Control Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 \param [in] control Control Register value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 __STATIC_INLINE void __set_CONTROL(uint32_t control)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 register uint32_t __regControl __ASM("control");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 __regControl = control;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 \brief Get IPSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78 \details Returns the content of the IPSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 \return IPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 __STATIC_INLINE uint32_t __get_IPSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 register uint32_t __regIPSR __ASM("ipsr");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 return(__regIPSR);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 \brief Get APSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90 \details Returns the content of the APSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 \return APSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 __STATIC_INLINE uint32_t __get_APSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 register uint32_t __regAPSR __ASM("apsr");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 return(__regAPSR);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 \brief Get xPSR Register
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 \details Returns the content of the xPSR Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 \return xPSR Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 __STATIC_INLINE uint32_t __get_xPSR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 register uint32_t __regXPSR __ASM("xpsr");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 return(__regXPSR);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 \brief Get Process Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 \details Returns the current value of the Process Stack Pointer (PSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 \return PSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 __STATIC_INLINE uint32_t __get_PSP(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 register uint32_t __regProcessStackPointer __ASM("psp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 return(__regProcessStackPointer);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 \brief Set Process Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126 \details Assigns the given value to the Process Stack Pointer (PSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 \param [in] topOfProcStack Process Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 register uint32_t __regProcessStackPointer __ASM("psp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 __regProcessStackPointer = topOfProcStack;
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
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 \brief Get Main Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 \details Returns the current value of the Main Stack Pointer (MSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 \return MSP Register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 __STATIC_INLINE uint32_t __get_MSP(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 register uint32_t __regMainStackPointer __ASM("msp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 return(__regMainStackPointer);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 \brief Set Main Stack Pointer
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 \details Assigns the given value to the Main Stack Pointer (MSP).
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 \param [in] topOfMainStack Main Stack Pointer value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155 register uint32_t __regMainStackPointer __ASM("msp");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 __regMainStackPointer = topOfMainStack;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 \brief Get Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 \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
163 \return Priority Mask value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 __STATIC_INLINE uint32_t __get_PRIMASK(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 register uint32_t __regPriMask __ASM("primask");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168 return(__regPriMask);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173 \brief Set Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 \details Assigns the given value to the Priority Mask Register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 \param [in] priMask Priority Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179 register uint32_t __regPriMask __ASM("primask");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180 __regPriMask = (priMask);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184 #if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187 \brief Enable FIQ
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191 #define __enable_fault_irq __enable_fiq
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 \brief Disable FIQ
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197 Can only be executed in Privileged modes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 #define __disable_fault_irq __disable_fiq
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 \brief Get Base Priority
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204 \details Returns the current value of the Base Priority register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205 \return Base Priority register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 __STATIC_INLINE uint32_t __get_BASEPRI(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209 register uint32_t __regBasePri __ASM("basepri");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210 return(__regBasePri);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 \brief Set Base Priority
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 \details Assigns the given value to the Base Priority register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219 __STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 register uint32_t __regBasePri __ASM("basepri");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 __regBasePri = (basePri & 0xFFU);
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
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 \brief Set Base Priority with condition
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228 \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
229 or the new value increases the BASEPRI priority level.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 \param [in] basePri Base Priority value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234 register uint32_t __regBasePriMax __ASM("basepri_max");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 __regBasePriMax = (basePri & 0xFFU);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240 \brief Get Fault Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241 \details Returns the current value of the Fault Mask register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 \return Fault Mask register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 __STATIC_INLINE uint32_t __get_FAULTMASK(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 register uint32_t __regFaultMask __ASM("faultmask");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247 return(__regFaultMask);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248 }
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 \brief Set Fault Mask
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
253 \details Assigns the given value to the Fault Mask register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
254 \param [in] faultMask Fault Mask value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
255 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
256 __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
257 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
258 register uint32_t __regFaultMask __ASM("faultmask");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
259 __regFaultMask = (faultMask & (uint32_t)1);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
260 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
261
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
262 #endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */
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 #if (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
266
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
267 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
268 \brief Get FPSCR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
269 \details Returns the current value of the Floating Point Status/Control register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
270 \return Floating Point Status/Control register value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
271 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
272 __STATIC_INLINE uint32_t __get_FPSCR(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
273 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
274 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
275 register uint32_t __regfpscr __ASM("fpscr");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
276 return(__regfpscr);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
277 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
278 return(0U);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
279 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
280 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
281
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
282
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
283 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
284 \brief Set FPSCR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
285 \details Assigns the given value to the Floating Point Status/Control register.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
286 \param [in] fpscr Floating Point Status/Control value to set
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
287 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
288 __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
289 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
290 #if (__FPU_PRESENT == 1U) && (__FPU_USED == 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
291 register uint32_t __regfpscr __ASM("fpscr");
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
292 __regfpscr = (fpscr);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
293 #endif
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 #endif /* (__CORTEX_M == 0x04U) || (__CORTEX_M == 0x07U) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
297
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
298
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
299
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
300 /*@} end of CMSIS_Core_RegAccFunctions */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
301
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
302
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
303 /* ########################## Core Instruction Access ######################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
304 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
305 Access to dedicated instructions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
306 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
307 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
308
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
309 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
310 \brief No Operation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
311 \details No Operation does nothing. This instruction can be used for code alignment purposes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
312 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
313 #define __NOP __nop
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
314
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
315
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
316 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
317 \brief Wait For Interrupt
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
318 \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
319 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
320 #define __WFI __wfi
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
321
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
322
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
323 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
324 \brief Wait For Event
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
325 \details Wait For Event is a hint instruction that permits the processor to enter
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
326 a low-power state until one of a number of events occurs.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
327 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
328 #define __WFE __wfe
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
329
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 \brief Send Event
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
333 \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
334 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
335 #define __SEV __sev
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
336
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
337
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
338 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
339 \brief Instruction Synchronization Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
340 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
341 so that all instructions following the ISB are fetched from cache or memory,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
342 after the instruction has been completed.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
343 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
344 #define __ISB() do {\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
345 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
346 __isb(0xF);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
347 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
348 } while (0U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
349
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
350 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
351 \brief Data Synchronization Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
352 \details Acts as a special kind of Data Memory Barrier.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
353 It completes when all explicit memory accesses before this instruction complete.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
354 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
355 #define __DSB() do {\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
356 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
357 __dsb(0xF);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
358 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
359 } while (0U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
360
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
361 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
362 \brief Data Memory Barrier
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
363 \details Ensures the apparent order of the explicit memory operations before
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
364 and after the instruction, without ensuring their completion.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
365 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
366 #define __DMB() do {\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
367 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
368 __dmb(0xF);\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
369 __schedule_barrier();\
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
370 } while (0U)
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 \brief Reverse byte order (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
374 \details Reverses the byte order in integer value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
375 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
376 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
377 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
378 #define __REV __rev
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
379
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
380
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
381 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
382 \brief Reverse byte order (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
383 \details Reverses the byte order in two unsigned short values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
384 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
385 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
386 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
387 #ifndef __NO_EMBEDDED_ASM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
388 __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
389 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
390 rev16 r0, r0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
391 bx lr
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
392 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
393 #endif
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 \brief Reverse byte order in signed short value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
397 \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
398 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
399 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
400 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
401 #ifndef __NO_EMBEDDED_ASM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
402 __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
403 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
404 revsh r0, r0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
405 bx lr
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
406 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
407 #endif
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 \brief Rotate Right in unsigned value (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
412 \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
413 \param [in] value Value to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
414 \param [in] value Number of Bits to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
415 \return Rotated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
416 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
417 #define __ROR __ror
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
418
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
419
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
420 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
421 \brief Breakpoint
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
422 \details Causes the processor to enter Debug state.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
423 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
424 \param [in] value is ignored by the processor.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
425 If required, a debugger can use it to store additional information about the breakpoint.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
426 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
427 #define __BKPT(value) __breakpoint(value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
428
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
429
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
430 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
431 \brief Reverse bit order of value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
432 \details Reverses the bit order of the given value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
433 \param [in] value Value to reverse
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
434 \return Reversed value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
435 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
436 #if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
437 #define __RBIT __rbit
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
438 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
439 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
440 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
441 uint32_t result;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
442 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
443
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
444 result = value; /* r will be reversed bits of v; first get LSB of v */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
445 for (value >>= 1U; value; value >>= 1U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
446 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
447 result <<= 1U;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
448 result |= value & 1U;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
449 s--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
450 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
451 result <<= s; /* shift when v's highest bits are zero */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
452 return(result);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
453 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
454 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
455
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
456
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
457 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
458 \brief Count leading zeros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
459 \details Counts the number of leading zeros of a data value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
460 \param [in] value Value to count the leading zeros
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
461 \return number of leading zeros in value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
462 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
463 #define __CLZ __clz
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
464
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
465
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
466 #if (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
467
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
468 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
469 \brief LDR Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
470 \details Executes a exclusive LDR instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
471 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
472 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
473 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
474 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
475 #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
476 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
477 #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
478 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
479
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
480
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
481 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
482 \brief LDR Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
483 \details Executes a exclusive LDR instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
484 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
485 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
486 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
487 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
488 #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
489 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
490 #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
491 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
492
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
493
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
494 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
495 \brief LDR Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
496 \details Executes a exclusive LDR instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
497 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
498 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
499 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
500 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
501 #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
502 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
503 #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
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 STR Exclusive (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
509 \details Executes a exclusive STR instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
510 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
511 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
512 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
513 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
514 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
515 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
516 #define __STREXB(value, ptr) __strex(value, ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
517 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
518 #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
519 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
520
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
521
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
522 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
523 \brief STR Exclusive (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
524 \details Executes a exclusive STR instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
525 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
526 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
527 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
528 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
529 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
530 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
531 #define __STREXH(value, ptr) __strex(value, ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
532 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
533 #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
534 #endif
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 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
538 \brief STR Exclusive (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
539 \details Executes a exclusive STR instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
540 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
541 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
542 \return 0 Function succeeded
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
543 \return 1 Function failed
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
544 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
545 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
546 #define __STREXW(value, ptr) __strex(value, ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
547 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
548 #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
549 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
550
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
551
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
552 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
553 \brief Remove the exclusive lock
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
554 \details Removes the exclusive lock which is created by LDREX.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
555 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
556 #define __CLREX __clrex
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
557
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
558
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
559 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
560 \brief Signed Saturate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
561 \details Saturates a signed value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
562 \param [in] value Value to be saturated
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
563 \param [in] sat Bit position to saturate to (1..32)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
564 \return Saturated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
565 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
566 #define __SSAT __ssat
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
567
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
568
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
569 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
570 \brief Unsigned Saturate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
571 \details Saturates an unsigned value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
572 \param [in] value Value to be saturated
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
573 \param [in] sat Bit position to saturate to (0..31)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
574 \return Saturated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
575 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
576 #define __USAT __usat
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
577
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
578
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
579 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
580 \brief Rotate Right with Extend (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
581 \details Moves each bit of a bitstring right by one bit.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
582 The carry input is shifted in at the left end of the bitstring.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
583 \param [in] value Value to rotate
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
584 \return Rotated value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
585 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
586 #ifndef __NO_EMBEDDED_ASM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
587 __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
588 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
589 rrx r0, r0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
590 bx lr
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
591 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
592 #endif
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
593
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
594
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
595 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
596 \brief LDRT Unprivileged (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
597 \details Executes a Unprivileged LDRT instruction for 8 bit value.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
598 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
599 \return value of type uint8_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
600 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
601 #define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
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 \brief LDRT Unprivileged (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
606 \details Executes a Unprivileged LDRT instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
607 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
608 \return value of type uint16_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
609 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
610 #define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
611
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
612
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
613 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
614 \brief LDRT Unprivileged (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
615 \details Executes a Unprivileged LDRT instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
616 \param [in] ptr Pointer to data
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
617 \return value of type uint32_t at (*ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
618 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
619 #define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
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 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
623 \brief STRT Unprivileged (8 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
624 \details Executes a Unprivileged STRT instruction for 8 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
625 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
626 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
627 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
628 #define __STRBT(value, ptr) __strt(value, ptr)
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 \brief STRT Unprivileged (16 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
633 \details Executes a Unprivileged STRT instruction for 16 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
634 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
635 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
636 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
637 #define __STRHT(value, ptr) __strt(value, ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
638
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
639
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
640 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
641 \brief STRT Unprivileged (32 bit)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
642 \details Executes a Unprivileged STRT instruction for 32 bit values.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
643 \param [in] value Value to store
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
644 \param [in] ptr Pointer to location
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
645 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
646 #define __STRT(value, ptr) __strt(value, ptr)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
647
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
648 #endif /* (__CORTEX_M >= 0x03U) || (__CORTEX_SC >= 300U) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
649
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
650 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
651
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
652
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
653 /* ################### Compiler specific Intrinsics ########################### */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
654 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
655 Access to dedicated SIMD instructions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
656 @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
657 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
658
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
659 #if (__CORTEX_M >= 0x04U) /* only for Cortex-M4 and above */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
660
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
661 #define __SADD8 __sadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
662 #define __QADD8 __qadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
663 #define __SHADD8 __shadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
664 #define __UADD8 __uadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
665 #define __UQADD8 __uqadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
666 #define __UHADD8 __uhadd8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
667 #define __SSUB8 __ssub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
668 #define __QSUB8 __qsub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
669 #define __SHSUB8 __shsub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
670 #define __USUB8 __usub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
671 #define __UQSUB8 __uqsub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
672 #define __UHSUB8 __uhsub8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
673 #define __SADD16 __sadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
674 #define __QADD16 __qadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
675 #define __SHADD16 __shadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
676 #define __UADD16 __uadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
677 #define __UQADD16 __uqadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
678 #define __UHADD16 __uhadd16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
679 #define __SSUB16 __ssub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
680 #define __QSUB16 __qsub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
681 #define __SHSUB16 __shsub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
682 #define __USUB16 __usub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
683 #define __UQSUB16 __uqsub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
684 #define __UHSUB16 __uhsub16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
685 #define __SASX __sasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
686 #define __QASX __qasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
687 #define __SHASX __shasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
688 #define __UASX __uasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
689 #define __UQASX __uqasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
690 #define __UHASX __uhasx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
691 #define __SSAX __ssax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
692 #define __QSAX __qsax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
693 #define __SHSAX __shsax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
694 #define __USAX __usax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
695 #define __UQSAX __uqsax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
696 #define __UHSAX __uhsax
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
697 #define __USAD8 __usad8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
698 #define __USADA8 __usada8
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
699 #define __SSAT16 __ssat16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
700 #define __USAT16 __usat16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
701 #define __UXTB16 __uxtb16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
702 #define __UXTAB16 __uxtab16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
703 #define __SXTB16 __sxtb16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
704 #define __SXTAB16 __sxtab16
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
705 #define __SMUAD __smuad
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
706 #define __SMUADX __smuadx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
707 #define __SMLAD __smlad
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
708 #define __SMLADX __smladx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
709 #define __SMLALD __smlald
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
710 #define __SMLALDX __smlaldx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
711 #define __SMUSD __smusd
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
712 #define __SMUSDX __smusdx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
713 #define __SMLSD __smlsd
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
714 #define __SMLSDX __smlsdx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
715 #define __SMLSLD __smlsld
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
716 #define __SMLSLDX __smlsldx
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
717 #define __SEL __sel
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
718 #define __QADD __qadd
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
719 #define __QSUB __qsub
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
720
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
721 #define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
722 ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
723
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
724 #define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
725 ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
726
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
727 #define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
728 ((int64_t)(ARG3) << 32U) ) >> 32U))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
729
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
730 #endif /* (__CORTEX_M >= 0x04) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
731 /*@} end of group CMSIS_SIMD_intrinsics */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
732
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
733
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
734 #endif /* __CMSIS_ARMCC_H */