mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

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