1 /**************************************************************************//**
\r
2 * @file cmsis_armclang.h
\r
3 * @brief CMSIS Cortex-M Core Function/Instruction Header File
\r
5 * @date 02. March 2016
\r
6 ******************************************************************************/
\r
8 * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
\r
10 * SPDX-License-Identifier: Apache-2.0
\r
12 * Licensed under the Apache License, Version 2.0 (the License); you may
\r
13 * not use this file except in compliance with the License.
\r
14 * You may obtain a copy of the License at
\r
16 * http://www.apache.org/licenses/LICENSE-2.0
\r
18 * Unless required by applicable law or agreed to in writing, software
\r
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
\r
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
21 * See the License for the specific language governing permissions and
\r
22 * limitations under the License.
\r
25 #ifndef __CMSIS_ARMCLANG_H
\r
26 #define __CMSIS_ARMCLANG_H
\r
29 /* ########################### Core Function Access ########################### */
\r
30 /** \ingroup CMSIS_Core_FunctionInterface
\r
31 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
\r
36 \brief Enable IRQ Interrupts
\r
37 \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
\r
38 Can only be executed in Privileged modes.
\r
40 __attribute__((always_inline)) __STATIC_INLINE void __enable_irq(void)
\r
42 __ASM volatile ("cpsie i" : : : "memory");
\r
47 \brief Disable IRQ Interrupts
\r
48 \details Disables IRQ interrupts by setting the I-bit in the CPSR.
\r
49 Can only be executed in Privileged modes.
\r
51 __attribute__((always_inline)) __STATIC_INLINE void __disable_irq(void)
\r
53 __ASM volatile ("cpsid i" : : : "memory");
\r
58 \brief Get Control Register
\r
59 \details Returns the content of the Control Register.
\r
60 \return Control Register value
\r
62 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void)
\r
66 __ASM volatile ("MRS %0, control" : "=r" (result) );
\r
71 #if (__ARM_FEATURE_CMSE == 3U)
\r
73 \brief Get Control Register (non-secure)
\r
74 \details Returns the content of the non-secure Control Register when in secure mode.
\r
75 \return non-secure Control Register value
\r
77 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_CONTROL_NS(void)
\r
81 __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
\r
88 \brief Set Control Register
\r
89 \details Writes the given value to the Control Register.
\r
90 \param [in] control Control Register value to set
\r
92 __attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control)
\r
94 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
\r
98 #if (__ARM_FEATURE_CMSE == 3U)
\r
100 \brief Set Control Register (non-secure)
\r
101 \details Writes the given value to the non-secure Control Register when in secure state.
\r
102 \param [in] control Control Register value to set
\r
104 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_CONTROL_NS(uint32_t control)
\r
106 __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
\r
112 \brief Get IPSR Register
\r
113 \details Returns the content of the IPSR Register.
\r
114 \return IPSR Register value
\r
116 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void)
\r
120 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
\r
125 #if (__ARM_FEATURE_CMSE == 3U)
\r
127 \brief Get IPSR Register (non-secure)
\r
128 \details Returns the content of the non-secure IPSR Register when in secure state.
\r
129 \return IPSR Register value
\r
131 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_IPSR_NS(void)
\r
135 __ASM volatile ("MRS %0, ipsr_ns" : "=r" (result) );
\r
142 \brief Get APSR Register
\r
143 \details Returns the content of the APSR Register.
\r
144 \return APSR Register value
\r
146 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void)
\r
150 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
\r
155 #if (__ARM_FEATURE_CMSE == 3U)
\r
157 \brief Get APSR Register (non-secure)
\r
158 \details Returns the content of the non-secure APSR Register when in secure state.
\r
159 \return APSR Register value
\r
161 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_APSR_NS(void)
\r
165 __ASM volatile ("MRS %0, apsr_ns" : "=r" (result) );
\r
172 \brief Get xPSR Register
\r
173 \details Returns the content of the xPSR Register.
\r
174 \return xPSR Register value
\r
176 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void)
\r
180 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
\r
185 #if (__ARM_FEATURE_CMSE == 3U)
\r
187 \brief Get xPSR Register (non-secure)
\r
188 \details Returns the content of the non-secure xPSR Register when in secure state.
\r
189 \return xPSR Register value
\r
191 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_xPSR_NS(void)
\r
195 __ASM volatile ("MRS %0, xpsr_ns" : "=r" (result) );
\r
202 \brief Get Process Stack Pointer
\r
203 \details Returns the current value of the Process Stack Pointer (PSP).
\r
204 \return PSP Register value
\r
206 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void)
\r
208 register uint32_t result;
\r
210 __ASM volatile ("MRS %0, psp" : "=r" (result) );
\r
215 #if (__ARM_FEATURE_CMSE == 3U)
\r
217 \brief Get Process Stack Pointer (non-secure)
\r
218 \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
\r
219 \return PSP Register value
\r
221 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void)
\r
223 register uint32_t result;
\r
225 __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
\r
232 \brief Set Process Stack Pointer
\r
233 \details Assigns the given value to the Process Stack Pointer (PSP).
\r
234 \param [in] topOfProcStack Process Stack Pointer value to set
\r
236 __attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
\r
238 __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : "sp");
\r
242 #if (__ARM_FEATURE_CMSE == 3U)
\r
244 \brief Set Process Stack Pointer (non-secure)
\r
245 \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
\r
246 \param [in] topOfProcStack Process Stack Pointer value to set
\r
248 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
\r
250 __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : "sp");
\r
256 \brief Get Main Stack Pointer
\r
257 \details Returns the current value of the Main Stack Pointer (MSP).
\r
258 \return MSP Register value
\r
260 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void)
\r
262 register uint32_t result;
\r
264 __ASM volatile ("MRS %0, msp" : "=r" (result) );
\r
269 #if (__ARM_FEATURE_CMSE == 3U)
\r
271 \brief Get Main Stack Pointer (non-secure)
\r
272 \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
\r
273 \return MSP Register value
\r
275 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void)
\r
277 register uint32_t result;
\r
279 __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
\r
286 \brief Set Main Stack Pointer
\r
287 \details Assigns the given value to the Main Stack Pointer (MSP).
\r
288 \param [in] topOfMainStack Main Stack Pointer value to set
\r
290 __attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
\r
292 __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : "sp");
\r
296 #if (__ARM_FEATURE_CMSE == 3U)
\r
298 \brief Set Main Stack Pointer (non-secure)
\r
299 \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
\r
300 \param [in] topOfMainStack Main Stack Pointer value to set
\r
302 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
\r
304 __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : "sp");
\r
310 \brief Get Priority Mask
\r
311 \details Returns the current state of the priority mask bit from the Priority Mask Register.
\r
312 \return Priority Mask value
\r
314 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void)
\r
318 __ASM volatile ("MRS %0, primask" : "=r" (result) );
\r
323 #if (__ARM_FEATURE_CMSE == 3U)
\r
325 \brief Get Priority Mask (non-secure)
\r
326 \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
\r
327 \return Priority Mask value
\r
329 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void)
\r
333 __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
\r
340 \brief Set Priority Mask
\r
341 \details Assigns the given value to the Priority Mask Register.
\r
342 \param [in] priMask Priority Mask
\r
344 __attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
\r
346 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
\r
350 #if (__ARM_FEATURE_CMSE == 3U)
\r
352 \brief Set Priority Mask (non-secure)
\r
353 \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
\r
354 \param [in] priMask Priority Mask
\r
356 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
\r
358 __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
\r
363 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U))
\r
367 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
\r
368 Can only be executed in Privileged modes.
\r
370 __attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void)
\r
372 __ASM volatile ("cpsie f" : : : "memory");
\r
378 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
\r
379 Can only be executed in Privileged modes.
\r
381 __attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void)
\r
383 __ASM volatile ("cpsid f" : : : "memory");
\r
388 \brief Get Base Priority
\r
389 \details Returns the current value of the Base Priority register.
\r
390 \return Base Priority register value
\r
392 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void)
\r
396 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
\r
401 #if (__ARM_FEATURE_CMSE == 3U)
\r
403 \brief Get Base Priority (non-secure)
\r
404 \details Returns the current value of the non-secure Base Priority register when in secure state.
\r
405 \return Base Priority register value
\r
407 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void)
\r
411 __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
\r
418 \brief Set Base Priority
\r
419 \details Assigns the given value to the Base Priority register.
\r
420 \param [in] basePri Base Priority value to set
\r
422 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
\r
424 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
\r
428 #if (__ARM_FEATURE_CMSE == 3U)
\r
430 \brief Set Base Priority (non-secure)
\r
431 \details Assigns the given value to the non-secure Base Priority register when in secure state.
\r
432 \param [in] basePri Base Priority value to set
\r
434 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t value)
\r
436 __ASM volatile ("MSR basepri_ns, %0" : : "r" (value) : "memory");
\r
442 \brief Set Base Priority with condition
\r
443 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
\r
444 or the new value increases the BASEPRI priority level.
\r
445 \param [in] basePri Base Priority value to set
\r
447 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value)
\r
449 __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
\r
453 #if (__ARM_FEATURE_CMSE == 3U)
\r
455 \brief Set Base Priority with condition (non_secure)
\r
456 \details Assigns the given value to the non-secure Base Priority register when in secure state only if BASEPRI masking is disabled,
\r
457 or the new value increases the BASEPRI priority level.
\r
458 \param [in] basePri Base Priority value to set
\r
460 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_MAX_NS(uint32_t value)
\r
462 __ASM volatile ("MSR basepri_max_ns, %0" : : "r" (value) : "memory");
\r
468 \brief Get Fault Mask
\r
469 \details Returns the current value of the Fault Mask register.
\r
470 \return Fault Mask register value
\r
472 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
\r
476 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
\r
481 #if (__ARM_FEATURE_CMSE == 3U)
\r
483 \brief Get Fault Mask (non-secure)
\r
484 \details Returns the current value of the non-secure Fault Mask register when in secure state.
\r
485 \return Fault Mask register value
\r
487 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void)
\r
491 __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
\r
498 \brief Set Fault Mask
\r
499 \details Assigns the given value to the Fault Mask register.
\r
500 \param [in] faultMask Fault Mask value to set
\r
502 __attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
\r
504 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
\r
508 #if (__ARM_FEATURE_CMSE == 3U)
\r
510 \brief Set Fault Mask (non-secure)
\r
511 \details Assigns the given value to the non-secure Fault Mask register when in secure state.
\r
512 \param [in] faultMask Fault Mask value to set
\r
514 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
\r
516 __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
\r
521 #endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
\r
524 #if (__ARM_ARCH_8M__ == 1U)
\r
527 \brief Get Process Stack Pointer Limit
\r
528 \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
\r
529 \return PSPLIM Register value
\r
531 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void)
\r
533 register uint32_t result;
\r
535 __ASM volatile ("MRS %0, psplim" : "=r" (result) );
\r
540 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M')
\r
542 \brief Get Process Stack Pointer Limit (non-secure)
\r
543 \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
544 \return PSPLIM Register value
\r
546 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void)
\r
548 register uint32_t result;
\r
550 __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
\r
557 \brief Set Process Stack Pointer Limit
\r
558 \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
\r
559 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
\r
561 __attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
\r
563 __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
\r
567 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M')
\r
569 \brief Set Process Stack Pointer (non-secure)
\r
570 \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
571 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
\r
573 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
\r
575 __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
\r
581 \brief Get Main Stack Pointer Limit
\r
582 \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
\r
583 \return MSPLIM Register value
\r
585 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void)
\r
587 register uint32_t result;
\r
589 __ASM volatile ("MRS %0, msplim" : "=r" (result) );
\r
595 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M')
\r
597 \brief Get Main Stack Pointer Limit (non-secure)
\r
598 \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
\r
599 \return MSPLIM Register value
\r
601 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void)
\r
603 register uint32_t result;
\r
605 __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
\r
612 \brief Set Main Stack Pointer Limit
\r
613 \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
\r
614 \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
\r
616 __attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
\r
618 __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
\r
622 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_PROFILE == 'M')
\r
624 \brief Set Main Stack Pointer Limit (non-secure)
\r
625 \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
\r
626 \param [in] MainStackPtrLimit Main Stack Pointer value to set
\r
628 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
\r
630 __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
\r
634 #endif /* (__ARM_ARCH_8M__ == 1U) */
\r
637 #if ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U))
\r
641 \details Returns the current value of the Floating Point Status/Control register.
\r
642 \return Floating Point Status/Control register value
\r
644 /* #define __get_FPSCR __builtin_arm_get_fpscr */
\r
645 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void)
\r
647 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
648 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
651 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
652 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
\r
653 __ASM volatile ("");
\r
660 #if (__ARM_FEATURE_CMSE == 3U)
\r
662 \brief Get FPSCR (non-secure)
\r
663 \details Returns the current value of the non-secure Floating Point Status/Control register when in secure state.
\r
664 \return Floating Point Status/Control register value
\r
666 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FPSCR_NS(void)
\r
668 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
669 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
672 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
673 __ASM volatile ("VMRS %0, fpscr_ns" : "=r" (result) );
\r
674 __ASM volatile ("");
\r
685 \details Assigns the given value to the Floating Point Status/Control register.
\r
686 \param [in] fpscr Floating Point Status/Control value to set
\r
688 /* #define __set_FPSCR __builtin_arm_set_fpscr */
\r
689 __attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
\r
691 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
692 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
693 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
694 /* __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); */
\r
695 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) :);
\r
696 __ASM volatile ("");
\r
700 #if (__ARM_FEATURE_CMSE == 3U)
\r
702 \brief Set FPSCR (non-secure)
\r
703 \details Assigns the given value to the non-secure Floating Point Status/Control register when in secure state.
\r
704 \param [in] fpscr Floating Point Status/Control value to set
\r
706 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FPSCR_NS(uint32_t fpscr)
\r
708 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
709 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
710 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
711 /* __ASM volatile ("VMSR fpscr_ns, %0" : : "r" (fpscr) : "vfpcc"); */
\r
712 __ASM volatile ("VMSR fpscr_ns, %0" : : "r" (fpscr) : );
\r
713 __ASM volatile ("");
\r
718 #endif /* ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
\r
722 /*@} end of CMSIS_Core_RegAccFunctions */
\r
725 /* ########################## Core Instruction Access ######################### */
\r
726 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
\r
727 Access to dedicated instructions
\r
731 /* Define macros for porting to both thumb1 and thumb2.
\r
732 * For thumb1, use low register (r0-r7), specified by constraint "l"
\r
733 * Otherwise, use general registers, specified by constraint "r" */
\r
734 #if defined (__thumb__) && !defined (__thumb2__)
\r
735 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
\r
736 #define __CMSIS_GCC_USE_REG(r) "l" (r)
\r
738 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
\r
739 #define __CMSIS_GCC_USE_REG(r) "r" (r)
\r
743 \brief No Operation
\r
744 \details No Operation does nothing. This instruction can be used for code alignment purposes.
\r
746 #define __NOP __builtin_arm_nop
\r
749 \brief Wait For Interrupt
\r
750 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
\r
752 #define __WFI __builtin_arm_wfi
\r
756 \brief Wait For Event
\r
757 \details Wait For Event is a hint instruction that permits the processor to enter
\r
758 a low-power state until one of a number of events occurs.
\r
760 #define __WFE __builtin_arm_wfe
\r
765 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
\r
767 #define __SEV __builtin_arm_sev
\r
771 \brief Instruction Synchronization Barrier
\r
772 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
\r
773 so that all instructions following the ISB are fetched from cache or memory,
\r
774 after the instruction has been completed.
\r
776 #define __ISB() __builtin_arm_isb(0xF);
\r
779 \brief Data Synchronization Barrier
\r
780 \details Acts as a special kind of Data Memory Barrier.
\r
781 It completes when all explicit memory accesses before this instruction complete.
\r
783 #define __DSB() __builtin_arm_dsb(0xF);
\r
787 \brief Data Memory Barrier
\r
788 \details Ensures the apparent order of the explicit memory operations before
\r
789 and after the instruction, without ensuring their completion.
\r
791 #define __DMB() __builtin_arm_dmb(0xF);
\r
795 \brief Reverse byte order (32 bit)
\r
796 \details Reverses the byte order in integer value.
\r
797 \param [in] value Value to reverse
\r
798 \return Reversed value
\r
800 #define __REV __builtin_bswap32
\r
804 \brief Reverse byte order (16 bit)
\r
805 \details Reverses the byte order in two unsigned short values.
\r
806 \param [in] value Value to reverse
\r
807 \return Reversed value
\r
809 #define __REV16 __builtin_bswap16 /* ToDo ARMCLANG: check if __builtin_bswap16 could be used */
\r
811 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
\r
815 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
822 \brief Reverse byte order in signed short value
\r
823 \details Reverses the byte order in a signed short value with sign extension to integer.
\r
824 \param [in] value Value to reverse
\r
825 \return Reversed value
\r
827 /* ToDo ARMCLANG: check if __builtin_bswap16 could be used */
\r
828 __attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value)
\r
832 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
838 \brief Rotate Right in unsigned value (32 bit)
\r
839 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
\r
840 \param [in] op1 Value to rotate
\r
841 \param [in] op2 Number of Bits to rotate
\r
842 \return Rotated value
\r
844 __attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
\r
846 return (op1 >> op2) | (op1 << (32U - op2));
\r
852 \details Causes the processor to enter Debug state.
\r
853 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
\r
854 \param [in] value is ignored by the processor.
\r
855 If required, a debugger can use it to store additional information about the breakpoint.
\r
857 #define __BKPT(value) __ASM volatile ("bkpt "#value)
\r
861 \brief Reverse bit order of value
\r
862 \details Reverses the bit order of the given value.
\r
863 \param [in] value Value to reverse
\r
864 \return Reversed value
\r
866 /* ToDo ARMCLANG: check if __builtin_arm_rbit is supported */
\r
867 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\r
871 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || ((__ARM_ARCH_8M__ == 1U) && (__ARM_ARCH_ISA_THUMB == 2U)))
\r
872 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
\r
874 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
\r
876 result = value; /* r will be reversed bits of v; first get LSB of v */
\r
877 for (value >>= 1U; value; value >>= 1U)
\r
880 result |= value & 1U;
\r
883 result <<= s; /* shift when v's highest bits are zero */
\r
890 \brief Count leading zeros
\r
891 \details Counts the number of leading zeros of a data value.
\r
892 \param [in] value Value to count the leading zeros
\r
893 \return number of leading zeros in value
\r
895 #define __CLZ __builtin_clz
\r
898 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U))
\r
901 \brief LDR Exclusive (8 bit)
\r
902 \details Executes a exclusive LDR instruction for 8 bit value.
\r
903 \param [in] ptr Pointer to data
\r
904 \return value of type uint8_t at (*ptr)
\r
906 #define __LDREXB (uint8_t)__builtin_arm_ldrex
\r
910 \brief LDR Exclusive (16 bit)
\r
911 \details Executes a exclusive LDR instruction for 16 bit values.
\r
912 \param [in] ptr Pointer to data
\r
913 \return value of type uint16_t at (*ptr)
\r
915 #define __LDREXH (uint16_t)__builtin_arm_ldrex
\r
919 \brief LDR Exclusive (32 bit)
\r
920 \details Executes a exclusive LDR instruction for 32 bit values.
\r
921 \param [in] ptr Pointer to data
\r
922 \return value of type uint32_t at (*ptr)
\r
924 #define __LDREXW (uint32_t)__builtin_arm_ldrex
\r
928 \brief STR Exclusive (8 bit)
\r
929 \details Executes a exclusive STR instruction for 8 bit values.
\r
930 \param [in] value Value to store
\r
931 \param [in] ptr Pointer to location
\r
932 \return 0 Function succeeded
\r
933 \return 1 Function failed
\r
935 #define __STREXB (uint32_t)__builtin_arm_strex
\r
939 \brief STR Exclusive (16 bit)
\r
940 \details Executes a exclusive STR instruction for 16 bit values.
\r
941 \param [in] value Value to store
\r
942 \param [in] ptr Pointer to location
\r
943 \return 0 Function succeeded
\r
944 \return 1 Function failed
\r
946 #define __STREXH (uint32_t)__builtin_arm_strex
\r
950 \brief STR Exclusive (32 bit)
\r
951 \details Executes a exclusive STR instruction for 32 bit values.
\r
952 \param [in] value Value to store
\r
953 \param [in] ptr Pointer to location
\r
954 \return 0 Function succeeded
\r
955 \return 1 Function failed
\r
957 #define __STREXW (uint32_t)__builtin_arm_strex
\r
961 \brief Remove the exclusive lock
\r
962 \details Removes the exclusive lock which is created by LDREX.
\r
964 #define __CLREX __builtin_arm_clrex
\r
968 \brief Signed Saturate
\r
969 \details Saturates a signed value.
\r
970 \param [in] value Value to be saturated
\r
971 \param [in] sat Bit position to saturate to (1..32)
\r
972 \return Saturated value
\r
974 /* #define __SSAT __builtin_arm_ssat */
\r
975 #define __SSAT(ARG1,ARG2) \
\r
977 int32_t __RES, __ARG1 = (ARG1); \
\r
978 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
984 \brief Unsigned Saturate
\r
985 \details Saturates an unsigned value.
\r
986 \param [in] value Value to be saturated
\r
987 \param [in] sat Bit position to saturate to (0..31)
\r
988 \return Saturated value
\r
990 #define __USAT __builtin_arm_usat
\r
992 #define __USAT(ARG1,ARG2) \
\r
994 uint32_t __RES, __ARG1 = (ARG1); \
\r
995 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
1002 \brief Rotate Right with Extend (32 bit)
\r
1003 \details Moves each bit of a bitstring right by one bit.
\r
1004 The carry input is shifted in at the left end of the bitstring.
\r
1005 \param [in] value Value to rotate
\r
1006 \return Rotated value
\r
1008 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value)
\r
1012 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
1018 \brief LDRT Unprivileged (8 bit)
\r
1019 \details Executes a Unprivileged LDRT instruction for 8 bit value.
\r
1020 \param [in] ptr Pointer to data
\r
1021 \return value of type uint8_t at (*ptr)
\r
1023 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr)
\r
1027 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1028 return ((uint8_t) result); /* Add explicit type cast here */
\r
1033 \brief LDRT Unprivileged (16 bit)
\r
1034 \details Executes a Unprivileged LDRT instruction for 16 bit values.
\r
1035 \param [in] ptr Pointer to data
\r
1036 \return value of type uint16_t at (*ptr)
\r
1038 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr)
\r
1042 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1043 return ((uint16_t) result); /* Add explicit type cast here */
\r
1048 \brief LDRT Unprivileged (32 bit)
\r
1049 \details Executes a Unprivileged LDRT instruction for 32 bit values.
\r
1050 \param [in] ptr Pointer to data
\r
1051 \return value of type uint32_t at (*ptr)
\r
1053 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr)
\r
1057 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1063 \brief STRT Unprivileged (8 bit)
\r
1064 \details Executes a Unprivileged STRT instruction for 8 bit values.
\r
1065 \param [in] value Value to store
\r
1066 \param [in] ptr Pointer to location
\r
1068 __attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
\r
1070 __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1075 \brief STRT Unprivileged (16 bit)
\r
1076 \details Executes a Unprivileged STRT instruction for 16 bit values.
\r
1077 \param [in] value Value to store
\r
1078 \param [in] ptr Pointer to location
\r
1080 __attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
\r
1082 __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1087 \brief STRT Unprivileged (32 bit)
\r
1088 \details Executes a Unprivileged STRT instruction for 32 bit values.
\r
1089 \param [in] value Value to store
\r
1090 \param [in] ptr Pointer to location
\r
1092 __attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
\r
1094 __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
\r
1097 #endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M__ == 1U)) */
\r
1100 #if (__ARM_ARCH_8M__ == 1U)
\r
1103 \brief Load-Acquire (8 bit)
\r
1104 \details Executes a LDAB instruction for 8 bit value.
\r
1105 \param [in] ptr Pointer to data
\r
1106 \return value of type uint8_t at (*ptr)
\r
1108 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr)
\r
1112 __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1113 return ((uint8_t) result);
\r
1118 \brief Load-Acquire (16 bit)
\r
1119 \details Executes a LDAH instruction for 16 bit values.
\r
1120 \param [in] ptr Pointer to data
\r
1121 \return value of type uint16_t at (*ptr)
\r
1123 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr)
\r
1127 __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1128 return ((uint16_t) result);
\r
1133 \brief Load-Acquire (32 bit)
\r
1134 \details Executes a LDA instruction for 32 bit values.
\r
1135 \param [in] ptr Pointer to data
\r
1136 \return value of type uint32_t at (*ptr)
\r
1138 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr)
\r
1142 __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1148 \brief Store-Release (8 bit)
\r
1149 \details Executes a STLB instruction for 8 bit values.
\r
1150 \param [in] value Value to store
\r
1151 \param [in] ptr Pointer to location
\r
1153 __attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
\r
1155 __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1160 \brief Store-Release (16 bit)
\r
1161 \details Executes a STLH instruction for 16 bit values.
\r
1162 \param [in] value Value to store
\r
1163 \param [in] ptr Pointer to location
\r
1165 __attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
\r
1167 __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1172 \brief Store-Release (32 bit)
\r
1173 \details Executes a STL instruction for 32 bit values.
\r
1174 \param [in] value Value to store
\r
1175 \param [in] ptr Pointer to location
\r
1177 __attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr)
\r
1179 __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1184 \brief Load-Acquire Exclusive (8 bit)
\r
1185 \details Executes a LDAB exclusive instruction for 8 bit value.
\r
1186 \param [in] ptr Pointer to data
\r
1187 \return value of type uint8_t at (*ptr)
\r
1189 #define __LDAEXB (uint8_t)__builtin_arm_ldaex
\r
1193 \brief Load-Acquire Exclusive (16 bit)
\r
1194 \details Executes a LDAH exclusive instruction for 16 bit values.
\r
1195 \param [in] ptr Pointer to data
\r
1196 \return value of type uint16_t at (*ptr)
\r
1198 #define __LDAEXH (uint16_t)__builtin_arm_ldaex
\r
1202 \brief Load-Acquire Exclusive (32 bit)
\r
1203 \details Executes a LDA exclusive instruction for 32 bit values.
\r
1204 \param [in] ptr Pointer to data
\r
1205 \return value of type uint32_t at (*ptr)
\r
1207 #define __LDAEX (uint32_t)__builtin_arm_ldaex
\r
1211 \brief Store-Release Exclusive (8 bit)
\r
1212 \details Executes a STLB exclusive instruction for 8 bit values.
\r
1213 \param [in] value Value to store
\r
1214 \param [in] ptr Pointer to location
\r
1215 \return 0 Function succeeded
\r
1216 \return 1 Function failed
\r
1218 #define __STLEXB (uint32_t)__builtin_arm_stlex
\r
1222 \brief Store-Release Exclusive (16 bit)
\r
1223 \details Executes a STLH exclusive instruction for 16 bit values.
\r
1224 \param [in] value Value to store
\r
1225 \param [in] ptr Pointer to location
\r
1226 \return 0 Function succeeded
\r
1227 \return 1 Function failed
\r
1229 #define __STLEXH (uint32_t)__builtin_arm_stlex
\r
1233 \brief Store-Release Exclusive (32 bit)
\r
1234 \details Executes a STL exclusive instruction for 32 bit values.
\r
1235 \param [in] value Value to store
\r
1236 \param [in] ptr Pointer to location
\r
1237 \return 0 Function succeeded
\r
1238 \return 1 Function failed
\r
1240 #define __STLEX (uint32_t)__builtin_arm_stlex
\r
1242 #endif /* (__ARM_ARCH_8M__ == 1U) */
\r
1244 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
\r
1247 /* ################### Compiler specific Intrinsics ########################### */
\r
1248 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
\r
1249 Access to dedicated SIMD instructions
\r
1253 #if (__ARM_FEATURE_DSP == 1U) /* ToDo ARMCLANG: This should be ARCH >= ARMv7-M + SIMD */
\r
1255 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
\r
1259 __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1263 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
\r
1267 __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1271 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
\r
1275 __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1279 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
\r
1283 __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1287 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
\r
1291 __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1295 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
\r
1299 __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1304 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
\r
1308 __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1312 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
\r
1316 __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1320 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
\r
1324 __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1328 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
\r
1332 __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1336 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
\r
1340 __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1344 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
\r
1348 __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1353 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
\r
1357 __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1361 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
\r
1365 __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1369 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
\r
1373 __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1377 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
\r
1381 __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1385 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
\r
1389 __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1393 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
\r
1397 __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1401 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
\r
1405 __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1409 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
\r
1413 __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1417 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
\r
1421 __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1425 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
\r
1429 __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1433 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
\r
1437 __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1441 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
\r
1445 __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1449 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
\r
1453 __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1457 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
\r
1461 __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1465 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
\r
1469 __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1473 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
\r
1477 __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1481 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
\r
1485 __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1489 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
\r
1493 __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1497 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
\r
1501 __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1505 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
\r
1509 __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1513 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
\r
1517 __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1521 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
\r
1525 __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1529 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
\r
1533 __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1537 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
\r
1541 __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1545 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
\r
1549 __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1553 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
\r
1557 __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1561 #define __SSAT16(ARG1,ARG2) \
\r
1563 int32_t __RES, __ARG1 = (ARG1); \
\r
1564 __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
1568 #define __USAT16(ARG1,ARG2) \
\r
1570 uint32_t __RES, __ARG1 = (ARG1); \
\r
1571 __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
1575 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1)
\r
1579 __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
\r
1583 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
\r
1587 __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1591 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1)
\r
1595 __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
\r
1599 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
\r
1603 __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1607 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
\r
1611 __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1615 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
\r
1619 __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1623 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1627 __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1631 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1635 __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1639 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1647 #ifndef __ARMEB__ /* Little endian */
\r
1648 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
\r
1649 #else /* Big endian */
\r
1650 __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
\r
1656 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1664 #ifndef __ARMEB__ /* Little endian */
\r
1665 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
\r
1666 #else /* Big endian */
\r
1667 __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
\r
1673 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
\r
1677 __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1681 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
\r
1685 __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1689 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1693 __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1697 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1701 __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1705 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1713 #ifndef __ARMEB__ /* Little endian */
\r
1714 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
\r
1715 #else /* Big endian */
\r
1716 __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
\r
1722 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1730 #ifndef __ARMEB__ /* Little endian */
\r
1731 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) );
\r
1732 #else /* Big endian */
\r
1733 __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) );
\r
1739 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
\r
1743 __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1747 __attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2)
\r
1751 __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1755 __attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2)
\r
1759 __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1763 #define __PKHBT(ARG1,ARG2,ARG3) \
\r
1765 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
\r
1766 __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
\r
1770 #define __PKHTB(ARG1,ARG2,ARG3) \
\r
1772 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
\r
1774 __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
\r
1776 __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
\r
1780 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
\r
1784 __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
\r
1788 #endif /* (__ARM_FEATURE_DSP == 1U) */
\r
1789 /*@} end of group CMSIS_SIMD_intrinsics */
\r
1792 #endif /* __CMSIS_ARMCLANG_H */
\r