Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

gGEM.py

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 GEM functional block"
00013 __author__  = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00014 __date__     = ("$Date: 2004/10/21 21:38:29 $").split(' ')[1]
00015 __version__ = "$Revision: 2.9 $"
00016 __release__  = "$Name: P04-06-05 $"
00017 __credits__ = "SLAC"
00018 
00019 import LATTE.copyright_SLAC
00020 
00021 import gDb
00022 import gAttr
00023 
00024 class GGEM(gDb.Gdb):
00025   """\brief GGEM node.
00026 
00027   """
00028   __attrs = []
00029 
00030   __EPU_ADDR = 0x20
00031 
00032   def __init__(self, client, parent):
00033     """\brief Initialize child objects.
00034 
00035     """
00036     self.GEMC    = None
00037     self.GEMMG   = None
00038     self.GEMST   = None
00039     self.GEMSC   = None
00040     self.GEMVG   = None
00041     self.GEMIE   = None
00042     self.GEMW    = None
00043     gDb.Gdb.__init__(self, client, parent, 0)
00044 
00045   def getEPUaddr(self):
00046     # Hard code EPU_ADDR to 0x20 to work with the Caligula FSW release
00047     #response = self.cmdrsp('getEPUaddr', 'slh')
00048     #return response.status()
00049     return GGEM.__EPU_ADDR
00050 
00051   def downGEMC(self):
00052     """\brief Navigate to the GGEMC node
00053 
00054     \return         The GGEMC object instance
00055     """
00056     return self.GEMC
00057 
00058   def existsGEMC(self):
00059     """\brief Check if the GGEMC instance exists in the schema.
00060 
00061     \return       1 if it exists, 0 if it doesn't.
00062     """
00063     return self.GEMC != None
00064 
00065   def downGEMMG(self):
00066     """\brief Navigate to the GGEMMG node
00067 
00068     \return         The GGEMMG object instance
00069     """
00070     return self.GEMMG
00071 
00072   def existsGEMMG(self):
00073     """\brief Check if the GGEMMG instance exists in the schema.
00074 
00075     \return       1 if it exists, 0 if it doesn't.
00076     """
00077     return self.GEMMG != None
00078 
00079   def downGEMST(self):
00080     """\brief Navigate to the GGEMST node
00081 
00082     \return         The GGEMST object instance
00083     """
00084     return self.GEMST
00085 
00086   def existsGEMST(self):
00087     """\brief Check if the GGEMST instance exists in the schema.
00088 
00089     \return       1 if it exists, 0 if it doesn't.
00090     """
00091     return self.GEMST != None
00092 
00093   def downGEMSC(self):
00094     """\brief Navigate to the GGEMSC node
00095 
00096     \return         The GGEMSC object instance
00097     """
00098     return self.GEMSC
00099 
00100   def existsGEMSC(self):
00101     """\brief Check if the GGEMSC instance exists in the schema.
00102 
00103     \return       1 if it exists, 0 if it doesn't.
00104     """
00105     return self.GEMSC != None
00106 
00107   def downGEMVG(self):
00108     """\brief Navigate to the GGEMVG node
00109 
00110     \return         The GGEMVG object instance
00111     """
00112     return self.GEMVG
00113 
00114   def existsGEMVG(self):
00115     """\brief Check if the GGEMVG instance exists in the schema.
00116 
00117     \return       1 if it exists, 0 if it doesn't.
00118     """
00119     return self.GEMVG != None
00120 
00121   def downGEMVG(self):
00122     """\brief Navigate to the GGEMVG node
00123 
00124     \return         The GGEMVG object instance
00125     """
00126     return self.GEMVG
00127 
00128   def existsGEMVG(self):
00129     """\brief Check if the GGEMVG instance exists in the schema.
00130 
00131     \return       1 if it exists, 0 if it doesn't.
00132     """
00133     return self.GEMVG != None
00134 
00135   def downGEMIE(self):
00136     """\brief Navigate to the GGEMIE node
00137 
00138     \return         The GGEMIE object instance
00139     """
00140     return self.GEMIE
00141 
00142   def existsGEMIE(self):
00143     """\brief Check if the GGEMIE instance exists in the schema.
00144 
00145     \return       1 if it exists, 0 if it doesn't.
00146     """
00147     return self.GEMIE != None
00148 
00149   def downGEMW(self):
00150     """\brief Navigate to the GGEMW node
00151 
00152     \return         The GGEMW object instance
00153     """
00154     return self.GEMW
00155 
00156   def existsGEMW(self):
00157     """\brief Check if the GGEMW instance exists in the schema.
00158 
00159     \return       1 if it exists, 0 if it doesn't.
00160     """
00161     return self.GEMW != None
00162 
00163 ## private:
00164 
00165   def __removeGEMC(self):
00166     self.GEMC = None
00167 
00168   def __addGEMC(self):
00169     ggemc = GGEMC(self.client(), self)
00170     self.GEMC = ggemc
00171     return ggemc
00172 
00173   def __removeGEMMG(self):
00174     self.GEMMG = None
00175 
00176   def __addGEMMG(self):
00177     ggemmg = GGEMMG(self.client(), self)
00178     self.GEMMG = ggemmg
00179     return ggemmg
00180 
00181   def __removeGEMST(self):
00182     self.GEMST = None
00183 
00184   def __addGEMST(self):
00185     ggemst = GGEMST(self.client(), self)
00186     self.GEMST = ggemst
00187     return ggemst
00188 
00189   def __removeGEMSC(self):
00190     self.GEMSC = None
00191 
00192   def __addGEMSC(self):
00193     ggemsc = GGEMSC(self.client(), self)
00194     self.GEMSC = ggemsc
00195     return ggemsc
00196 
00197   def __removeGEMVG(self):
00198     self.GEMVG = None
00199 
00200   def __addGEMVG(self):
00201     ggemvg = GGEMVG(self.client(), self)
00202     self.GEMVG = ggemvg
00203     return ggemvg
00204 
00205   def __removeGEMIE(self):
00206     self.GEMIE = None
00207 
00208   def __addGEMIE(self):
00209     ggemie = GGEMIE(self.client(), self)
00210     self.GEMIE = ggemie
00211     return ggemie
00212 
00213   def __removeGEMW(self):
00214     self.GEMW = None
00215 
00216   def __addGEMW(self):
00217     ggemw = GGEMW(self.client(), self)
00218     self.GEMW = ggemw
00219     return ggemw
00220 
00221 
00222 class GGEMC(gDb.Gdb):
00223   """\brief GEMC sub-node of GGEM (controller).
00224 
00225   Has GGEMC specific registers and dataless commands.
00226 
00227   Valid Registers:
00228   - \c configuration
00229   - \c address
00230   - \c periodic_mode
00231   - \c periodic_limits
00232   - \c periodic_rate
00233   - \c sequence
00234   - \c cr_statistics
00235   - \c event_statistics
00236 
00237   Dataless Commands:
00238   - \c cmd_nop
00239   - \c cmd_reset
00240   - \c cmd_trigger
00241 
00242   """
00243   __attrs = [
00244     # Registers
00245     gAttr.GattrRaw('configuration',    0, 4),
00246     gAttr.GattrRaw('address',          1, 4),
00247     gAttr.GattrRaw('periodic_mode',    3, 4),
00248     gAttr.GattrRaw('periodic_limits',  4, 4),
00249     gAttr.GattrRaw('periodic_rate',    5, 4),
00250     gAttr.GattrRaw('sequence',         6, 4),
00251     gAttr.GattrRaw('cr_statistics',    7, 4),
00252     gAttr.GattrRaw('event_statistics', 8, 4),
00253     # Dataless Commands
00254     gAttr.GattrDlc('cmd_nop',          0, 0),
00255     gAttr.GattrDlc('cmd_reset',        1, 0),
00256     gAttr.GattrDlc('cmd_trigger',      2, 0),
00257     ]
00258 
00259   def __init__(self, client, parent):
00260     """\brief Initialize valid registers as Gattrs
00261     """
00262     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00263 
00264   def read(self, reg):
00265     return self.cmdrsp('GEMconReadSync', 'slh', 'LADR_GEM', reg, '!I')
00266 
00267   def load(self, reg, value):
00268     return self.cmdrsp('GEMconLoadSync', 'slh', 'LADR_GEM', reg, value)
00269 
00270   def send(self, cmd):
00271     return self.cmdrsp('GEMconCmdSync', 'slh', 'LADR_GEM', cmd)
00272 
00273 
00274 class GGEMMG(gDb.Gdb):
00275   """\brief GEMMG sub-node of GGEM (TAM generator).
00276 
00277   Has GGEMMG specific registers and dataless commands.
00278 
00279   Valid Registers:
00280   - \c engine_0
00281   - \c engine_1
00282   - \c engine_2
00283   - \c engine_3
00284   - \c engine_4
00285   - \c engine_5
00286   - \c engine_6
00287   - \c engine_7
00288   - \c engine_8
00289   - \c engine_9
00290   - \c engine_a
00291   - \c engine_b
00292   - \c engine_c
00293   - \c engine_d
00294   - \c engine_e
00295   - \c engine_f
00296 
00297   """
00298   __attrs = [
00299     # Registers
00300     gAttr.GattrRaw('engine_0',    0, 4),
00301     gAttr.GattrRaw('engine_1',    1, 4),
00302     gAttr.GattrRaw('engine_2',    2, 4),
00303     gAttr.GattrRaw('engine_3',    3, 4),
00304     gAttr.GattrRaw('engine_4',    4, 4),
00305     gAttr.GattrRaw('engine_5',    5, 4),
00306     gAttr.GattrRaw('engine_6',    6, 4),
00307     gAttr.GattrRaw('engine_7',    7, 4),
00308     gAttr.GattrRaw('engine_8',    8, 4),
00309     gAttr.GattrRaw('engine_9',    9, 4),
00310     gAttr.GattrRaw('engine_a',   10, 4),
00311     gAttr.GattrRaw('engine_b',   11, 4),
00312     gAttr.GattrRaw('engine_c',   12, 4),
00313     gAttr.GattrRaw('engine_d',   13, 4),
00314     gAttr.GattrRaw('engine_e',   14, 4),
00315     gAttr.GattrRaw('engine_f',   15, 4),
00316     ]
00317 
00318   def __init__(self, client, parent):
00319     """\brief Initialize valid registers as Gattrs.
00320     """
00321     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00322 
00323   def read(self, reg):
00324     return self.cmdrsp('GEMtamReadSync', 'slh', 'LADR_GEM', reg, '!I')
00325 
00326   def load(self, reg, value):
00327     return self.cmdrsp('GEMtamLoadSync', 'slh', 'LADR_GEM', reg, value)
00328 
00329 
00330 class GGEMST(gDb.Gdb):
00331   """\brief GEMST sub-node of GGEM (statistics).
00332 
00333   Has GGEMST specific registers and dataless commands.
00334 
00335   Valid Registers:
00336   - \c livetime
00337   - \c prescaled
00338   - \c discarded
00339   - \c sent
00340   - \c tile_counters
00341   - \c tile_0
00342   - \c tile_1
00343 
00344   Dataless Commands:
00345   - \c cmd_reset
00346 
00347   """
00348   __attrs = [
00349     # Registers
00350     gAttr.GattrRaw('livetime',        0, 4),
00351     gAttr.GattrRaw('prescaled',       1, 4),
00352     gAttr.GattrRaw('discarded',       2, 4),
00353     gAttr.GattrRaw('sent',            3, 4),
00354     gAttr.GattrRaw('tile_counters',   4, 4),
00355     gAttr.GattrRaw('tile_0',          5, 4),
00356     gAttr.GattrRaw('tile_1',          6, 4),
00357     # Dataless Commands
00358     gAttr.GattrDlc('cmd_reset',       0, 0),
00359     ]
00360 
00361   def __init__(self, client, parent):
00362     """\brief Initialize valid registers as Gattrs.
00363     """
00364     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00365 
00366   def read(self, reg):
00367     return self.cmdrsp('GEMstatReadSync', 'slh', 'LADR_GEM', reg, '!I')
00368 
00369   def load(self, reg, value):
00370     return self.cmdrsp('GEMstatLoadSync', 'slh', 'LADR_GEM', reg, value)
00371 
00372   def send(self, cmd):
00373     return self.cmdrsp('GEMstatCmdSync', 'slh', 'LADR_GEM', cmd)
00374 
00375 
00376 class GGEMSC(gDb.Gdb):
00377   """\brief GEMSC sub-node of GGEM (scheduler).
00378 
00379   Has GGEMSC specific registers and dataless commands.
00380 
00381   Valid Registers:
00382   - \c conditions_00_07
00383   - \c conditions_08_0f
00384   - \c conditions_10_17
00385   - \c conditions_18_1f
00386   - \c conditions_20_27
00387   - \c conditions_28_2f
00388   - \c conditions_30_37
00389   - \c conditions_38_3f
00390   - \c conditions_40_47
00391   - \c conditions_48_4f
00392   - \c conditions_50_57
00393   - \c conditions_58_5f
00394   - \c conditions_60_67
00395   - \c conditions_68_6f
00396   - \c conditions_70_77
00397   - \c conditions_78_7f
00398   - \c conditions_80_87
00399   - \c conditions_88_8f
00400   - \c conditions_90_97
00401   - \c conditions_98_9f
00402   - \c conditions_a0_a7
00403   - \c conditions_a8_af
00404   - \c conditions_b0_b7
00405   - \c conditions_b8_bf
00406   - \c conditions_c0_c7
00407   - \c conditions_c8_cf
00408   - \c conditions_d0_d7
00409   - \c conditions_d8_df
00410   - \c conditions_e0_e7
00411   - \c conditions_e8_ef
00412   - \c conditions_f0_f7
00413   - \c conditions_f8_ff
00414 
00415   """
00416   __attrs = [
00417     # Registers
00418     gAttr.GattrRaw('conditions_00_07', 0x00, 4),
00419     gAttr.GattrRaw('conditions_08_0f', 0x01, 4),
00420     gAttr.GattrRaw('conditions_10_17', 0x02, 4),
00421     gAttr.GattrRaw('conditions_18_1f', 0x03, 4),
00422     gAttr.GattrRaw('conditions_20_27', 0x04, 4),
00423     gAttr.GattrRaw('conditions_28_2f', 0x05, 4),
00424     gAttr.GattrRaw('conditions_30_37', 0x06, 4),
00425     gAttr.GattrRaw('conditions_38_3f', 0x07, 4),
00426     gAttr.GattrRaw('conditions_40_47', 0x08, 4),
00427     gAttr.GattrRaw('conditions_48_4f', 0x09, 4),
00428     gAttr.GattrRaw('conditions_50_57', 0x0a, 4),
00429     gAttr.GattrRaw('conditions_58_5f', 0x0b, 4),
00430     gAttr.GattrRaw('conditions_60_67', 0x0c, 4),
00431     gAttr.GattrRaw('conditions_68_6f', 0x0d, 4),
00432     gAttr.GattrRaw('conditions_70_77', 0x0e, 4),
00433     gAttr.GattrRaw('conditions_78_7f', 0x0f, 4),
00434     gAttr.GattrRaw('conditions_80_87', 0x10, 4),
00435     gAttr.GattrRaw('conditions_88_8f', 0x11, 4),
00436     gAttr.GattrRaw('conditions_90_97', 0x12, 4),
00437     gAttr.GattrRaw('conditions_98_9f', 0x13, 4),
00438     gAttr.GattrRaw('conditions_a0_a7', 0x14, 4),
00439     gAttr.GattrRaw('conditions_a8_af', 0x15, 4),
00440     gAttr.GattrRaw('conditions_b0_b7', 0x16, 4),
00441     gAttr.GattrRaw('conditions_b8_bf', 0x17, 4),
00442     gAttr.GattrRaw('conditions_c0_c7', 0x18, 4),
00443     gAttr.GattrRaw('conditions_c8_cf', 0x19, 4),
00444     gAttr.GattrRaw('conditions_d0_d7', 0x1a, 4),
00445     gAttr.GattrRaw('conditions_d8_df', 0x1b, 4),
00446     gAttr.GattrRaw('conditions_e0_e7', 0x1c, 4),
00447     gAttr.GattrRaw('conditions_e8_ef', 0x1d, 4),
00448     gAttr.GattrRaw('conditions_f0_f7', 0x1e, 4),
00449     gAttr.GattrRaw('conditions_f8_ff', 0x1f, 4),
00450     ]
00451 
00452   def __init__(self, client, parent):
00453     """\brief Initialize valid registers as Gattrs.
00454     """
00455     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00456 
00457   def read(self, reg):
00458     return self.cmdrsp('GEMschedReadSync', 'slh', 'LADR_GEM', reg, '!I')
00459 
00460   def load(self, reg, value):
00461     return self.cmdrsp('GEMschedLoadSync', 'slh', 'LADR_GEM', reg, value)
00462 
00463 
00464 class GGEMVG(gDb.Gdb):
00465   """\brief GEMVG sub-node of GGEM (ROI generator).
00466 
00467   Has GGEMVG specific registers and dataless commands.
00468 
00469   Valid Registers:
00470 
00471   - \c ROI_00, ROI_01, ROI_02,...,ROI_53
00472 
00473   """
00474   __attrs = []
00475   # Registers
00476   for i in range(54):
00477     __attrs.append(gAttr.GattrRaw('ROI_%02d' % i, i, 4))
00478 
00479   def __init__(self, client, parent):
00480     """\brief Initialize valid registers as Gattrs.
00481     """
00482     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00483 
00484   def read(self, reg):
00485     return self.cmdrsp('GEMroiReadSync', 'slh', 'LADR_GEM', reg, '!I')
00486 
00487   def load(self, reg, value):
00488     return self.cmdrsp('GEMroiLoadSync', 'slh', 'LADR_GEM', reg, value)
00489 
00490 
00491 class GGEMIE(gDb.Gdb):
00492   """\brief GEMIE sub-node of GGEM (input enables).
00493 
00494   Has GGEMIE specific registers and dataless commands.
00495 
00496   Valid Registers:
00497   - \c towers_0_3
00498   - \c towers_4_7
00499   - \c towers_8_11
00500   - \c towers_12_15
00501   - \c acd_cno
00502   - \c tiles_000_013
00503   - \c tiles_014_032
00504   - \c tiles_033_NA3
00505   - \c tiles_100_113
00506   - \c tiles_114_NA5
00507   - \c tiles_200_213
00508   - \c tiles_214_NA7
00509   - \c tiles_300_313
00510   - \c tiles_314_NA9
00511   - \c tiles_400_413
00512   - \c tiles_414_NA1
00513   - \c tiles_500_NA10
00514   - \c tower_busy
00515 
00516   """
00517   __attrs = [
00518     # Registers
00519     gAttr.GattrRaw('towers_0_3',      0, 4),
00520     gAttr.GattrRaw('towers_4_7',      1, 4),
00521     gAttr.GattrRaw('towers_8_11',     2, 4),
00522     gAttr.GattrRaw('towers_12_15',    3, 4),
00523     gAttr.GattrRaw('acd_cno',         4, 4),
00524     gAttr.GattrRaw('tiles_000_013',   5, 4),
00525     gAttr.GattrRaw('tiles_014_032',   6, 4),
00526     gAttr.GattrRaw('tiles_033_NA3',   7, 4),
00527     gAttr.GattrRaw('tiles_100_113',   8, 4),
00528     gAttr.GattrRaw('tiles_114_NA5',   9, 4),
00529     gAttr.GattrRaw('tiles_200_213',  10, 4),
00530     gAttr.GattrRaw('tiles_214_NA7',  11, 4),
00531     gAttr.GattrRaw('tiles_300_313',  12, 4),
00532     gAttr.GattrRaw('tiles_314_NA9',  13, 4),
00533     gAttr.GattrRaw('tiles_400_413',  14, 4),
00534     gAttr.GattrRaw('tiles_414_NA1',  15, 4),
00535     gAttr.GattrRaw('tiles_500_NA10', 16, 4),
00536     gAttr.GattrRaw('tower_busy',     17, 4),
00537     ]
00538 
00539   def __init__(self, client, parent):
00540     """\brief Initialize valid registers as Gattrs.
00541 
00542     """
00543     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00544 
00545   def read(self, reg):
00546     return self.cmdrsp('GEMieReadSync', 'slh', 'LADR_GEM', reg, '!I')
00547 
00548   def load(self, reg, value):
00549     return self.cmdrsp('GEMieLoadSync', 'slh', 'LADR_GEM', reg, value)
00550 
00551 
00552 class GGEMW(gDb.Gdb):
00553   """\brief GEMW sub-node of GGEM.
00554 
00555   Has GGEMW specific registers.
00556 
00557   Valid Registers:
00558   - \c window_width
00559   - \c window_open_mask
00560   """
00561   __attrs = [
00562     # Registers
00563     gAttr.GattrRaw('window_width',      0, 4),
00564     gAttr.GattrRaw('window_open_mask',  1, 4),
00565     ]
00566 
00567   def __init__(self, client, parent):
00568     """\brief Initialize valid registers as Gattrs.
00569     """
00570     gDb.Gdb.__init__(self, client, parent, 0, self.__attrs)
00571 
00572   def read(self, reg):
00573     return self.cmdrsp('GEMwinReadSync', 'slh', 'LADR_GEM', reg, '!I')
00574 
00575   def load(self, reg, value):
00576     return self.cmdrsp('GEMwinLoadSync', 'slh', 'LADR_GEM', reg, value)

Generated on Fri Jan 21 18:00:48 2005 for LATTE P04-06-05 by doxygen 1.4.1