1
/* $Xorg: syncstr.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
4
Copyright 1991, 1993, 1994, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
Except as contained in this notice, the name of The Open Group shall not be
23
used in advertising or otherwise to promote the sale, use or other dealings
24
in this Software without prior written authorization from The Open Group.
28
/***********************************************************
29
Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
30
and Olivetti Research Limited, Cambridge, England.
34
Permission to use, copy, modify, and distribute this software and its
35
documentation for any purpose and without fee is hereby granted,
36
provided that the above copyright notice appear in all copies and that
37
both that copyright notice and this permission notice appear in
38
supporting documentation, and that the names of Digital or Olivetti
39
not be used in advertising or publicity pertaining to distribution of the
40
software without specific, written prior permission.
42
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
43
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
44
FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
46
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
47
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48
PERFORMANCE OF THIS SOFTWARE.
50
******************************************************************/
51
/* $XFree86: xc/include/extensions/syncstr.h,v 1.3 2003/07/16 01:38:24 dawes Exp $ */
60
/* cover up types from sync.h to make sure they're the right size for
61
* protocol packaging. These will be undef'ed after all the protocol
62
* structures are defined.
64
#define XSyncCounter CARD32
65
#define XSyncAlarm CARD32
70
typedef struct _xSyncInitialize {
78
#define sz_xSyncInitializeReq 8
83
CARD16 sequenceNumber B16;
93
} xSyncInitializeReply;
94
#define sz_xSyncInitializeReply 32
99
typedef struct _xSyncListSystemCounters
104
} xSyncListSystemCountersReq;
105
#define sz_xSyncListSystemCountersReq 4
110
CARD16 sequenceNumber B16;
118
} xSyncListSystemCountersReply;
119
#define sz_xSyncListSystemCountersReply 32
122
XSyncCounter counter B32;
123
INT32 resolution_hi B32;
124
CARD32 resolution_lo B32;
125
CARD16 name_length B16;
126
} xSyncSystemCounter;
127
#define sz_xSyncSystemCounter 14
132
typedef struct _xSyncCreateCounterReq {
136
XSyncCounter cid B32;
137
INT32 initial_value_hi B32;
138
CARD32 initial_value_lo B32;
139
} xSyncCreateCounterReq;
140
#define sz_xSyncCreateCounterReq 16
145
typedef struct _xSyncChangeCounterReq {
149
XSyncCounter cid B32;
152
} xSyncChangeCounterReq;
153
#define sz_xSyncChangeCounterReq 16
158
typedef struct _xSyncSetCounterReq {
162
XSyncCounter cid B32;
165
} xSyncSetCounterReq;
166
#define sz_xSyncSetCounterReq 16
171
typedef struct _xSyncDestroyCounterReq {
175
XSyncCounter counter B32;
176
} xSyncDestroyCounterReq;
177
#define sz_xSyncDestroyCounterReq 8
182
typedef struct _xSyncQueryCounterReq {
186
XSyncCounter counter B32;
187
} xSyncQueryCounterReq;
188
#define sz_xSyncQueryCounterReq 8
194
CARD16 sequenceNumber B16;
202
} xSyncQueryCounterReply;
203
#define sz_xSyncQueryCounterReply 32
208
typedef struct _xSyncAwaitReq {
213
#define sz_xSyncAwaitReq 4
215
typedef struct _xSyncWaitCondition {
216
XSyncCounter counter B32;
217
CARD32 value_type B32;
218
INT32 wait_value_hi B32;
219
CARD32 wait_value_lo B32;
220
CARD32 test_type B32;
221
INT32 event_threshold_hi B32;
222
CARD32 event_threshold_lo B32;
223
} xSyncWaitCondition;
224
#define sz_xSyncWaitCondition 28
229
typedef struct _xSyncCreateAlarmReq {
234
CARD32 valueMask B32;
235
} xSyncCreateAlarmReq;
236
#define sz_xSyncCreateAlarmReq 12
241
typedef struct _xSyncDestroyAlarmReq {
245
XSyncAlarm alarm B32;
246
} xSyncDestroyAlarmReq;
247
#define sz_xSyncDestroyAlarmReq 8
252
typedef struct _xSyncQueryAlarmReq {
256
XSyncAlarm alarm B32;
257
} xSyncQueryAlarmReq;
258
#define sz_xSyncQueryAlarmReq 8
263
CARD16 sequenceNumber B16;
265
XSyncCounter counter B32;
266
CARD32 value_type B32;
267
INT32 wait_value_hi B32;
268
CARD32 wait_value_lo B32;
269
CARD32 test_type B32;
276
} xSyncQueryAlarmReply;
277
#define sz_xSyncQueryAlarmReply 40
282
typedef struct _xSyncChangeAlarmReq {
286
XSyncAlarm alarm B32;
287
CARD32 valueMask B32;
288
} xSyncChangeAlarmReq;
289
#define sz_xSyncChangeAlarmReq 12
294
typedef struct _xSyncSetPriority{
300
} xSyncSetPriorityReq;
301
#define sz_xSyncSetPriorityReq 12
306
typedef struct _xSyncGetPriority{
310
CARD32 id B32; /*XXX XID? */
311
} xSyncGetPriorityReq;
312
#define sz_xSyncGetPriorityReq 8
317
CARD16 sequenceNumber B16;
325
} xSyncGetPriorityReply;
326
#define sz_xSyncGetPriorityReply 32
332
typedef struct _xSyncCounterNotifyEvent {
335
CARD16 sequenceNumber B16;
336
XSyncCounter counter B32;
337
INT32 wait_value_hi B32;
338
CARD32 wait_value_lo B32;
339
INT32 counter_value_hi B32;
340
CARD32 counter_value_lo B32;
345
} xSyncCounterNotifyEvent;
347
typedef struct _xSyncAlarmNotifyEvent {
350
CARD16 sequenceNumber B16;
351
XSyncAlarm alarm B32;
352
INT32 counter_value_hi B32;
353
CARD32 counter_value_lo B32;
354
INT32 alarm_value_hi B32;
355
CARD32 alarm_value_lo B32;
361
} xSyncAlarmNotifyEvent;
366
#endif /* _SYNC_OS */
370
#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
372
typedef struct _SyncCounter {
373
ClientPtr client; /* Owning client. 0 for system counters */
374
XSyncCounter id; /* resource ID */
375
CARD64 value; /* counter value */
376
struct _SyncTriggerList *pTriglist; /* list of triggers */
377
Bool beingDestroyed; /* in process of going away */
378
struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
382
* The System Counter interface
386
XSyncCounterNeverChanges,
387
XSyncCounterNeverIncreases,
388
XSyncCounterNeverDecreases,
389
XSyncCounterUnrestricted
392
typedef struct _SysCounterInfo {
395
CARD64 bracket_greater;
397
SyncCounterType counterType; /* how can this counter change */
399
pointer /*pCounter*/,
400
CARD64 * /*freshvalue*/
402
void (*BracketValues)(
403
pointer /*pCounter*/,
404
CARD64 * /*lessthan*/,
405
CARD64 * /*greaterthan*/
411
typedef struct _SyncTrigger {
412
SyncCounter *pCounter;
413
CARD64 wait_value; /* wait value */
414
unsigned int value_type; /* Absolute or Relative */
415
unsigned int test_type; /* transition or Comparision type */
416
CARD64 test_value; /* trigger event threshold value */
417
Bool (*CheckTrigger)(
418
struct _SyncTrigger * /*pTrigger*/,
421
void (*TriggerFired)(
422
struct _SyncTrigger * /*pTrigger*/
424
void (*CounterDestroyed)(
425
struct _SyncTrigger * /*pTrigger*/
429
typedef struct _SyncTriggerList {
430
SyncTrigger *pTrigger;
431
struct _SyncTriggerList *next;
434
typedef struct _SyncAlarmClientList {
437
struct _SyncAlarmClientList *next;
438
} SyncAlarmClientList;
440
typedef struct _SyncAlarm {
447
SyncAlarmClientList *pEventClients;
453
int num_waitconditions;
458
CARD64 event_threshold;
459
SyncAwaitHeader *pHeader;
463
SyncAwaitHeader header;
468
extern pointer SyncCreateSystemCounter(
470
CARD64 /* inital_value */,
471
CARD64 /* resolution */,
472
SyncCounterType /* change characterization */,
473
void (* /*QueryValue*/ ) (
474
pointer /* pCounter */,
475
CARD64 * /* pValue_return */), /* XXX prototype */
476
void (* /*BracketValues*/) (
477
pointer /* pCounter */,
478
CARD64 * /* pbracket_less */,
479
CARD64 * /* pbracket_greater */)
482
extern void SyncChangeCounter(
483
SyncCounter * /* pCounter*/,
484
CARD64 /* new_value */
487
extern void SyncDestroySystemCounter(
490
extern void InitServertime(void);
492
#endif /* _SYNC_SERVER */
494
#endif /* _SYNCSTR_H_ */