diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-19 15:24:04 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:57:24 +0200 |
commit | c71b596c4eb708716fb45950876a00f8ce6f4156 (patch) | |
tree | d574b5c656ad8f310817c74273aef83c03e9187a /cpukit/score/include/rtems/score/corespinlock.h | |
parent | posix: Create spinlock implementation header (diff) | |
download | rtems-c71b596c4eb708716fb45950876a00f8ce6f4156.tar.bz2 |
score: Create spinlock implementation header
Move implementation specific parts of corespinlock.h and
corespinlock.inl into new header file corespinlockimpl.h. The
corespinlock.h contains now only the application visible API.
Diffstat (limited to 'cpukit/score/include/rtems/score/corespinlock.h')
-rw-r--r-- | cpukit/score/include/rtems/score/corespinlock.h | 106 |
1 files changed, 7 insertions, 99 deletions
diff --git a/cpukit/score/include/rtems/score/corespinlock.h b/cpukit/score/include/rtems/score/corespinlock.h index 5a5b68168a..2c91e835df 100644 --- a/cpukit/score/include/rtems/score/corespinlock.h +++ b/cpukit/score/include/rtems/score/corespinlock.h @@ -19,6 +19,12 @@ #ifndef _RTEMS_SCORE_CORESPINLOCK_H #define _RTEMS_SCORE_CORESPINLOCK_H +#include <rtems/score/object.h> + +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup ScoreSpinlock Spinlock Handler * @@ -29,54 +35,6 @@ */ /**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/thread.h> -#include <rtems/score/priority.h> - -/** - * Core Spinlock handler return statuses. - */ -typedef enum { - /** This status indicates that the operation completed successfully. */ - CORE_SPINLOCK_SUCCESSFUL, - /** This status indicates that the current thread already holds the spinlock. - * An attempt to relock it will result in deadlock. - */ - CORE_SPINLOCK_HOLDER_RELOCKING, - /** This status indicates that the current thread is attempting to unlock a - * spinlock that is held by another thread. - */ - CORE_SPINLOCK_NOT_HOLDER, - /** This status indicates that a thread reached the limit of time it - * was willing to wait on the spin lock. - */ - CORE_SPINLOCK_TIMEOUT, - /** This status indicates that a thread is currently waiting for this - * spin lock. - */ - CORE_SPINLOCK_IS_BUSY, - /** This status indicates that the spinlock is currently locked and thus - * unavailable. - */ - CORE_SPINLOCK_UNAVAILABLE, - /** This status indicates that the spinlock is not currently locked and thus - * should not be released. - */ - CORE_SPINLOCK_NOT_LOCKED -} CORE_spinlock_Status; - -/** This is a shorthand for the last status code. */ -#define CORE_SPINLOCK_STATUS_LAST CORE_SPINLOCK_NOT_LOCKED - -/** This indicates the lock is available. */ -#define CORE_SPINLOCK_UNLOCKED 0 - -/** This indicates the lock is unavailable. */ -#define CORE_SPINLOCK_LOCKED 1 - /** * The following defines the control block used to manage the * attributes of each spinlock. @@ -111,61 +69,11 @@ typedef struct { volatile Objects_Id holder; } CORE_spinlock_Control; -/** - * @brief Initialize the spinlock. - * - * This routine initializes the spinlock based on the parameters passed. - * - * @param[in] the_spinlock is the spinlock control block to initialize - * @param[in] the_spinlock_attributes define the behavior of this instance - */ -void _CORE_spinlock_Initialize( - CORE_spinlock_Control *the_spinlock, - CORE_spinlock_Attributes *the_spinlock_attributes -); - -/** - * @brief Wait for spinlock. - * - * This routine wait for the spinlock to be released. If the spinlock - * is set to automatic and this is the appropriate thread, then it returns - * immediately. Otherwise, the calling thread is blocked until the spinlock - * is released. - * - * @param[in] the_spinlock is the spinlock to wait for - * @param[in] wait is true if willing to wait - * @param[in] timeout is the maximum number of ticks to spin (0 is forever) - * - * @retval A status is returned which indicates the success or failure of - * this operation. - */ -CORE_spinlock_Status _CORE_spinlock_Wait( - CORE_spinlock_Control *the_spinlock, - bool wait, - Watchdog_Interval timeout -); - -/** - * @brief Manually release the spinlock. - * - * This routine manually releases the spinlock. All of the threads waiting - * for the spinlock will be readied. - * - * @param[in] the_spinlock is the spinlock to surrender - */ -CORE_spinlock_Status _CORE_spinlock_Release( - CORE_spinlock_Control *the_spinlock -); - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/score/corespinlock.inl> -#endif +/**@}*/ #ifdef __cplusplus } #endif -/**@}*/ - #endif /* end of include file */ |