summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/sapi/src')
-rw-r--r--cpukit/sapi/src/chainappendnotify.c44
-rw-r--r--cpukit/sapi/src/chaingetnotify.c44
-rw-r--r--cpukit/sapi/src/chaingetwait.c55
-rw-r--r--cpukit/sapi/src/chainprependnotify.c44
-rw-r--r--cpukit/sapi/src/debug.c59
-rw-r--r--cpukit/sapi/src/exinit.c242
-rw-r--r--cpukit/sapi/src/exshutdown.c49
-rw-r--r--cpukit/sapi/src/extension.c52
-rw-r--r--cpukit/sapi/src/extensioncreate.c64
-rw-r--r--cpukit/sapi/src/extensiondata.c23
-rw-r--r--cpukit/sapi/src/extensiondelete.c54
-rw-r--r--cpukit/sapi/src/extensionident.c45
-rw-r--r--cpukit/sapi/src/fatal.c40
-rw-r--r--cpukit/sapi/src/getversionstring.c21
-rw-r--r--cpukit/sapi/src/io.c101
-rw-r--r--cpukit/sapi/src/ioclose.c48
-rw-r--r--cpukit/sapi/src/iocontrol.c48
-rw-r--r--cpukit/sapi/src/iodata.c22
-rw-r--r--cpukit/sapi/src/ioinitialize.c48
-rw-r--r--cpukit/sapi/src/ioopen.c48
-rw-r--r--cpukit/sapi/src/ioread.c48
-rw-r--r--cpukit/sapi/src/ioregisterdriver.c115
-rw-r--r--cpukit/sapi/src/iounregisterdriver.c57
-rw-r--r--cpukit/sapi/src/iowrite.c48
-rw-r--r--cpukit/sapi/src/posixapi.c88
-rw-r--r--cpukit/sapi/src/rtemsapi.c82
26 files changed, 1589 insertions, 0 deletions
diff --git a/cpukit/sapi/src/chainappendnotify.c b/cpukit/sapi/src/chainappendnotify.c
new file mode 100644
index 0000000000..df89d74b48
--- /dev/null
+++ b/cpukit/sapi/src/chainappendnotify.c
@@ -0,0 +1,44 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicChains
+ *
+ * @brief rtems_chain_append_with_notification() implementation.
+ */
+
+/*
+ * Copyright (c) 2010 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.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/chain.h>
+
+rtems_status_code rtems_chain_append_with_notification(
+ rtems_chain_control *chain,
+ rtems_chain_node *node,
+ rtems_id task,
+ rtems_event_set events
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ bool was_empty = rtems_chain_append_with_empty_check( chain, node );
+
+ if ( was_empty ) {
+ sc = rtems_event_send( task, events );
+ }
+
+ return sc;
+}
diff --git a/cpukit/sapi/src/chaingetnotify.c b/cpukit/sapi/src/chaingetnotify.c
new file mode 100644
index 0000000000..88f411b4f9
--- /dev/null
+++ b/cpukit/sapi/src/chaingetnotify.c
@@ -0,0 +1,44 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicChains
+ *
+ * @brief rtems_chain_get_with_notification() implementation.
+ */
+
+/*
+ * Copyright (c) 2010 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.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/chain.h>
+
+rtems_status_code rtems_chain_get_with_notification(
+ rtems_chain_control *chain,
+ rtems_id task,
+ rtems_event_set events,
+ rtems_chain_node **node
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ bool is_empty = rtems_chain_get_with_empty_check( chain, node );
+
+ if ( is_empty ) {
+ sc = rtems_event_send( task, events );
+ }
+
+ return sc;
+}
diff --git a/cpukit/sapi/src/chaingetwait.c b/cpukit/sapi/src/chaingetwait.c
new file mode 100644
index 0000000000..38986bc9c1
--- /dev/null
+++ b/cpukit/sapi/src/chaingetwait.c
@@ -0,0 +1,55 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicChains
+ *
+ * @brief rtems_chain_get_with_wait() implementation.
+ */
+
+/*
+ * Copyright (c) 2010 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.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/chain.h>
+
+rtems_status_code rtems_chain_get_with_wait(
+ rtems_chain_control *chain,
+ rtems_event_set events,
+ rtems_interval timeout,
+ rtems_chain_node **node_ptr
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ rtems_chain_node *node = NULL;
+
+ while (
+ sc == RTEMS_SUCCESSFUL
+ && (node = rtems_chain_get( chain )) == NULL
+ ) {
+ rtems_event_set out;
+ sc = rtems_event_receive(
+ events,
+ RTEMS_EVENT_ALL | RTEMS_WAIT,
+ timeout,
+ &out
+ );
+ }
+
+ *node_ptr = node;
+
+ return sc;
+}
diff --git a/cpukit/sapi/src/chainprependnotify.c b/cpukit/sapi/src/chainprependnotify.c
new file mode 100644
index 0000000000..057e4fbde6
--- /dev/null
+++ b/cpukit/sapi/src/chainprependnotify.c
@@ -0,0 +1,44 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicChains
+ *
+ * @brief rtems_chain_prepend_with_notification() implementation.
+ */
+
+/*
+ * Copyright (c) 2010 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.com/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/chain.h>
+
+rtems_status_code rtems_chain_prepend_with_notification(
+ rtems_chain_control *chain,
+ rtems_chain_node *node,
+ rtems_id task,
+ rtems_event_set events
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ bool was_empty = rtems_chain_prepend_with_empty_check( chain, node );
+
+ if (was_empty) {
+ sc = rtems_event_send( task, events );
+ }
+
+ return sc;
+}
diff --git a/cpukit/sapi/src/debug.c b/cpukit/sapi/src/debug.c
new file mode 100644
index 0000000000..fc9d57d874
--- /dev/null
+++ b/cpukit/sapi/src/debug.c
@@ -0,0 +1,59 @@
+/*
+ * Debug Manager
+ *
+ * COPYRIGHT (c) 1989-2009.
+ * 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/debug.h>
+
+/*
+ *
+ * _Debug_Manager_initialization
+ */
+void _Debug_Manager_initialization( void )
+{
+ rtems_debug_disable( RTEMS_DEBUG_ALL_MASK );
+}
+
+/*PAGE
+ *
+ * rtems_debug_enable
+ */
+void rtems_debug_enable (
+ rtems_debug_control to_be_enabled
+)
+{
+ _Debug_Level |= to_be_enabled;
+}
+
+/*
+ * rtems_debug_disable
+ */
+void rtems_debug_disable (
+ rtems_debug_control to_be_disabled
+)
+{
+ _Debug_Level &= ~to_be_disabled;
+}
+
+/*
+ * rtems_debug_is_enabled
+ */
+bool rtems_debug_is_enabled(
+ rtems_debug_control level
+)
+{
+ return (_Debug_Level & level) ? true : false;
+}
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
new file mode 100644
index 0000000000..a431669641
--- /dev/null
+++ b/cpukit/sapi/src/exinit.c
@@ -0,0 +1,242 @@
+/*
+ * Initialization Manager
+ *
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/*
+ * SCORE_INIT and SAPI_INIT are defined so all of the super core and
+ * super API data will be included in this object file.
+ */
+
+#define SAPI_INIT
+#define SCORE_INIT
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/debug.h>
+#include <rtems/extension.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/score/apiext.h>
+#include <rtems/score/apimutex.h>
+#include <rtems/score/copyrt.h>
+#include <rtems/score/heap.h>
+#include <rtems/score/interr.h>
+#include <rtems/score/isr.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/mpci.h>
+#endif
+#include <rtems/score/priority.h>
+#include <rtems/score/scheduler.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/tod.h>
+#include <rtems/score/userext.h>
+#include <rtems/score/watchdog.h>
+#include <rtems/score/wkspace.h>
+
+#include <rtems/sptables.h>
+
+
+#include <rtems/rtems/rtemsapi.h>
+#ifdef RTEMS_POSIX_API
+ #include <rtems/posix/posixapi.h>
+#endif
+
+#if defined(RTEMS_SMP)
+ #include <rtems/bspsmp.h>
+ #include <rtems/score/percpu.h>
+#endif
+
+Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
+
+void rtems_initialize_data_structures(void)
+{
+ /*
+ * Dispatching and interrupts are disabled until the end of the
+ * initialization sequence. This prevents an inadvertent context
+ * switch before the executive is initialized.
+ *
+ * WARNING: Interrupts should have been disabled by the BSP and
+ * are disabled by boot_card().
+ */
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ /*
+ * Initialize the system state based on whether this is an MP system.
+ * In an MP configuration, internally we view single processor
+ * systems as a very restricted multiprocessor system.
+ */
+ _Configuration_MP_table = Configuration.User_multiprocessing_table;
+
+ if ( _Configuration_MP_table == NULL ) {
+ _Configuration_MP_table =
+ (void *)&_Initialization_Default_multiprocessing_table;
+ _System_state_Handler_initialization( FALSE );
+ } else {
+ _System_state_Handler_initialization( TRUE );
+ }
+ #else
+ _System_state_Handler_initialization( FALSE );
+ #endif
+
+ /*
+ * Initialize any target architecture specific support as early as possible
+ */
+ _CPU_Initialize();
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ _Objects_MP_Handler_early_initialization();
+ #endif
+
+ /*
+ * Do this as early as possible to ensure no debugging output
+ * is even attempted to be printed.
+ */
+ _Debug_Manager_initialization();
+
+ _API_extensions_Initialization();
+
+ _Thread_Dispatch_initialization();
+
+ /*
+ * Before this is called, we are not allowed to allocate memory
+ * from the Workspace because it is not initialized.
+ */
+ _Workspace_Handler_initialization();
+
+ #if defined(RTEMS_SMP)
+ _SMP_Handler_initialize();
+ #endif
+
+ _User_extensions_Handler_initialization();
+ _ISR_Handler_initialization();
+
+ /*
+ * Initialize the internal support API and allocator Mutex
+ */
+ _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
+
+ _API_Mutex_Initialization( 1 );
+ _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
+
+ _Priority_bit_map_Handler_initialization();
+ _Watchdog_Handler_initialization();
+ _TOD_Handler_initialization();
+
+ _Thread_Handler_initialization();
+
+ _Scheduler_Handler_initialization();
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ _Objects_MP_Handler_initialization();
+ _MPCI_Handler_initialization( RTEMS_TIMEOUT );
+ #endif
+
+/* MANAGERS */
+
+ _RTEMS_API_Initialize();
+
+ _Extension_Manager_initialization();
+
+ _IO_Manager_initialization();
+
+ #ifdef RTEMS_POSIX_API
+ _POSIX_API_Initialize();
+ #endif
+
+ /*
+ * Discover and initialize the secondary cores in an SMP system.
+ */
+ #if defined(RTEMS_SMP)
+ _SMP_Processor_count = bsp_smp_initialize( rtems_smp_maximum_processors );
+ #endif
+
+ _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+
+ /*
+ * No threads should be created before this point!!!
+ * _Thread_Executing and _Thread_Heir are not set.
+ *
+ * At this point all API extensions are in place. After the call to
+ * _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.
+ */
+ _Thread_Create_idle();
+
+ /*
+ * Scheduling can properly occur now as long as we avoid dispatching.
+ */
+}
+
+void rtems_initialize_before_drivers(void)
+{
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ _MPCI_Create_server();
+ #endif
+
+ #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
+ /*
+ * Run the API and BSPs predriver hook.
+ */
+ _API_extensions_Run_predriver();
+ #endif
+}
+
+void rtems_initialize_device_drivers(void)
+{
+ /*
+ * Initialize all the device drivers and initialize the MPCI layer.
+ *
+ * NOTE: The MPCI may be build upon a device driver.
+ */
+
+ _IO_Initialize_all_drivers();
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ if ( _System_state_Is_multiprocessing ) {
+ _MPCI_Initialization();
+ _MPCI_Internal_packets_Send_process_packet(
+ MPCI_PACKETS_SYSTEM_VERIFY
+ );
+ }
+ #endif
+
+ /*
+ * Run the APIs and BSPs postdriver hooks.
+ *
+ * The API extensions are supposed to create user initialization tasks.
+ */
+ _API_extensions_Run_postdriver();
+}
+
+void rtems_initialize_start_multitasking(void)
+{
+
+ _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
+
+ _Thread_Start_multitasking();
+
+ /*******************************************************************
+ *******************************************************************
+ *******************************************************************
+ ****** APPLICATION RUNS HERE ******
+ ****** RETURNS WHEN SYSTEM IS SHUT DOWN ******
+ *******************************************************************
+ *******************************************************************
+ *******************************************************************/
+}
diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c
new file mode 100644
index 0000000000..5b0a5a1de1
--- /dev/null
+++ b/cpukit/sapi/src/exshutdown.c
@@ -0,0 +1,49 @@
+/*
+ * Initialization Manager
+ *
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/sysstate.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/interr.h>
+
+/*
+ * rtems_shutdown_executive
+ *
+ * This kernel routine shutdowns the executive. It halts multitasking
+ * and returns control to the application execution "thread" which
+ * initialially invoked the rtems_initialize_executive directive.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_shutdown_executive(
+ uint32_t result
+)
+{
+ if ( _System_state_Is_up( _System_state_Get() ) ) {
+ _System_state_Set( SYSTEM_STATE_SHUTDOWN );
+ _Thread_Stop_multitasking();
+ }
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ true,
+ INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP
+ );
+
+}
diff --git a/cpukit/sapi/src/extension.c b/cpukit/sapi/src/extension.c
new file mode 100644
index 0000000000..993f415fd8
--- /dev/null
+++ b/cpukit/sapi/src/extension.c
@@ -0,0 +1,52 @@
+/*
+ * Extension Manager
+ *
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+/*PAGE
+ *
+ * _Extension_Manager_initialization
+ *
+ * This routine initializes all extension manager related data structures.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ */
+
+void _Extension_Manager_initialization(void)
+{
+ _Objects_Initialize_information(
+ &_Extension_Information,
+ OBJECTS_CLASSIC_API, /* object API */
+ OBJECTS_RTEMS_EXTENSIONS,
+ Configuration.maximum_extensions,
+ sizeof( Extension_Control ),
+ false, /* true if the name is a string */
+ RTEMS_MAXIMUM_NAME_LENGTH /* maximum length of an object name */
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ false, /* true if this is a global object class */
+ NULL /* Proxy extraction support callout */
+#endif
+ );
+}
diff --git a/cpukit/sapi/src/extensioncreate.c b/cpukit/sapi/src/extensioncreate.c
new file mode 100644
index 0000000000..bb8647e7b9
--- /dev/null
+++ b/cpukit/sapi/src/extensioncreate.c
@@ -0,0 +1,64 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicUserExtensions
+ *
+ * @brief User Extensions Implementation.
+ */
+
+/*
+ * 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/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ const rtems_extensions_table *extension_table,
+ rtems_id *id
+)
+{
+ Extension_Control *the_extension;
+
+ if ( !id )
+ return RTEMS_INVALID_ADDRESS;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_extension = _Extension_Allocate();
+
+ if ( !the_extension ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ _User_extensions_Add_set_with_table( &the_extension->Extension, extension_table );
+
+ _Objects_Open(
+ &_Extension_Information,
+ &the_extension->Object,
+ (Objects_Name) name
+ );
+
+ *id = the_extension->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/extensiondata.c b/cpukit/sapi/src/extensiondata.c
new file mode 100644
index 0000000000..6057db5ee6
--- /dev/null
+++ b/cpukit/sapi/src/extensiondata.c
@@ -0,0 +1,23 @@
+/*
+ * Extension Manager -- Instantiate Data
+ *
+ * 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
+
+/* instantiate extension data */
+#define SAPI_EXT_EXTERN
+
+#include <rtems/system.h>
+#include <rtems/extension.h>
+
diff --git a/cpukit/sapi/src/extensiondelete.c b/cpukit/sapi/src/extensiondelete.c
new file mode 100644
index 0000000000..4f5be6337b
--- /dev/null
+++ b/cpukit/sapi/src/extensiondelete.c
@@ -0,0 +1,54 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicUserExtensions
+ *
+ * @brief User Extensions Implementation.
+ */
+
+/*
+ * 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/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+rtems_status_code rtems_extension_delete(
+ rtems_id id
+)
+{
+ Extension_Control *the_extension;
+ Objects_Locations location;
+
+ the_extension = _Extension_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_LOCAL:
+ _User_extensions_Remove_set( &the_extension->Extension );
+ _Objects_Close( &_Extension_Information, &the_extension->Object );
+ _Extension_Free( the_extension );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE: /* should never return this */
+#endif
+ case OBJECTS_ERROR:
+ break;
+ }
+
+ return RTEMS_INVALID_ID;
+}
diff --git a/cpukit/sapi/src/extensionident.c b/cpukit/sapi/src/extensionident.c
new file mode 100644
index 0000000000..e59f39d7dc
--- /dev/null
+++ b/cpukit/sapi/src/extensionident.c
@@ -0,0 +1,45 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicUserExtensions
+ *
+ * @brief User Extensions Implementation.
+ */
+
+/*
+ * 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/rtems/support.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/extension.h>
+
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ rtems_id *id
+)
+{
+ Objects_Name_or_id_lookup_errors status;
+
+ status = _Objects_Name_to_id_u32(
+ &_Extension_Information,
+ name,
+ OBJECTS_SEARCH_LOCAL_NODE,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
diff --git a/cpukit/sapi/src/fatal.c b/cpukit/sapi/src/fatal.c
new file mode 100644
index 0000000000..80abde253a
--- /dev/null
+++ b/cpukit/sapi/src/fatal.c
@@ -0,0 +1,40 @@
+/*
+ * Fatal Error Manager
+ *
+ * COPYRIGHT (c) 1989-2009.
+ * 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/fatal.h>
+#include <rtems/score/interr.h>
+
+/*
+ * rtems_fatal_error_occurred
+ *
+ * This directive will invoke the internal fatal error handler.
+ *
+ * Input parameters:
+ * the_error - fatal error status code
+ *
+ * Output parameters: NONE
+ */
+
+void rtems_fatal_error_occurred(
+ uint32_t the_error
+)
+{
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, FALSE, the_error );
+
+/* will not return from this routine */
+}
diff --git a/cpukit/sapi/src/getversionstring.c b/cpukit/sapi/src/getversionstring.c
new file mode 100644
index 0000000000..4295be56dc
--- /dev/null
+++ b/cpukit/sapi/src/getversionstring.c
@@ -0,0 +1,21 @@
+/*
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+
+const char *rtems_get_version_string(void)
+{
+ return _RTEMS_version;
+}
diff --git a/cpukit/sapi/src/io.c b/cpukit/sapi/src/io.c
new file mode 100644
index 0000000000..6a752cd527
--- /dev/null
+++ b/cpukit/sapi/src/io.c
@@ -0,0 +1,101 @@
+/*
+ * Input/Output Manager - Initialize Device Driver Subsystem
+ *
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/io.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/wkspace.h>
+
+#include <string.h>
+
+/*
+ * _IO_Manager_initialization
+ *
+ * The IO manager has been extended to support runtime driver
+ * registration. The driver table is now allocated in the
+ * workspace.
+ *
+ */
+
+void _IO_Manager_initialization(void)
+{
+ uint32_t index;
+ rtems_driver_address_table *driver_table;
+ uint32_t drivers_in_table;
+ uint32_t number_of_drivers;
+
+ driver_table = Configuration.Device_driver_table;
+ drivers_in_table = Configuration.number_of_device_drivers;
+ number_of_drivers = Configuration.maximum_drivers;
+
+ /*
+ * If the user claims there are less drivers than are actually in
+ * the table, then let's just go with the table's count.
+ */
+ if ( number_of_drivers <= drivers_in_table )
+ number_of_drivers = drivers_in_table;
+
+ /*
+ * If the maximum number of driver is the same as the number in the
+ * table, then we do not have to copy the driver table. They can't
+ * register any dynamically.
+ */
+ if ( number_of_drivers == drivers_in_table ) {
+ _IO_Driver_address_table = driver_table;
+ _IO_Number_of_drivers = number_of_drivers;
+ return;
+ }
+
+ /*
+ * The application requested extra slots in the driver table, so we
+ * have to allocate a new driver table and copy theirs to it.
+ */
+
+ _IO_Driver_address_table = (rtems_driver_address_table *)
+ _Workspace_Allocate_or_fatal_error(
+ sizeof( rtems_driver_address_table ) * ( number_of_drivers )
+ );
+ _IO_Number_of_drivers = number_of_drivers;
+
+ memset(
+ _IO_Driver_address_table, 0,
+ sizeof( rtems_driver_address_table ) * ( number_of_drivers )
+ );
+
+ for ( index = 0 ; index < drivers_in_table ; index++ )
+ _IO_Driver_address_table[index] = driver_table[index];
+}
+
+/*
+ * _IO_Initialize_all_drivers
+ *
+ * This routine initializes all device drivers
+ *
+ * Input Paramters: NONE
+ *
+ * Output Parameters: NONE
+ */
+
+void _IO_Initialize_all_drivers( void )
+{
+ rtems_device_major_number major;
+
+ for ( major=0 ; major < _IO_Number_of_drivers ; major ++ )
+ (void) rtems_io_initialize( major, 0, NULL );
+}
diff --git a/cpukit/sapi/src/ioclose.c b/cpukit/sapi/src/ioclose.c
new file mode 100644
index 0000000000..65d43f55ec
--- /dev/null
+++ b/cpukit/sapi/src/ioclose.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager -- Close Device
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_close
+ *
+ * This routine is the close directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].close_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/iocontrol.c b/cpukit/sapi/src/iocontrol.c
new file mode 100644
index 0000000000..1f1d0d38ea
--- /dev/null
+++ b/cpukit/sapi/src/iocontrol.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager - Device Control
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_control
+ *
+ * This routine is the control directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].control_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/iodata.c b/cpukit/sapi/src/iodata.c
new file mode 100644
index 0000000000..f15de6979d
--- /dev/null
+++ b/cpukit/sapi/src/iodata.c
@@ -0,0 +1,22 @@
+/*
+ * RTEMS Task Manager -- Instantiate Data
+ *
+ * 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
+
+/* instantiate RTEMS IO manager data */
+#define SAPI_IO_EXTERN
+
+#include <rtems/system.h>
+#include <rtems/io.h>
diff --git a/cpukit/sapi/src/ioinitialize.c b/cpukit/sapi/src/ioinitialize.c
new file mode 100644
index 0000000000..998edbb6b2
--- /dev/null
+++ b/cpukit/sapi/src/ioinitialize.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager - Initialize Device
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_initialize
+ *
+ * This routine is the initialization directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].initialization_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/ioopen.c b/cpukit/sapi/src/ioopen.c
new file mode 100644
index 0000000000..f8f1c84a86
--- /dev/null
+++ b/cpukit/sapi/src/ioopen.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager - Open Device
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_open
+ *
+ * This routine is the open directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].open_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/ioread.c b/cpukit/sapi/src/ioread.c
new file mode 100644
index 0000000000..3b090ef764
--- /dev/null
+++ b/cpukit/sapi/src/ioread.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager - Device Read
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_read
+ *
+ * This routine is the read directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].read_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/ioregisterdriver.c b/cpukit/sapi/src/ioregisterdriver.c
new file mode 100644
index 0000000000..30d10eb808
--- /dev/null
+++ b/cpukit/sapi/src/ioregisterdriver.c
@@ -0,0 +1,115 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicIO
+ *
+ * @brief Classic Input/Output Manager implementation.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * Copyright (c) 2009 embedded brains GmbH.
+ *
+ * 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/io.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/score/thread.h>
+
+static inline bool rtems_io_is_empty_table(
+ const rtems_driver_address_table *table
+)
+{
+ return table->initialization_entry == NULL && table->open_entry == NULL;
+}
+
+static rtems_status_code rtems_io_obtain_major_number(
+ rtems_device_major_number *major
+)
+{
+ rtems_device_major_number n = _IO_Number_of_drivers;
+ rtems_device_major_number m = 0;
+
+ /* major is error checked by caller */
+
+ for ( m = 0; m < n; ++m ) {
+ rtems_driver_address_table *const table = _IO_Driver_address_table + m;
+
+ if ( rtems_io_is_empty_table( table ) )
+ break;
+ }
+
+ /* Assigns invalid value in case of failure */
+ *major = m;
+
+ if ( m != n )
+ return RTEMS_SUCCESSFUL;
+
+ return RTEMS_TOO_MANY;
+}
+
+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
+)
+{
+ rtems_device_major_number major_limit = _IO_Number_of_drivers;
+
+ if ( rtems_interrupt_is_in_progress() )
+ return RTEMS_CALLED_FROM_ISR;
+
+ if ( registered_major == NULL )
+ return RTEMS_INVALID_ADDRESS;
+
+ /* Set it to an invalid value */
+ *registered_major = major_limit;
+
+ if ( driver_table == NULL )
+ return RTEMS_INVALID_ADDRESS;
+
+ if ( rtems_io_is_empty_table( driver_table ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ if ( major >= major_limit )
+ return RTEMS_INVALID_NUMBER;
+
+ _Thread_Disable_dispatch();
+
+ if ( major == 0 ) {
+ rtems_status_code sc = rtems_io_obtain_major_number( registered_major );
+
+ if ( sc != RTEMS_SUCCESSFUL ) {
+ _Thread_Enable_dispatch();
+ return sc;
+ }
+ major = *registered_major;
+ } else {
+ rtems_driver_address_table *const table = _IO_Driver_address_table + major;
+
+ if ( !rtems_io_is_empty_table( table ) ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ *registered_major = major;
+ }
+
+ _IO_Driver_address_table [major] = *driver_table;
+
+ _Thread_Enable_dispatch();
+
+ return rtems_io_initialize( major, 0, NULL );
+}
diff --git a/cpukit/sapi/src/iounregisterdriver.c b/cpukit/sapi/src/iounregisterdriver.c
new file mode 100644
index 0000000000..631ffbfd82
--- /dev/null
+++ b/cpukit/sapi/src/iounregisterdriver.c
@@ -0,0 +1,57 @@
+/*
+ * Input/Output Manager - Dynamically Unregister Device Driver
+ *
+ * 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/io.h>
+#include <rtems/rtems/intr.h>
+#include <rtems/score/thread.h>
+#include <string.h>
+
+/*
+ * rtems_io_unregister_driver
+ *
+ * Unregister a driver from the device driver table.
+ *
+ * Input Paramters:
+ * major - device major number
+ *
+ * Output Parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_io_unregister_driver(
+ rtems_device_major_number major
+)
+{
+ if ( rtems_interrupt_is_in_progress() )
+ return RTEMS_CALLED_FROM_ISR;
+
+ if ( major < _IO_Number_of_drivers ) {
+ _Thread_Disable_dispatch();
+ memset(
+ &_IO_Driver_address_table[major],
+ 0,
+ sizeof( rtems_driver_address_table )
+ );
+ _Thread_Enable_dispatch();
+
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_UNSATISFIED;
+}
diff --git a/cpukit/sapi/src/iowrite.c b/cpukit/sapi/src/iowrite.c
new file mode 100644
index 0000000000..9283404e73
--- /dev/null
+++ b/cpukit/sapi/src/iowrite.c
@@ -0,0 +1,48 @@
+/*
+ * Input/Output Manager - Device Write
+ *
+ * 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/io.h>
+
+/*
+ * rtems_io_write
+ *
+ * This routine is the write directive of the IO manager.
+ *
+ * Input Paramters:
+ * major - device driver number
+ * minor - device number
+ * argument - pointer to argument(s)
+ *
+ * Output Parameters:
+ * returns - return code
+ */
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+)
+{
+ rtems_device_driver_entry callout;
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ callout = _IO_Driver_address_table[major].write_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c
new file mode 100644
index 0000000000..37cbbae8a6
--- /dev/null
+++ b/cpukit/sapi/src/posixapi.c
@@ -0,0 +1,88 @@
+/*
+ * RTEMS API Initialization Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989-2010.
+ * 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
+
+/*
+ * POSIX_API_INIT is defined so all of the POSIX API
+ * data will be included in this object file.
+ */
+
+#define POSIX_API_INIT
+
+#include <rtems/system.h> /* include this before checking RTEMS_POSIX_API */
+#ifdef RTEMS_POSIX_API
+
+#include <sys/types.h>
+#include <mqueue.h>
+#include <rtems/config.h>
+#include <rtems/score/object.h>
+#include <rtems/posix/barrier.h>
+#include <rtems/posix/cond.h>
+#include <rtems/posix/config.h>
+#include <rtems/posix/key.h>
+#include <rtems/posix/mqueue.h>
+#include <rtems/posix/mutex.h>
+#include <rtems/posix/posixapi.h>
+#include <rtems/posix/priority.h>
+#include <rtems/posix/psignal.h>
+#include <rtems/posix/pthread.h>
+#include <rtems/posix/rwlock.h>
+#include <rtems/posix/timer.h>
+#include <rtems/posix/semaphore.h>
+#include <rtems/posix/spinlock.h>
+#include <rtems/posix/time.h>
+
+/*PAGE
+ *
+ * _POSIX_API_Initialize
+ *
+ * XXX
+ */
+
+Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
+
+void _POSIX_API_Initialize(void)
+{
+ /*
+ * If there are any type size assumptions in the POSIX API, this is
+ * the appropriate place to place them.
+ *
+ * Currently, there are no none type size assumptions.
+ */
+
+ /*
+ * Install our API Object Management Table and initialize the
+ * various managers.
+ */
+ _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
+
+ _POSIX_signals_Manager_Initialization();
+ _POSIX_Threads_Manager_initialization();
+ _POSIX_Condition_variables_Manager_initialization();
+ _POSIX_Key_Manager_initialization();
+ _POSIX_Mutex_Manager_initialization();
+ _POSIX_Message_queue_Manager_initialization();
+ _POSIX_Semaphore_Manager_initialization();
+ _POSIX_Timer_Manager_initialization();
+ _POSIX_Barrier_Manager_initialization();
+ _POSIX_RWLock_Manager_initialization();
+ _POSIX_Spinlock_Manager_initialization();
+}
+
+#endif
+/* end of file */
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
new file mode 100644
index 0000000000..fa76c2a966
--- /dev/null
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -0,0 +1,82 @@
+/*
+ * POSIX API Initialization Support
+ *
+ * NOTE:
+ *
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/*
+ * RTEMS_API_INIT is defined so all of the RTEMS API
+ * data will be included in this object file.
+ */
+
+#define RTEMS_API_INIT
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/rtemsapi.h>
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/barrier.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/rtems/mp.h>
+#endif
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(void)
+{
+ /*
+ * Install our API Object Management Table and initialize the
+ * various managers.
+ */
+ _Objects_Information_table[OBJECTS_CLASSIC_API] = _RTEMS_Objects;
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ _Multiprocessing_Manager_initialization();
+ #endif
+
+ _RTEMS_tasks_Manager_initialization();
+ _Timer_Manager_initialization();
+ _Signal_Manager_initialization();
+ _Event_Manager_initialization();
+ _Message_queue_Manager_initialization();
+ _Semaphore_Manager_initialization();
+ _Partition_Manager_initialization();
+ _Region_Manager_initialization();
+ _Dual_ported_memory_Manager_initialization();
+ _Rate_monotonic_Manager_initialization();
+ _Barrier_Manager_initialization();
+}
+
+/* end of file */