32 #if defined ( __CC_ARM )
34 #define __INLINE __inline
36 #elif defined ( __ICCARM__ )
38 #define __INLINE inline
40 #elif defined ( __GNUC__ )
42 #define __INLINE inline
44 #elif defined ( __TASKING__ )
46 #define __INLINE inline
53 #if defined ( __CC_ARM )
63 __ASM uint32_t __get_PSP(
void)
77 __ASM
void __set_PSP(uint32_t topOfProcStack)
91 __ASM uint32_t __get_MSP(
void)
105 __ASM
void __set_MSP(uint32_t mainStackPointer)
119 __ASM uint32_t __REV16(uint16_t value)
133 __ASM int32_t __REVSH(int16_t value)
140 #if (__ARMCC_VERSION < 400000)
147 __ASM
void __CLREX(
void)
159 __ASM uint32_t __get_BASEPRI(
void)
172 __ASM
void __set_BASEPRI(uint32_t basePri)
185 __ASM uint32_t __get_PRIMASK(
void)
198 __ASM
void __set_PRIMASK(uint32_t priMask)
211 __ASM uint32_t __get_FAULTMASK(
void)
224 __ASM
void __set_FAULTMASK(uint32_t faultMask)
237 __ASM uint32_t __get_CONTROL(
void)
250 __ASM
void __set_CONTROL(uint32_t control)
260 #elif (defined (__ICCARM__))
262 #pragma diag_suppress=Pe940
271 uint32_t __get_PSP(
void)
273 __ASM(
"mrs r0, psp");
285 void __set_PSP(uint32_t topOfProcStack)
287 __ASM(
"msr psp, r0");
299 uint32_t __get_MSP(
void)
301 __ASM(
"mrs r0, msp");
313 void __set_MSP(uint32_t topOfMainStack)
315 __ASM(
"msr msp, r0");
327 uint32_t __REV16(uint16_t value)
329 __ASM(
"rev16 r0, r0");
341 uint32_t __RBIT(uint32_t value)
343 __ASM(
"rbit r0, r0");
355 uint8_t __LDREXB(uint8_t *addr)
357 __ASM(
"ldrexb r0, [r0]");
369 uint16_t __LDREXH(uint16_t *addr)
371 __ASM(
"ldrexh r0, [r0]");
383 uint32_t __LDREXW(uint32_t *addr)
385 __ASM(
"ldrex r0, [r0]");
389 #pragma diag_default=Pe940
392 #elif (defined (__GNUC__))
403 uint32_t __get_PSP(
void)
407 __ASM
volatile (
"MRS %0, psp\n\t"
409 "BX lr \n\t" :
"=r" (result) );
421 void __set_PSP(uint32_t topOfProcStack)
__attribute__( ( naked ) );
422 void __set_PSP(uint32_t topOfProcStack)
424 __ASM
volatile (
"MSR psp, %0\n\t"
425 "BX lr \n\t" : :
"r" (topOfProcStack) );
437 uint32_t __get_MSP(
void)
441 __ASM
volatile (
"MRS %0, msp\n\t"
443 "BX lr \n\t" :
"=r" (result) );
455 void __set_MSP(uint32_t topOfMainStack)
__attribute__( ( naked ) );
456 void __set_MSP(uint32_t topOfMainStack)
458 __ASM
volatile (
"MSR msp, %0\n\t"
459 "BX lr \n\t" : :
"r" (topOfMainStack) );
469 uint32_t __get_BASEPRI(
void)
473 __ASM
volatile (
"MRS %0, basepri_max" :
"=r" (result) );
484 void __set_BASEPRI(uint32_t value)
486 __ASM
volatile (
"MSR basepri, %0" : :
"r" (value) );
496 uint32_t __get_PRIMASK(
void)
500 __ASM
volatile (
"MRS %0, primask" :
"=r" (result) );
511 void __set_PRIMASK(uint32_t priMask)
513 __ASM
volatile (
"MSR primask, %0" : :
"r" (priMask) );
523 uint32_t __get_FAULTMASK(
void)
527 __ASM
volatile (
"MRS %0, faultmask" :
"=r" (result) );
538 void __set_FAULTMASK(uint32_t faultMask)
540 __ASM
volatile (
"MSR faultmask, %0" : :
"r" (faultMask) );
550 uint32_t __get_CONTROL(
void)
554 __ASM
volatile (
"MRS %0, control" :
"=r" (result) );
565 void __set_CONTROL(uint32_t control)
567 __ASM
volatile (
"MSR control, %0" : :
"r" (control) );
579 uint32_t __REV(uint32_t value)
583 __ASM
volatile (
"rev %0, %1" :
"=r" (result) :
"r" (value) );
595 uint32_t __REV16(uint16_t value)
599 __ASM
volatile (
"rev16 %0, %1" :
"=r" (result) :
"r" (value) );
611 int32_t __REVSH(int16_t value)
615 __ASM
volatile (
"revsh %0, %1" :
"=r" (result) :
"r" (value) );
627 uint32_t __RBIT(uint32_t value)
631 __ASM
volatile (
"rbit %0, %1" :
"=r" (result) :
"r" (value) );
643 uint8_t __LDREXB(uint8_t *addr)
647 __ASM
volatile (
"ldrexb %0, [%1]" :
"=r" (result) :
"r" (addr) );
659 uint16_t __LDREXH(uint16_t *addr)
663 __ASM
volatile (
"ldrexh %0, [%1]" :
"=r" (result) :
"r" (addr) );
675 uint32_t __LDREXW(uint32_t *addr)
679 __ASM
volatile (
"ldrex %0, [%1]" :
"=r" (result) :
"r" (addr) );
683 #elif (defined (__TASKING__))