00001 #ifndef _TPX_CORE_H_
00002 #define _TPX_CORE_H_
00003
00004 #include <sys/types.h>
00005
00006
00007 #define TPX_GAIN_MASTER_FILE "/RTS/conf/tpx/tpx_gains.txt" // global -- read only AFAIK this code is concerned!
00008 #define TPX_CONFIG_FILE "/RTS/conf/tpx/tpx_config_%03d"
00009 #define TPX_REMAP_FILE "/RTS/conf/tpx/tpx_remap.txt"
00010
00011 #define TPX_ALTRO_DO_CHECK (1<<0) // check altro data
00012 #define TPX_ALTRO_DO_ADC (1<<1) // dump the ADCs into the altro_struct
00013 #define TPX_ALTRO_DO_FCF (1<<2) // run the CLUSTERfinder as well...
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define TPX_MAX_TB 420
00023 #define TPX_DEF_TB 400
00024
00025
00026
00027
00028 #include <TPX/tpx_rdo.h>
00029
00030 struct tpx_odd_fee_t {
00031 u_char tpc_fee_padplane ;
00032 u_char status ;
00033 u_char sector ;
00034 u_char rdo ;
00035
00036 u_char altro_id_padplane ;
00037 } ;
00038
00039 struct tpx_rdo_event {
00040 u_int *data_start ;
00041 u_int *data_end ;
00042 u_int trg_cou ;
00043 struct trg_data *trg ;
00044
00045 short token ;
00046 short sector ;
00047 short rdo ;
00048
00049 u_char l2_cmd ;
00050 u_char type ;
00051 u_char subtype ;
00052 u_char data_err ;
00053 } ;
00054
00055
00056 struct tpx_altro_struct {
00057 u_char id ;
00058 u_char ch ;
00059 u_char rdo ;
00060 u_char what ;
00061
00062 u_char sector ;
00063 u_char fee ;
00064 u_char row ;
00065 u_char pad ;
00066
00067 u_short wc_dummy ;
00068 u_char log_err ;
00069 u_char err ;
00070
00071
00072
00073 u_short t ;
00074 u_short count ;
00075
00076 u_short adc[512] ;
00077 u_short tb[512] ;
00078
00079 } ;
00080
00081
00082 struct tpx_rdo_dbg
00083 {
00084 u_int delta ;
00085 u_int old_rhic ;
00086 } ;
00087
00088 struct tpx_rdo_heartbeat_t {
00089 u_char pll ;
00090 u_char status ;
00091 u_short retries ;
00092
00093 u_int trgs ;
00094 u_int trg_csr ;
00095 u_int a_ticks ;
00096 u_int sta_reg ;
00097 u_int rhic_ticks ;
00098 } ;
00099
00100
00101 extern int tpx_get_start(char *buff, u_int words, struct tpx_rdo_event *rdo, int do_log) ;
00102 extern u_int *tpx_scan_to_next(u_int *now, u_int *data_start, struct tpx_altro_struct *a) ;
00103
00104 extern void tpx_from_altro(int rdo, int a, int ch, int &row, int &pad) ;
00105 extern void tpx_to_altro(int row, int pad, int &rdo, int &a, int &ch) ;
00106 extern int tpx_altro_to_fee(int rdo, int a) ;
00107 extern u_char tpx_rdo_fees(int rdo, int cou) ;
00108
00109
00110 extern void tpx_analyze_log(int sector, int rdo, char *buff) ;
00111 extern int tpx_analyze_msc(int sector, int rdo, char *buff, int *altro_list=0) ;
00112 extern int tpx_show_status(int sector, int rb_mask, int *altro_list=0) ;
00113
00114 extern struct tpx_rdo tpx_rdo[6] ;
00115 extern struct tpx_rdo_dbg tpx_rdo_dbg[6] ;
00116 extern int tpx_fee_check ;
00117
00118 extern struct tpx_odd_fee_t tpx_odd_fee[256] ;
00119 extern int tpx_odd_fee_count ;
00120
00121 #endif