File: io_linux.h

package info (click to toggle)
chrony 1.21z-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 2,080 kB
  • ctags: 2,375
  • sloc: ansic: 14,831; yacc: 858; sh: 588; perl: 426; makefile: 148
file content (61 lines) | stat: -rw-r--r-- 2,284 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Taken from <asm-$foo/ioctl.h> in the Linux kernel sources.
 * The ioctl.h file is pretty similar from one architecture to another.
 * */
#ifndef IO_LINUX_H
#define IO_LINUX_H

/* Hmm.  These constants vary a bit between systems. */
/* (__sh__ includes both sh and sh64) */
#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__ppc__) || defined(__ppc64__) || defined(__sparc64__)
#define CHRONY_IOC_NRBITS	8
#define CHRONY_IOC_TYPEBITS	8
#define CHRONY_IOC_SIZEBITS	13
#define CHRONY_IOC_DIRBITS	2

#define CHRONY_IOC_NONE         1U
#define CHRONY_IOC_READ         2U
#define CHRONY_IOC_WRITE        4U
#else
#define CHRONY_IOC_NRBITS	8
#define CHRONY_IOC_TYPEBITS	8
#define CHRONY_IOC_SIZEBITS	14
#define CHRONY_IOC_DIRBITS	2

#define CHRONY_IOC_NONE	        0U
#define CHRONY_IOC_WRITE	1U
#define CHRONY_IOC_READ	        2U
#endif

#define CHRONY_IOC_NRMASK	((1 << CHRONY_IOC_NRBITS)-1)
#define CHRONY_IOC_TYPEMASK	((1 << CHRONY_IOC_TYPEBITS)-1)
#define CHRONY_IOC_SIZEMASK	((1 << CHRONY_IOC_SIZEBITS)-1)
#define CHRONY_IOC_DIRMASK	((1 << CHRONY_IOC_DIRBITS)-1)

#define CHRONY_IOC_NRSHIFT	0
#define CHRONY_IOC_TYPESHIFT	(CHRONY_IOC_NRSHIFT+CHRONY_IOC_NRBITS)
#define CHRONY_IOC_SIZESHIFT	(CHRONY_IOC_TYPESHIFT+CHRONY_IOC_TYPEBITS)
#define CHRONY_IOC_DIRSHIFT	(CHRONY_IOC_SIZESHIFT+CHRONY_IOC_SIZEBITS)

#define CHRONY_IOC(dir,type,nr,size) \
	(((dir)  << CHRONY_IOC_DIRSHIFT) | \
	 ((type) << CHRONY_IOC_TYPESHIFT) | \
	 ((nr)   << CHRONY_IOC_NRSHIFT) | \
	 ((size) << CHRONY_IOC_SIZESHIFT))

/* used to create numbers */
#define CHRONY_IO(type,nr)		CHRONY_IOC(CHRONY_IOC_NONE,(type),(nr),0)
#define CHRONY_IOR(type,nr,size)	CHRONY_IOC(CHRONY_IOC_READ,(type),(nr),sizeof(size))
#define CHRONY_IOW(type,nr,size)	CHRONY_IOC(CHRONY_IOC_WRITE,(type),(nr),sizeof(size))
#define CHRONY_IOWR(type,nr,size)	CHRONY_IOC(CHRONY_IOC_READ|CHRONY_IOC_WRITE,(type),(nr),sizeof(size))

#define RTC_UIE_ON	CHRONY_IO('p', 0x03)	/* Update int. enable on	*/
#define RTC_UIE_OFF	CHRONY_IO('p', 0x04)	/* ... off			*/

#define RTC_RD_TIME	CHRONY_IOR('p', 0x09, struct rtc_time) /* Read RTC time   */
#define RTC_SET_TIME	CHRONY_IOW('p', 0x0a, struct rtc_time) /* Set RTC time    */

/* From mc146818.h */
#define RTC_UIE 0x10		/* update-finished interrupt enable */

#endif