29#ifndef __CMSIS_ICCARM_H__
30#define __CMSIS_ICCARM_H__
33 #error This file should only be compiled by ICCARM
38#define __IAR_FT _Pragma("inline=forced") __intrinsic
40#if (__VER__ >= 8000000)
48 #define __ALIGNED(x) __attribute__((aligned(x)))
49 #elif (__VER__ >= 7080000)
51 #define __ALIGNED(x) __attribute__((aligned(x)))
53 #warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored.
61#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__
64 #if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__)
65 #define __ARM_ARCH_8M_MAIN__ 1
66 #elif defined(__ARM8M_BASELINE__)
67 #define __ARM_ARCH_8M_BASE__ 1
68 #elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M'
70 #define __ARM_ARCH_6M__ 1
73 #define __ARM_ARCH_7EM__ 1
75 #define __ARM_ARCH_7M__ 1
82#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \
83 !defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__)
84 #if defined(__ARM6M__) && (__CORE__ == __ARM6M__)
85 #define __ARM_ARCH_6M__ 1
86 #elif defined(__ARM7M__) && (__CORE__ == __ARM7M__)
87 #define __ARM_ARCH_7M__ 1
88 #elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)
89 #define __ARM_ARCH_7EM__ 1
90 #elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__)
91 #define __ARM_ARCH_8M_BASE__ 1
92 #elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__)
93 #define __ARM_ARCH_8M_MAIN__ 1
94 #elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__)
95 #define __ARM_ARCH_8M_MAIN__ 1
97 #error "Unknown target."
103#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1
104 #define __IAR_M0_FAMILY 1
105#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1
106 #define __IAR_M0_FAMILY 1
108 #define __IAR_M0_FAMILY 0
112 #define __NO_INIT __attribute__ ((section (".noinit")))
115 #define __ALIAS(x) __attribute__ ((alias(x)))
122#ifndef __COMPILER_BARRIER
123 #define __COMPILER_BARRIER() __ASM volatile("":::"memory")
127 #define __INLINE inline
132 #define __NO_RETURN __attribute__((__noreturn__))
134 #define __NO_RETURN _Pragma("object_attribute=__noreturn")
140 #define __PACKED __attribute__((packed, aligned(1)))
143 #define __PACKED __packed
147#ifndef __PACKED_STRUCT
149 #define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
152 #define __PACKED_STRUCT __packed struct
156#ifndef __PACKED_UNION
158 #define __PACKED_UNION union __attribute__((packed, aligned(1)))
161 #define __PACKED_UNION __packed union
167 #define __RESTRICT __restrict
170 #define __RESTRICT restrict
174#ifndef __STATIC_INLINE
175 #define __STATIC_INLINE static inline
179 #define __FORCEINLINE _Pragma("inline=forced")
182#ifndef __STATIC_FORCEINLINE
183 #define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE
186#ifndef __UNALIGNED_UINT16_READ
188#pragma language=extended
189__IAR_FT uint16_t __iar_uint16_read(
void const *ptr)
191 return *(__packed uint16_t*)(ptr);
193#pragma language=restore
194#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR)
198#ifndef __UNALIGNED_UINT16_WRITE
200#pragma language=extended
201__IAR_FT
void __iar_uint16_write(
void const *ptr, uint16_t val)
203 *(__packed uint16_t*)(ptr) = val;;
205#pragma language=restore
206#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL)
209#ifndef __UNALIGNED_UINT32_READ
211#pragma language=extended
212__IAR_FT uint32_t __iar_uint32_read(
void const *ptr)
214 return *(__packed uint32_t*)(ptr);
216#pragma language=restore
217#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR)
220#ifndef __UNALIGNED_UINT32_WRITE
222#pragma language=extended
223__IAR_FT
void __iar_uint32_write(
void const *ptr, uint32_t val)
225 *(__packed uint32_t*)(ptr) = val;;
227#pragma language=restore
228#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL)
231#ifndef __UNALIGNED_UINT32
233#pragma language=extended
235#pragma language=restore
236#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v)
241 #define __USED __attribute__((used))
243 #define __USED _Pragma("__root")
250 #define __WEAK __attribute__((weak))
252 #define __WEAK _Pragma("__weak")
256#ifndef __PROGRAM_START
257#define __PROGRAM_START __iar_program_start
261#define __INITIAL_SP CSTACK$$Limit
265#define __STACK_LIMIT CSTACK$$Base
268#ifndef __VECTOR_TABLE
269#define __VECTOR_TABLE __vector_table
272#ifndef __VECTOR_TABLE_ATTRIBUTE
273#define __VECTOR_TABLE_ATTRIBUTE @".intvec"
276#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
278#define __STACK_SEAL STACKSEAL$$Base
281#ifndef __TZ_STACK_SEAL_SIZE
282#define __TZ_STACK_SEAL_SIZE 8U
285#ifndef __TZ_STACK_SEAL_VALUE
286#define __TZ_STACK_SEAL_VALUE 0xFEF5EDA5FEF5EDA5ULL
289__STATIC_FORCEINLINE
void __TZ_set_STACKSEAL_S (uint32_t* stackTop) {
290 *((uint64_t *)stackTop) = __TZ_STACK_SEAL_VALUE;
294#ifndef __ICCARM_INTRINSICS_VERSION__
295 #define __ICCARM_INTRINSICS_VERSION__ 0
298#if __ICCARM_INTRINSICS_VERSION__ == 2
316 #include "iccarm_builtin.h"
318 #define __disable_fault_irq __iar_builtin_disable_fiq
319 #define __disable_irq __iar_builtin_disable_interrupt
320 #define __enable_fault_irq __iar_builtin_enable_fiq
321 #define __enable_irq __iar_builtin_enable_interrupt
322 #define __arm_rsr __iar_builtin_rsr
323 #define __arm_wsr __iar_builtin_wsr
326 #define __get_APSR() (__arm_rsr("APSR"))
327 #define __get_BASEPRI() (__arm_rsr("BASEPRI"))
328 #define __get_CONTROL() (__arm_rsr("CONTROL"))
329 #define __get_FAULTMASK() (__arm_rsr("FAULTMASK"))
331 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
332 (defined (__FPU_USED ) && (__FPU_USED == 1U)) )
333 #define __get_FPSCR() (__arm_rsr("FPSCR"))
334 #define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE)))
336 #define __get_FPSCR() ( 0 )
337 #define __set_FPSCR(VALUE) ((void)VALUE)
340 #define __get_IPSR() (__arm_rsr("IPSR"))
341 #define __get_MSP() (__arm_rsr("MSP"))
342 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
343 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
345 #define __get_MSPLIM() (0U)
347 #define __get_MSPLIM() (__arm_rsr("MSPLIM"))
349 #define __get_PRIMASK() (__arm_rsr("PRIMASK"))
350 #define __get_PSP() (__arm_rsr("PSP"))
352 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
353 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
355 #define __get_PSPLIM() (0U)
357 #define __get_PSPLIM() (__arm_rsr("PSPLIM"))
360 #define __get_xPSR() (__arm_rsr("xPSR"))
362 #define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE)))
363 #define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE)))
367 __arm_wsr(
"CONTROL", control);
371 #define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE)))
372 #define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE)))
374 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
375 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
377 #define __set_MSPLIM(VALUE) ((void)(VALUE))
379 #define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE)))
381 #define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE)))
382 #define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE)))
383 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
384 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
386 #define __set_PSPLIM(VALUE) ((void)(VALUE))
388 #define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE)))
391 #define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS"))
393__STATIC_FORCEINLINE
void __TZ_set_CONTROL_NS(uint32_t control)
395 __arm_wsr(
"CONTROL_NS", control);
399 #define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS"))
400 #define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE)))
401 #define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS"))
402 #define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE)))
403 #define __TZ_get_SP_NS() (__arm_rsr("SP_NS"))
404 #define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE)))
405 #define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS"))
406 #define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE)))
407 #define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS"))
408 #define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE)))
409 #define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS"))
410 #define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE)))
412 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
413 (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
415 #define __TZ_get_PSPLIM_NS() (0U)
416 #define __TZ_set_PSPLIM_NS(VALUE) ((void)(VALUE))
418 #define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS"))
419 #define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE)))
422 #define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS"))
423 #define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE)))
425 #define __NOP __iar_builtin_no_operation
427 #define __CLZ __iar_builtin_CLZ
428 #define __CLREX __iar_builtin_CLREX
430 #define __DMB __iar_builtin_DMB
431 #define __DSB __iar_builtin_DSB
432 #define __ISB __iar_builtin_ISB
434 #define __LDREXB __iar_builtin_LDREXB
435 #define __LDREXH __iar_builtin_LDREXH
436 #define __LDREXW __iar_builtin_LDREX
438 #define __RBIT __iar_builtin_RBIT
439 #define __REV __iar_builtin_REV
440 #define __REV16 __iar_builtin_REV16
442 __IAR_FT int16_t
__REVSH(int16_t val)
444 return (int16_t) __iar_builtin_REVSH(val);
447 #define __ROR __iar_builtin_ROR
448 #define __RRX __iar_builtin_RRX
450 #define __SEV __iar_builtin_SEV
453 #define __SSAT __iar_builtin_SSAT
456 #define __STREXB __iar_builtin_STREXB
457 #define __STREXH __iar_builtin_STREXH
458 #define __STREXW __iar_builtin_STREX
461 #define __USAT __iar_builtin_USAT
464 #define __WFE __iar_builtin_WFE
465 #define __WFI __iar_builtin_WFI
468 #define __SADD8 __iar_builtin_SADD8
469 #define __QADD8 __iar_builtin_QADD8
470 #define __SHADD8 __iar_builtin_SHADD8
471 #define __UADD8 __iar_builtin_UADD8
472 #define __UQADD8 __iar_builtin_UQADD8
473 #define __UHADD8 __iar_builtin_UHADD8
474 #define __SSUB8 __iar_builtin_SSUB8
475 #define __QSUB8 __iar_builtin_QSUB8
476 #define __SHSUB8 __iar_builtin_SHSUB8
477 #define __USUB8 __iar_builtin_USUB8
478 #define __UQSUB8 __iar_builtin_UQSUB8
479 #define __UHSUB8 __iar_builtin_UHSUB8
480 #define __SADD16 __iar_builtin_SADD16
481 #define __QADD16 __iar_builtin_QADD16
482 #define __SHADD16 __iar_builtin_SHADD16
483 #define __UADD16 __iar_builtin_UADD16
484 #define __UQADD16 __iar_builtin_UQADD16
485 #define __UHADD16 __iar_builtin_UHADD16
486 #define __SSUB16 __iar_builtin_SSUB16
487 #define __QSUB16 __iar_builtin_QSUB16
488 #define __SHSUB16 __iar_builtin_SHSUB16
489 #define __USUB16 __iar_builtin_USUB16
490 #define __UQSUB16 __iar_builtin_UQSUB16
491 #define __UHSUB16 __iar_builtin_UHSUB16
492 #define __SASX __iar_builtin_SASX
493 #define __QASX __iar_builtin_QASX
494 #define __SHASX __iar_builtin_SHASX
495 #define __UASX __iar_builtin_UASX
496 #define __UQASX __iar_builtin_UQASX
497 #define __UHASX __iar_builtin_UHASX
498 #define __SSAX __iar_builtin_SSAX
499 #define __QSAX __iar_builtin_QSAX
500 #define __SHSAX __iar_builtin_SHSAX
501 #define __USAX __iar_builtin_USAX
502 #define __UQSAX __iar_builtin_UQSAX
503 #define __UHSAX __iar_builtin_UHSAX
504 #define __USAD8 __iar_builtin_USAD8
505 #define __USADA8 __iar_builtin_USADA8
506 #define __SSAT16 __iar_builtin_SSAT16
507 #define __USAT16 __iar_builtin_USAT16
508 #define __UXTB16 __iar_builtin_UXTB16
509 #define __UXTAB16 __iar_builtin_UXTAB16
510 #define __SXTB16 __iar_builtin_SXTB16
511 #define __SXTAB16 __iar_builtin_SXTAB16
512 #define __SMUAD __iar_builtin_SMUAD
513 #define __SMUADX __iar_builtin_SMUADX
514 #define __SMMLA __iar_builtin_SMMLA
515 #define __SMLAD __iar_builtin_SMLAD
516 #define __SMLADX __iar_builtin_SMLADX
517 #define __SMLALD __iar_builtin_SMLALD
518 #define __SMLALDX __iar_builtin_SMLALDX
519 #define __SMUSD __iar_builtin_SMUSD
520 #define __SMUSDX __iar_builtin_SMUSDX
521 #define __SMLSD __iar_builtin_SMLSD
522 #define __SMLSDX __iar_builtin_SMLSDX
523 #define __SMLSLD __iar_builtin_SMLSLD
524 #define __SMLSLDX __iar_builtin_SMLSLDX
525 #define __SEL __iar_builtin_SEL
526 #define __QADD __iar_builtin_QADD
527 #define __QSUB __iar_builtin_QSUB
528 #define __PKHBT __iar_builtin_PKHBT
529 #define __PKHTB __iar_builtin_PKHTB
536 #define __CLZ __cmsis_iar_clz_not_active
537 #define __SSAT __cmsis_iar_ssat_not_active
538 #define __USAT __cmsis_iar_usat_not_active
539 #define __RBIT __cmsis_iar_rbit_not_active
540 #define __get_APSR __cmsis_iar_get_APSR_not_active
544 #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
545 (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
546 #define __get_FPSCR __cmsis_iar_get_FPSR_not_active
547 #define __set_FPSCR __cmsis_iar_set_FPSR_not_active
550 #ifdef __INTRINSICS_INCLUDED
551 #error intrinsics.h is already included previously!
554 #include <intrinsics.h>
564 __STATIC_INLINE uint8_t
__CLZ(uint32_t data)
566 if (data == 0U) {
return 32U; }
569 uint32_t mask = 0x80000000U;
571 while ((data & mask) == 0U)
579 __STATIC_INLINE uint32_t
__RBIT(uint32_t v)
583 for (v >>= 1U; v; v >>= 1U)
595 __asm(
"MRS %0,APSR" :
"=r" (res));
601 #if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
602 (defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
605 #define __get_FPSCR() (0)
606 #define __set_FPSCR(VALUE) ((void)VALUE)
609 #pragma diag_suppress=Pe940
610 #pragma diag_suppress=Pe177
612 #define __enable_irq __enable_interrupt
613 #define __disable_irq __disable_interrupt
614 #define __NOP __no_operation
616 #define __get_xPSR __get_PSR
618 #if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0)
620 __IAR_FT uint32_t __LDREXW(uint32_t
volatile *ptr)
622 return __LDREX((
unsigned long *)ptr);
625 __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t
volatile *ptr)
627 return __STREX(value, (
unsigned long *)ptr);
633 #if (__CORTEX_M >= 0x03)
635 __IAR_FT uint32_t __RRX(uint32_t value)
638 __ASM
volatile(
"RRX %0, %1" :
"=r"(result) :
"r" (value));
642 __IAR_FT
void __set_BASEPRI_MAX(uint32_t value)
644 __asm
volatile(
"MSR BASEPRI_MAX,%0"::
"r" (value));
648 #define __enable_fault_irq __enable_fiq
649 #define __disable_fault_irq __disable_fiq
654 __IAR_FT uint32_t
__ROR(uint32_t op1, uint32_t op2)
656 return (op1 >> op2) | (op1 << ((
sizeof(op1)*8)-op2));
659 #if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
660 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
662 __IAR_FT uint32_t __get_MSPLIM(
void)
665 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
666 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
670 __asm
volatile(
"MRS %0,MSPLIM" :
"=r" (res));
675 __IAR_FT
void __set_MSPLIM(uint32_t value)
677 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
678 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
682 __asm
volatile(
"MSR MSPLIM,%0" ::
"r" (value));
686 __IAR_FT uint32_t __get_PSPLIM(
void)
689 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
690 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
694 __asm
volatile(
"MRS %0,PSPLIM" :
"=r" (res));
699 __IAR_FT
void __set_PSPLIM(uint32_t value)
701 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
702 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
706 __asm
volatile(
"MSR PSPLIM,%0" ::
"r" (value));
710 __IAR_FT uint32_t __TZ_get_CONTROL_NS(
void)
713 __asm
volatile(
"MRS %0,CONTROL_NS" :
"=r" (res));
717 __IAR_FT
void __TZ_set_CONTROL_NS(uint32_t value)
719 __asm
volatile(
"MSR CONTROL_NS,%0" ::
"r" (value));
723 __IAR_FT uint32_t __TZ_get_PSP_NS(
void)
726 __asm
volatile(
"MRS %0,PSP_NS" :
"=r" (res));
730 __IAR_FT
void __TZ_set_PSP_NS(uint32_t value)
732 __asm
volatile(
"MSR PSP_NS,%0" ::
"r" (value));
735 __IAR_FT uint32_t __TZ_get_MSP_NS(
void)
738 __asm
volatile(
"MRS %0,MSP_NS" :
"=r" (res));
742 __IAR_FT
void __TZ_set_MSP_NS(uint32_t value)
744 __asm
volatile(
"MSR MSP_NS,%0" ::
"r" (value));
747 __IAR_FT uint32_t __TZ_get_SP_NS(
void)
750 __asm
volatile(
"MRS %0,SP_NS" :
"=r" (res));
753 __IAR_FT
void __TZ_set_SP_NS(uint32_t value)
755 __asm
volatile(
"MSR SP_NS,%0" ::
"r" (value));
758 __IAR_FT uint32_t __TZ_get_PRIMASK_NS(
void)
761 __asm
volatile(
"MRS %0,PRIMASK_NS" :
"=r" (res));
765 __IAR_FT
void __TZ_set_PRIMASK_NS(uint32_t value)
767 __asm
volatile(
"MSR PRIMASK_NS,%0" ::
"r" (value));
770 __IAR_FT uint32_t __TZ_get_BASEPRI_NS(
void)
773 __asm
volatile(
"MRS %0,BASEPRI_NS" :
"=r" (res));
777 __IAR_FT
void __TZ_set_BASEPRI_NS(uint32_t value)
779 __asm
volatile(
"MSR BASEPRI_NS,%0" ::
"r" (value));
782 __IAR_FT uint32_t __TZ_get_FAULTMASK_NS(
void)
785 __asm
volatile(
"MRS %0,FAULTMASK_NS" :
"=r" (res));
789 __IAR_FT
void __TZ_set_FAULTMASK_NS(uint32_t value)
791 __asm
volatile(
"MSR FAULTMASK_NS,%0" ::
"r" (value));
794 __IAR_FT uint32_t __TZ_get_PSPLIM_NS(
void)
797 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
798 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
802 __asm
volatile(
"MRS %0,PSPLIM_NS" :
"=r" (res));
807 __IAR_FT
void __TZ_set_PSPLIM_NS(uint32_t value)
809 #if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
810 (!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
814 __asm
volatile(
"MSR PSPLIM_NS,%0" ::
"r" (value));
818 __IAR_FT uint32_t __TZ_get_MSPLIM_NS(
void)
821 __asm
volatile(
"MRS %0,MSPLIM_NS" :
"=r" (res));
825 __IAR_FT
void __TZ_set_MSPLIM_NS(uint32_t value)
827 __asm
volatile(
"MSR MSPLIM_NS,%0" ::
"r" (value));
834#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value))
837 __STATIC_INLINE int32_t
__SSAT(int32_t val, uint32_t sat)
839 if ((sat >= 1U) && (sat <= 32U))
841 const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
842 const int32_t min = -1 - max ;
855 __STATIC_INLINE uint32_t
__USAT(int32_t val, uint32_t sat)
859 const uint32_t max = ((1U << sat) - 1U);
860 if (val > (int32_t)max)
869 return (uint32_t)val;
873#if (__CORTEX_M >= 0x03)
875 __IAR_FT uint8_t __LDRBT(
volatile uint8_t *addr)
878 __ASM
volatile (
"LDRBT %0, [%1]" :
"=r" (res) :
"r" (addr) :
"memory");
879 return ((uint8_t)res);
882 __IAR_FT uint16_t __LDRHT(
volatile uint16_t *addr)
885 __ASM
volatile (
"LDRHT %0, [%1]" :
"=r" (res) :
"r" (addr) :
"memory");
886 return ((uint16_t)res);
889 __IAR_FT uint32_t __LDRT(
volatile uint32_t *addr)
892 __ASM
volatile (
"LDRT %0, [%1]" :
"=r" (res) :
"r" (addr) :
"memory");
896 __IAR_FT
void __STRBT(uint8_t value,
volatile uint8_t *addr)
898 __ASM
volatile (
"STRBT %1, [%0]" : :
"r" (addr),
"r" ((uint32_t)value) :
"memory");
901 __IAR_FT
void __STRHT(uint16_t value,
volatile uint16_t *addr)
903 __ASM
volatile (
"STRHT %1, [%0]" : :
"r" (addr),
"r" ((uint32_t)value) :
"memory");
906 __IAR_FT
void __STRT(uint32_t value,
volatile uint32_t *addr)
908 __ASM
volatile (
"STRT %1, [%0]" : :
"r" (addr),
"r" (value) :
"memory");
913#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
914 (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
917 __IAR_FT uint8_t __LDAB(
volatile uint8_t *ptr)
920 __ASM
volatile (
"LDAB %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
921 return ((uint8_t)res);
924 __IAR_FT uint16_t __LDAH(
volatile uint16_t *ptr)
927 __ASM
volatile (
"LDAH %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
928 return ((uint16_t)res);
931 __IAR_FT uint32_t __LDA(
volatile uint32_t *ptr)
934 __ASM
volatile (
"LDA %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
938 __IAR_FT
void __STLB(uint8_t value,
volatile uint8_t *ptr)
940 __ASM
volatile (
"STLB %1, [%0]" ::
"r" (ptr),
"r" (value) :
"memory");
943 __IAR_FT
void __STLH(uint16_t value,
volatile uint16_t *ptr)
945 __ASM
volatile (
"STLH %1, [%0]" ::
"r" (ptr),
"r" (value) :
"memory");
948 __IAR_FT
void __STL(uint32_t value,
volatile uint32_t *ptr)
950 __ASM
volatile (
"STL %1, [%0]" ::
"r" (ptr),
"r" (value) :
"memory");
953 __IAR_FT uint8_t __LDAEXB(
volatile uint8_t *ptr)
956 __ASM
volatile (
"LDAEXB %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
957 return ((uint8_t)res);
960 __IAR_FT uint16_t __LDAEXH(
volatile uint16_t *ptr)
963 __ASM
volatile (
"LDAEXH %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
964 return ((uint16_t)res);
967 __IAR_FT uint32_t __LDAEX(
volatile uint32_t *ptr)
970 __ASM
volatile (
"LDAEX %0, [%1]" :
"=r" (res) :
"r" (ptr) :
"memory");
974 __IAR_FT uint32_t __STLEXB(uint8_t value,
volatile uint8_t *ptr)
977 __ASM
volatile (
"STLEXB %0, %2, [%1]" :
"=r" (res) :
"r" (ptr),
"r" (value) :
"memory");
981 __IAR_FT uint32_t __STLEXH(uint16_t value,
volatile uint16_t *ptr)
984 __ASM
volatile (
"STLEXH %0, %2, [%1]" :
"=r" (res) :
"r" (ptr),
"r" (value) :
"memory");
988 __IAR_FT uint32_t __STLEX(uint32_t value,
volatile uint32_t *ptr)
991 __ASM
volatile (
"STLEX %0, %2, [%1]" :
"=r" (res) :
"r" (ptr),
"r" (value) :
"memory");
998#undef __IAR_M0_FAMILY
1001#pragma diag_default=Pe940
1002#pragma diag_default=Pe177
1004#define __SXTB16_RORn(ARG1, ARG2) __SXTB16(__ROR(ARG1, ARG2))
1006#define __SXTAB16_RORn(ARG1, ARG2, ARG3) __SXTAB16(ARG1, __ROR(ARG2, ARG3))
__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
Signed Saturate.
#define __CLZ
Count leading zeros.
__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
Unsigned Saturate.
#define __ROR
Rotate Right in unsigned value (32 bit)
#define __RBIT
Reverse bit order of value.
#define __REVSH(value)
Reverse byte order (16 bit)
__STATIC_INLINE void __set_CONTROL(uint32_t control)
Set Control Register.
__STATIC_INLINE uint32_t __get_APSR(void)
Get APSR Register.