PIR grove sensor that sends the sensed data to Thingspeak.com through the wifi module ESP 8266

Dependencies:   mbed

Committer:
skrawool
Date:
Mon Dec 05 16:39:27 2016 +0000
Revision:
0:3954a906acc2
PIR grove sensor that sends the sensed data to thingspeak through the wifi module ESP 8266

Who changed what in which revision?

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