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:
mbed_official
Date:
Thu Dec 21 18:20:02 2017 +0000
Revision:
159:7130f322cb7e
mbed library version 157

Who changed what in which revision?

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