/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipcom_spinlock.h,v $ $Revision: 1.7.10.1 $ * $Source: /home/interpeak/CVSRoot/ipcom/include/ipcom_spinlock.h,v $ * $Author: kenneth $ $Date: 2012-05-02 12:51:52 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Kenneth Jonsson ****************************************************************************** */ #ifndef IPCOM_SPINLOCK_H #define IPCOM_SPINLOCK_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* DESCRIPTION API for IPCOM spinlocks */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipcom_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipcom_os.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* *=========================================================================== * SPINLOCK INVALID *=========================================================================== */ #define IPCOM_SPINLOCK_INVALID IP_NULL /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* Spinlock types */ typedef void * Ipcom_spinlock; /* **************************************************************************** * 6 PUBLIC FUNCTIONS **************************************************************************** */ /******************************************************************************* * * ipcom_spinlock_create - create a spinlock * * This routine creates a new unlocked spinlock. * * Parameters: * \is * \i * Pointer to a location to store the spinlock handle in. * \ie * * RETURNS: 'IPCOM_SUCCESS', or an error value defined in 'include/ipcom_err.h'. * * ERRNO: \&'IPCOM_ERR_FAILED' */ IP_PUBLIC Ip_err ipcom_spinlock_create ( Ipcom_spinlock *sl ); #if defined(IPCOM_USE_DMALLOC) && defined(IP_PORT_UNIX) IP_PUBLIC Ip_err ipcom_dspinlock_create(Ipcom_spinlock *sl, const char *file, Ip_u32 line); #define ipcom_spinlock_create(sl) \ ipcom_dspinlock_create(sl, __FILE__, __LINE__) #endif /******************************************************************************* * * ipcom_spinlock_delete - delete a spinlock * * This routine deletes a spinlock. * * Parameter: * \is * \i * Pointer to spinlock handle. * \ie * * RETURNS: 'IPCOM_SUCCESS', or an error value defined in 'include/ipcom_err.h'. * * ERRNO: \&'IPCOM_ERR_FAILED' */ IP_PUBLIC Ip_err ipcom_spinlock_delete ( Ipcom_spinlock *sl ); /******************************************************************************* * * ipcom_spinlock_lock - grab the spinlock. * * This routine will lock the task-only spinlock . * Such spinlocks may be held locked across calls VxWorks kernel functions * unlike the ISR-allowed spinlocks. * * Parameter: * \is * \i * Pointer to spinlock handle. * \ie * * RETURNS: \&N/A. * * ERRNO: None. */ IP_FASTTEXT IP_PUBLIC void ipcom_spinlock_lock ( Ipcom_spinlock *sl ); /******************************************************************************* * * ipcom_spinlock_unlock - release the spinlock * * This routine releases a spinlock grabbed with ipcom_spinlock_lock(). * * Parameter: * \is * \i * Pointer to spinlock handle. * \i * * RETURNS: \&N/A. * * ERRNO: None. */ IP_FASTTEXT IP_PUBLIC void ipcom_spinlock_unlock ( Ipcom_spinlock *sl ); #ifdef __cplusplus } #endif #endif /* IPCOM_SPINLOCK_H */ /* **************************************************************************** * END OF FILE **************************************************************************** */