xref: /freebsd/contrib/ntp/include/hopf6039.h (revision 224ba2bd37e182b64f7d78defef8a6cacaad3415)
1 /****************************************************************************/
2 /*      hopf6039.h                                                          */
3 /*      hopf Elektronik 6039 PCI radio clock header                         */
4 /*      (c) 1999, 2000 Bernd Altmeier    <altmeier@ATLSoft.de>              */
5 /*      Rev. 1.00 Date 25.03.2000                                           */
6 /*      History:                                                            */
7 /****************************************************************************/
8 
9 #ifndef _hopf6039_H_
10 #define _hopf6039_H_
11 
12 #define HOPF_MAXVERSION			8
13 #define	HOPF_CNTR_MEM_LEN		0x7f
14 #define	HOPF_DATA_MEM_LEN		0x3ff	/* this is our memory size */
15 
16 /* macros and definition for 32 to 16 to 8 bit conversion */
17 
18 typedef unsigned long       DWORD;
19 typedef unsigned char       BYTE;
20 typedef unsigned short      WORD;
21 
22 #define LOWORD(l)     ((WORD)(l))
23 #define HIWORD(l)     ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
24 #define LOBYTE(w)     ((BYTE)(w))
25 #define HIBYTE(w)     ((BYTE)(((WORD)(w) >> 8) & 0xFF))
26 
27 /* iocntl codes for driver access */
28 
29 #define HOPF_CLOCK_CMD_MASK 0xff000
30 
31 #define HOPF_CLOCK_GET_LOCAL		0x10000
32 #define HOPF_CLOCK_GET_UTC		0x20000
33 #define HOPF_CLOCK_GET_ANTENNA		0x30000
34 #define HOPF_CLOCK_GET_DIFFERENCE	0x40000
35 #define HOPF_CLOCK_GET_VERSION		0x50000
36 #define HOPF_CLOCK_GET_POSITION		0x60000
37 #define HOPF_CLOCK_GET_SATDATA		0x70000
38 #define HOPF_CLOCK_GET_SYSTEMBYTE	0x80000
39 #define HOPF_CLOCK_GET_IRIG		0x90000
40 
41 #define HOPF_CLOCK_SET_DIFFERENCE	0x01000
42 #define HOPF_CLOCK_SET_ANTENNA		0x02000
43 #define HOPF_CLOCK_SET_TIME 		0x03000
44 #define HOPF_CLOCK_SET_POSITION		0x04000
45 #define HOPF_CLOCK_SET_SATMODE		0x05000
46 #define HOPF_CLOCK_SET_SYSTEMBYTE	0x06000
47 #define HOPF_CLOCK_SET_RESET		0x07000
48 #define HOPF_CLOCK_SET_IRIG		0x08000
49 
50 /* clock command codes */
51 
52 #define HOPF_CLOCK_HARDRESET		0x00008000
53 #define HOPF_CLOCK_SOFTRESET		0x00004000
54 
55 /* sat-information */
56 
57 typedef struct SatStat{
58 	BYTE wVisible;
59 	BYTE wMode;
60 	BYTE wSat0;
61 	BYTE wRat0;
62 	BYTE wSat1;
63 	BYTE wRat1;
64 	BYTE wSat2;
65 	BYTE wRat2;
66 	BYTE wSat3;
67 	BYTE wRat3;
68 	BYTE wSat4;
69 	BYTE wRat4;
70 	BYTE wSat5;
71 	BYTE wRat5;
72 	BYTE wSat6;
73 	BYTE wRat6;
74 	BYTE wSat7;
75 	BYTE wRat7;
76 } SatStat;
77 
78 /* GPS position */
79 
80 typedef struct GPSPos {  /* Position */
81 	long wAltitude;
82 	long wLongitude;
83 	long wLatitude;
84 } GPSPos;
85 
86 /* clock hardware version */
87 
88 typedef struct ClockVersion {
89 	char cVersion[255];  /* Hardware Version like " DCF-RECEIVER,   VERSION 01.01, DAT: 23.NOV.1999" */
90 	char dVersion[255];  /* Driver Version */
91 } ClockVersion;
92 
93 /* hopftime what you think */
94 
95 typedef struct HOPFTIME {
96     unsigned int wYear;
97     unsigned int wMonth;
98     unsigned int wDayOfWeek;
99     unsigned int wDay;
100     unsigned int wHour;
101     unsigned int wMinute;
102     unsigned int wSecond;
103     unsigned int wMilliseconds;
104     unsigned int wStatus;
105 } HOPFTIME;
106 
107 /* DCF77 antenna alignment */
108 
109 typedef struct DcfAntenne {
110 	BYTE bStatus;
111 	BYTE bStatus1;
112 	WORD wAntValue;
113 } DcfAntenne;
114 
115 /* hopf PCI clock */
116 
117 typedef struct hopfCard {
118 	char name[32];
119 	unsigned irq;
120 	unsigned long membase; /* without mmap */
121 	unsigned int port;
122 
123 	int versionlen;
124 	char versionbuf[1024];
125 	char *version[HOPF_MAXVERSION];
126 	char cardname[32];
127 	int interrupt;
128 	void *mbase;		   /* this will be our memory base address */
129 
130 } hopfCard;
131 
132 typedef struct cardparams {
133 	unsigned int port;
134 	unsigned irq;
135 	int cardtype;
136 	int cardnr;
137 	unsigned int membase;
138 } cardparams;
139 
140 
141 #define WRITE_REGISTER		0x00
142 #define READ_REGISTER		0x01
143 
144 #endif /* _hopf6039_H_ */
145