xref: /freebsd/contrib/ntp/include/hopf6039.h (revision 224ba2bd37e182b64f7d78defef8a6cacaad3415)
1224ba2bdSOllivier Robert /****************************************************************************/
2224ba2bdSOllivier Robert /*      hopf6039.h                                                          */
3224ba2bdSOllivier Robert /*      hopf Elektronik 6039 PCI radio clock header                         */
4224ba2bdSOllivier Robert /*      (c) 1999, 2000 Bernd Altmeier    <altmeier@ATLSoft.de>              */
5224ba2bdSOllivier Robert /*      Rev. 1.00 Date 25.03.2000                                           */
6224ba2bdSOllivier Robert /*      History:                                                            */
7224ba2bdSOllivier Robert /****************************************************************************/
8224ba2bdSOllivier Robert 
9224ba2bdSOllivier Robert #ifndef _hopf6039_H_
10224ba2bdSOllivier Robert #define _hopf6039_H_
11224ba2bdSOllivier Robert 
12224ba2bdSOllivier Robert #define HOPF_MAXVERSION			8
13224ba2bdSOllivier Robert #define	HOPF_CNTR_MEM_LEN		0x7f
14224ba2bdSOllivier Robert #define	HOPF_DATA_MEM_LEN		0x3ff	/* this is our memory size */
15224ba2bdSOllivier Robert 
16224ba2bdSOllivier Robert /* macros and definition for 32 to 16 to 8 bit conversion */
17224ba2bdSOllivier Robert 
18224ba2bdSOllivier Robert typedef unsigned long       DWORD;
19224ba2bdSOllivier Robert typedef unsigned char       BYTE;
20224ba2bdSOllivier Robert typedef unsigned short      WORD;
21224ba2bdSOllivier Robert 
22224ba2bdSOllivier Robert #define LOWORD(l)     ((WORD)(l))
23224ba2bdSOllivier Robert #define HIWORD(l)     ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
24224ba2bdSOllivier Robert #define LOBYTE(w)     ((BYTE)(w))
25224ba2bdSOllivier Robert #define HIBYTE(w)     ((BYTE)(((WORD)(w) >> 8) & 0xFF))
26224ba2bdSOllivier Robert 
27224ba2bdSOllivier Robert /* iocntl codes for driver access */
28224ba2bdSOllivier Robert 
29224ba2bdSOllivier Robert #define HOPF_CLOCK_CMD_MASK 0xff000
30224ba2bdSOllivier Robert 
31224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_LOCAL		0x10000
32224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_UTC		0x20000
33224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_ANTENNA		0x30000
34224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_DIFFERENCE	0x40000
35224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_VERSION		0x50000
36224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_POSITION		0x60000
37224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_SATDATA		0x70000
38224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_SYSTEMBYTE	0x80000
39224ba2bdSOllivier Robert #define HOPF_CLOCK_GET_IRIG		0x90000
40224ba2bdSOllivier Robert 
41224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_DIFFERENCE	0x01000
42224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_ANTENNA		0x02000
43224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_TIME 		0x03000
44224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_POSITION		0x04000
45224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_SATMODE		0x05000
46224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_SYSTEMBYTE	0x06000
47224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_RESET		0x07000
48224ba2bdSOllivier Robert #define HOPF_CLOCK_SET_IRIG		0x08000
49224ba2bdSOllivier Robert 
50224ba2bdSOllivier Robert /* clock command codes */
51224ba2bdSOllivier Robert 
52224ba2bdSOllivier Robert #define HOPF_CLOCK_HARDRESET		0x00008000
53224ba2bdSOllivier Robert #define HOPF_CLOCK_SOFTRESET		0x00004000
54224ba2bdSOllivier Robert 
55224ba2bdSOllivier Robert /* sat-information */
56224ba2bdSOllivier Robert 
57224ba2bdSOllivier Robert typedef struct SatStat{
58224ba2bdSOllivier Robert 	BYTE wVisible;
59224ba2bdSOllivier Robert 	BYTE wMode;
60224ba2bdSOllivier Robert 	BYTE wSat0;
61224ba2bdSOllivier Robert 	BYTE wRat0;
62224ba2bdSOllivier Robert 	BYTE wSat1;
63224ba2bdSOllivier Robert 	BYTE wRat1;
64224ba2bdSOllivier Robert 	BYTE wSat2;
65224ba2bdSOllivier Robert 	BYTE wRat2;
66224ba2bdSOllivier Robert 	BYTE wSat3;
67224ba2bdSOllivier Robert 	BYTE wRat3;
68224ba2bdSOllivier Robert 	BYTE wSat4;
69224ba2bdSOllivier Robert 	BYTE wRat4;
70224ba2bdSOllivier Robert 	BYTE wSat5;
71224ba2bdSOllivier Robert 	BYTE wRat5;
72224ba2bdSOllivier Robert 	BYTE wSat6;
73224ba2bdSOllivier Robert 	BYTE wRat6;
74224ba2bdSOllivier Robert 	BYTE wSat7;
75224ba2bdSOllivier Robert 	BYTE wRat7;
76224ba2bdSOllivier Robert } SatStat;
77224ba2bdSOllivier Robert 
78224ba2bdSOllivier Robert /* GPS position */
79224ba2bdSOllivier Robert 
80224ba2bdSOllivier Robert typedef struct GPSPos {  /* Position */
81224ba2bdSOllivier Robert 	long wAltitude;
82224ba2bdSOllivier Robert 	long wLongitude;
83224ba2bdSOllivier Robert 	long wLatitude;
84224ba2bdSOllivier Robert } GPSPos;
85224ba2bdSOllivier Robert 
86224ba2bdSOllivier Robert /* clock hardware version */
87224ba2bdSOllivier Robert 
88224ba2bdSOllivier Robert typedef struct ClockVersion {
89224ba2bdSOllivier Robert 	char cVersion[255];  /* Hardware Version like " DCF-RECEIVER,   VERSION 01.01, DAT: 23.NOV.1999" */
90224ba2bdSOllivier Robert 	char dVersion[255];  /* Driver Version */
91224ba2bdSOllivier Robert } ClockVersion;
92224ba2bdSOllivier Robert 
93224ba2bdSOllivier Robert /* hopftime what you think */
94224ba2bdSOllivier Robert 
95224ba2bdSOllivier Robert typedef struct HOPFTIME {
96224ba2bdSOllivier Robert     unsigned int wYear;
97224ba2bdSOllivier Robert     unsigned int wMonth;
98224ba2bdSOllivier Robert     unsigned int wDayOfWeek;
99224ba2bdSOllivier Robert     unsigned int wDay;
100224ba2bdSOllivier Robert     unsigned int wHour;
101224ba2bdSOllivier Robert     unsigned int wMinute;
102224ba2bdSOllivier Robert     unsigned int wSecond;
103224ba2bdSOllivier Robert     unsigned int wMilliseconds;
104224ba2bdSOllivier Robert     unsigned int wStatus;
105224ba2bdSOllivier Robert } HOPFTIME;
106224ba2bdSOllivier Robert 
107224ba2bdSOllivier Robert /* DCF77 antenna alignment */
108224ba2bdSOllivier Robert 
109224ba2bdSOllivier Robert typedef struct DcfAntenne {
110224ba2bdSOllivier Robert 	BYTE bStatus;
111224ba2bdSOllivier Robert 	BYTE bStatus1;
112224ba2bdSOllivier Robert 	WORD wAntValue;
113224ba2bdSOllivier Robert } DcfAntenne;
114224ba2bdSOllivier Robert 
115224ba2bdSOllivier Robert /* hopf PCI clock */
116224ba2bdSOllivier Robert 
117224ba2bdSOllivier Robert typedef struct hopfCard {
118224ba2bdSOllivier Robert 	char name[32];
119224ba2bdSOllivier Robert 	unsigned irq;
120224ba2bdSOllivier Robert 	unsigned long membase; /* without mmap */
121224ba2bdSOllivier Robert 	unsigned int port;
122224ba2bdSOllivier Robert 
123224ba2bdSOllivier Robert 	int versionlen;
124224ba2bdSOllivier Robert 	char versionbuf[1024];
125224ba2bdSOllivier Robert 	char *version[HOPF_MAXVERSION];
126224ba2bdSOllivier Robert 	char cardname[32];
127224ba2bdSOllivier Robert 	int interrupt;
128224ba2bdSOllivier Robert 	void *mbase;		   /* this will be our memory base address */
129224ba2bdSOllivier Robert 
130224ba2bdSOllivier Robert } hopfCard;
131224ba2bdSOllivier Robert 
132224ba2bdSOllivier Robert typedef struct cardparams {
133224ba2bdSOllivier Robert 	unsigned int port;
134224ba2bdSOllivier Robert 	unsigned irq;
135224ba2bdSOllivier Robert 	int cardtype;
136224ba2bdSOllivier Robert 	int cardnr;
137224ba2bdSOllivier Robert 	unsigned int membase;
138224ba2bdSOllivier Robert } cardparams;
139224ba2bdSOllivier Robert 
140224ba2bdSOllivier Robert 
141224ba2bdSOllivier Robert #define WRITE_REGISTER		0x00
142224ba2bdSOllivier Robert #define READ_REGISTER		0x01
143224ba2bdSOllivier Robert 
144224ba2bdSOllivier Robert #endif /* _hopf6039_H_ */
145