Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:19

0001 /*
0002 
0003 Copyright 1991, 1993, 1994, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 */
0026 
0027 /***********************************************************
0028 Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
0029 and Olivetti Research Limited, Cambridge, England.
0030 
0031                         All Rights Reserved
0032 
0033 Permission to use, copy, modify, and distribute this software and its
0034 documentation for any purpose and without fee is hereby granted,
0035 provided that the above copyright notice appear in all copies and that
0036 both that copyright notice and this permission notice appear in
0037 supporting documentation, and that the names of Digital or Olivetti
0038 not be used in advertising or publicity pertaining to distribution of the
0039 software without specific, written prior permission.
0040 
0041 DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
0042 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
0043 FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0044 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
0045 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
0046 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0047 PERFORMANCE OF THIS SOFTWARE.
0048 
0049 ******************************************************************/
0050 
0051 #ifndef _SYNCCONST_H_
0052 #define _SYNCCONST_H_
0053 
0054 #define SYNC_NAME "SYNC"
0055 
0056 #define SYNC_MAJOR_VERSION  3
0057 #define SYNC_MINOR_VERSION  1
0058 
0059 
0060 #define XSyncCounterNotify              0
0061 #define XSyncAlarmNotify        1
0062 #define XSyncAlarmNotifyMask        (1L << XSyncAlarmNotify)
0063 
0064 #define XSyncNumberEvents       2L
0065 
0066 #define XSyncBadCounter         0L
0067 #define XSyncBadAlarm           1L
0068 #define XSyncBadFence           2L
0069 #define XSyncNumberErrors       (XSyncBadFence + 1)
0070 
0071 /*
0072  * Flags for Alarm Attributes
0073  */
0074 #define XSyncCACounter          (1L<<0)
0075 #define XSyncCAValueType        (1L<<1)
0076 #define XSyncCAValue            (1L<<2)
0077 #define XSyncCATestType         (1L<<3)
0078 #define XSyncCADelta            (1L<<4)
0079 #define XSyncCAEvents           (1L<<5)
0080 
0081 /*  The _XSync macros below are for library internal use only.  They exist
0082  *  so that if we have to make a fix, we can change it in this one place
0083  *  and have both the macro and function variants inherit the fix.
0084  */
0085 
0086 #define _XSyncIntToValue(pv, i)     ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i))
0087 #define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h))
0088 #define _XSyncValueGreaterThan(a, b)\
0089     ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo))
0090 #define _XSyncValueLessThan(a, b)\
0091     ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo))
0092 #define _XSyncValueGreaterOrEqual(a, b)\
0093     ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo))
0094 #define _XSyncValueLessOrEqual(a, b)\
0095     ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo))
0096 #define _XSyncValueEqual(a, b)  ((a).lo==(b).lo && (a).hi==(b).hi)
0097 #define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0)
0098 #define _XSyncValueIsZero(a)    ((a).lo==0 && (a).hi==0)
0099 #define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1)
0100 #define _XSyncValueLow32(v) ((v).lo)
0101 #define _XSyncValueHigh32(v)    ((v).hi)
0102 #define _XSyncValueAdd(presult,a,b,poverflow) {\
0103     int t = (a).lo;\
0104     Bool signa = XSyncValueIsNegative(a);\
0105     Bool signb = XSyncValueIsNegative(b);\
0106     ((presult)->lo = (a).lo + (b).lo);\
0107     ((presult)->hi = (a).hi + (b).hi);\
0108     if (t>(presult)->lo) (presult)->hi++;\
0109     *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
0110      }
0111 #define _XSyncValueSubtract(presult,a,b,poverflow) {\
0112     int t = (a).lo;\
0113     Bool signa = XSyncValueIsNegative(a);\
0114     Bool signb = XSyncValueIsNegative(b);\
0115     ((presult)->lo = (a).lo - (b).lo);\
0116     ((presult)->hi = (a).hi - (b).hi);\
0117     if (t<(presult)->lo) (presult)->hi--;\
0118     *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
0119      }
0120 #define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff)
0121 #define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0)
0122 
0123 /*
0124  *  These are the publically usable macros.  If you want the function version
0125  *  of one of these, just #undef the macro to uncover the function.
0126  *  (This is the same convention that the ANSI C library uses.)
0127  */
0128 
0129 #define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i)
0130 #define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h)
0131 #define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b)
0132 #define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b)
0133 #define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b)
0134 #define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b)
0135 #define XSyncValueEqual(a, b) _XSyncValueEqual(a, b)
0136 #define XSyncValueIsNegative(v) _XSyncValueIsNegative(v)
0137 #define XSyncValueIsZero(a) _XSyncValueIsZero(a)
0138 #define XSyncValueIsPositive(v) _XSyncValueIsPositive(v)
0139 #define XSyncValueLow32(v) _XSyncValueLow32(v)
0140 #define XSyncValueHigh32(v) _XSyncValueHigh32(v)
0141 #define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow)
0142 #define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow)
0143 #define XSyncMaxValue(pv) _XSyncMaxValue(pv)
0144 #define XSyncMinValue(pv) _XSyncMinValue(pv)
0145 
0146 /*
0147  * Constants for the value_type argument of various requests
0148  */
0149 typedef enum {
0150     XSyncAbsolute,
0151     XSyncRelative
0152 } XSyncValueType;
0153 
0154 /*
0155  * Alarm Test types
0156  */
0157 typedef enum {
0158     XSyncPositiveTransition,
0159     XSyncNegativeTransition,
0160     XSyncPositiveComparison,
0161     XSyncNegativeComparison
0162 } XSyncTestType;
0163 
0164 /*
0165  * Alarm state constants
0166  */
0167 typedef enum {
0168     XSyncAlarmActive,
0169     XSyncAlarmInactive,
0170     XSyncAlarmDestroyed
0171 } XSyncAlarmState;
0172 
0173 
0174 typedef XID XSyncCounter;
0175 typedef XID XSyncAlarm;
0176 typedef XID XSyncFence;
0177 typedef struct _XSyncValue {
0178     int hi;
0179     unsigned int lo;
0180 } XSyncValue;
0181 #endif /* _SYNCCONST_H_ */