[rtems commit] Optional Classic Message Queue initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:31:02 UTC 2016


Module:    rtems
Branch:    master
Commit:    ed8b00e667fe179730beb8947b5afb6bcc234d7a
Changeset: http://git.rtems.org/rtems/commit/?id=ed8b00e667fe179730beb8947b5afb6bcc234d7a

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Dec 14 15:02:45 2015 +0100

Optional Classic Message Queue initialization

Update #2408.

---

 cpukit/rtems/Makefile.am                       |  1 -
 cpukit/rtems/include/rtems/rtems/messageimpl.h | 19 +------------------
 cpukit/rtems/src/msg.c                         | 16 ++++++++++------
 cpukit/rtems/src/msgdata.c                     | 25 -------------------------
 cpukit/sapi/src/rtemsapi.c                     |  2 --
 cpukit/score/include/rtems/sysinit.h           |  1 +
 testsuites/sptests/spsysinit01/init.c          | 17 +++++++++++++++++
 7 files changed, 29 insertions(+), 52 deletions(-)

diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 6c87b94..2fd8ecb 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -184,7 +184,6 @@ librtems_a_SOURCES += src/msgqreceive.c
 librtems_a_SOURCES += src/msgqsend.c
 librtems_a_SOURCES += src/msgqtranslatereturncode.c
 librtems_a_SOURCES += src/msgqurgent.c
-librtems_a_SOURCES += src/msgdata.c
 
 ## SEMAPHORE_C_FILES
 librtems_a_SOURCES += src/sem.c
diff --git a/cpukit/rtems/include/rtems/rtems/messageimpl.h b/cpukit/rtems/include/rtems/rtems/messageimpl.h
index 2399d65..3c904f0 100644
--- a/cpukit/rtems/include/rtems/rtems/messageimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/messageimpl.h
@@ -33,16 +33,6 @@ extern "C" {
  */
 
 /**
- *  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_MESSAGE_EXTERN
-#define RTEMS_MESSAGE_EXTERN extern
-#endif
-
-/**
  *  The following enumerated type details the modes in which a message
  *  may be submitted to a message queue.  The message may be posted
  *  in a send or urgent fashion.
@@ -64,14 +54,7 @@ typedef enum {
  *  The following defines the information control block used to
  *  manage this class of objects.
  */
-RTEMS_MESSAGE_EXTERN Objects_Information  _Message_queue_Information;
-
-/**
- *  @brief Message Queue Manager Initialization
- *
- *  This routine performs the initialization necessary for this manager.
- */
-void _Message_queue_Manager_initialization(void);
+extern Objects_Information _Message_queue_Information;
 
 /**
  *  @brief Message_queue_Submit
diff --git a/cpukit/rtems/src/msg.c b/cpukit/rtems/src/msg.c
index 8dd046d..acb6c37 100644
--- a/cpukit/rtems/src/msg.c
+++ b/cpukit/rtems/src/msg.c
@@ -20,18 +20,16 @@
 
 #include <rtems/system.h>
 #include <rtems/config.h>
-#include <rtems/score/chain.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/coremsgimpl.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
+#include <rtems/sysinit.h>
 #include <rtems/rtems/status.h>
 #include <rtems/rtems/attrimpl.h>
 #include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/options.h>
 #include <rtems/rtems/support.h>
 
-void _Message_queue_Manager_initialization(void)
+Objects_Information _Message_queue_Information;
+
+static void _Message_queue_Manager_initialization(void)
 {
   _Objects_Initialize_information(
     &_Message_queue_Information,  /* object information table */
@@ -63,3 +61,9 @@ void _Message_queue_Manager_initialization(void)
 #endif
 
 }
+
+RTEMS_SYSINIT_ITEM(
+  _Message_queue_Manager_initialization,
+  RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
diff --git a/cpukit/rtems/src/msgdata.c b/cpukit/rtems/src/msgdata.c
deleted file mode 100644
index 448f246..0000000
--- a/cpukit/rtems/src/msgdata.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- *  @file
- *
- *  @brief Instantiate the Message Queue Data
- *  @ingroup ClassicMessageQueue
- */
-
-/*
- *  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.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define RTEMS_MESSAGE_EXTERN
-
-#include <rtems/system.h>
-#include <rtems/rtems/messageimpl.h>
-
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
index 3a6005a..e66643c 100644
--- a/cpukit/sapi/src/rtemsapi.c
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -29,7 +29,6 @@
 #include <rtems/rtems/barrierimpl.h>
 #include <rtems/rtems/clock.h>
 #include <rtems/rtems/dpmemimpl.h>
-#include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/partimpl.h>
 #include <rtems/rtems/ratemonimpl.h>
 #include <rtems/rtems/regionimpl.h>
@@ -37,7 +36,6 @@
 
 void _RTEMS_API_Initialize(void)
 {
-  _Message_queue_Manager_initialization();
   _Semaphore_Manager_initialization();
   _Partition_Manager_initialization();
   _Region_Manager_initialization();
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index a5013e2..56b6c3b 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -35,6 +35,7 @@ extern "C" {
 #define RTEMS_SYSINIT_CLASSIC_TIMER              000341
 #define RTEMS_SYSINIT_CLASSIC_SIGNAL             000342
 #define RTEMS_SYSINIT_CLASSIC_EVENT              000343
+#define RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE      000344
 #define RTEMS_SYSINIT_IDLE_THREADS               000380
 #define RTEMS_SYSINIT_BSP_LIBC                   000400
 #define RTEMS_SYSINIT_BEFORE_DRIVERS             000500
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 00eae4b..753218e 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -25,6 +25,7 @@
 #include <rtems/test.h>
 
 #include <rtems/extensionimpl.h>
+#include <rtems/rtems/messageimpl.h>
 #include <rtems/rtems/tasksimpl.h>
 #include <rtems/rtems/timerimpl.h>
 #include <rtems/score/apimutex.h>
@@ -53,6 +54,8 @@ typedef enum {
   CLASSIC_SIGNAL_POST,
   CLASSIC_EVENT_PRE,
   CLASSIC_EVENT_POST,
+  CLASSIC_MESSAGE_QUEUE_PRE,
+  CLASSIC_MESSAGE_QUEUE_POST,
   IDLE_THREADS_PRE,
   IDLE_THREADS_POST,
   BSP_LIBC_PRE,
@@ -204,6 +207,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_EVENT)
   next_step(CLASSIC_EVENT_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
+{
+  assert(_Message_queue_Information.maximum == 0);
+  next_step(CLASSIC_MESSAGE_QUEUE_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE)
+{
+  assert(_Message_queue_Information.maximum != 0);
+  next_step(CLASSIC_MESSAGE_QUEUE_POST);
+}
+
 FIRST(RTEMS_SYSINIT_IDLE_THREADS)
 {
   assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -289,6 +304,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
 
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+
 #define CONFIGURE_MAXIMUM_TASKS 1
 
 #define CONFIGURE_MAXIMUM_TIMERS 1



More information about the vc mailing list