summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-17 23:18:20 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-17 23:18:20 +0000
commit1dc030fe0566d327c0c0f9ab0c4bfae89a961c9d (patch)
treefc90ce2202679fca6318c756547a9adf22c14199 /cpukit
parentSplit Partition Manager into one routine per file. (diff)
downloadrtems-1dc030fe0566d327c0c0f9ab0c4bfae89a961c9d.tar.bz2
Dual-Ported Memory Manager split into one routine per file.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/rtems/src/dpmem.c236
-rw-r--r--cpukit/rtems/src/dpmemcreate.c82
-rw-r--r--cpukit/rtems/src/dpmemdelete.c62
-rw-r--r--cpukit/rtems/src/dpmemexternal2internal.c73
-rw-r--r--cpukit/rtems/src/dpmemident.c56
-rw-r--r--cpukit/rtems/src/dpmeminternal2external.c73
6 files changed, 346 insertions, 236 deletions
diff --git a/cpukit/rtems/src/dpmem.c b/cpukit/rtems/src/dpmem.c
index cb9ed3fa4d..e3269593f9 100644
--- a/cpukit/rtems/src/dpmem.c
+++ b/cpukit/rtems/src/dpmem.c
@@ -49,239 +49,3 @@ void _Dual_ported_memory_Manager_initialization(
FALSE
);
}
-
-/*PAGE
- *
- * rtems_port_create
- *
- * This directive creates a port into a dual-ported memory area.
- *
- * Input parameters:
- * name - user defined port name
- * internal_start - internal start address of port
- * external_start - external start address of port
- * length - physical length in bytes
- * id - address of port id to set
- *
- * Output parameters:
- * id - port id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_port_create(
- rtems_name name,
- void *internal_start,
- void *external_start,
- unsigned32 length,
- Objects_Id *id
-)
-{
- register Dual_ported_memory_Control *the_port;
-
- if ( !rtems_is_name_valid( name) )
- return RTEMS_INVALID_NAME;
-
- if ( !_Addresses_Is_aligned( internal_start ) ||
- !_Addresses_Is_aligned( external_start ) )
- return RTEMS_INVALID_ADDRESS;
-
- _Thread_Disable_dispatch(); /* to prevent deletion */
-
- the_port = _Dual_ported_memory_Allocate();
-
- if ( !the_port ) {
- _Thread_Enable_dispatch();
- return RTEMS_TOO_MANY;
- }
-
- the_port->internal_base = internal_start;
- the_port->external_base = external_start;
- the_port->length = length - 1;
-
- _Objects_Open(
- &_Dual_ported_memory_Information,
- &the_port->Object,
- &name
- );
-
- *id = the_port->Object.id;
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
-}
-
-/*PAGE
- *
- * rtems_port_ident
- *
- * This directive returns the system ID associated with
- * the port name.
- *
- * Input parameters:
- * name - user defined port name
- * id - pointer to port id
- *
- * Output parameters:
- * *id - port id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_port_ident(
- rtems_name name,
- Objects_Id *id
-)
-{
- Objects_Name_to_id_errors status;
-
- status = _Objects_Name_to_id(
- &_Dual_ported_memory_Information,
- &name,
- OBJECTS_SEARCH_ALL_NODES,
- id
- );
-
- return _Status_Object_name_errors_to_status[ status ];
-}
-
-/*PAGE
- *
- * rtems_port_delete
- *
- * This directive allows a thread to delete a dual-ported memory area
- * specified by the dual-ported memory identifier.
- *
- * Input parameters:
- * id - dual-ported memory area id
- *
- * Output parameters:
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_port_delete(
- Objects_Id id
-)
-{
- register Dual_ported_memory_Control *the_port;
- Objects_Locations location;
-
- the_port = _Dual_ported_memory_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE: /* this error cannot be returned */
- return RTEMS_INTERNAL_ERROR;
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object );
- _Dual_ported_memory_Free( the_port );
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_port_internal_to_external
- *
- * This directive converts an internal dual-ported memory address to an
- * external dual-ported memory address. If the given internal address
- * is an invalid dual-ported address, then the external address is set
- * to the given internal address.
- *
- * Input parameters:
- * id - id of dual-ported memory object
- * internal - internal address to set
- * external - pointer to external address
- *
- * Output parameters:
- * external - external address
- * RTEMS_SUCCESSFUL - always succeeds
- */
-
-rtems_status_code rtems_port_internal_to_external(
- Objects_Id id,
- void *internal,
- void **external
-)
-{
- register Dual_ported_memory_Control *the_port;
- Objects_Locations location;
- unsigned32 ending;
-
- the_port = _Dual_ported_memory_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE: /* this error cannot be returned */
- return RTEMS_INTERNAL_ERROR;
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- ending = _Addresses_Subtract( internal, the_port->internal_base );
- if ( ending > the_port->length )
- *external = internal;
- else
- *external = _Addresses_Add_offset( the_port->external_base,
- ending );
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_port_external_to_internal
- *
- * This directive converts an external dual-ported memory address to an
- * internal dual-ported memory address. If the given external address
- * is an invalid dual-ported address, then the internal address is set
- * to the given external address.
- *
- * Input parameters:
- * id - id of dp memory object
- * external - external address
- * internal - pointer of internal address to set
- *
- * Output parameters:
- * internal - internal address
- * RTEMS_SUCCESSFUL - always succeeds
- */
-
-rtems_status_code rtems_port_external_to_internal(
- Objects_Id id,
- void *external,
- void **internal
-)
-{
- register Dual_ported_memory_Control *the_port;
- Objects_Locations location;
- unsigned32 ending;
-
- the_port = _Dual_ported_memory_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE: /* this error cannot be returned */
- return RTEMS_INTERNAL_ERROR;
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- ending = _Addresses_Subtract( external, the_port->external_base );
- if ( ending > the_port->length )
- *internal = external;
- else
- *internal = _Addresses_Add_offset( the_port->internal_base,
- ending );
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
diff --git a/cpukit/rtems/src/dpmemcreate.c b/cpukit/rtems/src/dpmemcreate.c
new file mode 100644
index 0000000000..9e71d78365
--- /dev/null
+++ b/cpukit/rtems/src/dpmemcreate.c
@@ -0,0 +1,82 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * rtems_port_create
+ *
+ * This directive creates a port into a dual-ported memory area.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * internal_start - internal start address of port
+ * external_start - external start address of port
+ * length - physical length in bytes
+ * id - address of port id to set
+ *
+ * Output parameters:
+ * id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_create(
+ rtems_name name,
+ void *internal_start,
+ void *external_start,
+ unsigned32 length,
+ Objects_Id *id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+
+ if ( !rtems_is_name_valid( name) )
+ return RTEMS_INVALID_NAME;
+
+ if ( !_Addresses_Is_aligned( internal_start ) ||
+ !_Addresses_Is_aligned( external_start ) )
+ return RTEMS_INVALID_ADDRESS;
+
+ _Thread_Disable_dispatch(); /* to prevent deletion */
+
+ the_port = _Dual_ported_memory_Allocate();
+
+ if ( !the_port ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+ the_port->internal_base = internal_start;
+ the_port->external_base = external_start;
+ the_port->length = length - 1;
+
+ _Objects_Open(
+ &_Dual_ported_memory_Information,
+ &the_port->Object,
+ &name
+ );
+
+ *id = the_port->Object.id;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/rtems/src/dpmemdelete.c b/cpukit/rtems/src/dpmemdelete.c
new file mode 100644
index 0000000000..6162e0bab1
--- /dev/null
+++ b/cpukit/rtems/src/dpmemdelete.c
@@ -0,0 +1,62 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * rtems_port_delete
+ *
+ * This directive allows a thread to delete a dual-ported memory area
+ * specified by the dual-ported memory identifier.
+ *
+ * Input parameters:
+ * id - dual-ported memory area id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_delete(
+ Objects_Id id
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object );
+ _Dual_ported_memory_Free( the_port );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/dpmemexternal2internal.c b/cpukit/rtems/src/dpmemexternal2internal.c
new file mode 100644
index 0000000000..082de3a0d8
--- /dev/null
+++ b/cpukit/rtems/src/dpmemexternal2internal.c
@@ -0,0 +1,73 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * rtems_port_external_to_internal
+ *
+ * This directive converts an external dual-ported memory address to an
+ * internal dual-ported memory address. If the given external address
+ * is an invalid dual-ported address, then the internal address is set
+ * to the given external address.
+ *
+ * Input parameters:
+ * id - id of dp memory object
+ * external - external address
+ * internal - pointer of internal address to set
+ *
+ * Output parameters:
+ * internal - internal address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_external_to_internal(
+ Objects_Id id,
+ void *external,
+ void **internal
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( external, the_port->external_base );
+ if ( ending > the_port->length )
+ *internal = external;
+ else
+ *internal = _Addresses_Add_offset( the_port->internal_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/dpmemident.c b/cpukit/rtems/src/dpmemident.c
new file mode 100644
index 0000000000..167327ce9a
--- /dev/null
+++ b/cpukit/rtems/src/dpmemident.c
@@ -0,0 +1,56 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * rtems_port_ident
+ *
+ * This directive returns the system ID associated with
+ * the port name.
+ *
+ * Input parameters:
+ * name - user defined port name
+ * id - pointer to port id
+ *
+ * Output parameters:
+ * *id - port id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_port_ident(
+ rtems_name name,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
+ &_Dual_ported_memory_Information,
+ &name,
+ OBJECTS_SEARCH_ALL_NODES,
+ id
+ );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
diff --git a/cpukit/rtems/src/dpmeminternal2external.c b/cpukit/rtems/src/dpmeminternal2external.c
new file mode 100644
index 0000000000..adfbf09933
--- /dev/null
+++ b/cpukit/rtems/src/dpmeminternal2external.c
@@ -0,0 +1,73 @@
+/*
+ * Dual Port Memory Manager
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/support.h>
+#include <rtems/score/address.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/dpmem.h>
+
+/*PAGE
+ *
+ * rtems_port_internal_to_external
+ *
+ * This directive converts an internal dual-ported memory address to an
+ * external dual-ported memory address. If the given internal address
+ * is an invalid dual-ported address, then the external address is set
+ * to the given internal address.
+ *
+ * Input parameters:
+ * id - id of dual-ported memory object
+ * internal - internal address to set
+ * external - pointer to external address
+ *
+ * Output parameters:
+ * external - external address
+ * RTEMS_SUCCESSFUL - always succeeds
+ */
+
+rtems_status_code rtems_port_internal_to_external(
+ Objects_Id id,
+ void *internal,
+ void **external
+)
+{
+ register Dual_ported_memory_Control *the_port;
+ Objects_Locations location;
+ unsigned32 ending;
+
+ the_port = _Dual_ported_memory_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE: /* this error cannot be returned */
+ return RTEMS_INTERNAL_ERROR;
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ ending = _Addresses_Subtract( internal, the_port->internal_base );
+ if ( ending > the_port->length )
+ *external = internal;
+ else
+ *external = _Addresses_Add_offset( the_port->external_base,
+ ending );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}