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