2 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 * CMSIS-Core(A) Compiler Specific Macros, Functions, Instructions
23 #ifndef __CMSIS_CP15_H
24 #define __CMSIS_CP15_H
26 #if defined ( __ICCARM__ )
27 #pragma system_include /* treat file as system include file for MISRA check */
28 #elif defined (__clang__)
29 #pragma clang system_header /* treat file as system include file */
33 \return Auxiliary Control register value
35 __STATIC_FORCEINLINE uint32_t __get_ACTLR(void)
38 __get_CP(15, 0, result, 1, 0, 1);
43 \param [in] actlr Auxiliary Control value to set
45 __STATIC_FORCEINLINE void __set_ACTLR(uint32_t actlr)
47 __set_CP(15, 0, actlr, 1, 0, 1);
51 \return Coprocessor Access Control register value
53 __STATIC_FORCEINLINE uint32_t __get_CPACR(void)
56 __get_CP(15, 0, result, 1, 0, 2);
61 \param [in] cpacr Coprocessor Access Control value to set
63 __STATIC_FORCEINLINE void __set_CPACR(uint32_t cpacr)
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 __get_CP(15, 0, result, 5, 0, 0);
79 \param [in] dfsr Data Fault Status value to set
81 __STATIC_FORCEINLINE void __set_DFSR(uint32_t dfsr)
83 __set_CP(15, 0, dfsr, 5, 0, 0);
87 \return Instruction Fault Status Register value
89 __STATIC_FORCEINLINE uint32_t __get_IFSR(void)
92 __get_CP(15, 0, result, 5, 0, 1);
97 \param [in] ifsr Instruction Fault Status value to set
99 __STATIC_FORCEINLINE void __set_IFSR(uint32_t ifsr)
101 __set_CP(15, 0, ifsr, 5, 0, 1);
105 \return Interrupt Status Register value
107 __STATIC_FORCEINLINE uint32_t __get_ISR(void)
110 __get_CP(15, 0, result, 12, 1, 0);
115 \return Configuration Base Address register value
117 __STATIC_FORCEINLINE uint32_t __get_CBAR(void)
120 __get_CP(15, 4, result, 15, 0, 0);
126 This function returns the value of the Translation Table Base Register 0.
128 \return Translation Table Base Register 0 value
130 __STATIC_FORCEINLINE uint32_t __get_TTBR0(void)
133 __get_CP(15, 0, result, 2, 0, 0);
139 This function assigns the given value to the Translation Table Base Register 0.
141 \param [in] ttbr0 Translation Table Base Register 0 value to set
143 __STATIC_FORCEINLINE void __set_TTBR0(uint32_t ttbr0)
145 __set_CP(15, 0, ttbr0, 2, 0, 0);
150 This function returns the value of the Domain Access Control Register.
152 \return Domain Access Control Register value
154 __STATIC_FORCEINLINE uint32_t __get_DACR(void)
157 __get_CP(15, 0, result, 3, 0, 0);
163 This function assigns the given value to the Domain Access Control Register.
165 \param [in] dacr Domain Access Control Register value to set
167 __STATIC_FORCEINLINE void __set_DACR(uint32_t dacr)
169 __set_CP(15, 0, dacr, 3, 0, 0);
174 This function assigns the given value to the System Control Register.
176 \param [in] sctlr System Control Register value to set
178 __STATIC_FORCEINLINE void __set_SCTLR(uint32_t sctlr)
180 __set_CP(15, 0, sctlr, 1, 0, 0);
184 \return System Control Register value
186 __STATIC_FORCEINLINE uint32_t __get_SCTLR(void)
189 __get_CP(15, 0, result, 1, 0, 0);
195 This function returns the value of the Multiprocessor Affinity Register.
197 \return Multiprocessor Affinity Register value
199 __STATIC_FORCEINLINE uint32_t __get_MPIDR(void)
202 __get_CP(15, 0, result, 0, 0, 5);
208 This function returns the value of the Vector Base Address Register.
210 \return Vector Base Address Register
212 __STATIC_FORCEINLINE uint32_t __get_VBAR(void)
215 __get_CP(15, 0, result, 12, 0, 0);
221 This function assigns the given value to the Vector Base Address Register.
223 \param [in] vbar Vector Base Address Register value to set
225 __STATIC_FORCEINLINE void __set_VBAR(uint32_t vbar)
227 __set_CP(15, 0, vbar, 12, 0, 0);
232 This function returns the value of the Monitor Vector Base Address Register.
234 \return Monitor Vector Base Address Register
236 __STATIC_FORCEINLINE uint32_t __get_MVBAR(void)
239 __get_CP(15, 0, result, 12, 0, 1);
245 This function assigns the given value to the Monitor Vector Base Address Register.
247 \param [in] mvbar Monitor Vector Base Address Register value to set
249 __STATIC_FORCEINLINE void __set_MVBAR(uint32_t mvbar)
251 __set_CP(15, 0, mvbar, 12, 0, 1);
254 #if (defined(__TIM_PRESENT) && (__TIM_PRESENT == 1U)) || \
257 /** \brief Set CNTFRQ
259 This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ).
261 \param [in] value CNTFRQ Register value to set
263 __STATIC_FORCEINLINE void __set_CNTFRQ(uint32_t value)
265 __set_CP(15, 0, value, 14, 0, 0);
268 /** \brief Get CNTFRQ
270 This function returns the value of the PL1 Physical Timer Counter Frequency Register (CNTFRQ).
272 \return CNTFRQ Register value
274 __STATIC_FORCEINLINE uint32_t __get_CNTFRQ(void)
277 __get_CP(15, 0, result, 14, 0 , 0);
281 /** \brief Set CNTP_TVAL
283 This function assigns the given value to PL1 Physical Timer Value Register (CNTP_TVAL).
285 \param [in] value CNTP_TVAL Register value to set
287 __STATIC_FORCEINLINE void __set_CNTP_TVAL(uint32_t value)
289 __set_CP(15, 0, value, 14, 2, 0);
292 /** \brief Get CNTP_TVAL
294 This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL).
296 \return CNTP_TVAL Register value
298 __STATIC_FORCEINLINE uint32_t __get_CNTP_TVAL(void)
301 __get_CP(15, 0, result, 14, 2, 0);
305 /** \brief Get CNTPCT
307 This function returns the value of the 64 bits PL1 Physical Count Register (CNTPCT).
309 \return CNTPCT Register value
311 __STATIC_FORCEINLINE uint64_t __get_CNTPCT(void)
314 __get_CP64(15, 0, result, 14);
318 /** \brief Set CNTP_CVAL
320 This function assigns the given value to 64bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
322 \param [in] value CNTP_CVAL Register value to set
324 __STATIC_FORCEINLINE void __set_CNTP_CVAL(uint64_t value)
326 __set_CP64(15, 2, value, 14);
329 /** \brief Get CNTP_CVAL
331 This function returns the value of the 64 bits PL1 Physical Timer CompareValue Register (CNTP_CVAL).
333 \return CNTP_CVAL Register value
335 __STATIC_FORCEINLINE uint64_t __get_CNTP_CVAL(void)
338 __get_CP64(15, 2, result, 14);
342 /** \brief Set CNTP_CTL
344 This function assigns the given value to PL1 Physical Timer Control Register (CNTP_CTL).
346 \param [in] value CNTP_CTL Register value to set
348 __STATIC_FORCEINLINE void __set_CNTP_CTL(uint32_t value)
350 __set_CP(15, 0, value, 14, 2, 1);
353 /** \brief Get CNTP_CTL register
354 \return CNTP_CTL Register value
356 __STATIC_FORCEINLINE uint32_t __get_CNTP_CTL(void)
359 __get_CP(15, 0, result, 14, 2, 1);
365 /** \brief Set TLBIALL
369 __STATIC_FORCEINLINE void __set_TLBIALL(uint32_t value)
371 __set_CP(15, 0, value, 8, 7, 0);
374 /** \brief Set BPIALL.
376 Branch Predictor Invalidate All
378 __STATIC_FORCEINLINE void __set_BPIALL(uint32_t value)
380 __set_CP(15, 0, value, 7, 5, 6);
383 /** \brief Set ICIALLU
385 Instruction Cache Invalidate All
387 __STATIC_FORCEINLINE void __set_ICIALLU(uint32_t value)
389 __set_CP(15, 0, value, 7, 5, 0);
392 /** \brief Set ICIMVAC
394 Instruction Cache Invalidate
396 __STATIC_FORCEINLINE void __set_ICIMVAC(uint32_t value)
398 __set_CP(15, 0, value, 7, 5, 1);
401 /** \brief Set DCCMVAC
405 __STATIC_FORCEINLINE void __set_DCCMVAC(uint32_t value)
407 __set_CP(15, 0, value, 7, 10, 1);
410 /** \brief Set DCIMVAC
412 Data cache invalidate
414 __STATIC_FORCEINLINE void __set_DCIMVAC(uint32_t value)
416 __set_CP(15, 0, value, 7, 6, 1);
419 /** \brief Set DCCIMVAC
421 Data cache clean and invalidate
423 __STATIC_FORCEINLINE void __set_DCCIMVAC(uint32_t value)
425 __set_CP(15, 0, value, 7, 14, 1);
428 /** \brief Set CSSELR
430 __STATIC_FORCEINLINE void __set_CSSELR(uint32_t value)
432 __set_CP(15, 2, value, 0, 0, 0);
435 /** \brief Get CSSELR
436 \return CSSELR Register value
438 __STATIC_FORCEINLINE uint32_t __get_CSSELR(void)
441 __get_CP(15, 2, result, 0, 0, 0);
445 /** \brief Get CCSIDR
446 \return CCSIDR Register value
448 __STATIC_FORCEINLINE uint32_t __get_CCSIDR(void)
451 __get_CP(15, 1, result, 0, 0, 0);
456 \return CLIDR Register value
458 __STATIC_FORCEINLINE uint32_t __get_CLIDR(void)
461 __get_CP(15, 1, result, 0, 0, 1);
467 __STATIC_FORCEINLINE void __set_DCISW(uint32_t value)
469 __set_CP(15, 0, value, 7, 6, 2);
474 __STATIC_FORCEINLINE void __set_DCCSW(uint32_t value)
476 __set_CP(15, 0, value, 7, 10, 2);
479 /** \brief Set DCCISW
481 __STATIC_FORCEINLINE void __set_DCCISW(uint32_t value)
483 __set_CP(15, 0, value, 7, 14, 2);