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