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);
363 /******************************* VIRTUAL TIMER *******************************/
364 /** see [ARM DDI 0406C.d] :
365 . §B4.1.31 "CNTV_CTL, Counter-timer Virtual Timer Control register"
366 . §B4.1.32 "CNTV_CVAL, Counter-timer Virtual Timer CompareValue register"
367 . §B4.1.33 "CNTV_TVAL, Counter-timer Virtual Timer TimerValue register"
368 . §B4.1.34 "CNTVCT, Counter-timer Virtual Count register"
370 /** \brief Set CNTV_TVAL
371 This function assigns the given value to VL1 Virtual Timer Value Register (CNTV_TVAL).
372 \param [in] value CNTV_TVAL Register value to set
374 __STATIC_FORCEINLINE void __set_CNTV_TVAL(uint32_t value)
376 __set_CP(15, 0, value, 14, 3, 0);
379 /** \brief Get CNTV_TVAL
380 This function returns the value of the VL1 Virtual Timer Value Register (CNTV_TVAL).
381 \return CNTV_TVAL Register value
383 __STATIC_FORCEINLINE uint32_t __get_CNTV_TVAL(void)
386 __get_CP(15, 0, result, 14, 3, 0);
390 /** \brief Get CNTVCT
391 This function returns the value of the 64 bits VL1 Virtual Count Register (CNTVCT).
392 \return CNTVCT Register value
394 __STATIC_FORCEINLINE uint64_t __get_CNTVCT(void)
397 __get_CP64(15, 1, result, 14);
401 /** \brief Set CNTV_CVAL
402 This function assigns the given value to 64bits VL1 Virtual Timer CompareValue Register (CNTV_CVAL).
403 \param [in] value CNTV_CVAL Register value to set
405 __STATIC_FORCEINLINE void __set_CNTV_CVAL(uint64_t value)
407 __set_CP64(15, 3, value, 14);
410 /** \brief Get CNTV_CVAL
411 This function returns the value of the 64 bits VL1 Virtual Timer CompareValue Register (CNTV_CVAL).
412 \return CNTV_CVAL Register value
414 __STATIC_FORCEINLINE uint64_t __get_CNTV_CVAL(void)
417 __get_CP64(15, 3, result, 14);
421 /** \brief Set CNTV_CTL
422 This function assigns the given value to VL1 Virtual Timer Control Register (CNTV_CTL).
423 \param [in] value CNTV_CTL Register value to set
425 __STATIC_FORCEINLINE void __set_CNTV_CTL(uint32_t value)
427 __set_CP(15, 0, value, 14, 3, 1);
430 /** \brief Get CNTV_CTL register
431 \return CNTV_CTL Register value
433 __STATIC_FORCEINLINE uint32_t __get_CNTV_CTL(void)
436 __get_CP(15, 0, result, 14, 3, 1);
440 /***************************** VIRTUAL TIMER END *****************************/
443 /** \brief Set TLBIALL
447 __STATIC_FORCEINLINE void __set_TLBIALL(uint32_t value)
449 __set_CP(15, 0, value, 8, 7, 0);
452 /** \brief Set BPIALL.
454 Branch Predictor Invalidate All
456 __STATIC_FORCEINLINE void __set_BPIALL(uint32_t value)
458 __set_CP(15, 0, value, 7, 5, 6);
461 /** \brief Set ICIALLU
463 Instruction Cache Invalidate All
465 __STATIC_FORCEINLINE void __set_ICIALLU(uint32_t value)
467 __set_CP(15, 0, value, 7, 5, 0);
470 /** \brief Set ICIMVAC
472 Instruction Cache Invalidate
474 __STATIC_FORCEINLINE void __set_ICIMVAC(uint32_t value)
476 __set_CP(15, 0, value, 7, 5, 1);
479 /** \brief Set DCCMVAC
483 __STATIC_FORCEINLINE void __set_DCCMVAC(uint32_t value)
485 __set_CP(15, 0, value, 7, 10, 1);
488 /** \brief Set DCIMVAC
490 Data cache invalidate
492 __STATIC_FORCEINLINE void __set_DCIMVAC(uint32_t value)
494 __set_CP(15, 0, value, 7, 6, 1);
497 /** \brief Set DCCIMVAC
499 Data cache clean and invalidate
501 __STATIC_FORCEINLINE void __set_DCCIMVAC(uint32_t value)
503 __set_CP(15, 0, value, 7, 14, 1);
506 /** \brief Set CSSELR
508 __STATIC_FORCEINLINE void __set_CSSELR(uint32_t value)
510 __set_CP(15, 2, value, 0, 0, 0);
513 /** \brief Get CSSELR
514 \return CSSELR Register value
516 __STATIC_FORCEINLINE uint32_t __get_CSSELR(void)
519 __get_CP(15, 2, result, 0, 0, 0);
523 /** \brief Get CCSIDR
524 \return CCSIDR Register value
526 __STATIC_FORCEINLINE uint32_t __get_CCSIDR(void)
529 __get_CP(15, 1, result, 0, 0, 0);
534 \return CLIDR Register value
536 __STATIC_FORCEINLINE uint32_t __get_CLIDR(void)
539 __get_CP(15, 1, result, 0, 0, 1);
545 __STATIC_FORCEINLINE void __set_DCISW(uint32_t value)
547 __set_CP(15, 0, value, 7, 6, 2);
552 __STATIC_FORCEINLINE void __set_DCCSW(uint32_t value)
554 __set_CP(15, 0, value, 7, 10, 2);
557 /** \brief Set DCCISW
559 __STATIC_FORCEINLINE void __set_DCCISW(uint32_t value)
561 __set_CP(15, 0, value, 7, 14, 2);