solved merge conflict
Build on RHEL9 docker image / build (push) Successful in 4m41s
Build on RHEL8 docker image / build (push) Successful in 5m12s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m41s
Run Simulator Tests on local RHEL8 / build (push) Successful in 17m10s

This commit is contained in:
2026-04-23 17:17:34 +02:00
19 changed files with 186 additions and 43 deletions
+6 -2
View File
@@ -6,6 +6,10 @@ on:
branches:
- developer
- main
push:
branches:
- developer
- main
release:
types:
- published
@@ -87,7 +91,7 @@ jobs:
- name: Copy documentation and Release notes to versioned folder
if: github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
if: github.event_name == 'release' || (github.event_name == 'push')
run: |
VERSION="${{ steps.version.outputs.version }}"
mkdir -p "gh-pages/${VERSION}"
@@ -99,7 +103,7 @@ jobs:
fi
- name: Commit and Push changes to gh-pages
if: github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
if: github.event_name == 'release' || (github.event_name == 'push')
run: |
cd gh-pages
git config --global user.name 'github-actions'
+1 -2
View File
@@ -517,13 +517,12 @@ class Detector(CppDetectorApi):
@element
def powerchip(self):
"""
[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb][Ctb] Power the chip.
[Jungfrau][Moench][Mythen3][Gotthard2] Power the chip.
Note
----
[Jungfrau][Moench] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
[Xilinx Ctb] Default is 0. Also configures the chip if powered on.
"""
return self.getPowerChip()
@@ -529,7 +529,7 @@ void setupDetector() {
for (int i = 0; i != NDAC_ONLY; ++i)
dacValues[i] = -1;
for (int i = 0; i != NPWR; ++i)
powerValues[i] = -1;
powerValues[i] = 0; // to calculate vchip
}
vLimit = DEFAULT_VLIMIT;
highvoltage = 0;
@@ -1496,6 +1496,23 @@ int setPowerDAC(enum powerIndex ind, int voltage, char *mess) {
if (validatePower(ind, voltage, mess) == FAIL)
return FAIL;
// to be values
bool pwrEnables[NPWR - 1] = {0};
int pwrValues[NPWR - 1] = {0};
if (getAllPowerValues(pwrEnables, pwrValues, mess) == FAIL)
return FAIL;
// update with current command
pwrValues[ind] = voltage;
// set vchip accordingly
{
int vchip = 0;
if (computeVchip(&vchip, pwrEnables, pwrValues, mess) == FAIL)
return FAIL;
if (setVchip(vchip, mess) == FAIL)
return FAIL;
}
int dacval = -1;
if (convertVoltageToPowerDAC(ind, voltage, &dacval, mess) == FAIL)
return FAIL;
@@ -1585,20 +1602,33 @@ int setPowerEnabled(enum powerIndex indices[], int count, bool enable,
{
char *powerNames[] = {PWR_NAMES};
char message[256] = {0};
sprintf(message, "Switching %s power for ", enable ? "on" : "off");
sprintf(message, "Switching %s power for [", enable ? "on" : "off");
for (int i = 0; i != count; ++i) {
strcat(message, powerNames[indices[i]]);
strcat(message, ", ");
}
strcat(message, "\n");
strcat(message, "]\n");
LOG(logINFO, ("%s", message));
}
// to be values
bool pwrEnables[NPWR - 1] = {0};
int pwrValues[NPWR - 1] = {0};
if (getAllPowerValues(pwrEnables, pwrValues, mess) == FAIL)
return FAIL;
// update with current command
for (int i = 0; i != count; ++i) {
pwrEnables[indices[i]] = enable;
}
// set vchip accordingly
int vchipToSet = 0;
if (getVchipToSet(&vchipToSet, mess) == FAIL)
return FAIL;
if (setVchip(vchipToSet, mess) == FAIL)
return FAIL;
{
int vchip = 0;
if (computeVchip(&vchip, pwrEnables, pwrValues, mess) == FAIL)
return FAIL;
if (setVchip(vchip, mess) == FAIL)
return FAIL;
}
// enable/disable power rails
uint32_t addr = POWER_REG;
@@ -1688,15 +1718,25 @@ int setVchip(int voltage, char *mess) {
return OK;
}
int getVchipToSet(int *retval_vchip, char *mess) {
int getAllPowerValues(bool *pwrEnables, int *pwrValues, char *mess) {
for (int ipwr = 0; ipwr != (NPWR - 1); ++ipwr) {
if (isPowerEnabled((enum powerIndex)ipwr, &pwrEnables[ipwr], mess) ==
FAIL)
return FAIL;
if (getPowerDAC((enum powerIndex)ipwr, &pwrValues[ipwr], mess) == FAIL)
return FAIL;
}
return OK;
}
int computeVchip(int *retval_vchip, bool *pwrEnables, int *pwrValues,
char *mess) {
// get the max of all the power regulators
int max = 0;
enum powerIndex pwrDacs[] = {V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D,
V_POWER_IO};
for (int ipwr = 0; ipwr != 5; ++ipwr) {
int val = 0;
if (getPowerDAC(pwrDacs[ipwr], &val, mess) == FAIL)
return FAIL;
if (pwrEnables[ipwr])
val = pwrValues[ipwr];
if (val > max)
max = val;
}
@@ -160,7 +160,12 @@ int isPowerEnabled(enum powerIndex ind, bool *retval, char *mess);
int validateVchip(int val, char *mess);
int getVchip(int *retval, char *mess);
int setVchip(int val, char *mess);
int getVchipToSet(int *retval_vchip, char *mess);
int getAllPowerValues(bool *pwrEnable, int *pwrValues, char *mess);
/** pwrEnable and pwrValues are current values
* updated with the current command
* (current cmd: eg. power enable all or only set one power dac) */
int computeVchip(int *retval_vchip, bool *pwrEnable, int *pwrValues,
char *mess);
int getPowerADC(enum powerIndex index, int *retval, char *mess);
@@ -122,3 +122,6 @@ uint32_t *Blackfin_getBaseAddress();
* Map FPGA
*/
int mapCSP0(void);
/** sleep for only usecs */
void usleep_bf(uint64_t i);
@@ -6,8 +6,8 @@
#include "sls/sls_detector_defs.h"
#include <stdbool.h>
#define GOODBYE (-200)
#define REBOOT (-400)
#define GOODBYE (-200)
#define REBOOT (-400)
#define BFIN_SPI_WAIT_uSECONDS 25
// initialization functions
@@ -11,12 +11,13 @@
#include <sys/mman.h> // mmap
/* global variables */
const uint64_t BFIN_CYCLES_1uSECOND = 20;
u_int32_t *csp0base = 0;
#define CSP0 0x20200000
#define MEM_SIZE 0x100000
#ifdef JUNGFRAUD
extern void configureChip();
#endif
@@ -131,3 +132,11 @@ int mapCSP0(void) {
}
uint32_t *Blackfin_getBaseAddress() { return csp0base; }
// usleep is not viable on blackfin
void usleep_bf(uint64_t i) {
uint64_t j = i * BFIN_CYCLES_1uSECOND;
while (--j) {
asm volatile("");
}
}
@@ -10907,15 +10907,6 @@ int set_pattern_wait_interval(int file_des) {
return Server_SendResult(file_des, INT64, NULL, 0);
}
// usleep is not viable on blackfin
void usleep_bf(uint64_t i) {
const uint64_t BFIN_CYCLES_1uSECOND = 20;
uint64_t j = i * BFIN_CYCLES_1uSECOND;
while (--j) {
asm volatile("");
}
}
/**
* Non destructive read from SPI register. Read n_bytes by shifting in dummy
* data while keeping csn 0 after the operation. Shift the read out data back
@@ -11066,9 +11057,11 @@ int spi_read(int file_des) {
#elif defined(CHIPTESTBOARDD)
// set spi to 8 bit per word (-1 comes from the firmware), set chipselect
bus_w(SPI_CTRL_REG,
((8 - 1) << SPI_CTRL_NBIT_OFST) + (1 << SPI_CTRL_CHIPSELECT_BIT));
for (int i = 0; i < n_bytes + 1; ++i) {
// TODO: should we make bus_w to this address blocking in the firmware
//
// to remove usleep ?
bus_w(SPI_WRITEDATA_REG, local_tx[i]);
usleep_bf(BFIN_SPI_WAIT_uSECONDS);
@@ -382,9 +382,9 @@ void setupDetector() {
analogEnable = 0;
digitalEnable = 0;
transceiverEnable = 0;
for (int i = 0; i != NDAC; ++i)
for (int i = 0; i != NDAC_ONLY; ++i)
dacValues[i] = -1;
for (int i = 0; i != 5; ++i)
for (int i = 0; i != NPWR - 1; ++i)
powerValues[i] = -1;
vLimit = DEFAULT_VLIMIT;
@@ -1170,11 +1170,12 @@ int setPowerEnabled(enum powerIndex indices[], int count, bool enable,
{
char *powerNames[] = {PWR_NAMES};
char message[256] = {0};
sprintf(message, "Switching %s power for ", enable ? "on" : "off");
sprintf(message, "Switching %s power for [", enable ? "on" : "off");
for (int i = 0; i != count; ++i) {
strcat(message, powerNames[indices[i]]);
strcat(message, ", ");
}
strcat(message, "\n");
strcat(message, "]\n");
LOG(logINFO, ("%s", message));
}
// enable/disable power rails
@@ -484,7 +484,6 @@ class Detector {
* temp_control enabled. Will configure chip (only chip v1.1)\n
* [Mythen3][Gotthard2] Default is 1. If module not connected or wrong
* module, powerchip will fail.\n
* [Xilinx CTB] Default is 0. Also configures chip if powered on.
*/
void setPowerChip(bool on, Positions pos = {});
@@ -706,12 +706,102 @@ TEST_CASE("powerdac", "[.detectorintegration][dacs]") {
REQUIRE(oss2.str() ==
"powerdac " + names[iPower] + " 1200\n");
}
// Reset all dacs to previous value
det.setPowerDAC(indices[iPower], prev_val);
det.setPowerEnabled(std::vector{indices[iPower]},
prev_val_power);
}
// all
{
int prev_val[5] = {0};
int prev_power_val[5] = {0};
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
prev_val[iPower] = det.getPowerDAC(indices[iPower]);
prev_power_val[iPower] =
det.isPowerEnabled(indices[iPower]);
}
// all off
REQUIRE_NOTHROW(caller.call("power", {"all", "off"}, -1, PUT));
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
REQUIRE(det.isPowerEnabled(indices[iPower]) == false);
}
// all on
REQUIRE_NOTHROW(caller.call("power", {"all", "on"}, -1, PUT));
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
REQUIRE(det.isPowerEnabled(indices[iPower]) == true);
}
// all off
REQUIRE_NOTHROW(caller.call("power", {"all", "off"}, -1, PUT));
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
REQUIRE(det.isPowerEnabled(indices[iPower]) == false);
}
// reset it to previous value
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
det.setPowerDAC(indices[iPower], prev_val[iPower]);
det.setPowerEnabled({indices[iPower]},
prev_power_val[iPower]);
}
}
// vchip val
if (det_type == defs::CHIPTESTBOARD) {
const int min_vchip_val = 1673;
int prev_val[5] = {0};
int prev_power_val[5] = {0};
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
prev_val[iPower] = det.getPowerDAC(indices[iPower]);
prev_power_val[iPower] =
det.isPowerEnabled(indices[iPower]);
}
// all off, vchip = min
REQUIRE_NOTHROW(caller.call("power", {"all", "off"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == min_vchip_val);
// change dacs
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_a", "1500"}, -1, PUT));
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_b", "1200"}, -1, PUT));
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_c", "1200"}, -1, PUT));
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_d", "1200"}, -1, PUT));
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_io", "1200"}, -1, PUT));
// vchip = min
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == min_vchip_val);
// all on, vchip changes
REQUIRE_NOTHROW(caller.call("power", {"all", "on"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == 1700);
// change dac, vchip changes to max + 200
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_a", "1700"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == 1900);
REQUIRE_NOTHROW(
caller.call("powerdac", {"v_b", "1500"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == 1900);
// switch off v_a, vchip = max + 200 of those enabled
REQUIRE_NOTHROW(caller.call("power", {"v_a", "off"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == 1700);
// all off, vchip = min
REQUIRE_NOTHROW(caller.call("power", {"all", "off"}, -1, PUT));
REQUIRE(det.getPowerDAC(defs::V_POWER_CHIP) == min_vchip_val);
// reset it to previous value
for (size_t iPower = 0; iPower < names.size(); ++iPower) {
det.setPowerDAC(indices[iPower], prev_val[iPower]);
det.setPowerEnabled({indices[iPower]},
prev_power_val[iPower]);
}
}
}
} else {
+7 -7
View File
@@ -3,11 +3,11 @@
/** API versions */
#define APILIB "0.0.0 0x250909"
#define APIRECEIVER "0.0.0 0x250822"
#define APICTB "0.0.0 0x260317"
#define APIGOTTHARD2 "0.0.0 0x260227"
#define APIMOENCH "0.0.0 0x260227"
#define APIEIGER "0.0.0 0x260227"
#define APIXILINXCTB "0.0.0 0x260324"
#define APIJUNGFRAU "0.0.0 0x260227"
#define APIMYTHEN3 "0.0.0 0x260227"
#define APICTB "0.0.0 0x260421"
#define APIGOTTHARD2 "0.0.0 0x260420"
#define APIMOENCH "0.0.0 0x260420"
#define APIEIGER "0.0.0 0x260420"
#define APIXILINXCTB "0.0.0 0x260420"
#define APIJUNGFRAU "0.0.0 0x260420"
#define APIMYTHEN3 "0.0.0 0x260420"
#define APIMATTERHORN "0.0.0 0x260212"