24 #ifndef __CORE_CMINSTR_H 25 #define __CORE_CMINSTR_H 34 #if defined ( __CC_ARM ) 37 #if (__ARMCC_VERSION < 400677) 38 #error "Please use ARM Compiler Toolchain V4.0.677 or later!" 78 #define __ISB() __isb(0xF) 86 #define __DSB() __dsb(0xF) 94 #define __DMB() __dmb(0xF) 114 static __INLINE __ASM uint32_t __REV16(uint32_t value)
128 static __INLINE __ASM int32_t __REVSH(int32_t value)
135 #if (__CORTEX_M >= 0x03) 144 #define __RBIT __rbit 154 #define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) 164 #define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) 174 #define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) 186 #define __STREXB(value, ptr) __strex(value, ptr) 198 #define __STREXH(value, ptr) __strex(value, ptr) 210 #define __STREXW(value, ptr) __strex(value, ptr) 218 #define __CLREX __clrex 229 #define __SSAT __ssat 240 #define __USAT __usat 256 #elif defined ( __ICCARM__ ) 259 #include <cmsis_iar.h> 262 #elif defined ( __GNUC__ ) 269 __attribute__( ( always_inline ) ) static __INLINE
void __NOP(
void)
271 __ASM
volatile (
"nop");
280 __attribute__( ( always_inline ) ) static __INLINE
void __WFI(
void)
282 __ASM
volatile (
"wfi");
291 __attribute__( ( always_inline ) ) static __INLINE
void __WFE(
void)
293 __ASM
volatile (
"wfe");
301 __attribute__( ( always_inline ) ) static __INLINE
void __SEV(
void)
303 __ASM
volatile (
"sev");
313 __attribute__( ( always_inline ) ) static __INLINE
void __ISB(
void)
315 __ASM
volatile (
"isb");
324 __attribute__( ( always_inline ) ) static __INLINE
void __DSB(
void)
326 __ASM
volatile (
"dsb");
335 __attribute__( ( always_inline ) ) static __INLINE
void __DMB(
void)
337 __ASM
volatile (
"dmb");
348 __attribute__( ( always_inline ) ) static __INLINE uint32_t __REV(uint32_t value)
352 __ASM
volatile (
"rev %0, %1" :
"=r" (result) :
"r" (value) );
364 __attribute__( ( always_inline ) ) static __INLINE uint32_t __REV16(uint32_t value)
368 __ASM
volatile (
"rev16 %0, %1" :
"=r" (result) :
"r" (value) );
380 __attribute__( ( always_inline ) ) static __INLINE int32_t __REVSH(int32_t value)
384 __ASM
volatile (
"revsh %0, %1" :
"=r" (result) :
"r" (value) );
389 #if (__CORTEX_M >= 0x03) 398 __attribute__( ( always_inline ) ) static __INLINE uint32_t __RBIT(uint32_t value)
402 __ASM
volatile (
"rbit %0, %1" :
"=r" (result) :
"r" (value) );
414 __attribute__( ( always_inline ) ) static __INLINE uint8_t __LDREXB(volatile uint8_t *
addr)
418 __ASM
volatile (
"ldrexb %0, [%1]" :
"=r" (result) :
"r" (addr) );
430 __attribute__( ( always_inline ) ) static __INLINE uint16_t __LDREXH(volatile uint16_t *addr)
434 __ASM
volatile (
"ldrexh %0, [%1]" :
"=r" (result) :
"r" (addr) );
446 __attribute__( ( always_inline ) ) static __INLINE uint32_t __LDREXW(volatile uint32_t *addr)
450 __ASM
volatile (
"ldrex %0, [%1]" :
"=r" (result) :
"r" (addr) );
464 __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
468 __ASM
volatile (
"strexb %0, %2, [%1]" :
"=r" (result) :
"r" (addr),
"r" (value) );
482 __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
486 __ASM
volatile (
"strexh %0, %2, [%1]" :
"=r" (result) :
"r" (addr),
"r" (value) );
500 __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
504 __ASM
volatile (
"strex %0, %2, [%1]" :
"=r" (result) :
"r" (addr),
"r" (value) );
514 __attribute__( ( always_inline ) ) static __INLINE
void __CLREX(
void)
516 __ASM
volatile (
"clrex");
528 #define __SSAT(ARG1,ARG2) \ 530 uint32_t __RES, __ARG1 = (ARG1); \ 531 __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ 544 #define __USAT(ARG1,ARG2) \ 546 uint32_t __RES, __ARG1 = (ARG1); \ 547 __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ 559 __attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)
563 __ASM
volatile (
"clz %0, %1" :
"=r" (result) :
"r" (value) );
572 #elif defined ( __TASKING__ ) struct emac_rx_descriptor __attribute__((packed, aligned(8))) emac_rx_descriptor_t
union emac_rx_addr addr
Definition: emac.h:123