Changeset 23f35aa in rtems


Ignore:
Timestamp:
May 21, 2010, 8:01:14 AM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10, 4.11, master
Children:
89076a8e
Parents:
bc74b337
Message:

2010-05-21 Sebastian Huber <sebastian.huber@…>

  • include/utility.h: Macros use now first and last bit values instead of shift and length parameters.
Location:
c/src/lib/libbsp/shared
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/ChangeLog

    rbc74b337 r23f35aa  
     12010-05-21      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * include/utility.h: Macros use now first and last bit values instead
     4        of shift and length parameters.
     5
    162010-05-20      Sebastian Huber <sebastian.huber@embedded-brains.de>
    27
  • c/src/lib/libbsp/shared/include/utility.h

    rbc74b337 r23f35aa  
    2828  ((uint32_t) 1 << (bit))
    2929
    30 #define MASK32(shift, length) \
    31   ((BIT32(length) - (uint32_t) 1) << (shift))
     30#define MASK32(first_bit, last_bit) \
     31  ((BIT32((last_bit) - (first_bit) + 1) - (uint32_t) 1) << (first_bit))
    3232
    33 #define FIELD32(val, shift, length) \
    34   (((uint32_t) (val) << (shift)) & MASK32(shift, length))
     33#define FIELD32(val, first_bit, last_bit) \
     34  (((uint32_t) (val) << (first_bit)) & MASK32(first_bit, last_bit))
    3535
    36 #define GETFIELD32(reg, shift, length) \
    37   (((uint32_t) (reg) & MASK32(shift, length)) >> (shift))
     36#define GETFIELD32(reg, first_bit, last_bit) \
     37  (((reg) & MASK32(first_bit, last_bit)) >> (first_bit))
    3838
    39 #define SETFIELD32(reg, val, shift, length) \
    40   (((uint32_t) (reg) & ~MASK32(shift, length)) | FIELD(val, shift, length))
     39#define SETFIELD32(reg, val, first_bit, last_bit) \
     40  (((reg) & ~MASK32(first_bit, last_bit)) | FIELD32(val, first_bit, last_bit))
    4141
    4242#endif /* LIBCPU_SHARED_UTILITY_H */
Note: See TracChangeset for help on using the changeset viewer.