mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 11:04:19 +01:00
ctb moench: feature to set digital io pin delay, changed print from unsuccessful to failed, maxpatternlength in server is inclusive
This commit is contained in:
@@ -506,12 +506,12 @@
|
||||
|
||||
/* Pin Delay 0 RW register */
|
||||
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
|
||||
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST (0) //t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK (0x0000001F << OUTPUT_DELAY_0_OFST)
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK (0x0000001F << OUTPUT_DELAY_0_OTPT_STTNG_OFST)
|
||||
// 1: load dynamic output settings, 0: trigger start of dynamic output delay configuration pn falling edge of ODT (output delay trigger) bit
|
||||
#define OUTPUT_DELAY_0_OTPT_TRGGR_OFST (31)
|
||||
#define OUTPUT_DELAY_0_OTPT_TRGGR_MSK (0x00000001 << OUTPUT_DELAY_0_OFST)
|
||||
#define OUTPUT_DELAY_0_OTPT_TRGGR_MSK (0x00000001 << OUTPUT_DELAY_0_OTPT_TRGGR_OFST)
|
||||
#define OUTPUT_DELAY_0_OTPT_TRGGR_LD_VAL (1)
|
||||
#define OUTPUT_DELAY_0_OTPT_TRGGR_STRT_VAL (0)
|
||||
|
||||
|
||||
@@ -1761,9 +1761,9 @@ uint64_t writePatternClkControl(uint64_t word) {
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
if (addr < 0 || addr > MAX_PATTERN_LENGTH) {
|
||||
FILE_LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. "
|
||||
"Should be within 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
"Should be <= 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1792,9 +1792,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
return readPatternWord(addr);
|
||||
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
if (addr < 0 || addr > MAX_PATTERN_LENGTH) {
|
||||
FILE_LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. "
|
||||
"Should be within 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
"Should be <= 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1820,9 +1820,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
int setPatternWaitAddress(int level, int addr) {
|
||||
|
||||
// error (handled in tcp)
|
||||
if (addr >= MAX_PATTERN_LENGTH) {
|
||||
if (addr > MAX_PATTERN_LENGTH) {
|
||||
FILE_LOG(logERROR, ("Cannot set Pattern - Wait Address. Invalid addr 0x%x. "
|
||||
"Should be within 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
"Should be <= 0x%x\n", addr, MAX_PATTERN_LENGTH));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1905,7 +1905,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
||||
if ((level != -1) &&
|
||||
(*startAddr > MAX_PATTERN_LENGTH || *stopAddr > MAX_PATTERN_LENGTH)) {
|
||||
FILE_LOG(logERROR, ("Cannot set Pattern (Pattern Loop, level:%d, startaddr:0x%x, stopaddr:0x%x). "
|
||||
"Addr must be less than 0x%x\n",
|
||||
"Addr must be <= 0x%x\n",
|
||||
level, *startAddr, *stopAddr, MAX_PATTERN_LENGTH));
|
||||
}
|
||||
|
||||
@@ -1913,7 +1913,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
||||
else if ((level == -1) &&
|
||||
(*startAddr > MAX_PATTERN_LENGTH || *stopAddr > MAX_PATTERN_LENGTH)) {
|
||||
FILE_LOG(logERROR, ("Cannot set Pattern (Pattern Loop, complete pattern, startaddr:0x%x, stopaddr:0x%x). "
|
||||
"Addr must be less than 0x%x\n",
|
||||
"Addr must be <= 0x%x\n",
|
||||
*startAddr, *stopAddr, MAX_PATTERN_LENGTH));
|
||||
}
|
||||
|
||||
@@ -2019,6 +2019,28 @@ int setLEDEnable(int enable) {
|
||||
return (((~bus_r(addr)) & CONFIG_LED_DSBL_MSK) >> CONFIG_LED_DSBL_OFST);
|
||||
}
|
||||
|
||||
void setDigitalIODelay(uint64_t pinMask, int delay) {
|
||||
FILE_LOG(logINFO, ("Setings Digital IO Delay (pinMask:0x%llx, delay: %d ps)\n",
|
||||
(long long unsigned int)pinMask, delay));
|
||||
|
||||
int delayunit = delay / OUTPUT_DELAY_0_OTPT_STTNG_STEPS;
|
||||
FILE_LOG(logDEBUG1, ("delay unit: 0x%x (steps of 25ps)\n", delayunit));
|
||||
|
||||
// set pin mask
|
||||
bus_w(PIN_DELAY_1_REG, pinMask);
|
||||
|
||||
uint32_t addr = OUTPUT_DELAY_0_REG;
|
||||
// set delay
|
||||
bus_w(addr, bus_r(addr) & (~OUTPUT_DELAY_0_OTPT_STTNG_MSK));
|
||||
bus_w(addr, (bus_r(addr) | ((delayunit << OUTPUT_DELAY_0_OTPT_STTNG_OFST) & OUTPUT_DELAY_0_OTPT_STTNG_MSK)));
|
||||
|
||||
// load value
|
||||
bus_w(addr, bus_r(addr) | OUTPUT_DELAY_0_OTPT_TRGGR_MSK);
|
||||
|
||||
// trigger configuration
|
||||
bus_w(addr, bus_r(addr) & (~OUTPUT_DELAY_0_OTPT_TRGGR_MSK));
|
||||
}
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#define MAX_PATTERN_LENGTH (0xFFFF)
|
||||
#define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
|
||||
|
||||
|
||||
#define WAIT_TME_US_FR_LK_AT_ME_REG (100) // wait time in us after acquisition done to ensure there is no data in fifo
|
||||
#define WAIT_TIME_US_PLL (10 * 1000)
|
||||
#define WAIT_TIME_US_STP_ACQ (100)
|
||||
|
||||
Reference in New Issue
Block a user