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