File indexing completed on 2025-01-18 10:14:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
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
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
0082
0083
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
0125
0126
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
0148
0149 typedef enum {
0150 XSyncAbsolute,
0151 XSyncRelative
0152 } XSyncValueType;
0153
0154
0155
0156
0157 typedef enum {
0158 XSyncPositiveTransition,
0159 XSyncNegativeTransition,
0160 XSyncPositiveComparison,
0161 XSyncNegativeComparison
0162 } XSyncTestType;
0163
0164
0165
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