mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
Added Backend board FPGA temperature support
This commit is contained in:
parent
ee0c6c4a05
commit
39cd82f0b8
@ -609,3 +609,35 @@ int Beb_Test(unsigned int beb_number){
|
|||||||
return 1;
|
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_Test(unsigned int beb_number);
|
||||||
|
|
||||||
|
int Beb_GetBebFPGATemp();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "HardwareMMappingDefs.h"
|
#include "HardwareMMappingDefs.h"
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "HardwareMMappingDefs.h"
|
#include "HardwareMMappingDefs.h"
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
#include "HardwareIO.h"
|
#include "HardwareIO.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "ansi.h"
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
/*class LocalLinkInterface: public HardwareIO{ //*/
|
/*class LocalLinkInterface: public HardwareIO{ //*/
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1009,4 +1009,9 @@ int getAllTrimbits(){
|
|||||||
return *((detectorModules->chanregs));
|
return *((detectorModules->chanregs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getBebFPGATemp()
|
||||||
|
{
|
||||||
|
return Beb_GetBebFPGATemp();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +131,7 @@ int startReceiver(int d);
|
|||||||
void setExternalGating(int enable[]);
|
void setExternalGating(int enable[]);
|
||||||
void setAllTrimbits(int val);
|
void setAllTrimbits(int val);
|
||||||
int getAllTrimbits();
|
int getAllTrimbits();
|
||||||
|
int getBebFPGATemp();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1244,7 +1244,7 @@ int set_dac(int file_des) {
|
|||||||
|
|
||||||
int get_adc(int file_des) {
|
int get_adc(int file_des) {
|
||||||
|
|
||||||
int retval;
|
int retval=-1;
|
||||||
int ret=OK,ret1=OK;
|
int ret=OK,ret1=OK;
|
||||||
int arg[2];
|
int arg[2];
|
||||||
enum dacIndex ind;
|
enum dacIndex ind;
|
||||||
@ -1271,6 +1271,12 @@ int get_adc(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (ind) {
|
switch (ind) {
|
||||||
|
#ifdef EIGERD
|
||||||
|
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||||
|
retval=getBebFPGATemp();
|
||||||
|
printf("Temperature: %d°C\n",retval);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||||
break;
|
break;
|
||||||
@ -1284,7 +1290,7 @@ int get_adc(int file_des) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (ret==OK) {
|
if ((ret==OK) && (retval==-1)) {
|
||||||
retval=getADC(idac,imod);
|
retval=getADC(idac,imod);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user