00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Reset and reboot SIU into secondary"
00012 __author__ = "J. Panetta <panetta@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__ = "2006/01/10 00:08:27"
00014 __updated__ = "$Date: 2006/01/11 03:14:33 $"
00015 __version__ = "$Revision: 1.1 $"
00016 __release__ = "$Name: HEAD $"
00017 __credits__ = "SLAC"
00018
00019 import LICOS.copyright_SLAC
00020
00021 import logging as log
00022 import os
00023 import time
00024
00025 from LICOS.tests.lib.testAppBase import TestAppBase
00026 from LICOS.lib.cmdTlmDb.TelemetryEvent import TelemetryEvent
00027 from LICOS.lib.LATconstants import *
00028 from LICOS.lib.cmdTlmDb.PBC import *
00029
00030
00031
00032 class ResetAndBoot(TestAppBase):
00033 """\brief LAT startup sequence testing.
00034
00035 """
00036 def __init__(self, common):
00037 TestAppBase.__init__(self, common)
00038 log.debug("%s.__init__()" % self.getName())
00039 preReqSeq = []
00040
00041 def getName(self):
00042 return self.__class__.__name__
00043
00044 def testSetup(self):
00045 pass
00046
00047 def testStartRun(self):
00048 pass
00049
00050 def testRun(self):
00051 log.debug("%s.startRun()" % self.getName())
00052 self.setCompletionStatus(self.COMPL_STATUS_UNDEFINED)
00053
00054 self.telemHandler = self.getTelemHandler()
00055
00056 log.info("Sending hard reset to VSC. SIU will reboot in a few seconds")
00057 self.vsc.reset()
00058 time.sleep(15)
00059 result = self.waitForSiuBootTelem()
00060
00061 if not result:
00062 self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00063 return
00064
00065
00066 flags_hi = 0x5400
00067
00068 flags_lo = 0xC000
00069 log.info("Sending SIU secondary boot signal")
00070 self.vsc.bootSIU(0, flags_hi, flags_lo )
00071
00072 time.sleep(3)
00073 result = self.waitForLatHSK()
00074 if not result:
00075 self.setCompletionStatus(self.COMPL_STATUS_FAILED)
00076
00077 self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00078 return
00079
00080
00081
00082 def testStopRun(self):
00083 pass
00084
00085
00086 def waitForLatHSK(self):
00087 result = True
00088 latHskTlm = TelemetryEvent(self.telemHandler,
00089 range(0x210, 0x231))
00090 latHskTlm.enable()
00091 log.info("Waiting for LAT housekeeping telemetry...")
00092 payloads = latHskTlm.waitForPayload([], STANDARD_TIMEOUT)
00093 latHskTlm.disable()
00094 if payloads is not None:
00095 msg = "LAT housekeeping telemetry received."
00096 log.info(msg)
00097 else:
00098 msg = "LAT housekeeping telemetry is not present."
00099 log.warning(msg)
00100 result = False
00101 return result
00102
00103 def waitForSiuBootTelem(self):
00104 siuId = FSW_UNIT_SIU
00105 log.info("Waiting for SIU %d boot telemetry..." % siuId)
00106 result = True
00107 siuBootTlm = TelemetryEvent(self.telemHandler,
00108 [self.lcatTlm.getApidFromName('LBTHKP')])
00109 bootMode = None
00110 siuBootTlm.enable()
00111 payloads = siuBootTlm.waitForPayload(["LPBCBOOTSTAT"], STANDARD_TIMEOUT)
00112 siuBootTlm.disable()
00113 if payloads is not None:
00114 bootMode = payloads[0]
00115 if bootMode == PBC.BOOT_MODE_COMMAND:
00116 msg = "SIU boot telemetry received."
00117 log.info(msg)
00118 else:
00119 msg = "SIU boot telemetry is not present."
00120 log.warning(msg)
00121 result = False
00122 return result
00123 if bootMode != PBC.BOOT_MODE_COMMAND:
00124 msg = "SIU boot telemetry received but the boot code mode has unexpected value %s" % PBC.BOOT_CODE_MODES[bootMode]
00125 log.warning(msg)
00126 result = False
00127 return result