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:
Kojto
Date:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
128:9bcdf88f62b0
Child:
138:093f2bd7b9eb
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

Who changed what in which revision?

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