1 /**************************************************************************//**
2 * @file cmsis_armclang.h
3 * @brief CMSIS compiler armclang (Arm Compiler 6) header file
6 ******************************************************************************/
8 * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
10 * SPDX-License-Identifier: Apache-2.0
12 * Licensed under the Apache License, Version 2.0 (the License); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
25 /*lint -esym(9058, IRQn)*/ /* disable MISRA 2012 Rule 2.4 for IRQn */
27 #ifndef __CMSIS_ARMCLANG_H
28 #define __CMSIS_ARMCLANG_H
30 #pragma clang system_header /* treat file as system include file */
32 #ifndef __ARM_COMPAT_H
33 #include <arm_compat.h> /* Compatibility header for Arm Compiler 5 intrinsics */
36 /* CMSIS compiler specific defines */
41 #define __INLINE __inline
43 #ifndef __STATIC_INLINE
44 #define __STATIC_INLINE static __inline
46 #ifndef __STATIC_FORCEINLINE
47 #define __STATIC_FORCEINLINE __attribute__((always_inline)) static __inline
50 #define __NO_RETURN __attribute__((__noreturn__))
53 #define __USED __attribute__((used))
56 #define __WEAK __attribute__((weak))
59 #define __PACKED __attribute__((packed, aligned(1)))
61 #ifndef __PACKED_STRUCT
62 #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
64 #ifndef __PACKED_UNION
65 #define __PACKED_UNION union __attribute__((packed, aligned(1)))
67 #ifndef __UNALIGNED_UINT32 /* deprecated */
68 #pragma clang diagnostic push
69 #pragma clang diagnostic ignored "-Wpacked"
70 /*lint -esym(9058, T_UINT32)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32 */
71 struct __attribute__((packed)) T_UINT32 { uint32_t v; };
72 #pragma clang diagnostic pop
73 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
75 #ifndef __UNALIGNED_UINT16_WRITE
76 #pragma clang diagnostic push
77 #pragma clang diagnostic ignored "-Wpacked"
78 /*lint -esym(9058, T_UINT16_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_WRITE */
79 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
80 #pragma clang diagnostic pop
81 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
83 #ifndef __UNALIGNED_UINT16_READ
84 #pragma clang diagnostic push
85 #pragma clang diagnostic ignored "-Wpacked"
86 /*lint -esym(9058, T_UINT16_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT16_READ */
87 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
88 #pragma clang diagnostic pop
89 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
91 #ifndef __UNALIGNED_UINT32_WRITE
92 #pragma clang diagnostic push
93 #pragma clang diagnostic ignored "-Wpacked"
94 /*lint -esym(9058, T_UINT32_WRITE)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_WRITE */
95 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
96 #pragma clang diagnostic pop
97 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
99 #ifndef __UNALIGNED_UINT32_READ
100 #pragma clang diagnostic push
101 #pragma clang diagnostic ignored "-Wpacked"
102 /*lint -esym(9058, T_UINT32_READ)*/ /* disable MISRA 2012 Rule 2.4 for T_UINT32_READ */
103 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
104 #pragma clang diagnostic pop
105 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
108 #define __ALIGNED(x) __attribute__((aligned(x)))
111 #define __RESTRICT __restrict
114 /* ######################### Startup and Lowlevel Init ######################## */
116 #ifndef __PROGRAM_START
117 #define __PROGRAM_START __main
121 #define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
124 #ifndef __STACK_LIMIT
125 #define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base
128 #ifndef __VECTOR_TABLE
129 #define __VECTOR_TABLE __Vectors
132 #ifndef __VECTOR_TABLE_ATTRIBUTE
133 #define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section("RESET")))
136 /* ########################### Core Function Access ########################### */
137 /** \ingroup CMSIS_Core_FunctionInterface
138 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
143 \brief Enable IRQ Interrupts
144 \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
145 Can only be executed in Privileged modes.
147 /* intrinsic void __enable_irq(); see arm_compat.h */
151 \brief Disable IRQ Interrupts
152 \details Disables IRQ interrupts by setting the I-bit in the CPSR.
153 Can only be executed in Privileged modes.
155 /* intrinsic void __disable_irq(); see arm_compat.h */
159 \brief Get Control Register
160 \details Returns the content of the Control Register.
161 \return Control Register value
163 __STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
167 __ASM volatile ("MRS %0, control" : "=r" (result) );
172 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
174 \brief Get Control Register (non-secure)
175 \details Returns the content of the non-secure Control Register when in secure mode.
176 \return non-secure Control Register value
178 __STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
182 __ASM volatile ("MRS %0, control_ns" : "=r" (result) );
189 \brief Set Control Register
190 \details Writes the given value to the Control Register.
191 \param [in] control Control Register value to set
193 __STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
195 __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
199 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
201 \brief Set Control Register (non-secure)
202 \details Writes the given value to the non-secure Control Register when in secure state.
203 \param [in] control Control Register value to set
205 __STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
207 __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");
213 \brief Get IPSR Register
214 \details Returns the content of the IPSR Register.
215 \return IPSR Register value
217 __STATIC_FORCEINLINE uint32_t __get_IPSR(void)
221 __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
227 \brief Get APSR Register
228 \details Returns the content of the APSR Register.
229 \return APSR Register value
231 __STATIC_FORCEINLINE uint32_t __get_APSR(void)
235 __ASM volatile ("MRS %0, apsr" : "=r" (result) );
241 \brief Get xPSR Register
242 \details Returns the content of the xPSR Register.
243 \return xPSR Register value
245 __STATIC_FORCEINLINE uint32_t __get_xPSR(void)
249 __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
255 \brief Get Process Stack Pointer
256 \details Returns the current value of the Process Stack Pointer (PSP).
257 \return PSP Register value
259 __STATIC_FORCEINLINE uint32_t __get_PSP(void)
263 __ASM volatile ("MRS %0, psp" : "=r" (result) );
268 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
270 \brief Get Process Stack Pointer (non-secure)
271 \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
272 \return PSP Register value
274 __STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
278 __ASM volatile ("MRS %0, psp_ns" : "=r" (result) );
285 \brief Set Process Stack Pointer
286 \details Assigns the given value to the Process Stack Pointer (PSP).
287 \param [in] topOfProcStack Process Stack Pointer value to set
289 __STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
291 __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );
295 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
297 \brief Set Process Stack Pointer (non-secure)
298 \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
299 \param [in] topOfProcStack Process Stack Pointer value to set
301 __STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
303 __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );
309 \brief Get Main Stack Pointer
310 \details Returns the current value of the Main Stack Pointer (MSP).
311 \return MSP Register value
313 __STATIC_FORCEINLINE uint32_t __get_MSP(void)
317 __ASM volatile ("MRS %0, msp" : "=r" (result) );
322 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
324 \brief Get Main Stack Pointer (non-secure)
325 \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
326 \return MSP Register value
328 __STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
332 __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );
339 \brief Set Main Stack Pointer
340 \details Assigns the given value to the Main Stack Pointer (MSP).
341 \param [in] topOfMainStack Main Stack Pointer value to set
343 __STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
345 __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );
349 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
351 \brief Set Main Stack Pointer (non-secure)
352 \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
353 \param [in] topOfMainStack Main Stack Pointer value to set
355 __STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
357 __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );
362 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
364 \brief Get Stack Pointer (non-secure)
365 \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.
366 \return SP Register value
368 __STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
372 __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );
378 \brief Set Stack Pointer (non-secure)
379 \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.
380 \param [in] topOfStack Stack Pointer value to set
382 __STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
384 __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );
390 \brief Get Priority Mask
391 \details Returns the current state of the priority mask bit from the Priority Mask Register.
392 \return Priority Mask value
394 __STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
398 __ASM volatile ("MRS %0, primask" : "=r" (result) );
403 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
405 \brief Get Priority Mask (non-secure)
406 \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.
407 \return Priority Mask value
409 __STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
413 __ASM volatile ("MRS %0, primask_ns" : "=r" (result) );
420 \brief Set Priority Mask
421 \details Assigns the given value to the Priority Mask Register.
422 \param [in] priMask Priority Mask
424 __STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
426 __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
430 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
432 \brief Set Priority Mask (non-secure)
433 \details Assigns the given value to the non-secure Priority Mask Register when in secure state.
434 \param [in] priMask Priority Mask
436 __STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
438 __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");
443 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
444 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
445 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
448 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
449 Can only be executed in Privileged modes.
451 #define __enable_fault_irq __enable_fiq /* see arm_compat.h */
456 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
457 Can only be executed in Privileged modes.
459 #define __disable_fault_irq __disable_fiq /* see arm_compat.h */
463 \brief Get Base Priority
464 \details Returns the current value of the Base Priority register.
465 \return Base Priority register value
467 __STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
471 __ASM volatile ("MRS %0, basepri" : "=r" (result) );
476 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
478 \brief Get Base Priority (non-secure)
479 \details Returns the current value of the non-secure Base Priority register when in secure state.
480 \return Base Priority register value
482 __STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
486 __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );
493 \brief Set Base Priority
494 \details Assigns the given value to the Base Priority register.
495 \param [in] basePri Base Priority value to set
497 __STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
499 __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");
503 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
505 \brief Set Base Priority (non-secure)
506 \details Assigns the given value to the non-secure Base Priority register when in secure state.
507 \param [in] basePri Base Priority value to set
509 __STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
511 __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");
517 \brief Set Base Priority with condition
518 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
519 or the new value increases the BASEPRI priority level.
520 \param [in] basePri Base Priority value to set
522 __STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
524 __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");
529 \brief Get Fault Mask
530 \details Returns the current value of the Fault Mask register.
531 \return Fault Mask register value
533 __STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
537 __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
542 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
544 \brief Get Fault Mask (non-secure)
545 \details Returns the current value of the non-secure Fault Mask register when in secure state.
546 \return Fault Mask register value
548 __STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
552 __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );
559 \brief Set Fault Mask
560 \details Assigns the given value to the Fault Mask register.
561 \param [in] faultMask Fault Mask value to set
563 __STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
565 __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
569 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
571 \brief Set Fault Mask (non-secure)
572 \details Assigns the given value to the non-secure Fault Mask register when in secure state.
573 \param [in] faultMask Fault Mask value to set
575 __STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
577 __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");
581 #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
582 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
583 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
586 #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
587 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
590 \brief Get Process Stack Pointer Limit
591 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
592 Stack Pointer Limit register hence zero is returned always in non-secure
595 \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).
596 \return PSPLIM Register value
598 __STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
600 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
601 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
602 // without main extensions, the non-secure PSPLIM is RAZ/WI
606 __ASM volatile ("MRS %0, psplim" : "=r" (result) );
611 #if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
613 \brief Get Process Stack Pointer Limit (non-secure)
614 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
615 Stack Pointer Limit register hence zero is returned always in non-secure
618 \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
619 \return PSPLIM Register value
621 __STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
623 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
624 // without main extensions, the non-secure PSPLIM is RAZ/WI
628 __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) );
636 \brief Set Process Stack Pointer Limit
637 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
638 Stack Pointer Limit register hence the write is silently ignored in non-secure
641 \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).
642 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
644 __STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
646 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
647 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
648 // without main extensions, the non-secure PSPLIM is RAZ/WI
649 (void)ProcStackPtrLimit;
651 __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));
656 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
658 \brief Set Process Stack Pointer (non-secure)
659 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
660 Stack Pointer Limit register hence the write is silently ignored in non-secure
663 \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
664 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
666 __STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
668 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
669 // without main extensions, the non-secure PSPLIM is RAZ/WI
670 (void)ProcStackPtrLimit;
672 __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));
679 \brief Get Main Stack Pointer Limit
680 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
681 Stack Pointer Limit register hence zero is returned always.
683 \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).
684 \return MSPLIM Register value
686 __STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
688 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
689 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
690 // without main extensions, the non-secure MSPLIM is RAZ/WI
694 __ASM volatile ("MRS %0, msplim" : "=r" (result) );
700 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
702 \brief Get Main Stack Pointer Limit (non-secure)
703 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
704 Stack Pointer Limit register hence zero is returned always.
706 \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
707 \return MSPLIM Register value
709 __STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
711 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
712 // without main extensions, the non-secure MSPLIM is RAZ/WI
716 __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );
724 \brief Set Main Stack Pointer Limit
725 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
726 Stack Pointer Limit register hence the write is silently ignored.
728 \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).
729 \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set
731 __STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
733 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
734 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
735 // without main extensions, the non-secure MSPLIM is RAZ/WI
736 (void)MainStackPtrLimit;
738 __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));
743 #if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))
745 \brief Set Main Stack Pointer Limit (non-secure)
746 Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure
747 Stack Pointer Limit register hence the write is silently ignored.
749 \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
750 \param [in] MainStackPtrLimit Main Stack Pointer value to set
752 __STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
754 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))
755 // without main extensions, the non-secure MSPLIM is RAZ/WI
756 (void)MainStackPtrLimit;
758 __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));
763 #endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
764 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
768 \details Returns the current value of the Floating Point Status/Control register.
769 \return Floating Point Status/Control register value
771 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
772 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
773 #define __get_FPSCR (uint32_t)__builtin_arm_get_fpscr
775 #define __get_FPSCR() ((uint32_t)0U)
780 \details Assigns the given value to the Floating Point Status/Control register.
781 \param [in] fpscr Floating Point Status/Control value to set
783 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
784 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
785 #define __set_FPSCR __builtin_arm_set_fpscr
787 #define __set_FPSCR(x) ((void)(x))
791 /*@} end of CMSIS_Core_RegAccFunctions */
794 /* ########################## Core Instruction Access ######################### */
795 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
796 Access to dedicated instructions
800 /* Define macros for porting to both thumb1 and thumb2.
801 * For thumb1, use low register (r0-r7), specified by constraint "l"
802 * Otherwise, use general registers, specified by constraint "r" */
803 #if defined (__thumb__) && !defined (__thumb2__)
804 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
805 #define __CMSIS_GCC_RW_REG(r) "+l" (r)
806 #define __CMSIS_GCC_USE_REG(r) "l" (r)
808 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
809 #define __CMSIS_GCC_RW_REG(r) "+r" (r)
810 #define __CMSIS_GCC_USE_REG(r) "r" (r)
815 \details No Operation does nothing. This instruction can be used for code alignment purposes.
817 #define __NOP __builtin_arm_nop
820 \brief Wait For Interrupt
821 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
823 #define __WFI __builtin_arm_wfi
827 \brief Wait For Event
828 \details Wait For Event is a hint instruction that permits the processor to enter
829 a low-power state until one of a number of events occurs.
831 #define __WFE __builtin_arm_wfe
836 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
838 #define __SEV __builtin_arm_sev
842 \brief Instruction Synchronization Barrier
843 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
844 so that all instructions following the ISB are fetched from cache or memory,
845 after the instruction has been completed.
847 #define __ISB() __builtin_arm_isb(0xF)
850 \brief Data Synchronization Barrier
851 \details Acts as a special kind of Data Memory Barrier.
852 It completes when all explicit memory accesses before this instruction complete.
854 #define __DSB() __builtin_arm_dsb(0xF)
858 \brief Data Memory Barrier
859 \details Ensures the apparent order of the explicit memory operations before
860 and after the instruction, without ensuring their completion.
862 #define __DMB() __builtin_arm_dmb(0xF)
866 \brief Reverse byte order (32 bit)
867 \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
868 \param [in] value Value to reverse
869 \return Reversed value
871 #define __REV(value) __builtin_bswap32(value)
875 \brief Reverse byte order (16 bit)
876 \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
877 \param [in] value Value to reverse
878 \return Reversed value
880 #define __REV16(value) __ROR(__REV(value), 16)
884 \brief Reverse byte order (16 bit)
885 \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
886 \param [in] value Value to reverse
887 \return Reversed value
889 #define __REVSH(value) (int16_t)__builtin_bswap16(value)
893 \brief Rotate Right in unsigned value (32 bit)
894 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
895 \param [in] op1 Value to rotate
896 \param [in] op2 Number of Bits to rotate
897 \return Rotated value
899 __STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
906 return (op1 >> op2) | (op1 << (32U - op2));
912 \details Causes the processor to enter Debug state.
913 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
914 \param [in] value is ignored by the processor.
915 If required, a debugger can use it to store additional information about the breakpoint.
917 #define __BKPT(value) __ASM volatile ("bkpt "#value)
921 \brief Reverse bit order of value
922 \details Reverses the bit order of the given value.
923 \param [in] value Value to reverse
924 \return Reversed value
926 #define __RBIT __builtin_arm_rbit
929 \brief Count leading zeros
930 \details Counts the number of leading zeros of a data value.
931 \param [in] value Value to count the leading zeros
932 \return number of leading zeros in value
934 __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
936 /* Even though __builtin_clz produces a CLZ instruction on ARM, formally
937 __builtin_clz(0) is undefined behaviour, so handle this case specially.
938 This guarantees ARM-compatible results if happening to compile on a non-ARM
939 target, and ensures the compiler doesn't decide to activate any
940 optimisations using the logic "value was passed to __builtin_clz, so it
942 ARM Compiler 6.10 and possibly earlier will optimise this test away, leaving a
943 single CLZ instruction.
949 return __builtin_clz(value);
953 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
954 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
955 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
956 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
958 \brief LDR Exclusive (8 bit)
959 \details Executes a exclusive LDR instruction for 8 bit value.
960 \param [in] ptr Pointer to data
961 \return value of type uint8_t at (*ptr)
963 #define __LDREXB (uint8_t)__builtin_arm_ldrex
967 \brief LDR Exclusive (16 bit)
968 \details Executes a exclusive LDR instruction for 16 bit values.
969 \param [in] ptr Pointer to data
970 \return value of type uint16_t at (*ptr)
972 #define __LDREXH (uint16_t)__builtin_arm_ldrex
976 \brief LDR Exclusive (32 bit)
977 \details Executes a exclusive LDR instruction for 32 bit values.
978 \param [in] ptr Pointer to data
979 \return value of type uint32_t at (*ptr)
981 #define __LDREXW (uint32_t)__builtin_arm_ldrex
985 \brief STR Exclusive (8 bit)
986 \details Executes a exclusive STR instruction for 8 bit values.
987 \param [in] value Value to store
988 \param [in] ptr Pointer to location
989 \return 0 Function succeeded
990 \return 1 Function failed
992 #define __STREXB (uint32_t)__builtin_arm_strex
996 \brief STR Exclusive (16 bit)
997 \details Executes a exclusive STR instruction for 16 bit values.
998 \param [in] value Value to store
999 \param [in] ptr Pointer to location
1000 \return 0 Function succeeded
1001 \return 1 Function failed
1003 #define __STREXH (uint32_t)__builtin_arm_strex
1007 \brief STR Exclusive (32 bit)
1008 \details Executes a exclusive STR instruction for 32 bit values.
1009 \param [in] value Value to store
1010 \param [in] ptr Pointer to location
1011 \return 0 Function succeeded
1012 \return 1 Function failed
1014 #define __STREXW (uint32_t)__builtin_arm_strex
1018 \brief Remove the exclusive lock
1019 \details Removes the exclusive lock which is created by LDREX.
1021 #define __CLREX __builtin_arm_clrex
1023 #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
1024 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
1025 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
1026 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
1029 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
1030 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
1031 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) )
1034 \brief Signed Saturate
1035 \details Saturates a signed value.
1036 \param [in] value Value to be saturated
1037 \param [in] sat Bit position to saturate to (1..32)
1038 \return Saturated value
1040 #define __SSAT __builtin_arm_ssat
1044 \brief Unsigned Saturate
1045 \details Saturates an unsigned value.
1046 \param [in] value Value to be saturated
1047 \param [in] sat Bit position to saturate to (0..31)
1048 \return Saturated value
1050 #define __USAT __builtin_arm_usat
1054 \brief Rotate Right with Extend (32 bit)
1055 \details Moves each bit of a bitstring right by one bit.
1056 The carry input is shifted in at the left end of the bitstring.
1057 \param [in] value Value to rotate
1058 \return Rotated value
1060 __STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
1064 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
1070 \brief LDRT Unprivileged (8 bit)
1071 \details Executes a Unprivileged LDRT instruction for 8 bit value.
1072 \param [in] ptr Pointer to data
1073 \return value of type uint8_t at (*ptr)
1075 __STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
1079 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );
1080 return ((uint8_t) result); /* Add explicit type cast here */
1085 \brief LDRT Unprivileged (16 bit)
1086 \details Executes a Unprivileged LDRT instruction for 16 bit values.
1087 \param [in] ptr Pointer to data
1088 \return value of type uint16_t at (*ptr)
1090 __STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
1094 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );
1095 return ((uint16_t) result); /* Add explicit type cast here */
1100 \brief LDRT Unprivileged (32 bit)
1101 \details Executes a Unprivileged LDRT instruction for 32 bit values.
1102 \param [in] ptr Pointer to data
1103 \return value of type uint32_t at (*ptr)
1105 __STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
1109 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );
1115 \brief STRT Unprivileged (8 bit)
1116 \details Executes a Unprivileged STRT instruction for 8 bit values.
1117 \param [in] value Value to store
1118 \param [in] ptr Pointer to location
1120 __STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
1122 __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
1127 \brief STRT Unprivileged (16 bit)
1128 \details Executes a Unprivileged STRT instruction for 16 bit values.
1129 \param [in] value Value to store
1130 \param [in] ptr Pointer to location
1132 __STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
1134 __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
1139 \brief STRT Unprivileged (32 bit)
1140 \details Executes a Unprivileged STRT instruction for 32 bit values.
1141 \param [in] value Value to store
1142 \param [in] ptr Pointer to location
1144 __STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
1146 __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );
1149 #else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
1150 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
1151 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
1154 \brief Signed Saturate
1155 \details Saturates a signed value.
1156 \param [in] value Value to be saturated
1157 \param [in] sat Bit position to saturate to (1..32)
1158 \return Saturated value
1160 __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
1162 if ((sat >= 1U) && (sat <= 32U))
1164 const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
1165 const int32_t min = -1 - max ;
1179 \brief Unsigned Saturate
1180 \details Saturates an unsigned value.
1181 \param [in] value Value to be saturated
1182 \param [in] sat Bit position to saturate to (0..31)
1183 \return Saturated value
1185 __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
1189 const uint32_t max = ((1U << sat) - 1U);
1190 if (val > (int32_t)max)
1199 return (uint32_t)val;
1202 #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
1203 (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \
1204 (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */
1207 #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
1208 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
1210 \brief Load-Acquire (8 bit)
1211 \details Executes a LDAB instruction for 8 bit value.
1212 \param [in] ptr Pointer to data
1213 \return value of type uint8_t at (*ptr)
1215 __STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
1219 __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );
1220 return ((uint8_t) result);
1225 \brief Load-Acquire (16 bit)
1226 \details Executes a LDAH instruction for 16 bit values.
1227 \param [in] ptr Pointer to data
1228 \return value of type uint16_t at (*ptr)
1230 __STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
1234 __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );
1235 return ((uint16_t) result);
1240 \brief Load-Acquire (32 bit)
1241 \details Executes a LDA instruction for 32 bit values.
1242 \param [in] ptr Pointer to data
1243 \return value of type uint32_t at (*ptr)
1245 __STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
1249 __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );
1255 \brief Store-Release (8 bit)
1256 \details Executes a STLB instruction for 8 bit values.
1257 \param [in] value Value to store
1258 \param [in] ptr Pointer to location
1260 __STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
1262 __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
1267 \brief Store-Release (16 bit)
1268 \details Executes a STLH instruction for 16 bit values.
1269 \param [in] value Value to store
1270 \param [in] ptr Pointer to location
1272 __STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
1274 __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
1279 \brief Store-Release (32 bit)
1280 \details Executes a STL instruction for 32 bit values.
1281 \param [in] value Value to store
1282 \param [in] ptr Pointer to location
1284 __STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
1286 __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );
1291 \brief Load-Acquire Exclusive (8 bit)
1292 \details Executes a LDAB exclusive instruction for 8 bit value.
1293 \param [in] ptr Pointer to data
1294 \return value of type uint8_t at (*ptr)
1296 #define __LDAEXB (uint8_t)__builtin_arm_ldaex
1300 \brief Load-Acquire Exclusive (16 bit)
1301 \details Executes a LDAH exclusive instruction for 16 bit values.
1302 \param [in] ptr Pointer to data
1303 \return value of type uint16_t at (*ptr)
1305 #define __LDAEXH (uint16_t)__builtin_arm_ldaex
1309 \brief Load-Acquire Exclusive (32 bit)
1310 \details Executes a LDA exclusive instruction for 32 bit values.
1311 \param [in] ptr Pointer to data
1312 \return value of type uint32_t at (*ptr)
1314 #define __LDAEX (uint32_t)__builtin_arm_ldaex
1318 \brief Store-Release Exclusive (8 bit)
1319 \details Executes a STLB exclusive instruction for 8 bit values.
1320 \param [in] value Value to store
1321 \param [in] ptr Pointer to location
1322 \return 0 Function succeeded
1323 \return 1 Function failed
1325 #define __STLEXB (uint32_t)__builtin_arm_stlex
1329 \brief Store-Release Exclusive (16 bit)
1330 \details Executes a STLH exclusive instruction for 16 bit values.
1331 \param [in] value Value to store
1332 \param [in] ptr Pointer to location
1333 \return 0 Function succeeded
1334 \return 1 Function failed
1336 #define __STLEXH (uint32_t)__builtin_arm_stlex
1340 \brief Store-Release Exclusive (32 bit)
1341 \details Executes a STL exclusive instruction for 32 bit values.
1342 \param [in] value Value to store
1343 \param [in] ptr Pointer to location
1344 \return 0 Function succeeded
1345 \return 1 Function failed
1347 #define __STLEX (uint32_t)__builtin_arm_stlex
1349 #endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
1350 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */
1352 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
1355 /* ################### Compiler specific Intrinsics ########################### */
1356 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
1357 Access to dedicated SIMD instructions
1361 #if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
1363 #define __SADD8 __builtin_arm_sadd8
1364 #define __QADD8 __builtin_arm_qadd8
1365 #define __SHADD8 __builtin_arm_shadd8
1366 #define __UADD8 __builtin_arm_uadd8
1367 #define __UQADD8 __builtin_arm_uqadd8
1368 #define __UHADD8 __builtin_arm_uhadd8
1369 #define __SSUB8 __builtin_arm_ssub8
1370 #define __QSUB8 __builtin_arm_qsub8
1371 #define __SHSUB8 __builtin_arm_shsub8
1372 #define __USUB8 __builtin_arm_usub8
1373 #define __UQSUB8 __builtin_arm_uqsub8
1374 #define __UHSUB8 __builtin_arm_uhsub8
1375 #define __SADD16 __builtin_arm_sadd16
1376 #define __QADD16 __builtin_arm_qadd16
1377 #define __SHADD16 __builtin_arm_shadd16
1378 #define __UADD16 __builtin_arm_uadd16
1379 #define __UQADD16 __builtin_arm_uqadd16
1380 #define __UHADD16 __builtin_arm_uhadd16
1381 #define __SSUB16 __builtin_arm_ssub16
1382 #define __QSUB16 __builtin_arm_qsub16
1383 #define __SHSUB16 __builtin_arm_shsub16
1384 #define __USUB16 __builtin_arm_usub16
1385 #define __UQSUB16 __builtin_arm_uqsub16
1386 #define __UHSUB16 __builtin_arm_uhsub16
1387 #define __SASX __builtin_arm_sasx
1388 #define __QASX __builtin_arm_qasx
1389 #define __SHASX __builtin_arm_shasx
1390 #define __UASX __builtin_arm_uasx
1391 #define __UQASX __builtin_arm_uqasx
1392 #define __UHASX __builtin_arm_uhasx
1393 #define __SSAX __builtin_arm_ssax
1394 #define __QSAX __builtin_arm_qsax
1395 #define __SHSAX __builtin_arm_shsax
1396 #define __USAX __builtin_arm_usax
1397 #define __UQSAX __builtin_arm_uqsax
1398 #define __UHSAX __builtin_arm_uhsax
1399 #define __USAD8 __builtin_arm_usad8
1400 #define __USADA8 __builtin_arm_usada8
1401 #define __SSAT16 __builtin_arm_ssat16
1402 #define __USAT16 __builtin_arm_usat16
1403 #define __UXTB16 __builtin_arm_uxtb16
1404 #define __UXTAB16 __builtin_arm_uxtab16
1405 #define __SXTB16 __builtin_arm_sxtb16
1406 #define __SXTAB16 __builtin_arm_sxtab16
1407 #define __SMUAD __builtin_arm_smuad
1408 #define __SMUADX __builtin_arm_smuadx
1409 #define __SMLAD __builtin_arm_smlad
1410 #define __SMLADX __builtin_arm_smladx
1411 #define __SMLALD __builtin_arm_smlald
1412 #define __SMLALDX __builtin_arm_smlaldx
1413 #define __SMUSD __builtin_arm_smusd
1414 #define __SMUSDX __builtin_arm_smusdx
1415 #define __SMLSD __builtin_arm_smlsd
1416 #define __SMLSDX __builtin_arm_smlsdx
1417 #define __SMLSLD __builtin_arm_smlsld
1418 #define __SMLSLDX __builtin_arm_smlsldx
1419 #define __SEL __builtin_arm_sel
1420 #define __QADD __builtin_arm_qadd
1421 #define __QSUB __builtin_arm_qsub
1423 #define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
1424 ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
1426 #define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
1427 ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
1429 __STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)
1433 __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) );
1437 #endif /* (__ARM_FEATURE_DSP == 1) */
1438 /*@} end of group CMSIS_SIMD_intrinsics */
1441 #endif /* __CMSIS_ARMCLANG_H */