mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
jungfrau module id (#581)
* connected module id to detid_jungfrau.txt * fixed module id register in jungfrau
This commit is contained in:
@ -42,3 +42,4 @@ install(TARGETS jungfrauDetectorServer_virtual
|
||||
)
|
||||
|
||||
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
|
||||
configure_file(detid_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/detid_jungfrau.txt COPYONLY)
|
||||
|
@ -37,6 +37,7 @@ $(PROGS): $(OBJS)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
cp config_jungfrau.txt $(DESTDIR)
|
||||
cp detid_jungfrau.txt $(DESTDIR)
|
||||
rm *.gdb
|
||||
rm $(main_src)*.o $(md5_dir)*.o
|
||||
|
||||
|
@ -440,13 +440,11 @@ Time before end of exposure when comparator is disabled */
|
||||
#define COORD_COL_INNER_OFST (16)
|
||||
#define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
|
||||
|
||||
/** Module column coordinates */
|
||||
#define COORD_RESERVED_REG (0x7E << MEM_MAP_SHIFT)
|
||||
/** Module ID coordinates */
|
||||
#define MOD_ID_REG (0x7E << MEM_MAP_SHIFT)
|
||||
|
||||
#define COORD_RESERVED_OUTER_OFST (0)
|
||||
#define COORD_RESERVED_OUTER_MSK (0x0000FFFF << COORD_RESERVED_OUTER_OFST)
|
||||
#define COORD_RESERVED_INNER_OFST (16)
|
||||
#define COORD_RESERVED_INNER_MSK (0x0000FFFF << COORD_RESERVED_INNER_OFST)
|
||||
#define MOD_ID_OFST (0)
|
||||
#define MOD_ID_MSK (0x0000FFFF << MOD_ID_OFST)
|
||||
|
||||
/* ASIC Control Register */
|
||||
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
|
||||
|
Binary file not shown.
1
slsDetectorServers/jungfrauDetectorServer/detid_jungfrau.txt
Executable file
1
slsDetectorServers/jungfrauDetectorServer/detid_jungfrau.txt
Executable file
@ -0,0 +1 @@
|
||||
1234
|
@ -42,6 +42,7 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_image_test_mode = 0;
|
||||
int virtual_moduleid = 0;
|
||||
#endif
|
||||
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
@ -326,6 +327,29 @@ u_int32_t getDetectorNumber() {
|
||||
return bus_r(MOD_SERIAL_NUM_REG);
|
||||
}
|
||||
|
||||
int getModuleId(int *ret, char *mess) {
|
||||
return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST);
|
||||
}
|
||||
|
||||
void setModuleId(int modid) {
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid));
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
|
||||
bus_w(MOD_ID_REG,
|
||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
}
|
||||
|
||||
int updateModuleId() {
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_moduleid = modid;
|
||||
#endif
|
||||
setModuleId(modid);
|
||||
return OK;
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -469,6 +493,10 @@ void setupDetector() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateModuleId() == FAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
setReadoutSpeed(HALF_SPEED);
|
||||
cleanFifos();
|
||||
resetCore();
|
||||
@ -2648,7 +2676,7 @@ void *start_timer(void *arg) {
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = row0;
|
||||
header->column = col0;
|
||||
|
||||
@ -2675,7 +2703,7 @@ void *start_timer(void *arg) {
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = row1;
|
||||
header->column = col1;
|
||||
|
||||
|
@ -8,80 +8,12 @@
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x220421 // 1.0 pcb (version = 010)
|
||||
#define REQRD_FRMWRE_VRSN 0x220422 // 2.0 pcb (version = 011)
|
||||
|
||||
#define ID_FILE "detid_jungfrau.txt"
|
||||
|
||||
#define LINKED_SERVER_NAME "jungfrauDetectorServer"
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct udp_header_struct {
|
||||
uint32_t udp_destmac_msb;
|
||||
uint16_t udp_srcmac_msb;
|
||||
uint16_t udp_destmac_lsb;
|
||||
uint32_t udp_srcmac_lsb;
|
||||
uint8_t ip_tos;
|
||||
uint8_t ip_ihl : 4, ip_ver : 4;
|
||||
uint16_t udp_ethertype;
|
||||
uint16_t ip_identification;
|
||||
uint16_t ip_totallength;
|
||||
uint8_t ip_protocol;
|
||||
uint8_t ip_ttl;
|
||||
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
|
||||
uint16_t ip_srcip_msb;
|
||||
uint16_t ip_checksum;
|
||||
uint16_t ip_destip_msb;
|
||||
uint16_t ip_srcip_lsb;
|
||||
uint16_t udp_srcport;
|
||||
uint16_t ip_destip_lsb;
|
||||
uint16_t udp_checksum;
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
/* Enums */
|
||||
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
|
||||
enum DACINDEX {
|
||||
J_VB_COMP,
|
||||
J_VDD_PROT,
|
||||
J_VIN_COM,
|
||||
J_VREF_PRECH,
|
||||
J_VB_PIXBUF,
|
||||
J_VB_DS,
|
||||
J_VREF_DS,
|
||||
J_VREF_COMP
|
||||
};
|
||||
#define DAC_NAMES \
|
||||
"vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \
|
||||
"vref_ds", "vref_comp"
|
||||
|
||||
#define DEFAULT_DAC_VALS \
|
||||
{ \
|
||||
1220, /* J_VB_COMP */ \
|
||||
3000, /* J_VDD_PROT */ \
|
||||
1053, /* J_VIN_COM */ \
|
||||
1450, /* J_VREF_PRECH */ \
|
||||
750, /* J_VB_PIXBUF */ \
|
||||
1000, /* J_VB_DS */ \
|
||||
480, /* J_VREF_DS */ \
|
||||
420 /* J_VREF_COMP */ \
|
||||
};
|
||||
|
||||
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||
#define MASTER_NAMES "hardware", "master", "slave"
|
||||
|
||||
#define NUMSETTINGS (2)
|
||||
#define NSPECIALDACS (3)
|
||||
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
|
||||
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
|
||||
{ 1450, 480, 420 }
|
||||
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
|
||||
{ 1550, 450, 620 }
|
||||
|
||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define CLK_NAMES "run", "adc", "dbit"
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (8)
|
||||
@ -207,3 +139,73 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
|
||||
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10)
|
||||
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08)
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct udp_header_struct {
|
||||
uint32_t udp_destmac_msb;
|
||||
uint16_t udp_srcmac_msb;
|
||||
uint16_t udp_destmac_lsb;
|
||||
uint32_t udp_srcmac_lsb;
|
||||
uint8_t ip_tos;
|
||||
uint8_t ip_ihl : 4, ip_ver : 4;
|
||||
uint16_t udp_ethertype;
|
||||
uint16_t ip_identification;
|
||||
uint16_t ip_totallength;
|
||||
uint8_t ip_protocol;
|
||||
uint8_t ip_ttl;
|
||||
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
|
||||
uint16_t ip_srcip_msb;
|
||||
uint16_t ip_checksum;
|
||||
uint16_t ip_destip_msb;
|
||||
uint16_t ip_srcip_lsb;
|
||||
uint16_t udp_srcport;
|
||||
uint16_t ip_destip_lsb;
|
||||
uint16_t udp_checksum;
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
/* Enums */
|
||||
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
|
||||
enum DACINDEX {
|
||||
J_VB_COMP,
|
||||
J_VDD_PROT,
|
||||
J_VIN_COM,
|
||||
J_VREF_PRECH,
|
||||
J_VB_PIXBUF,
|
||||
J_VB_DS,
|
||||
J_VREF_DS,
|
||||
J_VREF_COMP
|
||||
};
|
||||
#define DAC_NAMES \
|
||||
"vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \
|
||||
"vref_ds", "vref_comp"
|
||||
|
||||
#define DEFAULT_DAC_VALS \
|
||||
{ \
|
||||
1220, /* J_VB_COMP */ \
|
||||
3000, /* J_VDD_PROT */ \
|
||||
1053, /* J_VIN_COM */ \
|
||||
1450, /* J_VREF_PRECH */ \
|
||||
750, /* J_VB_PIXBUF */ \
|
||||
1000, /* J_VB_DS */ \
|
||||
480, /* J_VREF_DS */ \
|
||||
420 /* J_VREF_COMP */ \
|
||||
};
|
||||
|
||||
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||
#define MASTER_NAMES "hardware", "master", "slave"
|
||||
|
||||
#define NUMSETTINGS (2)
|
||||
#define NSPECIALDACS (3)
|
||||
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
|
||||
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
|
||||
{ 1450, 480, 420 }
|
||||
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
|
||||
{ 1550, 450, 620 }
|
||||
|
||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define CLK_NAMES "run", "adc", "dbit"
|
||||
|
Reference in New Issue
Block a user