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