FlxCard
Loading...
Searching...
No Matches
FlxCard.h
1/*******************************************************************
2 * \mainpage *
3 * *
4 * @author: Markus Joos, CERN *
5 * Maintainer: Henk Boterenbrood, Nikhef *
6 * *
7 * @brief *
8 * This note defines an application program interface (API) for *
9 * the use of the FLX PCIe I/O card in the ATLAS read-out system. *
10 * The intention of the API is to satisfy the needs of simple *
11 * test programs as well as the requirements of the *
12 * FelixApplication. *
13 * *
14 * @copyright CERN, Nikhef *
15 ******************************************************************/
16
17#ifndef FLXCARD_H
18#define FLXCARD_H
19
20#include <cstdint>
21#include <vector>
22#include <string>
23#include <sys/types.h>
24#include <utility> // std::pair
25
26#include "flxcard/flx_common.h"
27#include "regmap/regmap.h"
28#include "flxcard/LinkConfig.h"
29
30// Constants
31#define NUM_INTERRUPTS 8
32#define FLX_GBT_FILE_NOT_FOUND -1
33#define FLX_GBT_VERSION_NOT_FOUND -2
34#define FLX_GBT_TMODE_FEC 0
35#define FLX_GBT_ALIGNMENT_CONTINUOUS 0
36#define FLX_DMA_WRAPAROUND 1
37#define FLX_GBT_ALIGNMENT_ONE 1
38#define FLX_GBT_CHANNEL_AUTO 1
39#define FLX_GBT_TMODE_WideBus 1
40
41// Firmware types
42#define FIRMW_GBT 0
43#define FIRMW_FULL 1
44#define FIRMW_LTDB 2
45#define FIRMW_FEI4 3
46#define FIRMW_PIXEL 4
47#define FIRMW_STRIP 5
48#define FIRMW_FELIG_GBT 6
49#define FIRMW_FELIG 6 // Backwards compatible
50#define FIRMW_FMEMU 7
51#define FIRMW_MROD 8
52#define FIRMW_LPGBT 9
53#define FIRMW_INTERLAKEN 10
54#define FIRMW_FELIG_LPGBT 11
55#define FIRMW_HGTD_LUMI 12
56#define FIRMW_BCM_PRIME 13
57#define FIRMW_FELIG_PIXEL 14
58#define FIRMW_FELIG_STRIP 15
59#define FIRMW_WUPPER 16
60#define FIRMW_TPX4 17
61const std::vector<std::string> FIRMW_STR{ "GBT", "FULL", "LTDB", "FEI4", "PIXEL",
62 "STRIP", "FELIG", "FM-EMU", "MROD", "LPGBT",
63 "INTERLAKEN", "FELIG-LPGBT", "HGTD-LUMI",
64 "BCM-PRIME", "FELIG-PIXEL", "FELIG-STRIP",
65 "WUPPER", "TPX4" };
66
67// Interrupts
68#define ALL_IRQS 0xFFFFFFFF
69
70// Monitoring devices
71#define FPGA_MONITOR 0x001
72#define POD_MONITOR_ALL 0x002
73#define POWER_MONITOR 0x004
74#define FIREFLY_MONITOR 0x008
75#define POD_MONITOR_LOS 0x100
76#define POD_MONITOR_TEMP_VOLT 0x200
77#define POD_MONITOR_POWER 0x400
78#define POD_MONITOR_POWER_RX 0x800
79// (Backwards compatability)
80#define POD_MONITOR POD_MONITOR_ALL
81
82// Resource locking
83#define LOCK_NONE 0x0000
84#define LOCK_DMA0 0x0001
85#define LOCK_DMA1 0x0002
86#define LOCK_I2C 0x0004
87#define LOCK_FLASH 0x0008
88#define LOCK_ELINK 0x0010
89#define LOCK_READ_CONFIG 0x0020
90#define LOCK_ALL 0xFFFFFFFF
91#define LOCK_DMA(n) (1<<(16+n))
92
93// Other constants
94#define ALL_BITS 0xFFFFFFFFFFFFFFFF
95
96// Register model
97typedef struct
98{
99 volatile u_long start_address; /* low half, bits 63:00 */
100 volatile u_long end_address; /* low half, bits 127:64 */
101 volatile u_long tlp :11; /* high half, bits 10:00 */
102 volatile u_long fromhost : 1; /* high half, bit 11 */
103 volatile u_long wrap_around : 1; /* high half, bit 12 */
104 volatile u_long reserved :51; /* high half, bits 63:13 */
105 volatile u_long sw_pointer; /* high half, bits 127:64 */
107
108typedef struct
109{
110 volatile u_long fw_pointer; /* bits 63:00 */
111 volatile u_long descriptor_done : 1; /* bit 64 */
112 volatile u_long even_addr_dma : 1; /* bit 65 */
113 volatile u_long even_addr_pc : 1; /* bit 66 */
115
116typedef struct
117{
118 volatile u_int control; /* bits 63:00 */
119 volatile u_int data; /* bits 95:64 */
120 volatile u_long address; /* bits 127:96 */
121} int_vec_t;
122
123typedef struct
124{
125 volatile u_long date_time : 40; /* bits 39:00 */
126 volatile u_long reserved : 24; /* bits 63:40 */
127 volatile u_long revision : 16; /* bits 79:64 */
128} board_id_t;
129
130typedef struct
131{
132 dma_descriptor_t DMA_DESC[8]; /* 0x000 - 0x0ff */
133 u_char unused1[256]; /* 0x100 - 0x1ff */
134 dma_status_t DMA_DESC_STATUS[8]; /* 0x200 - 0x27f */
135 u_char unused2[128]; /* 0x280 - 0x2ff */
136 volatile u_int BAR0_VALUE; /* 0x300 - 0x303 */
137 u_char unused3[12]; /* 0x304 - 0x30f */
138 volatile u_int BAR1_VALUE; /* 0x310 - 0x313 */
139 u_char unused4[12]; /* 0x314 - 0x31f */
140 volatile u_int BAR2_VALUE; /* 0x320 - 0x323 */
141 u_char unused5[220]; /* 0x324 - 0x3ff */
142 volatile u_int DMA_DESC_ENABLE; /* 0x400 - 0x403 */
143 u_char unused7[28]; /* 0x404 - 0x41f */
144 volatile u_int DMA_RESET; /* 0x420 - 0x423 */
145 u_char unused8[12]; /* 0x424 - 0x42f */
146 volatile u_int SOFT_RESET; /* 0x430 - 0x433 */
147 u_char unused9[12]; /* 0x434 - 0x43f */
148 volatile u_int REGISTERS_RESET; /* 0x440 - 0x443 */
150
151typedef struct
152{
153 int_vec_t INT_VEC[8]; /* 0x000 - 0x07f */
154 u_char unused1[128]; /* 0x080 - 0x0ff */
155 volatile u_int INT_TAB_ENABLE; /* 0x100 - 0x103 */
157
158typedef struct
159{
160 u_int n_devices;
161 u_int cdmap[MAXCARDS][2];
163
164// Forward declaration (see I2CDevices.h)
165typedef struct i2c_device i2c_device_t;
166
167// Device parameters typedefs
168
169typedef struct
170{
171 double temperature;
172 double vccint;
173 double vccaux;
174 double vccbram;
175 u_long fanspeed;
176 u_long dna;
178
179typedef struct
180{
181 bool absent;
182 char name[10];
183 int temp;
184 double v33;
185 double v25;
186 int los;
187 char vname[16];
188 char voui[3];
189 char vpnum[16];
190 char vrev[2];
191 char vsernum[16];
192 char vdate[8];
193 int optical_power_uw[12];
195
196typedef struct
197{
198 std::string name;
199 double vccint_current;
200 double vccint_voltage;
201 double mgtavcc_current;
202 double mgtavcc_voltage;
203 double fpga_internal_diode_temperature;
204 double mgtavtt_current; // Only FLX-712
205 double mgtavtt_voltage; // Only FLX-712
206 double mgtavttc_voltage; // Only FLX-711
207 double mgtvccaux_voltage; // Only FLX-711
208 double internal_temperature;
209 double vcc;
211
212typedef struct
213{
214 std::string name;
215 double pex0p9v_current;
216 double pex0p9v_voltage;
217 double sys18_current;
218 double sys18_voltage;
219 double sys12_voltage; // Only FLX-711
220 double sys25_current; // Only FLX-712
221 double sys25_voltage;
222 double pex8732_internal_diode_temperature;
223 double internal_temperature;
224 double vcc;
226
227typedef struct
228{
229 std::string name;
230 uint32_t t_local_hi; // In degrees C
231 uint32_t t_local_lo; // In 1/10000ths C
232 uint32_t t_remote_hi; // In degrees C
233 uint32_t t_remote_lo; // In 1/10000ths C
234 uint32_t status;
235 uint32_t device_id;
236 uint32_t manufacturer_id;
238
239typedef struct
240{
241 std::string name;
242 uint32_t config_reg;
243 uint32_t shunt_volt_reg;
244 uint32_t bus_volt_reg;
245 uint32_t power_reg;
246 uint32_t current_reg;
247 uint32_t calib_reg;
248 uint32_t manufacturer_id;
249 double r_shunt;
251
252typedef struct
253{
254 std::string name;
255 uint32_t mfr_special_id;
256 uint32_t vin;
257 uint32_t iin;
258 uint32_t pin;
259 uint32_t vout[2];
260 uint32_t iout[2];
261 uint32_t pout[2];
262 uint32_t temp_die;
263 uint32_t temp_ext[2];
265
266typedef struct
267{
268 std::string name;
269 bool valid;
270 uint32_t manufacturer_id;
271 uint32_t silicon_rev;
272 uint8_t input_cfg[10][8];
273 uint32_t fault_stat[6];
274 uint32_t adc[12];
275 double adc_fullscale[12];
276 std::string adc_name[12];
278
279typedef struct
280{
281 std::string name;
282 bool valid;
283 uint32_t ic_device_id;
284 uint64_t ic_device_rev;
285 uint32_t vout[17];
286 uint32_t vout_mode[17];
287 uint32_t status_vout[17];
288 std::string vout_name[17];
289 uint32_t vout_uv_warn[17];
290 uint32_t vout_uv_fault[17];
291 uint32_t vout_ov_warn[17];
292 uint32_t vout_ov_fault[17];
294
296{
297public:
298 std::string name;
299 bool absent;
300
301 // FireFly TX lower memory map
302 uint32_t status;
303 uint32_t status_summ;
304 uint32_t latched_alarms_tx_los;
305 uint32_t latched_alarms_tx_fault;
306 uint32_t latched_alarms_temp;
307 uint32_t latched_alarms_vcc33;
308 uint32_t latched_alarms_cdr_lol;
309 int32_t case_temp;
310 uint32_t vcc;
311 uint32_t elapsed_optime;
312 uint32_t chan_disable;
313 uint32_t squelch_disable;
314 uint32_t polarity_invert;
315 uint64_t input_equalization;
316 uint32_t cdr_enable;
317 uint32_t mask_tx_los_alarms;
318 uint32_t mask_fault_flags;
319 uint32_t mask_temp_alarms;
320 uint32_t mask_vcc33_alarms;
321 uint32_t mask_cdr_lol_alarms;
322 uint32_t firmware_version;
323
324 // Upper page 0
325 std::string vendor_part;
326 std::string vendor_serial;
327};
328
330{
331public:
332 std::string name;
333 bool absent;
334
335 // FireFly RX lower memory map
336 uint32_t status;
337 uint32_t status_summ;
338 uint32_t latched_alarms_rx_los;
339 uint32_t latched_alarms_rx_power;
340 uint32_t latched_alarms_temp;
341 uint32_t latched_alarms_vcc33;
342 uint32_t latched_alarms_cdr_lol;
343 int32_t case_temp;
344 uint32_t vcc;
345 uint32_t elapsed_optime;
346 uint32_t chan_disable;
347 uint32_t output_disable;
348 uint32_t polarity_invert;
349 uint64_t output_swing;
350 uint64_t output_preemphasis;
351 uint32_t cdr_enable;
352 uint32_t firmware_version;
353
354 // Upper page 0
355 std::string vendor_part;
356 std::string vendor_serial;
357
358 // Upper page 1
359 uint32_t optical_power[12];
360};
361
363{
364public:
365 std::string name;
366 bool absent;
367
368 // FireFly TX/RX lower memory map
369 uint32_t status;
370 uint32_t latched_alarms_tx_los;
371 uint32_t latched_alarms_tx_fault;
372 uint32_t latched_alarms_cdr_lol;
373 uint32_t latched_alarms_temp;
374 uint32_t latched_alarms_vcc;
375 uint32_t latched_alarms_rx_power;
376 uint32_t elapsed_optime;
377 int32_t case_temp;
378 uint32_t vcc_3v3;
379 uint32_t vcc_1v8;
380 uint32_t rx_optical_power[4];
381 uint32_t firmware_revision;
382 uint32_t tx_chan_disable;
383 uint32_t cdr_enable;
384 uint32_t cdr_rate_select;
385 uint32_t mask_los_alarms;
386 uint32_t mask_tx_fault_flags;
387 uint32_t mask_cdr_lol_alarms;
388 uint32_t mask_temp_alarms;
389 uint32_t mask_vcc_alarms;
390
391 // Upper page 0;
392 std::string vendor_part;
393 std::string vendor_serial;
394};
395
396// Device monitoring data collections typedefs
397
398typedef fpga_parameters_t fpga_monitoring_t;
399
400typedef struct
401{
402 ltc2991_1_parameters_t ltc2991_1;
403 ltc2991_2_parameters_t ltc2991_2;
405
406typedef struct
407{
408 ina226_parameters_t ina226[10+1]; // +1 for FLX-155
410
411typedef struct
412{
413 tmp435_parameters_t tmp435[7+1]; // +1 for FLX-155
415
416typedef ltm4700_parameters_t ltm_monitoring_t;
417
418typedef struct
419{
420 adm1066_parameters_t adm1066[2];
421 adm1266_parameters_t adm1266;
423
425{
426public:
427 FireFlyTxParams ffly_tx[2+2]; // +2 for FLX-155
428 FireFlyRxParams ffly_rx[2+2]; // +2 for FLX-155
429 FireFlyTxRxParams ffly_tr[1+1]; // +1 for FLX-155
430};
431
432typedef struct
433{
434 minipod_parameters_t minipod[8];
436
437typedef struct
438{
439 fpga_monitoring_t fpga;
442 ltm_monitoring_t ltm;
446 FireFlyMonitorData firefly;
448
449// Macros
450#define TOHEX(n) std::hex << "0x" << (n) << std::dec
451
453{
454public:
457
458 ~FlxCard();
459
511 void card_open( int device_nr, u_int lock_mask,
512 bool read_config = false,
513 bool ignore_version = false );
514
522
529 static u_int number_of_cards();
530
542 static u_int number_of_devices();
543
561
572 static int card_to_device_number( int card_number );
573
595 u_int lock_mask( int device_nr );
596 u_int get_lock_mask( int device_nr ) { return lock_mask( device_nr ); } // Backwards-compatibility
597
603 u_long openBackDoor( int bar );
607 u_long bar0Address() { return openBackDoor( 0 ); }
611 u_long bar1Address() { return openBackDoor( 1 ); }
615 u_long bar2Address() { return openBackDoor( 2 ); }
617
629 int dma_max_tlp_bytes() { return m_maxTlpBytes; }
630
649 void dma_to_host( u_int dma_id, u_long dst, size_t size, u_int flags );
650
683 void dma_from_host( u_int dma_id, u_long src, size_t size, u_int flags );
684
689 bool dma_enabled( u_int dma_id );
690
699 void dma_wait( u_int dma_id );
700
706 void dma_stop( u_int dma_id );
707
719 void dma_advance_ptr( u_int dma_id, u_long dst, size_t size, size_t bytes );
720
726 void dma_set_ptr( u_int dma_id, u_long dst );
727
735 u_long dma_get_ptr( u_int dma_id );
736 /* For backwards compatibility: */
737 u_long dma_get_read_ptr( u_int dma_id ) { return dma_get_ptr( dma_id ); }
738
739 // Sets the DMA_FIFO_FLUSH register to "1".
740 //void dma_fifo_flush(); //MJ: disabled. See FlxCard.cpp
741
745 void dma_reset();
746
753 u_long dma_get_fw_ptr( u_int dma_id );
754 /* For backwards compatibility: */
755 u_long dma_get_current_address( u_int dma_id ) { return dma_get_fw_ptr( dma_id ); }
756
762 bool dma_cmp_even_bits( u_int dma_id );
763
767
773
798 void i2c_read( const char *device_str, u_char reg_addr, u_char *value, int nbytes = 1 );
799
803 void i2c_write( const char *device_str, u_char reg_addr, u_char data );
804 void i2c_write( const char *device_str, u_char reg_addr, u_char *data, int nbytes );
805
817 void i2c_write_byte( u_char dev_addr, u_char byte );
818
824 void i2c_write_byte( u_char dev_addr, u_char reg_addr, u_char byte );
825
830 u_char i2c_read_byte( u_char dev_addr, u_char reg_addr );
831
839 bool i2c_flush( u_int *count = 0 );
840
845 void i2c_write_bytes( uint8_t dev_addr, uint8_t reg_addr,
846 int nbytes, uint8_t *bytes );
847 void i2c_read_bytes ( uint8_t dev_addr, uint8_t reg_addr,
848 int nbytes, uint8_t *bytes );
849
853
859
869 u_int gbt_setup( int alignment, int channel_mode );
870
881 long int gbt_version_delay( u_long svn_version, char *filename );
882
898 u_long rxusrclk_freq( u_int channel );
899
903 u_long txusrclk_freq( u_int channel );
904
909 void gth_rx_reset( int quad = -1 );
910
914
920
933 void irq_enable( u_int interrupt = ALL_IRQS );
934
948 void irq_disable( u_int interrupt = ALL_IRQS );
949
961 void irq_wait( u_int interrupt );
962
980 void irq_clear( u_int interrupt = ALL_IRQS );
981
995 void irq_cancel( u_int interrupt = ALL_IRQS );
996
1007 void irq_reset_counters( u_int interrupt = ALL_IRQS );
1008
1012
1019
1032 u_long cfg_get_option( const char *key, bool show_options = false );
1033
1047 void cfg_set_option( const char *key, u_long value, bool show_options = false );
1048
1059 u_long cfg_get_reg( const char *key );
1060
1072 void cfg_set_reg( const char *key, u_long value );
1073
1080
1087 static regmap_register_t *cfg_register( const char *name );
1094 static regmap_bitfield_t *cfg_bitfield( const char *name );
1106 static std::string cfg_bitfield_options( const char *name, bool include_all_substr = true );
1107
1111
1123 u_int card_model() { return m_cardType; }
1124 u_int card_type() { return card_model(); }
1125
1129 u_int firmware_type() { return m_firmwareType; }
1130
1135 { return( m_firmwareType<FIRMW_STR.size() ? FIRMW_STR[m_firmwareType] : std::string("????") ); }
1136
1140 std::string firmware_string() { return m_firmwareString; }
1141
1145 bool lpgbt_type() { return m_lpgbtType; }
1146
1150 bool lpgbt_fec12() { return m_lpgbtFec12; }
1151
1155 bool lpgbt_5gbps() { return m_lpgbt5Gbps; }
1156
1160 bool fullmode_type() { return m_fullmodeType; }
1161
1166
1171
1175 u_int number_of_endpoints() { return m_numberOfEndpoints; }
1176
1180 u_int endpoint() { return m_endpoint; }
1181
1185 u_int number_of_channels() { return m_numberOfChans; }
1186
1190 std::pair<int,int> ec_elink_indices();
1191 int ec_elink_tohost_index();
1192 int ec_elink_fromhost_index();
1193
1197 std::pair<int,int> ic_elink_indices();
1198 int ic_elink_tohost_index();
1199 int ic_elink_fromhost_index();
1200
1204
1210
1211 fpga_monitoring_t fpga_monitoring();
1212 ltc_monitoring_t power_monitoring_ltc2991();
1213 ina_monitoring_t power_monitoring_ina226( int *ina_count = 0 );
1214 tmp_monitoring_t temperature_monitoring_tmp435( int *tmp_count = 0 );
1215 ltm_monitoring_t power_monitoring_ltm4700();
1216 adm_monitoring_t powersequencer_monitoring_adm1x66( int *adm_count = 0 );
1217 minipod_monitoring_t minipod_monitoring( u_int selection, int *number_of_pods = 0 );
1218 FireFlyMonitorData firefly_monitoring( int *tx_count = 0, int *rx_count = 0, int *tr_count = 0 );
1219
1244
1249
1254
1259 std::vector<int> minipods_temperature();
1260
1267 std::vector<std::pair<std::string, std::vector<int>>> minipods_optical_power();
1268
1273 std::vector<std::pair<std::string, std::vector<int>>> firefly_optical_power();
1274
1281 bool firefly_detect( const std::string &device_name,
1282 std::string &vendor_part,
1283 std::string &vendor_sn );
1284
1288
1294
1301 void configure( std::string filename, bool do_links = true, bool do_registers = true );
1302
1307 void readConfiguration( std::string filename );
1308 void read_configuration( std::string filename ) { readConfiguration(filename); }
1309
1316 void read_configuration() { readConfiguration(); }
1317
1322 u_int number_of_elinks_tohost( int dma_index = -1 );
1323
1329 u_int number_of_elinks_fromhost() { return number_of_elinks_toflx(); }
1330
1335 std::vector<flxcard::elink_descr_t> elinks_tohost( int dma_index = -1 );
1336
1341 std::vector<flxcard::elink_descr_t> elinks_toflx();
1342 std::vector<flxcard::elink_descr_t> elinks_fromhost() { return elinks_toflx(); }
1343
1344 std::vector<flxcard::elink_descr_t> elinks_toflx_broadcast();
1345 std::vector<flxcard::elink_descr_t> elinks_fromhost_broadcast() { return elinks_toflx_broadcast(); }
1346
1350 u_int number_of_dma_tohost() { return m_numberOfDma; }
1351
1356 bool uses_dma_index_mask() { return m_useDmaIndexMask; }
1357
1358 void set_hdlc_instant_timeout( bool b ) { m_hdlcInstantTimeout = b; }
1359 bool hdlc_instant_timeout( ) { return m_hdlcInstantTimeout; }
1360
1364 unsigned int link_mode();
1365
1369 bool is_elink_enabled( u_int channel, u_int egroup, u_int epath, bool is_to_flx );
1370
1374 unsigned int tohost_elink_dmaid( u_int channel, u_int egroup, u_int epath );
1375
1379 unsigned int tohost_elink_dmaid( uint16_t elinknr );
1380
1384 bool has_tohost_elink_streams( u_int channel, u_int egroup, u_int epath );
1385
1390 uint8_t detector_id();
1391
1398 uint16_t connector_id( uint16_t channel );
1399
1400 uint32_t number_of_epaths_per_egroup( bool to_flx = false );
1401
1402 uint32_t number_of_egroups( bool to_flx = false );
1403
1404 uint16_t elink_number( uint32_t channel, uint32_t egroup,
1405 uint32_t epath, bool to_flx = false );
1406
1407 uint16_t channel_number( uint32_t elinknr );
1408 uint16_t link_number( uint32_t elinknr ) { return channel_number(elinknr); }
1409
1410 uint16_t egroup_number( uint32_t elinknr, bool to_flx = false );
1411
1412 uint16_t epath_number( uint32_t elinknr, bool to_flx = false );
1413
1417
1418private:
1419 static int m_cardsOpen;
1420 int m_fd;
1421 int m_deviceNumber;
1422 int m_maxTlpBytes;
1423 u_int m_cardType;
1424 u_int m_firmwareType;
1425 bool m_configRead;
1426 bool m_lpgbtType;
1427 bool m_lpgbtFec12;
1428 bool m_lpgbt5Gbps;
1429 bool m_fullmodeType;
1430 bool m_useDmaIndexMask;
1431 bool m_hdlcInstantTimeout;
1432 u_int m_numberOfEndpoints;
1433 u_int m_endpoint;
1434 u_int m_numberOfChans;
1435 u_int m_numberOfDma;
1436 u_int m_fromHostDataFormat;
1437 std::string m_firmwareString;
1438 u_int m_myLocks;
1439 u_int m_myLockTag; //MJ: do we still need the lock tag??
1440 u_long m_bar0Base;
1441 u_long m_bar1Base;
1442 u_long m_bar2Base;
1443
1444 // Space to store a device's e-link configuration, for all links + Emulator 'link'
1445 flxcard::LinkConfig m_linkConfig[flxcard::FLX_LINKS + 1];
1446
1447 // Space to store additional register settings
1448 std::vector<flxcard::regsetting_t> m_regSettings;
1449
1450public:
1456 volatile flxcard_bar0_regs_t *m_bar0;
1457 volatile flxcard_bar1_regs_t *m_bar1;
1458 volatile flxcard_bar2_regs_t *m_bar2;
1459
1460 // Pointer to a list of this FLX device's I2C devices
1461 i2c_device_t const *m_i2cDevices;
1462
1466
1467private:
1468 u_long map_memory_bar( u_long pci_addr, size_t size );
1469 void unmap_memory_bar( u_long vaddr, size_t size );
1470
1471 void i2c_wait_not_full( );
1472 void i2c_wait_not_empty( );
1473 int i2c_parse_address_string( const char *str,
1474 u_char *port1, u_char *port2, u_char *port3,
1475 u_char *dev_addr );
1476 void i2c_set_switches( u_char switch1_val, u_char switch2_val, u_char switch3_val );
1477
1478 void gbt_tx_configuration( int channel_tx_mode, int alignment );
1479 int gbt_rx_configuration( int channel_rx_mode );
1480 int gbt_software_alignment( int number_channels );
1481 bool gbt_channel_alignment( u_int channel );
1482 void gbt_topbot_oddeven_set( u_int channel, u_int topbot, u_int oddeven );
1483 bool gbt_topbot_alignment( u_int channel, u_int topbot,
1484 u_long *phase_found, u_int *oddeven );
1485 u_long gbt_shift_phase( u_int channel );
1486
1487 int check_digic_value2( const char *str, u_long *version, u_long *delay );
1488
1489 std::string lockbits2string( u_int locks );
1490
1491 void configureLinks( flxcard::LinkConfig *link_config,
1492 int *dma_index_invalid_count,
1493 int *unsupported_tohost_elinks_count,
1494 int *unsupported_fromhost_elinks_count );
1495
1496 void lockForConfiguration( FlxCard &flx );
1497};
1498
1499#endif // FLXCARD_H
Definition FlxCard.h:425
Definition FlxCard.h:330
Definition FlxCard.h:296
Definition FlxCard.h:363
Definition FlxCard.h:453
FlxCard()
The constructor of an FlxCard object only initializes a few class variables. It does not interact wit...
bool uses_dma_index_mask()
Definition FlxCard.h:1356
std::vector< flxcard::elink_descr_t > elinks_toflx()
void configure(std::string filename, bool do_links=true, bool do_registers=true)
unsigned int tohost_elink_dmaid(u_int channel, u_int egroup, u_int epath)
bool has_tohost_elink_streams(u_int channel, u_int egroup, u_int epath)
u_int number_of_elinks_toflx()
void readConfiguration()
void readConfiguration(std::string filename)
unsigned int link_mode()
bool is_elink_enabled(u_int channel, u_int egroup, u_int epath, bool is_to_flx)
uint8_t detector_id()
u_int number_of_dma_tohost()
Definition FlxCard.h:1350
u_int number_of_elinks_tohost(int dma_index=-1)
uint16_t connector_id(uint16_t channel)
std::vector< flxcard::elink_descr_t > elinks_tohost(int dma_index=-1)
unsigned int tohost_elink_dmaid(uint16_t elinknr)
void dma_advance_ptr(u_int dma_id, u_long dst, size_t size, size_t bytes)
void dma_to_host(u_int dma_id, u_long dst, size_t size, u_int flags)
void dma_stop(u_int dma_id)
void dma_reset()
bool dma_enabled(u_int dma_id)
u_long dma_get_fw_ptr(u_int dma_id)
int dma_max_tlp_bytes()
Definition FlxCard.h:629
void dma_set_ptr(u_int dma_id, u_long dst)
void dma_wait(u_int dma_id)
u_long dma_get_ptr(u_int dma_id)
void dma_from_host(u_int dma_id, u_long src, size_t size, u_int flags)
bool dma_cmp_even_bits(u_int dma_id)
static device_list_t device_list()
u_long openBackDoor(int bar)
u_long bar1Address()
Definition FlxCard.h:611
static u_int number_of_devices()
void card_close()
u_long bar2Address()
Definition FlxCard.h:615
void card_open(int device_nr, u_int lock_mask, bool read_config=false, bool ignore_version=false)
static u_int number_of_cards()
static int card_to_device_number(int card_number)
u_int lock_mask(int device_nr)
u_long bar0Address()
Definition FlxCard.h:607
long int gbt_version_delay(u_long svn_version, char *filename)
u_long txusrclk_freq(u_int channel)
void gth_rx_reset(int quad=-1)
u_long rxusrclk_freq(u_int channel)
u_int gbt_setup(int alignment, int channel_mode)
bool i2c_flush(u_int *count=0)
void i2c_write(const char *device_str, u_char reg_addr, u_char data)
u_char i2c_read_byte(u_char dev_addr, u_char reg_addr)
void i2c_write_byte(u_char dev_addr, u_char byte)
void i2c_read(const char *device_str, u_char reg_addr, u_char *value, int nbytes=1)
void i2c_write_byte(u_char dev_addr, u_char reg_addr, u_char byte)
void i2c_write_bytes(uint8_t dev_addr, uint8_t reg_addr, int nbytes, uint8_t *bytes)
void irq_enable(u_int interrupt=ALL_IRQS)
void irq_disable(u_int interrupt=ALL_IRQS)
void irq_wait(u_int interrupt)
void irq_cancel(u_int interrupt=ALL_IRQS)
void irq_clear(u_int interrupt=ALL_IRQS)
void irq_reset_counters(u_int interrupt=ALL_IRQS)
double fpga_temperature()
int fpga_fanspeed()
bool firefly_detect(const std::string &device_name, std::string &vendor_part, std::string &vendor_sn)
std::vector< int > minipods_temperature()
std::vector< std::pair< std::string, std::vector< int > > > firefly_optical_power()
std::vector< std::pair< std::string, std::vector< int > > > minipods_optical_power()
monitoring_data_t get_monitoring_data(u_int mon_mask)
static regmap_bitfield_t * cfg_bitfield(const char *name)
void cfg_set_reg(const char *key, u_long value)
u_long cfg_get_option(const char *key, bool show_options=false)
void registers_reset()
void cfg_set_option(const char *key, u_long value, bool show_options=false)
u_long cfg_get_reg(const char *key)
static regmap_register_t * cfg_register(const char *name)
static std::string cfg_bitfield_options(const char *name, bool include_all_substr=true)
u_int endpoint()
Definition FlxCard.h:1180
std::string firmware_type_string()
Definition FlxCard.h:1134
void soft_reset()
u_int number_of_endpoints()
Definition FlxCard.h:1175
u_int card_model()
Definition FlxCard.h:1123
std::string firmware_string()
Definition FlxCard.h:1140
std::pair< int, int > ec_elink_indices()
bool lpgbt_type()
Definition FlxCard.h:1145
bool lpgbt_5gbps()
Definition FlxCard.h:1155
void cr_fromhost_reset()
u_int number_of_channels()
Definition FlxCard.h:1185
bool fullmode_type()
Definition FlxCard.h:1160
std::pair< int, int > ic_elink_indices()
u_int firmware_type()
Definition FlxCard.h:1129
bool lpgbt_fec12()
Definition FlxCard.h:1150
Definition FlxCard.h:267
Definition FlxCard.h:280
Definition FlxCard.h:419
Definition FlxCard.h:124
Definition FlxCard.h:159
Definition FlxCard.h:98
Definition FlxCard.h:109
Definition FlxCard.h:131
Definition FlxCard.h:152
Definition FlxCard.h:170
Definition FlxCard.h:240
Definition FlxCard.h:407
Definition FlxCard.h:117
Definition FlxCard.h:197
Definition FlxCard.h:213
Definition FlxCard.h:401
Definition FlxCard.h:253
Definition FlxCard.h:433
Definition FlxCard.h:180
Definition FlxCard.h:438
Definition FlxCard.h:228
Definition FlxCard.h:412