Modification of Mbed-dev library for LQFP48 package microcontrollers: STM32F103C8 (STM32F103C8T6) and STM32F103CB (STM32F103CBT6) (Bluepill boards, Maple mini etc. )

Fork of mbed-STM32F103C8_org by Nothing Special

Library for STM32F103C8 (Bluepill boards etc.).
Use this instead of mbed library.
This library allows the size of the code in the FLASH up to 128kB. Therefore, code also runs on microcontrollers STM32F103CB (eg. Maple mini).
But in the case of STM32F103C8, check the size of the resulting code would not exceed 64kB.

To compile a program with this library, use NUCLEO-F103RB as the target name. !

Changes:

  • Corrected initialization of the HSE + crystal clock (mbed permanent bug), allowing the use of on-board xtal (8MHz).(1)
  • Additionally, it also set USB clock (48Mhz).(2)
  • Definitions of pins and peripherals adjusted to LQFP48 case.
  • Board led LED1 is now PC_13 (3)
  • USER_BUTTON is now PC_14 (4)

    Now the library is complete rebuilt based on mbed-dev v160 (and not yet fully tested).

notes
(1) - In case 8MHz xtal on board, CPU frequency is 72MHz. Without xtal is 64MHz.
(2) - Using the USB interface is only possible if STM32 is clocking by on-board 8MHz xtal or external clock signal 8MHz on the OSC_IN pin.
(3) - On Bluepill board led operation is reversed, i.e. 0 - led on, 1 - led off.
(4) - Bluepill board has no real user button

Information

After export to SW4STM (AC6):

  • add line #include "mbed_config.h" in files Serial.h and RawSerial.h
  • in project properties change Optimisation Level to Optimise for size (-Os)
Committer:
mega64
Date:
Thu Apr 27 23:56:38 2017 +0000
Revision:
148:8b0b02bf146f
Parent:
146:03e976389d16
Remove unnecessary folders

Who changed what in which revision?

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