forked from Imagelibrary/rtems
rtems: Create semaphore implementation header
Move implementation specific parts of sem.h and sem.inl into new header file semimpl.h. The sem.h contains now only the application visible API.
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/score/protectedheap.h>
|
||||
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
#ifdef RTEMS_POSIX_API
|
||||
#include <rtems/posix/barrier.h>
|
||||
#include <rtems/posix/cond.h>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
#include <rtems/monitor.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#if defined(RTEMS_POSIX_API)
|
||||
#include <rtems/posix/pthread.h>
|
||||
#endif
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/error.h>
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
|
||||
@@ -33,6 +33,7 @@ include_rtems_rtems_HEADERS += include/rtems/rtems/ratemon.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/region.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/rtemsapi.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/sem.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/semimpl.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/signal.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/smp.h
|
||||
include_rtems_rtems_HEADERS += include/rtems/rtems/status.h
|
||||
@@ -69,7 +70,6 @@ include_rtems_rtems_HEADERS += inline/rtems/rtems/options.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/part.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/ratemon.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/region.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/sem.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/status.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/support.inl
|
||||
include_rtems_rtems_HEADERS += inline/rtems/rtems/tasks.inl
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/**
|
||||
* @file rtems/rtems/sem.h
|
||||
* @file
|
||||
*
|
||||
* @brief Semaphore Manager
|
||||
* @ingroup ClassicSem
|
||||
*
|
||||
* @defgroup ClassicSem Semaphores
|
||||
*
|
||||
* @ingroup ClassicRTEMS
|
||||
* @brief Classic Semaphores API
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Semaphore Manager. This manager utilizes standard Dijkstra
|
||||
@@ -32,25 +30,6 @@
|
||||
#ifndef _RTEMS_RTEMS_SEM_H
|
||||
#define _RTEMS_RTEMS_SEM_H
|
||||
|
||||
/**
|
||||
* @brief Instantiate Semaphore Data
|
||||
*
|
||||
* Semaphore Manager -- Data Instantiation
|
||||
*
|
||||
* 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_SEM_EXTERN
|
||||
#define RTEMS_SEM_EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/support.h>
|
||||
@@ -60,6 +39,10 @@ extern "C" {
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup ClassicSem Semaphores
|
||||
*
|
||||
@@ -108,19 +91,6 @@ typedef struct {
|
||||
} Core_control;
|
||||
} Semaphore_Control;
|
||||
|
||||
/**
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information;
|
||||
|
||||
/**
|
||||
* @brief Semaphore Manager Initialization
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
void _Semaphore_Manager_initialization(void);
|
||||
|
||||
/**
|
||||
* @brief rtems_semaphore_create
|
||||
*
|
||||
@@ -238,46 +208,11 @@ rtems_status_code rtems_semaphore_flush(
|
||||
rtems_id id
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Semaphore Translate Core Mutex Return Code
|
||||
*
|
||||
* This function returns a RTEMS status code based on the mutex
|
||||
* status code specified.
|
||||
*
|
||||
* @param[in] the_mutex_status is the mutex status code to translate
|
||||
*
|
||||
* @retval translated RTEMS status code
|
||||
*/
|
||||
rtems_status_code _Semaphore_Translate_core_mutex_return_code (
|
||||
uint32_t the_mutex_status
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Semaphore Translate Core Semaphore Return Code
|
||||
*
|
||||
* This function returns a RTEMS status code based on the semaphore
|
||||
* status code specified.
|
||||
*
|
||||
* @param[in] the_mutex_status is the semaphore status code to translate
|
||||
*
|
||||
* @retval translated RTEMS status code
|
||||
*/
|
||||
rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
|
||||
uint32_t the_mutex_status
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/sem.inl>
|
||||
#endif
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
#include <rtems/rtems/semmp.h>
|
||||
#endif
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* @file rtems/rtems/sem.inl
|
||||
* @file
|
||||
*
|
||||
* This file contains the static inlin implementation of the inlined
|
||||
* routines from the Semaphore Manager.
|
||||
* @ingroup ClassicSem
|
||||
*
|
||||
* @brief Classic Semaphores Implementation
|
||||
*/
|
||||
|
||||
/* COPYRIGHT (c) 1989-2008.
|
||||
@@ -13,17 +14,70 @@
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_RTEMS_SEM_H
|
||||
# error "Never use <rtems/rtems/sem.inl> directly; include <rtems/rtems/sem.h> instead."
|
||||
#ifndef _RTEMS_RTEMS_SEMIMPL_H
|
||||
#define _RTEMS_RTEMS_SEMIMPL_H
|
||||
|
||||
#include <rtems/rtems/sem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _RTEMS_RTEMS_SEM_INL
|
||||
#define _RTEMS_RTEMS_SEM_INL
|
||||
/**
|
||||
* @brief Instantiate Semaphore Data
|
||||
*
|
||||
* Semaphore Manager -- Data Instantiation
|
||||
*
|
||||
* 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_SEM_EXTERN
|
||||
#define RTEMS_SEM_EXTERN extern
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup ClassicSem
|
||||
* @{
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information;
|
||||
|
||||
/**
|
||||
* @brief Semaphore Manager Initialization
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
void _Semaphore_Manager_initialization(void);
|
||||
|
||||
/**
|
||||
* @brief Semaphore Translate Core Mutex Return Code
|
||||
*
|
||||
* This function returns a RTEMS status code based on the mutex
|
||||
* status code specified.
|
||||
*
|
||||
* @param[in] the_mutex_status is the mutex status code to translate
|
||||
*
|
||||
* @retval translated RTEMS status code
|
||||
*/
|
||||
rtems_status_code _Semaphore_Translate_core_mutex_return_code (
|
||||
uint32_t the_mutex_status
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Semaphore Translate Core Semaphore Return Code
|
||||
*
|
||||
* This function returns a RTEMS status code based on the semaphore
|
||||
* status code specified.
|
||||
*
|
||||
* @param[in] the_mutex_status is the semaphore status code to translate
|
||||
*
|
||||
* @retval translated RTEMS status code
|
||||
*/
|
||||
rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
|
||||
uint32_t the_mutex_status
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Allocates a semaphore control block from
|
||||
@@ -92,7 +146,13 @@ RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get_interrupt_disable (
|
||||
_Objects_Get_isr_disable( &_Semaphore_Information, id, location, level );
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_MULTIPROCESSING
|
||||
#include <rtems/rtems/semmp.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -21,17 +21,14 @@
|
||||
#ifndef _RTEMS_RTEMS_SEMMP_H
|
||||
#define _RTEMS_RTEMS_SEMMP_H
|
||||
|
||||
#ifndef _RTEMS_RTEMS_SEMIMPL_H
|
||||
# error "Never use <rtems/rtems/semmp.h> directly; include <rtems/rtems/semimpl.h> instead."
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/**
|
||||
* @defgroup ClassicSEM Semaphore MP Support
|
||||
*
|
||||
|
||||
@@ -103,6 +103,10 @@ $(PROJECT_INCLUDE)/rtems/rtems/sem.h: include/rtems/rtems/sem.h $(PROJECT_INCLUD
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/sem.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/sem.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/rtems/semimpl.h: include/rtems/rtems/semimpl.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/semimpl.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/semimpl.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/rtems/signal.h: include/rtems/rtems/signal.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/signal.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/signal.h
|
||||
@@ -136,7 +140,6 @@ $(PROJECT_INCLUDE)/rtems/rtems/atomic.h: include/rtems/rtems/atomic.h $(PROJECT_
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/atomic.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/atomic.h
|
||||
endif
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/rtems/mainpage.h: mainpage.h $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/mainpage.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/mainpage.h
|
||||
@@ -222,10 +225,6 @@ $(PROJECT_INCLUDE)/rtems/rtems/region.inl: inline/rtems/rtems/region.inl $(PROJE
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/region.inl
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/region.inl
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/rtems/sem.inl: inline/rtems/rtems/sem.inl $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/sem.inl
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/sem.inl
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/rtems/status.inl: inline/rtems/rtems/status.inl $(PROJECT_INCLUDE)/rtems/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems/status.inl
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems/status.inl
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -21,5 +21,4 @@
|
||||
/* instantiate semaphore data */
|
||||
#define RTEMS_SEM_EXTERN
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/rtems/support.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/states.h>
|
||||
|
||||
@@ -43,7 +43,6 @@ extern "C" {
|
||||
#include <rtems/rtems/part.h>
|
||||
#include <rtems/rtems/ratemon.h>
|
||||
#include <rtems/rtems/region.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/signal.h>
|
||||
#include <rtems/rtems/timer.h>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <rtems/rtems/part.h>
|
||||
#include <rtems/rtems/ratemon.h>
|
||||
#include <rtems/rtems/region.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/rtems/signal.h>
|
||||
#include <rtems/rtems/timer.h>
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
|
||||
#include <tmacros.h>
|
||||
#include <intrcritical.h>
|
||||
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
/* forward declarations to avoid warnings */
|
||||
rtems_task Init(rtems_task_argument argument);
|
||||
rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <tmacros.h>
|
||||
#include <intrcritical.h>
|
||||
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
static rtems_id Semaphore;
|
||||
static bool case_hit;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <tmacros.h>
|
||||
#include <intrcritical.h>
|
||||
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
/* forward declarations to avoid warnings */
|
||||
rtems_task Init(rtems_task_argument argument);
|
||||
rtems_timer_service_routine test_release_from_isr(rtems_id timer, void *arg);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <rtems/score/priority.h>
|
||||
#include <rtems/rtems/ratemon.h>
|
||||
#include <rtems/rtems/region.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
#include <rtems/rtems/signal.h>
|
||||
#include <rtems/score/scheduler.h>
|
||||
#include <rtems/score/sysstate.h>
|
||||
@@ -355,7 +355,7 @@ uninitialized =
|
||||
|
||||
/*scheduler.h*/ SCHEDULER_OVHD +
|
||||
|
||||
/*sem.h*/ (sizeof _Semaphore_Information) +
|
||||
/*semimpl.h*/ (sizeof _Semaphore_Information) +
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
/*semmp.h*/ 0 +
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <tmacros.h>
|
||||
#include <timesys.h>
|
||||
|
||||
#include <rtems/rtems/semimpl.h>
|
||||
|
||||
/* TEST DATA */
|
||||
rtems_id Semaphore_id;
|
||||
|
||||
Reference in New Issue
Block a user