summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/Makefile.am14
-rw-r--r--cpukit/score/include/rtems/score/userext.h59
-rw-r--r--cpukit/score/inline/rtems/score/userext.inl156
-rw-r--r--cpukit/score/preinstall.am4
-rw-r--r--cpukit/score/src/chain.c125
-rw-r--r--cpukit/score/src/chainappend.c46
-rw-r--r--cpukit/score/src/chainextract.c44
-rw-r--r--cpukit/score/src/chainget.c51
-rw-r--r--cpukit/score/src/chaininsert.c47
-rw-r--r--cpukit/score/src/userext.c203
-rw-r--r--cpukit/score/src/userextaddapiset.c38
-rw-r--r--cpukit/score/src/userextaddset.c46
-rw-r--r--cpukit/score/src/userextremoveset.c35
-rw-r--r--cpukit/score/src/userextthreadbegin.c89
-rw-r--r--cpukit/score/src/userextthreadcreate.c49
-rw-r--r--cpukit/score/src/userextthreaddelete.c43
-rw-r--r--cpukit/score/src/userextthreadrestart.c44
-rw-r--r--cpukit/score/src/userextthreadstart.c44
-rw-r--r--cpukit/score/src/userextthreadswitch.c39
19 files changed, 708 insertions, 468 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 342244f65c..9c9fd67919 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -51,7 +51,7 @@ include_rtems_score_HEADERS += inline/rtems/score/address.inl \
inline/rtems/score/stack.inl inline/rtems/score/states.inl \
inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
- inline/rtems/score/tqdata.inl inline/rtems/score/userext.inl \
+ inline/rtems/score/tqdata.inl \
inline/rtems/score/watchdog.inl inline/rtems/score/wkspace.inl
if HAS_MP
@@ -158,9 +158,17 @@ libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
src/watchdoginsert.c src/watchdogremove.c src/watchdogtickle.c
+## USEREXT_C_FILES
+libscore_a_SOURCES += src/userextaddapiset.c src/userextaddset.c \
+ src/userext.c src/userextremoveset.c src/userextthreadbegin.c \
+ src/userextthreadcreate.c src/userextthreaddelete.c \
+ src/userextthreadrestart.c src/userextthreadstart.c \
+ src/userextthreadswitch.c
+
## STD_C_FILES
-libscore_a_SOURCES += src/apiext.c src/chain.c \
- src/interr.c src/isr.c src/userext.c src/wkspace.c
+libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
+ src/chainextract.c src/chainget.c src/chaininsert.c \
+ src/interr.c src/isr.c src/wkspace.c
EXTRA_DIST = src/Unlimited.txt
diff --git a/cpukit/score/include/rtems/score/userext.h b/cpukit/score/include/rtems/score/userext.h
index dcc8c80031..b8bcc0c2ff 100644
--- a/cpukit/score/include/rtems/score/userext.h
+++ b/cpukit/score/include/rtems/score/userext.h
@@ -202,6 +202,47 @@ SCORE_EXTERN Chain_Control _User_extensions_Switches_list;
/*@{*/
+/** @brief User extensions Handler Initialization
+ *
+ * This routine performs the initialization necessary for this handler.
+ *
+ * @param[in] number_of_extensions is the number of extensions
+ * @param[in] initial_extensions is the initial extension set
+ */
+void _User_extensions_Handler_initialization (
+ uint32_t number_of_extensions,
+ User_extensions_Table *initial_extensions
+);
+
+/** @brief User extensions Add to API extension set
+ *
+ * This routine is used to add an API extension set to the active list.
+ *
+ * @param[in] the_extension is the extension set to add
+ */
+void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+);
+
+/** @brief User extensions Add extension set
+ *
+ * This routine is used to add a user extension set to the active list.
+ *
+ * @param[in] the_extension is the extension set to add
+ * @param[in] extension_table is the user's extension set
+ */
+void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+);
+
+/**
+ * This routine is used to remove a user extension set from the active list.
+ */
+void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+);
+
/** @brief User extensions Thread create
*
* This routine is used to invoke the user extension for
@@ -260,6 +301,20 @@ void _User_extensions_Thread_begin (
Thread_Control *executing
);
+
+/** @brief User extensions Thread switch
+ *
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ *
+ * @param[in] executing is the thread currently executing.
+ * @param[in] heir is the thread which will execute.
+ */
+void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+);
+
/** @brief User extensions Thread exitted
*
* This routine is used to invoke the user extension which
@@ -286,10 +341,6 @@ void _User_extensions_Fatal (
uint32_t the_error
);
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/userext.inl>
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/inline/rtems/score/userext.inl b/cpukit/score/inline/rtems/score/userext.inl
deleted file mode 100644
index 6dd5cb6fff..0000000000
--- a/cpukit/score/inline/rtems/score/userext.inl
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * @file rtems/score/userext.inl
- *
- * This file contains the macro implementation of the inlined routines
- * from the User Extension Handler
- */
-
-/*
- * COPYRIGHT (c) 1989-2004.
- * 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.com/license/LICENSE.
- *
- * $Id$
- */
-
-#ifndef _RTEMS_SCORE_USEREXT_INL
-#define _RTEMS_SCORE_USEREXT_INL
-
-#include <rtems/score/wkspace.h>
-
-#include <string.h> /* memset */
-
-/**
- * @addtogroup ScoreUserExt
- * @{
- */
-
-/**
- * This routine is used to add a user extension set to the active list.
- *
- * @note Must be before _User_extensions_Handler_initialization to
- * ensure proper inlining.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
- User_extensions_Control *the_extension,
- User_extensions_Table *extension_table
-)
-{
- the_extension->Callouts = *extension_table;
-
- _Chain_Append( &_User_extensions_List, &the_extension->Node );
-
- /*
- * If a switch handler is present, append it to the switch chain.
- */
-
- if ( extension_table->thread_switch != NULL ) {
- the_extension->Switch.thread_switch = extension_table->thread_switch;
- _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node );
- }
-}
-
-/**
- * This routine performs the initialization necessary for this handler.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization (
- uint32_t number_of_extensions,
- User_extensions_Table *initial_extensions
-)
-{
- User_extensions_Control *extension;
- uint32_t i;
-
- _Chain_Initialize_empty( &_User_extensions_List );
- _Chain_Initialize_empty( &_User_extensions_Switches_list );
-
- if ( initial_extensions ) {
- extension = (User_extensions_Control *)
- _Workspace_Allocate_or_fatal_error(
- number_of_extensions * sizeof( User_extensions_Control )
- );
-
- memset (
- extension,
- 0,
- number_of_extensions * sizeof( User_extensions_Control )
- );
-
- for ( i = 0 ; i < number_of_extensions ; i++ ) {
- _User_extensions_Add_set (extension, &initial_extensions[i]);
- extension++;
- }
- }
-}
-
-/**
- * This routine is used to add an API extension set to the active list.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set (
- User_extensions_Control *the_extension
-)
-{
- _Chain_Append( &_User_extensions_List, &the_extension->Node );
-
- /*
- * If a switch handler is present, append it to the switch chain.
- */
-
- if ( the_extension->Callouts.thread_switch != NULL ) {
- the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
- _Chain_Append(
- &_User_extensions_Switches_list, &the_extension->Switch.Node );
- }
-}
-
-/**
- * This routine is used to remove a user extension set from the active list.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set (
- User_extensions_Control *the_extension
-)
-{
- _Chain_Extract( &the_extension->Node );
-
- /*
- * If a switch handler is present, remove it.
- */
-
- if ( the_extension->Callouts.thread_switch != NULL )
- _Chain_Extract( &the_extension->Switch.Node );
-}
-
-/**
- * This routine is used to invoke the user extension which
- * is invoked when a context switch occurs.
- */
-
-RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch (
- Thread_Control *executing,
- Thread_Control *heir
-)
-{
- Chain_Node *the_node;
- User_extensions_Switch_control *the_extension_switch;
-
- for ( the_node = _User_extensions_Switches_list.first ;
- !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension_switch = (User_extensions_Switch_control *) the_node;
-
- (*the_extension_switch->thread_switch)( executing, heir );
- }
-}
-
-/**@}*/
-
-#endif
-/* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index a43bc4da11..040616aa6a 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -252,10 +252,6 @@ $(PROJECT_INCLUDE)/rtems/score/tqdata.inl: inline/rtems/score/tqdata.inl $(PROJE
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tqdata.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/tqdata.inl
-$(PROJECT_INCLUDE)/rtems/score/userext.inl: inline/rtems/score/userext.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/userext.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/userext.inl
-
$(PROJECT_INCLUDE)/rtems/score/watchdog.inl: inline/rtems/score/watchdog.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/watchdog.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/watchdog.inl
diff --git a/cpukit/score/src/chain.c b/cpukit/score/src/chain.c
index d9248ea794..c44d6201a3 100644
--- a/cpukit/score/src/chain.c
+++ b/cpukit/score/src/chain.c
@@ -1,12 +1,5 @@
/*
- * Chain Handler
- *
- * NOTE:
- *
- * The order of this file is to allow proper compilation due to the
- * order of inlining required by the compiler.
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -65,119 +58,3 @@ void _Chain_Initialize(
current->next = _Chain_Tail( the_chain );
the_chain->last = current;
}
-
-/*PAGE
- *
- * _Chain_Get
- *
- * This kernel routine returns a pointer to a node taken from the
- * given chain.
- *
- * Input parameters:
- * the_chain - pointer to chain header
- *
- * Output parameters:
- * return_node - pointer to node in chain allocated
- * CHAIN_END - if no nodes available
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-Chain_Node *_Chain_Get(
- Chain_Control *the_chain
-)
-{
- ISR_Level level;
- Chain_Node *return_node;
-
- return_node = NULL;
- _ISR_Disable( level );
- if ( !_Chain_Is_empty( the_chain ) )
- return_node = _Chain_Get_first_unprotected( the_chain );
- _ISR_Enable( level );
- return return_node;
-}
-
-/*PAGE
- *
- * _Chain_Append
- *
- * This kernel routine puts a node on the end of the specified chain.
- *
- * Input parameters:
- * the_chain - pointer to chain header
- * node - address of node to put at rear of chain
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Append(
- Chain_Control *the_chain,
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Append_unprotected( the_chain, node );
- _ISR_Enable( level );
-}
-
-/*PAGE
- *
- * _Chain_Extract
- *
- * This kernel routine deletes the given node from a chain.
- *
- * Input parameters:
- * node - pointer to node in chain to be deleted
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Extract(
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Extract_unprotected( node );
- _ISR_Enable( level );
-}
-
-/*PAGE
- *
- * _Chain_Insert
- *
- * This kernel routine inserts a given node after a specified node
- * a requested chain.
- *
- * Input parameters:
- * after_node - pointer to node in chain to be inserted after
- * node - pointer to node to be inserted
- *
- * Output parameters: NONE
- *
- * INTERRUPT LATENCY:
- * only case
- */
-
-void _Chain_Insert(
- Chain_Node *after_node,
- Chain_Node *node
-)
-{
- ISR_Level level;
-
- _ISR_Disable( level );
- _Chain_Insert_unprotected( after_node, node );
- _ISR_Enable( level );
-}
diff --git a/cpukit/score/src/chainappend.c b/cpukit/score/src/chainappend.c
new file mode 100644
index 0000000000..f5287a450f
--- /dev/null
+++ b/cpukit/score/src/chainappend.c
@@ -0,0 +1,46 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Append
+ *
+ * This kernel routine puts a node on the end of the specified chain.
+ *
+ * Input parameters:
+ * the_chain - pointer to chain header
+ * node - address of node to put at rear of chain
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Append(
+ Chain_Control *the_chain,
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Append_unprotected( the_chain, node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/chainextract.c b/cpukit/score/src/chainextract.c
new file mode 100644
index 0000000000..deb537ed85
--- /dev/null
+++ b/cpukit/score/src/chainextract.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Extract
+ *
+ * This kernel routine deletes the given node from a chain.
+ *
+ * Input parameters:
+ * node - pointer to node in chain to be deleted
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Extract(
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Extract_unprotected( node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/chainget.c b/cpukit/score/src/chainget.c
new file mode 100644
index 0000000000..4ec11c112e
--- /dev/null
+++ b/cpukit/score/src/chainget.c
@@ -0,0 +1,51 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Get
+ *
+ * This kernel routine returns a pointer to a node taken from the
+ * given chain.
+ *
+ * Input parameters:
+ * the_chain - pointer to chain header
+ *
+ * Output parameters:
+ * return_node - pointer to node in chain allocated
+ * CHAIN_END - if no nodes available
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+Chain_Node *_Chain_Get(
+ Chain_Control *the_chain
+)
+{
+ ISR_Level level;
+ Chain_Node *return_node;
+
+ return_node = NULL;
+ _ISR_Disable( level );
+ if ( !_Chain_Is_empty( the_chain ) )
+ return_node = _Chain_Get_first_unprotected( the_chain );
+ _ISR_Enable( level );
+ return return_node;
+}
diff --git a/cpukit/score/src/chaininsert.c b/cpukit/score/src/chaininsert.c
new file mode 100644
index 0000000000..0f5cdd25ab
--- /dev/null
+++ b/cpukit/score/src/chaininsert.c
@@ -0,0 +1,47 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/address.h>
+#include <rtems/score/chain.h>
+#include <rtems/score/isr.h>
+
+/*
+ * _Chain_Insert
+ *
+ * This kernel routine inserts a given node after a specified node
+ * a requested chain.
+ *
+ * Input parameters:
+ * after_node - pointer to node in chain to be inserted after
+ * node - pointer to node to be inserted
+ *
+ * Output parameters: NONE
+ *
+ * INTERRUPT LATENCY:
+ * only case
+ */
+
+void _Chain_Insert(
+ Chain_Node *after_node,
+ Chain_Node *node
+)
+{
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ _Chain_Insert_unprotected( after_node, node );
+ _ISR_Enable( level );
+}
diff --git a/cpukit/score/src/userext.c b/cpukit/score/src/userext.c
index 469200ef76..c23e63f40d 100644
--- a/cpukit/score/src/userext.c
+++ b/cpukit/score/src/userext.c
@@ -1,9 +1,5 @@
/*
- * User Extension Handler
- *
- * NOTE: XXX
- *
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,187 +15,40 @@
#include <rtems/system.h>
#include <rtems/score/userext.h>
+#include <rtems/score/wkspace.h>
+#include <string.h>
-/*PAGE
- *
- * _User_extensions_Thread_create
+/**
+ * This routine performs the initialization necessary for this handler.
*/
-boolean _User_extensions_Thread_create (
- Thread_Control *the_thread
+void _User_extensions_Handler_initialization (
+ uint32_t number_of_extensions,
+ User_extensions_Table *initial_extensions
)
{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
- boolean status;
+ User_extensions_Control *extension;
+ uint32_t i;
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
+ _Chain_Initialize_empty( &_User_extensions_List );
+ _Chain_Initialize_empty( &_User_extensions_Switches_list );
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_create != NULL ) {
- status = (*the_extension->Callouts.thread_create)(
- _Thread_Executing,
- the_thread
+ if ( initial_extensions ) {
+ extension = (User_extensions_Control *)
+ _Workspace_Allocate_or_fatal_error(
+ number_of_extensions * sizeof( User_extensions_Control )
);
- if ( !status )
- return FALSE;
+
+ memset (
+ extension,
+ 0,
+ number_of_extensions * sizeof( User_extensions_Control )
+ );
+
+ for ( i = 0 ; i < number_of_extensions ; i++ ) {
+ _User_extensions_Add_set (extension, &initial_extensions[i]);
+ extension++;
}
}
-
- return TRUE;
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_delete
- */
-
-void _User_extensions_Thread_delete (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_delete != NULL )
- (*the_extension->Callouts.thread_delete)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_start
- *
- */
-
-void _User_extensions_Thread_start (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_start != NULL )
- (*the_extension->Callouts.thread_start)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_restart
- *
- */
-
-void _User_extensions_Thread_restart (
- Thread_Control *the_thread
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_restart != NULL )
- (*the_extension->Callouts.thread_restart)(
- _Thread_Executing,
- the_thread
- );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_begin
- *
- */
-
-void _User_extensions_Thread_begin (
- Thread_Control *executing
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.first ;
- !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
- the_node = the_node->next ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_begin != NULL )
- (*the_extension->Callouts.thread_begin)( executing );
- }
-}
-
-/*PAGE
- *
- * _User_extensions_Thread_exitted
- */
-
-void _User_extensions_Thread_exitted (
- Thread_Control *executing
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.thread_exitted != NULL )
- (*the_extension->Callouts.thread_exitted)( executing );
- }
}
-/*PAGE
- *
- * _User_extensions_Fatal
- */
-
-void _User_extensions_Fatal (
- Internal_errors_Source the_source,
- boolean is_internal,
- uint32_t the_error
-)
-{
- Chain_Node *the_node;
- User_extensions_Control *the_extension;
-
- for ( the_node = _User_extensions_List.last ;
- !_Chain_Is_head( &_User_extensions_List, the_node ) ;
- the_node = the_node->previous ) {
-
- the_extension = (User_extensions_Control *) the_node;
-
- if ( the_extension->Callouts.fatal != NULL )
- (*the_extension->Callouts.fatal)( the_source, is_internal, the_error );
- }
-}
diff --git a/cpukit/score/src/userextaddapiset.c b/cpukit/score/src/userextaddapiset.c
new file mode 100644
index 0000000000..db2670f5e0
--- /dev/null
+++ b/cpukit/score/src/userextaddapiset.c
@@ -0,0 +1,38 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to add an API extension set to the active list.
+ */
+
+void _User_extensions_Add_API_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+
+ /*
+ * If a switch handler is present, append it to the switch chain.
+ */
+
+ if ( the_extension->Callouts.thread_switch != NULL ) {
+ the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
+ _Chain_Append(
+ &_User_extensions_Switches_list, &the_extension->Switch.Node );
+ }
+}
diff --git a/cpukit/score/src/userextaddset.c b/cpukit/score/src/userextaddset.c
new file mode 100644
index 0000000000..516477a50e
--- /dev/null
+++ b/cpukit/score/src/userextaddset.c
@@ -0,0 +1,46 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to add a user extension set to the active list.
+ *
+ * @note Must be before _User_extensions_Handler_initialization to
+ * ensure proper inlining.
+ */
+
+void _User_extensions_Add_set (
+ User_extensions_Control *the_extension,
+ User_extensions_Table *extension_table
+)
+{
+ the_extension->Callouts = *extension_table;
+
+ _Chain_Append( &_User_extensions_List, &the_extension->Node );
+
+ /*
+ * If a switch handler is present, append it to the switch chain.
+ */
+
+ if ( extension_table->thread_switch != NULL ) {
+ the_extension->Switch.thread_switch = extension_table->thread_switch;
+ _Chain_Append(
+ &_User_extensions_Switches_list,
+ &the_extension->Switch.Node
+ );
+ }
+}
diff --git a/cpukit/score/src/userextremoveset.c b/cpukit/score/src/userextremoveset.c
new file mode 100644
index 0000000000..dcff2ef626
--- /dev/null
+++ b/cpukit/score/src/userextremoveset.c
@@ -0,0 +1,35 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to remove a user extension set from the active list.
+ */
+
+void _User_extensions_Remove_set (
+ User_extensions_Control *the_extension
+)
+{
+ _Chain_Extract( &the_extension->Node );
+
+ /*
+ * If a switch handler is present, remove it.
+ */
+
+ if ( the_extension->Callouts.thread_switch != NULL )
+ _Chain_Extract( &the_extension->Switch.Node );
+}
diff --git a/cpukit/score/src/userextthreadbegin.c b/cpukit/score/src/userextthreadbegin.c
new file mode 100644
index 0000000000..bf2cc1a1af
--- /dev/null
+++ b/cpukit/score/src/userextthreadbegin.c
@@ -0,0 +1,89 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_begin
+ *
+ */
+
+void _User_extensions_Thread_begin (
+ Thread_Control *executing
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_begin != NULL )
+ (*the_extension->Callouts.thread_begin)( executing );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Thread_exitted
+ */
+
+void _User_extensions_Thread_exitted (
+ Thread_Control *executing
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_exitted != NULL )
+ (*the_extension->Callouts.thread_exitted)( executing );
+ }
+}
+
+/*PAGE
+ *
+ * _User_extensions_Fatal
+ */
+
+void _User_extensions_Fatal (
+ Internal_errors_Source the_source,
+ boolean is_internal,
+ uint32_t the_error
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.fatal != NULL )
+ (*the_extension->Callouts.fatal)( the_source, is_internal, the_error );
+ }
+}
diff --git a/cpukit/score/src/userextthreadcreate.c b/cpukit/score/src/userextthreadcreate.c
new file mode 100644
index 0000000000..3d9caca174
--- /dev/null
+++ b/cpukit/score/src/userextthreadcreate.c
@@ -0,0 +1,49 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_create
+ */
+
+boolean _User_extensions_Thread_create (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+ boolean status;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_create != NULL ) {
+ status = (*the_extension->Callouts.thread_create)(
+ _Thread_Executing,
+ the_thread
+ );
+ if ( !status )
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/cpukit/score/src/userextthreaddelete.c b/cpukit/score/src/userextthreaddelete.c
new file mode 100644
index 0000000000..4f7214805b
--- /dev/null
+++ b/cpukit/score/src/userextthreaddelete.c
@@ -0,0 +1,43 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_delete
+ */
+
+void _User_extensions_Thread_delete (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.last ;
+ !_Chain_Is_head( &_User_extensions_List, the_node ) ;
+ the_node = the_node->previous ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_delete != NULL )
+ (*the_extension->Callouts.thread_delete)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadrestart.c b/cpukit/score/src/userextthreadrestart.c
new file mode 100644
index 0000000000..d8af932cf2
--- /dev/null
+++ b/cpukit/score/src/userextthreadrestart.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_restart
+ *
+ */
+
+void _User_extensions_Thread_restart (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_restart != NULL )
+ (*the_extension->Callouts.thread_restart)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadstart.c b/cpukit/score/src/userextthreadstart.c
new file mode 100644
index 0000000000..1534571344
--- /dev/null
+++ b/cpukit/score/src/userextthreadstart.c
@@ -0,0 +1,44 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/*PAGE
+ *
+ * _User_extensions_Thread_start
+ *
+ */
+
+void _User_extensions_Thread_start (
+ Thread_Control *the_thread
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Control *the_extension;
+
+ for ( the_node = _User_extensions_List.first ;
+ !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension = (User_extensions_Control *) the_node;
+
+ if ( the_extension->Callouts.thread_start != NULL )
+ (*the_extension->Callouts.thread_start)(
+ _Thread_Executing,
+ the_thread
+ );
+ }
+}
diff --git a/cpukit/score/src/userextthreadswitch.c b/cpukit/score/src/userextthreadswitch.c
new file mode 100644
index 0000000000..2a88c9f4f9
--- /dev/null
+++ b/cpukit/score/src/userextthreadswitch.c
@@ -0,0 +1,39 @@
+/*
+ * COPYRIGHT (c) 1989-2007.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/userext.h>
+
+/**
+ * This routine is used to invoke the user extension which
+ * is invoked when a context switch occurs.
+ */
+void _User_extensions_Thread_switch (
+ Thread_Control *executing,
+ Thread_Control *heir
+)
+{
+ Chain_Node *the_node;
+ User_extensions_Switch_control *the_extension_switch;
+
+ for ( the_node = _User_extensions_Switches_list.first ;
+ !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
+ the_node = the_node->next ) {
+
+ the_extension_switch = (User_extensions_Switch_control *) the_node;
+
+ (*the_extension_switch->thread_switch)( executing, heir );
+ }
+}