This is the final version of Mini Gateway for Automation and Security desgined for Renesas GR Peach Design Contest

Dependencies:   GR-PEACH_video GraphicsFramework HTTPServer R_BSP mbed-rpc mbed-rtos Socket lwip-eth lwip-sys lwip FATFileSystem

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
vipinranka
Date:
Wed Jan 11 11:41:30 2017 +0000
Revision:
12:9a20164dcc47
This is the final version MGAS Project for Renesas GR Peach Design Contest

Who changed what in which revision?

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