Dependents:   sensomed

Committer:
switches
Date:
Tue Nov 08 18:27:11 2016 +0000
Revision:
0:0e018d759a2a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:0e018d759a2a 1
switches 0:0e018d759a2a 2 /** \addtogroup platform */
switches 0:0e018d759a2a 3 /** @{*/
switches 0:0e018d759a2a 4 /*
switches 0:0e018d759a2a 5 * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
switches 0:0e018d759a2a 6 * SPDX-License-Identifier: Apache-2.0
switches 0:0e018d759a2a 7 *
switches 0:0e018d759a2a 8 * Licensed under the Apache License, Version 2.0 (the "License"); you may
switches 0:0e018d759a2a 9 * not use this file except in compliance with the License.
switches 0:0e018d759a2a 10 * You may obtain a copy of the License at
switches 0:0e018d759a2a 11 *
switches 0:0e018d759a2a 12 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:0e018d759a2a 13 *
switches 0:0e018d759a2a 14 * Unless required by applicable law or agreed to in writing, software
switches 0:0e018d759a2a 15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
switches 0:0e018d759a2a 16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:0e018d759a2a 17 * See the License for the specific language governing permissions and
switches 0:0e018d759a2a 18 * limitations under the License.
switches 0:0e018d759a2a 19 */
switches 0:0e018d759a2a 20
switches 0:0e018d759a2a 21 #ifndef __MBED_UTIL_CRITICAL_H__
switches 0:0e018d759a2a 22 #define __MBED_UTIL_CRITICAL_H__
switches 0:0e018d759a2a 23
switches 0:0e018d759a2a 24 #include <stdbool.h>
switches 0:0e018d759a2a 25 #include <stdint.h>
switches 0:0e018d759a2a 26 #include <stddef.h>
switches 0:0e018d759a2a 27
switches 0:0e018d759a2a 28 #ifdef __cplusplus
switches 0:0e018d759a2a 29 extern "C" {
switches 0:0e018d759a2a 30 #endif
switches 0:0e018d759a2a 31
switches 0:0e018d759a2a 32
switches 0:0e018d759a2a 33 /** Determine the current interrupts enabled state
switches 0:0e018d759a2a 34 *
switches 0:0e018d759a2a 35 * This function can be called to determine whether or not interrupts are currently enabled.
switches 0:0e018d759a2a 36 * \note
switches 0:0e018d759a2a 37 * NOTE:
switches 0:0e018d759a2a 38 * This function works for both cortex-A and cortex-M, although the underlyng implementation
switches 0:0e018d759a2a 39 * differs.
switches 0:0e018d759a2a 40 * @return true if interrupts are enabled, false otherwise
switches 0:0e018d759a2a 41 */
switches 0:0e018d759a2a 42 bool core_util_are_interrupts_enabled(void);
switches 0:0e018d759a2a 43
switches 0:0e018d759a2a 44 /** Mark the start of a critical section
switches 0:0e018d759a2a 45 *
switches 0:0e018d759a2a 46 * This function should be called to mark the start of a critical section of code.
switches 0:0e018d759a2a 47 * \note
switches 0:0e018d759a2a 48 * NOTES:
switches 0:0e018d759a2a 49 * 1) The use of this style of critical section is targetted at C based implementations.
switches 0:0e018d759a2a 50 * 2) These critical sections can be nested.
switches 0:0e018d759a2a 51 * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
switches 0:0e018d759a2a 52 * section) will be preserved on exit from the section.
switches 0:0e018d759a2a 53 * 4) This implementation will currently only work on code running in privileged mode.
switches 0:0e018d759a2a 54 */
switches 0:0e018d759a2a 55 void core_util_critical_section_enter(void);
switches 0:0e018d759a2a 56
switches 0:0e018d759a2a 57 /** Mark the end of a critical section
switches 0:0e018d759a2a 58 *
switches 0:0e018d759a2a 59 * This function should be called to mark the end of a critical section of code.
switches 0:0e018d759a2a 60 * \note
switches 0:0e018d759a2a 61 * NOTES:
switches 0:0e018d759a2a 62 * 1) The use of this style of critical section is targetted at C based implementations.
switches 0:0e018d759a2a 63 * 2) These critical sections can be nested.
switches 0:0e018d759a2a 64 * 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
switches 0:0e018d759a2a 65 * section) will be preserved on exit from the section.
switches 0:0e018d759a2a 66 * 4) This implementation will currently only work on code running in privileged mode.
switches 0:0e018d759a2a 67 */
switches 0:0e018d759a2a 68 void core_util_critical_section_exit(void);
switches 0:0e018d759a2a 69
switches 0:0e018d759a2a 70 /**
switches 0:0e018d759a2a 71 * Atomic compare and set. It compares the contents of a memory location to a
switches 0:0e018d759a2a 72 * given value and, only if they are the same, modifies the contents of that
switches 0:0e018d759a2a 73 * memory location to a given new value. This is done as a single atomic
switches 0:0e018d759a2a 74 * operation. The atomicity guarantees that the new value is calculated based on
switches 0:0e018d759a2a 75 * up-to-date information; if the value had been updated by another thread in
switches 0:0e018d759a2a 76 * the meantime, the write would fail due to a mismatched expectedCurrentValue.
switches 0:0e018d759a2a 77 *
switches 0:0e018d759a2a 78 * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
switches 0:0e018d759a2a 79 * you to the article on compare-and swap].
switches 0:0e018d759a2a 80 *
switches 0:0e018d759a2a 81 * @param ptr The target memory location.
switches 0:0e018d759a2a 82 * @param[in,out] expectedCurrentValue A pointer to some location holding the
switches 0:0e018d759a2a 83 * expected current value of the data being set atomically.
switches 0:0e018d759a2a 84 * The computed 'desiredValue' should be a function of this current value.
switches 0:0e018d759a2a 85 * @Note: This is an in-out parameter. In the
switches 0:0e018d759a2a 86 * failure case of atomic_cas (where the
switches 0:0e018d759a2a 87 * destination isn't set), the pointee of expectedCurrentValue is
switches 0:0e018d759a2a 88 * updated with the current value.
switches 0:0e018d759a2a 89 * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
switches 0:0e018d759a2a 90 *
switches 0:0e018d759a2a 91 * @return true if the memory location was atomically
switches 0:0e018d759a2a 92 * updated with the desired value (after verifying
switches 0:0e018d759a2a 93 * that it contained the expectedCurrentValue),
switches 0:0e018d759a2a 94 * false otherwise. In the failure case,
switches 0:0e018d759a2a 95 * exepctedCurrentValue is updated with the new
switches 0:0e018d759a2a 96 * value of the target memory location.
switches 0:0e018d759a2a 97 *
switches 0:0e018d759a2a 98 * pseudocode:
switches 0:0e018d759a2a 99 * function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
switches 0:0e018d759a2a 100 * if *p != *old {
switches 0:0e018d759a2a 101 * *old = *p
switches 0:0e018d759a2a 102 * return false
switches 0:0e018d759a2a 103 * }
switches 0:0e018d759a2a 104 * *p = new
switches 0:0e018d759a2a 105 * return true
switches 0:0e018d759a2a 106 * }
switches 0:0e018d759a2a 107 *
switches 0:0e018d759a2a 108 * @Note: In the failure case (where the destination isn't set), the value
switches 0:0e018d759a2a 109 * pointed to by expectedCurrentValue is still updated with the current value.
switches 0:0e018d759a2a 110 * This property helps writing concise code for the following incr:
switches 0:0e018d759a2a 111 *
switches 0:0e018d759a2a 112 * function incr(p : pointer to int, a : int) returns int {
switches 0:0e018d759a2a 113 * done = false
switches 0:0e018d759a2a 114 * value = *p // This fetch operation need not be atomic.
switches 0:0e018d759a2a 115 * while not done {
switches 0:0e018d759a2a 116 * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
switches 0:0e018d759a2a 117 * }
switches 0:0e018d759a2a 118 * return value + a
switches 0:0e018d759a2a 119 * }
switches 0:0e018d759a2a 120 */
switches 0:0e018d759a2a 121 bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue);
switches 0:0e018d759a2a 122
switches 0:0e018d759a2a 123 /**
switches 0:0e018d759a2a 124 * Atomic compare and set. It compares the contents of a memory location to a
switches 0:0e018d759a2a 125 * given value and, only if they are the same, modifies the contents of that
switches 0:0e018d759a2a 126 * memory location to a given new value. This is done as a single atomic
switches 0:0e018d759a2a 127 * operation. The atomicity guarantees that the new value is calculated based on
switches 0:0e018d759a2a 128 * up-to-date information; if the value had been updated by another thread in
switches 0:0e018d759a2a 129 * the meantime, the write would fail due to a mismatched expectedCurrentValue.
switches 0:0e018d759a2a 130 *
switches 0:0e018d759a2a 131 * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
switches 0:0e018d759a2a 132 * you to the article on compare-and swap].
switches 0:0e018d759a2a 133 *
switches 0:0e018d759a2a 134 * @param ptr The target memory location.
switches 0:0e018d759a2a 135 * @param[in,out] expectedCurrentValue A pointer to some location holding the
switches 0:0e018d759a2a 136 * expected current value of the data being set atomically.
switches 0:0e018d759a2a 137 * The computed 'desiredValue' should be a function of this current value.
switches 0:0e018d759a2a 138 * @Note: This is an in-out parameter. In the
switches 0:0e018d759a2a 139 * failure case of atomic_cas (where the
switches 0:0e018d759a2a 140 * destination isn't set), the pointee of expectedCurrentValue is
switches 0:0e018d759a2a 141 * updated with the current value.
switches 0:0e018d759a2a 142 * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
switches 0:0e018d759a2a 143 *
switches 0:0e018d759a2a 144 * @return true if the memory location was atomically
switches 0:0e018d759a2a 145 * updated with the desired value (after verifying
switches 0:0e018d759a2a 146 * that it contained the expectedCurrentValue),
switches 0:0e018d759a2a 147 * false otherwise. In the failure case,
switches 0:0e018d759a2a 148 * exepctedCurrentValue is updated with the new
switches 0:0e018d759a2a 149 * value of the target memory location.
switches 0:0e018d759a2a 150 *
switches 0:0e018d759a2a 151 * pseudocode:
switches 0:0e018d759a2a 152 * function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
switches 0:0e018d759a2a 153 * if *p != *old {
switches 0:0e018d759a2a 154 * *old = *p
switches 0:0e018d759a2a 155 * return false
switches 0:0e018d759a2a 156 * }
switches 0:0e018d759a2a 157 * *p = new
switches 0:0e018d759a2a 158 * return true
switches 0:0e018d759a2a 159 * }
switches 0:0e018d759a2a 160 *
switches 0:0e018d759a2a 161 * @Note: In the failure case (where the destination isn't set), the value
switches 0:0e018d759a2a 162 * pointed to by expectedCurrentValue is still updated with the current value.
switches 0:0e018d759a2a 163 * This property helps writing concise code for the following incr:
switches 0:0e018d759a2a 164 *
switches 0:0e018d759a2a 165 * function incr(p : pointer to int, a : int) returns int {
switches 0:0e018d759a2a 166 * done = false
switches 0:0e018d759a2a 167 * value = *p // This fetch operation need not be atomic.
switches 0:0e018d759a2a 168 * while not done {
switches 0:0e018d759a2a 169 * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
switches 0:0e018d759a2a 170 * }
switches 0:0e018d759a2a 171 * return value + a
switches 0:0e018d759a2a 172 * }
switches 0:0e018d759a2a 173 */
switches 0:0e018d759a2a 174 bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue);
switches 0:0e018d759a2a 175
switches 0:0e018d759a2a 176 /**
switches 0:0e018d759a2a 177 * Atomic compare and set. It compares the contents of a memory location to a
switches 0:0e018d759a2a 178 * given value and, only if they are the same, modifies the contents of that
switches 0:0e018d759a2a 179 * memory location to a given new value. This is done as a single atomic
switches 0:0e018d759a2a 180 * operation. The atomicity guarantees that the new value is calculated based on
switches 0:0e018d759a2a 181 * up-to-date information; if the value had been updated by another thread in
switches 0:0e018d759a2a 182 * the meantime, the write would fail due to a mismatched expectedCurrentValue.
switches 0:0e018d759a2a 183 *
switches 0:0e018d759a2a 184 * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
switches 0:0e018d759a2a 185 * you to the article on compare-and swap].
switches 0:0e018d759a2a 186 *
switches 0:0e018d759a2a 187 * @param ptr The target memory location.
switches 0:0e018d759a2a 188 * @param[in,out] expectedCurrentValue A pointer to some location holding the
switches 0:0e018d759a2a 189 * expected current value of the data being set atomically.
switches 0:0e018d759a2a 190 * The computed 'desiredValue' should be a function of this current value.
switches 0:0e018d759a2a 191 * @Note: This is an in-out parameter. In the
switches 0:0e018d759a2a 192 * failure case of atomic_cas (where the
switches 0:0e018d759a2a 193 * destination isn't set), the pointee of expectedCurrentValue is
switches 0:0e018d759a2a 194 * updated with the current value.
switches 0:0e018d759a2a 195 * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
switches 0:0e018d759a2a 196 *
switches 0:0e018d759a2a 197 * @return true if the memory location was atomically
switches 0:0e018d759a2a 198 * updated with the desired value (after verifying
switches 0:0e018d759a2a 199 * that it contained the expectedCurrentValue),
switches 0:0e018d759a2a 200 * false otherwise. In the failure case,
switches 0:0e018d759a2a 201 * exepctedCurrentValue is updated with the new
switches 0:0e018d759a2a 202 * value of the target memory location.
switches 0:0e018d759a2a 203 *
switches 0:0e018d759a2a 204 * pseudocode:
switches 0:0e018d759a2a 205 * function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
switches 0:0e018d759a2a 206 * if *p != *old {
switches 0:0e018d759a2a 207 * *old = *p
switches 0:0e018d759a2a 208 * return false
switches 0:0e018d759a2a 209 * }
switches 0:0e018d759a2a 210 * *p = new
switches 0:0e018d759a2a 211 * return true
switches 0:0e018d759a2a 212 * }
switches 0:0e018d759a2a 213 *
switches 0:0e018d759a2a 214 * @Note: In the failure case (where the destination isn't set), the value
switches 0:0e018d759a2a 215 * pointed to by expectedCurrentValue is still updated with the current value.
switches 0:0e018d759a2a 216 * This property helps writing concise code for the following incr:
switches 0:0e018d759a2a 217 *
switches 0:0e018d759a2a 218 * function incr(p : pointer to int, a : int) returns int {
switches 0:0e018d759a2a 219 * done = false
switches 0:0e018d759a2a 220 * value = *p // This fetch operation need not be atomic.
switches 0:0e018d759a2a 221 * while not done {
switches 0:0e018d759a2a 222 * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
switches 0:0e018d759a2a 223 * }
switches 0:0e018d759a2a 224 * return value + a
switches 0:0e018d759a2a 225 * }
switches 0:0e018d759a2a 226 */
switches 0:0e018d759a2a 227 bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue);
switches 0:0e018d759a2a 228
switches 0:0e018d759a2a 229 /**
switches 0:0e018d759a2a 230 * Atomic compare and set. It compares the contents of a memory location to a
switches 0:0e018d759a2a 231 * given value and, only if they are the same, modifies the contents of that
switches 0:0e018d759a2a 232 * memory location to a given new value. This is done as a single atomic
switches 0:0e018d759a2a 233 * operation. The atomicity guarantees that the new value is calculated based on
switches 0:0e018d759a2a 234 * up-to-date information; if the value had been updated by another thread in
switches 0:0e018d759a2a 235 * the meantime, the write would fail due to a mismatched expectedCurrentValue.
switches 0:0e018d759a2a 236 *
switches 0:0e018d759a2a 237 * Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
switches 0:0e018d759a2a 238 * you to the article on compare-and swap].
switches 0:0e018d759a2a 239 *
switches 0:0e018d759a2a 240 * @param ptr The target memory location.
switches 0:0e018d759a2a 241 * @param[in,out] expectedCurrentValue A pointer to some location holding the
switches 0:0e018d759a2a 242 * expected current value of the data being set atomically.
switches 0:0e018d759a2a 243 * The computed 'desiredValue' should be a function of this current value.
switches 0:0e018d759a2a 244 * @Note: This is an in-out parameter. In the
switches 0:0e018d759a2a 245 * failure case of atomic_cas (where the
switches 0:0e018d759a2a 246 * destination isn't set), the pointee of expectedCurrentValue is
switches 0:0e018d759a2a 247 * updated with the current value.
switches 0:0e018d759a2a 248 * @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
switches 0:0e018d759a2a 249 *
switches 0:0e018d759a2a 250 * @return true if the memory location was atomically
switches 0:0e018d759a2a 251 * updated with the desired value (after verifying
switches 0:0e018d759a2a 252 * that it contained the expectedCurrentValue),
switches 0:0e018d759a2a 253 * false otherwise. In the failure case,
switches 0:0e018d759a2a 254 * exepctedCurrentValue is updated with the new
switches 0:0e018d759a2a 255 * value of the target memory location.
switches 0:0e018d759a2a 256 *
switches 0:0e018d759a2a 257 * pseudocode:
switches 0:0e018d759a2a 258 * function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
switches 0:0e018d759a2a 259 * if *p != *old {
switches 0:0e018d759a2a 260 * *old = *p
switches 0:0e018d759a2a 261 * return false
switches 0:0e018d759a2a 262 * }
switches 0:0e018d759a2a 263 * *p = new
switches 0:0e018d759a2a 264 * return true
switches 0:0e018d759a2a 265 * }
switches 0:0e018d759a2a 266 *
switches 0:0e018d759a2a 267 * @Note: In the failure case (where the destination isn't set), the value
switches 0:0e018d759a2a 268 * pointed to by expectedCurrentValue is still updated with the current value.
switches 0:0e018d759a2a 269 * This property helps writing concise code for the following incr:
switches 0:0e018d759a2a 270 *
switches 0:0e018d759a2a 271 * function incr(p : pointer to int, a : int) returns int {
switches 0:0e018d759a2a 272 * done = false
switches 0:0e018d759a2a 273 * value = *p // This fetch operation need not be atomic.
switches 0:0e018d759a2a 274 * while not done {
switches 0:0e018d759a2a 275 * done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
switches 0:0e018d759a2a 276 * }
switches 0:0e018d759a2a 277 * return value + a
switches 0:0e018d759a2a 278 * }
switches 0:0e018d759a2a 279 */
switches 0:0e018d759a2a 280 bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue);
switches 0:0e018d759a2a 281
switches 0:0e018d759a2a 282 /**
switches 0:0e018d759a2a 283 * Atomic increment.
switches 0:0e018d759a2a 284 * @param valuePtr Target memory location being incremented.
switches 0:0e018d759a2a 285 * @param delta The amount being incremented.
switches 0:0e018d759a2a 286 * @return The new incremented value.
switches 0:0e018d759a2a 287 */
switches 0:0e018d759a2a 288 uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta);
switches 0:0e018d759a2a 289
switches 0:0e018d759a2a 290 /**
switches 0:0e018d759a2a 291 * Atomic increment.
switches 0:0e018d759a2a 292 * @param valuePtr Target memory location being incremented.
switches 0:0e018d759a2a 293 * @param delta The amount being incremented.
switches 0:0e018d759a2a 294 * @return The new incremented value.
switches 0:0e018d759a2a 295 */
switches 0:0e018d759a2a 296 uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta);
switches 0:0e018d759a2a 297
switches 0:0e018d759a2a 298 /**
switches 0:0e018d759a2a 299 * Atomic increment.
switches 0:0e018d759a2a 300 * @param valuePtr Target memory location being incremented.
switches 0:0e018d759a2a 301 * @param delta The amount being incremented.
switches 0:0e018d759a2a 302 * @return The new incremented value.
switches 0:0e018d759a2a 303 */
switches 0:0e018d759a2a 304 uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta);
switches 0:0e018d759a2a 305
switches 0:0e018d759a2a 306 /**
switches 0:0e018d759a2a 307 * Atomic increment.
switches 0:0e018d759a2a 308 * @param valuePtr Target memory location being incremented.
switches 0:0e018d759a2a 309 * @param delta The amount being incremented in bytes.
switches 0:0e018d759a2a 310 * @return The new incremented value.
switches 0:0e018d759a2a 311 *
switches 0:0e018d759a2a 312 * @note The type of the pointer argument is not taken into account
switches 0:0e018d759a2a 313 * and the pointer is incremented by bytes.
switches 0:0e018d759a2a 314 */
switches 0:0e018d759a2a 315 void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta);
switches 0:0e018d759a2a 316
switches 0:0e018d759a2a 317 /**
switches 0:0e018d759a2a 318 * Atomic decrement.
switches 0:0e018d759a2a 319 * @param valuePtr Target memory location being decremented.
switches 0:0e018d759a2a 320 * @param delta The amount being decremented.
switches 0:0e018d759a2a 321 * @return The new decremented value.
switches 0:0e018d759a2a 322 */
switches 0:0e018d759a2a 323 uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta);
switches 0:0e018d759a2a 324
switches 0:0e018d759a2a 325 /**
switches 0:0e018d759a2a 326 * Atomic decrement.
switches 0:0e018d759a2a 327 * @param valuePtr Target memory location being decremented.
switches 0:0e018d759a2a 328 * @param delta The amount being decremented.
switches 0:0e018d759a2a 329 * @return The new decremented value.
switches 0:0e018d759a2a 330 */
switches 0:0e018d759a2a 331 uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta);
switches 0:0e018d759a2a 332
switches 0:0e018d759a2a 333 /**
switches 0:0e018d759a2a 334 * Atomic decrement.
switches 0:0e018d759a2a 335 * @param valuePtr Target memory location being decremented.
switches 0:0e018d759a2a 336 * @param delta The amount being decremented.
switches 0:0e018d759a2a 337 * @return The new decremented value.
switches 0:0e018d759a2a 338 */
switches 0:0e018d759a2a 339 uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta);
switches 0:0e018d759a2a 340
switches 0:0e018d759a2a 341 /**
switches 0:0e018d759a2a 342 * Atomic decrement.
switches 0:0e018d759a2a 343 * @param valuePtr Target memory location being decremented.
switches 0:0e018d759a2a 344 * @param delta The amount being decremented in bytes.
switches 0:0e018d759a2a 345 * @return The new decremented value.
switches 0:0e018d759a2a 346 *
switches 0:0e018d759a2a 347 * @note The type of the pointer argument is not taken into account
switches 0:0e018d759a2a 348 * and the pointer is decremented by bytes
switches 0:0e018d759a2a 349 */
switches 0:0e018d759a2a 350 void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta);
switches 0:0e018d759a2a 351
switches 0:0e018d759a2a 352 #ifdef __cplusplus
switches 0:0e018d759a2a 353 } // extern "C"
switches 0:0e018d759a2a 354 #endif
switches 0:0e018d759a2a 355
switches 0:0e018d759a2a 356
switches 0:0e018d759a2a 357 #endif // __MBED_UTIL_CRITICAL_H__
switches 0:0e018d759a2a 358
switches 0:0e018d759a2a 359 /** @}*/