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 __facility__ = "Online" 00011 __abstract__ = "GLAST LAT Trigger Periodic Interface classes" 00012 __author__ = "M. Huffer <mehsys@slac.stanford.edu> SLAC - GLAST LAT Electronics" 00013 __date__ = "1/14/04" 00014 __version__ = "$Revision: 2.1 $" 00015 __release__ = "$Name: R04-12-00 $" 00016 __credits__ = "SLAC" 00017 00018 import LATTE.copyright_SLAC 00019 00020 00021 from TrgObject import TrgObject 00022 00023 00024 """TrgPeriodic: Interface for the Periodic Trigger""" 00025 00026 class TrgPeriodicConditionAbstract(TrgObject): 00027 """\brief TrgPeriodicConditionAbstract class definition 00028 """ 00029 def __init__(self): 00030 """\brief TrgPeriodicConditionAbstract constructor 00031 """ 00032 pass 00033 00034 def source(self): 00035 """\brief source() 'virtual' method 00036 If the returned value is FALSE, the system clock is used as the 00037 source of the periodic condition. If the returned value is TRUE, the 1-PPS signal is 00038 used as the source of the condition. 00039 \return A boolean 00040 """ 00041 raise NotImplementedError 00042 pass 00043 00044 def prescale(self): 00045 """\brief prescale() 'virtual' method 00046 Determines how the source signal is prescaled to form the periodic condition. 00047 That is, it sets the rate of the periodic condition. A value of zero does not prescale 00048 the periodic condition. This would, for example, assuming the system clock is 00049 used as source, create a periodic condition which operates at 20 MHZ. 00050 Range: [0 .. 0xffffff] 00051 \return An integer 00052 """ 00053 raise NotImplementedError 00054 pass 00055 00056 def limit(self): 00057 """\brief limit() 'virtual' method 00058 Returns the number of iterations of the periodic condition before 00059 the condition stops. A value of zero (0) will cause the periodic condition to 00060 'free-run', or never stop. 00061 \return An integer 00062 """ 00063 raise NotImplementedError 00064 pass 00065 00066 class TrgPeriodicCondition(TrgPeriodicConditionAbstract): 00067 """\brief Trigger Periodic Condition class definition 00068 """ 00069 00070 def __init__(self): # constructor... 00071 TrgPeriodicConditionAbstract.__init__(self) 00072 00073 def definition(self): 00074 """\brief definition() method 00075 Returns an object of type TrgPeriodicConditionDefinition. 00076 This object will be used to both define the initial values for the 00077 periodic condition and is used by the reset() function to re-establish 00078 the initial limit value. 00079 """ 00080 raise NotImplementedError 00081 pass # returns an object of type TrgPeriodicConditionDefinition 00082 00083 def remaining(self): 00084 """\brief remaining() method 00085 Returns the number of iterations remaining before the periodic condition stops. 00086 """ 00087 raise NotImplementedError 00088 pass # returns an integer... 00089 00090 def reset(self): 00091 """\brief reset() method 00092 Will cause the periodic condition to stop, regardless of how many iterations are 00093 remaining. It will re-initialize the limit function with the value returned by the 00094 limit function of. If the periodic condition is free running, this function has no 00095 effect. 00096 """ 00097 raise NotImplementedError 00098 pass # returns void... 00099 00100 def abort(self): 00101 """\brief abort() method 00102 Will cause the periodic condition to stop, regardless of how many iterations are 00103 remaining. If the periodic condition is free running, this function has no effect. 00104 """ 00105 raise NotImplementedError 00106 pass # returns void... 00107 00108 class TrgPeriodicConditionDefinition(TrgPeriodicConditionAbstract): 00109 """\brief TrgPeriodicConditionDefinition class definition 00110 """ 00111 def __init__(self): 00112 TrgPeriodicConditionAbstract.__init__(self) 00113 00114 00115 class TrgDefaultPeriodicCondition(TrgPeriodicConditionDefinition): 00116 """\brief TrgDefaultPeriodicCondition class definition 00117 """ 00118 def __init__(self): 00119 TrgPeriodicConditionDefinition.__init__(self) 00120 00121 def source(self): 00122 """\brief source() method 00123 Default is FALSE, do not use 1-PPS clock 00124 """ 00125 return False 00126 00127 def prescale(self): 00128 """\brief prescale() method 00129 Default is 0x1fffff, 10 hz periodic function 00130 """ 00131 # Generate a 10 hz periodic function 00132 # 20 Megahertz clock, 1fffff = 2e6 00133 return 0x1fffff 00134 00135 def limit(self): 00136 """\brief limit() method 00137 Default is 0, free-run the condition. 00138 """ 00139 return 0x0 00140