BA / Mbed OS BaBoRo1
Committer:
borlanic
Date:
Thu Mar 29 07:02:09 2018 +0000
Revision:
0:380207fcb5c1
Encoder, IMU --> OK; Controller --> in bearbeitung

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:380207fcb5c1 1 /*
borlanic 0:380207fcb5c1 2 * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
borlanic 0:380207fcb5c1 3 * SPDX-License-Identifier: Apache-2.0
borlanic 0:380207fcb5c1 4 *
borlanic 0:380207fcb5c1 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
borlanic 0:380207fcb5c1 6 * not use this file except in compliance with the License.
borlanic 0:380207fcb5c1 7 * You may obtain a copy of the License at
borlanic 0:380207fcb5c1 8 *
borlanic 0:380207fcb5c1 9 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:380207fcb5c1 10 *
borlanic 0:380207fcb5c1 11 * Unless required by applicable law or agreed to in writing, software
borlanic 0:380207fcb5c1 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
borlanic 0:380207fcb5c1 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:380207fcb5c1 14 * See the License for the specific language governing permissions and
borlanic 0:380207fcb5c1 15 * limitations under the License.
borlanic 0:380207fcb5c1 16 */
borlanic 0:380207fcb5c1 17
borlanic 0:380207fcb5c1 18 /* Declare __STDC_LIMIT_MACROS so stdint.h defines UINT32_MAX when using C++ */
borlanic 0:380207fcb5c1 19 #define __STDC_LIMIT_MACROS
borlanic 0:380207fcb5c1 20 #include "hal/critical_section_api.h"
borlanic 0:380207fcb5c1 21
borlanic 0:380207fcb5c1 22 #include "cmsis.h"
borlanic 0:380207fcb5c1 23 #include "platform/mbed_assert.h"
borlanic 0:380207fcb5c1 24 #include "platform/mbed_critical.h"
borlanic 0:380207fcb5c1 25 #include "platform/mbed_toolchain.h"
borlanic 0:380207fcb5c1 26
borlanic 0:380207fcb5c1 27 // if __EXCLUSIVE_ACCESS rtx macro not defined, we need to get this via own-set architecture macros
borlanic 0:380207fcb5c1 28 #ifndef MBED_EXCLUSIVE_ACCESS
borlanic 0:380207fcb5c1 29 #ifndef __EXCLUSIVE_ACCESS
borlanic 0:380207fcb5c1 30 #if ((__ARM_ARCH_7M__ == 1U) || \
borlanic 0:380207fcb5c1 31 (__ARM_ARCH_7EM__ == 1U) || \
borlanic 0:380207fcb5c1 32 (__ARM_ARCH_8M_BASE__ == 1U) || \
borlanic 0:380207fcb5c1 33 (__ARM_ARCH_8M_MAIN__ == 1U)) || \
borlanic 0:380207fcb5c1 34 (__ARM_ARCH_7A__ == 1U)
borlanic 0:380207fcb5c1 35 #define MBED_EXCLUSIVE_ACCESS 1U
borlanic 0:380207fcb5c1 36 #elif (__ARM_ARCH_6M__ == 1U)
borlanic 0:380207fcb5c1 37 #define MBED_EXCLUSIVE_ACCESS 0U
borlanic 0:380207fcb5c1 38 #else
borlanic 0:380207fcb5c1 39 #error "Unknown architecture for exclusive access"
borlanic 0:380207fcb5c1 40 #endif
borlanic 0:380207fcb5c1 41 #else
borlanic 0:380207fcb5c1 42 #define MBED_EXCLUSIVE_ACCESS __EXCLUSIVE_ACCESS
borlanic 0:380207fcb5c1 43 #endif
borlanic 0:380207fcb5c1 44 #endif
borlanic 0:380207fcb5c1 45
borlanic 0:380207fcb5c1 46 static volatile uint32_t critical_section_reentrancy_counter = 0;
borlanic 0:380207fcb5c1 47
borlanic 0:380207fcb5c1 48 bool core_util_are_interrupts_enabled(void)
borlanic 0:380207fcb5c1 49 {
borlanic 0:380207fcb5c1 50 #if defined(__CORTEX_A9)
borlanic 0:380207fcb5c1 51 return ((__get_CPSR() & 0x80) == 0);
borlanic 0:380207fcb5c1 52 #else
borlanic 0:380207fcb5c1 53 return ((__get_PRIMASK() & 0x1) == 0);
borlanic 0:380207fcb5c1 54 #endif
borlanic 0:380207fcb5c1 55 }
borlanic 0:380207fcb5c1 56
borlanic 0:380207fcb5c1 57 bool core_util_is_isr_active(void)
borlanic 0:380207fcb5c1 58 {
borlanic 0:380207fcb5c1 59 #if defined(__CORTEX_A9)
borlanic 0:380207fcb5c1 60 switch(__get_CPSR() & 0x1FU) {
borlanic 0:380207fcb5c1 61 case CPSR_M_USR:
borlanic 0:380207fcb5c1 62 case CPSR_M_SYS:
borlanic 0:380207fcb5c1 63 return false;
borlanic 0:380207fcb5c1 64 case CPSR_M_SVC:
borlanic 0:380207fcb5c1 65 default:
borlanic 0:380207fcb5c1 66 return true;
borlanic 0:380207fcb5c1 67 }
borlanic 0:380207fcb5c1 68 #else
borlanic 0:380207fcb5c1 69 return (__get_IPSR() != 0U);
borlanic 0:380207fcb5c1 70 #endif
borlanic 0:380207fcb5c1 71 }
borlanic 0:380207fcb5c1 72
borlanic 0:380207fcb5c1 73 bool core_util_in_critical_section(void)
borlanic 0:380207fcb5c1 74 {
borlanic 0:380207fcb5c1 75 return hal_in_critical_section();
borlanic 0:380207fcb5c1 76 }
borlanic 0:380207fcb5c1 77
borlanic 0:380207fcb5c1 78 void core_util_critical_section_enter(void)
borlanic 0:380207fcb5c1 79 {
borlanic 0:380207fcb5c1 80 // FIXME
borlanic 0:380207fcb5c1 81 #ifdef FEATURE_UVISOR
borlanic 0:380207fcb5c1 82 #warning "core_util_critical_section_enter needs fixing to work from unprivileged code"
borlanic 0:380207fcb5c1 83 #else
borlanic 0:380207fcb5c1 84 // If the reentrancy counter overflows something has gone badly wrong.
borlanic 0:380207fcb5c1 85 MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX);
borlanic 0:380207fcb5c1 86 #endif /* FEATURE_UVISOR */
borlanic 0:380207fcb5c1 87
borlanic 0:380207fcb5c1 88 hal_critical_section_enter();
borlanic 0:380207fcb5c1 89
borlanic 0:380207fcb5c1 90 ++critical_section_reentrancy_counter;
borlanic 0:380207fcb5c1 91 }
borlanic 0:380207fcb5c1 92
borlanic 0:380207fcb5c1 93 void core_util_critical_section_exit(void)
borlanic 0:380207fcb5c1 94 {
borlanic 0:380207fcb5c1 95 // FIXME
borlanic 0:380207fcb5c1 96 #ifdef FEATURE_UVISOR
borlanic 0:380207fcb5c1 97 #warning "core_util_critical_section_exit needs fixing to work from unprivileged code"
borlanic 0:380207fcb5c1 98 #endif /* FEATURE_UVISOR */
borlanic 0:380207fcb5c1 99
borlanic 0:380207fcb5c1 100 // If critical_section_enter has not previously been called, do nothing
borlanic 0:380207fcb5c1 101 if (critical_section_reentrancy_counter == 0) {
borlanic 0:380207fcb5c1 102 return;
borlanic 0:380207fcb5c1 103 }
borlanic 0:380207fcb5c1 104
borlanic 0:380207fcb5c1 105 --critical_section_reentrancy_counter;
borlanic 0:380207fcb5c1 106
borlanic 0:380207fcb5c1 107 if (critical_section_reentrancy_counter == 0) {
borlanic 0:380207fcb5c1 108 hal_critical_section_exit();
borlanic 0:380207fcb5c1 109 }
borlanic 0:380207fcb5c1 110 }
borlanic 0:380207fcb5c1 111
borlanic 0:380207fcb5c1 112 #if MBED_EXCLUSIVE_ACCESS
borlanic 0:380207fcb5c1 113
borlanic 0:380207fcb5c1 114 /* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */
borlanic 0:380207fcb5c1 115 #if defined (__CC_ARM)
borlanic 0:380207fcb5c1 116 #pragma diag_suppress 3731
borlanic 0:380207fcb5c1 117 #endif
borlanic 0:380207fcb5c1 118
borlanic 0:380207fcb5c1 119 bool core_util_atomic_cas_u8(volatile uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue)
borlanic 0:380207fcb5c1 120 {
borlanic 0:380207fcb5c1 121 do {
borlanic 0:380207fcb5c1 122 uint8_t currentValue = __LDREXB(ptr);
borlanic 0:380207fcb5c1 123 if (currentValue != *expectedCurrentValue) {
borlanic 0:380207fcb5c1 124 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 125 __CLREX();
borlanic 0:380207fcb5c1 126 return false;
borlanic 0:380207fcb5c1 127 }
borlanic 0:380207fcb5c1 128 } while (__STREXB(desiredValue, ptr));
borlanic 0:380207fcb5c1 129 return true;
borlanic 0:380207fcb5c1 130 }
borlanic 0:380207fcb5c1 131
borlanic 0:380207fcb5c1 132 bool core_util_atomic_cas_u16(volatile uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue)
borlanic 0:380207fcb5c1 133 {
borlanic 0:380207fcb5c1 134 do {
borlanic 0:380207fcb5c1 135 uint16_t currentValue = __LDREXH(ptr);
borlanic 0:380207fcb5c1 136 if (currentValue != *expectedCurrentValue) {
borlanic 0:380207fcb5c1 137 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 138 __CLREX();
borlanic 0:380207fcb5c1 139 return false;
borlanic 0:380207fcb5c1 140 }
borlanic 0:380207fcb5c1 141 } while (__STREXH(desiredValue, ptr));
borlanic 0:380207fcb5c1 142 return true;
borlanic 0:380207fcb5c1 143 }
borlanic 0:380207fcb5c1 144
borlanic 0:380207fcb5c1 145
borlanic 0:380207fcb5c1 146 bool core_util_atomic_cas_u32(volatile uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue)
borlanic 0:380207fcb5c1 147 {
borlanic 0:380207fcb5c1 148 do {
borlanic 0:380207fcb5c1 149 uint32_t currentValue = __LDREXW(ptr);
borlanic 0:380207fcb5c1 150 if (currentValue != *expectedCurrentValue) {
borlanic 0:380207fcb5c1 151 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 152 __CLREX();
borlanic 0:380207fcb5c1 153 return false;
borlanic 0:380207fcb5c1 154 }
borlanic 0:380207fcb5c1 155 } while (__STREXW(desiredValue, ptr));
borlanic 0:380207fcb5c1 156 return true;
borlanic 0:380207fcb5c1 157 }
borlanic 0:380207fcb5c1 158
borlanic 0:380207fcb5c1 159 uint8_t core_util_atomic_incr_u8(volatile uint8_t *valuePtr, uint8_t delta)
borlanic 0:380207fcb5c1 160 {
borlanic 0:380207fcb5c1 161 uint8_t newValue;
borlanic 0:380207fcb5c1 162 do {
borlanic 0:380207fcb5c1 163 newValue = __LDREXB(valuePtr) + delta;
borlanic 0:380207fcb5c1 164 } while (__STREXB(newValue, valuePtr));
borlanic 0:380207fcb5c1 165 return newValue;
borlanic 0:380207fcb5c1 166 }
borlanic 0:380207fcb5c1 167
borlanic 0:380207fcb5c1 168 uint16_t core_util_atomic_incr_u16(volatile uint16_t *valuePtr, uint16_t delta)
borlanic 0:380207fcb5c1 169 {
borlanic 0:380207fcb5c1 170 uint16_t newValue;
borlanic 0:380207fcb5c1 171 do {
borlanic 0:380207fcb5c1 172 newValue = __LDREXH(valuePtr) + delta;
borlanic 0:380207fcb5c1 173 } while (__STREXH(newValue, valuePtr));
borlanic 0:380207fcb5c1 174 return newValue;
borlanic 0:380207fcb5c1 175 }
borlanic 0:380207fcb5c1 176
borlanic 0:380207fcb5c1 177 uint32_t core_util_atomic_incr_u32(volatile uint32_t *valuePtr, uint32_t delta)
borlanic 0:380207fcb5c1 178 {
borlanic 0:380207fcb5c1 179 uint32_t newValue;
borlanic 0:380207fcb5c1 180 do {
borlanic 0:380207fcb5c1 181 newValue = __LDREXW(valuePtr) + delta;
borlanic 0:380207fcb5c1 182 } while (__STREXW(newValue, valuePtr));
borlanic 0:380207fcb5c1 183 return newValue;
borlanic 0:380207fcb5c1 184 }
borlanic 0:380207fcb5c1 185
borlanic 0:380207fcb5c1 186
borlanic 0:380207fcb5c1 187 uint8_t core_util_atomic_decr_u8(volatile uint8_t *valuePtr, uint8_t delta)
borlanic 0:380207fcb5c1 188 {
borlanic 0:380207fcb5c1 189 uint8_t newValue;
borlanic 0:380207fcb5c1 190 do {
borlanic 0:380207fcb5c1 191 newValue = __LDREXB(valuePtr) - delta;
borlanic 0:380207fcb5c1 192 } while (__STREXB(newValue, valuePtr));
borlanic 0:380207fcb5c1 193 return newValue;
borlanic 0:380207fcb5c1 194 }
borlanic 0:380207fcb5c1 195
borlanic 0:380207fcb5c1 196 uint16_t core_util_atomic_decr_u16(volatile uint16_t *valuePtr, uint16_t delta)
borlanic 0:380207fcb5c1 197 {
borlanic 0:380207fcb5c1 198 uint16_t newValue;
borlanic 0:380207fcb5c1 199 do {
borlanic 0:380207fcb5c1 200 newValue = __LDREXH(valuePtr) - delta;
borlanic 0:380207fcb5c1 201 } while (__STREXH(newValue, valuePtr));
borlanic 0:380207fcb5c1 202 return newValue;
borlanic 0:380207fcb5c1 203 }
borlanic 0:380207fcb5c1 204
borlanic 0:380207fcb5c1 205 uint32_t core_util_atomic_decr_u32(volatile uint32_t *valuePtr, uint32_t delta)
borlanic 0:380207fcb5c1 206 {
borlanic 0:380207fcb5c1 207 uint32_t newValue;
borlanic 0:380207fcb5c1 208 do {
borlanic 0:380207fcb5c1 209 newValue = __LDREXW(valuePtr) - delta;
borlanic 0:380207fcb5c1 210 } while (__STREXW(newValue, valuePtr));
borlanic 0:380207fcb5c1 211 return newValue;
borlanic 0:380207fcb5c1 212 }
borlanic 0:380207fcb5c1 213
borlanic 0:380207fcb5c1 214 #else
borlanic 0:380207fcb5c1 215
borlanic 0:380207fcb5c1 216 bool core_util_atomic_cas_u8(volatile uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue)
borlanic 0:380207fcb5c1 217 {
borlanic 0:380207fcb5c1 218 bool success;
borlanic 0:380207fcb5c1 219 uint8_t currentValue;
borlanic 0:380207fcb5c1 220 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 221 currentValue = *ptr;
borlanic 0:380207fcb5c1 222 if (currentValue == *expectedCurrentValue) {
borlanic 0:380207fcb5c1 223 *ptr = desiredValue;
borlanic 0:380207fcb5c1 224 success = true;
borlanic 0:380207fcb5c1 225 } else {
borlanic 0:380207fcb5c1 226 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 227 success = false;
borlanic 0:380207fcb5c1 228 }
borlanic 0:380207fcb5c1 229 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 230 return success;
borlanic 0:380207fcb5c1 231 }
borlanic 0:380207fcb5c1 232
borlanic 0:380207fcb5c1 233 bool core_util_atomic_cas_u16(volatile uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue)
borlanic 0:380207fcb5c1 234 {
borlanic 0:380207fcb5c1 235 bool success;
borlanic 0:380207fcb5c1 236 uint16_t currentValue;
borlanic 0:380207fcb5c1 237 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 238 currentValue = *ptr;
borlanic 0:380207fcb5c1 239 if (currentValue == *expectedCurrentValue) {
borlanic 0:380207fcb5c1 240 *ptr = desiredValue;
borlanic 0:380207fcb5c1 241 success = true;
borlanic 0:380207fcb5c1 242 } else {
borlanic 0:380207fcb5c1 243 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 244 success = false;
borlanic 0:380207fcb5c1 245 }
borlanic 0:380207fcb5c1 246 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 247 return success;
borlanic 0:380207fcb5c1 248 }
borlanic 0:380207fcb5c1 249
borlanic 0:380207fcb5c1 250
borlanic 0:380207fcb5c1 251 bool core_util_atomic_cas_u32(volatile uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue)
borlanic 0:380207fcb5c1 252 {
borlanic 0:380207fcb5c1 253 bool success;
borlanic 0:380207fcb5c1 254 uint32_t currentValue;
borlanic 0:380207fcb5c1 255 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 256 currentValue = *ptr;
borlanic 0:380207fcb5c1 257 if (currentValue == *expectedCurrentValue) {
borlanic 0:380207fcb5c1 258 *ptr = desiredValue;
borlanic 0:380207fcb5c1 259 success = true;
borlanic 0:380207fcb5c1 260 } else {
borlanic 0:380207fcb5c1 261 *expectedCurrentValue = currentValue;
borlanic 0:380207fcb5c1 262 success = false;
borlanic 0:380207fcb5c1 263 }
borlanic 0:380207fcb5c1 264 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 265 return success;
borlanic 0:380207fcb5c1 266 }
borlanic 0:380207fcb5c1 267
borlanic 0:380207fcb5c1 268
borlanic 0:380207fcb5c1 269 uint8_t core_util_atomic_incr_u8(volatile uint8_t *valuePtr, uint8_t delta)
borlanic 0:380207fcb5c1 270 {
borlanic 0:380207fcb5c1 271 uint8_t newValue;
borlanic 0:380207fcb5c1 272 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 273 newValue = *valuePtr + delta;
borlanic 0:380207fcb5c1 274 *valuePtr = newValue;
borlanic 0:380207fcb5c1 275 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 276 return newValue;
borlanic 0:380207fcb5c1 277 }
borlanic 0:380207fcb5c1 278
borlanic 0:380207fcb5c1 279 uint16_t core_util_atomic_incr_u16(volatile uint16_t *valuePtr, uint16_t delta)
borlanic 0:380207fcb5c1 280 {
borlanic 0:380207fcb5c1 281 uint16_t newValue;
borlanic 0:380207fcb5c1 282 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 283 newValue = *valuePtr + delta;
borlanic 0:380207fcb5c1 284 *valuePtr = newValue;
borlanic 0:380207fcb5c1 285 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 286 return newValue;
borlanic 0:380207fcb5c1 287 }
borlanic 0:380207fcb5c1 288
borlanic 0:380207fcb5c1 289 uint32_t core_util_atomic_incr_u32(volatile uint32_t *valuePtr, uint32_t delta)
borlanic 0:380207fcb5c1 290 {
borlanic 0:380207fcb5c1 291 uint32_t newValue;
borlanic 0:380207fcb5c1 292 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 293 newValue = *valuePtr + delta;
borlanic 0:380207fcb5c1 294 *valuePtr = newValue;
borlanic 0:380207fcb5c1 295 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 296 return newValue;
borlanic 0:380207fcb5c1 297 }
borlanic 0:380207fcb5c1 298
borlanic 0:380207fcb5c1 299
borlanic 0:380207fcb5c1 300 uint8_t core_util_atomic_decr_u8(volatile uint8_t *valuePtr, uint8_t delta)
borlanic 0:380207fcb5c1 301 {
borlanic 0:380207fcb5c1 302 uint8_t newValue;
borlanic 0:380207fcb5c1 303 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 304 newValue = *valuePtr - delta;
borlanic 0:380207fcb5c1 305 *valuePtr = newValue;
borlanic 0:380207fcb5c1 306 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 307 return newValue;
borlanic 0:380207fcb5c1 308 }
borlanic 0:380207fcb5c1 309
borlanic 0:380207fcb5c1 310 uint16_t core_util_atomic_decr_u16(volatile uint16_t *valuePtr, uint16_t delta)
borlanic 0:380207fcb5c1 311 {
borlanic 0:380207fcb5c1 312 uint16_t newValue;
borlanic 0:380207fcb5c1 313 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 314 newValue = *valuePtr - delta;
borlanic 0:380207fcb5c1 315 *valuePtr = newValue;
borlanic 0:380207fcb5c1 316 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 317 return newValue;
borlanic 0:380207fcb5c1 318 }
borlanic 0:380207fcb5c1 319
borlanic 0:380207fcb5c1 320 uint32_t core_util_atomic_decr_u32(volatile uint32_t *valuePtr, uint32_t delta)
borlanic 0:380207fcb5c1 321 {
borlanic 0:380207fcb5c1 322 uint32_t newValue;
borlanic 0:380207fcb5c1 323 core_util_critical_section_enter();
borlanic 0:380207fcb5c1 324 newValue = *valuePtr - delta;
borlanic 0:380207fcb5c1 325 *valuePtr = newValue;
borlanic 0:380207fcb5c1 326 core_util_critical_section_exit();
borlanic 0:380207fcb5c1 327 return newValue;
borlanic 0:380207fcb5c1 328 }
borlanic 0:380207fcb5c1 329
borlanic 0:380207fcb5c1 330 #endif
borlanic 0:380207fcb5c1 331
borlanic 0:380207fcb5c1 332
borlanic 0:380207fcb5c1 333 bool core_util_atomic_cas_ptr(void * volatile *ptr, void **expectedCurrentValue, void *desiredValue) {
borlanic 0:380207fcb5c1 334 return core_util_atomic_cas_u32(
borlanic 0:380207fcb5c1 335 (volatile uint32_t *)ptr,
borlanic 0:380207fcb5c1 336 (uint32_t *)expectedCurrentValue,
borlanic 0:380207fcb5c1 337 (uint32_t)desiredValue);
borlanic 0:380207fcb5c1 338 }
borlanic 0:380207fcb5c1 339
borlanic 0:380207fcb5c1 340 void *core_util_atomic_incr_ptr(void * volatile *valuePtr, ptrdiff_t delta) {
borlanic 0:380207fcb5c1 341 return (void *)core_util_atomic_incr_u32((volatile uint32_t *)valuePtr, (uint32_t)delta);
borlanic 0:380207fcb5c1 342 }
borlanic 0:380207fcb5c1 343
borlanic 0:380207fcb5c1 344 void *core_util_atomic_decr_ptr(void * volatile *valuePtr, ptrdiff_t delta) {
borlanic 0:380207fcb5c1 345 return (void *)core_util_atomic_decr_u32((volatile uint32_t *)valuePtr, (uint32_t)delta);
borlanic 0:380207fcb5c1 346 }
borlanic 0:380207fcb5c1 347