mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/utility.h: Removed superfluous macros.
This commit is contained in:
@@ -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>
|
||||
|
||||
* include/uart-output-char.h, src/uart-output-char.c: New files.
|
||||
|
||||
@@ -1,66 +1,42 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Utility definitions and functions.
|
||||
* @ingroup bsp_kit
|
||||
*
|
||||
* @brief Utility macros.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008
|
||||
* Embedded Brains GmbH
|
||||
* Copyright (c) 2008, 2010
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be found in the file
|
||||
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef LIBCPU_SHARED_UTILITY_H
|
||||
#define LIBCPU_SHARED_UTILITY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#include <stdint.h>
|
||||
|
||||
#define GET_FIELD( val, mask, shift) \
|
||||
(((val) & (mask)) >> (shift))
|
||||
#define BIT32(bit) \
|
||||
((uint32_t) 1 << (bit))
|
||||
|
||||
#define SET_FIELD( val, field, mask, shift) \
|
||||
(((val) & ~(mask)) | (((field) << (shift)) & (mask)))
|
||||
#define MASK32(shift, length) \
|
||||
((BIT32(length) - (uint32_t) 1) << (shift))
|
||||
|
||||
#define CLEAR_FIELD( val, mask) \
|
||||
((val) & ~(mask))
|
||||
#define FIELD32(val, shift, length) \
|
||||
(((uint32_t) (val) << (shift)) & MASK32(shift, length))
|
||||
|
||||
#define IS_FLAG_SET( val, flag) \
|
||||
(((val) & (flag)) != 0)
|
||||
#define GETFIELD32(reg, shift, length) \
|
||||
(((uint32_t) (reg) & MASK32(shift, length)) >> (shift))
|
||||
|
||||
#define IS_FLAG_CLEARED( val, flag) \
|
||||
(((val) & (flag)) == 0)
|
||||
|
||||
#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 */
|
||||
#define SETFIELD32(reg, val, shift, length) \
|
||||
(((uint32_t) (reg) & ~MASK32(shift, length)) | FIELD(val, shift, length))
|
||||
|
||||
#endif /* LIBCPU_SHARED_UTILITY_H */
|
||||
|
||||
Reference in New Issue
Block a user