Optional Classic Barrier initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2015-12-14 15:27:56 +01:00
parent b377e3f6b7
commit 97d94ff3e9
7 changed files with 29 additions and 52 deletions

View File

@@ -141,7 +141,6 @@ librtems_a_SOURCES += src/barrierident.c
librtems_a_SOURCES += src/barriertranslatereturncode.c
librtems_a_SOURCES += src/barrierrelease.c
librtems_a_SOURCES += src/barrierwait.c
librtems_a_SOURCES += src/barrierdata.c
## CLOCK_C_FILES
librtems_a_SOURCES += src/clockget.c

View File

@@ -38,32 +38,11 @@ extern "C" {
* @{
*/
/**
* @brief Instantiate Barrier Data
*
* Barrier Manager -- Instantiate 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_BARRIER_EXTERN
#define RTEMS_BARRIER_EXTERN extern
#endif
/**
* The following defines the information control block used to manage
* this class of objects.
*/
RTEMS_BARRIER_EXTERN Objects_Information _Barrier_Information;
/**
* @brief _Barrier_Manager_initialization
*
* This routine performs the initialization necessary for this manager.
*/
void _Barrier_Manager_initialization(void);
extern Objects_Information _Barrier_Information;
/**
* @brief _Barrier_Allocate

View File

@@ -20,14 +20,17 @@
#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/sysinit.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/support.h>
#include <rtems/rtems/barrierimpl.h>
Objects_Information _Barrier_Information;
/**
* @brief _Barrier_Manager_initialization
*/
void _Barrier_Manager_initialization(void)
static void _Barrier_Manager_initialization(void)
{
_Objects_Initialize_information(
&_Barrier_Information, /* object information table */
@@ -45,3 +48,9 @@ void _Barrier_Manager_initialization(void)
#endif
);
}
RTEMS_SYSINIT_ITEM(
_Barrier_Manager_initialization,
RTEMS_SYSINIT_CLASSIC_BARRIER,
RTEMS_SYSINIT_ORDER_MIDDLE
);

View File

@@ -1,26 +0,0 @@
/**
* @file
*
* @brief Instantiate Barrier Data
* @ingroup ClassicBarrier Barriers
*/
/*
* 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
/* instantiate barrier data */
#define RTEMS_BARRIER_EXTERN
#include <rtems/system.h>
#include <rtems/rtems/barrierimpl.h>

View File

@@ -26,10 +26,8 @@
#include <rtems/rtems/rtemsapi.h>
#include <rtems/rtems/intr.h>
#include <rtems/rtems/barrierimpl.h>
#include <rtems/rtems/clock.h>
void _RTEMS_API_Initialize(void)
{
_Barrier_Manager_initialization();
}

View File

@@ -41,6 +41,7 @@ extern "C" {
#define RTEMS_SYSINIT_CLASSIC_REGION 000347
#define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 000348
#define RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC 000349
#define RTEMS_SYSINIT_CLASSIC_BARRIER 00034a
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_BSP_LIBC 000400
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500

View File

@@ -25,6 +25,7 @@
#include <rtems/test.h>
#include <rtems/extensionimpl.h>
#include <rtems/rtems/barrierimpl.h>
#include <rtems/rtems/dpmemimpl.h>
#include <rtems/rtems/messageimpl.h>
#include <rtems/rtems/partimpl.h>
@@ -71,6 +72,8 @@ typedef enum {
CLASSIC_DUAL_PORTED_MEMORY_POST,
CLASSIC_RATE_MONOTONIC_PRE,
CLASSIC_RATE_MONOTONIC_POST,
CLASSIC_BARRIER_PRE,
CLASSIC_BARRIER_POST,
IDLE_THREADS_PRE,
IDLE_THREADS_POST,
BSP_LIBC_PRE,
@@ -294,6 +297,18 @@ LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC)
next_step(CLASSIC_RATE_MONOTONIC_POST);
}
FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER)
{
assert(_Barrier_Information.maximum == 0);
next_step(CLASSIC_BARRIER_PRE);
}
LAST(RTEMS_SYSINIT_CLASSIC_BARRIER)
{
assert(_Barrier_Information.maximum != 0);
next_step(CLASSIC_BARRIER_POST);
}
FIRST(RTEMS_SYSINIT_IDLE_THREADS)
{
assert(_System_state_Is_before_initialization(_System_state_Get()));
@@ -379,6 +394,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MAXIMUM_BARRIERS 1
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
#define CONFIGURE_MAXIMUM_PARTITIONS 1