27 #if defined ( __CC_ARM ) 29 #define __INLINE __inline 31 #elif defined ( __ICCARM__ ) 33 #define __INLINE inline 35 #elif defined ( __GNUC__ ) 37 #define __INLINE inline 39 #elif defined ( __TASKING__ ) 41 #define __INLINE inline 48 #if defined ( __CC_ARM ) 58 __ASM uint32_t __get_PSP(
void)
72 __ASM
void __set_PSP(uint32_t topOfProcStack)
86 __ASM uint32_t __get_MSP(
void)
100 __ASM
void __set_MSP(uint32_t mainStackPointer)
114 __ASM uint32_t __REV16(uint16_t value)
128 __ASM int32_t __REVSH(int16_t value)
135 #if (__ARMCC_VERSION < 400000) 142 __ASM
void __CLREX(
void)
154 __ASM uint32_t __get_BASEPRI(
void)
167 __ASM
void __set_BASEPRI(uint32_t basePri)
180 __ASM uint32_t __get_PRIMASK(
void)
193 __ASM
void __set_PRIMASK(uint32_t priMask)
206 __ASM uint32_t __get_FAULTMASK(
void)
219 __ASM
void __set_FAULTMASK(uint32_t faultMask)
232 __ASM uint32_t __get_CONTROL(
void)
245 __ASM
void __set_CONTROL(uint32_t control)
255 #elif (defined (__ICCARM__)) 257 #pragma diag_suppress=Pe940 266 uint32_t __get_PSP(
void)
268 __ASM(
"mrs r0, psp");
280 void __set_PSP(uint32_t topOfProcStack)
282 __ASM(
"msr psp, r0");
294 uint32_t __get_MSP(
void)
296 __ASM(
"mrs r0, msp");
308 void __set_MSP(uint32_t topOfMainStack)
310 __ASM(
"msr msp, r0");
322 uint32_t __REV16(uint16_t value)
324 __ASM(
"rev16 r0, r0");
336 uint32_t __RBIT(uint32_t value)
338 __ASM(
"rbit r0, r0");
350 uint8_t __LDREXB(uint8_t *
addr)
352 __ASM(
"ldrexb r0, [r0]");
364 uint16_t __LDREXH(uint16_t *
addr)
366 __ASM(
"ldrexh r0, [r0]");
378 uint32_t __LDREXW(uint32_t *
addr)
380 __ASM(
"ldrex r0, [r0]");
393 uint32_t __STREXB(uint8_t value, uint8_t *
addr)
395 __ASM(
"strexb r0, r0, [r1]");
408 uint32_t __STREXH(uint16_t value, uint16_t *
addr)
410 __ASM(
"strexh r0, r0, [r1]");
423 uint32_t __STREXW(uint32_t value, uint32_t *
addr)
425 __ASM(
"strex r0, r0, [r1]");
429 #pragma diag_default=Pe940 432 #elif (defined (__GNUC__)) 443 uint32_t __get_PSP(
void)
447 __ASM
volatile (
"MRS %0, psp\n\t" 449 "BX lr \n\t" :
"=r" (result) );
461 void __set_PSP(uint32_t topOfProcStack)
__attribute__( ( naked ) );
462 void __set_PSP(uint32_t topOfProcStack)
464 __ASM
volatile (
"MSR psp, %0\n\t" 465 "BX lr \n\t" : :
"r" (topOfProcStack) );
477 uint32_t __get_MSP(
void)
481 __ASM
volatile (
"MRS %0, msp\n\t" 483 "BX lr \n\t" :
"=r" (result) );
495 void __set_MSP(uint32_t topOfMainStack)
__attribute__( ( naked ) );
496 void __set_MSP(uint32_t topOfMainStack)
498 __ASM
volatile (
"MSR msp, %0\n\t" 499 "BX lr \n\t" : :
"r" (topOfMainStack) );
509 uint32_t __get_BASEPRI(
void)
513 __ASM
volatile (
"MRS %0, basepri_max" :
"=r" (result) );
524 void __set_BASEPRI(uint32_t value)
526 __ASM
volatile (
"MSR basepri, %0" : :
"r" (value) );
536 uint32_t __get_PRIMASK(
void)
540 __ASM
volatile (
"MRS %0, primask" :
"=r" (result) );
551 void __set_PRIMASK(uint32_t priMask)
553 __ASM
volatile (
"MSR primask, %0" : :
"r" (priMask) );
563 uint32_t __get_FAULTMASK(
void)
567 __ASM
volatile (
"MRS %0, faultmask" :
"=r" (result) );
578 void __set_FAULTMASK(uint32_t faultMask)
580 __ASM
volatile (
"MSR faultmask, %0" : :
"r" (faultMask) );
590 uint32_t __get_CONTROL(
void)
594 __ASM
volatile (
"MRS %0, control" :
"=r" (result) );
605 void __set_CONTROL(uint32_t control)
607 __ASM
volatile (
"MSR control, %0" : :
"r" (control) );
619 uint32_t __REV(uint32_t value)
623 __ASM
volatile (
"rev %0, %1" :
"=r" (result) :
"r" (value) );
635 uint32_t __REV16(uint16_t value)
639 __ASM
volatile (
"rev16 %0, %1" :
"=r" (result) :
"r" (value) );
651 int32_t __REVSH(int16_t value)
655 __ASM
volatile (
"revsh %0, %1" :
"=r" (result) :
"r" (value) );
667 uint32_t __RBIT(uint32_t value)
671 __ASM
volatile (
"rbit %0, %1" :
"=r" (result) :
"r" (value) );
683 uint8_t __LDREXB(uint8_t *
addr)
687 __ASM
volatile (
"ldrexb %0, [%1]" :
"=r" (result) :
"r" (addr) );
699 uint16_t __LDREXH(uint16_t *addr)
703 __ASM
volatile (
"ldrexh %0, [%1]" :
"=r" (result) :
"r" (addr) );
715 uint32_t __LDREXW(uint32_t *addr)
719 __ASM
volatile (
"ldrex %0, [%1]" :
"=r" (result) :
"r" (addr) );
732 uint32_t __STREXB(uint8_t value, uint8_t *addr)
736 __ASM
volatile (
"strexb %0, %2, [%1]" :
"=&r" (result) :
"r" (addr),
"r" (value) );
749 uint32_t __STREXH(uint16_t value, uint16_t *addr)
753 __ASM
volatile (
"strexh %0, %2, [%1]" :
"=&r" (result) :
"r" (addr),
"r" (value) );
766 uint32_t __STREXW(uint32_t value, uint32_t *addr)
770 __ASM
volatile (
"strex %0, %2, [%1]" :
"=r" (result) :
"r" (addr),
"r" (value) );
775 #elif (defined (__TASKING__)) static volatile uint8_t addr
struct __attribute__((packed))