RTEMS  5.1
Files | Functions
Address Handler

Support for Address Manipulation. More...

Files

file  address.h
 Information Required to Manipulate Physical Addresses.
 

Functions

RTEMS_INLINE_ROUTINE void * _Addresses_Add_offset (const void *base, uintptr_t offset)
 Adds offset to an address. More...
 
RTEMS_INLINE_ROUTINE void * _Addresses_Subtract_offset (const void *base, uintptr_t offset)
 Subtracts offset from an address. More...
 
RTEMS_INLINE_ROUTINE intptr_t _Addresses_Subtract (const void *left, const void *right)
 Subtracts two addresses. More...
 
RTEMS_INLINE_ROUTINE bool _Addresses_Is_aligned (const void *address)
 Checks if address is aligned. More...
 
RTEMS_INLINE_ROUTINE bool _Addresses_Is_in_range (const void *address, const void *base, const void *limit)
 Checks if address is in range. More...
 
RTEMS_INLINE_ROUTINE void * _Addresses_Align_up (void *address, size_t alignment)
 Aligns address to nearest multiple of alignment, rounding up. More...
 
RTEMS_INLINE_ROUTINE void * _Addresses_Align_down (void *address, size_t alignment)
 Aligns address to nearest multiple of alignment, truncating. More...
 

Detailed Description

Support for Address Manipulation.

This handler encapsulates functionality which abstracts address manipulation in a portable manner.

Function Documentation

◆ _Addresses_Add_offset()

RTEMS_INLINE_ROUTINE void* _Addresses_Add_offset ( const void *  base,
uintptr_t  offset 
)

Adds offset to an address.

This function is used to add an offset to a base address. It returns the resulting address. This address is typically converted to an access type before being used further.

Parameters
baseThe base address to add the offset to.
offsetThe offset to add to base.
Returns
This method returns the resulting address.

◆ _Addresses_Align_down()

RTEMS_INLINE_ROUTINE void* _Addresses_Align_down ( void *  address,
size_t  alignment 
)

Aligns address to nearest multiple of alignment, truncating.

This function returns the given address aligned to the given alignment. If the address already is aligned, or if alignment is 0, the address is returned as is. The returned address is less than or equal to the given address.

Parameters
addressThe address to align to the given alignment.
alignmentThe desired alignment for the address. It must be a power of two.
Returns
Returns the aligned address.

◆ _Addresses_Align_up()

RTEMS_INLINE_ROUTINE void* _Addresses_Align_up ( void *  address,
size_t  alignment 
)

Aligns address to nearest multiple of alignment, rounding up.

This function returns the given address aligned to the given alignment. If the address already is aligned, or if alignment is 0, the address is returned as is. The returned address is greater than or equal to the given address.

Parameters
addressThe address to align to the given alignment.
alignmentThe desired alignment for the address. It must be a power of two.
Returns
Returns the aligned address.

◆ _Addresses_Is_aligned()

RTEMS_INLINE_ROUTINE bool _Addresses_Is_aligned ( const void *  address)

Checks if address is aligned.

This function returns true if the given address is correctly aligned for this processor and false otherwise. Proper alignment is based on correctness and efficiency.

Parameters
addressThe address being checked for alignment.
Return values
trueThe address is aligned.
falseThe address is not aligned.

◆ _Addresses_Is_in_range()

RTEMS_INLINE_ROUTINE bool _Addresses_Is_in_range ( const void *  address,
const void *  base,
const void *  limit 
)

Checks if address is in range.

This function returns true if the given address is within the memory range specified and false otherwise. base is the address of the first byte in the memory range and limit is the address of the last byte in the memory range. The base address is assumed to be lower than the limit address.

Parameters
addressThe address to check if it is in the given range.
baseThe lowest address of the range to check against.
limitThe highest address of the range to check against.
Return values
trueThe address is within the memory range specified
falseThe address is not within the memory range specified.

◆ _Addresses_Subtract()

RTEMS_INLINE_ROUTINE intptr_t _Addresses_Subtract ( const void *  left,
const void *  right 
)

Subtracts two addresses.

This function is used to subtract two addresses. It returns the resulting offset.

Parameters
leftThe address on the left hand side of the subtraction.
rightThe address on the right hand side of the subtraction.
Returns
This method returns the resulting address.

◆ _Addresses_Subtract_offset()

RTEMS_INLINE_ROUTINE void* _Addresses_Subtract_offset ( const void *  base,
uintptr_t  offset 
)

Subtracts offset from an address.

This function is used to subtract an offset from a base address. It returns the resulting address. This address is typically converted to an access type before being used further.

Parameters
baseThe base address to subtract the offset from.
offsetThe offset to subtract from base.
Returns
This method returns the resulting address.