2.5.70 update
[linux-flexiantxendom0-3.2.10.git] / include / asm-ia64 / sn / hires_clock.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2001 Silicon Graphics, Inc. All rights reserved.
7  *
8  * SGI Hi Resolution Clock
9  *
10  * SGI SN platforms provide a high resolution clock that is
11  * synchronized across all nodes. The clock can be memory mapped
12  * and directly read from user space.
13  *
14  * Access to the clock is thru the following:
15  *       (error checking not shown)
16  *
17  * (Note: should library routines be provided to encapsulate this??)
18  *
19  *      int             fd:
20  *      volatile long   *clk;
21  *
22  *      fd = open (HIRES_FULLNAME, O_RDONLY);
23  *      clk = mmap(0, getpagesize(), PROT_READ, MAP_SHARED, fd, 0);
24  *      clk += ioctl(fd, HIRES_IOCQGETOFFSET, 0);
25  *
26  * At this point, clk is a pointer to the high resolution clock.
27  *
28  * The clock period can be obtained via:
29  *
30  *      long    picosec_per_tick;
31  *      picosec_per_tick = ioctl(fd, HIRES_IOCQGETPICOSEC, 0);
32  */
33
34 #ifndef _ASM_IA64_SN_HIRES_CLOCK_H
35 #define _ASM_IA64_SN_HIRES_CLOCK_H
36
37
38 #define HIRES_BASENAME  "sgi_hires_clock"
39 #define HIRES_FULLNAME  "/dev/sgi_hires_clock"
40 #define HIRES_IOC_BASE  's'
41
42
43 /* Get page offset of hires timer */
44 #define HIRES_IOCQGETOFFSET     _IO( HIRES_IOC_BASE, 0 )
45
46 /* get clock period in picoseconds per tick */
47 #define HIRES_IOCQGETPICOSEC    _IO( HIRES_IOC_BASE, 1 )
48
49 /* get number of significant bits in clock counter */
50 #define HIRES_IOCQGETCLOCKBITS  _IO( HIRES_IOC_BASE, 2 )
51
52 #endif /* _ASM_IA64_SN_HIRES_CLOCK_H */