summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/include/rtems/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-23 14:56:00 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-23 15:12:55 +0200
commitc40482815ec85bc9ef802570498a8abe8baef865 (patch)
tree50a529eac444f2ccd6c2635fba7b8d63ebb33fd9 /cpukit/rtems/include/rtems/rtems
parentrtems: Create region implementation header (diff)
downloadrtems-c40482815ec85bc9ef802570498a8abe8baef865.tar.bz2
rtems: Create tasks implementation header
Move implementation specific parts of tasks.h and tasks.inl into new header file tasksimpl.h. The tasks.h contains now only the application visible API.
Diffstat (limited to 'cpukit/rtems/include/rtems/rtems')
-rw-r--r--cpukit/rtems/include/rtems/rtems/taskmp.h12
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasks.h107
-rw-r--r--cpukit/rtems/include/rtems/rtems/tasksimpl.h142
3 files changed, 178 insertions, 83 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/taskmp.h b/cpukit/rtems/include/rtems/rtems/taskmp.h
index 01a283b2f5..4102b9c74d 100644
--- a/cpukit/rtems/include/rtems/rtems/taskmp.h
+++ b/cpukit/rtems/include/rtems/rtems/taskmp.h
@@ -21,13 +21,20 @@
#ifndef _RTEMS_RTEMS_TASKMP_H
#define _RTEMS_RTEMS_TASKMP_H
+#ifndef _RTEMS_RTEMS_TASKSIMPL_H
+# error "Never use <rtems/rtems/taskmp.h> directly; include <rtems/rtems/tasksimpl.h> instead."
+#endif
+
#include <rtems/score/mppkt.h>
#include <rtems/score/object.h>
#include <rtems/rtems/options.h>
#include <rtems/score/priority.h>
-#include <rtems/rtems/tasks.h>
#include <rtems/score/thread.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* @defgroup ClassicTaskMP Task MP Support
*
@@ -37,9 +44,6 @@
*/
/**@{*/
-#ifdef __cplusplus
-extern "C" {
-#endif
/**
* The following enumerated type defines the list of
* remote task operations.
diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 3be3aebe7c..c5d20c81e5 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -48,16 +48,8 @@
#include <rtems/rtems/attr.h>
#include <rtems/rtems/status.h>
-/**
- * @brief Instantiate RTEMS Classic API Tasks Data
- *
- * This constant is defined to extern most of the time when using
- * this header file. However by defining it to nothing, the data
- * declared in this header file can be instantiated. This is done
- * in a single per manager file.
- */
-#ifndef RTEMS_TASKS_EXTERN
-#define RTEMS_TASKS_EXTERN extern
+#ifdef __cplusplus
+extern "C" {
#endif
/**
@@ -71,10 +63,6 @@
*/
/**@{*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
* Constant to be used as the ID of current task
*/
@@ -209,51 +197,6 @@ typedef struct {
} rtems_initialization_tasks_table;
/**
- * This is the API specific information required by each thread for
- * the RTEMS API to function correctly.
- *
- * @note Notepads must be the last entry in the structure and memory
- * will be taken away from this structure when allocated if
- * notespads are disabled by the application configuration.
- */
-typedef struct {
- /** This field contains the event control for this task. */
- Event_Control Event;
- /** This field contains the system event control for this task. */
- Event_Control System_event;
- /** This field contains the Classic API Signal information for this task. */
- ASR_Information Signal;
- /**
- * This field contains the notepads for this task.
- *
- * @note MUST BE LAST ENTRY.
- */
- uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ];
-} RTEMS_API_Control;
-
-/**
- * The following instantiates the information control block used to
- * manage this class of objects.
- */
-RTEMS_TASKS_EXTERN Objects_Information _RTEMS_tasks_Information;
-
-/**
- * When the user configures a set of Classic API initialization tasks,
- * This variable will point to the method used to initialize them.
- *
- * @note It is instantiated and initialized by confdefs.h based upon
- * application requirements.
- */
-extern void (*_RTEMS_tasks_Initialize_user_tasks_p)(void);
-
-/**
- * @brief RTEMS Task Manager Initialization
- *
- * This routine initializes all Task Manager related data structures.
- */
-void _RTEMS_tasks_Manager_initialization(void);
-
-/**
* @brief RTEMS Task Create
*
* This routine implements the rtems_task_create directive. The task
@@ -555,24 +498,39 @@ rtems_status_code rtems_task_variable_delete(
*/
rtems_id rtems_task_self(void);
+/**@}*/
+
/**
- * @brief RTEMS User Task Initialization
+ * This is the API specific information required by each thread for
+ * the RTEMS API to function correctly.
*
- * This routine creates and starts all configured user
- * initialization threads.
+ * @note Notepads must be the last entry in the structure and memory
+ * will be taken away from this structure when allocated if
+ * notespads are disabled by the application configuration.
*/
-void _RTEMS_tasks_Initialize_user_tasks( void );
+typedef struct {
+ /** This field contains the event control for this task. */
+ Event_Control Event;
+ /** This field contains the system event control for this task. */
+ Event_Control System_event;
+ /** This field contains the Classic API Signal information for this task. */
+ ASR_Information Signal;
+ /**
+ * This field contains the notepads for this task.
+ *
+ * @note MUST BE LAST ENTRY.
+ */
+ uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ];
+} RTEMS_API_Control;
/**
- * @brief RTEMS Tasks Invoke Task Variable Destructor
+ * When the user configures a set of Classic API initialization tasks,
+ * This variable will point to the method used to initialize them.
*
- * This routine invokes the optional user provided destructor on the
- * task variable and frees the memory for the task variable.
+ * @note It is instantiated and initialized by confdefs.h based upon
+ * application requirements.
*/
-void _RTEMS_Tasks_Invoke_task_variable_dtor(
- Thread_Control *the_thread,
- rtems_task_variable_t *tvp
-);
+extern void (*_RTEMS_tasks_Initialize_user_tasks_p)(void);
/**
* @brief _RTEMS_tasks_Initialize_user_tasks_body
@@ -589,18 +547,9 @@ void _RTEMS_Tasks_Invoke_task_variable_dtor(
extern void _RTEMS_tasks_Initialize_user_tasks_body( void );
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/rtems/tasks.inl>
-#endif
-#if defined(RTEMS_MULTIPROCESSING)
-#include <rtems/rtems/taskmp.h>
-#endif
-
#ifdef __cplusplus
}
#endif
-/**@}*/
-
#endif
/* end of include file */
diff --git a/cpukit/rtems/include/rtems/rtems/tasksimpl.h b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
new file mode 100644
index 0000000000..830a82a283
--- /dev/null
+++ b/cpukit/rtems/include/rtems/rtems/tasksimpl.h
@@ -0,0 +1,142 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicTasksImpl
+ *
+ * @brief Classic Tasks Manager Implementation
+ */
+
+/* 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.
+ */
+
+#ifndef _RTEMS_RTEMS_TASKSIMPL_H
+#define _RTEMS_RTEMS_TASKSIMPL_H
+
+#include <rtems/rtems/tasks.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup ClassicTasksImpl Classic Tasks Manager Implementation
+ *
+ * @ingroup ClassicTasks
+ *
+ * @{
+ */
+
+/**
+ * @brief Instantiate RTEMS Classic API Tasks Data
+ *
+ * This constant is defined to extern most of the time when using
+ * this header file. However by defining it to nothing, the data
+ * declared in this header file can be instantiated. This is done
+ * in a single per manager file.
+ */
+#ifndef RTEMS_TASKS_EXTERN
+#define RTEMS_TASKS_EXTERN extern
+#endif
+
+/**
+ * The following instantiates the information control block used to
+ * manage this class of objects.
+ */
+RTEMS_TASKS_EXTERN Objects_Information _RTEMS_tasks_Information;
+
+/**
+ * @brief RTEMS Task Manager Initialization
+ *
+ * This routine initializes all Task Manager related data structures.
+ */
+void _RTEMS_tasks_Manager_initialization(void);
+
+/**
+ * @brief RTEMS User Task Initialization
+ *
+ * This routine creates and starts all configured user
+ * initialization threads.
+ */
+void _RTEMS_tasks_Initialize_user_tasks( void );
+
+/**
+ * @brief RTEMS Tasks Invoke Task Variable Destructor
+ *
+ * This routine invokes the optional user provided destructor on the
+ * task variable and frees the memory for the task variable.
+ */
+void _RTEMS_Tasks_Invoke_task_variable_dtor(
+ Thread_Control *the_thread,
+ rtems_task_variable_t *tvp
+);
+
+/**
+ * @brief Allocates a task control block.
+ *
+ * This function allocates a task control block from
+ * the inactive chain of free task control blocks.
+ */
+RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate( void )
+{
+ return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information );
+}
+
+/**
+ * @brief Frees a task control block.
+ *
+ * This routine frees a task control block to the
+ * inactive chain of free task control blocks.
+ */
+RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free (
+ Thread_Control *the_task
+)
+{
+ _Objects_Free(
+ _Objects_Get_information_id( the_task->Object.id ),
+ &the_task->Object
+ );
+}
+
+/**
+ * @brief Converts an RTEMS API priority into a core priority.
+ *
+ * This function converts an RTEMS API priority into a core priority.
+ */
+RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core(
+ rtems_task_priority priority
+)
+{
+ return (Priority_Control) priority;
+}
+
+/**
+ * @brief Checks whether the priority is a valid user task.
+ *
+ * This function returns TRUE if the_priority is a valid user task priority
+ * and FALSE otherwise.
+ */
+RTEMS_INLINE_ROUTINE bool _RTEMS_tasks_Priority_is_valid (
+ rtems_task_priority the_priority
+)
+{
+ return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
+ ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
+}
+
+/**@}*/
+
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/rtems/taskmp.h>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */