001

Committer:
ganlikun
Date:
Sun Jun 12 14:02:44 2022 +0000
Revision:
0:13413ea9a877
00

Who changed what in which revision?

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