From e00c62a7a5a1221dcf8c8afc8b7b8b6e1b5837a1 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 8 Jun 2021 11:37:11 +0200 Subject: [PATCH] m3 server: fixed absolute addressing for isMaster --- slsDetectorServers/mythen3DetectorServer/RegisterDefs.h | 3 +++ .../mythen3DetectorServer/slsDetectorFunctionList.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h index a07a24a50..0a04b7916 100644 --- a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h +++ b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h @@ -109,6 +109,9 @@ #define SYSTEM_STATUS_R_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_R_PLL_LCKD_OFST) #define SYSTEM_STATUS_RDO_PLL_LCKD_OFST (2) #define SYSTEM_STATUS_RDO_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_RDO_PLL_LCKD_OFST) +#define SYSTEM_STATUS_SLV_BRD_DTCT_OFST (31) +#define SYSTEM_STATUS_SLV_BRD_DTCT_MSK (0x00000001 << SYSTEM_STATUS_SLV_BRD_DTCT_OFST) + /* Config RW regiseter */ #define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL) diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 5aa9781fc..aa7c0b88f 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -1393,7 +1393,10 @@ int setHighVoltage(int val) { return highvoltage; } -int isMaster() { return !(bus_r(0x18) >> 31); } +int isMaster() { + return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >> + SYSTEM_STATUS_SLV_BRD_DTCT_OFST); +} /* parameters - timing */ void setTiming(enum timingMode arg) {