* include/utility.h: Removed superfluous macros.
This commit is contained in:
Sebastian Huber
2010-05-20 14:19:58 +00:00
parent f780417e5d
commit ef6f1d0c43
2 changed files with 24 additions and 44 deletions

View File

@@ -1,3 +1,7 @@
2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/utility.h: Removed superfluous macros.
2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de> 2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/uart-output-char.h, src/uart-output-char.c: New files. * include/uart-output-char.h, src/uart-output-char.c: New files.

View File

@@ -1,66 +1,42 @@
/** /**
* @file * @file
* *
* @brief Utility definitions and functions. * @ingroup bsp_kit
*
* @brief Utility macros.
*/ */
/* /*
* Copyright (c) 2008 * Copyright (c) 2008, 2010
* Embedded Brains GmbH * embedded brains GmbH
* Obere Lagerstr. 30 * Obere Lagerstr. 30
* D-82178 Puchheim * D-82178 Puchheim
* Germany * Germany
* rtems@embedded-brains.de * <rtems@embedded-brains.de>
* *
* The license and distribution terms for this file may be found in the file * The license and distribution terms for this file may be
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. * found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/ */
#ifndef LIBCPU_SHARED_UTILITY_H #ifndef LIBCPU_SHARED_UTILITY_H
#define LIBCPU_SHARED_UTILITY_H #define LIBCPU_SHARED_UTILITY_H
#ifdef __cplusplus #include <stdint.h>
extern "C" {
#endif /* __cplusplus */
#define GET_FIELD( val, mask, shift) \ #define BIT32(bit) \
(((val) & (mask)) >> (shift)) ((uint32_t) 1 << (bit))
#define SET_FIELD( val, field, mask, shift) \ #define MASK32(shift, length) \
(((val) & ~(mask)) | (((field) << (shift)) & (mask))) ((BIT32(length) - (uint32_t) 1) << (shift))
#define CLEAR_FIELD( val, mask) \ #define FIELD32(val, shift, length) \
((val) & ~(mask)) (((uint32_t) (val) << (shift)) & MASK32(shift, length))
#define IS_FLAG_SET( val, flag) \ #define GETFIELD32(reg, shift, length) \
(((val) & (flag)) != 0) (((uint32_t) (reg) & MASK32(shift, length)) >> (shift))
#define IS_FLAG_CLEARED( val, flag) \ #define SETFIELD32(reg, val, shift, length) \
(((val) & (flag)) == 0) (((uint32_t) (reg) & ~MASK32(shift, length)) | FIELD(val, shift, length))
#define ARE_FLAGS_SET( val, flags) \
(((val) & (flags)) == (flags))
#define IS_ANY_FLAG_SET( val, flags) \
(((val) & (flags)) != 0)
#define ARE_FLAGS_CLEARED( val, flags) \
(((val) & (flags)) == 0)
#define SET_FLAG( val, flag) \
((val) | (flag))
#define CLEAR_FLAG( val, flag) \
((val) & ~(flag))
#define SET_FLAGS( val, flags) \
((val) | (flags))
#define CLEAR_FLAGS( val, flags) \
((val) & ~(flags))
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBCPU_SHARED_UTILITY_H */ #endif /* LIBCPU_SHARED_UTILITY_H */