Darwin-Streaming-Server/AtomicLib
Darren VanBuren 849723c9cf Add even more of the source
This should be about everything needed to build so far?
2017-03-07 17:14:16 -08:00
..
atomic.h Add even more of the source 2017-03-07 17:14:16 -08:00
atomic_subr.s Add even more of the source 2017-03-07 17:14:16 -08:00
hmi.c Add even more of the source 2017-03-07 17:14:16 -08:00
README Add even more of the source 2017-03-07 17:14:16 -08:00
timescale.c Add even more of the source 2017-03-07 17:14:16 -08:00
timestamp.h Add even more of the source 2017-03-07 17:14:16 -08:00
timestamp.s Add even more of the source 2017-03-07 17:14:16 -08:00

/* --- Version 4.0 --- 12-Feb-1999 --- */
/*
 * Include the following routines :
 *		atomic_or()
 *		scaledtimestamp()
 *
 *	Updated the copyright.
 */

/*
 *	unsigned int atomic_or(unsigned int *area, unsigned int mask)
 *
 *		Atomically or the mask into *area.
 *		Returns the old value.
 */
/*
 *	long long scaledtimestamp(double scale)
 *
 *		Read the PPC timebase. Convert the time base value based on
 *		scale.
 *
 *		Caveat: scale can not be 0, NaN, Inf. It's upto the caller
 *				to validate scale before calling this.
 */

/* --- Version 3.0 --- 23-Oct-1998 --- */
/*
 * Made the headers c++ friendly
 * Build a static library with dynamic code generation.
 * If you make a copy of the libatomic.a do not forget to run "ranlib".
 */

/* --- Version 2.0 --- 23-Oct-1998 --- */
/*
 * Added routines described in timestamp.h
 * Test program for these is in hmi.c
 */

/* --- Version 1.0 --- 12-Oct-1998 --- */
/*
 *	void spin_lock_init(spin_lock_t)
 *
 *		Initialize a spin lock.
 *		These locks should be cache aligned and a multiple of cache size.
 */

/*
 *	void spin_lock_unlock(spin_lock_t)
 *
 *		Unconditionally release lock.
 */

/*
 *	unsigned int spin_lock_lock(spin_lock_t)
 *
 *		Try to acquire spin-lock. Return success (1).
 */

/*
 *	unsigned int spin_lock_bit(spin_lock_t, unsigned int bits)
 *
 *		Try to acquire spin-lock. The second parameter is the bit mask to 
 *		test and set. multiple bits may be set.
 *		Return success (1).
 */

/*
 *	unsigned int spin_unlock_bit(spin_lock_t, unsigned int bits)
 *
 *		Release bit based spin-lock. The second parameter is the bit mask to 
 *		clear. Multiple bits may be cleared.
 */

/*
 *	unsigned int spin_lock_try(spin_lock_t)
 *
 *		Try to acquire spin-lock. Return success (1) or failure (0).
 */

/*
 *	unsigned int spin_lock_held(spin_lock_t)
 *
 *      Return 1 if lock is held
 *      N.B.  Racy, of course.
 */

/*
 *	unsigned int compare_and_store(unsigned int oval,
 *									unsigned int nval, unsigned int *area)
 *
 *		Compare oval to area if equal, store nval, and return true
 *		else return false and no store
 *		This is an atomic operation
 */

/*
 *	unsigned int atomic_add(unsigned int *area, int val)
 *
 *		Atomically add the second parameter to the first.
 *		Returns the result.
 */

/*
 *	unsigned int atomic_sub(unsigned int *area, int val)
 *
 *		Atomically subtract the second parameter from the first.
 *		Returns the result.
 */

/*
 *	void queue_atomic(unsigned int * anchor,
 *						unsigned int * elem, unsigned int disp)
 *
 *		Atomically inserts the element at the head of the list
 *		anchor is the pointer to the first element
 *		element is the pointer to the element to insert
 *		disp is the displacement into the element to the chain pointer
 */

/*
 *	void queue_atomic_list(unsigned int * anchor,
 *							unsigned int * first, unsigned int * last,
 *							unsigned int disp)
 *
 *		Atomically inserts the list of elements at the head of the list
 *		anchor is the pointer to the first element
 *		first is the pointer to the first element to insert
 *		last is the pointer to the last element to insert
 *		disp is the displacement into the element to the chain pointer
 */

/*
 *	unsigned int *dequeue_atomic(unsigned int *anchor, unsigned int disp)
 *
 *		Atomically removes the first element in a list and returns it.
 *		anchor is the pointer to the first element
 *		disp is the displacement into the element to the chain pointer
 *		Returns element if found, 0 if empty.
 */