]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/ST_Code/Drivers/CMSIS/Include/cmsis_gcc.h
Add MPU demo project for Nulceo-L152RE which is Coretx-M3.
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M3_NUCLEO_L152RE_GCC / ST_Code / Drivers / CMSIS / Include / cmsis_gcc.h
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/ST_Code/Drivers/CMSIS/Include/cmsis_gcc.h b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/ST_Code/Drivers/CMSIS/Include/cmsis_gcc.h
new file mode 100644 (file)
index 0000000..1bd41a4
--- /dev/null
@@ -0,0 +1,2085 @@
+/**************************************************************************//**\r
+ * @file     cmsis_gcc.h\r
+ * @brief    CMSIS compiler GCC header file\r
+ * @version  V5.0.4\r
+ * @date     09. April 2018\r
+ ******************************************************************************/\r
+/*\r
+ * Copyright (c) 2009-2018 Arm Limited. All rights reserved.\r
+ *\r
+ * SPDX-License-Identifier: Apache-2.0\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License); you may\r
+ * not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT\r
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef __CMSIS_GCC_H\r
+#define __CMSIS_GCC_H\r
+\r
+/* ignore some GCC warnings */\r
+#pragma GCC diagnostic push\r
+#pragma GCC diagnostic ignored "-Wsign-conversion"\r
+#pragma GCC diagnostic ignored "-Wconversion"\r
+#pragma GCC diagnostic ignored "-Wunused-parameter"\r
+\r
+/* Fallback for __has_builtin */\r
+#ifndef __has_builtin\r
+  #define __has_builtin(x) (0)\r
+#endif\r
+\r
+/* CMSIS compiler specific defines */\r
+#ifndef   __ASM\r
+  #define __ASM                                  __asm\r
+#endif\r
+#ifndef   __INLINE\r
+  #define __INLINE                               inline\r
+#endif\r
+#ifndef   __STATIC_INLINE\r
+  #define __STATIC_INLINE                        static inline\r
+#endif\r
+#ifndef   __STATIC_FORCEINLINE                 \r
+  #define __STATIC_FORCEINLINE                   __attribute__((always_inline)) static inline\r
+#endif                                           \r
+#ifndef   __NO_RETURN\r
+  #define __NO_RETURN                            __attribute__((__noreturn__))\r
+#endif\r
+#ifndef   __USED\r
+  #define __USED                                 __attribute__((used))\r
+#endif\r
+#ifndef   __WEAK\r
+  #define __WEAK                                 __attribute__((weak))\r
+#endif\r
+#ifndef   __PACKED\r
+  #define __PACKED                               __attribute__((packed, aligned(1)))\r
+#endif\r
+#ifndef   __PACKED_STRUCT\r
+  #define __PACKED_STRUCT                        struct __attribute__((packed, aligned(1)))\r
+#endif\r
+#ifndef   __PACKED_UNION\r
+  #define __PACKED_UNION                         union __attribute__((packed, aligned(1)))\r
+#endif\r
+#ifndef   __UNALIGNED_UINT32        /* deprecated */\r
+  #pragma GCC diagnostic push\r
+  #pragma GCC diagnostic ignored "-Wpacked"\r
+  #pragma GCC diagnostic ignored "-Wattributes"\r
+  struct __attribute__((packed)) T_UINT32 { uint32_t v; };\r
+  #pragma GCC diagnostic pop\r
+  #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)\r
+#endif\r
+#ifndef   __UNALIGNED_UINT16_WRITE\r
+  #pragma GCC diagnostic push\r
+  #pragma GCC diagnostic ignored "-Wpacked"\r
+  #pragma GCC diagnostic ignored "-Wattributes"\r
+  __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };\r
+  #pragma GCC diagnostic pop\r
+  #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))\r
+#endif\r
+#ifndef   __UNALIGNED_UINT16_READ\r
+  #pragma GCC diagnostic push\r
+  #pragma GCC diagnostic ignored "-Wpacked"\r
+  #pragma GCC diagnostic ignored "-Wattributes"\r
+  __PACKED_STRUCT T_UINT16_READ { uint16_t v; };\r
+  #pragma GCC diagnostic pop\r
+  #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)\r
+#endif\r
+#ifndef   __UNALIGNED_UINT32_WRITE\r
+  #pragma GCC diagnostic push\r
+  #pragma GCC diagnostic ignored "-Wpacked"\r
+  #pragma GCC diagnostic ignored "-Wattributes"\r
+  __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };\r
+  #pragma GCC diagnostic pop\r
+  #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))\r
+#endif\r
+#ifndef   __UNALIGNED_UINT32_READ\r
+  #pragma GCC diagnostic push\r
+  #pragma GCC diagnostic ignored "-Wpacked"\r
+  #pragma GCC diagnostic ignored "-Wattributes"\r
+  __PACKED_STRUCT T_UINT32_READ { uint32_t v; };\r
+  #pragma GCC diagnostic pop\r
+  #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)\r
+#endif\r
+#ifndef   __ALIGNED\r
+  #define __ALIGNED(x)                           __attribute__((aligned(x)))\r
+#endif\r
+#ifndef   __RESTRICT\r
+  #define __RESTRICT                             __restrict\r
+#endif\r
+\r
+\r
+/* ###########################  Core Function Access  ########################### */\r
+/** \ingroup  CMSIS_Core_FunctionInterface\r
+    \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions\r
+  @{\r
+ */\r
+\r
+/**\r
+  \brief   Enable IRQ Interrupts\r
+  \details Enables IRQ interrupts by clearing the I-bit in the CPSR.\r
+           Can only be executed in Privileged modes.\r
+ */\r
+__STATIC_FORCEINLINE void __enable_irq(void)\r
+{\r
+  __ASM volatile ("cpsie i" : : : "memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Disable IRQ Interrupts\r
+  \details Disables IRQ interrupts by setting the I-bit in the CPSR.\r
+           Can only be executed in Privileged modes.\r
+ */\r
+__STATIC_FORCEINLINE void __disable_irq(void)\r
+{\r
+  __ASM volatile ("cpsid i" : : : "memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get Control Register\r
+  \details Returns the content of the Control Register.\r
+  \return               Control Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_CONTROL(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, control" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Control Register (non-secure)\r
+  \details Returns the content of the non-secure Control Register when in secure mode.\r
+  \return               non-secure Control Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, control_ns" : "=r" (result) );\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Control Register\r
+  \details Writes the given value to the Control Register.\r
+  \param [in]    control  Control Register value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)\r
+{\r
+  __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Control Register (non-secure)\r
+  \details Writes the given value to the non-secure Control Register when in secure state.\r
+  \param [in]    control  Control Register value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)\r
+{\r
+  __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory");\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Get IPSR Register\r
+  \details Returns the content of the IPSR Register.\r
+  \return               IPSR Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_IPSR(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, ipsr" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get APSR Register\r
+  \details Returns the content of the APSR Register.\r
+  \return               APSR Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_APSR(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, apsr" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get xPSR Register\r
+  \details Returns the content of the xPSR Register.\r
+  \return               xPSR Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_xPSR(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, xpsr" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get Process Stack Pointer\r
+  \details Returns the current value of the Process Stack Pointer (PSP).\r
+  \return               PSP Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_PSP(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, psp"  : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Process Stack Pointer (non-secure)\r
+  \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.\r
+  \return               PSP Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, psp_ns"  : "=r" (result) );\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Process Stack Pointer\r
+  \details Assigns the given value to the Process Stack Pointer (PSP).\r
+  \param [in]    topOfProcStack  Process Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)\r
+{\r
+  __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : );\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Process Stack Pointer (non-secure)\r
+  \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.\r
+  \param [in]    topOfProcStack  Process Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)\r
+{\r
+  __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : );\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Get Main Stack Pointer\r
+  \details Returns the current value of the Main Stack Pointer (MSP).\r
+  \return               MSP Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_MSP(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, msp" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Main Stack Pointer (non-secure)\r
+  \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.\r
+  \return               MSP Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, msp_ns" : "=r" (result) );\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Main Stack Pointer\r
+  \details Assigns the given value to the Main Stack Pointer (MSP).\r
+  \param [in]    topOfMainStack  Main Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)\r
+{\r
+  __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : );\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Main Stack Pointer (non-secure)\r
+  \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.\r
+  \param [in]    topOfMainStack  Main Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)\r
+{\r
+  __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : );\r
+}\r
+#endif\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Stack Pointer (non-secure)\r
+  \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state.\r
+  \return               SP Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, sp_ns" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Set Stack Pointer (non-secure)\r
+  \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state.\r
+  \param [in]    topOfStack  Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)\r
+{\r
+  __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : );\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Get Priority Mask\r
+  \details Returns the current state of the priority mask bit from the Priority Mask Register.\r
+  \return               Priority Mask value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, primask" : "=r" (result) :: "memory");\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Priority Mask (non-secure)\r
+  \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state.\r
+  \return               Priority Mask value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, primask_ns" : "=r" (result) :: "memory");\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Priority Mask\r
+  \details Assigns the given value to the Priority Mask Register.\r
+  \param [in]    priMask  Priority Mask\r
+ */\r
+__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)\r
+{\r
+  __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Priority Mask (non-secure)\r
+  \details Assigns the given value to the non-secure Priority Mask Register when in secure state.\r
+  \param [in]    priMask  Priority Mask\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)\r
+{\r
+  __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory");\r
+}\r
+#endif\r
+\r
+\r
+#if ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+     (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+     (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    )\r
+/**\r
+  \brief   Enable FIQ\r
+  \details Enables FIQ interrupts by clearing the F-bit in the CPSR.\r
+           Can only be executed in Privileged modes.\r
+ */\r
+__STATIC_FORCEINLINE void __enable_fault_irq(void)\r
+{\r
+  __ASM volatile ("cpsie f" : : : "memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Disable FIQ\r
+  \details Disables FIQ interrupts by setting the F-bit in the CPSR.\r
+           Can only be executed in Privileged modes.\r
+ */\r
+__STATIC_FORCEINLINE void __disable_fault_irq(void)\r
+{\r
+  __ASM volatile ("cpsid f" : : : "memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get Base Priority\r
+  \details Returns the current value of the Base Priority register.\r
+  \return               Base Priority register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, basepri" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Base Priority (non-secure)\r
+  \details Returns the current value of the non-secure Base Priority register when in secure state.\r
+  \return               Base Priority register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) );\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Base Priority\r
+  \details Assigns the given value to the Base Priority register.\r
+  \param [in]    basePri  Base Priority value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)\r
+{\r
+  __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory");\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Base Priority (non-secure)\r
+  \details Assigns the given value to the non-secure Base Priority register when in secure state.\r
+  \param [in]    basePri  Base Priority value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)\r
+{\r
+  __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory");\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Base Priority with condition\r
+  \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,\r
+           or the new value increases the BASEPRI priority level.\r
+  \param [in]    basePri  Base Priority value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)\r
+{\r
+  __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Get Fault Mask\r
+  \details Returns the current value of the Fault Mask register.\r
+  \return               Fault Mask register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, faultmask" : "=r" (result) );\r
+  return(result);\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Fault Mask (non-secure)\r
+  \details Returns the current value of the non-secure Fault Mask register when in secure state.\r
+  \return               Fault Mask register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) );\r
+  return(result);\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Fault Mask\r
+  \details Assigns the given value to the Fault Mask register.\r
+  \param [in]    faultMask  Fault Mask value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)\r
+{\r
+  __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Set Fault Mask (non-secure)\r
+  \details Assigns the given value to the non-secure Fault Mask register when in secure state.\r
+  \param [in]    faultMask  Fault Mask value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)\r
+{\r
+  __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory");\r
+}\r
+#endif\r
+\r
+#endif /* ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+           (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+           (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    ) */\r
+\r
+\r
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+     (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    )\r
+\r
+/**\r
+  \brief   Get Process Stack Pointer Limit\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence zero is returned always in non-secure\r
+  mode.\r
+  \r
+  \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).\r
+  \return               PSPLIM Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \\r
+    (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))\r
+    // without main extensions, the non-secure PSPLIM is RAZ/WI\r
+  return 0U;\r
+#else\r
+  uint32_t result;\r
+  __ASM volatile ("MRS %0, psplim"  : "=r" (result) );\r
+  return result;\r
+#endif\r
+}\r
+\r
+#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))\r
+/**\r
+  \brief   Get Process Stack Pointer Limit (non-secure)\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence zero is returned always.\r
+\r
+  \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.\r
+  \return               PSPLIM Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))\r
+  // without main extensions, the non-secure PSPLIM is RAZ/WI\r
+  return 0U;\r
+#else\r
+  uint32_t result;\r
+  __ASM volatile ("MRS %0, psplim_ns"  : "=r" (result) );\r
+  return result;\r
+#endif\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Process Stack Pointer Limit\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence the write is silently ignored in non-secure\r
+  mode.\r
+  \r
+  \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).\r
+  \param [in]    ProcStackPtrLimit  Process Stack Pointer Limit value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \\r
+    (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))\r
+  // without main extensions, the non-secure PSPLIM is RAZ/WI\r
+  (void)ProcStackPtrLimit;\r
+#else\r
+  __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit));\r
+#endif\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE  ) && (__ARM_FEATURE_CMSE   == 3))\r
+/**\r
+  \brief   Set Process Stack Pointer (non-secure)\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence the write is silently ignored.\r
+\r
+  \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.\r
+  \param [in]    ProcStackPtrLimit  Process Stack Pointer Limit value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))\r
+  // without main extensions, the non-secure PSPLIM is RAZ/WI\r
+  (void)ProcStackPtrLimit;\r
+#else\r
+  __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit));\r
+#endif\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Get Main Stack Pointer Limit\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence zero is returned always in non-secure\r
+  mode.\r
+\r
+  \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).\r
+  \return               MSPLIM Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \\r
+    (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))\r
+  // without main extensions, the non-secure MSPLIM is RAZ/WI\r
+  return 0U;\r
+#else\r
+  uint32_t result;\r
+  __ASM volatile ("MRS %0, msplim" : "=r" (result) );\r
+  return result;\r
+#endif\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE  ) && (__ARM_FEATURE_CMSE   == 3))\r
+/**\r
+  \brief   Get Main Stack Pointer Limit (non-secure)\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence zero is returned always.\r
+\r
+  \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.\r
+  \return               MSPLIM Register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))\r
+  // without main extensions, the non-secure MSPLIM is RAZ/WI\r
+  return 0U;\r
+#else\r
+  uint32_t result;\r
+  __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) );\r
+  return result;\r
+#endif\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+  \brief   Set Main Stack Pointer Limit\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence the write is silently ignored in non-secure\r
+  mode.\r
+\r
+  \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).\r
+  \param [in]    MainStackPtrLimit  Main Stack Pointer Limit value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \\r
+    (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))\r
+  // without main extensions, the non-secure MSPLIM is RAZ/WI\r
+  (void)MainStackPtrLimit;\r
+#else\r
+  __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit));\r
+#endif\r
+}\r
+\r
+\r
+#if (defined (__ARM_FEATURE_CMSE  ) && (__ARM_FEATURE_CMSE   == 3))\r
+/**\r
+  \brief   Set Main Stack Pointer Limit (non-secure)\r
+  Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure\r
+  Stack Pointer Limit register hence the write is silently ignored.\r
+\r
+  \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.\r
+  \param [in]    MainStackPtrLimit  Main Stack Pointer value to set\r
+ */\r
+__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)\r
+{\r
+#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)))\r
+  // without main extensions, the non-secure MSPLIM is RAZ/WI\r
+  (void)MainStackPtrLimit;\r
+#else\r
+  __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit));\r
+#endif\r
+}\r
+#endif\r
+\r
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+           (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    ) */\r
+\r
+\r
+/**\r
+  \brief   Get FPSCR\r
+  \details Returns the current value of the Floating Point Status/Control register.\r
+  \return               Floating Point Status/Control register value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __get_FPSCR(void)\r
+{\r
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \\r
+     (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )\r
+#if __has_builtin(__builtin_arm_get_fpscr) \r
+// Re-enable using built-in when GCC has been fixed\r
+// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)\r
+  /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */\r
+  return __builtin_arm_get_fpscr();\r
+#else\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );\r
+  return(result);\r
+#endif\r
+#else\r
+  return(0U);\r
+#endif\r
+}\r
+\r
+\r
+/**\r
+  \brief   Set FPSCR\r
+  \details Assigns the given value to the Floating Point Status/Control register.\r
+  \param [in]    fpscr  Floating Point Status/Control value to set\r
+ */\r
+__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr)\r
+{\r
+#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \\r
+     (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )\r
+#if __has_builtin(__builtin_arm_set_fpscr)\r
+// Re-enable using built-in when GCC has been fixed\r
+// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2)\r
+  /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */\r
+  __builtin_arm_set_fpscr(fpscr);\r
+#else\r
+  __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");\r
+#endif\r
+#else\r
+  (void)fpscr;\r
+#endif\r
+}\r
+\r
+\r
+/*@} end of CMSIS_Core_RegAccFunctions */\r
+\r
+\r
+/* ##########################  Core Instruction Access  ######################### */\r
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface\r
+  Access to dedicated instructions\r
+  @{\r
+*/\r
+\r
+/* Define macros for porting to both thumb1 and thumb2.\r
+ * For thumb1, use low register (r0-r7), specified by constraint "l"\r
+ * Otherwise, use general registers, specified by constraint "r" */\r
+#if defined (__thumb__) && !defined (__thumb2__)\r
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)\r
+#define __CMSIS_GCC_RW_REG(r) "+l" (r)\r
+#define __CMSIS_GCC_USE_REG(r) "l" (r)\r
+#else\r
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)\r
+#define __CMSIS_GCC_RW_REG(r) "+r" (r)\r
+#define __CMSIS_GCC_USE_REG(r) "r" (r)\r
+#endif\r
+\r
+/**\r
+  \brief   No Operation\r
+  \details No Operation does nothing. This instruction can be used for code alignment purposes.\r
+ */\r
+#define __NOP()                             __ASM volatile ("nop")\r
+\r
+/**\r
+  \brief   Wait For Interrupt\r
+  \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.\r
+ */\r
+#define __WFI()                             __ASM volatile ("wfi")\r
+\r
+\r
+/**\r
+  \brief   Wait For Event\r
+  \details Wait For Event is a hint instruction that permits the processor to enter\r
+           a low-power state until one of a number of events occurs.\r
+ */\r
+#define __WFE()                             __ASM volatile ("wfe")\r
+\r
+\r
+/**\r
+  \brief   Send Event\r
+  \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.\r
+ */\r
+#define __SEV()                             __ASM volatile ("sev")\r
+\r
+\r
+/**\r
+  \brief   Instruction Synchronization Barrier\r
+  \details Instruction Synchronization Barrier flushes the pipeline in the processor,\r
+           so that all instructions following the ISB are fetched from cache or memory,\r
+           after the instruction has been completed.\r
+ */\r
+__STATIC_FORCEINLINE void __ISB(void)\r
+{\r
+  __ASM volatile ("isb 0xF":::"memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Data Synchronization Barrier\r
+  \details Acts as a special kind of Data Memory Barrier.\r
+           It completes when all explicit memory accesses before this instruction complete.\r
+ */\r
+__STATIC_FORCEINLINE void __DSB(void)\r
+{\r
+  __ASM volatile ("dsb 0xF":::"memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Data Memory Barrier\r
+  \details Ensures the apparent order of the explicit memory operations before\r
+           and after the instruction, without ensuring their completion.\r
+ */\r
+__STATIC_FORCEINLINE void __DMB(void)\r
+{\r
+  __ASM volatile ("dmb 0xF":::"memory");\r
+}\r
+\r
+\r
+/**\r
+  \brief   Reverse byte order (32 bit)\r
+  \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.\r
+  \param [in]    value  Value to reverse\r
+  \return               Reversed value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __REV(uint32_t value)\r
+{\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)\r
+  return __builtin_bswap32(value);\r
+#else\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );\r
+  return result;\r
+#endif\r
+}\r
+\r
+\r
+/**\r
+  \brief   Reverse byte order (16 bit)\r
+  \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.\r
+  \param [in]    value  Value to reverse\r
+  \return               Reversed value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );\r
+  return result;\r
+}\r
+\r
+\r
+/**\r
+  \brief   Reverse byte order (16 bit)\r
+  \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.\r
+  \param [in]    value  Value to reverse\r
+  \return               Reversed value\r
+ */\r
+__STATIC_FORCEINLINE int16_t __REVSH(int16_t value)\r
+{\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)\r
+  return (int16_t)__builtin_bswap16(value);\r
+#else\r
+  int16_t result;\r
+\r
+  __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );\r
+  return result;\r
+#endif\r
+}\r
+\r
+\r
+/**\r
+  \brief   Rotate Right in unsigned value (32 bit)\r
+  \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.\r
+  \param [in]    op1  Value to rotate\r
+  \param [in]    op2  Number of Bits to rotate\r
+  \return               Rotated value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)\r
+{\r
+  op2 %= 32U;\r
+  if (op2 == 0U)\r
+  {\r
+    return op1;\r
+  }\r
+  return (op1 >> op2) | (op1 << (32U - op2));\r
+}\r
+\r
+\r
+/**\r
+  \brief   Breakpoint\r
+  \details Causes the processor to enter Debug state.\r
+           Debug tools can use this to investigate system state when the instruction at a particular address is reached.\r
+  \param [in]    value  is ignored by the processor.\r
+                 If required, a debugger can use it to store additional information about the breakpoint.\r
+ */\r
+#define __BKPT(value)                       __ASM volatile ("bkpt "#value)\r
+\r
+\r
+/**\r
+  \brief   Reverse bit order of value\r
+  \details Reverses the bit order of the given value.\r
+  \param [in]    value  Value to reverse\r
+  \return               Reversed value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value)\r
+{\r
+  uint32_t result;\r
+\r
+#if ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+     (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+     (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    )\r
+   __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );\r
+#else\r
+  uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */\r
+\r
+  result = value;                      /* r will be reversed bits of v; first get LSB of v */\r
+  for (value >>= 1U; value != 0U; value >>= 1U)\r
+  {\r
+    result <<= 1U;\r
+    result |= value & 1U;\r
+    s--;\r
+  }\r
+  result <<= s;                        /* shift when v's highest bits are zero */\r
+#endif\r
+  return result;\r
+}\r
+\r
+\r
+/**\r
+  \brief   Count leading zeros\r
+  \details Counts the number of leading zeros of a data value.\r
+  \param [in]  value  Value to count the leading zeros\r
+  \return             number of leading zeros in value\r
+ */\r
+#define __CLZ             (uint8_t)__builtin_clz\r
+\r
+\r
+#if ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+     (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+     (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+     (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    )\r
+/**\r
+  \brief   LDR Exclusive (8 bit)\r
+  \details Executes a exclusive LDR instruction for 8 bit value.\r
+  \param [in]    ptr  Pointer to data\r
+  \return             value of type uint8_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr)\r
+{\r
+    uint32_t result;\r
+\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)\r
+   __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );\r
+#else\r
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not\r
+       accepted by assembler. So has to use following less efficient pattern.\r
+    */\r
+   __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );\r
+#endif\r
+   return ((uint8_t) result);    /* Add explicit type cast here */\r
+}\r
+\r
+\r
+/**\r
+  \brief   LDR Exclusive (16 bit)\r
+  \details Executes a exclusive LDR instruction for 16 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint16_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr)\r
+{\r
+    uint32_t result;\r
+\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)\r
+   __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );\r
+#else\r
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not\r
+       accepted by assembler. So has to use following less efficient pattern.\r
+    */\r
+   __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );\r
+#endif\r
+   return ((uint16_t) result);    /* Add explicit type cast here */\r
+}\r
+\r
+\r
+/**\r
+  \brief   LDR Exclusive (32 bit)\r
+  \details Executes a exclusive LDR instruction for 32 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint32_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   STR Exclusive (8 bit)\r
+  \details Executes a exclusive STR instruction for 8 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   STR Exclusive (16 bit)\r
+  \details Executes a exclusive STR instruction for 16 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   STR Exclusive (32 bit)\r
+  \details Executes a exclusive STR instruction for 32 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Remove the exclusive lock\r
+  \details Removes the exclusive lock which is created by LDREX.\r
+ */\r
+__STATIC_FORCEINLINE void __CLREX(void)\r
+{\r
+  __ASM volatile ("clrex" ::: "memory");\r
+}\r
+\r
+#endif /* ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+           (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+           (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+           (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    ) */\r
+\r
+\r
+#if ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+     (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+     (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    )\r
+/**\r
+  \brief   Signed Saturate\r
+  \details Saturates a signed value.\r
+  \param [in]  ARG1  Value to be saturated\r
+  \param [in]  ARG2  Bit position to saturate to (1..32)\r
+  \return             Saturated value\r
+ */\r
+#define __SSAT(ARG1,ARG2) \\r
+__extension__ \\r
+({                          \\r
+  int32_t __RES, __ARG1 = (ARG1); \\r
+  __ASM ("ssat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \\r
+  __RES; \\r
+ })\r
+\r
+\r
+/**\r
+  \brief   Unsigned Saturate\r
+  \details Saturates an unsigned value.\r
+  \param [in]  ARG1  Value to be saturated\r
+  \param [in]  ARG2  Bit position to saturate to (0..31)\r
+  \return             Saturated value\r
+ */\r
+#define __USAT(ARG1,ARG2) \\r
+ __extension__ \\r
+({                          \\r
+  uint32_t __RES, __ARG1 = (ARG1); \\r
+  __ASM ("usat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \\r
+  __RES; \\r
+ })\r
+\r
+\r
+/**\r
+  \brief   Rotate Right with Extend (32 bit)\r
+  \details Moves each bit of a bitstring right by one bit.\r
+           The carry input is shifted in at the left end of the bitstring.\r
+  \param [in]    value  Value to rotate\r
+  \return               Rotated value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );\r
+  return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   LDRT Unprivileged (8 bit)\r
+  \details Executes a Unprivileged LDRT instruction for 8 bit value.\r
+  \param [in]    ptr  Pointer to data\r
+  \return             value of type uint8_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)\r
+   __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+#else\r
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not\r
+       accepted by assembler. So has to use following less efficient pattern.\r
+    */\r
+   __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );\r
+#endif\r
+   return ((uint8_t) result);    /* Add explicit type cast here */\r
+}\r
+\r
+\r
+/**\r
+  \brief   LDRT Unprivileged (16 bit)\r
+  \details Executes a Unprivileged LDRT instruction for 16 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint16_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)\r
+   __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+#else\r
+    /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not\r
+       accepted by assembler. So has to use following less efficient pattern.\r
+    */\r
+   __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" );\r
+#endif\r
+   return ((uint16_t) result);    /* Add explicit type cast here */\r
+}\r
+\r
+\r
+/**\r
+  \brief   LDRT Unprivileged (32 bit)\r
+  \details Executes a Unprivileged LDRT instruction for 32 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint32_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   STRT Unprivileged (8 bit)\r
+  \details Executes a Unprivileged STRT instruction for 8 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)\r
+{\r
+   __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+}\r
+\r
+\r
+/**\r
+  \brief   STRT Unprivileged (16 bit)\r
+  \details Executes a Unprivileged STRT instruction for 16 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)\r
+{\r
+   __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+}\r
+\r
+\r
+/**\r
+  \brief   STRT Unprivileged (32 bit)\r
+  \details Executes a Unprivileged STRT instruction for 32 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)\r
+{\r
+   __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) );\r
+}\r
+\r
+#else  /* ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+           (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+           (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    ) */\r
+\r
+/**\r
+  \brief   Signed Saturate\r
+  \details Saturates a signed value.\r
+  \param [in]  value  Value to be saturated\r
+  \param [in]    sat  Bit position to saturate to (1..32)\r
+  \return             Saturated value\r
+ */\r
+__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)\r
+{\r
+  if ((sat >= 1U) && (sat <= 32U))\r
+  {\r
+    const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);\r
+    const int32_t min = -1 - max ;\r
+    if (val > max)\r
+    {\r
+      return max;\r
+    }\r
+    else if (val < min)\r
+    {\r
+      return min;\r
+    }\r
+  }\r
+  return val;\r
+}\r
+\r
+/**\r
+  \brief   Unsigned Saturate\r
+  \details Saturates an unsigned value.\r
+  \param [in]  value  Value to be saturated\r
+  \param [in]    sat  Bit position to saturate to (0..31)\r
+  \return             Saturated value\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)\r
+{\r
+  if (sat <= 31U)\r
+  {\r
+    const uint32_t max = ((1U << sat) - 1U);\r
+    if (val > (int32_t)max)\r
+    {\r
+      return max;\r
+    }\r
+    else if (val < 0)\r
+    {\r
+      return 0U;\r
+    }\r
+  }\r
+  return (uint32_t)val;\r
+}\r
+\r
+#endif /* ((defined (__ARM_ARCH_7M__      ) && (__ARM_ARCH_7M__      == 1)) || \\r
+           (defined (__ARM_ARCH_7EM__     ) && (__ARM_ARCH_7EM__     == 1)) || \\r
+           (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))    ) */\r
+\r
+\r
+#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+     (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    )\r
+/**\r
+  \brief   Load-Acquire (8 bit)\r
+  \details Executes a LDAB instruction for 8 bit value.\r
+  \param [in]    ptr  Pointer to data\r
+  \return             value of type uint8_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return ((uint8_t) result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Load-Acquire (16 bit)\r
+  \details Executes a LDAH instruction for 16 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint16_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return ((uint16_t) result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Load-Acquire (32 bit)\r
+  \details Executes a LDA instruction for 32 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint32_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release (8 bit)\r
+  \details Executes a STLB instruction for 8 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)\r
+{\r
+   __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release (16 bit)\r
+  \details Executes a STLH instruction for 16 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)\r
+{\r
+   __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release (32 bit)\r
+  \details Executes a STL instruction for 32 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+ */\r
+__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)\r
+{\r
+   __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+}\r
+\r
+\r
+/**\r
+  \brief   Load-Acquire Exclusive (8 bit)\r
+  \details Executes a LDAB exclusive instruction for 8 bit value.\r
+  \param [in]    ptr  Pointer to data\r
+  \return             value of type uint8_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return ((uint8_t) result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Load-Acquire Exclusive (16 bit)\r
+  \details Executes a LDAH exclusive instruction for 16 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint16_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return ((uint16_t) result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Load-Acquire Exclusive (32 bit)\r
+  \details Executes a LDA exclusive instruction for 32 bit values.\r
+  \param [in]    ptr  Pointer to data\r
+  \return        value of type uint32_t at (*ptr)\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr)\r
+{\r
+    uint32_t result;\r
+\r
+   __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release Exclusive (8 bit)\r
+  \details Executes a STLB exclusive instruction for 8 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release Exclusive (16 bit)\r
+  \details Executes a STLH exclusive instruction for 16 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+   return(result);\r
+}\r
+\r
+\r
+/**\r
+  \brief   Store-Release Exclusive (32 bit)\r
+  \details Executes a STL exclusive instruction for 32 bit values.\r
+  \param [in]  value  Value to store\r
+  \param [in]    ptr  Pointer to location\r
+  \return          0  Function succeeded\r
+  \return          1  Function failed\r
+ */\r
+__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)\r
+{\r
+   uint32_t result;\r
+\r
+   __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) );\r
+   return(result);\r
+}\r
+\r
+#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \\r
+           (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1))    ) */\r
+\r
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */\r
+\r
+\r
+/* ###################  Compiler specific Intrinsics  ########################### */\r
+/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics\r
+  Access to dedicated SIMD instructions\r
+  @{\r
+*/\r
+\r
+#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))\r
+\r
+__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+\r
+__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+\r
+__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );\r
+  return(result);\r
+}\r
+\r
+#define __SSAT16(ARG1,ARG2) \\r
+({                          \\r
+  int32_t __RES, __ARG1 = (ARG1); \\r
+  __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \\r
+  __RES; \\r
+ })\r
+\r
+#define __USAT16(ARG1,ARG2) \\r
+({                          \\r
+  uint32_t __RES, __ARG1 = (ARG1); \\r
+  __ASM ("usat16 %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) ); \\r
+  __RES; \\r
+ })\r
+\r
+__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1));\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1));\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMUAD  (uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc)\r
+{\r
+  union llreg_u{\r
+    uint32_t w32[2];\r
+    uint64_t w64;\r
+  } llr;\r
+  llr.w64 = acc;\r
+\r
+#ifndef __ARMEB__   /* Little endian */\r
+  __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
+#else               /* Big endian */\r
+  __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
+#endif\r
+\r
+  return(llr.w64);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc)\r
+{\r
+  union llreg_u{\r
+    uint32_t w32[2];\r
+    uint64_t w64;\r
+  } llr;\r
+  llr.w64 = acc;\r
+\r
+#ifndef __ARMEB__   /* Little endian */\r
+  __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
+#else               /* Big endian */\r
+  __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
+#endif\r
+\r
+  return(llr.w64);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMUSD  (uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc)\r
+{\r
+  union llreg_u{\r
+    uint32_t w32[2];\r
+    uint64_t w64;\r
+  } llr;\r
+  llr.w64 = acc;\r
+\r
+#ifndef __ARMEB__   /* Little endian */\r
+  __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
+#else               /* Big endian */\r
+  __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
+#endif\r
+\r
+  return(llr.w64);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc)\r
+{\r
+  union llreg_u{\r
+    uint32_t w32[2];\r
+    uint64_t w64;\r
+  } llr;\r
+  llr.w64 = acc;\r
+\r
+#ifndef __ARMEB__   /* Little endian */\r
+  __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
+#else               /* Big endian */\r
+  __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
+#endif\r
+\r
+  return(llr.w64);\r
+}\r
+\r
+__STATIC_FORCEINLINE uint32_t __SEL  (uint32_t op1, uint32_t op2)\r
+{\r
+  uint32_t result;\r
+\r
+  __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE  int32_t __QADD( int32_t op1,  int32_t op2)\r
+{\r
+  int32_t result;\r
+\r
+  __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+__STATIC_FORCEINLINE  int32_t __QSUB( int32_t op1,  int32_t op2)\r
+{\r
+  int32_t result;\r
+\r
+  __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );\r
+  return(result);\r
+}\r
+\r
+#if 0\r
+#define __PKHBT(ARG1,ARG2,ARG3) \\r
+({                          \\r
+  uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \\r
+  __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2), "I" (ARG3)  ); \\r
+  __RES; \\r
+ })\r
+\r
+#define __PKHTB(ARG1,ARG2,ARG3) \\r
+({                          \\r
+  uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \\r
+  if (ARG3 == 0) \\r
+    __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2)  ); \\r
+  else \\r
+    __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) :  "r" (__ARG1), "r" (__ARG2), "I" (ARG3)  ); \\r
+  __RES; \\r
+ })\r
+#endif\r
+\r
+#define __PKHBT(ARG1,ARG2,ARG3)          ( ((((uint32_t)(ARG1))          ) & 0x0000FFFFUL) |  \\r
+                                           ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL)  )\r
+\r
+#define __PKHTB(ARG1,ARG2,ARG3)          ( ((((uint32_t)(ARG1))          ) & 0xFFFF0000UL) |  \\r
+                                           ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL)  )\r
+\r
+__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3)\r
+{\r
+ int32_t result;\r
+\r
+ __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r"  (op1), "r" (op2), "r" (op3) );\r
+ return(result);\r
+}\r
+\r
+#endif /* (__ARM_FEATURE_DSP == 1) */\r
+/*@} end of group CMSIS_SIMD_intrinsics */\r
+\r
+\r
+#pragma GCC diagnostic pop\r
+\r
+#endif /* __CMSIS_GCC_H */\r