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 EBM functional block" 00013 __author__ = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online" 00014 __date__ = ("$Date: 2005/03/05 03:30:23 $").split(' ')[1] 00015 __version__ = "$Revision: 2.10 $" 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 GEBM(gDb.Gdb): 00025 """\brief GEBM node. 00026 00027 """ 00028 __attrs = [] 00029 00030 def __init__(self, client, parent): 00031 """\brief Initialize child objects. 00032 00033 """ 00034 self.EBMC = None 00035 self.EBMST = None 00036 flags = {'CmdrspFabric': 'On'} 00037 gDb.Gdb.__init__(self, client, parent, 0, self.__attrs, None, flags) 00038 00039 def downEBMC(self): 00040 """\brief Navigate to the GEBMC node. 00041 00042 \return The GEBMC object instance 00043 """ 00044 return self.EBMC 00045 00046 def existsEBMC(self): 00047 """\brief Check if the GEBMC instance exists in the schema. 00048 00049 \return 1 if it exists, 0 if it doesn't. 00050 """ 00051 return self.EBMC != None 00052 00053 def downEBMST(self): 00054 """\brief Navigate to the GEBMST node. 00055 00056 \return The GEBMST object instance 00057 """ 00058 return self.EBMST 00059 00060 def existsEBMST(self): 00061 """\brief Check if the GEBMS instance exists in the schema. 00062 00063 \return 1 if it exists, 0 if it doesn't. 00064 """ 00065 return self.EBMST != None 00066 00067 ## private: 00068 00069 def __removeEBMC(self): 00070 self.EBMC = None 00071 00072 def __addEBMC(self): 00073 gebmc = GEBMC(self.client(), self) 00074 self.EBMC = gebmc 00075 return gebmc 00076 00077 def __removeEBMST(self): 00078 self.EBMST = None 00079 00080 def __addEBMST(self): 00081 gebmst = GEBMST(self.client(), self) 00082 self.EBMST = gebmst 00083 return gebmst 00084 00085 00086 class GEBMC(gDb.Gdb): 00087 """\brief EBM Controller node. 00088 00089 Has GEBMC specific registers. 00090 00091 Valid Registers: 00092 - \c back_end_config 00093 - \c front_end_a_config 00094 - \c front_end_b_config 00095 - \c address 00096 - \c sources 00097 - \c input_enables 00098 - \c output_enables 00099 - \c timeout 00100 - \c tem_statistics 00101 - \c cr_statistics 00102 - \c ssr_header 00103 00104 Dataless Commands: 00105 - \c cmd_nop 00106 - \c cmd_reset 00107 00108 """ 00109 __attrs = [ 00110 # Registers 00111 gAttr.GattrRaw('back_end_config', 0, 4), 00112 gAttr.GattrRaw('front_end_a_config', 1, 4), 00113 gAttr.GattrRaw('front_end_b_config', 2, 4), 00114 gAttr.GattrRaw('address', 3, 4), 00115 gAttr.GattrRaw('sources', 4, 4), 00116 gAttr.GattrRaw('input_enables', 5, 4), 00117 gAttr.GattrRaw('output_enables', 6, 4), 00118 gAttr.GattrRaw('timeout', 7, 4), 00119 gAttr.GattrRaw('tem_statistics', 8, 4), 00120 gAttr.GattrRaw('cr_statistics', 9, 4), 00121 gAttr.GattrRaw('ssr_header', 10, 4), 00122 # Dataless Commands 00123 gAttr.GattrDlc('cmd_nop', 0, 0), 00124 gAttr.GattrDlc('cmd_reset', 1, 0), 00125 ] 00126 00127 def __init__(self, client, parent): 00128 """\brief Initialize valid registers as Gattrs 00129 """ 00130 gDb.Gdb.__init__(self, client, parent, 0, self.__attrs) 00131 00132 def read(self, reg): 00133 return self.cmdrsp('EBM_read', gDb.Lem.ADDR_EBM, reg, '!I') 00134 00135 def load(self, reg, value): 00136 return self.cmdrsp('EBM_load', gDb.Lem.ADDR_EBM, reg, value) 00137 00138 def send(self, cmd): 00139 return self.cmdrsp('EBM_cmd', gDb.Lem.ADDR_EBM, cmd) 00140 00141 00142 class GEBMST(gDb.Gdb): 00143 """\brief EBM Event Statistics node. 00144 00145 Has GEBMST specific registers. 00146 00147 Valid Registers: 00148 - \c receive_gem 00149 - \c receive_aem 00150 - \c receive_siu0 00151 - \c receive_siu1 00152 - \c receive_epu0 00153 - \c receive_epu1 00154 - \c receive_epu2 00155 - \c receive_siu2 00156 - \c receive_tem_mux0 00157 - \c receive_tem_mux1 00158 - \c transmit_siu0 00159 - \c transmit_siu1 00160 - \c transmit_epu0 00161 - \c transmit_epu1 00162 - \c transmit_epu2 00163 - \c transmit_siu2 00164 - \c transmit_ssr 00165 00166 Dataless Commands: 00167 - \c cmd_reset 00168 00169 """ 00170 __attrs = [ 00171 # Registers 00172 gAttr.GattrRaw('receive_gem', 0, 4), 00173 gAttr.GattrRaw('receive_aem', 1, 4), 00174 gAttr.GattrRaw('receive_siu0', 2, 4), 00175 gAttr.GattrRaw('receive_siu1', 3, 4), 00176 gAttr.GattrRaw('receive_epu0', 4, 4), 00177 gAttr.GattrRaw('receive_epu1', 5, 4), 00178 gAttr.GattrRaw('receive_epu2', 6, 4), 00179 gAttr.GattrRaw('receive_siu2', 7, 4), 00180 gAttr.GattrRaw('receive_tem_mux0', 16, 4), 00181 gAttr.GattrRaw('receive_tem_mux1', 17, 4), 00182 gAttr.GattrRaw('transmit_siu0', 32, 4), 00183 gAttr.GattrRaw('transmit_siu1', 33, 4), 00184 gAttr.GattrRaw('transmit_epu0', 34, 4), 00185 gAttr.GattrRaw('transmit_epu1', 35, 4), 00186 gAttr.GattrRaw('transmit_epu2', 36, 4), 00187 gAttr.GattrRaw('transmit_siu2', 37, 4), 00188 gAttr.GattrRaw('transmit_ssr', 38, 4), 00189 # Dataless Commands 00190 gAttr.GattrDlc('cmd_reset', 0, 0), 00191 ] 00192 00193 def __init__(self, client, parent): 00194 """\brief Initialize valid registers as Gattrs. 00195 00196 """ 00197 gDb.Gdb.__init__(self, client, parent, 0, self.__attrs) 00198 00199 def read(self, reg): 00200 return self.cmdrsp('EBM_STAT_read', gDb.Lem.ADDR_EBM, reg, '!I') 00201 00202 def send(self, cmd): 00203 return self.cmdrsp('EBM_STAT_cmd', gDb.Lem.ADDR_EBM, cmd) 00204