summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-17 23:15:20 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-17 23:15:20 +0000
commit842db5f391f323b49ff2fc6157f89135d4662506 (patch)
tree3a30015625c2caa01e470b72fd98874663c2485f
parentSplit Timer Manager into one routine per file. (diff)
downloadrtems-842db5f391f323b49ff2fc6157f89135d4662506.tar.bz2
Split Partition Manager into one routine per file.
-rw-r--r--c/src/exec/rtems/src/Makefile.in23
-rw-r--r--c/src/exec/rtems/src/part.c299
-rw-r--r--c/src/exec/rtems/src/partcreate.c116
-rw-r--r--c/src/exec/rtems/src/partdelete.c88
-rw-r--r--c/src/exec/rtems/src/partgetbuffer.c80
-rw-r--r--c/src/exec/rtems/src/partident.c54
-rw-r--r--c/src/exec/rtems/src/partreturnbuffer.c76
-rw-r--r--cpukit/rtems/src/part.c299
-rw-r--r--cpukit/rtems/src/partcreate.c116
-rw-r--r--cpukit/rtems/src/partdelete.c88
-rw-r--r--cpukit/rtems/src/partgetbuffer.c80
-rw-r--r--cpukit/rtems/src/partident.c54
-rw-r--r--cpukit/rtems/src/partreturnbuffer.c76
13 files changed, 843 insertions, 606 deletions
diff --git a/c/src/exec/rtems/src/Makefile.in b/c/src/exec/rtems/src/Makefile.in
index e27501ddfc..0ae8d4faac 100644
--- a/c/src/exec/rtems/src/Makefile.in
+++ b/c/src/exec/rtems/src/Makefile.in
@@ -31,10 +31,6 @@ TIMER_PIECES=\
timer timercancel timercreate timerdelete timerfireafter \
timerfirewhere timerident timerreset
-REGION_PIECES=\
- region regioncreate regiondelete regionextend regiongetsegment \
- regiongetsegmentsize regionident regionreturnsegemnt regionreturnsegemnt
-
MESSAGE_QUEUE_PIECES=\
msg msgqallocate msgqbroadcast msgqcreate msgqdelete \
msgqflush msgqgetnumberpending msgqident msgqreceive \
@@ -51,10 +47,21 @@ RATEMON_PIECES=\
ratemon ratemoncancel ratemoncreate ratemondelete ratemongetstatus \
ratemonident ratemonperiod ratemontimeout
-C_PIECES=attr $(CLOCK_PIECES) dpmem $(EVENT_PIECES) intr intrbody \
- $(MESSAGE_QUEUE_PIECES) \
- part $(RATEMON_PIECES) $(REGION_PIECES) $(SEMAPHORE_PIECES) signal \
- $(TASK_PIECES) $(TIMER_PIECES) $(MP_PIECES)
+REGION_PIECES=\
+ region regioncreate regiondelete regionextend regiongetsegment \
+ regiongetsegmentsize regionident regionreturnsegemnt regionreturnsegemnt
+
+PARTITION_PIECES=\
+ part partcreate partdelete partgetbuffer partident partreturnbuffer
+
+C_PIECES=\
+ attr $(TASK_PIECES) $(RATEMON_PIECES) \
+ intr intrbody \
+ $(CLOCK_PIECES) $(TIMER_PIECES) \
+ $(SEMAPHORE_PIECES) $(MESSAGE_QUEUE_PIECES) \
+ $(EVENT_PIECES) signal
+ $(PARTITION_PIECES) $(REGION_PIECES) dpmem \
+ $(MP_PIECES)
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c
index 4417db10cb..89c9ac3f3f 100644
--- a/c/src/exec/rtems/src/part.c
+++ b/c/src/exec/rtems/src/part.c
@@ -62,302 +62,3 @@ void _Partition_Manager_initialization(
#endif
}
-
-/*PAGE
- *
- * rtems_partition_create
- *
- * This directive creates a partiton of fixed sized buffers from the
- * given contiguous memory area.
- *
- * Input parameters:
- * name - user defined partition name
- * starting_address - physical start address of partition
- * length - physical length in bytes
- * buffer_size - size of buffers in bytes
- * attribute_set - partition attributes
- * id - pointer to partition id
- *
- * Output parameters:
- * id - partition id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_create(
- rtems_name name,
- void *starting_address,
- unsigned32 length,
- unsigned32 buffer_size,
- rtems_attribute attribute_set,
- Objects_Id *id
-)
-{
- register Partition_Control *the_partition;
-
- if ( !rtems_is_name_valid( name ) )
- return RTEMS_INVALID_NAME;
-
- if ( length == 0 || buffer_size == 0 || length < buffer_size ||
- !_Partition_Is_buffer_size_aligned( buffer_size ) )
- return RTEMS_INVALID_SIZE;
-
- if ( !_Addresses_Is_aligned( starting_address ) )
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) &&
- !_System_state_Is_multiprocessing )
- return RTEMS_MP_NOT_CONFIGURED;
-#endif
-
- _Thread_Disable_dispatch(); /* prevents deletion */
-
- the_partition = _Partition_Allocate();
-
- if ( !the_partition ) {
- _Thread_Enable_dispatch();
- return RTEMS_TOO_MANY;
- }
-
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) &&
- !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
- the_partition->Object.id, FALSE ) ) ) {
- _Partition_Free( the_partition );
- _Thread_Enable_dispatch();
- return RTEMS_TOO_MANY;
- }
-#endif
-
- the_partition->starting_address = starting_address;
- the_partition->length = length;
- the_partition->buffer_size = buffer_size;
- the_partition->attribute_set = attribute_set;
- the_partition->number_of_used_blocks = 0;
-
- _Chain_Initialize( &the_partition->Memory, starting_address,
- length / buffer_size, buffer_size );
-
- _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
-
- *id = the_partition->Object.id;
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) )
- _Partition_MP_Send_process_packet(
- PARTITION_MP_ANNOUNCE_CREATE,
- the_partition->Object.id,
- name,
- 0 /* Not used */
- );
-#endif
-
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
-}
-
-/*PAGE
- *
- * rtems_partition_ident
- *
- * This directive returns the system ID associated with
- * the partition name.
- *
- * Input parameters:
- * name - user defined partition name
- * node - node(s) to be searched
- * id - pointer to partition id
- *
- * Output parameters:
- * *id - partition id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_ident(
- rtems_name name,
- unsigned32 node,
- Objects_Id *id
-)
-{
- Objects_Name_to_id_errors status;
-
- status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
-
- return _Status_Object_name_errors_to_status[ status ];
-}
-
-/*PAGE
- *
- * rtems_partition_delete
- *
- * This directive allows a thread to delete a partition specified by
- * the partition identifier, provided that none of its buffers are
- * still allocated.
- *
- * Input parameters:
- * id - partition id
- *
- * Output parameters:
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_delete(
- Objects_Id id
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- if ( the_partition->number_of_used_blocks == 0 ) {
- _Objects_Close( &_Partition_Information, &the_partition->Object );
- _Partition_Free( the_partition );
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
-
- _Objects_MP_Close(
- &_Partition_Information,
- the_partition->Object.id
- );
-
- _Partition_MP_Send_process_packet(
- PARTITION_MP_ANNOUNCE_DELETE,
- the_partition->Object.id,
- 0, /* Not used */
- 0 /* Not used */
- );
- }
-#endif
-
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_RESOURCE_IN_USE;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_partition_get_buffer
- *
- * This directive will obtain a buffer from a buffer partition.
- *
- * Input parameters:
- * id - partition id
- * buffer - pointer to buffer address
- *
- * Output parameters:
- * buffer - pointer to buffer address filled in
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_get_buffer(
- Objects_Id id,
- void **buffer
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
- void *the_buffer;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- _Thread_Executing->Wait.return_argument = buffer;
- return(
- _Partition_MP_Send_request_packet(
- PARTITION_MP_GET_BUFFER_REQUEST,
- id,
- 0 /* Not used */
- )
- );
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- the_buffer = _Partition_Allocate_buffer( the_partition );
- if ( the_buffer ) {
- the_partition->number_of_used_blocks += 1;
- _Thread_Enable_dispatch();
- *buffer = the_buffer;
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_UNSATISFIED;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_partition_return_buffer
- *
- * This directive will return the given buffer to the specified
- * buffer partition.
- *
- * Input parameters:
- * id - partition id
- * buffer - pointer to buffer address
- *
- * Output parameters:
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_return_buffer(
- Objects_Id id,
- void *buffer
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
-
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- return _Partition_MP_Send_request_packet(
- PARTITION_MP_RETURN_BUFFER_REQUEST,
- id,
- buffer
- );
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
- _Partition_Free_buffer( the_partition, buffer );
- the_partition->number_of_used_blocks -= 1;
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_INVALID_ADDRESS;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
diff --git a/c/src/exec/rtems/src/partcreate.c b/c/src/exec/rtems/src/partcreate.c
new file mode 100644
index 0000000000..5c3098f02f
--- /dev/null
+++ b/c/src/exec/rtems/src/partcreate.c
@@ -0,0 +1,116 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_create
+ *
+ * This directive creates a partiton of fixed sized buffers from the
+ * given contiguous memory area.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * starting_address - physical start address of partition
+ * length - physical length in bytes
+ * buffer_size - size of buffers in bytes
+ * attribute_set - partition attributes
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Partition_Control *the_partition;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( length == 0 || buffer_size == 0 || length < buffer_size ||
+ !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ return RTEMS_INVALID_SIZE;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+#endif
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_partition = _Partition_Allocate();
+
+ if ( !the_partition ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
+ the_partition->Object.id, FALSE ) ) ) {
+ _Partition_Free( the_partition );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+#endif
+
+ the_partition->starting_address = starting_address;
+ the_partition->length = length;
+ the_partition->buffer_size = buffer_size;
+ the_partition->attribute_set = attribute_set;
+ the_partition->number_of_used_blocks = 0;
+
+ _Chain_Initialize( &the_partition->Memory, starting_address,
+ length / buffer_size, buffer_size );
+
+ _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
+
+ *id = the_partition->Object.id;
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_CREATE,
+ the_partition->Object.id,
+ name,
+ 0 /* Not used */
+ );
+#endif
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/exec/rtems/src/partdelete.c b/c/src/exec/rtems/src/partdelete.c
new file mode 100644
index 0000000000..d4bcc9932d
--- /dev/null
+++ b/c/src/exec/rtems/src/partdelete.c
@@ -0,0 +1,88 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_delete
+ *
+ * This directive allows a thread to delete a partition specified by
+ * the partition identifier, provided that none of its buffers are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - partition id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ if ( the_partition->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Partition_Information, &the_partition->Object );
+ _Partition_Free( the_partition );
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+
+ _Objects_MP_Close(
+ &_Partition_Information,
+ the_partition->Object.id
+ );
+
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_DELETE,
+ the_partition->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+#endif
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/partgetbuffer.c b/c/src/exec/rtems/src/partgetbuffer.c
new file mode 100644
index 0000000000..d62647b3f8
--- /dev/null
+++ b/c/src/exec/rtems/src/partgetbuffer.c
@@ -0,0 +1,80 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_get_buffer
+ *
+ * This directive will obtain a buffer from a buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * buffer - pointer to buffer address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+ void *the_buffer;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ _Thread_Executing->Wait.return_argument = buffer;
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_GET_BUFFER_REQUEST,
+ id,
+ 0 /* Not used */
+ )
+ );
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ the_buffer = _Partition_Allocate_buffer( the_partition );
+ if ( the_buffer ) {
+ the_partition->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *buffer = the_buffer;
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/c/src/exec/rtems/src/partident.c b/c/src/exec/rtems/src/partident.c
new file mode 100644
index 0000000000..2f86e17a39
--- /dev/null
+++ b/c/src/exec/rtems/src/partident.c
@@ -0,0 +1,54 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_ident
+ *
+ * This directive returns the system ID associated with
+ * the partition name.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * node - node(s) to be searched
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * *id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
diff --git a/c/src/exec/rtems/src/partreturnbuffer.c b/c/src/exec/rtems/src/partreturnbuffer.c
new file mode 100644
index 0000000000..3b68e53bff
--- /dev/null
+++ b/c/src/exec/rtems/src/partreturnbuffer.c
@@ -0,0 +1,76 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_return_buffer
+ *
+ * This directive will return the given buffer to the specified
+ * buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ return _Partition_MP_Send_request_packet(
+ PARTITION_MP_RETURN_BUFFER_REQUEST,
+ id,
+ buffer
+ );
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
+ _Partition_Free_buffer( the_partition, buffer );
+ the_partition->number_of_used_blocks -= 1;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/part.c b/cpukit/rtems/src/part.c
index 4417db10cb..89c9ac3f3f 100644
--- a/cpukit/rtems/src/part.c
+++ b/cpukit/rtems/src/part.c
@@ -62,302 +62,3 @@ void _Partition_Manager_initialization(
#endif
}
-
-/*PAGE
- *
- * rtems_partition_create
- *
- * This directive creates a partiton of fixed sized buffers from the
- * given contiguous memory area.
- *
- * Input parameters:
- * name - user defined partition name
- * starting_address - physical start address of partition
- * length - physical length in bytes
- * buffer_size - size of buffers in bytes
- * attribute_set - partition attributes
- * id - pointer to partition id
- *
- * Output parameters:
- * id - partition id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_create(
- rtems_name name,
- void *starting_address,
- unsigned32 length,
- unsigned32 buffer_size,
- rtems_attribute attribute_set,
- Objects_Id *id
-)
-{
- register Partition_Control *the_partition;
-
- if ( !rtems_is_name_valid( name ) )
- return RTEMS_INVALID_NAME;
-
- if ( length == 0 || buffer_size == 0 || length < buffer_size ||
- !_Partition_Is_buffer_size_aligned( buffer_size ) )
- return RTEMS_INVALID_SIZE;
-
- if ( !_Addresses_Is_aligned( starting_address ) )
- return RTEMS_INVALID_ADDRESS;
-
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) &&
- !_System_state_Is_multiprocessing )
- return RTEMS_MP_NOT_CONFIGURED;
-#endif
-
- _Thread_Disable_dispatch(); /* prevents deletion */
-
- the_partition = _Partition_Allocate();
-
- if ( !the_partition ) {
- _Thread_Enable_dispatch();
- return RTEMS_TOO_MANY;
- }
-
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) &&
- !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
- the_partition->Object.id, FALSE ) ) ) {
- _Partition_Free( the_partition );
- _Thread_Enable_dispatch();
- return RTEMS_TOO_MANY;
- }
-#endif
-
- the_partition->starting_address = starting_address;
- the_partition->length = length;
- the_partition->buffer_size = buffer_size;
- the_partition->attribute_set = attribute_set;
- the_partition->number_of_used_blocks = 0;
-
- _Chain_Initialize( &the_partition->Memory, starting_address,
- length / buffer_size, buffer_size );
-
- _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
-
- *id = the_partition->Object.id;
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( attribute_set ) )
- _Partition_MP_Send_process_packet(
- PARTITION_MP_ANNOUNCE_CREATE,
- the_partition->Object.id,
- name,
- 0 /* Not used */
- );
-#endif
-
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
-}
-
-/*PAGE
- *
- * rtems_partition_ident
- *
- * This directive returns the system ID associated with
- * the partition name.
- *
- * Input parameters:
- * name - user defined partition name
- * node - node(s) to be searched
- * id - pointer to partition id
- *
- * Output parameters:
- * *id - partition id
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_ident(
- rtems_name name,
- unsigned32 node,
- Objects_Id *id
-)
-{
- Objects_Name_to_id_errors status;
-
- status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
-
- return _Status_Object_name_errors_to_status[ status ];
-}
-
-/*PAGE
- *
- * rtems_partition_delete
- *
- * This directive allows a thread to delete a partition specified by
- * the partition identifier, provided that none of its buffers are
- * still allocated.
- *
- * Input parameters:
- * id - partition id
- *
- * Output parameters:
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_delete(
- Objects_Id id
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- _Thread_Dispatch();
- return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- if ( the_partition->number_of_used_blocks == 0 ) {
- _Objects_Close( &_Partition_Information, &the_partition->Object );
- _Partition_Free( the_partition );
-#if defined(RTEMS_MULTIPROCESSING)
- if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
-
- _Objects_MP_Close(
- &_Partition_Information,
- the_partition->Object.id
- );
-
- _Partition_MP_Send_process_packet(
- PARTITION_MP_ANNOUNCE_DELETE,
- the_partition->Object.id,
- 0, /* Not used */
- 0 /* Not used */
- );
- }
-#endif
-
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_RESOURCE_IN_USE;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_partition_get_buffer
- *
- * This directive will obtain a buffer from a buffer partition.
- *
- * Input parameters:
- * id - partition id
- * buffer - pointer to buffer address
- *
- * Output parameters:
- * buffer - pointer to buffer address filled in
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_get_buffer(
- Objects_Id id,
- void **buffer
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
- void *the_buffer;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- _Thread_Executing->Wait.return_argument = buffer;
- return(
- _Partition_MP_Send_request_packet(
- PARTITION_MP_GET_BUFFER_REQUEST,
- id,
- 0 /* Not used */
- )
- );
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- the_buffer = _Partition_Allocate_buffer( the_partition );
- if ( the_buffer ) {
- the_partition->number_of_used_blocks += 1;
- _Thread_Enable_dispatch();
- *buffer = the_buffer;
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_UNSATISFIED;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
-
-/*PAGE
- *
- * rtems_partition_return_buffer
- *
- * This directive will return the given buffer to the specified
- * buffer partition.
- *
- * Input parameters:
- * id - partition id
- * buffer - pointer to buffer address
- *
- * Output parameters:
- * RTEMS_SUCCESSFUL - if successful
- * error code - if unsuccessful
- */
-
-rtems_status_code rtems_partition_return_buffer(
- Objects_Id id,
- void *buffer
-)
-{
- register Partition_Control *the_partition;
- Objects_Locations location;
-
- the_partition = _Partition_Get( id, &location );
- switch ( location ) {
-
- case OBJECTS_REMOTE:
-#if defined(RTEMS_MULTIPROCESSING)
- return _Partition_MP_Send_request_packet(
- PARTITION_MP_RETURN_BUFFER_REQUEST,
- id,
- buffer
- );
-#endif
-
- case OBJECTS_ERROR:
- return RTEMS_INVALID_ID;
-
- case OBJECTS_LOCAL:
- if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
- _Partition_Free_buffer( the_partition, buffer );
- the_partition->number_of_used_blocks -= 1;
- _Thread_Enable_dispatch();
- return RTEMS_SUCCESSFUL;
- }
- _Thread_Enable_dispatch();
- return RTEMS_INVALID_ADDRESS;
- }
-
- return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
-}
diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c
new file mode 100644
index 0000000000..5c3098f02f
--- /dev/null
+++ b/cpukit/rtems/src/partcreate.c
@@ -0,0 +1,116 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_create
+ *
+ * This directive creates a partiton of fixed sized buffers from the
+ * given contiguous memory area.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * starting_address - physical start address of partition
+ * length - physical length in bytes
+ * buffer_size - size of buffers in bytes
+ * attribute_set - partition attributes
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_create(
+ rtems_name name,
+ void *starting_address,
+ unsigned32 length,
+ unsigned32 buffer_size,
+ rtems_attribute attribute_set,
+ Objects_Id *id
+)
+{
+ register Partition_Control *the_partition;
+
+ if ( !rtems_is_name_valid( name ) )
+ return RTEMS_INVALID_NAME;
+
+ if ( length == 0 || buffer_size == 0 || length < buffer_size ||
+ !_Partition_Is_buffer_size_aligned( buffer_size ) )
+ return RTEMS_INVALID_SIZE;
+
+ if ( !_Addresses_Is_aligned( starting_address ) )
+ return RTEMS_INVALID_ADDRESS;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !_System_state_Is_multiprocessing )
+ return RTEMS_MP_NOT_CONFIGURED;
+#endif
+
+ _Thread_Disable_dispatch(); /* prevents deletion */
+
+ the_partition = _Partition_Allocate();
+
+ if ( !the_partition ) {
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) &&
+ !( _Objects_MP_Allocate_and_open( &_Partition_Information, name,
+ the_partition->Object.id, FALSE ) ) ) {
+ _Partition_Free( the_partition );
+ _Thread_Enable_dispatch();
+ return RTEMS_TOO_MANY;
+ }
+#endif
+
+ the_partition->starting_address = starting_address;
+ the_partition->length = length;
+ the_partition->buffer_size = buffer_size;
+ the_partition->attribute_set = attribute_set;
+ the_partition->number_of_used_blocks = 0;
+
+ _Chain_Initialize( &the_partition->Memory, starting_address,
+ length / buffer_size, buffer_size );
+
+ _Objects_Open( &_Partition_Information, &the_partition->Object, &name );
+
+ *id = the_partition->Object.id;
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( attribute_set ) )
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_CREATE,
+ the_partition->Object.id,
+ name,
+ 0 /* Not used */
+ );
+#endif
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/cpukit/rtems/src/partdelete.c b/cpukit/rtems/src/partdelete.c
new file mode 100644
index 0000000000..d4bcc9932d
--- /dev/null
+++ b/cpukit/rtems/src/partdelete.c
@@ -0,0 +1,88 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_delete
+ *
+ * This directive allows a thread to delete a partition specified by
+ * the partition identifier, provided that none of its buffers are
+ * still allocated.
+ *
+ * Input parameters:
+ * id - partition id
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_delete(
+ Objects_Id id
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ _Thread_Dispatch();
+ return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ if ( the_partition->number_of_used_blocks == 0 ) {
+ _Objects_Close( &_Partition_Information, &the_partition->Object );
+ _Partition_Free( the_partition );
+#if defined(RTEMS_MULTIPROCESSING)
+ if ( _Attributes_Is_global( the_partition->attribute_set ) ) {
+
+ _Objects_MP_Close(
+ &_Partition_Information,
+ the_partition->Object.id
+ );
+
+ _Partition_MP_Send_process_packet(
+ PARTITION_MP_ANNOUNCE_DELETE,
+ the_partition->Object.id,
+ 0, /* Not used */
+ 0 /* Not used */
+ );
+ }
+#endif
+
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_RESOURCE_IN_USE;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/partgetbuffer.c b/cpukit/rtems/src/partgetbuffer.c
new file mode 100644
index 0000000000..d62647b3f8
--- /dev/null
+++ b/cpukit/rtems/src/partgetbuffer.c
@@ -0,0 +1,80 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_get_buffer
+ *
+ * This directive will obtain a buffer from a buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * buffer - pointer to buffer address filled in
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_get_buffer(
+ Objects_Id id,
+ void **buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+ void *the_buffer;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ _Thread_Executing->Wait.return_argument = buffer;
+ return(
+ _Partition_MP_Send_request_packet(
+ PARTITION_MP_GET_BUFFER_REQUEST,
+ id,
+ 0 /* Not used */
+ )
+ );
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ the_buffer = _Partition_Allocate_buffer( the_partition );
+ if ( the_buffer ) {
+ the_partition->number_of_used_blocks += 1;
+ _Thread_Enable_dispatch();
+ *buffer = the_buffer;
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_UNSATISFIED;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}
diff --git a/cpukit/rtems/src/partident.c b/cpukit/rtems/src/partident.c
new file mode 100644
index 0000000000..2f86e17a39
--- /dev/null
+++ b/cpukit/rtems/src/partident.c
@@ -0,0 +1,54 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_ident
+ *
+ * This directive returns the system ID associated with
+ * the partition name.
+ *
+ * Input parameters:
+ * name - user defined partition name
+ * node - node(s) to be searched
+ * id - pointer to partition id
+ *
+ * Output parameters:
+ * *id - partition id
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_ident(
+ rtems_name name,
+ unsigned32 node,
+ Objects_Id *id
+)
+{
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id( &_Partition_Information, &name, node, id );
+
+ return _Status_Object_name_errors_to_status[ status ];
+}
diff --git a/cpukit/rtems/src/partreturnbuffer.c b/cpukit/rtems/src/partreturnbuffer.c
new file mode 100644
index 0000000000..3b68e53bff
--- /dev/null
+++ b/cpukit/rtems/src/partreturnbuffer.c
@@ -0,0 +1,76 @@
+/*
+ * Partition 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/score/object.h>
+#include <rtems/rtems/part.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/sysstate.h>
+
+/*PAGE
+ *
+ * rtems_partition_return_buffer
+ *
+ * This directive will return the given buffer to the specified
+ * buffer partition.
+ *
+ * Input parameters:
+ * id - partition id
+ * buffer - pointer to buffer address
+ *
+ * Output parameters:
+ * RTEMS_SUCCESSFUL - if successful
+ * error code - if unsuccessful
+ */
+
+rtems_status_code rtems_partition_return_buffer(
+ Objects_Id id,
+ void *buffer
+)
+{
+ register Partition_Control *the_partition;
+ Objects_Locations location;
+
+ the_partition = _Partition_Get( id, &location );
+ switch ( location ) {
+
+ case OBJECTS_REMOTE:
+#if defined(RTEMS_MULTIPROCESSING)
+ return _Partition_MP_Send_request_packet(
+ PARTITION_MP_RETURN_BUFFER_REQUEST,
+ id,
+ buffer
+ );
+#endif
+
+ case OBJECTS_ERROR:
+ return RTEMS_INVALID_ID;
+
+ case OBJECTS_LOCAL:
+ if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
+ _Partition_Free_buffer( the_partition, buffer );
+ the_partition->number_of_used_blocks -= 1;
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+ }
+ _Thread_Enable_dispatch();
+ return RTEMS_INVALID_ADDRESS;
+ }
+
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
+}