mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Dev/xilinx defaults and pattern (#888)
* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values * connected kernelversion, hardwareversion, versions, framesl, triggersl, dr, timingmode, pattern (except patioctrl) thats there for altera ctb * replaced set/get64Bit to set/getU64bit in all loadpattern.c for (ctb and m3 also)
This commit is contained in:
@ -8,6 +8,7 @@ add_executable(xilinx_ctbDetectorServer_virtual
|
||||
../slsDetectorServer/src/arm64.c
|
||||
../slsDetectorServer/src/common.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
../slsDetectorServer/src/loadPattern.c
|
||||
../../slsSupportLib/src/md5.c
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRCS = slsDetectorFunctionList.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(md5_dir)md5.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -7,6 +7,9 @@
|
||||
#include "sharedMemory.h"
|
||||
#include "sls/versionAPI.h"
|
||||
|
||||
#include "loadPattern.h"
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h> // usleep
|
||||
#include <arpa/inet.h> // INET_ADDRSTRLEN
|
||||
@ -227,6 +230,10 @@ uint64_t getFirmwareVersion() {
|
||||
return ((bus_r(FPGAVERSIONREG) & COMPDATE_MSK) >> COMPDATE_OFST);
|
||||
}
|
||||
|
||||
void getHardwareVersion(char *version) {
|
||||
strcpy(version, "Not applicable");
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -310,12 +317,29 @@ void setupDetector() {
|
||||
LOG(logINFO, ("Setting up Server for 1 Xilinx Chip Test Board\n"));
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStatus(IDLE);
|
||||
initializePatternWord();
|
||||
#endif
|
||||
|
||||
LOG(logINFOBLUE, ("Setting Default parameters\n"));
|
||||
initializePatternAddresses();
|
||||
|
||||
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
}
|
||||
|
||||
/* set parameters - dr */
|
||||
|
||||
int setDynamicRange(int dr) {
|
||||
if (dr == 16)
|
||||
return OK;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
int getDynamicRange(int *retval) {
|
||||
*retval = DYNAMIC_RANGE;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* parameters - timer */
|
||||
@ -338,6 +362,37 @@ void setNumTriggers(int64_t val) {
|
||||
|
||||
int64_t getNumTriggers() { return getU64BitReg(CYCLESINREG1, CYCLESINREG2); }
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return getU64BitReg(FRAMESOUTREG1, FRAMESOUTREG2);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return getU64BitReg(CYCLESOUTREG1, CYCLESOUTREG2);
|
||||
}
|
||||
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
void setTiming(enum timingMode arg) {
|
||||
switch (arg) {
|
||||
case AUTO_TIMING:
|
||||
LOG(logINFO, ("Set Timing: Auto\n"));
|
||||
bus_w(FLOWCONTROLREG, bus_r(FLOWCONTROLREG) & ~TRIGGERENABLE_MSK);
|
||||
break;
|
||||
case TRIGGER_EXPOSURE:
|
||||
LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||
bus_w(FLOWCONTROLREG, bus_r(FLOWCONTROLREG) | TRIGGERENABLE_MSK);
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
}
|
||||
}
|
||||
|
||||
enum timingMode getTiming() {
|
||||
if (bus_r(FLOWCONTROLREG) == TRIGGERENABLE_MSK)
|
||||
return TRIGGER_EXPOSURE;
|
||||
return AUTO_TIMING;
|
||||
}
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
// TODO
|
||||
|
@ -19,5 +19,10 @@ enum DACINDEX { D0 };
|
||||
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#define WAIT_TIME_PATTERN_READ (10) // TODO?
|
Reference in New Issue
Block a user