The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Jun 21 17:31:38 2017 +0100
Revision:
145:64910690c574
Parent:
138:093f2bd7b9eb
Release 145 of the mbed library.

Who changed what in which revision?

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