diff --git a/software/diag/getsr.py b/software/diag/getsr.py index bafb3245f892ad9dc3448ce0463ea0ee401141aa..f3034cf4f73d0b2e9b854ade3438292556111632 100755 --- a/software/diag/getsr.py +++ b/software/diag/getsr.py @@ -32,6 +32,7 @@ # in turn. # 2017-02-02 M. Suminski Updated mem map to match v4 gateware # 2017-02-17 M. Suminski Use SLOT configuration from ei2cdefine +# Updated HWVERS mask & offset #=============================================================================== # TODO: - #=============================================================================== @@ -68,11 +69,11 @@ if __name__ == "__main__": print("===============================") # Strip GWVERS and print - maj = (v & 0xf0) >> 4 - min = v & 0x0f - print("Gateware version : v%d.%d (0x%02x)" % (maj, min, v & 0xff)) + gwmaj = (v & 0xf0) >> 4 + gwmin = v & 0x0f + print("Gateware version : v%d.%d (0x%02x)" % (gwmaj, gwmin, v & 0xff)) - if maj < 4: + if gwmaj < 4: print("This tool works with gateware v4. Please upgrade your gateware.") sys.exit() @@ -84,7 +85,7 @@ if __name__ == "__main__": # Gateware versions below these two had the switches active-low. # This negation is done to allow correct printing of ON or OFF states. if ((bid == "TBLO") and - (((maj == 0) and (min < 2)) or ((maj != 0) and (maj < 3)))): + (((gwmaj == 0) and (gwmin < 2)) or ((gwmaj != 0) and (gwmaj < 3)))): switches ^= 0xff if (switches & 0x80): print(" TTL mode : TTL") @@ -104,19 +105,20 @@ if __name__ == "__main__": rtmm = rtm & 0x7 rtmp = (rtm & 0x3f) >> 3 if ((bid == "TBLO") and - (((maj == 0) and (min < 2)) or ((maj != 0) and (maj < 3)))): + (((gwmaj == 0) and (gwmin < 2)) or ((gwmaj != 0) and (gwmaj < 3)))): print("-------------------------------") print("Note: negated w.r.t. latest user guide version") print("RTM detection : 0x%02x" % rtm) print(" RTMM[2:0] : %s" % ("{0:#05b}".format(rtmm)[2:])) print(" RTMP[2:0] : %s" % ("{0:#05b}".format(rtmp)[2:])) - if ((maj == 0) and (min < 2)) or (maj < 3): + if ((gwmaj == 0) and (gwmin < 2)) or (gwmaj < 3): print("-------------------------------") # Hardware version - hwver = (v & 0x03c00000) >> 22 + hwmaj = (v & 0x0f000000) >> 24 + hwmin = (v & 0x00c00000) >> 22 print("Hardware version : %s" - % (str(hwver) if hwver >= 4 else "3 or below" )) + % ("%d.%d" % (hwmaj, hwmin) if hwmaj >= 4 else "3 or below" )) # White Rabbit present wrpres = (v & 0x04000000) >> 8