mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
wip
This commit is contained in:
@ -43,6 +43,8 @@ int Beb_deactivated_transmission_flowcontrol_10g = 0;
|
||||
int Beb_deactivated_transmission_delay_frame = 0;
|
||||
int Beb_deactivated_transmission_delay_left = 0;
|
||||
int Beb_deactivated_transmission_delay_right = 0;
|
||||
int Beb_deactivated_left_datastream = 1;
|
||||
int Beb_deactivated_right_datastream = 1;
|
||||
|
||||
void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num) {
|
||||
bebInfo->beb_number = beb_num;
|
||||
@ -449,6 +451,77 @@ int Beb_GetActivate(int *retval) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Beb_SetDataStream(int left, int enable) {
|
||||
if (!Beb_activated) {
|
||||
if (left) {
|
||||
Beb_deactivated_left_datastream = enable;
|
||||
} else {
|
||||
Beb_deactivated_right_datastream = enable;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (left < 0) {
|
||||
LOG(logERROR, ("Invalid left value\n"));
|
||||
return 0;
|
||||
}
|
||||
if (enable < 0) {
|
||||
LOG(logERROR, ("Invalid enable value\n"));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t *csp0base = 0;
|
||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Activate FAIL, could not open fd\n"));
|
||||
return 0;
|
||||
} else {
|
||||
u_int32_t reg = XPAR_GPIO_P15_STREAMING_REG;
|
||||
u_int32_t mask =
|
||||
(left ? XPAR_GPIO_LFT_STRM_DSBL_MSK : XPAR_GPIO_RGHT_STRM_DSBL_MSK);
|
||||
|
||||
u_int32_t value = Beb_Read32(csp0base, reg);
|
||||
LOG(logDEBUG, ("data streaming register value before:%d\n", value));
|
||||
if (enable)
|
||||
value |= mask;
|
||||
else
|
||||
value &= ~mask;
|
||||
u_int32_t retval = Beb_Write32(csp0base, reg, value);
|
||||
if (retval != value) {
|
||||
LOG(logERROR,
|
||||
("Could not %s %s fpga datastream. Wrote 0x%x, read 0x%x\n",
|
||||
(enable ? "enable" : "disable"), (left ? "left" : "right"),
|
||||
value, retval));
|
||||
Beb_close(fd, csp0base);
|
||||
}
|
||||
}
|
||||
Beb_close(fd, csp0base);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Beb_GetDataStream(int left, int *retval) {
|
||||
if (!Beb_activated) {
|
||||
if (left) {
|
||||
return Beb_deactivated_left_datastream;
|
||||
} else {
|
||||
return Beb_deactivated_right_datastream;
|
||||
}
|
||||
}
|
||||
u_int32_t *csp0base = 0;
|
||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Activate FAIL, could not open fd\n"));
|
||||
return 0;
|
||||
} else {
|
||||
u_int32_t reg = XPAR_GPIO_P15_STREAMING_REG;
|
||||
u_int32_t mask =
|
||||
(left ? XPAR_GPIO_LFT_STRM_DSBL_MSK : XPAR_GPIO_RGHT_STRM_DSBL_MSK);
|
||||
|
||||
u_int32_t value = Beb_Read32(csp0base, reg);
|
||||
*retval = (value & mask) ? 1 : 0;
|
||||
}
|
||||
Beb_close(fd, csp0base);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Beb_Set32bitOverflow(int val) {
|
||||
if (!Beb_activated)
|
||||
return val;
|
||||
|
Reference in New Issue
Block a user