Changeset 29f7d317 in rtems


Ignore:
Timestamp:
Sep 2, 2013, 1:08:05 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
3bac8a4c
Parents:
0c47440
git-author:
Sebastian Huber <sebastian.huber@…> (09/02/13 13:08:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/03/13 09:07:36)
Message:

score: Use unsigned long for atomic integers

Use unsigned long instead of uint_fast32_t since C11 provides only a
ATOMIC_LONG_LOCK_FREE macro constant. This makes it also possible to
use properly typed integer literals like 123UL. It is now clear which
compatible type should be used for the atomic integer.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/atomic.h

    r0c47440 r29f7d317  
    3535 * @brief atomic data initializer for static initialization.
    3636 */
    37 #define ATOMIC_INITIALIZER_UINT(value) CPU_ATOMIC_INITIALIZER_UINT(value)
     37#define ATOMIC_INITIALIZER_ULONG(value) CPU_ATOMIC_INITIALIZER_ULONG(value)
    3838#define ATOMIC_INITIALIZER_PTR(value) CPU_ATOMIC_INITIALIZER_PTR(value)
    3939
     
    4949 * @param value a value to be stored into object.
    5050 */
    51 static inline void _Atomic_Init_uint(
    52   volatile Atomic_Uint *object,
    53   uint_fast32_t value
    54 )
    55 {
    56   _CPU_atomic_Init_uint(object, value);
     51static inline void _Atomic_Init_ulong(
     52  volatile Atomic_Ulong *object,
     53  unsigned long value
     54)
     55{
     56  _CPU_atomic_Init_ulong(object, value);
    5757}
    5858
     
    7373 * The order shall not be ATOMIC_ORDER_RELEASE.
    7474 */
    75 static inline uint_fast32_t _Atomic_Load_uint(
    76   volatile Atomic_Uint *object,
    77   Atomic_Order order
    78 )
    79 {
    80   return _CPU_atomic_Load_uint( object, order );
     75static inline unsigned long _Atomic_Load_ulong(
     76  volatile Atomic_Ulong *object,
     77  Atomic_Order order
     78)
     79{
     80  return _CPU_atomic_Load_ulong( object, order );
    8181}
    8282
     
    9898 * The order shall not be ATOMIC_ORDER_ACQUIRE.
    9999 */
    100 static inline void _Atomic_Store_uint(
    101   volatile Atomic_Uint *object,
    102   uint_fast32_t value,
    103   Atomic_Order order
    104 )
    105 {
    106   _CPU_atomic_Store_uint( object, value, order );
     100static inline void _Atomic_Store_ulong(
     101  volatile Atomic_Ulong *object,
     102  unsigned long value,
     103  Atomic_Order order
     104)
     105{
     106  _CPU_atomic_Store_ulong( object, value, order );
    107107}
    108108
     
    125125 * @retval a result value before add ops.
    126126 */
    127 static inline uint_fast32_t _Atomic_Fetch_add_uint(
    128   volatile Atomic_Uint *object,
    129   uint_fast32_t value,
    130   Atomic_Order order
    131 )
    132 {
    133   return _CPU_atomic_Fetch_add_uint( object, value, order );
     127static inline unsigned long _Atomic_Fetch_add_ulong(
     128  volatile Atomic_Ulong *object,
     129  unsigned long value,
     130  Atomic_Order order
     131)
     132{
     133  return _CPU_atomic_Fetch_add_ulong( object, value, order );
    134134}
    135135
     
    152152 * @retval a result value before sub ops.
    153153 */
    154 static inline uint_fast32_t _Atomic_Fetch_sub_uint(
    155   volatile Atomic_Uint *object,
    156   uint_fast32_t value,
    157   Atomic_Order order
    158 )
    159 {
    160   return _CPU_atomic_Fetch_sub_uint( object, value, order );
     154static inline unsigned long _Atomic_Fetch_sub_ulong(
     155  volatile Atomic_Ulong *object,
     156  unsigned long value,
     157  Atomic_Order order
     158)
     159{
     160  return _CPU_atomic_Fetch_sub_ulong( object, value, order );
    161161}
    162162
     
    179179 * @retval a result value before or ops.
    180180 */
    181 static inline uint_fast32_t _Atomic_Fetch_or_uint(
    182   volatile Atomic_Uint *object,
    183   uint_fast32_t value,
    184   Atomic_Order order
    185 )
    186 {
    187   return _CPU_atomic_Fetch_or_uint( object, value, order );
     181static inline unsigned long _Atomic_Fetch_or_ulong(
     182  volatile Atomic_Ulong *object,
     183  unsigned long value,
     184  Atomic_Order order
     185)
     186{
     187  return _CPU_atomic_Fetch_or_ulong( object, value, order );
    188188}
    189189
     
    206206 * @retval a result value before and ops.
    207207 */
    208 static inline uint_fast32_t _Atomic_Fetch_and_uint(
    209   volatile Atomic_Uint *object,
    210   uint_fast32_t value,
    211   Atomic_Order order
    212 )
    213 {
    214   return _CPU_atomic_Fetch_and_uint( object, value, order );
     208static inline unsigned long _Atomic_Fetch_and_ulong(
     209  volatile Atomic_Ulong *object,
     210  unsigned long value,
     211  Atomic_Order order
     212)
     213{
     214  return _CPU_atomic_Fetch_and_ulong( object, value, order );
    215215}
    216216
     
    233233 * @retval a result value before exchange ops.
    234234 */
    235 static inline uint_fast32_t _Atomic_Exchange_uint(
    236  volatile Atomic_Uint *object,
    237  uint_fast32_t value,
     235static inline unsigned long _Atomic_Exchange_ulong(
     236 volatile Atomic_Ulong *object,
     237 unsigned long value,
    238238 Atomic_Order order
    239239)
    240240{
    241   return _CPU_atomic_Exchange_uint( object, value, order );
     241  return _CPU_atomic_Exchange_ulong( object, value, order );
    242242}
    243243
     
    265265 * @retval false if the compare exchange failed.
    266266 */
    267 static inline bool _Atomic_Compare_exchange_uint(
    268   volatile Atomic_Uint *object,
    269   uint_fast32_t *old_value,
    270   uint_fast32_t new_value,
     267static inline bool _Atomic_Compare_exchange_ulong(
     268  volatile Atomic_Ulong *object,
     269  unsigned long *old_value,
     270  unsigned long new_value,
    271271  Atomic_Order order_succ,
    272272  Atomic_Order order_fail
    273273)
    274274{
    275   return _CPU_atomic_Compare_exchange_uint( object, old_value, new_value,
     275  return _CPU_atomic_Compare_exchange_ulong( object, old_value, new_value,
    276276    order_succ, order_fail );
    277277}
  • cpukit/score/include/rtems/score/cpustdatomic.h

    r0c47440 r29f7d317  
    3636 * @brief atomic operation unsigned integer type
    3737 */
    38 typedef atomic_uint_fast32_t Atomic_Uint;
     38typedef atomic_ulong Atomic_Ulong;
    3939
    4040/**
     
    7272 * @brief atomic data initializer for static initialization.
    7373 */
    74 #define CPU_ATOMIC_INITIALIZER_UINT(value) ATOMIC_VAR_INIT(value)
     74#define CPU_ATOMIC_INITIALIZER_ULONG(value) ATOMIC_VAR_INIT(value)
    7575#define CPU_ATOMIC_INITIALIZER_PTR(value) ATOMIC_VAR_INIT(value)
    7676
     
    8383 * @param value a value to be stored into object.
    8484 */
    85 static inline void _CPU_atomic_Init_uint(
    86   volatile Atomic_Uint *object,
    87   uint_fast32_t value
     85static inline void _CPU_atomic_Init_ulong(
     86  volatile Atomic_Ulong *object,
     87  unsigned long value
    8888)
    8989{
     
    107107 * The order shall not be ATOMIC_ORDER_RELEASE.
    108108 */
    109 static inline uint_fast32_t _CPU_atomic_Load_uint(
    110   volatile Atomic_Uint *object,
     109static inline unsigned long _CPU_atomic_Load_ulong(
     110  volatile Atomic_Ulong *object,
    111111  Atomic_Order order
    112112)
     
    132132 * The order shall not be ATOMIC_ORDER_ACQUIRE.
    133133 */
    134 static inline void _CPU_atomic_Store_uint(
    135   volatile Atomic_Uint *object,
    136   uint_fast32_t value,
     134static inline void _CPU_atomic_Store_ulong(
     135  volatile Atomic_Ulong *object,
     136  unsigned long value,
    137137  Atomic_Order order
    138138)
     
    159159 * @retval a result value before add ops.
    160160 */
    161 static inline uint_fast32_t _CPU_atomic_Fetch_add_uint(
    162   volatile Atomic_Uint *object,
    163   uint_fast32_t value,
     161static inline unsigned long _CPU_atomic_Fetch_add_ulong(
     162  volatile Atomic_Ulong *object,
     163  unsigned long value,
    164164  Atomic_Order order
    165165)
     
    186186 * @retval a result value before sub ops.
    187187 */
    188 static inline uint_fast32_t _CPU_atomic_Fetch_sub_uint(
    189   volatile Atomic_Uint *object,
    190   uint_fast32_t value,
     188static inline unsigned long _CPU_atomic_Fetch_sub_ulong(
     189  volatile Atomic_Ulong *object,
     190  unsigned long value,
    191191  Atomic_Order order
    192192)
     
    213213 * @retval a result value before or ops.
    214214 */
    215 static inline uint_fast32_t _CPU_atomic_Fetch_or_uint(
    216   volatile Atomic_Uint *object,
    217   uint_fast32_t value,
     215static inline unsigned long _CPU_atomic_Fetch_or_ulong(
     216  volatile Atomic_Ulong *object,
     217  unsigned long value,
    218218  Atomic_Order order
    219219)
     
    240240 * @retval a result value before and ops.
    241241 */
    242 static inline uint_fast32_t _CPU_atomic_Fetch_and_uint(
    243   volatile Atomic_Uint *object,
    244   uint_fast32_t value,
     242static inline unsigned long _CPU_atomic_Fetch_and_ulong(
     243  volatile Atomic_Ulong *object,
     244  unsigned long value,
    245245  Atomic_Order order
    246246)
     
    267267 * @retval a result value before exchange ops.
    268268 */
    269 static inline uint_fast32_t _CPU_atomic_Exchange_uint(
    270  volatile Atomic_Uint *object,
    271  uint_fast32_t value,
     269static inline unsigned long _CPU_atomic_Exchange_ulong(
     270 volatile Atomic_Ulong *object,
     271 unsigned long value,
    272272 Atomic_Order order
    273273)
     
    299299 * @retval false if the compare exchange failed.
    300300 */
    301 static inline bool _CPU_atomic_Compare_exchange_uint(
    302   volatile Atomic_Uint *object,
    303   uint_fast32_t *old_value,
    304   uint_fast32_t new_value,
     301static inline bool _CPU_atomic_Compare_exchange_ulong(
     302  volatile Atomic_Ulong *object,
     303  unsigned long *old_value,
     304  unsigned long new_value,
    305305  Atomic_Order order_succ,
    306306  Atomic_Order order_fail
  • testsuites/smptests/smpatomic01/tasks.c

    r0c47440 r29f7d317  
    5353  /* Print that the task is up and running. */
    5454  /* test relaxed barrier */
    55   ATOMIC_LOAD_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     55  ATOMIC_LOAD_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5656
    5757  ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    5858
    5959  /* test acquire barrier */
    60   ATOMIC_LOAD_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     60  ATOMIC_LOAD_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6161
    6262  ATOMIC_LOAD_NO_BARRIER(ptr, Pointer, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
  • testsuites/smptests/smpatomic02/tasks.c

    r0c47440 r29f7d317  
    5353  /* Print that the task is up and running. */
    5454  /* test relaxed barrier */
    55   ATOMIC_STORE_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     55  ATOMIC_STORE_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5656
    5757  ATOMIC_STORE_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    5858
    5959  /* test release barrier */
    60   ATOMIC_STORE_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     60  ATOMIC_STORE_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    6161
    6262  ATOMIC_STORE_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic03/tasks.c

    r0c47440 r29f7d317  
    5656  /* Print that the task is up and running. */
    5757  /* test relaxed barrier */
    58   ATOMIC_FETCH_ADD_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     58  ATOMIC_FETCH_ADD_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5959
    6060  ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    6161
    6262  /* test acquire barrier */
    63   ATOMIC_FETCH_ADD_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     63  ATOMIC_FETCH_ADD_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6464
    6565  ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6666
    6767  /* test release barrier */
    68   ATOMIC_FETCH_ADD_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     68  ATOMIC_FETCH_ADD_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    6969
    7070  ATOMIC_FETCH_ADD_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic04/tasks.c

    r0c47440 r29f7d317  
    5656  /* Print that the task is up and running. */
    5757  /* test relaxed barrier */
    58   ATOMIC_FETCH_SUB_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     58  ATOMIC_FETCH_SUB_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5959
    6060  ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    6161
    6262  /* test acquire barrier */
    63   ATOMIC_FETCH_SUB_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     63  ATOMIC_FETCH_SUB_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6464
    6565  ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6666
    6767  /* test release barrier */
    68   ATOMIC_FETCH_SUB_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     68  ATOMIC_FETCH_SUB_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    6969
    7070  ATOMIC_FETCH_SUB_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic05/tasks.c

    r0c47440 r29f7d317  
    5656  /* Print that the task is up and running. */
    5757  /* test relaxed barrier */
    58   ATOMIC_FETCH_AND_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     58  ATOMIC_FETCH_AND_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5959
    6060  ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    6161
    6262  /* test acquire barrier */
    63   ATOMIC_FETCH_AND_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     63  ATOMIC_FETCH_AND_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6464
    6565  ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6666
    6767  /* test release barrier */
    68   ATOMIC_FETCH_AND_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     68  ATOMIC_FETCH_AND_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    6969
    7070  ATOMIC_FETCH_AND_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic06/tasks.c

    r0c47440 r29f7d317  
    5656  /* Print that the task is up and running. */
    5757  /* test relaxed barrier */
    58   ATOMIC_FETCH_OR_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     58  ATOMIC_FETCH_OR_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    5959
    6060  ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    6161
    6262  /* test acquire barrier */
    63   ATOMIC_FETCH_OR_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     63  ATOMIC_FETCH_OR_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6464
    6565  ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
    6666
    6767  /* test release barrier */
    68   ATOMIC_FETCH_OR_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     68  ATOMIC_FETCH_OR_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    6969
    7070  ATOMIC_FETCH_OR_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic07/tasks.c

    r0c47440 r29f7d317  
    7272  /* Print that the task is up and running. */
    7373  /* test relaxed barrier */
    74   ATOMIC_CAS_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELAXED);
     74  ATOMIC_CAS_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELAXED);
    7575
    7676  ATOMIC_CAS_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELAXED);
    7777
    7878  /* test acquire barrier */
    79   ATOMIC_CAS_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
     79  ATOMIC_CAS_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_ACQUIRE);
    8080
    8181  ATOMIC_CAS_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_ACQUIRE);
    8282
    8383  /* test release barrier */
    84   ATOMIC_CAS_NO_BARRIER(uint, Uint, uint_fast32_t, cpu_num, ATOMIC_ORDER_RELEASE);
     84  ATOMIC_CAS_NO_BARRIER(ulong, Ulong, unsigned long, cpu_num, ATOMIC_ORDER_RELEASE);
    8585
    8686  ATOMIC_CAS_NO_BARRIER(ptr, Pointer, uintptr_t, cpu_num, ATOMIC_ORDER_RELEASE);
  • testsuites/smptests/smpatomic08/init.c

    r0c47440 r29f7d317  
    2525
    2626typedef struct {
    27         Atomic_Uint value;
    28         Atomic_Uint sense;
     27        Atomic_Ulong value;
     28        Atomic_Ulong sense;
    2929} SMP_barrier_Control;
    3030
    3131typedef struct {
    32         uint_fast32_t sense;
     32        unsigned long sense;
    3333} SMP_barrier_State;
    3434
    3535#define SMP_BARRIER_CONTROL_INITIALIZER \
    36   { ATOMIC_INITIALIZER_UINT( 0 ), ATOMIC_INITIALIZER_UINT( 0 ) }
     36  { ATOMIC_INITIALIZER_ULONG( 0 ), ATOMIC_INITIALIZER_ULONG( 0 ) }
    3737
    3838#define SMP_BARRIER_STATE_INITIALIZER { 0 }
     
    4141  SMP_barrier_Control *control,
    4242  SMP_barrier_State *state,
    43   uint_fast32_t count
     43  unsigned long count
    4444)
    4545{
    46   uint_fast32_t sense = ~state->sense;
    47   uint_fast32_t previous_value;
     46  unsigned long sense = ~state->sense;
     47  unsigned long previous_value;
    4848
    4949  state->sense = sense;
    5050
    51   previous_value = _Atomic_Fetch_add_uint(
     51  previous_value = _Atomic_Fetch_add_ulong(
    5252    &control->value,
    5353    1,
     
    5656
    5757  if ( previous_value + 1 == count ) {
    58     _Atomic_Store_uint( &control->value, 0, ATOMIC_ORDER_RELAXED );
    59     _Atomic_Store_uint( &control->sense, sense, ATOMIC_ORDER_RELEASE );
     58    _Atomic_Store_ulong( &control->value, 0, ATOMIC_ORDER_RELAXED );
     59    _Atomic_Store_ulong( &control->sense, sense, ATOMIC_ORDER_RELEASE );
    6060  } else {
    6161    while (
    62       _Atomic_Load_uint( &control->sense, ATOMIC_ORDER_ACQUIRE ) != sense
     62      _Atomic_Load_ulong( &control->sense, ATOMIC_ORDER_ACQUIRE ) != sense
    6363    ) {
    6464      /* Wait */
     
    7474
    7575typedef struct {
    76   Atomic_Uint stop;
     76  Atomic_Ulong stop;
    7777  SMP_barrier_Control barrier;
    7878  size_t worker_count;
    7979  rtems_id stop_worker_timer_id;
    80   Atomic_Uint atomic_value;
    81   uint_fast32_t per_worker_value[CPU_COUNT];
    82   uint32_t normal_value;
     80  Atomic_Ulong atomic_value;
     81  unsigned long per_worker_value[CPU_COUNT];
     82  unsigned long normal_value;
    8383  Atomic_Flag global_flag;
    8484} test_context;
     
    9191
    9292static test_context test_instance = {
    93   .stop = ATOMIC_INITIALIZER_UINT(0),
     93  .stop = ATOMIC_INITIALIZER_ULONG(0),
    9494  .barrier = SMP_BARRIER_CONTROL_INITIALIZER
    9595};
     
    9797static bool stop(test_context *ctx)
    9898{
    99   return _Atomic_Load_uint(&ctx->stop, ATOMIC_ORDER_RELAXED) != 0;
     99  return _Atomic_Load_ulong(&ctx->stop, ATOMIC_ORDER_RELAXED) != 0;
    100100}
    101101
     
    111111)
    112112{
    113   uint_fast32_t expected_value = 0;
    114   uint_fast32_t actual_value;
     113  unsigned long expected_value = 0;
     114  unsigned long actual_value;
    115115  size_t worker_index;
    116116
     
    118118
    119119  for (worker_index = 0; worker_index < ctx->worker_count; ++worker_index) {
    120     uint_fast32_t worker_value = ctx->per_worker_value[worker_index];
     120    unsigned long worker_value = ctx->per_worker_value[worker_index];
    121121
    122122    expected_value += worker_value;
    123123
    124124    printf(
    125       "worker %zu value: %" PRIuFAST32 "\n",
     125      "worker %zu value: %lu\n",
    126126      worker_index,
    127127      worker_value
     
    130130
    131131  if (atomic) {
    132     actual_value = _Atomic_Load_uint(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
     132    actual_value = _Atomic_Load_ulong(&ctx->atomic_value, ATOMIC_ORDER_RELAXED);
    133133  } else {
    134134    actual_value = ctx->normal_value;
     
    136136
    137137  printf(
    138     "atomic value: expected = %" PRIuFAST32 ", actual = %" PRIuFAST32 "\n",
     138    "atomic value: expected = %lu, actual = %lu\n",
    139139    expected_value,
    140140    actual_value
     
    146146static void test_atomic_add_init(test_context *ctx)
    147147{
    148   _Atomic_Init_uint(&ctx->atomic_value, 0);
     148  _Atomic_Init_ulong(&ctx->atomic_value, 0);
    149149}
    150150
    151151static void test_atomic_add_body(test_context *ctx, size_t worker_index)
    152152{
    153   uint_fast32_t counter = 0;
     153  unsigned long counter = 0;
    154154
    155155  while (!stop(ctx)) {
    156156    ++counter;
    157     _Atomic_Fetch_add_uint(&ctx->atomic_value, 1, ATOMIC_ORDER_RELAXED);
     157    _Atomic_Fetch_add_ulong(&ctx->atomic_value, 1, ATOMIC_ORDER_RELAXED);
    158158  }
    159159
     
    174174static void test_atomic_flag_body(test_context *ctx, size_t worker_index)
    175175{
    176   uint_fast32_t counter = 0;
     176  unsigned long counter = 0;
    177177
    178178  while (!stop(ctx)) {
     
    197197static void test_atomic_sub_init(test_context *ctx)
    198198{
    199   _Atomic_Init_uint(&ctx->atomic_value, 0);
     199  _Atomic_Init_ulong(&ctx->atomic_value, 0);
    200200}
    201201
    202202static void test_atomic_sub_body(test_context *ctx, size_t worker_index)
    203203{
    204   uint_fast32_t counter = 0;
     204  unsigned long counter = 0;
    205205
    206206  while (!stop(ctx)) {
    207207    --counter;
    208     _Atomic_Fetch_sub_uint(&ctx->atomic_value, 1, ATOMIC_ORDER_RELAXED);
     208    _Atomic_Fetch_sub_ulong(&ctx->atomic_value, 1, ATOMIC_ORDER_RELAXED);
    209209  }
    210210
     
    219219static void test_atomic_compare_exchange_init(test_context *ctx)
    220220{
    221   _Atomic_Init_uint(&ctx->atomic_value, 0);
     221  _Atomic_Init_ulong(&ctx->atomic_value, 0);
    222222  ctx->normal_value = 0;
    223223}
     
    225225static void test_atomic_compare_exchange_body(test_context *ctx, size_t worker_index)
    226226{
    227   uint_fast32_t counter = 0;
     227  unsigned long counter = 0;
    228228
    229229  while (!stop(ctx)) {
     
    231231
    232232    do {
    233       uint_fast32_t zero = 0;
    234 
    235       success = _Atomic_Compare_exchange_uint(
     233      unsigned long zero = 0;
     234
     235      success = _Atomic_Compare_exchange_ulong(
    236236        &ctx->atomic_value,
    237237        &zero,
     
    245245    ++ctx->normal_value;
    246246
    247     _Atomic_Store_uint(&ctx->atomic_value, 0, ATOMIC_ORDER_RELEASE);
     247    _Atomic_Store_ulong(&ctx->atomic_value, 0, ATOMIC_ORDER_RELEASE);
    248248  }
    249249
     
    258258static void test_atomic_or_and_init(test_context *ctx)
    259259{
    260   _Atomic_Init_uint(&ctx->atomic_value, 0);
     260  _Atomic_Init_ulong(&ctx->atomic_value, 0);
    261261}
    262262
    263263static void test_atomic_or_and_body(test_context *ctx, size_t worker_index)
    264264{
    265   uint_fast32_t the_bit = 1UL << worker_index;
    266   uint_fast32_t current_bit = 0;
     265  unsigned long the_bit = 1UL << worker_index;
     266  unsigned long current_bit = 0;
    267267
    268268  while (!stop(ctx)) {
    269     uint_fast32_t previous;
     269    unsigned long previous;
    270270
    271271    if (current_bit != 0) {
    272       previous = _Atomic_Fetch_and_uint(
     272      previous = _Atomic_Fetch_and_ulong(
    273273        &ctx->atomic_value,
    274274        ~the_bit,
     
    277277      current_bit = 0;
    278278    } else {
    279       previous = _Atomic_Fetch_or_uint(
     279      previous = _Atomic_Fetch_or_ulong(
    280280        &ctx->atomic_value,
    281281        the_bit,
     
    326326  test_context *ctx = arg;
    327327
    328   _Atomic_Store_uint(&ctx->stop, 1, ATOMIC_ORDER_RELAXED);
     328  _Atomic_Store_ulong(&ctx->stop, 1, ATOMIC_ORDER_RELAXED);
    329329}
    330330
     
    333333  rtems_status_code sc;
    334334
    335   _Atomic_Store_uint(&ctx->stop, 0, ATOMIC_ORDER_RELEASE);
     335  _Atomic_Store_ulong(&ctx->stop, 0, ATOMIC_ORDER_RELEASE);
    336336
    337337  sc = rtems_timer_fire_after(
Note: See TracChangeset for help on using the changeset viewer.