Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

/var/pcce/usera/hill/rcc_1.2/RodDaq/RodCrate/BocCard.h

Go to the documentation of this file.
00001 // File: BocModule.h
00002 
00003 #ifndef SCTPIXELROD_BOCCARD_H
00004 #define SCTPIXELROD_BOCCARD_H
00005 
00006 #include <iostream>
00007 
00008 #include "BocAddresses.h"
00009 #include "RodModule.h"
00010 
00011 namespace SctPixelRod {
00012 
00013 //------------------------------------------------------------------------
00014 
00015 //! BocCard: A class for setting-up etc. the BOC.
00016 
00017 /*! @class BocCard
00018  *
00019  * @brief This class contains the methods to set up a BOC. The name
00020  * BocCard was chosen because the possibly more obvious "BocModule"
00021  * implies that this class is derived from VmeModule. In fact it relies on
00022  * RodModule for the interface to the BOC.  
00023 
00024  @author John Hill (hill@hep.phy.cam.ac.uk) - originator
00025 */
00026 
00027 class BocCard
00028 {
00029 public:
00030 
00031 // Constructor and destructor
00032         BocCard(RodModule & rod );                     // Constructor
00033         ~BocCard();                                    // Destructor
00034 
00035 
00036 // Accessor methods
00037 
00038         UINT32 getSerialNumber() {return m_serialNumber;};
00039         UINT32 getManufacturer() {return m_manufacturer;};
00040         UINT32 getModuleType() {return m_moduleType;};
00041         UINT32 getHardwareRevision() {return m_hardwareRevision;};
00042         UINT32 getFirmwareRevision() {return m_firmwareRevision;};
00043         RodModule* getRod() {return m_myrod;};
00044 
00045 /*! initialize() sets the BOC into a well-defined state. Power-on should
00046  *  set the BOC into much the same state, but we may wish to do this to
00047  *  recover that state without power cycling.
00048 
00049  *  Activities:
00050  *     Reset the BOC
00051  *     Read the read-only registers
00052  *     Set clock registers
00053  *     Initialize the I2C busses by writing to each in turn
00054  *     Set 0xFF into the Rx thresholds
00055  *     Set 0x00 into the data delays, strobe delays and laser current DACs
00056  *     Reset the BPM12 chips
00057  *     Set the defaults values for the BPM12 chips (including the test
00058  *     structures).
00059 */
00060         void initialize();
00061 
00062 
00063 /*! reset() issues a BOC reset
00064 */
00065         void reset();
00066 
00067 
00068 /* status() reports the status of the BOC.
00069  * This initial version just prints the information to standard output.
00070 */
00071         void status();
00072 
00073 
00074 /*! getLaserCurrent() reads the contents of one or more Tx laser current
00075  * DACs. The method is overloaded to return either a number of consecutive
00076  * channels from a starting channel number in a buffer, or a single channel
00077  * via the method return value.
00078 */
00079         void getLaserCurrent(const UINT32 channel, UINT32 buffer[],
00080                 const UINT32 numChannels);
00081         UINT32 getLaserCurrent(const UINT32 channel);
00082 
00083 
00084 /*! setLaserCurrent() writes the contents of one or more Tx laser current
00085  * DACs. The method is overloaded to write either a number of consecutive
00086  * channels from a starting channel number, or a single channel.
00087 */
00088         void setLaserCurrent(const UINT32 channel, const UINT32 buffer[],
00089                 const UINT32 numChannels);
00090         void setLaserCurrent(const UINT32 channel, const UINT32 value);
00091 
00092 
00093 /*! getRxThreshold() reads the contents of one or more Rx threshold
00094  * DACs. The method is overloaded to return either a number of consecutive
00095  * channels from a starting channel number in a buffer, or a single channel
00096  * via the method return value.
00097 */
00098         void getRxThreshold(const UINT32 channel, UINT32 buffer[], 
00099                 const UINT32 numChannels);
00100         UINT32 getRxThreshold(const UINT32 channel);
00101 
00102 
00103 /*! setRxThreshold() writes the contents of one or more Rx threshold
00104  * DACs. The method is overloaded to write either a number of consecutive
00105  * channels from a starting channel number, or a single channel.
00106 */
00107         void setRxThreshold(const UINT32 channel, const UINT32 buffer[], 
00108                 const UINT32 numChannels);
00109         void setRxThreshold(const UINT32 channel, const UINT32 value);
00110 
00111 
00112 /*! getRxDataDelay() reads the contents of one or more Rx data delay
00113  * registers. The method is overloaded to return either a number of consecutive
00114  * channels from a starting channel number in a buffer, or a single channel
00115  * via the method return value.
00116 */
00117         void getRxDataDelay(const UINT32 channel, UINT32 buffer[],
00118                 const UINT32 numChannels);
00119         UINT32 getRxDataDelay(const UINT32 channel);
00120 
00121 
00122 /*! setRxDataDelay() writes the contents of one or more Rx data delay
00123  * registers. The method is overloaded to write either a number of consecutive
00124  * channels from a starting channel number, or a single channel.
00125 */
00126         void setRxDataDelay(const UINT32 channel, const UINT32 buffer[],
00127                 const UINT32 numChannels);
00128         void setRxDataDelay(const UINT32 channel, const UINT32 value);
00129 
00130 
00131 /*! getRxStrobeDelay() reads the contents of one or more Rx strobe delay
00132  * registers. The method is overloaded to return either a number of consecutive
00133  * channels from a starting channel number in a buffer, or a single channel
00134  * via the method return value.
00135 */
00136         void getStrobeDelay(const UINT32 channel, UINT32 buffer[],
00137                 const UINT32 numChannels);
00138         UINT32 getStrobeDelay(const UINT32 channel);
00139 
00140 
00141 /*! setRxStrobeDelay() writes the contents of one or more Rx strobe delay
00142  * registers. The method is overloaded to write either a number of consecutive
00143  * channels from a starting channel number, or a single channel.
00144 */
00145         void setStrobeDelay(const UINT32 channel, const UINT32 buffer[],
00146                 const UINT32 numChannels);
00147         void setStrobeDelay(const UINT32 channel, const UINT32 value);
00148 
00149 
00150 /*! getBpmStreamInhibit() reads the contents of one or more BPM stream inhibit
00151  * registers. The method is overloaded to return either a number of consecutive
00152  * channels from a starting channel number in a buffer, or a single channel
00153  * via the method return value. "Channel" refers to the BOC channel number -
00154  * the BPM stream number mapping is dealt with internally.
00155 */
00156         void getBpmStreamInhibit(const UINT32 channel, UINT32 buffer[],
00157                 const UINT32 numChannels);
00158         UINT32 getBpmStreamInhibit(const UINT32 channel);
00159 
00160 
00161 /*! setBpmStreamInhibit() writes the contents of one or more BPM stream inhibit
00162  * registers. The method is overloaded to write either a number of consecutive
00163  * channels from a starting channel number, or a single channel.
00164  * "Channel" refers to the BOC channel number - the BPM stream number mapping
00165  * is dealt with internally.
00166 */
00167         void setBpmStreamInhibit(const UINT32 channel, const UINT32 buffer[],
00168                 const UINT32 numChannels);
00169         void setBpmStreamInhibit(const UINT32 channel, const UINT32 value);
00170 
00171 
00172 /*! getBpmMarkSpace() reads the contents of one or more BPM mark/space
00173  * registers. The method is overloaded to return either a number of consecutive
00174  * channels from a starting channel number in a buffer, or a single channel
00175  * via the method return value. "Channel" refers to the BOC channel number -
00176  * the BPM stream number mapping is dealt with internally.
00177 */
00178         void getBpmMarkSpace(const UINT32 channel, UINT32 buffer[],
00179                 const UINT32 numChannels);
00180         UINT32 getBpmMarkSpace(const UINT32 channel);
00181 
00182 
00183 /*! setBpmMarkSpace() writes the contents of one or more BPM mark/space
00184  * registers. The method is overloaded to write either a number of consecutive
00185  * channels from a starting channel number, or a single channel.
00186  * "Channel" refers to the BOC channel number - the BPM stream number mapping
00187  * is dealt with internally.
00188 */
00189         void setBpmMarkSpace(const UINT32 channel, const UINT32 buffer[],
00190                 const UINT32 numChannels);
00191         void setBpmMarkSpace(const UINT32 channel, const UINT32 value);
00192 
00193 
00194 /*! getBpmCoarseDelay() reads the contents of one or more BPM coarse delay
00195  * registers. The method is overloaded to return either a number of consecutive
00196  * channels from a starting channel number in a buffer, or a single channel
00197  * via the method return value. "Channel" refers to the BOC channel number -
00198  * the BPM stream number mapping is dealt with internally.
00199 */
00200         void getBpmCoarseDelay(const UINT32 channel, UINT32 buffer[],
00201                 const UINT32 numChannels);
00202         UINT32 getBpmCoarseDelay(const UINT32 channel);
00203 
00204 
00205 /*! setBpmCoarseDelay() writes the contents of one or more BPM coarse delay
00206  * registers. The method is overloaded to write either a number of consecutive
00207  * channels from a starting channel number, or a single channel.
00208  * "Channel" refers to the BOC channel number - the BPM stream number mapping
00209  * is dealt with internally.
00210 */
00211         void setBpmCoarseDelay(const UINT32 channel, const UINT32 buffer[],
00212                 const UINT32 numChannels);
00213         void setBpmCoarseDelay(const UINT32 channel, const UINT32 value);
00214 
00215 
00216 /*! getBpmFineDelay() reads the contents of one or more BPM fine delay
00217  * registers. The method is overloaded to return either a number of consecutive
00218  * channels from a starting channel number in a buffer, or a single channel
00219  * via the method return value. "Channel" refers to the BOC channel number -
00220  * the BPM stream number mapping is dealt with internally.
00221 */
00222         void getBpmFineDelay(const UINT32 channel, UINT32 buffer[],
00223                 const UINT32 numChannels);
00224         UINT32 getBpmFineDelay(const UINT32 channel);
00225 
00226 
00227 /*! setBpmFineDelay() writes the contents of one or more BPM fine delay
00228  * registers. The method is overloaded to write either a number of consecutive
00229  * channels from a starting channel number, or a single channel.
00230  * "Channel" refers to the BOC channel number - the BPM stream number mapping
00231  * is dealt with internally.
00232 */
00233         void setBpmFineDelay(const UINT32 channel, const UINT32 buffer[],
00234                 const UINT32 numChannels);
00235         void setBpmFineDelay(const UINT32 channel, const UINT32 value);
00236 
00237 
00238 /*! getClockControl() reads the contents of the Clock Control register.
00239 */
00240         UINT32 getClockControl();
00241 
00242 
00243 /*! setClockControl() writes the contents of the Clock Control register.
00244 */
00245         void setClockControl(const UINT32 value);
00246 
00247 
00248 /*! getRxDataMode() reads the contents of the Data Mode register.
00249 */
00250         UINT32 getRxDataMode();
00251 
00252 
00253 /*! setRxDataMode() writes the contents of the Data Mode register.
00254 */
00255         void setRxDataMode(const UINT32 value);
00256 
00257 
00258 /*! getRxDacClear() reads the contents of the Rx Dac Clear register.
00259 */
00260         UINT32 getRxDacClear();
00261 
00262 
00263 /*! clearRxDac() clears the Rx Dac register by writing 1 followed by
00264  *  0 to the register. A method to write a specific value to the register
00265  *  is not provided, as this is not a meaningful operation for the user.
00266 */
00267         void clearRxDac();
00268 
00269 
00270 /*! getTxDacClear() reads the contents of the Tx Dac Clear register.
00271 */
00272         UINT32 getTxDacClear();
00273 
00274 
00275 /*! clearTxDac() clears the Tx Dac register by writing 1 followed by
00276  *  0 to the register. A method to write a specific value to the register
00277  *  is not provided, as this is not a meaningful operation for the user.
00278 */
00279         void clearTxDac();
00280 
00281 
00282 /*! getVernierFinePhase() reads the contents of the Vernier Fine Phase
00283  * register.
00284 */
00285         UINT32 getVernierFinePhase();
00286 
00287 
00288 /*! setVernierFinePhase() writes the contents of the Vernier Fine Phase
00289  * register.
00290 */
00291         void setVernierFinePhase(const UINT32 value);
00292 
00293 
00294 /*! getVernierClockPhase0() reads the contents of the Vernier Clock Phase
00295  * register 0. This is one of two clock phase registers allowing the user
00296  * to set a delay of up to 50 nsec.
00297 */
00298         UINT32 getVernierClockPhase0();
00299 
00300 
00301 /*! setVernierClockPhase0() writes the contents of the Vernier Clock Phase
00302  * register 0. This is one of two clock phase registers allowing the user
00303  * to set a delay of up to 50 nsec.
00304 */
00305         void setVernierClockPhase0(const UINT32 value);
00306 
00307 
00308 /*! getVernierClockPhase1() reads the contents of the Vernier Clock Phase
00309  * register 1. This is one of two clock phase registers allowing the user
00310  * to set a delay of up to 50 nsec.
00311 */
00312         UINT32 getVernierClockPhase1();
00313 
00314 
00315 /*! setVernierClockPhase1() writes the contents of the Vernier Clock Phase
00316  * register 1. This is one of two clock phase registers allowing the user
00317  * to set a delay of up to 50 nsec.
00318 */
00319         void setVernierClockPhase1(const UINT32 value);
00320 
00321 
00322 /*! getBpmClockPhase() reads the contents of the BPM Clock Phase register.
00323 */
00324         UINT32 getBpmClockPhase();
00325 
00326 
00327 /*! setBpmClockPhase() writes the contents of the BPM Clock Phase register.
00328 */
00329         void setBpmClockPhase(const UINT32 value);
00330 
00331 
00332 /*! getBregClockPhase() reads the contents of the BREG Clock Phase register.
00333 */
00334         UINT32 getBregClockPhase();
00335 
00336 
00337 /*! setBregClockPhase() writes the contents of the BREG Clock Phase register.
00338 */
00339         void setBregClockPhase(const UINT32 value);
00340 
00341 
00342 /*! getBocReset() reads the contents of the BOC Reset register.
00343 */
00344         UINT32 getBocReset();
00345 
00346 
00347 /*! resetBoc() resets the BOC by writing 1 followed by 0 to the Reset register.
00348  *  A method to write a specific value to the register is not provided as
00349  *  this would not be a useful operation.
00350 */
00351         void resetBoc();
00352 
00353 
00354 /*! getBpmReset() reads the contents of the BPM Reset register.
00355 */
00356         UINT32 getBpmReset();
00357 
00358 
00359 /*! resetBpm() resets the BPM registers on the BOC by writing 1 followed by 0 
00360  *  to the BPM Reset register. A method to write a specific value to the
00361  *  register is not provided as this would not be a useful operation.
00362 */
00363         void resetBpm();
00364 
00365 
00366 /*! getBocStatusRegister() reads the contents of the BOC Status register.
00367  *  This is a readonly register, hence there is no "set" method provided.
00368 */
00369 
00370         UINT32 getBocStatusRegister();          //Read-only register
00371 
00372 private: 
00373 
00374 
00375 //! Read and write to single BOC registers
00376         UINT32 singleRead(const UINT32 bocAddress);
00377         void singleWrite(const UINT32 bocAddress, const UINT32 value);
00378 
00379 
00380 //! Read and write to a block of BOC registers
00381         void blockRead(const UINT32 bocAddress,  UINT32 buffer[],
00382                 const INT32 length);
00383         void blockWrite(const UINT32 bocAddress,  const UINT32 buffer[],
00384                 const INT32 length);
00385 
00386 
00387 //! Read and write to BPM streams
00388         UINT32 bpmRead(const UINT32 bpm, const UINT32 stream, 
00389                 const UINT32 offset);
00390         void bpmWrite(const UINT32 bpm, const UINT32 stream, 
00391                 const UINT32 offset, const UINT32 value);
00392 
00393 
00394 //! Handle for the ROD through which this BOC is accessed.
00395         RodModule* m_myrod;
00396 
00397 
00398 //! BOC serial number (read in initialize method). Set on a pair of hex switches.
00399         UINT32 m_serialNumber;
00400 
00401 
00402 //! BOC manufacturer (read in initialize method). Should be 0xCB.
00403         UINT32 m_manufacturer;
00404 
00405 
00406 //! BOC module type (read in initialize method). Should be 0x2C.
00407         UINT32 m_moduleType;
00408 
00409 
00410 //! BOC hardware revision (read in initialize method).
00411         UINT32 m_hardwareRevision;
00412 
00413 
00414 //! BOC firmware revision (read in initialize method).
00415         UINT32 m_firmwareRevision;
00416 
00417 
00418   }; // End of class BocCard declaration
00419 
00420 
00421 }; // End namespace SctPixelRod
00422 
00423 #endif  // SCTPIXELROD_BOCCARD_H

Generated on Mon Mar 3 11:16:16 2003 for SCTPixelDAQ by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001