forked from Imagelibrary/rtems
score: Delete _CORE_semaphore_Seize()
Rename _CORE_semaphore_Seize_isr_disable() to _CORE_semaphore_Seize().
This commit is contained in:
@@ -40,8 +40,13 @@ int _POSIX_Semaphore_Wait_support(
|
||||
POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
Thread_Control *executing;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
the_semaphore = _POSIX_Semaphore_Get_interrupt_disable(
|
||||
sem,
|
||||
&location,
|
||||
&lock_context
|
||||
);
|
||||
switch ( location ) {
|
||||
|
||||
case OBJECTS_LOCAL:
|
||||
@@ -51,9 +56,9 @@ int _POSIX_Semaphore_Wait_support(
|
||||
executing,
|
||||
the_semaphore->Object.id,
|
||||
blocking,
|
||||
timeout
|
||||
timeout,
|
||||
&lock_context
|
||||
);
|
||||
_Objects_Put( &the_semaphore->Object );
|
||||
|
||||
if ( !executing->Wait.return_code )
|
||||
return 0;
|
||||
|
||||
@@ -93,7 +93,7 @@ rtems_status_code rtems_semaphore_obtain(
|
||||
}
|
||||
|
||||
/* must be a counting semaphore */
|
||||
_CORE_semaphore_Seize_isr_disable(
|
||||
_CORE_semaphore_Seize(
|
||||
&the_semaphore->Core_control.semaphore,
|
||||
executing,
|
||||
id,
|
||||
|
||||
@@ -177,7 +177,7 @@ libscore_a_SOURCES += src/corerwlock.c src/corerwlockobtainread.c \
|
||||
endif
|
||||
|
||||
## CORE_SEMAPHORE_C_FILES
|
||||
libscore_a_SOURCES += src/coresem.c src/coresemflush.c src/coresemseize.c \
|
||||
libscore_a_SOURCES += src/coresem.c src/coresemflush.c \
|
||||
src/coresemsurrender.c
|
||||
|
||||
## CORE_SPINLOCK_C_FILES
|
||||
|
||||
@@ -33,10 +33,6 @@ extern "C" {
|
||||
*/
|
||||
/**@{**/
|
||||
|
||||
#if defined(RTEMS_POSIX_API) || defined(RTEMS_MULTIPROCESSING)
|
||||
#define RTEMS_SCORE_CORESEM_ENABLE_SEIZE_BODY
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Core Semaphore handler return statuses.
|
||||
*/
|
||||
@@ -105,30 +101,6 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
|
||||
_Thread_queue_Destroy( &the_semaphore->Wait_queue );
|
||||
}
|
||||
|
||||
#if defined(RTEMS_SCORE_CORESEM_ENABLE_SEIZE_BODY)
|
||||
/**
|
||||
* This routine attempts to receive a unit from @a the_semaphore.
|
||||
* If a unit is available or if the wait flag is false, then the routine
|
||||
* returns. Otherwise, the calling task is blocked until a unit becomes
|
||||
* available.
|
||||
*
|
||||
* @param[in] the_semaphore is the semaphore to seize
|
||||
* @param[in,out] executing The currently executing thread.
|
||||
* @param[in] id is the Id of the API level Semaphore object associated
|
||||
* with this instance of a SuperCore Semaphore
|
||||
* @param[in] wait indicates if the caller is willing to block
|
||||
* @param[in] timeout is the number of ticks the calling thread is willing
|
||||
* to wait if @a wait is true.
|
||||
*/
|
||||
void _CORE_semaphore_Seize(
|
||||
CORE_semaphore_Control *the_semaphore,
|
||||
Thread_Control *executing,
|
||||
Objects_Id id,
|
||||
bool wait,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Surrender a unit to a semaphore.
|
||||
*
|
||||
@@ -219,7 +191,7 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count(
|
||||
*
|
||||
* @note There is currently no MACRO version of this routine.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
|
||||
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(
|
||||
CORE_semaphore_Control *the_semaphore,
|
||||
Thread_Control *executing,
|
||||
Objects_Id id,
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Core Semaphore Seize
|
||||
*
|
||||
* @ingroup ScoreSemaphore
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/coresemimpl.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
#if defined(RTEMS_SCORE_CORESEM_ENABLE_SEIZE_BODY)
|
||||
|
||||
void _CORE_semaphore_Seize(
|
||||
CORE_semaphore_Control *the_semaphore,
|
||||
Thread_Control *executing,
|
||||
Objects_Id id,
|
||||
bool wait,
|
||||
Watchdog_Interval timeout
|
||||
)
|
||||
{
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
|
||||
_Thread_queue_Acquire( &the_semaphore->Wait_queue, &lock_context );
|
||||
if ( the_semaphore->count != 0 ) {
|
||||
the_semaphore->count -= 1;
|
||||
_Thread_queue_Release( &the_semaphore->Wait_queue, &lock_context );
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the semaphore was not available and the caller was not willing
|
||||
* to block, then return immediately with a status indicating that
|
||||
* the semaphore was not available and the caller never blocked.
|
||||
*/
|
||||
if ( !wait ) {
|
||||
_Thread_queue_Release( &the_semaphore->Wait_queue, &lock_context );
|
||||
executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the semaphore is not available and the caller is willing to
|
||||
* block, then we now block the caller with optional timeout.
|
||||
*/
|
||||
executing->Wait.id = id;
|
||||
_Thread_queue_Enqueue_critical(
|
||||
&the_semaphore->Wait_queue,
|
||||
executing,
|
||||
STATES_WAITING_FOR_SEMAPHORE,
|
||||
timeout,
|
||||
CORE_SEMAPHORE_TIMEOUT,
|
||||
&lock_context
|
||||
);
|
||||
}
|
||||
#endif
|
||||
@@ -283,6 +283,7 @@ Thread _MPCI_Receive_server(
|
||||
MP_packet_Prefix *the_packet;
|
||||
MPCI_Packet_processor the_function;
|
||||
Thread_Control *executing;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
executing = _Thread_Get_executing();
|
||||
|
||||
@@ -290,15 +291,15 @@ Thread _MPCI_Receive_server(
|
||||
|
||||
executing->receive_packet = NULL;
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
_ISR_lock_ISR_disable( &lock_context );
|
||||
_CORE_semaphore_Seize(
|
||||
&_MPCI_Semaphore,
|
||||
executing,
|
||||
0,
|
||||
true,
|
||||
WATCHDOG_NO_TIMEOUT
|
||||
WATCHDOG_NO_TIMEOUT,
|
||||
&lock_context
|
||||
);
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
for ( ; ; ) {
|
||||
the_packet = _MPCI_Receive_packet();
|
||||
|
||||
Reference in New Issue
Block a user