mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
no_serial was merged to master
This commit is contained in:
commit
1f1581a1fa
@ -510,9 +510,15 @@ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, i
|
||||
|
||||
|
||||
Beb_send_data[1] = 0x62000000 | (!stop_read_when_fifo_empty) << 27 | (ten_gig==1) << 24 | packet_size << 14 | dst_number << 8 | npackets;
|
||||
#ifdef MARTIN
|
||||
cprintf(GREEN, "Beb_send_data[1]:%X\n",Beb_send_data[1]);
|
||||
#endif
|
||||
Beb_send_data[2] = 0;
|
||||
|
||||
Beb_SwapDataFun(0,2,&(Beb_send_data[1]));
|
||||
#ifdef MARTIN
|
||||
cprintf(GREEN, "Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]);
|
||||
#endif
|
||||
|
||||
if(!Beb_WriteTo(i)) return 0;
|
||||
|
||||
@ -559,7 +565,10 @@ int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int ten
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef MARTIN
|
||||
cprintf(RED, "----Beb_RequestNImages Start----\n");
|
||||
cprintf(RED, "beb_number:%X, left_right:%X,ten_gig:%X,dst_number:%X,npackets:%X,Beb_bit_mode:%X,header_size:%X,test_just_send_out_packets_no_wait:%X\n",beb_number,left_right,ten_gig,dst_number,npackets,Beb_bit_mode,header_size,test_just_send_out_packets_no_wait);
|
||||
#endif
|
||||
unsigned int i;
|
||||
for(i=0;i<nimages;i++){
|
||||
//header then data request
|
||||
@ -570,7 +579,9 @@ int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int ten
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MARTIN
|
||||
cprintf(RED, "----Beb_RequestNImages----\n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -609,3 +620,35 @@ int Beb_Test(unsigned int beb_number){
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Returns the FPGA temperature from the xps sysmon ip core
|
||||
// Temperature value is cropped and not well rounded
|
||||
int Beb_GetBebFPGATemp()
|
||||
{
|
||||
int temperature=0;
|
||||
volatile u_int32_t *ptr1;
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf("\nCan't find /dev/mem!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, XPAR_SYSMON_0_BASEADDR );
|
||||
|
||||
if (CSP0BASE == (u_int32_t)MAP_FAILED)
|
||||
{
|
||||
printf("\nCan't map memmory area!!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr1=(u_int32_t*)(CSP0BASE + 0x200); // temperature register in xps sysmon core is at 0x200
|
||||
close(fd);
|
||||
|
||||
temperature = ((((float)(*ptr1)/65536.0f)/0.00198421639f ) - 273.15f); // Static conversation, copied from xps sysmon standalone driver
|
||||
|
||||
|
||||
return temperature;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ struct BebInfo{
|
||||
|
||||
int Beb_Test(unsigned int beb_number);
|
||||
|
||||
int Beb_GetBebFPGATemp();
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -187,15 +187,13 @@ int Feb_Control_Init(int master, int top){
|
||||
sscanf(pch,"%d",&res);
|
||||
Feb_Control_module_number = (res & 0xFF);
|
||||
|
||||
int serial = !top;
|
||||
|
||||
/*
|
||||
//for Gemmas modules: if master, serial 0, else 1
|
||||
int serial = 1;
|
||||
if(master)
|
||||
serial = 0;
|
||||
/* else if(top)if slave top, serial = 2
|
||||
serial = 2;*/
|
||||
|
||||
|
||||
|
||||
switch(Feb_Control_module_number){
|
||||
case 34: serial = 0; break; //martin half
|
||||
case 26: serial = 0; break; //leo
|
||||
@ -212,7 +210,7 @@ int Feb_Control_Init(int master, int top){
|
||||
|
||||
case 49: serial = 0; break; // Gemma
|
||||
case 48: serial = 1; break; // Gemma
|
||||
}
|
||||
}*/
|
||||
printf("serial: %d\n",serial);
|
||||
|
||||
Feb_Control_current_index = 1;
|
||||
@ -1071,17 +1069,17 @@ unsigned int Feb_Control_AddressToAll(){printf("in Feb_Control_AddressToAll()\n"
|
||||
|
||||
if(moduleSize==0) return 0;
|
||||
|
||||
/*
|
||||
|
||||
if(Module_BottomAddressIsValid(&modules[1])){
|
||||
printf("************* bottom\n");
|
||||
//printf("************* bottom\n");
|
||||
//if(Feb_Control_am_i_master)
|
||||
return Module_GetBottomLeftAddress(&modules[1])|Module_GetBottomRightAddress(&modules[1]);
|
||||
// else return 0;
|
||||
}
|
||||
printf("************* top\n");
|
||||
*/
|
||||
//return Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1]);
|
||||
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
|
||||
// printf("************* top\n");
|
||||
|
||||
return Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1]);
|
||||
//return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
|
||||
|
||||
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ int Feb_Interface_WriteTo(unsigned int ch){
|
||||
if(ch>0xfff) return 0;
|
||||
|
||||
#ifdef MARTIN
|
||||
printf("FIW ch %d\n", ch);
|
||||
cprintf(YELLOW, "FIW ch %d\n", ch);
|
||||
#endif
|
||||
|
||||
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
//#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#include "HardwareMMappingDefs.h"
|
||||
@ -127,9 +125,9 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
|
||||
#ifdef MARTIN
|
||||
printf("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base);
|
||||
cprintf(BLUE, "LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base);
|
||||
for (i=0; i < buffer_len/4; i++)
|
||||
printf("%.8X ",*(((unsigned *) buffer)+i));
|
||||
cprintf(BLUE, "%.8X ",*(((unsigned *) buffer)+i));
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
@ -173,7 +171,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
int sof = 0;
|
||||
|
||||
#ifdef MARTIN
|
||||
printf("LL Read - If: %X - Data: ",ll->ll_fifo_base);
|
||||
cprintf(CYAN, "LL Read - If: %X - Data: ",ll->ll_fifo_base);
|
||||
#endif
|
||||
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
@ -202,7 +200,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
if ( (buffer_len >> 2) > buffer_ptr)
|
||||
{
|
||||
#ifdef MARTIN
|
||||
printf("%.8X ", fifo_val);
|
||||
cprintf(CYAN, "%.8X ", fifo_val);
|
||||
#endif
|
||||
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
|
||||
}
|
||||
@ -216,7 +214,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
{
|
||||
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
|
||||
#ifdef MARTIN
|
||||
printf("Len: %d\n",len);
|
||||
cprintf(CYAN, "Len: %d\n",len);
|
||||
#endif
|
||||
// printf(">>>>status=0x%08x EOF len = %d \n\r\n\r",status, len);
|
||||
buffer_ptr = 0;
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
//#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#include "HardwareMMappingDefs.h"
|
||||
|
@ -8,6 +8,10 @@
|
||||
#include "HardwareIO.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "ansi.h"
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/*class LocalLinkInterface: public HardwareIO{ //*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
CC = powerpc-4xx-softfloat-gcc
|
||||
CCX = powerpc-4xx-softfloat-g++
|
||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
|
||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
|
||||
LDLIBS += -lm -lstdc++
|
||||
|
||||
PROGS = eigerDetectorServer
|
||||
|
@ -495,7 +495,7 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
|
||||
|
||||
int startReceiver(int d){
|
||||
if(master)
|
||||
//if(master)
|
||||
Feb_Control_PrepareForAcquisition();
|
||||
return OK;
|
||||
}
|
||||
@ -503,10 +503,10 @@ int startReceiver(int d){
|
||||
|
||||
int startStateMachine(){
|
||||
int ret;
|
||||
if(master){
|
||||
//if(master){
|
||||
printf("Going to start acquisition\n");
|
||||
Feb_Control_StartAcquisition();
|
||||
}
|
||||
//}
|
||||
|
||||
//do not read status here, cannot get images then
|
||||
|
||||
@ -517,7 +517,7 @@ int startStateMachine(){
|
||||
//if(trialMasterMode == IS_MASTER){
|
||||
|
||||
|
||||
if(master){
|
||||
//if(master){
|
||||
/*
|
||||
* int i=0;
|
||||
if(getRunStatus() == IDLE){
|
||||
@ -535,9 +535,11 @@ int startStateMachine(){
|
||||
|
||||
*/
|
||||
|
||||
while(getRunStatus() == IDLE);
|
||||
while(getRunStatus() == IDLE){
|
||||
printf("waiting for being not idle anymore\n");
|
||||
}
|
||||
printf("*****Acquiring...\n");
|
||||
}
|
||||
//}
|
||||
/*else usleep(1000000);
|
||||
printf("****Returning\n");*/
|
||||
|
||||
@ -1007,4 +1009,9 @@ int getAllTrimbits(){
|
||||
return *((detectorModules->chanregs));
|
||||
}
|
||||
|
||||
int getBebFPGATemp()
|
||||
{
|
||||
return Beb_GetBebFPGATemp();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -131,6 +131,7 @@ int startReceiver(int d);
|
||||
void setExternalGating(int enable[]);
|
||||
void setAllTrimbits(int val);
|
||||
int getAllTrimbits();
|
||||
int getBebFPGATemp();
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1244,7 +1244,7 @@ int set_dac(int file_des) {
|
||||
|
||||
int get_adc(int file_des) {
|
||||
|
||||
int retval;
|
||||
int retval=-1;
|
||||
int ret=OK,ret1=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
@ -1271,6 +1271,12 @@ int get_adc(int file_des) {
|
||||
#endif
|
||||
|
||||
switch (ind) {
|
||||
#ifdef EIGERD
|
||||
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||
retval=getBebFPGATemp();
|
||||
printf("Temperature: %d°C\n",retval);
|
||||
break;
|
||||
#endif
|
||||
#ifdef GOTTHARDD
|
||||
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||
break;
|
||||
@ -1284,7 +1290,7 @@ int get_adc(int file_des) {
|
||||
break;
|
||||
}
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
if (ret==OK) {
|
||||
if ((ret==OK) && (retval==-1)) {
|
||||
retval=getADC(idac,imod);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user