source: rtems/cpukit/score/inline/rtems/score/address.inl @ baff4da

4.104.114.84.95
Last change on this file since baff4da was baff4da, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/04 at 13:22:41

2004-11-01 Joel Sherrill <joel@…>

  • score/cpu/no_cpu/rtems/score/cpu.h, score/include/rtems/debug.h, score/include/rtems/seterr.h, score/include/rtems/system.h, score/include/rtems/score/address.h, score/include/rtems/score/apiext.h, score/include/rtems/score/apimutex.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/context.h, score/include/rtems/score/copyrt.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/sysstate.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/chain.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coremutex.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/mppkt.inl, score/inline/rtems/score/objectmp.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/states.inl, score/inline/rtems/score/sysstate.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/threadmp.inl, score/inline/rtems/score/tod.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/watchdog.inl, score/inline/rtems/score/wkspace.inl: Add Doxygen comments -- working modifications which are not complete and may have broken code. Committing so work and testing can proceed.
  • score/Doxyfile, score/mainpage.h: New files.
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 *  @file address.inl
3 *
4 *  This include file contains the bodies of the routines
5 *  about addresses which are inlined.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2004.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef __INLINE_ADDRESSES_inl
20#define __INLINE_ADDRESSES_inl
21
22/**
23 *  @addtogroup ScoreAddress
24 *  @{
25 */
26
27/**
28 *  This function is used to add an offset to a base address.
29 *  It returns the resulting address.  This address is typically
30 *  converted to an access type before being used further.
31 */
32
33RTEMS_INLINE_ROUTINE void *_Addresses_Add_offset (
34  void       *base,
35  uint32_t    offset
36)
37{
38  return (void *)((char *)base + offset);
39}
40
41/**
42 *  This function is used to subtract an offset from a base
43 *  address.  It returns the resulting address.  This address is
44 *  typically converted to an access type before being used further.
45 */
46
47RTEMS_INLINE_ROUTINE void *_Addresses_Subtract_offset (
48  void       *base,
49  uint32_t    offset
50)
51{
52  return (void *)((char *)base - offset);
53}
54
55/**
56 *  This function is used to subtract two addresses.  It returns the
57 *  resulting offset.
58 *
59 *  @note  The cast of an address to an uint32_t   makes this code
60 *         dependent on an addresses being thirty two bits.
61 */
62
63RTEMS_INLINE_ROUTINE uint32_t   _Addresses_Subtract (
64  void *left,
65  void *right
66)
67{
68  return ((char *) left - (char *) right);
69}
70
71/**
72 *  This function returns TRUE if the given address is correctly
73 *  aligned for this processor and FALSE otherwise.  Proper alignment
74 *  is based on correctness and efficiency.
75 */
76
77RTEMS_INLINE_ROUTINE boolean _Addresses_Is_aligned (
78  void *address
79)
80{
81#if (CPU_ALIGNMENT == 0)
82    return TRUE;
83#elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES)
84    return ( ( (unsigned short)address % CPU_ALIGNMENT ) == 0 );
85#else
86    return ( ( (uint32_t  )address % CPU_ALIGNMENT ) == 0 );
87#endif
88}
89
90/**
91 *  This function returns TRUE if the given address is within the
92 *  memory range specified and FALSE otherwise.  base is the address
93 *  of the first byte in the memory range and limit is the address
94 *  of the last byte in the memory range.  The base address is
95 *  assumed to be lower than the limit address.
96 */
97
98RTEMS_INLINE_ROUTINE boolean _Addresses_Is_in_range (
99  void *address,
100  void *base,
101  void *limit
102)
103{
104  return ( address >= base && address <= limit );
105}
106
107/**@}*/
108
109#endif
110/* end of include file */
Note: See TracBrowser for help on using the repository browser.