From ed8b00e667fe179730beb8947b5afb6bcc234d7a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 14 Dec 2015 15:02:45 +0100 Subject: 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(-) delete mode 100644 cpukit/rtems/src/msgdata.c diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am index 6c87b94a75..2fd8ecb1a2 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 2399d65f29..3c904f0f8c 100644 --- a/cpukit/rtems/include/rtems/rtems/messageimpl.h +++ b/cpukit/rtems/include/rtems/rtems/messageimpl.h @@ -32,16 +32,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 @@ -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 8dd046da1b..acb6c37601 100644 --- a/cpukit/rtems/src/msg.c +++ b/cpukit/rtems/src/msg.c @@ -20,18 +20,16 @@ #include #include -#include -#include -#include -#include -#include +#include #include #include #include #include #include -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 448f2466b4..0000000000 --- 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 -#include - diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c index 3a6005a6c0..e66643ca8a 100644 --- a/cpukit/sapi/src/rtemsapi.c +++ b/cpukit/sapi/src/rtemsapi.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -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 a5013e2a65..56b6c3b9a1 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 00eae4bbdc..753218edf5 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -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 -- cgit v1.2.3