Modified for BG96
Fork of mbed-dev by
Diff: platform/mbed_critical.c
- Revision:
- 187:0387e8f68319
- Parent:
- 184:08ed48f1de7f
--- a/platform/mbed_critical.c Fri Jun 22 16:45:37 2018 +0100 +++ b/platform/mbed_critical.c Thu Sep 06 13:40:20 2018 +0100 @@ -38,7 +38,7 @@ #else #error "Unknown architecture for exclusive access" #endif -#else +#else #define MBED_EXCLUSIVE_ACCESS __EXCLUSIVE_ACCESS #endif #endif @@ -57,7 +57,7 @@ bool core_util_is_isr_active(void) { #if defined(__CORTEX_A9) - switch(__get_CPSR() & 0x1FU) { + switch (__get_CPSR() & 0x1FU) { case CPSR_M_USR: case CPSR_M_SYS: return false; @@ -79,7 +79,7 @@ { // FIXME #ifdef FEATURE_UVISOR - #warning "core_util_critical_section_enter needs fixing to work from unprivileged code" +#warning "core_util_critical_section_enter needs fixing to work from unprivileged code" #else // If the reentrancy counter overflows something has gone badly wrong. MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX); @@ -94,7 +94,7 @@ { // FIXME #ifdef FEATURE_UVISOR - #warning "core_util_critical_section_exit needs fixing to work from unprivileged code" +#warning "core_util_critical_section_exit needs fixing to work from unprivileged code" #endif /* FEATURE_UVISOR */ // If critical_section_enter has not previously been called, do nothing @@ -112,7 +112,7 @@ #if MBED_EXCLUSIVE_ACCESS /* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */ -#if defined (__CC_ARM) +#if defined (__CC_ARM) #pragma diag_suppress 3731 #endif @@ -330,18 +330,21 @@ #endif -bool core_util_atomic_cas_ptr(void * volatile *ptr, void **expectedCurrentValue, void *desiredValue) { +bool core_util_atomic_cas_ptr(void *volatile *ptr, void **expectedCurrentValue, void *desiredValue) +{ return core_util_atomic_cas_u32( - (volatile uint32_t *)ptr, - (uint32_t *)expectedCurrentValue, - (uint32_t)desiredValue); + (volatile uint32_t *)ptr, + (uint32_t *)expectedCurrentValue, + (uint32_t)desiredValue); } -void *core_util_atomic_incr_ptr(void * volatile *valuePtr, ptrdiff_t delta) { +void *core_util_atomic_incr_ptr(void *volatile *valuePtr, ptrdiff_t delta) +{ return (void *)core_util_atomic_incr_u32((volatile uint32_t *)valuePtr, (uint32_t)delta); } -void *core_util_atomic_decr_ptr(void * volatile *valuePtr, ptrdiff_t delta) { +void *core_util_atomic_decr_ptr(void *volatile *valuePtr, ptrdiff_t delta) +{ return (void *)core_util_atomic_decr_u32((volatile uint32_t *)valuePtr, (uint32_t)delta); }