RTEMS 6.1-rc1
Macros | Functions
Support Services

Items of this group should move to other groups. More...

Macros

#define RTEMS_MICROSECONDS_TO_TICKS(_us)    ( ( _us ) / rtems_configuration_get_microseconds_per_tick() )
 Gets the number of clock ticks for the microseconds value. More...
 
#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms)   ( ( _ms ) * 1000UL )
 Gets the number of microseconds for the milliseconds value. More...
 
#define RTEMS_MILLISECONDS_TO_TICKS(_ms)    RTEMS_MICROSECONDS_TO_TICKS( RTEMS_MILLISECONDS_TO_MICROSECONDS( _ms ) )
 Gets the number of clock ticks for the milliseconds value. More...
 

Functions

bool rtems_workspace_allocate (size_t bytes, void **pointer)
 Allocates a memory area from the RTEMS Workspace. More...
 
bool rtems_workspace_free (void *pointer)
 Frees the memory area allocated from the RTEMS Workspace. More...
 
bool rtems_workspace_get_information (Heap_Information_block *the_info)
 Gets information about the RTEMS Workspace. More...
 
void * rtems_workspace_greedy_allocate (const uintptr_t *block_sizes, size_t block_count)
 Greedy allocates that empties the RTEMS Workspace. More...
 
void * rtems_workspace_greedy_allocate_all_except_largest (uintptr_t *allocatable_size)
 Greedy allocates all blocks of the RTEMS Workspace except the largest free block. More...
 
void rtems_workspace_greedy_free (void *opaque)
 Frees space of a greedy allocation to the RTEMS Workspace. More...
 

Detailed Description

Items of this group should move to other groups.

Macro Definition Documentation

◆ RTEMS_MICROSECONDS_TO_TICKS

#define RTEMS_MICROSECONDS_TO_TICKS (   _us)     ( ( _us ) / rtems_configuration_get_microseconds_per_tick() )

Gets the number of clock ticks for the microseconds value.

Parameters
_usis the microseconds value to convert to clock ticks.
Returns
Returns the number of clock ticks for the specified microseconds value.
Notes
The number of clock ticks per second is defined by the CONFIGURE_MICROSECONDS_PER_TICK application configuration option.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.

◆ RTEMS_MILLISECONDS_TO_MICROSECONDS

#define RTEMS_MILLISECONDS_TO_MICROSECONDS (   _ms)    ( ( _ms ) * 1000UL )

Gets the number of microseconds for the milliseconds value.

Parameters
_msis the milliseconds value to convert to microseconds.
Returns
Returns the number of microseconds for the milliseconds value.
Constraints

The following constraints apply to this directive:

  • The directive is implemented by a macro and may be called from within C/C++ constant expressions. In addition, a function implementation of the directive exists for bindings to other programming languages.
  • The directive will not cause the calling task to be preempted.

◆ RTEMS_MILLISECONDS_TO_TICKS

#define RTEMS_MILLISECONDS_TO_TICKS (   _ms)     RTEMS_MICROSECONDS_TO_TICKS( RTEMS_MILLISECONDS_TO_MICROSECONDS( _ms ) )

Gets the number of clock ticks for the milliseconds value.

Parameters
_msis the milliseconds value to convert to clock ticks.
Returns
Returns the number of clock ticks for the milliseconds value.
Notes
The number of clock ticks per second is defined by the CONFIGURE_MICROSECONDS_PER_TICK application configuration option.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within any runtime context.
  • The directive will not cause the calling task to be preempted.

Function Documentation

◆ rtems_workspace_allocate()

bool rtems_workspace_allocate ( size_t  bytes,
void **  pointer 
)

Allocates a memory area from the RTEMS Workspace.

Parameters
bytesis the number of bytes to allocated.
[out]pointeris the pointer to a void pointer object. When the directive call is successful, the begin address of the allocated memory area will be stored in this object.
Returns
Returns true, if the allocation was successful, otherwise false.
Notes
This directive is intended to be used by tests of the RTEMS test suites.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_workspace_free()

bool rtems_workspace_free ( void *  pointer)

Frees the memory area allocated from the RTEMS Workspace.

Parameters
pointeris the begin address of the memory area to free.
Returns
Returns true, if freeing the memory area was successful, otherwise false.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_workspace_get_information()

bool rtems_workspace_get_information ( Heap_Information_block the_info)

Gets information about the RTEMS Workspace.

Parameters
[out]the_infois the pointer to a Heap_Information_block object. When the directive call is successful, the heap information will be stored in this object.
Returns
Returns true, if getting the information was successful, otherwise false.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_workspace_greedy_allocate()

void * rtems_workspace_greedy_allocate ( const uintptr_t *  block_sizes,
size_t  block_count 
)

Greedy allocates that empties the RTEMS Workspace.

Parameters
block_sizesis the array of block sizes.
block_countis the block count.

Afterwards the heap has at most block_count allocatable blocks of sizes specified by block_sizes. The block_sizes must point to an array with block_count members. All other blocks are used.

Returns
The returned pointer value may be used to free the greedy allocation by calling rtems_workspace_greedy_free().

◆ rtems_workspace_greedy_allocate_all_except_largest()

void * rtems_workspace_greedy_allocate_all_except_largest ( uintptr_t *  allocatable_size)

Greedy allocates all blocks of the RTEMS Workspace except the largest free block.

Parameters
allocatable_sizeis the remaining allocatable size.

Afterwards the heap has at most one allocatable block. This block is the largest free block if it exists. The allocatable size of this block is stored in allocatable_size. All other blocks are used.

Returns
The returned pointer value may be used to free the greedy allocation by calling rtems_workspace_greedy_free().
Notes
This directive is intended to be used by tests of the RTEMS test suites.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.

◆ rtems_workspace_greedy_free()

void rtems_workspace_greedy_free ( void *  opaque)

Frees space of a greedy allocation to the RTEMS Workspace.

Parameters
opaqueis the pointer value returned by rtems_workspace_greedy_allocate() or rtems_workspace_greedy_allocate_all_except_largest().
Notes
This directive is intended to be used by tests of the RTEMS test suites.
Constraints

The following constraints apply to this directive:

  • The directive may be called from within device driver initialization context.
  • The directive may be called from within task context.
  • The directive may obtain and release the object allocator mutex. This may cause the calling task to be preempted.