1 /**************************************************************************//**
2 * @file cmsis_armclang.h
3 * @brief CMSIS compiler specific macros, functions, instructions
6 ******************************************************************************/
8 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
25 #ifndef __CMSIS_CP15_H
26 #define __CMSIS_CP15_H
29 \return Auxiliary Control register value
31 __STATIC_FORCEINLINE uint32_t __get_ACTLR(void)
34 // __ASM volatile("MRC p15, 0, %0, c1, c0, 1" : "=r" (result) : : "memory" );
35 __get_CP(15, 0, result, 1, 0, 1);
40 \param [in] actlr Auxiliary Control value to set
42 __STATIC_FORCEINLINE void __set_ACTLR(uint32_t actlr)
44 // __ASM volatile ("MCR p15, 0, %0, c1, c0, 1" : : "r" (actlr) : "memory");
45 __set_CP(15, 0, actlr, 1, 0, 1);
49 \return Coprocessor Access Control register value
51 __STATIC_FORCEINLINE uint32_t __get_CPACR(void)
54 // __ASM volatile("MRC p15, 0, %0, c1, c0, 2" : "=r"(result) : : "memory");
55 __get_CP(15, 0, result, 1, 0, 2);
60 \param [in] cpacr Coprocessor Access Control value to set
62 __STATIC_FORCEINLINE void __set_CPACR(uint32_t cpacr)
64 // __ASM volatile("MCR p15, 0, %0, c1, c0, 2" : : "r"(cpacr) : "memory");
65 __set_CP(15, 0, cpacr, 1, 0, 2);
69 \return Data Fault Status Register value
71 __STATIC_FORCEINLINE uint32_t __get_DFSR(void)
74 // __ASM volatile("MRC p15, 0, %0, c5, c0, 0" : "=r"(result) : : "memory");
75 __get_CP(15, 0, result, 5, 0, 0);
80 \param [in] dfsr Data Fault Status value to set
82 __STATIC_FORCEINLINE void __set_DFSR(uint32_t dfsr)
84 // __ASM volatile("MCR p15, 0, %0, c5, c0, 0" : : "r"(dfsr) : "memory");
85 __set_CP(15, 0, dfsr, 5, 0, 0);
89 \return Instruction Fault Status Register value
91 __STATIC_FORCEINLINE uint32_t __get_IFSR(void)
94 // __ASM volatile("MRC p15, 0, %0, c5, c0, 1" : "=r"(result) : : "memory");
95 __get_CP(15, 0, result, 5, 0, 1);
100 \param [in] ifsr Instruction Fault Status value to set
102 __STATIC_FORCEINLINE void __set_IFSR(uint32_t ifsr)
104 // __ASM volatile("MCR p15, 0, %0, c5, c0, 1" : : "r"(ifsr) : "memory");
105 __set_CP(15, 0, ifsr, 5, 0, 1);
109 \return Interrupt Status Register value
111 __STATIC_FORCEINLINE uint32_t __get_ISR(void)
114 // __ASM volatile("MRC p15, 0, %0, c12, c1, 0" : "=r"(result) : : "memory");
115 __get_CP(15, 0, result, 12, 1, 0);
120 \return Configuration Base Address register value
122 __STATIC_FORCEINLINE uint32_t __get_CBAR()
125 // __ASM volatile("MRC p15, 4, %0, c15, c0, 0" : "=r"(result) : : "memory");
126 __get_CP(15, 4, result, 15, 0, 0);
132 This function returns the value of the Translation Table Base Register 0.
134 \return Translation Table Base Register 0 value
136 __STATIC_FORCEINLINE uint32_t __get_TTBR0()
139 // __ASM volatile("MRC p15, 0, %0, c2, c0, 0" : "=r"(result) : : "memory");
140 __get_CP(15, 0, result, 2, 0, 0);
146 This function assigns the given value to the Translation Table Base Register 0.
148 \param [in] ttbr0 Translation Table Base Register 0 value to set
150 __STATIC_FORCEINLINE void __set_TTBR0(uint32_t ttbr0)
152 // __ASM volatile("MCR p15, 0, %0, c2, c0, 0" : : "r"(ttbr0) : "memory");
153 __set_CP(15, 0, ttbr0, 2, 0, 0);
158 This function returns the value of the Domain Access Control Register.
160 \return Domain Access Control Register value
162 __STATIC_FORCEINLINE uint32_t __get_DACR()
165 // __ASM volatile("MRC p15, 0, %0, c3, c0, 0" : "=r"(result) : : "memory");
166 __get_CP(15, 0, result, 3, 0, 0);
172 This function assigns the given value to the Domain Access Control Register.
174 \param [in] dacr Domain Access Control Register value to set
176 __STATIC_FORCEINLINE void __set_DACR(uint32_t dacr)
178 // __ASM volatile("MCR p15, 0, %0, c3, c0, 0" : : "r"(dacr) : "memory");
179 __set_CP(15, 0, dacr, 3, 0, 0);
184 This function assigns the given value to the System Control Register.
186 \param [in] sctlr System Control Register value to set
188 __STATIC_FORCEINLINE void __set_SCTLR(uint32_t sctlr)
190 // __ASM volatile("MCR p15, 0, %0, c1, c0, 0" : : "r"(sctlr) : "memory");
191 __set_CP(15, 0, sctlr, 1, 0, 0);
195 \return System Control Register value
197 __STATIC_FORCEINLINE uint32_t __get_SCTLR()
200 // __ASM volatile("MRC p15, 0, %0, c1, c0, 0" : "=r"(result) : : "memory");
201 __get_CP(15, 0, result, 1, 0, 0);
206 \param [in] actrl Auxiliary Control Register value to set
208 __STATIC_FORCEINLINE void __set_ACTRL(uint32_t actrl)
210 // __ASM volatile("MCR p15, 0, %0, c1, c0, 1" : : "r"(actrl) : "memory");
211 __set_CP(15, 0, actrl, 1, 0, 1);
215 \return Auxiliary Control Register value
217 __STATIC_FORCEINLINE uint32_t __get_ACTRL(void)
220 // __ASM volatile("MRC p15, 0, %0, c1, c0, 1" : "=r"(result) : : "memory");
221 __get_CP(15, 0, result, 1, 0, 1);
227 This function returns the value of the Multiprocessor Affinity Register.
229 \return Multiprocessor Affinity Register value
231 __STATIC_FORCEINLINE uint32_t __get_MPIDR(void)
234 // __ASM volatile("MRC p15, 0, %0, c0, c0, 5" : "=r"(result) : : "memory");
235 __get_CP(15, 0, result, 0, 0, 5);
241 This function returns the value of the Vector Base Address Register.
243 \return Vector Base Address Register
245 __STATIC_FORCEINLINE uint32_t __get_VBAR(void)
248 // __ASM volatile("MRC p15, 0, %0, c12, c0, 0" : "=r"(result) : : "memory");
249 __get_CP(15, 0, result, 12, 0, 0);
255 This function assigns the given value to the Vector Base Address Register.
257 \param [in] vbar Vector Base Address Register value to set
259 __STATIC_FORCEINLINE void __set_VBAR(uint32_t vbar)
261 // __ASM volatile("MCR p15, 0, %0, c12, c0, 1" : : "r"(vbar) : "memory");
262 __set_CP(15, 0, vbar, 12, 0, 1);
265 #if defined(__CORTEX_A) && (__CORTEX_A == 7U) && \
266 defined(__TIM_PRESENT) && (__TIM_PRESENT == 1U)
268 /** \brief Set CNTFRQ
270 This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ).
272 \param [in] value CNTFRQ Register value to set
274 __STATIC_FORCEINLINE void __set_CNTFRQ(uint32_t value)
276 // __ASM volatile("MCR p15, 0, %0, c14, c0, 0" : : "r"(value) : "memory");
277 __set_CP(15, 0, value, 14, 0, 0);
280 /** \brief Get CNTFRQ
282 This function returns the value of the PL1 Physical Timer Counter Frequency Register (CNTFRQ).
284 \return CNTFRQ Register value
286 __STATIC_FORCEINLINE uint32_t __get_CNTFRQ()
289 // __ASM volatile("MRC p15, 0, %0, c14, c0, 0" : "=r"(result) : : "memory");
290 __get_CP(15, 0, result, 14, 0 , 0);
294 /** \brief Set CNTP_TVAL
296 This function assigns the given value to PL1 Physical Timer Value Register (CNTP_TVAL).
298 \param [in] value CNTP_TVAL Register value to set
300 __STATIC_FORCEINLINE void __set_CNTP_TVAL(uint32_t value)
302 // __ASM volatile("MCR p15, 0, %0, c14, c2, 0" : : "r"(value) : "memory");
303 __set_CP(15, 0, value, 14, 2, 0);
306 /** \brief Get CNTP_TVAL
308 This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL).
310 \return CNTP_TVAL Register value
312 __STATIC_FORCEINLINE uint32_t __get_CNTP_TVAL()
315 // __ASM volatile("MRC p15, 0, %0, c14, c2, 0" : "=r"(result) : : "memory");
316 __get_CP(15, 0, result, 14, 2, 0);
320 /** \brief Set CNTP_CTL
322 This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL).
324 \param [in] value CNTP_CTL Register value to set
326 __STATIC_FORCEINLINE void __set_CNTP_CTL(uint32_t value)
328 // __ASM volatile("MCR p15, 0, %0, c14, c2, 1" : : "r"(value) : "memory");
329 __set_CP(15, 0, value, 14, 2, 1);
332 /** \brief Get CNTP_CTL register
333 \return CNTP_CTL Register value
335 __STATIC_FORCEINLINE uint32_t __get_CNTP_CTL()
338 // __ASM volatile("MRC p15, 0, %0, c14, c2, 1" : "=r"(result) : : "memory");
339 __get_CP(15, 0, result, 14, 2, 1);
345 /** \brief Set TLBIALL
349 __STATIC_FORCEINLINE void __set_TLBIALL(uint32_t value)
351 // __ASM volatile("MCR p15, 0, %0, c8, c7, 0" : : "r"(value) : "memory");
352 __set_CP(15, 0, value, 8, 7, 0);
355 /** \brief Set BPIALL.
357 Branch Predictor Invalidate All
359 __STATIC_FORCEINLINE void __set_BPIALL(uint32_t value)
361 // __ASM volatile("MCR p15, 0, %0, c7, c5, 6" : : "r"(value) : "memory");
362 __set_CP(15, 0, value, 7, 5, 6);
365 /** \brief Set ICIALLU
367 Instruction Cache Invalidate All
369 __STATIC_FORCEINLINE void __set_ICIALLU(uint32_t value)
371 // __ASM volatile("MCR p15, 0, %0, c7, c5, 0" : : "r"(value) : "memory");
372 __set_CP(15, 0, value, 7, 5, 0);
375 /** \brief Set DCCMVAC
379 __STATIC_FORCEINLINE void __set_DCCMVAC(uint32_t value)
381 // __ASM volatile("MCR p15, 0, %0, c7, c10, 1" : : "r"(value) : "memory");
382 __set_CP(15, 0, value, 7, 10, 1);
385 /** \brief Set DCIMVAC
387 Data cache invalidate
389 __STATIC_FORCEINLINE void __set_DCIMVAC(uint32_t value)
391 // __ASM volatile("MCR p15, 0, %0, c7, c6, 1" : : "r"(value) : "memory");
392 __set_CP(15, 0, value, 7, 6, 1);
395 /** \brief Set DCCIMVAC
397 Data cache clean and invalidate
399 __STATIC_FORCEINLINE void __set_DCCIMVAC(uint32_t value)
401 // __ASM volatile("MCR p15, 0, %0, c7, c14, 1" : : "r"(value) : "memory");
402 __set_CP(15, 0, value, 7, 14, 1);