mbgtools-lx  4.2.8
pci_asic.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: pci_asic.h 1.31 2018/06/25 12:32:19 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions for the Meinberg PCI interface ASIC.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: pci_asic.h $
13  * Revision 1.31 2018/06/25 12:32:19 martin
14  * Added PCPS_ASIC_STR_FMT format specifier.
15  * Revision 1.30 2018/03/27 12:39:46 martin
16  * Updated minor version for PZF180PEX to 0x01.
17  * Revision 1.29 2017/07/04 14:18:03 martin
18  * Updated minor version for PTP270PEX.
19  * Revision 1.28 2017/05/10 15:24:21 martin
20  * Tiny cleanup.
21  * Revision 1.27 2017/04/25 11:36:30 martin
22  * Renamed GRC181PEX to GNS181PEX.
23  * Revision 1.26 2016/09/15 14:55:02 martin
24  * Support GRC181PEX.
25  * Added doxgen comments.
26  * Revision 1.25 2014/10/17 11:38:39 martin
27  * Updated version info for GPS180PEX.
28  * Revision 1.24 2013/10/01 15:29:39 martin
29  * Updated version info for PTP270PEX.
30  * Revision 1.23 2013/06/26 15:57:07Z martin
31  * Support GLN180PEX.
32  * Revision 1.22 2011/10/05 09:46:12 martin
33  * Updated version info for GPS180PEX.
34  * Revision 1.21 2011/09/13 07:36:21Z martin
35  * Updated version info for GPS180PEX.
36  * Revision 1.20 2011/06/30 13:52:26Z martin
37  * Updated version info for GPS180PEX.
38  * Revision 1.19 2011/06/29 08:58:32Z martin
39  * Support PZF180PEX.
40  * Cleaned up handling of pragma pack().
41  * Revision 1.18 2011/04/06 12:31:48 martin
42  * Updated minor versions for PTP270PEX and GPS180PEX.
43  * Revision 1.17 2010/09/10 14:03:25Z martin
44  * Support GPS180PEX and TCR180PEX.
45  * New table initializer to simplify EPLD version checking.
46  * Revision 1.16 2010/04/16 11:12:21Z martin
47  * Updated GPS170PEX ASIC version.
48  * Revision 1.15 2009/03/27 09:39:15 martin
49  * Increased current ASIC minor number for TCR170PEX to 0x02.
50  * Renamed some symbols.
51  * Revision 1.14 2009/03/11 16:54:10Z martin
52  * Increased current ASIC minor number for TCR511PEX to 0x04.
53  * Fixed a typo.
54  * Revision 1.13 2008/12/05 12:28:18Z martin
55  * Modified syntax of macro _convert_asic_version_number().
56  * Added macros to deal with the ASIC version number.
57  * Added definition PCI_ASIC_HAS_PGMB_IRQ.
58  * Added ASIC revision numbers for PEX511, TCR511PEX, and GPS170PEX
59  * which fix an IRQ bug with these cards.
60  * Added definitions for PTP270PEX, FRC511PEX, and TCR170PEX.
61  * Revision 1.12 2008/07/21 10:30:00Z martin
62  * Added macros to convert the endianess of data types.
63  * Added PCI_ASIC_CURRENT_MINOR_... symbols.
64  * Revision 1.11 2008/06/11 09:49:43 martin
65  * Added definitions and comments how to handle version numbers
66  * of the PCI and PEX interface chips and EPLDs.
67  * Revision 1.10 2008/02/29 15:21:48Z martin
68  * Added definition PCI_ASIC_HAS_MM_IO.
69  * Revision 1.9 2008/01/17 09:51:05 daniel
70  * Added macro _convert_asic_version_number().
71  * Cleanup for PCI ASIC version and features.
72  * Revision 1.8 2006/06/14 12:59:12Z martin
73  * Added support for TCR511PCI.
74  * Revision 1.7 2006/03/10 10:47:03 martin
75  * Added support for PCI511.
76  * Revision 1.6 2005/11/03 15:30:44Z martin
77  * Added support for GPS170PCI.
78  * Revision 1.5 2004/11/09 12:51:56Z martin
79  * Redefined fixed width data types using standard C99 types.
80  * Defined some constants unsigned.
81  * Revision 1.4 2004/10/14 15:01:23 martin
82  * Added support for TCR167PCI.
83  * Revision 1.3 2003/05/13 14:38:55Z MARTIN
84  * Added ushort fields to unions PCI_ASIC_REG and
85  * PCI_ASIC_ADDON_DATA.
86  * Revision 1.2 2003/04/03 10:56:38 martin
87  * Use unions for registers.
88  * Modified BADR0 initializer due to fixed size of address decoder.
89  * Revision 1.1 2003/02/07 11:42:52 MARTIN
90  * Initial revision
91  *
92  **************************************************************************/
93 
94 #ifndef _PCI_ASIC_H
95 #define _PCI_ASIC_H
96 
97 
98 /* Other headers to be included */
99 
100 #include <words.h>
101 #include <use_pack.h>
102 
103 #ifdef _PCI_ASIC
104  #define _ext
105  #define _DO_INIT
106 #else
107  #define _ext extern
108 #endif
109 
110 
111 /* Start of header body */
112 
113 #if defined( _USE_PACK )
114  #pragma pack( 1 ) // set byte alignment
115  #define _USING_BYTE_ALIGNMENT
116 #endif
117 
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121 
122 
126 typedef struct
127 {
131 
132 } PCI_ASIC_CFG;
133 
134 
138 typedef union
139 {
140  uint32_t ul;
141  uint16_t us[2];
142  uint8_t b[4];
143 
144 } PCI_ASIC_REG;
145 
146 
147 
151 typedef uint32_t PCI_ASIC_VERSION;
152 
153 #define _mbg_swab_asic_version( _p ) _mbg_swab32( _p )
154 
155 
156 
162 typedef uint32_t PCI_ASIC_FEATURES;
163 
164 #define _mbg_swab_asic_features( _p ) _mbg_swab32( _p )
165 
166 
167 
175 #define PCI_ASIC_HAS_MM_IO 0x0001
176 #define PCI_ASIC_HAS_PGMB_IRQ 0x0002
177 
178 
185 typedef union
186 {
187  uint32_t ul[4];
188  uint16_t us[8];
189  uint8_t b[16];
190 
192 
193 
194 
198 typedef struct
199 {
201  PCI_ASIC_VERSION raw_version;
202  PCI_ASIC_FEATURES features;
207 
210 
211 } PCI_ASIC;
212 
213 
214 
231 #define PCI_ASIC_ADD_ON_IRQF 0x00000001UL
232 
242 #define PCI_ASIC_PCI_IRQF 0x00010000UL
243 
244 // NOTE All other bits are reserved for future use.
245 
257 #define PCI_ASIC_ADDR_RANGE 0x100U
258 
259 
260 // Initializers for device configurations
261 
262 #define PCPS_DEV_CLASS_CODE 0x08800000UL
263 #define PCI_ASIC_BADR0_INIT ( ~( PCI_ASIC_ADDR_RANGE - 1 ) | 0x01 )
264 
265 
266 #define PCI_ASIC_CFG_PCI510 \
267 { \
268  _hilo_32( PCPS_DEV_CLASS_CODE ), \
269  _hilo_16( PCI_ASIC_BADR0_INIT ), \
270  _hilo_16( PCI_DEV_PCI510 ) \
271 }
272 
273 #define PCI_ASIC_CFG_GPS169PCI \
274 { \
275  _hilo_32( PCPS_DEV_CLASS_CODE ), \
276  _hilo_16( PCI_ASIC_BADR0_INIT ), \
277  _hilo_16( PCI_DEV_GPS169PCI ) \
278 }
279 
280 #define PCI_ASIC_CFG_TCR510PCI \
281 { \
282  _hilo_32( PCPS_DEV_CLASS_CODE ), \
283  _hilo_16( PCI_ASIC_BADR0_INIT ), \
284  _hilo_16( PCI_DEV_TCR510PCI ) \
285 }
286 
287 #define PCI_ASIC_CFG_TCR167PCI \
288 { \
289  _hilo_32( PCPS_DEV_CLASS_CODE ), \
290  _hilo_16( PCI_ASIC_BADR0_INIT ), \
291  _hilo_16( PCI_DEV_TCR167PCI ) \
292 }
293 
294 #define PCI_ASIC_CFG_GPS170PCI \
295 { \
296  _hilo_32( PCPS_DEV_CLASS_CODE ), \
297  _hilo_16( PCI_ASIC_BADR0_INIT ), \
298  _hilo_16( PCI_DEV_GPS170PCI ) \
299 }
300 
301 #define PCI_ASIC_CFG_PCI511 \
302 { \
303  _hilo_32( PCPS_DEV_CLASS_CODE ), \
304  _hilo_16( PCI_ASIC_BADR0_INIT ), \
305  _hilo_16( PCI_DEV_PCI511 ) \
306 }
307 
308 #define PCI_ASIC_CFG_TCR511PCI \
309 { \
310  _hilo_32( PCPS_DEV_CLASS_CODE ), \
311  _hilo_16( PCI_ASIC_BADR0_INIT ), \
312  _hilo_16( PCI_DEV_TCR511PCI ) \
313 }
314 
315 
316 
329 #define _convert_asic_version_number( _n ) \
330  ( ( (_n) < 0x100 ) ? ( (_n) << 8 ) : (_n) )
331 
332 
333 
334 #define PCPS_ASIC_STR_FMT "%u.%02X" // TODO Or should this be "%u.%02u"
335 
339 #define _pcps_asic_version_major( _v ) \
340  ( ( (_v) >> 8 ) & 0xFF )
341 
342 
346 #define _pcps_asic_version_minor( _v ) \
347  ( (_v) & 0xFF )
348 
349 
350 
354 #define _pcps_asic_version_greater_equal( _v, _v_major, _v_minor ) \
355  ( \
356  ( _pcps_asic_version_major( _v ) == (_v_major) ) && \
357  ( _pcps_asic_version_minor( _v ) >= (_v_minor) ) \
358  )
359 
360 
361 
368 {
383 };
384 
385 
386 
399 #define PCI_ASIC_CURRENT_MINOR_PEX511 0x04
400 #define PCI_ASIC_REQUIRED_MINOR_PEX511 0x03
401 #define PCI_ASIC_FIX_HRT_MINOR_PEX511 0x04 // Increases HRT accuracy
402 #define PCI_ASIC_FIX_IRQ_MINOR_PEX511 0x03 // Fixes IRQ problem
403 #define PCI_ASIC_HR_TIME_MINOR_PEX511 0x02 // Supports HR time with PEX511
404 
405 #define PCI_ASIC_CURRENT_MINOR_GPS170PEX 0x05
406 #define PCI_ASIC_REQUIRED_MINOR_GPS170PEX 0x03
407 #define PCI_ASIC_ENH_HRT_MINOR_GPS170PEX 0x05 // Enhanced MM HRT accuracy
408 #define PCI_ASIC_FIX_HRT_MINOR_GPS170PEX 0x04 // Increases MM HRT accuracy
409 #define PCI_ASIC_FIX_IRQ_MINOR_GPS170PEX 0x03 // Fixes IRQ problem
410 
411 #define PCI_ASIC_CURRENT_MINOR_TCR511PEX 0x04
412 #define PCI_ASIC_REQUIRED_MINOR_TCR511PEX 0x03
413 // 0x04 // EPLD sources shared with PEX511 0x04
414 #define PCI_ASIC_FIX_IRQ_MINOR_TCR511PEX 0x03 // Fixes IRQ problem, increases HRT accuracy
415 
416 #define PCI_ASIC_CURRENT_MINOR_PTP270PEX 0x06
417 #define PCI_ASIC_REQUIRED_MINOR_PTP270PEX 0x01
418 // 0x06 // Supports 1 PPS pulse shift
419 // 0x05 // ...
420 // 0x04 // ...
421 // 0x03 // ...
422 // 0x02 // Increased accuracy of IRIG DCLS slopes
423 // 0x01 // Supports inversion of ucap slopes
424 
425 #define PCI_ASIC_CURRENT_MINOR_FRC511PEX 0x01
426 #define PCI_ASIC_REQUIRED_MINOR_FRC511PEX 0x01
427 
428 #define PCI_ASIC_CURRENT_MINOR_TCR170PEX 0x03
429 #define PCI_ASIC_REQUIRED_MINOR_TCR170PEX 0x02
430 #define PCI_ASIC_FIX_EE_ACCESS_TCR170PEX 0x02 // Fixes EE access problem after reset
431 #define PCI_ASIC_FIX_FO_IN_LEVEL_TCR170PEX 0x03 // Correct polarity for fiber optic input
432 
433 #define PCI_ASIC_CURRENT_MINOR_GPS180PEX 0x06
434 #define PCI_ASIC_REQUIRED_MINOR_GPS180PEX 0x01
435 // 0x01 // Updated VHDL compiler and associated PCI primitives
436 // 0x02 // I/O using 3.3V LVTTL
437 // 0x03 // GPS TIC pulse len now 1 sample clock
438 // 0x04 // Enabled PCI IRQ line which had unintentionally been disabled earlier
439 // 0x05 // Increased accuracy of synthesizer output
440 // 0x06 // T0 AUX Capture used by firmware v2.0x
441 
442 #define PCI_ASIC_CURRENT_MINOR_TCR180PEX 0x00
443 #define PCI_ASIC_REQUIRED_MINOR_TCR180PEX 0x00
444 
445 #define PCI_ASIC_CURRENT_MINOR_PZF180PEX 0x01
446 #define PCI_ASIC_REQUIRED_MINOR_PZF180PEX 0x00
447 // 0x01 // ...
448 
449 #define PCI_ASIC_CURRENT_MINOR_GLN180PEX 0x00
450 #define PCI_ASIC_REQUIRED_MINOR_GLN180PEX 0x00
451 
452 #define PCI_ASIC_CURRENT_MINOR_GNS181PEX 0x00
453 #define PCI_ASIC_REQUIRED_MINOR_GNS181PEX 0x00
454 
464 typedef struct
465 {
466  unsigned int dev_type_num;
467  unsigned int major;
468  unsigned int current_minor;
469  unsigned int required_minor;
470 
472 
473 
481 #define DEFAULT_PCI_ASIC_VERSION_INFO_TABLE \
482 { \
483  { PCPS_TYPE_PEX511, PCI_ASIC_MAJOR_PEX511, PCI_ASIC_CURRENT_MINOR_PEX511, PCI_ASIC_REQUIRED_MINOR_PEX511 }, \
484  { PCPS_TYPE_GPS170PEX, PCI_ASIC_MAJOR_GPS170PEX, PCI_ASIC_CURRENT_MINOR_GPS170PEX, PCI_ASIC_REQUIRED_MINOR_GPS170PEX }, \
485  { PCPS_TYPE_TCR511PEX, PCI_ASIC_MAJOR_TCR511PEX, PCI_ASIC_CURRENT_MINOR_TCR511PEX, PCI_ASIC_REQUIRED_MINOR_TCR511PEX }, \
486  { PCPS_TYPE_PTP270PEX, PCI_ASIC_MAJOR_PTP270PEX, PCI_ASIC_CURRENT_MINOR_PTP270PEX, PCI_ASIC_REQUIRED_MINOR_PTP270PEX }, \
487  { PCPS_TYPE_FRC511PEX, PCI_ASIC_MAJOR_FRC511PEX, PCI_ASIC_CURRENT_MINOR_FRC511PEX, PCI_ASIC_REQUIRED_MINOR_FRC511PEX }, \
488  { PCPS_TYPE_TCR170PEX, PCI_ASIC_MAJOR_TCR170PEX, PCI_ASIC_CURRENT_MINOR_TCR170PEX, PCI_ASIC_REQUIRED_MINOR_TCR170PEX }, \
489  { PCPS_TYPE_GPS180PEX, PCI_ASIC_MAJOR_GPS180PEX, PCI_ASIC_CURRENT_MINOR_GPS180PEX, PCI_ASIC_REQUIRED_MINOR_GPS180PEX }, \
490  { PCPS_TYPE_TCR180PEX, PCI_ASIC_MAJOR_TCR180PEX, PCI_ASIC_CURRENT_MINOR_TCR180PEX, PCI_ASIC_REQUIRED_MINOR_TCR180PEX }, \
491  { PCPS_TYPE_PZF180PEX, PCI_ASIC_MAJOR_PZF180PEX, PCI_ASIC_CURRENT_MINOR_PZF180PEX, PCI_ASIC_REQUIRED_MINOR_PZF180PEX }, \
492  { PCPS_TYPE_GLN180PEX, PCI_ASIC_MAJOR_GLN180PEX, PCI_ASIC_CURRENT_MINOR_GLN180PEX, PCI_ASIC_REQUIRED_MINOR_GLN180PEX }, \
493  { PCPS_TYPE_GPS180AMC, PCI_ASIC_MAJOR_GPS180PEX, PCI_ASIC_CURRENT_MINOR_GPS180PEX, PCI_ASIC_REQUIRED_MINOR_GPS180PEX }, \
494  { PCPS_TYPE_GNS181PEX, PCI_ASIC_MAJOR_GNS181PEX, PCI_ASIC_CURRENT_MINOR_GNS181PEX, PCI_ASIC_REQUIRED_MINOR_GNS181PEX }, \
495  { 0 } \
496 }
497 
498 
499 /* ----- function prototypes begin ----- */
500 
501 /* This section was generated automatically */
502 /* by MAKEHDR, do not remove the comments. */
503 
504 /* (no header definitions found) */
505 
506 /* ----- function prototypes end ----- */
507 
508 #ifdef __cplusplus
509 }
510 #endif
511 
512 
513 #if defined( _USING_BYTE_ALIGNMENT )
514  #pragma pack() // set default alignment
515  #undef _USING_BYTE_ALIGNMENT
516 #endif
517 
518 /* End of header body */
519 
520 #undef _ext
521 #undef _DO_INIT
522 
523 #endif /* _PCI_ASIC_H */
PCI_ASIC_ADDON_DATA reserved_2
Currently not implemented / used.
Definition: pci_asic.h:209
uint32_t ul
Definition: pci_asic.h:140
PCI_ASIC_REG reserved_1
Currently not implemented / used.
Definition: pci_asic.h:206
unsigned int dev_type_num
Definition: pci_asic.h:466
uint16_t cfg_dev_id
Definition: pci_asic.h:130
A structure holding version information for a specific device.
Definition: pci_asic.h:464
PEX EPLD for PZF180PEX.
Definition: pci_asic.h:379
PEX EPLD for TCR180PEX.
Definition: pci_asic.h:378
unsigned short uint16_t
Definition: words.h:213
PCI_ASIC_MAJOR_VERSION_NUMBERS
ASIC major version numbers.
Definition: pci_asic.h:367
PEX EPLD for TCR511PEX.
Definition: pci_asic.h:373
PEX EPLD for GPS170PEX.
Definition: pci_asic.h:372
PCI_ASIC_ADDON_DATA addon_data
Register set used to return data from add-on to PCI bus.
Definition: pci_asic.h:208
PCI_ASIC_FEATURES features
PCI ASIC feature mask, see PCI_ASIC_FEATURE_MASKS.
Definition: pci_asic.h:202
PEX EPLD for GPS180PEX/GPS180AMC.
Definition: pci_asic.h:377
A PCI ASIC register as 32, 16, or 8 bit accessible union.
Definition: pci_asic.h:138
PEX EPLD for GNS181PEX.
Definition: pci_asic.h:381
uint16_t cfg_badr_0
Definition: pci_asic.h:129
PEX EPLD for FRC511PEX.
Definition: pci_asic.h:375
Register layout of a PCI ASIC.
Definition: pci_asic.h:198
fixed version of PCI ASIC
Definition: pci_asic.h:370
the number of known codes
Definition: pci_asic.h:382
uint32_t PCI_ASIC_FEATURES
A data type to hold the PCI ASIC feature flags mask.
Definition: pci_asic.h:162
unsigned char uint8_t
Definition: words.h:210
unsigned int major
Definition: pci_asic.h:467
Set of PCI ASIC registers which are writeable once after power-up.
Definition: pci_asic.h:126
PCI_ASIC_REG status_port
The status port register.
Definition: pci_asic.h:203
PCI ASIC with CRC bug.
Definition: pci_asic.h:369
PEX EPLD for GLN180PEX.
Definition: pci_asic.h:380
PEX EPLD for TCR170PEX.
Definition: pci_asic.h:376
unsigned int required_minor
Definition: pci_asic.h:469
The addon-data part of a PCI ASIC.
Definition: pci_asic.h:185
uint32_t PCI_ASIC_VERSION
A data type to hold the PCI ASIC version code.
Definition: pci_asic.h:151
PCI_ASIC_VERSION raw_version
Raw version code.
Definition: pci_asic.h:201
PEX EPLD for PTP270PEX.
Definition: pci_asic.h:374
unsigned int current_minor
Definition: pci_asic.h:468
uint32_t cfg_class_rev_id
Definition: pci_asic.h:128
PEX EPLD for PEX511.
Definition: pci_asic.h:371
PCI_ASIC_REG pci_data
Register used to pass byte from PCI bus to add-on side.
Definition: pci_asic.h:205
PCI_ASIC_REG control_status
See PCI_ASIC_CONTROL_STATUS_MASKS.
Definition: pci_asic.h:204
PCI_ASIC_CFG cfg
Registers which are writeable from add-on once after power-up.
Definition: pci_asic.h:200