summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/include
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-09-25 13:38:24 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-09-25 13:38:24 +0000
commit8042961d87b10e0bf0b0f021e24dbb8eb1979841 (patch)
tree975fa83004c5c30404880036836cdfae88e775ab /cpukit/rtems/include
parentAdd name. (diff)
downloadrtems-8042961d87b10e0bf0b0f021e24dbb8eb1979841.tar.bz2
2006-09-25 Joel Sherrill <joel.sherrill@oarcorp.com>
* rtems/Makefile.am, rtems/preinstall.am, rtems/include/rtems.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/config.h, rtems/inline/rtems/rtems/attr.inl, rtems/macros/rtems/rtems/attr.inl: Add Classic API Barriers. * rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/barriermp.h, rtems/inline/rtems/rtems/barrier.inl, rtems/macros/rtems/rtems/barrier.inl, rtems/src/barrier.c, rtems/src/barriercreate.c, rtems/src/barrierdelete.c, rtems/src/barrierident.c, rtems/src/barrierrelease.c, rtems/src/barriertranslatereturncode.c, rtems/src/barrierwait.c: New files.
Diffstat (limited to 'cpukit/rtems/include')
-rw-r--r--cpukit/rtems/include/rtems.h1
-rw-r--r--cpukit/rtems/include/rtems/rtems/attr.h25
-rw-r--r--cpukit/rtems/include/rtems/rtems/barrier.h195
-rw-r--r--cpukit/rtems/include/rtems/rtems/barriermp.h141
-rw-r--r--cpukit/rtems/include/rtems/rtems/config.h3
5 files changed, 355 insertions, 10 deletions
diff --git a/cpukit/rtems/include/rtems.h b/cpukit/rtems/include/rtems.h
index 2cbfee49f0..b4eb12a1c7 100644
--- a/cpukit/rtems/include/rtems.h
+++ b/cpukit/rtems/include/rtems.h
@@ -46,6 +46,7 @@ extern "C" {
#include <rtems/rtems/options.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/intr.h>
+#include <rtems/rtems/barrier.h>
#include <rtems/rtems/cache.h>
#include <rtems/rtems/clock.h>
#include <rtems/extension.h>
diff --git a/cpukit/rtems/include/rtems/rtems/attr.h b/cpukit/rtems/include/rtems/rtems/attr.h
index 22e78ee052..f37e8caa33 100644
--- a/cpukit/rtems/include/rtems/rtems/attr.h
+++ b/cpukit/rtems/include/rtems/rtems/attr.h
@@ -31,28 +31,35 @@ typedef uint32_t rtems_attribute;
#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
-#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
-#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
-
#define RTEMS_LOCAL 0x00000000 /* local resource */
#define RTEMS_GLOBAL 0x00000002 /* global resource */
#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
#define RTEMS_PRIORITY 0x00000004 /* process by priority */
+ /* RTEMS Task Specific Attributes */
+#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
+#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
+
+ /* RTEMS Semaphore Specific Attributes */
#define RTEMS_SEMAPHORE_CLASS 0x00000030 /* mask */
#define RTEMS_COUNTING_SEMAPHORE 0x00000000
#define RTEMS_BINARY_SEMAPHORE 0x00000010
#define RTEMS_SIMPLE_BINARY_SEMAPHORE 0x00000020
-#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
-#define RTEMS_INHERIT_PRIORITY 0x00000040
+#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
+#define RTEMS_INHERIT_PRIORITY 0x00000040
+
+#define RTEMS_NO_PRIORITY_CEILING 0x00000000
+#define RTEMS_PRIORITY_CEILING 0x00000080
-#define RTEMS_NO_PRIORITY_CEILING 0x00000000
-#define RTEMS_PRIORITY_CEILING 0x00000080
+ /* RTEMS Barrier Specific Attributes */
+#define RTEMS_BARRIER_AUTOMATIC_RELEASE 0x00000010
+#define RTEMS_BARRIER_MANUAL_RELEASE 0x00000000
-#define RTEMS_APPLICATION_TASK 0x00000000
-#define RTEMS_SYSTEM_TASK 0x00000100
+ /* RTEMS Internal Task Specific Attributes */
+#define RTEMS_APPLICATION_TASK 0x00000000
+#define RTEMS_SYSTEM_TASK 0x00008000
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
diff --git a/cpukit/rtems/include/rtems/rtems/barrier.h b/cpukit/rtems/include/rtems/rtems/barrier.h
new file mode 100644
index 0000000000..f9c8e909ee
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/barrier.h
@@ -0,0 +1,195 @@
+/**
+ * @file rtems/rtems/barrier.h
+ */
+
+/*
+ * This include file contains all the constants and structures associated
+ * with the Barrier Manager.
+ *
+ * Directives provided are:
+ *
+ * + create a barrier
+ * + get an ID of a barrier
+ * + delete a barrier
+ * + wait for a barrier
+ * + signal a barrier
+ *
+ * COPYRIGHT (c) 1989-2006.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_RTEMS_BARRIER_H
+#define _RTEMS_RTEMS_BARRIER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/support.h>
+#include <rtems/rtems/attr.h>
+#include <rtems/score/object.h>
+#include <rtems/score/corebarrier.h>
+
+/**
+ * This type defines the control block used to manage each barrier.
+ */
+
+typedef struct {
+ /** This is used to manage a barrier as an object. */
+ Objects_Control Object;
+ /** This is used to specify the attributes of a barrier. */
+ rtems_attribute attribute_set;
+ /** This is used to implement the barrier. */
+ CORE_barrier_Control Barrier;
+} Barrier_Control;
+
+/**
+ * The following defines the information control block used to manage
+ * this class of objects.
+ */
+
+RTEMS_EXTERN Objects_Information _Barrier_Information;
+
+/**
+ * @brief _Barrier_Manager_initialization
+ *
+ * This routine performs the initialization necessary for this manager.
+ *
+ * @param[in] maximum_barriers is the total number of barriers allowed to
+ * concurrently be active in the system.
+ */
+
+void _Barrier_Manager_initialization(
+ uint32_t maximum_barriers
+);
+
+/**
+ * @brief rtems_barrier_create
+ *
+ * This routine implements the rtems_barrier_create directive. The
+ * barrier will have the name name. The starting count for
+ * the barrier is count. The attribute_set determines if
+ * the barrier is global or local and the thread queue
+ * discipline. It returns the id of the created barrier in ID.
+ *
+ * @param[in] name is the name of this barrier instance.
+ * @param[in] attribute_set specifies the attributes of this barrier instance.
+ * @param[in] maximum_waiters is the maximum number of threads which will
+ * be allowed to concurrently wait at the barrier.
+ * @param[out] id will contain the id of this barrier.
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+
+rtems_status_code rtems_barrier_create(
+ rtems_name name,
+ rtems_attribute attribute_set,
+ uint32_t maximum_waiters,
+ rtems_id *id
+);
+
+/**
+ * @brief rtems_barrier_ident
+ *
+ * This routine implements the rtems_barrier_ident directive.
+ * This directive returns the barrier ID associated with name.
+ * If more than one barrier is named name, then the barrier
+ * to which the ID belongs is arbitrary. node indicates the
+ * extent of the search for the ID of the barrier named name.
+ * The search can be limited to a particular node or allowed to
+ * encompass all nodes.
+ *
+ * @param[in] name is the name of this barrier instance.
+ * @param[out] id will contain the id of this barrier.
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+
+rtems_status_code rtems_barrier_ident(
+ rtems_name name,
+ rtems_id *id
+);
+
+/**
+ * @brief rtems_barrier_delete
+ *
+ * This routine implements the rtems_barrier_delete directive. The
+ * barrier indicated by @a id is deleted.
+ *
+ * @param[in] id indicates the barrier to delete
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+rtems_status_code rtems_barrier_delete(
+ rtems_id id
+);
+
+/**
+ * @brief rtems_barrier_wait
+ *
+ * This routine implements the rtems_barrier_wait directive. It
+ * attempts to wait at the barrier associated with @a id. The calling task
+ * may block waiting for the barrier with an optional timeout of @a timeout
+ * clock ticks.
+ *
+ * @param[in] id indicates the barrier to wait at.
+ * @param[in] option_set indicates if the caller is willing to wait.
+ * @param[in] timeout is the maximum length of time in ticks the calling
+ * thread is willing to block.
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+rtems_status_code rtems_barrier_wait(
+ rtems_id id,
+ rtems_interval timeout
+);
+
+/**
+ * @brief rtems_barrier_release
+ *
+ * This routine implements the rtems_barrier_release directive. It
+ * unblocks all of the threads waiting on the barrier associated with
+ * @a id. The number of threads unblocked is returns in @a unblocked.
+ *
+ *
+ * @param[in] id indicates the barrier to wait at.
+ * @param[out] unblocked will contain the number of threads unblocked.
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+rtems_status_code rtems_barrier_release(
+ rtems_id id,
+ uint32_t *unblocked
+);
+
+/**
+ * @brief Translate SuperCore Barrier Status Code to RTEMS Status Code
+ *
+ * This function returns a RTEMS status code based on the barrier
+ * status code specified.
+ *
+ * @param[in] the_status is the SuperCore Barrier status to translate.
+ *
+ * @return a status code indicating success or the reason for failure.
+ */
+rtems_status_code _Barrier_Translate_core_barrier_return_code (
+ CORE_barrier_Status the_status
+);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/rtems/barrier.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/barriermp.h b/cpukit/rtems/include/rtems/rtems/barriermp.h
new file mode 100644
index 0000000000..c09b1fc6ff
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/barriermp.h
@@ -0,0 +1,141 @@
+/**
+ * @file rtems/rtems/barriermp.h
+ */
+
+/*
+ * This include file contains all the constants and structures associated
+ * with the Multiprocessing Support in the Barrier Manager.
+ *
+ * COPYRIGHT (c) 1989-2006.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_RTEMS_SEMMP_H
+#define _RTEMS_RTEMS_SEMMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/mppkt.h>
+#include <rtems/score/object.h>
+#include <rtems/rtems/options.h>
+#include <rtems/rtems/barrier.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/watchdog.h>
+
+/**
+ * The following enumerated type defines the list of
+ * remote barrier operations.
+ */
+typedef enum {
+ BARRIER_MP_ANNOUNCE_CREATE = 0,
+ BARRIER_MP_ANNOUNCE_DELETE = 1,
+ BARRIER_MP_EXTRACT_PROXY = 2,
+ BARRIER_MP_WAIT_REQUEST = 3,
+ BARRIER_MP_WAIT_RESPONSE = 4,
+ BARRIER_MP_RELEASE_REQUEST = 5,
+ BARRIER_MP_RELEASE_RESPONSE = 6
+} Barrier_MP_Remote_operations;
+
+/**
+ * The following data structure defines the packet used to perform
+ * remote barrier operations.
+ */
+typedef struct {
+ rtems_packet_prefix Prefix;
+ Barrier_MP_Remote_operations operation;
+ rtems_name name;
+ rtems_option option_set;
+ Objects_Id proxy_id;
+} Barrier_MP_Packet;
+
+/**
+ * @brief _Barrier_MP_Send_process_packet
+ *
+ * This routine performs a remote procedure call so that a
+ * process operation can be performed on another node.
+ */
+void _Barrier_MP_Send_process_packet (
+ Barrier_MP_Remote_operations operation,
+ Objects_Id barrier_id,
+ rtems_name name,
+ Objects_Id proxy_id
+);
+
+/**
+ * @brief _Barrier_MP_Send_request_packet
+ *
+ * This routine performs a remote procedure call so that a
+ * directive operation can be initiated on another node.
+ */
+rtems_status_code _Barrier_MP_Send_request_packet (
+ Barrier_MP_Remote_operations operation,
+ Objects_Id barrier_id,
+ rtems_interval timeout
+);
+
+/**
+ * @brief _Barrier_MP_Send_response_packet
+ *
+ * This routine performs a remote procedure call so that a
+ * directive can be performed on another node.
+ */
+
+void _Barrier_MP_Send_response_packet (
+ Barrier_MP_Remote_operations operation,
+ Objects_Id barrier_id,
+ Thread_Control *the_thread
+);
+
+/**
+ * @brief _Barrier_MP_Process_packet
+ *
+ * This routine performs the actions specific to this package for
+ * the request from another node.
+ */
+void _Barrier_MP_Process_packet (
+ rtems_packet_prefix *the_packet_prefix
+);
+
+/**
+ * @brief _Barrier_MP_Send_object_was_deleted
+ *
+ * This routine is invoked indirectly by the thread queue
+ * when a proxy has been removed from the thread queue and
+ * the remote node must be informed of this.
+ */
+void _Barrier_MP_Send_object_was_deleted (
+ Thread_Control *the_proxy
+);
+
+/**
+ * @brief _Barrier_MP_Send_extract_proxy
+ *
+ * This routine is invoked when a task is deleted and it
+ * has a proxy which must be removed from a thread queue and
+ * the remote node must be informed of this.
+ */
+void _Barrier_MP_Send_extract_proxy (
+ void *argument
+);
+
+/**
+ * @brief _Barrier_MP_Get_packet
+ *
+ * This function is used to obtain a barrier mp packet.
+ */
+Barrier_MP_Packet *_Barrier_MP_Get_packet ( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of file */
diff --git a/cpukit/rtems/include/rtems/rtems/config.h b/cpukit/rtems/include/rtems/rtems/config.h
index d9c43d556d..3cc64cfe97 100644
--- a/cpukit/rtems/include/rtems/rtems/config.h
+++ b/cpukit/rtems/include/rtems/rtems/config.h
@@ -6,7 +6,7 @@
* This include file contains the table of user defined configuration
* parameters specific for the RTEMS API.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2006.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -44,6 +44,7 @@ typedef struct {
uint32_t maximum_regions;
uint32_t maximum_ports;
uint32_t maximum_periods;
+ uint32_t maximum_barriers;
uint32_t number_of_initialization_tasks;
rtems_initialization_tasks_table *User_initialization_tasks_table;
} rtems_api_configuration_table;