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:
<>
Date:
Tue Mar 14 16:20:51 2017 +0000
Revision:
138:093f2bd7b9eb
Child:
145:64910690c574
Release 138 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3716: fix for issue #3715: correction in startup files for ARM and IAR, alignment of system_stm32f429xx.c files https://github.com/ARMmbed/mbed-os/pull/3716
3741: STM32 remove warning in hal_tick_32b.c file https://github.com/ARMmbed/mbed-os/pull/3741
3780: STM32L4 : Fix GPIO G port compatibility https://github.com/ARMmbed/mbed-os/pull/3780
3831: NCS36510: SPISLAVE enabled (Conflict resolved) https://github.com/ARMmbed/mbed-os/pull/3831
3836: Allow to redefine nRF's PSTORAGE_NUM_OF_PAGES outside of the mbed-os https://github.com/ARMmbed/mbed-os/pull/3836
3840: STM32: gpio SPEED - always set High Speed by default https://github.com/ARMmbed/mbed-os/pull/3840
3844: STM32 GPIO: Typo correction. Update comment (GPIO_IP_WITHOUT_BRR) https://github.com/ARMmbed/mbed-os/pull/3844
3850: STM32: change spi error to debug warning https://github.com/ARMmbed/mbed-os/pull/3850
3860: Define GPIO_IP_WITHOUT_BRR for xDot platform https://github.com/ARMmbed/mbed-os/pull/3860
3880: DISCO_F469NI: allow the use of CAN2 instance when CAN1 is not activated https://github.com/ARMmbed/mbed-os/pull/3880
3795: Fix pwm period calc https://github.com/ARMmbed/mbed-os/pull/3795
3828: STM32 CAN API: correct format and type https://github.com/ARMmbed/mbed-os/pull/3828
3842: TARGET_NRF: corrected spi_init() to properly handle re-initialization https://github.com/ARMmbed/mbed-os/pull/3842
3843: STM32L476xG: set APB2 clock to 80MHz (instead of 40MHz) https://github.com/ARMmbed/mbed-os/pull/3843
3879: NUCLEO_F446ZE: Add missing AnalogIn pins on PF_3, PF_5 and PF_10. https://github.com/ARMmbed/mbed-os/pull/3879
3902: Fix heap and stack size for NUCLEO_F746ZG https://github.com/ARMmbed/mbed-os/pull/3902
3829: can_write(): return error code when no tx mailboxes are available https://github.com/ARMmbed/mbed-os/pull/3829

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