/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
fblanc
Date:
Fri Dec 05 15:42:32 2014 +0000
Revision:
93:9dd889aeda0e
Parent:
82:6473597d706e
substitute line 894 extern } by }; /TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /**************************************************************************//**
bogdanm 82:6473597d706e 2 * @file core_cmInstr.h
bogdanm 82:6473597d706e 3 * @brief CMSIS Cortex-M Core Instruction Access Header File
bogdanm 82:6473597d706e 4 * @version V3.20
bogdanm 82:6473597d706e 5 * @date 05. March 2013
bogdanm 82:6473597d706e 6 *
bogdanm 82:6473597d706e 7 * @note
bogdanm 82:6473597d706e 8 *
bogdanm 82:6473597d706e 9 ******************************************************************************/
bogdanm 82:6473597d706e 10 /* Copyright (c) 2009 - 2013 ARM LIMITED
bogdanm 82:6473597d706e 11
bogdanm 82:6473597d706e 12 All rights reserved.
bogdanm 82:6473597d706e 13 Redistribution and use in source and binary forms, with or without
bogdanm 82:6473597d706e 14 modification, are permitted provided that the following conditions are met:
bogdanm 82:6473597d706e 15 - Redistributions of source code must retain the above copyright
bogdanm 82:6473597d706e 16 notice, this list of conditions and the following disclaimer.
bogdanm 82:6473597d706e 17 - Redistributions in binary form must reproduce the above copyright
bogdanm 82:6473597d706e 18 notice, this list of conditions and the following disclaimer in the
bogdanm 82:6473597d706e 19 documentation and/or other materials provided with the distribution.
bogdanm 82:6473597d706e 20 - Neither the name of ARM nor the names of its contributors may be used
bogdanm 82:6473597d706e 21 to endorse or promote products derived from this software without
bogdanm 82:6473597d706e 22 specific prior written permission.
bogdanm 82:6473597d706e 23 *
bogdanm 82:6473597d706e 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 82:6473597d706e 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 82:6473597d706e 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
bogdanm 82:6473597d706e 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
bogdanm 82:6473597d706e 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
bogdanm 82:6473597d706e 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
bogdanm 82:6473597d706e 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
bogdanm 82:6473597d706e 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
bogdanm 82:6473597d706e 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
bogdanm 82:6473597d706e 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
bogdanm 82:6473597d706e 34 POSSIBILITY OF SUCH DAMAGE.
bogdanm 82:6473597d706e 35 ---------------------------------------------------------------------------*/
bogdanm 82:6473597d706e 36
bogdanm 82:6473597d706e 37
bogdanm 82:6473597d706e 38 #ifndef __CORE_CMINSTR_H
bogdanm 82:6473597d706e 39 #define __CORE_CMINSTR_H
bogdanm 82:6473597d706e 40
bogdanm 82:6473597d706e 41
bogdanm 82:6473597d706e 42 /* ########################## Core Instruction Access ######################### */
bogdanm 82:6473597d706e 43 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
bogdanm 82:6473597d706e 44 Access to dedicated instructions
bogdanm 82:6473597d706e 45 @{
bogdanm 82:6473597d706e 46 */
bogdanm 82:6473597d706e 47
bogdanm 82:6473597d706e 48 #if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
bogdanm 82:6473597d706e 49 /* ARM armcc specific functions */
bogdanm 82:6473597d706e 50
bogdanm 82:6473597d706e 51 #if (__ARMCC_VERSION < 400677)
bogdanm 82:6473597d706e 52 #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
bogdanm 82:6473597d706e 53 #endif
bogdanm 82:6473597d706e 54
bogdanm 82:6473597d706e 55
bogdanm 82:6473597d706e 56 /** \brief No Operation
bogdanm 82:6473597d706e 57
bogdanm 82:6473597d706e 58 No Operation does nothing. This instruction can be used for code alignment purposes.
bogdanm 82:6473597d706e 59 */
bogdanm 82:6473597d706e 60 #define __NOP __nop
bogdanm 82:6473597d706e 61
bogdanm 82:6473597d706e 62
bogdanm 82:6473597d706e 63 /** \brief Wait For Interrupt
bogdanm 82:6473597d706e 64
bogdanm 82:6473597d706e 65 Wait For Interrupt is a hint instruction that suspends execution
bogdanm 82:6473597d706e 66 until one of a number of events occurs.
bogdanm 82:6473597d706e 67 */
bogdanm 82:6473597d706e 68 #define __WFI __wfi
bogdanm 82:6473597d706e 69
bogdanm 82:6473597d706e 70
bogdanm 82:6473597d706e 71 /** \brief Wait For Event
bogdanm 82:6473597d706e 72
bogdanm 82:6473597d706e 73 Wait For Event is a hint instruction that permits the processor to enter
bogdanm 82:6473597d706e 74 a low-power state until one of a number of events occurs.
bogdanm 82:6473597d706e 75 */
bogdanm 82:6473597d706e 76 #define __WFE __wfe
bogdanm 82:6473597d706e 77
bogdanm 82:6473597d706e 78
bogdanm 82:6473597d706e 79 /** \brief Send Event
bogdanm 82:6473597d706e 80
bogdanm 82:6473597d706e 81 Send Event is a hint instruction. It causes an event to be signaled to the CPU.
bogdanm 82:6473597d706e 82 */
bogdanm 82:6473597d706e 83 #define __SEV __sev
bogdanm 82:6473597d706e 84
bogdanm 82:6473597d706e 85
bogdanm 82:6473597d706e 86 /** \brief Instruction Synchronization Barrier
bogdanm 82:6473597d706e 87
bogdanm 82:6473597d706e 88 Instruction Synchronization Barrier flushes the pipeline in the processor,
bogdanm 82:6473597d706e 89 so that all instructions following the ISB are fetched from cache or
bogdanm 82:6473597d706e 90 memory, after the instruction has been completed.
bogdanm 82:6473597d706e 91 */
bogdanm 82:6473597d706e 92 #define __ISB() __isb(0xF)
bogdanm 82:6473597d706e 93
bogdanm 82:6473597d706e 94
bogdanm 82:6473597d706e 95 /** \brief Data Synchronization Barrier
bogdanm 82:6473597d706e 96
bogdanm 82:6473597d706e 97 This function acts as a special kind of Data Memory Barrier.
bogdanm 82:6473597d706e 98 It completes when all explicit memory accesses before this instruction complete.
bogdanm 82:6473597d706e 99 */
bogdanm 82:6473597d706e 100 #define __DSB() __dsb(0xF)
bogdanm 82:6473597d706e 101
bogdanm 82:6473597d706e 102
bogdanm 82:6473597d706e 103 /** \brief Data Memory Barrier
bogdanm 82:6473597d706e 104
bogdanm 82:6473597d706e 105 This function ensures the apparent order of the explicit memory operations before
bogdanm 82:6473597d706e 106 and after the instruction, without ensuring their completion.
bogdanm 82:6473597d706e 107 */
bogdanm 82:6473597d706e 108 #define __DMB() __dmb(0xF)
bogdanm 82:6473597d706e 109
bogdanm 82:6473597d706e 110
bogdanm 82:6473597d706e 111 /** \brief Reverse byte order (32 bit)
bogdanm 82:6473597d706e 112
bogdanm 82:6473597d706e 113 This function reverses the byte order in integer value.
bogdanm 82:6473597d706e 114
bogdanm 82:6473597d706e 115 \param [in] value Value to reverse
bogdanm 82:6473597d706e 116 \return Reversed value
bogdanm 82:6473597d706e 117 */
bogdanm 82:6473597d706e 118 #define __REV __rev
bogdanm 82:6473597d706e 119
bogdanm 82:6473597d706e 120
bogdanm 82:6473597d706e 121 /** \brief Reverse byte order (16 bit)
bogdanm 82:6473597d706e 122
bogdanm 82:6473597d706e 123 This function reverses the byte order in two unsigned short values.
bogdanm 82:6473597d706e 124
bogdanm 82:6473597d706e 125 \param [in] value Value to reverse
bogdanm 82:6473597d706e 126 \return Reversed value
bogdanm 82:6473597d706e 127 */
bogdanm 82:6473597d706e 128 #ifndef __NO_EMBEDDED_ASM
bogdanm 82:6473597d706e 129 __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
bogdanm 82:6473597d706e 130 {
bogdanm 82:6473597d706e 131 rev16 r0, r0
bogdanm 82:6473597d706e 132 bx lr
bogdanm 82:6473597d706e 133 }
bogdanm 82:6473597d706e 134 #endif
bogdanm 82:6473597d706e 135
bogdanm 82:6473597d706e 136 /** \brief Reverse byte order in signed short value
bogdanm 82:6473597d706e 137
bogdanm 82:6473597d706e 138 This function reverses the byte order in a signed short value with sign extension to integer.
bogdanm 82:6473597d706e 139
bogdanm 82:6473597d706e 140 \param [in] value Value to reverse
bogdanm 82:6473597d706e 141 \return Reversed value
bogdanm 82:6473597d706e 142 */
bogdanm 82:6473597d706e 143 #ifndef __NO_EMBEDDED_ASM
bogdanm 82:6473597d706e 144 __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
bogdanm 82:6473597d706e 145 {
bogdanm 82:6473597d706e 146 revsh r0, r0
bogdanm 82:6473597d706e 147 bx lr
bogdanm 82:6473597d706e 148 }
bogdanm 82:6473597d706e 149 #endif
bogdanm 82:6473597d706e 150
bogdanm 82:6473597d706e 151
bogdanm 82:6473597d706e 152 /** \brief Rotate Right in unsigned value (32 bit)
bogdanm 82:6473597d706e 153
bogdanm 82:6473597d706e 154 This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
bogdanm 82:6473597d706e 155
bogdanm 82:6473597d706e 156 \param [in] value Value to rotate
bogdanm 82:6473597d706e 157 \param [in] value Number of Bits to rotate
bogdanm 82:6473597d706e 158 \return Rotated value
bogdanm 82:6473597d706e 159 */
bogdanm 82:6473597d706e 160 #define __ROR __ror
bogdanm 82:6473597d706e 161
bogdanm 82:6473597d706e 162
bogdanm 82:6473597d706e 163 /** \brief Breakpoint
bogdanm 82:6473597d706e 164
bogdanm 82:6473597d706e 165 This function causes the processor to enter Debug state.
bogdanm 82:6473597d706e 166 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
bogdanm 82:6473597d706e 167
bogdanm 82:6473597d706e 168 \param [in] value is ignored by the processor.
bogdanm 82:6473597d706e 169 If required, a debugger can use it to store additional information about the breakpoint.
bogdanm 82:6473597d706e 170 */
bogdanm 82:6473597d706e 171 #define __BKPT(value) __breakpoint(value)
bogdanm 82:6473597d706e 172
bogdanm 82:6473597d706e 173
bogdanm 82:6473597d706e 174 #if (__CORTEX_M >= 0x03)
bogdanm 82:6473597d706e 175
bogdanm 82:6473597d706e 176 /** \brief Reverse bit order of value
bogdanm 82:6473597d706e 177
bogdanm 82:6473597d706e 178 This function reverses the bit order of the given value.
bogdanm 82:6473597d706e 179
bogdanm 82:6473597d706e 180 \param [in] value Value to reverse
bogdanm 82:6473597d706e 181 \return Reversed value
bogdanm 82:6473597d706e 182 */
bogdanm 82:6473597d706e 183 #define __RBIT __rbit
bogdanm 82:6473597d706e 184
bogdanm 82:6473597d706e 185
bogdanm 82:6473597d706e 186 /** \brief LDR Exclusive (8 bit)
bogdanm 82:6473597d706e 187
bogdanm 82:6473597d706e 188 This function performs a exclusive LDR command for 8 bit value.
bogdanm 82:6473597d706e 189
bogdanm 82:6473597d706e 190 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 191 \return value of type uint8_t at (*ptr)
bogdanm 82:6473597d706e 192 */
bogdanm 82:6473597d706e 193 #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
bogdanm 82:6473597d706e 194
bogdanm 82:6473597d706e 195
bogdanm 82:6473597d706e 196 /** \brief LDR Exclusive (16 bit)
bogdanm 82:6473597d706e 197
bogdanm 82:6473597d706e 198 This function performs a exclusive LDR command for 16 bit values.
bogdanm 82:6473597d706e 199
bogdanm 82:6473597d706e 200 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 201 \return value of type uint16_t at (*ptr)
bogdanm 82:6473597d706e 202 */
bogdanm 82:6473597d706e 203 #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
bogdanm 82:6473597d706e 204
bogdanm 82:6473597d706e 205
bogdanm 82:6473597d706e 206 /** \brief LDR Exclusive (32 bit)
bogdanm 82:6473597d706e 207
bogdanm 82:6473597d706e 208 This function performs a exclusive LDR command for 32 bit values.
bogdanm 82:6473597d706e 209
bogdanm 82:6473597d706e 210 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 211 \return value of type uint32_t at (*ptr)
bogdanm 82:6473597d706e 212 */
bogdanm 82:6473597d706e 213 #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
bogdanm 82:6473597d706e 214
bogdanm 82:6473597d706e 215
bogdanm 82:6473597d706e 216 /** \brief STR Exclusive (8 bit)
bogdanm 82:6473597d706e 217
bogdanm 82:6473597d706e 218 This function performs a exclusive STR command for 8 bit values.
bogdanm 82:6473597d706e 219
bogdanm 82:6473597d706e 220 \param [in] value Value to store
bogdanm 82:6473597d706e 221 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 222 \return 0 Function succeeded
bogdanm 82:6473597d706e 223 \return 1 Function failed
bogdanm 82:6473597d706e 224 */
bogdanm 82:6473597d706e 225 #define __STREXB(value, ptr) __strex(value, ptr)
bogdanm 82:6473597d706e 226
bogdanm 82:6473597d706e 227
bogdanm 82:6473597d706e 228 /** \brief STR Exclusive (16 bit)
bogdanm 82:6473597d706e 229
bogdanm 82:6473597d706e 230 This function performs a exclusive STR command for 16 bit values.
bogdanm 82:6473597d706e 231
bogdanm 82:6473597d706e 232 \param [in] value Value to store
bogdanm 82:6473597d706e 233 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 234 \return 0 Function succeeded
bogdanm 82:6473597d706e 235 \return 1 Function failed
bogdanm 82:6473597d706e 236 */
bogdanm 82:6473597d706e 237 #define __STREXH(value, ptr) __strex(value, ptr)
bogdanm 82:6473597d706e 238
bogdanm 82:6473597d706e 239
bogdanm 82:6473597d706e 240 /** \brief STR Exclusive (32 bit)
bogdanm 82:6473597d706e 241
bogdanm 82:6473597d706e 242 This function performs a exclusive STR command for 32 bit values.
bogdanm 82:6473597d706e 243
bogdanm 82:6473597d706e 244 \param [in] value Value to store
bogdanm 82:6473597d706e 245 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 246 \return 0 Function succeeded
bogdanm 82:6473597d706e 247 \return 1 Function failed
bogdanm 82:6473597d706e 248 */
bogdanm 82:6473597d706e 249 #define __STREXW(value, ptr) __strex(value, ptr)
bogdanm 82:6473597d706e 250
bogdanm 82:6473597d706e 251
bogdanm 82:6473597d706e 252 /** \brief Remove the exclusive lock
bogdanm 82:6473597d706e 253
bogdanm 82:6473597d706e 254 This function removes the exclusive lock which is created by LDREX.
bogdanm 82:6473597d706e 255
bogdanm 82:6473597d706e 256 */
bogdanm 82:6473597d706e 257 #define __CLREX __clrex
bogdanm 82:6473597d706e 258
bogdanm 82:6473597d706e 259
bogdanm 82:6473597d706e 260 /** \brief Signed Saturate
bogdanm 82:6473597d706e 261
bogdanm 82:6473597d706e 262 This function saturates a signed value.
bogdanm 82:6473597d706e 263
bogdanm 82:6473597d706e 264 \param [in] value Value to be saturated
bogdanm 82:6473597d706e 265 \param [in] sat Bit position to saturate to (1..32)
bogdanm 82:6473597d706e 266 \return Saturated value
bogdanm 82:6473597d706e 267 */
bogdanm 82:6473597d706e 268 #define __SSAT __ssat
bogdanm 82:6473597d706e 269
bogdanm 82:6473597d706e 270
bogdanm 82:6473597d706e 271 /** \brief Unsigned Saturate
bogdanm 82:6473597d706e 272
bogdanm 82:6473597d706e 273 This function saturates an unsigned value.
bogdanm 82:6473597d706e 274
bogdanm 82:6473597d706e 275 \param [in] value Value to be saturated
bogdanm 82:6473597d706e 276 \param [in] sat Bit position to saturate to (0..31)
bogdanm 82:6473597d706e 277 \return Saturated value
bogdanm 82:6473597d706e 278 */
bogdanm 82:6473597d706e 279 #define __USAT __usat
bogdanm 82:6473597d706e 280
bogdanm 82:6473597d706e 281
bogdanm 82:6473597d706e 282 /** \brief Count leading zeros
bogdanm 82:6473597d706e 283
bogdanm 82:6473597d706e 284 This function counts the number of leading zeros of a data value.
bogdanm 82:6473597d706e 285
bogdanm 82:6473597d706e 286 \param [in] value Value to count the leading zeros
bogdanm 82:6473597d706e 287 \return number of leading zeros in value
bogdanm 82:6473597d706e 288 */
bogdanm 82:6473597d706e 289 #define __CLZ __clz
bogdanm 82:6473597d706e 290
bogdanm 82:6473597d706e 291 #endif /* (__CORTEX_M >= 0x03) */
bogdanm 82:6473597d706e 292
bogdanm 82:6473597d706e 293
bogdanm 82:6473597d706e 294
bogdanm 82:6473597d706e 295 #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
bogdanm 82:6473597d706e 296 /* IAR iccarm specific functions */
bogdanm 82:6473597d706e 297
bogdanm 82:6473597d706e 298 #include <cmsis_iar.h>
bogdanm 82:6473597d706e 299
bogdanm 82:6473597d706e 300
bogdanm 82:6473597d706e 301 #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
bogdanm 82:6473597d706e 302 /* TI CCS specific functions */
bogdanm 82:6473597d706e 303
bogdanm 82:6473597d706e 304 #include <cmsis_ccs.h>
bogdanm 82:6473597d706e 305
bogdanm 82:6473597d706e 306
bogdanm 82:6473597d706e 307 #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
bogdanm 82:6473597d706e 308 /* GNU gcc specific functions */
bogdanm 82:6473597d706e 309
bogdanm 82:6473597d706e 310 /* Define macros for porting to both thumb1 and thumb2.
bogdanm 82:6473597d706e 311 * For thumb1, use low register (r0-r7), specified by constrant "l"
bogdanm 82:6473597d706e 312 * Otherwise, use general registers, specified by constrant "r" */
bogdanm 82:6473597d706e 313 #if defined (__thumb__) && !defined (__thumb2__)
bogdanm 82:6473597d706e 314 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
bogdanm 82:6473597d706e 315 #define __CMSIS_GCC_USE_REG(r) "l" (r)
bogdanm 82:6473597d706e 316 #else
bogdanm 82:6473597d706e 317 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
bogdanm 82:6473597d706e 318 #define __CMSIS_GCC_USE_REG(r) "r" (r)
bogdanm 82:6473597d706e 319 #endif
bogdanm 82:6473597d706e 320
bogdanm 82:6473597d706e 321 /** \brief No Operation
bogdanm 82:6473597d706e 322
bogdanm 82:6473597d706e 323 No Operation does nothing. This instruction can be used for code alignment purposes.
bogdanm 82:6473597d706e 324 */
bogdanm 82:6473597d706e 325 __attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void)
bogdanm 82:6473597d706e 326 {
bogdanm 82:6473597d706e 327 __ASM volatile ("nop");
bogdanm 82:6473597d706e 328 }
bogdanm 82:6473597d706e 329
bogdanm 82:6473597d706e 330
bogdanm 82:6473597d706e 331 /** \brief Wait For Interrupt
bogdanm 82:6473597d706e 332
bogdanm 82:6473597d706e 333 Wait For Interrupt is a hint instruction that suspends execution
bogdanm 82:6473597d706e 334 until one of a number of events occurs.
bogdanm 82:6473597d706e 335 */
bogdanm 82:6473597d706e 336 __attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void)
bogdanm 82:6473597d706e 337 {
bogdanm 82:6473597d706e 338 __ASM volatile ("wfi");
bogdanm 82:6473597d706e 339 }
bogdanm 82:6473597d706e 340
bogdanm 82:6473597d706e 341
bogdanm 82:6473597d706e 342 /** \brief Wait For Event
bogdanm 82:6473597d706e 343
bogdanm 82:6473597d706e 344 Wait For Event is a hint instruction that permits the processor to enter
bogdanm 82:6473597d706e 345 a low-power state until one of a number of events occurs.
bogdanm 82:6473597d706e 346 */
bogdanm 82:6473597d706e 347 __attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void)
bogdanm 82:6473597d706e 348 {
bogdanm 82:6473597d706e 349 __ASM volatile ("wfe");
bogdanm 82:6473597d706e 350 }
bogdanm 82:6473597d706e 351
bogdanm 82:6473597d706e 352
bogdanm 82:6473597d706e 353 /** \brief Send Event
bogdanm 82:6473597d706e 354
bogdanm 82:6473597d706e 355 Send Event is a hint instruction. It causes an event to be signaled to the CPU.
bogdanm 82:6473597d706e 356 */
bogdanm 82:6473597d706e 357 __attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void)
bogdanm 82:6473597d706e 358 {
bogdanm 82:6473597d706e 359 __ASM volatile ("sev");
bogdanm 82:6473597d706e 360 }
bogdanm 82:6473597d706e 361
bogdanm 82:6473597d706e 362
bogdanm 82:6473597d706e 363 /** \brief Instruction Synchronization Barrier
bogdanm 82:6473597d706e 364
bogdanm 82:6473597d706e 365 Instruction Synchronization Barrier flushes the pipeline in the processor,
bogdanm 82:6473597d706e 366 so that all instructions following the ISB are fetched from cache or
bogdanm 82:6473597d706e 367 memory, after the instruction has been completed.
bogdanm 82:6473597d706e 368 */
bogdanm 82:6473597d706e 369 __attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void)
bogdanm 82:6473597d706e 370 {
bogdanm 82:6473597d706e 371 __ASM volatile ("isb");
bogdanm 82:6473597d706e 372 }
bogdanm 82:6473597d706e 373
bogdanm 82:6473597d706e 374
bogdanm 82:6473597d706e 375 /** \brief Data Synchronization Barrier
bogdanm 82:6473597d706e 376
bogdanm 82:6473597d706e 377 This function acts as a special kind of Data Memory Barrier.
bogdanm 82:6473597d706e 378 It completes when all explicit memory accesses before this instruction complete.
bogdanm 82:6473597d706e 379 */
bogdanm 82:6473597d706e 380 __attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void)
bogdanm 82:6473597d706e 381 {
bogdanm 82:6473597d706e 382 __ASM volatile ("dsb");
bogdanm 82:6473597d706e 383 }
bogdanm 82:6473597d706e 384
bogdanm 82:6473597d706e 385
bogdanm 82:6473597d706e 386 /** \brief Data Memory Barrier
bogdanm 82:6473597d706e 387
bogdanm 82:6473597d706e 388 This function ensures the apparent order of the explicit memory operations before
bogdanm 82:6473597d706e 389 and after the instruction, without ensuring their completion.
bogdanm 82:6473597d706e 390 */
bogdanm 82:6473597d706e 391 __attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void)
bogdanm 82:6473597d706e 392 {
bogdanm 82:6473597d706e 393 __ASM volatile ("dmb");
bogdanm 82:6473597d706e 394 }
bogdanm 82:6473597d706e 395
bogdanm 82:6473597d706e 396
bogdanm 82:6473597d706e 397 /** \brief Reverse byte order (32 bit)
bogdanm 82:6473597d706e 398
bogdanm 82:6473597d706e 399 This function reverses the byte order in integer value.
bogdanm 82:6473597d706e 400
bogdanm 82:6473597d706e 401 \param [in] value Value to reverse
bogdanm 82:6473597d706e 402 \return Reversed value
bogdanm 82:6473597d706e 403 */
bogdanm 82:6473597d706e 404 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value)
bogdanm 82:6473597d706e 405 {
bogdanm 82:6473597d706e 406 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
bogdanm 82:6473597d706e 407 return __builtin_bswap32(value);
bogdanm 82:6473597d706e 408 #else
bogdanm 82:6473597d706e 409 uint32_t result;
bogdanm 82:6473597d706e 410
bogdanm 82:6473597d706e 411 __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
bogdanm 82:6473597d706e 412 return(result);
bogdanm 82:6473597d706e 413 #endif
bogdanm 82:6473597d706e 414 }
bogdanm 82:6473597d706e 415
bogdanm 82:6473597d706e 416
bogdanm 82:6473597d706e 417 /** \brief Reverse byte order (16 bit)
bogdanm 82:6473597d706e 418
bogdanm 82:6473597d706e 419 This function reverses the byte order in two unsigned short values.
bogdanm 82:6473597d706e 420
bogdanm 82:6473597d706e 421 \param [in] value Value to reverse
bogdanm 82:6473597d706e 422 \return Reversed value
bogdanm 82:6473597d706e 423 */
bogdanm 82:6473597d706e 424 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value)
bogdanm 82:6473597d706e 425 {
bogdanm 82:6473597d706e 426 uint32_t result;
bogdanm 82:6473597d706e 427
bogdanm 82:6473597d706e 428 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
bogdanm 82:6473597d706e 429 return(result);
bogdanm 82:6473597d706e 430 }
bogdanm 82:6473597d706e 431
bogdanm 82:6473597d706e 432
bogdanm 82:6473597d706e 433 /** \brief Reverse byte order in signed short value
bogdanm 82:6473597d706e 434
bogdanm 82:6473597d706e 435 This function reverses the byte order in a signed short value with sign extension to integer.
bogdanm 82:6473597d706e 436
bogdanm 82:6473597d706e 437 \param [in] value Value to reverse
bogdanm 82:6473597d706e 438 \return Reversed value
bogdanm 82:6473597d706e 439 */
bogdanm 82:6473597d706e 440 __attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value)
bogdanm 82:6473597d706e 441 {
bogdanm 82:6473597d706e 442 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
bogdanm 82:6473597d706e 443 return (short)__builtin_bswap16(value);
bogdanm 82:6473597d706e 444 #else
bogdanm 82:6473597d706e 445 uint32_t result;
bogdanm 82:6473597d706e 446
bogdanm 82:6473597d706e 447 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
bogdanm 82:6473597d706e 448 return(result);
bogdanm 82:6473597d706e 449 #endif
bogdanm 82:6473597d706e 450 }
bogdanm 82:6473597d706e 451
bogdanm 82:6473597d706e 452
bogdanm 82:6473597d706e 453 /** \brief Rotate Right in unsigned value (32 bit)
bogdanm 82:6473597d706e 454
bogdanm 82:6473597d706e 455 This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
bogdanm 82:6473597d706e 456
bogdanm 82:6473597d706e 457 \param [in] value Value to rotate
bogdanm 82:6473597d706e 458 \param [in] value Number of Bits to rotate
bogdanm 82:6473597d706e 459 \return Rotated value
bogdanm 82:6473597d706e 460 */
bogdanm 82:6473597d706e 461 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
bogdanm 82:6473597d706e 462 {
bogdanm 82:6473597d706e 463 return (op1 >> op2) | (op1 << (32 - op2));
bogdanm 82:6473597d706e 464 }
bogdanm 82:6473597d706e 465
bogdanm 82:6473597d706e 466
bogdanm 82:6473597d706e 467 /** \brief Breakpoint
bogdanm 82:6473597d706e 468
bogdanm 82:6473597d706e 469 This function causes the processor to enter Debug state.
bogdanm 82:6473597d706e 470 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
bogdanm 82:6473597d706e 471
bogdanm 82:6473597d706e 472 \param [in] value is ignored by the processor.
bogdanm 82:6473597d706e 473 If required, a debugger can use it to store additional information about the breakpoint.
bogdanm 82:6473597d706e 474 */
bogdanm 82:6473597d706e 475 #define __BKPT(value) __ASM volatile ("bkpt "#value)
bogdanm 82:6473597d706e 476
bogdanm 82:6473597d706e 477
bogdanm 82:6473597d706e 478 #if (__CORTEX_M >= 0x03)
bogdanm 82:6473597d706e 479
bogdanm 82:6473597d706e 480 /** \brief Reverse bit order of value
bogdanm 82:6473597d706e 481
bogdanm 82:6473597d706e 482 This function reverses the bit order of the given value.
bogdanm 82:6473597d706e 483
bogdanm 82:6473597d706e 484 \param [in] value Value to reverse
bogdanm 82:6473597d706e 485 \return Reversed value
bogdanm 82:6473597d706e 486 */
bogdanm 82:6473597d706e 487 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
bogdanm 82:6473597d706e 488 {
bogdanm 82:6473597d706e 489 uint32_t result;
bogdanm 82:6473597d706e 490
bogdanm 82:6473597d706e 491 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
bogdanm 82:6473597d706e 492 return(result);
bogdanm 82:6473597d706e 493 }
bogdanm 82:6473597d706e 494
bogdanm 82:6473597d706e 495
bogdanm 82:6473597d706e 496 /** \brief LDR Exclusive (8 bit)
bogdanm 82:6473597d706e 497
bogdanm 82:6473597d706e 498 This function performs a exclusive LDR command for 8 bit value.
bogdanm 82:6473597d706e 499
bogdanm 82:6473597d706e 500 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 501 \return value of type uint8_t at (*ptr)
bogdanm 82:6473597d706e 502 */
bogdanm 82:6473597d706e 503 __attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
bogdanm 82:6473597d706e 504 {
bogdanm 82:6473597d706e 505 uint32_t result;
bogdanm 82:6473597d706e 506
bogdanm 82:6473597d706e 507 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
bogdanm 82:6473597d706e 508 __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
bogdanm 82:6473597d706e 509 #else
bogdanm 82:6473597d706e 510 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
bogdanm 82:6473597d706e 511 accepted by assembler. So has to use following less efficient pattern.
bogdanm 82:6473597d706e 512 */
bogdanm 82:6473597d706e 513 __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
bogdanm 82:6473597d706e 514 #endif
bogdanm 82:6473597d706e 515 return(result);
bogdanm 82:6473597d706e 516 }
bogdanm 82:6473597d706e 517
bogdanm 82:6473597d706e 518
bogdanm 82:6473597d706e 519 /** \brief LDR Exclusive (16 bit)
bogdanm 82:6473597d706e 520
bogdanm 82:6473597d706e 521 This function performs a exclusive LDR command for 16 bit values.
bogdanm 82:6473597d706e 522
bogdanm 82:6473597d706e 523 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 524 \return value of type uint16_t at (*ptr)
bogdanm 82:6473597d706e 525 */
bogdanm 82:6473597d706e 526 __attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
bogdanm 82:6473597d706e 527 {
bogdanm 82:6473597d706e 528 uint32_t result;
bogdanm 82:6473597d706e 529
bogdanm 82:6473597d706e 530 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
bogdanm 82:6473597d706e 531 __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
bogdanm 82:6473597d706e 532 #else
bogdanm 82:6473597d706e 533 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
bogdanm 82:6473597d706e 534 accepted by assembler. So has to use following less efficient pattern.
bogdanm 82:6473597d706e 535 */
bogdanm 82:6473597d706e 536 __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
bogdanm 82:6473597d706e 537 #endif
bogdanm 82:6473597d706e 538 return(result);
bogdanm 82:6473597d706e 539 }
bogdanm 82:6473597d706e 540
bogdanm 82:6473597d706e 541
bogdanm 82:6473597d706e 542 /** \brief LDR Exclusive (32 bit)
bogdanm 82:6473597d706e 543
bogdanm 82:6473597d706e 544 This function performs a exclusive LDR command for 32 bit values.
bogdanm 82:6473597d706e 545
bogdanm 82:6473597d706e 546 \param [in] ptr Pointer to data
bogdanm 82:6473597d706e 547 \return value of type uint32_t at (*ptr)
bogdanm 82:6473597d706e 548 */
bogdanm 82:6473597d706e 549 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
bogdanm 82:6473597d706e 550 {
bogdanm 82:6473597d706e 551 uint32_t result;
bogdanm 82:6473597d706e 552
bogdanm 82:6473597d706e 553 __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
bogdanm 82:6473597d706e 554 return(result);
bogdanm 82:6473597d706e 555 }
bogdanm 82:6473597d706e 556
bogdanm 82:6473597d706e 557
bogdanm 82:6473597d706e 558 /** \brief STR Exclusive (8 bit)
bogdanm 82:6473597d706e 559
bogdanm 82:6473597d706e 560 This function performs a exclusive STR command for 8 bit values.
bogdanm 82:6473597d706e 561
bogdanm 82:6473597d706e 562 \param [in] value Value to store
bogdanm 82:6473597d706e 563 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 564 \return 0 Function succeeded
bogdanm 82:6473597d706e 565 \return 1 Function failed
bogdanm 82:6473597d706e 566 */
bogdanm 82:6473597d706e 567 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
bogdanm 82:6473597d706e 568 {
bogdanm 82:6473597d706e 569 uint32_t result;
bogdanm 82:6473597d706e 570
bogdanm 82:6473597d706e 571 __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
bogdanm 82:6473597d706e 572 return(result);
bogdanm 82:6473597d706e 573 }
bogdanm 82:6473597d706e 574
bogdanm 82:6473597d706e 575
bogdanm 82:6473597d706e 576 /** \brief STR Exclusive (16 bit)
bogdanm 82:6473597d706e 577
bogdanm 82:6473597d706e 578 This function performs a exclusive STR command for 16 bit values.
bogdanm 82:6473597d706e 579
bogdanm 82:6473597d706e 580 \param [in] value Value to store
bogdanm 82:6473597d706e 581 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 582 \return 0 Function succeeded
bogdanm 82:6473597d706e 583 \return 1 Function failed
bogdanm 82:6473597d706e 584 */
bogdanm 82:6473597d706e 585 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
bogdanm 82:6473597d706e 586 {
bogdanm 82:6473597d706e 587 uint32_t result;
bogdanm 82:6473597d706e 588
bogdanm 82:6473597d706e 589 __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
bogdanm 82:6473597d706e 590 return(result);
bogdanm 82:6473597d706e 591 }
bogdanm 82:6473597d706e 592
bogdanm 82:6473597d706e 593
bogdanm 82:6473597d706e 594 /** \brief STR Exclusive (32 bit)
bogdanm 82:6473597d706e 595
bogdanm 82:6473597d706e 596 This function performs a exclusive STR command for 32 bit values.
bogdanm 82:6473597d706e 597
bogdanm 82:6473597d706e 598 \param [in] value Value to store
bogdanm 82:6473597d706e 599 \param [in] ptr Pointer to location
bogdanm 82:6473597d706e 600 \return 0 Function succeeded
bogdanm 82:6473597d706e 601 \return 1 Function failed
bogdanm 82:6473597d706e 602 */
bogdanm 82:6473597d706e 603 __attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
bogdanm 82:6473597d706e 604 {
bogdanm 82:6473597d706e 605 uint32_t result;
bogdanm 82:6473597d706e 606
bogdanm 82:6473597d706e 607 __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
bogdanm 82:6473597d706e 608 return(result);
bogdanm 82:6473597d706e 609 }
bogdanm 82:6473597d706e 610
bogdanm 82:6473597d706e 611
bogdanm 82:6473597d706e 612 /** \brief Remove the exclusive lock
bogdanm 82:6473597d706e 613
bogdanm 82:6473597d706e 614 This function removes the exclusive lock which is created by LDREX.
bogdanm 82:6473597d706e 615
bogdanm 82:6473597d706e 616 */
bogdanm 82:6473597d706e 617 __attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void)
bogdanm 82:6473597d706e 618 {
bogdanm 82:6473597d706e 619 __ASM volatile ("clrex" ::: "memory");
bogdanm 82:6473597d706e 620 }
bogdanm 82:6473597d706e 621
bogdanm 82:6473597d706e 622
bogdanm 82:6473597d706e 623 /** \brief Signed Saturate
bogdanm 82:6473597d706e 624
bogdanm 82:6473597d706e 625 This function saturates a signed value.
bogdanm 82:6473597d706e 626
bogdanm 82:6473597d706e 627 \param [in] value Value to be saturated
bogdanm 82:6473597d706e 628 \param [in] sat Bit position to saturate to (1..32)
bogdanm 82:6473597d706e 629 \return Saturated value
bogdanm 82:6473597d706e 630 */
bogdanm 82:6473597d706e 631 #define __SSAT(ARG1,ARG2) \
bogdanm 82:6473597d706e 632 ({ \
bogdanm 82:6473597d706e 633 uint32_t __RES, __ARG1 = (ARG1); \
bogdanm 82:6473597d706e 634 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
bogdanm 82:6473597d706e 635 __RES; \
bogdanm 82:6473597d706e 636 })
bogdanm 82:6473597d706e 637
bogdanm 82:6473597d706e 638
bogdanm 82:6473597d706e 639 /** \brief Unsigned Saturate
bogdanm 82:6473597d706e 640
bogdanm 82:6473597d706e 641 This function saturates an unsigned value.
bogdanm 82:6473597d706e 642
bogdanm 82:6473597d706e 643 \param [in] value Value to be saturated
bogdanm 82:6473597d706e 644 \param [in] sat Bit position to saturate to (0..31)
bogdanm 82:6473597d706e 645 \return Saturated value
bogdanm 82:6473597d706e 646 */
bogdanm 82:6473597d706e 647 #define __USAT(ARG1,ARG2) \
bogdanm 82:6473597d706e 648 ({ \
bogdanm 82:6473597d706e 649 uint32_t __RES, __ARG1 = (ARG1); \
bogdanm 82:6473597d706e 650 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
bogdanm 82:6473597d706e 651 __RES; \
bogdanm 82:6473597d706e 652 })
bogdanm 82:6473597d706e 653
bogdanm 82:6473597d706e 654
bogdanm 82:6473597d706e 655 /** \brief Count leading zeros
bogdanm 82:6473597d706e 656
bogdanm 82:6473597d706e 657 This function counts the number of leading zeros of a data value.
bogdanm 82:6473597d706e 658
bogdanm 82:6473597d706e 659 \param [in] value Value to count the leading zeros
bogdanm 82:6473597d706e 660 \return number of leading zeros in value
bogdanm 82:6473597d706e 661 */
bogdanm 82:6473597d706e 662 __attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value)
bogdanm 82:6473597d706e 663 {
bogdanm 82:6473597d706e 664 uint32_t result;
bogdanm 82:6473597d706e 665
bogdanm 82:6473597d706e 666 __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );
bogdanm 82:6473597d706e 667 return(result);
bogdanm 82:6473597d706e 668 }
bogdanm 82:6473597d706e 669
bogdanm 82:6473597d706e 670 #endif /* (__CORTEX_M >= 0x03) */
bogdanm 82:6473597d706e 671
bogdanm 82:6473597d706e 672
bogdanm 82:6473597d706e 673
bogdanm 82:6473597d706e 674
bogdanm 82:6473597d706e 675 #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
bogdanm 82:6473597d706e 676 /* TASKING carm specific functions */
bogdanm 82:6473597d706e 677
bogdanm 82:6473597d706e 678 /*
bogdanm 82:6473597d706e 679 * The CMSIS functions have been implemented as intrinsics in the compiler.
bogdanm 82:6473597d706e 680 * Please use "carm -?i" to get an up to date list of all intrinsics,
bogdanm 82:6473597d706e 681 * Including the CMSIS ones.
bogdanm 82:6473597d706e 682 */
bogdanm 82:6473597d706e 683
bogdanm 82:6473597d706e 684 #endif
bogdanm 82:6473597d706e 685
bogdanm 82:6473597d706e 686 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
bogdanm 82:6473597d706e 687
bogdanm 82:6473597d706e 688 #endif /* __CORE_CMINSTR_H */