1 /**************************************************************************//**
\r
2 * @file cmsis_armclang.h
\r
3 * @brief CMSIS Cortex-M Core Function/Instruction Header File
\r
5 * @date 20. April 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
126 \brief Get APSR Register
\r
127 \details Returns the content of the APSR Register.
\r
128 \return APSR Register value
\r
130 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void)
\r
134 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
\r
140 \brief Get xPSR Register
\r
141 \details Returns the content of the xPSR Register.
\r
142 \return xPSR Register value
\r
144 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void)
\r
148 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
\r
154 \brief Get Process Stack Pointer
\r
155 \details Returns the current value of the Process Stack Pointer (PSP).
\r
156 \return PSP Register value
\r
158 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void)
\r
160 register uint32_t result;
\r
162 __ASM volatile ("MRS %0, psp" : "=r" (result) );
\r
167 #if (__ARM_FEATURE_CMSE == 3U)
\r
169 \brief Get Process Stack Pointer (non-secure)
\r
170 \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
\r
171 \return PSP Register value
\r
173 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void)
\r
175 register uint32_t result;
\r
177 __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
\r
184 \brief Set Process Stack Pointer
\r
185 \details Assigns the given value to the Process Stack Pointer (PSP).
\r
186 \param [in] topOfProcStack Process Stack Pointer value to set
\r
188 __attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
\r
190 __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : "sp");
\r
194 #if (__ARM_FEATURE_CMSE == 3U)
\r
196 \brief Set Process Stack Pointer (non-secure)
\r
197 \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
\r
198 \param [in] topOfProcStack Process Stack Pointer value to set
\r
200 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
\r
202 __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : "sp");
\r
208 \brief Get Main Stack Pointer
\r
209 \details Returns the current value of the Main Stack Pointer (MSP).
\r
210 \return MSP Register value
\r
212 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void)
\r
214 register uint32_t result;
\r
216 __ASM volatile ("MRS %0, msp" : "=r" (result) );
\r
221 #if (__ARM_FEATURE_CMSE == 3U)
\r
223 \brief Get Main Stack Pointer (non-secure)
\r
224 \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
\r
225 \return MSP Register value
\r
227 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void)
\r
229 register uint32_t result;
\r
231 __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
\r
238 \brief Set Main Stack Pointer
\r
239 \details Assigns the given value to the Main Stack Pointer (MSP).
\r
240 \param [in] topOfMainStack Main Stack Pointer value to set
\r
242 __attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
\r
244 __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : "sp");
\r
248 #if (__ARM_FEATURE_CMSE == 3U)
\r
250 \brief Set Main Stack Pointer (non-secure)
\r
251 \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
\r
252 \param [in] topOfMainStack Main Stack Pointer value to set
\r
254 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
\r
256 __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : "sp");
\r
262 \brief Get Priority Mask
\r
263 \details Returns the current state of the priority mask bit from the Priority Mask Register.
\r
264 \return Priority Mask value
\r
266 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void)
\r
270 __ASM volatile ("MRS %0, primask" : "=r" (result) );
\r
275 #if (__ARM_FEATURE_CMSE == 3U)
\r
277 \brief Get Priority Mask (non-secure)
\r
278 \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
\r
279 \return Priority Mask value
\r
281 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void)
\r
285 __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
\r
292 \brief Set Priority Mask
\r
293 \details Assigns the given value to the Priority Mask Register.
\r
294 \param [in] priMask Priority Mask
\r
296 __attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
\r
298 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
\r
302 #if (__ARM_FEATURE_CMSE == 3U)
\r
304 \brief Set Priority Mask (non-secure)
\r
305 \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
\r
306 \param [in] priMask Priority Mask
\r
308 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
\r
310 __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
\r
315 #if ((__ARM_ARCH_7M__ == 1U) || \
\r
316 (__ARM_ARCH_7EM__ == 1U) || \
\r
317 (__ARM_ARCH_8M_MAIN__ == 1U) )
\r
320 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
\r
321 Can only be executed in Privileged modes.
\r
323 __attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void)
\r
325 __ASM volatile ("cpsie f" : : : "memory");
\r
331 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
\r
332 Can only be executed in Privileged modes.
\r
334 __attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void)
\r
336 __ASM volatile ("cpsid f" : : : "memory");
\r
341 \brief Get Base Priority
\r
342 \details Returns the current value of the Base Priority register.
\r
343 \return Base Priority register value
\r
345 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void)
\r
349 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
\r
354 #if (__ARM_FEATURE_CMSE == 3U)
\r
356 \brief Get Base Priority (non-secure)
\r
357 \details Returns the current value of the non-secure Base Priority register when in secure state.
\r
358 \return Base Priority register value
\r
360 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void)
\r
364 __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
\r
371 \brief Set Base Priority
\r
372 \details Assigns the given value to the Base Priority register.
\r
373 \param [in] basePri Base Priority value to set
\r
375 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
\r
377 __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
\r
381 #if (__ARM_FEATURE_CMSE == 3U)
\r
383 \brief Set Base Priority (non-secure)
\r
384 \details Assigns the given value to the non-secure Base Priority register when in secure state.
\r
385 \param [in] basePri Base Priority value to set
\r
387 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t value)
\r
389 __ASM volatile ("MSR basepri_ns, %0" : : "r" (value) : "memory");
\r
395 \brief Set Base Priority with condition
\r
396 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
\r
397 or the new value increases the BASEPRI priority level.
\r
398 \param [in] basePri Base Priority value to set
\r
400 __attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t value)
\r
402 __ASM volatile ("MSR basepri_max, %0" : : "r" (value) : "memory");
\r
407 \brief Get Fault Mask
\r
408 \details Returns the current value of the Fault Mask register.
\r
409 \return Fault Mask register value
\r
411 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
\r
415 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
\r
420 #if (__ARM_FEATURE_CMSE == 3U)
\r
422 \brief Get Fault Mask (non-secure)
\r
423 \details Returns the current value of the non-secure Fault Mask register when in secure state.
\r
424 \return Fault Mask register value
\r
426 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void)
\r
430 __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
\r
437 \brief Set Fault Mask
\r
438 \details Assigns the given value to the Fault Mask register.
\r
439 \param [in] faultMask Fault Mask value to set
\r
441 __attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
\r
443 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
\r
447 #if (__ARM_FEATURE_CMSE == 3U)
\r
449 \brief Set Fault Mask (non-secure)
\r
450 \details Assigns the given value to the non-secure Fault Mask register when in secure state.
\r
451 \param [in] faultMask Fault Mask value to set
\r
453 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
\r
455 __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
\r
459 #endif /* ((__ARM_ARCH_7M__ == 1U) || \
\r
460 (__ARM_ARCH_7EM__ == 1U) || \
\r
461 (__ARM_ARCH_8M_MAIN__ == 1U) ) */
\r
464 #if ((__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U))
\r
467 \brief Get Process Stack Pointer Limit
\r
468 \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
\r
469 \return PSPLIM Register value
\r
471 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void)
\r
473 register uint32_t result;
\r
475 __ASM volatile ("MRS %0, psplim" : "=r" (result) );
\r
480 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_8M_MAIN__ == 1U)
\r
482 \brief Get Process Stack Pointer Limit (non-secure)
\r
483 \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
484 \return PSPLIM Register value
\r
486 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void)
\r
488 register uint32_t result;
\r
490 __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
\r
497 \brief Set Process Stack Pointer Limit
\r
498 \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
\r
499 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
\r
501 __attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
\r
503 __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
\r
507 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_8M_MAIN__ == 1U)
\r
509 \brief Set Process Stack Pointer (non-secure)
\r
510 \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
511 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
\r
513 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
\r
515 __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
\r
521 \brief Get Main Stack Pointer Limit
\r
522 \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
\r
523 \return MSPLIM Register value
\r
525 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void)
\r
527 register uint32_t result;
\r
529 __ASM volatile ("MRS %0, msplim" : "=r" (result) );
\r
535 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_8M_MAIN__ == 1U)
\r
537 \brief Get Main Stack Pointer Limit (non-secure)
\r
538 \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
\r
539 \return MSPLIM Register value
\r
541 __attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void)
\r
543 register uint32_t result;
\r
545 __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
\r
552 \brief Set Main Stack Pointer Limit
\r
553 \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
\r
554 \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
\r
556 __attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
\r
558 __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
\r
562 #if (__ARM_FEATURE_CMSE == 3U) && (__ARM_ARCH_8M_MAIN__ == 1U)
\r
564 \brief Set Main Stack Pointer Limit (non-secure)
\r
565 \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
\r
566 \param [in] MainStackPtrLimit Main Stack Pointer value to set
\r
568 __attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
\r
570 __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
\r
574 #endif /* ((__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U)) */
\r
577 #if ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U))
\r
581 \details Returns the current value of the Floating Point Status/Control register.
\r
582 \return Floating Point Status/Control register value
\r
584 /* #define __get_FPSCR __builtin_arm_get_fpscr */
\r
585 __attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void)
\r
587 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
588 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
591 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
592 __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
\r
593 __ASM volatile ("");
\r
603 \details Assigns the given value to the Floating Point Status/Control register.
\r
604 \param [in] fpscr Floating Point Status/Control value to set
\r
606 /* #define __set_FPSCR __builtin_arm_set_fpscr */
\r
607 __attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
\r
609 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
\r
610 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
\r
611 __ASM volatile (""); /* Empty asm statement works as a scheduling barrier */
\r
612 /* __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); */
\r
613 __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) :);
\r
614 __ASM volatile ("");
\r
618 #endif /* ((__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U)) */
\r
622 /*@} end of CMSIS_Core_RegAccFunctions */
\r
625 /* ########################## Core Instruction Access ######################### */
\r
626 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
\r
627 Access to dedicated instructions
\r
631 /* Define macros for porting to both thumb1 and thumb2.
\r
632 * For thumb1, use low register (r0-r7), specified by constraint "l"
\r
633 * Otherwise, use general registers, specified by constraint "r" */
\r
634 #if defined (__thumb__) && !defined (__thumb2__)
\r
635 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
\r
636 #define __CMSIS_GCC_USE_REG(r) "l" (r)
\r
638 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
\r
639 #define __CMSIS_GCC_USE_REG(r) "r" (r)
\r
643 \brief No Operation
\r
644 \details No Operation does nothing. This instruction can be used for code alignment purposes.
\r
646 #define __NOP __builtin_arm_nop
\r
649 \brief Wait For Interrupt
\r
650 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
\r
652 #define __WFI __builtin_arm_wfi
\r
656 \brief Wait For Event
\r
657 \details Wait For Event is a hint instruction that permits the processor to enter
\r
658 a low-power state until one of a number of events occurs.
\r
660 #define __WFE __builtin_arm_wfe
\r
665 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
\r
667 #define __SEV __builtin_arm_sev
\r
671 \brief Instruction Synchronization Barrier
\r
672 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
\r
673 so that all instructions following the ISB are fetched from cache or memory,
\r
674 after the instruction has been completed.
\r
676 #define __ISB() __builtin_arm_isb(0xF);
\r
679 \brief Data Synchronization Barrier
\r
680 \details Acts as a special kind of Data Memory Barrier.
\r
681 It completes when all explicit memory accesses before this instruction complete.
\r
683 #define __DSB() __builtin_arm_dsb(0xF);
\r
687 \brief Data Memory Barrier
\r
688 \details Ensures the apparent order of the explicit memory operations before
\r
689 and after the instruction, without ensuring their completion.
\r
691 #define __DMB() __builtin_arm_dmb(0xF);
\r
695 \brief Reverse byte order (32 bit)
\r
696 \details Reverses the byte order in integer value.
\r
697 \param [in] value Value to reverse
\r
698 \return Reversed value
\r
700 #define __REV __builtin_bswap32
\r
704 \brief Reverse byte order (16 bit)
\r
705 \details Reverses the byte order in two unsigned short values.
\r
706 \param [in] value Value to reverse
\r
707 \return Reversed value
\r
709 #define __REV16 __builtin_bswap16 /* ToDo ARMCLANG: check if __builtin_bswap16 could be used */
\r
711 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
\r
715 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
722 \brief Reverse byte order in signed short value
\r
723 \details Reverses the byte order in a signed short value with sign extension to integer.
\r
724 \param [in] value Value to reverse
\r
725 \return Reversed value
\r
727 /* ToDo ARMCLANG: check if __builtin_bswap16 could be used */
\r
728 __attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value)
\r
732 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
738 \brief Rotate Right in unsigned value (32 bit)
\r
739 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
\r
740 \param [in] op1 Value to rotate
\r
741 \param [in] op2 Number of Bits to rotate
\r
742 \return Rotated value
\r
744 __attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
\r
746 return (op1 >> op2) | (op1 << (32U - op2));
\r
752 \details Causes the processor to enter Debug state.
\r
753 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
\r
754 \param [in] value is ignored by the processor.
\r
755 If required, a debugger can use it to store additional information about the breakpoint.
\r
757 #define __BKPT(value) __ASM volatile ("bkpt "#value)
\r
761 \brief Reverse bit order of value
\r
762 \details Reverses the bit order of the given value.
\r
763 \param [in] value Value to reverse
\r
764 \return Reversed value
\r
766 /* ToDo ARMCLANG: check if __builtin_arm_rbit is supported */
\r
767 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\r
771 #if ((__ARM_ARCH_7M__ == 1U) || \
\r
772 (__ARM_ARCH_7EM__ == 1U) || \
\r
773 (__ARM_ARCH_8M_MAIN__ == 1U) )
\r
774 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
\r
776 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; /* extra shift needed at end */
\r
778 result = value; /* r will be reversed bits of v; first get LSB of v */
\r
779 for (value >>= 1U; value; value >>= 1U)
\r
782 result |= value & 1U;
\r
785 result <<= s; /* shift when v's highest bits are zero */
\r
792 \brief Count leading zeros
\r
793 \details Counts the number of leading zeros of a data value.
\r
794 \param [in] value Value to count the leading zeros
\r
795 \return number of leading zeros in value
\r
797 #define __CLZ __builtin_clz
\r
800 #if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U))
\r
803 \brief LDR Exclusive (8 bit)
\r
804 \details Executes a exclusive LDR instruction for 8 bit value.
\r
805 \param [in] ptr Pointer to data
\r
806 \return value of type uint8_t at (*ptr)
\r
808 #define __LDREXB (uint8_t)__builtin_arm_ldrex
\r
812 \brief LDR Exclusive (16 bit)
\r
813 \details Executes a exclusive LDR instruction for 16 bit values.
\r
814 \param [in] ptr Pointer to data
\r
815 \return value of type uint16_t at (*ptr)
\r
817 #define __LDREXH (uint16_t)__builtin_arm_ldrex
\r
821 \brief LDR Exclusive (32 bit)
\r
822 \details Executes a exclusive LDR instruction for 32 bit values.
\r
823 \param [in] ptr Pointer to data
\r
824 \return value of type uint32_t at (*ptr)
\r
826 #define __LDREXW (uint32_t)__builtin_arm_ldrex
\r
830 \brief STR Exclusive (8 bit)
\r
831 \details Executes a exclusive STR instruction for 8 bit values.
\r
832 \param [in] value Value to store
\r
833 \param [in] ptr Pointer to location
\r
834 \return 0 Function succeeded
\r
835 \return 1 Function failed
\r
837 #define __STREXB (uint32_t)__builtin_arm_strex
\r
841 \brief STR Exclusive (16 bit)
\r
842 \details Executes a exclusive STR instruction for 16 bit values.
\r
843 \param [in] value Value to store
\r
844 \param [in] ptr Pointer to location
\r
845 \return 0 Function succeeded
\r
846 \return 1 Function failed
\r
848 #define __STREXH (uint32_t)__builtin_arm_strex
\r
852 \brief STR Exclusive (32 bit)
\r
853 \details Executes a exclusive STR instruction for 32 bit values.
\r
854 \param [in] value Value to store
\r
855 \param [in] ptr Pointer to location
\r
856 \return 0 Function succeeded
\r
857 \return 1 Function failed
\r
859 #define __STREXW (uint32_t)__builtin_arm_strex
\r
863 \brief Remove the exclusive lock
\r
864 \details Removes the exclusive lock which is created by LDREX.
\r
866 #define __CLREX __builtin_arm_clrex
\r
870 \brief Signed Saturate
\r
871 \details Saturates a signed value.
\r
872 \param [in] value Value to be saturated
\r
873 \param [in] sat Bit position to saturate to (1..32)
\r
874 \return Saturated value
\r
876 /* #define __SSAT __builtin_arm_ssat */
\r
877 #define __SSAT(ARG1,ARG2) \
\r
879 int32_t __RES, __ARG1 = (ARG1); \
\r
880 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
886 \brief Unsigned Saturate
\r
887 \details Saturates an unsigned value.
\r
888 \param [in] value Value to be saturated
\r
889 \param [in] sat Bit position to saturate to (0..31)
\r
890 \return Saturated value
\r
892 #define __USAT __builtin_arm_usat
\r
894 #define __USAT(ARG1,ARG2) \
\r
896 uint32_t __RES, __ARG1 = (ARG1); \
\r
897 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
904 \brief Rotate Right with Extend (32 bit)
\r
905 \details Moves each bit of a bitstring right by one bit.
\r
906 The carry input is shifted in at the left end of the bitstring.
\r
907 \param [in] value Value to rotate
\r
908 \return Rotated value
\r
910 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value)
\r
914 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
\r
920 \brief LDRT Unprivileged (8 bit)
\r
921 \details Executes a Unprivileged LDRT instruction for 8 bit value.
\r
922 \param [in] ptr Pointer to data
\r
923 \return value of type uint8_t at (*ptr)
\r
925 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr)
\r
929 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
930 return ((uint8_t) result); /* Add explicit type cast here */
\r
935 \brief LDRT Unprivileged (16 bit)
\r
936 \details Executes a Unprivileged LDRT instruction for 16 bit values.
\r
937 \param [in] ptr Pointer to data
\r
938 \return value of type uint16_t at (*ptr)
\r
940 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr)
\r
944 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
945 return ((uint16_t) result); /* Add explicit type cast here */
\r
950 \brief LDRT Unprivileged (32 bit)
\r
951 \details Executes a Unprivileged LDRT instruction for 32 bit values.
\r
952 \param [in] ptr Pointer to data
\r
953 \return value of type uint32_t at (*ptr)
\r
955 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr)
\r
959 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
965 \brief STRT Unprivileged (8 bit)
\r
966 \details Executes a Unprivileged STRT instruction for 8 bit values.
\r
967 \param [in] value Value to store
\r
968 \param [in] ptr Pointer to location
\r
970 __attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
\r
972 __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
977 \brief STRT Unprivileged (16 bit)
\r
978 \details Executes a Unprivileged STRT instruction for 16 bit values.
\r
979 \param [in] value Value to store
\r
980 \param [in] ptr Pointer to location
\r
982 __attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
\r
984 __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
989 \brief STRT Unprivileged (32 bit)
\r
990 \details Executes a Unprivileged STRT instruction for 32 bit values.
\r
991 \param [in] value Value to store
\r
992 \param [in] ptr Pointer to location
\r
994 __attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
\r
996 __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
\r
999 #endif /* ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U)) */
\r
1002 #if ((__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U))
\r
1005 \brief Load-Acquire (8 bit)
\r
1006 \details Executes a LDAB instruction for 8 bit value.
\r
1007 \param [in] ptr Pointer to data
\r
1008 \return value of type uint8_t at (*ptr)
\r
1010 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr)
\r
1014 __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1015 return ((uint8_t) result);
\r
1020 \brief Load-Acquire (16 bit)
\r
1021 \details Executes a LDAH instruction for 16 bit values.
\r
1022 \param [in] ptr Pointer to data
\r
1023 \return value of type uint16_t at (*ptr)
\r
1025 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr)
\r
1029 __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1030 return ((uint16_t) result);
\r
1035 \brief Load-Acquire (32 bit)
\r
1036 \details Executes a LDA instruction for 32 bit values.
\r
1037 \param [in] ptr Pointer to data
\r
1038 \return value of type uint32_t at (*ptr)
\r
1040 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr)
\r
1044 __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
\r
1050 \brief Store-Release (8 bit)
\r
1051 \details Executes a STLB instruction for 8 bit values.
\r
1052 \param [in] value Value to store
\r
1053 \param [in] ptr Pointer to location
\r
1055 __attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
\r
1057 __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1062 \brief Store-Release (16 bit)
\r
1063 \details Executes a STLH instruction for 16 bit values.
\r
1064 \param [in] value Value to store
\r
1065 \param [in] ptr Pointer to location
\r
1067 __attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
\r
1069 __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1074 \brief Store-Release (32 bit)
\r
1075 \details Executes a STL instruction for 32 bit values.
\r
1076 \param [in] value Value to store
\r
1077 \param [in] ptr Pointer to location
\r
1079 __attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr)
\r
1081 __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
\r
1086 \brief Load-Acquire Exclusive (8 bit)
\r
1087 \details Executes a LDAB exclusive instruction for 8 bit value.
\r
1088 \param [in] ptr Pointer to data
\r
1089 \return value of type uint8_t at (*ptr)
\r
1091 #define __LDAEXB (uint8_t)__builtin_arm_ldaex
\r
1095 \brief Load-Acquire Exclusive (16 bit)
\r
1096 \details Executes a LDAH exclusive instruction for 16 bit values.
\r
1097 \param [in] ptr Pointer to data
\r
1098 \return value of type uint16_t at (*ptr)
\r
1100 #define __LDAEXH (uint16_t)__builtin_arm_ldaex
\r
1104 \brief Load-Acquire Exclusive (32 bit)
\r
1105 \details Executes a LDA exclusive instruction for 32 bit values.
\r
1106 \param [in] ptr Pointer to data
\r
1107 \return value of type uint32_t at (*ptr)
\r
1109 #define __LDAEX (uint32_t)__builtin_arm_ldaex
\r
1113 \brief Store-Release Exclusive (8 bit)
\r
1114 \details Executes a STLB exclusive instruction for 8 bit values.
\r
1115 \param [in] value Value to store
\r
1116 \param [in] ptr Pointer to location
\r
1117 \return 0 Function succeeded
\r
1118 \return 1 Function failed
\r
1120 #define __STLEXB (uint32_t)__builtin_arm_stlex
\r
1124 \brief Store-Release Exclusive (16 bit)
\r
1125 \details Executes a STLH exclusive instruction for 16 bit values.
\r
1126 \param [in] value Value to store
\r
1127 \param [in] ptr Pointer to location
\r
1128 \return 0 Function succeeded
\r
1129 \return 1 Function failed
\r
1131 #define __STLEXH (uint32_t)__builtin_arm_stlex
\r
1135 \brief Store-Release Exclusive (32 bit)
\r
1136 \details Executes a STL exclusive instruction for 32 bit values.
\r
1137 \param [in] value Value to store
\r
1138 \param [in] ptr Pointer to location
\r
1139 \return 0 Function succeeded
\r
1140 \return 1 Function failed
\r
1142 #define __STLEX (uint32_t)__builtin_arm_stlex
\r
1144 #endif /* ((__ARM_ARCH_8M_MAIN__ == 1U) || (__ARM_ARCH_8M_BASE__ == 1U)) */
\r
1146 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
\r
1149 /* ################### Compiler specific Intrinsics ########################### */
\r
1150 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
\r
1151 Access to dedicated SIMD instructions
\r
1155 #if (__ARM_FEATURE_DSP == 1U) /* ToDo ARMCLANG: This should be ARCH >= ARMv7-M + SIMD */
\r
1157 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
\r
1161 __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1165 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
\r
1169 __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1173 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
\r
1177 __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1181 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
\r
1185 __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1189 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
\r
1193 __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1197 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
\r
1201 __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1206 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
\r
1210 __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1214 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
\r
1218 __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1222 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
\r
1226 __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1230 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
\r
1234 __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1238 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
\r
1242 __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1246 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
\r
1250 __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1255 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
\r
1259 __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1263 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
\r
1267 __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1271 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
\r
1275 __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1279 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
\r
1283 __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1287 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
\r
1291 __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1295 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
\r
1299 __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1303 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
\r
1307 __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1311 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
\r
1315 __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1319 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
\r
1323 __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1327 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
\r
1331 __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1335 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
\r
1339 __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1343 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
\r
1347 __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1351 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
\r
1355 __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1359 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
\r
1363 __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1367 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
\r
1371 __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1375 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
\r
1379 __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1383 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
\r
1387 __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1391 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
\r
1395 __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1399 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
\r
1403 __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1407 __attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
\r
1411 __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1415 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
\r
1419 __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1423 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
\r
1427 __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1431 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
\r
1435 __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1439 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
\r
1443 __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1447 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
\r
1451 __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1455 __attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)
\r
1459 __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1463 #define __SSAT16(ARG1,ARG2) \
\r
1465 int32_t __RES, __ARG1 = (ARG1); \
\r
1466 __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
1470 #define __USAT16(ARG1,ARG2) \
\r
1472 uint32_t __RES, __ARG1 = (ARG1); \
\r
1473 __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
\r
1477 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1)
\r
1481 __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));
\r
1485 __attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
\r
1489 __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1493 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1)
\r
1497 __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));
\r
1501 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
\r
1505 __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1509 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2)
\r
1513 __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1517 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
\r
1521 __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1525 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1529 __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1533 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1537 __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1541 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1549 #ifndef __ARMEB__ /* Little endian */
\r
1550 __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
1551 #else /* Big endian */
\r
1552 __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
1558 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1566 #ifndef __ARMEB__ /* Little endian */
\r
1567 __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
1568 #else /* Big endian */
\r
1569 __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
1575 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2)
\r
1579 __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1583 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
\r
1587 __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1591 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1595 __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1599 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)
\r
1603 __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );
\r
1607 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1615 #ifndef __ARMEB__ /* Little endian */
\r
1616 __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
1617 #else /* Big endian */
\r
1618 __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
1624 __attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)
\r
1632 #ifndef __ARMEB__ /* Little endian */
\r
1633 __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
1634 #else /* Big endian */
\r
1635 __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
1641 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2)
\r
1645 __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1649 __attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2)
\r
1653 __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1657 __attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2)
\r
1661 __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );
\r
1665 #define __PKHBT(ARG1,ARG2,ARG3) \
\r
1667 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
\r
1668 __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
\r
1672 #define __PKHTB(ARG1,ARG2,ARG3) \
\r
1674 uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \
\r
1676 __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \
\r
1678 __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \
\r
1682 __attribute__((always_inline)) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
\r
1686 __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
\r
1690 #endif /* (__ARM_FEATURE_DSP == 1U) */
\r
1691 /*@} end of group CMSIS_SIMD_intrinsics */
\r
1694 #endif /* __CMSIS_ARMCLANG_H */
\r