1 /**************************************************************************//**
3 * @brief CMSIS Cortex-M Core Instruction Access Header File
9 ******************************************************************************/
10 /* Copyright (c) 2009 - 2014 ARM LIMITED
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 - Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 - Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 - Neither the name of ARM nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ---------------------------------------------------------------------------*/
38 #ifndef __CORE_CMINSTR_H
39 #define __CORE_CMINSTR_H
42 /* ########################## Core Instruction Access ######################### */
43 /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
44 Access to dedicated instructions
48 #if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
49 /* ARM armcc specific functions */
51 #if (__ARMCC_VERSION < 400677)
52 #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
56 /** \brief No Operation
58 No Operation does nothing. This instruction can be used for code alignment purposes.
63 /** \brief Wait For Interrupt
65 Wait For Interrupt is a hint instruction that suspends execution
66 until one of a number of events occurs.
71 /** \brief Wait For Event
73 Wait For Event is a hint instruction that permits the processor to enter
74 a low-power state until one of a number of events occurs.
81 Send Event is a hint instruction. It causes an event to be signaled to the CPU.
86 /** \brief Instruction Synchronization Barrier
88 Instruction Synchronization Barrier flushes the pipeline in the processor,
89 so that all instructions following the ISB are fetched from cache or
90 memory, after the instruction has been completed.
93 __schedule_barrier();\
95 __schedule_barrier();\
98 /** \brief Data Synchronization Barrier
100 This function acts as a special kind of Data Memory Barrier.
101 It completes when all explicit memory accesses before this instruction complete.
103 #define __DSB() do {\
104 __schedule_barrier();\
106 __schedule_barrier();\
109 /** \brief Data Memory Barrier
111 This function ensures the apparent order of the explicit memory operations before
112 and after the instruction, without ensuring their completion.
114 #define __DMB() do {\
115 __schedule_barrier();\
117 __schedule_barrier();\
120 /** \brief Reverse byte order (32 bit)
122 This function reverses the byte order in integer value.
124 \param [in] value Value to reverse
125 \return Reversed value
130 /** \brief Reverse byte order (16 bit)
132 This function reverses the byte order in two unsigned short values.
134 \param [in] value Value to reverse
135 \return Reversed value
137 #ifndef __NO_EMBEDDED_ASM
138 __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
145 /** \brief Reverse byte order in signed short value
147 This function reverses the byte order in a signed short value with sign extension to integer.
149 \param [in] value Value to reverse
150 \return Reversed value
152 #ifndef __NO_EMBEDDED_ASM
153 __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
161 /** \brief Rotate Right in unsigned value (32 bit)
163 This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
165 \param [in] value Value to rotate
166 \param [in] value Number of Bits to rotate
167 \return Rotated value
172 /** \brief Breakpoint
174 This function causes the processor to enter Debug state.
175 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
177 \param [in] value is ignored by the processor.
178 If required, a debugger can use it to store additional information about the breakpoint.
180 #define __BKPT(value) __breakpoint(value)
183 /** \brief Reverse bit order of value
185 This function reverses the bit order of the given value.
187 \param [in] value Value to reverse
188 \return Reversed value
190 #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
191 #define __RBIT __rbit
193 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
196 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; // extra shift needed at end
198 result = value; // r will be reversed bits of v; first get LSB of v
199 for (value >>= 1; value; value >>= 1)
205 result <<= s; // shift when v's highest bits are zero
211 /** \brief Count leading zeros
213 This function counts the number of leading zeros of a data value.
215 \param [in] value Value to count the leading zeros
216 \return number of leading zeros in value
221 #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
223 /** \brief LDR Exclusive (8 bit)
225 This function executes a exclusive LDR instruction for 8 bit value.
227 \param [in] ptr Pointer to data
228 \return value of type uint8_t at (*ptr)
230 #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
233 /** \brief LDR Exclusive (16 bit)
235 This function executes a exclusive LDR instruction for 16 bit values.
237 \param [in] ptr Pointer to data
238 \return value of type uint16_t at (*ptr)
240 #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
243 /** \brief LDR Exclusive (32 bit)
245 This function executes a exclusive LDR instruction for 32 bit values.
247 \param [in] ptr Pointer to data
248 \return value of type uint32_t at (*ptr)
250 #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
253 /** \brief STR Exclusive (8 bit)
255 This function executes a exclusive STR instruction for 8 bit values.
257 \param [in] value Value to store
258 \param [in] ptr Pointer to location
259 \return 0 Function succeeded
260 \return 1 Function failed
262 #define __STREXB(value, ptr) __strex(value, ptr)
265 /** \brief STR Exclusive (16 bit)
267 This function executes a exclusive STR instruction for 16 bit values.
269 \param [in] value Value to store
270 \param [in] ptr Pointer to location
271 \return 0 Function succeeded
272 \return 1 Function failed
274 #define __STREXH(value, ptr) __strex(value, ptr)
277 /** \brief STR Exclusive (32 bit)
279 This function executes a exclusive STR instruction for 32 bit values.
281 \param [in] value Value to store
282 \param [in] ptr Pointer to location
283 \return 0 Function succeeded
284 \return 1 Function failed
286 #define __STREXW(value, ptr) __strex(value, ptr)
289 /** \brief Remove the exclusive lock
291 This function removes the exclusive lock which is created by LDREX.
294 #define __CLREX __clrex
297 /** \brief Signed Saturate
299 This function saturates a signed value.
301 \param [in] value Value to be saturated
302 \param [in] sat Bit position to saturate to (1..32)
303 \return Saturated value
305 #define __SSAT __ssat
308 /** \brief Unsigned Saturate
310 This function saturates an unsigned value.
312 \param [in] value Value to be saturated
313 \param [in] sat Bit position to saturate to (0..31)
314 \return Saturated value
316 #define __USAT __usat
319 /** \brief Rotate Right with Extend (32 bit)
321 This function moves each bit of a bitstring right by one bit.
322 The carry input is shifted in at the left end of the bitstring.
324 \param [in] value Value to rotate
325 \return Rotated value
327 #ifndef __NO_EMBEDDED_ASM
328 __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
336 /** \brief LDRT Unprivileged (8 bit)
338 This function executes a Unprivileged LDRT instruction for 8 bit value.
340 \param [in] ptr Pointer to data
341 \return value of type uint8_t at (*ptr)
343 #define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
346 /** \brief LDRT Unprivileged (16 bit)
348 This function executes a Unprivileged LDRT instruction for 16 bit values.
350 \param [in] ptr Pointer to data
351 \return value of type uint16_t at (*ptr)
353 #define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
356 /** \brief LDRT Unprivileged (32 bit)
358 This function executes a Unprivileged LDRT instruction for 32 bit values.
360 \param [in] ptr Pointer to data
361 \return value of type uint32_t at (*ptr)
363 #define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
366 /** \brief STRT Unprivileged (8 bit)
368 This function executes a Unprivileged STRT instruction for 8 bit values.
370 \param [in] value Value to store
371 \param [in] ptr Pointer to location
373 #define __STRBT(value, ptr) __strt(value, ptr)
376 /** \brief STRT Unprivileged (16 bit)
378 This function executes a Unprivileged STRT instruction for 16 bit values.
380 \param [in] value Value to store
381 \param [in] ptr Pointer to location
383 #define __STRHT(value, ptr) __strt(value, ptr)
386 /** \brief STRT Unprivileged (32 bit)
388 This function executes a Unprivileged STRT instruction for 32 bit values.
390 \param [in] value Value to store
391 \param [in] ptr Pointer to location
393 #define __STRT(value, ptr) __strt(value, ptr)
395 #endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */
398 #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
399 /* GNU gcc specific functions */
401 /* Define macros for porting to both thumb1 and thumb2.
402 * For thumb1, use low register (r0-r7), specified by constrant "l"
403 * Otherwise, use general registers, specified by constrant "r" */
404 #if defined (__thumb__) && !defined (__thumb2__)
405 #define __CMSIS_GCC_OUT_REG(r) "=l" (r)
406 #define __CMSIS_GCC_USE_REG(r) "l" (r)
408 #define __CMSIS_GCC_OUT_REG(r) "=r" (r)
409 #define __CMSIS_GCC_USE_REG(r) "r" (r)
412 /** \brief No Operation
414 No Operation does nothing. This instruction can be used for code alignment purposes.
416 __attribute__((always_inline)) __STATIC_INLINE void __NOP(void)
418 __ASM volatile ("nop");
422 /** \brief Wait For Interrupt
424 Wait For Interrupt is a hint instruction that suspends execution
425 until one of a number of events occurs.
427 __attribute__((always_inline)) __STATIC_INLINE void __WFI(void)
429 __ASM volatile ("wfi");
433 /** \brief Wait For Event
435 Wait For Event is a hint instruction that permits the processor to enter
436 a low-power state until one of a number of events occurs.
438 __attribute__((always_inline)) __STATIC_INLINE void __WFE(void)
440 __ASM volatile ("wfe");
444 /** \brief Send Event
446 Send Event is a hint instruction. It causes an event to be signaled to the CPU.
448 __attribute__((always_inline)) __STATIC_INLINE void __SEV(void)
450 __ASM volatile ("sev");
454 /** \brief Instruction Synchronization Barrier
456 Instruction Synchronization Barrier flushes the pipeline in the processor,
457 so that all instructions following the ISB are fetched from cache or
458 memory, after the instruction has been completed.
460 __attribute__((always_inline)) __STATIC_INLINE void __ISB(void)
462 __ASM volatile ("isb 0xF":::"memory");
466 /** \brief Data Synchronization Barrier
468 This function acts as a special kind of Data Memory Barrier.
469 It completes when all explicit memory accesses before this instruction complete.
471 __attribute__((always_inline)) __STATIC_INLINE void __DSB(void)
473 __ASM volatile ("dsb 0xF":::"memory");
477 /** \brief Data Memory Barrier
479 This function ensures the apparent order of the explicit memory operations before
480 and after the instruction, without ensuring their completion.
482 __attribute__((always_inline)) __STATIC_INLINE void __DMB(void)
484 __ASM volatile ("dmb 0xF":::"memory");
488 /** \brief Reverse byte order (32 bit)
490 This function reverses the byte order in integer value.
492 \param [in] value Value to reverse
493 \return Reversed value
495 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value)
497 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
498 return __builtin_bswap32(value);
502 __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
508 /** \brief Reverse byte order (16 bit)
510 This function reverses the byte order in two unsigned short values.
512 \param [in] value Value to reverse
513 \return Reversed value
515 __attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
519 __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
524 /** \brief Reverse byte order in signed short value
526 This function reverses the byte order in a signed short value with sign extension to integer.
528 \param [in] value Value to reverse
529 \return Reversed value
531 __attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value)
533 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
534 return (short)__builtin_bswap16(value);
538 __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
544 /** \brief Rotate Right in unsigned value (32 bit)
546 This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
548 \param [in] value Value to rotate
549 \param [in] value Number of Bits to rotate
550 \return Rotated value
552 __attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
554 return (op1 >> op2) | (op1 << (32 - op2));
558 /** \brief Breakpoint
560 This function causes the processor to enter Debug state.
561 Debug tools can use this to investigate system state when the instruction at a particular address is reached.
563 \param [in] value is ignored by the processor.
564 If required, a debugger can use it to store additional information about the breakpoint.
566 #define __BKPT(value) __ASM volatile ("bkpt "#value)
569 /** \brief Reverse bit order of value
571 This function reverses the bit order of the given value.
573 \param [in] value Value to reverse
574 \return Reversed value
576 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
580 #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
581 __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
583 int32_t s = 4 /*sizeof(v)*/ * 8 - 1; // extra shift needed at end
585 result = value; // r will be reversed bits of v; first get LSB of v
586 for (value >>= 1; value; value >>= 1)
592 result <<= s; // shift when v's highest bits are zero
598 /** \brief Count leading zeros
600 This function counts the number of leading zeros of a data value.
602 \param [in] value Value to count the leading zeros
603 \return number of leading zeros in value
605 #define __CLZ __builtin_clz
608 #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300)
610 /** \brief LDR Exclusive (8 bit)
612 This function executes a exclusive LDR instruction for 8 bit value.
614 \param [in] ptr Pointer to data
615 \return value of type uint8_t at (*ptr)
617 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
621 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
622 __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
624 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
625 accepted by assembler. So has to use following less efficient pattern.
627 __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
629 return ((uint8_t) result); /* Add explicit type cast here */
633 /** \brief LDR Exclusive (16 bit)
635 This function executes a exclusive LDR instruction for 16 bit values.
637 \param [in] ptr Pointer to data
638 \return value of type uint16_t at (*ptr)
640 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
644 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
645 __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
647 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
648 accepted by assembler. So has to use following less efficient pattern.
650 __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
652 return ((uint16_t) result); /* Add explicit type cast here */
656 /** \brief LDR Exclusive (32 bit)
658 This function executes a exclusive LDR instruction for 32 bit values.
660 \param [in] ptr Pointer to data
661 \return value of type uint32_t at (*ptr)
663 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
667 __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
672 /** \brief STR Exclusive (8 bit)
674 This function executes a exclusive STR instruction for 8 bit values.
676 \param [in] value Value to store
677 \param [in] ptr Pointer to location
678 \return 0 Function succeeded
679 \return 1 Function failed
681 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
685 __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
690 /** \brief STR Exclusive (16 bit)
692 This function executes a exclusive STR instruction for 16 bit values.
694 \param [in] value Value to store
695 \param [in] ptr Pointer to location
696 \return 0 Function succeeded
697 \return 1 Function failed
699 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
703 __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
708 /** \brief STR Exclusive (32 bit)
710 This function executes a exclusive STR instruction for 32 bit values.
712 \param [in] value Value to store
713 \param [in] ptr Pointer to location
714 \return 0 Function succeeded
715 \return 1 Function failed
717 __attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
721 __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
726 /** \brief Remove the exclusive lock
728 This function removes the exclusive lock which is created by LDREX.
731 __attribute__((always_inline)) __STATIC_INLINE void __CLREX(void)
733 __ASM volatile ("clrex" ::: "memory");
737 /** \brief Signed Saturate
739 This function saturates a signed value.
741 \param [in] value Value to be saturated
742 \param [in] sat Bit position to saturate to (1..32)
743 \return Saturated value
745 #define __SSAT(ARG1,ARG2) \
747 uint32_t __RES, __ARG1 = (ARG1); \
748 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
753 /** \brief Unsigned Saturate
755 This function saturates an unsigned value.
757 \param [in] value Value to be saturated
758 \param [in] sat Bit position to saturate to (0..31)
759 \return Saturated value
761 #define __USAT(ARG1,ARG2) \
763 uint32_t __RES, __ARG1 = (ARG1); \
764 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
769 /** \brief Rotate Right with Extend (32 bit)
771 This function moves each bit of a bitstring right by one bit.
772 The carry input is shifted in at the left end of the bitstring.
774 \param [in] value Value to rotate
775 \return Rotated value
777 __attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value)
781 __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
786 /** \brief LDRT Unprivileged (8 bit)
788 This function executes a Unprivileged LDRT instruction for 8 bit value.
790 \param [in] ptr Pointer to data
791 \return value of type uint8_t at (*ptr)
793 __attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *addr)
797 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
798 __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*addr) );
800 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
801 accepted by assembler. So has to use following less efficient pattern.
803 __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
805 return ((uint8_t) result); /* Add explicit type cast here */
809 /** \brief LDRT Unprivileged (16 bit)
811 This function executes a Unprivileged LDRT instruction for 16 bit values.
813 \param [in] ptr Pointer to data
814 \return value of type uint16_t at (*ptr)
816 __attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *addr)
820 #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
821 __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*addr) );
823 /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
824 accepted by assembler. So has to use following less efficient pattern.
826 __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
828 return ((uint16_t) result); /* Add explicit type cast here */
832 /** \brief LDRT Unprivileged (32 bit)
834 This function executes a Unprivileged LDRT instruction for 32 bit values.
836 \param [in] ptr Pointer to data
837 \return value of type uint32_t at (*ptr)
839 __attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *addr)
843 __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) );
848 /** \brief STRT Unprivileged (8 bit)
850 This function executes a Unprivileged STRT instruction for 8 bit values.
852 \param [in] value Value to store
853 \param [in] ptr Pointer to location
855 __attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *addr)
857 __ASM volatile ("strbt %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
861 /** \brief STRT Unprivileged (16 bit)
863 This function executes a Unprivileged STRT instruction for 16 bit values.
865 \param [in] value Value to store
866 \param [in] ptr Pointer to location
868 __attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *addr)
870 __ASM volatile ("strht %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) );
874 /** \brief STRT Unprivileged (32 bit)
876 This function executes a Unprivileged STRT instruction for 32 bit values.
878 \param [in] value Value to store
879 \param [in] ptr Pointer to location
881 __attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *addr)
883 __ASM volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) );
886 #endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */
889 #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
890 /* IAR iccarm specific functions */
891 #include <cmsis_iar.h>
894 #elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
895 /* TI CCS specific functions */
896 #include <cmsis_ccs.h>
899 #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
900 /* TASKING carm specific functions */
902 * The CMSIS functions have been implemented as intrinsics in the compiler.
903 * Please use "carm -?i" to get an up to date list of all intrinsics,
904 * Including the CMSIS ones.
908 #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/
909 /* Cosmic specific functions */
910 #include <cmsis_csm.h>
914 /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
916 #endif /* __CORE_CMINSTR_H */