Ignore:
Timestamp:
Apr 5, 2019, 9:26:53 PM (5 years ago)
Author:
coas-nagasima
Message:

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_critical.h

    r352 r374  
    11
    2 /** \addtogroup platform */
    3 /** @{*/
    42/*
    53 * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
     
    3028#endif
    3129
     30/** \addtogroup platform */
     31/** @{*/
     32/**
     33 * \defgroup platform_critical critical section function
     34 * @{
     35 */
    3236
    3337/** Determine the current interrupts enabled state
    3438  *
    3539  * This function can be called to determine whether or not interrupts are currently enabled.
    36   * \note
     40  * @note
    3741  * NOTE:
    3842  * This function works for both cortex-A and cortex-M, although the underlyng implementation
     
    4246bool core_util_are_interrupts_enabled(void);
    4347
     48/** Determine if this code is executing from an interrupt
     49  *
     50  * This function can be called to determine if the code is running on interrupt context.
     51  * @note
     52  * NOTE:
     53  * This function works for both cortex-A and cortex-M, although the underlyng implementation
     54  * differs.
     55  * @return true if in an isr, false otherwise
     56  */
     57bool core_util_is_isr_active(void);
     58
    4459/** Mark the start of a critical section
    4560  *
    4661  * This function should be called to mark the start of a critical section of code.
    47   * \note
     62  * @note
    4863  * NOTES:
    4964  * 1) The use of this style of critical section is targetted at C based implementations.
     
    5873  *
    5974  * This function should be called to mark the end of a critical section of code.
    60   * \note
     75  * @note
    6176  * NOTES:
    6277  * 1) The use of this style of critical section is targetted at C based implementations.
     
    6984
    7085/**
     86 * Determine if we are currently in a critical section
     87 *
     88 * @return true if in a critical section, false otherwise.
     89 */
     90bool core_util_in_critical_section(void);
     91
     92/**
    7193 * Atomic compare and set. It compares the contents of a memory location to a
    7294 * given value and, only if they are the same, modifies the contents of that
     
    83105 *                              expected current value of the data being set atomically.
    84106 *                              The computed 'desiredValue' should be a function of this current value.
    85  *                              @Note: This is an in-out parameter. In the
     107 *                              @note: This is an in-out parameter. In the
    86108 *                              failure case of atomic_cas (where the
    87109 *                              destination isn't set), the pointee of expectedCurrentValue is
     
    106128 * }
    107129 *
    108  * @Note: In the failure case (where the destination isn't set), the value
    109  * pointed to by expectedCurrentValue is still updated with the current value.
     130 * @note: In the failure case (where the destination isn't set), the value
     131 * pointed to by expectedCurrentValue is instead updated with the current value.
    110132 * This property helps writing concise code for the following incr:
    111133 *
     
    118140 *     return value + a
    119141 * }
    120  */
    121 bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue);
     142 *
     143 * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
     144 * always succeeds if the current value is expected, as per the pseudocode
     145 * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
     146 */
     147bool core_util_atomic_cas_u8(volatile uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue);
    122148
    123149/**
     
    136162 *                              expected current value of the data being set atomically.
    137163 *                              The computed 'desiredValue' should be a function of this current value.
    138  *                              @Note: This is an in-out parameter. In the
     164 *                              @note: This is an in-out parameter. In the
    139165 *                              failure case of atomic_cas (where the
    140166 *                              destination isn't set), the pointee of expectedCurrentValue is
     
    159185 * }
    160186 *
    161  * @Note: In the failure case (where the destination isn't set), the value
    162  * pointed to by expectedCurrentValue is still updated with the current value.
     187 * @note: In the failure case (where the destination isn't set), the value
     188 * pointed to by expectedCurrentValue is instead updated with the current value.
    163189 * This property helps writing concise code for the following incr:
    164190 *
     
    171197 *     return value + a
    172198 * }
    173  */
    174 bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue);
     199 *
     200 * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
     201 * always succeeds if the current value is expected, as per the pseudocode
     202 * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
     203 */
     204bool core_util_atomic_cas_u16(volatile uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue);
    175205
    176206/**
     
    189219 *                              expected current value of the data being set atomically.
    190220 *                              The computed 'desiredValue' should be a function of this current value.
    191  *                              @Note: This is an in-out parameter. In the
     221 *                              @note: This is an in-out parameter. In the
    192222 *                              failure case of atomic_cas (where the
    193223 *                              destination isn't set), the pointee of expectedCurrentValue is
     
    212242 * }
    213243 *
    214  * @Note: In the failure case (where the destination isn't set), the value
    215  * pointed to by expectedCurrentValue is still updated with the current value.
     244 * @note: In the failure case (where the destination isn't set), the value
     245 * pointed to by expectedCurrentValue is instead updated with the current value.
    216246 * This property helps writing concise code for the following incr:
    217247 *
     
    223253 *     }
    224254 *     return value + a
    225  * }
    226  */
    227 bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue);
     255 *
     256 * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
     257 * always succeeds if the current value is expected, as per the pseudocode
     258 * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
     259 * }
     260 */
     261bool core_util_atomic_cas_u32(volatile uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue);
    228262
    229263/**
     
    242276 *                              expected current value of the data being set atomically.
    243277 *                              The computed 'desiredValue' should be a function of this current value.
    244  *                              @Note: This is an in-out parameter. In the
     278 *                              @note: This is an in-out parameter. In the
    245279 *                              failure case of atomic_cas (where the
    246280 *                              destination isn't set), the pointee of expectedCurrentValue is
     
    265299 * }
    266300 *
    267  * @Note: In the failure case (where the destination isn't set), the value
    268  * pointed to by expectedCurrentValue is still updated with the current value.
     301 * @note: In the failure case (where the destination isn't set), the value
     302 * pointed to by expectedCurrentValue is instead updated with the current value.
    269303 * This property helps writing concise code for the following incr:
    270304 *
     
    277311 *     return value + a
    278312 * }
    279  */
    280 bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue);
     313 *
     314 * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
     315 * always succeeds if the current value is expected, as per the pseudocode
     316 * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
     317 */
     318bool core_util_atomic_cas_ptr(void *volatile *ptr, void **expectedCurrentValue, void *desiredValue);
    281319
    282320/**
     
    286324 * @return          The new incremented value.
    287325 */
    288 uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta);
     326uint8_t core_util_atomic_incr_u8(volatile uint8_t *valuePtr, uint8_t delta);
    289327
    290328/**
     
    294332 * @return          The new incremented value.
    295333 */
    296 uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta);
     334uint16_t core_util_atomic_incr_u16(volatile uint16_t *valuePtr, uint16_t delta);
    297335
    298336/**
     
    302340 * @return          The new incremented value.
    303341 */
    304 uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta);
     342uint32_t core_util_atomic_incr_u32(volatile uint32_t *valuePtr, uint32_t delta);
    305343
    306344/**
     
    313351 *       and the pointer is incremented by bytes.
    314352 */
    315 void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta);
     353void *core_util_atomic_incr_ptr(void *volatile *valuePtr, ptrdiff_t delta);
    316354
    317355/**
     
    321359 * @return          The new decremented value.
    322360 */
    323 uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta);
     361uint8_t core_util_atomic_decr_u8(volatile uint8_t *valuePtr, uint8_t delta);
    324362
    325363/**
     
    329367 * @return          The new decremented value.
    330368 */
    331 uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta);
     369uint16_t core_util_atomic_decr_u16(volatile uint16_t *valuePtr, uint16_t delta);
    332370
    333371/**
     
    337375 * @return          The new decremented value.
    338376 */
    339 uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta);
     377uint32_t core_util_atomic_decr_u32(volatile uint32_t *valuePtr, uint32_t delta);
    340378
    341379/**
     
    348386 *       and the pointer is decremented by bytes
    349387 */
    350 void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta);
     388void *core_util_atomic_decr_ptr(void *volatile *valuePtr, ptrdiff_t delta);
    351389
    352390#ifdef __cplusplus
    353391} // extern "C"
    354392#endif
    355 
     393/**@}*/
     394
     395/**@}*/
    356396
    357397#endif // __MBED_UTIL_CRITICAL_H__
    358398
    359 /** @}*/
     399
     400
Note: See TracChangeset for help on using the changeset viewer.