source: rtems/c/src/lib/libcpu/shared/include/utility.h @ ea1116d

4.104.115
Last change on this file since ea1116d was 9cabf5f, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Sep 22, 2008 at 12:51:16 PM

shared/include/utility.h: New file.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Utility definitions and functions.
5 */
6
7/*
8 * Copyright (c) 2008
9 * Embedded Brains GmbH
10 * Obere Lagerstr. 30
11 * D-82178 Puchheim
12 * Germany
13 * rtems@embedded-brains.de
14 *
15 * The license and distribution terms for this file may be found in the file
16 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef LIBCPU_SHARED_UTILITY_H
20#define LIBCPU_SHARED_UTILITY_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
26#define GET_REG_FIELD( reg, mask, shift) \
27  (((reg) & (mask)) >> (shift))
28
29#define SET_REG_FIELD( reg, val, mask, shift) \
30  (((reg) & ~(mask)) | (((val) << (shift)) & (mask)))
31
32#define REG_FLAG_IS_SET( reg, flag) \
33  (((reg) & (flag)) != 0)
34
35#define REG_FLAG_IS_CLEARED( reg, flag) \
36  (((reg) & (flag)) == 0)
37
38#define SET_REG_FLAG( reg, flag) \
39  ((reg) | (flag))
40
41#define CLEAR_REG_FLAG( reg, flag) \
42  ((reg) & ~(flag))
43
44#define SET_REG_FLAGS( reg, flags, mask) \
45  (((reg) & ~(mask)) | (flags))
46
47#define CLEAR_REG_FLAGS( reg, flags) \
48  ((reg) & ~(flags))
49
50#ifdef __cplusplus
51}
52#endif /* __cplusplus */
53
54#endif /* LIBCPU_SHARED_UTILITY_H */
Note: See TracBrowser for help on using the repository browser.