diff options
Diffstat (limited to 'cpukit/sapi/include/rtems')
-rw-r--r-- | cpukit/sapi/include/rtems/bsd.h | 141 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/cbs.h | 244 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/chain.h | 789 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/config.h | 397 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/counter.h | 160 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/extension.h | 245 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/extensionimpl.h | 53 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 134 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/init.h | 69 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/io.h | 254 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/ioimpl.h | 65 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/mptables.h | 32 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/profiling.h | 333 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/rbheap.h | 268 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/rbtree.h | 456 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/scheduler.h | 247 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/timecounter.h | 335 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/timespec.h | 305 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/version.h | 77 |
19 files changed, 0 insertions, 4604 deletions
diff --git a/cpukit/sapi/include/rtems/bsd.h b/cpukit/sapi/include/rtems/bsd.h deleted file mode 100644 index 0c44e3787d..0000000000 --- a/cpukit/sapi/include/rtems/bsd.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @file - * - * @ingroup BSD - * - * @brief BSD Compatibility API - */ - -/* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_BSD_H -#define _RTEMS_BSD_H - -#include <rtems/score/timecounter.h> -#include <rtems/score/basedefs.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup BSD BSD Compatibility Support - * - * @{ - */ - -/** - * @copydoc _Timecounter_Bintime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_bintime( struct bintime *bt ) -{ - _Timecounter_Bintime( bt ); -} - -/** - * @copydoc _Timecounter_Nanotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_nanotime( struct timespec *ts ) -{ - _Timecounter_Nanotime( ts ); -} - -/** - * @copydoc _Timecounter_Microtime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_microtime( struct timeval *tv ) -{ - _Timecounter_Microtime( tv ); -} - -/** - * @copydoc _Timecounter_Binuptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_binuptime( struct bintime *bt ) -{ - _Timecounter_Binuptime( bt ); -} - -/** - * @copydoc _Timecounter_Nanouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_nanouptime( struct timespec *ts ) -{ - _Timecounter_Nanouptime( ts ); -} - -/** - * @copydoc _Timecounter_Microtime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_microuptime( struct timeval *tv ) -{ - _Timecounter_Microuptime( tv ); -} - -/** - * @copydoc _Timecounter_Getbintime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getbintime( struct bintime *bt ) -{ - _Timecounter_Getbintime( bt ); -} - -/** - * @copydoc _Timecounter_Getnanotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getnanotime( struct timespec *ts ) -{ - _Timecounter_Getnanotime( ts ); -} - -/** - * @copydoc _Timecounter_Getmicrotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getmicrotime( struct timeval *tv ) -{ - _Timecounter_Getmicrotime( tv ); -} - -/** - * @copydoc _Timecounter_Getbinuptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getbinuptime( struct bintime *bt ) -{ - _Timecounter_Getbinuptime( bt ); -} - -/** - * @copydoc _Timecounter_Getnanouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getnanouptime( struct timespec *ts ) -{ - _Timecounter_Getnanouptime( ts ); -} - -/** - * @copydoc _Timecounter_Getmicrouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getmicrouptime( struct timeval *tv ) -{ - _Timecounter_Getmicrouptime( tv ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_BSD_H */ diff --git a/cpukit/sapi/include/rtems/cbs.h b/cpukit/sapi/include/rtems/cbs.h deleted file mode 100644 index a42061ddc0..0000000000 --- a/cpukit/sapi/include/rtems/cbs.h +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated - * with the CBS library in RTEMS - * - * This include file contains all the constants and structures associated - * with the CBS library in RTEMS. - */ - -/* - * Copyright (C) 2011 Petr Benes. - * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef CONFIGURE_SCHEDULER_CBS - #error "cbs.h available only with CONFIGURE_SCHEDULER_CBS" -#endif - -#ifndef _RTEMS_CBS_H -#define _RTEMS_CBS_H - -#include <rtems/score/schedulercbs.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Return codes. */ -#define RTEMS_CBS_OK SCHEDULER_CBS_OK -#define RTEMS_CBS_ERROR_GENERIC SCHEDULER_CBS_ERROR_GENERIC -#define RTEMS_CBS_ERROR_NO_MEMORY SCHEDULER_CBS_ERROR_NO_MEMORY -#define RTEMS_CBS_ERROR_INVALID_PARAMETER SCHEDULER_CBS_ERROR_INVALID_PARAM -#define RTEMS_CBS_ERROR_UNAUTHORIZED SCHEDULER_CBS_ERROR_UNAUTHORIZED -#define RTEMS_CBS_ERROR_UNIMPLEMENTED SCHEDULER_CBS_ERROR_UNIMPLEMENTED -#define RTEMS_CBS_ERROR_MISSING_COMPONENT SCHEDULER_CBS_ERROR_MISSING_COMPONENT -#define RTEMS_CBS_ERROR_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE -#define RTEMS_CBS_ERROR_SYSTEM_OVERLOAD SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD -#define RTEMS_CBS_ERROR_INTERNAL_ERROR SCHEDULER_CBS_ERROR_INTERNAL_ERROR -#define RTEMS_CBS_ERROR_NOT_FOUND SCHEDULER_CBS_ERROR_NOT_FOUND -#define RTEMS_CBS_ERROR_FULL SCHEDULER_CBS_ERROR_FULL -#define RTEMS_CBS_ERROR_EMPTY SCHEDULER_CBS_ERROR_EMPTY -#define RTEMS_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOSERVER - -/** Callback function invoked when a budget overrun of a task occurs. */ -typedef Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun; - -/** Server id. */ -typedef Scheduler_CBS_Server_id rtems_cbs_server_id; - -/** Server parameters. */ -typedef Scheduler_CBS_Parameters rtems_cbs_parameters; - -/** - * @brief Initialize the CBS library. - * - * Initializes the CBS library. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_initialize ( void ) -{ - return _Scheduler_CBS_Initialize(); -} - -/** - * @brief Cleanup resources associated to the CBS Library - * - * Cleanup resources associated to the CBS Library. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup ( void ) -{ - return _Scheduler_CBS_Cleanup(); -} - -/** - * @brief Create a new server with specified parameters. - * - * Create a new server with specified parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_create_server ( - rtems_cbs_parameters *params, - rtems_cbs_budget_overrun budget_overrun_callback, - rtems_cbs_server_id *server_id -) -{ - return _Scheduler_CBS_Create_server( - params, - budget_overrun_callback, - server_id - ); -} - -/** - * @brief Attach a task to an already existing server. - * - * Attach a task to an already existing server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread ( - rtems_cbs_server_id server_id, - rtems_id task_id -) -{ - return _Scheduler_CBS_Attach_thread( server_id, task_id ); -} - -/** - * @brief Detach from the CBS server. - * - * Detach from the CBS Server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread ( - rtems_cbs_server_id server_id, - rtems_id task_id -) -{ - return _Scheduler_CBS_Detach_thread( server_id, task_id ); -} - -/** - * @brief Detach all tasks from a server and destroy it. - * - * Detach all tasks from a server and destroy it. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server ( - rtems_cbs_server_id server_id -) -{ - return _Scheduler_CBS_Destroy_server( server_id ); -} - -/** - * @brief Get CBS server id. - * - * Get a thread server id, or RTEMS_CBS_E_NOT_FOUND if it is not - * attached to any server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id ( - rtems_id task_id, - rtems_cbs_server_id *server_id -) -{ - return _Scheduler_CBS_Get_server_id( task_id, server_id ); -} - -/** - * @brief Get CBS parameters. - * - * Retrieve CBS scheduling parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters ( - rtems_cbs_server_id server_id, - rtems_cbs_parameters *params -) -{ - return _Scheduler_CBS_Get_parameters( server_id, params ); -} - -/** - * @brief Set CBS parameters. - * - * Change CBS scheduling parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters ( - rtems_cbs_server_id server_id, - rtems_cbs_parameters *params -) -{ - return _Scheduler_CBS_Set_parameters( server_id, params ); -} - -/** - * @brief Get the CBS get execution time. - * - * Retrieve time info relative to the current server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time ( - rtems_cbs_server_id server_id, - time_t *exec_time, - time_t *abs_time -) -{ - return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time ); -} - -/** - * @brief Get the remaining CBS budget. - * - * Retrieve remaining budget for the current server instance. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget ( - rtems_cbs_server_id server_id, - time_t *remaining_budget -) -{ - return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget ); -} - -/** - * @brief Get the approved CBS budget. - * - * Retrieve the budget that has been approved for the subsequent - * server instances. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget ( - rtems_cbs_server_id server_id, - time_t *appr_budget -) -{ - return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget ); -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h deleted file mode 100644 index f0e7ee4f40..0000000000 --- a/cpukit/sapi/include/rtems/chain.h +++ /dev/null @@ -1,789 +0,0 @@ -/** - * @file - * - * @brief Chain API - */ - -/* - * Copyright (c) 2010-2014 embedded brains GmbH. - * - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_CHAIN_H -#define _RTEMS_CHAIN_H - -#include <rtems/score/chainimpl.h> -#include <rtems/rtems/event.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicChains Chains - * - * @ingroup ClassicRTEMS - * - * @brief Chain API - */ -/**@{**/ - -typedef Chain_Node rtems_chain_node; - -typedef Chain_Control rtems_chain_control; - -/** - * @brief Chain initializer for an empty chain with designator @a name. - */ -#define RTEMS_CHAIN_INITIALIZER_EMPTY( name ) \ - CHAIN_INITIALIZER_EMPTY( name ) - -/** - * @brief Chain initializer for a chain with one @a node. - * - * @see RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(). - */ -#define RTEMS_CHAIN_INITIALIZER_ONE_NODE( node ) \ - CHAIN_INITIALIZER_ONE_NODE( node ) - -/** - * @brief Chain node initializer for a @a chain containing exactly this node. - * - * @see RTEMS_CHAIN_INITIALIZER_ONE_NODE(). - */ -#define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \ - CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) - -/** - * @brief Chain definition for an empty chain with designator @a name. - */ -#define RTEMS_CHAIN_DEFINE_EMPTY( name ) \ - rtems_chain_control name = RTEMS_CHAIN_INITIALIZER_EMPTY( name ) - -/** - * @brief Appends the @a node to the @a chain and sends the @a events to the - * @a task if the @a chain was empty before the append. - * - * @see rtems_chain_append_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_append_with_notification( - rtems_chain_control *chain, - rtems_chain_node *node, - rtems_id task, - rtems_event_set events -); - -/** - * @brief Prepends the @a node to the @a chain and sends the @a events to the - * @a task if the @a chain was empty before the prepend. - * - * @see rtems_chain_prepend_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_prepend_with_notification( - rtems_chain_control *chain, - rtems_chain_node *node, - rtems_id task, - rtems_event_set events -); - -/** - * @brief Gets the first @a node of the @a chain and sends the @a events to the - * @a task if the @a chain is empty after the get. - * - * @see rtems_chain_get_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_get_with_notification( - rtems_chain_control *chain, - rtems_id task, - rtems_event_set events, - rtems_chain_node **node -); - -/** - * @brief Gets the first @a node of the @a chain and sends the @a events to the - * @a task if the @a chain is empty afterwards. - * - * @see rtems_chain_get() and rtems_event_receive(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_TIMEOUT Timeout. - */ -rtems_status_code rtems_chain_get_with_wait( - rtems_chain_control *chain, - rtems_event_set events, - rtems_interval timeout, - rtems_chain_node **node -); - -/** - * @brief Initialize a chain Header. - * - * This routine initializes @a the_chain structure to manage the - * contiguous array of @a number_nodes nodes which starts at - * @a starting_address. Each node is of @a node_size bytes. - * - * @param[in] the_chain specifies the chain to initialize - * @param[in] starting_address is the starting address of the array - * of elements - * @param[in] number_nodes is the number of nodes that will be in the chain - * @param[in] node_size is the size of each node - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize( - rtems_chain_control *the_chain, - void *starting_address, - size_t number_nodes, - size_t node_size -) -{ - _Chain_Initialize( - the_chain, - starting_address, - number_nodes, - node_size - ); -} - -/** - * @brief Initialize this chain as empty. - * - * This routine initializes the specified chain to contain zero nodes. - * - * @param[in] the_chain is the chain to be initialized. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_empty( - rtems_chain_control *the_chain -) -{ - _Chain_Initialize_empty( the_chain ); -} - -/** - * @brief Set off chain. - * - * This function sets the next and previous fields of the @a node to NULL - * indicating the @a node is not part of a chain. - * - * @param[in] node the node set to off chain. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain( - rtems_chain_node *node -) -{ - _Chain_Set_off_chain( node ); -} - -/** - * @brief Initializes a chain node. - * - * In debug configurations, the node is set off chain. In all other - * configurations, this function does nothing. - * - * @param[in] the_node The chain node to initialize. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node( - rtems_chain_node *node -) -{ - _Chain_Initialize_node( node ); -} - -/** - * @brief Is the node off chain. - * - * This function returns true if the @a node is not on a chain. A @a node is - * off chain if the next and previous fields are set to NULL. - * - * @param[in] node is the node off chain. - * - * @retval true The node is off chain. - * @retval false The node is not off chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_node_off_chain( - const rtems_chain_node *node -) -{ - return _Chain_Is_node_off_chain( node ); -} - -/** - * @brief Is the chain node pointer NULL. - * - * This function returns true if the_node is NULL and false otherwise. - * - * @param[in] the_node is the node pointer to check. - * - * @retval true The chain node pointer is NULL. - * @retval false The chain node pointer is not NULL. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_null_node( the_node ); -} - -/** - * @brief Return pointer to Chain Head - * - * This function returns a pointer to the first node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head( - rtems_chain_control *the_chain -) -{ - return _Chain_Head( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain Head - * - * This function returns a pointer to the head node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent head node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_head( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_head( the_chain ); -} - -/** - * @brief Return pointer to Chain Tail - * - * This function returns a pointer to the tail node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent tail node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail( - rtems_chain_control *the_chain -) -{ - return _Chain_Tail( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain Tail - * - * This function returns a pointer to the tail node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent tail node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_tail( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_tail( the_chain ); -} - -/** - * @brief Return pointer to Chain's First node after the permanent head. - * - * This function returns a pointer to the first node on the chain after the - * head. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the first node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first( - const rtems_chain_control *the_chain -) -{ - return _Chain_First( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain's First node - * - * This function returns a pointer to the first node on the chain after the - * head. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the first node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_first( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_first( the_chain ); -} - -/** - * @brief Return pointer to Chain's Last node before the permanent tail. - * - * This function returns a pointer to the last node on the chain just before - * the tail. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the last node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last( - const rtems_chain_control *the_chain -) -{ - return _Chain_Last( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain's Last node - * - * This function returns a pointer to the last node on the chain just before - * the tail. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the last node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_last( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_last( the_chain ); -} - -/** - * @brief Return pointer the next node from this node - * - * This function returns a pointer to the next node after this node. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the next node on the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next( - const rtems_chain_node *the_node -) -{ - return _Chain_Next( the_node ); -} - -/** - * @brief Return pointer the immutable next node from this node - * - * This function returns a pointer to the next node after this node. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the next node on the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_next( - const rtems_chain_node *the_node -) -{ - return _Chain_Immutable_next( the_node ); -} - -/** - * @brief Return pointer the previous node from this node - * - * This function returns a pointer to the previous node on this chain. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the previous node on the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_previous( - const rtems_chain_node *the_node -) -{ - return _Chain_Previous( the_node ); -} - -/** - * @brief Return pointer the immutable previous node from this node. - * - * This function returns a pointer to the previous node on this chain. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the previous node on the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_previous( - const rtems_chain_node *the_node -) -{ - return _Chain_Immutable_previous( the_node ); -} - -/** - * @brief Are Two nodes equal. - * - * This function returns true if @a left and @a right are equal, - * and false otherwise. - * - * @param[in] left is the node on the left hand side of the comparison. - * @param[in] right is the node on the left hand side of the comparison. - * - * @retval true @a left is equal to @a right. - * @retval false @a left is not equal to @a right - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_are_nodes_equal( - const rtems_chain_node *left, - const rtems_chain_node *right -) -{ - return _Chain_Are_nodes_equal( left, right ); -} - -/** - * @brief Is the chain empty - * - * This function returns true if there a no nodes on @a the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @retval true The chain is empty. - * @retval false The chain is not empty. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_empty( - const rtems_chain_control *the_chain -) -{ - return _Chain_Is_empty( the_chain ); -} - -/** - * @brief Is this the first node on the chain. - * - * This function returns true if the_node is the first node on a chain and - * false otherwise. - * - * @param[in] the_node is the node the caller wants to know if it is - * the first node on a chain. - * - * @retval true @a the_node is the first node on a chain. - * @retval false @a the_node is not the first node on a chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_first( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_first( the_node ); -} - -/** - * @brief Is this the last node on the chain. - * - * This function returns true if @a the_node is the last node on a chain and - * false otherwise. - * - * @param[in] the_node is the node to check as the last node. - * - * @retval true @a the_node is the last node on a chain. - * @retval false @a the_node is not the last node on a chain - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_last( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_last( the_node ); -} - -/** - * @brief Does this chain have only one node. - * - * This function returns true if there is only one node on @a the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @retval true The chain has only one node. - * @retval false The chain has more than one nodes. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_has_only_one_node( - const rtems_chain_control *the_chain -) -{ - return _Chain_Has_only_one_node( the_chain ); -} - -/** - * @brief Is this node the chain head. - * - * This function returns true if @a the_node is the head of the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to check for being the Chain Head. - * - * @retval true @a the_node is the head of @a the_chain. - * @retval false @a the_node is not the head of @a the_chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_head( - const rtems_chain_control *the_chain, - const rtems_chain_node *the_node -) -{ - return _Chain_Is_head( the_chain, the_node ); -} - -/** - * @brief Is this node the chain tail. - * - * This function returns true if the_node is the tail of the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to check for being the Chain Tail. - * - * @retval true @a the_node is the tail of @a the_chain. - * @retval false @a the_node is not the tail of @a the_chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_tail( - const rtems_chain_control *the_chain, - const rtems_chain_node *the_node -) -{ - return _Chain_Is_tail( the_chain, the_node ); -} - -/** - * @brief Extract the specified node from a chain. - * - * This routine extracts @a the_node from the chain on which it resides. - * It disables interrupts to ensure the atomicity of the - * extract operation. - * - * @arg the_node specifies the node to extract - */ -void rtems_chain_extract( - rtems_chain_node *the_node -); - -/** - * @brief Extract the specified node from a chain (unprotected). - * - * This routine extracts @a the_node from the chain on which it resides. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * append operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_extract_unprotected( - rtems_chain_node *the_node -) -{ - _Chain_Extract_unprotected( the_node ); -} - -/** - * @brief Obtain the first node on a chain. - * - * This function removes the first node from @a the_chain and returns - * a pointer to that node. If @a the_chain is empty, then NULL is returned. - * - * @return This method returns a pointer a node. If a node was removed, - * then a pointer to that node is returned. If @a the_chain was - * empty, then NULL is returned. - * - * NOTE: It disables interrupts to ensure the atomicity of the get operation. - */ -rtems_chain_node *rtems_chain_get( - rtems_chain_control *the_chain -); - -/** - * @brief See _Chain_Get_unprotected(). - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_unprotected( - rtems_chain_control *the_chain -) -{ - return _Chain_Get_unprotected( the_chain ); -} - -/** - * @brief See _Chain_Get_first_unprotected(). - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_first_unprotected( - rtems_chain_control *the_chain -) -{ - return _Chain_Get_first_unprotected( the_chain ); -} - -/** - * @brief Insert a node on a chain - * - * This routine inserts @a the_node on a chain immediately following - * @a after_node. - * - * NOTE: It disables interrupts to ensure the atomicity - * of the extract operation. - */ -void rtems_chain_insert( - rtems_chain_node *after_node, - rtems_chain_node *the_node -); - -/** - * @brief See _Chain_Insert_unprotected(). - */ -RTEMS_INLINE_ROUTINE void rtems_chain_insert_unprotected( - rtems_chain_node *after_node, - rtems_chain_node *the_node -) -{ - _Chain_Insert_unprotected( after_node, the_node ); -} - -/** - * @brief Append a node on the end of a chain. - * - * This routine appends @a the_node onto the end of @a the_chain. - * - * NOTE: It disables interrupts to ensure the atomicity of the - * append operation. - */ -void rtems_chain_append( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -); - -/** - * @brief Append a node on the end of a chain (unprotected). - * - * This routine appends @a the_node onto the end of @a the_chain. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * append operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_append_unprotected( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -) -{ - _Chain_Append_unprotected( the_chain, the_node ); -} - -/** - * @brief Prepend a node. - * - * This routine prepends the_node onto the front of the_chain. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to be prepended. - * - * NOTE: It disables interrupts to ensure the atomicity of the - * prepend operation. - */ -void rtems_chain_prepend( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -); - -/** - * @brief Prepend a node (unprotected). - * - * This routine prepends the_node onto the front of the_chain. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to be prepended. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * prepend operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_prepend_unprotected( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -) -{ - _Chain_Prepend_unprotected( the_chain, the_node ); -} - -/** - * @brief Checks if the @a chain is empty and appends the @a node. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain was empty before the append. - * @retval false The chain contained at least one node before the append. - */ -bool rtems_chain_append_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node *node -); - -/** - * @brief Checks if the @a chain is empty and prepends the @a node. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain was empty before the prepend. - * @retval false The chain contained at least one node before the prepend. - */ -bool rtems_chain_prepend_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node *node -); - -/** - * @brief Tries to get the first @a node and check if the @a chain is empty - * afterwards. - * - * This function removes the first node from the @a chain and returns a pointer - * to that node in @a node. If the @a chain is empty, then @c NULL is returned. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain is empty after the node removal. - * @retval false The chain contained at least one node after the node removal. - */ -bool rtems_chain_get_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node **node -); - -/** - * @brief Returns the node count of the chain. - * - * @param[in] chain The chain. - * - * @note It does NOT disable interrupts to ensure the atomicity of the - * operation. - * - * @return The node count of the chain. - */ -RTEMS_INLINE_ROUTINE size_t rtems_chain_node_count_unprotected( - const rtems_chain_control *chain -) -{ - return _Chain_Node_count_unprotected( chain ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h deleted file mode 100644 index 6b97376511..0000000000 --- a/cpukit/sapi/include/rtems/config.h +++ /dev/null @@ -1,397 +0,0 @@ -/** - * @file - * - * @brief Table of User Defined Configuration Parameters - * - * This include file contains the table of user defined configuration - * parameters. - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_CONFIG_H -#define _RTEMS_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Unlimited object support. Changes the configuration table entry for POSIX - * or RTEMS APIs to bounded only by the memory of the work-space. - * - * Use the macro to define the resource unlimited before placing in - * the configuration table. - */ - -#include <rtems/score/object.h> -#define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS - -#define rtems_resource_unlimited(resource) \ - ( resource | RTEMS_UNLIMITED_OBJECTS ) - -#define rtems_resource_is_unlimited(resource) \ - _Objects_Is_unlimited(resource) - -#define rtems_resource_maximum_per_allocation(resource) \ - _Objects_Maximum_per_allocation(resource) - -#include <rtems/score/watchdog.h> - -/* - * This is kind of kludgy but it allows targets to totally ignore the - * optional APIs like POSIX safely. - */ - -#ifdef RTEMS_POSIX_API -#include <rtems/posix/config.h> -#else -typedef void *posix_api_configuration_table; -#endif - -#include <rtems/rtems/config.h> - -#include <rtems/extension.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/mpci.h> -#endif - -#if defined(RTEMS_MULTIPROCESSING) -/* - * The following records define the Multiprocessor Configuration - * Table. This table defines the multiprocessor system - * characteristics which must be known by RTEMS in a multiprocessor - * system. - */ -typedef struct { - /** This is the local node number. */ - uint32_t node; - /** This is the maximum number of nodes in system. */ - uint32_t maximum_nodes; - /** This is the maximum number of global objects. */ - uint32_t maximum_global_objects; - /** This is the maximum number of proxies. */ - uint32_t maximum_proxies; - - /** - * The MPCI Receive server is assumed to have a stack of at least - * minimum stack size. This field specifies the amount of extra - * stack this task will be given in bytes. - */ - uint32_t extra_mpci_receive_server_stack; - - /** This is a pointer to User/BSP provided MPCI Table. */ - rtems_mpci_table *User_mpci_table; -} rtems_multiprocessing_table; -#endif - -/** - * @brief Task stack allocator initialization hook. - * - * @param[in] stack_space_size is the size of the stack space in bytes. - */ -typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size ); - -/** - * @brief Task stack allocator hook. - * - * @param[in] stack_size is the Size of the task stack in bytes. - * - * @retval NULL Not enough memory. - * @retval other Pointer to task stack. - */ -typedef void *(*rtems_stack_allocate_hook)( size_t stack_size ); - -/** - * @brief Task stack deallocator hook. - * - * @param[in] addr is a pointer to previously allocated task stack. - */ -typedef void (*rtems_stack_free_hook)( void *addr ); - -/* - * The following records define the Configuration Table. The - * information contained in this table is required in all - * RTEMS systems, whether single or multiprocessor. This - * table primarily defines the following: - * - * + location and size of the RTEMS Workspace - * + microseconds per clock tick - * + clock ticks per task timeslice - * + required number of each object type for each API configured - */ -typedef struct { - /** - * This field specifies the size in bytes of the RTEMS Workspace. - */ - uintptr_t work_space_size; - - /** - * This field specifies the size in bytes of the RTEMS thread stack space. - */ - uintptr_t stack_space_size; - - /** - * This field specifies the maximum number of dynamically installed - * used extensions. - */ - uint32_t maximum_extensions; - - /** - * This field contains the maximum number of POSIX API - * keys which are configured for this application. - */ - uint32_t maximum_keys; - - /** - * This field contains the maximum number of POSIX API - * key value pairs which are configured for this application. - * - * @note There can be potentially be a key/value pair for - * every thread to use every key. But normally this - * many are not needed in a system. - */ - uint32_t maximum_key_value_pairs; - - /** - * This field specifies the number of microseconds which elapse - * between clock ticks. This is the basis for RTEMS timing. - */ - uint32_t microseconds_per_tick; - - /** - * This field specifies the number of ticks in each task's timeslice. - */ - uint32_t ticks_per_timeslice; - - /** - * This element points to the BSP's optional idle task which may override - * the default one provided with RTEMS. - */ - void *(*idle_task)( uintptr_t ); - - /** - * This field specifies the size of the IDLE task's stack. If less than or - * equal to the minimum stack size, then the IDLE task will have the minimum - * stack size. - */ - uint32_t idle_task_stack_size; - - /** - * This field specifies the size of the interrupt stack. If less than or - * equal to the minimum stack size, then the interrupt stack will be of - * minimum stack size. - */ - uint32_t interrupt_stack_size; - - /** - * @brief Optional task stack allocator initialization hook. - */ - rtems_stack_allocate_init_hook stack_allocate_init_hook; - - /** - * @brief Optional task stack allocator hook. - */ - rtems_stack_allocate_hook stack_allocate_hook; - - /** - * @brief Optional task stack free hook. - */ - rtems_stack_free_hook stack_free_hook; - - /** - * If this element is TRUE, then RTEMS will zero the Executive Workspace. - * When this element is FALSE, it is assumed that the BSP or invoking - * environment has ensured that memory was cleared before RTEMS was - * invoked. - */ - bool do_zero_of_workspace; - - /** - * @brief Specifies if a unified work area is used or not. - * - * If this element is @a true, then the RTEMS Workspace and the C Program - * Heap use the same heap, otherwise they use separate heaps. - */ - bool unified_work_area; - - /** - * @brief Specifies if the stack allocator avoids the work space. - * - * If this element is @a true, then the stack allocator must not allocate the - * thread stacks from the RTEMS Workspace, otherwise it should allocate the - * thread stacks from the RTEMS Workspace. - */ - bool stack_allocator_avoids_work_space; - - #ifdef RTEMS_SMP - bool smp_enabled; - #endif - - uint32_t number_of_initial_extensions; - const rtems_extensions_table *User_extension_table; - #if defined(RTEMS_MULTIPROCESSING) - rtems_multiprocessing_table *User_multiprocessing_table; - #endif - #ifdef RTEMS_SMP - uint32_t maximum_processors; - #endif -} rtems_configuration_table; - -/** - * This is the configuration table generated by confdefs.h. - */ -extern const rtems_configuration_table Configuration; - -#if defined(RTEMS_MULTIPROCESSING) - /** - * This points to the multiprocessing configuration table. - */ - extern rtems_multiprocessing_table *_Configuration_MP_table; -#endif - -#if defined(RTEMS_MULTIPROCESSING) - /** - * @brief RTEMS multiprocessing configuration table. - * - * This is the RTEMS Multiprocessing Configuration Table expected to - * be generated by confdefs.h. - */ - extern rtems_multiprocessing_table Multiprocessing_configuration; - - /* - * This is the default Multiprocessing Configuration Table. - * It is used in single processor configurations. - */ - extern const rtems_multiprocessing_table - _Initialization_Default_multiprocessing_table; -#endif - - -/* - * Some handy macros to avoid dependencies on either the BSP - * or the exact format of the configuration table. - */ - -#define rtems_configuration_get_unified_work_area() \ - (Configuration.unified_work_area) - -#define rtems_configuration_get_stack_allocator_avoids_work_space() \ - (Configuration.stack_allocator_avoids_work_space) - -#define rtems_configuration_get_stack_space_size() \ - (Configuration.stack_space_size) - -#define rtems_configuration_get_work_space_size() \ - (Configuration.work_space_size + \ - (rtems_configuration_get_stack_allocator_avoids_work_space() ? \ - 0 : rtems_configuration_get_stack_space_size())) - -#define rtems_configuration_get_maximum_extensions() \ - (Configuration.maximum_extensions) - -#define rtems_configuration_get_microseconds_per_tick() \ - (Configuration.microseconds_per_tick) -#define rtems_configuration_get_milliseconds_per_tick() \ - (Configuration.microseconds_per_tick / 1000) -#define rtems_configuration_get_nanoseconds_per_tick() \ - (_Watchdog_Nanoseconds_per_tick) - -#define rtems_configuration_get_ticks_per_timeslice() \ - (Configuration.ticks_per_timeslice) - -#define rtems_configuration_get_idle_task() \ - (Configuration.idle_task) - -#define rtems_configuration_get_idle_task_stack_size() \ - (Configuration.idle_task_stack_size) - -#define rtems_configuration_get_interrupt_stack_size() \ - (Configuration.interrupt_stack_size) - -#define rtems_configuration_get_stack_allocate_init_hook() \ - (Configuration.stack_allocate_init_hook) - -#define rtems_configuration_get_stack_allocate_hook() \ - (Configuration.stack_allocate_hook) - -#define rtems_configuration_get_stack_free_hook() \ - (Configuration.stack_free_hook) - - /** - * This macro assists in accessing the field which indicates whether - * RTEMS is responsible for zeroing the Executive Workspace. - */ -#define rtems_configuration_get_do_zero_of_workspace() \ - (Configuration.do_zero_of_workspace) - -#define rtems_configuration_get_number_of_initial_extensions() \ - (Configuration.number_of_initial_extensions) - -#define rtems_configuration_get_user_extension_table() \ - (Configuration.User_extension_table) - -#if defined(RTEMS_MULTIPROCESSING) - #define rtems_configuration_get_user_multiprocessing_table() \ - (Configuration.User_multiprocessing_table) -#else - #define rtems_configuration_get_user_multiprocessing_table() \ - NULL -#endif - -/** - * @brief Returns true if the SMP mode of operation is enabled, and false - * otherwise. - * - * In uni-processor configurations this is a compile-time constant which - * evaluates to false. - * - * @retval true SMP mode of operation is enabled. - * @retval false Otherwise. - */ -#ifdef RTEMS_SMP - #define rtems_configuration_is_smp_enabled() \ - (Configuration.smp_enabled) -#else - #define rtems_configuration_is_smp_enabled() \ - false -#endif - -/** - * @brief Returns the configured maximum count of processors. - * - * The actual number of processors available for the application will be less - * than or equal to the configured maximum count of processors. - * - * On single-processor configurations this is a compile time constant which - * evaluates to one. - * - * @return The configured maximum count of processors. - */ -#ifdef RTEMS_SMP - #define rtems_configuration_get_maximum_processors() \ - (Configuration.maximum_processors) -#else - #define rtems_configuration_get_maximum_processors() \ - 1 -#endif - -#define rtems_configuration_get_rtems_api_configuration() \ - (&Configuration_RTEMS_API) - -#define rtems_configuration_get_posix_api_configuration() \ - (&Configuration_POSIX_API) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/counter.h b/cpukit/sapi/include/rtems/counter.h deleted file mode 100644 index 3b428402a8..0000000000 --- a/cpukit/sapi/include/rtems/counter.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file - * - * @ingroup ClassicCounter - * - * @brief Free-Running Counter and Busy Wait Delay API - */ - -/* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_SAPI_COUNTER_H -#define _RTEMS_SAPI_COUNTER_H - -#include <rtems/score/cpu.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup ClassicCounter Free-Running Counter and Busy Wait Delay - * - * @ingroup ClassicRTEMS - * - * @brief Free-running counter and busy wait delay functions. - * - * The RTEMS counter is some free-running counter. It ticks usually with a - * frequency close to the CPU or system bus clock. - * - * The counter can be used in case the overhead of the - * rtems_clock_get_uptime_nanoseconds() is too high. The step from counter - * ticks to/from nanoseconds is explicit in this API unlike to - * rtems_clock_get_uptime_nanoseconds() which performs the conversion on each - * invocation. - * - * This counter works without a clock driver and during system initialization. - * - * The counter can be used to profile low-level operations like SMP locks or - * interrupt disabled critical sections. The counter can act also as an - * entropy source for a random number generator. - * - * The period of the counter depends on the actual hardware. - * - * @{ - */ - -/** - * @brief Unsigned integer type for counter values. - */ -typedef CPU_Counter_ticks rtems_counter_ticks; - -/** - * @brief Reads the current counter values. - * - * @return The current counter values. - */ -static inline rtems_counter_ticks rtems_counter_read( void ) -{ - return _CPU_Counter_read(); -} - -/** - * @brief Returns the difference between the second and first CPU counter - * value. - * - * This operation may be carried out as a modulo operation depending on the - * range of the CPU counter device. - * - * @param[in] second The second CPU counter value. - * @param[in] first The first CPU counter value. - * - * @return Returns second minus first modulo counter period. - */ -static inline rtems_counter_ticks rtems_counter_difference( - rtems_counter_ticks second, - rtems_counter_ticks first -) -{ - return _CPU_Counter_difference( second, first ); -} - -/** - * @brief Converts counter ticks into nanoseconds. - * - * @param[in] ticks Some counter ticks. - * - * @return The nanoseconds corresponding to the counter ticks. The value is - * rounded up. - */ -uint64_t rtems_counter_ticks_to_nanoseconds( - rtems_counter_ticks ticks -); - -/** - * @brief Converts nanoseconds into counter ticks. - * - * @param[in] nanoseconds Some nanoseconds. - * - * @return The counter ticks corresponding to the nanoseconds. The value is - * rounded up. - */ -rtems_counter_ticks rtems_counter_nanoseconds_to_ticks( - uint32_t nanoseconds -); - -/** - * @brief Initializes the counter ticks to/from nanoseconds converter functions. - * - * This function must be used to initialize the - * rtems_counter_ticks_to_nanoseconds() and - * rtems_counter_nanoseconds_to_ticks() functions. It should be called during - * system initialization by the board support package. - * - * @param[in] frequency The current counter frequency in Hz. - */ -void rtems_counter_initialize_converter( uint32_t frequency ); - -/** - * @brief Busy wait for some counter ticks. - * - * This function does not disable interrupts. Thus task switches and - * interrupts can interfere with this busy wait may prolong the delay. This - * function busy waits at least the specified time. Due to some overhead the - * actual delay may be longer. - * - * @param[in] ticks The minimum busy wait time in counter ticks. - */ -void rtems_counter_delay_ticks( rtems_counter_ticks ticks ); - -/** - * @brief Busy wait for some nanoseconds. - * - * This function does not disable interrupts. Thus task switches and - * interrupts can interfere with this busy wait may prolong the delay. This - * function busy waits at least the specified time. Due to some overhead the - * actual delay may be longer. - * - * @param[in] nanoseconds The minimum busy wait time in nanoseconds. - */ -void rtems_counter_delay_nanoseconds( uint32_t nanoseconds ); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_SAPI_COUNTER_H */ diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h deleted file mode 100644 index f22abf7f18..0000000000 --- a/cpukit/sapi/include/rtems/extension.h +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @file - * - * @brief User Extensions API. - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_EXTENSION_H -#define _RTEMS_EXTENSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/object.h> -#include <rtems/score/userext.h> -#include <rtems/rtems/status.h> -#include <rtems/rtems/types.h> - -typedef struct { - Objects_Control Object; - User_extensions_Control Extension; -} Extension_Control; - -typedef User_extensions_routine - rtems_extension RTEMS_DEPRECATED; - -/** - * @defgroup ClassicUserExtensions User Extensions - * - * @ingroup ClassicRTEMS - * - * @brief The User Extensions Manager allows the application developer to - * augment the executive by allowing them to supply extension routines which - * are invoked at critical system events. - * - * @section ClassicUserExtensionsSets Extension Sets - * - * An @ref User_extensions_Table "extension set" is defined as a set of - * routines which are invoked at each of the critical system events at which - * user extension routines are invoked. Together a set of these routines - * typically perform a specific functionality such as performance monitoring or - * debugger support. - * - * RTEMS allows the user to have multiple extension sets active at the same - * time. First, a single static extension set may be defined as the - * application's User Extension Table which is included as part of the - * Configuration Table. This extension set is active for the entire life of the - * system and may not be deleted. This extension set is especially important - * because it is the only way the application can provided a fatal error - * extension which is invoked if RTEMS fails during the - * rtems_initialize_data_structures() directive. The static extension set is - * optional and may be configured as @c NULL if no static extension set is - * required. - * - * Second, the user can install dynamic extensions using the - * rtems_extension_create() directive. These extensions are RTEMS objects in - * that they have a name, an ID, and can be dynamically created and deleted. In - * contrast to the static extension set, these extensions can only be created - * and installed after the rtems_initialize_data_structures() directive - * successfully completes execution. Dynamic extensions are useful for - * encapsulating the functionality of an extension set. For example, the - * application could use extensions to manage a special coprocessor, do - * performance monitoring, and to do stack bounds checking. Each of these - * extension sets could be written and installed independently of the others. - * - * All user extensions are optional and RTEMS places no naming restrictions on - * the user. The user extension entry points are copied into an internal RTEMS - * structure. This means the user does not need to keep the table after - * creating it, and changing the handler entry points dynamically in a table - * once created has no effect. Creating a table local to a function can save - * space in space limited applications. - * - * Extension switches do not effect the context switch overhead if no switch - * handler is installed. - * - * @section ClassicUserExtensionsTCB Task Control Block Area - * - * RTEMS provides for a pointer to a user-defined data area for each extension - * set to be linked to each task's control block (TCB). This area is only - * available for the dynamic extensions. This set of pointers is an extension - * of the TCB and can be used to store additional data required by the user's - * extension functions. - * - * The TCB extension is an array of pointers in the TCB. The index into the - * table can be obtained from the extension identifier returned when the - * extension is created: - * - * @code - * rtems_tcb *task = some_task; - * size_t index = rtems_object_id_get_index(extension_id); - * void *extension_data = task->extensions [index]; - * @endcode - * - * The number of pointers in the area is the same as the number of user - * extension sets configured. This allows an application to augment the TCB - * with user-defined information. For example, an application could implement - * task profiling by storing timing statistics in the TCB's extended memory - * area. When a task context switch is being executed, the task switch - * extension could read a real-time clock to calculate how long the task being - * swapped out has run as well as timestamp the starting time for the task - * being swapped in. - * - * If used, the extended memory area for the TCB should be allocated and the - * TCB extension pointer should be set at the time the task is created or - * started by either the task create or task start extension. The application - * is responsible for managing this extended memory area for the TCBs. The - * memory may be reinitialized by the task restart extension and should be - * deallocated by the task delete extension when the task is deleted. Since the - * TCB extension buffers would most likely be of a fixed size, the RTEMS - * partition manager could be used to manage the application's extended memory - * area. The application could create a partition of fixed size TCB extension - * buffers and use the partition manager's allocation and deallocation - * directives to obtain and release the extension buffers. - * - * @section ClassicUserExtensionsOrder Order of Invokation - * - * When one of the critical system events occur, the user extensions are - * invoked in either @a forward or @a reverse order. Forward order indicates - * that the static extension set is invoked followed by the dynamic extension - * sets in the order in which they were created. Reverse order means that the - * dynamic extension sets are invoked in the opposite of the order in which - * they were created followed by the static extension set. By invoking the - * extension sets in this order, extensions can be built upon one another. At - * the following system events, the extensions are invoked in forward order: - * - * - Task creation - * - Task start - * - Task restart - * - Task context switch - * - Post task context switch - * - Task begins to execute - * - * At the following system events, the extensions are invoked in reverse order: - * - * - Task exit - * - Task deletion - * - Fatal error detection - * - * At these system events, the extensions are invoked in reverse order to - * insure that if an extension set is built upon another, the more complicated - * extension is invoked before the extension set it is built upon. For example, - * by invoking the static extension set last it is known that the "system" - * fatal error extension will be the last fatal error extension executed. - * Another example is use of the task delete extension by the Standard C - * Library. Extension sets which are installed after the Standard C Library - * will operate correctly even if they utilize the C Library because the C - * Library's task delete extension is invoked after that of the other - * extensions. - */ -/**@{**/ - -typedef User_extensions_thread_create_extension rtems_task_create_extension; -typedef User_extensions_thread_delete_extension rtems_task_delete_extension; -typedef User_extensions_thread_start_extension rtems_task_start_extension; -typedef User_extensions_thread_restart_extension rtems_task_restart_extension; -typedef User_extensions_thread_switch_extension rtems_task_switch_extension; -typedef User_extensions_thread_begin_extension rtems_task_begin_extension; -typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; -typedef User_extensions_fatal_extension rtems_fatal_extension; -typedef User_extensions_thread_terminate_extension rtems_task_terminate_extension; - -typedef User_extensions_Table rtems_extensions_table; - -typedef Internal_errors_Source rtems_fatal_source; - -typedef Internal_errors_t rtems_fatal_code; - -/** - * @brief Creates an extension set object. - * - * This directive creates a extension set object from the extension table - * @a extension_table. The assigned extension set identifier is returned in - * @a id. The identifier is used to access this extension set in other - * extension set related directives. The name @a name will be assigned to the - * extension set object. - * - * Newly created extension sets are immediately installed and are invoked upon - * the next system event supporting an extension. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set created successfully. - * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL. - * @retval RTEMS_INVALID_NAME Invalid extension set name. - * @retval RTEMS_TOO_MANY Too many extension sets created. - */ -rtems_status_code rtems_extension_create( - rtems_name name, - const rtems_extensions_table *extension_table, - rtems_id *id -); - -/** - * @brief Identifies an extension set object by a name. - * - * This directive obtains an extension set identifier in @a id associated with - * the extension set name @a name. If the extension set name is not unique, - * then the extension set identifier will match one of the extension sets with - * that name. However, this extension set identifier is not guaranteed to - * correspond to the desired extension set. The extension set identifier is - * used to access this extension set in other extension set related directives. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set identified successfully. - * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL. - * @retval RTEMS_INVALID_NAME Extension set name not found or invalid name. - */ -rtems_status_code rtems_extension_ident( - rtems_name name, - rtems_id *id -); - -/** - * @brief Deletes an extension set object specified by the identifier @a id. - * - * Any subsequent references to the extension's name and identifier are - * invalid. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set deleted successfully. - * @retval RTEMS_INVALID_ID Invalid extension set identifier. - */ -rtems_status_code rtems_extension_delete( - rtems_id id -); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h deleted file mode 100644 index fb4eeaff7c..0000000000 --- a/cpukit/sapi/include/rtems/extensionimpl.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file - * - * @ingroup ClassicUserExtensions - * - * @brief User Extensions API - */ - -/* - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_EXTENSIONIMPL_H -#define _RTEMS_EXTENSIONIMPL_H - -#include <rtems/extension.h> -#include <rtems/score/objectimpl.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern Objects_Information _Extension_Information; - -RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void ) -{ - return (Extension_Control *) _Objects_Allocate( &_Extension_Information ); -} - -RTEMS_INLINE_ROUTINE void _Extension_Free ( - Extension_Control *the_extension -) -{ - _Objects_Free( &_Extension_Information, &the_extension->Object ); -} - -RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id ) -{ - return (Extension_Control *) - _Objects_Get_no_protection( id, &_Extension_Information ); -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h deleted file mode 100644 index 291af42c6e..0000000000 --- a/cpukit/sapi/include/rtems/fatal.h +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @file - * - * @brief Fatal API. - */ - -/* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_FATAL_H -#define _RTEMS_FATAL_H - -#include <rtems/score/basedefs.h> /* RTEMS_NO_RETURN */ -#include <rtems/extension.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicFatal Fatal - * - * @ingroup ClassicRTEMS - * - * @brief The Fatal Manager provides functions for fatal system states and or - * irrecoverable errors. - */ -/**@{**/ - -/** - * @brief Assert context. - */ -typedef struct { - const char *file; - int line; - const char *function; - const char *failed_expression; -} rtems_assert_context; - -/** - * @brief Exception frame. - */ -typedef CPU_Exception_frame rtems_exception_frame; - -/** - * @brief Prints the exception frame via printk(). - * - * @see rtems_fatal() and RTEMS_FATAL_SOURCE_EXCEPTION. - */ -static inline void rtems_exception_frame_print( - const rtems_exception_frame *frame -) -{ - _CPU_Exception_frame_print( frame ); -} - -/** - * @brief Invokes the internal error handler with a source of - * INTERNAL_ERROR_RTEMS_API and is internal set to false. - * - * @param[in] the_error is a 32-bit fatal error code. - * - * @see _Terminate(). - */ -void rtems_fatal_error_occurred( - uint32_t the_error -) RTEMS_NO_RETURN; - -/** - * @brief Terminates the system. - * - * @param[in] fatal_source The fatal source. - * @param[in] error_code The error code. - * - * @see _Terminate(). - */ -RTEMS_NO_RETURN RTEMS_INLINE_ROUTINE void rtems_fatal( - rtems_fatal_source fatal_source, - rtems_fatal_code error_code -) -{ - _Terminate( fatal_source, error_code ); -} - -/** - * @brief Prints the specified message via printk() and terminates the system. - * - * @param[in] fmt The message format. - * @param[in] ... The message parameters. - * - * @see _Terminate(). - */ -RTEMS_NO_RETURN void rtems_panic( - const char *fmt, ... -) RTEMS_PRINTFLIKE( 1, 2 ); - -/** - * @brief Returns a text for a fatal source. - * - * The text for each fatal source is the enumerator constant. - * - * @param[in] source is the fatal source. - * - * @retval text The fatal source text. - * @retval "?" The passed fatal source is invalid. - */ -const char *rtems_fatal_source_text( rtems_fatal_source source ); - -/** - * @brief Returns a text for an internal error code. - * - * The text for each internal error code is the enumerator constant. - * - * @param[in] error is the error code. - * - * @retval text The error code text. - * @retval "?" The passed error code is invalid. - */ -const char *rtems_internal_error_text( rtems_fatal_code error ); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h deleted file mode 100644 index fa3108ea50..0000000000 --- a/cpukit/sapi/include/rtems/init.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated - * with the Initialization Manager - * - * This include file contains all the constants and structures associated - * with the Initialization Manager. This manager is responsible for - * initializing RTEMS, creating and starting all configured initialization - * tasks, invoking the initialization routine for each user-supplied device - * driver, and initializing the optional multiprocessor layer. - * - * This manager provides directives to: - * - * + initialize the RTEMS executive - * + shutdown the RTEMS executive - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_INIT_H -#define _RTEMS_INIT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/rtems/types.h> -#include <rtems/config.h> -#include <rtems/rtems/intr.h> - -/** - * @brief Initializes the system and starts multitasking. - * - * Iterates through the system initialization linker set and invokes the - * registered handlers. The final step is to start multitasking. - * - * This directive should be called by boot_card() only. - * - * This directive does not return. - */ -void rtems_initialize_executive(void) - RTEMS_NO_RETURN; - -/** - * @brief Shutdown the RTEMS environment. - * - * This routine implements the rtems_shutdown_executive directive. The - * invocation of this directive results in the RTEMS environment being - * shutdown and multitasking halted. The system is terminated with a fatal - * source of RTEMS_FATAL_SOURCE_EXIT and the specified result code. - */ -void rtems_shutdown_executive( - uint32_t result -) RTEMS_NO_RETURN; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h deleted file mode 100644 index 760d412bb8..0000000000 --- a/cpukit/sapi/include/rtems/io.h +++ /dev/null @@ -1,254 +0,0 @@ -/** - * @file - * - * @brief Classic Input/Output Manager API - * - * This file emulates the old Classic RTEMS IO manager directives - * which register and lookup names using the in-memory filesystem. - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_IO_H -#define _RTEMS_IO_H - -#include <rtems/rtems/status.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicIO Input/Output - * - * @ingroup ClassicRTEMS - * - */ -/**@{**/ - -typedef uint32_t rtems_device_major_number; - -typedef uint32_t rtems_device_minor_number; - -typedef rtems_status_code rtems_device_driver; - -typedef rtems_device_driver (*rtems_device_driver_entry)( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -typedef struct { - rtems_device_driver_entry initialization_entry; - rtems_device_driver_entry open_entry; - rtems_device_driver_entry close_entry; - rtems_device_driver_entry read_entry; - rtems_device_driver_entry write_entry; - rtems_device_driver_entry control_entry; -} rtems_driver_address_table; - -/** - * @name Device Driver Maintainance - */ -/**@{**/ - -/** - * @brief Returns @c RTEMS_IO_ERROR. - * - * @retval RTEMS_IO_ERROR Only this one. - */ -rtems_status_code rtems_io_driver_io_error( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Registers and initializes the device with the device driver table - * @a driver_table and major number @a major. - * - * If the major number equals zero a major number will be obtained. The major - * number of the registered driver will be returned in @a registered_major. - * - * After a successful registration rtems_io_initialize() will be called to - * initialize the device. - * - * @retval RTEMS_SUCCESSFUL Device successfully registered and initialized. - * @retval RTEMS_INVALID_ADDRESS Pointer to driver table or to registered - * major number are invalid. Device driver table is empty. - * @retval RTEMS_INVALID_NUMBER Invalid major number. - * @retval RTEMS_TOO_MANY No major number available. - * @retval RTEMS_RESOURCE_IN_USE Major number in use. - * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. - * @retval * Status code depends on rtems_io_initialize(). - */ -rtems_status_code rtems_io_register_driver( - rtems_device_major_number major, - const rtems_driver_address_table *driver_table, - rtems_device_major_number *registered_major -); - -/** - * @brief Unregister a driver from the device driver table. - * - * @param[in] major is the device major number. - * - * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered. - * @retval RTEMS_UNSATISFIED Invalid major number. - * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. - */ -rtems_status_code rtems_io_unregister_driver( - rtems_device_major_number major -); - -/** - * @brief Registers the name @a device_name in the file system for the device - * with number tuple @a major and @a minor. - * - * This assumes that all registered devices are character devices. - * - * @retval RTEMS_SUCCESSFUL Name successfully registered. - * @retval RTEMS_TOO_MANY Name already in use or other errors. - */ -rtems_status_code rtems_io_register_name( - const char *device_name, - rtems_device_major_number major, - rtems_device_minor_number minor -); - -/** @} */ - -/** - * @brief IO driver initialization. - * - * This routine is the initialization directive of the IO manager. - * - * @param[in] major is the device drive number - * @param[in] minor is the device number - * @param[in] argument is the pointer to the argument(s) - * - * @return status code - */ -rtems_status_code rtems_io_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Opening for the IO manager. - * - * Opens a device driver with the number @a major. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Closing for the IO manager. - * - * This routine is the close directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Reading for the IO manager. - * - * This routine is the read directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Writing for the IO manager. - * - * This routine is the write directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Control for the IO manager. - * - * This routine is the control directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** @} */ - -/** @} */ - -typedef struct { - const char *device_name; - size_t device_name_length; - rtems_device_major_number major; - rtems_device_minor_number minor; -} rtems_driver_name_t; - -/** - * @deprecated Use stat() instead. - */ -rtems_status_code rtems_io_lookup_name( - const char *name, - rtems_driver_name_t *device_info -) RTEMS_DEPRECATED; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/ioimpl.h b/cpukit/sapi/include/rtems/ioimpl.h deleted file mode 100644 index 5c4a82eea6..0000000000 --- a/cpukit/sapi/include/rtems/ioimpl.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file - * - * @brief Classic Input/Output Manager Implementation API - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_IOIMPL_H -#define _RTEMS_IOIMPL_H - -#include <rtems/io.h> -#include <rtems/score/isrlock.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern const size_t _IO_Number_of_drivers; - -extern rtems_driver_address_table _IO_Driver_address_table[]; - -extern bool _IO_All_drivers_initialized; - -/** - * @brief Initialization of all device drivers. - * - * Initializes all device drivers. - */ -void _IO_Initialize_all_drivers( void ); - -ISR_LOCK_DECLARE( extern, _IO_Driver_registration_lock ) - -RTEMS_INLINE_ROUTINE void _IO_Driver_registration_acquire( - ISR_lock_Context *lock_context -) -{ - _ISR_lock_ISR_disable_and_acquire( - &_IO_Driver_registration_lock, - lock_context - ); -} - -RTEMS_INLINE_ROUTINE void _IO_Driver_registration_release( - ISR_lock_Context *lock_context -) -{ - _ISR_lock_Release_and_ISR_enable( - &_IO_Driver_registration_lock, - lock_context - ); -} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_IOIMPL_H */ diff --git a/cpukit/sapi/include/rtems/mptables.h b/cpukit/sapi/include/rtems/mptables.h deleted file mode 100644 index 01e5b653b4..0000000000 --- a/cpukit/sapi/include/rtems/mptables.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file - * - * @brief Executive's Pre-Initialized Tables used in a - * Multiprocessor Configuration - * - * This include file contains the executive's pre-initialized tables - * used in a multiprocessor configuration. - */ - -/* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_MPTABLES_H -#define _RTEMS_MPTABLES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/profiling.h b/cpukit/sapi/include/rtems/profiling.h deleted file mode 100644 index 9e434b2a3c..0000000000 --- a/cpukit/sapi/include/rtems/profiling.h +++ /dev/null @@ -1,333 +0,0 @@ -/** - * @file - * - * @ingroup Profiling - * - * @brief Profiling API - */ - -/* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_PROFILING_H -#define _RTEMS_PROFILING_H - -#include <stdint.h> - -#include <rtems/print.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup Profiling Profiling Support - * - * @brief The profiling support offers functions to report profiling - * information available in the system. - * - * Profiling support is by default disabled. It must be enabled via the - * configure command line with the <tt>--enable-profiling</tt> option. In this - * case the RTEMS_PROFILING pre-processor symbol is defined and profiling - * statistics will be gathered during system run-time. The profiling support - * increases the time of critical sections and has some memory overhead. The - * overhead should be acceptable for most applications. The aim of the - * profiling implementation is to be available even for production systems so - * that verification is simplified. - * - * Profiling information includes critical timing values such as the maximum - * time of disabled thread dispatching which is a measure for the thread - * dispatch latency. On SMP configurations statistics of all SMP locks in the - * system are available. - * - * Profiling information can be retrieved via rtems_profiling_iterate() and - * reported as an XML dump via rtems_profiling_report_xml(). These functions - * are always available, but actual profiling data is only available if enabled - * at build configuration time. - * - * @{ - */ - -/** - * @brief Type of profiling data. - */ -typedef enum { - /** - * @brief Type of per-CPU profiling data. - * - * @see rtems_profiling_per_cpu. - */ - RTEMS_PROFILING_PER_CPU, - - /** - * @brief Type of SMP lock profiling data. - * - * @see rtems_profiling_smp_lock. - */ - RTEMS_PROFILING_SMP_LOCK -} rtems_profiling_type; - -/** - * @brief The profiling data header. - */ -typedef struct { - /** - * @brief The profiling data type. - */ - rtems_profiling_type type; -} rtems_profiling_header; - -/** - * @brief Per-CPU profiling data. - * - * Theoretically all values in this structure can overflow, but the integer - * types are chosen so that they cannot overflow in practice. On systems with - * a 1GHz CPU counter, the 64-bit integers can overflow in about 58 years. - * Since the system should not spend most of the time in critical sections the - * actual system run-time is much longer. Several other counters in the system - * will overflow before we get a problem in the profiling area. - */ -typedef struct { - /** - * @brief The profiling data header. - */ - rtems_profiling_header header; - - /** - * @brief The processor index of this profiling data. - */ - uint32_t processor_index; - - /** - * @brief The maximum time of disabled thread dispatching in nanoseconds. - */ - uint32_t max_thread_dispatch_disabled_time; - - /** - * @brief Count of times when the thread dispatch disable level changes from - * zero to one in thread context. - * - * This value may overflow. - */ - uint64_t thread_dispatch_disabled_count; - - /** - * @brief Total time of disabled thread dispatching in nanoseconds. - * - * The average time of disabled thread dispatching is the total time of - * disabled thread dispatching divided by the thread dispatch disabled - * count. - * - * This value may overflow. - */ - uint64_t total_thread_dispatch_disabled_time; - - /** - * @brief The maximum interrupt delay in nanoseconds if supported by the - * hardware. - * - * The interrupt delay is the time interval from the recognition of an - * interrupt signal by the hardware up to the execution start of the - * corresponding high-level handler. The interrupt delay is the main - * contributor to the interrupt latency. To measure this time hardware - * support is required. A time stamp unit must capture the interrupt signal - * recognition time. If no hardware support is available, then this field - * will have a constant value of zero. - */ - uint32_t max_interrupt_delay; - - /** - * @brief The maximum time spent to process a single sequence of nested - * interrupts in nanoseconds. - * - * This is the time interval between the change of the interrupt nest level - * from zero to one and the change back from one to zero. It is the measured - * worst-case execution time of interrupt service routines. Please note that - * in case of nested interrupts this time includes the combined execution - * time and not the maximum time of an individual interrupt service routine. - */ - uint32_t max_interrupt_time; - - /** - * @brief Count of times when the interrupt nest level changes from zero to - * one. - * - * This value may overflow. - */ - uint64_t interrupt_count; - - /** - * @brief Total time of interrupt processing in nanoseconds. - * - * The average time of interrupt processing is the total time of interrupt - * processing divided by the interrupt count. - * - * This value may overflow. - */ - uint64_t total_interrupt_time; -} rtems_profiling_per_cpu; - -/** - * @brief Count of lock contention counters for SMP lock profiling. - */ -#define RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS 4 - -/** - * @brief SMP lock profiling data. - * - * The lock acquire attempt instant is the point in time right after the - * interrupt disable action in the lock acquire sequence. - * - * The lock acquire instant is the point in time right after the lock - * acquisition. This is the begin of the critical section code execution. - * - * The lock acquire time is the time elapsed between the lock acquire attempt - * instant and the lock acquire instant. - * - * The lock release instant is the point in time right before the interrupt - * enable action in the lock release sequence. - * - * The lock section time is the time elapsed between the lock acquire instant - * and the lock release instant. - */ -typedef struct { - /** - * @brief The profiling data header. - */ - rtems_profiling_header header; - - /** - * @brief The lock name. - */ - const char *name; - - /** - * @brief The maximum lock acquire time in nanoseconds. - */ - uint32_t max_acquire_time; - - /** - * @brief The maximum lock section time in nanoseconds. - */ - uint32_t max_section_time; - - /** - * @brief The count of lock uses. - * - * This value may overflow. - */ - uint64_t usage_count; - - /** - * @brief Total lock acquire time in nanoseconds. - * - * The average lock acquire time is the total acquire time divided by the - * lock usage count. The ration of the total section and total acquire times - * gives a measure for the lock contention. - * - * This value may overflow. - */ - uint64_t total_acquire_time; - - /** - * @brief Total lock section time in nanoseconds. - * - * The average lock section time is the total section time divided by the - * lock usage count. - * - * This value may overflow. - */ - uint64_t total_section_time; - - /** - * @brief The counts of lock acquire operations by contention. - * - * The contention count for index N corresponds to a lock acquire attempt - * with an initial queue length of N. The last index corresponds to all - * lock acquire attempts with an initial queue length greater than or equal - * to RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS minus one. - * - * The values may overflow. - */ - uint64_t contention_counts[RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS]; -} rtems_profiling_smp_lock; - -/** - * @brief Collection of profiling data. - */ -typedef union { - /** - * @brief Header to specify the actual profiling data. - */ - rtems_profiling_header header; - - /** - * @brief Per-CPU profiling data if indicated by the header. - */ - rtems_profiling_per_cpu per_cpu; - - /** - * @brief SMP lock profiling data if indicated by the header. - */ - rtems_profiling_smp_lock smp_lock; -} rtems_profiling_data; - -/** - * @brief Visitor function for the profiling iteration. - * - * @param[in, out] arg The visitor argument. - * @param[in] data The current profiling data. - * - * @see rtems_profiling_iterate(). - */ -typedef void (*rtems_profiling_visitor)( - void *arg, - const rtems_profiling_data *data -); - -/** - * @brief Iterates through all profiling data of the system. - * - * @param[in] visitor The visitor. - * @param[in, out] visitor_arg The visitor argument. - */ -void rtems_profiling_iterate( - rtems_profiling_visitor visitor, - void *visitor_arg -); - -/** - * @brief Reports profiling data as XML. - * - * @param[in] name The name of the profiling report. - * @param[in] printer The RTEMS printer to send the output too. - * @param[in] indentation_level The current indentation level. - * @param[in] indentation The string used for indentation. - * - * @returns As specified by printf(). - */ -int rtems_profiling_report_xml( - const char *name, - const rtems_printer *printer, - uint32_t indentation_level, - const char *indentation -); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_PROFILING_H */ diff --git a/cpukit/sapi/include/rtems/rbheap.h b/cpukit/sapi/include/rtems/rbheap.h deleted file mode 100644 index 735aa6c8fd..0000000000 --- a/cpukit/sapi/include/rtems/rbheap.h +++ /dev/null @@ -1,268 +0,0 @@ -/** - * @file - * - * @brief Red-Black Tree Heap API - */ - -/* - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_RBHEAP_H -#define _RTEMS_RBHEAP_H - -#include <rtems.h> -#include <rtems/chain.h> -#include <rtems/rbtree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup RBHeap Red-Black Tree Heap - * - * @ingroup ClassicRTEMS - * - * @brief Red-Black Tree Heap API. - * - * The red-black tree heap provides a memory allocator suitable to implement - * the malloc() and free() interface. It uses a first-fit allocation strategy. - * In the red-black tree heap the administration data structures are not - * contained in the managed memory area. Thus writing beyond the boundaries of - * a chunk does not damage the data to maintain the heap. This can be used for - * example in a task stack allocator which protects the task stacks from access - * by other tasks. The allocated and free memory parts of the managed area are - * called chunks. Each chunk needs a descriptor which is stored outside of the - * managed area. - */ -/**@{*/ - -/** - * @brief Red-black heap chunk descriptor. - */ -typedef struct { - /** - * This chain node can be used in two chains - * - the chain of spare chunk descriptors and - * - the chain of free chunks in the managed memory area. - * - * In case this chain node is not part of a chain, the chunk represents a - * used chunk in the managed memory area. - */ - rtems_chain_node chain_node; - - /** - * Tree node for chunks that represent a part of the managed memory area. - * These chunks are either free or used. - */ - rtems_rbtree_node tree_node; - - /** - * Begin address of the chunk. The address alignment it specified in the - * @ref rtems_rbheap_control. - */ - uintptr_t begin; - - /** - * Size of the chunk in bytes. - */ - uintptr_t size; -} rtems_rbheap_chunk; - -typedef struct rtems_rbheap_control rtems_rbheap_control; - -/** - * @brief Handler to extend the available chunk descriptors. - * - * This handler is called when no more chunk descriptors are available. An - * example implementation is this: - * - * @code - * void extend_descriptors_with_malloc(rtems_rbheap_control *control) - * { - * rtems_rbheap_chunk *chunk = malloc(sizeof(*chunk)); - * - * if (chunk != NULL) { - * rtems_rbheap_add_to_spare_descriptor_chain(control, chunk); - * } - * } - * @endcode - * - * @see rtems_rbheap_extend_descriptors_never() and - * rtems_rbheap_extend_descriptors_with_malloc(). - */ -typedef void (*rtems_rbheap_extend_descriptors)(rtems_rbheap_control *control); - -/** - * @brief Red-black heap control. - */ -struct rtems_rbheap_control { - /** - * Chain of free chunks in the managed memory area. - */ - rtems_chain_control free_chunk_chain; - - /** - * Chain of free chunk descriptors. Descriptors are consumed during - * allocation and may be produced during free if contiguous chunks can be - * coalesced. In case of descriptor starvation the @ref extend_descriptors - * handler will be called. - */ - rtems_chain_control spare_descriptor_chain; - - /** - * Tree of chunks representing the state of the managed memory area. - */ - rtems_rbtree_control chunk_tree; - - /** - * Minimum chunk begin alignment in bytes. - */ - uintptr_t alignment; - - /** - * Handler to extend the available chunk descriptors. - */ - rtems_rbheap_extend_descriptors extend_descriptors; - - /** - * User specified argument handler for private handler data. - */ - void *handler_arg; -}; - -/** - * @brief Initializes the red-black tree heap @a control. - * - * @param[in, out] control The red-black tree heap. - * @param[in] area_begin The managed memory area begin. - * @param[in] area_size The managed memory area size. - * @param[in] alignment The minimum chunk alignment. - * @param[in] extend_descriptors The handler to extend the available chunk - * descriptors. - * @param[in] handler_arg The handler argument. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The memory area is invalid. - * @retval RTEMS_NO_MEMORY Not enough chunk descriptors. - */ -rtems_status_code rtems_rbheap_initialize( - rtems_rbheap_control *control, - void *area_begin, - uintptr_t area_size, - uintptr_t alignment, - rtems_rbheap_extend_descriptors extend_descriptors, - void *handler_arg -); - -/** - * @brief Allocates a chunk of memory of at least @a size bytes from the - * red-black tree heap @a control. - * - * The chunk begin is aligned by the value specified in - * rtems_rbheap_initialize(). - * - * @param[in, out] control The red-black tree heap. - * @param[in] size The requested chunk size in bytes. - * - * @retval NULL Not enough free space in the heap. - * @retval otherwise Pointer to allocated chunk of memory. - */ -void *rtems_rbheap_allocate(rtems_rbheap_control *control, size_t size); - -/** - * @brief Frees a chunk of memory @a ptr allocated from the red-black tree heap - * @a control. - * - * @param[in, out] control The red-black tree heap. - * @param[in] ptr The pointer to the chunk of memory. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID The chunk of memory is not a valid chunk in the - * red-black tree heap. - * @retval RTEMS_INCORRECT_STATE The chunk of memory is not in the right state. - */ -rtems_status_code rtems_rbheap_free(rtems_rbheap_control *control, void *ptr); - -static inline rtems_chain_control *rtems_rbheap_get_spare_descriptor_chain( - rtems_rbheap_control *control -) -{ - return &control->spare_descriptor_chain; -} - -static inline void rtems_rbheap_add_to_spare_descriptor_chain( - rtems_rbheap_control *control, - rtems_rbheap_chunk *chunk -) -{ - rtems_chain_control *chain = - rtems_rbheap_get_spare_descriptor_chain(control); - - rtems_chain_initialize_node(&chunk->chain_node); - rtems_chain_prepend_unprotected(chain, &chunk->chain_node); -} - -static inline void rtems_rbheap_set_extend_descriptors( - rtems_rbheap_control *control, - rtems_rbheap_extend_descriptors extend_descriptors -) -{ - control->extend_descriptors = extend_descriptors; -} - -static inline void *rtems_rbheap_get_handler_arg( - const rtems_rbheap_control *control -) -{ - return control->handler_arg; -} - -static inline void rtems_rbheap_set_handler_arg( - rtems_rbheap_control *control, - void *handler_arg -) -{ - control->handler_arg = handler_arg; -} - -/** - * @brief Chunk descriptor extend handler that does nothing. - */ -void rtems_rbheap_extend_descriptors_never(rtems_rbheap_control *control); - -/** - * @brief Chunk descriptor extend handler that uses malloc(). - */ -void rtems_rbheap_extend_descriptors_with_malloc( - rtems_rbheap_control *control -); - -/** @} */ - -/* Private API */ - -#define rtems_rbheap_chunk_of_node(node) \ - RTEMS_CONTAINER_OF(node, rtems_rbheap_chunk, tree_node) - -static inline bool rtems_rbheap_is_chunk_free(const rtems_rbheap_chunk *chunk) -{ - return !rtems_chain_is_node_off_chain(&chunk->chain_node); -} - -#ifdef __cplusplus -} -#endif - -#endif /* _RTEMS_RBHEAP_H */ diff --git a/cpukit/sapi/include/rtems/rbtree.h b/cpukit/sapi/include/rtems/rbtree.h deleted file mode 100644 index 57821cf31d..0000000000 --- a/cpukit/sapi/include/rtems/rbtree.h +++ /dev/null @@ -1,456 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated with the RBTree API in RTEMS - * - * This include file contains all the constants and structures associated - * with the RBTree API in RTEMS. The rbtree is a Red Black Tree that - * is part of the Super Core. This is the published interface to that - * code. - */ - -/* - * Copyright (c) 2010 Gedare Bloom. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_RBTREE_H -#define _RTEMS_RBTREE_H - -#include <rtems/score/rbtree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicRBTrees Red-Black Trees - * - * @ingroup ClassicRTEMS - * - * @brief A Red-Black Tree container. - * - * The red-black tree container offers no internal protection against - * concurrent access. The user must ensure that at most one thread at once can - * access a red-black tree instance. - * - * @{ - */ - -/** - * @typedef rtems_rbtree_node - * - * A node that can be manipulated in the rbtree. - */ -typedef RBTree_Node rtems_rbtree_node; - -/** - * @typedef rtems_rbtree_control - * - * The rbtree's control anchors the rbtree. - */ -typedef RBTree_Control rtems_rbtree_control; - -/** - * @brief Integer type for compare results. - * - * The type is large enough to represent pointers and 32-bit signed integers. - * - * @see rtems_rbtree_compare. - */ -typedef long rtems_rbtree_compare_result; - -/** - * @brief Compares two red-black tree nodes. - * - * @param[in] first The first node. - * @param[in] second The second node. - * - * @retval positive The key value of the first node is greater than the one of - * the second node. - * @retval 0 The key value of the first node is equal to the one of the second - * node. - * @retval negative The key value of the first node is less than the one of the - * second node. - */ -typedef rtems_rbtree_compare_result ( *rtems_rbtree_compare )( - const RBTree_Node *first, - const RBTree_Node *second -); - -/** - * @brief RBTree initializer for an empty rbtree with designator @a name. - */ -#define RTEMS_RBTREE_INITIALIZER_EMPTY(name) \ - RBTREE_INITIALIZER_EMPTY(name) - -/** - * @brief RBTree definition for an empty rbtree with designator @a name. - */ -#define RTEMS_RBTREE_DEFINE_EMPTY(name) \ - RBTREE_DEFINE_EMPTY(name) - -/** - * @brief Initialize a RBTree header. - * - * This routine initializes @a the_rbtree structure to manage the - * contiguous array of @a number_nodes nodes which starts at - * @a starting_address. Each node is of @a node_size bytes. - * - * @param[in] the_rbtree is the pointer to rbtree header - * @param[in] compare The node compare function. - * @param[in] starting_address is the starting address of first node - * @param[in] number_nodes is the number of nodes in rbtree - * @param[in] node_size is the size of node in bytes - * @param[in] is_unique If true, then reject nodes with a duplicate key, else - * otherwise. - */ -void rtems_rbtree_initialize( - rtems_rbtree_control *the_rbtree, - rtems_rbtree_compare compare, - void *starting_address, - size_t number_nodes, - size_t node_size, - bool is_unique -); - -/** - * @brief Initialize this RBTree as Empty - * - * This routine initializes @a the_rbtree to contain zero nodes. - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize_empty( - rtems_rbtree_control *the_rbtree -) -{ - _RBTree_Initialize_empty( the_rbtree ); -} - -/** - * @brief Set off RBtree. - * - * This function sets the next and previous fields of the @a node to NULL - * indicating the @a node is not part of any rbtree. - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_set_off_tree( - rtems_rbtree_node *node -) -{ - _RBTree_Set_off_tree( node ); -} - -/** - * @brief Is the Node off RBTree. - * - * This function returns true if the @a node is not on a rbtree. A @a node is - * off rbtree if the next and previous fields are set to NULL. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_node_off_tree( - const rtems_rbtree_node *node -) -{ - return _RBTree_Is_node_off_tree( node ); -} - -/** - * @brief Return pointer to RBTree root. - * - * This function returns a pointer to the root node of @a the_rbtree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_root( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Root( the_rbtree ); -} - -/** - * @copydoc _RBTree_Minimum() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_min( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Minimum( the_rbtree ); -} - -/** - * @copydoc _RBTree_Maximum() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_max( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Maximum( the_rbtree ); -} - -/** - * @brief Return pointer to the left child node from this node. - * - * This function returns a pointer to the left child node of @a the_node. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_left( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Left( the_node ); -} - -/** - * @brief Return pointer to the right child node from this node. - * - * This function returns a pointer to the right child node of @a the_node. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_right( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Right( the_node ); -} - -/** - * @copydoc _RBTree_Parent() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_parent( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Parent( the_node ); -} - -/** - * @brief Is the RBTree empty. - * - * This function returns true if there a no nodes on @a the_rbtree and - * false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_empty( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Is_empty( the_rbtree ); -} - -/** - * @brief Is this the minimum node on the RBTree. - * - * This function returns true if @a the_node is the min node on @a the_rbtree - * and false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_min( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node -) -{ - return rtems_rbtree_min( the_rbtree ) == the_node; -} - -/** - * @brief Is this the maximum node on the RBTree. - * - * This function returns true if @a the_node is the max node on @a the_rbtree - * and false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_max( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node -) -{ - return rtems_rbtree_max( the_rbtree ) == the_node; -} - -/** - * @copydoc _RBTree_Is_root() - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_root( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Is_root( the_node ); -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_equal( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result == 0; -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_greater( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result > 0; -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_lesser( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result < 0; -} - -/** - * @brief Tries to find a node for the specified key in the tree. - * - * @param[in] the_rbtree The red-black tree control. - * @param[in] the_node A node specifying the key. - * @param[in] compare The node compare function. - * @param[in] is_unique If true, then return the first node with a key equal to - * the one of the node specified if it exits, else return the last node if it - * exists. - * - * @retval node A node corresponding to the key. If the tree is not unique - * and contains duplicate keys, the set of duplicate keys acts as FIFO. - * @retval NULL No node exists in the tree for the key. - */ -rtems_rbtree_node* rtems_rbtree_find( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node, - rtems_rbtree_compare compare, - bool is_unique -); - -/** - * @copydoc _RBTree_Predecessor() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor( - const rtems_rbtree_node *node -) -{ - return _RBTree_Predecessor( node ); -} - -/** - * @copydoc _RBTree_Successor() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor( - const rtems_rbtree_node *node -) -{ - return _RBTree_Successor( node ); -} - -/** - * @copydoc _RBTree_Extract() - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_extract( - rtems_rbtree_control *the_rbtree, - rtems_rbtree_node *the_node -) -{ - _RBTree_Extract( the_rbtree, the_node ); -} - -/** - * @brief Gets a node with the minimum key value from the red-black tree. - * - * This function extracts a node with the minimum key value from - * tree and returns a pointer to that node if it exists. In case multiple - * nodes with a minimum key value exist, then they are extracted in FIFO order. - * - * @param[in] the_rbtree The red-black tree control. - * - * @retval NULL The tree is empty. - * @retval node A node with the minimal key value on the tree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min( - rtems_rbtree_control *the_rbtree -) -{ - rtems_rbtree_node *the_node = rtems_rbtree_min( the_rbtree ); - - if ( the_node != NULL ) { - rtems_rbtree_extract( the_rbtree, the_node ); - } - - return the_node; -} - -/** - * @brief Gets a node with the maximal key value from the red-black tree. - * - * This function extracts a node with the maximum key value from tree and - * returns a pointer to that node if it exists. In case multiple nodes with a - * maximum key value exist, then they are extracted in LIFO order. - * - * @param[in] the_rbtree The red-black tree control. - * - * @retval NULL The tree is empty. - * @retval node A node with the maximal key value on the tree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max( - rtems_rbtree_control *the_rbtree -) -{ - rtems_rbtree_node *the_node = rtems_rbtree_max( the_rbtree ); - - if ( the_node != NULL ) { - rtems_rbtree_extract( the_rbtree, the_node ); - } - - return the_node; -} - -/** - * @brief Peek at the min node on a rbtree. - * - * This function returns a pointer to the min node from @a the_rbtree - * without changing the tree. If @a the_rbtree is empty, - * then NULL is returned. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_min( - const rtems_rbtree_control *the_rbtree -) -{ - return rtems_rbtree_min( the_rbtree ); -} - -/** - * @brief Peek at the max node on a rbtree. - * - * This function returns a pointer to the max node from @a the_rbtree - * without changing the tree. If @a the_rbtree is empty, - * then NULL is returned. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_max( - const rtems_rbtree_control *the_rbtree -) -{ - return rtems_rbtree_max( the_rbtree ); -} - -/** - * @brief Inserts the node into the red-black tree. - * - * In case the node is already a node of a tree, then this function yields - * unpredictable results. - * - * @param[in] the_rbtree The red-black tree control. - * @param[in] the_node The node to insert. - * @param[in] compare The node compare function. - * @param[in] is_unique If true, then reject nodes with a duplicate key, else - * insert nodes in FIFO order in case the key value is equal to existing nodes. - * - * @retval NULL Successfully inserted. - * @retval existing_node This is a unique insert and there exists a node with - * an equal key in the tree already. - */ -rtems_rbtree_node *rtems_rbtree_insert( - RBTree_Control *the_rbtree, - RBTree_Node *the_node, - rtems_rbtree_compare compare, - bool is_unique -); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/scheduler.h b/cpukit/sapi/include/rtems/scheduler.h deleted file mode 100644 index 8684b798f7..0000000000 --- a/cpukit/sapi/include/rtems/scheduler.h +++ /dev/null @@ -1,247 +0,0 @@ -/** - * @file - * - * @brief Scheduler Configuration API - */ - -/* - * Copyright (c) 2014, 2017 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_SAPI_SCHEDULER_H -#define _RTEMS_SAPI_SCHEDULER_H - -#include <rtems/score/scheduler.h> - -#define RTEMS_SCHEDULER_CONTEXT_NAME( name ) \ - _Configuration_Scheduler_ ## name - -#if defined(RTEMS_SMP) - /* This object doesn't exist and indicates a configuration error */ - extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX; - - #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \ - SCHEDULER_ASSIGN_DEFAULT - - #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ - SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL - - #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \ - SCHEDULER_ASSIGN_PROCESSOR_MANDATORY - - #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \ - { \ - ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \ - &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \ - ( attr ) \ - } - - #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 } -#endif - -/* - * This file should be only included in the context of <rtems/confdefs.h>. - * Define the scheduler configuration macros only in case the corresponding - * configure symbol is defined. This is necessary to prevent invalid workspace - * size estimates since we have to account for the per-thread scheduler - * information. - */ - -#ifdef CONFIGURE_SCHEDULER_CBS - #include <rtems/score/schedulercbs.h> - - #define RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( CBS_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \ - static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \ - SCHEDULER_CBS_ENTRY_POINTS, \ - SCHEDULER_CBS_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_EDF - #include <rtems/score/scheduleredf.h> - - #define RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( EDF_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \ - static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \ - SCHEDULER_EDF_ENTRY_POINTS, \ - SCHEDULER_EDF_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_EDF_SMP - #include <rtems/score/scheduleredfsmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \ - static struct { \ - Scheduler_EDF_SMP_Context Base; \ - Scheduler_EDF_SMP_Ready_queue Ready[ ( max_cpu_count ) + 1 ]; \ - } RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_EDF_SMP_ENTRY_POINTS, \ - SCHEDULER_EDF_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY - #include <rtems/score/schedulerpriority.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \ - static struct { \ - Scheduler_priority_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \ - SCHEDULER_PRIORITY_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - #include <rtems/score/schedulerpriorityaffinitysmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \ - static struct { \ - Scheduler_priority_SMP_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP - #include <rtems/score/schedulerprioritysmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \ - static struct { \ - Scheduler_priority_SMP_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_STRONG_APA - #include <rtems/score/schedulerstrongapa.h> - - #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( strong_APA_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \ - static struct { \ - Scheduler_strong_APA_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Base.Base.Base, \ - SCHEDULER_STRONG_APA_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_SIMPLE - #include <rtems/score/schedulersimple.h> - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \ - static Scheduler_simple_Context \ - RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \ - SCHEDULER_SIMPLE_ENTRY_POINTS, \ - SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP - #include <rtems/score/schedulersimplesmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \ - static Scheduler_simple_SMP_Context \ - RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base.Base, \ - SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \ - SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#endif /* _RTEMS_SAPI_SCHEDULER_H */ diff --git a/cpukit/sapi/include/rtems/timecounter.h b/cpukit/sapi/include/rtems/timecounter.h deleted file mode 100644 index 8d1bd78618..0000000000 --- a/cpukit/sapi/include/rtems/timecounter.h +++ /dev/null @@ -1,335 +0,0 @@ -/** - * @file - * - * @ingroup SAPITimecounter - * - * @brief Timecounter API - */ - -/* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_TIMECOUNTER_H -#define _RTEMS_TIMECOUNTER_H - -#include <rtems/score/timecounter.h> -#include <rtems/score/basedefs.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup SAPITimecounter Timecounter Support - * - * @{ - */ - -/** - * @brief Timecounter quality for the clock drivers. - * - * Timecounter with higher quality value are used in favour of those with lower - * quality value. - */ -#define RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER 100 - -/** - * @copydoc _Timecounter_Install() - * - * Below is an exemplary code snippet that shows the adjustable parameters and - * the following call of the install routine. - * - * @code - * struct timecounter tc; - * - * uint32_t get_timecount( struct timecounter *tc ) - * { - * return some_free_running_counter; - * } - * - * void install( void ) - * { - * tc.tc_get_timecount = get_timecount; - * tc.tc_counter_mask = 0xffffffff; - * tc.tc_frequency = 123456; - * tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; - * rtems_timecounter_install( &tc ); - * } - * @endcode - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_install( - struct timecounter *tc -) -{ - _Timecounter_Install( tc ); -} - -/** - * @copydoc _Timecounter_Tick() - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_tick(void) -{ - _Timecounter_Tick(); -} - -/** - * @brief Simple timecounter to support legacy clock drivers. - */ -typedef struct { - struct timecounter tc; - uint64_t scaler; - uint32_t real_interval; - uint32_t binary_interval; -} rtems_timecounter_simple; - -/** - * @brief At tick handling done under protection of the timecounter lock. - */ -typedef void rtems_timecounter_simple_at_tick( - rtems_timecounter_simple *tc -); - -/** - * @brief Returns the current value of a simple timecounter. - */ -typedef uint32_t rtems_timecounter_simple_get( - rtems_timecounter_simple *tc -); - -/** - * @brief Returns true if the interrupt of a simple timecounter is pending, and - * false otherwise. - */ -typedef bool rtems_timecounter_simple_is_pending( - rtems_timecounter_simple *tc -); - -/** - * @brief Initializes and installs a simple timecounter. - * - * A simple timecounter can be used if the hardware provides no free running - * counter. A periodic hardware counter must be provided. The counter period - * must be synchronous to the clock tick. The counter ticks per clock tick is - * scaled up to the next power of two. - * - * @param[in] tc Zero initialized simple timecounter. - * @param[in] counter_frequency_in_hz The hardware counter frequency in Hz. - * @param[in] counter_ticks_per_clock_tick The hardware counter ticks per clock - * tick. - * @param[in] get_timecount The method to get the current time count. - * - * @code - * #include <rtems/timecounter.h> - * - * static rtems_timecounter_simple some_tc; - * - * static uint32_t some_tc_get( rtems_timecounter_simple *tc ) - * { - * return some.value; - * } - * - * static bool some_tc_is_pending( rtems_timecounter_simple *tc ) - * { - * return some.is_pending; - * } - * - * static uint32_t some_tc_get_timecount( struct timecounter *tc ) - * { - * return rtems_timecounter_simple_downcounter_get( - * tc, - * some_tc_get, - * some_tc_is_pending - * ); - * } - * - * static void some_tc_tick( void ) - * { - * rtems_timecounter_simple_downcounter_tick( &some_tc, some_tc_get ); - * } - * - * void some_tc_init( void ) - * { - * uint64_t us_per_tick; - * uint32_t counter_frequency_in_hz; - * uint32_t counter_ticks_per_clock_tick; - * - * us_per_tick = rtems_configuration_get_microseconds_per_tick(); - * counter_frequency_in_hz = some_tc_get_frequency(); - * counter_ticks_per_clock_tick = - * (uint32_t) ( counter_frequency_in_hz * us_per_tick ) / 1000000; - * - * some_tc_init_hardware( counter_ticks_per_clock_tick ); - * some_tc_init_clock_tick_interrupt( some_tc_tick ); - * - * rtems_timecounter_simple_install( - * &some_tc, - * counter_frequency_in_hz, - * counter_ticks_per_clock_tick, - * some_tc_get_timecount - * ); - * } - * @endcode - * - * @see rtems_timecounter_simple_downcounter_get(), - * rtems_timecounter_simple_downcounter_tick(), - * rtems_timecounter_simple_upcounter_get() and - * rtems_timecounter_simple_upcounter_tick(). - */ -void rtems_timecounter_simple_install( - rtems_timecounter_simple *tc, - uint32_t counter_frequency_in_hz, - uint32_t counter_ticks_per_clock_tick, - timecounter_get_t *get_timecount -); - -/** - * @brief Maps a simple timecounter value into its binary frequency domain. - * - * @param[in] tc The simple timecounter. - * @param[in] value The value of the simple timecounter. - * - * @return The scaled value. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_scale( - const rtems_timecounter_simple *tc, - uint32_t value -) -{ - return (uint32_t) ( ( value * tc->scaler ) >> 32 ); -} - -/** - * @brief Performs a simple timecounter tick for downcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] at_tick The method to perform work under timecounter lock - * protection at this tick, e.g. clear a pending flag. - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_downcounter_tick( - rtems_timecounter_simple *tc, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_at_tick at_tick -) -{ - ISR_lock_Context lock_context; - uint32_t current; - - _Timecounter_Acquire( &lock_context ); - - ( *at_tick )( tc ); - - current = rtems_timecounter_simple_scale( - tc, - tc->real_interval - ( *get )( tc ) - ); - - _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context ); -} - -/** - * @brief Performs a simple timecounter tick for upcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] at_tick The method to perform work under timecounter lock - * protection at this tick, e.g. clear a pending flag. - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_upcounter_tick( - rtems_timecounter_simple *tc, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_at_tick at_tick -) -{ - ISR_lock_Context lock_context; - uint32_t current; - - _Timecounter_Acquire( &lock_context ); - - ( *at_tick )( tc ); - - current = rtems_timecounter_simple_scale( tc, ( *get )( tc ) ); - - _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context ); -} - -/** - * @brief Gets the simple timecounter value mapped to its binary frequency - * domain for downcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] is_pending The method which indicates if the interrupt of the - * simple timecounter is pending. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_downcounter_get( - struct timecounter *tc_base, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_is_pending is_pending -) -{ - rtems_timecounter_simple *tc; - uint32_t counter; - uint32_t interval; - - tc = (rtems_timecounter_simple *) tc_base; - counter = ( *get )( tc ); - interval = tc->real_interval; - - if ( ( *is_pending )( tc ) ) { - counter = ( *get )( tc ); - interval *= 2; - } - - return rtems_timecounter_simple_scale( tc, interval - counter ); -} - -/** - * @brief Gets the simple timecounter value mapped to its binary frequency - * domain for upcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] is_pending The method which indicates if the interrupt of the - * simple timecounter is pending. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_upcounter_get( - struct timecounter *tc_base, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_is_pending is_pending -) -{ - rtems_timecounter_simple *tc; - uint32_t counter; - uint32_t interval; - - tc = (rtems_timecounter_simple *) tc_base; - counter = ( *get )( tc ); - interval = 0; - - if ( ( *is_pending )( tc ) ) { - counter = ( *get )( tc ); - interval = tc->real_interval; - } - - return rtems_timecounter_simple_scale( tc, interval + counter ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_TIMECOUNTER_H */ diff --git a/cpukit/sapi/include/rtems/timespec.h b/cpukit/sapi/include/rtems/timespec.h deleted file mode 100644 index e82d271492..0000000000 --- a/cpukit/sapi/include/rtems/timespec.h +++ /dev/null @@ -1,305 +0,0 @@ -/** - * @file - * - * @brief Timespec API - * - * This include file contains API for manipulating timespecs. - */ - -/* - * Copyright (c) 2012. - * Krzysztof Miesowicz <krzysztof.miesowicz@gmail.com> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_TIMESPEC_H -#define _RTEMS_TIMESPEC_H - -#include <rtems/score/timespec.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup TimespecAPI Timespec - * - * @ingroup ClassicRTEMS - * - * @brief Timespec API - * - * @{ - * - */ - -/** - * @brief Is timespec valid - * - * This method determines the validity of a timespec. - * - * @param[in] time is the timespec instance to validate. - * - * @retval true The timespec is valid. - * @retval false The timespec is not valid. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_is_valid( - const struct timespec *time -) -{ - return _Timespec_Is_valid(time); -} - -/** - * @brief Timespec less than operator. - * - * This method is the less than operator for timespecs. - * - * @param[in] lhs is the left hand side timespec - * @param[in] rhs is the right hand side timespec - * - * @retval true @a lhs is less than @a rhs. - * @retval false @a lhs is not less than @a rhs. - * - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_less_than( - const struct timespec *lhs, - const struct timespec *rhs -) -{ - return _Timespec_Less_than(lhs,rhs); -} - -/** - * @brief Add to a timespec. - * - * This routine adds two timespecs. The second argument is added - * to the first. - * - * @param[in] time is the base time to be added to - * @param[in] add is the timespec to add to the first argument - * - * @return This method returns the number of seconds @a time increased by. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_add_to( - struct timespec *time, - const struct timespec *add -) -{ - return _Timespec_Add_to(time,add); -} - -/** - * @brief Convert timespec to number of ticks. - * - * This routine convert the @a time timespec to the corresponding number - * of clock ticks. - * - * @param[in] time is the time to be converted - * - * @return This method returns the number of ticks computed. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_to_ticks( - const struct timespec *time -) -{ - return _Timespec_To_ticks(time); -} - -/** - * @brief Convert ticks to timespec. - * - * This routine converts the @a ticks value to the corresponding - * timespec format @a time. - * - * @param[in] time is the timespec format time result - * @param[in] ticks is the number of ticks to convert - */ - -RTEMS_INLINE_ROUTINE void rtems_timespec_from_ticks( - uint32_t ticks, - struct timespec *time -) -{ - _Timespec_From_ticks(ticks,time); -} - -/** - * @brief Subtract two timespec. - * - * This routine subtracts two timespecs. @a result is set to - * @a end - @a start. - * - * @param[in] start is the starting time - * @param[in] end is the ending time - * @param[in] result is the difference between starting and ending time. - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_subtract( - const struct timespec *start, - const struct timespec *end, - struct timespec *result -) -{ - _Timespec_Subtract(start,end,result); -} - -/** - * @brief Divide timespec by integer. - * - * This routine divides a timespec by an integer value. The expected - * use is to assist in benchmark calculations where you typically - * divide a duration by a number of iterations. - * - * @param[in] time is the total - * @param[in] iterations is the number of iterations - * @param[in] result is the average time. - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_divide_by_integer( - const struct timespec *time, - uint32_t iterations, - struct timespec *result -) -{ - _Timespec_Divide_by_integer(time,iterations,result); -} - -/** - * @brief Divide timespec. - * - * This routine divides a timespec by another timespec. The - * intended use is for calculating percentages to three decimal points. - * - * @param[in] lhs is the left hand number - * @param[in] rhs is the right hand number - * @param[in] ival_percentage is the integer portion of the average - * @param[in] fval_percentage is the thousandths of percentage - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_divide( - const struct timespec *lhs, - const struct timespec *rhs, - uint32_t *ival_percentage, - uint32_t *fval_percentage -) -{ - _Timespec_Divide(lhs,rhs,ival_percentage,fval_percentage); -} - -/** - * @brief Set timespec to seconds nanosecond. - * - * This method sets the timespec to the specified seconds and nanoseconds - * value. - * - * @param[in] _time points to the timespec instance to validate. - * @param[in] _seconds is the seconds portion of the timespec - * @param[in] _nanoseconds is the nanoseconds portion of the timespec - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_set( - struct timespec *_time, - time_t _seconds, - uint32_t _nanoseconds -) -{ - _Timespec_Set( _time, _seconds, _nanoseconds ); -} - -/** - * @brief Zero timespec. - * - * This method sets the timespec to zero. - * value. - * - * @param[in] _time points to the timespec instance to zero. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_zero( - struct timespec *_time -) -{ - _Timespec_Set_to_zero( _time ); -} - -/** - * @brief Get seconds portion of timespec. - * - * This method returns the seconds portion of the specified timespec - * - * @param[in] _time points to the timespec - * - * @return The seconds portion of @a _time. - */ -RTEMS_INLINE_ROUTINE time_t rtems_timespec_get_seconds( - struct timespec *_time -) -{ - return _Timespec_Get_seconds( _time ); -} - -/** - * @brief Get nanoseconds portion of timespec. - * - * This method returns the nanoseconds portion of the specified timespec - * - * @param[in] _time points to the timespec - * - * @return The nanoseconds portion of @a _time. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_get_nanoseconds( - struct timespec *_time -) -{ - return _Timespec_Get_nanoseconds( _time ); -} - -/** - * @brief Timespec greater than operator. - * - * This method is the greater than operator for timespecs. - * - * @param[in] _lhs is the left hand side timespec - * @param[in] _rhs is the right hand side timespec - * - * @retval true @a _lhs is greater than @a _rhs. - * @retval false @a _lhs is not greater than @a _rhs. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_greater_than( - const struct timespec *_lhs, - const struct timespec *_rhs -) -{ - return _Timespec_Greater_than( _lhs, _rhs ); -} -/** - * @brief Timespec equal to Operator - * - * This method is the is equal to than operator for timespecs. - * - * @param[in] lhs is the left hand side timespec - * @param[in] rhs is the right hand side timespec - * - * @retval true @a lhs is equal to @a rhs. - * @retval false @a lhs is not equal to @a rhs. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_equal_to( - const struct timespec *lhs, - const struct timespec *rhs -) -{ - return _Timespec_Equal_to( lhs, rhs); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/version.h b/cpukit/sapi/include/rtems/version.h deleted file mode 100644 index b806cb8c2f..0000000000 --- a/cpukit/sapi/include/rtems/version.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file - * - * @brief Version API. - */ - -/* - * Copyright (C) 2017. - * Chris Johns <chrisj@rtems.org> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_VERSION_H -#define _RTEMS_VERSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicVersion Version - * - * @ingroup ClassicVersion - * - * @brief The Version API provides functions to return the version or parts of - * the version of RTEMS you are using. - */ -/**@{**/ - -/** - * @brief Returns the version string. - * - * @retval text The version as a string. - */ -const char *rtems_version( void ); - -/** - * @brief Returns the version's major number. - * - * @retval int The version's major number. - */ -int rtems_version_major( void ); - -/** - * @brief Returns the version's minor number. - * - * @retval int The version's minor number. - */ -int rtems_version_minor( void ); - -/** - * @brief Returns the version's revision number. - * - * @retval int The version's revision number. - */ -int rtems_version_revision( void ); - -/** - * @brief Returns the version control key for the current version of code that - * has been built. The key is specific to the version control system being used - * and allows the built version to be identified. - * - * @retval int The version's version control key. - */ -const char *rtems_version_control_key( void ); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ |