00001 #!/usr/local/bin/python 00002 # 00003 # Copyright 2004 00004 # by 00005 # The Board of Trustees of the 00006 # Leland Stanford Junior University. 00007 # All rights reserved. 00008 # 00009 00010 00011 __facility__ = "Online" 00012 __abstract__ = "GLAST CRU functional block" 00013 __author__ = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online" 00014 __date__ = ("$Date: 2005/03/15 19:42:43 $").split(' ')[1] 00015 __version__ = "$Revision: 2.8 $" 00016 __release__ = "$Name: R04-12-00 $" 00017 __credits__ = "SLAC" 00018 00019 import LATTE.copyright_SLAC 00020 00021 import gDb 00022 import gAttr 00023 00024 class GCRU(gDb.Gdb): 00025 """\brief CRU node. 00026 00027 Has GCRU specific registers and dataless commands. 00028 00029 Valid Registers: 00030 - \c configuration 00031 - \c command_enable 00032 - \c response_enable 00033 - \c cr_statistics 00034 - \c acd_startup_clock 00035 - \c test_io 00036 00037 Dataless Commands: 00038 - \c cmd_nop 00039 - \c cmd_reset 00040 00041 """ 00042 __attrs = [ 00043 # Registers 00044 gAttr.GattrRaw('configuration', 0, 4), 00045 gAttr.GattrRaw('command_enable', 1, 4), 00046 gAttr.GattrRaw('response_enable', 2, 4), 00047 gAttr.GattrRaw('cr_statistics', 3, 4), 00048 gAttr.GattrRaw('acd_startup_clock', 4, 4), 00049 gAttr.GattrRaw('test_io', 5, 4), 00050 # Dataless Commands 00051 gAttr.GattrDlc('cmd_nop', 0, 0), 00052 gAttr.GattrDlc('cmd_reset', 1, 0), 00053 ] 00054 00055 def __init__(self, client, parent): 00056 """\brief Initialize valid registers as Gattrs. 00057 """ 00058 flags = { 'EnableInternal1PPS' : 0 } 00059 gDb.Gdb.__init__(self, client, parent, 0, self.__attrs, None, flags) 00060 00061 def read(self, reg): 00062 return self.cmdrsp('CRU_read', reg, '!I') 00063 00064 def load(self, reg, value): 00065 return self.cmdrsp('CRU_load', reg, value) 00066 00067 def send(self, cmd): 00068 return self.cmdrsp('CRU_cmd', cmd)