diff options
Diffstat (limited to 'c/src/exec/score/macros/rtems')
22 files changed, 2224 insertions, 0 deletions
diff --git a/c/src/exec/score/macros/rtems/score/README b/c/src/exec/score/macros/rtems/score/README new file mode 100644 index 0000000000..b2f0c4d481 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/README @@ -0,0 +1,18 @@ +# +# $Id$ +# + +The files in this directory are not considered the "primary" source +of inlined routines for RTEMS. The "inline" directory contains +the implementations of the inlined basis which are regularly +tested. In general, an effort is made to keep the contents of +this directory up to date but testing is only performed irregularly +and even then it is usually with a single target processor and BSP. + +The primary purpose of the code in this directory is to insure +that RTEMS can be compiled using a C compiler which does not support +static inline routines. + +These were last successfully tested on 2/1/95 on a prerelease version +of 3.2.0. The testing was done only on the Force CPU386 i386 target board. +No testing was done on version of the code in the final release. diff --git a/c/src/exec/score/macros/rtems/score/address.inl b/c/src/exec/score/macros/rtems/score/address.inl new file mode 100644 index 0000000000..c0d45c3c6b --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/address.inl @@ -0,0 +1,68 @@ +/* macros/address.h + * + * This include file contains the bodies of the routines + * about addresses which are inlined. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_ADDRESSES_h +#define __MACROS_ADDRESSES_h + +/*PAGE + * + * _Addresses_Add_offset + * + */ + +#define _Addresses_Add_offset( _base, _offset ) \ + ((void *)((char *)(_base) + (_offset))) + +/*PAGE + * + * _Addresses_Subtract_offset + * + */ + +#define _Addresses_Subtract_offset( _base, _offset ) \ + ((void *)((char *)(_base) - (_offset))) + +/*PAGE + * + * _Addresses_Subtract + * + * NOTE: The cast of an address to an unsigned32 makes this code + * dependent on an addresses being thirty two bits. + */ + +#define _Addresses_Subtract( _left, _right ) \ + ((void *)(_left) - (void *)(_right)) + +/*PAGE + * + * _Addresses_Is_aligned + * + */ + +#define _Addresses_Is_aligned( _address ) \ + ( ( (unsigned32)(_address) % 4 ) == 0 ) + +/*PAGE + * + * _Addresses_Is_in_range + * + */ + +#define _Addresses_Is_in_range( _address, _base, _limit ) \ + ( (_address) >= (_base) && (_address) <= (_limit) ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/chain.inl b/c/src/exec/score/macros/rtems/score/chain.inl new file mode 100644 index 0000000000..0f09499f1d --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/chain.inl @@ -0,0 +1,200 @@ +/* macros/chain.h + * + * This include file contains the bodies of the routines which are + * associated with doubly linked chains and inlined. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CHAIN_h +#define __MACROS_CHAIN_h + +/*PAGE + * + * _Chain_Are_nodes_equal + */ + +#define _Chain_Are_nodes_equal( _left, _right ) \ + ( (_left) == (_right) ) + +/*PAGE + * + * _Chain_Is_null + */ + +#define _Chain_Is_null( _the_chain ) \ + ( (_the_chain) == NULL ) + +/*PAGE + * + * _Chain_Is_null_node + */ + +#define _Chain_Is_null_node( _the_node ) \ + ( (_the_node) == NULL ) + +/*PAGE + * + * _Chain_Head + */ + +#define _Chain_Head( _the_chain ) \ + ((Chain_Node *) (_the_chain)) + +/*PAGE + * + * _Chain_Tail + */ + +#define _Chain_Tail( _the_chain ) \ + ((Chain_Node *) &(_the_chain)->permanent_null) + +/*PAGE + * + * _Chain_Is_empty + */ + +#define _Chain_Is_empty( _the_chain ) \ + ( (_the_chain)->first == _Chain_Tail( (_the_chain) ) ) + +/*PAGE + * + * _Chain_Is_first + */ + +#define _Chain_Is_first( _the_node ) \ + ( (the_node)->previous == NULL ) + +/*PAGE + * + * _Chain_Is_last + */ + +#define _Chain_Is_last( _the_node ) \ + ( (_the_node)->next == NULL ) + +/*PAGE + * + * _Chain_Has_only_one_node + */ + +#define _Chain_Has_only_one_node( _the_chain ) \ + ( (_the_chain)->first == (_the_chain)->last ) + +/*PAGE + * + * _Chain_Is_head + */ + +#define _Chain_Is_head( _the_chain, _the_node ) \ + ( (_the_node) == _Chain_Head( (_the_chain) ) ) + +/*PAGE + * + * _Chain_Is_tail + */ + +#define _Chain_Is_tail( _the_chain, _the_node ) \ + ( (_the_node) == _Chain_Tail( (_the_chain) ) ) + +/*PAGE + * + * Chain_Initialize_empty + */ + +#define _Chain_Initialize_empty( _the_chain ) \ +{ \ + (_the_chain)->first = _Chain_Tail( (_the_chain) ); \ + (_the_chain)->permanent_null = NULL; \ + (_the_chain)->last = _Chain_Head( (_the_chain) ); \ +} + +/*PAGE + * + * _Chain_Extract_unprotected + */ + +#define _Chain_Extract_unprotected( _the_node ) \ +{ \ + Chain_Node *_next; \ + Chain_Node *_previous; \ + \ + _next = (_the_node)->next; \ + _previous = (_the_node)->previous; \ + _next->previous = _previous; \ + _previous->next = _next; \ +} + +/*PAGE + * + * _Chain_Get_unprotected + */ + +/*PAGE + * + * Chain_Get_unprotected + */ + +#define _Chain_Get_unprotected( _the_chain ) \ + (( !_Chain_Is_empty( (_the_chain) ) ) \ + ? _Chain_Get_first_unprotected( (_the_chain) ) \ + : NULL) + +/*PAGE + * + * _Chain_Insert_unprotected + */ + +#define _Chain_Insert_unprotected( _after_node, _the_node ) \ +{ \ + Chain_Node *_before_node; \ + \ + (_the_node)->previous = (_after_node); \ + _before_node = (_after_node)->next; \ + (_after_node)->next = (_the_node); \ + (_the_node)->next = _before_node; \ + _before_node->previous = (_the_node); \ +} + +/*PAGE + * + * _Chain_Append_unprotected + */ + +#define _Chain_Append_unprotected( _the_chain, _the_node ) \ +{ \ + Chain_Node *_old_last_node; \ + \ + (_the_node)->next = _Chain_Tail( (_the_chain) ); \ + _old_last_node = (_the_chain)->last; \ + (_the_chain)->last = (_the_node); \ + _old_last_node->next = (_the_node); \ + (_the_node)->previous = _old_last_node; \ +} + +/*PAGE + * + * _Chain_Prepend_unprotected + */ + +#define _Chain_Prepend_unprotected( _the_chain, _the_node ) \ + _Chain_Insert_unprotected( _Chain_Head( (_the_chain) ), (_the_node) ) + +/*PAGE + * + * _Chain_Prepend + */ + +#define _Chain_Prepend( _the_chain, _the_node ) \ + _Chain_Insert( _Chain_Head( (_the_chain) ), (_the_node) ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/coremsg.inl b/c/src/exec/score/macros/rtems/score/coremsg.inl new file mode 100644 index 0000000000..90bef885ed --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/coremsg.inl @@ -0,0 +1,143 @@ +/* coremsg.inl + * + * This include file contains the macro implementation of all + * inlined routines in the Core Message Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __CORE_MESSAGE_QUEUE_inl +#define __CORE_MESSAGE_QUEUE_inl + +/*PAGE + * + * _CORE_message_queue_Send + * + */ + +#define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \ +_id, _api_message_queue_mp_support ) \ + _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ + (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_SEND_REQUEST ) + +/*PAGE + * + * _CORE_message_queue_Urgent + * + */ + +#define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \ +_id, _api_message_queue_mp_support ) \ + _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ + (_id), (_api_message_queue_mp_support), CORE_MESSAGE_QUEUE_URGENT_REQUEST ) + +/*PAGE + * + * _CORE_message_queue_Copy_buffer + */ + +#define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \ + memcpy( _destination, _source, _size) + +/*PAGE + * + * _CORE_message_queue_Allocate_message_buffer + * + */ + +#define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \ + (CORE_message_queue_Buffer_control *) \ + _Chain_Get( &(_the_message_queue)->Inactive_messages ) + +/*PAGE + * + * _CORE_message_queue_Free_message_buffer + * + */ + +#define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \ + _Chain_Append( \ + &(_the_message_queue)->Inactive_messages, \ + &(_the_message)->Node \ + ) + +/*PAGE + * + * _CORE_message_queue_Is_priority + * + */ + +#define _CORE_message_queue_Is_priority( _the_attribute ) \ + ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY) + +/*PAGE + * + * _CORE_message_queue_Get_pending_message + * + */ + +#define _CORE_message_queue_Get_pending_message( _the_message_queue ) \ + (CORE_message_queue_Buffer_control *) \ + _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages ) + +/*PAGE + * + * _CORE_message_queue_Append + * + */ + +#define _CORE_message_queue_Append( _the_message_queue, _the_message ) \ + _Chain_Append( &(_the_message_queue)->Pending_messages, \ + &(_the_message)->Node ) + +/*PAGE + * + * _CORE_message_queue_Prepend + * + */ + +#define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \ + _Chain_Prepend( &(_the_message_queue)->Pending_messages, \ + &(_the_message)->Node ) + +/*PAGE + * + * _CORE_message_queue_Is_null + * + */ + +#define _CORE_message_queue_Is_null( _the_message_queue ) \ + ( (_the_message_queue) == NULL ) + +/*PAGE + * + * _CORE_message_queue_Is_notify_enabled + * + */ + +#define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \ + ( (_the_message_queue)->notify_handler != NULL ) + +/*PAGE + * + * _CORE_message_queue_Set_notify + * + */ + +#define _CORE_message_queue_Set_notify( \ + _the_message_queue, _the_handler, _the_argument ) \ + do { \ + (_the_message_queue)->notify_handler = (_the_handler); \ + (_the_message_queue)->notify_argument = (_the_argument); \ + } while ( 0 ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/coremutex.inl b/c/src/exec/score/macros/rtems/score/coremutex.inl new file mode 100644 index 0000000000..e8dbc9322c --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/coremutex.inl @@ -0,0 +1,77 @@ +/* macros/coremutex.h + * + * This include file contains all of the inlined routines associated + * with core mutexes. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_MUTEX_h +#define __MACROS_CORE_MUTEX_h + + +/*PAGE + * + * _CORE_mutex_Is_locked + * + */ + +#define _CORE_mutex_Is_locked( _the_mutex ) \ + ( (_the_mutex)->lock == CORE_MUTEX_LOCKED ) + +/*PAGE + * + * _CORE_mutex_Is_fifo + * + */ + +#define _CORE_mutex_Is_fifo( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_FIFO ) + +/*PAGE + * + * _CORE_mutex_Is_priority + * + */ + +#define _CORE_mutex_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _CORE_mutex_Is_inherit_priority + * + */ + +#define _CORE_mutex_Is_inherit_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == \ + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT ) + +/*PAGE + * + * _CORE_mutex_Is_priority_ceiling + * + */ + +#define _CORE_mutex_Is_priority_ceiling( _the_attribute )\ + ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) + +/*PAGE + * + * _CORE_mutex_Is_nesting_allowed + * + */ + +#define _CORE_mutex_Is_nesting_allowed( _the_attribute ) \ + ( (_the_attribute)->allow_nesting == TRUE ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/coresem.inl b/c/src/exec/score/macros/rtems/score/coresem.inl new file mode 100644 index 0000000000..499b4a1433 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/coresem.inl @@ -0,0 +1,40 @@ +/* macros/coresem.h + * + * This include file contains all of the inlined routines associated + * with core semaphores. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_CORE_SEMAPHORE_h +#define __MACROS_CORE_SEMAPHORE_h + +/*PAGE + * + * _CORE_semaphore_Is_priority + * + */ + +#define _CORE_semaphore_Is_priority( _the_attribute ) \ + ( (_the_attribute)->discipline == CORE_SEMAPHORE_DISCIPLINES_PRIORITY ) + +/*PAGE + * + * _Core_semaphore_Get_count + * + */ + +#define _Core_semaphore_Get_count( _the_semaphore ) \ + ( (_the_semaphore)->count ) + + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/heap.inl b/c/src/exec/score/macros/rtems/score/heap.inl new file mode 100644 index 0000000000..94f4ff9194 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/heap.inl @@ -0,0 +1,150 @@ +/* heap.inl + * + * This file contains the macro implementation of the inlined + * routines from the heap handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __HEAP_inl +#define __HEAP_inl + +#include <rtems/score/address.h> + +/*PAGE + * + * _Heap_Head + */ + +#define _Heap_Head( _the_heap ) \ + ((Heap_Block *)&(_the_heap)->start) + +/*PAGE + * + * _Heap_Tail + */ + +#define _Heap_Tail( _the_heap ) \ + ((Heap_Block *)&(_the_heap)->final) + +/*PAGE + * + * _Heap_Previous_block + */ + +#define _Heap_Previous_block( _the_block ) \ + ( (Heap_Block *) _Addresses_Subtract_offset( \ + (void *)(_the_block), \ + (_the_block)->back_flag & ~ HEAP_BLOCK_USED \ + ) \ + ) + +/*PAGE + * + * _Heap_Next_block + */ + +#define _Heap_Next_block( _the_block ) \ + ( (Heap_Block *) _Addresses_Add_offset( \ + (void *)(_the_block), \ + (_the_block)->front_flag & ~ HEAP_BLOCK_USED \ + ) \ + ) + +/*PAGE + * + * _Heap_Block_at + */ + +#define _Heap_Block_at( _base, _offset ) \ + ( (Heap_Block *) \ + _Addresses_Add_offset( (void *)(_base), (_offset) ) ) + +/*PAGE + * + * _Heap_User_block_at + * + */ + +#define _Heap_User_block_at( _base ) \ + _Heap_Block_at( \ + (_base), \ + -*(((unsigned32 *) (_base)) - 1) + -HEAP_BLOCK_USED_OVERHEAD \ + ) + +/*PAGE + * + * _Heap_Is_previous_block_free + */ + +#define _Heap_Is_previous_block_free( _the_block ) \ + ( !((_the_block)->back_flag & HEAP_BLOCK_USED) ) + +/*PAGE + * + * _Heap_Is_block_free + */ + +#define _Heap_Is_block_free( _the_block ) \ + ( !((_the_block)->front_flag & HEAP_BLOCK_USED) ) + +/*PAGE + * + * _Heap_Is_block_used + */ + +#define _Heap_Is_block_used( _the_block ) \ + ((_the_block)->front_flag & HEAP_BLOCK_USED) + +/*PAGE + * + * _Heap_Block_size + */ + +#define _Heap_Block_size( _the_block ) \ + ((_the_block)->front_flag & ~HEAP_BLOCK_USED) + +/*PAGE + * + * _Heap_Start_of_user_area + */ + +#define _Heap_Start_of_user_area( _the_block ) \ + ((void *) &(_the_block)->next) + +/*PAGE + * + * _Heap_Is_block_in + */ + +#define _Heap_Is_block_in( _the_heap, _the_block ) \ + ( ((_the_block) >= (_the_heap)->start) && \ + ((_the_block) <= (_the_heap)->final) ) + +/*PAGE + * + * _Heap_Is_page_size_valid + */ + +#define _Heap_Is_page_size_valid( _page_size ) \ + ( ((_page_size) != 0) && \ + (((_page_size) % CPU_HEAP_ALIGNMENT) == 0) ) + +/*PAGE + * + * _Heap_Build_flag + */ + +#define _Heap_Build_flag( _size, _in_use_flag ) \ + ( (_size) | (_in_use_flag)) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/isr.inl b/c/src/exec/score/macros/rtems/score/isr.inl new file mode 100644 index 0000000000..95f0319396 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/isr.inl @@ -0,0 +1,48 @@ +/* isr.inl + * + * This include file contains the macro implementation of all + * inlined routines in the Interrupt Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __ISR_inl +#define __ISR_inl + +/*PAGE + * + * _ISR_Is_in_progress + * + */ + +#define _ISR_Is_in_progress() \ + (_ISR_Nest_level != 0) + +/*PAGE + * + * _ISR_Is_vector_number_valid + * + */ + +#define _ISR_Is_vector_number_valid( _vector ) \ + ( (_vector) <= CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER ) + +/*PAGE + * + * _ISR_Is_valid_user_handler + * + */ + +#define _ISR_Is_valid_user_handler( _handler ) \ + ((_handler) != NULL) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/mppkt.inl b/c/src/exec/score/macros/rtems/score/mppkt.inl new file mode 100644 index 0000000000..ff1d51034b --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/mppkt.inl @@ -0,0 +1,41 @@ +/* macros/mppkt.h + * + * This package is the implementation of the Packet Handler + * routines which are inlined. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_MP_PACKET_h +#define __MACROS_MP_PACKET_h + +/*PAGE + * + * _Mp_packet_Is_valid_packet_class + * + * NOTE: Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary + * because this enum starts at lower bound of zero. + */ + +#define _Mp_packet_Is_valid_packet_class( _the_packet_class ) \ + ( (_the_packet_class) <= MP_PACKET_CLASSES_LAST ) + +/*PAGE + * + * _Mp_packet_Is_null + * + */ + +#define _Mp_packet_Is_null ( _the_packet ) \ + ( (_the_packet) == NULL ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/object.inl b/c/src/exec/score/macros/rtems/score/object.inl new file mode 100644 index 0000000000..8a5a0a3411 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/object.inl @@ -0,0 +1,148 @@ +/* object.inl + * + * This include file contains the macro implementation of all + * of the inlined routines in the Object Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __OBJECTS_inl +#define __OBJECTS_inl + +/*PAGE + * + * _Objects_Build_id + * + */ + +#define _Objects_Build_id( _the_class, _node, _index ) \ + ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \ + ((_node) << OBJECTS_NODE_START_BIT) | \ + ((_index) << OBJECTS_INDEX_START_BIT) ) + +/*PAGE + * + * _Objects_Get_class + */ + +#define _Objects_Get_class( _id ) \ + (Objects_Classes) \ + (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) + +/*PAGE + * + * _Objects_Get_node + * + */ + +#define _Objects_Get_node( _id ) \ + (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) + +/*PAGE + * + * _Objects_Get_index + * + */ + +#define _Objects_Get_index( _id ) \ + (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) + +/*PAGE + * + * _Objects_Is_class_valid + * + */ + +#define _Objects_Is_class_valid( _the_class ) \ + ( (_the_class) <= OBJECTS_CLASSES_LAST ) + +/*PAGE + * + * _Objects_Is_local_node + * + */ + +#define _Objects_Is_local_node( _node ) \ + ( (_node) == _Objects_Local_node ) + +/*PAGE + * + * _Objects_Is_local_id + * + */ + +#define _Objects_Is_local_id( _id ) \ + _Objects_Is_local_node( _Objects_Get_node(_id) ) + +/*PAGE + * + * _Objects_Are_ids_equal + * + */ + +#define _Objects_Are_ids_equal( _left, _right ) \ + ( (_left) == (_right) ) + +/*PAGE + * + * _Objects_Allocate + * + */ + +#define _Objects_Allocate( _information ) \ + (Objects_Control *) _Chain_Get( &(_information)->Inactive ) + +/*PAGE + * + * _Objects_Free + * + */ + +#define _Objects_Free( _information, _the_object ) \ + _Chain_Append( &(_information)->Inactive, &(_the_object)->Node ) + +/*PAGE + * + * _Objects_Open + * + */ + +#define _Objects_Open( _information, _the_object, _name ) \ + { \ + unsigned32 _index; \ + \ + _index = _Objects_Get_index( (_the_object)->id ); \ + (_information)->local_table[ _index ] = (_the_object); \ + \ + if ( (_information)->is_string ) \ + _Objects_Copy_name_string( (_name), (_the_object)->name ); \ + else \ + _Objects_Copy_name_raw( \ + (_name), (_the_object)->name, (_information)->name_length ); \ + } + +/*PAGE + * + * _Objects_Close + * + */ + +#define _Objects_Close( _information, _the_object ) \ + { \ + unsigned32 _index; \ + \ + _index = _Objects_Get_index( (_the_object)->id ); \ + (_information)->local_table[ _index ] = NULL; \ + _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); \ + } + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/objectmp.inl b/c/src/exec/score/macros/rtems/score/objectmp.inl new file mode 100644 index 0000000000..2f1c5ac7fa --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/objectmp.inl @@ -0,0 +1,50 @@ +/* macros/objectmp.inl + * + * This include file contains the bodies of all inlined routines + * which deal with global objects. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_MP_OBJECTS_inl +#define __MACROS_MP_OBJECTS_inl + +/*PAGE + * + * _Objects_MP_Allocate_global_object + * + */ + +#define _Objects_MP_Allocate_global_object() \ + (Objects_MP_Control *) \ + _Chain_Get( &_Objects_MP_Inactive_global_objects ) + +/*PAGE + * _Objects_MP_Free_global_object + * + */ + +#define _Objects_MP_Free_global_object( _the_object ) \ + _Chain_Append( \ + &_Objects_MP_Inactive_global_objects, \ + &(_the_object)->Object.Node \ + ) + +/*PAGE + * _Objects_MP_Is_null_global_object + * + */ + +#define _Objects_MP_Is_null_global_object( _the_object ) \ + ( (_the_object) == NULL ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/priority.inl b/c/src/exec/score/macros/rtems/score/priority.inl new file mode 100644 index 0000000000..4c5d32b3b3 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/priority.inl @@ -0,0 +1,170 @@ +/* priority.inl + * + * This file contains the macro implementation of all inlined routines + * in the Priority Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __PRIORITY_inl +#define __PRIORITY_inl + +#include <rtems/score/bitfield.h> + +/*PAGE + * + * _Priority_Handler_initialization + * + */ + +#define _Priority_Handler_initialization() \ + { \ + unsigned32 index; \ + \ + _Priority_Major_bit_map = 0; \ + for ( index=0 ; index <16 ; index++ ) \ + _Priority_Bit_map[ index ] = 0; \ + } + +/*PAGE + * + * _Priority_Is_valid + * + */ + + /* + * Since PRIORITY_MINIMUM is 0 and priorities are stored unsigned, + * then checking for less than 0 is unnecessary. + */ + +#define _Priority_Is_valid( _the_priority ) \ + ( (_the_priority) <= PRIORITY_MAXIMUM ) + +/*PAGE + * + * _Priority_Major + * + */ + +#define _Priority_Major( _the_priority ) ( (_the_priority) / 16 ) + +/*PAGE + * + * _Priority_Minor + * + */ + +#define _Priority_Minor( _the_priority ) ( (_the_priority) % 16 ) + +#if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE ) + +/*PAGE + * + * _Priority_Mask + * + */ + +#define _Priority_Mask( _bit_number ) \ + (0x8000 >> _bit_number) + +/*PAGE + * + * _Priority_Bits_index + * + */ + +#define _Priority_Bits_index( _bit_number ) \ + (_bit_number) + +#endif + +/*PAGE + * + * _Priority_Add_to_bit_map + * + */ + +#define _Priority_Add_to_bit_map( _the_priority_map ) \ + { \ + *(_the_priority_map)->minor |= (_the_priority_map)->ready_minor; \ + _Priority_Major_bit_map |= (_the_priority_map)->ready_major; \ + } + +/*PAGE + * + * _Priority_Remove_from_bit_map + * + */ + +#define _Priority_Remove_from_bit_map( _the_priority_map ) \ + { \ + *(_the_priority_map)->minor &= (_the_priority_map)->block_minor; \ + if ( *(_the_priority_map)->minor == 0 ) \ + _Priority_Major_bit_map &= (_the_priority_map)->block_major; \ + } + +/*PAGE + * + * _Priority_Get_highest + * + */ + +#define _Priority_Get_highest( _high_priority ) \ + { \ + Priority_Bit_map_control minor; \ + Priority_Bit_map_control major; \ + \ + _Bitfield_Find_first_bit( _Priority_Major_bit_map, major ); \ + _Bitfield_Find_first_bit( _Priority_Bit_map[major], minor ); \ + \ + (_high_priority) = (_Priority_Bits_index( major ) * 16) + \ + _Priority_Bits_index( minor ); \ + } + +/*PAGE + * + * _Priority_Initialize_information + * + */ + +#define _Priority_Initialize_information( \ + _the_priority_map, _new_priority ) \ + { \ + Priority_Bit_map_control _major; \ + Priority_Bit_map_control _minor; \ + Priority_Bit_map_control _mask; \ + \ + _major = _Priority_Major( (_new_priority) ); \ + _minor = _Priority_Minor( (_new_priority) ); \ + \ + (_the_priority_map)->minor = \ + &_Priority_Bit_map[ _Priority_Bits_index(_major) ]; \ + \ + _mask = _Priority_Mask( _major ); \ + (_the_priority_map)->ready_major = _mask; \ + (_the_priority_map)->block_major = ~_mask; \ + \ + _mask = _Priority_Mask( _minor ); \ + (_the_priority_map)->ready_minor = _mask; \ + (_the_priority_map)->block_minor = ~_mask; \ + } + +/*PAGE + * + * _Priority_Is_group_empty + * + */ + +#define _Priority_Is_group_empty ( _the_priority ) \ + ( (_the_priority) == 0 ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/stack.inl b/c/src/exec/score/macros/rtems/score/stack.inl new file mode 100644 index 0000000000..d20eebd0b9 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/stack.inl @@ -0,0 +1,50 @@ +/* stack.inl + * + * This file contains the macro implementation of the inlined + * routines from the Stack Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __STACK_inl +#define __STACK_inl + +/*PAGE + * + * _Stack_Initialize + * + */ + +#define _Stack_Initialize( _the_stack, _starting_address, _size ) \ + { \ + (_the_stack)->area = (_starting_address); \ + (_the_stack)->size = (_size); \ + } + +/*PAGE + * + * _Stack_Is_enough + * + */ + +#define _Stack_Is_enough( _size ) \ + ( (_size) >= STACK_MINIMUM_SIZE ) + +/*PAGE + * + * _Stack_Adjust_size + */ + +#define _Stack_Adjust_size( _size ) \ + ((_size) + CPU_STACK_ALIGNMENT) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/states.inl b/c/src/exec/score/macros/rtems/score/states.inl new file mode 100644 index 0000000000..4fa138d107 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/states.inl @@ -0,0 +1,210 @@ +/* states.inl + * + * This file contains the macro implementation of the inlined + * routines associated with thread state information. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __STATES_inl +#define __STATES_inl + +/*PAGE + * + * _States_Set + * + */ + +#define _States_Set( _states_to_set, _current_state ) \ + ((_current_state) | (_states_to_set)) + +/*PAGE + * + * _States_Clear + * + */ + +#define _States_Clear( _states_to_clear, _current_state ) \ + ((_current_state) & ~(_states_to_clear)) + +/*PAGE + * + * _States_Is_ready + * + */ + +#define _States_Is_ready( _the_states ) \ + ( (_the_states) == STATES_READY ) + +/*PAGE + * + * _States_Is_only_dormant + * + */ + +#define _States_Is_only_dormant( _the_states ) \ + ( (_the_states) == STATES_DORMANT ) + +/*PAGE + * + * _States_Is_dormant + * + */ + +#define _States_Is_dormant( _the_states ) \ + ( (_the_states) & STATES_DORMANT ) + +/*PAGE + * + * _States_Is_suspended + * + */ + +#define _States_Is_suspended( _the_states ) \ + ( (_the_states) & STATES_SUSPENDED ) + +/*PAGE + * + * _States_Is_Transient + * + */ + +#define _States_Is_transient( _the_states ) \ + ( (_the_states) & STATES_TRANSIENT ) + +/*PAGE + * + * _States_Is_delaying + * + */ + +#define _States_Is_delaying( _the_states ) \ + ( (_the_states) & STATES_DELAYING ) + +/*PAGE + * + * _States_Is_waiting_for_buffer + * + */ + +#define _States_Is_waiting_for_buffer( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_BUFFER ) + +/*PAGE + * + * _States_Is_waiting_for_segment + * + */ + +#define _States_Is_waiting_for_segment( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_SEGMENT ) + +/*PAGE + * + * _States_Is_waiting_for_message + * + */ + +#define _States_Is_waiting_for_message( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_MESSAGE ) + +/*PAGE + * + * _States_Is_waiting_for_event + * + */ + +#define _States_Is_waiting_for_event( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_EVENT ) + +/*PAGE + * + * _States_Is_waiting_for_mutex + * + */ + +#define _States_Is_waiting_for_mutex( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_MUTEX ) + +/*PAGE + * + * _States_Is_waiting_for_semaphore + * + */ + +#define _States_Is_waiting_for_semaphore( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_SEMAPHORE ) + +/*PAGE + * + * _States_Is_waiting_for_time + * + */ + +#define _States_Is_waiting_for_time( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_TIME ) + +/*PAGE + * + * _States_Is_waiting_for_rpc_reply + * + */ + +#define _States_Is_waiting_for_rpc_reply( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_RPC_REPLY ) + +/*PAGE + * + * _States_Is_waiting_for_period + * + */ + +#define _States_Is_waiting_for_period( _the_states ) \ + ( (_the_states) & STATES_WAITING_FOR_PERIOD ) + +/*PAGE + * + * _States_Is_locally_blocked + * + */ + +#define _States_Is_locally_blocked( _the_states ) \ + ( (_the_states) & STATES_LOCALLY_BLOCKED ) + +/*PAGE + * + * _States_Is_waiting_on_thread_queue + * + */ + +#define _States_Is_waiting_on_thread_queue( _the_states ) \ + ( (_the_states) & STATES_WAITING_ON_THREAD_QUEUE ) + +/*PAGE + * + * _States_Is_blocked + * + */ + +#define _States_Is_blocked( _the_states ) \ + ( (_the_states) & STATES_BLOCKED ) + +/*PAGE + * + * _States_Are_set + * + */ + +#define _States_Are_set( _the_states, _mask ) \ + ( ((_the_states) & (_mask)) != STATES_READY ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/sysstate.inl b/c/src/exec/score/macros/rtems/score/sysstate.inl new file mode 100644 index 0000000000..d0cb932924 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/sysstate.inl @@ -0,0 +1,90 @@ +/* sysstates.inl + * + * This file contains the macro implementation of routines regarding the + * system state. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __SYSTEM_STATE_inl +#define __SYSTEM_STATE_inl + +/*PAGE + * + * _System_state_Handler_initialization + */ + +#define _System_state_Handler_initialization( _is_multiprocessing ) \ + do { \ + _System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION; \ + _System_state_Is_multiprocessing = (_is_multiprocessing); \ + } while ( 0 ) + +/*PAGE + * + * _System_state_Set + */ + +#define _System_state_Set( _state ) \ + do { \ + _System_state_Current = (_state); \ + } while ( 0 ) + +/*PAGE + * + * _System_state_Get + */ + +#define _System_state_Get() \ + (_System_state_Current) + +/*PAGE + * + * _System_state_Is_before_initialization + */ + +#define _System_state_Is_before_initialization( _state ) \ + ((_state) == SYSTEM_STATE_BEFORE_INITIALIZATION) + +/*PAGE + * + * _System_state_Is_before_multitasking + */ + +#define _System_state_Is_before_multitasking( _state ) \ + ((_state) == SYSTEM_STATE_BEFORE_MULTITASKING) + +/*PAGE + * + * _System_state_Is_begin_multitasking + */ + +#define _System_state_Is_begin_multitasking( _state ) \ + ((_state) == SYSTEM_STATE_BEGIN_MULTITASKING) + +/*PAGE + * + * _System_state_Is_up + */ + +#define _System_state_Is_up( _state ) \ + ((_state) == SYSTEM_STATE_UP) + +/*PAGE + * + * _System_state_Is_failed + */ + +#define _System_state_Is_failed( _state ) \ + ((_state) == SYSTEM_STATE_FAILED) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/thread.inl b/c/src/exec/score/macros/rtems/score/thread.inl new file mode 100644 index 0000000000..735686aa20 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/thread.inl @@ -0,0 +1,217 @@ +/* thread.inl + * + * This file contains the macro implementation of the inlined + * routines from the Thread handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __THREAD_inl +#define __THREAD_inl + +/*PAGE + * + * _Thread_Stop_multitasking + * + */ + +#define _Thread_Stop_multitasking() \ + _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); + +/*PAGE + * + * _Thread_Is_executing + * + */ + +#define _Thread_Is_executing( _the_thread ) \ + ( (_the_thread) == _Thread_Executing ) + +/*PAGE + * + * _Thread_Is_heir + * + */ + +#define _Thread_Is_heir( _the_thread ) \ + ( (_the_thread) == _Thread_Heir ) + +/*PAGE + * + * _Thread_Is_executing_also_the_heir + * + */ + +#define _Thread_Is_executing_also_the_heir() \ + ( _Thread_Executing == _Thread_Heir ) + +/*PAGE + * + * _Thread_Resume + * + */ + +#define _Thread_Resume( _the_thread ) \ + _Thread_Clear_state( (_the_thread), STATES_SUSPENDED ) + +/*PAGE + * + * _Thread_Unblock + * + */ + +#define _Thread_Unblock( _the_thread ) \ + _Thread_Clear_state( (_the_thread), STATES_BLOCKED ); + +/*PAGE + * + * _Thread_Restart_self + * + */ + +#define _Thread_Restart_self() \ + { \ + if ( _Thread_Executing->fp_context != NULL ) \ + _Context_Restore_fp( &_Thread_Executing->fp_context ); \ + \ + _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ + } + +/*PAGE + * + * _Thread_Calculate_heir + * + */ + +#define _Thread_Calculate_heir() \ + { \ + Priority_Control highest; \ + \ + _Priority_Get_highest( highest ); \ + \ + _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \ + } + +/*PAGE + * + * _Thread_Is_allocated_fp + * + */ + +#define _Thread_Is_allocated_fp( _the_thread ) \ + ( (_the_thread) == _Thread_Allocated_fp ) + +/*PAGE + * + * _Thread_Deallocate_fp + * + */ + +#define _Thread_Deallocate_fp() \ + _Thread_Allocated_fp = NULL + +/*PAGE + * + * _Thread_Disable_dispatch + * + */ + +#define _Thread_Disable_dispatch() \ + _Thread_Dispatch_disable_level += 1 + +/*PAGE + * + * _Thread_Enable_dispatch + * + */ + +#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) +#define _Thread_Enable_dispatch() \ + { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ + _Thread_Dispatch(); \ + } +#endif + +#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) +void _Thread_Enable_dispatch( void ); +#endif + +/*PAGE + * + * _Thread_Unnest_dispatch + * + */ + +#define _Thread_Unnest_dispatch() \ + _Thread_Dispatch_disable_level -= 1 + +/*PAGE + * + * _Thread_Is_dispatching_enabled + * + */ + +#define _Thread_Is_dispatching_enabled() \ + ( _Thread_Dispatch_disable_level == 0 ) + +/*PAGE + * + * _Thread_Is_context_switch_necessary + * + */ + +#define _Thread_Is_context_switch_necessary() \ + ( _Context_Switch_necessary == TRUE ) + +/*PAGE + * + * _Thread_Dispatch_initialization + * + */ + +#define _Thread_Dispatch_initialization() \ + _Thread_Dispatch_disable_level = 1 + +/*PAGE + * + * _Thread_Is_null + * + */ + +#define _Thread_Is_null( _the_thread ) \ + ( (_the_thread) == NULL ) + +/* + * _Thread_Is_proxy_blocking + * + */ + +#define _Thread_Is_proxy_blocking( _code ) \ + ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) + +/* + * _Thread_Internal_allocate + * + */ + +#define _Thread_Internal_allocate() \ + ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information )) + +/* + * _Thread_Internal_free + * + */ + +#define _Thread_Internal_free( _the_task ) \ + _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/threadmp.inl b/c/src/exec/score/macros/rtems/score/threadmp.inl new file mode 100644 index 0000000000..c601862f96 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/threadmp.inl @@ -0,0 +1,50 @@ +/* macros/threadmp.h + * + * This include file contains the bodies of all inlined routines + * for the multiprocessing part of thread package. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __MACROS_MP_THREAD_h +#define __MACROS_MP_THREAD_h + +/*PAGE + * + * _Thread_MP_Is_receive + * + */ + +#define _Thread_MP_Is_receive( _the_thread ) \ + ( (_the_thread) == _Thread_MP_Receive) + +/*PAGE + * + * _Thread_MP_Free_proxy + * + */ + +#define _Thread_MP_Free_proxy( _the_thread ) \ +{ \ + Thread_Proxy_control *_the_proxy; \ + \ + _the_proxy = (Thread_Proxy_control *) (_the_thread); \ + \ + _Chain_Extract( &_the_proxy->Active ); \ + \ + _Chain_Append( \ + &_Thread_MP_Inactive_proxies, \ + &(_the_thread)->Object.Node \ + ); \ +} + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/tod.inl b/c/src/exec/score/macros/rtems/score/tod.inl new file mode 100644 index 0000000000..ecab4e6eae --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/tod.inl @@ -0,0 +1,58 @@ +/* tod.inl + * + * This file contains the macro implementation of the inlined routines + * from the Time of Day Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __TIME_OF_DAY_inl +#define __TIME_OF_DAY_inl + +/*PAGE + * + * _TOD_Is_set + * + */ + +#define _TOD_Is_set() \ + _Watchdog_Is_active( &_TOD_Seconds_watchdog ) + +/*PAGE + * + * _TOD_Tickle_ticks + * + */ + +#define _TOD_Tickle_ticks() \ + _TOD_Current.ticks++; \ + _TOD_Ticks_since_boot++ + +/*PAGE + * + * _TOD_Deactivate + * + */ + +#define _TOD_Deactivate() \ + _Watchdog_Remove( &_TOD_Seconds_watchdog ) + +/*PAGE + * + * _TOD_Activate + * + */ + +#define _TOD_Activate( _ticks ) \ + _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, (_ticks) ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/tqdata.inl b/c/src/exec/score/macros/rtems/score/tqdata.inl new file mode 100644 index 0000000000..5ffb79bcb1 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/tqdata.inl @@ -0,0 +1,59 @@ +/* tqdata.inl + * + * This file contains the macro implementation of the inlined + * routines needed to support the Thread Queue Data. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __THREAD_QUEUE_DATA_inl +#define __THREAD_QUEUE_DATA_inl + +/*PAGE + * + * _Thread_queue_Header_number + * + */ + +#define _Thread_queue_Header_number( _the_priority ) \ + ((_the_priority) / TASK_QUEUE_DATA_PRIORITIES_PER_HEADER) + +/*PAGE + * + * _Thread_queue_Is_reverse_search + * + */ + +#define _Thread_queue_Is_reverse_search( _the_priority ) \ + ( (_the_priority) & TASK_QUEUE_DATA_REVERSE_SEARCH_MASK ) + +/*PAGE + * + * _Thread_queue_Get_number_waiting + * + */ + +#define _Thread_queue_Get_number_waiting( _the_thread_queue ) \ + ( (_the_thread_queue)->count ) + +/*PAGE + * + * _Thread_queue_Enter_critical_section + * + */ + +#define _Thread_queue_Enter_critical_section( _the_thread_queue ) \ + do { \ + (_the_thread_queue)->sync_state = THREAD_QUEUE_NOTHING_HAPPENED; \ + } while ( 0 ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/userext.inl b/c/src/exec/score/macros/rtems/score/userext.inl new file mode 100644 index 0000000000..4b5b8083bf --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/userext.inl @@ -0,0 +1,126 @@ +/* userext.inl + * + * This file contains the macro implementation of the inlined routines + * from the User Extension Handler + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __USER_EXTENSIONS_inl +#define __USER_EXTENSIONS_inl + +/*PAGE + * + * _User_extensions_Handler_initialization + * + */ + +#define _User_extensions_Handler_initialization( _initial_extensions ) \ + { \ + _Chain_Initialize_empty( &_User_extensions_List ); \ + \ + if ( (_initial_extensions) ) { \ + _User_extensions_Initial.Callouts = *(_initial_extensions); \ + _Chain_Append( \ + &_User_extensions_List, &_User_extensions_Initial.Node ); \ + } \ + } + +/*PAGE + * + * _User_extensions_Add_set + */ + +#define _User_extensions_Add_set( _the_extension, _extension_table ) \ + do { \ + (_the_extension)->Callouts = *(_extension_table); \ + \ + _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \ + } while ( 0 ) + +/*PAGE + * + * _User_extensions_Add_API_set + */ + +#define _User_extensions_Add_API_set( _the_extension ) \ + _Chain_Prepend( &_User_extensions_List, &(_the_extension)->Node ) + + +/*PAGE + * + * _User_extensions_Remove_set + */ + +#define _User_extensions_Remove_set( _the_extension ) \ + _Chain_Extract( &(_the_extension)->Node ) + +/*PAGE + * + * _User_extensions_Run_list_forward + * + * NOTE: No parentheses around macro names here to avoid + * messing up the name and function call expansion. + */ + +#define _User_extensions_Run_list_forward( _name, _arguments ) \ + do { \ + Chain_Node *the_node; \ + User_extensions_Control *the_extension; \ + \ + for ( the_node = _User_extensions_List.first ; \ + !_Chain_Is_tail( &_User_extensions_List, the_node ) ; \ + the_node = the_node->next ) { \ + the_extension = (User_extensions_Control *) the_node; \ + \ + if ( the_extension->Callouts.## _name != NULL ) \ + (*the_extension->Callouts.## _name) _arguments; \ + \ + } \ + \ + } while ( 0 ) + +/*PAGE + * + * _User_extensions_Run_list_backward + * + * NOTE: No parentheses around macro names here to avoid + * messing up the name and function call expansion. + */ + +#define _User_extensions_Run_list_backward( _name, _arguments ) \ + do { \ + Chain_Node *the_node; \ + User_extensions_Control *the_extension; \ + \ + for ( the_node = _User_extensions_List.last ; \ + !_Chain_Is_head( &_User_extensions_List, the_node ) ; \ + the_node = the_node->previous ) { \ + the_extension = (User_extensions_Control *) the_node; \ + \ + if ( the_extension->Callouts.## _name != NULL ) \ + (*the_extension->Callouts.## _name) _arguments; \ + \ + } \ + \ + } while ( 0 ) + +/*PAGE + * + * _User_extensions_Thread_switch + * + */ + +#define _User_extensions_Thread_switch( _executing, _heir ) \ + _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) ) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/watchdog.inl b/c/src/exec/score/macros/rtems/score/watchdog.inl new file mode 100644 index 0000000000..d24224f93d --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/watchdog.inl @@ -0,0 +1,172 @@ +/* watchdog.inl + * + * This file contains the macro implementation of all inlined routines + * in the Watchdog Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __WATCHDOG_inl +#define __WATCHDOG_inl + +#include <rtems/score/object.h> + +/*PAGE + * + * _Watchdog_Initialize + * + */ + +#define _Watchdog_Initialize( _the_watchdog, _routine, _id, _user_data ) \ + { \ + (_the_watchdog)->state = WATCHDOG_INACTIVE; \ + (_the_watchdog)->routine = (_routine); \ + (_the_watchdog)->id = (_id); \ + (_the_watchdog)->user_data = (_user_data); \ + } + +/*PAGE + * + * _Watchdog_Is_active + * + */ + +#define _Watchdog_Is_active( _the_watchdog ) \ + ( (_the_watchdog)->state == WATCHDOG_ACTIVE ) + +/*PAGE + * + * _Watchdog_Activate + * + */ + +#define _Watchdog_Activate( _the_watchdog ) \ + (_the_watchdog)->state = WATCHDOG_ACTIVE + +/*PAGE + * + * _Watchdog_Deactivate + * + */ + +#define _Watchdog_Deactivate( _the_watchdog ) \ + (_the_watchdog)->state = WATCHDOG_REMOVE_IT + +/*PAGE + * + * _Watchdog_Tickle_ticks + * + */ + +#define _Watchdog_Tickle_ticks() \ + _Watchdog_Tickle( &_Watchdog_Ticks_chain ) + +/*PAGE + * + * _Watchdog_Tickle_seconds + * + */ + +#define _Watchdog_Tickle_seconds() \ + _Watchdog_Tickle( &_Watchdog_Seconds_chain ) + +/*PAGE + * + * _Watchdog_Insert_ticks + * + */ + +#define _Watchdog_Insert_ticks( _the_watchdog, _units ) \ + do { \ + (_the_watchdog)->initial = (_units); \ + _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ + } while ( 0 ) + +/*PAGE + * + * _Watchdog_Insert_seconds + * + */ + +#define _Watchdog_Insert_seconds( _the_watchdog, _units ) \ + do { \ + (_the_watchdog)->initial = (_units); \ + _Watchdog_Insert( &_Watchdog_Seconds_chain, (_the_watchdog) ); \ + } while ( 0 ) + +/*PAGE + * + * _Watchdog_Adjust_seconds + * + */ + +#define _Watchdog_Adjust_seconds( _direction, _units ) \ + _Watchdog_Adjust( &_Watchdog_Seconds_chain, (_direction), (_units) ) + +/*PAGE + * + * _Watchdog_Adjust_ticks + * + */ + +#define _Watchdog_Adjust_ticks( _direction, _units ) \ + _Watchdog_Adjust( &_Watchdog_Ticks_chain, (_direction), (_units) ) + +/*PAGE + * + * _Watchdog_Reset + * + */ + +#define _Watchdog_Reset( _the_watchdog ) \ + { \ + (void) _Watchdog_Remove( (_the_watchdog) ); \ + _Watchdog_Insert( &_Watchdog_Ticks_chain, (_the_watchdog) ); \ + } + +/*PAGE + * + * _Watchdog_Next + * + */ + +#define _Watchdog_Next( _watchdog ) \ + ((Watchdog_Control *) (_watchdog)->Node.next) + +/*PAGE + * + * _Watchdog_Previous + * + */ + +#define _Watchdog_Previous( _watchdog ) \ + ((Watchdog_Control *) (_watchdog)->Node.previous) + +/*PAGE + * + * _Watchdog_First + * + */ + +#define _Watchdog_First( _header ) \ + ((Watchdog_Control *) (_header)->first) + +/*PAGE + * + * _Watchdog_Last + * + */ + +#define _Watchdog_Last( _header ) \ + ((Watchdog_Control *) (_header)->last) + +#endif +/* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/wkspace.inl b/c/src/exec/score/macros/rtems/score/wkspace.inl new file mode 100644 index 0000000000..5efe247fb1 --- /dev/null +++ b/c/src/exec/score/macros/rtems/score/wkspace.inl @@ -0,0 +1,39 @@ +/* wkspace.inl + * + * This file contains the macro implementation of the inlined routines + * from the RAM Workspace Handler. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#ifndef __WORKSPACE_inl +#define __WORKSPACE_inl + +/*PAGE + * + * _Workspace_Allocate + * + */ + +#define _Workspace_Allocate( _size ) \ + _Heap_Allocate( &_Workspace_Area, (_size) ) + +/*PAGE + * + * _Workspace_Free + * + */ + +#define _Workspace_Free( _block ) \ + _Heap_Free( &_Workspace_Area, (_block) ) + +#endif +/* end of include file */ |