The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Jul 06 15:30:22 2017 +0100
Revision:
146:22da6e220af6
Child:
160:5571c4ff569f
Release 146 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 146:22da6e220af6 1 /**************************************************************************//**
AnnaBridge 146:22da6e220af6 2 * @file cmsis_armcc.h
AnnaBridge 146:22da6e220af6 3 * @brief CMSIS compiler ARMCC (ARM compiler V5) header file
AnnaBridge 146:22da6e220af6 4 * @version V5.0.2
AnnaBridge 146:22da6e220af6 5 * @date 13. February 2017
AnnaBridge 146:22da6e220af6 6 ******************************************************************************/
AnnaBridge 146:22da6e220af6 7 /*
AnnaBridge 146:22da6e220af6 8 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
AnnaBridge 146:22da6e220af6 9 *
AnnaBridge 146:22da6e220af6 10 * SPDX-License-Identifier: Apache-2.0
AnnaBridge 146:22da6e220af6 11 *
AnnaBridge 146:22da6e220af6 12 * Licensed under the Apache License, Version 2.0 (the License); you may
AnnaBridge 146:22da6e220af6 13 * not use this file except in compliance with the License.
AnnaBridge 146:22da6e220af6 14 * You may obtain a copy of the License at
AnnaBridge 146:22da6e220af6 15 *
AnnaBridge 146:22da6e220af6 16 * www.apache.org/licenses/LICENSE-2.0
AnnaBridge 146:22da6e220af6 17 *
AnnaBridge 146:22da6e220af6 18 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 146:22da6e220af6 19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
AnnaBridge 146:22da6e220af6 20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 146:22da6e220af6 21 * See the License for the specific language governing permissions and
AnnaBridge 146:22da6e220af6 22 * limitations under the License.
AnnaBridge 146:22da6e220af6 23 */
AnnaBridge 146:22da6e220af6 24
AnnaBridge 146:22da6e220af6 25 #ifndef __CMSIS_ARMCC_H
AnnaBridge 146:22da6e220af6 26 #define __CMSIS_ARMCC_H
AnnaBridge 146:22da6e220af6 27
AnnaBridge 146:22da6e220af6 28
AnnaBridge 146:22da6e220af6 29 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
AnnaBridge 146:22da6e220af6 30 #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
AnnaBridge 146:22da6e220af6 31 #endif
AnnaBridge 146:22da6e220af6 32
AnnaBridge 146:22da6e220af6 33 /* CMSIS compiler control architecture macros */
AnnaBridge 146:22da6e220af6 34 #if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \
AnnaBridge 146:22da6e220af6 35 (defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) )
AnnaBridge 146:22da6e220af6 36 #define __ARM_ARCH_6M__ 1
AnnaBridge 146:22da6e220af6 37 #endif
AnnaBridge 146:22da6e220af6 38
AnnaBridge 146:22da6e220af6 39 #if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1))
AnnaBridge 146:22da6e220af6 40 #define __ARM_ARCH_7M__ 1
AnnaBridge 146:22da6e220af6 41 #endif
AnnaBridge 146:22da6e220af6 42
AnnaBridge 146:22da6e220af6 43 #if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
AnnaBridge 146:22da6e220af6 44 #define __ARM_ARCH_7EM__ 1
AnnaBridge 146:22da6e220af6 45 #endif
AnnaBridge 146:22da6e220af6 46
AnnaBridge 146:22da6e220af6 47 /* __ARM_ARCH_8M_BASE__ not applicable */
AnnaBridge 146:22da6e220af6 48 /* __ARM_ARCH_8M_MAIN__ not applicable */
AnnaBridge 146:22da6e220af6 49
AnnaBridge 146:22da6e220af6 50
AnnaBridge 146:22da6e220af6 51 /* CMSIS compiler specific defines */
AnnaBridge 146:22da6e220af6 52 #ifndef __ASM
AnnaBridge 146:22da6e220af6 53 #define __ASM __asm
AnnaBridge 146:22da6e220af6 54 #endif
AnnaBridge 146:22da6e220af6 55 #ifndef __INLINE
AnnaBridge 146:22da6e220af6 56 #define __INLINE __inline
AnnaBridge 146:22da6e220af6 57 #endif
AnnaBridge 146:22da6e220af6 58 #ifndef __STATIC_INLINE
AnnaBridge 146:22da6e220af6 59 #define __STATIC_INLINE static __inline
AnnaBridge 146:22da6e220af6 60 #endif
AnnaBridge 146:22da6e220af6 61 #ifndef __NO_RETURN
AnnaBridge 146:22da6e220af6 62 #define __NO_RETURN __declspec(noreturn)
AnnaBridge 146:22da6e220af6 63 #endif
AnnaBridge 146:22da6e220af6 64 #ifndef __USED
AnnaBridge 146:22da6e220af6 65 #define __USED __attribute__((used))
AnnaBridge 146:22da6e220af6 66 #endif
AnnaBridge 146:22da6e220af6 67 #ifndef __WEAK
AnnaBridge 146:22da6e220af6 68 #define __WEAK __attribute__((weak))
AnnaBridge 146:22da6e220af6 69 #endif
AnnaBridge 146:22da6e220af6 70 #ifndef __PACKED
AnnaBridge 146:22da6e220af6 71 #define __PACKED __attribute__((packed))
AnnaBridge 146:22da6e220af6 72 #endif
AnnaBridge 146:22da6e220af6 73 #ifndef __PACKED_STRUCT
AnnaBridge 146:22da6e220af6 74 #define __PACKED_STRUCT __packed struct
AnnaBridge 146:22da6e220af6 75 #endif
AnnaBridge 146:22da6e220af6 76 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 146:22da6e220af6 77 #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
AnnaBridge 146:22da6e220af6 78 #endif
AnnaBridge 146:22da6e220af6 79 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 146:22da6e220af6 80 #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
AnnaBridge 146:22da6e220af6 81 #endif
AnnaBridge 146:22da6e220af6 82 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 146:22da6e220af6 83 #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
AnnaBridge 146:22da6e220af6 84 #endif
AnnaBridge 146:22da6e220af6 85 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 146:22da6e220af6 86 #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
AnnaBridge 146:22da6e220af6 87 #endif
AnnaBridge 146:22da6e220af6 88 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 146:22da6e220af6 89 #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
AnnaBridge 146:22da6e220af6 90 #endif
AnnaBridge 146:22da6e220af6 91 #ifndef __ALIGNED
AnnaBridge 146:22da6e220af6 92 #define __ALIGNED(x) __attribute__((aligned(x)))
AnnaBridge 146:22da6e220af6 93 #endif
AnnaBridge 146:22da6e220af6 94
AnnaBridge 146:22da6e220af6 95
AnnaBridge 146:22da6e220af6 96 /* ########################### Core Function Access ########################### */
AnnaBridge 146:22da6e220af6 97 /** \ingroup CMSIS_Core_FunctionInterface
AnnaBridge 146:22da6e220af6 98 \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
AnnaBridge 146:22da6e220af6 99 @{
AnnaBridge 146:22da6e220af6 100 */
AnnaBridge 146:22da6e220af6 101
AnnaBridge 146:22da6e220af6 102 /**
AnnaBridge 146:22da6e220af6 103 \brief Enable IRQ Interrupts
AnnaBridge 146:22da6e220af6 104 \details Enables IRQ interrupts by clearing the I-bit in the CPSR.
AnnaBridge 146:22da6e220af6 105 Can only be executed in Privileged modes.
AnnaBridge 146:22da6e220af6 106 */
AnnaBridge 146:22da6e220af6 107 /* intrinsic void __enable_irq(); */
AnnaBridge 146:22da6e220af6 108
AnnaBridge 146:22da6e220af6 109
AnnaBridge 146:22da6e220af6 110 /**
AnnaBridge 146:22da6e220af6 111 \brief Disable IRQ Interrupts
AnnaBridge 146:22da6e220af6 112 \details Disables IRQ interrupts by setting the I-bit in the CPSR.
AnnaBridge 146:22da6e220af6 113 Can only be executed in Privileged modes.
AnnaBridge 146:22da6e220af6 114 */
AnnaBridge 146:22da6e220af6 115 /* intrinsic void __disable_irq(); */
AnnaBridge 146:22da6e220af6 116
AnnaBridge 146:22da6e220af6 117 /**
AnnaBridge 146:22da6e220af6 118 \brief Get Control Register
AnnaBridge 146:22da6e220af6 119 \details Returns the content of the Control Register.
AnnaBridge 146:22da6e220af6 120 \return Control Register value
AnnaBridge 146:22da6e220af6 121 */
AnnaBridge 146:22da6e220af6 122 __STATIC_INLINE uint32_t __get_CONTROL(void)
AnnaBridge 146:22da6e220af6 123 {
AnnaBridge 146:22da6e220af6 124 register uint32_t __regControl __ASM("control");
AnnaBridge 146:22da6e220af6 125 return(__regControl);
AnnaBridge 146:22da6e220af6 126 }
AnnaBridge 146:22da6e220af6 127
AnnaBridge 146:22da6e220af6 128
AnnaBridge 146:22da6e220af6 129 /**
AnnaBridge 146:22da6e220af6 130 \brief Set Control Register
AnnaBridge 146:22da6e220af6 131 \details Writes the given value to the Control Register.
AnnaBridge 146:22da6e220af6 132 \param [in] control Control Register value to set
AnnaBridge 146:22da6e220af6 133 */
AnnaBridge 146:22da6e220af6 134 __STATIC_INLINE void __set_CONTROL(uint32_t control)
AnnaBridge 146:22da6e220af6 135 {
AnnaBridge 146:22da6e220af6 136 register uint32_t __regControl __ASM("control");
AnnaBridge 146:22da6e220af6 137 __regControl = control;
AnnaBridge 146:22da6e220af6 138 }
AnnaBridge 146:22da6e220af6 139
AnnaBridge 146:22da6e220af6 140
AnnaBridge 146:22da6e220af6 141 /**
AnnaBridge 146:22da6e220af6 142 \brief Get IPSR Register
AnnaBridge 146:22da6e220af6 143 \details Returns the content of the IPSR Register.
AnnaBridge 146:22da6e220af6 144 \return IPSR Register value
AnnaBridge 146:22da6e220af6 145 */
AnnaBridge 146:22da6e220af6 146 __STATIC_INLINE uint32_t __get_IPSR(void)
AnnaBridge 146:22da6e220af6 147 {
AnnaBridge 146:22da6e220af6 148 register uint32_t __regIPSR __ASM("ipsr");
AnnaBridge 146:22da6e220af6 149 return(__regIPSR);
AnnaBridge 146:22da6e220af6 150 }
AnnaBridge 146:22da6e220af6 151
AnnaBridge 146:22da6e220af6 152
AnnaBridge 146:22da6e220af6 153 /**
AnnaBridge 146:22da6e220af6 154 \brief Get APSR Register
AnnaBridge 146:22da6e220af6 155 \details Returns the content of the APSR Register.
AnnaBridge 146:22da6e220af6 156 \return APSR Register value
AnnaBridge 146:22da6e220af6 157 */
AnnaBridge 146:22da6e220af6 158 __STATIC_INLINE uint32_t __get_APSR(void)
AnnaBridge 146:22da6e220af6 159 {
AnnaBridge 146:22da6e220af6 160 register uint32_t __regAPSR __ASM("apsr");
AnnaBridge 146:22da6e220af6 161 return(__regAPSR);
AnnaBridge 146:22da6e220af6 162 }
AnnaBridge 146:22da6e220af6 163
AnnaBridge 146:22da6e220af6 164
AnnaBridge 146:22da6e220af6 165 /**
AnnaBridge 146:22da6e220af6 166 \brief Get xPSR Register
AnnaBridge 146:22da6e220af6 167 \details Returns the content of the xPSR Register.
AnnaBridge 146:22da6e220af6 168 \return xPSR Register value
AnnaBridge 146:22da6e220af6 169 */
AnnaBridge 146:22da6e220af6 170 __STATIC_INLINE uint32_t __get_xPSR(void)
AnnaBridge 146:22da6e220af6 171 {
AnnaBridge 146:22da6e220af6 172 register uint32_t __regXPSR __ASM("xpsr");
AnnaBridge 146:22da6e220af6 173 return(__regXPSR);
AnnaBridge 146:22da6e220af6 174 }
AnnaBridge 146:22da6e220af6 175
AnnaBridge 146:22da6e220af6 176
AnnaBridge 146:22da6e220af6 177 /**
AnnaBridge 146:22da6e220af6 178 \brief Get Process Stack Pointer
AnnaBridge 146:22da6e220af6 179 \details Returns the current value of the Process Stack Pointer (PSP).
AnnaBridge 146:22da6e220af6 180 \return PSP Register value
AnnaBridge 146:22da6e220af6 181 */
AnnaBridge 146:22da6e220af6 182 __STATIC_INLINE uint32_t __get_PSP(void)
AnnaBridge 146:22da6e220af6 183 {
AnnaBridge 146:22da6e220af6 184 register uint32_t __regProcessStackPointer __ASM("psp");
AnnaBridge 146:22da6e220af6 185 return(__regProcessStackPointer);
AnnaBridge 146:22da6e220af6 186 }
AnnaBridge 146:22da6e220af6 187
AnnaBridge 146:22da6e220af6 188
AnnaBridge 146:22da6e220af6 189 /**
AnnaBridge 146:22da6e220af6 190 \brief Set Process Stack Pointer
AnnaBridge 146:22da6e220af6 191 \details Assigns the given value to the Process Stack Pointer (PSP).
AnnaBridge 146:22da6e220af6 192 \param [in] topOfProcStack Process Stack Pointer value to set
AnnaBridge 146:22da6e220af6 193 */
AnnaBridge 146:22da6e220af6 194 __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
AnnaBridge 146:22da6e220af6 195 {
AnnaBridge 146:22da6e220af6 196 register uint32_t __regProcessStackPointer __ASM("psp");
AnnaBridge 146:22da6e220af6 197 __regProcessStackPointer = topOfProcStack;
AnnaBridge 146:22da6e220af6 198 }
AnnaBridge 146:22da6e220af6 199
AnnaBridge 146:22da6e220af6 200
AnnaBridge 146:22da6e220af6 201 /**
AnnaBridge 146:22da6e220af6 202 \brief Get Main Stack Pointer
AnnaBridge 146:22da6e220af6 203 \details Returns the current value of the Main Stack Pointer (MSP).
AnnaBridge 146:22da6e220af6 204 \return MSP Register value
AnnaBridge 146:22da6e220af6 205 */
AnnaBridge 146:22da6e220af6 206 __STATIC_INLINE uint32_t __get_MSP(void)
AnnaBridge 146:22da6e220af6 207 {
AnnaBridge 146:22da6e220af6 208 register uint32_t __regMainStackPointer __ASM("msp");
AnnaBridge 146:22da6e220af6 209 return(__regMainStackPointer);
AnnaBridge 146:22da6e220af6 210 }
AnnaBridge 146:22da6e220af6 211
AnnaBridge 146:22da6e220af6 212
AnnaBridge 146:22da6e220af6 213 /**
AnnaBridge 146:22da6e220af6 214 \brief Set Main Stack Pointer
AnnaBridge 146:22da6e220af6 215 \details Assigns the given value to the Main Stack Pointer (MSP).
AnnaBridge 146:22da6e220af6 216 \param [in] topOfMainStack Main Stack Pointer value to set
AnnaBridge 146:22da6e220af6 217 */
AnnaBridge 146:22da6e220af6 218 __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
AnnaBridge 146:22da6e220af6 219 {
AnnaBridge 146:22da6e220af6 220 register uint32_t __regMainStackPointer __ASM("msp");
AnnaBridge 146:22da6e220af6 221 __regMainStackPointer = topOfMainStack;
AnnaBridge 146:22da6e220af6 222 }
AnnaBridge 146:22da6e220af6 223
AnnaBridge 146:22da6e220af6 224
AnnaBridge 146:22da6e220af6 225 /**
AnnaBridge 146:22da6e220af6 226 \brief Get Priority Mask
AnnaBridge 146:22da6e220af6 227 \details Returns the current state of the priority mask bit from the Priority Mask Register.
AnnaBridge 146:22da6e220af6 228 \return Priority Mask value
AnnaBridge 146:22da6e220af6 229 */
AnnaBridge 146:22da6e220af6 230 __STATIC_INLINE uint32_t __get_PRIMASK(void)
AnnaBridge 146:22da6e220af6 231 {
AnnaBridge 146:22da6e220af6 232 register uint32_t __regPriMask __ASM("primask");
AnnaBridge 146:22da6e220af6 233 return(__regPriMask);
AnnaBridge 146:22da6e220af6 234 }
AnnaBridge 146:22da6e220af6 235
AnnaBridge 146:22da6e220af6 236
AnnaBridge 146:22da6e220af6 237 /**
AnnaBridge 146:22da6e220af6 238 \brief Set Priority Mask
AnnaBridge 146:22da6e220af6 239 \details Assigns the given value to the Priority Mask Register.
AnnaBridge 146:22da6e220af6 240 \param [in] priMask Priority Mask
AnnaBridge 146:22da6e220af6 241 */
AnnaBridge 146:22da6e220af6 242 __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
AnnaBridge 146:22da6e220af6 243 {
AnnaBridge 146:22da6e220af6 244 register uint32_t __regPriMask __ASM("primask");
AnnaBridge 146:22da6e220af6 245 __regPriMask = (priMask);
AnnaBridge 146:22da6e220af6 246 }
AnnaBridge 146:22da6e220af6 247
AnnaBridge 146:22da6e220af6 248
AnnaBridge 146:22da6e220af6 249 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
AnnaBridge 146:22da6e220af6 250 (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
AnnaBridge 146:22da6e220af6 251
AnnaBridge 146:22da6e220af6 252 /**
AnnaBridge 146:22da6e220af6 253 \brief Enable FIQ
AnnaBridge 146:22da6e220af6 254 \details Enables FIQ interrupts by clearing the F-bit in the CPSR.
AnnaBridge 146:22da6e220af6 255 Can only be executed in Privileged modes.
AnnaBridge 146:22da6e220af6 256 */
AnnaBridge 146:22da6e220af6 257 #define __enable_fault_irq __enable_fiq
AnnaBridge 146:22da6e220af6 258
AnnaBridge 146:22da6e220af6 259
AnnaBridge 146:22da6e220af6 260 /**
AnnaBridge 146:22da6e220af6 261 \brief Disable FIQ
AnnaBridge 146:22da6e220af6 262 \details Disables FIQ interrupts by setting the F-bit in the CPSR.
AnnaBridge 146:22da6e220af6 263 Can only be executed in Privileged modes.
AnnaBridge 146:22da6e220af6 264 */
AnnaBridge 146:22da6e220af6 265 #define __disable_fault_irq __disable_fiq
AnnaBridge 146:22da6e220af6 266
AnnaBridge 146:22da6e220af6 267
AnnaBridge 146:22da6e220af6 268 /**
AnnaBridge 146:22da6e220af6 269 \brief Get Base Priority
AnnaBridge 146:22da6e220af6 270 \details Returns the current value of the Base Priority register.
AnnaBridge 146:22da6e220af6 271 \return Base Priority register value
AnnaBridge 146:22da6e220af6 272 */
AnnaBridge 146:22da6e220af6 273 __STATIC_INLINE uint32_t __get_BASEPRI(void)
AnnaBridge 146:22da6e220af6 274 {
AnnaBridge 146:22da6e220af6 275 register uint32_t __regBasePri __ASM("basepri");
AnnaBridge 146:22da6e220af6 276 return(__regBasePri);
AnnaBridge 146:22da6e220af6 277 }
AnnaBridge 146:22da6e220af6 278
AnnaBridge 146:22da6e220af6 279
AnnaBridge 146:22da6e220af6 280 /**
AnnaBridge 146:22da6e220af6 281 \brief Set Base Priority
AnnaBridge 146:22da6e220af6 282 \details Assigns the given value to the Base Priority register.
AnnaBridge 146:22da6e220af6 283 \param [in] basePri Base Priority value to set
AnnaBridge 146:22da6e220af6 284 */
AnnaBridge 146:22da6e220af6 285 __STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
AnnaBridge 146:22da6e220af6 286 {
AnnaBridge 146:22da6e220af6 287 register uint32_t __regBasePri __ASM("basepri");
AnnaBridge 146:22da6e220af6 288 __regBasePri = (basePri & 0xFFU);
AnnaBridge 146:22da6e220af6 289 }
AnnaBridge 146:22da6e220af6 290
AnnaBridge 146:22da6e220af6 291
AnnaBridge 146:22da6e220af6 292 /**
AnnaBridge 146:22da6e220af6 293 \brief Set Base Priority with condition
AnnaBridge 146:22da6e220af6 294 \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
AnnaBridge 146:22da6e220af6 295 or the new value increases the BASEPRI priority level.
AnnaBridge 146:22da6e220af6 296 \param [in] basePri Base Priority value to set
AnnaBridge 146:22da6e220af6 297 */
AnnaBridge 146:22da6e220af6 298 __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
AnnaBridge 146:22da6e220af6 299 {
AnnaBridge 146:22da6e220af6 300 register uint32_t __regBasePriMax __ASM("basepri_max");
AnnaBridge 146:22da6e220af6 301 __regBasePriMax = (basePri & 0xFFU);
AnnaBridge 146:22da6e220af6 302 }
AnnaBridge 146:22da6e220af6 303
AnnaBridge 146:22da6e220af6 304
AnnaBridge 146:22da6e220af6 305 /**
AnnaBridge 146:22da6e220af6 306 \brief Get Fault Mask
AnnaBridge 146:22da6e220af6 307 \details Returns the current value of the Fault Mask register.
AnnaBridge 146:22da6e220af6 308 \return Fault Mask register value
AnnaBridge 146:22da6e220af6 309 */
AnnaBridge 146:22da6e220af6 310 __STATIC_INLINE uint32_t __get_FAULTMASK(void)
AnnaBridge 146:22da6e220af6 311 {
AnnaBridge 146:22da6e220af6 312 register uint32_t __regFaultMask __ASM("faultmask");
AnnaBridge 146:22da6e220af6 313 return(__regFaultMask);
AnnaBridge 146:22da6e220af6 314 }
AnnaBridge 146:22da6e220af6 315
AnnaBridge 146:22da6e220af6 316
AnnaBridge 146:22da6e220af6 317 /**
AnnaBridge 146:22da6e220af6 318 \brief Set Fault Mask
AnnaBridge 146:22da6e220af6 319 \details Assigns the given value to the Fault Mask register.
AnnaBridge 146:22da6e220af6 320 \param [in] faultMask Fault Mask value to set
AnnaBridge 146:22da6e220af6 321 */
AnnaBridge 146:22da6e220af6 322 __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
AnnaBridge 146:22da6e220af6 323 {
AnnaBridge 146:22da6e220af6 324 register uint32_t __regFaultMask __ASM("faultmask");
AnnaBridge 146:22da6e220af6 325 __regFaultMask = (faultMask & (uint32_t)1U);
AnnaBridge 146:22da6e220af6 326 }
AnnaBridge 146:22da6e220af6 327
AnnaBridge 146:22da6e220af6 328 #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
AnnaBridge 146:22da6e220af6 329 (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
AnnaBridge 146:22da6e220af6 330
AnnaBridge 146:22da6e220af6 331
AnnaBridge 146:22da6e220af6 332 #if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
AnnaBridge 146:22da6e220af6 333
AnnaBridge 146:22da6e220af6 334 /**
AnnaBridge 146:22da6e220af6 335 \brief Get FPSCR
AnnaBridge 146:22da6e220af6 336 \details Returns the current value of the Floating Point Status/Control register.
AnnaBridge 146:22da6e220af6 337 \return Floating Point Status/Control register value
AnnaBridge 146:22da6e220af6 338 */
AnnaBridge 146:22da6e220af6 339 __STATIC_INLINE uint32_t __get_FPSCR(void)
AnnaBridge 146:22da6e220af6 340 {
AnnaBridge 146:22da6e220af6 341 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
AnnaBridge 146:22da6e220af6 342 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
AnnaBridge 146:22da6e220af6 343 register uint32_t __regfpscr __ASM("fpscr");
AnnaBridge 146:22da6e220af6 344 return(__regfpscr);
AnnaBridge 146:22da6e220af6 345 #else
AnnaBridge 146:22da6e220af6 346 return(0U);
AnnaBridge 146:22da6e220af6 347 #endif
AnnaBridge 146:22da6e220af6 348 }
AnnaBridge 146:22da6e220af6 349
AnnaBridge 146:22da6e220af6 350
AnnaBridge 146:22da6e220af6 351 /**
AnnaBridge 146:22da6e220af6 352 \brief Set FPSCR
AnnaBridge 146:22da6e220af6 353 \details Assigns the given value to the Floating Point Status/Control register.
AnnaBridge 146:22da6e220af6 354 \param [in] fpscr Floating Point Status/Control value to set
AnnaBridge 146:22da6e220af6 355 */
AnnaBridge 146:22da6e220af6 356 __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
AnnaBridge 146:22da6e220af6 357 {
AnnaBridge 146:22da6e220af6 358 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
AnnaBridge 146:22da6e220af6 359 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
AnnaBridge 146:22da6e220af6 360 register uint32_t __regfpscr __ASM("fpscr");
AnnaBridge 146:22da6e220af6 361 __regfpscr = (fpscr);
AnnaBridge 146:22da6e220af6 362 #else
AnnaBridge 146:22da6e220af6 363 (void)fpscr;
AnnaBridge 146:22da6e220af6 364 #endif
AnnaBridge 146:22da6e220af6 365 }
AnnaBridge 146:22da6e220af6 366
AnnaBridge 146:22da6e220af6 367 #endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
AnnaBridge 146:22da6e220af6 368
AnnaBridge 146:22da6e220af6 369
AnnaBridge 146:22da6e220af6 370
AnnaBridge 146:22da6e220af6 371 /*@} end of CMSIS_Core_RegAccFunctions */
AnnaBridge 146:22da6e220af6 372
AnnaBridge 146:22da6e220af6 373
AnnaBridge 146:22da6e220af6 374 /* ########################## Core Instruction Access ######################### */
AnnaBridge 146:22da6e220af6 375 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
AnnaBridge 146:22da6e220af6 376 Access to dedicated instructions
AnnaBridge 146:22da6e220af6 377 @{
AnnaBridge 146:22da6e220af6 378 */
AnnaBridge 146:22da6e220af6 379
AnnaBridge 146:22da6e220af6 380 /**
AnnaBridge 146:22da6e220af6 381 \brief No Operation
AnnaBridge 146:22da6e220af6 382 \details No Operation does nothing. This instruction can be used for code alignment purposes.
AnnaBridge 146:22da6e220af6 383 */
AnnaBridge 146:22da6e220af6 384 #define __NOP __nop
AnnaBridge 146:22da6e220af6 385
AnnaBridge 146:22da6e220af6 386
AnnaBridge 146:22da6e220af6 387 /**
AnnaBridge 146:22da6e220af6 388 \brief Wait For Interrupt
AnnaBridge 146:22da6e220af6 389 \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
AnnaBridge 146:22da6e220af6 390 */
AnnaBridge 146:22da6e220af6 391 #define __WFI __wfi
AnnaBridge 146:22da6e220af6 392
AnnaBridge 146:22da6e220af6 393
AnnaBridge 146:22da6e220af6 394 /**
AnnaBridge 146:22da6e220af6 395 \brief Wait For Event
AnnaBridge 146:22da6e220af6 396 \details Wait For Event is a hint instruction that permits the processor to enter
AnnaBridge 146:22da6e220af6 397 a low-power state until one of a number of events occurs.
AnnaBridge 146:22da6e220af6 398 */
AnnaBridge 146:22da6e220af6 399 #define __WFE __wfe
AnnaBridge 146:22da6e220af6 400
AnnaBridge 146:22da6e220af6 401
AnnaBridge 146:22da6e220af6 402 /**
AnnaBridge 146:22da6e220af6 403 \brief Send Event
AnnaBridge 146:22da6e220af6 404 \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
AnnaBridge 146:22da6e220af6 405 */
AnnaBridge 146:22da6e220af6 406 #define __SEV __sev
AnnaBridge 146:22da6e220af6 407
AnnaBridge 146:22da6e220af6 408
AnnaBridge 146:22da6e220af6 409 /**
AnnaBridge 146:22da6e220af6 410 \brief Instruction Synchronization Barrier
AnnaBridge 146:22da6e220af6 411 \details Instruction Synchronization Barrier flushes the pipeline in the processor,
AnnaBridge 146:22da6e220af6 412 so that all instructions following the ISB are fetched from cache or memory,
AnnaBridge 146:22da6e220af6 413 after the instruction has been completed.
AnnaBridge 146:22da6e220af6 414 */
AnnaBridge 146:22da6e220af6 415 #define __ISB() do {\
AnnaBridge 146:22da6e220af6 416 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 417 __isb(0xF);\
AnnaBridge 146:22da6e220af6 418 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 419 } while (0U)
AnnaBridge 146:22da6e220af6 420
AnnaBridge 146:22da6e220af6 421 /**
AnnaBridge 146:22da6e220af6 422 \brief Data Synchronization Barrier
AnnaBridge 146:22da6e220af6 423 \details Acts as a special kind of Data Memory Barrier.
AnnaBridge 146:22da6e220af6 424 It completes when all explicit memory accesses before this instruction complete.
AnnaBridge 146:22da6e220af6 425 */
AnnaBridge 146:22da6e220af6 426 #define __DSB() do {\
AnnaBridge 146:22da6e220af6 427 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 428 __dsb(0xF);\
AnnaBridge 146:22da6e220af6 429 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 430 } while (0U)
AnnaBridge 146:22da6e220af6 431
AnnaBridge 146:22da6e220af6 432 /**
AnnaBridge 146:22da6e220af6 433 \brief Data Memory Barrier
AnnaBridge 146:22da6e220af6 434 \details Ensures the apparent order of the explicit memory operations before
AnnaBridge 146:22da6e220af6 435 and after the instruction, without ensuring their completion.
AnnaBridge 146:22da6e220af6 436 */
AnnaBridge 146:22da6e220af6 437 #define __DMB() do {\
AnnaBridge 146:22da6e220af6 438 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 439 __dmb(0xF);\
AnnaBridge 146:22da6e220af6 440 __schedule_barrier();\
AnnaBridge 146:22da6e220af6 441 } while (0U)
AnnaBridge 146:22da6e220af6 442
AnnaBridge 146:22da6e220af6 443 /**
AnnaBridge 146:22da6e220af6 444 \brief Reverse byte order (32 bit)
AnnaBridge 146:22da6e220af6 445 \details Reverses the byte order in integer value.
AnnaBridge 146:22da6e220af6 446 \param [in] value Value to reverse
AnnaBridge 146:22da6e220af6 447 \return Reversed value
AnnaBridge 146:22da6e220af6 448 */
AnnaBridge 146:22da6e220af6 449 #define __REV __rev
AnnaBridge 146:22da6e220af6 450
AnnaBridge 146:22da6e220af6 451
AnnaBridge 146:22da6e220af6 452 /**
AnnaBridge 146:22da6e220af6 453 \brief Reverse byte order (16 bit)
AnnaBridge 146:22da6e220af6 454 \details Reverses the byte order in two unsigned short values.
AnnaBridge 146:22da6e220af6 455 \param [in] value Value to reverse
AnnaBridge 146:22da6e220af6 456 \return Reversed value
AnnaBridge 146:22da6e220af6 457 */
AnnaBridge 146:22da6e220af6 458 #ifndef __NO_EMBEDDED_ASM
AnnaBridge 146:22da6e220af6 459 __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
AnnaBridge 146:22da6e220af6 460 {
AnnaBridge 146:22da6e220af6 461 rev16 r0, r0
AnnaBridge 146:22da6e220af6 462 bx lr
AnnaBridge 146:22da6e220af6 463 }
AnnaBridge 146:22da6e220af6 464 #endif
AnnaBridge 146:22da6e220af6 465
AnnaBridge 146:22da6e220af6 466
AnnaBridge 146:22da6e220af6 467 /**
AnnaBridge 146:22da6e220af6 468 \brief Reverse byte order in signed short value
AnnaBridge 146:22da6e220af6 469 \details Reverses the byte order in a signed short value with sign extension to integer.
AnnaBridge 146:22da6e220af6 470 \param [in] value Value to reverse
AnnaBridge 146:22da6e220af6 471 \return Reversed value
AnnaBridge 146:22da6e220af6 472 */
AnnaBridge 146:22da6e220af6 473 #ifndef __NO_EMBEDDED_ASM
AnnaBridge 146:22da6e220af6 474 __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
AnnaBridge 146:22da6e220af6 475 {
AnnaBridge 146:22da6e220af6 476 revsh r0, r0
AnnaBridge 146:22da6e220af6 477 bx lr
AnnaBridge 146:22da6e220af6 478 }
AnnaBridge 146:22da6e220af6 479 #endif
AnnaBridge 146:22da6e220af6 480
AnnaBridge 146:22da6e220af6 481
AnnaBridge 146:22da6e220af6 482 /**
AnnaBridge 146:22da6e220af6 483 \brief Rotate Right in unsigned value (32 bit)
AnnaBridge 146:22da6e220af6 484 \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
AnnaBridge 146:22da6e220af6 485 \param [in] op1 Value to rotate
AnnaBridge 146:22da6e220af6 486 \param [in] op2 Number of Bits to rotate
AnnaBridge 146:22da6e220af6 487 \return Rotated value
AnnaBridge 146:22da6e220af6 488 */
AnnaBridge 146:22da6e220af6 489 #define __ROR __ror
AnnaBridge 146:22da6e220af6 490
AnnaBridge 146:22da6e220af6 491
AnnaBridge 146:22da6e220af6 492 /**
AnnaBridge 146:22da6e220af6 493 \brief Breakpoint
AnnaBridge 146:22da6e220af6 494 \details Causes the processor to enter Debug state.
AnnaBridge 146:22da6e220af6 495 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
AnnaBridge 146:22da6e220af6 496 \param [in] value is ignored by the processor.
AnnaBridge 146:22da6e220af6 497 If required, a debugger can use it to store additional information about the breakpoint.
AnnaBridge 146:22da6e220af6 498 */
AnnaBridge 146:22da6e220af6 499 #define __BKPT(value) __breakpoint(value)
AnnaBridge 146:22da6e220af6 500
AnnaBridge 146:22da6e220af6 501
AnnaBridge 146:22da6e220af6 502 /**
AnnaBridge 146:22da6e220af6 503 \brief Reverse bit order of value
AnnaBridge 146:22da6e220af6 504 \details Reverses the bit order of the given value.
AnnaBridge 146:22da6e220af6 505 \param [in] value Value to reverse
AnnaBridge 146:22da6e220af6 506 \return Reversed value
AnnaBridge 146:22da6e220af6 507 */
AnnaBridge 146:22da6e220af6 508 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
AnnaBridge 146:22da6e220af6 509 (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
AnnaBridge 146:22da6e220af6 510 #define __RBIT __rbit
AnnaBridge 146:22da6e220af6 511 #else
AnnaBridge 146:22da6e220af6 512 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
AnnaBridge 146:22da6e220af6 513 {
AnnaBridge 146:22da6e220af6 514 uint32_t result;
AnnaBridge 146:22da6e220af6 515 int32_t s = (4 /*sizeof(v)*/ * 8) - 1; /* extra shift needed at end */
AnnaBridge 146:22da6e220af6 516
AnnaBridge 146:22da6e220af6 517 result = value; /* r will be reversed bits of v; first get LSB of v */
AnnaBridge 146:22da6e220af6 518 for (value >>= 1U; value; value >>= 1U)
AnnaBridge 146:22da6e220af6 519 {
AnnaBridge 146:22da6e220af6 520 result <<= 1U;
AnnaBridge 146:22da6e220af6 521 result |= value & 1U;
AnnaBridge 146:22da6e220af6 522 s--;
AnnaBridge 146:22da6e220af6 523 }
AnnaBridge 146:22da6e220af6 524 result <<= s; /* shift when v's highest bits are zero */
AnnaBridge 146:22da6e220af6 525 return(result);
AnnaBridge 146:22da6e220af6 526 }
AnnaBridge 146:22da6e220af6 527 #endif
AnnaBridge 146:22da6e220af6 528
AnnaBridge 146:22da6e220af6 529
AnnaBridge 146:22da6e220af6 530 /**
AnnaBridge 146:22da6e220af6 531 \brief Count leading zeros
AnnaBridge 146:22da6e220af6 532 \details Counts the number of leading zeros of a data value.
AnnaBridge 146:22da6e220af6 533 \param [in] value Value to count the leading zeros
AnnaBridge 146:22da6e220af6 534 \return number of leading zeros in value
AnnaBridge 146:22da6e220af6 535 */
AnnaBridge 146:22da6e220af6 536 #define __CLZ __clz
AnnaBridge 146:22da6e220af6 537
AnnaBridge 146:22da6e220af6 538
AnnaBridge 146:22da6e220af6 539 #if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
AnnaBridge 146:22da6e220af6 540 (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
AnnaBridge 146:22da6e220af6 541
AnnaBridge 146:22da6e220af6 542 /**
AnnaBridge 146:22da6e220af6 543 \brief LDR Exclusive (8 bit)
AnnaBridge 146:22da6e220af6 544 \details Executes a exclusive LDR instruction for 8 bit value.
AnnaBridge 146:22da6e220af6 545 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 546 \return value of type uint8_t at (*ptr)
AnnaBridge 146:22da6e220af6 547 */
AnnaBridge 146:22da6e220af6 548 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 549 #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
AnnaBridge 146:22da6e220af6 550 #else
AnnaBridge 146:22da6e220af6 551 #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
AnnaBridge 146:22da6e220af6 552 #endif
AnnaBridge 146:22da6e220af6 553
AnnaBridge 146:22da6e220af6 554
AnnaBridge 146:22da6e220af6 555 /**
AnnaBridge 146:22da6e220af6 556 \brief LDR Exclusive (16 bit)
AnnaBridge 146:22da6e220af6 557 \details Executes a exclusive LDR instruction for 16 bit values.
AnnaBridge 146:22da6e220af6 558 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 559 \return value of type uint16_t at (*ptr)
AnnaBridge 146:22da6e220af6 560 */
AnnaBridge 146:22da6e220af6 561 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 562 #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
AnnaBridge 146:22da6e220af6 563 #else
AnnaBridge 146:22da6e220af6 564 #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
AnnaBridge 146:22da6e220af6 565 #endif
AnnaBridge 146:22da6e220af6 566
AnnaBridge 146:22da6e220af6 567
AnnaBridge 146:22da6e220af6 568 /**
AnnaBridge 146:22da6e220af6 569 \brief LDR Exclusive (32 bit)
AnnaBridge 146:22da6e220af6 570 \details Executes a exclusive LDR instruction for 32 bit values.
AnnaBridge 146:22da6e220af6 571 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 572 \return value of type uint32_t at (*ptr)
AnnaBridge 146:22da6e220af6 573 */
AnnaBridge 146:22da6e220af6 574 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 575 #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
AnnaBridge 146:22da6e220af6 576 #else
AnnaBridge 146:22da6e220af6 577 #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
AnnaBridge 146:22da6e220af6 578 #endif
AnnaBridge 146:22da6e220af6 579
AnnaBridge 146:22da6e220af6 580
AnnaBridge 146:22da6e220af6 581 /**
AnnaBridge 146:22da6e220af6 582 \brief STR Exclusive (8 bit)
AnnaBridge 146:22da6e220af6 583 \details Executes a exclusive STR instruction for 8 bit values.
AnnaBridge 146:22da6e220af6 584 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 585 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 586 \return 0 Function succeeded
AnnaBridge 146:22da6e220af6 587 \return 1 Function failed
AnnaBridge 146:22da6e220af6 588 */
AnnaBridge 146:22da6e220af6 589 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 590 #define __STREXB(value, ptr) __strex(value, ptr)
AnnaBridge 146:22da6e220af6 591 #else
AnnaBridge 146:22da6e220af6 592 #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
AnnaBridge 146:22da6e220af6 593 #endif
AnnaBridge 146:22da6e220af6 594
AnnaBridge 146:22da6e220af6 595
AnnaBridge 146:22da6e220af6 596 /**
AnnaBridge 146:22da6e220af6 597 \brief STR Exclusive (16 bit)
AnnaBridge 146:22da6e220af6 598 \details Executes a exclusive STR instruction for 16 bit values.
AnnaBridge 146:22da6e220af6 599 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 600 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 601 \return 0 Function succeeded
AnnaBridge 146:22da6e220af6 602 \return 1 Function failed
AnnaBridge 146:22da6e220af6 603 */
AnnaBridge 146:22da6e220af6 604 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 605 #define __STREXH(value, ptr) __strex(value, ptr)
AnnaBridge 146:22da6e220af6 606 #else
AnnaBridge 146:22da6e220af6 607 #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
AnnaBridge 146:22da6e220af6 608 #endif
AnnaBridge 146:22da6e220af6 609
AnnaBridge 146:22da6e220af6 610
AnnaBridge 146:22da6e220af6 611 /**
AnnaBridge 146:22da6e220af6 612 \brief STR Exclusive (32 bit)
AnnaBridge 146:22da6e220af6 613 \details Executes a exclusive STR instruction for 32 bit values.
AnnaBridge 146:22da6e220af6 614 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 615 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 616 \return 0 Function succeeded
AnnaBridge 146:22da6e220af6 617 \return 1 Function failed
AnnaBridge 146:22da6e220af6 618 */
AnnaBridge 146:22da6e220af6 619 #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
AnnaBridge 146:22da6e220af6 620 #define __STREXW(value, ptr) __strex(value, ptr)
AnnaBridge 146:22da6e220af6 621 #else
AnnaBridge 146:22da6e220af6 622 #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
AnnaBridge 146:22da6e220af6 623 #endif
AnnaBridge 146:22da6e220af6 624
AnnaBridge 146:22da6e220af6 625
AnnaBridge 146:22da6e220af6 626 /**
AnnaBridge 146:22da6e220af6 627 \brief Remove the exclusive lock
AnnaBridge 146:22da6e220af6 628 \details Removes the exclusive lock which is created by LDREX.
AnnaBridge 146:22da6e220af6 629 */
AnnaBridge 146:22da6e220af6 630 #define __CLREX __clrex
AnnaBridge 146:22da6e220af6 631
AnnaBridge 146:22da6e220af6 632
AnnaBridge 146:22da6e220af6 633 /**
AnnaBridge 146:22da6e220af6 634 \brief Signed Saturate
AnnaBridge 146:22da6e220af6 635 \details Saturates a signed value.
AnnaBridge 146:22da6e220af6 636 \param [in] value Value to be saturated
AnnaBridge 146:22da6e220af6 637 \param [in] sat Bit position to saturate to (1..32)
AnnaBridge 146:22da6e220af6 638 \return Saturated value
AnnaBridge 146:22da6e220af6 639 */
AnnaBridge 146:22da6e220af6 640 #define __SSAT __ssat
AnnaBridge 146:22da6e220af6 641
AnnaBridge 146:22da6e220af6 642
AnnaBridge 146:22da6e220af6 643 /**
AnnaBridge 146:22da6e220af6 644 \brief Unsigned Saturate
AnnaBridge 146:22da6e220af6 645 \details Saturates an unsigned value.
AnnaBridge 146:22da6e220af6 646 \param [in] value Value to be saturated
AnnaBridge 146:22da6e220af6 647 \param [in] sat Bit position to saturate to (0..31)
AnnaBridge 146:22da6e220af6 648 \return Saturated value
AnnaBridge 146:22da6e220af6 649 */
AnnaBridge 146:22da6e220af6 650 #define __USAT __usat
AnnaBridge 146:22da6e220af6 651
AnnaBridge 146:22da6e220af6 652
AnnaBridge 146:22da6e220af6 653 /**
AnnaBridge 146:22da6e220af6 654 \brief Rotate Right with Extend (32 bit)
AnnaBridge 146:22da6e220af6 655 \details Moves each bit of a bitstring right by one bit.
AnnaBridge 146:22da6e220af6 656 The carry input is shifted in at the left end of the bitstring.
AnnaBridge 146:22da6e220af6 657 \param [in] value Value to rotate
AnnaBridge 146:22da6e220af6 658 \return Rotated value
AnnaBridge 146:22da6e220af6 659 */
AnnaBridge 146:22da6e220af6 660 #ifndef __NO_EMBEDDED_ASM
AnnaBridge 146:22da6e220af6 661 __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
AnnaBridge 146:22da6e220af6 662 {
AnnaBridge 146:22da6e220af6 663 rrx r0, r0
AnnaBridge 146:22da6e220af6 664 bx lr
AnnaBridge 146:22da6e220af6 665 }
AnnaBridge 146:22da6e220af6 666 #endif
AnnaBridge 146:22da6e220af6 667
AnnaBridge 146:22da6e220af6 668
AnnaBridge 146:22da6e220af6 669 /**
AnnaBridge 146:22da6e220af6 670 \brief LDRT Unprivileged (8 bit)
AnnaBridge 146:22da6e220af6 671 \details Executes a Unprivileged LDRT instruction for 8 bit value.
AnnaBridge 146:22da6e220af6 672 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 673 \return value of type uint8_t at (*ptr)
AnnaBridge 146:22da6e220af6 674 */
AnnaBridge 146:22da6e220af6 675 #define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
AnnaBridge 146:22da6e220af6 676
AnnaBridge 146:22da6e220af6 677
AnnaBridge 146:22da6e220af6 678 /**
AnnaBridge 146:22da6e220af6 679 \brief LDRT Unprivileged (16 bit)
AnnaBridge 146:22da6e220af6 680 \details Executes a Unprivileged LDRT instruction for 16 bit values.
AnnaBridge 146:22da6e220af6 681 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 682 \return value of type uint16_t at (*ptr)
AnnaBridge 146:22da6e220af6 683 */
AnnaBridge 146:22da6e220af6 684 #define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
AnnaBridge 146:22da6e220af6 685
AnnaBridge 146:22da6e220af6 686
AnnaBridge 146:22da6e220af6 687 /**
AnnaBridge 146:22da6e220af6 688 \brief LDRT Unprivileged (32 bit)
AnnaBridge 146:22da6e220af6 689 \details Executes a Unprivileged LDRT instruction for 32 bit values.
AnnaBridge 146:22da6e220af6 690 \param [in] ptr Pointer to data
AnnaBridge 146:22da6e220af6 691 \return value of type uint32_t at (*ptr)
AnnaBridge 146:22da6e220af6 692 */
AnnaBridge 146:22da6e220af6 693 #define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
AnnaBridge 146:22da6e220af6 694
AnnaBridge 146:22da6e220af6 695
AnnaBridge 146:22da6e220af6 696 /**
AnnaBridge 146:22da6e220af6 697 \brief STRT Unprivileged (8 bit)
AnnaBridge 146:22da6e220af6 698 \details Executes a Unprivileged STRT instruction for 8 bit values.
AnnaBridge 146:22da6e220af6 699 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 700 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 701 */
AnnaBridge 146:22da6e220af6 702 #define __STRBT(value, ptr) __strt(value, ptr)
AnnaBridge 146:22da6e220af6 703
AnnaBridge 146:22da6e220af6 704
AnnaBridge 146:22da6e220af6 705 /**
AnnaBridge 146:22da6e220af6 706 \brief STRT Unprivileged (16 bit)
AnnaBridge 146:22da6e220af6 707 \details Executes a Unprivileged STRT instruction for 16 bit values.
AnnaBridge 146:22da6e220af6 708 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 709 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 710 */
AnnaBridge 146:22da6e220af6 711 #define __STRHT(value, ptr) __strt(value, ptr)
AnnaBridge 146:22da6e220af6 712
AnnaBridge 146:22da6e220af6 713
AnnaBridge 146:22da6e220af6 714 /**
AnnaBridge 146:22da6e220af6 715 \brief STRT Unprivileged (32 bit)
AnnaBridge 146:22da6e220af6 716 \details Executes a Unprivileged STRT instruction for 32 bit values.
AnnaBridge 146:22da6e220af6 717 \param [in] value Value to store
AnnaBridge 146:22da6e220af6 718 \param [in] ptr Pointer to location
AnnaBridge 146:22da6e220af6 719 */
AnnaBridge 146:22da6e220af6 720 #define __STRT(value, ptr) __strt(value, ptr)
AnnaBridge 146:22da6e220af6 721
AnnaBridge 146:22da6e220af6 722 #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
AnnaBridge 146:22da6e220af6 723 (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
AnnaBridge 146:22da6e220af6 724
AnnaBridge 146:22da6e220af6 725 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
AnnaBridge 146:22da6e220af6 726
AnnaBridge 146:22da6e220af6 727
AnnaBridge 146:22da6e220af6 728 /* ################### Compiler specific Intrinsics ########################### */
AnnaBridge 146:22da6e220af6 729 /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
AnnaBridge 146:22da6e220af6 730 Access to dedicated SIMD instructions
AnnaBridge 146:22da6e220af6 731 @{
AnnaBridge 146:22da6e220af6 732 */
AnnaBridge 146:22da6e220af6 733
AnnaBridge 146:22da6e220af6 734 #if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
AnnaBridge 146:22da6e220af6 735
AnnaBridge 146:22da6e220af6 736 #define __SADD8 __sadd8
AnnaBridge 146:22da6e220af6 737 #define __QADD8 __qadd8
AnnaBridge 146:22da6e220af6 738 #define __SHADD8 __shadd8
AnnaBridge 146:22da6e220af6 739 #define __UADD8 __uadd8
AnnaBridge 146:22da6e220af6 740 #define __UQADD8 __uqadd8
AnnaBridge 146:22da6e220af6 741 #define __UHADD8 __uhadd8
AnnaBridge 146:22da6e220af6 742 #define __SSUB8 __ssub8
AnnaBridge 146:22da6e220af6 743 #define __QSUB8 __qsub8
AnnaBridge 146:22da6e220af6 744 #define __SHSUB8 __shsub8
AnnaBridge 146:22da6e220af6 745 #define __USUB8 __usub8
AnnaBridge 146:22da6e220af6 746 #define __UQSUB8 __uqsub8
AnnaBridge 146:22da6e220af6 747 #define __UHSUB8 __uhsub8
AnnaBridge 146:22da6e220af6 748 #define __SADD16 __sadd16
AnnaBridge 146:22da6e220af6 749 #define __QADD16 __qadd16
AnnaBridge 146:22da6e220af6 750 #define __SHADD16 __shadd16
AnnaBridge 146:22da6e220af6 751 #define __UADD16 __uadd16
AnnaBridge 146:22da6e220af6 752 #define __UQADD16 __uqadd16
AnnaBridge 146:22da6e220af6 753 #define __UHADD16 __uhadd16
AnnaBridge 146:22da6e220af6 754 #define __SSUB16 __ssub16
AnnaBridge 146:22da6e220af6 755 #define __QSUB16 __qsub16
AnnaBridge 146:22da6e220af6 756 #define __SHSUB16 __shsub16
AnnaBridge 146:22da6e220af6 757 #define __USUB16 __usub16
AnnaBridge 146:22da6e220af6 758 #define __UQSUB16 __uqsub16
AnnaBridge 146:22da6e220af6 759 #define __UHSUB16 __uhsub16
AnnaBridge 146:22da6e220af6 760 #define __SASX __sasx
AnnaBridge 146:22da6e220af6 761 #define __QASX __qasx
AnnaBridge 146:22da6e220af6 762 #define __SHASX __shasx
AnnaBridge 146:22da6e220af6 763 #define __UASX __uasx
AnnaBridge 146:22da6e220af6 764 #define __UQASX __uqasx
AnnaBridge 146:22da6e220af6 765 #define __UHASX __uhasx
AnnaBridge 146:22da6e220af6 766 #define __SSAX __ssax
AnnaBridge 146:22da6e220af6 767 #define __QSAX __qsax
AnnaBridge 146:22da6e220af6 768 #define __SHSAX __shsax
AnnaBridge 146:22da6e220af6 769 #define __USAX __usax
AnnaBridge 146:22da6e220af6 770 #define __UQSAX __uqsax
AnnaBridge 146:22da6e220af6 771 #define __UHSAX __uhsax
AnnaBridge 146:22da6e220af6 772 #define __USAD8 __usad8
AnnaBridge 146:22da6e220af6 773 #define __USADA8 __usada8
AnnaBridge 146:22da6e220af6 774 #define __SSAT16 __ssat16
AnnaBridge 146:22da6e220af6 775 #define __USAT16 __usat16
AnnaBridge 146:22da6e220af6 776 #define __UXTB16 __uxtb16
AnnaBridge 146:22da6e220af6 777 #define __UXTAB16 __uxtab16
AnnaBridge 146:22da6e220af6 778 #define __SXTB16 __sxtb16
AnnaBridge 146:22da6e220af6 779 #define __SXTAB16 __sxtab16
AnnaBridge 146:22da6e220af6 780 #define __SMUAD __smuad
AnnaBridge 146:22da6e220af6 781 #define __SMUADX __smuadx
AnnaBridge 146:22da6e220af6 782 #define __SMLAD __smlad
AnnaBridge 146:22da6e220af6 783 #define __SMLADX __smladx
AnnaBridge 146:22da6e220af6 784 #define __SMLALD __smlald
AnnaBridge 146:22da6e220af6 785 #define __SMLALDX __smlaldx
AnnaBridge 146:22da6e220af6 786 #define __SMUSD __smusd
AnnaBridge 146:22da6e220af6 787 #define __SMUSDX __smusdx
AnnaBridge 146:22da6e220af6 788 #define __SMLSD __smlsd
AnnaBridge 146:22da6e220af6 789 #define __SMLSDX __smlsdx
AnnaBridge 146:22da6e220af6 790 #define __SMLSLD __smlsld
AnnaBridge 146:22da6e220af6 791 #define __SMLSLDX __smlsldx
AnnaBridge 146:22da6e220af6 792 #define __SEL __sel
AnnaBridge 146:22da6e220af6 793 #define __QADD __qadd
AnnaBridge 146:22da6e220af6 794 #define __QSUB __qsub
AnnaBridge 146:22da6e220af6 795
AnnaBridge 146:22da6e220af6 796 #define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
AnnaBridge 146:22da6e220af6 797 ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
AnnaBridge 146:22da6e220af6 798
AnnaBridge 146:22da6e220af6 799 #define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
AnnaBridge 146:22da6e220af6 800 ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
AnnaBridge 146:22da6e220af6 801
AnnaBridge 146:22da6e220af6 802 #define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
AnnaBridge 146:22da6e220af6 803 ((int64_t)(ARG3) << 32U) ) >> 32U))
AnnaBridge 146:22da6e220af6 804
AnnaBridge 146:22da6e220af6 805 #endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
AnnaBridge 146:22da6e220af6 806 /*@} end of group CMSIS_SIMD_intrinsics */
AnnaBridge 146:22da6e220af6 807
AnnaBridge 146:22da6e220af6 808
AnnaBridge 146:22da6e220af6 809 #endif /* __CMSIS_ARMCC_H */